public function add_order($data) { $data['uid'] = MEMBER_ID; $data['username'] = MEMBER_NICKNAME; $data['sn'] = TIMESTAMP . mt_rand(1, 9999); $config = jconf::get('mall'); $id = jtable('mall_order')->insert($data, 1); if ($id) { jtable('mall_goods')->update_count(array('id' => $data['goods_id']), 'seal_count', '+' . $data['goods_num']); jtable('mall_goods')->update_count(array('id' => $data['goods_id']), 'order_count', '+' . $data['goods_num']); jtable('mall_goods')->update_count(array('id' => $data['goods_id']), 'total', '-' . $data['goods_num']); update_credits_by_action('convert', $data['uid'], 1, -$data['pay_credit']); $feed_msg = cut_str($data['goods_name'], 30, ''); feed_msg('mall', 'exchange', $data['goods_id'], $feed_msg, 0); } return $id; }
function dig() { $tid = jget('tid', 'int', 'P'); $uid = jget('uid', 'int', 'P'); if ($tid > 0 && $uid > 0) { $count = DB::result_first("SELECT COUNT(*) FROM " . DB::table('topic_dig') . " WHERE tid='{$tid}' AND uid = '" . MEMBER_ID . "'"); if ($count > 0) { echo 'no,'; } else { $topic_info = DB::fetch_first("SELECT `uid`,`content`,`item_id` FROM " . DB::table('topic') . " WHERE tid='{$tid}'"); $uid = $topic_info['uid']; if ($uid == MEMBER_ID) { echo 'not,'; } else { jtable('topic_more')->update_diguids($tid); DB::query("update `" . DB::table('members') . "` set `digcount` = digcount + 1,`dig_new` = dig_new + 1 where `uid`='{$uid}'"); $ary = array('tid' => $tid, 'uid' => MEMBER_ID, 'touid' => $uid, 'dateline' => time()); DB::insert('topic_dig', $ary, true); jtable('topic')->update_digcounts($tid); if (jconf::get('contest_available')) { if ('contest' == DB::result_first("SELECT `item` FROM " . DB::table('topic') . " WHERE tid={$tid}")) { jlogic('contest_entries')->update_dig($tid); } } $credits = jconf::get('credits'); update_credits_by_action('topic_dig', MEMBER_ID); update_credits_by_action('my_dig', $uid); if ($GLOBALS['_J']['config']['feed_type'] && is_array($GLOBALS['_J']['config']['feed_type']) && in_array('dig', $GLOBALS['_J']['config']['feed_type']) && $GLOBALS['_J']['config']['feed_user'] && is_array($GLOBALS['_J']['config']['feed_user']) && array_key_exists(MEMBER_ID, $GLOBALS['_J']['config']['feed_user'])) { $feed_msg = cut_str($topic_info['content'], 30, ''); feed_msg('leader', 'dig', $tid, $feed_msg, $topic_info['item_id']); } echo 'yes,' . $this->js_show_msg(1); } } } }
function MasterObject(&$config) { require_once ROOT_PATH . 'mobile/include/func/mobile.func.php'; $config['client_type'] = ''; $user_agent = $_SERVER['HTTP_USER_AGENT']; if (empty($user_agent)) { exit('Access Denied'); } $pc_browser = false; if (preg_match("/android/i", $user_agent)) { $config['client_type'] = "android"; } else { if (preg_match("/iphone/i", $user_agent)) { $config['client_type'] = "iphone"; } else { $pc_browser = true; } } $config['is_mobile_client'] = false; if (isset($_GET['JSG_SESSION']) && isset($_GET['iv']) && isset($_GET['app_key']) && isset($_GET['app_secret']) && isset($_GET['bt'])) { $config['is_mobile_client'] = true; define("IS_MOBILE_CLIENT", true); } define("CLIENT_TYPE", $config['client_type']); $config['sys_version'] = sys_version(); $config['sys_published'] = SYS_PUBLISHED; if (!$config['mobile_url']) { $config['mobile_url'] = $config['site_url'] . "/mobile"; } if (!$config['topic_length']) { $config['topic_length'] = 140; } $this->Config = $config; $this->Config = array_merge($this->Config, Mobile::config()); define("CHARSET", $this->Config['charset']); Obj::register('config', $this->Config); $this->Get =& $_GET; $this->Post =& $_POST; $this->Module = trim($this->Post['mod'] ? $this->Post['mod'] : $this->Get['mod']); $this->Code = trim($this->Post['code'] ? $this->Post['code'] : $this->Get['code']); $this->DatabaseHandler =& Obj::registry('DatabaseHandler'); $uid = 0; $password = ''; $authcode = ''; $implicit_pass = true; if (!empty($this->Get['JSG_SESSION']) && $config['is_mobile_client']) { $authcode = $this->Get['JSG_SESSION']; $authcode = rawurldecode($authcode); $implicit_pass = false; } else { $authcode = jsg_getcookie('auth'); } if (!empty($authcode)) { list($password, $uid) = explode("\t", authcode($authcode, 'DECODE')); } $this->MemberHandler = jclass('member'); $MemberFields = $this->MemberHandler->FetchMember($uid, $password); if ($this->MemberHandler->HasPermission($this->Module, $this->Code) == false) { Mobile::show_message(411); exit; } if (!in_array($this->Module, array('member', 'login', 'wechat'))) { $visit_rets = $this->MemberHandler->visit(); if ($visit_rets['error']) { Mobile::show_message(411); exit; } } $this->Title = $this->MemberHandler->CurrentAction['name']; Obj::register("MemberHandler", $this->MemberHandler); $rets = jsg_member_login_extract(); if ($rets) { if (MEMBER_ID < 1) { $func = $rets['login_direct']; } else { $func = $rets['logout_direct']; } if ($func && function_exists($func)) { $ret = $func(); } } if (MEMBER_ID > 0) { jsg_member_login_set_status($MemberFields); } if ($this->Config['extcredits_enable']) { if (MEMBER_ID > 0 && jsg_getcookie('login_credits') + 3600 < time()) { update_credits_by_action('login', MEMBER_ID); jsg_setcookie('login_credits', time(), 3600); } } }
function do_recd() { Load::logic('topic_recommend'); $TopicRecommendLogic = new TopicRecommendLogic(); $tid = intval($this->Post['tid']); $topic = DB::fetch_first("SELECT * FROM " . DB::table("topic") . " WHERE tid='{$tid}'"); if (empty($topic)) { json_error("当前微博不存在或者已经被删除了"); } if ($topic['item'] == 'channel' && $topic['item_id'] > 0) { if (!function_exists('item_topic_from')) { jfunc('item'); } $topic = item_topic_from($topic); } if (!($this->MemberHandler->HasPermission('topic', 'do_recd') || $topic['ismanager'])) { json_error("您的角色没有推荐微博的权限!"); } $recd = intval($this->Post['recd'][0]); if ($recd > 4 || $recd < 0) { json_error("推荐类型错误"); } if ($topic['item'] == 'qun' && $topic['item_id'] > 0) { Load::logic('qun'); $QunLogic = new QunLogic(); $tmp_perm = $QunLogic->chk_perm($topic['item_id'], MEMBER_ID); if (!('admin' == MEMBER_ROLE_TYPE || in_array($tmp_perm, array(1, 2)))) { json_error("你没有权限推荐群内微博"); } } if ($recd == 0) { $topic_recd = $TopicRecommendLogic->delete(array($tid)); json_result("0|||取消推荐成功!"); } else { $expiration = jstrtotime(trim($this->Post['expiration'])); $tag_id = intval($this->Post['tag_id']); $r_title = strip_tags(trim($this->Post['r_title'])); if (!empty($tag_id)) { $count = DB::result_first("SELECT COUNT(*) FROM " . DB::table('topic_tag') . " WHERE item_id='{$tid}' AND tag_id='{$tag_id}' "); if (!empty($count)) { $topic['item'] = 'tag'; $topic['item_id'] = $tag_id; } } $item = $this->Post['item_id'] ? 'channel' : $topic['item']; $item_id = $this->Post['item_id'] ? intval($this->Post['item_id']) : $topic['item_id']; if (empty($r_title)) { json_error("推荐标题为空或内容不合法"); } if ($expiration && $expiration < time()) { json_error("时间设置无效,请重新设置"); } $data = array('expiration' => $expiration, 'item' => $item, 'item_id' => $item_id, 'tid' => $tid, 'recd' => $recd, 'dateline' => TIMESTAMP, 'r_uid' => MEMBER_ID, 'r_nickname' => MEMBER_NICKNAME, 'r_title' => $r_title); if ($TopicRecommendLogic->is_exists($tid)) { unset($data['tid']); $TopicRecommendLogic->modify($data, array('tid' => $tid)); json_result("2|||重新推荐成功!"); } else { $TopicRecommendLogic->add($data); feed_msg('recommend', 'recommend', $tid, $r_title, $item_id); if ($recd == 4) { $iphone_msg = cut_str($topic['content'], 30, ''); ios_push_msg('all', $r_title . ':' . $iphone_msg); } $credits = jconf::get('credits'); update_credits_by_action('recommend', $topic['uid']); json_result("1|||推荐成功!被推荐者因:" . $this->js_show_msg(1)); } } }
function DoRegister() { if (MEMBER_ID != 0 and false == $this->IsAdmin) { $this->Messager('您已经是注册用户,无需再注册!', -1); } $regstatus = jsg_member_register_check_status(); if ($regstatus['error']) { $this->Messager($regstatus['error'], null); } $message = array(); $timestamp = time(); $noemail = 0; $sms_ckret = 0; if ($this->_sms_register()) { $sms_bind_num = $this->Post['sms_bind_num']; $sms_bind_key = $this->Post['sms_bind_key']; $sms_ckret = sms_check_bind_key($sms_bind_num, $sms_bind_key); if ($sms_ckret) { $this->Messager($sms_ckret, -1); } $noemail = jconf::get('sms', 'register_verify', 'noemail'); if ($noemail) { $this->Post['email'] = $sms_bind_num . '@139.com'; } } $inviter_member = array(); $invite_code = $this->Post['invite_code'] ? $this->Post['invite_code'] : $this->Get['invite_code']; $check_result = jsg_member_register_check_invite($invite_code); if ($regstatus['invite_enable'] && !$regstatus['normal_enable']) { if (!$invite_code) { $this->Messager("本站目前需要有好友邀请链接才能注册。<br><br>看看<a href=\"?mod=topic&code=top\">达人榜</a>中有没有你认识的人,让他给你发一个好友邀请。", null); } if (!$check_result) { $this->Messager("对不起,您访问的邀请链接不正确或者因邀请数已满而失效,请重新与邀请人索取链接。", null); } } if ($check_result['uid'] > 0) { $inviter_member = jsg_member_info($check_result['uid']); } if (!$inviter_member && $this->Config['register_invite_input']) { $inviter_member = jsg_member_info($this->Post['inviter_nickname'], 'nickname'); } $this->Post = array_iconv('UTF-8', $this->Config['charset'], $this->Post, 1); $password = $this->Post['password']; $email = $this->Post['email']; $username = $nickname = $this->Post['nickname']; if (strlen($password) < 5) { $this->Messager("密码过短,请设置至少5位", -1); } $uid = jsg_member_register($nickname, $password, $email); if ($uid < 1) { $regconf = jconf::get('register'); $rets = array('0' => '【注册失败】有可能是站点关闭了注册功能', '-1' => '帐户/昵称 不合法,含有不允许注册的字符,请尝试更换一个。', '-2' => '帐户/昵称 不允许注册,含有被保留的字符,请尝试更换一个。', '-3' => '帐户/昵称 已经存在了,请尝试更换一个。', '-4' => 'Email 不合法,请输入正确的Email地址。', '-5' => 'Email 不允许注册,请尝试更换一个。', '-6' => 'Email 已经存在了,请尝试更换一个。', '-7' => '您的IP地址 ' . $GLOBALS['_J']['client_ip'] . ' 已经被限制注册了(一个IP地址 ' . $regconf['time_html'] . ' 之内,最多只能注册 ' . $regconf['limit'] . ' 个用户),请稍后再试或联系管理员'); $this->Messager($rets[$uid], null); } $datas = array(); $datas['uid'] = $uid; $datas['province'] = $this->Post['province']; $datas['city'] = $this->Post['city']; if ($this->_sms_register()) { $datas['phone'] = $sms_bind_num; } jtable('members')->update($datas); if ($this->_sms_register()) { $_sms_info = _sms_client_user($sms_bind_num); $username = $username ? $username : $this->Post['username']; $_sms_sets = array('uid' => $uid, 'username' => $username, 'bind_key' => 0, 'bind_key_time' => 0, 'try_bind_times' => '+1', 'last_try_bind_time' => $timestamp); sms_client_user_update($_sms_sets, $_sms_info); } if ($inviter_member) { $u = $inviter_member['uid']; $c = $check_result['code']; buddy_add($u, $uid); buddy_add($uid, $u); if (0 < ($invite_id = $check_result['invite_id'])) { $row = DB::fetch_first("select * from `" . TABLE_PREFIX . "invite` where `id`='{$invite_id}'"); if ($row) { DB::query("update `" . TABLE_PREFIX . "invite` set `fuid`='{$uid}',`fusername`='{$username}' where `id`='{$row['id']}'"); } } else { DB::query("insert into `" . TABLE_PREFIX . "invite` (`uid`,`code`,`dateline`,`fuid`,`fusername`,`femail`) values ('{$u}','{$c}','{$timestamp}','{$uid}','{$username}','{$email}')"); } $sql = "update `" . TABLE_PREFIX . "members` set `invite_count`=`invite_count`+1 where `uid`='{$u}'"; $this->DatabaseHandler->Query($sql); $sql = "update `" . TABLE_PREFIX . "members` set `invite_uid`='{$inviter_member['uid']}' where `uid`='{$uid}'"; $this->DatabaseHandler->Query($sql); if ($c && $this->Config['invite_limit'] > 0) { $code_invite_count = DB::result_first("select count(*) as code_invite_count from `" . TABLE_PREFIX . "invite` where `uid`='{$u}' and `code`='{$c}'"); if ($code_invite_count > $this->Config['invite_limit']) { jsg_member_register_check_invite($u, 1); } } if ($this->Config['extcredits_enable'] && $u > 0) { update_credits_by_action('register', $u); } } $rets = jsg_member_login_set_status($uid); $this->Messager(null, 'index.php'); }
function del_info($buddyid, $uid, $update = 1) { $ret = false; $uid = jfilter($uid, 'int'); $buddyid = jfilter($buddyid, 'int'); if ($uid < 1 || $buddyid < 1) { return $ret; } $info = $this->info($buddyid, $uid); if ($info) { jtable('buddy_follow')->del($uid, $buddyid); jtable('buddy_fans')->del($buddyid, $uid); $this->count($buddyid); if ($update) { $this->count($uid); if ($GLOBALS['_J']['config']['extcredits_enable'] && $uid > 0) { update_credits_by_action('buddy_del', $uid); } } $ret = true; } return $ret; }
function Download() { global $_J; $attach_config = jconf::get('attach'); $uid = MEMBER_ID; if ($uid < 1) { $this->Messager("请先<a href='index.php?mod=login'>点此登录</a>或者<a href='index.php?mod=member'>点此注册</a>一个帐号", 'index.php?mod=login'); } $candown = jclass('member')->HasPermission('uploadattach', 'down'); if (!$candown) { $this->Messager("您没有下载附件的权限", null); } $readmod = 2; $downfile = get_param('downfile'); if (!$downfile) { $this->Messager("您的下载链接地址错误", null); } @(list($dasize, $daid, $datime, $dadown) = explode('|', base64_decode($downfile))); $daid = (int) $daid; if ($daid <= 0) { $this->Messager("您的下载链接地址错误", null); } $down_attach_file = $this->AttachLogic->get_down_info($daid); if (empty($down_attach_file)) { $this->Messager("您的下载链接地址错误", null); } if ($dadown != $down_attach_file['download']) { defined('NEDU_MOYO') || $this->Messager("您的下载链接地址已经过期或失效!或您使用的是<font class='R'>360浏览器</font>,因其系统缺陷,请更换其它浏览器进行下载!", null); } $MIMETypes = array('doc' => 'application/msword', 'ppt' => 'application/vnd.ms-powerpoint', 'pdf' => 'application/pdf', 'xls' => 'application/vnd.ms-excel', 'txt' => 'text/plain', 'rar' => 'application/octet-stream', 'zip' => 'application/zip', 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation'); $de_attach_file_type = explode('|', $this->Config['attach_file_type']); foreach ($de_attach_file_type as $val) { if (!isset($MIMETypes[$val])) { $MIMETypes[$val] = 'application/octet-stream'; } } if (!isset($MIMETypes[$down_attach_file['filetype']])) { $this->Messager("您只能下载(" . strtoupper(str_replace('|', ',', $this->Config['attach_file_type'])) . ")类型的文件", null); } if (!$down_attach_file['file'] || empty($down_attach_file['site_url']) && !(file_exists($down_attach_file['file']) && is_readable($down_attach_file['file']))) { $this->Messager("在服务器上找不到您要下载的文件,或文件不可读,或被删除,或数据错误,请联系网站管理员", null); } $auid = $down_attach_file['uid']; $score = $down_attach_file['score']; $this->AttachLogic->mod_download_num($daid); if ($score > 0) { if (!in_array($_J['member']['role_id'], explode(',', $attach_config['no_score_user']))) { update_credits_by_action('attach_down', $uid, 1, -$score); } if ($auid != $uid) { update_credits_by_action('down_my_attach', $auid, 1, $score); } } if ($down_attach_file['site_url']) { $ftptype = getftptype($down_attach_file['site_url']); if ($ftptype == 'Aliyun') { $ftpkey = getftpkey($down_attach_file['site_url']); $ftps = jconf::get('ftp'); if ($ftps[$ftpkey]['type'] == 'Aliyun') { define('ALI_LOG', FALSE); define('ALI_DISPLAY_LOG', FALSE); define('ALI_LANG', 'zh'); define('OSS_ACCESS_ID', $ftps[$ftpkey]['username']); define('OSS_ACCESS_KEY', $ftps[$ftpkey]['password']); define('OSS_BUCKET', $ftps[$ftpkey]['attachdir']); define('OSS_HOST_NAME', $ftps[$ftpkey]['host']); define('OSS_HOST_PORT', $ftps[$ftpkey]['port']); define('OSS_SIGN_TIMEOUT', $ftps[$ftpkey]['timeout']); define('OSS_ENABLED', $ftps[$ftpkey]['on']); $oss = jclass('jishigou/oss'); $file = str_replace('./', '', $down_attach_file['file']); $filename = urlencode(array_iconv($this->Config['charset'], 'UTF-8', $down_attach_file['name'])); $res = $oss->sign_url($file . '?response-content-disposition=attachment; filename=' . $filename, str_replace('http:/' . '/', '', $down_attach_file['site_url'])); $res = str_replace("?OSSAccessKeyId", "&OSSAccessKeyId", $res); $res = str_replace("%3F", "?", $res); $res = str_replace("disposition%3Dattachment", "disposition=attachment", $res); header('location:' . $res); } } else { $fileurl = $down_attach_file['site_url'] . '/' . str_replace('./', '', $down_attach_file['file']); $this->Messager("文件存储在外部地址或FTP空间,正在跳转,请稍侯......", $fileurl); } } else { $fileType = $MIMETypes[$down_attach_file['filetype']]; $down_attach_file['name'] = '"' . (strtolower(str_replace('-', '', $this->Config['charset'])) == 'utf8' && strexists($_SERVER['HTTP_USER_AGENT'], 'MSIE') ? urlencode($down_attach_file['name']) : $down_attach_file['name']) . '"'; ob_end_clean(); ob_start(); header('Cache-control: max-age=31536000'); header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . ' GMT'); header('Content-Encoding: none'); header('Content-type: ' . $fileType); header('Content-Disposition: attachment; filename=' . $down_attach_file['name']); header('Content-Length: ' . filesize($down_attach_file['file'])); if ($readmod == 1 || $readmod == 3) { if ($fp = @fopen($down_attach_file['file'], 'rb')) { @fseek($fp, 0); if (function_exists('fpassthru') && $readmod == 3) { @fpassthru($fp); } else { echo @fread($fp, filesize($down_attach_file['file'])); } } @fclose($fp); } else { @readfile($down_attach_file['file']); } @flush(); @ob_flush(); } }
function DeleteToBox($ids, $managetype = 1, $score = 0) { if (MEMBER_ID < 1) { return '游客不能执行此操作'; } if (!function_exists('item_topic_from')) { jfunc('item'); } if (is_numeric($ids)) { $where = " where tid = '{$ids}' "; } elseif (is_array($ids)) { $where = " where tid in ('" . implode("'.'", $ids) . "') "; } elseif (is_string($ids)) { $where = $ids; } else { return '所指定的微博有误。'; } if (!$ids) { return '微博已经不存在了'; } $tbs = array('topic_recommend' => 'tid'); $query = DB::query("select * from " . TABLE_PREFIX . "topic {$where} "); $topics = array(); while ($rs = DB::fetch($query)) { if ($rs['item'] == 'channel' && $rs['item_id'] > 0) { $rs = item_topic_from($rs); } if (!(jallow($rs['uid']) || $rs['ismanager'])) { return '您没有权限执行此操作'; } $topics[$rs['tid']] = $rs; } if (count($topics) < 1) { return '微博已经不存在了.'; } foreach ($topics as $value) { $tid = $value['tid'] = (int) $value['tid']; if ($value['tid'] < 1) { continue; } jtable('topic')->rm($value['tid']); $value['managetype'] = $managetype; $value['content'] = addslashes($value['content']); $value['content2'] = addslashes($value['content2']); jtable('topic_verify')->insert($value); if ($value['imageid']) { DB::query("update " . TABLE_PREFIX . "topic_image set `tid`='-1' where `id` in ({$value['imageid']})"); } if ($value['attachid']) { DB::query("update " . TABLE_PREFIX . "topic_attach set `tid`='-1' where `id` in ({$value['attachid']})"); } if ($GLOBALS['_J']['config']['extcredits_enable'] && $value['uid'] > 0) { if ($value['uid'] == MEMBER_ID) { update_credits_by_action('topic_del', $value['uid']); } else { $credit_logic = jlogic('credits'); $rule = $credit_logic->GetRule('topic_del'); $credit_logic->UpdateCreditsByRule($rule, $value['uid'], 1, $score); $data = array('uid' => $value['uid'], 'rid' => 0, 'relatedid' => MEMBER_ID, 'dateline' => time(), 'remark' => "删除微博 【微博ID:{$tid}】"); foreach ($GLOBALS['_J']['config']['credits']['ext'] as $key => $value) { if ($value['enable'] == 1 && $score != 0) { $data[$key] = $score; } if ($value['enable'] == 1 && $score == 0) { $data[$key] = $rule[$key]; } } jtable('credits_log')->insert($data); } if ($value['item'] == 'channel' && $value['item_id'] > 0 && ($value['type'] == 'first' || $value['type'] == 'channel')) { $credits_itemid = jlogic('channel')->is_update_credits_byid($value['item_id'], 0); if ($credits_itemid) { update_credits_by_action('_D' . crc32($credits_itemid), $value['uid']); } } } if ($tbs) { foreach ($tbs as $k => $vs) { $vs = (array) $vs; foreach ($vs as $v) { DB::query("delete from `" . TABLE_PREFIX . "{$k}` where `{$v}`='{$tid}'", "SKIP_ERROR"); } } } } }
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 _uploadImage() { $field = 'author'; $type = trim(strtolower(end(explode(".", $_FILES[$field]['name'])))); if ($type != 'gif' && $type != 'jpg' && $type != 'png') { Mobile::error('Illegal Strings', 350); } $image_name = substr(md5($_FILES[$field]['name']), -10) . ".{$type}"; $sub_path = './cache/temp_images/' . $image_name[0] . '/'; $image_path = RELATIVE_ROOT_PATH . $sub_path; $image_path_abs = ROOT_PATH . $sub_path; $image_file = $image_path . $image_name; $image_file_abs = $image_path_abs . $image_name; if (!is_dir($image_path_abs)) { jio()->MakeDir($image_path_abs); } jupload()->init($image_path_abs, $field, true); jupload()->setNewName($image_name); $result = jupload()->doUpload(); if ($result) { $result = is_image($image_file_abs); } if (!$result) { jio()->RemoveDir($image_path_abs); Mobile::error('Illegal Strings', 352); } list($w, $h) = getimagesize($image_file_abs); if ($w > 601) { $tow = 599; $toh = round($tow * ($h / $w)); $result = makethumb($image_file_abs, $image_file_abs, $tow, $toh); if (!$result) { jio()->RemoveDir($image_path_abs); Mobile::error('Illegal Strings', 351); } } $up_image_path = addslashes($image_file_abs); $src_file = $image_file_abs; $image_path = RELATIVE_ROOT_PATH . 'images/face/' . face_path(MEMBER_ID); $image_path_abs = ROOT_PATH . './images/face/' . face_path(MEMBER_ID); if (!is_dir($image_path_abs)) { jio()->MakeDir($image_path_abs); } $image_file = $dst_file = $image_path . MEMBER_ID . '_b.jpg'; $image_file_abs = $dst_file_abs = $image_path_abs . MEMBER_ID . '_b.jpg'; $make_result = image_thumb($src_file, $dst_file_abs, 128, 128, 2); $image_file_small = $dst_file = $image_path . MEMBER_ID . '_s.jpg'; $image_file_small_abs = $dst_file_abs = $image_path_abs . MEMBER_ID . '_s.jpg'; $make_result = image_thumb($src_file, $dst_file_abs, 50, 50, 2); $face_url = ''; if ($this->Config['ftp_on']) { $ftp_key = randgetftp(); $get_ftps = jconf::get('ftp'); $face_url = $get_ftps[$ftp_key]['attachurl']; $ftp_result = ftpcmd('upload', $image_file_abs, '', $ftp_key); if ($ftp_result > 0) { ftpcmd('upload', $image_file_small_abs, '', $ftp_key); jio()->DeleteFile($image_file_abs); jio()->DeleteFile($image_file_small_abs); } } $sql = "update `" . TABLE_PREFIX . "members` set `face_url`='{$face_url}', `face`='{$dst_file}' where `uid`='" . MEMBER_ID . "'"; $this->DatabaseHandler->Query($sql); jio()->DeleteFile($src_file); if ($this->Config['extcredits_enable'] && MEMBER_ID > 0) { update_credits_by_action('face', MEMBER_ID); } Mobile::success("Success"); }
function Login2() { $username = trim(jget('username')); $password = jget('password'); if ($username == "" || $password == "") { json_error("无法登录,用户名或密码不能为空"); } if ($GLOBALS['_J']['plugins']['func']['login']) { hookscript('login', 'funcs', array('param' => $this->Post, 'step' => 'check'), 'login'); } $referer = jget('referer'); if (!$referer) { $referer = jsg_getcookie('referer'); } $rets = jsg_member_login($username, $password); $uid = (int) $rets['uid']; if ($uid < 1) { json_error($rets['error']); } $member = jsg_member_info($uid); $this->Config['email_must_be_true'] == 2 && $member['email_checked'] == 0 && ($referer = 'index.php?mod=member&code=setverify&ids=' . $uid); if ($this->Config['extcredits_enable'] && $uid > 0) { update_credits_by_action('login', $uid); } Load::logic('other'); $otherLogic = new OtherLogic(); $sql = "SELECT m.id as medal_id,m.medal_img,m.medal_name,m.medal_depict,m.conditions,u.dateline,y.apply_id\r\n\t\t\t\tFROM " . TABLE_PREFIX . "medal m\r\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "user_medal u ON (u.medalid = m.id AND u.uid = '{$uid}')\r\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "medal_apply y ON (y.medal_id = m.id AND y.uid = '{$uid}')\r\n\t\t\t\tWHERE m.is_open = 1\r\n\t\t\t\tORDER BY u.dateline DESC,m.id"; $query = $this->DatabaseHandler->Query($sql); while (false != ($rs = $query->GetRow())) { $rs['conditions'] = unserialize($rs['conditions']); if (in_array($rs['conditions']['type'], array('topic', 'reply', 'tag', 'invite', 'fans')) && !$rs['dateline']) { $result .= $otherLogic->autoCheckMedal($rs['medal_id'], $uid); } } header("location:mobile/index.php"); }
function register_by_invite($invite_uid, $uid = MEMBER_ID, $check_result = array()) { $u = (int) $invite_uid; if ($u < 1) { return 0; } $uid = (int) $uid; if ($uid < 1) { return 0; } if ($uid == $u) { return 0; } $invite_member = jsg_member_info($u); if (!$invite_member) { return 0; } $member = jsg_member_info($uid); if (!$member) { return 0; } $timestamp = time(); $username = $member['nickname']; $email = $member['email']; $c = $check_result['code']; buddy_add($u, $uid); if ($check_result) { buddy_add($uid, $u); } if (0 < ($invite_id = $check_result['invite_id'])) { $row = DB::fetch_first("select * from `" . TABLE_PREFIX . "invite` where `id`='{$invite_id}'"); if ($row) { DB::query("update `" . TABLE_PREFIX . "invite` set `fuid`='{$uid}',`fusername`='{$username}' where `id`='{$row['id']}'"); } } else { DB::query("insert into `" . TABLE_PREFIX . "invite` (`uid`,`code`,`dateline`,`fuid`,`fusername`,`femail`) values ('{$u}','{$c}','{$timestamp}','{$uid}','{$username}','{$email}')"); } DB::query("update `" . TABLE_PREFIX . "members` set `invite_count`=`invite_count`+1 where `uid`='{$u}'"); DB::query("update `" . TABLE_PREFIX . "members` set `invite_uid`='{$u}' where `uid`='{$uid}'"); if ($c && $GLOBALS['_J']['config']['invite_limit'] > 0) { $code_invite_count = DB::result_first("select count(*) as code_invite_count from `" . TABLE_PREFIX . "invite` where `uid`='{$u}' and `code`='{$c}'"); if ($code_invite_count > $GLOBALS['_J']['config']['invite_limit']) { $this->register_check_invite($u, 1); } } if ($GLOBALS['_J']['config']['extcredits_enable'] && $u > 0) { update_credits_by_action('register', $u); } return 1; }
function DoModify() { $uid = (int) $this->Post['uid']; $is_pm_notice = (int) $this->Post['is_pm_notice']; $is_audit = $this->Post['is_audit']; $category_fid = (int) $this->Post['category_fid']; $category_id = (int) $this->Post['category_id']; $audit_info = $this->Post['to_message']; if (!$category_fid || !$category_id) { $this->Messager("请确认认证类别", -1); } $validate_info = $this->Post['validate_info']; $sql = "update `" . TABLE_PREFIX . "validate_category_fields`\r\n\t\t\t\tset `audit_info` = '{$audit_info}',\r\n\t\t\t\t\t`category_fid` = '{$category_fid}',\r\n\t\t\t\t\t`category_id` = '{$category_id}',\r\n\t\t\t\t\t`is_audit` = '{$is_audit}',\r\n\t\t\t\t\t`is_push` = 0\r\n\t\t\t\twhere `uid` = '{$uid}'"; $update = $this->DatabaseHandler->Query($sql); if ($is_audit == 1) { update_credits_by_action('vip', $uid); $to_user = DB::result_first("select `nickname` from `" . TABLE_PREFIX . "members` where `uid` = '{$uid}'"); $pm_post = array('message' => '您的V认证申请已经通过。', 'to_user' => $to_user); jlogic('pm')->pmSend($pm_post); } if ($is_audit != 1) { $sql = "update `" . TABLE_PREFIX . "members` set `validate`='0',`validate_category`='0' where `uid`='{$uid}'"; $this->DatabaseHandler->Query($sql); if ($is_pm_notice) { $message = $this->Post['to_message'] ? $this->Post['to_message'] : "没有理由!"; $data = array('to_user' => $this->Post['nickname'], 'message' => "您的身份验证不通过,拒绝理由:" . $message); load::logic('pm'); $PmLogic = new PmLogic(); $return = $PmLogic->pmSend($data); } $this->Messager('已设置为审核未通过', 'admin.php?mod=vipintro'); } $member_extra = ''; if ($this->Post['member_extra']) { $member_extra = @serialize($this->Post['member_extra']); } $sql = "update `" . TABLE_PREFIX . "members` set `validate`='{$category_fid}',`validate_category` = '{$category_id}' where `uid`='{$uid}'"; $this->DatabaseHandler->Query($sql); $sql = "update `" . TABLE_PREFIX . "memberfields` set `validate_true_name`='{$this->Post['validate_true_name']}' ,`validate_card_id` = '{$this->Post['validate_card_id']}' ,`validate_card_type` = '{$this->Post['validate_card_type']}' , `validate_remark` = '{$validate_info}',`validate_extra` = '{$member_extra}' where `uid` = '{$uid}'"; $update = $this->DatabaseHandler->Query($sql); $category_count = DB::result_first("SELECT count(*) FROM " . DB::table('validate_category_fields') . " where `category_fid` = '{$category_fid}' "); $subclass_count = DB::result_first("SELECT count(*) FROM " . DB::table('validate_category_fields') . " where `category_id` = '{$category_id}' "); $sql = "update `" . TABLE_PREFIX . "validate_category` set `num`='{$category_count}' where `id`='{$category_fid}'"; $this->DatabaseHandler->Query($sql); $sql = "update `" . TABLE_PREFIX . "validate_category` set `num`='{$subclass_count}' where `id`='{$category_id}'"; $this->DatabaseHandler->Query($sql); $this->Messager('审核成功', 'admin.php?mod=vipintro'); }
function face($p = array(), $modify = 1) { global $_J; $pic_file = $p['pic_file'] && is_image($p['pic_file']) ? $p['pic_file'] : ''; $pic_url = $p['pic_url'] && false !== strpos($p['pic_url'], ':/' . '/') ? $p['pic_url'] : ''; $p['pic_field'] = $p['pic_field'] ? $p['pic_field'] : 'face'; $pic_field = $p['pic_field'] && $_FILES[$p['pic_field']] ? $p['pic_field'] : ''; if (!$pic_file && !$pic_url && !$pic_field) { return jerror('pic is empty', 0); } $uid = $p['uid'] ? (int) $p['uid'] : MEMBER_ID; if ($uid < 1) { return jerror('请指定一个用户ID', -1); } $member = jsg_member_info($uid); if (!$member) { return jerror('用户已经不存在了', -2); } if (!$_J['config']['edit_face_enable'] && $member['__face__'] && 'admin' != MEMBER_ROLE_TYPE) { return jerror('不允许用户修改头像', -3); } $src_x = max(0, (int) $p['x']); $src_y = max(0, (int) $p['y']); $src_w = max(0, (int) $p['w']); $src_h = max(0, (int) $p['h']); $image_path = RELATIVE_ROOT_PATH . 'images/' . ($_J['config']['face_verify'] ? 'face_verify' : 'face') . '/' . face_path($uid); $image_name = $uid . '_b.jpg'; $image_file = $image_path . $image_name; $image_file_small = $image_path . $uid . '_s.jpg'; $image_file_temp = $image_path . $uid . '_t.jpg'; if (!is_dir($image_path)) { jmkdir($image_path); } if (!$modify && is_image($image_file)) { return jerror('头像已经存在了', -4); } if ($pic_file) { $src_file = $pic_file; } elseif ($pic_url) { $image_data = dfopen($pic_url, 99999999, '', '', true, 3, $_SERVER['HTTP_USER_AGENT']); if ($image_data) { jio()->WriteFile($image_file, $image_data); if (is_image($image_file)) { $src_file = $image_file; } } } elseif ($pic_field) { jupload()->init($image_path, $pic_field, true, false); jupload()->setNewName($image_name); $result = jupload()->doUpload(); if ($result && is_image($image_file)) { $src_file = $image_file; } } if (!is_image($src_file)) { return jerror('源头像不存在了,请上传正确的图片文件', -5); } $w = max(50, min(128, $src_w > 50 ? $src_w : 200)); $make_result = makethumb($src_file, $image_file, $w, $w, 0, 0, $src_x, $src_y, $src_w, $src_h); $make_result = makethumb($src_file, $image_file_small, 50, 50, 0, 0, $src_x, $src_y, $src_w, $src_h); $face_url = ''; if ($_J['config']['ftp_on']) { $ftp_key = randgetftp(); $get_ftps = jconf::get('ftp'); $face_url = $get_ftps[$ftp_key]['attachurl']; $ftp_result = ftpcmd('upload', $image_file, '', $ftp_key); if ($ftp_result > 0) { ftpcmd('upload', $image_file_small, '', $ftp_key); jio()->DeleteFile($image_file); jio()->DeleteFile($image_file_small); } } if ($_J['config']['face_verify']) { $count = DB::result_first("SELECT COUNT(1) FROM " . DB::table('members_verify') . " WHERE `uid`='{$uid}'"); if ($count) { $sql = "update `" . TABLE_PREFIX . "members_verify` set `face_url`='{$face_url}', `face`='{$image_file_small}' where `uid`='{$uid}'"; } else { $sql = "insert into `" . TABLE_PREFIX . "members_verify` (`uid`,`nickname`,`face_url`,`face`) values('{$uid}','{$member['nickname']}','{$face_url}','{$image_file_small}')"; } DB::query($sql); if ($_J['config']['notice_to_admin']) { $pm_post = array('message' => $member['nickname'] . " 修改了头像进入审核,<a href='admin.php?mod=verify&code=fs_verify' target='_blank'>点击</a>进入审核。", 'to_user' => str_replace('|', ',', $_J['config']['notice_to_admin'])); $admin_info = jsg_member_info(1); jlogic('pm')->pmSend($pm_post, $admin_info['uid'], $admin_info['username'], $admin_info['nickname']); } } else { $sql = "update `" . TABLE_PREFIX . "members` set `face_url`='{$face_url}', `face`='{$image_file_small}' where `uid`='{$uid}'"; DB::query($sql); if ($_J['config']['extcredits_enable'] && $uid > 0) { update_credits_by_action('face', $uid); } } return true; }
function DoLogin() { if ($this->Config['seccode_enable'] == 1 && $this->Config['seccode_login']) { if (!ckseccode(@$_POST['seccode'])) { $this->Messager("验证码输入错误", -1); } } elseif ($this->Config['seccode_enable'] > 1 && $this->Config['seccode_login'] && $this->yxm_title && $this->Config['seccode_pub_key'] && $this->Config['seccode_pri_key']) { $YinXiangMa_response = jlogic('seccode')->CheckYXM(@$_POST['YinXiangMa_challenge'], @$_POST['YXM_level'][0], @$_POST['YXM_input_result']); if ($YinXiangMa_response != "true") { $this->Messager("验证码输入错误", -1); } } if ($this->Username == "" || $this->Password == "") { $this->Messager("无法登录,用户名或密码不能为空", -1); } $username = $this->Username; $password = $this->Password; $referer = jget('referer'); if (!$referer) { $referer = jsg_getcookie('referer'); } $rets = jsg_member_login($username, $password); $uid = (int) $rets['uid']; if ($uid < 1) { $this->Messager($rets['error'], null); } $member = jsg_member_info(MEMBER_ID); $this->Config['reg_email_verify'] == 1 && $member['email_checked'] == 0 && ($referer = 'index.php?mod=member&code=setverify&ids=' . $uid); $this->Config['email_must_be_true'] == 2 && $member['email_checked'] == 0 && ($referer = 'index.php?mod=member&code=setverify&ids=' . $uid); if ($this->Config['extcredits_enable'] && $uid > 0) { update_credits_by_action('login', $uid); } Load::logic('other'); $otherLogic = new OtherLogic(); $sql = "SELECT m.id as medal_id,m.medal_img,m.medal_name,m.medal_depict,m.conditions,u.dateline,y.apply_id\r\n\t\t\t\tFROM " . TABLE_PREFIX . "medal m\r\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "user_medal u ON (u.medalid = m.id AND u.uid = '{$uid}')\r\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "medal_apply y ON (y.medal_id = m.id AND y.uid = '{$uid}')\r\n\t\t\t\tWHERE m.is_open = 1\r\n\t\t\t\tORDER BY u.dateline DESC,m.id"; $query = $this->DatabaseHandler->Query($sql); while (false != ($rs = $query->GetRow())) { $rs['conditions'] = unserialize($rs['conditions']); if (in_array($rs['conditions']['type'], array('topic', 'reply', 'tag', 'invite', 'fans', 'sign')) && !$rs['dateline']) { $result .= $otherLogic->autoCheckMedal($rs['medal_id'], $uid); } } $redirecto = $referer ? $referer : referer(); $redirecto = str_replace('#', '', $redirecto); if ($this->Post['loginType'] == 'share') { $redirecto = $this->Post['return_url']; $this->Messager(null, $redirecto, 0); } if ($this->Post['loginType'] == 'show_login') { $this->Messager(NULL, $redirecto, 0); } if ($rets['uc_syn_html']) { $this->Messager("登录成功{$rets['uc_syn_html']}", $redirecto, 3); } else { $this->Messager(null, $redirecto); } }
function DoLogin() { $this->Username = wap_iconv($this->Username, 'utf-8', $this->Config['charset'], 1); $this->Password = wap_iconv($this->Password, 'utf-8', $this->Config['charset'], 1); if ($this->Username == "" || $this->Password == "") { $this->Messager("无法登录,用户名或密码不能为空", 'index.php?mod=login'); } $username = $this->Username; $password = $this->Password; if ($this->Config['reg_email_verify'] == '1') { $member_info = DB::fetch_first("select `uid`,`username` from " . DB::table('members') . " where `username`='{$username}' limit 0,1"); if ($member_info) { $member_validate = DB::fetch_first("select `uid`,`status` from " . DB::table('member_validate') . " where `uid`='{$member_info['uid']}' "); } if ($member_validate) { if ($member_validate['status'] != '1') { $this->Messager("必须完成邮件激活,才能正常访问!进入注册时填写的邮箱激活即可。", 'index.php?mod=login'); } } } $referer = jget('referer'); if (!$referer) { $referer = jsg_getcookie('referer'); } $rets = jsg_member_login($username, $password); if ($rets['uid'] < 1) { $this->Messager(wap_iconv($rets['error']), null); } $uid = $rets['uid']; if ($this->Config['extcredits_enable'] && $rets['uid'] > 0) { update_credits_by_action('login', $rets['uid']); } $redirecto = $referer ? $referer : referer('index.php'); if (strpos($redirecto, 'login') !== false) { $redirecto = "index.php?mod=topic&code=myhome"; } if ($this->Post['loginType'] == 'share') { $redirecto = $this->Post['return_url']; } $this->Messager('登录成功', $redirecto, 0); }
function delete($ids) { $sparecredit = $spaces = $polls = $newpids = array(); $delnum = 0; if (!is_array($ids)) { $ids = (array) $ids; } $query = DB::query("SELECT * FROM " . DB::table('vote') . " WHERE vid IN (" . jimplode($ids) . ")"); while ($value = DB::fetch($query)) { if (jallow($value['uid'])) { $polls[] = $value; update_credits_by_action('vote_del', $value['uid']); } } if (empty($polls)) { return false; } foreach ($polls as $key => $value) { $newpids[] = $value['vid']; } DB::query("DELETE FROM " . DB::table('vote') . " WHERE vid IN (" . jimplode($newpids) . ")"); DB::query("DELETE FROM " . DB::table('vote_field') . " WHERE vid IN (" . jimplode($newpids) . ")"); DB::query("DELETE FROM " . DB::table('vote_option') . " WHERE vid IN (" . jimplode($newpids) . ")"); DB::query("DELETE FROM " . DB::table('vote_user') . " WHERE vid IN (" . jimplode($newpids) . ")"); $pic_arr = array(); $query = DB::query(" select * from " . DB::table('vote_image') . " WHERE vid IN (" . jimplode($newpids) . ")"); while ($rs = DB::fetch($query)) { if ($rs['picurl']) { unlink($rs['picurl']); } } DB::query(" delete from " . DB::table('vote_image') . " WHERE vid IN (" . jimplode($newpids) . ")"); $tids = array(); $query = DB::query("SELECT tid FROM " . DB::table('topic_vote') . " WHERE item_id IN (" . jimplode($newpids) . ") "); while ($value = DB::fetch($query)) { $tids[] = $value['tid']; } if (!empty($tids)) { $topic_reply_ids = array(); $query = DB::query("SELECT tid,type FROM " . DB::table('topic') . " WHERE tid IN(" . jimplode($tids) . ")"); while ($value = DB::fetch($query)) { if ($value['type'] == 'reply') { $topic_reply_ids[] = $value['tid']; } } if (!empty($topic_reply_ids)) { $TopicLogic = jlogic('topic'); $TopicLogic->Delete($topic_reply_ids); } DB::query("DELETE FROM " . DB::table('topic_vote') . " WHERE item_id IN (" . jimplode($newpids) . ") "); } return $polls; }
function DeleteAttach() { if (MEMBER_ID < 1) { json_error("请先登录或者注册一个帐号"); } $id = jget('id', 'int'); $topic_attach = $this->AttachLogic->get_info($id); if (!$topic_attach) { json_error('请指定一个正确的文件ID'); } if (jdisallow($topic_attach['uid'])) { json_error('您无权删除该文件'); } $ret = $this->AttachLogic->delete($id); update_credits_by_action('attach_del', $topic_attach['uid']); if (!$ret) { json_error('删除失败'); } json_result('删除成功'); }
function doApp($id, $qua) { $id = (int) $id; $time = time(); $member_info = $this->getMemberInfo($id, MEMBER_ID); if ($member_info) { DB::query("update " . TABLE_PREFIX . "event_member set app = 1 ,app_time = '{$time}' ,app_info = '{$qua}' where id = '{$id}' and fid = " . MEMBER_ID); } else { $title = DB::result_first("select title from " . TABLE_PREFIX . "event where id = '{$id}'"); DB::query("insert into " . TABLE_PREFIX . "event_member (id,title,fid,app,app_time,app_info) values('{$id}','{$title}'," . MEMBER_ID . ",1,'{$time}','{$qua}')"); } DB::query("update " . TABLE_PREFIX . "event set app_num = app_num + 1,lasttime = '{$time}' where id = '{$id}'"); $postman = DB::result_first("select postman from " . TABLE_PREFIX . "event where id = '{$id}' "); $query = DB::query("select fid from " . TABLE_PREFIX . "event_member where id = '{$id}' order by `id` limit 300 "); $id_arr = array(); while ($rsdb = DB::fetch($query)) { $id_arr[$rsdb['fid']] = $rsdb['fid']; } if (!in_array($postman, $id_arr)) { $id_arr[$postman] = $postman; } if (in_array(MEMBER_ID, $id_arr)) { unset($id_arr[MEMBER_ID]); } if ($id_arr) { DB::query("update " . TABLE_PREFIX . "members set event_new = event_new + 1 where uid in ('" . implode("','", $id_arr) . "')"); } update_credits_by_action('event_app', MEMBER_ID); }
function ordercancle() { $config = jconf::get('mall'); $mall_enable = (int) $config['enable']; if ($mall_enable === 0) { return json_error('没有开启积分商城模块'); } $order_id = jget('oid', 'int'); if ($order_id === 0) { return json_error('没有找到订单对象'); } $order = jtable("mall_order")->info($order_id); if (empty($order)) { return json_error('没有找到订单对象'); } jtable('mall_goods')->update_count(array('id' => $order['goods_id']), 'seal_count', '-' . $order['goods_num']); jtable('mall_goods')->update_count(array('id' => $order['goods_id']), 'total', '+' . $order['goods_num']); jtable("mall_order")->update(array('status' => 2), array('id' => $order_id)); update_credits_by_action('unconvert', $order['uid'], 1, $order['pay_credit']); return json_result('订单取消成功'); }
function doVerify() { $act = $this->Get['act']; $uids = array(); $uid = (int) $this->Get['uid']; $uids = $this->Post['uids']; if ($uid) { $uids[$uid] = $uid; } $msg = jget('msg'); if ($act == 'yes') { if ($uids) { foreach ($uids as $uid) { if ($uid < 1) { continue; } $message = ''; $nickname = DB::result_first(" select `nickname` from `" . TABLE_PREFIX . "members` where `uid` = '{$uid}'"); $query = $this->DatabaseHandler->Query("select * from " . TABLE_PREFIX . "members_verify where `uid` = '{$uid}'"); $member_verify = $query->GetRow(); if ($member_verify) { if ($member_verify['face'] || $member_verify['face_url']) { $image_path = RELATIVE_ROOT_PATH . 'images/face/' . face_path($uid); if (!is_dir($image_path)) { jio()->MakeDir($image_path); } $image_file_b = $dst_file = $image_path . $uid . '_b.jpg'; $image_file_s = $dst_file = $image_path . $uid . '_s.jpg'; $image_verify_path = RELATIVE_ROOT_PATH . 'images/face_verify/' . face_path($uid); $image_verify_file_b = $dst_file = $image_verify_path . $uid . '_b.jpg'; $image_verify_file_s = $dst_file = $image_verify_path . $uid . '_s.jpg'; if ($member_verify['face_url']) { $ftp_key = getftpkey($member_verify['face_url']); if ($ftp_key < 0) { $this->Messager('请检查FTP是否可用'); } ftpcmd('get', $image_file_b, $image_verify_file_b, $ftp_key); ftpcmd('get', $image_file_s, $image_verify_file_s, $ftp_key); $ftp_result = ftpcmd('upload', $image_file_b, '', $ftp_key); $ftp_result = ftpcmd('upload', $image_file_s, '', $ftp_key); $sql = "update `" . TABLE_PREFIX . "members` set `face`='{$image_file_s}', `face_url`='{$member_verify['face_url']}' where `uid`='" . $uid . "'"; $this->DatabaseHandler->Query($sql); } else { if ($member_verify['face']) { @copy($image_verify_file_b, $image_file_b); @copy($image_verify_file_s, $image_file_s); $sql = "update `" . TABLE_PREFIX . "members` set `face`='{$image_file_s}' where `uid`='" . $uid . "'"; $this->DatabaseHandler->Query($sql); } } if ($this->Config['extcredits_enable'] && $member_verify['uid'] > 0) { update_credits_by_action('face', $member_verify['uid']); } $message .= '你更新的头像已经通过审核,可以通过ctrl+f5强制刷新来查看新头像;'; } if ($member_verify["signature"]) { $sql = "update " . TABLE_PREFIX . "members set signature = '{$member_verify['signature']}',signtime = '" . time() . "' where uid = '{$uid}' "; $this->DatabaseHandler->Query($sql); $message .= '你更新的签名已经更过审核;'; } $this->DatabaseHandler->Query("delete from " . TABLE_PREFIX . "members_verify where uid = '{$uid}'"); $pm_post = array('message' => $message, 'to_user' => $nickname); jlogic('pm')->pmSend($pm_post); } } } } else { if ($msg) { $to_user = DB::result_first("select `nickname` from `" . TABLE_PREFIX . "members` where `uid` = '{$uid}'"); if ($to_user) { $pm_post = array('message' => $msg, 'to_user' => $to_user); jlogic('pm')->pmSend($pm_post); } } $this->DatabaseHandler->Query("delete from `" . TABLE_PREFIX . "members_verify` where `uid` = '{$uid}'"); } $this->Messager("操作成功"); }
function pmSendAgain($post) { $message = trim($post['message']); $time = time(); if ($message == '') { return 1; } $pmid = $post['pmid']; $pm = $this->DatabaseHandler->Query("select * from " . TABLE_PREFIX . "pms where pmid = '{$pmid}'"); $pm_list = $pm->GetRow(); $pm_list['message'] = $message; $touid = $pm_list['msgtoid']; $uids = ''; if ($pm_list['msgtoid'] > $pm_list['msgfromid']) { $uids = $pm_list['msgfromid'] . "," . $pm_list['msgtoid']; } else { $uids = $pm_list['msgtoid'] . "," . $pm_list['msgfromid']; } if ($touid < 1) { return 5; } $to_user_list = array(); $sql = "\r\n\t\tSELECT\r\n\t\t\tuid,username,nickname,notice_pm,email,newpm\r\n\t\tFROM\r\n\t\t\t" . TABLE_PREFIX . 'members' . "\r\n\t\tWHERE\r\n\t\t\tuid = '{$touid}'"; $query = $this->DatabaseHandler->Query($sql); while ($row = $query->GetRow()) { $to_user_list[$row['uid']] = $row; } if ($to_user_list == false) { return 3; } $plid = DB::result_first("select plid from " . TABLE_PREFIX . "pms_index where uids = '{$uids}'"); if ($plid == 0) { DB::query("insert into " . TABLE_PREFIX . "pms_index (uids) values('{$uids}')"); $plid = mysql_insert_id(); $pm_list['plid'] = $plid; $lastmessage = addslashes(serialize($pm_list)); DB::query("insert into " . TABLE_PREFIX . "pms_list (plid,uid,pmnum,dateline,lastmessage) values('{$plid}'," . MEMBER_ID . ",1,'{$time}','{$lastmessage}')"); if ($pm_list['msgtoid'] != $pm_list['msgfromid']) { DB::query("insert into " . TABLE_PREFIX . "pms_list (plid,uid,pmnum,dateline,lastmessage) values('{$plid}','{$touid}',1,'{$time}','{$lastmessage}')"); } } else { $lastmessage = addslashes(serialize($pm_list)); DB::query("update " . TABLE_PREFIX . "pms_list set pmnum = pmnum + 1,dateline = '{$time}',lastmessage = '{$lastmessage}' where plid = '{$plid}'"); } DB::query("update " . TABLE_PREFIX . "pms set folder = 'inbox' ,message = '{$message}' ,dateline = '{$time}',plid = '{$plid}' where pmid = '{$pmid}'"); $num = 1; $_tmps = array_keys($to_user_list); $to_user_id_list = array(); foreach ($_tmps as $_tmp) { $_tmp = (int) $_tmp; if ($_tmp > 0) { $to_user_id_list[$_tmp] = $_tmp; } } $this->UpdateNewMsgCount($num, $to_user_id_list); foreach ($to_user_list as $user_notice) { if ($GLOBALS['_J']['config']['sendmailday'] > 0) { jtable('mailqueue')->add($user_notice, 'notice_pm'); } if ($GLOBALS['_J']['config']['imjiqiren_enable'] && imjiqiren_init()) { imjiqiren_send_message($user_notice, 'm', $GLOBALS['_J']['config']); } if ($GLOBALS['_J']['config']['sms_enable'] && sms_init()) { sms_send_message($user_notice, 'm', $GLOBALS['_J']['config']); } } if ($GLOBALS['_J']['config']['extcredits_enable'] && MEMBER_ID > 0) { update_credits_by_action('pm', MEMBER_ID, count($to_user_list)); } return 0; }
function DeleteAttach() { $tid = (int) $this->Get['tid']; $ids = $this->Post['ids'] ? $this->Post['ids'] : $this->Get['ids']; $uid = DB::result_first("select uid from " . TABLE_PREFIX . "topic_attach where id = '{$ids}'"); if (!$uid) { $this->Messager("您要删除的附件不存在!"); } $sql = "delete from `" . TABLE_PREFIX . "topic_attach` where `id`='{$ids}'"; $this->DatabaseHandler->Query($sql); update_credits_by_action('attach_del', $uid); jio()->DeleteFile(topic_attach($ids, 'file')); $verify = $this->Get['verify']; if ($verify) { $table = TABLE_PREFIX . "topic_verify"; } else { $table = TABLE_PREFIX . "topic"; } $attachid = DB::result_first("select attachid from {$table} where tid = '{$tid}'"); if ($attachid) { $attach_id_arr = explode(",", $attachid); foreach ($attach_id_arr as $key => $value) { if ($value == $ids) { unset($attach_id_arr[$key]); } } $new_attachid = implode(",", $attach_id_arr); $updata = "update {$table} set `attachid`='{$new_attachid}' where `tid`= '{$tid}'"; $result = $this->DatabaseHandler->Query($updata); } $this->Messager("操作成功"); }