function doForceOut($nickname_arr = array(), $cause = "没有理由", $role_id = 4) { $force_out_list = jconf::get('login_enable'); foreach ($nickname_arr as $val) { $sql = "select uid,username,nickname,role_id,role_type from " . TABLE_PREFIX . "members where nickname = '{$val}'"; $member_list = DB::fetch_first($sql); if (!$member_list) { continue; } if (jsg_member_is_founder($member_list['uid'])) { return 1; } if ('admin' == $member_list['role_type']) { return 1; } $old_role_id = $member_list['role_id']; $member_list['douid'] = MEMBER_ID; $member_list['dousername'] = MEMBER_NAME; $member_list['donickname'] = MEMBER_NICKNAME; $member_list['cause'] = $cause; $member_list['role_id'] = $role_id; $member_list['dateline'] = time(); if ($role_id == 4) { $force_out_list['4'][$member_list['uid']] = $member_list; if ($force_out_list['118'][$member_list['uid']]) { unset($force_out_list['118'][$member_list['uid']]); } } elseif ($role_id == 118) { $force_out_list[118][$member_list['uid']] = $member_list; if ($force_out_list[4][$member_list['uid']]) { unset($force_out_list[4][$member_list['uid']]); } } else { continue; } $count = DB::result_first("select count(*) from `" . TABLE_PREFIX . "force_out` where `uid` = '{$member_list['uid']}'"); if ($count) { DB::query("update " . TABLE_PREFIX . "force_out set douid='{$member_list['douid']}',cause='{$member_list['cause']}',dateline='{$member_list['dateline']}',role_id = '{$role_id}' where uid = '" . $member_list['uid'] . "'"); } else { DB::query("insert into " . TABLE_PREFIX . "force_out (uid,role_id,douid,cause,dateline) values('{$member_list['uid']}','{$role_id}','{$member_list['douid']}','{$member_list['cause']}','{$member_list['dateline']}')"); } if ($old_role_id != $role_id) { DB::query("update " . TABLE_PREFIX . "members set role_id = '{$role_id}' where uid = '" . $member_list['uid'] . "'"); } } jconf::set('login_enable', $force_out_list); return 2; }
function admin_check_allow($uid, $is_role_id = 0) { global $_J; if (MEMBER_ID < 1) { return false; } if (true === JISHIGOU_FOUNDER) { return true; } $uid = is_numeric($uid) ? $uid : 0; if ($uid > 0) { if (!$is_role_id) { if ($uid == MEMBER_ID) { return true; } if (true === jsg_member_is_founder($uid)) { return false; } $info = jsg_member_info($uid); $role_id = $info['role_id']; } else { $role_id = $uid; } if ('normal' == $_J['member']['role_type']) { return false; } if ($role_id == $_J['member']['role_id']) { return false; } $role_info = jsg_role_info($role_id); if ('admin' == $role_info['type']) { return false; } } return true; }
function FetchMember($id, $pass) { $this->ID = max(0, (int) $id); $this->MemberPassword = trim($pass); $this->GetMember(); if ($this->MemberFields) { if (118 == $this->MemberFields['role_id']) { if (jsg_getcookie('auth')) { jsg_member_logout(); } exit('<meta http-equiv="refresh" content="3; URL=\'index.php\'">Your role id is disable.'); } jdefine("MEMBER_ID", (int) $this->MemberFields['uid']); jdefine("MEMBER_UCUID", (int) $this->MemberFields['ucuid']); jdefine("MEMBER_NAME", $this->MemberFields['username']); jdefine("MEMBER_NICKNAME", $this->MemberFields['nickname']); jdefine("MEMBER_ROLE_TYPE", $this->MemberFields['role_type']); define("MEMBER_STYLE_THREE_TOL", (int) (1 == $this->MemberFields['style_three_tol'] ? 1 : (-1 == $this->MemberFields['style_three_tol'] ? 0 : $GLOBALS['_J']['config']['style_three_tol']))); jdefine('JISHIGOU_FOUNDER', jsg_member_is_founder(MEMBER_ID)); } return $this->MemberFields; }
function DoModify() { $_update = false; $uid = (int) $this->Post['uid']; if ($uid < 1) { $this->Messager("请指定一个正确的UID"); } $this->ID = $uid; $member_info = jsg_member_info($uid); if (!$member_info) { $this->Messager("您要编辑的用户已经不存在了"); } if (!admin_check_allow($uid)) { $this->Messager("为安全起见,您没有编辑 <b>{$member_info['nickname']}</b> 用户信息的权限,请使用网站创始人的身份登录后再进行编辑操作。", '', 10); } if (($this->Post['role_id'] == 4 || $this->Post['role_id'] == 118) && !trim($this->Post['cause'])) { $this->Messager("请输入封杀理由", -1); } $password = get_param('password'); if ($password == '') { unset($this->Post['password']); } else { $this->Post['password_unhash'] = $password; $this->Post['password'] = jsg_member_password($password, $member_info['salt']); $_update = true; } $rets = array('0' => '【注册失败】有可能是站点关闭了注册功能', '-1' => '不合法', '-2' => '不允许注册', '-3' => '已经存在了', '-4' => 'Email 不合法,请输入正确的Email地址。', '-5' => 'Email 不允许注册,请尝试更换一个。', '-6' => 'Email 已经存在了,请尝试更换一个。'); $nickname = get_param('nickname'); if ($nickname != $member_info['nickname']) { $ret = jsg_member_checkname($nickname, 1, 0, $uid); if ($ret < 1) { $this->Messager("帐户/昵称 " . $rets[$ret]); } unset($this->Post['nickname']); $_update = true; } $username = get_param('username'); if ($username != $member_info['username']) { $ret = jsg_member_checkname($username, 0, 0, $uid); if ($ret < 1) { $this->Messager("个性域名/微博地址 " . $rets[$ret]); } unset($this->Post['username']); $_update = true; } $email_update = false; $email = get_param('email'); if ($email != $member_info['email']) { $ret = jsg_member_checkemail($email); if ($ret < 1) { $this->Messager($rets[$ret]); } unset($this->Post['email']); $_update = true; } $this->Post['role_id'] = (int) $this->Post['role_id']; if ($this->Post['role_id'] > 0) { $role = DB::fetch_first("SELECT * FROM " . DB::table('role') . " WHERE `id`='{$this->Post['role_id']}'"); if ($role) { if (!admin_check_allow($this->Post['role_id'], 1) || true === jsg_member_is_founder($uid) && 'admin' != $role['type']) { unset($this->Post['role_id'], $this->Post['role_type']); } else { $this->Post['role_type'] = $role['type']; } $login_enable = jconf::get('login_enable'); if (!$role['privilege'] || $role['privilege'] == '') { $login_enable[$uid] = $uid; } else { unset($login_enable[$uid]); } jconf::set('login_enable', $login_enable); } else { $this->messager("角色已经不存在"); } } else { unset($this->Post['role_id'], $this->Post['role_type']); } $phone = $this->Post['phone']; if ($phone) { if (!jsg_is_mobile($phone)) { $this->Messager("手机号 {$phone} 格式不对哦,请重新输入正确的号码。"); $phone = ''; unset($this->Post['phone']); } else { if (($member_phone_info = jtable('members')->info(array('phone' => $phone))) && $uid != $member_phone_info['uid']) { $this->Messager("手机号 {$phone} 已经被使用在了 【{$member_phone_info['uid']}】{$member_phone_info['nickname']} 帐户上,请返回重新输入!"); } } } else { $phone = ''; } if (sms_init()) { if ($phone) { sms_bind($uid, $phone); } else { sms_unbind($uid); } } if (@is_file(ROOT_PATH . 'include/logic/cp.logic.php') && $this->Config['company_enable']) { $this->Post['companyid'] = max(0, (int) $this->Post['companyid']); if ($this->Post['companyid'] == $member_info['companyid']) { unset($this->Post['companyid']); } else { if ($member_info['companyid'] == 0 && $this->Post['companyid'] > 0) { $this->CpLogic->update('company', $this->Post['companyid'], 1, $member_info['topic_count']); } elseif ($member_info['companyid'] > 0 && $this->Post['companyid'] == 0) { $this->CpLogic->update('company', $member_info['companyid'], -1, -$member_info['topic_count']); } else { $this->CpLogic->update('company', $member_info['companyid'], -1, -$member_info['topic_count']); $this->CpLogic->update('company', $this->Post['companyid'], 1, $member_info['topic_count']); } $this->Post['company'] = $this->CpLogic->Getone($this->Post['companyid'], 'company', 'name'); } if ($this->Config['department_enable']) { $this->Post['departmentid'] = max(0, (int) $this->Post['departmentid']); if ($this->Post['departmentid'] == $member_info['departmentid']) { unset($this->Post['departmentid']); } else { if ($member_info['departmentid'] == 0 && $this->Post['departmentid'] > 0) { $this->CpLogic->update('department', $this->Post['departmentid'], 1, $member_info['topic_count']); } elseif ($member_info['departmentid'] > 0 && $this->Post['departmentid'] == 0) { $this->CpLogic->update('department', $member_info['departmentid'], -1, -$member_info['topic_count']); } else { $this->CpLogic->update('department', $member_info['departmentid'], -1, -$member_info['topic_count']); $this->CpLogic->update('department', $this->Post['departmentid'], 1, $member_info['topic_count']); } $this->Post['department'] = $this->CpLogic->Getone($this->Post['departmentid'], 'department', 'name'); } } if ($this->Post['jobid'] == $member_info['jobid']) { unset($this->Post['jobid']); } else { $this->Post['job'] = jlogic('job')->id2subject($this->Post['jobid']); } if ($this->Post['companyid']) { $chx_cid = $this->Post['companyid']; $chx_uid = $member_info['uid']; $chx_did = $this->Post['departmentid'] ? $this->Post['departmentid'] : 0; $is_cp_usered = DB::fetch_first("SELECT * FROM " . DB::table('cp_user') . " WHERE uid = '{$chx_uid}' AND companyid = '{$chx_cid}' AND departmentid = '{$chx_did}'"); if ($is_cp_usered) { DB::query("DELETE FROM " . DB::table('cp_user') . " WHERE id = '" . $is_cp_usered['id'] . "'"); } } } $this->Post['province'] = trim(DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '" . (int) $this->Post['province'] . "'")); $this->Post['city'] = trim(DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '" . (int) $this->Post['city'] . "'")); if ($this->Post['area']) { $this->Post['area'] = trim(DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '" . (int) $this->Post['area'] . "'")); } if ($this->Post['street']) { $this->Post['street'] = trim(DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '" . (int) $this->Post['street'] . "'")); } $table1 = jtable('members')->update($this->Post, $uid); $memberfields = array('site' => $this->Post['site'], 'validate_true_name' => $this->Post['validate_true_name'], 'validate_card_type' => $this->Post['validate_card_type'], 'validate_card_id' => $this->Post['validate_card_id'], 'validate_remark' => $this->Post['validate_remark']); $table2 = jtable('memberfields')->update($memberfields, $uid); #附表2信息(members_profile) $arr2 = array(); $profileField = array('constellation', 'zodiac', 'telephone', 'address', 'zipcode', 'nationality', 'education', 'birthcity', 'graduateschool', 'pcompany', 'occupation', 'position', 'revenue', 'affectivestatus', 'lookingfor', 'bloodtype', 'height', 'weight', 'alipay', 'icq', 'yahoo', 'taobao', 'site', 'interest', 'linkaddress', 'field1', 'field2', 'field3', 'field4', 'field5', 'field6', 'field7', 'field8'); foreach ($profileField as $k => $v) { isset($this->Post[$v]) && ($arr2[$v] = trim(strip_tags($this->Post[$v]))); } if ($arr2) { $this->_updateMemberProfile($arr2, $uid); } $email_checked = $this->Post['email_checked'] ? $this->Post['email_checked'] : 0; if ($email_checked != $member_info['email_checked']) { $_update = true; } if ($_update) { $ret = jsg_member_edit($member_info['nickname'], '', $nickname, $this->Post['password_unhash'], $email, $username, 1, 1, $email_checked); $rets = array('0' => '没有做任何修改', '-1' => '帐户/昵称 不合法,含有不允许注册的字符,请尝试更换一个。', '-2' => '帐户/昵称 不允许注册,含有被保留的字符,请尝试更换一个。', '-3' => '帐户/昵称 已经存在了,请尝试更换一个。', '-4' => 'Email 不合法,请输入正确的Email地址。', '-5' => 'Email 不允许注册,请尝试更换一个。', '-6' => 'Email 已经存在了,请尝试更换一个。'); if ($ret < 1 && isset($rets[$ret])) { $this->Messager($rets[$ret]); } } load::logic('topic_manage'); $TopicManageLogic = new TopicManageLogic(); $role_id = get_param('role_id'); $cause = get_param('cause'); if ($role_id == 4 || $role_id == 118) { $TopicManageLogic->doForceOut((array) $nickname, $cause, $role_id); } elseif ($role_id != 4 && $role_id != 118 && ($member_info['role_id'] == 4 || $member_info['role_id'] == 118)) { $TopicManageLogic->doUserFree($uid); } if ($this->Config['extcredits_enable'] && $this->Post['validate'] && $this->Post['uid'] > 0) { update_credits_by_action('vip', $this->Post['uid']); } Load::logic('credits'); $CreditsLogic = new CreditsLogic(); $CreditsLogic->CountCredits($this->Post['uid']); $data = array('uid' => $uid, 'rid' => 0, 'relatedid' => MEMBER_ID, 'dateline' => time()); foreach ($GLOBALS['_J']['config']['credits']['ext'] as $key => $value) { $data[$key] = $_POST[$key] - $member_info[$key]; $remark .= $value['name'] . ' : ' . $_POST[$key . '_remark'] . ' , '; } $data['remark'] = trim($remark, ', '); jtable('credits_log')->insert($data); $this->Messager("编辑成功"); }
function delete($ids) { $ids = (array) $ids; $admin_list = array(); $member_ids = array(); $query = DB::query("select * from " . DB::table('members') . " where `uid` in ('" . implode("','", $ids) . "')"); while (false != ($row = DB::fetch($query))) { $uid = $row['uid']; if (jsg_member_is_founder($uid) || 'admin' == $row['role_type']) { $admin_list[$uid] = $row['nickname']; } else { $member_ids[$uid] = $uid; if (true === UCENTER && $row['ucuid'] > 0) { uc_user_delete($row['ucuid']); } } #if NEDU if (defined('NEDU_MOYO')) { ndata('sync')->member()->delete($uid); } #endif if ($GLOBALS['_J']['config']['company_enable'] && @is_file(ROOT_PATH . 'include/logic/cp.logic.php') && $row['companyid'] > 0) { $CpLogic = jlogic('cp'); $CpLogic->update('company', $row['companyid'], -1, -$row['topic_count']); if ($GLOBALS['_J']['config']['department_enable'] && $row['departmentid'] > 0) { $CpLogic->update('department', $row['departmentid'], -1, -$row['topic_count']); } $cp_companys = $CpLogic->get_cp_users($row['uid']); if ($cp_companys) { foreach ($cp_companys as $val) { $CpLogic->update('company', $val['companyid'], -1, 0); if ($GLOBALS['_J']['config']['department_enable'] && $val['departmentid'] > 0) { $CpLogic->update('department', $val['departmentid'], -1, 0); } } } } } $member_ids_count = count($member_ids); if ($member_ids_count > 0) { $member_ids_in = jimplode($member_ids); jlogic('buddy')->del_user($member_ids); jlogic('topic')->DeleteToBox(" where `uid` in ({$member_ids_in}) limit 999999999 "); jlogic('topic')->Delete(" where `uid` in ({$member_ids_in}) limit 999999999 "); $tbs = array('blacklist' => array('uid', 'touid'), 'credits_log' => 'uid', 'credits_rule_log' => 'uid', 'cron' => 'touid', 'event' => 'postman', 'event_favorite' => 'uid', 'event_member' => 'fid', 'group' => 'uid', 'groupfields' => 'uid', 'imjiqiren_client_user' => 'uid', 'invite' => array('uid', 'fuid'), 'ios' => 'uid', 'item_sms' => 'uid', 'item_user' => 'uid', 'kaixin_bind_info' => 'uid', 'log' => 'uid', 'mailqueue' => 'uid', 'mall_order' => 'uid', 'mall_order_action' => 'uid', 'medal_apply' => 'uid', 'member_notice' => 'uid', 'member_relation' => 'touid', 'member_topic' => 'uid', 'member_validate' => 'uid', 'members_profile' => 'uid', 'members_verify' => 'uid', 'members_vest' => array('uid', 'useruid'), 'my_tag' => 'user_id', 'my_topic_tag' => 'user_id', 'pms' => array('msgfromid', 'msgtoid'), 'qqwb_bind_info' => 'uid', 'qun' => 'founderuid', 'qun_apply' => 'uid', 'qun_user' => 'uid', 'renren_bind_info' => 'uid', 'report' => 'uid', 'reward' => 'uid', 'reward_image' => 'uid', 'reward_user' => 'uid', 'reward_win_user' => 'uid', 'schedule' => 'uid', 'sessions' => 'uid', 'sms_client_user' => 'uid', 'sms_receive_log' => 'uid', 'sms_send_log' => 'uid', 'tag_favorite' => 'uid', 'task_log' => 'uid', 'topic' => 'uid', 'topic_favorite' => 'uid', 'topic_image' => 'uid', 'topic_attach' => 'uid', 'topic_longtext' => 'uid', 'topic_mention' => 'uid', 'topic_music' => 'uid', 'topic_show' => 'uid', 'topic_video' => 'uid', 'user_medal' => 'uid', 'user_tag_fields' => 'uid', 'validate_category_fields' => 'uid', 'vote' => 'uid', 'vote_user' => 'uid', 'wall' => 'uid', 'xwb_bind_info' => 'uid', 'yy_bind_info' => 'uid', 'topic_dig' => array('uid', 'touid'), 'buddy_channel' => 'uid', 'buddy_department' => 'uid', 'bulletin' => 'uid', 'topic_live' => 'uid', 'topic_talk' => array('uid', 'touid'), 'topic_channel' => 'uid', 'memberfields' => 'uid', 'members' => 'uid'); foreach ($tbs as $k => $vs) { $vs = (array) $vs; foreach ($vs as $v) { DB::query("delete from `" . TABLE_PREFIX . "{$k}` where `{$v}` in ({$member_ids_in})", "SKIP_ERROR"); } } } $rets = array('admin_list' => $admin_list, 'member_ids' => $member_ids, 'member_ids_count' => $member_ids_count); if ($GLOBALS['_J']['plugins']['func']['deletemember']) { hookscript('deletemember', 'funcs', is_array($member_ids) ? $member_ids : array($member_ids), 'deletemember'); } return $rets; }