public function add() { $js = intval($_GET['js']); $userid = aac('user')->isLogin(1); //判断发布者状态 /* if(aac('user')->isPublisher()==false) { getJson('不好意思,你还没有权限发布内容!',$js); } */ if ($_POST['token'] != $_SESSION['token']) { getJson('非法操作!', $js); } $content = tsClean($_POST['content']); if ($content == '') { getJson('内容不能为空', $js); } $isaudit = 0; //过滤内容开始 aac('system')->antiWord($content); //过滤内容结束 $weiboid = $this->create('weibo', array('userid' => $userid, 'locationid' => aac('user')->getLocationId($userid), 'content' => $content, 'isaudit' => $isaudit, 'addtime' => date('Y-m-d H:i:s'), 'uptime' => date('Y-m-d H:i:s'))); //feed开始 $feed_template = '<span class="pl">说:</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('weibo', 'show', array('id' => $weiboid)), 'content' => cututf8(t($content), '0', '50')); aac('feed')->add($userid, $feed_template, $feed_data); //feed结束 getJson('发布成功!', $js, 2, tsurl('weibo', 'show', array('id' => $weiboid))); }
function signuser() { $arrUser = aac('user')->getHotUser(20); echo '<div class="panel panel-default">'; echo '<div class="panel-heading">最新签到用户</div>'; echo '<div class="panel-body facelist"><ul>'; foreach ($arrUser as $key => $item) { echo '<li><a href="' . tsUrl('user', 'space', array('id' => $item['userid'])) . '"><img class="img-circle" src="' . $item['face'] . '" alt="' . $item['username'] . '" width="48" height="48" /></a><div><a href="' . tsUrl('user', 'space', array('id' => $item['userid'])) . '">' . cututf8(t($item['username']), 0, 5, false) . '</a></div></li>'; } echo '</ul></div><div class="clear"></div></div>'; }
function hottopic() { $arrHotTopics = aac('group')->getHotTopic(7); echo '<div class="bs"><div class="bbox">'; echo '<div class="btitle">热分享</div>'; echo '<div class="bc commlist">'; echo '<ul>'; foreach ($arrHotTopics as $key => $item) { echo '<li><a href="' . tsUrl('group', 'topic', array('id' => $item['topicid'])) . '">' . cututf8(stripslashes($item['title']), 0, 20, false) . '</a> (' . $item['count_view'] . ')</li>'; } echo '</ul>'; echo '</div>'; echo '</div></div>'; }
function hottopic() { $arrHotTopics = aac('group')->getHotTopic(7); echo '<div class="panel panel-default">'; echo '<div class="panel-heading">热门话题</div>'; echo '<div class="panel-body commlist">'; echo '<ul>'; foreach ($arrHotTopics as $key => $item) { echo '<li><a href="' . tsUrl('group', 'topic', array('id' => $item['topicid'])) . '">' . cututf8(stripslashes($item['title']), 0, 20, false) . '</a> (' . $item['count_view'] . ')</li>'; } echo '</ul>'; echo '</div>'; echo '</div>'; }
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'); }
function recommendgroup() { $arrRecommendGroup = aac('group')->getRecommendGroup('12'); echo '<div class="panel panel-default">'; echo '<div class="panel-heading">推荐小组</div>'; echo '<div class="panel-body">'; foreach ($arrRecommendGroup as $key => $item) { $count_user = $item['count_user']; echo '<div class="sub-item"> <div class="pic"> <a href="' . tsUrl('group', 'show', array('id' => $item[groupid])) . '"> <img src="' . $item['photo'] . '" alt="' . $item['groupname'] . '" title="' . $item['groupname'] . '" /> </a> </div> <div class="info"> <a href="' . tsUrl('group', 'show', array('id' => $item[groupid])) . '">' . $item['groupname'] . '</a> (' . $count_user . ') <p>' . cututf8(t($item['groupdesc']), 0, 50) . '</p> </div> </div>'; } echo '</div>'; echo '<div class="clear"></div>'; echo '</div>'; }
$locationid = intval($_GET['id']); $strLocation = $new['location']->find('location', array('locationid' => $locationid)); //文章 $arrArticle = $new['location']->findAll('article', array('locationid' => $locationid), 'addtime desc', null, 10); //资料 $arrAttach = $new['location']->findAll('attach', array('locationid' => $locationid), 'addtime desc', null, 10); //帖子 $arrTopic = $new['location']->findAll('group_topic', array('locationid' => $locationid), 'addtime desc', null, 10); foreach ($arrTopic as $key => $item) { $arrTopic[$key]['user'] = aac('user')->getOneUser($item['userid']); $arrTopic[$key]['group'] = $new['location']->find('group', array('groupid' => $item['groupid'])); } //图片 $arrPhoto = $new['location']->findAll('photo', array('locationid' => $locationid), 'addtime desc', null, 10); //用户 $arrUser = $new['location']->findAll('user_info', array('locationid' => $locationid), 'uptime desc', null, 16); //唠叨 $arrWeibo = $new['location']->findAll('weibo', array('locationid' => $locationid), 'addtime desc', null, 10); foreach ($arrWeibo as $key => $item) { $arrWeibo[$key]['user'] = aac('user')->getOneUser($item['userid']); } //是否是同城用户 $isLocationId = 0; if ($TS_USER['userid']) { $strUser = $new['location']->find('user_info', array('userid' => $TS_USER['userid'])); $isLocationId = $strUser['locationid']; } $sitekey = $strLocation['title']; $sitedesc = cututf8(t($strLocation['content']), 0, 100); $title = $strLocation['title']; include template('show');
$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));
//小组分类 $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);
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); //把标签作为关键词 if ($strArticle['tags']) { foreach ($strArticle['tags'] as $key => $item) { $arrTag[] = $item['tagname']; } $sitekey = arr2str($arrTag); } else { $sitekey = $strArticle['title']; } $sitedesc = cututf8(t($strArticle['content']), 0, 100); $title = $strArticle['title']; include template('show'); // 统计查看次数 $new['article']->update('article', array('articleid' => $strArticle['articleid']), array('count_view' => $strArticle['count_view'] + 1));
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; }
$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; }
} else { echo SITE_URL; ?> app/event/skins/default/event.jpg<?php } ?> " alt="<?php echo $item['title']; ?> " height="150"></a> <div class="caption"> <h3><a href="<?php echo tsurl('event', 'show', array('id' => $item['eventid'])); ?> "><?php echo cututf8($item['title'], 0, 10, false); ?> </a></h3> <p>开始时间:<?php echo date('Y-m-d H:i', strtotime($item['starttime'])); ?> <br /> 结束时间:<?php echo date('Y-m-d H:i', strtotime($item['endtime'])); ?> <br> <?php echo $item['count_userdo']; ?> 人参加 <?php echo $item['count_userwish'];
defined('IN_TS') or die('Access Denied.'); $name = urldecode(trim($_GET['id'])); $tagid = aac('tag')->getTagId(t($name)); $strTag = $new['article']->find('tag', array('tagid' => $tagid)); $strTag['tagname'] = htmlspecialchars($strTag['tagname']); $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $url = tsUrl('article', 'tag', array('id' => urlencode($name), 'page' => '')); $lstart = $page * 30 - 30; $arrTagId = $new['article']->findAll('tag_article_index', array('tagid' => $tagid), null, null, $lstart . ',30'); foreach ($arrTagId as $item) { $strArticle = $new['article']->find('article', array('articleid' => $item['articleid'])); if ($strArticle == '') { $new['article']->delete('tag_article_index', array('articleid' => $item['articleid'], 'tagid' => $item['tagid'])); } if ($strArticle) { $arrArticle[] = $strArticle; } } aac('tag')->countObjTag('article', $tagid); $articleNum = $new['article']->findCount('tag_article_index', array('tagid' => $tagid)); $pageUrl = pagination($articleNum, 30, $page, $url); foreach ($arrArticle as $key => $item) { $arrArticle[$key]['title'] = htmlspecialchars($item['title']); $arrArticle[$key]['content'] = cututf8(t($item['content']), 0, 150); $arrArticle[$key]['user'] = aac('user')->getOneUser($item['userid']); } // 热门tag $arrTag = $new['article']->findAll('tag', "`count_article`>'0'", 'count_article desc', null, 30); $sitekey = $strTag['tagname']; $title = $strTag['tagname']; include template("tag");
<?php defined('IN_TS') or die('Access Denied.'); //所有小组 $page = isset($_GET['page']) ? intval($_GET['page']) : '1'; $url = tsUrl('group', 'all', array('page' => '')); $lstart = $page * 20 - 20; $arrGroups = $db->fetch_all_assoc("select groupid from " . dbprefix . "group order by isrecommend desc limit {$lstart},20"); foreach ($arrGroups as $key => $item) { $arrData[] = $new['group']->getOneGroup($item['groupid']); } foreach ($arrData as $key => $item) { $arrGroup[] = $item; $arrGroup[$key]['groupdesc'] = cututf8(t($item['groupdesc']), 0, 35); } $groupNum = $db->once_fetch_assoc("select count(groupid) from " . dbprefix . "group"); $pageUrl = pagination($groupNum['count(groupid)'], 20, $page, $url); if ($page > 1) { $title = '全部小组 - 第' . $page . '页'; } else { $title = '全部小组'; } //热门帖子 $arrTopic = $db->fetch_all_assoc("select topicid,title,count_comment from " . dbprefix . "group_topic order by count_comment desc limit 10"); //最新10个小组 $arrNewGroup = $new['group']->getNewGroup('10'); include template('all');
<?php defined('IN_TS') or die('Access Denied.'); switch ($ts) { //文化列表 case "list": $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $url = SITE_URL . 'index.php?app=group&ac=admin&mg=group&ts=list&page='; $lstart = $page * 10 - 10; $arrGroup = $db->fetch_all_assoc("select * from " . dbprefix . "group order by addtime desc limit {$lstart},10"); $groupNum = $db->once_num_rows("select * from " . dbprefix . "group"); if (is_array($arrGroup)) { foreach ($arrGroup as $key => $item) { $arrAllGroup[] = $item; $arrAllGroup[$key]['groupdesc'] = cututf8($item['groupdesc'], 0, 40); } } $pageUrl = pagination($groupNum, 10, $page, $url); include template("admin/group_list"); break; //文化添加 //文化添加 case "add": include template("admin/group_add"); break; //文化添加执行 //文化添加执行 case "add_do": $userid = intval($_POST['userid']); $strUser = aac('user')->getOneUser($userid); $groupid = $new['group']->create('group', array('userid' => $userid, 'groupname' => t($_POST['groupname']), 'groupdesc' => tsClean($_POST['groupdesc']), 'isrecommend' => intval($_POST['isrecommend']), 'addtime' => time(), 'ispost' => intval($_POST['ispost'])));
function tsCutContent($text, $length = 50) { $text = cututf8(t(tsDecode($text)), 0, $length); return $text; }
<table cellpadding="0" cellspacing="0"> <tr class="old"><td width="20">ID</td><td width="100">文化名字</td><td width="200">文化介绍</td><td>帖子统计</td><td>成员统计</td><td>创建时间</td><td>操作</td></tr> <?php foreach ((array) $arrAllGroup as $key => $item) { ?> <tr class="odd"><td><?php echo $item['groupid']; ?> </td><td><a href="<?php echo tsurl('group', 'show', array('id' => $item['groupid'])); ?> " target="_blank">[<?php echo $item['groupname']; ?> ]</a></td><td><?php echo cututf8(t($item['groupdesc']), 0, 20); ?> </td><td><?php echo $item['count_topic']; ?> </td><td><?php echo $item['count_user']; ?> </td><td><?php echo date('Y-m-d H:i:s', $item['addtime']); ?> </td><td><?php if ($item['isaudit'] == 1) { ?> <a href="<?php echo SITE_URL;