public function login() { $username = jget('username', 'txt'); $password = jget('password'); $openid = jget('openid'); if ($username == "" || $password == "") { json_error("无法登录,用户名或密码不能为空"); } if ($this->Config['login_by_uid']) { is_numeric($username) && json_error("禁止使用UID登录"); } if ($GLOBALS['_J']['plugins']['func']['login']) { hookscript('login', 'funcs', array('param' => $this->Post, 'step' => 'check'), 'login'); } $rets = jsg_member_login($username, $password); $uid = (int) $rets['uid']; if ($uid < 1) { json_error(array_iconv($this->Config['charset'], 'utf-8', $rets['error'])); } $r = false; if ($openid && $uid) { $r = jlogic('wechat')->do_bind($openid, $uid); } if ($r) { json_result("绑定成功!"); } else { json_error("绑定失败!"); } }
function Domodfeature() { $tid = jget('tid'); $relateid = jget('replyid'); $featureid = jget('featureid'); if ($tid > 0) { jlogic('feature')->set_topic_feature($tid, $relateid, $featureid); json_result('操作成功'); } else { json_result('没做任何处理'); } }
function choose() { $post = $this->Post; $post['id'] = (int) $post['id']; $type = $this->Get['type']; $time = TIMESTAMP; $i = 0; if ($type == 'agree') { foreach ($post['che'] as $key => $val) { $key = (int) $key; if ($val) { $this->DatabaseHandler->Query("update " . TABLE_PREFIX . "event_member set play = 1,play_time = '{$time}' where id = '{$post[id]}' and fid = '{$key}'"); $i++; } } } else { foreach ($post['che'] as $key => $val) { $key = (int) $key; if ($val) { $this->DatabaseHandler->Query("update " . TABLE_PREFIX . "event_member set play = 0,play_time = 0 where id = '{$post[id]}' and fid = '{$key}'"); $i--; } } } $play_num = DB::result_first("select count(*) from " . TABLE_PREFIX . "event_member where id = '{$post[id]}' and play = 1 "); $this->DatabaseHandler->Query("update " . TABLE_PREFIX . "event set play_num = '{$play_num}' where id = '{$post[id]}' "); json_result("成功"); }
function appMedal() { $medal_id = (int) $this->Get['medal_id']; $uid = (int) $this->Get['uid']; $uid = (int) MEMBER_ID; $nickname = MEMBER_NICKNAME; $time = TIMESTAMP; if ($medal_id < 1) { json_error("无效的勋章ID"); } if ($uid < 1) { json_error("无效的用户ID"); } $count = DB::result_first("select count(*) from " . TABLE_PREFIX . "medal_apply where medal_id = '{$medal_id}' and uid = '{$uid}'"); if ($count) { json_error("勋章已申请,耐心等待哦"); } $reslut = $this->DatabaseHandler->Query("insert into " . TABLE_PREFIX . "medal_apply (uid,nickname,medal_id,dateline) values ('{$uid}','{$nickname}','{$medal_id}','{$time}')"); if ($reslut) { json_result("1"); } else { json_error("申请失败:" . $reslut); } }
function DelPlaylistAll() { $this->_init_wall(); $wall_id = $this->WallId; $ret = $this->WallLogic->clear_wall_playlist($wall_id); json_result('清空成功'); }
function DoAdd() { $this->_check_login(); $longtext = $this->Post['longtext'] ? $this->Post['longtext'] : $this->Get['longtext']; if ('' == trim(strip_tags($longtext))) { json_error('内容不能为空'); } $f_rets = filter($longtext); if ($f_rets && $f_rets['error']) { json_error('内容 ' . $f_rets['msg']); } $data_length_limit = $this->Config['topic_cut_length'] * 2; $retval_data = trim(strip_tags($longtext)); $retval_data_length = strlen($retval_data); $ret = 0; $ret_msg = ''; if ($retval_data_length > $data_length_limit) { $ret = $this->LongtextLogic->add($longtext); if ($ret < 1) { json_error('内容添加失败'); } else { $ret_msg = '内容添加成功'; } } else { $ret_msg = '内容长度过短,点击确定按钮直接发起一条微博'; } $retval = array('id' => $ret, 'data' => cut_str($retval_data, $data_length_limit, '')); json_result($ret_msg, $retval); }
function Login() { $username = trim(jget('username')); $password = jget('password'); if ($this->Config['seccode_enable'] == 1 && $this->Config['seccode_login']) { if (!ckseccode(@$_POST['seccode'])) { json_error("验证码输入错误"); } } 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") { json_error("验证码输入错误"); } } if ($username == "" || $password == "") { json_error("无法登录,用户名或密码不能为空"); } if ($this->Config['login_by_uid']) { is_numeric($username) && json_error("禁止使用UID登录"); } 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); } } $redirecto = $referer ? $referer : referer(); if (!$redirecto || strpos($redirecto, 'login') !== false) { $redirecto = "index.php?"; } $redirecto = str_replace('#', '', $redirecto); if ($rets['uc_syn_html']) { json_result("登录成功{$rets['uc_syn_html']}", $redirecto); } else { json_result('登录成功', $redirecto); } }
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 DoRecommend() { $act = $this->Post['act'] ? $this->Post['act'] : $this->Get['act']; $timestamp = time(); $uid = MEMBER_ID; $username = MEMBER_NAME; $hot_tag_recommend_config = jconf::get('hot_tag_recommend'); $messager = ""; if ('delete' == $act) { $hot_tag_recommend = $hot_tag_recommend_config; $id = max(0, (int) get_param('id')); $info = DB::fetch_first("select * from " . TABLE_PREFIX . "tag_recommend where `id`='{$id}'"); if (!$info) { $this->Messager("你要删除的内容已经不存在了"); } $name = $info['name']; DB::query("delete from " . TABLE_PREFIX . "tag_recommend where `id`='{$id}'"); DB::query("update " . TABLE_PREFIX . "tag set `status`=0 where `name`='{$name}'"); $messager = "删除成功"; } else { $_arr = $this->Post['hot_tag_recommend']; if ($_arr) { $name = $_arr['name'] ? $_arr['name'] : "热门话题推荐"; $num = min(20, max(1, (int) $_arr['num'])); $hot_tag_recommend = array('enable' => $_arr['enable'] ? 1 : 0, 'name' => $name, 'num' => $num, 'time' => time()); if ($_arr['list']) { $_list = $this->Post['_list']; foreach ($_arr['list'] as $k => $v) { if ($v != $_list[$k]) { $v['enable'] = $v['enable'] ? 1 : 0; $_sets = array(); foreach ($v as $_k => $_v) { if ($_v != $_list[$k][$_k]) { $_sets[$_k] = "`{$_k}`='{$_v}'"; } } if ($_sets) { $_sets['last_update'] = "`last_update`='{$timestamp}'"; DB::query("update " . TABLE_PREFIX . "tag_recommend set " . implode(" , ", $_sets) . " where `id`='{$k}'"); if ($v['enable'] != $_list[$k]['enable']) { DB::query("update " . TABLE_PREFIX . "tag set `status`='{$v['enable']}' where `name`='{$v['name']}'"); } } } } } } else { $hot_tag_recommend = $hot_tag_recommend_config; } $_new_arr = $this->Post['hot_tag_recommend_new']; foreach ($_new_arr as $k => $v) { if ($name = get_safe_code($v['name'])) { if (DB::fetch_first("select * from " . TABLE_PREFIX . "tag_recommend where `name`='{$name}'")) { continue; } if (false == DB::fetch_first("select * from " . TABLE_PREFIX . "tag where `name`='{$name}'")) { jtable('tag')->insert(array('name' => $name, 'user_id' => MEMBER_ID, 'username' => MEMBER_NAME, 'dateline' => TIMESTAMP, 'last_post' => TIMESTAMP)); } $_enable = $v['enable'] ? 1 : 0; $desc = $v['desc']; $order = (int) $v['order']; DB::query("insert into " . TABLE_PREFIX . "tag_recommend (`enable`,`name`,`desc`,`order`,`dateline`,`uid`,`username`) values ('{$_enable}','{$name}','{$desc}','{$order}','{$timestamp}','{$uid}','{$username}')"); DB::query("update " . TABLE_PREFIX . "tag set `status`='{$_enable}' where `name`='{$name}'"); } } $messager = "设置成功"; } if (false == jpost('is_ajax')) { if ($hot_tag_recommend) { $__list = array(); if ($hot_tag_recommend['num'] > 0) { $sql = "select tr.*,t.id as tag_id,t.topic_count from " . TABLE_PREFIX . "tag_recommend tr left join " . TABLE_PREFIX . "tag t on t.name=tr.name where tr.enable=1 order by `order` desc , `id` desc limit {$hot_tag_recommend['num']}"; $query = $this->DatabaseHandler->Query($sql); while (false != ($row = $query->GetRow())) { $__list[$row['id']] = $row; } } $hot_tag_recommend['list'] = $__list; if ($hot_tag_recommend_config != $hot_tag_recommend) { jconf::set('hot_tag_recommend', $hot_tag_recommend); if ($hot_tag_recommend['enable'] != $this->Config['hot_tag_recommend_enable']) { $config = array(); $config['hot_tag_recommend_enable'] = $hot_tag_recommend['enable']; jconf::update($config); } } } $this->Messager($messager); } else { json_result($messager); } }
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 UrlIframePost() { $content = $this->_input('content', $this->in_ajax); $item_id = max(0, (int) $this->_input('item_id')); $item = jget('item', 'txt'); if ($item_id < 1 || !in_array($item, $this->allow_item)) { $item = ''; $item_id = 0; } $imageid = $this->_input('imageid', $this->in_ajax, ''); $totid = max(0, (int) $this->_input('totid')); $type = $this->_input('type'); if ('qun' == $item && $item_id > 0 && $totid < 1 && 'reply' == $type) { $type = 'qun'; } $datas = array('item' => $item, 'item_id' => $item_id, 'imageid' => $imageid, 'totid' => $totid, 'type' => $type, 'content' => $content); $rets = jlogic('topic')->Add($datas); $error = 0; $message = ''; if (is_array($rets)) { $message = "【发布成功】"; if ($rets['tid'] < 1) { if ($rets['msg']) { $message .= $rets['msg']; } else { $message .= implode(',', $rets); } } } else { $error = 1; $message = $rets ? $rets : "发布失败"; } if ($this->in_ajax) { if ($error) { json_error($message); } else { json_result($message, $rets); } } $this->_message($message, '', 0); }
function changeLogin() { if (MEMBER_ID < 1) { json_error('请先登录'); } if (!$this->Config['vest_enable']) { json_error('未开启马甲功能'); } $uid = jget('uid', 'int'); if ($uid < 1) { json_error('登录失败'); } $ret = jlogic('member_vest')->checkMemberVest(MEMBER_ID, $uid); if ($ret) { $member = jsg_member_login_set_status($uid); if ($member) { json_result('登录马甲成功'); } } json_error('登录失败'); }
function edit_opt() { $vid = intval($this->Post['vid']); $options = $this->Post['option']; $new_options = $this->Post['new_option']; $vote = $this->VoteLogic->id2voteinfo($vid, 'm'); if (empty($vote) || $vote['verify'] == 0) { json_error('当前投票不存在或正在审核中'); } if (jdisallow($vote['uid'])) { json_error('你没有权限'); } $old_options = unserialize($vote['option']); $preview_updata_flg = false; if (!empty($options)) { $count = 0; if (MEMBER_ROLE_TYPE != 'admin') { $count = $this->VoteLogic->get_count_vote_user($vid); } if (!$count) { $preview = array(); $keys = array_keys($options); $options = array_unique($options); if (count($options) > 1) { foreach ($keys as $i) { if (!empty($options[$i])) { $val = $options[$i]; $p = getstr(trim($val), 40, 1, 1); if (empty($p)) { continue; } $this->VoteLogic->update_options($i, array('option' => $p)); } else { $this->VoteLogic->delete_vote_option($i); } } $preview_updata_flg = true; } } } if (!empty($new_options)) { $new_options = array_unique($new_options); foreach ($new_options as $val) { $ret = $this->VoteLogic->add_opt($vid, $val); } } if ($preview_updata_flg) { $preview = array(); $options = $this->VoteLogic->get_option_by_vid($vid); foreach ($options['option'] as $val) { if (count($preview) < 2) { $preview[] = $val['option']; } } $str_options = addslashes(serialize($preview)); $this->VoteLogic->update_vote_field(array('vid' => $vid), array('option' => $str_options)); } json_result('编辑投票项成功'); }
function _image_result($msg, $retval = null) { if ('normal' == $this->Type) { $image_uploadify_id = $this->Post['image_uploadify_id'] ? $this->Post['image_uploadify_id'] : $this->Get['image_uploadify_id']; echo "<script type='text/javascript'>window.parent.imageUploadifyComplete{$image_uploadify_id}('{$retval['id']}', '{$retval['src']}', '{$retval['name']}');window.parent.imageUploadifyAllComplete{$image_uploadify_id}();</script>"; exit; } elseif ('normalnew' == $this->Type) { $divid = jget('divid'); echo "<script type='text/javascript'>window.parent.imageUploadifyComplete('{$divid}','{$retval['id']}', '{$retval['src']}', '{$retval['name']}');window.parent.imageUploadifyAllComplete('{$divid}');</script>"; exit; } elseif ('share_upload' == $this->Type) { echo "<script type='text/javascript'>_div=window.parent.onComplete({done:1});</script>"; exit; } else { json_result($msg, $retval); } }
function setSync() { $uid = max(0, (int) MEMBER_ID); if ($uid < 1) { $this->Messager("请先<a href='index.php?mod=login'>点此登录</a>或者<a href='index.php?mod=member'>点此注册</a>一个帐号", null); } $setting = (int) $this->Get['setting']; if ('sina' == $this->Get['type']) { define('IS_IN_XWB_PLUGIN', true); define('XWB_P_ROOT', ROOT_PATH . 'include/ext/xwb/'); require_once XWB_P_ROOT . 'sina.php'; require_once XWB_P_ROOT . 'lib/core.class.php'; if (XWB_S_UID < 1 || !XWB_plugin::pCfg('is_account_binding')) { XWB_plugin::showError('新浪微博绑定功能已经关闭!'); } $tojishigou = XWB_plugin::V('G:tojishigou'); $reply_tojishigou = XWB_plugin::V('G:reply_tojishigou'); $profile = XWB_plugin::O('xwbUserProfile'); $profile->set(array('bind_setting' => (int) $setting, 'synctopic_tojishigou' => (int) $tojishigou, 'syncreply_tojishigou' => (int) $reply_tojishigou)); $r = jclass('misc')->update_account_bind_info(XWB_S_UID, '', '', 1); } elseif ('qq' == $this->Get['type']) { $this->DatabaseHandler->Query("update " . TABLE_PREFIX . "qqwb_bind_info set `synctoqq`='{$setting}' where `uid`='{$uid}'"); $r = jclass('misc')->update_account_bind_info($uid, '', '', 1); } elseif ('renren' == $this->Get['type'] && !$setting) { $r = $this->DatabaseHandler->Query("delete from " . TABLE_PREFIX . "renren_bind_info where `uid`='{$uid}'"); } elseif ('kaixin' == $this->Get['type']) { $this->DatabaseHandler->Query("delete from " . TABLE_PREFIX . "kaixin_bind_info where `uid`='{$uid}'"); } json_result('ok', $setting ? 0 : 1); }
function _attach_result($msg, $retval = null) { if ('normal' == $this->Type) { $attach_uploadify_id = $this->Post['attach_uploadify_id'] ? $this->Post['attach_uploadify_id'] : $this->Get['attach_uploadify_id']; echo "<script type='text/javascript'>\r\n\t\t\twindow.parent.attachUploadifyComplete{$attach_uploadify_id}('{$retval['id']}', '{$retval['src']}', '{$retval['name']}');\r\n\t\t\twindow.parent.attachUploadifyAllComplete{$attach_uploadify_id}('{$retval['name']}');\r\n\t\t\t</script>"; exit; } else { json_result($msg, $retval); } }
function quit() { $qid = empty($this->Post['qid']) ? 0 : intval(trim($this->Post['qid'])); if ($qid == 0) { json_error('错误的操作'); } $qun_info = $this->QunLogic->get_qun_info($qid); if (empty($qun_info)) { json_error('当前' . $this->Config[changeword][weiqun] . '不存在或已经被删除'); } $r = $this->QunLogic->is_qun_member($qid, MEMBER_ID); if ($r == 0) { json_error('错误的操作'); } $this->QunLogic->quit_qun($qid, MEMBER_ID); json_result("退出成功"); }
function doSendEmail() { $message = trim($this->Post["message"]); $leader_list = (array) $this->Post['leader']; if (count($leader_list) < 1) { json_result("请选择需要报备的领导email。"); } $return_msg = ''; foreach ($leader_list as $key => $val) { $mail_to = $val; $mail_subject = "来自" . $this->Config['site_name'] . "微博-管理员 " . MEMBER_NICKNAME . " 的报备"; $mail_content = $message; $mail_from_username = MEMBER_NAME; $mail_from_email = '*****@*****.**'; $mail_from_email = $this->Config['site_admin_email']; $send_result = send_mail($mail_to, $mail_subject, $mail_content, $mail_from_username, $mail_from_email, array(), 3, false); if (!$send_result) { $return_msg .= "发给[" . $val . "]出现错误.<br>"; } } json_result($return_msg ? $return_msg : "报备成功"); }
public function article_delete() { $article_id = (int) jget('article'); if ($article_id < 1) { $this->Messager('哪一个?'); return; } jlogic('cms')->delete_article($article_id); if (jget('is_ajax')) { json_result('完成'); } else { $this->Messager('完成'); } }
public function getLastVerson() { $verson_re = (string) file_get_contents("http:/" . "/update.cenwor.com/jss.api.php?do=ver&pid=2"); $pos = stripos($verson_re, '"'); if ($pos !== false) { $verson_re_temp = explode('"', $verson_re); $verson_re = ltrim(trim(strtolower($verson_re_temp[1])), "v"); } $this_version = SYS_VERSION . " " . SYS_BUILD; if ($verson_re == $this_version) { json_error($verson_re); } else { json_result($verson_re); } }