Example #1
0
 function Main()
 {
     $uid = MEMBER_ID;
     if ($uid < 1) {
         $this->Messager("请先<a href='index.php?mod=login'>点此登录</a>或者<a href='index.php?mod=member'>点此注册</a>一个帐号", 'index.php?mod=login');
     }
     $member = jsg_member_info($uid);
     $sql = "select * from `" . TABLE_PREFIX . "blacklist` where `uid` = '" . MEMBER_ID . "' ";
     $query = $this->DatabaseHandler->Query($sql);
     $uids = array();
     while (false != ($row = $query->GetRow())) {
         $uids[$row['touid']] = $row['touid'];
     }
     if ($uids) {
         $where = "where `uid` in (" . jimplode($uids) . ")";
         $member_list = $this->_MemberList($where);
         if ($uids && MEMBER_ID > 0) {
             $sql = "select `uid`,`tid`,`content`,`dateline` from `" . TABLE_PREFIX . "topic` where `uid` in (" . jimplode($uids) . ") group by `uid` order by `dateline` desc";
             $query = $this->DatabaseHandler->Query($sql);
             $topic_list = array();
             while (false != ($row = $query->GetRow())) {
                 $row['content'] = cut_str($row['content'], 100);
                 $row['dateline'] = my_date_format2($row['dateline']);
                 $topic_list[] = $row;
             }
         }
     }
     $group_list = jlogic('buddy_follow_group')->get_my_group(MEMBER_ID);
     $this->Title = '黑名单';
     include template('social/blacklist');
 }
Example #2
0
 public function new_topic($p)
 {
     $ps = array('cache_time' => max(0, (int) $p['cache_time']), 'page_url' => $p['page_url']);
     if (isset($p['perpage'])) {
         $ps['perpage'] = (int) $p['perpage'];
     }
     $ps['cache_key'] = 'topic-new_topic';
     $ps['order'] = ' `dateline` DESC ';
     $ps['where'] = ' `type` IN (' . jimplode(get_topic_type()) . ') ';
     return $this->_get($ps);
 }
 function CategoryUserList($where = '', $limit = '', $query_link = '', $orderby = 'uid')
 {
     $per_page_num = $limit ? $limit : 20;
     $p = array('cache_time' => 300, 'cache_file' => 1, 'sql_where' => $where, 'sql_order' => ' `id` DESC ');
     $uds = jtable('validate_category_fields')->get_ids($p, 'uid');
     if ($uds) {
         $total_record = count($uds);
         $page_arr = page($total_record, $per_page_num, $query_link, array('return' => 'array'));
         $wherelist = "where `uid` in (" . jimplode($uds) . ") and `city` !='' order by `{$orderby}` desc  {$page_arr['limit']} ";
         $TopicLogic = jlogic('topic');
         $members = $TopicLogic->GetMember($wherelist, "`uid`,`ucuid`,`media_id`,`aboutme`,`username`,`nickname`,`province`,`city`,`face_url`,`face`,`validate`");
         $members = buddy_follow_html($members, 'uid', 'follow_html2');
     }
     $user_ary = array('member' => $members, 'uids' => $uds, 'pagearr' => $page_arr);
     return $user_ary;
 }
Example #4
0
 function get_token($uids)
 {
     $token = array();
     $uids = is_array($uids) ? $uids : (is_numeric($uids) && $uids > 0 ? array($uids) : ('all' == $uids ? $uids : array()));
     if ($uids) {
         if ('all' == $uids) {
             $query = DB::query("SELECT `token` FROM " . DB::table('ios'));
         } else {
             $query = DB::query("SELECT `token` FROM " . DB::table('ios') . " where uid IN (" . jimplode($uids) . ")");
         }
         while ($value = DB::fetch($query)) {
             $token[] = $value['token'];
         }
     }
     return $token;
 }
Example #5
0
 function delete_feed($p = array())
 {
     $time = TIMESTAMP;
     if ($p['all']) {
         DB::Query("delete from " . DB::table('feed_log'));
     } elseif ($p['week']) {
         $time = $time - 7 * 24 * 3600;
         DB::Query("delete from " . DB::table('feed_log') . " where `dateline` < '{$time}'");
     } elseif ($p['month']) {
         $time = $time - 30 * 24 * 3600;
         DB::Query("delete from " . DB::table('feed_log') . " where `dateline` < '{$time}'");
     } elseif ($p['ids']) {
         $dids = is_array($p['ids']) ? $p['ids'] : (array) $p['ids'];
         DB::Query("delete from " . DB::table('feed_log') . " where `id` in(" . jimplode($dids) . ")");
     }
 }
 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("修改成功");
 }
Example #7
0
 function attach_list($ids)
 {
     $ids = $this->get_ids($ids, 0, 1);
     $list = array();
     if ($ids) {
         $query = DB::query("SELECT * FROM " . DB::table('topic_attach') . " WHERE id IN(" . jimplode($ids) . ")");
         $candown = jclass('member')->HasPermission('uploadattach', 'down');
         $canviewtype = array('doc', 'ppt', 'pdf', 'xls', 'txt', 'docx', 'xlsx', 'pptx');
         while ($attach = DB::fetch($query)) {
             $attach_img = $attach['filetype'];
             $attach_name = $attach['name'];
             $attach_size = $attach['filesize'];
             $attach_down = $attach['download'];
             $attach_size = $attach_size > 1024 * 1024 ? round($attach_size / (1024 * 1024), 2) . 'MB' : ($attach_size == 0 ? '未知' : round($attach_size / 1024, 1) . 'KB');
             $attach_score = $attach['score'];
             $attach_file = RELATIVE_ROOT_PATH . $attach['file'];
             $attach_url = ($attach['site_url'] ? $attach['site_url'] : $GLOBALS['_J']['site_url']) . '/' . str_replace('./', '', $attach['file']);
             $list[$attach['id']] = array('id' => $attach['id'], 'attach_img' => 'images/filetype/' . $attach_img . '.gif', 'attach_file' => $attach_file, 'attach_name' => $attach_name, 'attach_score' => $attach_score, 'attach_down' => $attach_down, 'attach_size' => '大小:' . $attach_size, 'url' => $attach_url, 'onlineview' => $candown && in_array($attach_img, $canviewtype) && $attach_score == 0 ? $attach_url : '');
         }
     }
     return $list;
 }
