示例#1
0
 function add($uid, $check = '')
 {
     $ret = false;
     if ($GLOBALS['_J']['config']['sendmailday'] > 0) {
         $user = array();
         if (is_numeric($uid)) {
             $user = jtable('members')->info($uid);
         } elseif (is_array($uid)) {
             $user = $uid;
         }
         if ($user && ($uid = (int) $user['uid']) > 0 && $user['email'] && 1 == $user['email_checked'] && (!$check || $check && 1 == $user[$check]) && TIMESTAMP - $user['lastactivity'] > 3600) {
             if (1 == $user['user_notice_time']) {
                 $sendtime = TIMESTAMP;
             } elseif (2 == $user['user_notice_time']) {
                 $sendtime = TIMESTAMP + 86400;
             } elseif (4 == $user['user_notice_time']) {
                 $sendtime = TIMESTAMP + 86400 * 30;
             } else {
                 $sendtime = TIMESTAMP + 86400 * 7;
             }
             $data = array('dateline' => $sendtime, 'uid' => $uid, 'email' => $user['email'], 'msg' => serialize(array('comment_new' => $user['comment_new'], 'newpm' => $user['newpm'], 'event_new' => $user['event_new'], 'at_new' => $user['at_new'], 'fans_new' => $user['fans_new'], 'vote_new' => $user['vote_new'], 'dig_new' => $user['dig_new'], 'channel_new' => $user['channel_new'], 'company_new' => $user['company_new'], 'qun_new' => $user['qun_new'])));
             $row = $this->row($uid);
             if (!$row) {
                 $ret = $this->insert($data, true, true);
             } else {
                 if ($row['dateline'] > 0) {
                     unset($data['dateline']);
                 }
                 $ret = $this->update($data, array('uid' => $uid));
             }
         }
     }
     return $ret;
 }
示例#2
0
 function DoClean()
 {
     $type = get_param('type');
     if (!$type) {
         $this->Messager("请先选择要清理的缓存对象");
     }
     $this->_removeTopicAttach();
     $this->_removeTopicLongtext();
     $this->_removeVoteImage();
     if (in_array('data', $type)) {
         cache_db('clear');
         jtable('failedlogins')->truncate();
         DB::query("update " . TABLE_PREFIX . "members set `username`=`uid` WHERE `username`!=`uid` AND `username` REGEXP '^[0-9]*\$'");
     }
     if (in_array('tpl', $type)) {
         cache_clear();
         jconf::set('validate_category', array());
         jlogic('credits')->rule_conf(true);
     }
     if (in_array('channel', $type)) {
         jlogic('channel')->update_data();
     }
     if (in_array('album', $type)) {
         jlogic('image')->update_data();
     }
     $this->Messager("已清空所有缓存");
 }
示例#3
0
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;
}
示例#4
0
 public function do_bind($openid, $jsg_id = MEMBER_ID)
 {
     if (!$jsg_id) {
         return FALSE;
     }
     jtable('wechat')->delete(array('wechat_id' => $openid));
     jtable('wechat')->delete(array('jsg_id' => $jsg_id));
     $r = jtable('wechat')->insert(array('wechat_id' => $openid, 'jsg_id' => $jsg_id, 'dateline' => TIMESTAMP), 1);
     return $r;
 }
示例#5
0
 function delMailQueue()
 {
     $ids = jget('ids');
     if ($ids && is_array($ids)) {
         $list = jtable('mailqueue')->get($ids);
         foreach ($list as $row) {
             jtable('mailqueue')->delete(array('uid' => $row['uid']));
         }
     }
     $this->Messager('操作成功', 'admin.php?mod=notice&code=mailq');
 }
示例#6
0
 function Reg()
 {
     $uid = max(0, (int) $this->Inputs['uid']);
     $token = $this->Inputs['token'];
     if ($uid > 0 && strlen($token) == 64 && ctype_alnum($token)) {
         $info = jtable('ios')->info(array('token' => $token));
         if (!$info) {
             jtable('ios')->insert(array('uid' => $uid, 'token' => $token), 1);
         } elseif ($uid != $info['uid']) {
             jtable("ios")->update(array('uid' => $uid), $info['id']);
         }
     }
 }
 function add($tid, $uid)
 {
     $ret = false;
     $tid = jfilter($tid, 'int');
     $uid = jfilter($uid, 'int');
     if ($tid > 0 && $uid > 0 && !$this->is_at($tid, $uid) && ($row = jtable('topic')->row($tid)) && $uid != $row['uid']) {
         $ret = $this->insert(array('tid' => $tid, 'uid' => $uid, 'tuid' => $row['uid'], 'dateline' => TIMESTAMP), 1);
         if ($ret) {
             $this->cache_rm(array('tid' => $tid, 'uid' => $uid));
             jtable('members')->update_count($uid, 'at_new', '+1', array('+@at_count' => 1));
         }
     }
     return $ret;
 }
