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
 function index()
 {
     $per_page_num = min(500, max(20, (int) (isset($_GET['pn']) ? $_GET['pn'] : $_GET['per_page_num'])));
     $gets = array('mod' => 'recdtopic', 'pn' => $this->Get['pn'], 'per_page_num' => $this->Get['per_page_num'], 'keyword' => $this->Get['keyword'], 'nickname' => $this->Get['nickname']);
     $page_url = 'admin.php?' . url_implode($gets);
     $where_sql = ' 1 AND tr.tid>0 ';
     $keyword = trim($this->Get['keyword']);
     if ($keyword) {
         $_GET['highlight'] = $keyword;
         $where_sql .= " AND " . build_like_query('t.content,t.content2', $keyword) . " ";
     }
     $nickname = trim($this->Get['nickname']);
     if ($nickname) {
         $sql = "select `username`,`nickname` from `" . TABLE_PREFIX . "members` where `nickname`='{$nickname}' limit 0,1";
         $query = $this->DatabaseHandler->Query($sql);
         $members = $query->GetRow();
         $where_sql .= " AND `username`='{$members['username']}' ";
     }
     $count = DB::result_first("SELECT COUNT(*)\r\n\t\t\t\t\t\t\t\t   FROM " . DB::table('topic') . " AS t\r\n\t\t\t\t\t\t\t\t   LEFT JOIN " . DB::table('topic_recommend') . " AS tr\r\n\t\t\t\t\t\t\t\t   ON t.tid=tr.tid\r\n\t\t\t\t\t\t\t\t   WHERE {$where_sql}");
     $topic_list = array();
     if ($count) {
         $page_arr = page($count, $per_page_num, $page_url, array('return' => 'array'));
         $query = DB::query("SELECT t.*,tr.dateline AS recd_time,tr.expiration,tr.r_nickname\r\n\t\t\t\t\t\t\t\tFROM  " . DB::table('topic') . " AS t\r\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB::table('topic_recommend') . " AS tr\r\n\t\t\t\t\t\t\t\tON t.tid=tr.tid\r\n\t\t\t\t\t\t\t\tWHERE {$where_sql}\r\n\t\t\t\t\t\t\t\tORDER BY tr.dateline DESC\r\n\t\t\t\t\t\t\t\t{$page_arr['limit']} ");
         while ($value = DB::fetch($query)) {
             $value['recd_time'] = my_date_format2($value['recd_time']);
             $topic_list[] = $value;
         }
         $topic_list = $this->TopicLogic->MakeAll($topic_list);
     }
     include template('admin/recdtopic');
 }
Example #3
0
 function getHistoryList($uid = MEMBER_ID, $touid = MEMBER_ID, $page = array(), $limit = '')
 {
     $info = $this->getHistory($uid, $touid, $page, $limit);
     if (!empty($info)) {
         $list = array();
         foreach ($info['pm_list'] as $key => $val) {
             $val['date'] = my_date_format2($val['dateline']);
             $list[] = $val;
         }
         if (!empty($list)) {
             usort($list, create_function('$a,$b', 'if($a[dateline]==$b[dateline])return 0;return $a[dateline]<$b[dateline]?-1:1;'));
             $ret = array('pm_list' => $list, 'current_page' => $info['page_arr']['current_page'], 'total_page' => $info['page_arr']['total_page'], 'list_count' => count($list));
             return $ret;
         }
     }
     return false;
 }
Example #4
0
 function QunSearch()
 {
     $qun_setting = $this->Config['qun_setting'];
     if (!$qun_setting['qun_open']) {
         $this->Messager("当前站点没有开放" . $this->Config[changeword][weiqun] . "功能");
     }
     $perpage = 10;
     $q = trim($this->Get['q']);
     $q = get_safe_code($q);
     $gets = array('mod' => 'search', 'code' => 'qun', 'q' => $this->Get['q']);
     $page_url = 'index.php?' . url_implode($gets);
     $count = 0;
     if (!empty($q)) {
         $q = $this->_filterKeyword($q);
         $search_keyword = $q;
         $QunLogic = jlogic('qun');
         $where = ' gview_perm=0 AND ' . build_like_query('name', $q) . ' ';
         $order = " ORDER BY dateline DESC ";
         $cache_time = 3600;
         if ($cache_time > 0) {
             $cache_key = "qun-search-{$q}";
             if (false === ($qids = cache_db('mget', $cache_key))) {
                 $query = DB::query("SELECT `qid` FROM " . DB::table('qun') . " WHERE {$where} {$order} LIMIT {$this->cache_ids_limit} ");
                 $qids = array();
                 while (false != ($row = DB::fetch($query))) {
                     $qids[$row['qid']] = $row['qid'];
                 }
                 cache_db('mset', $cache_key, $qids, $cache_time);
             }
             $where = $qids ? " `gview_perm`='0' AND `qid` IN ('" . implode("','", $qids) . "') " : "";
         }
         $qun_list = array();
         if ($where) {
             $count = DB::result_first("SELECT COUNT(*) FROM " . DB::table('qun') . " WHERE {$where}");
             if ($count > 0) {
                 $page_arr = page($count, $perpage, $page_url, array('return' => 'array'));
                 $query = DB::query("SELECT * FROM " . DB::table('qun') . " WHERE {$where} {$order} {$page_arr['limit']}");
                 while ($value = DB::fetch($query)) {
                     if (empty($value['icon'])) {
                         $value['icon'] = $QunLogic->qun_avatar($value['qid'], 's');
                     }
                     $value['dateline'] = my_date_format2($value['dateline']);
                     $qun_list[] = $value;
                 }
             }
         }
     }
     $member = jsg_member_info(MEMBER_ID);
     if ($member['medal_id']) {
         $medal_list = $this->TopicLogic->GetMedal($member['medal_id'], $member['uid']);
     }
     $this->Title = $this->Config[changeword][weiqun] . '搜索';
     include template('social/search_list');
 }
Example #5
0
 function attachs_list($num = 10, $where = '')
 {
     $total_attach = DB::result_first("SELECT count(*) FROM " . DB::table('topic_attach') . " WHERE tid>0 {$where}");
     $page_arr = page($total_attach, $num, 'index.php?mod=attach', array('return' => 'array'));
     $limit_sql = $page_arr['limit'];
     $attachs = array();
     $query = DB::query("SELECT * FROM " . DB::table('topic_attach') . " WHERE tid>0 {$where} ORDER BY id DESC {$limit_sql}");
     $candown = jclass('member')->HasPermission('uploadattach', 'down');
     $canviewtype = array('doc', 'ppt', 'pdf', 'xls', 'txt', 'docx', 'xlsx', 'pptx');
     while ($value = DB::fetch($query)) {
         $value['manage'] = jallow($value[uid]) ? true : false;
         $value['filesize'] = $value['filesize'] > 1024 * 1024 ? round($value['filesize'] / (1024 * 1024), 2) . 'MB' : ($value['filesize'] == 0 ? '未知' : round($value['filesize'] / 1024, 1) . 'KB');
         $value['dateline'] = my_date_format2($value['dateline']);
         $value['img'] = 'images/filetype/' . $value['filetype'] . '.gif';
         $value['url'] = ($value['site_url'] ? $value['site_url'] : $GLOBALS['_J']['site_url']) . '/' . str_replace('./', '', $value['file']);
         $value['onlineview'] = $candown && in_array($value['filetype'], $canviewtype) && $value['score'] == 0 ? $value['url'] : '';
         $attachs[$value['id']] = $value;
     }
     $return = array('list' => $attachs);
     $return['page'] = $page_arr ? $page_arr : $pagenum;
     return $return;
 }
Example #6
0
 function Make($topic, $merge_sql = 0, $option = array(), $clist_img = 1, $islongtext = 0)
 {
     global $jishigou_rewrite;
     $clist_img = $clist_img && !$merge_sql && (true === IN_JISHIGOU_INDEX || true === IN_JISHIGOU_AJAX || true === IN_JISHIGOU_ADMIN);
     $make_member_fields = "`uid`,`ucuid`,`username`,`nickname`,`signature`,`face_url`,`face`,`validate`,`validate_category`,`level`";
     $topic['content'] .= $topic['content2'];
     if ($topic['longtextid'] > 0) {
         $topic['content'] = $this->_content_end($topic['content']);
     }
     $topic['raw_content'] = strip_tags($topic['content']);
     unset($topic['content2']);
     if ($topic['dateline']) {
         $topic['addtime'] = $topic['dateline'];
         $topic['dateline'] = my_date_format2($topic['dateline']);
     }
     $topic['is_vote'] = 0;
     if (!$topic['random']) {
         $topic['random'] = mt_rand();
     }
     if ($GLOBALS['_J']['plugins']['func']['printtopic']) {
         jlogic('plugin')->hookscript('printtopic', 'funcs', $topic, 'printtopic');
     }
     if (false === strpos($topic['content'], '</a>') && (false !== strpos($topic['content'], $GLOBALS['_J']['config']['site_url']) || false !== strpos($topic['content'], '.wmv'))) {
         if (preg_match_all('~(?:https?\\:\\/\\/|www\\.)(?:[A-Za-z0-9\\_\\-]+\\.)+[A-Za-z0-9]{1,4}(?:\\:\\d{1,6})?(?:\\/[\\w\\d\\/=\\?%\\-\\&_\\~\\`\\:\\+\\#\\.]*(?:[^\\;\\@\\[\\]\\<\\>\'\\"\\n\\r\\t\\s\\x7f-\\xff])*)?~i', $topic['content'] . " ", $match)) {
             $cont_rpl = $cont_sch = array();
             foreach ($match[0] as $v) {
                 $v = trim($v);
                 if (($vl = strlen($v)) < 8 || $vl > 200) {
                     continue;
                 }
                 if ('.wmv' == substr($v, -4)) {
                     $cont_sch[] = "{$v}";
                     if ($islongtext) {
                         $cont_rpl[] = "<br><center><object border='0' data='{$v}' width='480' align='baseline' type='video/x-ms-wmv' height='400'></object></center><br>如要下载此视频,请右击此链接,选择“目标另存为”:<br><a target='_blank' href='{$v}'>{$v}</a>";
                     } else {
                         $cont_rpl[] = "<a target='_blank' href='" . jurl('index.php?mod=topic&code=' . $topic['tid']) . "' title='单击播放'><img src='images/vd.gif'></a>";
                     }
                 }
                 if (strtolower($GLOBALS['_J']['config']['site_url']) == strtolower(substr($v, 0, strlen($GLOBALS['_J']['config']['site_url'])))) {
                     $app_type = '';
                     $tmp_vid = 0;
                     if (MEMBER_ID > 0) {
                         if (preg_match("/mod=vote(?:&code=view)?&vid=([0-9]+)/", $v, $m) || preg_match("/vote(?:\\/view)?\\/vid\\-([0-9]+)/", $v, $m)) {
                             $app_type = 'vote';
                             $tmp_vid = $m[1];
                             if ($topic['is_vote'] === 0) {
                                 $topic['is_vote'] = $tmp_vid;
                             }
                         }
                     }
                     if ($app_type == 'vote') {
                         $cont_sch[] = "{$v}";
                         $vote_key = $topic['tid'] . '_' . $topic['random'];
                         if (IN_JISHIGOU_WAP === true || IN_JISHIGOU_MOBILE === true) {
                             $cont_rpl[] = "<a href='{$v}'>{$v}<img src='{$GLOBALS['_J']['config']['site_url']}/images/voteicon.gif'/></a>";
                         } else {
                             $cont_rpl[] = "<a onclick='return getVoteDetailWidgets(\"{$vote_key}\", {$tmp_vid});' href='{$v}'>{$v}<img src='{$GLOBALS['_J']['config']['site_url']}/images/voteicon.gif'/></a>";
                         }
                     } else {
                         $cont_sch[] = "{$v}";
                         $cont_rpl[] = "<a target='_blank' href='{$v}'>{$v}</a>";
                     }
                 }
             }
             if ($cont_rpl && $cont_sch) {
                 $cont_sch = array_unique($cont_sch);
                 $cont_rpl = array_unique($cont_rpl);
                 $topic['content'] = trim($this->_str_replace($cont_sch, $cont_rpl, $topic['content']));
             }
         }
     }
     $this->_parseAt($topic);
     $highlight = jget('highlight', 'txt');
     if ($highlight && is_string($highlight)) {
         $topic['content'] = str_replace($highlight, "<font color=red>{$highlight}</font>", $topic['content']);
     }
     if (false !== strpos($topic['content'], '<T>#')) {
         static $topic_content_tag_href_pattern_static = '';
         if (!$topic_content_tag_href_pattern_static) {
             $topic_content_tag_href_pattern_static = "index.php?mod=tag&code=|REPLACE_VALUE|";
             if ($topic['item'] == 'qun') {
                 $topic_content_tag_href_pattern_static = "index.php?mod=qun&qid={$topic['item_id']}&tag=|REPLACE_VALUE|";
             }
             if ($jishigou_rewrite) {
                 $topic_content_tag_href_pattern_static = $jishigou_rewrite->formatURL($topic_content_tag_href_pattern_static);
             }
             if (defined("IN_JISHIGOU_MOBILE")) {
                 $topic_content_tag_href_pattern_static = 'javascript:goToTopicList(\\\'|REPLACE_VALUE| . "\')"';
             }
         }
         $topic['content'] = preg_replace('~<T>#(.+?)#</T>~e', '\'<a href="' . str_replace('|REPLACE_VALUE|', '\' . ' . (defined('IN_JISHIGOU_MOBILE') ? '' : 'urlencode') . '(strip_tags(\'\\1\'))', $topic_content_tag_href_pattern_static) . ' . \'">#\\1#</a>\'', $topic['content']);
     }
     if (false !== strpos($topic['content'], '</U>')) {
         static $topic_content_url_href_pattern_static = '';
         if (!$topic_content_url_href_pattern_static) {
             $topic_content_url_href_pattern_static = "index.php?mod=url&code=|REPLACE_VALUE|";
             if ($jishigou_rewrite) {
                 $topic_content_url_href_pattern_static = ltrim($jishigou_rewrite->formatURL($topic_content_url_href_pattern_static), '/');
             }
         }
         $sys_site_url = $GLOBALS['_J']['config']['site_url'];
         if ($jishigou_rewrite) {
             $sys_site_url = false !== ($_tmp_pos = strpos($sys_site_url, '/', 10)) ? substr($sys_site_url, 0, $_tmp_pos) : $sys_site_url;
         }
         $topic['content'] = preg_replace('~<U ([0-9a-zA-Z]+)>(.+?)</U>~e', '\'<a title="\'.jhtmlspecialchars(strip_tags(\'\\2\')).\'" href="' . ($sys_site_url . '/' . str_replace('|REPLACE_VALUE|', '\\1', $topic_content_url_href_pattern_static)) . '" target="_blank">' . ($sys_site_url . '/' . str_replace('|REPLACE_VALUE|', '\\1', $topic_content_url_href_pattern_static)) . '</a>\'', $topic['content']);
     }
     if (false !== strpos($topic['content'], '<T>')) {
         $topic['content'] = str_replace(array('<T>', '</T>', '</U>', '<T', '</T'), '', $topic['content']);
     }
     if (false !== strpos($topic['content'], '<U')) {
         $topic['content'] = preg_replace('~(</U>|<U[^><]*?>|<U\\s*)~', '', $topic['content']);
     }
     $topic = $this->_make_topic_from($topic);
     $topic['top_parent_id'] = $topic['roottid'];
     $topic['parent_id'] = $topic['totid'];
     if ($topic['imageid'] && !$merge_sql) {
         $topic['image_list'] = jlogic('image')->image_list($topic['imageid']);
     }
     if ($topic['attachid'] && !$merge_sql) {
         $topic['attach_list'] = jlogic('attach')->attach_list($topic['attachid']);
     }
     $content_arr = explode("\n", $topic['content']);
     if (count($content_arr) > 1) {
         $content0 = $content_arr[0];
         if (jstrlen(strip_tags($content0)) <= 78 && strpos($content0, '[code]') === false) {
             if ($islongtext) {
                 $content_arr[0] = '<center><b>' . $content0 . '</b></center>';
             } else {
                 $content_arr[0] = '<b>' . $content0 . '</b>';
             }
             $topic['content'] = implode("\n", $content_arr);
         }
     }
     if (false !== strpos($topic['content'], '[')) {
         if (false === strpos($topic['content'], '#[')) {
             if (preg_match_all('~\\[(.+?)\\]~', $topic['content'], $match)) {
                 static $face_conf = null;
                 if (!$face_conf) {
                     $face_conf = jconf::get('face');
                 }
                 foreach ($match[0] as $k => $v) {
                     if (false != ($img_src = $face_conf[$match[1][$k]])) {
                         if (defined("IN_JISHIGOU_MOBILE")) {
                             $img_src = 'mobile/' . $img_src;
                         }
                         $topic['content'] = str_replace($v, '<img src="' . $GLOBALS['_J']['config']['site_url'] . '/' . $img_src . '" border="0"/>', $topic['content']);
                     }
                 }
             }
         }
         if (false !== strpos($topic['content'], '[/image]') && preg_match_all('~\\[image\\](.+?)\\[\\/image\\]~', $topic['content'], $match)) {
             $TPT = $option['TPT_id'] ? $option['TPT_id'] : '';
             $ptidv = $option['ptidv'] ? $option['ptidv'] : '';
             $type = $option['type'] ? $option['type'] : '';
             foreach ($match[0] as $k => $v) {
                 if ($option && ($image_url = $topic['image_list'][$match[1][$k]]['image_small']) && !$merge_sql && $clist_img) {
                     $iid = $topic['image_list'][$match[1][$k]]['id'];
                     $ikey = $topic['image_list'][$match[1][$k]]['image_key'];
                     $image_original = $topic['image_list'][$match[1][$k]]['image_original'];
                     if ($type == 'artZoom2') {
                         $imageHTML = '<ul class="imgList"><li><a id="TV_img_a_' . $iid . '" href="' . $image_original . '" class="artZoom2" rel="' . $image_url . '"><img id="TV_img_' . $iid . '" src="' . $image_original . '" onload="TV_resizeImage(this, 550, ' . $iid . ')" /></a></li></ul>';
                     } else {
                         $imageHTML = '<ul class="imgList"><li><a href="' . $image_original . '" class="artZoomAll" rel="' . $image_url . '" rev="' . $ikey . '"><img src="' . $image_url . '" onload="this.click();"/></a></li></ul>';
                     }
                     $topic['content'] = str_replace($v, $imageHTML, $topic['content']);
                     unset($topic['image_list'][$match[1][$k]]);
                 } else {
                     $topic['content'] = str_replace(array("<br />{$v}", "<br>{$v}", "{$v}<br />", "{$v}<br>", "{$v}"), '', $topic['content']);
                 }
             }
         }
         if (false !== strpos($topic['content'], '[/b]') && preg_match_all('/\\[b\\](.+?)\\[\\/b\\]/is', $topic['content'], $match)) {
             foreach ($match[0] as $k => $v) {
                 $topic['content'] = str_replace($v, '<b>' . $match[1][$k] . '</b>', $topic['content']);
             }
         }
         if (false !== strpos($topic['content'], '[/u]') && preg_match_all('/\\[u\\](.+?)\\[\\/u\\]/is', $topic['content'], $match)) {
             foreach ($match[0] as $k => $v) {
                 $topic['content'] = str_replace($v, '<u>' . $match[1][$k] . '</u>', $topic['content']);
             }
         }
         if (false !== strpos($topic['content'], '[/color]') && preg_match_all('/\\[color=(.+?)\\](.+?)\\[\\/color\\]/is', $topic['content'], $match)) {
             foreach ($match[0] as $k => $v) {
                 $topic['content'] = str_replace($v, '<span style="color:' . $match[1][$k] . ';">' . $match[2][$k] . '</span>', $topic['content']);
             }
         }
         #引用的样式
         if (false !== strpos($topic['content'], '[/quote]') && preg_match_all('/\\[quote\\](.+?)\\[\\/quote\\]/is', $topic['content'], $match)) {
             foreach ($match[0] as $k => $v) {
                 $topic['content'] = str_replace($v, '<div class="quote">' . $match[1][$k] . '</div>', $topic['content']);
             }
         }
         #代码的样式
         if (false !== strpos($topic['content'], '[/code]') && preg_match_all('/\\[code\\](.+?)\\[\\/code\\]/is', $topic['content'], $match)) {
             foreach ($match[0] as $k => $v) {
                 $html = "<br /><div class='code'><ul>";
                 $codeList = explode("\n", $match[1][$k]);
                 if ($codeList) {
                     $li = '';
                     foreach ($codeList as $code) {
                         $li .= "<li>{$code}</li>";
                     }
                 }
                 $html .= $li . '</ul></div><br />';
                 $topic['content'] = str_replace($v, $html, $topic['content']);
             }
         }
         if (false !== strpos($topic['content'], '[')) {
             $topic['content'] = preg_replace('~\\[\\/?([\\w\\d\\=]+)\\]~i', '', $topic['content']);
         }
     }
     if ($topic['videoid'] > 0 && $GLOBALS['_J']['config']['video_status'] && !$merge_sql) {
         $sql = "select `id`,`video_hosts`,`video_link`,`video_img`,`video_img_url`,`video_url` from `" . TABLE_PREFIX . "topic_video` where `id`='" . $topic['videoid'] . "' ";
         $topic_video = DB::fetch_first($sql);
         $topic['VideoID'] = $topic_video['id'];
         $topic['VideoHosts'] = $topic_video['video_hosts'];
         $topic['VideoLink'] = $topic_video['video_link'];
         $topic['VideoUrl'] = $topic_video['video_url'];
         if ($topic_video['video_img']) {
             $topic['VideoImg'] = ($topic_video['video_img_url'] ? $topic_video['video_img_url'] : $GLOBALS['_J']['config']['site_url']) . '/' . $topic_video['video_img'];
         } else {
             $topic['VideoImg'] = $GLOBALS['_J']['config']['site_url'] . '/images/vd.gif';
         }
     }
     if ($topic['musicid'] > 0 && !$merge_sql) {
         $sql = "select `id`,`music_url`,`xiami_id` from `" . TABLE_PREFIX . "topic_music` where `id`='" . $topic['musicid'] . "' ";
         $topic_music = DB::fetch_first($sql);
         $topic['MusicID'] = $topic_music['id'];
         $topic['MusicUrl'] = $topic_music['music_url'];
         $topic['xiami_id'] = $topic_music['xiami_id'];
     }
     if ($topic['image_list'] && !$merge_sql && $clist_img) {
         $addHtml = '<ul class="imgList">';
         foreach ($topic['image_list'] as $k => $v) {
             $image_url = $v['image_small'];
             $iid = $v['id'];
             $image_original = $v['image_original'];
             $addHtml .= '<li><a href="' . $image_original . '" class="artZoomAll" rel="' . $image_url . '" rev="' . $ikey . '"><img src="' . $image_url . '" onload="this.click();"/></a></li>';
         }
         $addHtml .= '</ul>';
         $topic['content'] .= $addHtml;
     }
     if (!$merge_sql) {
         $topic = array_merge($topic, (array) $this->GetMember($topic['uid'], $make_member_fields));
         if ($topic['anonymous']) {
             $topic = $this->_anonymous($topic);
         }
     }
     return $topic;
 }
 private function _get_my_favorite_times($uid, $tids)
 {
     $list = array();
     $rets = $this->db->get(array('uid' => $uid, 'tid' => $tids));
     if ($rets && is_array($rets['list'])) {
         foreach ($rets['list'] as $row) {
             $k = $row['tid'];
             $v = my_date_format2($row['dateline']);
             $list[$k] = $v;
         }
     }
     return $list;
 }
Example #8
0
 function _getMyFavorite($param)
 {
     $topic_list = array();
     $uid = MEMBER_ID;
     $total_record = DB::result_first("SELECT COUNT(*) FROM " . DB::table("topic_favorite") . " WHERE uid='{$uid}'");
     $limit = $param['limit'];
     $max_id = $param['max_id'];
     if ($total_record > 0) {
         $where = " ";
         if ($max_id > 0) {
             $where = " AND TF.id<'{$max_id}' ";
         }
         $sql = "select TF.dateline as favorite_time,TF.id as ft_id,T.*\r\n\t\t\t\t\tfrom " . DB::table('topic_favorite') . " TF\r\n\t\t\t\t\tleft join " . DB::table('topic') . " T\r\n\t\t\t\t\ton T.tid=TF.tid\r\n\t\t\t\t\twhere TF.uid='{$uid}' {$where}\r\n\t\t\t\t\torder by TF.id desc Limit {$limit}";
         $query = DB::query($sql);
         while ($row = DB::fetch($query)) {
             if ($row['tid'] < 1) {
                 continue;
             }
             $row['favorite_time'] = my_date_format2($row['favorite_time']);
             $topic_list[] = $row;
         }
         $topic_list = $this->TopicLogic->MakeAll($topic_list);
         $ret = array('list' => $topic_list, 'total_record' => $total_record);
         return $ret;
     }
     return false;
 }
 function get_photo_list($param)
 {
     $sql_where = '';
     $uid = max(0, (int) $param['uid']);
     $cache_key = "{$uid}-get_photo_list-" . md5(serialize($param));
     if (false === ($info = cache_db('get', $cache_key))) {
         if ($uid > 0) {
             $uids = get_buddyids($uid, $GLOBALS['_J']['config']['topic_myhome_time_limit']);
             if ($uids) {
                 $sql_where = " AND t.uid in(" . jimplode($uids) . ") ";
             } else {
                 return array();
             }
         }
         $total_photo = (int) $param['count'];
         if ($total_photo < 1) {
             if ($param['vip']) {
                 $total_photo = DB::result_first("select count(1) as `total` from " . DB::table('topic_image') . " t left join " . DB::table('members') . " m on m.uid=t.uid where t.tid>0 and m.validate='1'" . $sql_where);
             } else {
                 $total_photo = DB::result_first("SELECT COUNT(*) FROM " . DB::table('topic_image') . " AS t WHERE t.tid > 0 " . $sql_where);
             }
         }
         $info = false;
         $limit_sql = '';
         $photo_i = 0;
         $topic_list = array();
         $user_lists = array();
         if ($total_photo > 0) {
             if ($param['perpage']) {
                 $page_arr = page($total_photo, $param['perpage'], $param['page_url'], array('return' => 'array'));
                 $limit_sql = $page_arr['limit'];
             } else {
                 if ($param['limit']) {
                     $limit_sql = ' LIMIT ' . $param['limit'];
                 } elseif ($param['count']) {
                     $limit_sql = ' LIMIT ' . $param['count'];
                 }
             }
             if ($param['vip']) {
                 $query = DB::query("SELECT t.id,t.tid,t.uid,t.name,t.width,t.height,t.dateline,tr.content,tr.content2,tr.forwards,tr.replys,tr.digcounts\r\n\t\t\t\t\t\t\t\t\tFROM " . DB::table('topic_image') . " AS t\r\n\t\t\t\t\t\t\t\t\tLEFT JOIN " . DB::table('topic') . " AS tr\r\n\t\t\t\t\t\t\t\t\tON t.tid = tr.tid\r\n\t\t\t\t\t\t\t\t\tleft join " . DB::table('members') . " as m\r\n\t\t\t\t\t\t\t\t\ton m.uid=t.uid\r\n\t\t\t\t\t\t\t\t\tWHERE t.tid > 0 and m.validate='1' " . $sql_where . "\r\n\t\t\t\t\t\t\t\t\tORDER BY t.id DESC\r\n\t\t\t\t\t\t\t\t\t{$limit_sql} ");
             } else {
                 $query = DB::query("SELECT t.id,t.tid,t.uid,t.name,t.width,t.height,t.dateline,tr.content,tr.content2,tr.forwards,tr.replys,tr.digcounts\r\n\t\t\t\t\t\t\t\t\tFROM " . DB::table('topic_image') . " AS t\r\n\t\t\t\t\t\t\t\t\tLEFT JOIN " . DB::table('topic') . " AS tr\r\n\t\t\t\t\t\t\t\t\tON t.tid = tr.tid\r\n\t\t\t\t\t\t\t\t\tWHERE t.tid > 0  " . $sql_where . "\r\n\t\t\t\t\t\t\t\t\tORDER BY t.id DESC\r\n\t\t\t\t\t\t\t\t\t{$limit_sql} ");
             }
             while ($value = DB::fetch($query)) {
                 $value['content'] .= $value['content2'];
                 $value['content'] = jhtmlspecialchars(strip_tags($value['content']));
                 if (!is_file(topic_image($value['id'], 'photo', 1))) {
                     $image_file = RELATIVE_ROOT_PATH . 'images/topic/' . face_path($value['id']) . $value['id'] . "_o.jpg";
                     $image_file_photo = RELATIVE_ROOT_PATH . 'images/topic/' . face_path($value['id']) . $value['id'] . "_p.jpg";
                     if ($value['width'] > 280) {
                         $p_width = 280;
                         $p_height = round($value['height'] * 280 / $value['width']);
                         $result = makethumb($image_file, $image_file_photo, $p_width, $p_height);
                     }
                     if ($value['width'] <= 280 || !$result && !is_file($image_file_photo)) {
                         @copy($image_file, $image_file_photo);
                     }
                 }
                 $value['photo'] = topic_image($value['id'], 'photo', 0);
                 $value['height'] = $value['width'] > 280 ? round($value['height'] * 280 / $value['width']) : $value['height'];
                 $value['width'] = $value['width'] > 280 ? 280 : $value['width'];
                 $value['dateline'] = my_date_format2($value['dateline']);
                 if (false != strpos($value['content'], '</U>')) {
                     $value['content'] = preg_replace('#\\<U(.*?)\\>(.*?)\\</U\\>#', '<a href="\\2" target="_blank">Click Here</a>', $value['content']);
                 }
                 if (false !== strpos($value['content'], 'http:/' . '/')) {
                     $value['content'] = preg_replace('~(http:/' . '/[a-z0-9-\\.\\?\\=&;_@/%#]+?)\\s+~i', '<a href="\\1" target="_blank">Click Here</a> ', $value['content']);
                     $value['content'] = preg_replace("|\\s*http:/" . "/[a-z0-9-\\.\\?\\=&;_@/%#]*\$|sim", "", $value['content']);
                 }
                 $topic_list[] = $value;
             }
             if ($topic_list) {
                 $topic_list_count = count($topic_list);
                 $topic_list = $this->TopicLogic->MakeAll($topic_list, 0);
                 $info = array('list' => $topic_list, 'count' => $param['count'] ? $topic_list_count : $total_photo, 'page' => $page_arr);
             }
         }
         cache_db('set', $cache_key, $info, $uid > 0 ? 3600 : 600);
     }
     if ($info['count'] > 0 && $info['list']) {
         if ($GLOBALS['_J']['config']['is_topic_user_follow'] && !$GLOBALS['_J']['disable_user_follow']) {
             $info['list'] = buddy_follow_html($info['list'], 'uid', 'follow_html2');
         }
         $pi = 0;
         $list = array();
         foreach ($info['list'] as $v) {
             $list[$pi++ % 3][] = $v;
         }
         $info['list'] = $list;
     }
     return $info;
 }
Example #10
0
 function get_bbs($param)
 {
     if (BBS_ENABLE) {
         if ($this->BbsType == 'discuz') {
             $table_p = DZ_BBS_VER == 'dzx' ? BBSDB::table('forum_post') : BBSDB::table('posts');
             $table_t = DZ_BBS_VER == 'dzx' ? BBSDB::table('forum_thread') : BBSDB::table('threads');
             $table_f = DZ_BBS_VER == 'dzx' ? BBSDB::table('home_favorite') : BBSDB::table('favorites');
             $table_ff = DZ_BBS_VER == 'dzx' ? BBSDB::table('forum_forum') : BBSDB::table('forums');
             $furl = DZ_BBS_VER == 'dzx' ? '/forum.php?mod=forumdisplay&fid=' : '/forumdisplay.php?fid=';
             $turl = DZ_BBS_VER == 'dzx' ? '/forum.php?mod=viewthread&tid=' : '/viewthread.php?tid=';
             $lurl = DZ_BBS_VER == 'dzx' ? '/forum.php?mod=redirect&tid=' : '/redirect.php?tid=';
             $where_sql = " p.invisible >=0 ";
             $order_by = " t.lastpost DESC ";
             if (!empty($param['where'])) {
                 if ($param['where'] == 'favorites') {
                     if (DZ_BBS_VER == 'dzx') {
                         $where_sql .= " AND p.first = 1 AND p.fid IN (SELECT id FROM {$table_f} WHERE idtype = 'fid' AND uid = " . MEMBER_UCUID . ") ";
                     } else {
                         $where_sql .= " AND p.first = 1 AND p.fid IN (SELECT fid FROM {$table_f} WHERE tid = '0' AND uid = " . MEMBER_UCUID . ") ";
                     }
                     $order_by = " p.pid DESC ";
                 } elseif ($param['where'] == 'favorite') {
                     if (DZ_BBS_VER == 'dzx') {
                         $where_sql .= " AND p.first = 1 AND p.tid IN (SELECT id FROM {$table_f} WHERE idtype = 'tid' AND uid = " . MEMBER_UCUID . ") ";
                     } else {
                         $where_sql .= " AND p.first = 1 AND p.tid IN (SELECT tid FROM {$table_f} WHERE fid = '0' AND uid = " . MEMBER_UCUID . ") ";
                     }
                 } elseif ($param['where'] == 'all') {
                     $where_sql .= " AND p.first = 1 ";
                     if ($fids = $this->_get_member_fid()) {
                         $where_sql .= " AND p.fid NOT IN (" . $fids . ") ";
                     }
                     $order_by = " p.pid DESC ";
                 } elseif ($param['where'] == 'thread') {
                     $where_sql .= " AND p.first = 1 AND p.authorid = " . MEMBER_UCUID;
                 } elseif ($param['where'] == 'reply') {
                     $where_sql .= " AND p.first = 0 AND p.authorid = " . MEMBER_UCUID;
                     $order_by = " p.pid DESC ";
                 }
             }
         } elseif ($this->BbsType == 'phpwind') {
             $table_ff = BBSDB::table('forums');
             $where_sql = ' p.fid !=0 ';
             $furl = '/thread.php?fid=';
             $turl = '/read.php?tid=';
             $lurl = '/read.php?tid=';
             if (!empty($param['where'])) {
                 if ($param['where'] == 'favorite') {
                     $table_p = BBSDB::table('collection');
                     $where_sql = " p.type ='postfavor' AND p.uid = " . MEMBER_UCUID;
                 } elseif ($param['where'] == 'all') {
                     $table_p = BBSDB::table('threads');
                 } elseif ($param['where'] == 'thread') {
                     $table_p = BBSDB::table('threads');
                     $where_sql .= " AND p.authorid = " . MEMBER_UCUID;
                 } elseif ($param['where'] == 'reply') {
                     $table_p = BBSDB::table('posts');
                     $where_sql .= " AND p.authorid = " . MEMBER_UCUID;
                 } else {
                     return false;
                 }
             }
         }
         $total_record = BBSDB::result_first("SELECT COUNT(*) FROM {$table_p} AS p WHERE {$where_sql} LIMIT 1000");
         if ($total_record > 0) {
             if ($param['perpage']) {
                 $page_arr = page($total_record, $param['perpage'], $param['page_url'], array('return' => 'array'));
                 $limit_sql = $page_arr['limit'];
             } else {
                 if ($param['limit']) {
                     $limit_sql = ' LIMIT ' . $param['limit'];
                 }
             }
             if ($this->BbsType == 'discuz') {
                 $query = BBSDB::query("SELECT p.pid,p.tid,p.fid,p.authorid,p.author,p.subject,p.message,p.dateline,p.first,t.author AS t_username,t.subject AS t_title,t.dateline AS t_dateline,t.authorid AS t_authorid,t.replies,t.lastpost,ff.name FROM {$table_p} p LEFT JOIN {$table_t} t ON p.tid = t.tid LEFT JOIN {$table_ff} ff ON p.fid = ff.fid WHERE {$where_sql} ORDER BY {$order_by} {$limit_sql} ");
             } elseif ($this->BbsType == 'phpwind') {
                 if ($param['where'] == 'favorite') {
                     $table_fc = BBSDB::table('collection');
                     $table_t = BBSDB::table('tmsgs');
                     $table_p = BBSDB::table('threads');
                     $where_sql = " p.tid IN(SELECT typeid FROM {$table_fc} WHERE type ='postfavor' AND uid = " . MEMBER_UCUID . ")";
                     $order_by = ' p.lastpost DESC ';
                     $query = BBSDB::query("SELECT p.tid,p.tid AS pid,p.lastpost,p.tid AS first,p.fid,p.authorid,p.authorid AS t_authorid,p.author,p.subject,t.content AS message,p.postdate AS dateline,p.replies,ff.name FROM {$table_p} p LEFT JOIN {$table_t} t ON p.tid = t.tid LEFT JOIN {$table_ff} ff ON p.fid = ff.fid WHERE {$where_sql} ORDER BY {$order_by} {$limit_sql} ");
                 } elseif ($param['where'] == 'all') {
                     $table_t = BBSDB::table('tmsgs');
                     $table_p = BBSDB::table('threads');
                     $order_by = ' p.tid DESC ';
                     $query = BBSDB::query("SELECT p.tid,p.tid AS pid,p.lastpost,p.tid AS first,p.fid,p.authorid,p.authorid AS t_authorid,p.author,p.subject,t.content AS message,p.postdate AS dateline,p.replies,ff.name FROM {$table_p} p LEFT JOIN {$table_t} t ON p.tid = t.tid LEFT JOIN {$table_ff} ff ON p.fid = ff.fid WHERE {$where_sql} ORDER BY {$order_by} {$limit_sql} ");
                 } elseif ($param['where'] == 'thread') {
                     $table_t = BBSDB::table('tmsgs');
                     $table_p = BBSDB::table('threads');
                     $where_sql .= " AND p.authorid = " . MEMBER_UCUID;
                     $order_by = ' p.lastpost DESC ';
                     $query = BBSDB::query("SELECT p.tid AS pid,p.lastpost,p.tid AS first,p.tid,p.fid,p.authorid,p.authorid AS t_authorid,p.author,p.subject,t.content AS message,p.postdate AS dateline,p.replies,ff.name FROM {$table_p} p LEFT JOIN {$table_t} t ON p.tid = t.tid LEFT JOIN {$table_ff} ff ON p.fid = ff.fid WHERE {$where_sql} ORDER BY {$order_by} {$limit_sql} ");
                 } elseif ($param['where'] == 'reply') {
                     $table_p = BBSDB::table('posts');
                     $table_t = BBSDB::table('threads');
                     $where_sql .= " AND p.authorid = " . MEMBER_UCUID;
                     $order_by = ' p.pid DESC ';
                     $query = BBSDB::query("SELECT p.pid,t.lastpost,p.tid,p.fid,p.authorid,p.author,p.subject,p.content AS message,p.postdate AS dateline,t.author AS t_username,t.subject AS t_title,t.postdate AS t_dateline,t.authorid AS t_authorid,t.replies,ff.name FROM {$table_p} p LEFT JOIN {$table_t} t ON p.tid = t.tid LEFT JOIN {$table_ff} ff ON p.fid = ff.fid WHERE {$where_sql} ORDER BY {$order_by} {$limit_sql} ");
                 }
             }
             $topic_list = array();
             while ($value = BBSDB::fetch($query)) {
                 if ($user_lists[$value['authorid']]) {
                     $p_m_user = $user_lists[$value['authorid']];
                 } else {
                     $p_user = $this->TopicLogic->GetMember($this->_getuid($value['authorid']), "`uid`,`ucuid`,`nickname`,`face`,`level`,`signature`,`validate`,`validate_category`");
                     $p_m_user = empty($p_user) ? array() : jsg_member_make($p_user);
                     $user_lists[$value['authorid']] = $p_m_user;
                 }
                 if ($user_lists[$value['t_authorid']]) {
                     $t_m_user = $user_lists[$value['t_authorid']];
                 } else {
                     $t_user = $this->TopicLogic->GetMember($this->_getuid($value['t_authorid']), "`uid`,`ucuid`,`nickname`,`face`,`level`,`signature`,`validate`,`validate_category`");
                     $t_m_user = empty($t_user) ? array() : jsg_member_make($t_user);
                     $user_lists[$value['t_authorid']] = $t_m_user;
                 }
                 $topic_list[$value['pid']]['pid'] = $value['pid'];
                 $topic_list[$value['pid']]['dateline'] = my_date_format2($value['dateline']);
                 $topic_list[$value['pid']]['t_dateline'] = my_date_format2($value['t_dateline']);
                 $topic_list[$value['pid']]['lastpost'] = my_date_format2($value['lastpost']);
                 $topic_list[$value['pid']]['content'] = $this->_format($value['message']);
                 $topic_list[$value['pid']]['content_full'] = $this->_format($value['message'], 'long');
                 $topic_list[$value['pid']]['t_title'] = $this->_format($value['t_title']);
                 $topic_list[$value['pid']]['title'] = $this->_format($value['subject']);
                 $topic_list[$value['pid']]['face'] = $p_m_user['face'];
                 $topic_list[$value['pid']]['level'] = $p_m_user['level'];
                 $topic_list[$value['pid']]['t_nickname'] = empty($t_m_user['nickname']) ? $value['t_username'] : $t_m_user['nickname'];
                 $topic_list[$value['pid']]['nickname'] = empty($p_m_user['nickname']) ? $value['author'] : $p_m_user['nickname'];
                 $topic_list[$value['pid']]['bbsurl'] = BBS_API_URL . $turl . $value['tid'];
                 $topic_list[$value['pid']]['lasturl'] = BBS_API_URL . $lurl . $value['tid'] . '&goto=lastpost#lastpost';
                 $topic_list[$value['pid']]['replys'] = $value['replies'];
                 $topic_list[$value['pid']]['username'] = $value['author'];
                 $topic_list[$value['pid']]['first'] = $value['first'];
                 $topic_list[$value['pid']]['t_username'] = $value['t_username'];
                 $topic_list[$value['pid']]['longtext'] = $this->_format($value['message'], 'islong');
                 $topic_list[$value['pid']]['forumtitle'] = $value['name'];
                 $topic_list[$value['pid']]['forumurl'] = BBS_API_URL . $furl . $value['fid'];
                 $topic_list[$value['pid']]['uid'] = $p_m_user['uid'];
                 $topic_list[$value['pid']]['tid'] = $value['pid'];
                 $topic_list[$value['pid']]['rid'] = $value['tid'];
                 $topic_list[$value['pid']]['tuid'] = $t_m_user['uid'];
                 $topic_list[$value['pid']]['signature'] = $p_m_user['signature'];
                 $topic_list[$value['pid']]['validate_html'] = $p_m_user['validate_html'];
                 $topic_list[$value['pid']]['t_validate_html'] = $t_m_user['validate_html'];
             }
             $info = array('list' => $topic_list, 'count' => $total_record, 'page' => $page_arr);
             return $info;
         }
     }
     return false;
 }
Example #11
0
 function DoList()
 {
     $options = array();
     if (($per_page_num = (int) jconf::get('show', 'topic', $this->Code)) < 1) {
         $per_page_num = 20;
     }
     $uid = (int) get_param('uid');
     $is_personal = (int) get_param('is_personal');
     $tag_id = (int) get_param('tag_id');
     $topic_parent_disable = false;
     $start = max(0, (int) $start);
     $limit = "limit {$start},{$per_page_num}";
     $next = $start + $per_page_num;
     if ($tag_id > 0) {
         $sql = "select `item_id` from `" . TABLE_PREFIX . "topic_tag` where `tag_id`='{$tag_id}' order by `item_id` desc {$limit}";
         $query = $this->DatabaseHandler->Query($sql);
         $topic_ids[0] = 0;
         while (false != ($row = $query->GetRow())) {
             $topic_ids[$row['item_id']] = $row['item_id'];
         }
         $options['tid'] = $topic_ids;
     }
     $options['perpage'] = $per_page_num;
     $tpl = 'topic_list_ajax';
     if ('myhome' == $this->Code) {
         $uid = MEMBER_ID;
         $cache_time = 600;
         $cache_key = "{$uid}-topic-myhome--0";
         $topic_myhome_time_limit = 0;
         if ($this->Config['topic_myhome_time_limit'] > 0) {
             $topic_myhome_time_limit = time() - $this->Config['topic_myhome_time_limit'] * 86400;
             if ($topic_myhome_time_limit > 0) {
                 $options['dateline'] = $topic_myhome_time_limit;
             }
         }
         $topic_uids[$uid] = $uid;
         if ($is_personal) {
             if (false === cache_db('get', $cache_key)) {
                 $buddyids = get_buddyids(MEMBER_ID, $this->Config['topic_myhome_time_limit']);
                 if ($buddyids) {
                     $topic_uids = array_merge($topic_uids, $buddyids);
                 }
             }
         }
         $options['uid'] = $topic_uids;
     } else {
         if ('myat' == $this->Code) {
             $uid = MEMBER_ID;
             $rets = jtable('topic_mention')->get_ids(array('uid' => $uid, 'sql_order' => ' `id` DESC ', 'perpage' => $options['perpage'], 'page_url' => $options['page_url']), 'tid', 1);
             $total_record = $rets['count'];
             $page_arr = $rets['page'];
             $topic_list = $total_record > 0 && $rets['ids'] ? $this->TopicLogic->Get($rets['ids']) : array();
             $topic_list_get = true;
         } else {
             if ('groupview' == $this->Code) {
                 $gid = jget('gid', 'int');
                 $g_view_uids = array();
                 if ($gid > 0) {
                     $ginfo = jtable('buddy_follow_group')->info($gid);
                     if ($ginfo && $ginfo['count'] > 0 && $ginfo['uid'] == MEMBER_ID) {
                         $groupid = $gid;
                         $groupname = $ginfo['name'];
                         $g_view_uids = jtable('buddy_follow_group_relation')->get_my_group_uids(MEMBER_ID, $gid);
                     }
                 }
                 if ($g_view_uids) {
                     $options['uid'] = $g_view_uids;
                 } else {
                     exit;
                 }
             } else {
                 if ('mylastpublish' == $this->Code) {
                     $topic_list = $this->TopicLogic->Get(" where `uid`='" . MEMBER_ID . "' order by `dateline` desc limit 0,1 ");
                     $temp_last_topic = end($topic_list);
                     if ($temp_last_topic['item'] == 'reward' && !$this->item) {
                         $this->item = 'reward';
                     }
                     $no_from = false;
                     $ref_mod = $this->Post['ref_mod'];
                     $talk_r = $this->Post['r'];
                     if ($talk_r == 'answer' || $talk_r == 'talk') {
                         $tpl = 'talk_item_ajax';
                     }
                     $ref_code = $this->Post['ref_code'];
                     $no_from = $this->_no_from($ref_mod, $ref_code);
                     $topic_list_get = true;
                     if ($ref_mod == 'live' || $ref_mod == 'talk') {
                         foreach ($topic_list as $key => $val) {
                             $item = $topic_list[$key]['item'];
                             $itemid = $topic_list[$key]['item_id'];
                             $uid = $topic_list[$key]['uid'];
                             $user_type = DB::result_first("SELECT type FROM " . DB::table('item_user') . " WHERE item = '{$item}' AND itemid='{$itemid}' AND uid = '{$uid}'");
                             $topic_list[$key]['user_css'] = $item . $user_type;
                             if ($ref_mod == 'talk' && $user_type == 'guest') {
                                 $topic_list[$key]['user_str'] = '本期嘉宾';
                             } else {
                                 $topic_list[$key]['user_str'] = '&nbsp;';
                             }
                         }
                         $no_mBlog_linedot2 = false;
                     } else {
                         $no_mBlog_linedot2 = true;
                     }
                 } else {
                     if ('updatecurrent' == $this->Code) {
                         $tid = intval($this->Post['tid']);
                         if (empty($tid)) {
                             exit;
                         }
                         $refcode = trim($this->Post['refcode']);
                         $refmod = trim($this->Post['refmod']);
                         $tpl = 'topic_item_ajax';
                         if ('topic' == $refmod && 'myfavorite' == $refcode) {
                             $sql = "SELECT TF.dateline as favorite_time , T.*\r\n\t\t\t\t\t\tFROM " . DB::table("topic_favorite") . " AS TF\r\n\t\t\t\t\t\tLEFT JOIN " . DB::table("topic") . " AS T\r\n\t\t\t\t\t\tON T.tid=TF.tid where T.tid='{$tid}'";
                             $this->Code = $refcode;
                             $topic_parent_disable = true;
                         } else {
                             $sql = "SELECT * FROM " . DB::table('topic') . " WHERE tid='{$tid}'";
                         }
                         $data = DB::fetch_first($sql);
                         if (empty($data)) {
                             exit;
                         }
                         if (isset($data['favorite_time'])) {
                             $data['favorite_time'] = my_date_format2($data['favorite_time']);
                         }
                         $val = $this->TopicLogic->Make($data, 0, array(), 0);
                         $topic_list[] = $val;
                         $no_from = false;
                         if ('vote' == $refmod && 'view' == $refcode) {
                             $no_from = true;
                         }
                         if ($refmod == 'qun') {
                             $this->Module = 'qun';
                         }
                         if ($refcode == 'reply_list_ajax') {
                             $tpl = 'topic_comment_item';
                             $topic_parent_disable = true;
                             $v = $val;
                         }
                         $topic_list_get = true;
                     } else {
                         if ('mycomment' == $this->Code) {
                             $options['where'] = " `touid`='" . MEMBER_ID . "' ";
                         } elseif ('tocomment' == $this->Code) {
                             $title = '我评论的';
                             $topic_selected = 'tocomment';
                             $options['where'] = " `uid` = '" . MEMBER_ID . "' and `type` in ('both','reply') ";
                         } elseif ('myblog' == $this->Code) {
                             $options['uid'] = $uid;
                         } else {
                             if ('myfavorite' == $this->Code) {
                                 $uid = MEMBER_ID;
                                 $sql = "select TF.dateline as favorite_time , T.* from `" . TABLE_PREFIX . "topic_favorite` TF left join `" . TABLE_PREFIX . "topic` T on T.tid=TF.tid where TF.uid='{$uid}' order by TF.id desc {$limit}";
                                 $query = $this->DatabaseHandler->Query($sql);
                                 while (false != ($row = $query->GetRow())) {
                                     if ($row['tid'] < 1) {
                                         continue;
                                     }
                                     $row['favorite_time'] = my_date_format2($row['favorite_time']);
                                     $topic_list[$row['tid']] = $row;
                                 }
                                 $topic_list = $this->TopicLogic->MakeAll($topic_list);
                                 $topic_list_get = true;
                             } else {
                                 if ('favoritemy' == $this->Code) {
                                     $uid = MEMBER_ID;
                                     $sql = "select TF.dateline as favorite_time , TF.tuid , T.* from `" . TABLE_PREFIX . "topic_favorite` TF left join `" . TABLE_PREFIX . "topic` T on T.tid=TF.tid where TF.tuid='{$uid}' order by TF.id desc {$limit}";
                                     $query = $this->DatabaseHandler->Query($sql);
                                     $tuids = array();
                                     while (false != ($row = $query->GetRow())) {
                                         if ($row['tid'] < 1) {
                                             continue;
                                         }
                                         $row['favorite_time'] = my_date_format2($row['favorite_time']);
                                         $topic_list[$row['tid']] = $row;
                                         $tuids[$row['tuid']] = $row['tuid'];
                                     }
                                     $topic_list = $this->TopicLogic->MakeAll($topic_list);
                                     if ($tuids) {
                                         $topic_members = $this->TopicLogic->GetMember($tuids, "`uid`,`ucuid`,`username`,`nickname`,`face_url`,`face`,`validate`");
                                     }
                                     $topic_parent_disable = true;
                                     $topic_list_get = true;
                                 } else {
                                     if ('topicnew' == $params['code']) {
                                         $title = '最新内容';
                                         $options['where'] = '';
                                         $orderby = in_array($this->Get['orderby'], array('post', 'dig', 'mark')) ? $this->Get['orderby'] : 'dig';
                                         if ($orderby == 'mark') {
                                             $order = ' `lastupdate` DESC';
                                         } elseif ($orderby == 'dig') {
                                             $order = ' `lastdigtime` DESC';
                                         } else {
                                             $options['type'] = array('first', 'forward', 'both');
                                             $order = ' `dateline` DESC';
                                         }
                                         $options['order'] = $order;
                                         if ($this->Get["date"] && strtotime($this->Get["date"]) > 0) {
                                             $dateline = strtotime($this->Get["date"]);
                                             $options['where'] .= " `dateline` > '" . $dateline . "' and `dateline`<'" . ($dateline + 86400) . "'";
                                         } else {
                                             $this->Get["date"] = date("Y-m-d", TIMESTAMP);
                                         }
                                         if (empty($options['type'])) {
                                             $options['type'] = get_topic_type();
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     #if NEDU
     defined('NEDU_MOYO') && nlogic('feeds.app.jsg')->on_ajax_topic_request($options);
     #endif
     if (!$topic_list_get) {
         if ($cache_time > 0 && $cache_key && !$options['tid']) {
             $options = jlogic('topic_list')->get_options($options, $cache_time, $cache_key);
         }
         $info = jlogic('topic_list')->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);
         }
         $relate_list = $this->TopicLogic->GetRelateTopic($topic_list);
     }
     if ($tpl == 'talk_item_ajax') {
         $answer_list = array();
         if ($parent_list) {
             $answer_list = $topic_list;
             $topic_list = $parent_list;
         }
         foreach ($topic_list as $key => $val) {
             if (empty($topic_list[$key]['touid'])) {
                 $topic_list[$key]['biank_css'] = 'talk_view_ping';
                 $topic_list[$key]['tubiao_css'] = 'talk_view_pin';
             } else {
                 $topic_list[$key]['biank_css'] = 'talk_view_wenda';
                 $topic_list[$key]['tubiao_css'] = 'talk_view_wen';
                 $topic_list[$key]['ask_list'] = $answer_list;
                 foreach ($topic_list[$key]['ask_list'] as $k => $v) {
                     $topic_list[$key]['ask_list'][$k]['tubiao_css'] = 'talk_view_da';
                     $topic_list[$key]['ask_list'][$k]['user_css'] = 'talkguest';
                 }
             }
         }
     }
     #if NEDU
     defined('NEDU_MOYO') && nlogic('feeds.app.jsg')->on_ajax_topic_response($topic_list, $page_arr);
     #endif
     include template($tpl);
 }
Example #12
0
}
?>
 </tr> <tr class="altbg2"> <?php 
if (is_array($app_statistics['data'])) {
    foreach ($app_statistics['data'] as $k => $v) {
        ?>
 <td><?php 
        echo $v['num'];
        ?>
</td> <?php 
    }
}
?>
 </tr> </tbody> </table> <div class="c"></div> <table cellspacing="1" cellpadding="4" width="100%" align="center" class="tableborder"> <tr class="header"> <td colspan="12"> <div> <span>其他数据统计<em>(最后更新时间:
<?php 
echo my_date_format2($other_statistics['time']);
?>
)</em></span> <span style="float:right;"><em><a href="javascript:void(0);" onclick="refalshStatic('other');">点击更新数据</a></em></span> </div> </td> </tr> <tbody id="other_tbody"> <tr class="altbg1"> <?php 
if (is_array($other_statistics['data'])) {
    foreach ($other_statistics['data'] as $k => $v) {
        ?>
 <td><?php 
        echo $v['name'];
        ?>
</td> <?php 
    }
}
?>
 </tr> <tr class="altbg2"> <?php 
if (is_array($other_statistics['data'])) {
    foreach ($other_statistics['data'] as $k => $v) {
Example #13
0
 function Notice()
 {
     $ids = (int) $this->Get['ids'];
     if ($ids) {
         $sql = "Select * From " . TABLE_PREFIX . 'notice' . " Where id = '{$ids}' ";
         $query = $this->DatabaseHandler->Query($sql);
         $view_notice = $query->GetRow();
         $title = $view_notice['title'];
         $content = $view_notice['content'];
         $dateline = my_date_format2($view_notice['dateline']);
         $sql = "select `id`,`title` from " . TABLE_PREFIX . 'notice' . " order by `dateline` desc  ";
         $query = $this->DatabaseHandler->Query($sql);
         $list_notice = array();
         while (false != ($row = $query->GetRow())) {
             $row['titles'] = cutstr($row['title'], 26);
             $list_notice[] = $row;
         }
         $this->Title = "网站公告 - {$view_notice['title']}";
     } else {
         $this->Title = '网站公告';
         $per_page_num = $this->ShowConfig['notice']['list'] ? $this->ShowConfig['notice']['list'] : 10;
         $query_link = "index.php?mod=" . ($_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module) . ($this->Code ? "&amp;code={$this->Code}" : "");
         $sql = " select count(*) as `total_record` from `" . TABLE_PREFIX . "notice`";
         $total_record = DB::result_first($sql);
         $page_arr = page($total_record, $per_page_num, $query_link, array('return' => 'array'));
         $sql = "select `id`,`title` from " . TABLE_PREFIX . 'notice' . " order by `dateline` desc {$page_arr['limit']} ";
         $query = $this->DatabaseHandler->Query($sql);
         $list_notice = array();
         while (false != ($row = $query->GetRow())) {
             $row['titles'] = cutstr($row['title'], 26);
             $list_notice[] = $row;
         }
     }
     include template('other/view_notice');
 }
Example #14
0
 function find($param)
 {
     if (!empty($param['where'])) {
         $where_sql .= " {$param['where']} ";
     }
     $order_sql = " ";
     if (!empty($param['order'])) {
         $order_sql = " {$param['order']} ";
     }
     $limit_sql = " ";
     if (!empty($param['limit'])) {
         $limit_sql = " {$param['limit']} ";
     }
     $vote_list = array();
     $count = max(0, (int) $param['count']);
     if ($count < 1) {
         $count_sql = "SELECT COUNT(*)\r\n\t\t\t\t\t\t  FROM " . DB::table('vote') . " AS v\r\n\t\t\t\t\t\t  WHERE {$where_sql}";
         $count = DB::result_first($count_sql);
     }
     if ($count) {
         if ($param['page']) {
             $_config = array('return' => 'array');
             $page_arr = page($count, $param['perpage'], $param['page_url'], $_config);
             $limit_sql = $page_arr['limit'];
         } elseif ($param['count']) {
             $limit_sql = " LIMIT {$count} ";
         }
         $uid_ary = array();
         $sql = "SELECT v.*,vf.*\r\n\t\t\t\t    FROM " . DB::table('vote') . " AS v\r\n\t\t\t\t\tLEFT JOIN " . DB::table('vote_field') . " AS vf\r\n\t\t\t\t\tUSING (vid)\r\n\t\t\t\t\tWHERE {$where_sql}\r\n\t\t\t\t\t{$order_sql}\r\n\t\t\t\t\t{$limit_sql} ";
         $query = DB::query($sql);
         while ($value = DB::fetch($query)) {
             $last_update_time = $value['lastvote'] ? $value['lastvote'] : $value['dateline'];
             $value['last_update_time'] = my_date_format2($last_update_time);
             $value['option'] = unserialize($value['option']);
             $value['input_type'] = $value['multiple'] ? 'checkbox' : 'radio';
             $value['is_expiration'] = false;
             if ($value['expiration'] <= TIMESTAMP) {
                 $value['is_expiration'] = true;
             }
             $value['expiration'] = my_date_format($value['expiration']);
             $vote_list[] = $value;
             $uid_ary[] = $value['uid'];
         }
         $def_items = 2;
         foreach ($vote_list as $key => $val) {
             $vote_itemss = $this->get_vote_item($val['vid'], MEMBER_ID);
             $vote_items = !empty($vote_itemss) ? $vote_itemss['option'] : array();
             $vote_list[$key]['is_vote'] = false;
             $vote_list[$key]['vote_show'] = $val['option'];
             if (!empty($vote_items)) {
                 $vi_count = count($vote_items);
                 $vote_list[$key]['vi_count'] = $vi_count;
                 $vote_list[$key]['is_vote'] = true;
                 $vote_list[$key]['hasfollowed'] = $vote_itemss['follow_vote'];
                 if ($vi_count >= $def_items) {
                     $vote_list[$key]['vote_show'] = array_slice($vote_items, 0, $def_items);
                 } else {
                     $item = $vote_items[0];
                     $index = array_search($item, $vote_list[$key]['vote_show']);
                     if ($index !== false) {
                         unset($vote_list[$key]['vote_show'][$index]);
                         array_unshift($vote_list[$key]['vote_show'], $item);
                     } else {
                         unset($vote_list[$key]['vote_show'][$def_items - 1]);
                         array_unshift($vote_list[$key]['vote_show'], $item);
                     }
                 }
             }
             if ($val['lastvote'] > 0) {
                 $last_vote_data = DB::fetch_first("SELECT vu.*,m.nickname FROM " . DB::table('vote_user') . " AS vu LEFT JOIN " . DB::table("members") . " AS m  USING (uid) WHERE vu.dateline = '" . $val['lastvote'] . "'");
                 $last_vote_data['option'] = unserialize($last_vote_data['option']);
                 $last_vote_data['option'] = '"' . implode('","', $last_vote_data['option']) . '"';
                 $vote_list[$key]['lusername'] = $last_vote_data['username'];
                 $vote_list[$key]['lnickname'] = $last_vote_data['username'] ? $last_vote_data['nickname'] : '***';
                 $vote_list[$key]['loption'] = $last_vote_data['option'];
                 $vote_list[$key]['last_vote_time'] = my_date_format($last_vote_data['dateline']);
             }
         }
         return array('count' => $count, 'vote_list' => $vote_list, 'uids' => array_unique($uid_ary), 'page' => $page_arr);
     }
     return false;
 }
Example #15
0
 function get_cms($param)
 {
     if (CMS_ENABLE) {
         $table_p = CMSDB::table('archives');
         $table_t = CMSDB::table('arctype');
         $table_c = CMSDB::table('addonarticle');
         $table = CMSDB::table('feedback');
         $turl = "/plus/list.php?tid=";
         $furl = "/plus/view.php?aid=";
         $curl = "/plus/feedback.php?aid=";
         $where_sql = " p.arcrank =0 ";
         $order_by = " p.id DESC ";
         $total_record = CMSDB::result_first("SELECT COUNT(*) FROM {$table_p} AS p WHERE {$where_sql} LIMIT 1000");
         if ($total_record > 0) {
             if ($param['perpage']) {
                 $page_arr = page($total_record, $param['perpage'], $param['page_url'], array('return' => 'array'));
                 $limit_sql = $page_arr['limit'];
             } else {
                 if ($param['limit']) {
                     $limit_sql = ' LIMIT ' . $param['limit'];
                 }
             }
             $query = CMSDB::query("SELECT p.id,p.typeid,p.title,p.writer,p.description,p.pubdate,t.typename,c.body FROM {$table_p} p LEFT JOIN {$table_t} t ON p.typeid = t.id  LEFT JOIN {$table_c} c ON p.id = c.aid WHERE {$where_sql} ORDER BY {$order_by} {$limit_sql} ");
             $topic_list = array();
             while ($value = CMSDB::fetch($query)) {
                 if ($user_lists[$value['writer']]) {
                     $p_m_user = $user_lists[$value['writer']];
                 } else {
                     $p_user = $this->TopicLogic->GetMember($this->_getuid($value['writer']), "`uid`,`ucuid`,`nickname`,`face`,`level`,`signature`,`validate`,`validate_category`");
                     $p_m_user = empty($p_user) ? array() : jsg_member_make($p_user);
                     $user_lists[$value['writer']] = $p_m_user;
                 }
                 $replytime = CMSDB::result_first("SELECT dtime FROM {$table} WHERE aid = '" . $value['id'] . "' order by id DESC LIMIT 1");
                 $topic_list[$value['id']]['pid'] = $value['id'];
                 $topic_list[$value['id']]['replys'] = CMSDB::result_first("SELECT COUNT(*) FROM {$table} WHERE aid = '" . $value['id'] . "'");
                 $topic_list[$value['id']]['replytime'] = $replytime ? my_date_format2($replytime) : my_date_format2($value['pubdate']);
                 $topic_list[$value['id']]['replyurl'] = CMS_API_URL . $curl . $value['id'];
                 $topic_list[$value['id']]['dateline'] = my_date_format2($value['pubdate']);
                 $topic_list[$value['id']]['content'] = $this->_format($value['description']);
                 $topic_list[$value['id']]['content_full'] = $this->_format($value['body'], 'long');
                 $topic_list[$value['id']]['title'] = $this->_format($value['title']);
                 $topic_list[$value['id']]['face'] = $p_m_user['face'];
                 $topic_list[$value['id']]['level'] = $p_m_user['level'];
                 $topic_list[$value['id']]['nickname'] = empty($p_m_user['nickname']) ? $value['writer'] : $p_m_user['nickname'];
                 $topic_list[$value['id']]['cmsurl'] = CMS_API_URL . $furl . $value['id'];
                 $topic_list[$value['id']]['username'] = $value['writer'];
                 $topic_list[$value['id']]['longtext'] = $this->_format($value['body'], 'islong');
                 $topic_list[$value['id']]['typetitle'] = $value['typename'];
                 $topic_list[$value['id']]['typeurl'] = CMS_API_URL . $turl . $value['typeid'];
                 $topic_list[$value['id']]['uid'] = $p_m_user['uid'];
                 $topic_list[$value['id']]['tid'] = $value['id'];
                 $topic_list[$value['id']]['signature'] = $p_m_user['signature'];
                 $topic_list[$value['id']]['validate_html'] = $p_m_user['validate_html'];
             }
             $info = array('list' => $topic_list, 'count' => $total_record, 'page' => $page_arr);
             return $info;
         }
     }
     return false;
 }
Example #16
0
 function joined()
 {
     $page = empty($this->Get['page']) ? 0 : intval($this->Get['page']);
     $type = trim($this->Get['type']);
     $vid = empty($this->Get['vid']) ? 0 : intval($this->Get['vid']);
     if ($page == 0) {
         $page = 1;
     }
     $prepage = 6;
     $start = ($page - 1) * $prepage;
     $where_sql = " 1 ";
     $page_param = array();
     if ($type == 'follow') {
         $this->_check_login();
         $buddy_ids = get_buddyids(MEMBER_ID);
         $where_sql .= " AND vu.vid='{$vid}' AND uid IN(" . jimplode($buddy_ids) . ") ";
         $page_param = array('c' => 2);
     } else {
         $type = 'all';
         $where_sql .= " AND vu.vid='{$vid}' ";
         $page_param = array('c' => 1);
     }
     $order_sql = " vu.dateline DESC ";
     $count = DB::result_first("SELECT COUNT(*) FROM " . DB::table('vote_user') . " AS vu WHERE {$where_sql}");
     if ($count) {
         $query = DB::query("SELECT vu.*,m.nickname\r\n\t\t\t\t\t   FROM " . DB::table('vote_user') . " AS vu\r\n\t\t\t\t\t   LEFT JOIN " . DB::table("members") . " AS m\r\n\t\t\t\t\t   USING (uid)\r\n\t\t\t\t\t   WHERE {$where_sql}\r\n\t\t\t\t\t   ORDER BY {$order_sql}\r\n\t\t\t\t\t   LIMIT {$start},{$prepage}");
         while ($value = DB::fetch($query)) {
             $value['option'] = unserialize($value['option']);
             $value['option'] = '"' . implode('","', $value['option']) . '"';
             $value['dateline'] = my_date_format2($value['dateline']);
             if (empty($value['username'])) {
                 $value['nickname'] = '**';
             }
             $list[] = $value;
         }
         $multi = ajax_page($count, $prepage, $page, 'getVoteJoined', $page_param);
     }
     include template('vote/vote_ajax_joined');
 }