Example #8
0
function app_itemid2tid($item, $item_id, $options = null)
{
    $table_name = app_table($item);
    if (!$table_name) {
        return array();
    }
    if ($item == 'talk' && $options['talkwhere']) {
        $where_sql = $options['talkwhere'];
    } else {
        $where_sql = ' 1 ';
    }
    if (is_array($item_id)) {
        $where_sql .= " AND item_id IN (" . jimplode($item_id) . ") ";
    } else {
        $where_sql .= " AND item_id='{$item_id}' ";
    }
    $query = DB::query("SELECT tid FROM " . DB::table($table_name) . " WHERE {$where_sql} ");
    $tid_ary = array();
    while ($value = DB::fetch($query)) {
        $tid_ary[] = $value['tid'];
    }
    return $tid_ary;
}
Example #9
0
 function iframe_recommend()
 {
     $ids = (int) (jget('ids') ? jget('ids') : jget('id'));
     if ($ids < 1) {
         exit('ids is empty');
     }
     $sql = " select * from `" . TABLE_PREFIX . "share` where `id` = '{$ids}' ";
     $query = $this->DatabaseHandler->Query($sql);
     $sharelist = $query->GetRow();
     if (!$sharelist) {
         exit('ids is invalid');
     }
     $share = @unserialize($sharelist['show_style']);
     $topic_charset = $share['topic_charset'];
     $share['limit'] = max(0, (int) $share['limit']);
     if ($share['limit'] < 1 || $share['limit'] > 200) {
         $share['limit'] = 20;
     }
     $share['string'] = max(0, (int) $share['string']);
     $order = ' `dateline` DESC ';
     $condition = '';
     $rets = $topic_list = array();
     if ('live' == $sharelist['type']) {
         $rr = jlogic('live')->get_script_out_list(1, $share['limit'], $share['string']);
         $rets = $live_list = $rr;
     } else {
         $user_topic_list = '';
         if ('topic' == $sharelist['type']) {
             $nickname = '';
             if ($sharelist['nickname']) {
                 $nickname = $sharelist['nickname'];
             } else {
                 $nickname = get_safe_code(jget('nickname'));
             }
             if ($nickname) {
                 $ns = explode('|', $nickname);
                 $uids = jtable('members')->get_ids(array('nickname' => $ns, 'result_count' => count($ns)), 'uid');
                 if (!$uids) {
                     exit('nickname is invalid');
                 }
                 $user_topic_list = " `uid` IN (" . jimplode($uids) . ") ";
             }
         }
         $tag_condition = '';
         if ('tag' == $sharelist['type']) {
             $tag = '';
             if ($sharelist['tag']) {
                 $tag = $sharelist['tag'];
             } else {
                 $tag = get_safe_code(jget('tag'));
             }
             if ($tag) {
                 $ts = explode('|', $tag);
                 $tagids = jtable('tag')->get_ids(array('name' => $ts, 'result_count' => count($ts)), 'id');
                 if (!$tagids) {
                     exit('tag is invalid');
                 }
                 $tids = jtable('topic_tag')->get_ids(array('tag_id' => $tagids, 'result_count' => $share['limit'], 'sql_order' => ' `dateline` DESC '), 'item_id');
                 if ($tids) {
                     $tag_condition = " `tid` IN (" . jimplode($tids) . ") ";
                     $topic_list = jlogic('topic')->Get($tids);
                 }
             }
         }
         $channel_condition = '';
         if ('channel' == $sharelist['type']) {
             $cids = array();
             if ($share['channel']['name']) {
                 $cname = $share['channel']['name'];
             } else {
                 $channel_id = jget('channel_id', 'int');
                 if ($channel_id > 0) {
                     $cids[$channel_id] = $channel_id;
                 } else {
                     $cname = jget('channel') ? jget('channel') : (jget('channel_name') ? jget('channel_name') : jget('ch_name'));
                 }
             }
             if ($cname) {
                 $ns = explode('|', $cname);
                 $cids = jtable('channel')->get_ids(array('ch_name' => $ns, 'result_count' => count($ns)), 'ch_id');
                 if (!$cids) {
                     exit('channel is invalid');
                 }
             }
             if ($cids) {
                 $condition = " `item`='channel' AND `item_id` IN(" . jimplode($cids) . ") ";
             }
         }
         if ('recommend' == $sharelist['type']) {
             $p = array('sql_order' => ' `dateline` DESC ', 'result_count' => $share['limit']);
             $its = array();
             $item = $share['recommend']['item'];
             if ($item) {
                 $its = $share['recommend']['item_id'];
             } else {
                 $item = jget('item', 'txt');
                 $its = jget('item_id', 'txt');
             }
             if (in_array($item, array('qun', 'channel')) && $its) {
                 ${$item_id . '_id'} = $its;
                 $p['item_id'] = explode('|', $its);
                 $p['item'] = $item;
             }
             $tids = jtable('topic_recommend')->get_ids($p, 'tid');
             if ($tids) {
                 $topic_list = jlogic('topic')->Get($tids);
             }
             foreach ($topic_list as $key_one => $topic_one) {
                 $sql = " select r_title from `" . TABLE_PREFIX . "topic_recommend` where tid = " . $topic_one['tid'];
                 $topic_list[$key_one]['recd_title'] = DB::result_first($sql);
             }
         }
         if ('live_weibo' == $sharelist['type']) {
             $live_id = (int) $share['live_weibo']['item_id'];
             $live_item = $share['live_weibo']['item'];
             if ($live_id > 0) {
                 $live_info = jlogic('live')->id2liveinfo($live_id);
                 $live_uids = array();
                 foreach ($live_info['all'] as $k => $v) {
                     $live_uids[$k] = $k;
                 }
                 $p = array('limit' => $share['limit']);
                 if ('live_all' == $live_item) {
                 } elseif ('live_other' == $live_item) {
                     $p['where'] = ' `uid` NOT IN (' . jimplode($live_uids) . ') ';
                 } else {
                     $p['where'] = " `uid` IN (" . jimplode($live_uids) . ") ";
                 }
                 jfunc('app');
                 $rets = app_get_topic_list('live', $live_id, $p);
                 $topic_list = $rets['list'];
             }
         }
         if ($tag_condition) {
             $condition = " {$tag_condition} AND `type` = 'first' ";
         } elseif ($user_topic_list) {
             $condition = " {$user_topic_list} AND `type` = 'first' ";
         }
         if (!$condition) {
             $condition = " `type` = 'first' ";
         }
         $gorder = jget('order');
         $where = " WHERE {$condition} ORDER BY {$order} LIMIT {$share['limit']} ";
         if (!$topic_list) {
             $topic_list = $this->TopicLogic->Get($where);
         }
         if ($topic_list) {
             if (!$share['hold_tags']) {
                 foreach ($topic_list as $k => $v) {
                     $topic_list[$k]['content'] = stripslashes($topic_list[$k]['content']);
                     $topic_list[$k]['content'] = strip_tags($topic_list[$k]['content']);
                     if ($share['string'] > 0) {
                         $topic_list[$k]['content'] = cut_str($topic_list[$k]['content'], $share['string']);
                         $topic_list[$k]['recd_title'] = cut_str($topic_list[$k]['recd_title'], $share['string']);
                     }
                 }
             }
         }
         $rets = $topic_list;
     }
     $output = jget('output');
     if ('json' == $output) {
         $rets = array_values($rets);
         $rets = array_iconv($this->Config['charset'], 'utf-8', $rets);
         echo json_encode($rets);
     } else {
         ob_start();
         include template('share/sharetemp_' . $ids);
         $content = ob_get_contents();
         ob_clean();
         $content = str_replace(array("\r\n", "\n", "\r"), "", $content);
         $content = str_replace("'", "\\'", $content);
         $content = str_replace("/http", "http", $content);
         $content = str_replace("index.php?", $this->Config['site_url'] . '/index.php?', $content);
         $content = str_replace($this->Config['site_url'] . "/" . $this->Config['site_url'], $this->Config['site_url'], $content);
         #开启伪静态以后加网址
         $content = str_replace('href="/', 'href="' . $this->Config['site_url'] . '/', $content);
         $content = str_replace('target="_blank"', "", $content);
         $content = str_replace('<a ', '<a target="_blank" ', $content);
         $content = preg_replace(array("/[\r\n]+/s", "/\\>\\s+\\</", "/\\>\\s+/", "/\\s+\\</"), array("", "><", ">", "<"), $content);
         if (strtoupper($this->Config['charset']) != strtoupper($share['topic_charset'])) {
             @header('Content-Type: text/html; charset=' . $share['topic_charset']);
             $content = array_iconv($this->Config['charset'], $share['topic_charset'], $content);
         }
         if ('iframe' == $output) {
             echo $content;
         } else {
             echo "document.write('{$content}');";
         }
     }
     exit;
 }
Example #10
0
 function Getguest($ids)
 {
     $list = array();
     $uids = array();
     $guests = array();
     $ids = is_array($ids) ? $ids : array((int) $ids);
     $query = DB::query("SELECT iid,itemid,uid,description,type FROM " . DB::table('item_user') . " WHERE item = 'talk' AND itemid IN(" . jimplode($ids) . ")");
     while ($row = DB::fetch($query)) {
         $uids[] = $row['uid'];
         $guests[$row['itemid']][$row['uid']]['type'] = $row['type'];
         $guests[$row['itemid']][$row['uid']]['iid'] = $row['iid'];
         $guests[$row['itemid']][$row['uid']]['description'] = $row['description'];
     }
     $uids = array_unique($uids);
     $users = array();
     $userss = $this->TopicLogic->GetMember($uids, "`uid`,`ucuid`,`username`,`nickname`,`face`,`face_url`,`fans_count`,`validate`,`validate_category`");
     foreach ($userss as $val) {
         $users[$val['uid']] = $val;
     }
     unset($userss);
     foreach ($guests as $key => $val) {
         $guests_g = array();
         $guests_h = array();
         $guests_m = array();
         $guests_hg = array();
         $guests_a = array();
         foreach ($val as $k => $v) {
             $guests_a[$key][$k] = $guests[$key][$k]['type'];
             if ($guests[$key][$k]['type'] == 'guest') {
                 unset($guests[$key][$k]['type']);
                 $guests_g[$key][$k] = array_merge($users[$k], $guests[$key][$k]);
                 $guests_hg[$key][$k] = $users[$k]['nickname'];
             } elseif ($guests[$key][$k]['type'] == 'host') {
                 unset($guests[$key][$k]['type']);
                 $guests_h[$key][$k] = array_merge($users[$k], $guests[$key][$k]);
                 $guests_hg[$key][$k] = $users[$k]['nickname'];
             } elseif ($guests[$key][$k]['type'] == 'media') {
                 unset($guests[$key][$k]['type']);
                 $guests_m[$key][$k] = array_merge($users[$k], $guests[$key][$k]);
             }
         }
         $list[$key]['guest'] = $guests_g[$key];
         $list[$key]['host'] = $guests_h[$key];
         $list[$key]['media'] = $guests_m[$key];
         $list[$key]['host_guest'] = $guests_hg[$key];
         $list[$key]['all'] = $guests_a[$key];
     }
     return $list;
 }
Example #11
0
 function getDigUser()
 {
     $dateline = time() - 7 * 24 * 3600;
     $sql = " SELECT `uid`,count(*) as num FROM `" . DB::table('topic_dig') . "` WHERE `dateline` > '{$dateline}' GROUP BY uid ORDER BY num DESC , dateline DESC  ";
     $query = DB::query($sql);
     $uid = array();
     while ($rs = DB::fetch($query)) {
         $uid[$rs['uid']] = $rs['uid'];
     }
     if ($uid) {
         $members = jlogic('topic')->GetMember(" WHERE `uid` in (" . jimplode($uid) . ") ORDER BY `fans_count` DESC limit 10 ", "`uid`,`ucuid`,`username`,`validate`,`validate_category`,`face`,`nickname`");
     }
     return $members;
 }
Example #12
0
 function delete_ploy($ids)
 {
     $ids = (array) $ids;
     $where_sql = jimplode($ids);
     DB::query("DELETE FROM " . DB::table('qun_ploy') . " WHERE id IN({$where_sql})");
 }
Example #13
0
 function delZone()
 {
     $area = $this->Get['area'];
     $city = $this->Get['city'];
     $fid = $this->Get['fid'];
     $id_arr = array();
     if ($fid) {
         $id_arr = $this->getNextId($fid);
         $id_arr[$fid] = $fid;
     }
     if ($id_arr) {
         $id_list = jimplode($id_arr);
         $this->DatabaseHandler->Query("delete from `" . TABLE_PREFIX . "common_district` where id in ({$id_list})");
     }
     $this->Messager("区域删除成功", "admin.php?mod=city&code=zone&area={$area}&city={$city}");
 }
