Esempio n. 1
0
 function send()
 {
     $to_user = jfilter($this->Post['to_user'], 'txt');
     $member = DB::fetch_first("SELECT `nickname` FROM " . DB::table("members") . " WHERE `nickname`='{$to_user}'");
     if (empty($member)) {
         Mobile::error("No User", 300);
     }
     $this->Post['message'] = jpost('message', 'txt');
     $to_user = $member['nickname'];
     $data = array('to_user' => $to_user, 'message' => trim($this->Post['message']));
     $ret = $this->MyPmLogic->pmSend($data);
     if ($ret == 0) {
         Mobile::success("Success");
     } else {
         if ($ret == 1) {
             Mobile::error("Content not emtpy", 420);
         } else {
             if ($ret == 2) {
                 Mobile::error("Content not emtpy", 321);
             } else {
                 if (ret == 3) {
                     Mobile::error("Content not emtpy", 321);
                 }
             }
         }
     }
     Mobile::error("Unkonw error", 250);
 }
 function hot_at($uid = MEMBER_ID, $limit = 10, $day = 7, $key = 'uid', $field = 'tuid')
 {
     $rets = array();
     $uid = jfilter($uid, 'int');
     $limit = jfilter($limit, 'int');
     $day = jfilter($day, 'int');
     if ($uid > 0 && $limit > 0 && $day > 0) {
         $cache_id = $this->cache_id("hot_at-{$field}-{$key}-{$uid}-{$limit}-{$day}");
         if (false === ($rets = cache_db('mget', $cache_id))) {
             $gets = $this->get(array('sql_field' => " `{$field}`, COUNT(`{$field}`) AS `at_count` ", $key => $uid, '>@dateline' => TIMESTAMP - $day * 86400, 'sql_group' => " `{$field}` ", 'sql_order' => ' `at_count` DESC, `id` DESC ', 'result_count' => $limit, 'return_list' => 1));
             $uids = array();
             if ($gets) {
                 $at_counts = array();
                 foreach ($gets as $k => $v) {
                     $uid = (int) $v[$field];
                     if ($uid > 0) {
                         $uids[$uid] = $uid;
                         $at_counts[$uid] = $v['at_count'];
                     }
                 }
             }
             $rets = array();
             if ($uids) {
                 $rets = jlogic('topic')->GetMember($uids, "`uid`,`ucuid`,`username`,`nickname`,`face`,`face_url`,`fans_count`");
                 foreach ($rets as $k => $row) {
                     $row['at_count'] = $at_counts[$row['uid']];
                     $rets[$k] = $row;
                 }
             }
             cache_db('mset', $cache_id, $rets, 3600);
         }
     }
     return $rets;
 }
 function get_my_group($uid, $limit = 0)
 {
     $list = array();
     $uid = jfilter($uid, 'int');
     if ($uid > 0 && jallow($uid)) {
         if ($limit < 1) {
             $cache_key = $this->table . '-get_my_group-' . $uid;
             $cache_time = 300;
             if (false !== ($list = cache_db('mget', $cache_key))) {
                 return $list;
             }
         }
         $limit = jfilter($limit, 'int');
         $p = array('uid' => $uid, 'sql_order' => '`count` DESC, `order` ASC, `id` ASC', 'result_count' => $limit > 0 ? $limit : 999);
         $rets = $this->db->get($p);
         $list = array();
         if ($rets['list']) {
             foreach ($rets['list'] as $row) {
                 $list[$row['id']] = $row;
             }
         }
         if ($cache_time > 0) {
             cache_db('mset', $cache_key, $list, $cache_time);
         }
     }
     return $list;
 }
 public function get_id_by_name($name)
 {
     $ret = 0;
     $name = jfilter($name, 'txt');
     if ($name) {
         $ret = (int) $this->db->val(array('name' => $name), 'id');
     }
     return $ret;
 }
Esempio n. 5
0
 function row($id)
 {
     $row = array();
     $id = jfilter($id, 'int');
     if ($id > 0) {
         $row = $this->info($id, 2592000, 1);
     }
     return $row;
 }
 function CategoryView($ids = 0)
 {
     $ids = jfilter($ids, 'int');
     $error_info = array(0 => '未找到指定分类信息');
     if ($ids < 1) {
         return $error_info[0];
     }
     return jtable('validate_category')->info($ids);
 }
 function cache_rm($mod)
 {
     $mod = jfilter($mod, 'txt');
     if ($mod) {
         parent::cache_rm($mod);
         cache_file('rm', 'role_action/' . $mod . '-0');
         cache_file('rm', 'role_action/' . $mod . '-1');
     }
 }
