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 getOneUser($userid) { $strUser = $this->find('user_info', array('userid' => $userid)); if ($strUser) { $strUser['username'] = tsTitle($strUser['username']); $strUser['email'] = tsTitle($strUser['email']); $strUser['phone'] = tsTitle($strUser['phone']); $strUser['province'] = tsTitle($strUser['province']); $strUser['city'] = tsTitle($strUser['city']); $strUser['signed'] = tsTitle($strUser['signed']); $strUser['about'] = tsTitle($strUser['about']); $strUser['address'] = tsTitle($strUser['address']); if ($strUser['face'] && $strUser['path']) { $strUser['face'] = tsXimg($strUser['face'], 'user', 120, 120, $strUser['path'], 1); } elseif ($strUser['face'] && $strUser['path'] == '') { $strUser['face'] = SITE_URL . 'public/images/' . $strUser['face']; } else { //没有头像 $strUser['face'] = SITE_URL . 'public/images/user_large.jpg'; } } else { $strUser = ''; } return $strUser; }
function photo() { $arrAlbum = aac('photo')->findAll('photo_album', array('isrecommend' => 1), 'addtime desc', null, 12); foreach ($arrAlbum as $key => $item) { $arrAlbum[$key]['albumname'] = tsTitle($item['albumname']); } include template('photo', 'photo'); }
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 newtopic() { global $db; //最新帖子 $arrTopics = aac('group')->findAll('group_topic', array('isaudit' => 0), 'uptime desc', null, 35); foreach ($arrTopics as $key => $item) { $arrTopic[] = $item; $arrTopic[$key]['title'] = tsTitle($item['title']); $arrTopic[$key]['user'] = aac('user')->getOneUser($item['userid']); $arrTopic[$key]['group'] = aac('group')->getOneGroup($item['groupid']); } include template('newtopic', 'newtopic'); }
function tag() { //最新标签 $arrTag = aac('tag')->findAll('tag', "`count_topic`>'0'", 'uptime desc', null, 30); foreach ($arrTag as $key => $item) { $arrTag[$key]['tagname'] = tsTitle($item['tagname']); } //echo '<div class="bbox">'.doAction('gobad','home_left_1').'</div>'; echo '<div class="panel panel-default">'; echo '<div class="panel-heading">热门标签<small><a href="' . tsUrl('group', 'tags') . '">更多</a></small></div>'; echo '<div class="panel-body tags">'; foreach ($arrTag as $key => $item) { echo '<a href="' . tsUrl('group', 'tag', array('id' => urlencode($item['tagname']))) . '">' . $item['tagname'] . '</a>'; } echo '</div></div>'; //echo '<div class="bbox">'.doAction('gobad','home_left_2').'</div>'; }
function newgroup() { $arrNewGroups = aac('group')->findAll('group', array('isaudit' => 0), 'addtime desc', null, 10); foreach ($arrNewGroups as $key => $item) { $arrNewGroup[] = $item; $arrNewGroup[$key]['groupname'] = tsTitle($item['groupname']); $arrNewGroup[$key]['user'] = aac('user')->find('user_info', array('userid' => $item['userid']), 'userid,username'); } echo '<div class="panel panel-default">'; echo '<div class="panel-heading">最新创建小组</div>'; echo '<div class="panel-body commlist"><ul>'; foreach ($arrNewGroup as $key => $item) { echo '<li><a href="' . tsUrl('group', 'show', array('id' => $item['groupid'])) . '">' . $item['groupname'] . '</a> By <a href="' . tsUrl('user', 'space', array('id' => $item['user']['userid'])) . '">' . $item['user']['username'] . '</a></li>'; } echo '</ul></div>'; echo '</div>'; }
/** * @param $day * @param int $cateid * @return mixed */ public function getHotArticle($day, $cateid = 0) { $startTime = time() - $day * 3600 * 60; $startTime = date('Y-m-d', $startTime); $endTime = date('Y-m-d'); if ($day == 30) { $endTime = date('Y-m-d', time() - 7 * 3600 * 60); } if ($cateid) { $arr = "`cateid`='{$cateid}' and `count_view`>'0' and `addtime`>'{$startTime}' and `addtime`<'{$endTime}' and `isaudit`='0'"; } else { $arr = "`addtime`>'{$startTime}' and `count_view`>'0' and `addtime`<'{$endTime}' and `isaudit`='0'"; } $arrArticle = $this->findAll('article', $arr, 'addtime desc', 'articleid,title', 10); foreach ($arrArticle as $key => $item) { $arrArticle[$key]['title'] = tsTitle($item['title']); } return $arrArticle; }
<?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'] = tsTitle($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");
<?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");
<?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.'); 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'])); //统计
<?php defined('IN_TS') or die('Access Denied.'); // 列表 $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $url = tsUrl('article', 'index', array('page' => '')); $lstart = $page * 10 - 10; $arrArticles = $new['article']->findAll('article', array('isaudit' => '0'), 'addtime desc', null, $lstart . ',10'); $articleNum = $new['article']->findCount('article', array('isaudit' => '0')); $pageUrl = pagination($articleNum, 10, $page, $url); foreach ($arrArticles as $key => $item) { $arrArticle[] = $item; $arrArticle[$key]['title'] = tsTitle($item['title']); $arrArticle[$key]['content'] = cututf8(t(tsDecode($item['content'])), 0, 100); $arrArticle[$key]['user'] = aac('user')->getOneUser($item['userid']); $arrArticle[$key]['cate'] = $new['article']->find('article_cate', array('cateid' => $item['cateid'])); } // 推荐阅读 $arrRecommend = $new['article']->getRecommendArticle(); // 一周热门 $arrHot7 = $new['article']->getHotArticle(7); // 一月热门 $arrHot30 = $new['article']->getHotArticle(30); $sitekey = $TS_APP['appkey']; $sitedesc = $TS_APP['appdesc']; $title = '文章'; include template('index');
//某一个圖 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'];
} $strAlbum['title'] = tsTitle($strAlbum['title']); $strAlbum['content'] = tsTitle($strAlbum['content']); $strAlbum['user'] = aac('user')->getOneUser($strAlbum['userid']); $arrAttach = $new['attach']->findAll('attach', array('albumid' => $albumid)); $title = $strAlbum['title']; include template('album'); break; //修改 //修改 case "edit": $userid = aac('user')->isLogin(); $albumid = intval($_GET['albumid']); $strAlbum = $new['attach']->find('attach_album', array('albumid' => $albumid)); $strAlbum['title'] = tsTitle($strAlbum['title']); $strAlbum['content'] = tsTitle($strAlbum['content']); if ($strAlbum['userid'] == $userid || $TS_USER['isadmin'] == 1) { $title = '修改资料库'; include template('album_edit'); } break; case "editdo": $userid = aac('user')->isLogin(); $albumid = intval($_POST['albumid']); $strAlbum = $new['attach']->find('attach_album', array('albumid' => $albumid)); $title = trim($_POST['title']); $content = trim($_POST['content']); if ($title == '' || $content == '') { tsNotice('资料库标题和内容不能为空!'); } if ($strAlbum['userid'] == $userid || $TS_USER['isadmin'] == 1) {
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'] = tsTitle($strAlbum['albumdesc']); $page = isset($_GET['page']) ? intval($_GET['page']) : '1'; $url = tsUrl('photo', 'album', array('id' => $albumid, 'page' => '')); $lstart = $page * 20 - 20; $strUser = aac('user')->getOneUser($strAlbum['userid']); $arrPhoto = $new['photo']->findAll('photo', array('albumid' => $albumid), 'photoid desc', null, $lstart . ',20'); foreach ($arrPhoto as $key => $item) { $arrPhoto[$key]['photodesc'] = stripslashes($item['photodesc']); } $photoNum = $new['photo']->findCount('photo', array('albumid' => $albumid)); $pageUrl = pagination($photoNum, 20, $page, $url); if ($TS_USER['userid'] == $strAlbum['userid']) { $title = '我的相册-' . $strAlbum['albumname']; } else { $title = $strUser['username'] . '的相册-' . $strAlbum['albumname']; }
<div class="s_top">获得约 <?php echo $articleNum; ?> 条结果</div> <?php foreach ((array) $arrArticle as $key => $item) { ?> <div class="result"> <div class="content"> <h3><span>[文章] </span> <a href="<?php echo tsurl('article', 'show', array('id' => $item['articleid'])); ?> "><?php echo tsTitle($item['title']); ?> </a></h3> <div class="info">发表于 <?php echo $item['addtime']; ?> <a href="#"><?php echo $item['count_comment']; ?> 回复</a></div> <p></p> </div> </div> <?php } ?>
?> <div class="s_top">获得约 <?php echo $group_num; ?> 条结果</div> <?php foreach ((array) $arrGroup as $key => $item) { ?> <div class="result"> <div class="content"> <h3><span>[小组] </span> <a href="<?php echo tsurl('group', 'show', array('id' => $item['groupid'])); ?> "><?php echo tsTitle($item['groupname']); ?> </a></h3> <div class="info">创建于 <?php echo date('Y-m-d', $item['addtime']); ?> <a href="#"><?php echo $item['count_user']; ?> 人</a></div> <p><?php echo tsCutContent($item['groupdesc']); ?> </p> </div> </div>
<?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'] = tsTitle($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");
//活动信息 $strEvent = $new['event']->find('event', array('eventid' => $eventid)); if ($strEvent == '') { header("HTTP/1.1 404 Not Found"); header("Status: 404 Not Found"); $title = '404'; include pubTemplate("404"); exit; } if ($strEvent['isaudit'] == 1) { tsNotice('活动审核中...'); } $strEvent['title'] = tsTitle($strEvent['title']); $strEvent['address'] = tsTitle($strEvent['address']); $strEvent['content'] = tsDecode($strEvent['content']); $strEvent['coordinate'] = tsTitle($strEvent['coordinate']); $strEvent['user'] = aac('user')->getOneUser($strEvent['userid']); $strEvent['type'] = $new['event']->find('event_type', array('typeid' => $strEvent['typeid'])); //wishdo $isEventUser = 0; if ($TS_USER['userid']) { $userid = $TS_USER['userid']; $isEventUser = $new['event']->findCount('event_users', array('eventid' => $strEvent['eventid'], 'userid' => $userid)); } //组织者 $arrOrganizers = $new['event']->findAll('event_users', array('eventid' => $strEvent['eventid'], 'isorganizer' => 1)); foreach ($arrOrganizers as $item) { $arrOrganizer[] = aac('user')->getOneUser($item['userid']); } //参加这个活动的成员 $arrDoUsers = $new['event']->findAll('event_users', array('eventid' => $strEvent['eventid'], 'status' => 0), 'addtime desc');
<?php defined('IN_TS') or die('Access Denied.'); //消息盒子 $userid = aac('user')->isLogin(); $touserid = intval($_GET['userid']); if ($userid == 0 || $touserid == 0) { exit; } $msgCount = $new['message']->findCount('message', "(userid='{$userid}' and touserid='{$touserid}') or (userid='{$touserid}' and touserid='{$userid}')"); if ($msgCount == 0) { exit; } $arrMessage = $new['message']->findAll('message', "(userid='{$userid}' and touserid='{$touserid}') or (userid='{$touserid}' and touserid='{$userid}')", 'addtime desc', null, 10); foreach ($arrMessage as $key => $item) { $arrMessage[$key]['user'] = aac('user')->getOneUser($item['userid']); $arrMessage[$key]['content'] = tsTitle($item['content']); } $arrMessage = array_reverse($arrMessage); //isread设为已读 $new['message']->update('message', array('userid' => $touserid, 'touserid' => $userid, 'isread' => 0), array('isread' => 1)); $title = '消息盒子'; include template("msgbox");
include 'userinfo.php'; //动态 $arrFeeds = $new['user']->findAll('feed', array('userid' => $strUser['userid']), 'addtime desc', null, '15'); 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'; }
defined('IN_TS') or die('Access Denied.'); $articleid = intval($_GET['id']); $strArticle = $new['article']->find('article', array('articleid' => $articleid)); if ($articleid == 0 || $strArticle == '') { header("HTTP/1.1 404 Not Found"); header("Status: 404 Not Found"); $title = '404'; include pubTemplate("404"); exit; } // 是否审核 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));
<?php defined('IN_TS') or die('Access Denied.'); $arrMsg = $new['message']->findAll('message', array('touserid' => $strUser['userid'], 'isread' => '0')); foreach ($arrMsg as $key => $item) { $arrMsg[$key]['content'] = tsTitle($item['content']); if ($item['userid']) { $arrMsg[$key]['user'] = aac('user')->getOneUser($item['userid']); } } $title = '我的消息盒子'; include template("my");
} //编辑的数据 if ($strTopic['userid'] == $TS_USER['userid']) { if ($strTopic['isdelete'] == '1') { tsNotice('你的帖子删除中...'); } } // 帖子分类 if ($strTopic['typeid'] != '0') { $strTopic['type'] = $new['group']->find('group_topic_type', array('typeid' => $strTopic['typeid'])); } $strTopic['content'] = @preg_replace("/\\[@(.*)\\:(.*)]/U", "<a href='" . tsUrl('user', 'space', array('id' => '$2')) . " ' rel=\"face\" uid=\"\$2\"'>@\$1</a>", $strTopic['content']); // 最新帖子 $newTopic = $new['group']->findAll('group_topic', array('isaudit' => '0'), 'addtime desc', null, 10); foreach ($newTopic as $key => $item) { $newTopic[$key]['title'] = tsTitle($item['title']); $newTopic[$key]['content'] = tsDecode($item['content']); } // 帖子标签 $strTopic['tags'] = aac('tag')->getObjTagByObjid('topic', 'topicid', $topicid); $strTopic['user'] = aac('user')->getOneUser($strTopic['userid']); //把标签作为关键词 if ($strTopic['tags']) { foreach ($strTopic['tags'] as $key => $item) { $arrTag[] = $item['tagname']; } $sitekey = arr2str($arrTag); } else { $sitekey = $strTopic['title']; } //标题
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; }