예제 #1
0
    function js_show_msg($a = 0)
    {
        $return = "{$GLOBALS['schedule_html']}";
        if ($GLOBALS['jsg_schedule_mark'] || jsg_getcookie('jsg_schedule')) {
            $return .= jsg_schedule();
        }
        if (($js_show_msg = $GLOBALS['js_show_msg'] ? $GLOBALS['js_show_msg'] : jsg_getcookie('js_show_msg')) && !$GLOBALS['js_show_msg_executed']) {
            $GLOBALS['js_show_msg_executed'] = 1;
            jsg_setcookie('js_show_msg', '', -311040000);
            unset($GLOBALS['js_show_msg'], $_COOKIE['js_show_msg']);
            $return .= "<script language='javascript'>\r\n            \t\$(document).ready(function(){show_message('{$js_show_msg}');});\r\n            </script>";
        }
        $return .= '<script type="text/javascript">
$(document).ready(function(){
		$("ul.imgList img, div.avatar img.lazyload").lazyload({
		skip_invisible : false,
		threshold : 200,
		effect : "fadeIn"
	});
});
</script>';
        if ($a) {
            $return = $js_show_msg;
        }
        return $return;
    }
예제 #2
0
 function Register()
 {
     if (MEMBER_ID != 0 and false == $this->IsAdmin) {
         $this->Messager('您已经是注册用户,无需再注册!', -1);
     }
     $regstatus = jsg_member_register_check_status();
     if ($regstatus['error']) {
         $this->Messager($regstatus['error'], null);
     }
     $inviter_member = array();
     $action = "index.php?mod=member&code=doregister";
     $check_result = jsg_member_register_check_invite($this->Code);
     if ($regstatus['invite_enable'] && !$regstatus['normal_enable']) {
         if (!$this->Code) {
             $this->Messager("本站目前需要有邀请链接才能注册。" . jsg_member_third_party_reg_msg(), null);
         }
         if (!$check_result) {
             $this->Messager("对不起,您访问的邀请链接不正确或者因邀请数已满而失效,请重新与邀请人索取链接。", null);
         }
     }
     if ($check_result['uid'] > 0) {
         $inviter_member = jsg_member_info($check_result['uid']);
     }
     $action .= "&invite_code=" . urlencode($this->Code);
     if (jsg_getcookie('referer') == '') {
         jsg_setcookie('referer', referer());
     }
     $noemail = 0;
     if ($this->_sms_register()) {
         $sms_bind_num = $this->Post['sms_bind_num'] ? $this->Post['sms_bind_num'] : $this->Get['sms_bind_num'];
         if (!sms_is_phone($sms_bind_num)) {
             $action = "index.php?mod=member&invite_code=" . urlencode($this->Code);
             $this->Title = "请输入您的手机号码";
             include template('member_register_sms');
             return;
         } else {
             if (($_user_info = _sms_client_user($sms_bind_num)) && $_user_info['uid']) {
                 $this->Messager('此手机号已经绑定了其他的帐号');
             }
             if ($_user_info['bind_key_time'] + 60 > time()) {
                 $this->Messager('60秒内仅发送一次,请稍候再试');
             }
             $bind_key = mt_rand(100000, 999999);
             $sets = array('user_im' => $sms_bind_num, 'bind_key' => $bind_key, 'bind_key_time' => time());
             sms_client_user_update($sets, $_user_info);
             $sms_msg = "您的验证码为 {$bind_key}";
             $sms_msg = array_iconv('UTF-8', $this->Config['charset'], $sms_msg);
             sms_send($sms_bind_num, $sms_msg, 0);
         }
         $noemail = jconf::get('sms', 'register_verify', 'noemail');
     }
     $action = "index.php?mod=member&code=doregister&invite_code=" . urlencode($this->Code);
     $this->Title = "注册新用户";
     include template('member_register');
 }
예제 #3
0
 function login()
 {
     if (!XWB_plugin::pCfg('is_account_binding')) {
         XWB_plugin::showError('新浪微博绑定功能已经关闭!');
     }
     if (jsg_getcookie("referer") == "") {
         jsg_setcookie("referer", referer('?', 1));
     }
     $aurl = $this->_getOAuthUrl();
     $sess = XWB_plugin::getUser();
     //$sess->clearToken();
     $sess->setInfo('waiting_site_bind', 1);
     XWB_plugin::redirect($aurl, 3);
 }
예제 #4
0
function schedule_html($id = 0)
{
    $return = '';
    $jsg_schedules = array();
    if ($id > 0) {
        $jsg_schedules[$id] = $id;
    } else {
        if ($GLOBALS['jsg_schedule']) {
            $jsg_schedules = (array) $GLOBALS['jsg_schedule'];
        }
        if (($_jsg_schedules = jsg_getcookie('jsg_schedule')) && ($__jsg_schedules = explode(",", $_jsg_schedules))) {
            $__jsg_schedules = (array) $__jsg_schedules;
            foreach ($__jsg_schedules as $id) {
                $jsg_schedules[$id] = $id;
            }
        }
        _schedule_destory();
    }
    if (!$GLOBALS['__jsg_schedules']) {
        $query = DB::query("select `id` from " . TABLE_PREFIX . "schedule order by `id` desc limit 100");
        while ($row = DB::fetch($query)) {
            $jsg_schedules[$row['id']] = $row['id'];
        }
    }
    if ($jsg_schedules) {
        settype($jsg_schedules, 'array');
        $sys_config = jconf::get();
        $html = '';
        foreach ($jsg_schedules as $id) {
            $id = is_numeric($id) ? $id : 0;
            if ($id > 0 && !isset($GLOBALS['__jsg_schedules'][$id])) {
                $GLOBALS['__jsg_schedules'][$id] = $id;
                $url = "{$sys_config['site_url']}/ajax.php?mod=schedule&code=execute&uninitmember=1&id={$id}";
                $html .= "<img src='{$url}' border='0' width='0' height='0' />";
            }
        }
        if ($html) {
            $return = "<span style='display:none;'>{$html}</span>";
        }
    }
    return $return;
}
예제 #5
0
 function DoLogin()
 {
     $this->Username = wap_iconv($this->Username, 'utf-8', $this->Config['charset'], 1);
     $this->Password = wap_iconv($this->Password, 'utf-8', $this->Config['charset'], 1);
     if ($this->Username == "" || $this->Password == "") {
         $this->Messager("无法登录,用户名或密码不能为空", 'index.php?mod=login');
     }
     $username = $this->Username;
     $password = $this->Password;
     if ($this->Config['reg_email_verify'] == '1') {
         $member_info = DB::fetch_first("select `uid`,`username` from " . DB::table('members') . " where `username`='{$username}' limit 0,1");
         if ($member_info) {
             $member_validate = DB::fetch_first("select `uid`,`status` from " . DB::table('member_validate') . " where `uid`='{$member_info['uid']}' ");
         }
         if ($member_validate) {
             if ($member_validate['status'] != '1') {
                 $this->Messager("必须完成邮件激活,才能正常访问!进入注册时填写的邮箱激活即可。", 'index.php?mod=login');
             }
         }
     }
     $referer = jget('referer');
     if (!$referer) {
         $referer = jsg_getcookie('referer');
     }
     $rets = jsg_member_login($username, $password);
     if ($rets['uid'] < 1) {
         $this->Messager(wap_iconv($rets['error']), null);
     }
     $uid = $rets['uid'];
     if ($this->Config['extcredits_enable'] && $rets['uid'] > 0) {
         update_credits_by_action('login', $rets['uid']);
     }
     $redirecto = $referer ? $referer : referer('index.php');
     if (strpos($redirecto, 'login') !== false) {
         $redirecto = "index.php?mod=topic&code=myhome";
     }
     if ($this->Post['loginType'] == 'share') {
         $redirecto = $this->Post['return_url'];
     }
     $this->Messager('登录成功', $redirecto, 0);
 }