示例#8
0
 function notice_index()
 {
     $this->Title = '网站公告';
     $id = jget('id', 'int');
     if ($id < 1) {
         $id = jget('ids', 'int');
         if ($id < 1) {
             $id = jget('code', 'int');
         }
     }
     if ($id > 0) {
         $notice_info = jtable('notice')->info($id);
         $this->Title .= ' - ' . $notice_info['title'];
     }
     $notice_data = jtable('notice')->get_data();
     include template('notice_index');
 }
 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;
 }
示例#10
0
 function exchangegoods()
 {
     $this->Title = '积分兑换记录';
     $pagenum = 10;
     $css['exchange'] = $css['exp'] = ' class="current"';
     $data = jtable('mall_order')->get(array('uid' => MEMBER_ID, 'sql_order' => 'id desc', 'page_num' => $pagenum));
     $page = $data['page']['html'];
     $data = $data['list'];
     foreach ($data as $key => $value) {
         $data[$key]['pay_time'] = $value['pay_time'] > 0 ? my_date_format($value['pay_time']) : '-';
         $data[$key]['xaddress'] = strlen($value['address']) > 26 ? cut_str($value['address'], 15) : $value['address'];
     }
     $feeds = jlogic('feed')->get_feed(5, "`action`='兑换了'");
     $top_credit_members = jlogic('mall')->get_top_member_credits();
     $config = jconf::get('mall');
     include template('mall_exchangegoods');
 }
 public function act($uid = 0, $tid = 0, $act = '')
 {
     $uid = is_numeric($uid) ? (int) $uid : 0;
     if (jdisallow($uid)) {
         return "您无权进行此操作";
     }
     $tid = is_numeric($tid) ? (int) $tid : 0;
     if ($tid < 1) {
         return "请指定一个微博";
     }
     $topic_info = jtable('topic')->info($tid);
     if (!$topic_info) {
         return "指定的微博已经不存在了";
     }
     $infop = array('uid' => $uid, 'tid' => $tid);
     $topic_favorite = $this->db->info($infop);
     $is_favorite = $topic_favorite ? true : false;
     if ('check' == $act) {
         return $is_favorite ? 1 : 0;
     }
     if ('info' == $act) {
         return $topic_favorite;
     }
     $ret = '';
     if (in_array($act, array('add', 'del', 'delete'))) {
         if ('add' == $act) {
             if (!$is_favorite) {
                 $this->db->insert(array('uid' => $uid, 'tid' => $tid, 'tuid' => $topic_info['uid'], 'dateline' => TIMESTAMP));
                 jtable('members')->update_count($topic_info['uid'], 'favoritemy_new', '+1');
                 if ($GLOBALS['_J']['config']['feed_type'] && is_array($GLOBALS['_J']['config']['feed_type']) && in_array('favorite', $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', 'favorite', $tid, $feed_msg, $topic_info['item_id']);
                 }
             }
             $ret = "<span><a href='javascript:void(0)'>已收藏</a></span>";
         } else {
             if ($is_favorite) {
                 $this->db->delete($infop);
             }
             $ret = "已取消";
         }
         jtable('members')->update_count($uid, 'topic_favorite_count', $this->db->count(array('uid' => $uid)));
     }
     return $ret;
 }
 function qun_announcement_index()
 {
     $this->Title = $this->Config['changeword']['weiqun'] . '公告';
     $qid = jget('qid', 'int');
     $id = jget('id', 'int');
     if ($id < 1) {
         $id = jget('ids', 'int');
         if ($id < 1) {
             $id = jget('code', 'int');
         }
     }
     if ($id > 0) {
         $qun_announcement_info = jtable('qun_announcement')->info($id);
         $author_member = jsg_member_info($qun_announcement_info['author_id']);
         $this->Title .= ' - ' . cutstr(trim(strip_tags($qun_announcement_info['message'])), 30);
     }
     include template('qun/qun_announcement_index');
 }
示例#13
0
 function DoModify()
 {
     if (($new_module = trim($this->Post['new_module'])) && trim($new_module_name = $this->Post['new_module_name'])) {
         jtable('role_module')->replace(array("module" => $new_module, "name" => $new_module_name));
     }
     $module_list = (array) $this->Post['module'];
     foreach ($module_list as $module) {
         jtable('role_module')->replace($module);
     }
     $delete_list = (array) $this->Post['delete'];
     if ($delete_list) {
         $module_in = " `module` IN (" . jimplode($delete_list) . ") ";
         DB::query("DELETE FROM " . TABLE_PREFIX . "role_module where " . $module_in);
         $sql = "DELETE FROM " . TABLE_PREFIX . "role_action where " . $module_in;
         $this->DatabaseHandler->Query($sql);
     }
     $this->Messager("修改成功");
 }
示例#14
0
 function Topic()
 {
     if (MEMBER_ID < 1) {
         response_text('您是游客,没有权限举报');
     }
     $tid = jget('totid', 'int', 'P');
     $report_reason = $this->Post['report_reason'];
     $report_content = $this->Post['report_content'];
     $data = array('uid' => MEMBER_ID, 'username' => MEMBER_NICKNAME, 'ip' => $GLOBALS['_J']['client_ip'], 'reason' => (int) $report_reason, 'content' => strip_tags($report_content), 'tid' => (int) $tid, 'dateline' => time());
     $result = jtable('report')->insert($data);
     if ($notice_to_admin = $this->Config['notice_to_admin']) {
         $message = "用户" . MEMBER_NICKNAME . "举报了微博ID:{$tid}(" . $data['content'] . "),<a href='admin.php?mod=report&code=report_manage' target='_blank'>点击</a>进入管理。";
         $pm_post = array('message' => $message, 'to_user' => str_replace('|', ',', $notice_to_admin));
         $admin_info = DB::fetch_first('select `uid`,`username`,`nickname` from `' . TABLE_PREFIX . 'members` where `uid` = 1');
         load::logic('pm');
         $PmLogic = new PmLogic();
         $PmLogic->pmSend($pm_post, $admin_info['uid'], $admin_info['username'], $admin_info['nickname']);
     }
     response_text('举报成功');
 }
示例#15
0
 function Notice_email($touid = 0)
 {
     $touid = max(0, (int) $touid);
     $timestamp = time();
     $sql = "select `uid`,`email`,`notice_at`,`notice_pm`,`notice_reply`,`user_notice_time`,`last_notice_time` from `" . TABLE_PREFIX . "members` where `uid` = '{$touid}'";
     $query = $this->DatabaseHandler->Query($sql);
     $members = $query->GetRow();
     $sql = "select * from `" . TABLE_PREFIX . "cron` where `touid` = '{$touid}'";
     $query = $this->DatabaseHandler->Query($sql);
     $crons = $query->GetRow();
     if ($members['user_notice_time'] == 0) {
         Load::logic('task');
         $TaskLogic = new TaskLogic();
         $TaskLogic->run($id = 1);
     }
     if ($send_return) {
         jtable('members')->update_count($touid, 'last_notice_time', $timestamp);
         $sql = "delete from `" . TABLE_PREFIX . "cron` where `id`= '{$crons['id']}' ";
         $this->DatabaseHandler->Query($sql);
     }
 }
示例#16
0
 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 doManage($tid, $type = 1, $score = 0)
 {
     $topic_list = array();
     $sql = "select * from " . DB::table('topic') . " where tid = '{$tid}'";
     $topic_list = DB::fetch_first($sql);
     if (!$topic_list) {
         return false;
     } else {
         if ($topic_list['managetype'] != $type) {
             $this->manageDetail($tid, $topic_list['managetype'], $type);
         }
         if ($type == 3) {
             $this->TopicLogic->DeleteToBox($tid, 0);
         } elseif ($type == 4) {
             $this->TopicLogic->DeleteToBox($tid, 1, $score);
         } else {
             if ($type == 1 && $topic_list['type'] == 'first') {
                 $credit_logic = jlogic('credits');
                 $rule = $credit_logic->GetRule('topic');
                 $credit_logic->UpdateCreditsByRule($rule, $topic_list['uid'], 1, $score);
                 $weibo_href = '[a]index.php?mod=topic&code=' . $tid . "[a]";
                 if ($score > 0) {
                     $data = array('uid' => $topic_list['uid'], 'rid' => 0, 'relatedid' => MEMBER_ID, 'dateline' => time(), 'remark' => "发布微博 【微博ID:{$weibo_href}】");
                     foreach ($GLOBALS['_J']['config']['credits']['ext'] as $key => $value) {
                         if ($value['enable'] == 1 && $score > 0) {
                             $data[$key] = $score;
                         }
                     }
                     jtable('credits_log')->insert($data);
                 }
             }
             $sql = "update " . DB::table('topic') . " set managetype = '{$type}' where tid = '{$tid}'";
         }
         DB::query($sql);
     }
 }
示例#18
0
 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 _init_table($id = 0, $type = 0)
 {
     $table = $this->_table;
     if (2 == $type) {
         $table_id = $id;
     } else {
         if (jtable('member_table_id')->get_maps()) {
             $table_id = jtable('member_table_id')->table_id($id, $type);
         }
     }
     if ($table_id) {
         $table = $this->_table . '_' . $table_id;
     }
     $this->init($table);
     return $table;
 }
示例#20
0
 function check_new_topic($uid = MEMBER_ID, $update_lastactivity = 0, $return_tids = 0, $all_topic_notice = 0)
 {
     $uid = (int) ($uid ? $uid : MEMBER_ID);
     if ($uid < 1) {
         return 0;
     }
     $info = jsg_member_info($uid);
     if (!$info) {
         return 0;
     }
     $t = $info['lastactivity'];
     $count = 0;
     $tids = array();
     if ($t > 0 && $t + 29 < TIMESTAMP) {
         if ($all_topic_notice) {
             $sql = TABLE_PREFIX . "topic` WHERE `type`!='reply' AND `dateline`>'{$t}'";
             $count = DB::result_first("SELECT COUNT(1) AS `count` FROM `" . $sql);
             if ($return_tids) {
                 $query = DB::query("SELECT tid FROM `" . $sql);
                 while (false != ($row = DB::fetch($query))) {
                     $tids[] = $row['tid'];
                 }
             }
         } else {
             $p = array('uid' => $uid, 'count' => 100, 'buddy_lastuptime' => $t);
             $buddy_uids = $this->get_buddyids($p);
             if ($buddy_uids) {
                 $sql = TABLE_PREFIX . "topic` WHERE `uid` IN ('" . implode("','", $buddy_uids) . "') AND `type`!='reply' AND `dateline`>'{$t}'";
                 $count = DB::result_first("SELECT COUNT(1) AS `count` FROM `" . $sql);
                 if ($return_tids) {
                     $query = DB::query("SELECT tid FROM `" . $sql);
                     while (false != ($row = DB::fetch($query))) {
                         $tids[] = $row['tid'];
                     }
                 }
             }
         }
     }
     if ($update_lastactivity) {
         jtable('members')->update_count($uid, 'lastactivity', TIMESTAMP);
     }
     if ($return_tids) {
         return array('count' => $count, 'tids' => $tids);
     } else {
         return $count;
     }
 }
示例#21
0
 function op_integral($uid, $integral, $rid, $remark)
 {
     $config = jconf::get('mall');
     jtable('members')->update_count(array('uid' => $uid), $config['credits'], $integral);
     jlogic('credits')->CountCredits($uid);
     $valid_filed[$config['credits']] = $integral;
     $data = array_merge($valid_filed, array('uid' => $uid, 'rid' => $rid, 'relatedid' => $uid, 'dateline' => time(), 'remark' => $remark));
     return jtable('credits_log')->insert($data, true);
 }
示例#22
0
 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('订单取消成功');
 }