Esempio n. 8
0
 function get($p = array())
 {
     $uid = (int) $p['uid'];
     $uid = $uid > 0 ? $uid : MEMBER_ID;
     if ($uid < 1) {
         return jerror('获取用户粉丝列表数据时,UID不能为空或您没有登录系统', -1);
     }
     $member = jsg_member_info($uid);
     if (empty($member)) {
         return jerror('您要查看的用户已经不存在了,UID错误', -2);
     }
     $count = (int) $member['fans_count'];
     if ($count < 1) {
         return array();
     }
     $page_num = 10;
     if (isset($p['page_num'])) {
         $page_num = (int) $p['page_num'];
         if ($page_num < 1 || $page_num > 100) {
             return jerror('请设置每页显示的数量在 1 ~ 100 之间', -3);
         }
     }
     $ps = array('result_count' => $count, 'page_num' => $page_num, 'page_url' => $p['page_url'], 'sql_field' => ' M.* ', 'sql_table' => ' `' . DB::table($this->db->table_name($uid)) . '` AS BF LEFT JOIN `' . DB::table('members') . '` AS M ON M.`uid`=BF.`touid` ', 'sql_where' => " BF.`uid`='{$uid}' AND M.`uid` IS NOT NULL ", 'sql_order' => ' BF.`dateline` DESC ', 'result_list_row_make_func' => 'jsg_member_make', 'result_list_make_func' => 'buddy_follow_html');
     if (true === IN_JISHIGOU_WAP) {
         unset($ps['result_list_make_func']);
     }
     if (jallow($uid)) {
         if ($member['fans_new'] > 0) {
             jlogic('member')->clean_new_remind('fans_new', $uid);
         }
         if ($p['nickname']) {
             $nickname = jfilter($p['nickname'], 'txt');
             if (strlen($nickname) < 3 || strlen($nickname) > 15) {
                 return jerror('搜索用户昵称时,字数请控制在 3 ~ 15 个字符之间', -4);
             }
             unset($ps['result_count']);
             $ps['cache_time'] = 600;
             $ps['sql_where'] .= ' AND ' . build_like_query(' M.`nickname` ', $nickname);
         }
         if ($p['order'] && in_array($p['order'], array('lastpost', 'fans_count'))) {
             $p['sql_order'] = ' M.`' . $p['order'] . '` DESC ';
         }
     }
     $rets = $this->db->get($ps);
     if (is_array($rets)) {
         $rets['member'] = $member;
     }
     if (true === IN_JISHIGOU_WAP) {
         if ($rets['list']) {
             $rets['list'] = buddy_follow_html($rets['list'], 'uid', 'wap_follow_html');
         }
         $rets = wap_iconv($rets);
     }
     return $rets;
 }
Esempio n. 9
0
 function row($uid, $make = 1)
 {
     $row = array();
     $uid = jfilter($uid, 'int');
     if ($uid > 0) {
         $row = $this->info($uid);
         if ($row && $make) {
             $row = jsg_member_make($row);
         }
     }
     return $row;
 }
Esempio n. 10
0
 function get_name_by_id($id)
 {
     static $S_names;
     $id = jfilter($id, 'int');
     if (!isset($S_names[$id])) {
         if ($id > 0) {
             $row = $this->row($id);
         } else {
             $row = $this->guest();
         }
         $S_names[$id] = $row['role_name'];
     }
     return $S_names[$id];
 }
Esempio n. 11
0
 function del($uid, $real = 0)
 {
     $ret = false;
     $uid = jfilter($uid, 'int');
     if ($uid > 0) {
         $p = array('uid' => $uid);
         if ($real) {
             $ret = $this->delete($p);
         } else {
             $ret = $this->update_count($p, 'dateline', '0', 1, array('msg' => ''));
         }
     }
     return $ret;
 }
Esempio n. 12
0
 function del($uid, $touid)
 {
     $ret = false;
     $uid = jfilter($uid, 'int');
     $touid = jfilter($touid, 'int');
     if ($uid > 0 && $touid > 0) {
         $row1 = $this->row($uid, $touid);
         if ($row1) {
             $this->_init_table($uid);
             $ret = $this->delete(array('uid' => $uid, 'touid' => $touid), 1);
         }
         $row2 = $this->row($touid, $uid);
         if ($row2 && 3 == $row2['relation']) {
             $this->_set_relation($touid, $uid, 2);
         }
     }
     return $ret;
 }
 function table_id($uid, $num = 0)
 {
     if ($GLOBALS['_J']['config']['acceleration_mode'] || true === IN_JISHIGOU_UPGRADE) {
         return $uid % $num + 1;
     }
     $table_id = $this->val($uid, 'table_id', 1);
     if (false === $table_id) {
         $num = jfilter($num, 'int');
         if ($num > 1) {
             if (is_numeric($uid)) {
                 $table_id = $uid % $num + 1;
             } else {
                 $table_id = rand(1, $num);
             }
             $this->add($uid, $table_id);
         }
     }
     return $table_id;
 }
 function next($id = 0, $is = 'id', $new = 1)
 {
     $ret = false;
     if ($this->get_maps()) {
         $is = in_array($is, array('id', 'uid', 'dateline')) ? $is : 'id';
         $id = jfilter($id, 'int');
         if ($id > 0) {
             $p = array(($new ? "<" : ">") . '@' . $is => $id);
             $p['sql_order'] = ' `' . $is . '` ' . ($new ? 'DESC' : 'ASC') . ' ';
             if ($new) {
                 $p['sql_order'] = ' `' . $is . '` DESC ';
             }
             $info = $this->info($p);
             if ($info) {
                 $ret = $info['id'];
             }
         } else {
             $ret = DB::result_first("SELECT " . ($new ? "MAX" : "MIN") . "(`id`) FROM " . DB::table($this->table));
         }
     }
     return $ret;
 }
 function get_tids($touid, $p = array(), $more = 0)
 {
     settype($p, 'array');
     $touid = jfilter($touid, 'int');
     if ($touid < 1) {
         return false;
     }
     $row = jtable('members')->row($touid);
     if (!$row) {
         return false;
     }
     $p['touid'] = $touid;
     if (!isset($p['type'])) {
         $p['type'] = array('both', 'reply');
     }
     if (!$p['sql_order']) {
         $p['sql_order'] = ' `dateline` DESC ';
     }
     $this->_init_table($touid);
     $rets = $this->get_ids($p, 'tid', $more);
     return $rets;
 }
 function _set_gids($uid, $touid)
 {
     $ret = false;
     $uid = jfilter($uid, 'int');
     $touid = jfilter($touid, 'int');
     if ($uid > 0 && $touid > 0) {
         $this->_init_table($uid);
         $rets = $this->get_ids(array('uid' => $uid, 'touid' => $touid), 'gid');
         $gids = $rets ? implode(',', $rets) : '';
         $ret = jtable('buddy_follow')->set_gids($uid, $touid, $gids);
     }
     return $ret;
 }
