function Main() { global $attach_list, $_J; $pagenum = 10; $listcpattach = $this->Config['company_enable'] && $_J['member']['companyid'] > 0 ? true : false; if ($_GET['code'] == 'myattach') { $where = "AND uid = '" . MEMBER_ID . "'"; } elseif ($_GET['code'] == 'myfollowattach') { $buddyids = get_buddyids(MEMBER_ID, $this->Config['topic_myhome_time_limit']); if ($buddyids) { $where = "AND item<>'company' AND uid IN(" . implode(',', $buddyids) . ")"; } else { $where = "AND uid = 0"; } } elseif ($listcpattach && $_GET['code'] == 'company') { $where = "AND item='company' AND itemid='" . $_J['member']['companyid'] . "'"; $current_cp = 'current'; } else { $where = "AND item<>'company'"; $current_new = 'current'; } $attach = $this->AttachLogic->attachs_list($pagenum, $where); $attach_list = $attach['list']; if ($attach['page']) { $page_arr = $attach['page']; } $hot_down_list = $this->AttachLogic->down_hot_attach(); $this->Title = '附件文档'; include template("attach"); }
function main() { $select_reward = true; $option = array('page' => true, 'per_page_num' => 10, 'page_url' => 'index.php?mod=reward', '_config' => array('return' => 'array')); $RewardLogic = jlogic('reward'); if ($this->Code == 'myreward') { $option['uid'] = MEMBER_ID; $option['page_url'] = 'index.php?mod=reward&code=myreward'; } else { if ($this->Code == 'freward') { $option['uid'] = get_buddyids(MEMBER_ID); if (!$option['uid']) { $select_reward = false; } $option['page_url'] = 'index.php?mod=reward&code=freward'; } else { if ($this->Code == 'joinedreward') { $rid = $RewardLogic->getJoinedRewardRid(MEMBER_ID); $option['id'] = $rid; if (!$option['id']) { $select_reward = false; } $option['page_url'] = 'index.php?mod=reward&code=joinedreward'; } } } $myreward = $this->Code == 'myreward' ? 'tago' : 'tagn'; $freward = $this->Code == 'freward' ? 'tago' : 'tagn'; $mainreward = $this->Code == '' ? 'tago' : 'tagn'; $joinedreward = $this->Code == 'joinedreward' ? 'tago' : 'tagn'; if ($select_reward) { extract($RewardLogic->getRewardList($option)); } $count = $count ? $count : 0; $param = array('recd' => 1, 'limit' => 10); $recd_reweard = $RewardLogic->getRewardList($param); $member = jsg_member_info(MEMBER_ID); $this->Title = '有奖转发'; include template('reward/reward_mian'); }
function TalkLogic() { $this->mybuddys = (array) get_buddyids(MEMBER_ID); $this->TopicLogic = jlogic('topic'); }
function Add($datas, $totid = 0, $imageid = 0, $attachid = 0, $from = 'web', $type = "first", $uid = 0, $item = '', $item_id = 0, $from_queue = false) { if ($GLOBALS['_J']['config']['wqueue_enabled'] && !$from_queue) { isset($datas['content']) && ($datas['content'] = base64_encode($datas['content'])); $wq_data = array('datas' => $datas, 'totid' => $totid, 'imageid' => $imageid, 'attachid' => $attachid, 'from' => $from, 'type' => $type, 'uid' => $uid ? $uid : (isset($datas['uid']) ? $datas['uid'] : MEMBER_ID), 'item' => $item ? $item : (isset($datas['item']) ? $datas['item'] : ''), 'item_id' => $item_id ? $item_id : (isset($datas['item_id']) ? $datas['item_id'] : 0)); $wq_ds = base64_encode(serialize($wq_data)); $wq_url = 'http:/' . '/' . $GLOBALS['_J']['config']['wqueue']['host'] . '/?name=' . $GLOBALS['_J']['config']['wqueue']['name'] . '&opt=put&auth=' . $GLOBALS['_J']['config']['wqueue']['auth'] . '&data=' . $wq_ds; $wq_r = dfopen($wq_url); if (strstr($wq_r, 'HTTPSQS_PUT_OK')) { return array(); } } elseif ($from_queue) { } if (is_array($datas) && count($datas)) { $ks = array('tid' => 1, 'uid' => 1, 'content' => 1, 'imageid' => 1, 'attachid' => 1, 'videoid' => 1, 'musicid' => 1, 'longtextid' => 1, 'totid' => 1, 'touid' => 1, 'dateline' => 1, 'from' => 1, 'type' => 1, 'item_id' => 1, 'item' => 1, 'postip' => 1, 'timestamp' => 1, 'managetype' => 1, 'checkfilter' => 1, 'verify' => 1, 'design' => 1, 'xiami_id' => 1, 'is_reward' => 1); foreach ($datas as $k => $v) { if (isset($ks[$k])) { ${$k} = $v; } } $pverify = $datas['pverify']; } else { $content = $datas; } $is_verify = $pverify || $GLOBALS['_J']['config']['verify'] ? true : false; $content = $this->_content_strip($content); $content_length = strlen($content); if ($content_length < 2) { return "内容不允许为空"; } if ($this->_len2 > 0 && $content_length > $this->_len2) { $content = cut_str($content, $this->_len2, ''); } if (!$checkfilter) { $f_rets = filter($content); if ($f_rets) { if ($f_rets['verify']) { $is_verify = true; } elseif ($f_rets['error']) { return $f_rets['msg']; } } } else { if ($is_verify && 'verify' == $verify && true === IN_JISHIGOU_ADMIN) { $is_verify = false; } } $totid = max(0, (int) $totid); $data = array(); if ($managetype) { $data['managetype'] = $managetype; } $is_new = 1; if ($tid) { $is_new = 0; $data['tid'] = $tid; } $parents = ''; $_froms = array('web' => 1, 'wap' => 1, 'mobile' => 1, 'sms' => 1, 'qq' => 1, 'msn' => 1, 'api' => 1, 'sina' => 1, 'qqwb' => 1, 'vote' => 1, 'qun' => 1, 'wechat' => 1, 'fenlei' => 1, 'event' => 1, 'android' => 1, 'iphone' => 1, 'ipad' => 1, 'pad' => 1, 'androidpad' => 1, 'reward' => 1); $from = $from && $_froms[$from] ? $from : 'web'; if (empty($item) || $item_id < 0) { if (!is_numeric($type)) { $_types = array('first' => 1, 'forward' => 1, 'reply' => 1, 'both' => 1); $type = $totid < 1 && $type && isset($_types[$type]) ? 'first' : $type; if (empty($type)) { $type = 'first'; } } } $data['from'] = $from; if (($type == 'forward' || $type == 'both') && $item == 'qun') { $data['type'] = $item; } else { $data['type'] = $type; } if ($item == 'channel' && $item_id > 0) { $channeldata = jlogic('channel')->id2category($item_id); if ($channeldata) { if ($channeldata['purpostview']) { $data['type'] = 'channel'; } if ($channeldata['topictype']) { $data['managetype'] = $channeldata['topictype']; } unset($channeldata); } } $data['uid'] = $uid = max(0, (int) ($uid ? $uid : MEMBER_ID)); $data['videoid'] = $videoid = max(0, (int) $videoid); $data['longtextid'] = $longtextid = max(0, (int) $longtextid); $timestamp = (int) ($timestamp ? $timestamp : $dateline); $data['dateline'] = $data['lastupdate'] = $timestamp = $dateline = $timestamp > 0 ? $timestamp : TIMESTAMP; $data['totid'] = $totid; $data['touid'] = $touid; $data['anonymous'] = $GLOBALS['_J']['config']['anonymous_enable'] ? $datas['anonymous'] : 0; $data['item'] = $item; $data['item_id'] = $item_id; $member = $this->GetMember($data['uid']); if (!$member) { return "用户不存在"; } if ($item == 'qun' && $item_id > 0) { $qun_closed = DB::result_first("SELECT closed FROM " . DB::table('qun') . " WHERE qid='{$item_id}'"); if ($qun_closed) { return "当前" . $GLOBALS['_J']['config']['changeword']['weiqun'] . "已经关闭,你无法发布内容"; } $r = $this->is_qun_member($item_id, $uid); if (!$r) { return "你没有权限进行当前操作"; } } if ($item == 'channel' && $item_id > 0) { $can_pub_topic = jlogic('channel')->can_pub_topic($item_id); if (!$can_pub_topic) { return "你没有权限进行当前操作"; } } if ($item == 'company' && $item_id > 0) { if ($GLOBALS['_J']['config']['company_enable']) { $my_companyid = $GLOBALS['_J']['member']['companyid']; $can_pub_cp_topic = false; if ($item_id == $my_companyid) { $can_pub_cp_topic = true; } elseif (@is_file(ROOT_PATH . 'include/logic/cp.logic.php') && $member['companyid'] > 0) { $is_my_cpid = jlogic('cp')->is_cp_company($item_id); if ($is_my_cpid) { $can_pub_cp_topic = true; } } if (!$can_pub_cp_topic) { return "你没有权限进行当前操作"; } } else { $item = ''; $item_id = 0; $data['type'] = 'first'; } } if ($GLOBALS['_J']['config']['add_topic_need_face'] && !$member['__face__']) { return "本站需上传头像才可互动。"; } $MemberHandler =& Obj::registry('MemberHandler'); if ($MemberHandler) { if (!in_array($type, array('both', 'reply', 'forward'))) { if (!$MemberHandler->HasPermission('topic', 'add', 0, $member)) { if (true !== IN_JISHIGOU_SMS) { return $MemberHandler->GetError(); } } } else { if (('reply' == $type || 'both' == $type) && !$MemberHandler->HasPermission('topic', 'reply', 0, $member)) { return $MemberHandler->GetError(); } elseif (('forward' == $type || 'both' == $type) && !$MemberHandler->HasPermission('topic', 'forward', 0, $member)) { return $MemberHandler->GetError(); } } } if (MEMBER_ROLE_TYPE != 'admin') { if ($GLOBALS['_J']['config']['topic_vip'] == 1) { if (!$member['validate']) { return "非V认证用户无法发布信息"; } } elseif ($GLOBALS['_J']['config']['topic_vip'] == 2) { $to_verify = 1; if (!$member['validate']) { $f_rets['vip'] = 1; $f_rets['msg'] = '非V认证用户发言内容进入<a href="index.php?mod=' . $member['uid'] . '&type=my_verify" target="_blank">待审核</a>, <a href="' . $GLOBALS['_J']['config']['site_url'] . '/index.php?mod=other&code=vip_intro" target="_blank">点击申请认证</a>'; $is_verify = true; } } } $data['username'] = $username = $member['username']; $topic_content_id = abs(crc32(md5($content))); if (!$verify) { if ($GLOBALS['_J']['config']['lastpost_time'] > 0 && !in_array($data['from'], array('sina', 'qqwb')) && $timestamp - $member['lastpost'] < $GLOBALS['_J']['config']['lastpost_time']) { return "您发布的太快了,请在<b>{$GLOBALS['_J']['config']['lastpost_time']}</b>秒后再发布"; } } #if NEDU if (defined('NEDU_MOYO')) { if (false != ($deny = nlogic('feeds.app.jsg')->topic_publish_denied($data))) { return $deny; } } #endif if ($imageid) { if ($verify) { $data['imageid'] = $imageid; } else { $data['imageid'] = $imageid = jlogic('image')->get_ids($imageid, $data['uid']); } } if ($attachid) { if ($verify) { $data['attachid'] = $attachid; } else { $data['attachid'] = $attachid = jlogic('attach')->get_ids($attachid, $data['uid']); } } $data['musicid'] = $musicid; if ($xiami_id > 0) { $musicid = $data['musicid'] = jtable('topic_music')->insert(array('uid' => $data['uid'], 'username' => $data['username'], 'dateline' => $timestamp, 'xiami_id' => $xiami_id), true); } $topic_more = array(); $parents = ''; $data['roottid'] = 0; if ($totid > 0) { $content = $this->GetForwardContent($content); $_type_names = array('both' => '转发和评论', 'forward' => '转发', 'reply' => '评论'); $_type_name = $_type_names[$type]; $to_topic = $row = $this->Get($totid); if (!$to_topic) { return "对不起,由于原微博已删除,不能{$_type_name}"; } if (('reply' == $type || 'both' == $type) && ($rets = jsg_role_check_allow('topic_reply', $row['uid'], $data['uid']))) { return $rets['error']; } elseif (('forward' == $type || 'both' == $type) && ($rets = jsg_role_check_allow('topic_forward', $row['uid'], $data['uid']))) { return $rets['error']; } $topic_more = $this->GetMore($totid); $data['totid'] = $row['tid']; $data['touid'] = $row['uid']; $data['tousername'] = $row['nickname']; $parents = $topic_more['parents'] ? $topic_more['parents'] . ',' . $totid : $totid; $data['roottid'] = $topic_more['parents'] ? substr($parents, 0, strpos($parents, ',')) : $totid; $root_topic = $this->Get($data['roottid']); if ($root_topic['item'] == 'qun' && $root_topic['item_id'] > 0) { $qun_closed = DB::result_first("SELECT closed FROM " . DB::table('qun') . " WHERE qid='{$root_topic['item_id']}'"); if ($qun_closed) { return "当前" . $GLOBALS['_J']['config'][changeword][weiqun] . "已经关闭,你无法发布内容"; } } if ($data['totid'] != $data['roottid']) { $rrow = $this->Get($data['roottid']); if (!$rrow) { return "对不起,由于原始微博已删除,不能{$_type_name}"; } if (('reply' == $type || 'both' == $type) && ($rets = jsg_role_check_allow('topic_reply', $rrow['uid'], $data['uid']))) { return $rets['error']; } elseif (('forward' == $type || 'both' == $type) && ($rets = jsg_role_check_allow('topic_forward', $rrow['uid'], $data['uid']))) { return $rets['error']; } if ('forward' == $type || 'both' == $type) { $content .= $this->ForwardSeprator . "{$row['nickname']} : " . addslashes($this->_content_strip($row['raw_content'])); } } } $_process_result = $this->_process_content($content, $data); $longtext = $_content = $_process_result['content']; $at_uids = $_process_result['at_uids']; $tags = $_process_result['tags']; $urls = $_process_result['urls']; unset($data['longtextid']); if (jstrlen($_content) > $this->_len) { $_content = cut_str($_content, $this->_len, ''); $_content = $this->_content_end($_content); if (strlen($longtext) > strlen($_content)) { $longtextid = 0; if ($is_verify) { $longtextid = jlogic('longtext')->Add($longtext, $data['uid']); } $longtextid = $longtextid > 0 ? $longtextid : TIMESTAMP; $data['longtextid'] = $longtextid; } } if (!$GLOBALS['_J']['config']['clear_format_open']) { $_content = $this->clearFormat($_content); } else { $_content = preg_replace('/\\n{3,}/', '\\n\\n', $_content); $_content = nl2br($_content); } if (strlen($_content) > 255) { $_content = cut_str($_content, 254 * 2, ''); $data['content'] = cut_str($_content, 255, ''); $data['content2'] = substr($_content, strlen($data['content'])); } else { $data['content'] = $_content; } $data['postip'] = $postip ? $postip : $GLOBALS['_J']['client_ip']; $data['post_ip_port'] = $GLOBALS['_J']['client_ip_port']; if ($is_verify) { $sql = "insert into `" . TABLE_PREFIX . "topic_verify` (`" . implode("`,`", array_keys($data)) . "`) values ('" . implode("','", $data) . "')"; DB::query($sql); $topic_id = $data['tid'] = $tid = DB::insert_id(); if ($imageid) { DB::query("update " . TABLE_PREFIX . "topic_image set `tid`='-1' where `id` in ({$imageid})"); } if ($attachid) { DB::query("update " . TABLE_PREFIX . "topic_attach set `tid`='-1' where `id` in ({$attachid})"); } if ($urls) { $date = $data; $date['id'] = $data['tid']; $date['tid'] = -1; $this->_process_urls($date, $urls, false, 'topic_verify'); } if ($notice_to_admin = $GLOBALS['_J']['config']['notice_to_admin']) { $pm_post = array('message' => $member['nickname'] . "有一条微博进入待审核状态,<a href='admin.php?jump_url=admin.php?mod=topic&code=verify' target='_blank'>点击</a>进入审核。", 'to_user' => str_replace('|', ',', $notice_to_admin)); $admin_info = DB::fetch_first('select `uid`,`username`,`nickname` from `' . TABLE_PREFIX . 'members` where `uid` = 1'); load::logic('pm'); $PmLogic = new PmLogic(); $PmLogic->pmSend($pm_post, $admin_info['uid'], $admin_info['username'], $admin_info['nickname']); } if ($f_rets['verify'] || $f_rets['vip']) { return array($f_rets['msg']); } } else { $tid = jtable('topic')->insert($data, true); if ($tid < 1) { return "未知的错误"; } $topic_id = $data['tid'] = $tid; if (is_array($datas) && isset($datas['relateid'])) { $relateid = $datas['relateid'] ? $datas['relateid'] : 0; $featureid = $datas['featureid'] ? $datas['featureid'] : 0; if ($relateid) { DB::query("update `" . TABLE_PREFIX . "topic` set `relateid`='{$tid}',`featureid`='{$featureid}' where `tid`='{$relateid}'"); $pmtoinfo = jlogic('topic')->Get($relateid, '`uid`,`item_id`,`relateid`,`featureid`', ''); $ch_typeinfo = jlogic('channel')->get_channel_typeinfo_byid($pmtoinfo['item_id']); $msg = '您提出的'; $msg .= $ch_typeinfo['channel_type'] == 'ask' ? '问题' : '建议'; $msg .= $pmtoinfo['relateid'] == 0 ? ',已经有了答复' : '重新给予了答复'; if ($featureid != $pmtoinfo['featureid']) { $msg .= ',状态变更为“' . ($ch_typeinfo['feature'][$featureid] ? $ch_typeinfo['feature'][$featureid] : '等待处理') . '”'; } postpmsms($pmtoinfo['uid'], $relateid, $msg); } } if ($is_new) { if (!empty($item) && $item_id > 0 && !($design == 'design' || $design == 'btn_wyfx')) { jfunc('app'); $param = array('item' => $item, 'item_id' => $item_id, 'tid' => $tid, 'uid' => $data['uid']); if ($item == 'talk') { $param['touid'] = $touid; $param['totid'] = $totid; } app_add_relation($param); unset($param); } jtable('topic_more')->add($tid, $parents, $longtext); } jtable('member_topic')->add($tid); if ($parents && 'first' != $data['type']) { jtable('topic_relation')->add($tid, $parents); } $p = array('uid' => $data['uid'], 'lastactivity' => $data['lastupdate'], 'lastpost' => $data['lastupdate'], 'last_topic_content_id' => $topic_content_id); if ('reply' != $data['type']) { $p['+@topic_count'] = 1; } jtable('members')->update($p); if ($at_uids) { $this->_process_at_uids($data, $at_uids); ios_push_msg($at_uids, '你有新消息:1条@我'); } if ($totid > 0 && $parents) { $this->_process_reply($data); ios_push_msg($totid, '你有新消息:1条评论'); } if ($urls) { $this->_process_urls($data, $urls); } if ($imageid) { jlogic('image')->set_tid($imageid, $tid); } if ($attachid) { jlogic('attach')->set_tid($attachid, $tid); } if ($musicid) { $sql = "update `" . TABLE_PREFIX . "topic_music` set `tid` = '{$tid}' where `id` = '{$musicid}' "; DB::query($sql); } if ($data['videoid'] > 0) { $sql = "update `" . TABLE_PREFIX . "topic_video` set `tid`='{$tid}' where `id`='{$data['videoid']}'"; DB::query($sql); } #有奖转发判断 if ($is_reward) { $allowed_reward = 1; $reward_info = jlogic('reward')->getRewardInfo($is_reward); if ($reward_info['rules']) { foreach ($reward_info['rules'] as $key => $val) { if ($allowed_reward == 0) { break; } switch ($key) { case 'at_num': if ($val > count($at_uids)) { $allowed_reward = 0; } break; case 'user': $my_buddyids = get_buddyids($data['uid']); if (!$my_buddyids) { $allowed_reward = 0; break; } foreach ($val as $re_uid => $re_name) { if ($re_uid == $data['uid']) { continue; } if (!in_array($re_uid, $my_buddyids)) { $allowed_reward = 0; break; } } break; case 'tag': foreach ($val as $re_tag) { if (!$tags) { $allowed_reward = 0; break; } if (!in_array($re_tag, $tags)) { $allowed_reward = 0; break; } } break; default: break; } } } #超时转发也不可进入有奖转发名单 if (TIMESTAMP > $reward_info['tot']) { $allowed_reward = 0; } #记录有奖转发 DB::query(" insert into `" . TABLE_PREFIX . "reward_user` (`uid`,`tid`,`rid`,`on`,`dateline`) values('{$data['uid']}','{$tid}','{$is_reward}','{$allowed_reward}','" . TIMESTAMP . "')"); DB::query(" update `" . TABLE_PREFIX . "reward` set `f_num` = `f_num`+1,`a_num`=`a_num`+{$allowed_reward} where `id` = '{$is_reward}' "); } if ($item == 'qun' && ($data['type'] == 'qun' || $data['type'] == 'first')) { if (!empty($item_id)) { $query = DB::query("SELECT uid FROM " . DB::table('qun_user') . " WHERE qid='{$item_id}'"); $uids = array(); while ($value = DB::fetch($query)) { if ($value['uid'] != $uid) { $uids[$value['uid']] = $value['uid']; } } if (!empty($uids)) { DB::query("UPDATE " . DB::table('members') . "\r\n\t \t\t\t\t\t SET qun_new=qun_new+1\r\n\t \t\t\t\t\t WHERE uid IN(" . jimplode($uids) . ")"); } } } if ($item == 'channel' && $item_id > 0 && ($data['type'] == 'first' || $data['type'] == 'channel')) { if (!empty($item_id)) { $query = DB::query("SELECT uid FROM " . DB::table('buddy_channel') . " WHERE ch_id='{$item_id}'"); $uids = array(); while ($value = DB::fetch($query)) { if ($value['uid'] != $uid) { $uids[$value['uid']] = $value['uid']; } } if (!empty($uids)) { DB::query("UPDATE " . DB::table('members') . "\r\n\t \t\t\t\t\t SET channel_new=channel_new+1\r\n\t \t\t\t\t\t WHERE uid IN(" . jimplode($uids) . ")"); } } if ($GLOBALS['_J']['config']['extcredits_enable'] && $data['uid'] > 0) { $credits_itemid = jlogic('channel')->is_update_credits_byid($item_id); if ($credits_itemid) { update_credits_by_action('_C' . crc32($credits_itemid), $data['uid']); } } } if ($item == 'company' && $item_id > 0 && $data['type'] == 'company') { $query = DB::query("SELECT uid FROM " . DB::table('members') . " WHERE companyid='{$item_id}'"); $uids = array(); while ($value = DB::fetch($query)) { if ($value['uid'] != $uid) { $uids[$value['uid']] = $value['uid']; } } $query = DB::query("SELECT uid FROM " . DB::table('cp_user') . " WHERE companyid='{$item_id}'"); while ($value = DB::fetch($query)) { if ($value['uid'] != $uid) { $uids[$value['uid']] = $value['uid']; } } if (!empty($uids)) { DB::query("UPDATE " . DB::table('members') . " SET company_new=company_new+1 WHERE uid IN(" . jimplode($uids) . ")"); } } $update_credits = false; if ($tags) { Load::logic('tag'); $TagLogic = new TagLogic('topic'); $TagLogic->Add(array('item_id' => $tid, 'tag' => $tags), false); if ($GLOBALS['_J']['config']['extcredits_enable'] && $data['uid'] > 0) { if (is_array($tags) && count($tags)) { if ($GLOBALS['_J']['config']['sign']['sign_enable'] && jtable('sign_tag')->is_sign_tag($tags)) { $sign_credits = update_credits_by_action('_S', $data['uid']); } if (!$sign_credits['updatecredit']) { foreach ($tags as $_t) { if ($_t) { $update_credits = update_credits_by_action('_T' . crc32($_t), $data['uid']) || $update_credits; } } } } } jlogic('tag_favorite')->topic_new($tags, $data['uid']); } if ($GLOBALS['_J']['config']['extcredits_enable']) { if (!$update_credits && !$sign_credits && $data['uid'] > 0) { if ($totid > 0) { update_credits_by_action('reply', $data['uid']); } else { update_credits_by_action('topic', $data['uid']); } } } if ($GLOBALS['_J']['config']['imjiqiren_enable'] && imjiqiren_init()) { $to_admin_robot = jconf::get('imjiqiren', 'admin_qq_robots'); if ($to_admin_robot) { imjiqiren_send_message($to_admin_robot, 'to_admin_robot', array('site_url' => $GLOBALS['_J']['config']['site_url'], 'username' => $data['username'], 'content' => $data['content'], 'topic_id' => $topic_id)); } } if ($GLOBALS['_J']['config']['sms_enable'] && sms_init()) { $to_admin_mobile = jconf::get('sms', 'admin_mobile'); if ($to_admin_mobile) { sms_send_message($to_admin_mobile, 'to_admin_mobile', array('site_url' => $GLOBALS['_J']['config']['site_url'], 'username' => $data['username'], 'content' => $data['content'], 'topic_id' => $topic_id)); } } if (@is_file(ROOT_PATH . 'include/logic/cp.logic.php') && $GLOBALS['_J']['config']['company_enable'] && $member['companyid'] > 0) { $CpLogic = jlogic('cp'); $update_companyid = $member['companyid']; $update_departmentid = $member['departmentid']; if ($item = 'company' && $item_id > 0 && $update_companyid != $item_id) { $cp_company_info = $CpLogic->get_cp_row_bycompany($item_id); if ($cp_company_info) { $update_companyid = $member['companyid']; $update_departmentid = $member['departmentid']; } } $CpLogic->update('company', $update_companyid, 0, 1); if ($update_departmentid > 0) { $CpLogic->update('department', $update_departmentid, 0, 1); } } $feed_action = ''; if (in_array($data['type'], array('first', 'reply', 'forward', 'both'))) { $feed_action = $data['type']; if ($feed_action == 'first') { $feed_action = 'post'; } elseif ($feed_action == 'both') { $feed_action = 'reply'; } } if ($feed_action) { $feed_msg = cut_str($data['content'], 30, ''); feed_msg('channel', $feed_action, $tid, $feed_msg, $item_id, $data['anonymous']); } $this->_syn_to($data); } if ($GLOBALS['_J']['plugins']['func']['posttopic']) { hookscript('posttopic', 'funcs', array('param' => array($data['tid']), 'step' => 'post'), 'posttopic'); } if ('reply' != $data['type']) { cache_db('rm', "{$data['uid']}-topic-%", 1); jtable('topic')->archive($data['tid']); } $this->cache_rm($data['tid']); #if NEDU defined('NEDU_MOYO') && nfevent('jsg.logic.topic.add', null, $data); #endif return $data; }
function Follow() { $member = $this->_member(); if (!$member) { $this->Messager("链接错误,请检查", 'index.php?mod=plaza'); } $member_list = array(); $per_page_num = 8; $page_link = "index.php?mod={$member['username']}&code=follow"; $count = $member['follow_count']; if ($count > 0) { $page_arr = wap_page($count, $per_page_num, $page_link, array('return' => 'Array')); $p = array('uid' => $member['uid'], 'result_count' => $count, 'sql_limit' => " {$page_arr['limit']} ", 'sql_order' => ' `dateline` DESC '); $uids = get_buddyids($p); if ($uids) { $member_list = $this->_topicLogicGetMember($uids); $member_list = buddy_follow_html($member_list, 'uid', 'wap_follow_html'); } } $this->Title = "{$member['nickname']}关注的人"; include template('topic_follow'); }
function members() { $qid = intval(trim($this->Get['qid'])); if (empty($qid)) { $this->Messager('错误的操作'); } $qun_info = $this->QunLogic->get_qun_info($qid); if (empty($qun_info)) { $this->Messager('当前' . $this->Config[changeword][weiqun] . '不存在或者已经被删除了'); } $type = trim($this->Get['type']); $page = intval(trim($this->Get['page'])); $page = $page == 0 ? 1 : $page; $perpage = 60; $gets = array('mod' => 'qun', 'code' => 'members', 'type' => $type, 'qid' => $qid); $page_url = 'index.php?' . url_implode($gets); if ($type == 'followed') { $followed_ids = get_buddyids(MEMBER_ID); if (empty($followed_ids)) { $where_sql = ' 0 '; } else { $where_sql = " qid='{$qid}' AND uid IN(" . jimplode($followed_ids) . ") "; } } else { if ($page == 1) { $founder_info = array(); $founderuid = DB::result_first("SELECT uid\r\n\t\t\t\t\t\t\t\t\t\t\t\tFROM " . DB::table('qun_user') . "\r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE qid='{$qid}' AND level=1"); $founder_info = $this->TopicLogic->GetMember($founderuid, 'uid,username,nickname,face'); $admin_ary = array(); $admin_nums = 0; $admin_ids = array(); $query = DB::query("SELECT uid FROM " . DB::table('qun_user') . " WHERE qid='{$qid}' AND level=2"); while ($value = DB::fetch($query)) { $admin_ids[] = $value['uid']; } if (!empty($admin_ids)) { $admin_ary = $this->TopicLogic->GetMember($admin_ids, 'uid,username,nickname,face'); $admin_nums = count($admin_ary); } } $where_sql = " qid='{$qid}' AND level=4 "; } $members = $member_ids = array(); $count = DB::result_first("SELECT COUNT(*) FROM " . DB::table('qun_user') . " WHERE {$where_sql} "); if ($count) { $_config = array('return' => 'array'); $page_arr = page($count, $perpage, $page_url, $_config); $query = DB::query("SELECT uid\r\n\t\t\t\t\t\t\t\tFROM " . DB::table('qun_user') . "\r\n\t\t\t\t\t\t\t\tWHERE {$where_sql}\r\n\t\t\t\t\t\t\t\t{$page_arr['limit']} "); while ($value = DB::fetch($query)) { $member_ids[] = $value['uid']; } $members = $this->TopicLogic->GetMember($member_ids, 'uid,username,nickname,face'); } $uid = MEMBER_ID; $buddyids = get_buddyids($uid); $this->Title = $this->Config[changeword][weiqun] . " - " . $qun_info['name'] . "的成员"; include_once template('qun/members'); }
function AtUser() { $limit = jget('limit', 'int'); if ($limit < 1 || $limit > 100) { $limit = 10; } $nickname = jget('q', 'txt'); $from = jget('from'); $type = jget('type'); $acode = jget('acode'); $id = jget('id', 'int'); $inkey = jget('key'); $nickname = get_safe_code($nickname); $nl = strlen($nickname); $rets = array(); $uids = array(); if ($acode == 'bud') { $uids = jtable('buddy_follow_group_relation')->get_my_group_uids(MEMBER_ID, $id); $rets = DB::fetch_all("SELECT `uid`, `nickname`, `ucuid`, `face` FROM " . DB::table('members') . " WHERE uid IN(" . jimplode($uids) . ") ORDER BY `topic_count` DESC\tLIMIT 10 "); } elseif ($acode == 'rec') { $rets = DB::fetch_all("SELECT `uid`, `nickname`, `ucuid`, `face` FROM " . DB::table('members') . " WHERE `media_id`='{$id}' ORDER BY `media_order_id` DESC\tLIMIT 10 "); } elseif ($acode == 'budn') { $buddyids = get_buddyids(array('uid' => MEMBER_ID, 'result_count' => 10, 'gids' => '')); $rets = DB::fetch_all("SELECT `uid`, `nickname`, `ucuid`, `face` FROM " . DB::table('members') . " WHERE uid IN(" . jimplode($buddyids) . ") ORDER BY `topic_count` DESC\tLIMIT 10 "); } else { if ($nl < 1 || $nl > 50) { #一周内我经常AT的人 $rets = jtable('topic_mention')->my_hot_at(MEMBER_ID, $limit); } else { $cache_id = 'ajax/misc/AtUser-' . $nickname; if (false === ($rets = cache_db('get', $cache_id))) { $where_sql = " " . build_like_query("nickname", $nickname) . " "; $rets = DB::fetch_all("SELECT `uid`, `nickname`, `ucuid`, `face`\r\n\t\t\t\t\t\t\t\t\tFROM " . DB::table('members') . "\r\n\t\t\t\t\t\t\t\t\tWHERE {$where_sql}\r\n\t\t\t\t\t\t\t\t\tORDER BY `fans_count` DESC, `lastactivity` DESC\r\n\t\t\t\t\t\t\t\t\tLIMIT {$limit} "); cache_db('set', $cache_id, $rets, 3600); } } } if ($rets) { foreach ($rets as $row) { $row = jsg_member_make($row); if ($from == 'admin') { echo "<li>{$row['nickname']}</li>"; } elseif ($from == 'web') { echo "<li onclick=\"atcin_user('{$inkey}','{$row[nickname]}','{$type}');\"><img onerror='javascript:faceError(this);' src='{$row['face']}'><span>{$row['nickname']}</span></li>"; } else { echo "{$row['nickname']}|{$row['uid']}|{$row['face']}\n"; } } } exit; }
function getRewardInfo($id) { if ($id < 1) { return array(); } $reward = array(); $sql = " select * from `" . TABLE_PREFIX . "reward` where `id` = '{$id}'"; $reward = DB::fetch_first($sql); if ($reward) { $reward['from_time'] = date('Y-m-d H:i:s', $reward['fromt']); $reward['to_time'] = date('Y-m-d H:i:s', $reward['tot']); $reward['post_time'] = date('Y-m-d H:i:s', $reward['posttime']); $reward['prize'] = unserialize($reward['prize']); $reward['rules'] = unserialize($reward['rules']); $reward['postip'] = long2ip($reward['postip']); $reward['event_image_path'] = DB::result_first(" select `image` from `" . TABLE_PREFIX . "reward_image` where `id` = '{$reward['event_image']}'"); if ($reward['prize']) { foreach ($reward['prize'] as $key => $val) { if ($image_id = (int) $val['prize_image']) { $reward['prize'][$key]['prize_image_url'] = DB::result_first(" select `image` from `" . TABLE_PREFIX . "reward_image` where `id` = '{$image_id}'"); if ($image_id == $reward['image']) { $reward['image'] = $reward['prize'][$key]['prize_image_url']; } } $reward['prize'][$key]['prize_image_url'] = $reward['prize'][$key]['prize_image_url'] ? $reward['prize'][$key]['prize_image_url'] : './images/reward_noPic.gif'; } #默认图片 $reward['image'] = $reward['image'] ? $reward['image'] : './images/reward_noPic.gif'; } $reward['event_image_path'] || ($reward['event_image_path'] = $reward['image']); if ($reward['fromt'] < TIMESTAMP && TIMESTAMP < $reward['tot']) { $reward['type'] = 1; $reward['reward_type'] = '正在进行'; } else { if ($reward['fromt'] > TIMESTAMP) { $reward['type'] = 0; $reward['reward_type'] = '等待开始'; } else { if (TIMESTAMP > $reward['tot']) { $reward['type'] = 2; $reward['reward_type'] = '已经结束'; } } } $reward['time_lesser'] = $reward['tot'] > TIMESTAMP ? $reward['tot'] - TIMESTAMP : 0; $member = jsg_member_info($reward['uid']); $reward['username'] = $member['username']; $reward['nickname'] = $member['nickname']; $reward['validate_html'] = $member['validate_html']; #需要转发的微博 if ($reward['tid'] > 0) { $reward['topic'] = jtable('topic_more')->get_longtext($reward['tid']); $reward['topic_content'] = cut_str($reward['topic'], 150); } #需关注人与我的关系 $my_buddyids = get_buddyids(MEMBER_ID); if ($reward['rules']['user']) { foreach ($reward['rules']['user'] as $uid => $val) { if (isset($my_buddyids[$uid])) { $reward['rules']['user'][$uid]['follow_html'] = follow_html($uid, 1); } else { $reward['rules']['user'][$uid]['follow_html'] = follow_html($uid, 0); } } } } return $reward; }
function followevent() { load::logic('event'); $EventLogic = new EventLogic(); $hot_event = $EventLogic->getHotEvent(); $uids = array(); if ($uids = $EventLogic->getDaRen()) { $hd_daren = $this->TopicLogic->GetMember($uids); } $buddyids = get_buddyids(MEMBER_ID); if ($buddyids) { $uid_list = implode(',', $buddyids); } $type = $this->Get['type']; $param = array('perpage' => "10", 'page' => true); $return = array(); if ($uid_list) { if ($type == 'part') { $param['where'] = " m.play = 1 and m.fid in ({$uid_list}) "; $param['order'] = " order by a.lasttime desc,a.app_num desc,a.posttime desc "; $param['page_url'] = "index.php?mod=event&code=followevent&type=part"; $this->Title = "他们参与的活动"; $return = $EventLogic->getEvents($param); } else { $param['where'] = " a.postman in ({$uid_list}) and a.verify = 1 "; $param['order'] = " order by a.lasttime desc,a.app_num desc,a.posttime desc "; $param['page_url'] = "index.php?mod=event&code=followevent"; $page_url = "index.php?mod=event&code=followevent"; $this->Title = "他们管理的活动"; $return = $EventLogic->getEventinfo($param); } if ($return) { extract($return); $rs = $event_list; } } else { $this->Messager("你没有关注的人哦、可以通过找人来关注你感兴趣的人", "index.php?mod=profile&code=search"); } $member = $this->Member; if ($member['medal_id']) { $medal_list = $this->TopicLogic->GetMedal($member['medal_id'], $member['uid']); } include template('event/event_follow'); }
function DoList() { $options = array(); if (($per_page_num = (int) jconf::get('show', 'topic', $this->Code)) < 1) { $per_page_num = 20; } $uid = (int) get_param('uid'); $is_personal = (int) get_param('is_personal'); $tag_id = (int) get_param('tag_id'); $topic_parent_disable = false; $start = max(0, (int) $start); $limit = "limit {$start},{$per_page_num}"; $next = $start + $per_page_num; if ($tag_id > 0) { $sql = "select `item_id` from `" . TABLE_PREFIX . "topic_tag` where `tag_id`='{$tag_id}' order by `item_id` desc {$limit}"; $query = $this->DatabaseHandler->Query($sql); $topic_ids[0] = 0; while (false != ($row = $query->GetRow())) { $topic_ids[$row['item_id']] = $row['item_id']; } $options['tid'] = $topic_ids; } $options['perpage'] = $per_page_num; $tpl = 'topic_list_ajax'; if ('myhome' == $this->Code) { $uid = MEMBER_ID; $cache_time = 600; $cache_key = "{$uid}-topic-myhome--0"; $topic_myhome_time_limit = 0; if ($this->Config['topic_myhome_time_limit'] > 0) { $topic_myhome_time_limit = time() - $this->Config['topic_myhome_time_limit'] * 86400; if ($topic_myhome_time_limit > 0) { $options['dateline'] = $topic_myhome_time_limit; } } $topic_uids[$uid] = $uid; if ($is_personal) { if (false === cache_db('get', $cache_key)) { $buddyids = get_buddyids(MEMBER_ID, $this->Config['topic_myhome_time_limit']); if ($buddyids) { $topic_uids = array_merge($topic_uids, $buddyids); } } } $options['uid'] = $topic_uids; } else { if ('myat' == $this->Code) { $uid = MEMBER_ID; $rets = jtable('topic_mention')->get_ids(array('uid' => $uid, 'sql_order' => ' `id` DESC ', 'perpage' => $options['perpage'], 'page_url' => $options['page_url']), 'tid', 1); $total_record = $rets['count']; $page_arr = $rets['page']; $topic_list = $total_record > 0 && $rets['ids'] ? $this->TopicLogic->Get($rets['ids']) : array(); $topic_list_get = true; } else { if ('groupview' == $this->Code) { $gid = jget('gid', 'int'); $g_view_uids = array(); if ($gid > 0) { $ginfo = jtable('buddy_follow_group')->info($gid); if ($ginfo && $ginfo['count'] > 0 && $ginfo['uid'] == MEMBER_ID) { $groupid = $gid; $groupname = $ginfo['name']; $g_view_uids = jtable('buddy_follow_group_relation')->get_my_group_uids(MEMBER_ID, $gid); } } if ($g_view_uids) { $options['uid'] = $g_view_uids; } else { exit; } } else { if ('mylastpublish' == $this->Code) { $topic_list = $this->TopicLogic->Get(" where `uid`='" . MEMBER_ID . "' order by `dateline` desc limit 0,1 "); $temp_last_topic = end($topic_list); if ($temp_last_topic['item'] == 'reward' && !$this->item) { $this->item = 'reward'; } $no_from = false; $ref_mod = $this->Post['ref_mod']; $talk_r = $this->Post['r']; if ($talk_r == 'answer' || $talk_r == 'talk') { $tpl = 'talk_item_ajax'; } $ref_code = $this->Post['ref_code']; $no_from = $this->_no_from($ref_mod, $ref_code); $topic_list_get = true; if ($ref_mod == 'live' || $ref_mod == 'talk') { foreach ($topic_list as $key => $val) { $item = $topic_list[$key]['item']; $itemid = $topic_list[$key]['item_id']; $uid = $topic_list[$key]['uid']; $user_type = DB::result_first("SELECT type FROM " . DB::table('item_user') . " WHERE item = '{$item}' AND itemid='{$itemid}' AND uid = '{$uid}'"); $topic_list[$key]['user_css'] = $item . $user_type; if ($ref_mod == 'talk' && $user_type == 'guest') { $topic_list[$key]['user_str'] = '本期嘉宾'; } else { $topic_list[$key]['user_str'] = ' '; } } $no_mBlog_linedot2 = false; } else { $no_mBlog_linedot2 = true; } } else { if ('updatecurrent' == $this->Code) { $tid = intval($this->Post['tid']); if (empty($tid)) { exit; } $refcode = trim($this->Post['refcode']); $refmod = trim($this->Post['refmod']); $tpl = 'topic_item_ajax'; if ('topic' == $refmod && 'myfavorite' == $refcode) { $sql = "SELECT TF.dateline as favorite_time , T.*\r\n\t\t\t\t\t\tFROM " . DB::table("topic_favorite") . " AS TF\r\n\t\t\t\t\t\tLEFT JOIN " . DB::table("topic") . " AS T\r\n\t\t\t\t\t\tON T.tid=TF.tid where T.tid='{$tid}'"; $this->Code = $refcode; $topic_parent_disable = true; } else { $sql = "SELECT * FROM " . DB::table('topic') . " WHERE tid='{$tid}'"; } $data = DB::fetch_first($sql); if (empty($data)) { exit; } if (isset($data['favorite_time'])) { $data['favorite_time'] = my_date_format2($data['favorite_time']); } $val = $this->TopicLogic->Make($data, 0, array(), 0); $topic_list[] = $val; $no_from = false; if ('vote' == $refmod && 'view' == $refcode) { $no_from = true; } if ($refmod == 'qun') { $this->Module = 'qun'; } if ($refcode == 'reply_list_ajax') { $tpl = 'topic_comment_item'; $topic_parent_disable = true; $v = $val; } $topic_list_get = true; } else { if ('mycomment' == $this->Code) { $options['where'] = " `touid`='" . MEMBER_ID . "' "; } elseif ('tocomment' == $this->Code) { $title = '我评论的'; $topic_selected = 'tocomment'; $options['where'] = " `uid` = '" . MEMBER_ID . "' and `type` in ('both','reply') "; } elseif ('myblog' == $this->Code) { $options['uid'] = $uid; } else { if ('myfavorite' == $this->Code) { $uid = MEMBER_ID; $sql = "select TF.dateline as favorite_time , T.* from `" . TABLE_PREFIX . "topic_favorite` TF left join `" . TABLE_PREFIX . "topic` T on T.tid=TF.tid where TF.uid='{$uid}' order by TF.id desc {$limit}"; $query = $this->DatabaseHandler->Query($sql); while (false != ($row = $query->GetRow())) { if ($row['tid'] < 1) { continue; } $row['favorite_time'] = my_date_format2($row['favorite_time']); $topic_list[$row['tid']] = $row; } $topic_list = $this->TopicLogic->MakeAll($topic_list); $topic_list_get = true; } else { if ('favoritemy' == $this->Code) { $uid = MEMBER_ID; $sql = "select TF.dateline as favorite_time , TF.tuid , T.* from `" . TABLE_PREFIX . "topic_favorite` TF left join `" . TABLE_PREFIX . "topic` T on T.tid=TF.tid where TF.tuid='{$uid}' order by TF.id desc {$limit}"; $query = $this->DatabaseHandler->Query($sql); $tuids = array(); while (false != ($row = $query->GetRow())) { if ($row['tid'] < 1) { continue; } $row['favorite_time'] = my_date_format2($row['favorite_time']); $topic_list[$row['tid']] = $row; $tuids[$row['tuid']] = $row['tuid']; } $topic_list = $this->TopicLogic->MakeAll($topic_list); if ($tuids) { $topic_members = $this->TopicLogic->GetMember($tuids, "`uid`,`ucuid`,`username`,`nickname`,`face_url`,`face`,`validate`"); } $topic_parent_disable = true; $topic_list_get = true; } else { if ('topicnew' == $params['code']) { $title = '最新内容'; $options['where'] = ''; $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 NEDU defined('NEDU_MOYO') && nlogic('feeds.app.jsg')->on_ajax_topic_request($options); #endif if (!$topic_list_get) { if ($cache_time > 0 && $cache_key && !$options['tid']) { $options = jlogic('topic_list')->get_options($options, $cache_time, $cache_key); } $info = jlogic('topic_list')->get_data($options); $topic_list = array(); $total_record = 0; if (!empty($info)) { $topic_list = $info['list']; $total_record = $info['count']; $page_arr = $info['page']; } } $topic_list_count = 0; if ($topic_list) { $topic_list_count = count($topic_list); if (!$topic_parent_disable) { $parent_list = $this->TopicLogic->GetParentTopic($topic_list); } $relate_list = $this->TopicLogic->GetRelateTopic($topic_list); } if ($tpl == 'talk_item_ajax') { $answer_list = array(); if ($parent_list) { $answer_list = $topic_list; $topic_list = $parent_list; } foreach ($topic_list as $key => $val) { if (empty($topic_list[$key]['touid'])) { $topic_list[$key]['biank_css'] = 'talk_view_ping'; $topic_list[$key]['tubiao_css'] = 'talk_view_pin'; } else { $topic_list[$key]['biank_css'] = 'talk_view_wenda'; $topic_list[$key]['tubiao_css'] = 'talk_view_wen'; $topic_list[$key]['ask_list'] = $answer_list; foreach ($topic_list[$key]['ask_list'] as $k => $v) { $topic_list[$key]['ask_list'][$k]['tubiao_css'] = 'talk_view_da'; $topic_list[$key]['ask_list'][$k]['user_css'] = 'talkguest'; } } } } #if NEDU defined('NEDU_MOYO') && nlogic('feeds.app.jsg')->on_ajax_topic_response($topic_list, $page_arr); #endif include template($tpl); }
function Topic() { $rets = array(); $rets_get = false; $options = array(); $topic_list = array(); $uid = MEMBER_ID; if ($uid < 1) { exit; } $type = jget('type'); $tpl_file = jget('tpl') ? 'output/' . jget('tpl') : 'output/output_topic'; $limit = (int) (jget('limit') ? jget('limit') : jget('count')); if ($limit < 1 || $limit > 200) { $limit = 10; } $options['count'] = $limit; if ('home' == $type) { $options['uid'] = get_buddyids($uid, $this->Config['topic_myhome_time_limit']); $options['uid'][$uid] = $uid; $options['type'] = 'first'; } elseif ('at' == $type) { $options['tid'] = jtable('topic_mention')->get_ids(array('uid' => $uid, 'sql_order' => ' `id` DESC ', 'result_count' => $limit), 'tid'); } elseif ('reply' == $type) { $options['where'] = " `type` IN ('reply','both') AND `totid`>'0' "; } elseif ('recommend' == $type) { $rets_get = true; $p = $options; $p['where'] = " tr.recd > '0' "; $rets = jlogic('topic_list')->get_recd_list($p); } else { } if (!$rets_get) { $rets = jlogic('topic_list')->get_data($options); } if ($rets) { $topic_list = $rets['list']; } if ($topic_list) { $parent_list = jlogic('topic')->GetParentTopic($topic_list); } $output = jget('output'); if ('json' == $output) { echo json_encode($rets); } else { include template($tpl_file); } }
function PmGroupList() { $uid = (int) MEMBER_ID; $gid = (int) $this->Post['group_id']; if ($uid < 1) { exit('请先登录后再操作'); } $member_info = jsg_member_info($uid); $group_name = ''; $count = 0; $perpage = 7; $page = max(1, jget('page', 'int')); $uids = array(); if ($gid > 0 && ($row = $group_info = jtable('buddy_follow_group')->info($gid)) && $row['uid'] == $uid) { $group_name = $group_info['name']; $count = $group_info['count']; if ($count > 0) { $p = array('uid' => $uid, 'gid' => $gid, 'result_count' => $count, 'per_page_num' => $perpage, 'sql_order' => ' `dateline` DESC '); $uids = jtable('buddy_follow_group')->get_ids($p, 'touid'); } } else { $count = $member_info['follow_count']; if ($count > 0) { $p = array('uid' => $uid, 'result_count' => $count, 'pre_page_num' => $perpage, 'sql_order' => ' `dateline` DESC '); $uids = get_buddyids($p); } } if ($count > 0) { $page_html = ajax_page($count, $perpage, $page, 'pm_group_list', $gid); $members = $this->TopicLogic->GetMember("where `uid` in (" . jimplode($uids) . ")", "`uid`,`ucuid`,`username`,`fans_count`,`validate`,`province`,`city`,`face`,`nickname`"); foreach ($members as $_m) { $member_list[$_m['uid']]['uid'] = $_m['uid']; $member_list[$_m['uid']]['nickname'] = $_m['nickname']; $member_list[$_m['uid']]['face'] = $_m['face']; } } include template('pm/pm_follow_user_ajax'); }
function may_interest_user($retry = FALSE, $getNum = 4) { $uid = MEMBER_ID; if ($uid < 1) { return array(); } $buddyids = get_buddyids($uid, $GLOBALS['_J']['config']['topic_myhome_time_limit']); $type_array = array(); if ($GLOBALS['_J']['config']['same_city']) { $type_array[] = 'city'; } if (!$retry) { $retry = $type_array = array('follow', 'tag', 'user_tag'); } else { $type_array = $retry; } $refresh_type = $type_array[array_rand($type_array, 1)]; $cache_time = 1800; $cache_key = "{$uid}-may_interest_user-" . $refresh_type; if (false === ($cache_data = cache_db('get', $cache_key))) { $uids = array(); $uids_limit = 300; if ($refresh_type == 'follow') { if ($buddyids) { $rs = array(); $imax = min(10, count($buddyids)); for ($i = 0; $i < $imax; $i++) { $bid = (int) $buddyids[array_rand($buddyids)]; if ($bid > 0 && !isset($rs[$bid])) { $rs[$bid] = 1; $p = array('uid' => $bid, 'buddy_lastuptime' => TIMESTAMP - 864000, 'result_count' => 100, 'sql_order' => ' `dateline` DESC '); $ids = get_buddyids($p); if ($ids) { $uids = array_merge($uids, $ids); $uids = array_unique($uids); if (count($uids) >= $uids_limit) { break; } } } } } } elseif ($refresh_type == 'tag') { $query = DB::query("SELECT `tag` FROM " . DB::table('tag_favorite') . " where uid='{$uid}'"); $touser_tag = array(); while ($value = DB::fetch($query)) { $touser_tag[] = $value['tag']; } if ($touser_tag) { $query = DB::query("SELECT `uid` FROM " . DB::table('tag_favorite') . " where `tag` in ('" . implode("','", $touser_tag) . "') ORDER BY `id` DESC LIMIT {$uids_limit} "); while ($value = DB::fetch($query)) { $uids[$value['uid']] = $value['uid']; } } } elseif ($refresh_type == 'user_tag') { $query = DB::query("SELECT `tag_id`,`uid` FROM " . DB::table('user_tag_fields') . " where uid='{$uid}'"); $touser_usertag_uid = array(); while ($value = DB::fetch($query)) { $touser_usertag_uid[$value['tag_id']] = $value['tag_id']; } if ($touser_usertag_uid) { $query = DB::query("SELECT `uid` FROM " . DB::table('user_tag_fields') . " where `tag_id` in ('" . implode("','", $touser_usertag_uid) . "') ORDER BY `id` DESC LIMIT {$uids_limit} "); while ($value = DB::fetch($query)) { $uids[$value['uid']] = $value['uid']; } } } elseif ($refresh_type == 'city') { $member_info = jsg_member_info($uid); if ($member_info['city']) { $query = DB::query("select `uid` from " . DB::table('members') . " where `city` = '{$member_info['city']}' ORDER BY `lastactivity` DESC LIMIT {$uids_limit} "); while ($value = DB::fetch($query)) { $uids[$value['uid']] = $value['uid']; } } } } else { $uids = $cache_data['uids']; $refresh_type = $cache_data['refresh_type']; } $member_list = array(); $black_list = array(); $query = DB::query(" select `touid` from `" . TABLE_PREFIX . "blacklist` where `uid` = '{$uid}'"); while ($rs = DB::fetch($query)) { $black_list[$rs['touid']] = $rs['touid']; } if ($uids) { if ($buddyids || $black_list) { foreach ($uids as $k => $v) { if (isset($buddyids[$v])) { unset($uids[$k]); } if (isset($black_list[$v])) { unset($uids[$k]); } if ($v == $uid) { unset($uids[$k]); } } } if ($uids) { if (false === $cache_data) { $cache_data['uids'] = $uids; $cache_data['refresh_type'] = $refresh_type; cache_db('set', $cache_key, $cache_data, $cache_time); } $rand_number = count($uids) > $getNum ? $getNum : count($uids); $rand_uids1 = array_rand($uids, $rand_number); if ($rand_uids1) { if (is_array($rand_uids1)) { foreach ($rand_uids1 as $key => $val) { $rand_uids[$val] = $uids[$val]; } } else { $rand_uids[$rand_uids1] = $uids[$rand_uids1]; } } if ($rand_uids) { $condition = " WHERE `uid` IN ('" . implode("','", $rand_uids) . "') LIMIT {$rand_number} "; $member_list = jlogic('topic')->GetMember($condition); $member_list = jlogic('buddy')->follow_html($member_list, 'uid', 'follow_html2', 0, 1); foreach ($member_list as $k => $row) { if ($row['is_follow']) { unset($member_list[$k]); } else { $_uid = $row['uid']; $count = 1; $i = 0; $moreHTML = ''; if ('follow' == $refresh_type) { $fansids = jlogic('buddy')->get_fansids(array('uid' => $_uid, 'touid' => $buddyids)); $fan_info = jtable('members')->get(array('uid' => $fansids)); foreach ($fan_info['list'] as $key => $val) { if ($i > 1) { break; } $i++; $moreHTML = $moreHTML . ($moreHTML ? "、" : '') . "<a href='index.php?mod={$val['uid']}'>{$val['nickname']}</a>"; } $count = count($fansids); } elseif ('user_tag' == $refresh_type) { $user_tag_list = array(); $query = DB::query("SELECT A.`tag_id`,A.`tag_name` FROM " . DB::table('user_tag_fields') . " A, " . DB::table('user_tag_fields') . " B WHERE A.uid='{$_uid}' AND B.uid='{$uid}' AND B.tag_id=A.tag_id"); while ($rs = DB::fetch($query)) { $user_tag_list[$rs['tag_id']] = $rs; if ($i < 2) { $moreHTML .= ($moreHTML ? '、' : '') . $rs['tag_name']; } $i++; } $count = count($user_tag_list); } elseif ('tag' == $refresh_type) { $user_tag_list = array(); $query = DB::query("SELECT A.id,A.tag FROM " . DB::table('tag_favorite') . " A, " . DB::table('tag_favorite') . " B WHERE A.uid='{$_uid}' AND B.uid='{$uid}' AND B.tag=A.tag"); while ($rs = DB::fetch($query)) { $user_tag_list[$rs['id']] = $rs; if ($i < 2) { $moreHTML .= ($moreHTML ? '、' : '') . "<a href='inde.php?mod=tag&code={$rs['tag']}'>{$rs['tag']}</a>"; } $i++; } $count = count($user_tag_list); } $row['moreHtml'] = $moreHTML; $row['count'] = $count; $row['refresh_type'] = $refresh_type; $member_list[$k] = $row; } } } } } $this->member_list = array_merge($this->member_list, $member_list); if ((!$member_list || count($this->member_list) < 5) && count($retry) > 1) { $key = array_search($refresh_type, $retry); unset($retry[$key]); $member_list = $this->may_interest_user($retry, $getNum); } return array_slice($this->member_list, 0, 5); }
function joined() { $page = empty($this->Get['page']) ? 0 : intval($this->Get['page']); $type = trim($this->Get['type']); $vid = empty($this->Get['vid']) ? 0 : intval($this->Get['vid']); if ($page == 0) { $page = 1; } $prepage = 6; $start = ($page - 1) * $prepage; $where_sql = " 1 "; $page_param = array(); if ($type == 'follow') { $this->_check_login(); $buddy_ids = get_buddyids(MEMBER_ID); $where_sql .= " AND vu.vid='{$vid}' AND uid IN(" . jimplode($buddy_ids) . ") "; $page_param = array('c' => 2); } else { $type = 'all'; $where_sql .= " AND vu.vid='{$vid}' "; $page_param = array('c' => 1); } $order_sql = " vu.dateline DESC "; $count = DB::result_first("SELECT COUNT(*) FROM " . DB::table('vote_user') . " AS vu WHERE {$where_sql}"); if ($count) { $query = DB::query("SELECT vu.*,m.nickname\r\n\t\t\t\t\t FROM " . DB::table('vote_user') . " AS vu\r\n\t\t\t\t\t LEFT JOIN " . DB::table("members") . " AS m\r\n\t\t\t\t\t USING (uid)\r\n\t\t\t\t\t WHERE {$where_sql}\r\n\t\t\t\t\t ORDER BY {$order_sql}\r\n\t\t\t\t\t LIMIT {$start},{$prepage}"); while ($value = DB::fetch($query)) { $value['option'] = unserialize($value['option']); $value['option'] = '"' . implode('","', $value['option']) . '"'; $value['dateline'] = my_date_format2($value['dateline']); if (empty($value['username'])) { $value['nickname'] = '**'; } $list[] = $value; } $multi = ajax_page($count, $prepage, $page, 'getVoteJoined', $page_param); } include template('vote/vote_ajax_joined'); }
function LiveLogic() { $buddyids = get_buddyids(MEMBER_ID); $this->mybuddys = is_array($buddyids) ? $buddyids : array($buddyids); $this->TopicLogic = jlogic('topic'); }
function index() { $view = empty($this->Get['view']) ? '' : trim($this->Get['view']); $filter = empty($this->Get['filter']) ? '' : trim($this->Get['filter']); $uid = empty($this->Get['uid']) ? 0 : intval($this->Get['uid']); $gets = array('mod' => 'vote', 'view' => $this->Get['view'], 'filter' => $this->Get['filter']); $page_url = 'index.php?' . url_implode($gets); $perpage = $this->ShowConfig['vote']['list']; $perpage = empty($perpage) ? 20 : $perpage; $tpl = 'vote/vote_index'; $where_sql = " 1 "; switch ($view) { case 'new': $this->Title = '最新投票'; $order_sql = ' ORDER BY dateline DESC '; break; case 'me': if ($uid && $uid != MEMBER_ID) { $user_info = $this->TopicLogic->GetMember($uid); $this->Title = $user_info['nickname'] . '发起的投票'; if (empty($user_info)) { $this->Messager("当前页面不存在", 'index.php?mod=vote'); } $tpl = 'vote/vote_me'; } else { $this->_check_login(); $this->Title = '我的投票'; $uid = MEMBER_ID; } if ($filter == 'joined') { $vids = $this->VoteLogic->get_joined($uid); if (!empty($vids)) { $where_sql .= " AND `v`.`vid` IN(" . jimplode($vids) . ") "; } else { $where_sql = ' 0 '; } } else { if ($filter == 'new_update') { jlogic('member')->clean_new_remind('vote_new', $uid); $vids = $this->VoteLogic->get_joined($uid); if (!empty($vids)) { $where_sql .= " AND `v`.`vid` IN(" . jimplode($vids) . ") "; } $where_sql .= " OR `v`.`uid`='{$uid}' "; } else { $where_sql .= " AND `v`.`uid`='{$uid}' "; $filter = 'created'; } } $order_sql = ' ORDER BY lastvote DESC '; break; case 'fllow': $this->_check_login(); $this->Title = '我关注的人的投票'; $buddyids = get_buddyids(MEMBER_ID); if ($filter == 'joined') { $vids = $this->VoteLogic->get_joined($buddyids); if (!empty($vids)) { $where_sql .= " AND `v`.`vid` IN(" . jimplode($vids) . ") "; } else { $where_sql = ' 0 '; } } else { if (!empty($buddyids)) { $where_sql .= " AND `v`.`uid` IN (" . jimplode($buddyids) . ") "; } else { $where_sql = ' 0 '; } $filter = 'created'; } $order_sql = ' ORDER BY dateline DESC '; break; default: $this->Title = '最新参与投票'; $view = 'newjoin'; $where_sql .= " AND v.expiration >= '" . time() . "' AND v.lastvote > 0 "; $order_sql = ' ORDER BY v.lastvote DESC '; break; } if (!empty($filter)) { $filter_on[$filter] = 'class="v_on"'; } $where_sql .= " AND v.verify = 1"; $param = array('where' => $where_sql, 'order' => $order_sql, 'page' => true, 'perpage' => $perpage, 'page_url' => $page_url); $vote_info = $this->VoteLogic->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); } $this->Title .= ' | 微博投票'; $active[$view] = 'class="tago"'; $member = jsg_member_info(MEMBER_ID); if ($member['medal_id']) { $medal_list = $this->TopicLogic->GetMedal($member['medal_id'], $member['uid']); } $recd_list = $this->VoteLogic->get_recd_list(); include template($tpl); }
function get_photo_list($param) { $sql_where = ''; $uid = max(0, (int) $param['uid']); $cache_key = "{$uid}-get_photo_list-" . md5(serialize($param)); if (false === ($info = cache_db('get', $cache_key))) { if ($uid > 0) { $uids = get_buddyids($uid, $GLOBALS['_J']['config']['topic_myhome_time_limit']); if ($uids) { $sql_where = " AND t.uid in(" . jimplode($uids) . ") "; } else { return array(); } } $total_photo = (int) $param['count']; if ($total_photo < 1) { if ($param['vip']) { $total_photo = DB::result_first("select count(1) as `total` from " . DB::table('topic_image') . " t left join " . DB::table('members') . " m on m.uid=t.uid where t.tid>0 and m.validate='1'" . $sql_where); } else { $total_photo = DB::result_first("SELECT COUNT(*) FROM " . DB::table('topic_image') . " AS t WHERE t.tid > 0 " . $sql_where); } } $info = false; $limit_sql = ''; $photo_i = 0; $topic_list = array(); $user_lists = array(); if ($total_photo > 0) { if ($param['perpage']) { $page_arr = page($total_photo, $param['perpage'], $param['page_url'], array('return' => 'array')); $limit_sql = $page_arr['limit']; } else { if ($param['limit']) { $limit_sql = ' LIMIT ' . $param['limit']; } elseif ($param['count']) { $limit_sql = ' LIMIT ' . $param['count']; } } if ($param['vip']) { $query = DB::query("SELECT t.id,t.tid,t.uid,t.name,t.width,t.height,t.dateline,tr.content,tr.content2,tr.forwards,tr.replys,tr.digcounts\r\n\t\t\t\t\t\t\t\t\tFROM " . DB::table('topic_image') . " AS t\r\n\t\t\t\t\t\t\t\t\tLEFT JOIN " . DB::table('topic') . " AS tr\r\n\t\t\t\t\t\t\t\t\tON t.tid = tr.tid\r\n\t\t\t\t\t\t\t\t\tleft join " . DB::table('members') . " as m\r\n\t\t\t\t\t\t\t\t\ton m.uid=t.uid\r\n\t\t\t\t\t\t\t\t\tWHERE t.tid > 0 and m.validate='1' " . $sql_where . "\r\n\t\t\t\t\t\t\t\t\tORDER BY t.id DESC\r\n\t\t\t\t\t\t\t\t\t{$limit_sql} "); } else { $query = DB::query("SELECT t.id,t.tid,t.uid,t.name,t.width,t.height,t.dateline,tr.content,tr.content2,tr.forwards,tr.replys,tr.digcounts\r\n\t\t\t\t\t\t\t\t\tFROM " . DB::table('topic_image') . " AS t\r\n\t\t\t\t\t\t\t\t\tLEFT JOIN " . DB::table('topic') . " AS tr\r\n\t\t\t\t\t\t\t\t\tON t.tid = tr.tid\r\n\t\t\t\t\t\t\t\t\tWHERE t.tid > 0 " . $sql_where . "\r\n\t\t\t\t\t\t\t\t\tORDER BY t.id DESC\r\n\t\t\t\t\t\t\t\t\t{$limit_sql} "); } while ($value = DB::fetch($query)) { $value['content'] .= $value['content2']; $value['content'] = jhtmlspecialchars(strip_tags($value['content'])); if (!is_file(topic_image($value['id'], 'photo', 1))) { $image_file = RELATIVE_ROOT_PATH . 'images/topic/' . face_path($value['id']) . $value['id'] . "_o.jpg"; $image_file_photo = RELATIVE_ROOT_PATH . 'images/topic/' . face_path($value['id']) . $value['id'] . "_p.jpg"; if ($value['width'] > 280) { $p_width = 280; $p_height = round($value['height'] * 280 / $value['width']); $result = makethumb($image_file, $image_file_photo, $p_width, $p_height); } if ($value['width'] <= 280 || !$result && !is_file($image_file_photo)) { @copy($image_file, $image_file_photo); } } $value['photo'] = topic_image($value['id'], 'photo', 0); $value['height'] = $value['width'] > 280 ? round($value['height'] * 280 / $value['width']) : $value['height']; $value['width'] = $value['width'] > 280 ? 280 : $value['width']; $value['dateline'] = my_date_format2($value['dateline']); if (false != strpos($value['content'], '</U>')) { $value['content'] = preg_replace('#\\<U(.*?)\\>(.*?)\\</U\\>#', '<a href="\\2" target="_blank">Click Here</a>', $value['content']); } if (false !== strpos($value['content'], 'http:/' . '/')) { $value['content'] = preg_replace('~(http:/' . '/[a-z0-9-\\.\\?\\=&;_@/%#]+?)\\s+~i', '<a href="\\1" target="_blank">Click Here</a> ', $value['content']); $value['content'] = preg_replace("|\\s*http:/" . "/[a-z0-9-\\.\\?\\=&;_@/%#]*\$|sim", "", $value['content']); } $topic_list[] = $value; } if ($topic_list) { $topic_list_count = count($topic_list); $topic_list = $this->TopicLogic->MakeAll($topic_list, 0); $info = array('list' => $topic_list, 'count' => $param['count'] ? $topic_list_count : $total_photo, 'page' => $page_arr); } } cache_db('set', $cache_key, $info, $uid > 0 ? 3600 : 600); } if ($info['count'] > 0 && $info['list']) { if ($GLOBALS['_J']['config']['is_topic_user_follow'] && !$GLOBALS['_J']['disable_user_follow']) { $info['list'] = buddy_follow_html($info['list'], 'uid', 'follow_html2'); } $pi = 0; $list = array(); foreach ($info['list'] as $v) { $list[$pi++ % 3][] = $v; } $info['list'] = $list; } return $info; }
function getEventList() { $uid = (int) get_param('uid'); if ($uid < 1) { echo '登录可见'; } $buddys = get_buddyids($uid); $limit = 10; switch ($this->Code) { case 'buddys_create_event': if (!empty($buddys)) { $param['where'] = " a.postman in (" . jimplode($buddys) . ") and a.verify = 1 "; $param['order'] = " order by a.lasttime desc,a.app_num desc,a.posttime desc "; $param['limit'] = " LIMIT {$limit} "; $return = jlogic('event')->getEventinfo($param); } break; case 'buddys_joined_event': if (!empty($buddys)) { $param['where'] = " m.play = 1 and m.fid in (" . jimplode($buddys) . ") "; $param['order'] = " order by a.lasttime desc,a.app_num desc,a.posttime desc "; $param['limit'] = " LIMIT {$limit} "; $return = jlogic('event')->getEvents($param); } break; case 'recd_event': $return['event_list'] = jlogic('event')->getHotEvent(); break; } if ($return['event_list']) { foreach ($return['event_list'] as $val) { $html .= "<li>\r\n\t\t\t\t\t\t\t<span class='boxRl listyle'><a href='index.php?mod=event&code=detail&id={$val['id']}' target='_blank'>{$val['title']}</a></span>\r\n\t\t\t\t\t\t\t<span style='float:right;'>(共{$val['app_num']}人报名)</span>\r\n\t\t\t\t\t\t</li>"; } } echo $html ? $html : '暂无相关内容'; }
function Main() { if ($this->MemberHandler->HasPermission($this->Module, $this->Code) == false) { $this->Messager($this->MemberHandler->GetError(), null); } $act_list = array(); if ($this->Config['company_enable']) { $act_list['company'] = '同单位'; } if (!$this->Config['profile_search_close']) { $act_list['search'] = '同城用户'; } if (!$this->Config['profile_maybe_friend_close']) { $act_list['maybe_friend'] = '同兴趣'; } if (!$this->Config['profile_usertag_close']) { $act_list['usertag'] = '同类人'; } if (!$this->Config['profile_role_close']) { $act_list['role'] = '同分组'; } if (false == jconf::get('invite', 'link_display_none')) { $act_list['invite'] = '邀请好友'; } $act = $this->Code; $member = $this->Member; if ($member['medal_id']) { $medal_list = $this->TopicLogic->GetMedal($member['medal_id'], $member['uid']); } $member_nickname = $member['nickname']; if ('invite' == $act) { $sql = "delete from `" . TABLE_PREFIX . "invite` where `fuid`<'1' and `dateline`>'0' and `dateline`<'" . (time() - 86400 * 7) . "'"; $this->DatabaseHandler->Query($sql); $sql = "select count(*) as my_invite_count from `" . TABLE_PREFIX . "invite` where `uid`='{$member['uid']}'"; $query = $this->DatabaseHandler->Query($sql); $row = $query->GetRow(); $my_invite_count = $row['my_invite_count']; $can_invite_count = max(0, $this->Config['invite_count_max'] - $my_invite_count); if ($my_invite_count > 0) { $per_page_num = 5; $query_link = "index.php?mod=" . ($_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module) . ($this->Code ? "&code={$this->Code}" : ""); $_config = array('return' => 'array'); $page_arr = page($my_invite_count, $per_page_num, $query_link, $_config); $sql = "select i.*,m.province,m.city,m.topic_count,m.fans_count,m.nickname as fusername from `" . TABLE_PREFIX . "invite` i\r\n\t\t\t\t\t\tleft join `" . TABLE_PREFIX . "members` m on m.uid = i.fuid\r\n\t\t\t\t\t \twhere i.`uid`='{$member['uid']}' order by i.`id` desc {$page_arr['limit']}"; $query = $this->DatabaseHandler->Query($sql); $invite_list = array(); while (false != ($row = $query->GetRow())) { $row['from_area'] = $row['province'] ? $row['province'] . ' ' . $row['city'] : '无'; $row['face'] = face_get($row['fuid']); $invite_list[] = $row; } $invite_list = buddy_follow_html($invite_list, 'fuid'); } $MEMBER_INVITE_CODE = ''; if (!$this->Config['invite_count_max'] || $this->Config['invite_count_max'] > $member['invite_count']) { $MEMBER_INVITE_CODE = $member['invitecode']; } if (!$MEMBER_INVITE_CODE) { $MEMBER_INVITE_CODE = random(16); $sql = "update `" . TABLE_PREFIX . "members` set `invitecode`='{$MEMBER_INVITE_CODE}' where `uid`='" . MEMBER_ID . "'"; $this->DatabaseHandler->Query($sql); } $inviteURL = "index.php?mod=member&code=" . urlencode(MEMBER_ID . "_" . $MEMBER_INVITE_CODE); $inviteURL = get_invite_url($inviteURL, $this->Config['site_url']); $invite = jconf::get('invite'); $invite_msg = empty($invite) ? '' : jstripslashes($invite['invite_msg']); if (!empty($invite_msg)) { $replaces = array('nickname' => $member['nickname'], 'inviteurl' => $inviteURL, 'invite_num' => $this->Config['invite_limit'], 'site_name' => $this->Config['site_name']); foreach ($replaces as $key => $val) { $invite_msg = str_replace("#" . $key . "#", $val, $invite_msg); } } } elseif ('maybe_friend' == $act) { $my_favorite_tags = jlogic('tag_favorite')->my_favorite_tags(MEMBER_ID, 20); if ($my_favorite_tags) { $uids = jlogic('tag_favorite')->favorite_uids($my_favorite_tags, 30); if ($uids) { $p = array('uid' => MEMBER_ID, 'touid' => $uids, 'result_count' => count($uids)); $buddyids = get_buddyids($p); $sql = "select `uid`,`ucuid`,`username`,`face_url`,`face`,`province`,`city`,`fans_count`,`topic_count`,`validate`,`nickname` from `" . TABLE_PREFIX . "members` where `uid` in('" . implode("','", $uids) . "')"; $query = $this->DatabaseHandler->Query($sql); $member_list = array(); while (false != ($row = $query->GetRow())) { $buddy_status = isset($buddyids[$row['uid']]); if (!$buddy_status && MEMBER_ID != $row['uid']) { $row['follow_html'] = follow_html($row['uid'], $buddy_status); $row = jsg_member_make($row); $member_list[$row['uid']] = $row; $tag_favorite_uids[$row['uid']] = $row['uid']; } } } } $user_favorite = array(); if ($tag_favorite_uids) { $user_favorite = jlogic('tag_favorite')->my_favorite($tag_favorite_uids, 100); } } elseif ('usertag' == $act) { $per_page_num = 10; $query_link = 'index.php?mod=profile&code=usertag'; $order = " order by `fans_count` desc "; $sql = "select * from `" . TABLE_PREFIX . "user_tag_fields` where `uid` = '" . MEMBER_ID . "'"; $query = $this->DatabaseHandler->Query($sql); $mytag = array(); $user_tagid = array(); while (false != ($row = $query->GetRow())) { $mytag[] = $row; $user_tagid[$row['tag_id']] = $row['tag_id']; } if ($user_tagid) { $sql = "select * from `" . TABLE_PREFIX . "user_tag_fields` where `uid` != '" . MEMBER_ID . "' and `tag_id` in (" . jimplode($user_tagid) . ") "; $query = $this->DatabaseHandler->Query($sql); $member_uids = array(); while (false != ($row = $query->GetRow())) { $member_uids[$row['uid']] = $row['uid']; } $where = $where_list = " where `uid` in (" . jimplode($member_uids) . ")"; } if ($member_uids) { $member_list = array(); $sql = "select count(*) as `total_record` from `" . TABLE_PREFIX . "members` {$where}"; $total_record = DB::result_first($sql); if ($total_record > 0) { $_config = array('return' => 'array'); $page_arr = page($total_record, $per_page_num, $query_link, $_config); $member_list = $this->TopicLogic->GetMember("{$where} {$order} {$page_arr['limit']}", "`uid`,`ucuid`,`username`,`nickname`,`face_url`,`face`,`fans_count`,`topic_count`,`province`,`city`,`validate`"); $member_list = buddy_follow_html($member_list); } $sql = "select * from `" . TABLE_PREFIX . "user_tag_fields` {$where}"; $query = $this->DatabaseHandler->Query($sql); $member_tag = array(); while (false != ($row = $query->GetRow())) { $member_tag[] = $row; } } $mytag = $this->_MyUserTag(MEMBER_ID); } else { $per_page_num = 10; $query_link = 'index.php?mod=profile&code=' . $act; $where_list = array(); if ('search' == $act) { $province_name = $member['province']; $city_name = $member['city']; $area_name = $member['area']; $street_name = $member['street']; $province = $this->Get['province']; $city = $this->Get['city']; $area = $this->Get['area']; $street = $this->Get['street']; if ($province) { $province_name = DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '{$province}'"); if ($city) { $city_name = DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '{$city}'"); if ($area) { $area_name = DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '{$area}'"); if ($street) { $street_name = DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '{$street}'"); } else { $street_name = ''; } } else { $area_name = ''; $street_name = ''; } } else { $city_name = ''; $area_name = ''; $street_name = ''; } } if (empty($where_list)) { if ($province_name) { $where_list['province'] = "`province`='" . addslashes("{$province_name}") . "'"; $query_link .= "&province=" . $province; if ($city_name) { $where_list['city'] = "`city`='" . addslashes("{$city_name}") . "'"; $query_link .= "&city=" . $city; if ($area_name) { $where_list['area'] = "`area`='" . addslashes("{$area_name}") . "'"; $query_link .= "&area=" . $area; if ($street_name) { $where_list['street'] = "`street`='" . addslashes("{$street_name}") . "'"; $query_link .= "&street=" . $street; } } } } } $query = $this->DatabaseHandler->Query("select * from " . TABLE_PREFIX . "common_district where `upid` = '0' order by list"); while ($rsdb = $query->GetRow()) { $province_arr[$rsdb['id']]['value'] = $rsdb['id']; $province_arr[$rsdb['id']]['name'] = $rsdb['name']; if ($member['province'] == $rsdb['name']) { $province_id = $rsdb['id']; } } $province_id = $province ? $province : $province_id; $province_list = jform()->Select("province", $province_arr, $province_id, "onchange=\"changeProvince();\""); $hid_area = ''; $hid_city = ''; $hid_street = ''; if (!$province && $province_id) { if ($member['city']) { $hid_city = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '{$member['city']}' and upid = '{$province_id}'"); } if ($hid_city) { if ($member['area']) { $hid_area = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '{$member['area']}' and upid = '{$hid_city}'"); } if ($hid_area) { if ($member['street']) { $hid_street = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '{$member['street']}' and upid = '{$hid_area}'"); } } } } $hid_city = $city ? $city : $hid_city; $hid_area = $area ? $area : $hid_area; $hid_street = $street ? $street : $hid_street; } elseif ('company' == $act && $this->Config['company_enable'] && @is_file(ROOT_PATH . 'include/logic/cp.logic.php')) { global $_J; $companyid = jget('companyid', 'int'); $departmentid = jget('departmentid', 'int'); $jobid = jget('jobid', 'int'); if ($companyid < 1 && $departmentid < 1 && $jobid < 1) { $companyid = (int) $_J['member']['companyid']; $departmentid = (int) $_J['member']['departmentid']; $jobid = (int) $_J['member']['jobid']; } $company_list = jlogic('cp')->get_cp_html($companyid); if ($this->Config['department_enable']) { $department_list = jlogic('cp')->get_cp_html($departmentid, 'department', $companyid); } $job_list = jlogic('job')->get_job_select($jobid); if ($companyid > 0) { $where_list['company'] = "`companyid`='" . $companyid . "'"; $query_link .= '&companyid=' . $companyid; } if ($departmentid > 0) { $where_list['department'] = "`departmentid`='" . $departmentid . "'"; $query_link .= '&departmentid=' . $departmentid; } if ($jobid > 0) { $where_list['job'] = "`jobid`='" . $jobid . "'"; $query_link .= '&jobid=' . $jobid; } } else { global $_J; $roleid = $this->Get['roleid'] ? (int) $this->Get['roleid'] : ($_J['role_id'] ? $_J['role_id'] : 0); $roles = jlogic('channel')->get_user_role(); $role_list = jform()->Select("roleid", $roles, $roleid, ""); if ($roleid) { $where_list['role'] = "`role_id`='" . $roleid . "'"; $query_link .= "&roleid=" . $roleid; } } $member_list = array(); if ($where_list) { $where = empty($where_list) ? null : ' WHERE ' . implode(' AND ', $where_list) . ' '; $order = " order by `uid` desc "; $sql = "select count(*) as `total_record` from `" . TABLE_PREFIX . "members` {$where} "; $total_record = DB::result_first($sql); if ($total_record > 0) { $_config = array('return' => 'array'); $page_arr = page($total_record, $per_page_num, $query_link, $_config); $uids = array(); $member_list = $this->TopicLogic->GetMember("{$where} {$order} {$page_arr['limit']}", "`uid`,`ucuid`,`username`,`nickname`,`face_url`,`face`,`fans_count`,`topic_count`,`province`,`city`,`aboutme`"); foreach ($member_list as $_m) { $uids[$_m['uid']] = $_m['uid']; } if ($uids && MEMBER_ID > 0) { $member_list = buddy_follow_html($member_list); $province = isset($_GET['province']) ? $province : $member['province']; $city = isset($_GET['city']) ? $city : $member['city']; $sql = "select * from (select * from `" . TABLE_PREFIX . "topic` where `uid` in (" . jimplode($uids) . ") and `type` != 'reply' order by `dateline` desc) a group by `uid` "; $query = $this->DatabaseHandler->Query($sql); $tids = array(); while (false != ($row = $query->GetRow())) { $tids[$row['tid']] = $row['tid']; } $topic_list = $this->TopicLogic->Get($tids); } } } $gender_radio = jform()->Radio('gender', array(0 => array('name' => '不限', 'value' => 0), 1 => array('name' => '男', 'value' => 1), 2 => array('name' => '女', 'value' => 2)), $gender); } $this->Title = $act_list[$act]; include template('social/profile_main'); }
function getListByType($type, $param) { $uid = intval($param['uid']); $uid < 1 && ($uid = MEMBER_ID); $max_tid = intval($param['max_tid']); $perpage = intval($param['perpage']); $code = $type; $code_ary = array('home', 'at_my', 'comment_my', 'my_blog', 'tag', 'new', 'hot_comments', 'hot_forwards', 'my_favorite'); if (!in_array($code, $code_ary)) { return 404; } if (isset($param['topic_parent_disable'])) { $topic_parent_disable = (bool) $param['topic_parent_disable']; } else { $topic_parent_disable = false; } $topic_list_get = false; $options = array(); if ($perpage > 0) { $options['perpage'] = $perpage; } $limit = intval($param['limit']); if ($limit > 0) { $options['limit'] = $limit; } if ($code == "home") { $topic_myhome_time_limit = 0; if ($this->Config['topic_myhome_time_limit'] > 0) { $topic_myhome_time_limit = time() - $this->Config['topic_myhome_time_limit'] * 86400; if ($topic_myhome_time_limit > 0) { $options['dateline'] = $topic_myhome_time_limit; } } $options['uid'] = array($uid); if ($uid == MEMBER_ID) { if ($this->Config['ajax_topic_time']) { DB::query("update " . DB::table('members') . " set `lastactivity`='" . time() . "' where `uid`='{$uid}'"); } $buddyids = get_buddyids($uid, $this->Config['topic_myhome_time_limit']); if ($buddyids) { $options['uid'] = array_merge($options['uid'], $buddyids); } } } else { if ($code == 'at_my') { $topic_ids = jtable('topic_mention')->get_ids(array('uid' => MEMBER_ID, 'result_count' => 1000, 'sql_order' => ' `id` DESC '), 'tid'); if (empty($topic_ids)) { return 400; } $options['tid'] = $topic_ids; } else { if ($code == "comment_my") { $options['where'] = "`touid`='" . MEMBER_ID . "' and `type` in ('both','reply')"; } else { if ($code == 'my_blog') { $uid = intval($param['uid']); if (empty($uid)) { $uid = MEMBER_ID; } else { $member = DB::fetch_first("SELECT * FROM " . DB::table('members') . " WHERE uid='{$uid}'"); if (empty($member)) { return 300; } } $options['uid'] = $uid; } else { if ($code == "tag") { $tag_key = $param['tag_key']; $tag_id = DB::result_first("SELECT id FROM " . DB::table('tag') . " WHERE name='{$tag_key}'"); if (empty($tag_id)) { return 500; } $tag_info = DB::fetch_first("SELECT * FROM " . DB::table('tag') . " WHERE id='{$tag_id}'"); if (empty($tag_info)) { return 400; } $sql = "SELECT `item_id` FROM " . DB::table('topic_tag') . " WHERE `tag_id`='{$tag_id}'"; $query = DB::query($sql); $topic_ids = array(); while ($row = DB::fetch($query)) { $topic_ids[$row['item_id']] = $row['item_id']; } if (empty($topic_ids)) { return 400; } $options['tid'] = $topic_ids; } else { if ($code == 'my_favorite') { $info = $this->_getMyFavorite(array('limit' => $options['limit'], 'max_id' => $max_tid)); if (empty($info)) { return 400; } $topic_list = $info['list']; $total_record = $info['count']; $topic_list_get = true; } else { if ($code == 'new') { $options['type'] = get_topic_type(); } else { if ($code == 'hot_comments') { $time = 30 * 86400; $dateline = time() - $time; $options['type'] = 'first'; $options['where'] = " `replys` > 0 AND dateline >= {$dateline} "; $options['order'] = " `replys` DESC , `dateline` DESC "; $options['perpage'] = $param['limit']; } else { if ($code == 'hot_forwards') { $time = 30 * 86400; $dateline = time() - $time; $options['type'] = 'first'; $options['where'] = " `forwards` > 0 AND dateline >= {$dateline} "; $options['order'] = " `forwards` DESC , `dateline` DESC "; $options['perpage'] = $param['limit']; } } } } } } } } } $keys = array(); if (!$topic_list_get) { if ($max_tid > 0) { $where = " tid<'{$max_tid}' "; if (empty($options['where'])) { $options['where'] = $where; } else { $options['where'] .= " AND " . $where; } } $info = $this->TopicListLogic->get_data($options); $topic_list = array(); $total_record = 0; if (!empty($info)) { $topic_list = $info['list']; $keys = array_keys($topic_list); $topic_list = array_values($topic_list); $total_record = $info['count']; $page_arr = $info['page']; } } $topic_list_count = 0; if ($topic_list) { $topic_list_count = count($topic_list); if (!$topic_parent_disable) { $parent_list = $this->TopicLogic->GetParentTopic($topic_list, 'mycomment' == $this->Code); } $tmp_ary = $topic_list; $tmp_topic = array_pop($tmp_ary); if ($code == 'my_favorite') { $max_tid = $tmp_topic['ft_id']; } else { if (!empty($keys)) { $max_tid = min($keys); } else { $max_tid = $tmp_topic['tid']; } } $result = array('total_record' => $total_record, 'topic_list' => $topic_list, 'parent_list' => $parent_list, 'max_tid' => $max_tid, 'next_page' => 0); if (!empty($page_arr)) { $result['next_page'] = $page_arr['current_page'] + 1; } return $result; } else { return 400; } }
function get_qun_list($parma) { $where_sql = " 1 "; $type = $parma['type']; if ($type == 'managed' || $type == 'joined') { if ($type == 'managed') { $level = "('1', '2')"; } else { $level = "('4')"; } $query = DB::query("SELECT qid\r\n\t\t\t\t\t\t\t\tFROM " . DB::table('qun_user') . "\r\n\t\t\t\t\t\t\t\tWHERE uid=" . MEMBER_ID . " AND level IN {$level}"); $ids = array(); while ($value = DB::fetch($query)) { $ids[] = $value['qid']; } $count = count($ids); if ($count == 0) { return array('row_nums' => 0); } else { $where_sql .= " AND qid IN(" . jimplode($ids) . ") "; } } else { if ($type == 'followed') { $buddyids = get_buddyids(MEMBER_ID); if (empty($buddyids)) { return array('row_nums' => 0); } $ids = array(); $query = DB::query("SELECT qid\r\n\t\t\t\t\t \t\t\tFROM " . DB::table('qun_user') . "\r\n\t\t\t\t\t \t\t\tWHERE uid IN(" . jimplode($buddyids) . ")"); while ($value = DB::fetch($query)) { $ids[] = $value['qid']; } $count = count($ids); if ($count == 0) { return array('row_nums' => 0); } else { $where_sql .= " AND qid IN(" . jimplode($ids) . ") "; } } } $limit_sql = ''; if ($parma['limit']) { $limit_sql = $parma['limit']; } $order_sql = ' member_num DESC'; $list = array(); $recount = 0; if (!is_numeric($parma['limit'])) { $count = DB::result_first("SELECT COUNT(*) FROM " . DB::table('qun') . " WHERE {$where_sql} "); } else { $recount = 1; } if ($count) { $query = DB::query("SELECT *\r\n\t\t\t\t\t\t\t\tFROM " . DB::table('qun') . "\r\n\t\t\t\t\t\t\t\tWHERE {$where_sql}\r\n\t\t\t\t\t\t\t\tORDER BY {$order_sql}\r\n\t\t\t\t\t\t\t\tLIMIT {$limit_sql}"); while ($value = DB::fetch($query)) { if (empty($value['icon'])) { $value['icon'] = $this->qun_avatar($value['qid'], 's'); } $list[] = $value; } if ($recount) { $count = count($list); } } return array('row_nums' => $count, 'list' => $list); }
function ViewGroup() { $member = $this->_member(); if (!$member || MEMBER_ID < 1) { $this->Messager("请先<a href='index.php?mod=login'>点此登录</a>或者<a href='index.php?mod=member'>点此注册</a>一个帐号", 'index.php?mod=login'); } $gid = (int) $this->Get['gid']; if ($gid < 1) { $this->Messager('分组ID不能为空'); } $group_view = jtable('buddy_follow_group')->info(array('id' => $gid, 'uid' => MEMBER_ID)); if (!$group_view) { $this->Messager('您要查看的分组不存在'); } $count = $member['follow_count']; if ($count > 0) { $per_page_num = 24; $page_arr = page($count, $per_page_num, "index.php?mod=topic&code=group&gid={$gid}", array('return' => 'Array')); $p = array('result_count' => $count, 'sql_order' => ' `dateline` DESC ', 'sql_limit' => " {$page_arr['limit']} ", 'uid' => $member['uid']); $uids = get_buddyids($p); if ($uids) { $buddysList = $this->TopicLogic->GetMember($uids, "`uid`,`ucuid`,`username`,`face_url`,`face`,`province`,`city`,`fans_count`,`topic_count`,`validate`,`validate_category`,`nickname`"); } } $group_list = $grouplist2 = array(); $group_list = $this->_myGroup($member['uid']); if ($group_list) { $grouplist2 = array_slice($group_list, 0, min(4, count($group_list))); } include template('topic_group'); }