Example #14
0
 function TagSearch()
 {
     $per_page_num = 10;
     $topic_parent_disable = false;
     $query_link = 'index.php?mod=search&code=tag';
     $tag = trim(get_param('tag'));
     if ($tag) {
         $tag = get_safe_code($tag);
         $tag = $this->_filterKeyword($tag);
         $search_keyword = $tag;
         $_GET['highlight'] = $search_keyword;
         $cache_time = 600;
         $cache_key = "tag-search-{$tag}";
         if (false === ($topic_ids = cache_db('mget', $cache_key))) {
             $sql = "select `id` from `" . TABLE_PREFIX . "tag` WHERE " . build_like_query('`name`', $tag) . " ORDER BY `last_post` DESC LIMIT {$this->cache_ids_limit} ";
             $query = $this->DatabaseHandler->Query($sql);
             $tag_id = array();
             while (false != ($row = $query->GetRow())) {
                 $tag_id[$row['id']] = $row['id'];
             }
             $topic_ids = array();
             if ($tag_id) {
                 $sql = "SELECT `item_id` FROM `" . TABLE_PREFIX . "topic_tag` WHERE `tag_id` in(" . jimplode($tag_id) . ") ORDER BY `item_id` DESC LIMIT {$this->cache_ids_limit} ";
                 $query = $this->DatabaseHandler->Query($sql);
                 while (false != ($row = $query->GetRow())) {
                     $topic_ids[$row['item_id']] = $row['item_id'];
                 }
             }
             cache_db('mset', $cache_key, $topic_ids, $cache_time);
         }
         $topic_ids = filter_tids($topic_ids);
         if ($topic_ids) {
             $where = " `tid` in('" . implode("','", $topic_ids) . "') ";
         }
         $query_link .= "&tag=" . urlencode($tag);
     }
     if ($where) {
         $options = array('where' => $where, 'type' => get_topic_type(), 'order' => ' `dateline` desc ', 'page_url' => $query_link, 'perpage' => $per_page_num);
         $info = $this->TopicListLogic->get_data($options);
         $topic_list = array();
         $total_record = 0;
         if (!empty($info)) {
             $topic_list = $info['list'];
             $total_record = $info['count'];
             $page_arr = $info['page'];
         }
         $topic_list_count = 0;
         if ($topic_list) {
             $topic_list_count = count($topic_list);
             if (!$topic_parent_disable) {
                 $parent_list = $this->TopicLogic->GetParentTopic($topic_list);
             }
         }
     }
     $member = jsg_member_info(MEMBER_ID);
     if ($member['medal_id']) {
         $medal_list = $this->TopicLogic->GetMedal($member['medal_id'], $member['uid']);
     }
     $this->Title = "话题搜索";
     include template('social/search_list');
 }
Example #15
0
 function index()
 {
     $view = empty($this->Get['view']) ? '' : trim($this->Get['view']);
     $filter = empty($this->Get['filter']) ? '' : trim($this->Get['filter']);
     $uid = empty($this->Get['uid']) ? 0 : intval($this->Get['uid']);
     $gets = array('mod' => 'vote', 'view' => $this->Get['view'], 'filter' => $this->Get['filter']);
     $page_url = 'index.php?' . url_implode($gets);
     $perpage = $this->ShowConfig['vote']['list'];
     $perpage = empty($perpage) ? 20 : $perpage;
     $tpl = 'vote/vote_index';
     $where_sql = " 1 ";
     switch ($view) {
         case 'new':
             $this->Title = '最新投票';
             $order_sql = ' ORDER BY dateline DESC ';
             break;
         case 'me':
             if ($uid && $uid != MEMBER_ID) {
                 $user_info = $this->TopicLogic->GetMember($uid);
                 $this->Title = $user_info['nickname'] . '发起的投票';
                 if (empty($user_info)) {
                     $this->Messager("当前页面不存在", 'index.php?mod=vote');
                 }
                 $tpl = 'vote/vote_me';
             } else {
                 $this->_check_login();
                 $this->Title = '我的投票';
                 $uid = MEMBER_ID;
             }
             if ($filter == 'joined') {
                 $vids = $this->VoteLogic->get_joined($uid);
                 if (!empty($vids)) {
                     $where_sql .= " AND `v`.`vid` IN(" . jimplode($vids) . ") ";
                 } else {
                     $where_sql = ' 0 ';
                 }
             } else {
                 if ($filter == 'new_update') {
                     jlogic('member')->clean_new_remind('vote_new', $uid);
                     $vids = $this->VoteLogic->get_joined($uid);
                     if (!empty($vids)) {
                         $where_sql .= " AND `v`.`vid` IN(" . jimplode($vids) . ") ";
                     }
                     $where_sql .= " OR `v`.`uid`='{$uid}' ";
                 } else {
                     $where_sql .= " AND `v`.`uid`='{$uid}' ";
                     $filter = 'created';
                 }
             }
             $order_sql = ' ORDER BY lastvote DESC ';
             break;
         case 'fllow':
             $this->_check_login();
             $this->Title = '我关注的人的投票';
             $buddyids = get_buddyids(MEMBER_ID);
             if ($filter == 'joined') {
                 $vids = $this->VoteLogic->get_joined($buddyids);
                 if (!empty($vids)) {
                     $where_sql .= " AND `v`.`vid` IN(" . jimplode($vids) . ") ";
                 } else {
                     $where_sql = ' 0 ';
                 }
             } else {
                 if (!empty($buddyids)) {
                     $where_sql .= " AND `v`.`uid` IN (" . jimplode($buddyids) . ") ";
                 } else {
                     $where_sql = ' 0 ';
                 }
                 $filter = 'created';
             }
             $order_sql = ' ORDER BY dateline DESC ';
             break;
         default:
             $this->Title = '最新参与投票';
             $view = 'newjoin';
             $where_sql .= " AND v.expiration >= '" . time() . "' AND v.lastvote > 0 ";
             $order_sql = ' ORDER BY v.lastvote DESC ';
             break;
     }
     if (!empty($filter)) {
         $filter_on[$filter] = 'class="v_on"';
     }
     $where_sql .= " AND v.verify = 1";
     $param = array('where' => $where_sql, 'order' => $order_sql, 'page' => true, 'perpage' => $perpage, 'page_url' => $page_url);
     $vote_info = $this->VoteLogic->find($param);
     $count = 0;
     $vote_list = array();
     $page_arr['html'] = '';
     $uid_ary = array();
     if (!empty($vote_info)) {
         $count = $vote_info['count'];
         $vote_list = $vote_info['vote_list'];
         $page_arr['html'] = $vote_info['page']['html'];
         $uid_ary = $vote_info['uids'];
     }
     if (!empty($uid_ary)) {
         $members = $this->TopicLogic->GetMember($uid_ary);
     }
     $this->Title .= ' | 微博投票';
     $active[$view] = 'class="tago"';
     $member = jsg_member_info(MEMBER_ID);
     if ($member['medal_id']) {
         $medal_list = $this->TopicLogic->GetMedal($member['medal_id'], $member['uid']);
     }
     $recd_list = $this->VoteLogic->get_recd_list();
     include template($tpl);
 }
Example #16
0
 function members()
 {
     $qid = intval(trim($this->Get['qid']));
     if (empty($qid)) {
         $this->Messager('错误的操作');
     }
     $qun_info = $this->QunLogic->get_qun_info($qid);
     if (empty($qun_info)) {
         $this->Messager('当前' . $this->Config[changeword][weiqun] . '不存在或者已经被删除了');
     }
     $type = trim($this->Get['type']);
     $page = intval(trim($this->Get['page']));
     $page = $page == 0 ? 1 : $page;
     $perpage = 60;
     $gets = array('mod' => 'qun', 'code' => 'members', 'type' => $type, 'qid' => $qid);
     $page_url = 'index.php?' . url_implode($gets);
     if ($type == 'followed') {
         $followed_ids = get_buddyids(MEMBER_ID);
         if (empty($followed_ids)) {
             $where_sql = ' 0 ';
         } else {
             $where_sql = " qid='{$qid}' AND uid IN(" . jimplode($followed_ids) . ") ";
         }
     } else {
         if ($page == 1) {
             $founder_info = array();
             $founderuid = DB::result_first("SELECT uid\r\n\t\t\t\t\t\t\t\t\t\t\t\tFROM " . DB::table('qun_user') . "\r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE qid='{$qid}' AND level=1");
             $founder_info = $this->TopicLogic->GetMember($founderuid, 'uid,username,nickname,face');
             $admin_ary = array();
             $admin_nums = 0;
             $admin_ids = array();
             $query = DB::query("SELECT uid FROM " . DB::table('qun_user') . " WHERE qid='{$qid}' AND level=2");
             while ($value = DB::fetch($query)) {
                 $admin_ids[] = $value['uid'];
             }
             if (!empty($admin_ids)) {
                 $admin_ary = $this->TopicLogic->GetMember($admin_ids, 'uid,username,nickname,face');
                 $admin_nums = count($admin_ary);
             }
         }
         $where_sql = " qid='{$qid}' AND level=4 ";
     }
     $members = $member_ids = array();
     $count = DB::result_first("SELECT COUNT(*) FROM " . DB::table('qun_user') . " WHERE {$where_sql} ");
     if ($count) {
         $_config = array('return' => 'array');
         $page_arr = page($count, $perpage, $page_url, $_config);
         $query = DB::query("SELECT uid\r\n\t\t\t\t\t\t\t\tFROM " . DB::table('qun_user') . "\r\n\t\t\t\t\t\t\t\tWHERE {$where_sql}\r\n\t\t\t\t\t\t\t\t{$page_arr['limit']} ");
         while ($value = DB::fetch($query)) {
             $member_ids[] = $value['uid'];
         }
         $members = $this->TopicLogic->GetMember($member_ids, 'uid,username,nickname,face');
     }
     $uid = MEMBER_ID;
     $buddyids = get_buddyids($uid);
     $this->Title = $this->Config[changeword][weiqun] . " - " . $qun_info['name'] . "的成员";
     include_once template('qun/members');
 }