示例#23
0
 function followme_nums($qid, $uid = MEMBER_ID)
 {
     $num = 0;
     $qid = (int) $qid;
     $uid = (int) $uid;
     if ($qid > 0 && $uid > 0 && false === ($num = cache_db('mget', $cache_id = "qun/{$qid}/{$uid}-followme_nums"))) {
         $num = DB::result_first("SELECT COUNT(1) AS `count`\r\nFROM " . DB::table("qun_user") . " QU\r\n  LEFT JOIN " . DB::table(jtable('buddy_follow')->table_name($uid)) . " BF\r\n    ON QU.uid = BF.touid\r\nWHERE QU.qid = '{$qid}'\r\n    AND BF.uid = '{$uid}'");
         cache_db('mset', $cache_id, $num, 300);
     }
     return $num;
 }
 function _init_table($uid = 0)
 {
     $table = $this->_table;
     if ($this->sub_table_num > 1 && $uid > 0) {
         $table_id = jtable('buddy_follow_table_id')->table_id($uid, $this->sub_table_num);
         if (false !== $table_id) {
             $table .= '_' . $table_id;
             $this->copy($table);
         }
     }
     $this->init($table);
     return $table;
 }
示例#25
0
 function getRewardInfo($id)
 {
     if ($id < 1) {
         return array();
     }
     $reward = array();
     $sql = " select * from `" . TABLE_PREFIX . "reward` where `id` = '{$id}'";
     $reward = DB::fetch_first($sql);
     if ($reward) {
         $reward['from_time'] = date('Y-m-d H:i:s', $reward['fromt']);
         $reward['to_time'] = date('Y-m-d H:i:s', $reward['tot']);
         $reward['post_time'] = date('Y-m-d H:i:s', $reward['posttime']);
         $reward['prize'] = unserialize($reward['prize']);
         $reward['rules'] = unserialize($reward['rules']);
         $reward['postip'] = long2ip($reward['postip']);
         $reward['event_image_path'] = DB::result_first(" select `image` from `" . TABLE_PREFIX . "reward_image` where `id` = '{$reward['event_image']}'");
         if ($reward['prize']) {
             foreach ($reward['prize'] as $key => $val) {
                 if ($image_id = (int) $val['prize_image']) {
                     $reward['prize'][$key]['prize_image_url'] = DB::result_first(" select `image` from `" . TABLE_PREFIX . "reward_image` where `id` = '{$image_id}'");
                     if ($image_id == $reward['image']) {
                         $reward['image'] = $reward['prize'][$key]['prize_image_url'];
                     }
                 }
                 $reward['prize'][$key]['prize_image_url'] = $reward['prize'][$key]['prize_image_url'] ? $reward['prize'][$key]['prize_image_url'] : './images/reward_noPic.gif';
             }
             #默认图片
             $reward['image'] = $reward['image'] ? $reward['image'] : './images/reward_noPic.gif';
         }
         $reward['event_image_path'] || ($reward['event_image_path'] = $reward['image']);
         if ($reward['fromt'] < TIMESTAMP && TIMESTAMP < $reward['tot']) {
             $reward['type'] = 1;
             $reward['reward_type'] = '正在进行';
         } else {
             if ($reward['fromt'] > TIMESTAMP) {
                 $reward['type'] = 0;
                 $reward['reward_type'] = '等待开始';
             } else {
                 if (TIMESTAMP > $reward['tot']) {
                     $reward['type'] = 2;
                     $reward['reward_type'] = '已经结束';
                 }
             }
         }
         $reward['time_lesser'] = $reward['tot'] > TIMESTAMP ? $reward['tot'] - TIMESTAMP : 0;
         $member = jsg_member_info($reward['uid']);
         $reward['username'] = $member['username'];
         $reward['nickname'] = $member['nickname'];
         $reward['validate_html'] = $member['validate_html'];
         #需要转发的微博
         if ($reward['tid'] > 0) {
             $reward['topic'] = jtable('topic_more')->get_longtext($reward['tid']);
             $reward['topic_content'] = cut_str($reward['topic'], 150);
         }
         #需关注人与我的关系
         $my_buddyids = get_buddyids(MEMBER_ID);
         if ($reward['rules']['user']) {
             foreach ($reward['rules']['user'] as $uid => $val) {
                 if (isset($my_buddyids[$uid])) {
                     $reward['rules']['user'][$uid]['follow_html'] = follow_html($uid, 1);
                 } else {
                     $reward['rules']['user'][$uid]['follow_html'] = follow_html($uid, 0);
                 }
             }
         }
     }
     return $reward;
 }