Esempio n. 17
0
 function set_remark($uid, $touid, $remark = '')
 {
     $ret = false;
     $row = $this->row($uid, $touid);
     if ($row) {
         $remark = jfilter($remark, 'txt');
         $remark = cutstr($remark, 30);
         $f_rets = filter($remark);
         if ($f_rets && $f_rets['error']) {
             $remark = '';
         }
         if ($remark != $row['remark']) {
             $this->_init_table($uid);
             $ret = $this->update(array('remark' => $remark), array('uid' => $uid, 'touid' => $touid));
         }
     }
     return $ret;
 }
Esempio n. 18
0
 function _get_tids_maps($uids, $p = array())
 {
     settype($uids, 'array');
     settype($p, 'array');
     $rets = jtable('member_table_id')->get_maps();
     if ($rets && ($maps = $rets['list'])) {
         $maps_count = $rets['count'];
         $table_id = $rets['table_id'];
         if ($maps_count < 2) {
             $p['uid'] = $uids;
             $this->_init_table($table_id, 2);
         } else {
             $_maps = array();
             foreach ($uids as $k => $uid) {
                 $uid = jfilter($uid, 'int');
                 if ($uid > 0) {
                     foreach ($maps as $map) {
                         if ($uid >= $map['min'] && $uid < $map['max']) {
                             $table_id = $map['id'];
                             $_maps[$table_id][$uid] = $uid;
                             break;
                         }
                     }
                 } else {
                     unset($uids[$k]);
                 }
             }
             if ($_maps) {
                 $_maps_count = count($_maps);
                 if ($_maps_count > 1) {
                     $_p = $p;
                     $_p['return_sql'] = 1;
                     $_rs = array();
                     foreach ($_maps as $table_id => $_uids) {
                         $_p['uid'] = $_uids;
                         $this->_init_table($table_id, 2);
                         $_rs[$table_id] = $this->get_ids($_p, 'tid', 1);
                     }
                     $p['sql_table'] = " ((" . implode(") UNION ALL (", $_rs) . ")) `{$this->_table}_union_all_table_alias` ";
                 } else {
                     $p['uid'] = $_maps[$table_id];
                     $this->_init_table($table_id, 2);
                 }
             }
         }
     } else {
         $p['uid'] = $uids;
         $this->_init_table();
     }
     return $p;
 }
Esempio n. 19
0
 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;
 }
Esempio n. 20
0
 function archive($tid = 0)
 {
     $num = 1000000;
     $keep = 200000;
     $tid = jfilter($tid, 'int');
     if ($tid > 0 && $tid - $GLOBALS['_J']['config']['last_archive_topic_tid'] > $num + $keep) {
         $max_tid = $num + max(0, (int) $GLOBALS['_J']['config']['last_archive_topic_tid']);
         if (!jtable('topic_table_id')->table_id($max_tid)) {
             $table_id = jtable('topic_table_id')->add($max_tid);
             if ($table_id) {
                 $p = array('<=@tid' => $max_tid);
                 jtable('topic')->copy($this->_table . '_' . $table_id, 3, $p);
                 jtable('topic_more')->copy('topic_more_' . $table_id, 3, $p);
                 jconf::update('last_archive_topic_tid', $max_tid);
             }
         }
     }
 }
Esempio n. 21
0
 function update_diguids($tid, $diguids = null, $act = 'add', $uid = MEMBER_ID)
 {
     $ret = false;
     $tid = jfilter($tid, 'int');
     if ($tid > 0) {
         if (is_null($diguids)) {
             $diguids = jtable('topic_dig')->get_ids(array('result_count' => 999, 'tid' => $tid, 'sql_order' => ' `id` DESC '), 'uid');
             $uid = jfilter($uid, 'int');
             if ('add' == $act) {
                 $diguids[$uid] = $uid;
             } elseif ('del' == $act) {
                 unset($diguids[$uid]);
             }
         }
         if (is_array($diguids)) {
             $diguids = serialize($diguids);
         }
         $ret = $this->set_val($tid, $diguids, 'diguids');
     }
     return $ret;
 }
