예제 #1
0
 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;
 }
예제 #2
0
 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 ? "&amp;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');
 }
예제 #3
0
 function _AddBlackList($uid = 0, $touid = 0, $types = '')
 {
     $uid = is_numeric($uid) ? $uid : 0;
     if ($uid < 1) {
         json_error("请先登录或者注册一个帐号");
     }
     $touid = is_numeric($touid) ? $touid : 0;
     if ($touid < 0) {
         json_error("请指定一个用户ID");
     }
     if ('add' == $types) {
         if ($touid == $uid) {
             json_error('不能拉黑自己');
         }
         jlogic('buddy')->add_blacklist($touid, $uid);
     }
     if ('del' == $types) {
         jlogic('buddy')->del_blacklist($touid, $uid);
     }
     $follow_html = follow_html($touid);
     return $follow_html;
 }
예제 #4
0
 function view()
 {
     $uid = MEMBER_ID;
     $vid = empty($this->Get['vid']) ? 0 : intval($this->Get['vid']);
     $newpoll = $hotpoll = $poll = $option = array();
     $vote = $this->VoteLogic->id2voteinfo($vid);
     if (empty($vote) || $vote['verify'] == 0 && MEMBER_ROLE_TYPE != 'admin') {
         $this->Messager('当前投票不存在或正在审核中!');
     }
     $this->item_id = $vid;
     $ret = $this->VoteLogic->process_detail($vote, MEMBER_ID);
     extract($ret);
     $member = jsg_member_info($vote['uid']);
     if ($member['uid'] != MEMBER_ID) {
         $fllow = chk_follow(MEMBER_ID, $member['uid']);
         $follow_html = follow_html($member['uid'], $fllow);
         $all_vote_btn = "他的全部投票";
     } else {
         $follow_html = '';
         $all_vote_btn = "我的全部投票";
     }
     if ($member['uid'] == MEMBER_ID || MEMBER_ROLE_TYPE == 'admin') {
         $exp_info = $this->VoteLogic->get_publish_form_param();
         extract($exp_info);
     }
     $recd_list = $this->VoteLogic->get_recd_list();
     jfunc('app');
     $gets = array('mod' => 'vote', 'code' => 'view', 'vid' => $vid);
     $page_url = 'index.php?' . url_implode($gets);
     $options = array('page' => true, 'perpage' => 5, 'page_url' => $page_url);
     $topic_info = app_get_topic_list($this->item, $vid, $options);
     $topic_list = array();
     if (!empty($topic_info)) {
         $topic_list = $topic_info['list'];
         $page_arr['html'] = $topic_info['page']['html'];
     }
     $params = array('item' => $this->item, 'item_id' => $vid, 'oc' => 'view');
     $no_from = true;
     $this->item = 'vote';
     $this->item_id = $vid;
     $set_qun_closed = 1;
     $set_vote_closed = 1;
     $expiration = FALSE;
     if ($vote['expiration'] < TIMESTAMP) {
         $expiration = true;
     }
     $this->Title = '投票 - ' . $vote['subject'];
     include template("vote/vote_view");
 }
예제 #5
0
 function add()
 {
     $GLOBALS['disable_show_msg'] = 1;
     $response = '';
     $follow_button = $this->Post['follow_button'];
     if (MEMBER_ID < 1) {
         js_show_login('登录后才能执行此操作');
     }
     $uid = jpost('uid', 'int');
     if ($follow_button == 'channel' || $follow_button == 'channelnav') {
         $isbuddy = jlogic('channel')->channel_isbuddy($uid);
         $can_buddy = jlogic('channel')->can_view_topic($uid);
         if ($isbuddy) {
             jlogic('channel')->buddy_channel($uid, 0);
             $response = follow_channel($uid, 0);
         } else {
             if ($can_buddy) {
                 jlogic('channel')->buddy_channel($uid, 1);
                 $response = follow_channel($uid, 1);
             } else {
                 $response = '';
             }
         }
     } elseif ($this->Config['department_enable'] && $follow_button == 'department') {
         $isbuddy = DB::result_first("SELECT count(*) FROM " . DB::table('buddy_department') . " WHERE uid = '" . MEMBER_ID . "' AND did = '{$uid}'");
         if ($isbuddy) {
             DB::query("DELETE FROM " . DB::table('buddy_department') . " WHERE uid = '" . MEMBER_ID . "' AND did = '{$uid}'");
             $response = follow_department($uid, 0);
         } else {
             DB::query("INSERT INTO " . DB::table('buddy_department') . " (`uid`,`did`) values ('" . MEMBER_ID . "','{$uid}')");
             $response = follow_department($uid, 1);
         }
     } else {
         $rets = buddy_add($uid, MEMBER_ID, 1);
         if ($rets) {
             if ($rets['error']) {
                 js_alert_output($rets['error']);
             } else {
                 if ($follow_button == 'xiao') {
                     $response = follow_html2($uid, 0, 0, 0);
                 } else {
                     $response = follow_html($uid, 0, 0, 0);
                 }
             }
         } else {
             if ($follow_button == 'xiao') {
                 $response = follow_html2($uid, 1, 0, 0);
             } else {
                 $response = follow_html($uid, 1, 0, 0);
             }
         }
         $response .= '<success></success>';
         $u_nickname = DB::result_first("SELECT `nickname` FROM " . DB::table('members') . " WHERE uid = '{$uid}'");
         $response .= $u_nickname;
     }
     response_text($response);
 }