public function getOneComment($commentid) { $strComment = $this->find('weibo_comment', array('commentid' => $commentid)); $strComment['content'] = tsDecode($strComment['content']); $strComment['user'] = aac('user')->getOneUser($strComment['userid']); return $strComment; }
function recommendtopic() { $arrTopics = aac('group')->findAll('group_topic', array('isaudit' => 0, 'isrecommend' => 1), 'uptime desc', null, 10); foreach ($arrTopics as $key => $item) { $arrTopic[$key] = $item; $arrTopic[$key]['title'] = tsTitle($item['title']); // 标题过滤 $arrTopic[$key]['desc'] = tsCutContent(strip_tags($item['content']), 50); // 简介 $arrTopic[$key]['user'] = aac('user')->getOneUser($item['userid']); // 用户信息 $arrTopic[$key]['group'] = aac('group')->getOneGroup($item['groupid']); // 群组信息 /* 匹配标题图片 */ $pattern = "/<[img|IMG].*?src=[\\'|\"](.*?(?:[\\.gif|\\.jpg|\\.png]))[\\'|\"].*?[\\/]?>/"; preg_match($pattern, tsDecode($item['content']), $match); if (!$match[1]) { // 内容里面没有图片 $match[0] = '<img src="/plugins/home/recommendtopic/images/default.png" />'; $match[1] = '/plugins/home/recommendtopic/images/default.png'; } $arrTopic[$key]['thumb'] = $match; } include template('recommendtopic', 'recommendtopic'); }
function article() { $arrArticle = aac('article')->findAll('article', array('isaudit' => 0), 'addtime desc', null, 10); foreach ($arrArticle as $key => $item) { $arrArticle[$key]['title'] = tsTitle($item['title']); $arrArticle[$key]['content'] = tsDecode($item['content']); } include template('article', 'article'); }
function weibo() { $arrWeibo = aac('weibo')->findAll('weibo', null, 'addtime desc', null, 10); foreach ($arrWeibo as $key => $item) { $arrWeibo[$key]['content'] = tsDecode($item['content']); $arrWeibo[$key]['user'] = aac('user')->getOneUser($item['userid']); } include template('weibo', 'weibo'); }
public function index() { //dump($GLOBALS); $page = isset($_GET['page']) ? intval($_GET['page']) : '1'; $url = tsUrl('weibo', 'index', array('page' => '')); $lstart = $page * 20 - 20; $arrWeibo = $this->findAll('weibo', array('isaudit' => 0), 'uptime desc', null, $lstart . ',20'); foreach ($arrWeibo as $key => $item) { $arrWeibo[$key]['user'] = aac('user')->getOneUser($item['userid']); $arrWeibo[$key]['content'] = tsDecode($item['content']); } $weiboNum = $this->findCount('weibo', array('isaudit' => 0)); $pageUrl = pagination($weiboNum, 20, $page, $url); $title = '唠叨'; include template('index'); }
public function show() { $weiboid = intval($_GET['id']); $strWeibo = $this->getOneWeibo($weiboid); if ($weiboid == 0 || $strWeibo == '') { ts404(); } if ($strWeibo['isaudit'] == 1) { tsNotice('内容审核中...'); } //comment $page = isset($_GET['page']) ? intval($_GET['page']) : '1'; $url = tsUrl('weibo', 'show', array('id' => $weiboid, 'page' => '')); $lstart = $page * 20 - 20; $arrComments = $this->findAll('weibo_comment', array('weiboid' => $weiboid), 'addtime desc', 'commentid', $lstart . ',20'); foreach ($arrComments as $key => $item) { $arrComment[] = $this->getOneComment($item['commentid']); } $commentNum = $this->findCount('weibo_comment', array('weiboid' => $weiboid)); $pageUrl = pagination($commentNum, 20, $page, $url); $title = cututf8(t(tsDecode($strWeibo['content'])), 0, 100, false); include template('show'); }
foreach ($arrFeeds as $key => $item) { $data = json_decode($item['data'], true); if (is_array($data)) { foreach ($data as $key => $itemTmp) { $tmpkey = '{' . $key . '}'; $tmpdata[$tmpkey] = tsTitle(urldecode($itemTmp)); } } } $arrFeeds = aac('group')->findAll('group_topic', array('userid' => $strUser['userid']), 'addtime desc', null, 25); foreach ($arrFeeds as $key => $item) { $arrFeed[$key] = $item; $arrFeed[$key]['title'] = tsTitle($item['title']); // 标题过滤 $arrFeed[$key]['desc'] = tsCutContent(strip_tags($item['content']), 90); // 简介 $arrFeed[$key]['user'] = aac('user')->getOneUser($item['userid']); // 用户信息 $arrFeed[$key]['group'] = aac('group')->getOneGroup($item['groupid']); // 群组信息 /* 匹配标题图片 */ $pattern = "/<[img|IMG].*?src=[\\'|\"](.*?(?:[\\.gif|\\.jpg|\\.png]))[\\'|\"].*?[\\/]?>/"; preg_match($pattern, tsDecode($item['content']), $match); if (!$match[1]) { // 内容里面没有图片 $match[0] = '<img src="/plugins/home/newtopics/images/default.png" />'; $match[1] = '/plugins/home/newtopics/images/default.png'; } $arrFeed[$key]['thumb'] = $match; } include template("space");
<?php defined('IN_TS') or die('Access Denied.'); $page = isset($_GET['page']) ? intval($_GET['page']) : '1'; $url = tsUrl('photo', 'my', array('my' => 'index', 'page' => '')); $lstart = $page * 6 - 6; $arrAlbum = $new['photo']->findAll('photo_album', array('userid' => $strUser['userid']), 'albumid desc', null, $lstart . ',6'); foreach ($arrAlbum as $key => $item) { $arrAlbum[$key]['albumname'] = tsDecode($item['albumname']); $arrAlbum[$key]['albumdesc'] = tsDecode($item['albumdesc']); } $albumNum = $new['photo']->findCount('photo_album', array('userid' => $strUser['userid'])); $pageUrl = pagination($albumNum, 6, $page, $url); $title = '我的圖'; include template('my/index');
$topicTypeNum = $new['group']->findCount('group_topic', array('typeid' => $typeid)); $new['group']->update('group_topic_type', array('typeid' => $typeid), array('count_topic' => $topicTypeNum)); } // 处理标签 aac('tag')->addTag('topic', 'topicid', $topicid, $tag); // 统计需要审核的帖子 $count_topic_audit = $new['group']->findCount('group_topic', array('groupid' => $groupid, 'isaudit' => '1')); // 统计小组下帖子数并更新 $count_topic = $new['group']->findCount('group_topic', array('groupid' => $groupid)); // 统计今天发布帖子数 $today_start = strtotime(date('Y-m-d 00:00:00')); $today_end = strtotime(date('Y-m-d 23:59:59')); $count_topic_today = $new['group']->findCount('group_topic', "`groupid`='{$groupid}' and `addtime`='{$today_start}'"); $new['group']->update('group', array('groupid' => $groupid), array('count_topic' => $count_topic, 'count_topic_audit' => $count_topic_audit, 'count_topic_today' => $count_topic_today, 'uptime' => time())); // 对积分进行处理 aac('user')->doScore($TS_URL['app'], $TS_URL['ac'], $TS_URL['ts']); // feed开始 if ($strGroup['joinway'] == 0) { $feed_template = '<span class="pl">发布了帖子:<a href="{link}">{title}</a></span><div class="quote"><span class="inq">{content}</span> <span><a class="j a_saying_reply" href="{link}" rev="unfold">回应</a></span></div>'; $feed_data = array('link' => tsurl('group', 'topic', array('id' => $topicid)), 'title' => $title, 'content' => cututf8(t(tsDecode($content)), '0', '50')); aac('feed')->add($userid, $feed_template, $feed_data); // feed结束 } // QQ分享 $arrShare = array('content' => $title . '[ThinkSAAS社区]' . tsUrl('group', 'topic', array('id' => $topicid))); doAction('qq_share', $arrShare); // 微博分享 doAction('weibo_share', $title . '[ThinkSAAS社区]' . tsUrl('group', 'topic', array('id' => $topicid))); header("Location: " . tsUrl('group', 'topic', array('id' => $topicid))); break; }
<div class="content"> <?php if ($item['photo']) { ?> <a target="_blank" href="<?php echo SITE_URL; ?> uploadfile/weibo/<?php echo $item['photo']; ?> "><img src="<?php echo tsXimg($item['photo'], 'weibo', 240, '', $item['path']); ?> " /></a><?php } echo tsDecode($item['content']); ?> </div> <p style="text-align:right;"> <a href="<?php echo tsurl('weibo', 'show', array('id' => $item['weiboid'])); ?> "><?php if ($item['count_comment'] > '0') { ?> (<?php echo $item['count_comment']; ?> )<?php }
//小组分类 $arrGroupCate = $new['group']->findAll('group_cate', array('referid' => 0)); // 所有小组 $page = isset($_GET['page']) ? intval($_GET['page']) : '1'; $lstart = $page * 24 - 24; $url = tsUrl('group', 'index', array('page' => '')); $arr = array('isaudit' => 0); if ($cateid) { $strCate = $new['group']->find('group_cate', array('cateid' => $cateid)); $url = tsUrl('group', 'index', array('cateid' => $cateid, 'page' => '')); $arr = array('cateid' => $cateid, 'isaudit' => 0); } $arrGroup = $new['group']->findAll('group', $arr, 'isrecommend desc,addtime asc', null, $lstart . ',24'); foreach ($arrGroup as $key => $item) { $arrGroup[$key]['groupname'] = tsTitle($item['groupname']); $arrGroup[$key]['groupdesc'] = cututf8(t(tsDecode($item['groupdesc'])), 0, 35); } $groupNum = $new['group']->findCount('group', $arr); $pageUrl = pagination($groupNum, 24, $page, $url); // 我加入的小组 $myGroup = array(); if ($TS_USER['userid']) { $myGroups = $new['group']->findAll('group_user', array('userid' => $TS_USER['userid']), null, 'groupid'); foreach ($myGroups as $item) { $myGroup[] = $item['groupid']; } } // 最新10个小组 $arrNewGroup = $new['group']->getNewGroup('10'); // 热门帖子 $arrTopics = $new['group']->findAll('group_topic', null, 'count_comment desc', 'groupid,topicid,title,count_comment', 10);
tsNotice('留言内容不能为空!'); } aac('system')->antiWord($content); $new['user']->create('user_gb', array('userid' => $userid, 'touserid' => $touserid, 'content' => $content, 'addtime' => date('Y-m-d H:i:s'))); //发送系统消息 $msg_userid = '0'; $msg_touserid = $touserid; $msg_content = '有人在你的留言板上留言了哦,快去看看吧!<br />' . tsUrl('user', 'space', array('id' => $touserid)); aac('message')->sendmsg($msg_userid, $msg_touserid, $msg_content); tsNotice('留言成功!'); break; case "redo": $userid = $new['user']->isLogin(); $touserid = intval($_POST['touserid']); $reid = intval($_POST['reid']); $content = tsDecode($_POST['content']); $arrContent = explode('#', $content); $content = $arrContent['1']; if ($content == '') { tsNotice('留言不能为空!'); } aac('system')->antiWord($content); $new['user']->create('user_gb', array('userid' => $userid, 'reid' => $reid, 'touserid' => $touserid, 'content' => $content, 'addtime' => date('Y-m-d H:i:s'))); //发送系统消息 $msg_userid = '0'; $msg_touserid = $touserid; $msg_content = '有人在你的留言板上留言了哦,快去看看吧!<br />' . tsUrl('user', 'space', array('id' => $touserid)); aac('message')->sendmsg($msg_userid, $msg_touserid, $msg_content); tsNotice('回复成功!'); break; //删除留言
<?php defined('IN_TS') or die('Access Denied.'); switch ($ts) { case "": $userid = aac('user')->isLogin(); $albumid = intval($_GET['albumid']); $strAlbum = $new['attach']->find('attach_album', array('albumid' => $albumid)); $strAlbum['title'] = tsTitle($strAlbum['title']); $strAlbum['content'] = tsDecode($strAlbum['content']); if ($strAlbum['userid'] == $userid || $TS_USER['isadmin'] == 1) { $title = '上传资料'; include template('upload'); } else { tsNotice('非法操作!'); } break; case "do": $albumid = intval($_POST['albumid']); $verifyToken = md5('unique_salt' . $addtime); $strAlbum = $new['attach']->find('attach_album', array('albumid' => $albumid)); if ($albumid == 0 || $_POST['tokens'] != $verifyToken || $strAlbum == '') { echo 00; exit; } $attachid = $new['attach']->create('attach', array('albumid' => $strAlbum['albumid'], 'userid' => $strAlbum['userid'], 'addtime' => date('Y-m-d H:i:s'))); //上传 $arrUpload = tsUpload($_FILES['Filedata'], $attachid, 'attach', array('xls', 'xlsx', 'pptx', 'docx', 'pdf', 'jpg', 'gif', 'png', 'rar', 'zip', 'doc', 'ppt', 'txt')); if ($arrUpload) { $new['attach']->update('attach', array('attachid' => $attachid), array('attachname' => $arrUpload['name'], 'attachtype' => $arrUpload['type'], 'attachurl' => $arrUpload['url'], 'attachsize' => $arrUpload['size'])); //统计
function tsCutContent($text, $length = 50) { $text = cututf8(t(tsDecode($text)), 0, $length); return $text; }
defined('IN_TS') or die('Access Denied.'); // 用户是否登录 $userid = aac('user')->isLogin(); //普通不用不允许编辑内容 if ($TS_SITE['isallowedit'] && $TS_USER['isadmin'] == 0) { tsNotice('系统不允许用户编辑内容,请联系管理员编辑!'); } switch ($ts) { case "": $articleid = intval($_GET['articleid']); $cateid = intval($_GET['cateid']); $strArticle = $new['article']->find('article', array('articleid' => $articleid)); if ($strArticle['userid'] == $userid || $TS_USER['isadmin'] == 1) { $strArticle['title'] = stripslashes($strArticle['title']); $strArticle['content'] = tsDecode($strArticle['content']); // 找出TAG $arrTags = aac('tag')->getObjTagByObjid('article', 'articleid', $articleid); foreach ($arrTags as $key => $item) { $arrTag[] = $item['tagname']; } $strArticle['tag'] = arr2str($arrTag); $title = '修改文章'; include template('edit'); } else { tsNotice('非法操作!'); } break; case "do": if ($_POST['token'] != $_SESSION['token']) { tsNotice('非法操作!');
<?php defined('IN_TS') or die('Access Denied.'); $goodsid = intval($_GET['id']); $strGoods = $new['redeem']->find('redeem_goods', array('goodsid' => $goodsid)); $strGoods['content'] = tsDecode($strGoods['content']); //谁兑换 $arrUsers = $new['redeem']->findAll('redeem_user', array('goodsid' => $goodsid)); foreach ($arrUsers as $key => $item) { if (aac('user')->isUser($item['userid']) == false) { $new['redeem']->delete('redeem_user', array('userid' => $item['userid'], 'goodsid' => $item['goodsid'])); } else { $arrUser[$key] = aac('user')->getOneUser($item['userid']); $arrUser[$key]['isreturn'] = $item['isreturn']; } } //最新兑换 $arrNewGoods = $new['redeem']->findAll('redeem_goods', null, 'addtime desc', null, 10); $title = $strGoods['title']; include template('goods');
case "": $albumid = intval($_GET['id']); $strAlbum = $new['photo']->find('photo_album', array('albumid' => $albumid)); //404 if ($strAlbum == '') { header("HTTP/1.1 404 Not Found"); header("Status: 404 Not Found"); $title = '404'; include pubTemplate("404"); exit; } if ($strAlbum['isaudit'] == 1) { tsNotice('内容审核中...'); } $strAlbum['albumname'] = tsTitle($strAlbum['albumname']); $strAlbum['albumdesc'] = tsDecode($strAlbum['albumdesc']); $page = isset($_GET['page']) ? intval($_GET['page']) : '1'; $url = tsUrl('photo', 'album', array('id' => $albumid, 'page' => '')); $lstart = $page * 30 - 30; $strUser = aac('user')->getOneUser($strAlbum['userid']); $arrPhoto = $new['photo']->findAll('photo', array('albumid' => $albumid), 'photoid desc', null, $lstart . ',30'); foreach ($arrPhoto as $key => $item) { $arrPhoto[$key]['photodesc'] = stripslashes($item['photodesc']); } $photoNum = $new['photo']->findCount('photo', array('albumid' => $albumid)); $pageUrl = pagination($photoNum, 30, $page, $url); if ($TS_USER['userid'] == $strAlbum['userid']) { $title = '' . $strAlbum['albumname']; } else { $title = $strAlbum['albumname']; }
defined('IN_TS') or die('Access Denied.'); switch ($ts) { case "": $cateid = intval($_GET['id']); $strCate = $new['article']->find('article_cate', array('cateid' => $cateid)); // 列表 $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $url = tsUrl('article', 'cate', array('id' => $cateid, 'page' => '')); $lstart = $page * 10 - 10; $arrArticles = $new['article']->findAll('article', array('cateid' => $cateid, 'isaudit' => 0), 'addtime desc', null, $lstart . ',10'); $articleNum = $new['article']->findCount('article', array('cateid' => $cateid, 'isaudit' => 0)); $pageUrl = pagination($articleNum, 10, $page, $url); foreach ($arrArticles as $key => $item) { $arrArticle[] = $item; $arrArticle[$key]['title'] = stripslashes($item['title']); $arrArticle[$key]['content'] = cututf8(t(tsDecode($item['content'])), 0, 150); $arrArticle[$key]['user'] = aac('user')->getOneUser($item['userid']); } // 推荐阅读 $arrRecommend = $new['article']->getRecommendArticle(); // 一周热门 $arrHot7 = $new['article']->getHotArticle(7); // 一月热门 $arrHot30 = $new['article']->getHotArticle(30); $title = $strCate['catename']; // SEO优化 $sitekey = $strCate['catename']; $sitedesc = $strCate['catename'] . ' - 文章'; include template('cate'); break; }
<?php defined('IN_TS') or die('Access Denied.'); $keys = tsUrlCheck($_GET['key']); $strInfo = $new['home']->find('home_info', array('infokey' => $keys)); $strInfo['content'] = nl2br(tsDecode($strInfo['content'])); $arrInfo = $new['home']->findAll('home_info'); $title = $strInfo['title']; include template('info');
<?php defined('IN_TS') or die('Access Denied.'); //资料库 $arrAlbum = $new['attach']->findAll('attach_album', array('isaudit' => 0), 'addtime desc', null, 15); foreach ($arrAlbum as $key => $item) { $arrAlbum[$key]['title'] = tsTitle($item['title']); $arrAlbum[$key]['content'] = tsDecode($item['content']); $arrAlbum[$key]['user'] = aac('user')->getOneUser($item['userid']); $new['attach']->update('attach_album', array('albumid' => $item['albumid']), array('count_attach' => $arrAlbum[$key]['count_attach'])); } $arrAttach = $new['attach']->findAll('attach', null, 'addtime desc', null, 20); foreach ($arrAttachs as $key => $item) { $arrAttach[$key]['user'] = aac('user')->getOneUser($item['userid']); } $sitekey = $TS_APP['appkey']; $sitedesc = $TS_APP['appdesc']; include template("index");
case "add": include template('admin/info_add'); break; case "adddo": $infokey = $_POST['infokey']; $title = $_POST['title']; $content = tsClean($_POST['content']); $new['home']->create('home_info', array('infokey' => $infokey, 'title' => $title, 'content' => $content)); header('Location: ' . SITE_URL . 'index.php?app=home&ac=admin&mg=info&ts=list'); break; //编辑 //编辑 case "edit": $infoid = intval($_GET['infoid']); $strInfo = $new['home']->find('home_info', array('infoid' => $infoid)); $strInfo['content'] = tsDecode($strInfo['content']); include template('admin/info_edit'); break; case "editdo": $infoid = intval($_POST['infoid']); $infokey = trim($_POST['infokey']); $title = trim($_POST['title']); $content = tsClean($_POST['content']); $new['home']->update('home_info', array('infoid' => $infoid), array('infokey' => $infokey, 'title' => $title, 'content' => $content)); header('Location: ' . SITE_URL . 'index.php?app=home&ac=admin&mg=info&ts=list'); break; //删除 //删除 case "delete": $infoid = intval($_GET['infoid']); $new['home']->delete('home_info', array('infoid' => $infoid));
<?php defined('IN_TS') or die('Access Denied.'); $attachid = intval($_GET['id']); $strAttach = $new['attach']->find('attach', array('attachid' => $attachid)); $strAttach['album'] = $new['attach']->find('attach_album', array('albumid' => $strAttach['albumid'])); $strAttach['album']['title'] = tsTitle($strAttach['album']['title']); $strAttach['album']['content'] = tsDecode($strAttach['album']['content']); $strAttach['user'] = aac('user')->getOneUser($strAttach['userid']); $userAttach = $new['attach']->findAll('attach', array('userid' => $strAttach['userid'], 'isaudit' => 0)); $title = $strAttach['attachname']; include template("show");
<?php //编辑小组信息 defined('IN_TS') or die('Access Denied.'); //用户是否登录 $userid = aac('user')->isLogin(); $groupid = intval($_GET['groupid']); $strGroup = $new['group']->find('group', array('groupid' => $groupid)); $strGroup['groupname'] = tsDecode($strGroup['groupname']); $strGroup['groupdesc'] = tsDecode($strGroup['groupdesc']); if ($strGroup['userid'] == $userid || $TS_USER['isadmin'] == 1) { switch ($ts) { //编辑小组基本信息 case "base": //小组标签 $arrTags = aac('tag')->getObjTagByObjid('group', 'groupid', $groupid); foreach ($arrTags as $key => $item) { $arrTag[] = $item['tagname']; } $strGroup['tag'] = arr2str($arrTag); $title = '编辑小组基本信息'; include template("edit_base"); break; //编辑小组头像 //编辑小组头像 case "icon": $title = '修改小组头像'; include template("edit_icon"); break; //修改访问权限 //修改访问权限
<?php defined('IN_TS') or die('Access Denied.'); //用户空间 include 'userinfo.php'; //加入的小组 $arrGroupUser = $new['user']->findAll('group_user', array('userid' => $userid)); if (is_array($arrGroupUser)) { foreach ($arrGroupUser as $key => $item) { $arrGroup[] = aac('group')->getOneGroup($item['groupid']); } } //留言 $arrGuests = $new['user']->findAll('user_gb', array('touserid' => $strUser['userid']), 'addtime desc', null, 10); foreach ($arrGuests as $key => $item) { $arrGuest[] = $item; $arrGuest[$key]['content'] = tsDecode($item['content']); $arrGuest[$key]['user'] = $new['user']->getOneUser($item['userid']); } $title = $strUser['username']; include template("space");
if ($strArticle['isaudit'] == 1) { tsNotice('内容审核中...'); } $strArticle['title'] = tsTitle($strArticle['title']); $strArticle['content'] = tsDecode($strArticle['content']); $strArticle['tags'] = aac('tag')->getObjTagByObjid('article', 'articleid', $articleid); $strArticle['user'] = aac('user')->getOneUser($strArticle['userid']); $strArticle['cate'] = $new['article']->find('article_cate', array('cateid' => $strArticle['cateid'])); // 获取评论 $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $url = tsUrl('article', 'show', array('id' => $articleid, 'page' => '')); $lstart = $page * 10 - 10; $arrComments = $new['article']->findAll('article_comment', array('articleid' => $articleid), 'addtime desc', null, $lstart . ',10'); foreach ($arrComments as $key => $item) { $arrComment[] = $item; $arrComment[$key]['content'] = tsDecode($item['content']); $arrComment[$key]['user'] = aac('user')->getOneUser($item['userid']); } $commentNum = $new['article']->findCount('article_comment', array('articleid' => $articleid)); $pageUrl = pagination($commentNum, 10, $page, $url); // 标签 $strArticle['tags'] = aac('tag')->getObjTagByObjid('article', 'articleid', $strArticle['articleid']); // 推荐阅读 $arrArticle = $new['article']->findAll('article', null, 'addtime desc', null, 10); // 推荐阅读 $arrRecommend = $new['article']->getRecommendArticle(); // 一周热门 $arrHot7 = $new['article']->getHotArticle(7); // 一月热门 $arrHot30 = $new['article']->getHotArticle(30); //把标签作为关键词
} else { $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $lstart = $page * 30 - 30; if ($typeid > 0) { $andType = " and `typeid`='{$typeid}'"; $url = tsUrl('group', 'show', array('id' => $groupid, 'typeid' => $typeid, 'page' => '')); } else { $andType = ''; $url = tsUrl('group', 'show', array('id' => $groupid, 'page' => '')); } $arrTopics = $new['group']->findAll('group_topic', "`groupid`='{$groupid}' " . $andType . " and `isaudit`='0'", 'istop desc,uptime desc', null, $lstart . ',30'); if (is_array($arrTopics)) { foreach ($arrTopics as $key => $item) { $arrTopic[] = $item; $arrTopic[$key]['title'] = tsTitle($item['title']); $arrTopic[$key]['content'] = tsDecode($item['content']); $arrTopic[$key]['typename'] = $arrTopicType[$item['typeid']]['typename']; $arrTopic[$key]['user'] = aac('user')->getOneUser($item['userid']); $arrTopic[$key]['group'] = aac('group')->getOneGroup($item['groupid']); } } $topicNum = $new['group']->findCount('group_topic', "`groupid`='{$groupid}' " . $andType); $pageUrl = pagination($topicNum, 30, $page, $url); //文化会员 $groupUser = $new['group']->findAll('group_user', array('groupid' => $groupid), 'addtime desc', null, 8); if (is_array($groupUser)) { foreach ($groupUser as $item) { $strUser = aac('user')->getOneUser($item['userid']); if ($strUser) { $arrGroupUser[] = $strUser; } else {
$sitekey = arr2str($arrTag); } else { $sitekey = $strTopic['title']; } //标题 $title = $strTopic['title']; // 评论列表开始 $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $url = tsUrl('group', 'topic', array('id' => $topicid, 'page' => '')); $lstart = $page * 15 - 15; $arrComment = $new['group']->findAll('group_topic_comment', array('topicid' => $topicid), 'addtime asc', null, $lstart . ',15'); foreach ($arrComment as $key => $item) { $arrTopicComment[] = $item; $arrTopicComment[$key]['l'] = ($page - 1) * 15 + $key + 1; $arrTopicComment[$key]['user'] = aac('user')->getOneUser($item['userid']); $arrTopicComment[$key]['content'] = @preg_replace("/\\[@(.*)\\:(.*)]/U", "<a href='" . tsUrl('user', 'space', array('id' => '$2')) . " ' rel=\"face\" uid=\"\$2\"'>@\$1</a>", tsDecode($item['content'])); $arrTopicComment[$key]['recomment'] = $new['group']->recomment($item['referid']); } $commentNum = $new['group']->findCount('group_topic_comment', array('topicid' => $strTopic['topicid'])); $pageUrl = pagination($commentNum, 15, $page, $url); // 评论列表结束 //7天内的热门帖子 $arrHotTopic = $new['group']->getHotTopic(7); //推荐帖子 $arrRecommendTopic = $new['group']->getRecommendTopic(); //本组热门帖子 $arrGroupHotTopic = $new['group']->findAll('group_topic', array('groupid' => $strGroup['groupid'], 'isaudit' => 0), 'count_view desc', null, 10); $sitedesc = cututf8(t($strTopic['content']), 0, 100); include template('topic'); // 增加浏览次数 $new['group']->update('group_topic', array('topicid' => $strTopic['topicid']), array('count_view' => $strTopic['count_view'] + 1));
public function getRecommendTopic($groupid = null, $num = 20) { if ($groupid) { $arr = array('groupid' => $groupid, 'isrecommend' => 1); } else { $arr = array('isrecommend' => 1); } $arrTopic = $this->findAll('group_topic', $arr, 'addtime desc', 'topicid,title', $num); foreach ($arrTopic as $key => $item) { $arrTopic[$key]['title'] = tsTitle($item['title']); $arrTopic[$key]['content'] = tsDecode($item['content']); } return $arrTopic; }