Esempio n. 22
0
 private function _process_reply($data)
 {
     $totid = jfilter($data['totid'], 'int');
     if ($totid > 0 && $data['touid'] > 0 && $data['uid'] != $data['touid'] && !jtable('topic_mention')->is_at($data['tid'], $data['touid'])) {
         if ($data['type'] == 'both' || $data['type'] == 'reply') {
             jtable('members')->update_count($data['touid'], 'comment_new', '+1');
         }
         if ($GLOBALS['_J']['config']['imjiqiren_enable'] || $GLOBALS['_J']['config']['sms_enable'] || $GLOBALS['_J']['config']['sendmailday'] > 0) {
             $sql = "select `uid`,`username`,`nickname`,`email`,`lastactivity`,\r\n\t\t\t\t\t`newpm`,`at_new`,`event_new`,`fans_new`,`vote_new`,`dig_new`,`channel_new`,`company_new`,`qun_new`,`comment_new`,\r\n\t\t\t\t\t`email_checked`,`notice_reply`,`user_notice_time`\r\n\t\t\t\tfrom `" . TABLE_PREFIX . "members`\r\n\t\t\t\twhere `uid` = '{$data['touid']}'";
             $reply_notice = DB::fetch_first($sql);
             if ($reply_notice) {
                 if ($GLOBALS['_J']['config']['imjiqiren_enable'] && imjiqiren_init()) {
                     imjiqiren_send_message($reply_notice, 'p', $GLOBALS['_J']['config']);
                 }
                 if ($GLOBALS['_J']['config']['sms_enable'] && sms_init()) {
                     sms_send_message($reply_notice, 'p', $GLOBALS['_J']['config']);
                 }
                 if ($GLOBALS['_J']['config']['sendmailday'] > 0) {
                     jtable('mailqueue')->add($reply_notice, 'notice_reply');
                 }
             }
         }
     }
 }
 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);
 }
Esempio n. 24
0
 function View()
 {
     $tid = 0;
     $tidv = jget('tid', 'txt');
     if (!is_numeric($tidv) && false !== strpos($tidv, '_')) {
         $tid = end(explode('_', $tidv));
     } else {
         $tid = $tidv;
     }
     $tid = jfilter($tid, 'int');
     $view_rets = jlogic('topic')->check_view($tid);
     if ($view_rets['error']) {
         exit($view_rets['result']);
     }
     $option = array('TPT_id' => jget('TPT_id'), 'ptidv' => jget('ptidv'));
     $ret = '';
     if ($tid > 0) {
         $info = $this->LongtextLogic->get_info($tid, $option);
         if ($info) {
             $ret = $info['content'];
             if ($info['longtextid'] > 0) {
                 $ret = nl2br($ret);
             }
         }
     }
     exit($ret);
 }
Esempio n. 25
0
    function get($p = array())
    {
        $uid = (int) $p['uid'];
        $uid = $uid > 0 ? $uid : MEMBER_ID;
        if ($uid < 1) {
            return jerror('获取用户关注列表数据时,UID不能为空或您没有登录系统', -1);
        }
        $member = jsg_member_info($uid);
        if (empty($member)) {
            return jerror('您要查看的用户已经不存在了,UID错误', -2);
        }
        $count = (int) $member['follow_count'];
        if ($count < 1) {
            return array();
        }
        $page_num = 20;
        if (isset($p['page_num'])) {
            $page_num = (int) $p['page_num'];
            if ($page_num < 1 || $page_num > 200) {
                return jerror('请设置每页显示的数量在 1 ~ 200 之间', -3);
            }
        }
        $ps = array('result_count' => $count, 'page_num' => $page_num, 'page_url' => $p['page_url'], 'sql_field' => ' BF.`remark`, BF.`gids`, M.* ', 'sql_table' => ' `' . DB::table($this->db->table_name($uid)) . '` AS BF LEFT JOIN `' . DB::table('members') . '` AS M ON M.`uid`=BF.`touid` ', 'sql_where' => " BF.`uid`='{$uid}' AND M.`uid` IS NOT NULL ", 'result_list_row_make_func' => 'jsg_member_make', 'result_list_make_func' => 'buddy_follow_html');
        if (true === IN_JISHIGOU_WAP) {
            unset($ps['result_list_make_func']);
        }
        $group = array();
        $group_list = array();
        if (jallow($uid)) {
            $group_list = jlogic('buddy_follow_group')->get_my_group($uid);
            if ($p['nickname']) {
                $nickname = jfilter($p['nickname'], 'txt');
                if (strlen($nickname) < 3 || strlen($nickname) > 15) {
                    return jerror('搜索用户昵称时,字数请控制在 3 ~ 15 个字符之间', -4);
                }
                unset($ps['result_count']);
                $ps['cache_time'] = 600;
                $ps['sql_where'] .= ' AND ' . build_like_query(' M.`nickname` ', $nickname);
            } elseif ($p['gid']) {
                $gid = (int) $p['gid'];
                $group = jlogic('buddy_follow_group')->get_my_group_info($uid, $gid);
                if (empty($group)) {
                    return jerror('请指定一个正确的分组GID', -5);
                }
                $ps['result_count'] = $group['count'];
                $ps['sql_table'] = ' `' . DB::table(jtable('buddy_follow_group_relation')->table_name($uid)) . '` AS BFGR
					LEFT JOIN `' . DB::table('members') . '` AS M
						ON M.`uid` = BFGR.`touid`
					LEFT JOIN `' . DB::table($this->db->table_name($uid)) . '` AS BF
						ON (BF.`uid`="' . $uid . '" AND BF.`touid`=M.`uid`) ';
                $ps['sql_where'] = ' BFGR.`gid`="' . $gid . '" AND BFGR.`uid`="' . $uid . '" AND M.`uid` IS NOT NULL ';
                $ps['sql_order'] = ' BFGR.`dateline` DESC ';
            }
            if ($p['order'] && in_array($p['order'], array('lastpost', 'fans_count'))) {
                $p['sql_order'] = ' M.`' . $p['order'] . '` DESC ';
            }
        }
        $rets = $this->db->get($ps);
        if (is_array($rets)) {
            $rets['member'] = $member;
            $rets['group'] = $group;
            $rets['group_list'] = $group_list;
            if ($rets['list'] && $group_list) {
                foreach ($rets['list'] as $k => $v) {
                    if ($v['gids']) {
                        $rets['list'][$k]['buddy_group_list'] = jlogic('buddy_follow_group')->get_group_list($v['gids'], $group_list);
                    }
                }
            }
        }
        if (true === IN_JISHIGOU_WAP) {
            if ($rets['list']) {
                $rets['list'] = buddy_follow_html($rets['list'], 'uid', 'wap_follow_html');
            }
            $rets = wap_iconv($rets);
        }
        return $rets;
    }