Example #17
0
 function view()
 {
     $lid = jget('id', 'int', 'G');
     if (!$this->TalkLogic->is_exists($lid)) {
         return false;
     }
     $list = $this->TalkLogic->Getguest($lid);
     $this->item = 'talk';
     $this->item_id = $item_id = $lid;
     $talk = $this->TalkLogic->id2talkinfo($lid, $list);
     $uids = array();
     $gets = array('mod' => 'talk', 'code' => 'view', 'id' => $lid);
     $page_url = 'index.php?' . url_implode($gets);
     $perpage = $talk['status_css'] == 'ico_ongoing' ? 1000 : 20;
     $options = array('page' => true, 'perpage' => $perpage, 'page_url' => $page_url, 'order' => ' dateline DESC ');
     if (empty($talk)) {
         $this->Messager('当前访谈不存在!');
     } elseif ($talk['all']) {
         $defaust_value = '&nbsp;<font color="#0080c7">我有一个想法和大家分享</font>';
         foreach ($talk['all'] as $key => $val) {
             $uids[$key] = $key;
         }
     }
     if ($talk['status_css'] == 'ico_ongoing') {
         $talklistcss = ' talk-list';
         $asklistcss = ' ask-list';
     }
     $is_talk_hosts = in_array(MEMBER_ID, $uids) ? true : false;
     $talkvisit_str = $this->Config['site_url'] . '/index.php?mod=talk&code=view&id=' . $lid;
     $cat = $this->TalkLogic->get_category($talk['cat_id'], 'second');
     $catp = $this->TalkLogic->get_category($cat['parent_id'], 'first');
     $talk_config = jconf::get('talk');
     if (MEMBER_STYLE_THREE_TOL) {
         $member = $this->TopicLogic->GetMember(MEMBER_ID);
     }
     $param = array('limit' => '5');
     $talk_info = $this->TalkLogic->get_list($param);
     if (!empty($talk_info)) {
         $talk_count = $talk_info['count'];
         $talk_list = $talk_info['list'];
     }
     jfunc('app');
     $options['talkwhere'] = ' uid NOT IN (' . jimplode($uids) . ')';
     $topic_info = app_get_topic_list('talk', $lid, $options);
     $options['talkwhere'] = ' totid > 0';
     $answer_info = app_get_topic_list('talk', $lid, $options);
     $options['talkwhere'] = ' istop = 1';
     $options['order'] = ' lastupdate DESC ';
     $question_info = app_get_topic_list('talk', $lid, $options);
     $myanswerids = app_getmyanswerid($lid);
     if (!empty($topic_info['list'])) {
         $topic_list = $topic_info['list'];
         foreach ($topic_list as $key => $val) {
             if (in_array($val['tid'], $myanswerids) && $talk[status_css] == 'ico_ongoing') {
                 $topic_list[$key]['reply_ok'] = true;
             }
         }
         $topic_count = $topic_info['count'];
         $topic_page_arr = $topic_info['page'];
     }
     if (!empty($question_info['list'])) {
         $question_list = $question_info['list'];
         $ask_count = $question_info['count'];
         $ask_page_arr = $question_info['page'];
         foreach ($question_list as $key => $val) {
             $ask_info = array();
             $u_t = $this->TalkLogic->id2usertype($lid, $val['uid'], $list);
             if ($u_t == 'guest') {
                 $question_list[$key]['user_str'] = '本期嘉宾';
             } else {
                 $question_list[$key]['user_str'] = '&nbsp;';
             }
             $question_list[$key]['user_css'] = 'talk' . $u_t;
             if (empty($question_list[$key]['touid'])) {
                 $question_list[$key]['biank_css'] = 'talk_view_ping';
                 $question_list[$key]['tubiao_css'] = 'talk_view_pin';
             } else {
                 $question_list[$key]['biank_css'] = 'talk_view_wenda';
                 $question_list[$key]['tubiao_css'] = 'talk_view_wen';
                 if (!empty($answer_info['list'])) {
                     foreach ($answer_info['list'] as $k => $v) {
                         if ($v['totid'] == $val['tid']) {
                             $ask_info['list'][$k] = $v;
                         }
                     }
                 }
                 if (!empty($ask_info)) {
                     $question_list[$key]['ask_list'] = $ask_info['list'];
                     foreach ($question_list[$key]['ask_list'] as $k => $v) {
                         $u_ta = $this->TalkLogic->id2usertype($lid, $v['uid'], $list);
                         if ($u_ta == 'guest') {
                             $question_list[$key]['ask_list'][$k]['user_str'] = '本期嘉宾';
                         } else {
                             $question_list[$key]['ask_list'][$k]['user_str'] = '&nbsp;';
                         }
                         $question_list[$key]['ask_list'][$k]['tubiao_css'] = 'talk_view_da';
                         $question_list[$key]['ask_list'][$k]['user_css'] = 'talk' . $u_ta;
                     }
                 }
             }
         }
     }
     $this->Title = '访谈 - ' . $talk['talkname'];
     $albums = jlogic('image')->getalbum();
     include template("talk/talk");
 }
Example #18
0
 function channeltype()
 {
     $do = jget('do');
     if ('delete' == $do) {
         $ids = (array) ($this->Post['ids'] ? $this->Post['ids'] : $this->Get['ids']);
         if (!$ids) {
             $this->Messager("请指定要删除的对象");
         }
         $return = jlogic('channel')->delete_channel_type($ids);
         if ($return) {
             if ($return['noids']) {
                 $this->Messager("类型[" . jimplode($return['ids']) . "]删除成功,类型[" . jimplode($return['noids']) . "]删除失败");
             } else {
                 $this->Messager("频道类型(模型)删除成功");
             }
         } else {
             $this->Messager("删除失败,类型已被频道使用,不可删除");
         }
     } elseif ('add' == $do) {
         $channel_typename = strip_tags($this->Post['channel_typename']);
         $channel_type = strip_tags($this->Post['channel_type']);
         if (empty($channel_typename)) {
             $this->Messager("请输入类型名称", -1);
         }
         if (empty($channel_type)) {
             $this->Messager("请输入类型标识符", -1);
         }
         if (!preg_match("/^[a-z]+\$/i", $channel_type)) {
             $this->Messager("类型标识符[" . $channel_type . "]不合法", -1);
         }
         $return = jlogic('channel')->add_channel_type($channel_typename, $channel_type);
         if ($return > 0) {
             $this->Messager("添加成功", 'admin.php?mod=channel&code=channeltype');
         } else {
             $this->Messager("频道类型名称已经存在或标识符不唯一", -1);
         }
     } elseif ('modify' == $do) {
         $ids = (int) $this->Get['ids'];
         $channel_typelist = jlogic('channel')->get_channel_typebyid($ids);
         $feature_list = jlogic('channel')->get_feature_formdata();
         $featurehtml = $this->jishigou_form->CheckBox('featureid[]', $feature_list, explode(',', $channel_typelist['featureid']));
     } elseif ('domodify' == $do) {
         $channel_typeid = (int) $this->Post['channel_typeid'];
         $channel_typename = strip_tags($this->Post['channel_typename']);
         $oldchannel_typename = $this->Post['oldchannel_typename'];
         $template = $this->Post['template'];
         $oldtemplate = $this->Post['oldtemplate'];
         $child_template = $this->Post['child_template'];
         $oldchild_template = $this->Post['oldchild_template'];
         $topic_template = $this->Post['topic_template'];
         $oldtopic_template = $this->Post['oldtopic_template'];
         $featureid = is_array($this->Post['featureid']) ? implode(',', $this->Post['featureid']) : '';
         $oldfeatureid = $this->Post['oldfeatureid'];
         $default_feature = $this->Post['default_feature'];
         $olddefault_feature = $this->Post['olddefault_feature'];
         if ($channel_typename != $oldchannel_typename || $template != $oldtemplate || $child_template != $oldchild_template || $topic_template != $oldtopic_template || $featureid != $oldfeatureid || $default_feature != $olddefault_feature) {
             if ($channel_typename != $oldchannel_typename) {
                 $return = jlogic('channel')->check_channel_type_byname($channel_typename);
                 if ($return) {
                     $this->Messager("{$channel_typename} 类型已经存在");
                 }
             }
             if ($template != $oldtemplate || $child_template != $oldchild_template || $topic_template != $oldtopic_template) {
                 $this->_checktemplate(array($template, $child_template, $topic_template));
             }
             jlogic('channel')->modiy_channel_type($channel_typeid, $channel_typename, $template, $child_template, $topic_template, $featureid, $default_feature);
             $this->Messager("编辑成功", 'admin.php?mod=channel&code=channeltype');
         } else {
             $this->Messager("没做任何修改", 'admin.php?mod=channel&code=channeltype');
         }
     } else {
         $per_page_num = min(500, max(20, (int) (isset($_GET['pn']) ? $_GET['pn'] : $_GET['per_page_num'])));
         $info = jlogic('channel')->get_channel_typelist($per_page_num);
         $total_record = $info['total'];
         $page_arr = $info['page'];
         $channel_type_list = $info['list'];
     }
     include template('admin/channel_type');
 }
Example #19
0
 function getCommentList($param)
 {
     $tid = $param['tid'];
     $max_tid = max(0, intval($param['max_tid']));
     $limit = intval($param['limit']);
     if ($limit < 1) {
         $limit = 20;
     }
     $options['limit'] = $limit;
     $offset = $max_tid * $limit;
     $p = array('sql_order' => ' `dateline` DESC ', 'sql_limit' => " {$offset}, {$limit} ");
     $rets = jtable('topic_relation')->get_tids($tid, $p, 1);
     $tids = array();
     if ($rets) {
         $tids = $rets['ids'];
         $total_record = $rets['count'];
     }
     if (isset($param['topic_parent_disable'])) {
         $topic_parent_disable = (bool) $param['topic_parent_disable'];
     } else {
         $topic_parent_disable = false;
     }
     if ($tids) {
         $condition = " `tid` IN (" . jimplode($tids) . ") ";
         $options['where'] = $condition;
         $info = $this->TopicListLogic->get_data($options);
         $topic_list = array();
         if (!empty($info)) {
             $topic_list = $info['list'];
             $topic_list = array_values($topic_list);
             $page_arr = $info['page'];
         }
         if ($topic_list) {
             if (!$topic_parent_disable) {
                 $parent_list = $this->TopicLogic->GetParentTopic($topic_list, 1);
             }
             $result = array('total_record' => $total_record, 'topic_list' => $topic_list, 'parent_list' => $parent_list, 'max_tid' => $max_tid + 1, 'next_page' => 0);
             if (!empty($page_arr)) {
                 $result['next_page'] = $page_arr['current_page'] + 1;
             }
             return $result;
         }
     }
     return 400;
 }
