function getnavbycatid($catid = 0, $url = 'index.php?mod=cms&code=channel') { $info = $this->get_category_info($catid); $html = '<a href="index.php">部门工作</a>'; if ($info['likecatid']) { $upid = array_filter(explode(',', trim($info['likecatid'], ','))); foreach ($upid as $one) { $one = $this->get_category_info($one); $html .= '>><a href="' . jurl($url . '&id=' . $one['catid']) . '">' . $one['catname'] . '</a>'; } } return $html; }
function PublishBox() { $type = trim($this->Get['type']); $this->item = $item = trim($this->Get['item']); $this->item_id = $itemid = jget('itemid', 'int', 'G'); $this->totid = $totid = jget('totid', 'int', 'G'); $this->touid = $touid = jget('touid', 'int', 'G'); $url = jurl('index.php?mod=' . $item . '&code=view&id=' . $itemid); $users = ''; if ($item == 'live') { $live = $this->LiveLogic->id2liveinfo($itemid); if (!empty($live) && $live['host_guest']) { foreach ($live['host_guest'] as $key => $val) { $users .= ' @' . $val . ' '; } } $defaust_value = '发条微博,把直播推荐给朋友'; $content = '给大家推荐一个不错的直播,来看看吧:“' . $live['livename'] . '”,直播时间:' . $live['date'] . ' ' . $live['time'] . ',主持和嘉宾们 ' . $users . '都很给力呦。直播地址:' . $url; } elseif ($item == 'talk') { $talk = $this->TalkLogic->id2talkinfo($itemid); if (!empty($talk) && $talk['guest']) { foreach ($talk['guest'] as $key => $val) { $users .= ' @' . $val['nickname'] . ' '; } } if ($type == 'ask') { if ($touid > 0) { $username = '******' . DB::result_first("SELECT nickname FROM " . DB::table('members') . " WHERE uid='{$touid}'"); } else { $username = $users; } $defaust_value = '发条微博,向嘉宾提问'; $content = '向 ' . $username . ' 提问: '; } elseif ($type == 'answer') { $username = '******' . DB::result_first("SELECT nickname FROM " . DB::table('members') . " WHERE uid='{$touid}'"); $defaust_value = '发条微博,回答网友提问'; $content = '对 ' . $username . ' 回复: '; } else { $defaust_value = '发条微博,把访谈推荐给朋友'; $talk['time'] = str_replace('<br>', '', $talk['time']); $content = '给大家推荐一个不错的访谈: “' . $talk['talkname'] . '”,访谈嘉宾 ' . $users . ' 。访谈进行时间' . $talk['date'] . ' ' . $talk['time'] . '。赶紧去提问吧。' . $url; } } $this->Code = $type; $albums = jlogic('image')->getalbum(); include template('topic_publish_ajax'); exit; }
function goodsinfo() { $id = jget('id'); $info = jlogic('mall')->get_info($id); if ($info) { $config = jconf::get('mall'); $member = jsg_member_info(MEMBER_ID); if ($info['expire'] < TIMESTAMP) { $info['exp'] = '商品已过期'; } elseif ($info['price'] > $member[$config['credits']]) { $info['exp'] = '您的' . $config['credits_name'] . '不够'; } elseif ($info['credit'] > $member['credits']) { $info['exp'] = '您的总积分不够'; } else { $info['exp'] = ''; } $info['expire'] = my_date_format($info['expire']); $info['desc'] = nl2br($info['desc']); $this->Title = '商品详情 —— ' . $info['name']; $this->MetaKeywords = '积分兑换,商品详情'; $this->MetaDescription = $info['name']; $top_credit_members = jlogic('mall')->get_top_member_credits(); $feeds = jlogic('feed')->get_feed(5, "`action`='兑换了'"); $css['mall'] = ' class="current"'; $this->item = 'mall'; $this->item_id = $id; $h_key = 'mall'; $gets = array('mod' => 'mall', 'code' => 'goodsinfo', 'id' => $id); $page_url = 'index.php?' . url_implode($gets); $tids = jlogic('mall')->get_topic_by_goodsid($id); $options = array('tid' => $tids, 'perpage' => 5, 'page_url' => $page_url); $topic_info = jlogic('topic_list')->get_data($options); $topic_list = array(); if (!empty($topic_info)) { $topic_list = $topic_info['list']; $page_arr['html'] = $topic_info['page']['html']; } $albums = jlogic('image')->getalbum(); include template('mall_info'); } else { header('Location: ' . jurl('index.php?mod=mall')); } }
function join() { $qid = empty($this->Post['qid']) ? 0 : intval(trim($this->Post['qid'])); if ($qid == 0) { json_error('错误的操作'); } $qun_info = $this->QunLogic->get_qun_info($qid); if (empty($qun_info)) { json_error('当前' . $this->Config[changeword][weiqun] . '不存在或已经被删除'); } $r = $this->QunLogic->is_qun_member($qid, MEMBER_ID); if ($r) { json_error('你已经是当前' . $this->Config[changeword][weiqun] . '成员了'); } $join_type = $qun_info['join_type']; $tmp = $GLOBALS['_J']['member']; if (2 == $join_type) { json_error('当前' . $this->Config[changeword][weiqun] . '已禁止任何人再加入'); } $message = ''; if ($join_type == 1) { $message = trim($this->Post['message']); if (empty($message)) { $message = '什么都没有写'; } $message = getstr($message, 280, 1, 1); } $member = array('uid' => MEMBER_ID, 'username' => $tmp['username'], 'message' => $message); unset($tmp); $level = $this->QunLogic->qun_level($qid); if ($level['member_num'] <= $qun_info['member_num']) { json_error('已经达到人数上限无法再加入'); } $this->QunLogic->join_qun($qid, $member, $join_type); if ($join_type == 0) { $nickname = DB::result_first("SELECT nickname\r\n\t\t\t\t\t\t\t\t\t\t FROM " . DB::table('members') . "\r\n\t\t\t\t\t\t\t\t\t\t WHERE uid='{$qun_info['founderuid']}'"); $data = array('qid' => $qid, 'nickname' => $nickname, 'qun_name' => $qun_info['name']); $txt_content = $this->_recd_msg('join_success', $data); $recd = true; $value = $txt_content; include template('qun/response_join'); } else { if ($join_type == 1) { $sendMessage = "我申请加入" . $qun_info['name'] . "。申请理由:" . $message . ",请点击审核!" . jurl("index.php?mod=qun&code=manage&op=check_member&qid=" . $qun_info['qid']); $founderinfo = jsg_member_info($qun_info['founderuid']); $sendR = jlogic("pm")->pmSend(array('to_user' => $founderinfo['nickname'], 'message' => $sendMessage)); json_result('申请加入成功,正在等待审核'); } } exit; }
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; }
function getRegiterMenu($nowStep = 2) { $menu = array(); $menuHTML = ''; if ($this->Config['reg_step3_radio']) { $menu[3]['name'] = '关注频道'; $menu[3]['url'] = jurl('index.php?mod=member&code=follow_channel'); } if ($this->Config['reg_step4_radio']) { $menu[4]['name'] = '关注达人'; $menu[4]['url'] = jurl('index.php?mod=member&code=follow_member'); } if ($this->Config['reg_step5_radio']) { $menu[5]['name'] = '上传头像'; $menu[5]['url'] = jurl('index.php?mod=member&code=add_face'); } if ($this->Config['reg_step6_radio']) { $menu[6]['name'] = '资料补全'; $menu[6]['url'] = jurl('index.php?mod=member&code=member_profile'); } if ($this->Config['reg_step7_radio']) { $menu[7]['name'] = '我的第一次'; $menu[7]['url'] = jurl('index.php?mod=member&code=do_first_topic'); } if ($menu) { $i = 1; foreach ($menu as $key => $val) { if ($key < $nowStep) { $menuHTML .= '<li class="t1"><em><a href="' . $val['url'] . '">' . $i . '、' . $val['name'] . '</a></em></li>'; } else { if ($key == $nowStep) { $menuHTML .= '<li class="t1 on"><em>' . $i . '、' . $val['name'] . '</em></li>'; } else { $menuHTML .= '<li class="t1"><em>' . $i . '、' . $val['name'] . '</em></li>'; } } $i++; } } $menuHTML = '<ol class="m-regStep">' . $menuHTML . '</ol>'; return $menuHTML; }
function _item_topic_from_mall($topic) { $mall_href = jurl('index.php?mod=mall&code=goodsinfo&id=' . $topic['item_id']); $mall_d_href = jurl('index.php?mod=mall'); $topic['from_html'] = $topic['from_string'] = "来自 积分商城"; $mall_info = jtable('mall_goods')->info($topic['item_id']); $subject = cut_str($mall_info['name'], 20); $sub_from = ''; if (!empty($subject)) { $sub_from = $subject; $topic['item_name'] = $subject; } if ($sub_from) { $topic['from_html'] = '来自 <a href="' . $mall_d_href . '">积分商城</a> >> <a href="' . $mall_href . '" target="_blank">' . $sub_from . '</a>'; } return $topic; }
public function cutProfile() { $w = (int) $this->Post['w']; $h = (int) $this->Post['h']; $x = (int) $this->Post['x']; $y = (int) $this->Post['y']; $image_path = RELATIVE_ROOT_PATH . 'images/temp/profile/' . face_path(MEMBER_ID); $image_name = MEMBER_ID . "_o.jpg"; $image_file = $image_path . $image_name; if (!$image_file) { if ($this->Get['home']) { echo '<script>parent.show_message("剪切错误!请重新上传图片");parent.closeDialog("showuploadform");</script>'; exit; } else { $this->Messager("剪切错误!请重新上传图片"); } } $member = $this->_member(); $image_thumb_file = RELATIVE_ROOT_PATH . 'images/profile/' . face_path($member['uid']) . "_o.jpg"; if (!is_dir($image_thumb_dir = dirname($image_thumb_file))) { jmkdir($image_thumb_dir); } list($w_src, $h_src) = getimagesize($image_file); if (!$w_src) { if ($this->Get['home']) { echo '<script>parent.show_message("剪切图片已不存在!");parent.closeDialog("showuploadform");</script>'; exit; } else { $this->Messager("剪切图片已不存在", jurl('index.php?mod=settings&code=profile')); } } if (!$w || !$h) { if ($w_src < 750) { $w = $w_src; $h = (int) ($w * (5 / 16)); } else { $w = 750; $h = (int) ($w * (5 / 16)); } } if ($w_src > 750) { $bili = $w_src / 750; round($w * $bili); $result = makethumb($image_file, $image_thumb_file, round($w * $bili), round($h * $bili), 0, 0, round($x * $bili), round($y * $bili), round($w * $bili), round($h * $bili)); if ($result) { jio()->DeleteFile($image_file); } } else { $result = makethumb($image_file, $image_thumb_file, $w, $h, 0, 0, $x, $y, $w, $h); if ($result) { jio()->DeleteFile($image_file); } } if ($this->Config['ftp_on']) { $ftp_key = randgetftp(); $get_ftps = jconf::get('ftp'); $site_url = $get_ftps[$ftp_key]['attachurl']; $ftp_result = ftpcmd('upload', $image_thumb_file, '', $ftp_key); if ($ftp_result > 0) { jio()->DeleteFile($image_thumb_file); $image_thumb_file = $site_url . '/' . str_replace('./', '', $image_thumb_file); } } if ($result) { $sql = "update `" . TABLE_PREFIX . "members` set profile_image='" . $image_thumb_file . "' where `uid`='" . MEMBER_ID . "'"; $this->DatabaseHandler->Query($sql); if ($this->Get['home']) { echo '<script>parent.show_message("已保存!");parent.location.replace(parent.location.href);parent.closeDialog("showuploadform");</script>'; exit; } else { $this->Messager("已保存", jurl('index.php?mod=settings&code=profile')); } } else { if ($this->Get['home']) { echo '<script>parent.show_message("保存失败!");parent.closeDialog("showuploadform");</script>'; exit; } else { $this->Messager("保存失败", jurl('index.php?mod=settings&code=profile')); } } }
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'); } if (isset($_GET['aid'])) { $type = 'image'; $albumid = jget('aid'); $albumname = jlogic('image')->getalbumname($albumid); $albumname = $albumname ? $albumname : '默认相册'; $addtitle = ' >> ' . $albumname; $count = jlogic('image')->albumimgnums($albumid); $albuminfo = jlogic('image')->getalbumbyid('album', $albumid); if ($count != $albuminfo['picnum']) { jlogic('image')->update_album_picnum($albumid, $count); } $pernum = 20; $pagehtml = page($count, $pernum, 'index.php?mod=album&aid=' . $albumid, array('return' => 'array')); $limit_sql = $pagehtml['limit']; $albums = jlogic('image')->getallalbumimg($albumid, $limit_sql); foreach ($albums as $key => $val) { $site_url = $val['site_url'] ? $val['site_url'] . '/' : ''; $albums[$key]['pic'] = $site_url . str_replace('./', '', str_replace('_o.jpg', '_s.jpg', $val['photo'])); $albums[$key]['albumname'] = $val['description'] ? cut_str($val['description'], 18) : ''; $albums[$key]['title'] = $val['description']; $albums[$key]['url'] = jurl('index.php?mod=album&code=viewimg&pid=' . $val['id']); $albums[$key]['rel'] = $val['photo'] ? $site_url . str_replace('./', '', $val['photo']) : ''; } $navtitle = '<a href="' . jurl('index.php?mod=album') . '">我的相册</a>' . $addtitle; } else { $type = 'album'; $count = jlogic('image')->albumnums(); $pernum = 9; $pagehtml = page($count, $pernum, 'index.php?mod=album', array('return' => 'array')); $limit_sql = $pagehtml['limit']; $albums = jlogic('image')->getalbum($limit_sql); $albums[0] = array('albumid' => 0, 'albumname' => '默认相册'); $purviewtext = array(0 => '所有人可见', 1 => '仅我关注的人可见', 2 => '仅我的粉丝可见', 3 => '仅我自己可见'); foreach ($albums as $key => $val) { $albums[$key]['pic'] = $val['pic'] ? str_replace('_o.jpg', '_s.jpg', $val['pic']) : 'images/noavatar.gif'; $albums[$key]['albumname'] = cut_str($val['albumname'], 18); $albums[$key]['title'] = $val['depict'] ? $val['depict'] : $val['albumname']; $albums[$key]['url'] = jurl('index.php?mod=album&aid=' . $val['albumid']); $albums[$key]['id'] = $val['albumid']; $albums[$key]['purview'] = $purviewtext[$val['purview']]; } $navtitle = '我的相册 >> 所有'; } $this->Title = '相册列表' . $addtitle; include template("album"); }
function getrcduser() { $tid = jget('tid', 'int', 'P'); if ($tid > 0) { $rcduser = DB::fetch_first("SELECT dateline,r_nickname FROM " . DB::table('topic_recommend') . " WHERE tid='{$tid}'"); $html = '<script type="text/javascript">$(document).ready(function(){$(".rcdusername").bind("mouseover", function(){$(this).show();});$(".rcdusername").bind("mouseout", function(){$(this).hide();});});</script>'; $html .= '<div class="rcdusername"><div style="text-align:center;background:#fdffd2;border:1px solid #ffecb0;padding:1px 10px;width:380px;overflow:hidden; margin:3px 0 0 80px"><p>推荐人:' . $rcduser['r_nickname'] . ',推荐时间:' . my_date_format($rcduser['dateline'], "Y-m-d H:i") . ',<a href="' . jurl('index.php?mod=topic&code=recd') . '">查看更多推荐</a></p></div></div>'; echo $html; } }
function getThisChannel($ch_id = 0) { $channel = DB::fetch_first("SELECT * FROM " . DB::table('channel') . " WHERE ch_id='{$ch_id}'"); $return = array('name' => '频道不存在', 'list' => 'txt', 'view' => 'post'); $navhtml = '<a href="' . jurl('index.php?mod=channel') . '" class="navLefthome">频道首页</a>'; if ($channel) { if ($channel['parent_id'] > 0) { $channelp = DB::fetch_first("SELECT ch_name FROM " . DB::table('channel') . " WHERE ch_id='{$channel['parent_id']}'"); $navhtml .= $channelp ? '<a href="' . jurl('index.php?mod=channel&id=' . $channel['parent_id']) . '" class="navLeftsub">' . $channelp['ch_name'] . '</a>' : ''; $navhtml .= '<a href="' . jurl('index.php?mod=channel&id=' . $channel['ch_id']) . '" class="navLeftsub2 subon">' . $channel['ch_name'] . '</a>'; } else { $navhtml .= '<a href="' . jurl('index.php?mod=channel&id=' . $channel['ch_id']) . '" class="navLeftsub subon">' . $channel['ch_name'] . '</a>'; } $my_channels = $this->mychannel(); $my_channels_key = array_keys($my_channels); $channel_buddy = follow_channel($channel['ch_id'], in_array($channel['ch_id'], $my_channels_key)); $navhtml .= '<span id="follow_channel" class="follow_c_' . $channel['ch_id'] . '">' . $channel_buddy . '</span>'; $navhtml .= '<div class="navinfo"><span>关注:<font class="follow_num_' . $channel['ch_id'] . '">' . $channel['buddy_numbers'] . '</font>人</span><span>内容:' . $channel['total_topic_num'] . '条</span></div>'; $return['description'] = $channel['description']; $return['name'] = $channel['ch_name']; $return['list'] = $channel['display_list']; $return['view'] = $channel['display_view']; } $return['navhtml'] = $navhtml; return $return; }
function nav_url($url, $top_nav_key = '', $side_nav_key = '') { if ($url && false === strpos($url, ':/' . '/')) { if ($top_nav_key) { $url .= (false !== strpos($url, '?') ? '&' : '?') . 'top_nav=' . $top_nav_key; } if ($side_nav_key) { $url .= (false !== strpos($url, '?') ? '&' : '?') . 'side_nav=' . $side_nav_key; } $url = jurl($url); } return $url; }
function getalbumname($aid = 0, $listall = 0, $url = 1, $uid = 0) { if ($listall) { $val = DB::fetch_first("SELECT a.albumname,a.uid,m.nickname FROM " . DB::table('album') . " a LEFT JOIN " . DB::table('members') . " m on a.uid=m.uid WHERE a.albumid = '{$aid}'"); if ($url) { return '<a href="' . jurl('index.php?mod=album&code=list&uid=' . $val['uid']) . '">' . $val['nickname'] . '的相册</a> >> ' . $val['albumname']; } else { return $val['albumname']; } } else { $uid = $uid ? $uid : MEMBER_ID; return DB::result_first("SELECT albumname FROM " . DB::table('album') . " WHERE uid = '{$uid}' and albumid = '{$aid}'"); } }
function Cpuser() { $type = jget('t'); $id = jget('id'); $CpLogic = jlogic('cp'); $users = $CpLogic->get_list_user($type, $id); $html = '<ul class="showatuser">'; foreach ($users as $val) { $val = jsg_member_make($val); $html .= "<li><a href='" . jurl('index.php?mod=' . $val['username']) . "' target='_blank'><img onerror='javascript:faceError(this);' src='{$val['face']}'></a><span><a href='" . jurl('index.php?mod=' . $val['username']) . "' target='_blank'>" . $val['nickname'] . "</a><span></li>"; } $html .= '</ul>'; echo $html; }
function Main() { $code_ary = array('myblog', 'myhome', 'tag', 'qun', 'recd', 'other', 'bbs', 'cms', 'department', 'company', 'channel', 'topicnew', 'bcj'); if (!in_array($this->Code, $code_ary)) { $tos = array('new' => 'index.php?mod=plaza', 'tc' => 'index.php?mod=plaza&code=new_tc', 'hotreply' => 'index.php?mod=plaza&code=hot_reply', 'hotforward' => 'index.php?mod=plaza&code=hot_forward', 'newreply' => 'index.php?mod=plaza&code=new_reply', 'newforward' => 'index.php?mod=plaza&code=new_forward', 'top' => 'index.php?mod=top&code=member', 'channellogin' => 'index.php?mod=channel'); if (isset($tos[$this->Code])) { $this->Messager(null, $tos[$this->Code]); exit; } unset($this->Code); } $channel_enable = jconf::get('channel') ? true : false; $content_dstr = $this->Config['in_publish_notice_str']; $content_ostr = $this->Config['on_publish_notice_str']; if ('topic' == trim($this->Get['mod']) && empty($this->Get['code']) && empty($this->Get['mod_original'])) { if (MEMBER_ID > 0) { if ($this->Config['topic_home_page']) { $this->Messager(null, $this->Config['topic_home_page']); } else { $this->Code = 'myhome'; } } else { $this->Messager('请<a onclick="ShowLoginDialog();return false;" title="快捷登录" rel="nofollow" href="index.php?mod=login" >点此登录</a>, 或<a href="index.php?mod=member">点此注册</a>一个帐号', null); return; } } $member = $this->_member(); if (!$member) { $this->Messager('请<a onclick="ShowLoginDialog();return false;" title="快捷登录" rel="nofollow" href="index.php?mod=login" >点此登录</a>, 或<a href="index.php?mod=member">点此注册</a>一个帐号', null); return false; } $title = ''; $per_page_num = 20; $topic_uids = $topic_ids = $order_list = $where_list = $params = array(); $where = $order = $limit = ""; $cache_time = 0; $cache_key = ''; $options = array(); $gets = array('mod' => $_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module, 'code' => $this->Code, 'type' => $this->Get['type'], 'gid' => $this->Get['gid'], 'qid' => $this->Get['qid'], 'chid' => $this->Get['chid'], 'view' => $this->Get['view'], 'filter' => $this->Get['filter'], 'orderby' => $this->Get['orderby']); $options['page_url'] = "index.php?" . url_implode($gets); unset($gets['type']); $type_url = "index.php?" . url_implode($gets); $params['uid'] = $uid = $member['uid']; $is_personal = $uid == MEMBER_ID; $params['is_personal'] = $is_personal; $params['code'] = $this->Code; if (!in_array($params['code'], $code_ary)) { $params['code'] = 'myblog'; } $page_str = $params['code']; if ($params['code'] == 'bbs' || $params['code'] == 'cms') { $page_str = 'myhome'; } if (($show_topic_num = (int) $this->ShowConfig['topic'][$page_str]) > 0) { $per_page_num = $show_topic_num; } $options['perpage'] = $per_page_num; $groupname = ''; $groupid = 0; $TopicListLogic = jlogic('topic_list'); #if NEDU if (defined('NEDU_MOYO')) { nui('jsg')->cindex($this, $params, $topic_list_get); } #endif $sendMail = false; $checkUser = false; if ($this->Config['sendmailday'] > 0) { if (!jsg_getcookie('mail_cookie')) { jsg_setcookie('mail_cookie', TIMESTAMP, 300); $sendMail = true; } if (!jsg_getcookie('check_user')) { jsg_setcookie('check_user', TIMESTAMP, 86400); $checkUser = true; } } $tpl = 'topic_index'; if ('myhome' == $params['code']) { $tpl = 'topic_myhome'; $topic_selected = 'myhome'; $type = get_param('type'); if ($type && !in_array($type, array('pic', 'video', 'music', 'vote', 'event'))) { $type = ''; } if ($type) { $params['type'] = $type; } $gid = max(0, (int) get_param('gid')); if ($gid) { $params['gid'] = $gid; } $topic_myhome_time_limit = 0; if ($this->Config['topic_myhome_time_limit'] > 0) { $topic_myhome_time_limit = TIMESTAMP - $this->Config['topic_myhome_time_limit'] * 86400; if ($topic_myhome_time_limit > 0) { $options['dateline'] = $topic_myhome_time_limit; } } $options['uid'] = array($member['uid']); if ($member['uid'] == MEMBER_ID) { $cache_time = 600; $cache_key = "{$member['uid']}-topic-myhome-{$type}-{$gid}"; $title = '我的首页'; $refresh_time = max(30, (int) $this->Config['ajax_topic_time']); if (get_param('page') < 2 && $member['lastactivity'] + $refresh_time < TIMESTAMP) { $new_topic = jlogic('buddy')->check_new_topic($uid, 1); if ($new_topic > 0) { cache_db('rm', "{$uid}-topic-%", 1); } } if ($gid) { $group_info = jtable('buddy_follow_group')->info($gid); if (empty($group_info) || MEMBER_ID != $group_info['uid']) { $this->Messager("当前分组不存在", 'index.php?mod=myhome'); } $query_link = "index.php?mod=" . ($_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module) . ($this->Code ? "&code={$this->Code}&type={$this->Get['type']}&gid={$this->Get['gid']}" : ""); if ($group_info['count'] > 0) { $g_view_uids = jtable('buddy_follow_group_relation')->get_my_group_uids(MEMBER_ID, $gid); } $groupid = $gid; $groupname = $group_info['name']; if ($g_view_uids) { $options['uid'] = $g_view_uids; } else { $this->Messager("没有设置用户,无法查看这个组的微博", 'index.php?mod=topic&code=group&gid=' . $gid); } $active[$gid] = "current"; } else { if ($type || false === cache_db('get', $cache_key)) { $buddyids = get_buddyids($params['uid'], $this->Config['topic_myhome_time_limit']); if ($buddyids) { $options['uid'] = array_merge($options['uid'], $buddyids); } } $active['all'] = "current"; } } else { $title = "{$member['nickname']}的微博"; $this->_initTheme($member); } if ($type) { $getTypeTidReturn = $TopicListLogic->GetTypeTid($type, $options['uid'], $options); $options['tid'] = $getTypeTidReturn['tid']; $options['count'] = $getTypeTidReturn['count']; $options['limit'] = $per_page_num; } } else { if ('channel' == $params['code'] && $this->Channel_enable && $this->Config['channel_enable']) { $viewtype = jget('view'); $ch_id = jget('cid'); $title = '我的频道微博'; if ($member['uid'] != MEMBER_ID) { $this->Messager("您无权查看该页面", null); } jlogic('member')->clean_new_remind('channel_new', MEMBER_ID); $orderby = in_array($this->Get['orderby'], array('post', 'dig', 'mark', 'ldig', 'top')) ? $this->Get['orderby'] : 'dig'; $ChannelLogic = jlogic('channel'); $my_buddy_channel = $ChannelLogic->mychannel(); $cachefile = jconf::get('channel'); $channel_channels = $cachefile['channels']; $channel_ids = array(); if (empty($my_buddy_channel)) { $channel_ids = array(0); } else { $my_chs = array_keys($my_buddy_channel); foreach ($my_chs as $val) { $channel_ids = array_merge($channel_ids, (array) $channel_channels[$val]); } if (is_array($channel_ids)) { $channel_ids = array_unique($channel_ids); } } $my_cannot_view_chids = jlogic('channel')->get_my_cannot_view_chids(); if ($my_cannot_view_chids) { foreach ($channel_ids as $key => $val) { if (in_array($val, $my_cannot_view_chids)) { unset($channel_ids[$key]); } } } $options['item'] = 'channel'; $options['item_id'] = $channel_ids; $options['type'] = array('first', 'channel'); if ($orderby == 'mark') { $order = ' lastupdate DESC'; } elseif ($orderby == 'dig') { $order = ' lastdigtime DESC'; } elseif ($orderby == 'ldig') { $order = ' digcounts DESC,lastdigtime DESC'; } else { $order = ' dateline DESC'; } $options['order'] = $order; if ($orderby == 'top') { $where = $channel_ids ? "tr.item = 'channel' AND tr.item_id IN(" . implode(",", $channel_ids) . ")" : "tr.item = 'channel'"; $options = array('where' => $where, 'perpage' => $per_page_num); $info = $TopicListLogic->get_recd_list($options); if (!empty($info)) { $total_record = $info['count']; $topic_list = $info['list']; $page_arr = $info['page']; } $topic_list_get = true; } } else { if ('company' == $params['code'] && $this->Config['company_enable'] && @is_file(ROOT_PATH . 'include/logic/cp.logic.php')) { $title = '我的单位微博'; if ($member['companyid'] < 1) { $this->Messager("您还不属于任何" . $d_c_name . ",请先加入某个" . $d_c_name . "!", 'index.php?mod=settings&code=base'); } jlogic('member')->clean_new_remind('company_new', MEMBER_ID); $viewtype = jget('view'); $options['uid'] = jlogic('cp')->getcpuids('company', $member['companyid']); if ($viewtype == 'secret') { $options['type'] = 'company'; } } else { if ('bcj' == $params['code'] && $this->Channel_enable && $this->Config['channel_enable']) { $ch_id = jget('cid', 'int'); $featureid = jget('view', 'int'); if ($ch_id == 3) { $title = '建议'; } elseif ($ch_id == 2) { $title = '提问'; } else { $title = '资讯'; if (!in_array($ch_id, array('4', '6'))) { $ch_id = 5; } } if (!in_array($featureid, array('1', '2', '3'))) { $featureid = 0; } $options['item'] = 'channel'; $options['item_id'] = $ch_id; $my_cannot_view_chids = jlogic('channel')->get_my_cannot_view_chids(); if ($my_cannot_view_chids && in_array($ch_id, $my_cannot_view_chids)) { $forbidden_view = true; $options['tid'] = 0; } if (isset($_GET['view'])) { $options['where'] = " featureid = '{$featureid}' "; } $options['page_url'] .= "&cid={$ch_id}"; } else { if ('department' == $params['code']) { $tpl = 'topic_department'; $title = ($this->Config['default_department'] ? $this->Config['default_department'] : '部门') . '微博'; if ($member['uid'] != MEMBER_ID) { $this->Messager("您无权查看该页面", null); } if (!($this->Config['department_enable'] && @is_file(ROOT_PATH . 'include/logic/cp.logic.php'))) { $this->Messager("网站没有开启该功能", null); } $views = array('all', 'my', 'other'); $view = trim($this->Get['view']); if (!in_array($view, $views)) { $view = 'other'; } $active[$view] = 'current'; $dids = array(); if ($member['departmentid'] > 0) { if ($view == 'my') { $dids[] = $member['departmentid']; } else { $sql = "select did\tfrom `" . TABLE_PREFIX . "buddy_department` where `uid`='" . MEMBER_ID . "'"; $query = $this->DatabaseHandler->Query($sql); while (false != ($row = $query->GetRow())) { $dids[] = $row['did']; } if ($view == 'all') { $dids[] = $member['departmentid']; } } } if ($dids) { $sql = "select `uid` from `" . TABLE_PREFIX . "members` where `departmentid` in(" . jimplode($dids) . ")"; $query = $this->DatabaseHandler->Query($sql); $options['uid'] = array(); while (false != ($row = $query->GetRow())) { $options['uid'][] = $row['uid']; } if (false != ($type = $this->Get['type']) && 'all' != $type) { $options['tid'] = $TopicListLogic->GetTypeTid($type, $options['uid']); } } else { $options['tid'] = array(); } if ($member['departmentid']) { $department = DB::fetch_first("SELECT * FROM " . DB::table('department') . " WHERE id='" . $member['departmentid'] . "'"); } $user_lp = $this->TopicLogic->GetMember(array($department['leaderid'], $department['managerid']), "`uid`,`ucuid`,`username`,`nickname`,`face`,`face_url`,`validate`,`validate_category`,`aboutme`"); $mybuddys = (array) get_buddyids(MEMBER_ID); $user_l = $user_lp[$department['leaderid']]; if ($user_l) { $user_l['here_name'] = $department['leadername']; $user_l['follow_html'] = follow_html2($department['leaderid'], in_array($department['leaderid'], $mybuddys)); $leader_list[] = $user_l; } $user_m = $user_lp[$department['managerid']]; if ($user_m) { $user_m['here_name'] = $department['managername']; $user_m['follow_html'] = follow_html2($department['managerid'], in_array($department['managerid'], $mybuddys)); $manager_list[] = $user_m; } $CpLogic = jlogic('cp'); $department_list = $CpLogic->Getdepartment($member['companyid'], $member['departmentid']); } else { if ('tag' == $params['code']) { $tpl = 'topic_tag'; $title = '我关注的话题'; if ($member['uid'] != MEMBER_ID) { $this->Messager("您无权查看该页面", null); } $views = array('new', 'new_reply', 'my_reply', 'recd'); $view = trim($this->Get['view']); if (!in_array($view, $views)) { $view = 'new'; } $active[$view] = 'current'; $tag_ids = jlogic('tag_favorite')->my_favorite_tag_ids(MEMBER_ID); if ($tag_ids) { if ('new' == $view) { $p = $options; $p['tag_id'] = $tag_ids; $p['sql_order'] = ' `item_id` DESC '; $rets = jtable('topic_tag')->get_ids($p, 'item_id', 1); $topic_list_get = true; $total_record = $rets['count']; $page_arr = $rets['page']; $topic_list = $total_record > 0 && $rets['ids'] ? $this->TopicLogic->Get($rets['ids']) : array(); } else { $sql = "select `item_id` from `" . TABLE_PREFIX . "topic_tag` where `tag_id` in('" . implode("','", $tag_ids) . "') ORDER BY `item_id` DESC LIMIT 2000 "; $query = $this->DatabaseHandler->Query($sql); $topic_ids = array(); while (false != ($row = $query->GetRow())) { $topic_ids[$row['item_id']] = $row['item_id']; } $options['tid'] = $topic_ids; unset($topic_ids); } if ($this->Get['type']) { $options['filter'] = $this->Get['type']; } if ($view == 'new_reply') { $options['where'] = " replys>0 "; $options['order'] = " lastupdate DESC "; } else { if ($view == 'recd') { $p = array('where' => " tr.recd >= 1 AND tr.item='tag' AND tr.item_id IN(" . jimplode($tag_ids) . ") ", 'perpage' => 10, 'filter' => $this->Get['type']); $info = $TopicListLogic->get_recd_list($p); if (!empty($info)) { $total_record = $info['count']; $topic_list = $info['list']; $page_arr = $info['page']; } $topic_list_get = true; } } } else { $topic_list_get = true; } if ($GLOBALS['_J']['member']['topic_new']) { jlogic('member')->clean_new_remind('topic_new', MEMBER_ID); } } else { if ('myblog' == $params['code']) { $this->myblog_no_recommend = TRUE; $tpl = 'topic_myblog'; $where = " 1 "; $options['uid'] = array($member['uid']); if ($this->Get['type']) { if ('profile' == $this->Get['type']) { $title = $member['gender_ta'] . '的资料'; $type = 'profile'; #用户填写的自定义添加项 $member_profile = jlogic('member_profile')->getMemberProfileInfo($member['uid']); if ($member_profile) { $member = array_merge($member, $member_profile); } #用户自定义添加项的可见度 $memberProfileSet = jlogic('member_profile')->getMemberProfileSet($member['uid']); $member_info = $member; if ($member_info['gender']) { if ($member_info['gender'] == 1) { $member_info['gender'] = '男'; } elseif ($member_info['gender'] == 2) { $member_info['gender'] = '女'; } } if ($member_info['bday']) { $bdayInt = strtotime($member_info['bday']); if (!$bdayInt) { unset($member_info['bday']); } } $member_info = array_filter($member_info); $groupProfile = jconf::get('groupprofile'); foreach ($groupProfile as $key_p => $group_p) { $keys_p = array_keys($group_p['list']); foreach ($keys_p as $key_one) { if ($member_info[$key_one]) { $groupProfile[$key_p]['isProfile'] = true; } continue; } } } if ('album' == $this->Get['type']) { $this->Title = ($member['uid'] == MEMBER_ID ? '我' : $member['nickname']) . '的相册'; $nav_url = $this->Title; $uid = $member['uid']; $imgid = jget('pid'); if (isset($_GET['aid'])) { $albumid = jget('aid'); $list_type = 'image'; $albumname = jlogic('image')->getalbumname($albumid, 0, 0, $uid); if ($albumid > 0 && $albumname) { if (!jlogic('image')->checkalbumbyid($albumid)) { $this->Messager("您没有权限浏览该相册", null); } $count = jlogic('image')->albumimgnums($albumid, 1); $albuminfo = jlogic('image')->getalbumbyid('album', $albumid); if ($count != $albuminfo['picnum']) { jlogic('image')->update_album_picnum($albumid, $count); } } else { $count = jlogic('image')->albumimgnums(0, 0, $uid); } $albumname = $albumname ? $albumname : ($albumid > 0 ? '错误页面' : '默认相册'); $pernum = 9; $pagehtml = page($count, $pernum, 'index.php?mod=' . $member['username'] . '&type=album&aid=' . $albumid, array('return' => 'array')); $limit_sql = $pagehtml['limit']; if ($albumid > 0) { $myalbums = jlogic('image')->getallalbumimg($albumid, $limit_sql, 1); } else { $myalbums = jlogic('image')->getallalbumimg(0, $limit_sql, 0, $uid); } foreach ($myalbums as $key => $val) { $myalbums[$key]['pic'] = $val['site_url'] . str_replace('./', '/', str_replace('_o.jpg', '_s.jpg', $val['photo'])); $myalbums[$key]['albumname'] = $val['description'] ? cut_str($val['description'], 18) : ''; $myalbums[$key]['title'] = $val['description']; $myalbums[$key]['url'] = jurl('index.php?mod=' . $member['username'] . '&type=album&pid=' . $val['id']); $myalbums[$key]['rel'] = $val['photo'] ? $val['site_url'] . '/' . str_replace('./', '', $val['photo']) : ''; } $nav_url = '<a href="index.php?mod=' . $member['username'] . '&type=album">' . $this->Title . '</a> >> ' . $albumname; } elseif ($imgid > 0) { $content_ostr = ''; $type = 'album'; $infos = jlogic('image')->get_uploadimg_byid($imgid, $uid); $imginfo = $infos[$imgid]; if (!$imginfo) { $this->Messager("不存在该图片", null); } if ($imginfo['albumid'] > 0 && !jlogic('image')->checkalbumbyid($imginfo['albumid'])) { $this->Messager("您没有权限浏览该图片", null); } $imginfo['photo'] = $imginfo['site_url'] . '/' . str_replace('./', '', $imginfo['photo']); $albumname = $imginfo['albumid'] > 0 ? jlogic('image')->get_albumname_byid($imginfo['albumid']) : '默认相册'; $imgname = $imginfo['description'] ? cut_str($imginfo['description'], 18) : $imginfo['name']; $imgwidth = $imginfo['width'] > 580 ? 580 : $imginfo['width']; $imgheight = $imginfo['width'] > 580 ? ceil($imginfo['height'] / $imginfo['width'] * 580) : $imginfo['height']; $imgsize = $imginfo['filesize'] > 0 ? $imginfo['filesize'] < 1024 * 100 ? round($imginfo['filesize'] / 1024, 1) . 'K' : round($imginfo['filesize'] / (1024 * 1024), 1) . 'M' : '未知'; $imgtime = my_date_format($imginfo['dateline']); $imgfrom = $imginfo['tid'] > 0 ? '<a href="' . jurl('index.php?mod=topic&code=' . $imginfo['tid']) . '">微博</a>' : ($imginfo['tid'] < 0 ? '私信' : '相册'); $this->item = 'topic_image'; $this->item_id = $imgid; $albumid = $imginfo['albumid']; $h_key = 'album'; $gets = array('mod' => $member['username'], 'type' => 'album', 'pid' => $imgid); $page_url = 'index.php?' . url_implode($gets); $tids = jlogic('image')->get_topic_by_imageid($imgid); $options = array('tid' => $tids, 'perpage' => 5, 'page_url' => $page_url); $topic_info = jlogic('topic_list')->get_data($options); $topic_list = array(); if (!empty($topic_info)) { $topic_list = $topic_info['list']; $page_arr['html'] = $topic_info['page']['html']; } $albums = jlogic('image')->getalbum(); $nav_url = '<a href="index.php?mod=' . $member['username'] . '&type=album">' . $this->Title . '</a> >> <a href="index.php?mod=' . $member['username'] . '&type=album&aid=' . ($imginfo['albumid'] > 0 ? $imginfo['albumid'] : 0) . '">' . $albumname . '</a> >> ' . ($imgname ? $imgname : '图片浏览'); } else { $list_type = 'album'; $count = jlogic('image')->albumnums(1, $uid); $pernum = 8; $pagehtml = page($count, $pernum, 'index.php?mod=' . $member['username'] . '&type=album', array('return' => 'array')); $limit_sql = $pagehtml['limit']; $myalbums = jlogic('image')->getalbum($limit_sql, 1, $uid); $myalbums[0] = array('albumid' => 0, 'albumname' => '默认相册'); $purview_name = $member['uid'] == MEMBER_ID ? '我' : $member['gender_ta']; $purviewtext = array(0 => '所有人可见', 1 => '仅' . $purview_name . '关注的人可见', 2 => '仅' . $purview_name . '的粉丝可见', 3 => '仅' . $purview_name . '自己可见'); foreach ($myalbums as $key => $val) { $myalbums[$key]['pic'] = $val['pic'] ? str_replace('_o.jpg', '_s.jpg', $val['pic']) : 'images/noavatar.gif'; $myalbums[$key]['albumname'] = cut_str($val['albumname'], 18); $myalbums[$key]['title'] = $val['depict'] ? $val['depict'] : $val['albumname']; $myalbums[$key]['url'] = jurl('index.php?mod=' . $member['username'] . '&type=album&aid=' . $val['albumid']); $myalbums[$key]['id'] = $val['albumid']; $myalbums[$key]['purview'] = $purviewtext[$val['purview']]; } } } if ('mycomment' == $this->Get['type']) { $title = '评论' . $member['gender_ta'] . '的'; if ($member['uid'] < 1) { $this->Messager("您无权查看该页面", null); } if ($member['comment_new']) { jlogic('member')->clean_new_remind('comment_new', $member['uid']); } $topic_selected = 'mycomment'; $_rets = jtable('member_relation')->get_tids($member['uid'], array('perpage' => $per_page_num), 1); if ($_rets) { $topic_list = $this->TopicLogic->Get($_rets['ids']); $total_record = $_rets['count']; $page_arr = $_rets['page']; unset($_rets); } $topic_list_get = true; } if ('tocomment' == $this->Get['type']) { $tpl = 'topic_myblog'; $title = $member['gender_ta'] . '评论的'; $topic_selected = 'mycomment'; unset($options['uid']); $options['where'] = "`uid` = '{$member['uid']}' and `type` in ('both','reply')"; } if ('vote' == $this->Get['type']) { $type = 'vote'; $tpl = 'topic_vote'; $perpage = $this->ShowConfig['vote']['list']; $perpage = empty($perpage) ? 20 : $perpage; $vote_where = ' 1 '; $filter = get_param('filter'); if ($filter == 'joined') { $vids = jlogic('vote')->get_joined($member['uid']); if (!empty($vids)) { $vote_where .= " AND `v`.`vid` IN(" . jimplode($vids) . ") "; } else { $vote_where = ' 0 '; } } else { if ($filter == 'new_update') { jlogic('member')->clean_new_remind('vote_new', $uid); $vids = jlogic('vote')->get_joined($uid); if (!empty($vids)) { $vote_where .= " AND `v`.`vid` IN(" . jimplode($vids) . ") "; } $vote_where .= " OR `v`.`uid`='{$uid}' "; } else { $vote_where .= " AND `v`.`uid`='{$uid}' "; $filter = 'created'; } } $vote_order_sql = ' ORDER BY lastvote DESC '; $vote_where .= " AND v.verify = 1"; $param = array('where' => $vote_where, 'order' => $vote_order_sql, 'page' => true, 'perpage' => $perpage, 'page_url' => $options['page_url']); $vote_info = jlogic('vote')->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); } $topic_list_get = true; } if ('event' == $this->Get['type']) { $type = 'event'; $tpl = 'topic_event'; $filter = get_param('filter'); $param = array('perpage' => "10", 'page' => true); $return = array(); if ($filter == 'joined') { $this->Title = $member['nickname'] . "参与的活动"; $param['where'] = " m.play = 1 and m.fid = '{$uid}' "; $param['order'] = " order by a.lasttime desc,a.app_num desc,a.posttime desc "; $param['page_url'] = $options['page_url']; $return = jlogic('event')->getEvents($param); } else { if ($filter == 'new_update') { jlogic('member')->clean_new_remind('event_new', $uid); $this->Title = "最近更新的活动"; $param['uid'] = $uid; $param['page_url'] = $options['page_url']; $return = jlogic('event')->getNewEvent($param); } else { $filter = 'created'; $this->Title = $member['nickname'] . "的活动"; $param['where'] = " a.postman = '{$uid}' and a.verify = 1 "; $param['order'] = " order by a.lasttime desc,a.app_num desc,a.posttime desc "; $param['page_url'] = $options['page_url']; $return = jlogic('event')->getEventInfo($param); } } $rs = $return['event_list']; $count = $return['count']; $page_arr = $return['page']; $topic_list_get = true; } if ('my_reply' == $this->Get['type']) { $title = $member['gender_ta'] . '评论的'; if ($member['uid'] != MEMBER_ID) { $this->Messager("您无权查看该页面", null); } } if ('mydig' == $this->Get['type']) { if ($member['dig_new']) { jlogic('member')->clean_new_remind('dig_new', $member['uid']); } } if (in_array($this->Get['type'], array('pic', 'video', 'music', 'attach', 'mydig', 'mydigout', 'my_reply'))) { if ($this->Get['follow'] && 'my_reply' != $this->Get['type']) { $buddyids = get_buddyids($params['uid'], $this->Config['topic_myhome_time_limit']); if ($buddyids) { $options['uid'] = $buddyids; } } $type = $dtype = $this->Get['type']; $options['get_list'] = 1; $getTypeTidReturn = $TopicListLogic->GetTypeTid($dtype, $options['uid'], $options); if (isset($getTypeTidReturn['list'])) { $topic_list = $getTypeTidReturn['list']; $total_record = $getTypeTidReturn['count']; $page_arr = $getTypeTidReturn['page']; $topic_list_get = true; } else { $options['tid'] = $getTypeTidReturn['tid']; $options['count'] = $getTypeTidReturn['count']; $options['limit'] = $per_page_num; if ($type == 'mydigout') { $options['uid'] = array(); } if ($type == 'mydig' || $type == 'mydigout') { $options['order'] = ' lastdigtime DESC '; } } } if ('forward' == $this->Get['type'] || 'first' == $this->Get['type']) { $p = $options; $p['type'] = 'forward'; if ('first' == $this->Get['type']) { $p['type'] = 'first'; } $p['sql_order'] = ' `forwards` DESC, `dateline` DESC '; if (!$p['sql_order']) { $p['sql_order'] = ' `dateline` DESC '; } $_rets = jtable('member_topic')->get_tids($member['uid'], $p, 1); $total_record = $_rets['count']; $page_arr = $_rets['page']; $topic_list = $this->TopicLogic->Get($_rets['ids']); $topic_list_get = true; } if ('my_verify' == $this->Get['type']) { $title = '审核中的微博'; if ('admin' != MEMBER_ROLE_TYPE) { if ($member['uid'] != MEMBER_ID) { $this->Messager("您无权查看该页面", -1); } } $sql = "select count(*) as `total_record` from `" . TABLE_PREFIX . "topic_verify` where managetype = 0"; $total_record = DB::result_first($sql); $page_arr = page($total_record, $per_page_num, $query_link, array('return' => "Array")); $sql = "select v.*\r\n\t\t\t\t\t\t\tfrom `" . TABLE_PREFIX . "topic_verify` v\r\n\r\n\t\t\t\t\t\t\twhere v.uid='{$uid}'\r\n\t\t\t\t\t\t\tand v.managetype = 0\r\n\t\t\t\t\t\t\torder by v.lastupdate desc {$page_arr['limit']}"; $query = $this->DatabaseHandler->Query($sql); while (false != ($row = $query->GetRow())) { if ($row['id'] < 1) { continue; } $row['tid'] = $row['id']; if ($row['longtextid']) { $row['content'] = jlogic('longtext')->longtext($row['longtextid']); unset($row['content2'], $row['longtextid']); } $topic_list[$row['id']] = $row; } $topic_list = $this->TopicLogic->MakeAll($topic_list); $topic_list_get = true; } } if ($this->Config['channel_enable']) { $myBuddyChannel = jlogic('channel')->mychannel($member['uid']); } $dateline = TIMESTAMP - 2592000; if (empty($this->Get['type']) || in_array($this->Get['type'], array('hot_reply', 'hot_forward', 'hot_dig'))) { $p = $options; $p['type'] = array('first', 'forward', 'both'); if ($this->Get['type']) { if ('hot_reply' == $this->Get['type']) { $p['>@replys'] = 0; $p['>@dateline'] = $dateline; $p['sql_order'] = ' `replys` DESC, `dateline` DESC '; } elseif ('hot_forward' == $this->Get['type']) { $p['>@forwards'] = 0; $p['>@dateline'] = $dateline; $p['sql_order'] = ' `forwards` DESC, `dateline` DESC '; } elseif ('hot_dig' == $this->Get['type']) { $p['>@digcounts'] = 0; $p['>@dateline'] = $dateline; $p['sql_order'] = ' `digcounts` DESC, `dateline` DESC '; } } if (!$p['sql_order']) { $p['sql_order'] = ' `dateline` DESC '; } $_rets = jtable('member_topic')->get_tids($member['uid'], $p, 1); $total_record = $_rets['count']; $page_arr = $_rets['page']; $topic_list = $this->TopicLogic->Get($_rets['ids']); $topic_list_get = true; $credit = jconf::get('credits'); foreach ($credit['ext'] as $key => $value) { $member['jifen'] .= $value['name'] . ':' . $member[$key] . ' '; } $title = '个人主页'; foreach ($topic_list as $key => $val) { if ($val[uid] == 0 && $val['anonymous_data'][uid] != MEMBER_ID) { unset($topic_list[$key]); } } } elseif ($this->Get['type'] == 'search' && trim($this->Get['q'])) { $_rets = jtable('topic')->get_ids(array('uid' => $member['uid'], 'like@content' => '%' . trim(jget('q')) . '%', 'sql_order' => '`dateline` desc', 'page_num' => 10), 'tid', 1); $total_record = $_rets['count']; $page_arr = $_rets['page']; $topic_list = $this->TopicLogic->Get($_rets['ids']); $topic_list_get = true; } if ($member['uid'] != MEMBER_ID) { $title = "{$member['nickname']}的微博"; $list_blacklist = is_blacklist($member['uid'], MEMBER_ID); $fg_code = 'hisblog'; $this->_initTheme($member); } else { $title = '我的微博'; $this->MetaKeywords = "{$member['nickname']}的微博"; } $buddys = array(); if (MEMBER_ID > 0 && $member['uid'] != MEMBER_ID) { $buddys = jlogic('buddy')->info($member['uid'], MEMBER_ID); $buddys['id'] = $buddys['touid']; } } else { if ('qun' == $params['code']) { $tpl = 'topic_qun'; $title = "我的" . $this->Config[changeword][weiqun]; $qun_setting = $this->Config['qun_setting']; if (!$qun_setting['qun_open']) { $this->Messager("当前站点没有开放" . $this->Config[changeword][weiqun] . "功能", null); } if (0 != $GLOBALS['_J']['member']['qun_new']) { jlogic('member')->clean_new_remind('qun_new', MEMBER_ID); } $views = array('new', 'new_reply', 'my_reply', 'recd'); $view = trim($this->Get['view']); if (!in_array($view, $views)) { $view = 'new'; } $active[$view] = "current"; $u = MEMBER_ID; if (false === ($my_qun_ids = cache_db('get', $cache_id = 'topic/' . $u . '-my_qun_ids'))) { $my_qun_ids = jtable('qun_user')->get_ids(array('uid' => $u), 'qid', 1); cache_db('set', $cache_id, $my_qun_ids, 300); } $qid_ary = $my_qun_ids['ids']; $join_qun_count = $my_qun_ids['count']; $qun_name = ''; if (!empty($qid_ary) && $join_qun_count > 0) { $where_sql = " 1 "; $order_sql = " t.dateline DESC "; $jget_type = jget('type', 'txt'); $jget_type = in_array($type, array('pic', 'video', 'music', 'vote')) ? $jget_type : ''; if ($jget_type) { if ('pic' == $jget_type) { $where_sql .= " AND t.`imageid` > 0 "; } else { if ('video' == $jget_type) { $where_sql .= " AND t.`videoid` > 0 "; } else { if ('music' == $jget_type) { $where_sql .= " AND t.`musicid` > 0 "; } else { if ('vote' == $jget_type) { $where_sql .= " AND t.item='vote' "; } else { $jget_type = ''; } } } } } $topic_get_flg = false; if ($view == 'new') { $where_sql .= " AND tq.item_id IN(" . jimplode($qid_ary) . ") "; } else { if ($view == 'new_reply') { $where_sql .= " AND tq.item_id IN(" . jimplode($qid_ary) . ") AND t.replys>0 "; $order_sql = " t.lastupdate DESC "; } else { if ($view == 'recd') { $p = array('where' => " tr.recd >= 1 AND tr.item='qun' AND tr.item_id IN(" . jimplode($qid_ary) . ") ", 'perpage' => $options['perpage'], 'filter' => $this->Get['type']); $info = $TopicListLogic->get_recd_list($p); if (!empty($info)) { $total_record = $info['count']; $topic_list = $info['list']; $page_arr = $info['page']; } $topic_get_flg = true; } } } if (!$topic_get_flg) { $total_record = DB::result_first("SELECT COUNT(*)\r\n\t\t\t\t\t\t\t\t\t\t\t FROM " . DB::table('topic') . " AS t\r\n\t\t\t\t\t\t\t\t\t\t\t LEFT JOIN " . DB::table('topic_qun') . " AS tq\r\n\t\t\t\t\t\t\t\t\t\t\t USING(tid)\r\n\t\t\t\t\t\t\t\t\t\t\t WHERE {$where_sql}"); if ($total_record > 0) { $page_arr = page($total_record, $options['perpage'], $options['page_url'], array('return' => 'array')); $query = DB::query("SELECT t.*\r\n\t\t\t\t\t\t\t\t\t\t\tFROM " . DB::table('topic') . " AS t\r\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN " . DB::table('topic_qun') . " AS tq\r\n\t\t\t\t\t\t\t\t\t\t\tUSING(tid)\r\n\t\t\t\t\t\t\t\t\t\t\tWHERE {$where_sql}\r\n\t\t\t\t\t\t\t\t\t\t\tORDER BY {$order_sql}\r\n\t\t\t\t\t\t\t\t\t\t\t{$page_arr['limit']} "); $topic_list = array(); while ($row = DB::fetch($query)) { $topic_list[$row['tid']] = $row; } $topic_list = $this->TopicLogic->MakeAll($topic_list); } } if (0 != $GLOBALS['_J']['member']['qun_new']) { jlogic('member')->clean_new_remind('qun_new', MEMBER_ID); } } $showConfig = $this->ShowConfig; $recd_qun_limit = (int) $showConfig['page_r']['recd_qun']; if ($recd_qun_limit) { $cache_id = 'topic/hot_qun-' . $recd_qun_limit; if (false === ($hot_qun = cache_file('get', $cache_id))) { $sql = "select * from `" . TABLE_PREFIX . "qun` where `recd` = 1 order by `member_num` desc limit {$recd_qun_limit} "; $query = $this->DatabaseHandler->Query($sql); $hot_qun = array(); $qunLogic = jlogic('qun'); while (false != ($row = $query->GetRow())) { $row['icon'] = $qunLogic->qun_avatar($row['qid'], 's'); $hot_qun[] = $row; } cache_file('set', $cache_id, $hot_qun, 3600); } } $topic_list_get = true; } else { if ('recd' == $params['code']) { $title = "官方推荐"; $view = trim($this->Get['view']); $where_sql = ''; if ($view == 'new_reply') { $where_sql = ' AND t.replys>0 '; } else { $view = 'all'; } $active[$view] = 'current'; $p = array('where' => ' tr.recd > 0 ' . $where_sql, 'perpage' => $options['perpage'], 'filter' => $this->Get['type']); $info = $TopicListLogic->get_recd_list($p); if (!empty($info)) { $total_record = $info['count']; $topic_list = $info['list']; $page_arr = $info['page']; } $topic_list_get = true; } else { if ('cms' == $params['code']) { $title = "网站资讯"; $param = array('perpage' => $options['perpage'], 'page_url' => $options['page_url']); $view = 'all'; $active[$view] = 'current'; $info = array(); if ($this->Config['dedecms_enable'] && jconf::get('dedecms')) { Load::logic("topic_cms"); $TopicCmsLogic = new TopicCmsLogic(); $info = $TopicCmsLogic->get_cms($param); $cms_url = CMS_API_URL; } if (!empty($info)) { $total_record = $info['count']; $topic_list = $info['list']; $page_arr = $info['page']; } $topic_list_get = true; } else { if ('bbs' == $params['code']) { $title = "我的论坛"; $view = trim($this->Get['view']); $where_sql = ''; if ($view == 'favorites') { $where_sql = 'favorites'; } else { if ($view == 'favorite') { $where_sql = 'favorite'; } else { if ($view == 'thread') { $where_sql = 'thread'; } else { if ($view == 'reply') { $where_sql = 'reply'; } else { if ($view == 'all') { $where_sql = 'all'; } else { if ($this->Config['dzbbs_enable']) { $view = 'favorites'; $where_sql = 'favorites'; } else { $view = 'all'; $where_sql = 'all'; } } } } } } $active[$view] = 'current'; $info = array(); $param = array('where' => $where_sql, 'perpage' => $options['perpage'], 'page_url' => $options['page_url']); if ($this->Config['dzbbs_enable'] && jconf::get('dzbbs') || $this->Config['phpwind_enable'] && $this->Config['pwbbs_enable'] && jconf::get('phpwind')) { Load::logic("topic_bbs"); $TopicBbsLogic = new TopicBbsLogic(); $info = $TopicBbsLogic->get_bbs($param); $bbs_url = BBS_API_URL; } if (!empty($info)) { $total_record = $info['count']; $topic_list = $info['list']; $page_arr = $info['page']; } $topic_list_get = true; } else { if ('topicnew' == $params['code']) { $title = '最新内容'; $options['where'] = ''; $params['orderby'] = $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 (!$topic_list_get) { if ($cache_time > 0 && !$options['tid']) { $cache_key = $cache_key ? $cache_key : "{$member['uid']}-topic-{$params['code']}-{$params['type']}-{$params['gid']}-{$params['qid']}-{$params['view']}"; $options = $TopicListLogic->get_options($options, $cache_time, $cache_key); } $info = $TopicListLogic->get_data($options); $topic_list = array(); $total_record = 0; if (!empty($info)) { $topic_list = $info['list']; $total_record = $info['count']; if ($info['page']) { $page_arr = $info['page']; } else { $page_arr = $getTypeTidReturn['page']; } } } $topic_list_count = 0; if ($topic_list) { if ($GLOBALS['_J']['config']['is_topic_user_follow'] && !$GLOBALS['_J']['disable_user_follow']) { $topic_list = jlogic('buddy')->follow_html2($topic_list); } $topic_list_count = count($topic_list); if (!$topic_parent_disable && ('bbs' != $this->Code || 'cms' != $this->Code)) { $parent_list = $this->TopicLogic->GetParentTopic($topic_list, 'mycomment' == $this->Code); } $relate_list = $this->TopicLogic->GetRelateTopic($topic_list); } if (!in_array($params['code'], array('bbs', 'cms'))) { $ajaxkey = array(); $ajaxnum = 10; if (count($topic_list) > $ajaxnum) { $topic_keys = array_keys($topic_list); $topic_list = array_slice($topic_list, 0, $ajaxnum); array_splice($topic_keys, 0, $ajaxnum); $num = ceil(count($topic_keys) / $ajaxnum); for ($i = 0; $i < $num; $i++) { if (count($topic_keys) > $ajaxnum) { $topic_key = array_splice($topic_keys, 0, $ajaxnum); } else { $topic_key = $topic_keys; } $ajaxkey[] = base64_encode(serialize($topic_key)); } $isloading = true; } } $group_list = $grouplist2 = array(); $group_list = $this->_myGroup($member['uid']); $cut_num = 5; if ($group_list) { $group_count = count($group_list); if ($group_count > $cut_num) { $grouplist2 = array_slice($group_list, 0, $cut_num); $grouplist_more = array_slice($group_list, $cut_num); foreach ($grouplist_more as $key => $value) { if ($value['id'] == $gid) { $tmp = $grouplist2[$cut_num - 1]; $grouplist2[$cut_num - 1] = $value; $grouplist_more[] = $tmp; unset($grouplist_more[$key]); break; } } $group_list = $grouplist_more; } else { $grouplist2 = $group_list; $group_list = array(); } } if (!$this->Config['acceleration_mode']) { $member_medal = $my_member ? $my_member : $member; if ($member_medal['medal_id']) { $medal_list = $this->_Medal($member_medal['medal_id'], $member_medal['uid']); } } $exp_return = user_exp($member_medal['level'], $member_medal['credits']); if ($exp_return['exp_width'] >= 1) { $exp_width = $exp_return['exp_width']; } else { $exp_width = 0; } $nex_exp_credit = $exp_return['nex_exp_credit']; $nex_level = $exp_return['nex_exp_level']; $this->Title || ($this->Title = $title); $tpl = $tpl ? $tpl : 'topic_index'; if (in_array($tpl, array('topic_index', 'topic_myhome'))) { $tid = jlogic('buddy')->check_new_recd_topic(MEMBER_ID); if ($tid && $topic_list) { foreach ($topic_list as $key => $val) { if ($tid == $val['tid']) { unset($topic_list[$key]); } } } } $albums = jlogic('image')->getalbum(); include template($tpl); }
function Install() { global $_J; $plugindir = $this->Get['plugindir']; $filedir = PLUGIN_DIR . '/' . $plugindir; $xml_url = $filedir . '/jishigou_plugin_' . $plugindir . '.xml'; $fp = fopen($xml_url, 'r'); $xmldata = fread($fp, filesize($xml_url)); $plugindata_all = xml_unserialize($xmldata); if (!is_array($plugindata_all) || jlogic('plugin')->errorplugindata($plugindata_all['Data'])) { $this->Messager("安装失败(插件代码可疑或有错误,系统禁止安装)", 'admin.php?mod=plugin&code=add'); } if ($this->Get['submit'] != 'yes') { $pname = $plugindata_all['Data']['plugin']['name']; if ($plugindata_all['license'] || $plugindata_all['intro']) { $license = ''; if ($plugindata_all['license']) { $license .= strip_tags($plugindata_all['license'], '<b>,<i>,<u>,<p>,<a>'); } if ($plugindata_all['intro']) { $license = $license ? $license . '<br><br>' : ''; $license .= strip_tags($plugindata_all['intro'], '<b>,<i>,<u>,<p>,<a>'); } $license = nl2br($license); } else { if ($plugindata_all['Version'] != $_J['config']['sys_version']) { $license = '<br><br><center>本插件适用版本为' . $plugindata_all['Version'] . ',您当前正在使用的系统版本是' . $_J['config']['sys_version'] . '<br>您确定要安装吗?</center><br><br>'; } else { $license = '<br><br><center>您确定要安装该插件吗?<br>如果此插件是从记事狗官方下载的,则为绿色插件,您可放心安装</center><br><br>'; } } include template('admin/plugin_install'); exit; } $plugindata = $plugindata_all['Data']['plugin']; $vardata = empty($plugindata_all['Data']['var']) ? array() : $plugindata_all['Data']['var']; $installfile = $plugindata_all['installfile']; if ($installfile) { if (file_exists($filedir . '/' . $installfile)) { $sql = ''; include $filedir . '/' . $installfile; if ($sql) { $sqls = str_replace("\r", "\n", str_replace("{jishigou}", TABLE_PREFIX, $sql)); foreach (explode(";\n", trim($sqls)) as $sql) { $query = trim($sql); if (!empty($query)) { if (strtoupper(substr($query, 0, 12)) == 'CREATE TABLE') { $query = $this->_sql_createtable($query, $this->Config['charset']); } $this->DatabaseHandler->Query($query); } } } } else { $this->Messager("安装失败(找不到安装文件" . $installfile . ",无法安装)", 'admin.php?mod=plugin&code=add'); } } $data['name'] = $plugindata['name']; $data['available'] = $plugindata['available']; $data['directory'] = $plugindata['directory']; $data['identifier'] = $plugindata['identifier']; $data['version'] = $plugindata['version']; $data['copyright'] = $plugindata['copyright']; $data['modules'] = addslashes(serialize($plugindata['__modules'])); $data['description'] = $plugindata['description']; $result_id = jtable('plugin')->insert($data, 1); foreach ($vardata as $temp => $value) { $var_data['pluginid'] = $result_id; $var_data['title'] = $value['title']; $var_data['description'] = $value['description']; $var_data['variable'] = $value['variable']; $var_data['type'] = $value['type']; $var_data['extra'] = $value['extra']; $var_data['value'] = $value['value']; $var_data['displayorder'] = $value['displayorder']; jtable('pluginvar')->insert($var_data); } $menustr = ''; if (is_array($plugindata['__modules'])) { foreach ($plugindata['__modules'] as $var) { if ($var['modtype'] == '1') { $menustr .= '<br>导航名称:<font color="blue">' . $var['mod_name'] . '</font><br>英文名称:<font color="blue">' . $data['identifier'] . '_' . $var['mod_file'] . '</font><br>链接地址:<font color="blue">' . jurl('index.php?mod=plugin&id=' . $data['identifier'] . ':' . $var['mod_file']) . '</font>'; } } } if ($menustr) { $this->Messager("已成功安装 (" . $plugindata['name'] . ") 插件!<br>该插件有独立模块,请在导航菜单里添加如下菜单:" . $menustr, 'admin.php?mod=plugin', 60); } else { $this->Messager("已成功安装 (" . $plugindata['name'] . ") 插件", 'admin.php?mod=plugin'); } }