Esempio n. 26
0
 function DoModifyNormal()
 {
     if ('11111111' == $this->Post['config']['iphone_passphrase']) {
         $this->Post['config']['iphone_passphrase'] = $this->Config['iphone_passphrase'];
     }
     if (!($this->Post['config']['iphone_push_enable'] > 0 && $this->Post['config']['iphone_download_url'] && $this->Post['config']['iphone_passphrase'] && $this->Post['config']['iphone_pem_file'] && $this->_check_ipone_file($this->Post['config']['iphone_pem_file']) && is_file(ROOT_PATH . $this->Post['config']['iphone_pem_file']) && function_exists("openssl_open") && $this->_check_iphone_join($this->Post['config']['iphone_pem_file'], $this->Post['config']['iphone_passphrase']))) {
         $this->Post['config']['iphone_push_enable'] = 0;
     }
     if (isset($this->Post['config']['nickname_length'])) {
         $this->Post['config']['nickname_length'] = (int) $this->Post['config']['nickname_length'];
         if ($this->Config['ucenter_enable']) {
             $this->Post['config']['nickname_length'] = $this->Post['config']['nickname_length'] > 15 ? 15 : $this->Post['config']['nickname_length'];
         } elseif ($this->Post['config']['nickname_length'] > 50) {
             $this->Post['config']['nickname_length'] = 50;
         }
     }
     if (isset($this->Post['config']['website_home_page'])) {
         $website_home_page = explode('|', $this->Post['config']['website_home_page']);
         $this->Post['config']['default_module'] = $website_home_page[0];
         $this->Post['config']['default_code'] = $website_home_page[1] ? $website_home_page[1] : $website_home_page[0];
         unset($this->Post['config']['website_home_page']);
     }
     if (isset($this->Post['user_forbid'])) {
         if ($this->Post['user_forbid']) {
             $forbid_list = explode("\r\n", $this->Post['user_forbid']);
             $forbid_list = array_unique($forbid_list);
             $forbid = implode("\r\n", $forbid_list);
             jconf::set('user', array('forbid' => $forbid));
         }
         unset($this->Post['user_forbid']);
         $this->Post['config']['regstatus'] = isset($this->Post['config']['regstatus']) ? $this->Post['config']['regstatus'] : array();
         $this->Post['config']['third_party_regstatus'] = isset($this->Post['config']['third_party_regstatus']) ? $this->Post['config']['third_party_regstatus'] : array();
     }
     isset($this->Post['config']['regiter_tuijian']) && ($this->Post['config']['regiter_tuijian'] = $this->Post['config']['regiter_tuijian'] ? $this->Post['config']['regiter_tuijian'] : array());
     if (isset($this->Post['config']['watermark_contents_size'])) {
         $this->Post['config']['watermark_contents'] = isset($this->Post['config']['watermark_contents']) ? $this->Post['config']['watermark_contents'] : array();
     }
     if (isset($this->Post['email_white_list'])) {
         if ($this->Post['email_white_list']) {
             $email_white_list = explode("\r\n", $this->Post['email_white_list']);
             $email_white_list = array_remove_empty(array_unique($email_white_list));
             jconf::set('email_white_list', $email_white_list);
         } else {
             jconf::set('email_white_list', '');
         }
         unset($this->Post['email_white_list']);
     }
     if (isset($this->Post['register']['ip'])) {
         $register = jconf::get('register');
         $register['ip']['time_val'] = max(0, (int) $this->Post['register']['ip']['time_val']);
         $register['ip']['time_unit'] = $this->Post['register']['ip']['time_unit'];
         $register['ip']['limit'] = max(0, (int) $this->Post['register']['ip']['limit']);
         $time_unit_config = jconf::get('time_unit');
         $register['ip']['time'] = (int) ($register['ip']['time_val'] * $time_unit_config[$register['ip']['time_unit']]['unit']);
         $register['ip']['time_html'] = $register['ip']['time_val'] . $time_unit_config[$register['ip']['time_unit']]['name'];
         $ip_white_list = '';
         if ($this->Post['register']['ip']['white_list']) {
             $ip_white_list = explode("\n", $this->Post['register']['ip']['white_list']);
             foreach ($ip_white_list as $k => $v) {
                 $ip_white_list[$k] = trim($v);
             }
             $ip_white_list = array_remove_empty(array_unique($ip_white_list));
         }
         $register['ip']['white_list'] = $ip_white_list;
         jconf::set('register', $register);
         $this->Post['config']['register_check_ip_enable'] = $register['ip']['time'] > 0 && $register['ip']['limit'] > 0 ? 1 : 0;
         unset($this->Post['register']['ip']);
     }
     if (isset($this->Post['config']['site_name']) && empty($this->Post['config']['site_name'])) {
         $this->Messager("修改出现错误,站点名称不能为空");
     }
     if (isset($this->Post['config']['normal_default_role_id']) && empty($this->Post['config']['normal_default_role_id'])) {
         $this->Messager("修改出现错误,请先选择一个角色");
     }
     if (isset($this->Post['config']['thumbwidth'])) {
         $this->Post['config']['thumbwidth'] = min(300, max(30, (int) $this->Post['config']['thumbwidth']));
     }
     if (isset($this->Post['config']['thumbheight'])) {
         $this->Post['config']['thumbheight'] = min(300, max(30, (int) $this->Post['config']['thumbheight']));
     }
     if (isset($this->Post['config']['watermark_position'])) {
         $this->Post['config']['watermark_position'] = (int) $this->Post['config']['watermark_position'];
     }
     if (isset($this->Post['config']['image_size'])) {
         $this->Post['config']['image_size'] = max(10, min(51200, (int) $this->Post['config']['image_size']));
         $this->Post['config']['image_size_limit'] = $this->Post['config']['image_size'] * 1024;
     }
     if (isset($this->Post['seccode_setting'])) {
         $this->Post['config']['seccode_login'] = $this->Post['config']['seccode_login'] ? 1 : 0;
         $this->Post['config']['seccode_register'] = $this->Post['config']['seccode_register'] ? 1 : 0;
         $this->Post['config']['seccode_password'] = $this->Post['config']['seccode_password'] ? 1 : 0;
         $this->Post['config']['seccode_publish'] = $this->Post['config']['seccode_publish'] ? 1 : 0;
         $this->Post['config']['seccode_comment'] = $this->Post['config']['seccode_comment'] ? 1 : 0;
         $this->Post['config']['seccode_forward'] = $this->Post['config']['seccode_forward'] ? 1 : 0;
         $this->Post['config']['seccode_sms'] = $this->Post['config']['seccode_sms'] ? 1 : 0;
         $this->Post['config']['seccode_no_email'] = $this->Post['config']['seccode_no_email'] ? 1 : 0;
         $this->Post['config']['seccode_no_photo'] = $this->Post['config']['seccode_no_photo'] ? 1 : 0;
         $this->Post['config']['seccode_no_vip'] = $this->Post['config']['seccode_no_vip'] ? 1 : 0;
         $this->Post['config']['seccode_purviews'] = array();
         if (is_array($this->Post['config']['seccode_purview']) && count($this->Post['config']['seccode_purview'])) {
             foreach ($this->Post['config']['seccode_purview'] as $__spid) {
                 $__spid = jfilter($__spid, 'int');
                 if ($__spid > 0) {
                     $this->Post['config']['seccode_purviews'][$__spid] = $__spid;
                 }
             }
         }
         $this->Post['config']['seccode_enable'] = $this->Post['seccode_enable'] ? (int) $this->Post['seccode_enable'] : 0;
         if ($this->Post['config']['seccode_enable'] == 1) {
             $this->Post['config']['seccode_login'] = $this->Post['config']['seccode_logins'] ? 1 : 0;
             $this->Post['config']['seccode_register'] = $this->Post['config']['seccode_registers'] ? 1 : 0;
             $this->Post['config']['seccode_password'] = $this->Post['config']['seccode_passwords'] ? 1 : 0;
         }
         $this->Post['config']['seccode_purview'] = is_array($this->Post['config']['seccode_purview']) ? implode(',', $this->Post['config']['seccode_purview']) : '';
         $this->Post['config']['seccode_pri_key'] = $this->Post['config']['seccode_pri_key'] ? $this->Post['config']['seccode_pri_key'] : $this->yxm_pri_key;
         $this->Post['config']['seccode_pub_key'] = $this->Post['config']['seccode_pub_key'] ? $this->Post['config']['seccode_pub_key'] : $this->yxm_pub_key;
         unset($this->Post['seccode_setting']);
     }
     if (isset($this->Post['config']['is_qmd'])) {
         $this->Post['config']['is_qmd'] = $this->Post['config']['is_qmd'] ? 1 : 0;
         if ($this->Post['config']['is_qmd']) {
             if (!$this->Post['config']['qmd_file_url'] || !jmkdir($this->Post['config']['qmd_file_url'])) {
                 $this->Post['config']['qmd_file_url'] = 'images/qmd/';
             }
             if (!$this->Post['config']['qmd_fonts_url'] || !file_exists($this->Post['config']['qmd_fonts_url'])) {
                 $this->Post['config']['is_qmd'] = 0;
                 $this->Messager('请上传签名档必须的字体文件 ' . $this->Post['config']['qmd_fonts_url']);
             }
         }
         $this->Post['config']['qmd_link_display'] = $this->Post['config']['qmd_link_display'] ? 1 : 0;
     }
     if (isset($this->Post['config']['follow_limit'])) {
         $this->Post['config']['follow_limit'] = max(0, (int) $this->Post['config']['follow_limit']);
     }
     if (isset($this->Post['config']['topic_input_length'])) {
         $this->Post['config']['topic_input_length'] = max(0, (int) $this->Post['config']['topic_input_length']);
     }
     if (isset($this->Post['config']['gzip'])) {
         $this->Post['config']['gzip'] = $this->Post['config']['gzip'] && function_exists('ob_gzhandler') ? 1 : 0;
     }
     if (isset($this->Post['config']['reply_mode_normal'])) {
         $this->Post['config']['reply_mode_normal'] = $this->Post['config']['reply_mode_normal'] ? 1 : 0;
     }
     $new_config = $config = jconf::core_settings();
     foreach ($this->Post['config'] as $k => $v) {
         if (isset($this->Post['config'][$k]) && !is_null($v)) {
             $new_config[$k] = $v;
         }
     }
     $new_config['topic_cut_length'] = (int) $new_config['topic_cut_length'];
     if ($new_config['topic_cut_length'] > 200 || $new_config['topic_cut_length'] < 10) {
         $new_config['topic_cut_length'] = 140;
     }
     if (!$new_config['wap_url']) {
         $new_config['wap_url'] = $new_config['site_url'] . '/wap';
     }
     if (!$new_config['mobile_url']) {
         $new_config['mobile_url'] = $new_config['site_url'] . '/mobile';
     }
     $new_config['extra_domains'] = array();
     if ($new_config['extra_domain']) {
         $_arrs = explode("\n", $new_config['extra_domain']);
         foreach ($_arrs as $v) {
             $v = trim($v);
             $vl = strlen($v);
             if ($vl > 3 && $vl < 100) {
                 $new_config['extra_domains'][] = strtolower($v);
             }
         }
         $new_config['extra_domain'] = implode("\n", $new_config['extra_domains']);
     }
     $new_config['copyright'] = jstripslashes($new_config['copyright']);
     $new_config['tongji'] = jstripslashes($new_config['tongji']);
     $new_config['topic_view_share_code'] = jstripslashes($new_config['topic_view_share_code']);
     $new_config['regclosemessage'] = jstripslashes($new_config['regclosemessage']);
     $result = jconf::set($new_config);
     if ($result != false) {
         $this->Messager("配置修改成功");
     } else {
         $this->Messager("配置修改失败");
     }
 }