示例#26
0
 function UserSearch()
 {
     $member = jsg_member_info(MEMBER_ID);
     $query_link = 'index.php?mod=search&code=user';
     $where = '';
     $where_list = array();
     $cache_time = 0;
     $cache_key = '';
     $tags = trim(get_param('tags'));
     if ($tags) {
         $tags = get_safe_code($tags);
         $tags = $this->_filterKeyword($tags);
         $search_keyword = $tags;
         if (jtable('tag')->info(array('name' => $tags))) {
             $uids = jlogic('tag_favorite')->favorite_uids($tags);
         }
         if (!empty($uids)) {
             $where = " WHERE `uid` IN (" . jimplode($uids) . ") ";
             $query_link .= "&tags=" . urlencode($tags);
         }
     } else {
         $keyword = trim(get_param('nickname'));
         if ($keyword) {
             $keyword = get_safe_code($keyword);
             $keyword = $this->_filterKeyword($keyword);
             $search_keyword = $keyword;
             $where_list['keyword'] = false !== strpos($keyword, '@') ? "`email`='" . addslashes("{$keyword}") . "'" : build_like_query("`nickname`, `province`, `city`", $keyword);
             $query_link .= "&nickname=" . urlencode($keyword);
             $profile_search_uids = jlogic('member_profile')->search($keyword);
             if ($profile_search_uids) {
                 $where_list['keyword'] .= " OR `uid` IN(" . jimplode($profile_search_uids) . ") ";
                 $profile_members = jlogic('member_profile')->get_by_uid($profile_search_uids);
             }
         }
         $province = (int) get_param('province');
         if ($province > 0) {
             $province = DB::result_first("select `name` from " . TABLE_PREFIX . "common_district where id = '{$province}'");
             $where_list['province'] = "`province`='" . addslashes("{$province}") . "'";
             $query_link .= "&province=" . urlencode($province);
             $city = (int) get_param('city');
             if ($city > 0) {
                 $city = DB::result_first("select `name` from " . TABLE_PREFIX . "common_district where id = '{$city}'");
                 $where_list['city'] = "`city`='" . addslashes("{$city}") . "'";
                 $query_link .= "&city=" . urlencode($city);
                 $area = (int) get_param('area');
                 if ($area > 0) {
                     $area = DB::result_first("select `name` from " . TABLE_PREFIX . "common_district where id = '{$area}'");
                     $where_list['area'] = "`area`='" . addslashes("{$area}") . "'";
                     $query_link .= "&area=" . urlencode($area);
                     $street = (int) get_param('street');
                     if ($street > 0) {
                         $street = DB::result_first("select `name` from " . TABLE_PREFIX . "common_district where id = '{$street}'");
                         $where_list['street'] = "`street`='" . addslashes("{$street}") . "'";
                         $query_link .= "&street=" . urlencode($street);
                     }
                 }
             }
         }
         $where = empty($where_list) ? '' : ' WHERE ' . implode(' AND ', $where_list) . ' ';
         $cache_time = 1800;
         $cache_key = "member-search-{$keyword}-{$province}-{$city}-{$area}-{$street}";
     }
     $total_record = 0;
     $member_list = array();
     $page_arr = array();
     $member_tag = array();
     if ($where) {
         $rets = $this->_MemberList($where, $query_link, $cache_time, $cache_key);
         if ($rets) {
             $total_record = $rets['total_record'];
             $member_list = $rets['member_list'];
             $page_arr = $rets['page_arr'];
             $member_tag = $rets['member_tag'];
         }
     }
     $this->Title = "用户搜索";
     include template('social/search_list');
 }
