function my_member_validate($uid, $email, $role_id = '', $new = 0, $check_allow = 1) { if (1 > ($uid = (int) $uid)) { return false; } if (!($email = trim($email))) { return false; } $sys_config = jconf::get(); if ($new == 0 && !$sys_config['reg_email_verify']) { return false; } if ($check_allow && jdisallow($uid)) { return false; } $sql = "select * from `" . TABLE_PREFIX . "member_validate` where `uid`='{$uid}' order by `regdate` asc"; $query = DB::query($sql); $data = array(); if (DB::num_rows($query) > 0) { DB::query("delete from `" . TABLE_PREFIX . "member_validate` where `uid`='{$uid}'"); } $data['uid'] = $uid; $data['email'] = $email; $data['role_id'] = (int) ($role_id > 0 ? $role_id : $sys_config['normal_default_role_id']); $data['key'] = substr(md5(md5($uid . $email . $role_id) . md5(uniqid(mt_rand(), true))), 3, 16); $data['status'] = $data['verify_time'] = '0'; $data['regdate'] = TIMESTAMP; $data['type'] = 'email'; jtable('member_validate')->insert($data); $email_message = "您好:\r\n您收到此邮件是因为在 {$sys_config['site_url']} 用户注册中使用了该 Email,\r\n如果您没有进行上述操作,请忽略这封邮件。\r\n------------------------------------------------------\r\n帐号激活说明:\r\n为避免垃圾邮件或您的Email地址被滥用,我们需要对您的email有效性进行验证,\r\n您只需点击下面的链接即可激活您的帐号,并享有真正会员权限:\r\n{$sys_config['site_url']}/index.php?mod=member&code=verify&uid={$data['uid']}&key={$data['key']}&from=reg\r\n\r\n(如果上面不是链接形式,请将地址手工粘贴到浏览器地址栏再访问)\r\n感谢您的访问,祝您使用愉快!\r\n\r\n此致,\r\n{$sys_config['site_name']} 管理团队.\r\n"; $send_result = send_mail($email, " [{$sys_config['site_name']}]Email地址验证", $email_message, $sys_config['site_name'], $sys_config['site_admin_email'], array(), 3, false); return $send_result; }
public function get_my_tag_topic($p) { $uid = isset($p['uid']) ? (int) $p['uid'] : MEMBER_ID; if (jdisallow($uid)) { return jerror('您无权查看'); } $member = jsg_member_info($uid); if ($member['topic_new']) { jlogic('member')->clean_new_remind('topic_new', $uid); } $rets = $this->get_my_tag_tid($p, 1); if (is_array($rets)) { $rets['member'] = $member; } return jlogic('topic')->get_by_ids($rets); }
public function get_at_my_tid($p, $more = 0) { $uid = isset($p['uid']) ? (int) $p['uid'] : MEMBER_ID; if (jdisallow($uid)) { return jerror('您无权查看该信息,请指定正确的UID参数', -1); } $page_num = (int) $p['page_num']; if ($page_num < 1) { $page_num = 10; } $ps = array('uid' => $uid, 'sql_order' => ' `id` DESC ', 'page_num' => $page_num); if (isset($p['page_url'])) { $ps['page_url'] = $p['page_url']; } return $this->db->get_ids($ps, 'tid', $more); }
public function outbox($p) { $uid = isset($p['uid']) ? (int) $p['uid'] : MEMBER_ID; if (jdisallow($uid)) { return jerror('您没有权限进行此操作', -1); } $member = jsg_member_info($uid); $pn = (int) $p['page_num']; if ($pn < 1) { $pn = 10; } $ps = array('type' => array('both', 'reply'), 'page_num' => $pn); if (isset($p['page_url'])) { $ps['page_url'] = $p['page_url']; } $rets = jtable('member_topic')->get_tids($uid, $ps, 1); if (is_array($rets)) { $rets['member'] = $member; } return jlogic('topic')->get_by_ids($rets); }
function sign_modify($uid, $signature) { $uid = max(0, (int) $uid); if ($uid < 1) { return jerror('【UID不能为空】请先登录或者注册一个帐号'); } $user = jsg_member_info($uid); if (!$user) { return jerror('请指定一个正确的UID'); } if (jdisallow($uid)) { return jerror('您无权修改此用户签名'); } $signature = jhtmlspecialchars(cutstr(trim(strip_tags($signature)), 32)); $f_rets = filter($signature); if ($f_rets && $f_rets['error']) { return jerror($f_rets['msg']); } if ($signature != $user['signature']) { $sys_config = jconf::get(); if ($sys_config['sign_verify'] && $signature) { $count = DB::result_first("select count(*) from " . TABLE_PREFIX . "members_verify where uid = '{$uid}'"); if ($count) { DB::query("update " . TABLE_PREFIX . "members_verify set signature = '{$signature}' , is_sign = 1 where uid = '{$uid}'"); } else { DB::query("insert into " . TABLE_PREFIX . "members_verify (uid,nickname,signature,is_sign) values ('{$uid}','{$user['nickname']}','{$signature}',1)"); } if ($sys_config['notice_to_admin']) { $pm_post = array('message' => $user['nickname'] . " 修改了签名进入审核,<a href='admin.php?mod=verify&code=fs_verify' target='_blank'>点击</a>进入审核。", 'to_user' => str_replace('|', ',', $sys_config['notice_to_admin'])); $admin_info = jsg_member_info(1); jlogic('pm')->pmSend($pm_post, $admin_info['uid'], $admin_info['username'], $admin_info['nickname']); } return jerror('个性签名修改成功,管理员审核中'); } else { $sets = array('signature' => $signature, 'signtime' => TIMESTAMP); DB::update('members', $sets, " `uid`='{$uid}' "); } } return $signature; }
public function del($tid, $id) { $id = (int) $id; if ($id < 1) { return jerror('要删除的图片ID不能为空', -1); } $info = jlogic('image')->get_info($id); if (!$info) { return jerror('请指定一个正确的图片ID,图片不存在或已经被删除了。', -2); } if (jdisallow($info['uid'])) { return jerror('您无权对该图片进行操作', -3); } $tid = (int) $tid; if ($tid > 0) { $tinfo = jlogic('topic')->Get($tid); if (!$tinfo) { return jerror('请指定一个正确的微博ID,微博不存在或已经被删除了。', -5); } if (jdisallow($tinfo['uid'])) { return jerror('您无权对该微博进行操作', -6); } $_iids = explode(',', $tinfo['imageid']); foreach ($_iids as $iid) { $iids[$iid] = $iid; } unset($iids[$id]); jlogic('image')->set_topic_imageid($tid, $iids); } else { if (!$info['tid']) { jlogic('image')->delete($id); } else { return jerror('删除失败,该图不允许删除', -10); } } }
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 Delete() { $tid = jget('tid', 'int'); if ($tid < 1) { js_alert_output("请指定一个您要删除的话题"); } $topic = $this->TopicLogic->Get($tid); if (!$topic) { js_alert_output("话题已经不存在了"); } if (jdisallow($topic['uid'])) { js_alert_output("您无权删除该话题"); } $return = $this->TopicLogic->Delete($tid); response_text($return . $this->js_show_msg()); }
function Delete($ids) { if (MEMBER_ID < 1) { return '游客不能执行此操作'; } if (is_numeric($ids)) { $where = " where `id` = '{$ids}' "; } else { if (is_string($ids)) { $where = $ids; } else { if (is_array($ids)) { $where = " where `id` in ('" . implode("','", $ids) . "') "; } else { return '所指定的微博有误。'; } } } if (!$ids) { return '微博已经不存在了'; } $query = DB::query("select * from " . TABLE_PREFIX . "topic_verify {$where} "); $topics = array(); while ($rs = DB::fetch($query)) { if (jdisallow($rs['uid'])) { return '您没有权限执行此操作'; } $topics[] = $rs; } if (count($topics) < 1) { return '微博已经不存在了'; } $tbs = array('report' => 'tid', 'sms_receive_log' => 'tid', 'topic_favorite' => 'tid', 'topic_longtext' => 'tid', 'topic_mention' => 'tid', 'topic_more' => 'tid', 'topic_qun' => 'tid', 'topic_reply' => array('tid', 'replyid'), 'topic_tag' => 'item_id', 'topic_url' => 'tid', 'topic_vote' => 'tid', 'wall_draft' => 'tid', 'wall_playlist' => 'tid', 'topic_recommend' => 'tid', 'topic_live' => 'tid', 'topic_talk' => 'tid', 'topic_channel' => 'tid', 'topic_dig' => 'tid', 'topic_topic_image' => 'tid'); $topictids = array(); foreach ($topics as $topic) { $topictids[] = $topic['tid']; if (false !== strpos($topic['content'], '#')) { preg_match_all('~<T>#(.+?)#</T>~', $topic['content'], $subpatterns); if ($subpatterns && is_array($subpatterns[1])) { Load::logic('tag'); $TagLogic = new TagLogic('topic'); $TagLogic->Delete(array('item_id' => $topic['tid'], 'tag' => $subpatterns['1'])); } } if ($topic['imageid']) { } if ($topic['attachid']) { jlogic('attach')->delete($topic['attachid']); } if ($topic['videoid']) { $sql = "select `id`,`video_img` from `" . TABLE_PREFIX . "topic_video` where `id`='" . $topic['videoid'] . "' "; $topic_video = DB::fetch_first($sql); jio()->DeleteFile($topic_video['video_img']); DB::query("delete from `" . TABLE_PREFIX . "topic_video` where `id` = '{$topic['videoid']}'"); } #音乐 if ($topic['musicid']) { DB::query("delete from `" . TABLE_PREFIX . "topic_music` where `id` = '{$topic['musicid']}'"); } $tid = $topic['tid']; if ($tid > 0) { if (!empty($topic['item']) && $topic['item_id'] > 0) { jfunc('app'); app_delete_relation($topic['item'], $topic['item_id'], $topic['tid']); } foreach ($tbs as $k => $vs) { $vs = (array) $vs; foreach ($vs as $v) { DB::query("delete from `" . TABLE_PREFIX . "{$k}` where `{$v}`='{$tid}'", "SKIP_ERROR"); } } } #删除审核表里的数据 DB::query(" delete from `" . TABLE_PREFIX . "topic_verify` where `id` = {$topic['id']}"); if (@is_file(ROOT_PATH . 'include/logic/cp.logic.php') && $GLOBALS['_J']['config']['company_enable']) { $cpstring = DB::fetch_first("SELECT companyid,departmentid FROM " . DB::table('members') . " WHERE uid = '" . $topic['uid'] . "'"); if ($cpstring['companyid'] > 0 || $cpstring['departmentid'] > 0) { $CpLogic = jlogic('cp'); if ($cpstring['companyid'] > 0) { $CpLogic->update('company', $cpstring['companyid'], 0, -1); } if ($cpstring['departmentid'] > 0) { $CpLogic->update('department', $cpstring['departmentid'], 0, -1); } } } } if ($GLOBALS['_J']['plugins']['func']['deletetopic']) { hookscript('deletetopic', 'funcs', is_array($topictids) ? $topictids : array($topictids), 'deletetopic'); } return ''; }
function DoDelTopic() { if (MEMBER_ID < 1) { $this->Messager('游客不能执行此操作'); } $tid = jget('tid', 'int'); if ($tid < 1) { $this->Messager('请指定一个您要删除的话题', 'index.php?mod=topic&code=myhome'); } $topic = $this->TopicLogic->Get($tid); if (!$topic) { $this->Messager('话题已经不存在了', 'index.php?mod=topic&code=myhome'); } if (jdisallow($topic['uid'])) { $this->Messager('您无权删除该话题', 'index.php?mod=topic&code=myhome'); } $return = $this->TopicLogic->DeleteToBox($tid); $this->Messager(NULL, 'index.php?mod=topic&code=myhome'); }
function del($id) { $id = jfilter($id, 'int'); if ($id < 1) { return jerror('分组ID不能为空'); } $info = $this->info($id); if (!$info) { return jerror('请指定一个正确的分组ID'); } if (jdisallow($info['uid'])) { return jerror('您没有权限删除该分组信息'); } jtable('buddy_follow_group_relation')->del_multi($uid, 0, $id); $this->_rm_my_cache($info['uid']); return $this->delete($id, 1); }
function jallow($uid = null) { return jdisallow($uid) ? false : true; }
function DoModifyEmail() { $uid = MEMBER_ID; if (jdisallow($uid)) { exit('你无权验证他人的邮箱,点击进入验证自己的邮箱'); } $email = jget('email', 'email'); $checktype = $this->Post['checktype']; $sql = "SELECT `uid`,`ucuid`,`nickname`,`username`,`email`,`role_id`,`email_checked` from `" . TABLE_PREFIX . "members` where `uid` = '{$uid}' LIMIT 0,1"; $query = $this->DatabaseHandler->Query($sql); $members = $query->GetRow(); if ($email) { if ($checktype == 'modify') { $jsg_result = jsg_member_checkemail($email, $members['ucuid']); if ($jsg_result < 1) { $rets = array('0' => '【注册失败】有可能是站点关闭了注册功能', '-4' => 'Email 不合法,请输入正确的Email地址。', '-5' => 'Email 不允许注册,请尝试更换一个。', '-6' => 'Email 已经存在了,请尝试更换一个。'); echo $rets[$jsg_result]; die; } if ($members['email_checked'] == 0) { $sql = "update `" . TABLE_PREFIX . "members` set `email`='{$email}' where `uid`='{$uid}'"; } else { $sql = "update `" . TABLE_PREFIX . "members` set `email2`='{$email}' where `uid`='{$uid}'"; } DB::query($sql); } jfunc('my'); $ret = my_member_validate(MEMBER_ID, $email, $members['role_id'] != $this->Config['normal_default_role_id'] ? $members['role_id'] : (int) $this->Config['normal_default_role_id'], 1); if ($ret) { echo "邮件已重新发送成功"; } else { echo "邮件发送失败,请填写有效的邮箱地址或联系管理员。"; } echo "<script language='Javascript'>"; echo "parent.document.getElementById('user_email').innerHTML='{$email}';"; echo "</script>"; die; } else { echo "请输入正确的邮箱"; die; } }
function Modify_User_Signature() { $uid = (int) $this->Post['uid']; if ($uid < 1) { showjsmessage("请先登录或者注册一个帐号"); } if (jdisallow($uid)) { json_error("您无权修改此用户签名"); } $rets = jclass('misc')->sign_modify($uid, $this->Post['signature']); if (is_array($rets) && $rets['error']) { json_error($rets['msg']); } else { json_result($rets); } }
function delEvent($id, $admin = 0) { $id = (int) $id; if (jdisallow()) { return 1; } if ($admin == 0) { $count = DB::result_first("select count(*) as count from " . TABLE_PREFIX . "event_member where id='{$id}' and app = 1 "); if ($count) { return 1; } } $event = DB::fetch_first("select * from " . TABLE_PREFIX . "event where id = '{$id}' "); if (!$event) { return 2; } $image = $event['image']; if ($image) { $type = trim(strtolower(end(explode(".", $image)))); $name = explode("_", $image); $image_s = $name[0] . "_s." . $type; unlink($image); unlink($image_s); } DB::query("delete from " . TABLE_PREFIX . "qun_event where eid = '{$id}' "); DB::query("delete from " . TABLE_PREFIX . "event where id = '{$id}' "); DB::query("delete from " . TABLE_PREFIX . "event_member where id = '{$id}' "); return; }
public function get_favorite_me_topic($p) { $uid = isset($p['uid']) ? (int) $p['uid'] : MEMBER_ID; if (jdisallow($uid)) { return jerror('您无权查看'); } $member = jsg_member_info($uid); if ($member['favoritemy_new'] > 0) { jlogic('member')->clean_new_remind('favoritemy_new', $member['uid']); } $page_num = (int) $p['page_num']; if ($page_num < 1) { $page_num = 10; } $ps = array('tuid' => $uid, 'sql_order' => ' `id` DESC ', 'page_num' => $page_num); if (isset($p['page_url'])) { $ps['page_url'] = $p['page_url']; } $rets = $this->db->get($ps); if (is_array($rets)) { $rets['member'] = $member; if ($rets['list']) { foreach ($rets['list'] as $k => $v) { if ($v['tid'] < 1) { continue; } $row = jlogic('topic')->Get($v['tid']); $row['fuid'] = $v['uid']; $row['favorite_time'] = my_date_format2($v['dateline']); $fuids[$v['uid']] = $v['uid']; $rets['list'][$k] = $row; } if ($fuids) { $rets['favorite_members'] = jlogic('member')->get($fuids); } if ($GLOBALS['_J']['config']['is_topic_user_follow'] && !$GLOBALS['_J']['disable_user_follow']) { if (true === IN_JISHIGOU_WAP) { $rets['list'] = buddy_follow_html($rets['list'], 'uid', 'wap_follow_html'); } else { $rets['list'] = jlogic('buddy')->follow_html2($rets['list']); } } $rets['parent_list'] = jlogic('topic')->get_parent_list($rets['list']); } if (true === IN_JISHIGOU_WAP) { $rets = wap_iconv($rets); } } return $rets; }
function DoDelete($id) { if ($id < 1) { return false; } $reward = $this->getRewardInfo($id); if (!$reward) { return false; } if (jdisallow($reward['uid'])) { return false; } if ($reward['prize']) { foreach ($reward['prize'] as $key => $val) { if ($val['prize_image_url'] && file_exists($val['prize_image_url'])) { unlink($val['prize_image_url']); } } } #删除数据库里面的图片 DB::query(" delete from `" . TABLE_PREFIX . "reward_image` where `rid` = '{$id}' "); #删除有奖转发的参与者 DB::query(" delete from `" . TABLE_PREFIX . "reward_user` where `rid` = '{$id}' "); #删除有奖转发的获奖者 DB::query(" delete from `" . TABLE_PREFIX . "reward_win_user` where `rid` = '{$id}' "); #删除有奖转发 DB::query(" delete from `" . TABLE_PREFIX . "reward` where `id` = '{$id}' "); return true; }
function manage() { $tab = 'word'; $op = empty($this->Get['op']) ? '' : $this->Get['op']; if (empty($op)) { exit; } $vid = empty($this->Get['vid']) ? 0 : intval($this->Get['vid']); $vote = $this->VoteLogic->id2voteinfo($vid, 'm'); if ($vote['tab']) { $tab = 'pic'; } if (empty($vote) || $vote['verify'] == 0) { json_error('当前投票不存在或正在审核中'); } if (jdisallow($vote['uid'])) { json_error("你没有权限"); } if ($op == 'modify_date') { $exp_info = $this->VoteLogic->get_publish_form_param($vote['expiration']); extract($exp_info); } else { if ($op == 'edit_opt') { $info = $this->VoteLogic->get_option_by_vid($vid); $options = $info['option']; $option_num = count($info['option']); if (MEMBER_ROLE_TYPE != 'admin') { $is_voted = $this->VoteLogic->get_count_vote_user($vid); } } else { if ($op == 'edit') { $max_option = 50; $this->Get['arf'] = "edit"; $opt_info = $this->VoteLogic->get_option_by_vid($vid); $opts = $opt_info['option']; $vote['message'] = $this->VoteLogic->get_vote_field_message($vid); $options_num = count($opts); $maxchoice = array(); if ($options_num > 1) { $maxchoice = range(1, $options_num); } $perpage = ceil($options_num / 5) * 5; $options = range(1, $perpage); for ($i = $options_num; $i < $perpage; $i++) { $opts[$i]['picurl'] = 'images/none.png'; } $is_voted = $this->VoteLogic->get_count_vote_user($vid); $checked = array(); $checked['is_view'][$vote['is_view']] = 'checked="checked"'; $checked['recd'] = $vote['recd'] ? 'checked="checked"' : ''; $selected[$vote['maxchoice']] = 'selected="selected"'; $expiration = my_date_format($vote['expiration'], 'Y-m-d'); $hour_select = mk_time_select('hour', my_date_format($vote['expiration'], 'H')); $min_select = mk_time_select('min', my_date_format($vote['expiration'], 'i')); include template('vote/vote_edit'); exit; } } } include template('vote/vote_manage'); }