Example #20
0
 function delete_feature($ids = array())
 {
     foreach ($ids as $k => $v) {
         if (in_array($v, array(1, 2, 3))) {
             unset($ids[$k]);
         }
     }
     if ($ids) {
         DB::Query("delete from " . DB::table('feature') . " where `featureid` in(" . jimplode($ids) . ")");
         DB::Query("update " . DB::table('topic') . " set  `featureid` = '0' where `featureid` in(" . jimplode($ids) . ")");
         foreach ($ids as $v) {
             DB::Query("UPDATE " . DB::table('channel_type') . " SET featureid = TRIM(BOTH ',' FROM REPLACE(CONCAT(',',featureid,','),'," . $v . ",',',')) WHERE CONCAT(',',featureid,',') LIKE '%," . $v . ",%'");
         }
         $this->update_feature_cache();
         jlogic('channel')->update_category_cache();
     }
 }
Example #21
0
 function recdqun()
 {
     $cat_id = empty($this->Get['cat_id']) ? 0 : intval(trim($this->Get['cat_id']));
     if (empty($cat_id)) {
         response_text('错误的操作');
     }
     $cat_ary = $this->QunLogic->get_category();
     if (empty($cat_ary)) {
         exit;
     }
     $top_cat_ary = $cat_ary['first'];
     $sub_cat_ary = $cat_ary['second'];
     if (!isset($top_cat_ary[$cat_id])) {
         response_text('当前分类不存在或者已经被删除');
     }
     if (empty($sub_cat_ary)) {
         response_text('当前分类下不存在' . $this->Config[changeword][weiqun]);
     }
     $cat_ids = array();
     foreach ($sub_cat_ary as $value) {
         if ($cat_id == $value['parent_id']) {
             $cat_ids[] = $value['cat_id'];
         }
     }
     $cat_ids[] = $cat_id;
     if (empty($cat_ids)) {
         exit;
     }
     $where_sql = "cat_id IN(" . jimplode($cat_ids) . ")";
     $where_sql .= ' AND gview_perm=0 ';
     $where_sql .= ' AND recd = 1 ';
     $limit = 10;
     $qun_list = array();
     $query = DB::query("SELECT *\r\n\t\t\t\t\t\t\tFROM " . DB::table('qun') . "\r\n\t\t\t\t\t\t\tWHERE {$where_sql}\r\n\t\t\t\t\t\t\tORDER BY member_num DESC\r\n\t\t\t\t\t\t\tLIMIT {$limit}");
     while ($value = DB::fetch($query)) {
         $value['icon'] = $this->QunLogic->qun_avatar($value['qid'], 's');
         $value['desc'] = getstr($value['desc'], 80);
         $qun_list[] = $value;
     }
     include_once template('qun/qun_list');
 }
Example #22
0
 function delete()
 {
     $vid = get_param('vid');
     $id = (int) get_param('id');
     if ($id) {
         $ids[] = $id;
         $vid[] = $id;
     }
     $ids = get_param('ids');
     $rid = get_param('up_id');
     $RewardLogic = jlogic('reward');
     if ($vid) {
         DB::query(" update `" . TABLE_PREFIX . "reward` set `recd` = 0 where `id` in (" . jimplode(',', $vid) . ")");
         foreach ($vid as $k => $v) {
             if ($ids && in_array($v, $ids)) {
                 $RewardLogic->DoDelete($v);
             } else {
                 if ($rid && in_array($v, $rid)) {
                     $recd_id[$v] = $v;
                 }
             }
         }
         if ($recd_id) {
             DB::query(" update `" . TABLE_PREFIX . "reward` set `recd` = 1 where `id` in (" . jimplode(',', $recd_id) . ")");
         }
     }
     $this->Messager('操作成功', 'admin.php?mod=reward');
 }
Example #23
0
 function get_buddyids($uid, $uptime_limit = 0)
 {
     $p = array();
     $cache_time = 0;
     if (is_array($uid)) {
         $p = $uid;
     } else {
         $p['uid'] = $uid;
         if (is_numeric($p['uid'])) {
             $cache_time = 3600;
         }
     }
     if (empty($p['uid'])) {
         return false;
     }
     $p['result_count'] = (int) ($p['result_count'] ? $p['result_count'] : ($p['count'] ? $p['count'] : 999999));
     $upt = max(0, (int) $uptime_limit);
     $uptime_limit = max((int) $p['buddy_lastuptime'], (int) $p['lastuptime'], $upt ? TIMESTAMP - $upt * 86400 : 0);
     if ($cache_time) {
         $uid = (int) $p['uid'];
         $cache_id = "{$uid}-buddyids-" . ($upt ? $upt : $uptime_limit);
         if (false !== ($ret = cache_db('get', $cache_id))) {
             return $ret;
         }
     }
     $table_name = jtable('buddy_follow')->table_name($p['uid']);
     if ($uptime_limit) {
         $limit = min($p['result_count'], 1000);
         $sql = "SELECT M.`uid`\r\n\t\t\tFROM " . DB::table($table_name) . " BF\r\n\t\t\t\tLEFT JOIN " . DB::table('members') . " M ON (M.`uid`=BF.`touid`)\r\n\t\t\tWHERE BF.`uid` IN (" . jimplode($p['uid']) . ") AND M.`lastactivity`>'{$uptime_limit}'\r\n\t\t\tORDER BY `lastactivity` DESC" . ($limit > 0 ? " LIMIT {$limit}" : "");
         $query = DB::query($sql);
         $ret = array();
         while ($row = DB::fetch($query)) {
             $ret[$row['uid']] = $row['uid'];
         }
     } else {
         $ret = jtable('buddy_follow')->get_ids($p, 'touid');
     }
     if ($cache_id && $cache_time) {
         cache_db('set', $cache_id, $ret, $cache_time);
     }
     return $ret;
 }