示例#27
0
 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;
 }
示例#28
0
 function UrlLogic()
 {
     $this->db = jtable('url');
 }
示例#29
0
 public function article_modify()
 {
     $article_id = (int) jget('article');
     if ($article_id < 1) {
         $this->Messager('哪一个?');
         return;
     }
     $article = jlogic('cms')->getarticlebyid($article_id);
     if ($article['imageid']) {
         $article['imageid'] = explode(',', $article['imageid']);
         foreach ($article['imageid'] as $key => $one) {
             $article['imageid'][$key] = jtable('topic_image')->info(array('id' => $one));
         }
     }
     if ($article['attachid']) {
         $article['attachid'] = explode(',', $article['attachid']);
         foreach ($article['attachid'] as $key => $one) {
             $article['attachid'][$key] = jtable('topic_attach')->info(array('id' => $one));
         }
     }
     $categoryselect = jlogic('cms')->get_category_html($article['catid']);
     include template('admin/cms/article_modify');
 }
示例#30
0
 function doleader()
 {
     $config = array();
     $config['feed_type'] = array();
     $feed_type = $this->Post['feed_type'];
     if ($feed_type) {
         $config['feed_type'] = $feed_type;
     }
     $config['feed_user'] = array();
     $feed_nicknames = $this->Post['feed_nicknames'];
     if ($feed_nicknames) {
         $feed_nicknames = explode("\r\n", $feed_nicknames);
         foreach ($feed_nicknames as $key => $one) {
             $uid = jtable('members')->val(array('nickname' => trim($one)), 'uid');
             if ($uid) {
                 $config['feed_user'][$uid] = $one;
             } else {
                 unset($feed_nicknames[$key]);
             }
         }
     }
     $cat_ary = array('type' => $feed_type, 'user' => implode("\r\n", $feed_nicknames));
     jconf::set('feed', $cat_ary);
     jconf::update($config);
     $this->Messager("修改成功", 'admin.php?mod=feed&code=leader');
 }