Esempio n. 27
0
 private function _nav_key($key, $nav_conf = array())
 {
     $key = jfilter($key, 'txt');
     if (empty($key)) {
         return false;
     }
     $nav_conf = $nav_conf ? $nav_conf : jconf::get('navigation');
     if (isset($nav_conf[$key]) && is_array($nav_conf[$key])) {
         return false;
     }
     foreach ($nav_conf as $tnk => $tn) {
         if ($tn['list']) {
             if (isset($tn['list'][$key]) && is_array($tn['list'][$key])) {
                 return false;
             }
             foreach ($tn['list'] as $snk => $sn) {
                 if ($sn['list']) {
                     if (isset($sn['list'][$key]) && is_array($sn['list'][$key])) {
                         return false;
                     }
                 }
             }
         }
     }
     return $key;
 }
Esempio n. 28
0
 function DoModifyProfile()
 {
     $op = jget('op');
     $member_info = DB::fetch_first("SELECT * FROM " . DB::table('members') . " where `uid`='" . MEMBER_ID . "'");
     if (!$member_info) {
         $this->Messager('用户已经不存在了', null);
     }
     $sql = "select * from `" . TABLE_PREFIX . "memberfields` where `uid`='" . MEMBER_ID . "'";
     $query = $this->DatabaseHandler->Query($sql);
     $memberfields = $query->GetRow();
     if ($op) {
         #主表信息(members)
         $arr = array();
         #性别
         $this->Post['gender'] && ($arr['gender'] = (int) $this->Post['gender']);
         isset($this->Post['qq']) && ($arr['qq'] = ($qq = is_numeric($this->Post['qq']) ? $this->Post['qq'] : 0) > 10000 && strlen((string) $qq) < 11 ? $qq : '');
         isset($this->Post['msn']) && ($arr['msn'] = trim(strip_tags($this->Post['msn'])));
         isset($this->Post['bday']) && ($arr['bday'] = $this->Post['bday']);
         isset($this->Post['phone']) && ($arr['phone'] = trim($this->Post['phone']));
         isset($this->Post['aboutme']) && ($arr['aboutme'] = trim(strip_tags($this->Post['aboutme'])));
         if ($arr) {
             $this->_update($arr);
         }
         #附表信息(memberfield的字段profile_set)
         $member_profile_set = array();
         if ($memberfields['profile_set']) {
             $member_profile_set = unserialize($memberfields['profile_set']);
         }
         $privacy = ($privacy = jget('privacy')) ? $privacy : array();
         $member_profile_set = array_merge($member_profile_set, $privacy);
         $this->_updateMemberField(array('profile_set' => serialize($member_profile_set)));
         #附表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) {
             if ($v == 'birthcity') {
                 $this->Post['b_province'] && ($birthcity['b_province'] = $this->Post['b_province']);
                 $this->Post['b_city'] && ($birthcity['b_city'] = $this->Post['b_city']);
                 $this->Post['b_area'] && ($birthcity['b_area'] = $this->Post['b_area']);
                 $this->Post['b_street'] && ($birthcity['b_street'] = $this->Post['b_street']);
                 if ($birthcity) {
                     $arr2[$v] = implode('-', $birthcity);
                 }
             } else {
                 isset($this->Post[$v]) && ($arr2[$v] = trim(strip_tags($this->Post[$v])));
             }
         }
         if ($arr2) {
             $this->_updateMemberProfile($arr2);
         }
     } else {
         foreach ($this->Post as $key => $val) {
             $key = strip_tags($key);
             $val = strip_tags($val);
             $this->Post[$key] = $val;
         }
         if ($member_info['invite_uid'] < 1 && $this->Post['invite_nickname'] && $this->Config['register_invite_input2']) {
             $_invite_member = jsg_member_info($this->Post['invite_nickname'], 'nickname');
             if ($_invite_member) {
                 jsg_member_register_by_invite($_invite_member['uid'], $member_info['uid']);
             }
         }
         $province = trim(DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '" . (int) $this->Post['province'] . "'"));
         $city = trim(DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '" . (int) $this->Post['city'] . "'"));
         if ($this->Post['area']) {
             $area = trim(DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '" . (int) $this->Post['area'] . "'"));
         }
         if ($this->Post['street']) {
             $street = trim(DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '" . (int) $this->Post['street'] . "'"));
         }
         $gender = in_array($gender = (int) $this->Post['gender'], array(1, 2)) ? $gender : 0;
         $email2 = preg_match("~^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\\.)+([a-z]{2,4})|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))\$~i", $email2 = trim($this->Post['email2'])) ? $email2 : '';
         $qq = ($qq = is_numeric($this->Post['qq']) ? $this->Post['qq'] : 0) > 10000 && strlen((string) $qq) < 11 ? $qq : '';
         $msn = trim(strip_tags($this->Post['msn']));
         $aboutme = trim(strip_tags($this->Post['aboutme']));
         $f_rets = filter($aboutme);
         if ($f_rets && $f_rets['error']) {
             $this->Messager($f_rets['msg'], null);
         }
         $signature = trim(strip_tags($this->Post['signature']));
         $f_rets = filter($signature);
         if ($f_rets && $f_rets['error']) {
             $this->Messager($f_rets['msg'], null);
         }
         if (!$gender) {
             $this->Messager("性别不能为空,请返回修改", -1);
         }
         #修改主表(members)
         $arr = array('province' => addslashes($province), 'city' => addslashes($city), 'area' => addslashes($area), 'street' => addslashes($street), 'gender' => $gender, 'aboutme' => addslashes($aboutme), 'aboutmetime' => 0);
         if (@is_file(ROOT_PATH . 'include/logic/cp.logic.php') && $this->Config['company_enable']) {
             if ($this->Post['companyid'] && $member_info['companyid'] == 0) {
                 $arr['companyid'] = (int) $this->Post['companyid'];
                 $arr['company'] = $this->CpLogic->Getone($arr['companyid'], 'company', 'name');
                 if ($arr['companyid'] > 0) {
                     $this->CpLogic->update('company', $arr['companyid'], 1, $member_info['topic_count']);
                 }
             }
             if ($this->Config['department_enable'] && $this->Post['departmentid'] && $member_info['departmentid'] == 0) {
                 $arr['departmentid'] = (int) $this->Post['departmentid'];
                 $arr['department'] = $this->CpLogic->Getone($arr['departmentid'], 'department', 'name');
                 if ($arr['departmentid'] > 0) {
                     $this->CpLogic->update('department', $arr['departmentid'], 1, $member_info['topic_count']);
                 }
             }
             if ($this->Post['jobid'] && $member_info['jobid'] == 0) {
                 $arr['jobid'] = (int) $this->Post['jobid'];
                 $arr['job'] = jlogic('job')->id2subject($arr['jobid']);
             }
         }
         $this->_update($arr);
         #修改附表(memberfiled)
         $arr1 = array();
         if (!$memberfields['validate_true_name'] && $this->Post['validate_true_name']) {
             $arr1['validate_true_name'] = $this->Post['validate_true_name'];
         }
         if (!$memberfields['validate_card_type'] && $this->Post['validate_card_type']) {
             $arr1['validate_card_type'] = $this->Post['validate_card_type'];
         }
         if (!$memberfields['validate_card_id'] && $this->Post['validate_card_id']) {
             $arr1['validate_card_id'] = $this->Post['validate_card_id'];
         }
         if ($arr1) {
             $sets = array();
             if (is_array($arr1)) {
                 foreach ($arr1 as $key => $val) {
                     $val = jfilter($val, 'txt');
                     $val = addslashes($val);
                     $sets[$key] = "`{$key}`='{$val}'";
                 }
             }
             $sql = "update `" . TABLE_PREFIX . "memberfields` set " . implode(" , ", $sets) . " where `uid`='" . MEMBER_ID . "'";
             $this->DatabaseHandler->Query($sql);
         }
     }
     $this->Messager("修改成功", '', 1);
 }
 public function search($keyword = '')
 {
     $rets = array();
     $keyword = jfilter($keyword, 'txt');
     $search = jconf::get('profilesearch');
     if ($keyword && $search) {
         $sql_where = build_like_query("`" . implode("`, `", array_keys($search)) . "`", $keyword);
         if ($sql_where) {
             $sql_where .= " AND `last_update`>'" . (strtotime(date('Y-m-d')) - 86400000) . "' ";
             $p = array('cache_time' => 300, 'result_count' => 300, 'sql_where' => $sql_where, 'sql_order' => ' `last_update` DESC, `uid` DESC ');
             $rets = jtable('members_profile')->get_ids($p, 'uid');
         }
     }
     return $rets;
 }
Esempio n. 30
0
function get_param($key, $method = 'PG', $filter = '')
{
    $method = strtoupper($method);
    switch ($method) {
        case 'POST':
        case 'P':
            $var =& $_POST;
            break;
        case 'GET':
        case 'G':
            $var =& $_GET;
            break;
        case 'COOKIE':
        case 'C':
            $var =& $_COOKIE;
            break;
        default:
            if (isset($_POST[$key])) {
                $var =& $_POST;
            } else {
                $var =& $_GET;
            }
            break;
    }
    $val = isset($var[$key]) ? $var[$key] : null;
    if ($filter) {
        $val = jfilter($val, $filter);
    }
    return $val;
}