Example #24
0
 function MakeAll($list, $make_row = 1, $verify = 0)
 {
     if (!$list) {
         return array();
     }
     $tids = array();
     $uids = array();
     $videoids = array();
     $musicids = array();
     $rewardids = array();
     $imageids = array();
     foreach ($list as $k => $v) {
         if (is_array($v) && count($v) && ($v['tid'] > 0 || $verify > 0)) {
             if ($make_row) {
                 $v = $this->Make($v, 1);
             }
             if ($v['uid'] > 0) {
                 $uids[$v['uid']] = $v['uid'];
             }
             if ($v['touid'] > 0) {
                 $uids[$v['touid']] = $v['touid'];
             }
             if ($v['videoid'] > 0) {
                 $videoids[$v['videoid']] = $v['videoid'];
             }
             if ($v['musicid'] > 0) {
                 $musicids[$v['musicid']] = $v['musicid'];
             }
             if ($v['item'] == 'reward' && $v['type'] == 'first' && $v['item_id'] > 0) {
                 $rewardids[$v['item_id']] = $v['item_id'];
             }
             if ($v['imageid']) {
                 $i = explode(",", $v['imageid']);
                 if ($i) {
                     foreach ($i as $key => $val) {
                         $imageids[$val] = $val;
                     }
                 }
             }
             if ($v['attachid']) {
                 $i = explode(",", $v['attachid']);
                 if ($i) {
                     foreach ($i as $key => $val) {
                         $attachids[$val] = $val;
                     }
                 }
             }
         }
         $list[$k] = $v;
     }
     $member_list = array();
     if ($uids) {
         $sql = "SELECT\r\n  M.`uid`,\r\n  M.`ucuid`,\r\n  M.`username`,\r\n  M.`nickname`,\r\n  M.`signature`,\r\n  M.`face_url`,\r\n  M.`face`,\r\n  M.`validate`,\r\n  M.`role_id`,\r\n  M.`validate_category`,\r\n  M.`level`,\r\n  MF.validate_true_name,\r\n  MF.validate_remark\r\nFROM " . DB::table('members') . " M\r\n  LEFT JOIN " . DB::table('memberfields') . " MF\r\n    ON MF.uid = M.uid\r\nWHERE M.uid IN('" . implode("','", $uids) . "')";
         $query = DB::query($sql);
         while (false != ($row = DB::fetch($query))) {
             $member_list[$row['uid']] = jsg_member_make($row);
         }
     }
     $video_list = array();
     if ($videoids) {
         $sql = "SELECT\r\n  `id`,\r\n  `video_hosts`,\r\n  `video_link`,\r\n  `video_img`,\r\n  `video_img_url`,\r\n  `video_url`\r\nFROM " . DB::table('topic_video') . "\r\nWHERE `id` IN('" . implode("','", $videoids) . "')";
         $query = DB::query($sql);
         while (false != ($row = DB::fetch($query))) {
             $video_list[$row['id']] = $row;
         }
     }
     $music_list = array();
     if ($musicids) {
         $sql = "SELECT\r\n  `id`,\r\n  `music_url`,\r\n  `xiami_id`\r\nFROM " . DB::table('topic_music') . "\r\nWHERE `id`IN('" . implode("','", $musicids) . "')";
         $query = DB::query($sql);
         while (false != ($row = DB::fetch($query))) {
             $music_list[$row['id']] = $row;
         }
     }
     $reward_list = array();
     if ($rewardids) {
         $sql = " select `id`,`tid`,`event_image`,`image` from `" . DB::table('reward') . "`  where `id` IN (" . jimplode($rewardids) . ") ";
         $query = DB::query($sql);
         while (false != ($row = DB::fetch($query))) {
             if ($row['event_image'] || $row['image']) {
                 if (!$row['event_image']) {
                     $row['event_image'] = $row['image'];
                 }
                 if (!$rewarImageList[$row['event_image']]) {
                     $rewarImageList[$row['event_image']] = DB::result_first(" select `image` from `" . TABLE_PREFIX . "reward_image` where `id` = '{$row['event_image']}'");
                     $rewarImageList[$row['event_image']] = $rewarImageList[$row['event_image']] ? $rewarImageList[$row['event_image']] : './images/reward_noPic.gif';
                 }
                 $row['event_image'] = $rewarImageList[$row['event_image']];
             } else {
                 $row['event_image'] = './images/reward_noPic.gif';
             }
             $reward_list[$row['id']] = $row;
         }
     }
     $image_list = array();
     if ($imageids) {
         $image_list = jlogic('image')->image_list($imageids);
     }
     $attach_list = array();
     if ($attachids) {
         $attach_list = jlogic('attach')->attach_list($attachids);
     }
     if ($member_list || $video_list || $music_list || $reward_list || $image_list || $attach_list) {
         foreach ($list as $k => $v) {
             if (is_array($v) && count($v) && ($v['tid'] > 0 || $verify > 0)) {
                 if ($v['uid'] > 0 && $member_list[$v['uid']]) {
                     $v = array_merge($v, $member_list[$v['uid']]);
                 }
                 if ($v['touid'] > 0 && $member_list[$v['touid']]) {
                     if ($v['tousername'] != $member_list[$v['touid']]['nickname']) {
                         jtable('topic')->update(array('tousername' => $member_list[$v['touid']]['nickname']), $v['tid']);
                     }
                 }
                 if ($v['videoid'] > 0 && $video_list[$v['videoid']]) {
                     $v['VideoID'] = $video_list[$v['videoid']]['id'];
                     $v['VideoHosts'] = $video_list[$v['videoid']]['video_hosts'];
                     $v['VideoLink'] = $video_list[$v['videoid']]['video_link'];
                     $v['VideoUrl'] = $video_list[$v['videoid']]['video_url'];
                     if ($video_list[$v['videoid']]['video_img']) {
                         $v['VideoImg'] = ($video_list[$v['videoid']]['video_img_url'] ? $video_list[$v['videoid']]['video_img_url'] : $GLOBALS['_J']['config']['site_url']) . '/' . $video_list[$v['videoid']]['video_img'];
                     } else {
                         $v['VideoImg'] = $GLOBALS['_J']['config']['site_url'] . '/images/vd.gif';
                     }
                 }
                 if ($v['musicid'] > 0 && $music_list[$v['musicid']]) {
                     $v['MusicID'] = $music_list[$v['musicid']]['id'];
                     $v['MusicUrl'] = $music_list[$v['musicid']]['music_url'];
                     $v['xiami_id'] = $music_list[$v['musicid']]['xiami_id'];
                 }
                 if ($v['item'] == 'reward' && $v['type'] == 'first' && $reward_list[$v['item_id']]['tid'] == $v['tid']) {
                     $v['is_reward'] = 1;
                     $v['reward_image'] = $reward_list[$v['item_id']]['event_image'];
                     $r_url = $GLOBALS['_J']['config']['site_url'] . '/index.php?mod=reward&code=detail&id=' . $v['item_id'];
                     $reward_url = '  更多信息尽在<a href="' . $r_url . '">' . $r_url . '</a>';
                     $v['content'] = $v['content'] . $reward_url;
                 }
                 if ($v['imageid'] && $image_list) {
                     $i_arr = explode(",", $v['imageid']);
                     foreach ($i_arr as $image_id) {
                         $v['image_list'][$image_id] = $image_list[$image_id];
                     }
                 }
                 if ($v['attachid'] && $attach_list) {
                     $a_arr = explode(",", $v['attachid']);
                     foreach ($a_arr as $attach_id) {
                         $v['attach_list'][$attach_id] = $attach_list[$attach_id];
                     }
                 }
             }
             if ($v['anonymous']) {
                 $v = $this->_anonymous($v);
             }
             $list[$k] = $v;
         }
     }
     return $list;
 }