?>
,
'simUploadLimit' : 1,
'scriptData'	 : {
<?php 
if ($attach_uploadify_topic_uid) {
    ?>
'topic_uid'  : '<?php 
    echo $attach_uploadify_topic_uid;
    ?>
',
<?php 
}
?>
'cookie_auth': '<?php 
echo urlencode(jsg_getcookie("auth"));
?>
'
},
'onSelect'		 : function(event, ID, fileObj) {
//修改选择的分类参数
$('#publisher_file_attach<?php 
echo $attach_uploadify_id;
?>
').uploadifySettings('scriptData', {attch_category:$("[name=attch_category]").val()});
},
'onSelectOnce'	 : function (event, data) {
attachUploadifySelectOnce<?php 
echo $attach_uploadify_id;
?>
();			    	
예제 #7
0
 function UpdateSessions()
 {
     if (jsg_getcookie('sid') == '' || $this->sid != jsg_getcookie('sid')) {
         $this->setSessionId($this->sid);
     }
     $uid = MEMBER_ID;
     $timestamp = TIMESTAMP;
     $member = $this->MemberFields;
     $member['slastactivity'] = $timestamp;
     $member['action'] = (int) $this->CurrentAction['id'];
     if ($this->SessionExists) {
         if ($member['action'] > 0 && $member['action'] != $this->MemberFields['action'] || $timestamp - $this->MemberFields['slastactivity'] > 900) {
             if ($uid > 0 || !$this->no_record_guest) {
                 DB::query("UPDATE " . DB::table('sessions') . " SET `action`='{$member['action']}', `slastactivity`='{$member['slastactivity']}' WHERE `sid`='{$this->sid}'");
             }
         }
     } else {
         $onlinehold = 3600;
         $ip = $GLOBALS['_J']['client_ip'];
         if ($uid > 0 || !$this->no_record_guest) {
             $ips = explode('.', $ip);
             $sql = "DELETE FROM `" . TABLE_PREFIX . "sessions`\r\n\t\t\t\tWHERE\r\n\t\t\t\t\t`sid`='{$this->sid}'\r\n\t\t\t\t\tOR `slastactivity`<'" . ($timestamp - $onlinehold) . "'\r\n\t\t\t\t\tOR ('" . $uid . "'<>'0' AND `uid`='" . $uid . "')\r\n\t\t\t\t\tOR (`uid`='0' AND `ip1`='{$ips['0']}' AND `ip2`='{$ips['1']}' AND `ip3`='{$ips['2']}' AND `ip4`='{$ips['3']}' AND `slastactivity`>'" . ($timestamp - 60) . "')";
             DB::query($sql, 'SILENT');
             DB::query("REPLACE INTO " . DB::table('sessions') . "\r\n\t\t\t\t\tSET `sid`='{$this->sid}', `ip1`='{$ips[0]}', `ip2`='{$ips[1]}', `ip3`='{$ips[2]}', `ip4`='{$ips[3]}',\r\n\t\t\t\t\t`uid`='{$member['uid']}', `action`='{$member['action']}', `slastactivity`='{$member['slastactivity']}'", 'SILENT');
         }
         if ($uid > 0) {
             if ($ip != $this->MemberFields['lastip'] || $timestamp - $this->MemberFields['lastactivity'] > $onlinehold) {
                 $sql = "\r\n\t\t\t\t\tUPDATE\r\n\t\t\t\t\t\t" . TABLE_PREFIX . 'members' . "\r\n\t\t\t\t\tSET\r\n\t\t\t\t\t\tlastip='{$ip}',\r\n\t\t\t\t\t\tlast_ip_port='{$GLOBALS['_J']['client_ip_port']}',\r\n\t\t\t\t\t\tlastactivity='{$timestamp}'\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\tuid='" . $uid . "'";
                 DB::query($sql, 'SILENT');
             }
             if ($ip != $this->MemberFields['lastip'] || date('Ymd', $this->MemberFields['lastactivity']) != date('Ymd', $timestamp)) {
                 jsg_login_log();
             }
         }
     }
 }
예제 #8
0
}
?>
 <?php 
if ($checkUser) {
    ?>
 <span style='display:none;'><img src='<?php 
    echo $GLOBALS['_J']['config']['site_url'];
    ?>
/ajax.php?mod=misc&code=checkuser' border='0' width='0' height='0' /></span> <?php 
}
?>
 <?php 
echo $GLOBALS['schedule_html'];
?>
 <?php 
if ($GLOBALS['jsg_schedule_mark'] || jsg_getcookie('jsg_schedule')) {
    echo jsg_schedule();
}
?>
 <div id="ajax_output_area"></div> <?php 
$_web_info = jconf::get('web_info');
?>
 <?php 
if ($_web_info['float_align'] && $_web_info['float_align'] != 'none') {
    ?>
 <?php 
    if ($_web_info['float_style'] == 'mini') {
        ?>
 <?php 
        $fs_mini = '';
        $fs_normal = 'display:none;';
예제 #9
0
 function DoLogin()
 {
     if (!$this->Username) {
         $this->Messager("无法登录,用户名或密码不能为空");
     }
     if ('' == $this->Password) {
         $this->Messager("无法登录,用户名或密码不能为空");
     }
     $loginperm = $this->_logincheck();
     if (!$loginperm) {
         $this->Messager("累计 5 次错误尝试,15 分钟内您将不能登录。", null);
     }
     $rets = $UserFields = array();
     $rets = jsg_member_login_check($this->Username, $this->Password);
     if ($rets['uid'] > 0) {
         $UserFields = jsg_member_login_set_status($rets['uid']);
     }
     if ($rets['uid'] < 1 || !$UserFields) {
         $this->Messager("无法登录,用户名或密码错误,您可以有至多 5 次尝试。", -1);
     }
     if ('normal' == $UserFields['role_type']) {
         $this->Messager("普通用户组成员无权登录后台", null);
     }
     $this->_loginfailed(3);
     if (!$this->Config['close_second_verify_enable']) {
         $authcode = authcode("{$UserFields['password']}\t{$UserFields['uid']}", 'ENCODE', $this->jsgAuthKey);
         jsg_setcookie('jsgAuth', $authcode);
     }
     $referer = jsg_getcookie('referer');
     if (!trim($referer)) {
         $referer = referer($this->Config['site_url'] . '/admin.php');
     }
     $this->Messager("登录成功,正在进入后台", $referer);
 }
예제 #10
0
 function Register()
 {
     if (MEMBER_ID > 0 && false == $this->IsAdmin) {
         $this->Messager('您已经是注册用户,无需再注册!', -1);
     }
     $regstatus = jsg_member_register_check_status();
     if ($regstatus['error']) {
         $this->Messager($regstatus['error'], null);
     }
     $inviter_member = array();
     $action = "index.php?mod=member&code=doregister";
     $check_result = jsg_member_register_check_invite($this->Code);
     if ($regstatus['invite_enable'] && !$regstatus['normal_enable']) {
         if (!$this->Code) {
             $this->Messager("本站目前需要有邀请链接才能注册。" . jsg_member_third_party_reg_msg(), null);
         }
         if (!$check_result) {
             $this->Messager("对不起,您访问的邀请链接不正确或者因邀请数已满而失效,请重新与邀请人索取链接。", null);
         }
     }
     if ($check_result['uid'] > 0) {
         $inviter_member = jsg_member_info($check_result['uid']);
     }
     $action .= "&invite_code=" . urlencode($this->Code);
     $referer = jget('referer');
     if (jsg_getcookie('referer') == '') {
         jsg_setcookie('referer', $referer);
     }
     $noemail = 0;
     if ($this->_sms_register()) {
         $noemail = jconf::get('sms', 'register_verify', 'noemail');
     }
     $email = '';
     $_email = get_param('email');
     if (false != jclass('passport')->_is_email($_email)) {
         $email = $_email;
     }
     $this->Title = "注册新用户";
     include template('register/register_member');
 }
예제 #11
0
 function MasterObject(&$config)
 {
     require_once ROOT_PATH . 'mobile/include/func/mobile.func.php';
     $config['client_type'] = '';
     $user_agent = $_SERVER['HTTP_USER_AGENT'];
     if (empty($user_agent)) {
         exit('Access Denied');
     }
     $pc_browser = false;
     if (preg_match("/android/i", $user_agent)) {
         $config['client_type'] = "android";
     } else {
         if (preg_match("/iphone/i", $user_agent)) {
             $config['client_type'] = "iphone";
         } else {
             $pc_browser = true;
         }
     }
     $config['is_mobile_client'] = false;
     if (isset($_GET['JSG_SESSION']) && isset($_GET['iv']) && isset($_GET['app_key']) && isset($_GET['app_secret']) && isset($_GET['bt'])) {
         $config['is_mobile_client'] = true;
         define("IS_MOBILE_CLIENT", true);
     }
     define("CLIENT_TYPE", $config['client_type']);
     $config['sys_version'] = sys_version();
     $config['sys_published'] = SYS_PUBLISHED;
     if (!$config['mobile_url']) {
         $config['mobile_url'] = $config['site_url'] . "/mobile";
     }
     if (!$config['topic_length']) {
         $config['topic_length'] = 140;
     }
     $this->Config = $config;
     $this->Config = array_merge($this->Config, Mobile::config());
     define("CHARSET", $this->Config['charset']);
     Obj::register('config', $this->Config);
     $this->Get =& $_GET;
     $this->Post =& $_POST;
     $this->Module = trim($this->Post['mod'] ? $this->Post['mod'] : $this->Get['mod']);
     $this->Code = trim($this->Post['code'] ? $this->Post['code'] : $this->Get['code']);
     $this->DatabaseHandler =& Obj::registry('DatabaseHandler');
     $uid = 0;
     $password = '';
     $authcode = '';
     $implicit_pass = true;
     if (!empty($this->Get['JSG_SESSION']) && $config['is_mobile_client']) {
         $authcode = $this->Get['JSG_SESSION'];
         $authcode = rawurldecode($authcode);
         $implicit_pass = false;
     } else {
         $authcode = jsg_getcookie('auth');
     }
     if (!empty($authcode)) {
         list($password, $uid) = explode("\t", authcode($authcode, 'DECODE'));
     }
     $this->MemberHandler = jclass('member');
     $MemberFields = $this->MemberHandler->FetchMember($uid, $password);
     if ($this->MemberHandler->HasPermission($this->Module, $this->Code) == false) {
         Mobile::show_message(411);
         exit;
     }
     if (!in_array($this->Module, array('member', 'login', 'wechat'))) {
         $visit_rets = $this->MemberHandler->visit();
         if ($visit_rets['error']) {
             Mobile::show_message(411);
             exit;
         }
     }
     $this->Title = $this->MemberHandler->CurrentAction['name'];
     Obj::register("MemberHandler", $this->MemberHandler);
     $rets = jsg_member_login_extract();
     if ($rets) {
         if (MEMBER_ID < 1) {
             $func = $rets['login_direct'];
         } else {
             $func = $rets['logout_direct'];
         }
         if ($func && function_exists($func)) {
             $ret = $func();
         }
     }
     if (MEMBER_ID > 0) {
         jsg_member_login_set_status($MemberFields);
     }
     if ($this->Config['extcredits_enable']) {
         if (MEMBER_ID > 0 && jsg_getcookie('login_credits') + 3600 < time()) {
             update_credits_by_action('login', MEMBER_ID);
             jsg_setcookie('login_credits', time(), 3600);
         }
     }
 }
예제 #12
0
 function DoLogin()
 {
     if ($this->Config['seccode_enable'] == 1 && $this->Config['seccode_login']) {
         if (!ckseccode(@$_POST['seccode'])) {
             $this->Messager("验证码输入错误", -1);
         }
     } elseif ($this->Config['seccode_enable'] > 1 && $this->Config['seccode_login'] && $this->yxm_title && $this->Config['seccode_pub_key'] && $this->Config['seccode_pri_key']) {
         $YinXiangMa_response = jlogic('seccode')->CheckYXM(@$_POST['YinXiangMa_challenge'], @$_POST['YXM_level'][0], @$_POST['YXM_input_result']);
         if ($YinXiangMa_response != "true") {
             $this->Messager("验证码输入错误", -1);
         }
     }
     if ($this->Username == "" || $this->Password == "") {
         $this->Messager("无法登录,用户名或密码不能为空", -1);
     }
     $username = $this->Username;
     $password = $this->Password;
     $referer = jget('referer');
     if (!$referer) {
         $referer = jsg_getcookie('referer');
     }
     $rets = jsg_member_login($username, $password);
     $uid = (int) $rets['uid'];
     if ($uid < 1) {
         $this->Messager($rets['error'], null);
     }
     $member = jsg_member_info(MEMBER_ID);
     $this->Config['reg_email_verify'] == 1 && $member['email_checked'] == 0 && ($referer = 'index.php?mod=member&code=setverify&ids=' . $uid);
     $this->Config['email_must_be_true'] == 2 && $member['email_checked'] == 0 && ($referer = 'index.php?mod=member&code=setverify&ids=' . $uid);
     if ($this->Config['extcredits_enable'] && $uid > 0) {
         update_credits_by_action('login', $uid);
     }
     Load::logic('other');
     $otherLogic = new OtherLogic();
     $sql = "SELECT m.id as medal_id,m.medal_img,m.medal_name,m.medal_depict,m.conditions,u.dateline,y.apply_id\r\n\t\t\t\tFROM " . TABLE_PREFIX . "medal m\r\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "user_medal u ON (u.medalid = m.id AND u.uid = '{$uid}')\r\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "medal_apply y ON (y.medal_id = m.id AND y.uid = '{$uid}')\r\n\t\t\t\tWHERE m.is_open = 1\r\n\t\t\t\tORDER BY u.dateline DESC,m.id";
     $query = $this->DatabaseHandler->Query($sql);
     while (false != ($rs = $query->GetRow())) {
         $rs['conditions'] = unserialize($rs['conditions']);
         if (in_array($rs['conditions']['type'], array('topic', 'reply', 'tag', 'invite', 'fans', 'sign')) && !$rs['dateline']) {
             $result .= $otherLogic->autoCheckMedal($rs['medal_id'], $uid);
         }
     }
     $redirecto = $referer ? $referer : referer();
     $redirecto = str_replace('#', '', $redirecto);
     if ($this->Post['loginType'] == 'share') {
         $redirecto = $this->Post['return_url'];
         $this->Messager(null, $redirecto, 0);
     }
     if ($this->Post['loginType'] == 'show_login') {
         $this->Messager(NULL, $redirecto, 0);
     }
     if ($rets['uc_syn_html']) {
         $this->Messager("登录成功{$rets['uc_syn_html']}", $redirecto, 3);
     } else {
         $this->Messager(null, $redirecto);
     }
 }
예제 #13
0
function ckseccode($seccode)
{
    $check = true;
    $c = jsg_getcookie('seccode');
    $cookie_seccode = empty($c) ? '' : authcode($c, 'DECODE');
    if (empty($cookie_seccode) || strtolower($cookie_seccode) != strtolower($seccode)) {
        $check = false;
    }
    return $check;
}
예제 #14
0
 function _init_qqwb()
 {
     if ($this->Config['qqwb_enable'] && qqwb_init($this->Config)) {
         if (!session_id()) {
             session_start();
         }
         $this->QQWBConfig = jconf::get('qqwb');
         require_once ROOT_PATH . 'include/ext/qqwb/oauth.php';
         $rto = jsg_getcookie('referer');
         $rto = $rto ? $rto : $this->Config['site_url'] . '/index.php';
         $this->redirect_to = $rto;
         if (MEMBER_ID > 0 && 'POST' == $_SERVER['REQUEST_METHOD']) {
             $this->_update();
         }
     } else {
         $this->Messager("整合腾讯微博的功能未启用,请联系管理员开启", null);
     }
 }
예제 #15
0
 function Login2()
 {
     $username = trim(jget('username'));
     $password = jget('password');
     if ($username == "" || $password == "") {
         json_error("无法登录,用户名或密码不能为空");
     }
     if ($GLOBALS['_J']['plugins']['func']['login']) {
         hookscript('login', 'funcs', array('param' => $this->Post, 'step' => 'check'), 'login');
     }
     $referer = jget('referer');
     if (!$referer) {
         $referer = jsg_getcookie('referer');
     }
     $rets = jsg_member_login($username, $password);
     $uid = (int) $rets['uid'];
     if ($uid < 1) {
         json_error($rets['error']);
     }
     $member = jsg_member_info($uid);
     $this->Config['email_must_be_true'] == 2 && $member['email_checked'] == 0 && ($referer = 'index.php?mod=member&code=setverify&ids=' . $uid);
     if ($this->Config['extcredits_enable'] && $uid > 0) {
         update_credits_by_action('login', $uid);
     }
     Load::logic('other');
     $otherLogic = new OtherLogic();
     $sql = "SELECT m.id as medal_id,m.medal_img,m.medal_name,m.medal_depict,m.conditions,u.dateline,y.apply_id\r\n\t\t\t\tFROM " . TABLE_PREFIX . "medal m\r\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "user_medal u ON (u.medalid = m.id AND u.uid = '{$uid}')\r\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "medal_apply y ON (y.medal_id = m.id AND y.uid = '{$uid}')\r\n\t\t\t\tWHERE m.is_open = 1\r\n\t\t\t\tORDER BY u.dateline DESC,m.id";
     $query = $this->DatabaseHandler->Query($sql);
     while (false != ($rs = $query->GetRow())) {
         $rs['conditions'] = unserialize($rs['conditions']);
         if (in_array($rs['conditions']['type'], array('topic', 'reply', 'tag', 'invite', 'fans')) && !$rs['dateline']) {
             $result .= $otherLogic->autoCheckMedal($rs['medal_id'], $uid);
         }
     }
     header("location:mobile/index.php");
 }
예제 #16
0
    function Main()
    {
        $code_ary = array('myblog', 'myhome', 'tag', 'qun', 'recd', 'other', 'bbs', 'cms', 'department', 'company', 'channel', 'topicnew', 'bcj');
        if (!in_array($this->Code, $code_ary)) {
            $tos = array('new' => 'index.php?mod=plaza', 'tc' => 'index.php?mod=plaza&code=new_tc', 'hotreply' => 'index.php?mod=plaza&code=hot_reply', 'hotforward' => 'index.php?mod=plaza&code=hot_forward', 'newreply' => 'index.php?mod=plaza&code=new_reply', 'newforward' => 'index.php?mod=plaza&code=new_forward', 'top' => 'index.php?mod=top&code=member', 'channellogin' => 'index.php?mod=channel');
            if (isset($tos[$this->Code])) {
                $this->Messager(null, $tos[$this->Code]);
                exit;
            }
            unset($this->Code);
        }
        $channel_enable = jconf::get('channel') ? true : false;
        $content_dstr = $this->Config['in_publish_notice_str'];
        $content_ostr = $this->Config['on_publish_notice_str'];
        if ('topic' == trim($this->Get['mod']) && empty($this->Get['code']) && empty($this->Get['mod_original'])) {
            if (MEMBER_ID > 0) {
                if ($this->Config['topic_home_page']) {
                    $this->Messager(null, $this->Config['topic_home_page']);
                } else {
                    $this->Code = 'myhome';
                }
            } else {
                $this->Messager('请<a onclick="ShowLoginDialog();return false;" title="快捷登录" rel="nofollow" href="index.php?mod=login" >点此登录</a>,
					或<a href="index.php?mod=member">点此注册</a>一个帐号', null);
                return;
            }
        }
        $member = $this->_member();
        if (!$member) {
            $this->Messager('请<a onclick="ShowLoginDialog();return false;" title="快捷登录" rel="nofollow" href="index.php?mod=login" >点此登录</a>,
					或<a href="index.php?mod=member">点此注册</a>一个帐号', null);
            return false;
        }
        $title = '';
        $per_page_num = 20;
        $topic_uids = $topic_ids = $order_list = $where_list = $params = array();
        $where = $order = $limit = "";
        $cache_time = 0;
        $cache_key = '';
        $options = array();
        $gets = array('mod' => $_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module, 'code' => $this->Code, 'type' => $this->Get['type'], 'gid' => $this->Get['gid'], 'qid' => $this->Get['qid'], 'chid' => $this->Get['chid'], 'view' => $this->Get['view'], 'filter' => $this->Get['filter'], 'orderby' => $this->Get['orderby']);
        $options['page_url'] = "index.php?" . url_implode($gets);
        unset($gets['type']);
        $type_url = "index.php?" . url_implode($gets);
        $params['uid'] = $uid = $member['uid'];
        $is_personal = $uid == MEMBER_ID;
        $params['is_personal'] = $is_personal;
        $params['code'] = $this->Code;
        if (!in_array($params['code'], $code_ary)) {
            $params['code'] = 'myblog';
        }
        $page_str = $params['code'];
        if ($params['code'] == 'bbs' || $params['code'] == 'cms') {
            $page_str = 'myhome';
        }
        if (($show_topic_num = (int) $this->ShowConfig['topic'][$page_str]) > 0) {
            $per_page_num = $show_topic_num;
        }
        $options['perpage'] = $per_page_num;
        $groupname = '';
        $groupid = 0;
        $TopicListLogic = jlogic('topic_list');
        #if NEDU
        if (defined('NEDU_MOYO')) {
            nui('jsg')->cindex($this, $params, $topic_list_get);
        }
        #endif
        $sendMail = false;
        $checkUser = false;
        if ($this->Config['sendmailday'] > 0) {
            if (!jsg_getcookie('mail_cookie')) {
                jsg_setcookie('mail_cookie', TIMESTAMP, 300);
                $sendMail = true;
            }
            if (!jsg_getcookie('check_user')) {
                jsg_setcookie('check_user', TIMESTAMP, 86400);
                $checkUser = true;
            }
        }
        $tpl = 'topic_index';
        if ('myhome' == $params['code']) {
            $tpl = 'topic_myhome';
            $topic_selected = 'myhome';
            $type = get_param('type');
            if ($type && !in_array($type, array('pic', 'video', 'music', 'vote', 'event'))) {
                $type = '';
            }
            if ($type) {
                $params['type'] = $type;
            }
            $gid = max(0, (int) get_param('gid'));
            if ($gid) {
                $params['gid'] = $gid;
            }
            $topic_myhome_time_limit = 0;
            if ($this->Config['topic_myhome_time_limit'] > 0) {
                $topic_myhome_time_limit = TIMESTAMP - $this->Config['topic_myhome_time_limit'] * 86400;
                if ($topic_myhome_time_limit > 0) {
                    $options['dateline'] = $topic_myhome_time_limit;
                }
            }
            $options['uid'] = array($member['uid']);
            if ($member['uid'] == MEMBER_ID) {
                $cache_time = 600;
                $cache_key = "{$member['uid']}-topic-myhome-{$type}-{$gid}";
                $title = '我的首页';
                $refresh_time = max(30, (int) $this->Config['ajax_topic_time']);
                if (get_param('page') < 2 && $member['lastactivity'] + $refresh_time < TIMESTAMP) {
                    $new_topic = jlogic('buddy')->check_new_topic($uid, 1);
                    if ($new_topic > 0) {
                        cache_db('rm', "{$uid}-topic-%", 1);
                    }
                }
                if ($gid) {
                    $group_info = jtable('buddy_follow_group')->info($gid);
                    if (empty($group_info) || MEMBER_ID != $group_info['uid']) {
                        $this->Messager("当前分组不存在", 'index.php?mod=myhome');
                    }
                    $query_link = "index.php?mod=" . ($_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module) . ($this->Code ? "&code={$this->Code}&type={$this->Get['type']}&gid={$this->Get['gid']}" : "");
                    if ($group_info['count'] > 0) {
                        $g_view_uids = jtable('buddy_follow_group_relation')->get_my_group_uids(MEMBER_ID, $gid);
                    }
                    $groupid = $gid;
                    $groupname = $group_info['name'];
                    if ($g_view_uids) {
                        $options['uid'] = $g_view_uids;
                    } else {
                        $this->Messager("没有设置用户,无法查看这个组的微博", 'index.php?mod=topic&code=group&gid=' . $gid);
                    }
                    $active[$gid] = "current";
                } else {
                    if ($type || false === cache_db('get', $cache_key)) {
                        $buddyids = get_buddyids($params['uid'], $this->Config['topic_myhome_time_limit']);
                        if ($buddyids) {
                            $options['uid'] = array_merge($options['uid'], $buddyids);
                        }
                    }
                    $active['all'] = "current";
                }
            } else {
                $title = "{$member['nickname']}的微博";
                $this->_initTheme($member);
            }
            if ($type) {
                $getTypeTidReturn = $TopicListLogic->GetTypeTid($type, $options['uid'], $options);
                $options['tid'] = $getTypeTidReturn['tid'];
                $options['count'] = $getTypeTidReturn['count'];
                $options['limit'] = $per_page_num;
            }
        } else {
            if ('channel' == $params['code'] && $this->Channel_enable && $this->Config['channel_enable']) {
                $viewtype = jget('view');
                $ch_id = jget('cid');
                $title = '我的频道微博';
                if ($member['uid'] != MEMBER_ID) {
                    $this->Messager("您无权查看该页面", null);
                }
                jlogic('member')->clean_new_remind('channel_new', MEMBER_ID);
                $orderby = in_array($this->Get['orderby'], array('post', 'dig', 'mark', 'ldig', 'top')) ? $this->Get['orderby'] : 'dig';
                $ChannelLogic = jlogic('channel');
                $my_buddy_channel = $ChannelLogic->mychannel();
                $cachefile = jconf::get('channel');
                $channel_channels = $cachefile['channels'];
                $channel_ids = array();
                if (empty($my_buddy_channel)) {
                    $channel_ids = array(0);
                } else {
                    $my_chs = array_keys($my_buddy_channel);
                    foreach ($my_chs as $val) {
                        $channel_ids = array_merge($channel_ids, (array) $channel_channels[$val]);
                    }
                    if (is_array($channel_ids)) {
                        $channel_ids = array_unique($channel_ids);
                    }
                }
                $my_cannot_view_chids = jlogic('channel')->get_my_cannot_view_chids();
                if ($my_cannot_view_chids) {
                    foreach ($channel_ids as $key => $val) {
                        if (in_array($val, $my_cannot_view_chids)) {
                            unset($channel_ids[$key]);
                        }
                    }
                }
                $options['item'] = 'channel';
                $options['item_id'] = $channel_ids;
                $options['type'] = array('first', 'channel');
                if ($orderby == 'mark') {
                    $order = ' lastupdate DESC';
                } elseif ($orderby == 'dig') {
                    $order = ' lastdigtime DESC';
                } elseif ($orderby == 'ldig') {
                    $order = ' digcounts DESC,lastdigtime DESC';
                } else {
                    $order = ' dateline DESC';
                }
                $options['order'] = $order;
                if ($orderby == 'top') {
                    $where = $channel_ids ? "tr.item = 'channel' AND tr.item_id IN(" . implode(",", $channel_ids) . ")" : "tr.item = 'channel'";
                    $options = array('where' => $where, 'perpage' => $per_page_num);
                    $info = $TopicListLogic->get_recd_list($options);
                    if (!empty($info)) {
                        $total_record = $info['count'];
                        $topic_list = $info['list'];
                        $page_arr = $info['page'];
                    }
                    $topic_list_get = true;
                }
            } else {
                if ('company' == $params['code'] && $this->Config['company_enable'] && @is_file(ROOT_PATH . 'include/logic/cp.logic.php')) {
                    $title = '我的单位微博';
                    if ($member['companyid'] < 1) {
                        $this->Messager("您还不属于任何" . $d_c_name . ",请先加入某个" . $d_c_name . "!", 'index.php?mod=settings&code=base');
                    }
                    jlogic('member')->clean_new_remind('company_new', MEMBER_ID);
                    $viewtype = jget('view');
                    $options['uid'] = jlogic('cp')->getcpuids('company', $member['companyid']);
                    if ($viewtype == 'secret') {
                        $options['type'] = 'company';
                    }
                } else {
                    if ('bcj' == $params['code'] && $this->Channel_enable && $this->Config['channel_enable']) {
                        $ch_id = jget('cid', 'int');
                        $featureid = jget('view', 'int');
                        if ($ch_id == 3) {
                            $title = '建议';
                        } elseif ($ch_id == 2) {
                            $title = '提问';
                        } else {
                            $title = '资讯';
                            if (!in_array($ch_id, array('4', '6'))) {
                                $ch_id = 5;
                            }
                        }
                        if (!in_array($featureid, array('1', '2', '3'))) {
                            $featureid = 0;
                        }
                        $options['item'] = 'channel';
                        $options['item_id'] = $ch_id;
                        $my_cannot_view_chids = jlogic('channel')->get_my_cannot_view_chids();
                        if ($my_cannot_view_chids && in_array($ch_id, $my_cannot_view_chids)) {
                            $forbidden_view = true;
                            $options['tid'] = 0;
                        }
                        if (isset($_GET['view'])) {
                            $options['where'] = " featureid = '{$featureid}' ";
                        }
                        $options['page_url'] .= "&cid={$ch_id}";
                    } else {
                        if ('department' == $params['code']) {
                            $tpl = 'topic_department';
                            $title = ($this->Config['default_department'] ? $this->Config['default_department'] : '部门') . '微博';
                            if ($member['uid'] != MEMBER_ID) {
                                $this->Messager("您无权查看该页面", null);
                            }
                            if (!($this->Config['department_enable'] && @is_file(ROOT_PATH . 'include/logic/cp.logic.php'))) {
                                $this->Messager("网站没有开启该功能", null);
                            }
                            $views = array('all', 'my', 'other');
                            $view = trim($this->Get['view']);
                            if (!in_array($view, $views)) {
                                $view = 'other';
                            }
                            $active[$view] = 'current';
                            $dids = array();
                            if ($member['departmentid'] > 0) {
                                if ($view == 'my') {
                                    $dids[] = $member['departmentid'];
                                } else {
                                    $sql = "select did\tfrom `" . TABLE_PREFIX . "buddy_department` where `uid`='" . MEMBER_ID . "'";
                                    $query = $this->DatabaseHandler->Query($sql);
                                    while (false != ($row = $query->GetRow())) {
                                        $dids[] = $row['did'];
                                    }
                                    if ($view == 'all') {
                                        $dids[] = $member['departmentid'];
                                    }
                                }
                            }
                            if ($dids) {
                                $sql = "select `uid` from `" . TABLE_PREFIX . "members` where  `departmentid` in(" . jimplode($dids) . ")";
                                $query = $this->DatabaseHandler->Query($sql);
                                $options['uid'] = array();
                                while (false != ($row = $query->GetRow())) {
                                    $options['uid'][] = $row['uid'];
                                }
                                if (false != ($type = $this->Get['type']) && 'all' != $type) {
                                    $options['tid'] = $TopicListLogic->GetTypeTid($type, $options['uid']);
                                }
                            } else {
                                $options['tid'] = array();
                            }
                            if ($member['departmentid']) {
                                $department = DB::fetch_first("SELECT * FROM " . DB::table('department') . " WHERE id='" . $member['departmentid'] . "'");
                            }
                            $user_lp = $this->TopicLogic->GetMember(array($department['leaderid'], $department['managerid']), "`uid`,`ucuid`,`username`,`nickname`,`face`,`face_url`,`validate`,`validate_category`,`aboutme`");
                            $mybuddys = (array) get_buddyids(MEMBER_ID);
                            $user_l = $user_lp[$department['leaderid']];
                            if ($user_l) {
                                $user_l['here_name'] = $department['leadername'];
                                $user_l['follow_html'] = follow_html2($department['leaderid'], in_array($department['leaderid'], $mybuddys));
                                $leader_list[] = $user_l;
                            }
                            $user_m = $user_lp[$department['managerid']];
                            if ($user_m) {
                                $user_m['here_name'] = $department['managername'];
                                $user_m['follow_html'] = follow_html2($department['managerid'], in_array($department['managerid'], $mybuddys));
                                $manager_list[] = $user_m;
                            }
                            $CpLogic = jlogic('cp');
                            $department_list = $CpLogic->Getdepartment($member['companyid'], $member['departmentid']);
                        } else {
                            if ('tag' == $params['code']) {
                                $tpl = 'topic_tag';
                                $title = '我关注的话题';
                                if ($member['uid'] != MEMBER_ID) {
                                    $this->Messager("您无权查看该页面", null);
                                }
                                $views = array('new', 'new_reply', 'my_reply', 'recd');
                                $view = trim($this->Get['view']);
                                if (!in_array($view, $views)) {
                                    $view = 'new';
                                }
                                $active[$view] = 'current';
                                $tag_ids = jlogic('tag_favorite')->my_favorite_tag_ids(MEMBER_ID);
                                if ($tag_ids) {
                                    if ('new' == $view) {
                                        $p = $options;
                                        $p['tag_id'] = $tag_ids;
                                        $p['sql_order'] = ' `item_id` DESC ';
                                        $rets = jtable('topic_tag')->get_ids($p, 'item_id', 1);
                                        $topic_list_get = true;
                                        $total_record = $rets['count'];
                                        $page_arr = $rets['page'];
                                        $topic_list = $total_record > 0 && $rets['ids'] ? $this->TopicLogic->Get($rets['ids']) : array();
                                    } else {
                                        $sql = "select `item_id` from `" . TABLE_PREFIX . "topic_tag` where  `tag_id` in('" . implode("','", $tag_ids) . "') ORDER BY `item_id` DESC LIMIT 2000 ";
                                        $query = $this->DatabaseHandler->Query($sql);
                                        $topic_ids = array();
                                        while (false != ($row = $query->GetRow())) {
                                            $topic_ids[$row['item_id']] = $row['item_id'];
                                        }
                                        $options['tid'] = $topic_ids;
                                        unset($topic_ids);
                                    }
                                    if ($this->Get['type']) {
                                        $options['filter'] = $this->Get['type'];
                                    }
                                    if ($view == 'new_reply') {
                                        $options['where'] = " replys>0 ";
                                        $options['order'] = " lastupdate DESC ";
                                    } else {
                                        if ($view == 'recd') {
                                            $p = array('where' => " tr.recd >= 1 AND tr.item='tag' AND tr.item_id IN(" . jimplode($tag_ids) . ") ", 'perpage' => 10, 'filter' => $this->Get['type']);
                                            $info = $TopicListLogic->get_recd_list($p);
                                            if (!empty($info)) {
                                                $total_record = $info['count'];
                                                $topic_list = $info['list'];
                                                $page_arr = $info['page'];
                                            }
                                            $topic_list_get = true;
                                        }
                                    }
                                } else {
                                    $topic_list_get = true;
                                }
                                if ($GLOBALS['_J']['member']['topic_new']) {
                                    jlogic('member')->clean_new_remind('topic_new', MEMBER_ID);
                                }
                            } else {
                                if ('myblog' == $params['code']) {
                                    $this->myblog_no_recommend = TRUE;
                                    $tpl = 'topic_myblog';
                                    $where = " 1 ";
                                    $options['uid'] = array($member['uid']);
                                    if ($this->Get['type']) {
                                        if ('profile' == $this->Get['type']) {
                                            $title = $member['gender_ta'] . '的资料';
                                            $type = 'profile';
                                            #用户填写的自定义添加项
                                            $member_profile = jlogic('member_profile')->getMemberProfileInfo($member['uid']);
                                            if ($member_profile) {
                                                $member = array_merge($member, $member_profile);
                                            }
                                            #用户自定义添加项的可见度
                                            $memberProfileSet = jlogic('member_profile')->getMemberProfileSet($member['uid']);
                                            $member_info = $member;
                                            if ($member_info['gender']) {
                                                if ($member_info['gender'] == 1) {
                                                    $member_info['gender'] = '男';
                                                } elseif ($member_info['gender'] == 2) {
                                                    $member_info['gender'] = '女';
                                                }
                                            }
                                            if ($member_info['bday']) {
                                                $bdayInt = strtotime($member_info['bday']);
                                                if (!$bdayInt) {
                                                    unset($member_info['bday']);
                                                }
                                            }
                                            $member_info = array_filter($member_info);
                                            $groupProfile = jconf::get('groupprofile');
                                            foreach ($groupProfile as $key_p => $group_p) {
                                                $keys_p = array_keys($group_p['list']);
                                                foreach ($keys_p as $key_one) {
                                                    if ($member_info[$key_one]) {
                                                        $groupProfile[$key_p]['isProfile'] = true;
                                                    }
                                                    continue;
                                                }
                                            }
                                        }
                                        if ('album' == $this->Get['type']) {
                                            $this->Title = ($member['uid'] == MEMBER_ID ? '我' : $member['nickname']) . '的相册';
                                            $nav_url = $this->Title;
                                            $uid = $member['uid'];
                                            $imgid = jget('pid');
                                            if (isset($_GET['aid'])) {
                                                $albumid = jget('aid');
                                                $list_type = 'image';
                                                $albumname = jlogic('image')->getalbumname($albumid, 0, 0, $uid);
                                                if ($albumid > 0 && $albumname) {
                                                    if (!jlogic('image')->checkalbumbyid($albumid)) {
                                                        $this->Messager("您没有权限浏览该相册", null);
                                                    }
                                                    $count = jlogic('image')->albumimgnums($albumid, 1);
                                                    $albuminfo = jlogic('image')->getalbumbyid('album', $albumid);
                                                    if ($count != $albuminfo['picnum']) {
                                                        jlogic('image')->update_album_picnum($albumid, $count);
                                                    }
                                                } else {
                                                    $count = jlogic('image')->albumimgnums(0, 0, $uid);
                                                }
                                                $albumname = $albumname ? $albumname : ($albumid > 0 ? '错误页面' : '默认相册');
                                                $pernum = 9;
                                                $pagehtml = page($count, $pernum, 'index.php?mod=' . $member['username'] . '&type=album&aid=' . $albumid, array('return' => 'array'));
                                                $limit_sql = $pagehtml['limit'];
                                                if ($albumid > 0) {
                                                    $myalbums = jlogic('image')->getallalbumimg($albumid, $limit_sql, 1);
                                                } else {
                                                    $myalbums = jlogic('image')->getallalbumimg(0, $limit_sql, 0, $uid);
                                                }
                                                foreach ($myalbums as $key => $val) {
                                                    $myalbums[$key]['pic'] = $val['site_url'] . str_replace('./', '/', str_replace('_o.jpg', '_s.jpg', $val['photo']));
                                                    $myalbums[$key]['albumname'] = $val['description'] ? cut_str($val['description'], 18) : '';
                                                    $myalbums[$key]['title'] = $val['description'];
                                                    $myalbums[$key]['url'] = jurl('index.php?mod=' . $member['username'] . '&type=album&pid=' . $val['id']);
                                                    $myalbums[$key]['rel'] = $val['photo'] ? $val['site_url'] . '/' . str_replace('./', '', $val['photo']) : '';
                                                }
                                                $nav_url = '<a href="index.php?mod=' . $member['username'] . '&type=album">' . $this->Title . '</a> >> ' . $albumname;
                                            } elseif ($imgid > 0) {
                                                $content_ostr = '';
                                                $type = 'album';
                                                $infos = jlogic('image')->get_uploadimg_byid($imgid, $uid);
                                                $imginfo = $infos[$imgid];
                                                if (!$imginfo) {
                                                    $this->Messager("不存在该图片", null);
                                                }
                                                if ($imginfo['albumid'] > 0 && !jlogic('image')->checkalbumbyid($imginfo['albumid'])) {
                                                    $this->Messager("您没有权限浏览该图片", null);
                                                }
                                                $imginfo['photo'] = $imginfo['site_url'] . '/' . str_replace('./', '', $imginfo['photo']);
                                                $albumname = $imginfo['albumid'] > 0 ? jlogic('image')->get_albumname_byid($imginfo['albumid']) : '默认相册';
                                                $imgname = $imginfo['description'] ? cut_str($imginfo['description'], 18) : $imginfo['name'];
                                                $imgwidth = $imginfo['width'] > 580 ? 580 : $imginfo['width'];
                                                $imgheight = $imginfo['width'] > 580 ? ceil($imginfo['height'] / $imginfo['width'] * 580) : $imginfo['height'];
                                                $imgsize = $imginfo['filesize'] > 0 ? $imginfo['filesize'] < 1024 * 100 ? round($imginfo['filesize'] / 1024, 1) . 'K' : round($imginfo['filesize'] / (1024 * 1024), 1) . 'M' : '未知';
                                                $imgtime = my_date_format($imginfo['dateline']);
                                                $imgfrom = $imginfo['tid'] > 0 ? '<a href="' . jurl('index.php?mod=topic&code=' . $imginfo['tid']) . '">微博</a>' : ($imginfo['tid'] < 0 ? '私信' : '相册');
                                                $this->item = 'topic_image';
                                                $this->item_id = $imgid;
                                                $albumid = $imginfo['albumid'];
                                                $h_key = 'album';
                                                $gets = array('mod' => $member['username'], 'type' => 'album', 'pid' => $imgid);
                                                $page_url = 'index.php?' . url_implode($gets);
                                                $tids = jlogic('image')->get_topic_by_imageid($imgid);
                                                $options = array('tid' => $tids, 'perpage' => 5, 'page_url' => $page_url);
                                                $topic_info = jlogic('topic_list')->get_data($options);
                                                $topic_list = array();
                                                if (!empty($topic_info)) {
                                                    $topic_list = $topic_info['list'];
                                                    $page_arr['html'] = $topic_info['page']['html'];
                                                }
                                                $albums = jlogic('image')->getalbum();
                                                $nav_url = '<a href="index.php?mod=' . $member['username'] . '&type=album">' . $this->Title . '</a> >> <a href="index.php?mod=' . $member['username'] . '&type=album&aid=' . ($imginfo['albumid'] > 0 ? $imginfo['albumid'] : 0) . '">' . $albumname . '</a> >> ' . ($imgname ? $imgname : '图片浏览');
                                            } else {
                                                $list_type = 'album';
                                                $count = jlogic('image')->albumnums(1, $uid);
                                                $pernum = 8;
                                                $pagehtml = page($count, $pernum, 'index.php?mod=' . $member['username'] . '&type=album', array('return' => 'array'));
                                                $limit_sql = $pagehtml['limit'];
                                                $myalbums = jlogic('image')->getalbum($limit_sql, 1, $uid);
                                                $myalbums[0] = array('albumid' => 0, 'albumname' => '默认相册');
                                                $purview_name = $member['uid'] == MEMBER_ID ? '我' : $member['gender_ta'];
                                                $purviewtext = array(0 => '所有人可见', 1 => '仅' . $purview_name . '关注的人可见', 2 => '仅' . $purview_name . '的粉丝可见', 3 => '仅' . $purview_name . '自己可见');
                                                foreach ($myalbums as $key => $val) {
                                                    $myalbums[$key]['pic'] = $val['pic'] ? str_replace('_o.jpg', '_s.jpg', $val['pic']) : 'images/noavatar.gif';
                                                    $myalbums[$key]['albumname'] = cut_str($val['albumname'], 18);
                                                    $myalbums[$key]['title'] = $val['depict'] ? $val['depict'] : $val['albumname'];
                                                    $myalbums[$key]['url'] = jurl('index.php?mod=' . $member['username'] . '&type=album&aid=' . $val['albumid']);
                                                    $myalbums[$key]['id'] = $val['albumid'];
                                                    $myalbums[$key]['purview'] = $purviewtext[$val['purview']];
                                                }
                                            }
                                        }
                                        if ('mycomment' == $this->Get['type']) {
                                            $title = '评论' . $member['gender_ta'] . '的';
                                            if ($member['uid'] < 1) {
                                                $this->Messager("您无权查看该页面", null);
                                            }
                                            if ($member['comment_new']) {
                                                jlogic('member')->clean_new_remind('comment_new', $member['uid']);
                                            }
                                            $topic_selected = 'mycomment';
                                            $_rets = jtable('member_relation')->get_tids($member['uid'], array('perpage' => $per_page_num), 1);
                                            if ($_rets) {
                                                $topic_list = $this->TopicLogic->Get($_rets['ids']);
                                                $total_record = $_rets['count'];
                                                $page_arr = $_rets['page'];
                                                unset($_rets);
                                            }
                                            $topic_list_get = true;
                                        }
                                        if ('tocomment' == $this->Get['type']) {
                                            $tpl = 'topic_myblog';
                                            $title = $member['gender_ta'] . '评论的';
                                            $topic_selected = 'mycomment';
                                            unset($options['uid']);
                                            $options['where'] = "`uid` = '{$member['uid']}' and `type` in ('both','reply')";
                                        }
                                        if ('vote' == $this->Get['type']) {
                                            $type = 'vote';
                                            $tpl = 'topic_vote';
                                            $perpage = $this->ShowConfig['vote']['list'];
                                            $perpage = empty($perpage) ? 20 : $perpage;
                                            $vote_where = ' 1 ';
                                            $filter = get_param('filter');
                                            if ($filter == 'joined') {
                                                $vids = jlogic('vote')->get_joined($member['uid']);
                                                if (!empty($vids)) {
                                                    $vote_where .= " AND `v`.`vid` IN(" . jimplode($vids) . ") ";
                                                } else {
                                                    $vote_where = ' 0 ';
                                                }
                                            } else {
                                                if ($filter == 'new_update') {
                                                    jlogic('member')->clean_new_remind('vote_new', $uid);
                                                    $vids = jlogic('vote')->get_joined($uid);
                                                    if (!empty($vids)) {
                                                        $vote_where .= " AND `v`.`vid` IN(" . jimplode($vids) . ") ";
                                                    }
                                                    $vote_where .= " OR `v`.`uid`='{$uid}' ";
                                                } else {
                                                    $vote_where .= " AND `v`.`uid`='{$uid}' ";
                                                    $filter = 'created';
                                                }
                                            }
                                            $vote_order_sql = ' ORDER BY lastvote DESC ';
                                            $vote_where .= " AND v.verify = 1";
                                            $param = array('where' => $vote_where, 'order' => $vote_order_sql, 'page' => true, 'perpage' => $perpage, 'page_url' => $options['page_url']);
                                            $vote_info = jlogic('vote')->find($param);
                                            $count = 0;
                                            $vote_list = array();
                                            $page_arr['html'] = '';
                                            $uid_ary = array();
                                            if (!empty($vote_info)) {
                                                $count = $vote_info['count'];
                                                $vote_list = $vote_info['vote_list'];
                                                $page_arr['html'] = $vote_info['page']['html'];
                                                $uid_ary = $vote_info['uids'];
                                            }
                                            if (!empty($uid_ary)) {
                                                $members = $this->TopicLogic->GetMember($uid_ary);
                                            }
                                            $topic_list_get = true;
                                        }
                                        if ('event' == $this->Get['type']) {
                                            $type = 'event';
                                            $tpl = 'topic_event';
                                            $filter = get_param('filter');
                                            $param = array('perpage' => "10", 'page' => true);
                                            $return = array();
                                            if ($filter == 'joined') {
                                                $this->Title = $member['nickname'] . "参与的活动";
                                                $param['where'] = " m.play = 1 and m.fid = '{$uid}' ";
                                                $param['order'] = " order by a.lasttime desc,a.app_num desc,a.posttime desc ";
                                                $param['page_url'] = $options['page_url'];
                                                $return = jlogic('event')->getEvents($param);
                                            } else {
                                                if ($filter == 'new_update') {
                                                    jlogic('member')->clean_new_remind('event_new', $uid);
                                                    $this->Title = "最近更新的活动";
                                                    $param['uid'] = $uid;
                                                    $param['page_url'] = $options['page_url'];
                                                    $return = jlogic('event')->getNewEvent($param);
                                                } else {
                                                    $filter = 'created';
                                                    $this->Title = $member['nickname'] . "的活动";
                                                    $param['where'] = " a.postman = '{$uid}' and a.verify = 1 ";
                                                    $param['order'] = " order by a.lasttime desc,a.app_num desc,a.posttime desc ";
                                                    $param['page_url'] = $options['page_url'];
                                                    $return = jlogic('event')->getEventInfo($param);
                                                }
                                            }
                                            $rs = $return['event_list'];
                                            $count = $return['count'];
                                            $page_arr = $return['page'];
                                            $topic_list_get = true;
                                        }
                                        if ('my_reply' == $this->Get['type']) {
                                            $title = $member['gender_ta'] . '评论的';
                                            if ($member['uid'] != MEMBER_ID) {
                                                $this->Messager("您无权查看该页面", null);
                                            }
                                        }
                                        if ('mydig' == $this->Get['type']) {
                                            if ($member['dig_new']) {
                                                jlogic('member')->clean_new_remind('dig_new', $member['uid']);
                                            }
                                        }
                                        if (in_array($this->Get['type'], array('pic', 'video', 'music', 'attach', 'mydig', 'mydigout', 'my_reply'))) {
                                            if ($this->Get['follow'] && 'my_reply' != $this->Get['type']) {
                                                $buddyids = get_buddyids($params['uid'], $this->Config['topic_myhome_time_limit']);
                                                if ($buddyids) {
                                                    $options['uid'] = $buddyids;
                                                }
                                            }
                                            $type = $dtype = $this->Get['type'];
                                            $options['get_list'] = 1;
                                            $getTypeTidReturn = $TopicListLogic->GetTypeTid($dtype, $options['uid'], $options);
                                            if (isset($getTypeTidReturn['list'])) {
                                                $topic_list = $getTypeTidReturn['list'];
                                                $total_record = $getTypeTidReturn['count'];
                                                $page_arr = $getTypeTidReturn['page'];
                                                $topic_list_get = true;
                                            } else {
                                                $options['tid'] = $getTypeTidReturn['tid'];
                                                $options['count'] = $getTypeTidReturn['count'];
                                                $options['limit'] = $per_page_num;
                                                if ($type == 'mydigout') {
                                                    $options['uid'] = array();
                                                }
                                                if ($type == 'mydig' || $type == 'mydigout') {
                                                    $options['order'] = ' lastdigtime DESC ';
                                                }
                                            }
                                        }
                                        if ('forward' == $this->Get['type'] || 'first' == $this->Get['type']) {
                                            $p = $options;
                                            $p['type'] = 'forward';
                                            if ('first' == $this->Get['type']) {
                                                $p['type'] = 'first';
                                            }
                                            $p['sql_order'] = ' `forwards` DESC, `dateline` DESC ';
                                            if (!$p['sql_order']) {
                                                $p['sql_order'] = ' `dateline` DESC ';
                                            }
                                            $_rets = jtable('member_topic')->get_tids($member['uid'], $p, 1);
                                            $total_record = $_rets['count'];
                                            $page_arr = $_rets['page'];
                                            $topic_list = $this->TopicLogic->Get($_rets['ids']);
                                            $topic_list_get = true;
                                        }
                                        if ('my_verify' == $this->Get['type']) {
                                            $title = '审核中的微博';
                                            if ('admin' != MEMBER_ROLE_TYPE) {
                                                if ($member['uid'] != MEMBER_ID) {
                                                    $this->Messager("您无权查看该页面", -1);
                                                }
                                            }
                                            $sql = "select count(*) as `total_record` from `" . TABLE_PREFIX . "topic_verify` where managetype = 0";
                                            $total_record = DB::result_first($sql);
                                            $page_arr = page($total_record, $per_page_num, $query_link, array('return' => "Array"));
                                            $sql = "select v.*\r\n\t\t\t\t\t\t\tfrom `" . TABLE_PREFIX . "topic_verify` v\r\n\r\n\t\t\t\t\t\t\twhere v.uid='{$uid}'\r\n\t\t\t\t\t\t\tand v.managetype = 0\r\n\t\t\t\t\t\t\torder by v.lastupdate desc {$page_arr['limit']}";
                                            $query = $this->DatabaseHandler->Query($sql);
                                            while (false != ($row = $query->GetRow())) {
                                                if ($row['id'] < 1) {
                                                    continue;
                                                }
                                                $row['tid'] = $row['id'];
                                                if ($row['longtextid']) {
                                                    $row['content'] = jlogic('longtext')->longtext($row['longtextid']);
                                                    unset($row['content2'], $row['longtextid']);
                                                }
                                                $topic_list[$row['id']] = $row;
                                            }
                                            $topic_list = $this->TopicLogic->MakeAll($topic_list);
                                            $topic_list_get = true;
                                        }
                                    }
                                    if ($this->Config['channel_enable']) {
                                        $myBuddyChannel = jlogic('channel')->mychannel($member['uid']);
                                    }
                                    $dateline = TIMESTAMP - 2592000;
                                    if (empty($this->Get['type']) || in_array($this->Get['type'], array('hot_reply', 'hot_forward', 'hot_dig'))) {
                                        $p = $options;
                                        $p['type'] = array('first', 'forward', 'both');
                                        if ($this->Get['type']) {
                                            if ('hot_reply' == $this->Get['type']) {
                                                $p['>@replys'] = 0;
                                                $p['>@dateline'] = $dateline;
                                                $p['sql_order'] = ' `replys` DESC, `dateline` DESC ';
                                            } elseif ('hot_forward' == $this->Get['type']) {
                                                $p['>@forwards'] = 0;
                                                $p['>@dateline'] = $dateline;
                                                $p['sql_order'] = ' `forwards` DESC, `dateline` DESC ';
                                            } elseif ('hot_dig' == $this->Get['type']) {
                                                $p['>@digcounts'] = 0;
                                                $p['>@dateline'] = $dateline;
                                                $p['sql_order'] = ' `digcounts` DESC, `dateline` DESC ';
                                            }
                                        }
                                        if (!$p['sql_order']) {
                                            $p['sql_order'] = ' `dateline` DESC ';
                                        }
                                        $_rets = jtable('member_topic')->get_tids($member['uid'], $p, 1);
                                        $total_record = $_rets['count'];
                                        $page_arr = $_rets['page'];
                                        $topic_list = $this->TopicLogic->Get($_rets['ids']);
                                        $topic_list_get = true;
                                        $credit = jconf::get('credits');
                                        foreach ($credit['ext'] as $key => $value) {
                                            $member['jifen'] .= $value['name'] . ':' . $member[$key] . ' ';
                                        }
                                        $title = '个人主页';
                                        foreach ($topic_list as $key => $val) {
                                            if ($val[uid] == 0 && $val['anonymous_data'][uid] != MEMBER_ID) {
                                                unset($topic_list[$key]);
                                            }
                                        }
                                    } elseif ($this->Get['type'] == 'search' && trim($this->Get['q'])) {
                                        $_rets = jtable('topic')->get_ids(array('uid' => $member['uid'], 'like@content' => '%' . trim(jget('q')) . '%', 'sql_order' => '`dateline` desc', 'page_num' => 10), 'tid', 1);
                                        $total_record = $_rets['count'];
                                        $page_arr = $_rets['page'];
                                        $topic_list = $this->TopicLogic->Get($_rets['ids']);
                                        $topic_list_get = true;
                                    }
                                    if ($member['uid'] != MEMBER_ID) {
                                        $title = "{$member['nickname']}的微博";
                                        $list_blacklist = is_blacklist($member['uid'], MEMBER_ID);
                                        $fg_code = 'hisblog';
                                        $this->_initTheme($member);
                                    } else {
                                        $title = '我的微博';
                                        $this->MetaKeywords = "{$member['nickname']}的微博";
                                    }
                                    $buddys = array();
                                    if (MEMBER_ID > 0 && $member['uid'] != MEMBER_ID) {
                                        $buddys = jlogic('buddy')->info($member['uid'], MEMBER_ID);
                                        $buddys['id'] = $buddys['touid'];
                                    }
                                } else {
                                    if ('qun' == $params['code']) {
                                        $tpl = 'topic_qun';
                                        $title = "我的" . $this->Config[changeword][weiqun];
                                        $qun_setting = $this->Config['qun_setting'];
                                        if (!$qun_setting['qun_open']) {
                                            $this->Messager("当前站点没有开放" . $this->Config[changeword][weiqun] . "功能", null);
                                        }
                                        if (0 != $GLOBALS['_J']['member']['qun_new']) {
                                            jlogic('member')->clean_new_remind('qun_new', MEMBER_ID);
                                        }
                                        $views = array('new', 'new_reply', 'my_reply', 'recd');
                                        $view = trim($this->Get['view']);
                                        if (!in_array($view, $views)) {
                                            $view = 'new';
                                        }
                                        $active[$view] = "current";
                                        $u = MEMBER_ID;
                                        if (false === ($my_qun_ids = cache_db('get', $cache_id = 'topic/' . $u . '-my_qun_ids'))) {
                                            $my_qun_ids = jtable('qun_user')->get_ids(array('uid' => $u), 'qid', 1);
                                            cache_db('set', $cache_id, $my_qun_ids, 300);
                                        }
                                        $qid_ary = $my_qun_ids['ids'];
                                        $join_qun_count = $my_qun_ids['count'];
                                        $qun_name = '';
                                        if (!empty($qid_ary) && $join_qun_count > 0) {
                                            $where_sql = " 1 ";
                                            $order_sql = " t.dateline DESC ";
                                            $jget_type = jget('type', 'txt');
                                            $jget_type = in_array($type, array('pic', 'video', 'music', 'vote')) ? $jget_type : '';
                                            if ($jget_type) {
                                                if ('pic' == $jget_type) {
                                                    $where_sql .= " AND t.`imageid` > 0 ";
                                                } else {
                                                    if ('video' == $jget_type) {
                                                        $where_sql .= " AND t.`videoid` > 0 ";
                                                    } else {
                                                        if ('music' == $jget_type) {
                                                            $where_sql .= " AND t.`musicid` > 0 ";
                                                        } else {
                                                            if ('vote' == $jget_type) {
                                                                $where_sql .= " AND t.item='vote' ";
                                                            } else {
                                                                $jget_type = '';
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            $topic_get_flg = false;
                                            if ($view == 'new') {
                                                $where_sql .= " AND tq.item_id IN(" . jimplode($qid_ary) . ") ";
                                            } else {
                                                if ($view == 'new_reply') {
                                                    $where_sql .= " AND tq.item_id IN(" . jimplode($qid_ary) . ") AND t.replys>0 ";
                                                    $order_sql = " t.lastupdate DESC ";
                                                } else {
                                                    if ($view == 'recd') {
                                                        $p = array('where' => " tr.recd >= 1 AND tr.item='qun' AND tr.item_id IN(" . jimplode($qid_ary) . ") ", 'perpage' => $options['perpage'], 'filter' => $this->Get['type']);
                                                        $info = $TopicListLogic->get_recd_list($p);
                                                        if (!empty($info)) {
                                                            $total_record = $info['count'];
                                                            $topic_list = $info['list'];
                                                            $page_arr = $info['page'];
                                                        }
                                                        $topic_get_flg = true;
                                                    }
                                                }
                                            }
                                            if (!$topic_get_flg) {
                                                $total_record = DB::result_first("SELECT COUNT(*)\r\n\t\t\t\t\t\t\t\t\t\t\t   FROM " . DB::table('topic') . " AS t\r\n\t\t\t\t\t\t\t\t\t\t\t   LEFT JOIN " . DB::table('topic_qun') . " AS tq\r\n\t\t\t\t\t\t\t\t\t\t\t   USING(tid)\r\n\t\t\t\t\t\t\t\t\t\t\t   WHERE {$where_sql}");
                                                if ($total_record > 0) {
                                                    $page_arr = page($total_record, $options['perpage'], $options['page_url'], array('return' => 'array'));
                                                    $query = DB::query("SELECT t.*\r\n\t\t\t\t\t\t\t\t\t\t\tFROM " . DB::table('topic') . " AS t\r\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN " . DB::table('topic_qun') . " AS tq\r\n\t\t\t\t\t\t\t\t\t\t\tUSING(tid)\r\n\t\t\t\t\t\t\t\t\t\t\tWHERE {$where_sql}\r\n\t\t\t\t\t\t\t\t\t\t\tORDER BY {$order_sql}\r\n\t\t\t\t\t\t\t\t\t\t\t{$page_arr['limit']} ");
                                                    $topic_list = array();
                                                    while ($row = DB::fetch($query)) {
                                                        $topic_list[$row['tid']] = $row;
                                                    }
                                                    $topic_list = $this->TopicLogic->MakeAll($topic_list);
                                                }
                                            }
                                            if (0 != $GLOBALS['_J']['member']['qun_new']) {
                                                jlogic('member')->clean_new_remind('qun_new', MEMBER_ID);
                                            }
                                        }
                                        $showConfig = $this->ShowConfig;
                                        $recd_qun_limit = (int) $showConfig['page_r']['recd_qun'];
                                        if ($recd_qun_limit) {
                                            $cache_id = 'topic/hot_qun-' . $recd_qun_limit;
                                            if (false === ($hot_qun = cache_file('get', $cache_id))) {
                                                $sql = "select * from `" . TABLE_PREFIX . "qun`  where `recd` = 1 order by `member_num` desc limit {$recd_qun_limit}  ";
                                                $query = $this->DatabaseHandler->Query($sql);
                                                $hot_qun = array();
                                                $qunLogic = jlogic('qun');
                                                while (false != ($row = $query->GetRow())) {
                                                    $row['icon'] = $qunLogic->qun_avatar($row['qid'], 's');
                                                    $hot_qun[] = $row;
                                                }
                                                cache_file('set', $cache_id, $hot_qun, 3600);
                                            }
                                        }
                                        $topic_list_get = true;
                                    } else {
                                        if ('recd' == $params['code']) {
                                            $title = "官方推荐";
                                            $view = trim($this->Get['view']);
                                            $where_sql = '';
                                            if ($view == 'new_reply') {
                                                $where_sql = ' AND t.replys>0 ';
                                            } else {
                                                $view = 'all';
                                            }
                                            $active[$view] = 'current';
                                            $p = array('where' => ' tr.recd > 0 ' . $where_sql, 'perpage' => $options['perpage'], 'filter' => $this->Get['type']);
                                            $info = $TopicListLogic->get_recd_list($p);
                                            if (!empty($info)) {
                                                $total_record = $info['count'];
                                                $topic_list = $info['list'];
                                                $page_arr = $info['page'];
                                            }
                                            $topic_list_get = true;
                                        } else {
                                            if ('cms' == $params['code']) {
                                                $title = "网站资讯";
                                                $param = array('perpage' => $options['perpage'], 'page_url' => $options['page_url']);
                                                $view = 'all';
                                                $active[$view] = 'current';
                                                $info = array();
                                                if ($this->Config['dedecms_enable'] && jconf::get('dedecms')) {
                                                    Load::logic("topic_cms");
                                                    $TopicCmsLogic = new TopicCmsLogic();
                                                    $info = $TopicCmsLogic->get_cms($param);
                                                    $cms_url = CMS_API_URL;
                                                }
                                                if (!empty($info)) {
                                                    $total_record = $info['count'];
                                                    $topic_list = $info['list'];
                                                    $page_arr = $info['page'];
                                                }
                                                $topic_list_get = true;
                                            } else {
                                                if ('bbs' == $params['code']) {
                                                    $title = "我的论坛";
                                                    $view = trim($this->Get['view']);
                                                    $where_sql = '';
                                                    if ($view == 'favorites') {
                                                        $where_sql = 'favorites';
                                                    } else {
                                                        if ($view == 'favorite') {
                                                            $where_sql = 'favorite';
                                                        } else {
                                                            if ($view == 'thread') {
                                                                $where_sql = 'thread';
                                                            } else {
                                                                if ($view == 'reply') {
                                                                    $where_sql = 'reply';
                                                                } else {
                                                                    if ($view == 'all') {
                                                                        $where_sql = 'all';
                                                                    } else {
                                                                        if ($this->Config['dzbbs_enable']) {
                                                                            $view = 'favorites';
                                                                            $where_sql = 'favorites';
                                                                        } else {
                                                                            $view = 'all';
                                                                            $where_sql = 'all';
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                    $active[$view] = 'current';
                                                    $info = array();
                                                    $param = array('where' => $where_sql, 'perpage' => $options['perpage'], 'page_url' => $options['page_url']);
                                                    if ($this->Config['dzbbs_enable'] && jconf::get('dzbbs') || $this->Config['phpwind_enable'] && $this->Config['pwbbs_enable'] && jconf::get('phpwind')) {
                                                        Load::logic("topic_bbs");
                                                        $TopicBbsLogic = new TopicBbsLogic();
                                                        $info = $TopicBbsLogic->get_bbs($param);
                                                        $bbs_url = BBS_API_URL;
                                                    }
                                                    if (!empty($info)) {
                                                        $total_record = $info['count'];
                                                        $topic_list = $info['list'];
                                                        $page_arr = $info['page'];
                                                    }
                                                    $topic_list_get = true;
                                                } else {
                                                    if ('topicnew' == $params['code']) {
                                                        $title = '最新内容';
                                                        $options['where'] = '';
                                                        $params['orderby'] = $orderby = in_array($this->Get['orderby'], array('post', 'dig', 'mark')) ? $this->Get['orderby'] : 'dig';
                                                        if ($orderby == 'mark') {
                                                            $order = ' `lastupdate` DESC';
                                                        } elseif ($orderby == 'dig') {
                                                            $order = ' `lastdigtime` DESC';
                                                        } else {
                                                            $options['type'] = array('first', 'forward', 'both');
                                                            $order = ' `dateline` DESC';
                                                        }
                                                        $options['order'] = $order;
                                                        if ($this->Get["date"] && strtotime($this->Get["date"]) > 0) {
                                                            $dateline = strtotime($this->Get["date"]);
                                                            $options['where'] .= " `dateline` > '" . $dateline . "' and `dateline`<'" . ($dateline + 86400) . "'";
                                                        } else {
                                                            $this->Get["date"] = date("Y-m-d", TIMESTAMP);
                                                        }
                                                        if (empty($options['type'])) {
                                                            $options['type'] = get_topic_type();
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        if (!$topic_list_get) {
            if ($cache_time > 0 && !$options['tid']) {
                $cache_key = $cache_key ? $cache_key : "{$member['uid']}-topic-{$params['code']}-{$params['type']}-{$params['gid']}-{$params['qid']}-{$params['view']}";
                $options = $TopicListLogic->get_options($options, $cache_time, $cache_key);
            }
            $info = $TopicListLogic->get_data($options);
            $topic_list = array();
            $total_record = 0;
            if (!empty($info)) {
                $topic_list = $info['list'];
                $total_record = $info['count'];
                if ($info['page']) {
                    $page_arr = $info['page'];
                } else {
                    $page_arr = $getTypeTidReturn['page'];
                }
            }
        }
        $topic_list_count = 0;
        if ($topic_list) {
            if ($GLOBALS['_J']['config']['is_topic_user_follow'] && !$GLOBALS['_J']['disable_user_follow']) {
                $topic_list = jlogic('buddy')->follow_html2($topic_list);
            }
            $topic_list_count = count($topic_list);
            if (!$topic_parent_disable && ('bbs' != $this->Code || 'cms' != $this->Code)) {
                $parent_list = $this->TopicLogic->GetParentTopic($topic_list, 'mycomment' == $this->Code);
            }
            $relate_list = $this->TopicLogic->GetRelateTopic($topic_list);
        }
        if (!in_array($params['code'], array('bbs', 'cms'))) {
            $ajaxkey = array();
            $ajaxnum = 10;
            if (count($topic_list) > $ajaxnum) {
                $topic_keys = array_keys($topic_list);
                $topic_list = array_slice($topic_list, 0, $ajaxnum);
                array_splice($topic_keys, 0, $ajaxnum);
                $num = ceil(count($topic_keys) / $ajaxnum);
                for ($i = 0; $i < $num; $i++) {
                    if (count($topic_keys) > $ajaxnum) {
                        $topic_key = array_splice($topic_keys, 0, $ajaxnum);
                    } else {
                        $topic_key = $topic_keys;
                    }
                    $ajaxkey[] = base64_encode(serialize($topic_key));
                }
                $isloading = true;
            }
        }
        $group_list = $grouplist2 = array();
        $group_list = $this->_myGroup($member['uid']);
        $cut_num = 5;
        if ($group_list) {
            $group_count = count($group_list);
            if ($group_count > $cut_num) {
                $grouplist2 = array_slice($group_list, 0, $cut_num);
                $grouplist_more = array_slice($group_list, $cut_num);
                foreach ($grouplist_more as $key => $value) {
                    if ($value['id'] == $gid) {
                        $tmp = $grouplist2[$cut_num - 1];
                        $grouplist2[$cut_num - 1] = $value;
                        $grouplist_more[] = $tmp;
                        unset($grouplist_more[$key]);
                        break;
                    }
                }
                $group_list = $grouplist_more;
            } else {
                $grouplist2 = $group_list;
                $group_list = array();
            }
        }
        if (!$this->Config['acceleration_mode']) {
            $member_medal = $my_member ? $my_member : $member;
            if ($member_medal['medal_id']) {
                $medal_list = $this->_Medal($member_medal['medal_id'], $member_medal['uid']);
            }
        }
        $exp_return = user_exp($member_medal['level'], $member_medal['credits']);
        if ($exp_return['exp_width'] >= 1) {
            $exp_width = $exp_return['exp_width'];
        } else {
            $exp_width = 0;
        }
        $nex_exp_credit = $exp_return['nex_exp_credit'];
        $nex_level = $exp_return['nex_exp_level'];
        $this->Title || ($this->Title = $title);
        $tpl = $tpl ? $tpl : 'topic_index';
        if (in_array($tpl, array('topic_index', 'topic_myhome'))) {
            $tid = jlogic('buddy')->check_new_recd_topic(MEMBER_ID);
            if ($tid && $topic_list) {
                foreach ($topic_list as $key => $val) {
                    if ($tid == $val['tid']) {
                        unset($topic_list[$key]);
                    }
                }
            }
        }
        $albums = jlogic('image')->getalbum();
        include template($tpl);
    }