Example #25
0
 function Main()
 {
     if ($this->MemberHandler->HasPermission($this->Module, $this->Code) == false) {
         $this->Messager($this->MemberHandler->GetError(), null);
     }
     $act_list = array();
     if ($this->Config['company_enable']) {
         $act_list['company'] = '同单位';
     }
     if (!$this->Config['profile_search_close']) {
         $act_list['search'] = '同城用户';
     }
     if (!$this->Config['profile_maybe_friend_close']) {
         $act_list['maybe_friend'] = '同兴趣';
     }
     if (!$this->Config['profile_usertag_close']) {
         $act_list['usertag'] = '同类人';
     }
     if (!$this->Config['profile_role_close']) {
         $act_list['role'] = '同分组';
     }
     if (false == jconf::get('invite', 'link_display_none')) {
         $act_list['invite'] = '邀请好友';
     }
     $act = $this->Code;
     $member = $this->Member;
     if ($member['medal_id']) {
         $medal_list = $this->TopicLogic->GetMedal($member['medal_id'], $member['uid']);
     }
     $member_nickname = $member['nickname'];
     if ('invite' == $act) {
         $sql = "delete from `" . TABLE_PREFIX . "invite` where `fuid`<'1' and `dateline`>'0' and `dateline`<'" . (time() - 86400 * 7) . "'";
         $this->DatabaseHandler->Query($sql);
         $sql = "select count(*) as my_invite_count from `" . TABLE_PREFIX . "invite` where `uid`='{$member['uid']}'";
         $query = $this->DatabaseHandler->Query($sql);
         $row = $query->GetRow();
         $my_invite_count = $row['my_invite_count'];
         $can_invite_count = max(0, $this->Config['invite_count_max'] - $my_invite_count);
         if ($my_invite_count > 0) {
             $per_page_num = 5;
             $query_link = "index.php?mod=" . ($_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module) . ($this->Code ? "&amp;code={$this->Code}" : "");
             $_config = array('return' => 'array');
             $page_arr = page($my_invite_count, $per_page_num, $query_link, $_config);
             $sql = "select i.*,m.province,m.city,m.topic_count,m.fans_count,m.nickname as fusername from `" . TABLE_PREFIX . "invite` i\r\n\t\t\t\t\t\tleft join `" . TABLE_PREFIX . "members` m on m.uid = i.fuid\r\n\t\t\t\t\t \twhere i.`uid`='{$member['uid']}' order by i.`id` desc {$page_arr['limit']}";
             $query = $this->DatabaseHandler->Query($sql);
             $invite_list = array();
             while (false != ($row = $query->GetRow())) {
                 $row['from_area'] = $row['province'] ? $row['province'] . ' ' . $row['city'] : '无';
                 $row['face'] = face_get($row['fuid']);
                 $invite_list[] = $row;
             }
             $invite_list = buddy_follow_html($invite_list, 'fuid');
         }
         $MEMBER_INVITE_CODE = '';
         if (!$this->Config['invite_count_max'] || $this->Config['invite_count_max'] > $member['invite_count']) {
             $MEMBER_INVITE_CODE = $member['invitecode'];
         }
         if (!$MEMBER_INVITE_CODE) {
             $MEMBER_INVITE_CODE = random(16);
             $sql = "update `" . TABLE_PREFIX . "members` set `invitecode`='{$MEMBER_INVITE_CODE}' where `uid`='" . MEMBER_ID . "'";
             $this->DatabaseHandler->Query($sql);
         }
         $inviteURL = "index.php?mod=member&code=" . urlencode(MEMBER_ID . "_" . $MEMBER_INVITE_CODE);
         $inviteURL = get_invite_url($inviteURL, $this->Config['site_url']);
         $invite = jconf::get('invite');
         $invite_msg = empty($invite) ? '' : jstripslashes($invite['invite_msg']);
         if (!empty($invite_msg)) {
             $replaces = array('nickname' => $member['nickname'], 'inviteurl' => $inviteURL, 'invite_num' => $this->Config['invite_limit'], 'site_name' => $this->Config['site_name']);
             foreach ($replaces as $key => $val) {
                 $invite_msg = str_replace("#" . $key . "#", $val, $invite_msg);
             }
         }
     } elseif ('maybe_friend' == $act) {
         $my_favorite_tags = jlogic('tag_favorite')->my_favorite_tags(MEMBER_ID, 20);
         if ($my_favorite_tags) {
             $uids = jlogic('tag_favorite')->favorite_uids($my_favorite_tags, 30);
             if ($uids) {
                 $p = array('uid' => MEMBER_ID, 'touid' => $uids, 'result_count' => count($uids));
                 $buddyids = get_buddyids($p);
                 $sql = "select `uid`,`ucuid`,`username`,`face_url`,`face`,`province`,`city`,`fans_count`,`topic_count`,`validate`,`nickname` from `" . TABLE_PREFIX . "members` where `uid` in('" . implode("','", $uids) . "')";
                 $query = $this->DatabaseHandler->Query($sql);
                 $member_list = array();
                 while (false != ($row = $query->GetRow())) {
                     $buddy_status = isset($buddyids[$row['uid']]);
                     if (!$buddy_status && MEMBER_ID != $row['uid']) {
                         $row['follow_html'] = follow_html($row['uid'], $buddy_status);
                         $row = jsg_member_make($row);
                         $member_list[$row['uid']] = $row;
                         $tag_favorite_uids[$row['uid']] = $row['uid'];
                     }
                 }
             }
         }
         $user_favorite = array();
         if ($tag_favorite_uids) {
             $user_favorite = jlogic('tag_favorite')->my_favorite($tag_favorite_uids, 100);
         }
     } elseif ('usertag' == $act) {
         $per_page_num = 10;
         $query_link = 'index.php?mod=profile&code=usertag';
         $order = " order by `fans_count` desc ";
         $sql = "select * from `" . TABLE_PREFIX . "user_tag_fields` where `uid` = '" . MEMBER_ID . "'";
         $query = $this->DatabaseHandler->Query($sql);
         $mytag = array();
         $user_tagid = array();
         while (false != ($row = $query->GetRow())) {
             $mytag[] = $row;
             $user_tagid[$row['tag_id']] = $row['tag_id'];
         }
         if ($user_tagid) {
             $sql = "select * from `" . TABLE_PREFIX . "user_tag_fields` where `uid` != '" . MEMBER_ID . "' and `tag_id` in (" . jimplode($user_tagid) . ") ";
             $query = $this->DatabaseHandler->Query($sql);
             $member_uids = array();
             while (false != ($row = $query->GetRow())) {
                 $member_uids[$row['uid']] = $row['uid'];
             }
             $where = $where_list = " where `uid` in (" . jimplode($member_uids) . ")";
         }
         if ($member_uids) {
             $member_list = array();
             $sql = "select count(*) as `total_record` from `" . TABLE_PREFIX . "members` {$where}";
             $total_record = DB::result_first($sql);
             if ($total_record > 0) {
                 $_config = array('return' => 'array');
                 $page_arr = page($total_record, $per_page_num, $query_link, $_config);
                 $member_list = $this->TopicLogic->GetMember("{$where} {$order} {$page_arr['limit']}", "`uid`,`ucuid`,`username`,`nickname`,`face_url`,`face`,`fans_count`,`topic_count`,`province`,`city`,`validate`");
                 $member_list = buddy_follow_html($member_list);
             }
             $sql = "select * from `" . TABLE_PREFIX . "user_tag_fields` {$where}";
             $query = $this->DatabaseHandler->Query($sql);
             $member_tag = array();
             while (false != ($row = $query->GetRow())) {
                 $member_tag[] = $row;
             }
         }
         $mytag = $this->_MyUserTag(MEMBER_ID);
     } else {
         $per_page_num = 10;
         $query_link = 'index.php?mod=profile&code=' . $act;
         $where_list = array();
         if ('search' == $act) {
             $province_name = $member['province'];
             $city_name = $member['city'];
             $area_name = $member['area'];
             $street_name = $member['street'];
             $province = $this->Get['province'];
             $city = $this->Get['city'];
             $area = $this->Get['area'];
             $street = $this->Get['street'];
             if ($province) {
                 $province_name = DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '{$province}'");
                 if ($city) {
                     $city_name = DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '{$city}'");
                     if ($area) {
                         $area_name = DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '{$area}'");
                         if ($street) {
                             $street_name = DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '{$street}'");
                         } else {
                             $street_name = '';
                         }
                     } else {
                         $area_name = '';
                         $street_name = '';
                     }
                 } else {
                     $city_name = '';
                     $area_name = '';
                     $street_name = '';
                 }
             }
             if (empty($where_list)) {
                 if ($province_name) {
                     $where_list['province'] = "`province`='" . addslashes("{$province_name}") . "'";
                     $query_link .= "&province=" . $province;
                     if ($city_name) {
                         $where_list['city'] = "`city`='" . addslashes("{$city_name}") . "'";
                         $query_link .= "&city=" . $city;
                         if ($area_name) {
                             $where_list['area'] = "`area`='" . addslashes("{$area_name}") . "'";
                             $query_link .= "&area=" . $area;
                             if ($street_name) {
                                 $where_list['street'] = "`street`='" . addslashes("{$street_name}") . "'";
                                 $query_link .= "&street=" . $street;
                             }
                         }
                     }
                 }
             }
             $query = $this->DatabaseHandler->Query("select * from " . TABLE_PREFIX . "common_district where `upid` = '0' order by list");
             while ($rsdb = $query->GetRow()) {
                 $province_arr[$rsdb['id']]['value'] = $rsdb['id'];
                 $province_arr[$rsdb['id']]['name'] = $rsdb['name'];
                 if ($member['province'] == $rsdb['name']) {
                     $province_id = $rsdb['id'];
                 }
             }
             $province_id = $province ? $province : $province_id;
             $province_list = jform()->Select("province", $province_arr, $province_id, "onchange=\"changeProvince();\"");
             $hid_area = '';
             $hid_city = '';
             $hid_street = '';
             if (!$province && $province_id) {
                 if ($member['city']) {
                     $hid_city = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '{$member['city']}' and upid = '{$province_id}'");
                 }
                 if ($hid_city) {
                     if ($member['area']) {
                         $hid_area = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '{$member['area']}' and upid = '{$hid_city}'");
                     }
                     if ($hid_area) {
                         if ($member['street']) {
                             $hid_street = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '{$member['street']}' and upid = '{$hid_area}'");
                         }
                     }
                 }
             }
             $hid_city = $city ? $city : $hid_city;
             $hid_area = $area ? $area : $hid_area;
             $hid_street = $street ? $street : $hid_street;
         } elseif ('company' == $act && $this->Config['company_enable'] && @is_file(ROOT_PATH . 'include/logic/cp.logic.php')) {
             global $_J;
             $companyid = jget('companyid', 'int');
             $departmentid = jget('departmentid', 'int');
             $jobid = jget('jobid', 'int');
             if ($companyid < 1 && $departmentid < 1 && $jobid < 1) {
                 $companyid = (int) $_J['member']['companyid'];
                 $departmentid = (int) $_J['member']['departmentid'];
                 $jobid = (int) $_J['member']['jobid'];
             }
             $company_list = jlogic('cp')->get_cp_html($companyid);
             if ($this->Config['department_enable']) {
                 $department_list = jlogic('cp')->get_cp_html($departmentid, 'department', $companyid);
             }
             $job_list = jlogic('job')->get_job_select($jobid);
             if ($companyid > 0) {
                 $where_list['company'] = "`companyid`='" . $companyid . "'";
                 $query_link .= '&companyid=' . $companyid;
             }
             if ($departmentid > 0) {
                 $where_list['department'] = "`departmentid`='" . $departmentid . "'";
                 $query_link .= '&departmentid=' . $departmentid;
             }
             if ($jobid > 0) {
                 $where_list['job'] = "`jobid`='" . $jobid . "'";
                 $query_link .= '&jobid=' . $jobid;
             }
         } else {
             global $_J;
             $roleid = $this->Get['roleid'] ? (int) $this->Get['roleid'] : ($_J['role_id'] ? $_J['role_id'] : 0);
             $roles = jlogic('channel')->get_user_role();
             $role_list = jform()->Select("roleid", $roles, $roleid, "");
             if ($roleid) {
                 $where_list['role'] = "`role_id`='" . $roleid . "'";
                 $query_link .= "&roleid=" . $roleid;
             }
         }
         $member_list = array();
         if ($where_list) {
             $where = empty($where_list) ? null : ' WHERE ' . implode(' AND ', $where_list) . ' ';
             $order = " order by `uid` desc ";
             $sql = "select count(*) as `total_record` from `" . TABLE_PREFIX . "members` {$where} ";
             $total_record = DB::result_first($sql);
             if ($total_record > 0) {
                 $_config = array('return' => 'array');
                 $page_arr = page($total_record, $per_page_num, $query_link, $_config);
                 $uids = array();
                 $member_list = $this->TopicLogic->GetMember("{$where} {$order} {$page_arr['limit']}", "`uid`,`ucuid`,`username`,`nickname`,`face_url`,`face`,`fans_count`,`topic_count`,`province`,`city`,`aboutme`");
                 foreach ($member_list as $_m) {
                     $uids[$_m['uid']] = $_m['uid'];
                 }
                 if ($uids && MEMBER_ID > 0) {
                     $member_list = buddy_follow_html($member_list);
                     $province = isset($_GET['province']) ? $province : $member['province'];
                     $city = isset($_GET['city']) ? $city : $member['city'];
                     $sql = "select * from (select * from `" . TABLE_PREFIX . "topic` where `uid` in (" . jimplode($uids) . ") and `type` != 'reply' order by `dateline` desc) a group by `uid` ";
                     $query = $this->DatabaseHandler->Query($sql);
                     $tids = array();
                     while (false != ($row = $query->GetRow())) {
                         $tids[$row['tid']] = $row['tid'];
                     }
                     $topic_list = $this->TopicLogic->Get($tids);
                 }
             }
         }
         $gender_radio = jform()->Radio('gender', array(0 => array('name' => '不限', 'value' => 0), 1 => array('name' => '男', 'value' => 1), 2 => array('name' => '女', 'value' => 2)), $gender);
     }
     $this->Title = $act_list[$act];
     include template('social/profile_main');
 }
Example #26
0
 function _get_shops($tids)
 {
     $shops = array();
     $query = DB::query("SELECT * FROM " . DB::table('topic_shop') . " WHERE tid IN(" . jimplode($tids) . ")");
     while ($shop = DB::fetch($query)) {
         $shops[] = $shop;
     }
     return $shops;
 }
Example #27
0
 function DoDraw($rid, $pid)
 {
     $r_uid = array();
     $new_uid = array();
     $reward = $this->getRewardInfo($rid);
     if (!$reward) {
         return '请确认你要抽奖的有奖转发是否存在。';
     }
     if ($reward['tot'] > TIMESTAMP) {
         return '该有奖转发还没有结束,不能抽奖。';
     }
     #抽取奖励数
     $prize_num = (int) $reward['prize'][$pid]['prize_num'];
     $uid = $this->getPrizeUserUid($rid, $pid);
     $uid2 = $this->getprizeUserUid2($rid);
     if (count($uid) >= $prize_num) {
         return '该有奖转发的[' . $reward['prize'][$pid]['prize_name'] . ']已全部抽取';
     }
     $prize_num = $prize_num - count($uid);
     if ($prize_num > 0) {
         if ($uid2) {
             $except_uid = " and `uid` not in(" . jimplode($uid2) . ") ";
         }
         $sql = " select distinct `uid` from `" . TABLE_PREFIX . "reward_user` where `rid` = '{$rid}' and `on` = 1 {$except_uid} limit 9999999";
         $query = DB::query($sql);
         while ($rs = DB::fetch($query)) {
             if ($uid2 && in_array($rs['uid'], $uid2)) {
                 continue;
             }
             $uids[$rs['uid']] = $rs['uid'];
         }
         if ($prize_num < count($uids)) {
             $new_uid_key = array_rand($uids, $prize_num);
             if (is_array($new_uid_key)) {
                 foreach ($new_uid_key as $val) {
                     $new_uid[$val] = $uids[$val];
                 }
             } else {
                 $new_uid[$new_uid_key] = $uids[$new_uid_key];
             }
         } else {
             $new_uid = $uids;
         }
     }
     $pm_to_user = '';
     if ($new_uid) {
         #给新抽取出来的用户发私信通知下
         $query = DB::query(" select `uid`,`username`,`nickname` from `" . TABLE_PREFIX . "members` where uid in ('" . implode(',', $new_uid) . "')");
         while ($rs = DB::fetch($query)) {
             $pm_to_user = $pm_to_user ? $pm_to_user . ',' . $rs['nickname'] : $rs['nickname'];
             $r_uid[$rs['uid']] = $rs;
             $r_uid[$rs['uid']]['prize_name'] = $reward['prize'][$pid]['prize_name'];
             $r_uid[$rs['uid']]['prize'] = $reward['prize'][$pid]['prize'];
             #记录
             DB::query(" insert into `" . TABLE_PREFIX . "reward_win_user` (`uid`,`rid`,`pid`,`dateline`) values ('{$rs['uid']}','{$rid}','{$pid}','" . TIMESTAMP . "')");
         }
     }
     if ($pm_to_user) {
         $post = array('to_user' => $pm_to_user, 'message' => '恭喜你在有奖转发【<a href="index.php?mod=reward&code=detail&id=' . $rid . '" target="_blank">' . $reward['title'] . '</a>】中获得' . $reward['prize'][$pid]['prize_name'] . ':' . $reward['prize'][$pid]['prize'] . '。请及时联系发起者(注意:本私信由活动发起者发送,请确认)。');
         jlogic('pm')->pmSend($post);
     }
     return $r_uid;
 }
Example #28
0
 function Main()
 {
     $config = jconf::get('robot');
     $order_by = $this->Get['order_by'] ? $this->Get['order_by'] : "today_times";
     $order_type = $this->Get['order_type'] ? $this->Get['order_type'] : "desc";
     $toggle_order_type = $order_type == "desc" ? "asc" : "desc";
     ${$order_by} = "order_" . $order_type;
     include_once ROOT_PATH . 'include/logic/robot.logic.php';
     $RobotRogic = new RobotLogic();
     $turnon_radio = $this->jishigou_form->YesNoRadio('config[turnon]', (int) $config['turnon'], '', 'class="radio"');
     if ($config['turnon']) {
         if (false === ($robot_list = cache_file('get', $cache_id = 'robot/list'))) {
             $sql = "SELECT * FROM " . $RobotRogic->tableName;
             $query = $this->DatabaseHandler->Query($sql);
             $robot_list = array();
             while (false != ($row = $query->GetRow())) {
                 if ($row['times'] < 10) {
                     continue;
                 }
                 $row['link'] = preg_replace("/.*?(((((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|ed2k):\\/\\/)|(www\\.))([^\\[\"'\\s\\)\\(\\;]+))|([a-z0-9\\_\\-.]+@[a-z0-9]+\\.[a-z0-9\\.]{2,}))*/i", "\\1", $row['agent']);
                 if (strpos($row['link'], '@') !== false) {
                     $row['link'] = "mailto:" . $row['link'];
                 }
                 if ($row['link'] && strpos($row['link'], ":") === false) {
                     $row['link'] = "http:/" . "/" . $row['link'];
                 }
                 $row['first_visit_timestamp'] = $row['first_visit'];
                 $row['first_visit'] = my_date_format($row['first_visit']);
                 $row['last_visit_timestamp'] = $row['last_visit'];
                 $row['last_visit'] = my_date_format($row['last_visit']);
                 if ($this->ad) {
                     $show_ad = isset($config['list'][$row['name']]['show_ad']) ? (int) $config['list'][$row['name']]['show_ad'] : 1;
                     $row['show_ad_radio'] = $this->jishigou_form->YesNoRadio("config[list][{$row['name']}][show_ad]", $show_ad, '', "class='radio'");
                 }
                 $row['today_times'] = 0;
                 $row['name'] = trim($row['name']);
                 $robot_list[$row['name']] = $row;
             }
             cache_file('set', $cache_id, $robot_list, 3600);
         }
         $name_list = array();
         foreach ($robot_list as $row) {
             if ($row['last_visit_timestamp'] + 86400 > TIMESTAMP) {
                 $name_list[] = $row['name'];
             }
         }
         if (!empty($name_list) && count($name_list) >= 0) {
             $names = jimplode($name_list);
             include_once ROOT_PATH . 'include/logic/robot_log.logic.php';
             $RobotLogLogic = new RobotLogLogic("");
             $sql = "SELECT * FROM {$RobotLogLogic->tableName}\r\n\t\t\t\twhere\r\n\t\t\t\t\t`name` in({$names})\r\n\t\t\t\t\tand `date`='{$RobotLogLogic->date}'";
             $query = $this->DatabaseHandler->Query($sql);
             while ($row = $query->GetRow()) {
                 if (isset($robot_list[$row['name']])) {
                     $robot_list[$row['name']]['today_times'] = $row['times'];
                 }
             }
         }
         if (is_array($robot_list) && sizeof($robot_list) > 0) {
             foreach ($robot_list as $key => $value) {
                 $order_by_list[$key] = $value[$order_by];
             }
             array_multisort($order_by_list, constant(strtoupper("sort_" . $order_type)), $robot_list);
         }
         if (sizeof($robot_list) > 0 && false === ($robot_ip_list = cache_file('get', $cache_id = 'robot/ip_list'))) {
             $robot_ip_list = array();
             $sql = "SELECT ip,name from {$RobotRogic->tableName}_ip GROUP BY `name` order by `last_visit` DESC";
             $query = $this->DatabaseHandler->Query($sql, "SKIP_ERROR");
             if ($query != false) {
                 while ($row = $query->GetRow()) {
                     $robot_ip_list[$row['name']][] = $row['ip'];
                 }
                 if (!empty($robot_ip_list)) {
                     foreach ($robot_ip_list as $_robot => $_ip_list) {
                         if (sizeof($_ip_list) > 5) {
                             $ip_list = array();
                             $ip_list_count = 0;
                             foreach ($_ip_list as $_ip) {
                                 $ip = substr($_ip, 0, strrpos($_ip, ".")) . ".*";
                                 $ip_list[$ip] = $ip;
                                 $ip_list_count++;
                                 if ($ip_list_count > 10) {
                                     break;
                                 }
                             }
                             $robot_ip_list[$_robot] = $ip_list;
                         }
                     }
                 }
             }
             cache_file('set', $cache_id, $robot_ip_list, 3600);
         }
     }
     include template("admin/robot");
 }
Example #29
0
 function UpdateNewMsgCount($num, $uids = '')
 {
     if ('' === $uids) {
         $uids = MEMBER_ID;
     }
     if (empty($uids)) {
         return false;
     }
     $num = (int) $num;
     if (empty($num)) {
         return false;
     }
     $uids = (array) $uids;
     $sql = "\r\n\t\tUPDATE\r\n\t\t\t" . TABLE_PREFIX . 'members' . "\r\n\t\tSET\r\n\t\t\t`newpm`=`newpm` + {$num}\r\n\t\tWHERE uid in (" . jimplode($uids) . ")";
     DB::query($sql);
     if ($num < 0) {
         DB::query("update " . TABLE_PREFIX . "members set `newpm`=0 where uid in (" . jimplode($uids) . ") and `newpm`<0");
     }
     return true;
 }
 function Addvar()
 {
     $id = jget('id', 'int');
     $var_data = array();
     $var_data['pluginid'] = $id;
     $var_data['displayorder'] = trim($this->Post['newdisplayorder']);
     $var_data['title'] = trim($this->Post['newtitle']);
     $var_data['variable'] = trim($this->Post['newvariable']);
     $var_data['type'] = trim($this->Post['newtype']);
     if (!empty($var_data['title']) || !empty($var_data['variable '])) {
         if (jlogic('plugin')->checkvar_by_pluginid($id, 0, $var_data['variable'])) {
             $this->Messager("变量名不合法,与现有变量名重复", 'admin.php?mod=plugindesign&code=vars&id=' . $id);
         } elseif (!preg_match("/^[a-z]+[a-z_]*[a-z]+\$/i", $var_data['variable'])) {
             $this->Messager("变量命名不合法", 'admin.php?mod=plugindesign&code=vars&id=' . $id);
         } else {
             jtable('pluginvar')->insert($var_data);
         }
     }
     if ($ids = jimplode($this->Post['delete'])) {
         $sql = "DELETE FROM `" . TABLE_PREFIX . "pluginvar` WHERE `pluginvarid` IN ({$ids})";
         $this->DatabaseHandler->Query($sql);
     }
     if (is_array($this->Post['displayordernew'])) {
         foreach ($this->Post['displayordernew'] as $vid => $displayorder) {
             $data['displayorder'] = $displayorder;
             jtable('pluginvar')->update($data, array('pluginvarid' => $vid));
         }
     }
     $this->Messager("插件设计完善成功", 'admin.php?mod=plugindesign&code=vars&id=' . $id);
 }