+13
@@ -0,0 +1,13 @@
|
||||
/cache
|
||||
/data
|
||||
/tslogs
|
||||
/uploadfile
|
||||
.git
|
||||
.idea
|
||||
.history
|
||||
.vscode
|
||||
.htaccess
|
||||
.DS_Store
|
||||
upgrade.sql
|
||||
upgrade.txt
|
||||
auto_install.json
|
||||
@@ -0,0 +1,26 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<title>404</title>
|
||||
<style>
|
||||
body{
|
||||
background-color:#444;
|
||||
font-size:14px;
|
||||
}
|
||||
h3{
|
||||
font-size:60px;
|
||||
color:#eee;
|
||||
text-align:center;
|
||||
padding-top:30px;
|
||||
font-weight:normal;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h3>404,您请求的文件不存在!</h3>
|
||||
</body>
|
||||
</html>
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
FROM php:7.2-apache
|
||||
|
||||
RUN apt-get update \
|
||||
# 相关依赖必须手动安装
|
||||
&& apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng-dev \
|
||||
# memcached 的相关依赖
|
||||
&& apt-get install -y libmemcached-dev zlib1g-dev \
|
||||
# 安装扩展
|
||||
&& docker-php-ext-install -j$(nproc) iconv \
|
||||
# 如果安装的扩展需要自定义配置时
|
||||
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
|
||||
&& docker-php-ext-install -j$(nproc) gd \
|
||||
# pecl 安卓mcrypt php从7.2开始不再在源码里支持mcrypt扩展而转到pecl方式支持
|
||||
&& pecl install mcrypt-1.0.1 \
|
||||
&& docker-php-ext-enable mcrypt \
|
||||
# 其他扩展
|
||||
&& docker-php-ext-install mysqli \
|
||||
&& docker-php-ext-install pdo_mysql \
|
||||
# pecl安装php的memcached扩展
|
||||
&& pecl install memcached \
|
||||
# 启用memcached 扩展
|
||||
&& docker-php-ext-enable memcached \
|
||||
# pecl 安装php的redis扩展
|
||||
&& pecl install redis \
|
||||
# 启用redis扩展
|
||||
&& docker-php-ext-enable redis
|
||||
|
||||
COPY . /var/www/html/
|
||||
|
||||
RUN chmod -R 755 /var/www/html/cache
|
||||
RUN chmod -R 755 /var/www/html/data
|
||||
RUN chmod -R 755 /var/www/html/tslogs
|
||||
RUN chmod -R 755 /var/www/html/upgrade
|
||||
RUN chmod -R 755 /var/www/html/uploadfile
|
||||
|
||||
ENV APACHE_RUN_USER www-data
|
||||
ENV APACHE_RUN_GROUP www-data
|
||||
ENV APACHE_LOG_DIR /var/log/apache2
|
||||
ENV APACHE_PID_FILE /var/run/apache2.pid
|
||||
ENV APACHE_RUN_DIR /var/run/apache2
|
||||
ENV APACHE_LOCK_DIR /var/lock/apache2
|
||||
ENV APACHE_SERVERADMIN admin@localhost
|
||||
ENV APACHE_SERVERNAME localhost
|
||||
ENV APACHE_SERVERALIAS docker.localhost
|
||||
ENV APACHE_DOCUMENTROOT /var/www
|
||||
|
||||
WORKDIR /var/www/html
|
||||
ENTRYPOINT apache2 -D FOREGROUND
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
++++ThinkSAAS安装说明
|
||||
|
||||
【推荐运行环境】
|
||||
PHP7.0及以上版本(建议使用php7.2),MySQL5.5及以上版本(建议使用mysql5.6),不支持MySQL8
|
||||
推荐使用Linux + Apache或者Linux + Nginx环境的主机
|
||||
【安装说明】
|
||||
1、上传目录下所有文件到你的网站根目录下
|
||||
(Linux系统必须使用FTP二进制上传)
|
||||
2、直接输入你的网址进行安装
|
||||
(不要带install)
|
||||
3、根据安装提示输入数据库连接信息、网站信息和管理员信息
|
||||
(安装前请为ThinkSAAS手动新建一个空数据库)
|
||||
4、安装成功。
|
||||
|
||||
【注意】
|
||||
|
||||
请保证以下目录和目录下所有文件的可写权限(777)
|
||||
cache
|
||||
data
|
||||
tslogs
|
||||
upgrade
|
||||
uploadfile
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
【用户条款】
|
||||
本协议适用ThinkSAAS发布的所有程序版本和代码,所有版本都将按照最新发布的【用户条款】执行。
|
||||
1、ThinkSAAS官方指:ThinkSAAS社区、thinksaas.cn和ThinkSAAS社区系统开发者邱君。
|
||||
2、ThinkSAAS禁止用户在使用中触犯中国法律范围内的任何法律条文。
|
||||
3、ThinkSAAS、及其创始人邱君拥有对ThinkSAAS的所有权,任何个人,公司和组织不得以任何形式和目的侵犯ThinkSAAS的版权和著作权。
|
||||
4、ThinkSAAS官方拥有对ThinkSAAS社区软件绝对的版权和著作权。
|
||||
5、ThinkSAAS程序代码完全开源,不做任何加密处理。ThinkSAAS允许【自身运营】用户对程序代码进行二次开发,但必须遵循本条款第6、7、8和9条规定执行。
|
||||
6、所有使用ThinkSAAS的用户在保留底部Powered by ThinkSAAS 文字链接或者标识的情况下,可以免费使用ThinkSAAS。
|
||||
7、用户在购买ThinkSAAS商业授权后才可以去除底部Powered by ThinkSAAS 文字链接或者标识。
|
||||
8、ThinkSAAS不会监控用户网站信息,但有权通过邮件或者其他联系方式获悉用户使用情况,有权拿用户网站用作案例展示。
|
||||
9、在未经ThinkSAAS官方书面允许的情况下,除【自身运营】外,任何个人、公司和组织不能单方面发布和出售以ThinkSAAS为基础开发的任何互联网软件或者产品,否则将视为侵权行为,将依照中华人民共和国法律追究其法律责任。
|
||||
10、公司企业等组织机构使用ThinkSAAS软件必须购买ThinkSAAS商业授权协议。
|
||||
11、ThinkSAAS官方拥有对此协议的修改和不断完善。
|
||||
|
||||
【自身运营】解释:即用户在使用ThinkSAAS中,不通过出售任何以ThinkSAAS为基础开发的产品,仅用作自身学习和自身商业运营的网站。
|
||||
【用户条款】网址:https://www.thinksaas.cn/home/info/3/
|
||||
【官方网站】网址:https://www.thinksaas.cn/
|
||||
【演示网站】网址:https://demo.thinksaas.cn/
|
||||
@@ -0,0 +1,78 @@
|
||||
## ThinkSAAS简介
|
||||
|
||||
ThinkSAAS是一个轻量级的开源社区系统,是一个可以用来搭建垂直网络的社区系统。
|
||||
ThinkSAAS是一个简单,高扩展的社区开发系统。
|
||||
ThinkSAAS可以帮你快速开发和搭建与众不同的交流社区。
|
||||
|
||||
## 开发环境
|
||||
|
||||
php >= 7.0 (支持php7+、php8+)
|
||||
MySQL >= 5.5 (支持mysql5+,mysql8)
|
||||
MariaDB >= 5.5(支持mariadb10)
|
||||
Apache / Nginx
|
||||
Windows / Linux
|
||||
建议采用lnmp或者lamp环境
|
||||
|
||||
## 系统特点
|
||||
|
||||
开发简单,php新手也可以开发强大功能
|
||||
单一入口
|
||||
扩展强大,支持应用扩展和插件扩展,支持http api接口扩展
|
||||
APP可单独配置独立数据库
|
||||
多端自适应,集成bootstrap
|
||||
底层加载速度快,抗压和并发能力强
|
||||
支持composer方式安装php第三方扩展库
|
||||
系统稳定、功能模块化、二次开发简单,持续升级
|
||||
适合个人和团队协作开发
|
||||
|
||||
## 系统基础功能
|
||||
|
||||
用户中心模块(user)
|
||||
系统管理模块(system)
|
||||
小组模块(group)
|
||||
话题模块(topic)
|
||||
文章模块(article)
|
||||
相册模块(photo)
|
||||
标签模块(tag)
|
||||
邮件模块(mail)
|
||||
消息模块(message)
|
||||
唠叨模块(weibo)
|
||||
搜索模块(search)
|
||||
我的社区(my)
|
||||
支持Email注册登录
|
||||
支持手机号注册
|
||||
支持短信验证码登录
|
||||
支持阿里云对象存储OSS
|
||||
支持发布内容人机验证
|
||||
支持敏感词过滤
|
||||
支持用户行为日志记录
|
||||
支持微信公众号网页授权登录
|
||||
支持用户积分
|
||||
更多特点和功能期待您的发现!
|
||||
|
||||
## 用户协议
|
||||
|
||||
本协议适用ThinkSAAS发布的所有程序版本和代码,所有版本都将按照最新发布的【用户条款】执行。
|
||||
1、ThinkSAAS官方指:ThinkSAAS社区、thinksaas.cn和ThinkSAAS社区系统开发者邱君。
|
||||
2、ThinkSAAS禁止用户在使用中触犯中国法律范围内的任何法律条文。
|
||||
3、任何个人,公司和组织不得以任何形式和目的侵犯ThinkSAAS的版权和著作权。
|
||||
4、ThinkSAAS官方拥有对ThinkSAAS社区软件绝对的版权和著作权。
|
||||
5、ThinkSAAS程序代码完全开源,不做任何加密处理。ThinkSAAS允许【自身运营】用户对程序代码进行二次开发,但必须遵循本条款第6、7、8和9条规定执行。
|
||||
6、所有使用ThinkSAAS的用户在保留底部Powered by ThinkSAAS 文字链接或者标识的情况下,可以免费使用ThinkSAAS。
|
||||
7、用户在购买ThinkSAAS商业授权后才可以去除底部Powered by ThinkSAAS 文字链接或者标识。
|
||||
8、ThinkSAAS不会监控用户网站信息,但有权通过邮件或者其他联系方式获悉用户使用情况,有权拿用户网站用作案例展示。
|
||||
9、在未经ThinkSAAS官方书面允许的情况下,除【自身运营】外,任何个人、公司和组织不能单方面发布和出售以ThinkSAAS为基础开发的任何互联网软件或者产品,否则将视为侵权行为,将依照中华人民共和国法律追究其法律责任。
|
||||
10、公司企业等组织机构使用ThinkSAAS软件必须购买ThinkSAAS商业授权协议。
|
||||
11、ThinkSAAS官方拥有对此协议的修改和不断完善。
|
||||
|
||||
【自身运营】解释:即用户在使用ThinkSAAS中,不通过出售任何以ThinkSAAS为基础开发的产品,仅用作自身学习和自身商业运营的网站。
|
||||
【用户条款】网址:https://www.thinksaas.cn/home/info/3/
|
||||
【官方网站】网址:https://www.thinksaas.cn/
|
||||
【演示网站】网址:https://demo.qiniao.com/
|
||||
|
||||
## 安装说明
|
||||
|
||||
1、上传目录下所有文件到你的网站根目录下(Linux系统必须使用FTP二进制上传)
|
||||
2、直接输入你的网址进行安装(不要带install)
|
||||
3、根据安装提示输入数据库连接信息、网站信息和管理员信息(安装前请为ThinkSAAS手动新建一个空数据库)
|
||||
4、安装成功。
|
||||
@@ -0,0 +1 @@
|
||||
this file was created on Wed. 26th June 2019 at 13:38:22, after ecoder checked the permissions of the folder /www/wwwroot/lmve.net/app/.
|
||||
@@ -0,0 +1 @@
|
||||
this file was created on Wed. 26th June 2019 at 13:38:28, after ecoder checked the permissions of the folder /www/wwwroot/lmve.net/app/article/.
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
return array(
|
||||
'name' => '文章',
|
||||
'version' => '1.2',
|
||||
'desc' => '文章',
|
||||
'url' => 'http://www.thinksaas.cn',
|
||||
'email' => 'thinksaas@qq.com',
|
||||
'author' => '邱君',
|
||||
'author_url' => 'http://www.thinksaas.cn',
|
||||
'isoption' => '1',
|
||||
'isinstall' => '1',
|
||||
'issql' => '1',
|
||||
'issystem' => '1',
|
||||
'isappnav' => '1',
|
||||
'ismy'=>'1'
|
||||
);
|
||||
@@ -0,0 +1,213 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
//判断用户登录
|
||||
$userid = aac('user') -> isLogin();
|
||||
|
||||
//判断用户是否存在
|
||||
if(aac('user')->isUser($userid)==false) tsNotice('不好意思,用户不存在!');
|
||||
|
||||
//判断发布者状态
|
||||
if(aac('user')->isPublisher()==false) tsNotice('不好意思,你还没有权限发布内容!');
|
||||
|
||||
//发布时间限制
|
||||
if(aac('system')->pubTime()==false) tsNotice('不好意思,当前时间不允许发布内容!');
|
||||
|
||||
//发布时间间隔限制
|
||||
if($TS_SITE['timeblank']){
|
||||
$lastArticle = $new['article']->find('article',array(
|
||||
'userid'=>$userid,
|
||||
),'articleid,addtime','addtime desc');
|
||||
if($lastArticle){
|
||||
if((time()-strtotime($lastArticle['addtime']))<$TS_SITE['timeblank']){
|
||||
tsNotice('不好意思,您的内容发送频率过高!请等等再发布!');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//发布内容扣除积分限制
|
||||
$strScoreOption = $new['article']->find('user_score',array(
|
||||
'app'=>'article',
|
||||
'action'=>'add',
|
||||
'ts'=>'do',
|
||||
));
|
||||
if($strScoreOption && $strScoreOption['status']==1){
|
||||
#用户积分数
|
||||
$strUserScore = $new['article']->find('user_info',array(
|
||||
'userid'=>$userid,
|
||||
),'count_score');
|
||||
if($strUserScore['count_score']<$strScoreOption['score']){
|
||||
tsNotice('不好意思,您的积分不足!');
|
||||
}
|
||||
}
|
||||
|
||||
switch ($ts) {
|
||||
case "" :
|
||||
if ($TS_APP['allowpost'] == 0 && $TS_USER['isadmin'] == 0) {
|
||||
tsNotice('系统设置不允许会员发文章!');
|
||||
}
|
||||
|
||||
$cateid = tsIntval($_GET['cateid']);
|
||||
|
||||
|
||||
foreach ($arrCate as $key=>$item){
|
||||
$arrCate[$key]['two'] = $new['article']->findAll('article_cate',array(
|
||||
'referid'=>$item['cateid'],
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
#加载草稿箱
|
||||
$strDraft = $new['article']->find('draft',array(
|
||||
'userid'=>$userid,
|
||||
'types'=>'article',
|
||||
));
|
||||
|
||||
|
||||
$title = '发布文章';
|
||||
include template('add');
|
||||
break;
|
||||
|
||||
case "do" :
|
||||
|
||||
#验证码验证
|
||||
$authcode = strtolower($_POST ['authcode']);
|
||||
if ($TS_SITE['isauthcode']){
|
||||
if ($authcode != $_SESSION['verify']){
|
||||
tsNotice("验证码输入有误,请重新输入!" );
|
||||
}
|
||||
}
|
||||
|
||||
#人机验证
|
||||
$vaptcha_token = tsTrim($_POST['vaptcha_token']);
|
||||
$vaptcha_server = tsTrim($_POST['vaptcha_server']);
|
||||
if ($TS_SITE['is_vaptcha']){
|
||||
$strVt = vaptcha($vaptcha_token,0,$vaptcha_server);
|
||||
if($strVt['success']==0){
|
||||
tsNotice('人机验证未通过!');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$cateid = tsIntval($_POST['cateid']);
|
||||
$cateid2 = tsIntval($_POST['cateid2']);
|
||||
|
||||
if($cateid2) $cateid = $cateid2;
|
||||
|
||||
$title = tsTrim($_POST['title']);
|
||||
$content = tsClean($_POST['content']);
|
||||
$content2 = emptyText($_POST['content']);
|
||||
$gaiyao = tsTrim($_POST['gaiyao']);
|
||||
$tag = tsClean($_POST['tag']);
|
||||
$addtime = date('Y-m-d H:i:s');
|
||||
|
||||
$score = tsIntval($_POST ['score']);#积分
|
||||
|
||||
|
||||
//匿名用户
|
||||
$isniming = tsIntval($_POST['isniming']);
|
||||
if($TS_SITE['isniming']==1 && $isniming==1) $userid = aac('user')->getNimingId();
|
||||
|
||||
|
||||
|
||||
if (tsIntval($TS_USER['isadmin']) == 0) {
|
||||
// 过滤内容开始
|
||||
$title = antiWord($title);
|
||||
$content = antiWord($content);
|
||||
$tag = antiWord($tag);
|
||||
// 过滤内容结束
|
||||
}
|
||||
|
||||
if ($title == '' || $content2 == '' || $content=='')
|
||||
tsNotice("标题和内容都不能为空!");
|
||||
|
||||
$isTitle = $new['article']->findCount('article',array(
|
||||
'title'=>$title,
|
||||
));
|
||||
|
||||
if($isTitle){
|
||||
tsNotice("相同标题的文章已经存在!");
|
||||
}
|
||||
|
||||
if($gaiyao){
|
||||
$gaiyao = cututf8($gaiyao,0,100);
|
||||
}else{
|
||||
$gaiyao = cututf8(t(tsDecode($content)),0,100);
|
||||
}
|
||||
|
||||
if($score<0){
|
||||
tsNotice ( '积分填写有误!' );
|
||||
}
|
||||
|
||||
//1审核后显示0不审核
|
||||
if ($TS_APP['isaudit'] == 1) {
|
||||
$isaudit = 1;
|
||||
} else {
|
||||
$isaudit = 0;
|
||||
}
|
||||
|
||||
$articleid = $new['article'] -> create('article', array(
|
||||
'userid' => $userid,
|
||||
'cateid' => $cateid,
|
||||
'title' => $title,
|
||||
#'content' => $content,
|
||||
'gaiyao' => $gaiyao,
|
||||
'score'=>$score,
|
||||
'isaudit' => $isaudit,
|
||||
'addtime' => date('Y-m-d H:i:s')
|
||||
));
|
||||
|
||||
if($articleid){
|
||||
|
||||
$new['article'] -> create('article_content', array(
|
||||
'articleid' => $articleid,
|
||||
'content' => $content,
|
||||
));
|
||||
|
||||
|
||||
#清空草稿箱
|
||||
$new['article']->delete('draft',array(
|
||||
'userid'=>$userid,
|
||||
'types'=>'article',
|
||||
));
|
||||
|
||||
|
||||
// 上传图片开始
|
||||
$arrUpload = tsUpload($_FILES['photo'], $articleid, 'article', array('jpg', 'gif', 'png', 'jpeg'));
|
||||
if ($arrUpload) {
|
||||
$new['article'] -> update('article', array(
|
||||
'articleid' => $articleid
|
||||
), array(
|
||||
'path' => $arrUpload['path'],
|
||||
'photo' => $arrUpload['url']
|
||||
));
|
||||
|
||||
#生成不同尺寸的图片
|
||||
tsXimg($arrUpload['url'],'article',320,180,$arrUpload['path'],'1');
|
||||
//tsXimg($arrUpload['url'],'article',640,'',$arrUpload['path']);
|
||||
|
||||
}
|
||||
// 上传图片结束
|
||||
|
||||
// 处理标签
|
||||
aac('tag') -> addTag('article', 'articleid', $articleid, $tag);
|
||||
|
||||
|
||||
// 对积分进行处理
|
||||
if($isaudit==0){
|
||||
aac('user') -> doScore($TS_URL['app'], $TS_URL['ac'],$TS_URL['mg'],$TS_URL['api'],$TS_URL['ts']);
|
||||
}
|
||||
|
||||
#用户记录
|
||||
aac('pubs')->addLogs('article','articleid',$articleid,$userid,$title,$content,0);
|
||||
|
||||
header("Location: " . tsUrl('article', 'show', array('id' => $articleid)));
|
||||
|
||||
}else{
|
||||
|
||||
tsNotice ( '文章发布失败!' );
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
// 管理入口
|
||||
if (is_file('app/' . $TS_URL['app'] . '/action/admin/' . $mg . '.php')) {
|
||||
include_once 'app/' . $TS_URL['app'] . '/action/admin/' . $mg . '.php';
|
||||
} else {
|
||||
qiMsg('sorry:no index!');
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
switch($ts){
|
||||
|
||||
case "list":
|
||||
|
||||
$page = tsIntval($_GET['page'],1);
|
||||
$url = SITE_URL.'index.php?app=article&ac=admin&mg=article&ts=list&page=';
|
||||
$lstart = $page*20-20;
|
||||
$arrArticle = $new['article']->findAll('article',null,'addtime desc',null,$lstart.',20');
|
||||
|
||||
$articleNum = $new['article']->findCount('article');
|
||||
$pageUrl = pagination($articleNum, 20, $page, $url);
|
||||
|
||||
include template('admin/article_list');
|
||||
break;
|
||||
|
||||
//审核通过
|
||||
case "isaudit0":
|
||||
|
||||
$articleid = tsIntval($_GET['articleid']);
|
||||
$strArticle = $new['article']->find('article',array(
|
||||
'articleid'=>$articleid,
|
||||
));
|
||||
|
||||
$new['article']->update('article',array(
|
||||
'articleid'=>$articleid,
|
||||
),array(
|
||||
'isaudit'=>0,
|
||||
));
|
||||
|
||||
#发送系统消息
|
||||
$msg_userid = '0';
|
||||
$msg_touserid = $strArticle['userid'];
|
||||
$msg_content = '你发布的文章审核通过,快去看看吧^_^ ';
|
||||
$msg_url = tsUrl('article','show',array('id'=>$articleid));
|
||||
aac('message')->sendmsg($msg_userid,$msg_touserid,$msg_content,$msg_url);
|
||||
|
||||
#处理积分
|
||||
aac('user') -> doScore($TS_URL['app'], $TS_URL['ac'],$TS_URL['mg'],$TS_URL['api'],$TS_URL['ts'],$strArticle['userid']);
|
||||
|
||||
qiMsg('操作成功!');
|
||||
break;
|
||||
|
||||
#审核不通过
|
||||
case "isaudit1":
|
||||
|
||||
$articleid = tsIntval($_GET['articleid']);
|
||||
$strArticle = $new['article']->find('article',array(
|
||||
'articleid'=>$articleid,
|
||||
));
|
||||
|
||||
$new['article']->update('article',array(
|
||||
'articleid'=>$articleid,
|
||||
),array(
|
||||
'isaudit'=>1,
|
||||
));
|
||||
|
||||
#发送系统消息
|
||||
$msg_userid = '0';
|
||||
$msg_touserid = $strArticle['userid'];
|
||||
$msg_content = '你发布的文章审核未通过,快去看看吧^_^ ';
|
||||
$msg_url = tsUrl('article','show',array('id'=>$articleid));
|
||||
aac('message')->sendmsg($msg_userid,$msg_touserid,$msg_content,$msg_url);
|
||||
|
||||
#处理积分
|
||||
aac('user') -> doScore($TS_URL['app'], $TS_URL['ac'],$TS_URL['mg'],$TS_URL['api'],$TS_URL['ts'],$strArticle['userid']);
|
||||
|
||||
qiMsg('操作成功!');
|
||||
|
||||
break;
|
||||
|
||||
//删除
|
||||
case "delete":
|
||||
|
||||
$articleid = tsIntval($_GET['articleid']);
|
||||
$strArticle = $new['article']->find('article',array(
|
||||
'articleid'=>$articleid,
|
||||
));
|
||||
|
||||
$new['article']->deleteArticle($strArticle);
|
||||
|
||||
#处理积分
|
||||
aac('user') -> doScore($TS_URL['app'], $TS_URL['ac'],$TS_URL['mg'],$TS_URL['api'],$TS_URL['ts'],$strArticle['userid']);
|
||||
|
||||
#用户记录
|
||||
aac('pubs')->addLogs('article','articleid',$articleid,$TS_USER['userid'],$strArticle['title'],$strArticle['content'],2);
|
||||
|
||||
qiMsg('删除成功!');
|
||||
|
||||
break;
|
||||
|
||||
//推荐
|
||||
case "isrecommend":
|
||||
|
||||
$articleid = tsIntval($_GET['articleid']);
|
||||
$strArticle = $new['article']->find('article',array(
|
||||
'articleid'=>$articleid,
|
||||
));
|
||||
|
||||
if($strArticle['isrecommend']==0){
|
||||
$isrecommend = 1;
|
||||
}else{
|
||||
$isrecommend = 0;
|
||||
}
|
||||
|
||||
$new['article']->update('article',array(
|
||||
'articleid'=>$articleid,
|
||||
),array(
|
||||
'isrecommend'=>$isrecommend,
|
||||
));
|
||||
|
||||
#更新项目推荐
|
||||
aac('pubs')->upPtableRecommend('article','articleid',$articleid,$isrecommend);
|
||||
|
||||
qiMsg('操作成功!');
|
||||
break;
|
||||
|
||||
//置顶
|
||||
case "istop":
|
||||
|
||||
$articleid = tsIntval($_GET['articleid']);
|
||||
$strArticle = $new['article']->find('article',array(
|
||||
'articleid'=>$articleid,
|
||||
));
|
||||
|
||||
if($strArticle['istop']==0){
|
||||
$istop = 1;
|
||||
}else{
|
||||
$istop = 0;
|
||||
}
|
||||
|
||||
$new['article']->update('article',array(
|
||||
'articleid'=>$articleid,
|
||||
),array(
|
||||
'istop'=>$istop,
|
||||
));
|
||||
|
||||
qiMsg('操作成功!');
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
switch($ts){
|
||||
//分类列表
|
||||
case "list":
|
||||
|
||||
$arrCate = $new['article']->findAll('article_cate',array(
|
||||
'referid'=>0,
|
||||
),'orderid asc');
|
||||
|
||||
foreach($arrCate as $key=>$item){
|
||||
$arrCate[$key]['twocate'] = $new['article']->findAll('article_cate',array(
|
||||
'referid'=>$item['cateid'],
|
||||
),'orderid asc');
|
||||
}
|
||||
|
||||
include template("admin/cate_list");
|
||||
|
||||
break;
|
||||
|
||||
//分类添加
|
||||
case "add":
|
||||
|
||||
$referid = tsIntval($_GET['referid']);
|
||||
|
||||
include template("admin/cate_add");
|
||||
|
||||
break;
|
||||
|
||||
case "add_do":
|
||||
|
||||
|
||||
|
||||
$new['article']->create('article_cate',array(
|
||||
'referid'=>tsIntval($_POST['referid']),
|
||||
'catename'=>tsTrim($_POST['catename']),
|
||||
'cateinfo'=>tsTrim($_POST['cateinfo']),
|
||||
'orderid'=>tsIntval($_POST['orderid']),
|
||||
|
||||
));
|
||||
|
||||
|
||||
header("Location: ".SITE_URL."index.php?app=article&ac=admin&mg=cate&ts=list");
|
||||
|
||||
break;
|
||||
|
||||
//分类删除
|
||||
case "del":
|
||||
|
||||
$cateid = tsIntval($_GET['cateid']);
|
||||
|
||||
|
||||
$strCate = $new['article']->find('article_cate',array(
|
||||
'cateid'=>$cateid,
|
||||
));
|
||||
|
||||
if($strCate['referid']==0){
|
||||
$arrCate = $new['article']->findAll('article_cate',array(
|
||||
'referid'=>$strCate['cateid'],
|
||||
));
|
||||
|
||||
foreach($arrCate as $key=>$item){
|
||||
$new['article']->update('article',array(
|
||||
'cateid'=>$item['cateid']
|
||||
),array(
|
||||
'cateid'=>0,
|
||||
));
|
||||
}
|
||||
|
||||
$new['article']->delete('article_cate',array(
|
||||
'referid'=>$strCate['cateid'],
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
|
||||
$new['article']->update('article',array(
|
||||
'cateid'=>$cateid
|
||||
),array(
|
||||
'cateid'=>0,
|
||||
));
|
||||
|
||||
|
||||
$new['article']->delete('article_cate',array(
|
||||
'cateid'=>$cateid,
|
||||
));
|
||||
|
||||
|
||||
|
||||
|
||||
qiMsg("分类删除成功!");
|
||||
|
||||
break;
|
||||
|
||||
//分类修改
|
||||
case "edit":
|
||||
|
||||
$cateid = tsIntval($_GET['cateid']);
|
||||
|
||||
$strCate = $new['article']->find('article_cate',array(
|
||||
'cateid'=>$cateid,
|
||||
));
|
||||
|
||||
|
||||
include template("admin/cate_edit");
|
||||
|
||||
break;
|
||||
|
||||
//分类修改执行
|
||||
case "edit_do":
|
||||
$cateid = tsIntval($_POST['cateid']);
|
||||
$catename = tsTrim($_POST['catename']);
|
||||
$cateinfo = tsTrim($_POST['cateinfo']);
|
||||
|
||||
$new['article']->update('article_cate',array(
|
||||
'cateid'=>$cateid,
|
||||
),array(
|
||||
'catename'=>$catename,
|
||||
'cateinfo'=>$cateinfo,
|
||||
'orderid'=>tsIntval($_POST['orderid']),
|
||||
));
|
||||
|
||||
header("Location: ".SITE_URL."index.php?app=article&ac=admin&mg=cate&ts=list");
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
switch($ts){
|
||||
//基本配置
|
||||
case "":
|
||||
$strOption = getAppOptions('article');
|
||||
|
||||
include template("admin/options");
|
||||
|
||||
break;
|
||||
|
||||
case "do":
|
||||
|
||||
$arrOption = $_POST['option'];
|
||||
|
||||
#更新app配置选项
|
||||
upAppOptions('article',$arrOption);
|
||||
|
||||
#更新app导航和我的导航
|
||||
upAppNav('article',$arrOption['appname']);
|
||||
|
||||
qiMsg('修改成功!');
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
switch($ts){
|
||||
|
||||
case "":
|
||||
|
||||
$ugid = tsIntval($_GET['ugid'],1);
|
||||
|
||||
$arrUg = $new['article']->findAll('user_group',null,'ugid asc');
|
||||
|
||||
|
||||
|
||||
|
||||
include template('admin/permissions');
|
||||
|
||||
break;
|
||||
|
||||
case "do":
|
||||
|
||||
/**
|
||||
* 权限参数说明,app,action必须,其他参数可选
|
||||
* app-action-ts
|
||||
* app-action-mg-ts 当action=admin
|
||||
* app-action-api-ts 当action=api
|
||||
*/
|
||||
|
||||
$ugid = tsIntval($_POST['ugid']);
|
||||
|
||||
$arrOption = $_POST['option'];
|
||||
|
||||
aac('pubs')->upAppPermissions($ugid,'article',$arrOption);
|
||||
|
||||
qiMsg('操作成功!');
|
||||
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?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=article&ac=admin&mg=post&ts=list&page=';
|
||||
$lstart = $page*20-20;
|
||||
$arrArticle = $new['article']->findAll('article',null,'addtime desc',null,$lstart.',20');
|
||||
|
||||
$articleNum = $new['article']->findCount('article');
|
||||
$pageUrl = pagination($articleNum, 20, $page, $url);
|
||||
|
||||
include template('admin/post_list');
|
||||
break;
|
||||
|
||||
//审核通过
|
||||
case "isaudit0":
|
||||
|
||||
$articleid = intval($_GET['articleid']);
|
||||
$strArticle = $new['article']->find('article',array(
|
||||
'articleid'=>$articleid,
|
||||
));
|
||||
|
||||
$new['article']->update('article',array(
|
||||
'articleid'=>$articleid,
|
||||
),array(
|
||||
'isaudit'=>0,
|
||||
));
|
||||
|
||||
#发送系统消息
|
||||
$msg_userid = '0';
|
||||
$msg_touserid = $strArticle['userid'];
|
||||
$msg_content = '你发布的文章审核通过,快去看看吧^_^ ';
|
||||
$msg_url = tsUrl('article','show',array('id'=>$articleid));
|
||||
aac('message')->sendmsg($msg_userid,$msg_touserid,$msg_content,$msg_url);
|
||||
|
||||
#处理积分
|
||||
aac('user') -> doScore($TS_URL['app'], $TS_URL['ac'], $TS_URL['ts'],$strArticle['userid'],$TS_URL['mg']);
|
||||
|
||||
qiMsg('操作成功!');
|
||||
break;
|
||||
|
||||
#审核不通过
|
||||
case "isaudit1":
|
||||
|
||||
$articleid = intval($_GET['articleid']);
|
||||
$strArticle = $new['article']->find('article',array(
|
||||
'articleid'=>$articleid,
|
||||
));
|
||||
|
||||
$new['article']->update('article',array(
|
||||
'articleid'=>$articleid,
|
||||
),array(
|
||||
'isaudit'=>1,
|
||||
));
|
||||
|
||||
#发送系统消息
|
||||
$msg_userid = '0';
|
||||
$msg_touserid = $strArticle['userid'];
|
||||
$msg_content = '你发布的文章审核未通过,快去看看吧^_^ ';
|
||||
$msg_url = tsUrl('article','show',array('id'=>$articleid));
|
||||
aac('message')->sendmsg($msg_userid,$msg_touserid,$msg_content,$msg_url);
|
||||
|
||||
#处理积分
|
||||
aac('user') -> doScore($TS_URL['app'], $TS_URL['ac'], $TS_URL['ts'],$strArticle['userid'],$TS_URL['mg']);
|
||||
|
||||
qiMsg('操作成功!');
|
||||
|
||||
break;
|
||||
|
||||
//删除
|
||||
case "delete":
|
||||
|
||||
$articleid = intval($_GET['articleid']);
|
||||
$strArticle = $new['article']->find('article',array(
|
||||
'articleid'=>$articleid,
|
||||
));
|
||||
|
||||
if($strArticle['photo']){
|
||||
unlink('uploadfile/article/'.$strArticle['photo']);
|
||||
}
|
||||
|
||||
$new['article']->delete('article',array(
|
||||
'articleid'=>$articleid,
|
||||
));
|
||||
|
||||
$new['article']->delete('tag_article_index',array(
|
||||
'articleid'=>$articleid,
|
||||
));
|
||||
|
||||
#处理积分
|
||||
aac('user') -> doScore($TS_URL['app'], $TS_URL['ac'], $TS_URL['ts'],$strArticle['userid'],$TS_URL['mg']);
|
||||
|
||||
qiMsg('删除成功!');
|
||||
|
||||
break;
|
||||
|
||||
//推荐
|
||||
case "isrecommend":
|
||||
|
||||
$articleid = intval($_GET['articleid']);
|
||||
$strArticle = $new['article']->find('article',array(
|
||||
'articleid'=>$articleid,
|
||||
));
|
||||
|
||||
if($strArticle['isrecommend']==0){
|
||||
$new['article']->update('article',array(
|
||||
'articleid'=>$articleid,
|
||||
),array(
|
||||
'isrecommend'=>1,
|
||||
));
|
||||
}else{
|
||||
$new['article']->update('article',array(
|
||||
'articleid'=>$articleid,
|
||||
),array(
|
||||
'isrecommend'=>0,
|
||||
));
|
||||
}
|
||||
|
||||
qiMsg('操作成功!');
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
$arrArticle = $new['news']->findAll('');
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
|
||||
switch($ts){
|
||||
|
||||
/**
|
||||
* 二级分类
|
||||
*/
|
||||
case "twocate":
|
||||
|
||||
$referid = tsIntval($_GET['referid']);
|
||||
|
||||
$arrCate = $new['article']->findAll('article_cate',array(
|
||||
'referid'=>$referid,
|
||||
));
|
||||
|
||||
echo '<select name="cateid2" class="form-control">';
|
||||
echo '<option value="0">选择二级分类</option>';
|
||||
foreach($arrCate as $key=>$item){
|
||||
echo '<option value="'.$item['cateid'].'">'.$item['catename'].'</option>';
|
||||
}
|
||||
echo '</select>';
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
|
||||
// api入口
|
||||
if (is_file ( 'app/' . $TS_URL['app'] . '/action/api/' . $TS_URL['api'] . '.php' )) {
|
||||
include_once 'app/' . $TS_URL['app'] . '/action/api/' . $TS_URL['api'] . '.php';
|
||||
} else {
|
||||
qiMsg ( 'sorry:no api!' );
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
echo '<pre>
|
||||
-----------------------------------------------
|
||||
article http api list
|
||||
URL:https://demo.thinksaas.cn
|
||||
-----------------------------------------------
|
||||
/**
|
||||
* 文章列表【api接口示例】
|
||||
* index.php?app=article&ac=api&api=list
|
||||
* get
|
||||
*
|
||||
* @cateid 分类ID
|
||||
* @page
|
||||
* @limit
|
||||
*
|
||||
*/
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
</pre>';
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
|
||||
/**
|
||||
* 文章列表【api接口示例】
|
||||
* index.php?app=article&ac=api&api=list
|
||||
* get
|
||||
*
|
||||
* @cateid 分类ID
|
||||
* @page
|
||||
* @limit
|
||||
*
|
||||
*/
|
||||
|
||||
$arrCate1 = $new['article']->findAll('article_cate',array(
|
||||
'referid'=>0,
|
||||
));
|
||||
foreach($arrCate1 as $key=>$item){
|
||||
$arrCate[$item['cateid']] = $item['catename'];
|
||||
}
|
||||
|
||||
$cateid = tsIntval($_GET['cateid']);
|
||||
$locationid = tsIntval($_GET['locationid']);
|
||||
|
||||
$kw = tsTrim($_GET['kw']);
|
||||
|
||||
$page = tsIntval($_GET['page'],1);
|
||||
$limit = isset($_GET['limit']) ? $_GET['limit'] : '10';
|
||||
|
||||
$lstart = $limit*$page-$limit;
|
||||
|
||||
$where = "`isaudit`='0'";
|
||||
|
||||
if($cateid){
|
||||
$where .= " and `cateid`='$cateid'";
|
||||
}
|
||||
|
||||
$articleNum = $new['article']->findCount('article',$where);
|
||||
|
||||
$arrArticle = $new['article']->findAll('article',$where,'addtime desc','articleid,cateid,title,gaiyao,photo,path,count_comment,count_view,count_love,addtime',$lstart.','.$limit);
|
||||
|
||||
foreach($arrArticle as $key=>$item){
|
||||
|
||||
$arrArticle[$key]['title'] = tsTitle($item['title']);
|
||||
$arrArticle[$key]['gaiyao'] = tsTitle($item['gaiyao']);
|
||||
|
||||
if($item['photo']){
|
||||
$arrArticle[$key]['photourl'] = tsXimg($item['photo'],'article',320,180,$item['path'],'1');
|
||||
}else{
|
||||
$arrArticle[$key]['photourl'] = '';
|
||||
}
|
||||
|
||||
if($item['cateid']){
|
||||
$arrArticle[$key]['catename'] = $arrCate[$item['cateid']];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$jsonData = json_encode(array(
|
||||
|
||||
'status'=> 1,
|
||||
'msg'=> 'success',
|
||||
'data'=> array(
|
||||
|
||||
'previous'=>tsIntval($page-1),
|
||||
'page'=>tsIntval($page),
|
||||
'next'=>tsIntval($page+1),
|
||||
'total'=>tsIntval(ceil($articleNum/$limit)),
|
||||
'list'=>$arrArticle,
|
||||
|
||||
),
|
||||
|
||||
));
|
||||
|
||||
if($_GET['callback']){
|
||||
echo $_GET['callback'].'('.$jsonData.')';
|
||||
exit;
|
||||
}else{
|
||||
echo $jsonData;
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
|
||||
$cateid = tsIntval ( $_GET ['id'] );
|
||||
|
||||
if($cateid==0){
|
||||
ts404();
|
||||
}
|
||||
|
||||
//分类
|
||||
$strCate = $new ['article']->find ( 'article_cate', array (
|
||||
'cateid' => $cateid
|
||||
));
|
||||
|
||||
if($strCate==''){
|
||||
ts404();
|
||||
}
|
||||
|
||||
if($strCate['referid']==0){
|
||||
$arrTwoCate = $new['article']->findAll('article_cate',array(
|
||||
'referid'=>$strCate['cateid'],
|
||||
),'orderid asc');
|
||||
|
||||
if($arrTwoCate){
|
||||
|
||||
foreach($arrTwoCate as $key=>$item){
|
||||
$arrCateId[] = $item['cateid'];
|
||||
}
|
||||
|
||||
$cateids = $cateid.','.arr2str($arrCateId);
|
||||
|
||||
$where = "`cateid` in ($cateids) and `isaudit`=0";
|
||||
|
||||
}else{
|
||||
|
||||
$where = array(
|
||||
'cateid'=>$cateid,
|
||||
'isaudit'=>0,
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
$arrTwoCate = $new['article']->findAll('article_cate',array(
|
||||
'referid'=>$strCate['referid'],
|
||||
),'orderid asc');
|
||||
|
||||
$where = array(
|
||||
'cateid'=>$cateid,
|
||||
'isaudit'=>0,
|
||||
);
|
||||
}
|
||||
|
||||
// 列表
|
||||
$page = tsIntval($_GET['page'],1);
|
||||
$url = tsUrl ( 'article', 'cate', array ('id' => $cateid, 'page' => ''));
|
||||
$lstart = $page * 10 - 10;
|
||||
|
||||
$arrArticle = $new ['article']->findAll ( 'article',$where, 'addtime desc', 'articleid,userid,cateid,title,gaiyao,score,path,photo,count_comment,count_love,count_view,addtime', $lstart . ',10' );
|
||||
|
||||
$articleNum = $new ['article']->findCount ( 'article',$where);
|
||||
|
||||
$pageUrl = pagination ( $articleNum, 10, $page, $url );
|
||||
|
||||
foreach ( $arrArticle as $key => $item ) {
|
||||
$arrArticle [$key]['title'] = tsTitle($item['title']);
|
||||
$arrArticle [$key]['gaiyao'] = tsTitle($item['gaiyao']);
|
||||
$arrArticle [$key] ['user'] = aac ( 'user' )->getSimpleUser ( $item ['userid'] );
|
||||
$arrArticle [$key] ['cate'] = array(
|
||||
'cateid'=>$strCate['cateid'],
|
||||
'catename'=>$strCate['catename'],
|
||||
);
|
||||
|
||||
|
||||
#封面图
|
||||
if($item['photo']){
|
||||
$arrArticle[$key]['photo_url'] = $new['article']->getArticlePhoto($item);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 推荐阅读
|
||||
$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 ( 'index' );
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
// 用户是否登录
|
||||
$userid = aac ( 'user' )->isLogin ();
|
||||
|
||||
switch ($ts) {
|
||||
|
||||
case "do" :
|
||||
|
||||
$articleid = intval ( $_POST ['articleid'] );
|
||||
$content = tsClean ( $_POST ['content'] );
|
||||
$content2 = emptyText( $_POST ['content'] );
|
||||
|
||||
if ($content2 == '') tsNotice ( "内容不能为空!" );
|
||||
|
||||
// 过滤内容开始
|
||||
aac ( 'system' )->antiWord ( $content );
|
||||
// 过滤内容结束
|
||||
|
||||
$new ['article']->create ( 'article_comment', array (
|
||||
'articleid' => $articleid,
|
||||
'userid' => $userid,
|
||||
'content' => $content,
|
||||
'addtime' => time ()
|
||||
)
|
||||
);
|
||||
|
||||
// 统计
|
||||
$count_comment = $new ['article']->findCount ( 'article_comment', array (
|
||||
'articleid' => $articleid
|
||||
) );
|
||||
|
||||
$new ['article']->update ( 'article', array (
|
||||
'articleid' => $articleid
|
||||
), array (
|
||||
'count_comment' => $count_comment
|
||||
) );
|
||||
|
||||
header ( "Location: " . tsUrl ( 'article', 'show', array (
|
||||
'id' => $articleid
|
||||
) ) );
|
||||
|
||||
break;
|
||||
|
||||
case "delete" :
|
||||
|
||||
$commentid = intval ( $_GET ['commentid'] );
|
||||
|
||||
$strComment = $new ['article']->find ( 'article_comment', array (
|
||||
'commentid' => $commentid
|
||||
) );
|
||||
|
||||
$strArticle = $new ['article']->find ( 'article', array (
|
||||
'articleid' => $strComment ['articleid']
|
||||
) );
|
||||
|
||||
if ($userid == $strArticle ['userid'] || $TS_USER ['isadmin'] == 1) {
|
||||
|
||||
$new ['article']->delete ( 'article_comment', array (
|
||||
'commentid' => $commentid
|
||||
));
|
||||
|
||||
//处理积分
|
||||
aac('user')->doScore($GLOBALS['TS_URL']['app'], $GLOBALS['TS_URL']['ac'], $GLOBALS['TS_URL']['ts'],$strComment['userid']);
|
||||
|
||||
tsNotice ( '删除成功' );
|
||||
} else {
|
||||
|
||||
tsNotice ( '非法操作' );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
|
||||
// 分类
|
||||
$arrCate = $new ['article']->findAll ( 'article_cate',array(
|
||||
'referid'=>0,
|
||||
),'orderid asc');
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
|
||||
$userid = aac ( 'user' )->isLogin ();
|
||||
|
||||
$articleid = tsIntval ( $_GET ['articleid'] );
|
||||
|
||||
$strArticle = $new ['article']->find ( 'article', array (
|
||||
'articleid' => $articleid
|
||||
) );
|
||||
|
||||
//普通用户不允许删除内容
|
||||
if($TS_SITE['isallowdelete'] && $TS_USER ['isadmin'] == 0) tsNotice('系统不允许用户删除内容,请联系管理员删除!');
|
||||
|
||||
if ($strArticle ['userid'] == $userid || $TS_USER ['isadmin'] == 1) {
|
||||
|
||||
|
||||
#用户记录
|
||||
aac('pubs')->addLogs('article','articleid',$articleid,$userid,$strArticle['title'],$strArticle['content'],2);
|
||||
|
||||
|
||||
#删除文章
|
||||
$new['article']->deleteArticle($strArticle);
|
||||
|
||||
if($strArticle['isaudit']==0){
|
||||
#对积分进行处理
|
||||
aac('user') -> doScore($TS_URL['app'], $TS_URL['ac'],$TS_URL['mg'],$TS_URL['api'],$TS_URL['ts'],$strArticle ['userid']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tsNotice('删除成功','点击返回文章首页',tsUrl ( 'article' ));
|
||||
@@ -0,0 +1,174 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
|
||||
// 用户是否登录
|
||||
$userid = aac ( 'user' )->isLogin ();
|
||||
|
||||
//普通不用不允许编辑内容
|
||||
if($TS_SITE['isallowedit'] && $TS_USER ['isadmin'] == 0) tsNotice('系统不允许用户编辑内容,请联系管理员编辑!');
|
||||
|
||||
switch ($ts) {
|
||||
|
||||
case "" :
|
||||
|
||||
$articleid = tsIntval ( $_GET ['articleid'] );
|
||||
|
||||
$cateid = tsIntval ( $_GET ['cateid'] );
|
||||
|
||||
$strArticle = $new ['article']->find ( 'article', array (
|
||||
'articleid' => $articleid
|
||||
) );
|
||||
|
||||
if ($strArticle ['userid'] == $userid || $TS_USER ['isadmin'] == 1) {
|
||||
|
||||
$strArticle['title'] = tsTitle($strArticle['title']);
|
||||
|
||||
$articleContent = $new['article']->find('article_content',array(
|
||||
'articleid'=>$articleid,
|
||||
));
|
||||
|
||||
$strArticle['content'] = $articleContent['content'];
|
||||
|
||||
//$strArticle['content'] = tsDecode($strArticle['content']); //为有效防止xss攻击,如果前端通过textarea标签加载的编辑器,请注释掉本行;如果编辑器有其他的加载方式,请视情况解除本行注释。
|
||||
$strArticle['gaiyao'] = tsTitle($strArticle['gaiyao']);
|
||||
|
||||
#封面图
|
||||
$strArticle['photo_url'] = $new['article']->getArticlePhoto($strArticle);
|
||||
|
||||
// 找出TAG
|
||||
$arrTags = aac ( 'tag' )->getObjTagByObjid ( 'article', 'articleid', $articleid );
|
||||
foreach ( $arrTags as $key => $item ) {
|
||||
$arrTag [] = $item ['tagname'];
|
||||
}
|
||||
$strArticle ['tag'] = arr2str ( $arrTag );
|
||||
|
||||
foreach ($arrCate as $key=>$item){
|
||||
$arrCate[$key]['two'] = $new['article']->findAll('article_cate',array(
|
||||
'referid'=>$item['cateid'],
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
$title = '修改文章';
|
||||
include template ( 'edit' );
|
||||
} else {
|
||||
|
||||
tsNotice ( '非法操作!' );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "do" :
|
||||
|
||||
$articleid = tsIntval ( $_POST ['articleid'] );
|
||||
|
||||
$strArticle = $new ['article']->find ( 'article', array (
|
||||
'articleid' => $articleid
|
||||
) );
|
||||
|
||||
if($strArticle['userid']!=$userid && $TS_USER['isadmin']==0){
|
||||
tsNotice('非法操作!');
|
||||
}
|
||||
|
||||
$cateid = tsIntval ( $_POST ['cateid'] );
|
||||
$cateid2 = tsIntval ( $_POST ['cateid2'] );
|
||||
|
||||
if($cateid2) $cateid = $cateid2;
|
||||
|
||||
$title = trim ( $_POST ['title'] );
|
||||
$content = tsClean ( $_POST ['content'] );
|
||||
$content2 = emptyText ( $_POST ['content'] );
|
||||
$gaiyao = trim ( $_POST ['gaiyao'] );
|
||||
|
||||
$re_gaiyao = tsIntval ( $_POST ['re_gaiyao'] );
|
||||
|
||||
$score = tsIntval($_POST ['score']);#积分
|
||||
|
||||
if ($TS_USER ['isadmin'] == 0) {
|
||||
// 过滤内容开始
|
||||
$title = antiWord ( $title );
|
||||
$content = antiWord ( $content );
|
||||
// 过滤内容结束
|
||||
}
|
||||
|
||||
if ($title == '' || $content2 == '' || $content=='')
|
||||
qiMsg ( "标题和内容都不能为空!" );
|
||||
|
||||
if($score<0){
|
||||
tsNotice ( '积分填写有误!' );
|
||||
}
|
||||
|
||||
if($re_gaiyao==1){
|
||||
$gaiyao = cututf8(t(tsDecode($content)),0,100);
|
||||
}
|
||||
|
||||
$new ['article']->update ( 'article', array (
|
||||
'articleid' => $articleid,
|
||||
), array (
|
||||
'title' => $title,
|
||||
'gaiyao' => $gaiyao,
|
||||
'score'=>$score,
|
||||
));
|
||||
|
||||
$new['article']->replace('article_content',array(
|
||||
'articleid'=>$articleid,
|
||||
),array(
|
||||
'articleid'=>$articleid,
|
||||
'content'=>$content,
|
||||
));
|
||||
|
||||
#更新分类
|
||||
if($cateid){
|
||||
$new['article']->update('article',array(
|
||||
'articleid' => $articleid,
|
||||
),array(
|
||||
'cateid' => $cateid,
|
||||
));
|
||||
}
|
||||
|
||||
// 处理标签
|
||||
$tag = trim ( $_POST ['tag'] );
|
||||
if ($tag) {
|
||||
aac ( 'tag' )->delIndextag ( 'article', 'articleid', $articleid );
|
||||
aac ( 'tag' )->addTag ( 'article', 'articleid', $articleid, $tag );
|
||||
}
|
||||
|
||||
$pjson = '';
|
||||
if($strArticle['photo']){
|
||||
$pjson = json_encode(array(
|
||||
tsXimg($strArticle['photo'],'article',320,180,$strArticle['path'],1)
|
||||
));
|
||||
}
|
||||
|
||||
// 上传封面图片
|
||||
$arrUpload = tsUpload ( $_FILES ['photo'], $articleid, 'article', array ('jpg','gif','png','jpeg' ) );
|
||||
if ($arrUpload) {
|
||||
$new ['article']->update ( 'article', array (
|
||||
'articleid' => $articleid
|
||||
), array (
|
||||
'path' => $arrUpload ['path'],
|
||||
'photo' => $arrUpload ['url'],
|
||||
'uptime'=>time(),
|
||||
) );
|
||||
|
||||
#生成不同尺寸的图片
|
||||
tsDimg ($arrUpload ['url'], 'article', '320', '180', $arrUpload ['path']);
|
||||
|
||||
$pjson = json_encode(array(
|
||||
tsXimg($arrUpload['url'],'article',320,180,$arrUpload['path'],1)
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
#更新ptable
|
||||
aac('pubs')->editPtable('article','articleid',$articleid,$pjson,$title,$gaiyao);
|
||||
|
||||
|
||||
#用户记录
|
||||
aac('pubs')->addLogs('article','articleid',$articleid,$userid,$title,$content,1);
|
||||
|
||||
|
||||
header ("Location: " . tsUrl ( 'article', 'show', array ('id' => $articleid)));
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
|
||||
$cateid = 0;
|
||||
|
||||
// 列表
|
||||
$page = tsIntval($_GET['page'],1);
|
||||
$url = tsUrl ( 'article', 'index', array ('page' => '') );
|
||||
$lstart = $page * 10 - 10;
|
||||
|
||||
$arrArticle = $new ['article']->findAll ( 'article', array (
|
||||
'isaudit' => '0'
|
||||
), 'istop desc,addtime desc', 'articleid,userid,cateid,title,gaiyao,score,path,photo,count_comment,count_love,count_view,istop,addtime,uptime', $lstart . ',10' );
|
||||
|
||||
$articleNum = $new ['article']->findCount ( 'article', array (
|
||||
'isaudit' => '0'
|
||||
) );
|
||||
|
||||
$pageUrl = pagination ( $articleNum, 10, $page, $url );
|
||||
|
||||
foreach ( $arrArticle as $key => $item ) {
|
||||
$arrArticle [$key]['title'] = tsTitle($item['title']);
|
||||
$arrArticle [$key]['gaiyao'] = tsTitle($item['gaiyao']);
|
||||
$arrArticle [$key] ['user'] = aac ( 'user' )->getSimpleUser( $item ['userid'] );
|
||||
$arrArticle [$key] ['cate'] = $new ['article']->find( 'article_cate', array (
|
||||
'cateid' => $item ['cateid']
|
||||
) );
|
||||
|
||||
#封面图
|
||||
if($item['photo']){
|
||||
$arrArticle[$key]['photo_url'] = $new['article']->getArticlePhoto($item);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 推荐阅读
|
||||
$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' );
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
|
||||
// 我的入口
|
||||
if (is_file ( 'app/' . $TS_URL['app'] . '/action/my/' . $TS_URL['my'] . '.php' )) {
|
||||
$userid = aac('user')->isLogin();
|
||||
$strUser = aac('user')->getOneUser($userid);
|
||||
include_once 'app/' . $TS_URL['app'] . '/action/my/' . $TS_URL['my'] . '.php';
|
||||
} else {
|
||||
qiMsg ( 'sorry:no index!' );
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
$strUser = aac('user')->getOneUser($userid);
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
|
||||
|
||||
$page = tsIntval($_GET['page'],1);
|
||||
$url = tsUrl ( 'article', 'my', array ('my'=>'index','page' => '' ) );
|
||||
$lstart = $page * 20 - 20;
|
||||
|
||||
$arrArticle = $new ['article']->findAll ( 'article', array (
|
||||
'userid' => $strUser['userid'],
|
||||
), 'addtime desc', null, $lstart . ',20' );
|
||||
|
||||
$articleNum = $new ['article']->findCount ( 'article', array (
|
||||
'userid' => $strUser['userid'],
|
||||
) );
|
||||
|
||||
$pageUrl = pagination ( $articleNum, 20, $page, $url );
|
||||
|
||||
|
||||
|
||||
$title = '我的文章';
|
||||
include template('my/index');
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
|
||||
$userid = intval ( $TS_USER ['userid'] );
|
||||
|
||||
if ($userid == 0) {
|
||||
echo 0;
|
||||
exit ();
|
||||
}
|
||||
|
||||
$articleid = intval ( $_POST ['articleid'] );
|
||||
|
||||
$isRecommend = $new ['article']->findCount ( 'article_recommend', array (
|
||||
'articleid' => $articleid,
|
||||
'userid' => $userid
|
||||
) );
|
||||
|
||||
if ($isRecommend > 0) {
|
||||
echo 1;
|
||||
exit ();
|
||||
}
|
||||
|
||||
$new ['article']->create ( 'article_recommend', array (
|
||||
'articleid' => $articleid,
|
||||
'userid' => $userid
|
||||
) );
|
||||
|
||||
$count_recommend = $new ['article']->findCount ( 'article_recommend', array (
|
||||
'articleid' => $articleid
|
||||
) );
|
||||
|
||||
$new ['article']->update ( 'article', array (
|
||||
'articleid' => $articleid
|
||||
), array (
|
||||
'count_recommend' => $count_recommend
|
||||
) );
|
||||
|
||||
echo 2;
|
||||
exit ();
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2019/6/15
|
||||
* Time: 23:28
|
||||
*/
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
switch ($ts){
|
||||
|
||||
case "pay":
|
||||
|
||||
$userid = tsIntval($TS_USER['userid']);
|
||||
|
||||
if($userid==0){
|
||||
getJson('请登录后再支付!',1,0);
|
||||
}
|
||||
|
||||
$articleid = tsIntval($_POST['articleid']);
|
||||
|
||||
if($articleid==0){
|
||||
getJson('文章不存在!',1,0);
|
||||
}
|
||||
|
||||
$strArticle = $new['article']->find('article',array(
|
||||
'articleid'=>$articleid,
|
||||
),'articleid,userid,score');
|
||||
|
||||
if($strArticle==''){
|
||||
getJson('文章不存在!',1,0);
|
||||
}
|
||||
|
||||
if($strArticle['userid']==$userid){
|
||||
getJson('自己无需支付阅读自己的文章!',1,0);
|
||||
}
|
||||
|
||||
$isArticleUser = $new['article']->findCount('article_user',array(
|
||||
'articleid'=>$articleid,
|
||||
'userid'=>$userid,
|
||||
));
|
||||
|
||||
if($isArticleUser>0){
|
||||
getJson('你已经支付过,无需再次支付!',1,0);
|
||||
}
|
||||
|
||||
$strUserScore = $new['article']->find('user_info',array(
|
||||
'userid'=>$userid,
|
||||
),'userid,count_score');
|
||||
|
||||
if($strUserScore['count_score']<$strArticle['score']){
|
||||
getJson('积分不足!',1,0);
|
||||
}
|
||||
|
||||
aac('user')->addScore($strArticle['userid'],'文章收入'.$strArticle['articleid'],$strArticle['score'],1);
|
||||
aac('user')->delScore($userid,'查看文章'.$strArticle['articleid'],$strArticle['score']);
|
||||
|
||||
$new['article']->create('article_user',array(
|
||||
'articleid'=>$articleid,
|
||||
'userid'=>$userid,
|
||||
'addtime'=>time(),
|
||||
));
|
||||
|
||||
|
||||
getJson('积分支付成功!',1,2,tsUrl('article','show',array('id'=>$articleid)));
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
|
||||
$articleid = tsIntval($_GET ['id']);
|
||||
|
||||
$strArticle = $new ['article']->find ( 'article', array (
|
||||
'articleid' => $articleid
|
||||
));
|
||||
|
||||
if ($strArticle == '') {
|
||||
ts404();
|
||||
}
|
||||
|
||||
// 是否审核
|
||||
if ($strArticle ['isaudit'] == 1 && $TS_USER['isadmin']==0 && $TS_USER['userid']!=$strArticle['userid']) {
|
||||
tsNotice ( '内容审核中...' );
|
||||
}
|
||||
|
||||
$cateid = $strArticle['cateid'];
|
||||
|
||||
$strArticle['title'] = tsTitle($strArticle['title']);
|
||||
|
||||
$articleContent = $new['article']->find('article_content',array(
|
||||
'articleid'=>$articleid,
|
||||
));
|
||||
|
||||
$strArticle['content'] = tsDecode($articleContent['content']);
|
||||
|
||||
$strArticle ['tags'] = aac ( 'tag' )->getObjTagByObjid ( 'article', 'articleid', $articleid );
|
||||
$strArticle ['user'] = aac ( 'user' )->getSimpleUser ( $strArticle ['userid'] );
|
||||
$strArticle ['cate'] = $new ['article']->find ( 'article_cate', array (
|
||||
'cateid' => $strArticle ['cateid']
|
||||
) );
|
||||
|
||||
|
||||
// 上一篇
|
||||
$strUp = $new['article']->find('article', "`articleid`< '$articleid' and `isaudit`='0'", 'articleid,title','articleid desc');
|
||||
if($strUp) $strUp['title'] = tsTitle($strUp['title']);
|
||||
// 下一篇
|
||||
$strNext = $new['article']->find('article', "`articleid`> '$articleid' and `isaudit`='0'", 'articleid,title','articleid asc');
|
||||
if($strNext) $strNext['title'] = tsTitle($strNext['title']);
|
||||
|
||||
|
||||
|
||||
// 获取评论
|
||||
$page = tsIntval($_GET['page'],1);
|
||||
$url = tsUrl ('article','show', array ('id' => $articleid,'page'=>''));
|
||||
$lstart = $page * 15 - 15;
|
||||
$arrComment = aac('comment')->getCommentList('article','articleid',$strArticle['articleid'],$page,$lstart,$strArticle['userid']);
|
||||
$commentNum = aac('comment')->getCommentNum('article','articleid',$strArticle['articleid']);
|
||||
$pageUrl = pagination ( $commentNum, 15, $page, $url );
|
||||
|
||||
// 标签
|
||||
$strArticle ['tags'] = aac ( 'tag' )->getObjTagByObjid ( 'article', 'articleid', $strArticle ['articleid'] );
|
||||
|
||||
//最新文章
|
||||
$arrArticle = $new ['article']->findAll ( 'article', array(
|
||||
'isaudit'=>0,
|
||||
), 'addtime desc', 'articleid,title', 10 );
|
||||
|
||||
// 推荐阅读
|
||||
$arrRecommend = $new ['article']->getRecommendArticle ();
|
||||
|
||||
// 一周热门
|
||||
$arrHot7 = $new ['article']->getHotArticle ( 7);
|
||||
// 一月热门
|
||||
$arrHot30 = $new ['article']->getHotArticle ( 30);
|
||||
|
||||
|
||||
|
||||
//判断用户可阅读文章:0可读1不可读
|
||||
$isread = 0;
|
||||
if($strArticle['score']>0) $isread = 1;
|
||||
if($TS_USER['userid'] && $strArticle['userid']==$TS_USER['userid']) $isread=0;
|
||||
if($TS_USER['userid'] && $strArticle['userid']!=$TS_USER['userid'] && $strArticle['score']>0){
|
||||
$isArticleUser = $new['article']->findCount('article_user',array(
|
||||
'articleid'=>$articleid,
|
||||
'userid'=>$TS_USER['userid'],
|
||||
));
|
||||
if($isArticleUser>0) $isread=0;
|
||||
}
|
||||
if($TS_USER['isadmin']==1) $isread=0;
|
||||
|
||||
|
||||
|
||||
|
||||
//把标签作为关键词
|
||||
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' );
|
||||
|
||||
// 统计查看次数
|
||||
$count_view = $strArticle ['count_view'] + 1;
|
||||
$new ['article']->update ('article', array(
|
||||
'articleid' => $strArticle ['articleid']
|
||||
), array (
|
||||
'count_view' => $count_view,
|
||||
));
|
||||
|
||||
#更新ptable
|
||||
aac('pubs')->upPtableView('article','articleid',$articleid,$count_view);
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
|
||||
$name = urldecode(tsUrlCheck($_GET['id']));
|
||||
|
||||
$strTag = aac('tag')->getTagByName($name);
|
||||
|
||||
$strTag ['tagname'] = htmlspecialchars ( $strTag ['tagname'] );
|
||||
|
||||
$page = tsIntval($_GET['page'],1);
|
||||
|
||||
$url = tsUrl ( 'article', 'tag', array (
|
||||
'id' => urlencode ( $name ),
|
||||
'page' => ''
|
||||
) );
|
||||
|
||||
$lstart = $page * 30 - 30;
|
||||
|
||||
$tagid = $strTag['tagid'];
|
||||
|
||||
$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 && $strArticle['isaudit']==0) {
|
||||
$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' )->getSimpleUser ( $item ['userid'] );
|
||||
$arrArticle [$key] ['cate'] = $new ['article']->find ( 'article_cate', array (
|
||||
'cateid' => $item ['cateid']
|
||||
) );
|
||||
}
|
||||
|
||||
// 热门tag
|
||||
$arrTag = $new ['article']->findAll ( 'tag', "`count_article`>'0' and `isaudit`=0", 'count_article desc', null, 30 );
|
||||
|
||||
$sitekey = $strTag ['tagname'];
|
||||
$title = $strTag ['tagname'];
|
||||
|
||||
include template ( "tag" );
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
$page = tsIntval($_GET['page'],1);
|
||||
|
||||
$url = tsUrl ( 'article', 'tags', array (
|
||||
'page' => ''
|
||||
) );
|
||||
|
||||
$lstart = $page * 200 - 200;
|
||||
|
||||
$arrTag = $new ['article']->findAll ( 'tag', "`count_article`>'0' and `isaudit`=0", null, null, $lstart . ',200' );
|
||||
|
||||
$tagNum = $new ['article']->findCount ( 'tag', "`count_article`>'0' and `isaudit`=0" );
|
||||
|
||||
$pageUrl = pagination ( $tagNum, 200, $page, $url );
|
||||
|
||||
$title = '标签';
|
||||
include template ( 'tags' );
|
||||
@@ -0,0 +1,165 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
class article extends tsApp {
|
||||
|
||||
//构造函数
|
||||
public function __construct($db) {
|
||||
$tsAppDb = array();
|
||||
include 'app/article/config.php';
|
||||
//判断APP是否采用独立数据库
|
||||
if ($tsAppDb) {
|
||||
$db = new MySql($tsAppDb);
|
||||
}
|
||||
|
||||
parent::__construct($db);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文章封面图
|
||||
*
|
||||
* @param [type] $strArticle
|
||||
* @return void
|
||||
*/
|
||||
public function getArticlePhoto($strArticle){
|
||||
if($strArticle['photo']){
|
||||
$strFace = tsXimg($strArticle['photo'],'article',320,180,$strArticle['path'],1);
|
||||
|
||||
if($GLOBALS['TS_SITE']['file_upload_type']==1){
|
||||
$strFace .= '&v='.$strArticle['uptime'];
|
||||
}else{
|
||||
$strFace .= '?v='.$strArticle['uptime'];
|
||||
}
|
||||
|
||||
}else{
|
||||
$strFace = SITE_URL.'public/images/group.jpg';
|
||||
}
|
||||
return $strFace;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文章
|
||||
*
|
||||
* @param [type] $strArticle
|
||||
* @return void
|
||||
*/
|
||||
public function deleteArticle($strArticle){
|
||||
|
||||
#删除封面图
|
||||
if($strArticle['photo']){
|
||||
|
||||
if($GLOBALS['TS_SITE']['file_upload_type']==1){
|
||||
deleteAliOssFile('uploadfile/article/'.$strArticle['photo']);
|
||||
}else{
|
||||
unlink('uploadfile/article/'.$strArticle['photo']);
|
||||
tsDimg($strArticle['photo'],'article','320','180',$strArticle['path']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#删除ts_article
|
||||
$this->delete('article',array(
|
||||
'articleid' => $strArticle['articleid'],
|
||||
));
|
||||
|
||||
#删除ts_article_content
|
||||
$this->delete('article_content',array(
|
||||
'articleid' => $strArticle['articleid'],
|
||||
));
|
||||
|
||||
#删除ts_article_user
|
||||
$this->delete('article_user',array(
|
||||
'articleid' => $strArticle['articleid'],
|
||||
));
|
||||
|
||||
#删除关联标签
|
||||
$this->delete('tag_article_index',array(
|
||||
'articleid'=>$strArticle['articleid'],
|
||||
));
|
||||
|
||||
#删除评论ts_comment
|
||||
aac('comment')->delComment('article','articleid',$strArticle['articleid']);
|
||||
|
||||
#删除点赞ts_love
|
||||
aac('pubs')->delLove('article','articleid',$strArticle['articleid']);
|
||||
|
||||
#删除ptable
|
||||
aac('pubs')->delPtable('article','articleid',$strArticle['articleid']);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//热门文章,1天,7天,30天
|
||||
/**
|
||||
* @param $day
|
||||
* @param int $cateid
|
||||
* @return mixed
|
||||
*/
|
||||
public function getHotArticle($day, $cateid = 0) {
|
||||
$startTime = time() - ($day * 3600 * 24);
|
||||
$startTime = date('Y-m-d', $startTime);
|
||||
|
||||
$endTime = date('Y-m-d');
|
||||
|
||||
if ($day == 30) {
|
||||
$endTime = date('Y-m-d', time() - (7 * 3600 * 24));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
//推荐文章 $cateid
|
||||
/**
|
||||
* @param int $cateid
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRecommendArticle($cateid = 0) {
|
||||
|
||||
if ($cateid) {
|
||||
$arr = array(
|
||||
'cateid' => $cateid,
|
||||
'isrecommend' => 1,
|
||||
);
|
||||
} else {
|
||||
$arr = array(
|
||||
'isrecommend' => 1,
|
||||
);
|
||||
}
|
||||
|
||||
$arrArticle = $this->findAll('article', $arr, 'addtime desc', 'articleid,title', 10);
|
||||
foreach ($arrArticle as $key => $item) {
|
||||
$arrArticle[$key]['title'] = tsTitle($item['title']);
|
||||
}
|
||||
|
||||
return $arrArticle;
|
||||
}
|
||||
|
||||
/*
|
||||
* 是否文章作者
|
||||
*/
|
||||
public function isArticleUser($articleid,$userid){
|
||||
$isUser = $this->findCount('article',array(
|
||||
'articleid'=>$articleid,
|
||||
'userid'=>$userid,
|
||||
));
|
||||
|
||||
if($isUser){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
$skin = 'default';
|
||||
|
||||
$TS_APP['appname'] = '文章';
|
||||
|
||||
/*
|
||||
* APP独立数据库配置
|
||||
*/
|
||||
/*
|
||||
$tsAppDb['sql']='mysqli';
|
||||
$tsAppDb['host']='localhost';
|
||||
$tsAppDb['port']='3306';
|
||||
$tsAppDb['user']='thinksaas';
|
||||
$tsAppDb['pwd']='123456';
|
||||
$tsAppDb['name']='thinksaas';
|
||||
$tsAppDb['pre']='ts_';
|
||||
*/
|
||||
@@ -0,0 +1,237 @@
|
||||
{php include pubTemplate("header")}
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
//选择一级区域
|
||||
$('#cateid').change(function(){
|
||||
$("#select2").html('<img src="'+siteUrl+'public/images/loading.gif" />');
|
||||
var cateid = $(this).children('option:selected').val(); //弹出select的值
|
||||
|
||||
if(cateid==0){
|
||||
$("#select2").html('');
|
||||
|
||||
}else{
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "{SITE_URL}index.php?app=article&ac=ajax&ts=twocate&referid="+cateid,
|
||||
success: function(msg){
|
||||
$("#select2").html(msg);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{SITE_URL}">首页</a></li>
|
||||
<li class="breadcrumb-item"><a href="{tsUrl('article')}">文章</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">写文章</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-2"></div>
|
||||
<div class="col-md-8">
|
||||
|
||||
|
||||
<form method="POST" action="{SITE_URL}index.php?app=article&ac=add&ts=do" enctype="multipart/form-data">
|
||||
|
||||
<div class="form-group">
|
||||
<label>标题:</label>
|
||||
<input name="title" type="text" class="form-control" value="{if $strDraft['title']}{tsTitle($strDraft['title'])}{/if}">
|
||||
</div>
|
||||
{if $arrCate}
|
||||
<div class="form-group">
|
||||
<label>分类:</label>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-6 col-md-6">
|
||||
|
||||
<select id="cateid" name="cateid" class="form-control">
|
||||
<option value="0">选择一级分类</option>
|
||||
{loop $arrCate $key $item}
|
||||
<option value ="{$item['cateid']}">{$item['catename']}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
|
||||
</div>
|
||||
<div id="select2" class="col-6 col-md-6">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="form-group">
|
||||
<label>内容:</label>
|
||||
<div>
|
||||
<textarea id="tseditor" name="content">{if $strDraft['content']}{php echo tsDecode($strDraft['content'])}{/if}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label>内容概要:</label>
|
||||
<textarea class="form-control" name="gaiyao"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>标签:</label>
|
||||
<input name="tag" type="text" class="form-control">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>封面图片:</label>
|
||||
|
||||
<!--
|
||||
<div>
|
||||
<input type="file" name="photo" accept="image/jpeg,image/png"> <span class="fs12 c9">(支持jpg,png格式;大小640*400px)</span>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div class="custom-file" onchange="imgView()">
|
||||
<input id="img-file" type="file" name="photo" class="custom-file-input" accept="image/jpeg,image/png">
|
||||
<label class="custom-file-label c9" for="img-file" data-browse="封面图">(支持jpg,png格式;大小640*360px)</label>
|
||||
</div>
|
||||
|
||||
<div id="img-view" style="display: none;">
|
||||
<img src="" id="img-show" height="200">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label>查看需要:</label>
|
||||
<input type="text" name="score" value="0" onkeyup="NumberCheck(this)" /> 积分
|
||||
</div>
|
||||
|
||||
|
||||
<!--匿名发布-->
|
||||
{if $TS_SITE['isniming']==1}
|
||||
<div class="form-group">
|
||||
<label>匿名发布:</label>
|
||||
<input type="radio" name="isniming" value="0" checked> 否
|
||||
<input type="radio" name="isniming" value="1"> 是 <span class="text-danger">(匿名发布后用户将无法对内容进行管理)</span>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
<!--图片验证码-->
|
||||
{if $TS_SITE['isauthcode']}
|
||||
<div class="form-group">
|
||||
<label>验证码:</label>
|
||||
|
||||
<div class="offset-0">
|
||||
<input class="form-control form-control-sm w-auto float-left mr-1" name="authcode" />
|
||||
<img class="mt-1" src="{SITE_URL}index.php?app=pubs&ac=code" onclick="javascript:newgdcode(this,this.src);" title="点击刷新验证码" alt="点击刷新验证码" style="cursor:pointer;"/>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
<!--人机验证-->
|
||||
{if $TS_SITE['is_vaptcha']}
|
||||
<div class="form-group">
|
||||
<label>人机验证:</label>
|
||||
|
||||
<div class="offset-0">
|
||||
|
||||
<div id="vaptchaContainer" style="width: 300px;height: 36px;">
|
||||
<div class="vaptcha-init-main">
|
||||
<div class="vaptcha-init-loading">
|
||||
<a href="/" target="_blank">
|
||||
<img src="https://r.vaptcha.net/public/img/vaptcha-loading.gif" />
|
||||
</a>
|
||||
<span class="vaptcha-text">Vaptcha启动中...</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://v-cn.vaptcha.com/v3.js"></script>
|
||||
<script>
|
||||
vaptcha({
|
||||
vid: '{$TS_SITE[vaptcha_vid]}',
|
||||
mode: 'click',
|
||||
scene: 0, // 场景值 默认0
|
||||
container: '#vaptchaContainer',
|
||||
area: 'auto' //验证节点区域,默认 auto,可选值 auto,sea,na,cn
|
||||
}).then(function (vaptchaObj) {
|
||||
vaptchaObj.render()
|
||||
vaptchaObj.renderTokenInput('#vaptcha-token')
|
||||
})
|
||||
</script>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="vaptcha-token"></div>
|
||||
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
<input type="hidden" name="token" value="{$_SESSION['token']}" />
|
||||
<button class="btn btn-sm btn-info" type="submit">发布文章</button>
|
||||
|
||||
<a class="btn btn-sm btn-outline-secondary" href="{tsUrl('article')}">取消发布</a>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-md-2"></div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
{php doAction('tseditor')}
|
||||
|
||||
<script>
|
||||
//自动保存到草稿箱
|
||||
var int=self.setInterval('toDraft()',60000);//轮询执行,一分钟一次
|
||||
function toDraft() {
|
||||
$(document).ready(function() {
|
||||
var title = $('input[name="title"]').val();
|
||||
var content = $('textarea[name="content"]').val();
|
||||
$.post(siteUrl+'index.php?app=pubs&ac=draft',{'types':'article','title':title,'content':content},function (rs) {
|
||||
if(rs.status==1){
|
||||
tsAlert(rs.msg)
|
||||
}
|
||||
},'json')
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
{php include pubTemplate("footer")}
|
||||
@@ -0,0 +1,76 @@
|
||||
{php include pubTemplate("header_admin")}
|
||||
|
||||
<!--main-->
|
||||
<div class="midder">
|
||||
|
||||
{php include template("admin/menu");}
|
||||
|
||||
<div class="page">{$pageUrl}</div>
|
||||
|
||||
<table class="table table-hover">
|
||||
|
||||
|
||||
<thead class="thead-light fs14">
|
||||
<tr>
|
||||
<th>ID</th><th>用户ID</th>
|
||||
|
||||
<th>标题</th>
|
||||
<th>统计</th>
|
||||
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody class="fs12">
|
||||
|
||||
|
||||
|
||||
{loop $arrArticle $key $item}
|
||||
<tr><td>{$item['articleid']}</td><td>{$item['userid']}</td>
|
||||
|
||||
<td><a target="_blank" href="{tsUrl('article','show',array('id'=>$item['articleid']))}">{tsTitle($item['title'])}</a></td>
|
||||
|
||||
<td>浏览:{$item['count_view']}<br>
|
||||
评论:{$item['count_comment']}
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
|
||||
|
||||
|
||||
{if $item['isaudit']==0}
|
||||
<a class="btn btn-outline-secondary btn-sm" href="{SITE_URL}index.php?app=article&ac=admin&mg=article&ts=isaudit1&articleid={$item['articleid']}">取消审核</a>
|
||||
{/if}
|
||||
|
||||
{if $item['isaudit']==1}
|
||||
<a class="btn btn-outline-secondary btn-sm" href="{SITE_URL}index.php?app=article&ac=admin&mg=article&ts=isaudit0&articleid={$item['articleid']}"><font color="red">审核</font></a>
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
<a class="btn btn-outline-secondary btn-sm" href="{SITE_URL}index.php?app=article&ac=admin&mg=article&ts=istop&articleid={$item['articleid']}">
|
||||
{if $item['istop']==1}
|
||||
取消置顶
|
||||
{else}
|
||||
置顶
|
||||
{/if}
|
||||
</a>
|
||||
|
||||
|
||||
<a class="btn btn-outline-secondary btn-sm" href="{SITE_URL}index.php?app=article&ac=admin&mg=article&ts=isrecommend&articleid={$item['articleid']}">{if $item['isrecommend']==1}
|
||||
取消推荐
|
||||
{else}
|
||||
推荐
|
||||
{/if}</a>
|
||||
|
||||
<a class="btn btn-outline-secondary btn-sm" onclick="return confirm('确定删除?')" href="{SITE_URL}index.php?app=article&ac=admin&mg=article&ts=delete&articleid={$item['articleid']}">删除</a>
|
||||
</td></tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
{php include pubTemplate("footer_admin")}
|
||||
@@ -0,0 +1,28 @@
|
||||
{php include pubTemplate("header_admin")}
|
||||
<!--main-->
|
||||
<div class="midder">
|
||||
{php include template("admin/menu");}
|
||||
|
||||
<form method="POST" action="{SITE_URL}index.php?app=article&ac=admin&mg=cate&ts=add_do">
|
||||
<table class="table table-hover">
|
||||
<tr><td>分类名称:</td><td><input class=" form-control" name="catename" value="" /></td></tr>
|
||||
|
||||
<tr><td>分类介绍:</td><td>
|
||||
|
||||
<textarea class=" form-control" name="cateinfo"></textarea>
|
||||
|
||||
</td></tr>
|
||||
|
||||
<tr><td>排序ID:</td><td><input class=" form-control" name="orderid" value="0" /></td></tr>
|
||||
|
||||
<tr><td></td><td>
|
||||
|
||||
<input type="hidden" name="referid" value="{$referid}" />
|
||||
<input class="btn btn-primary" type="submit" value="添加分类" />
|
||||
</td></tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
{php include pubTemplate("footer_admin")}
|
||||
@@ -0,0 +1,27 @@
|
||||
{php include pubTemplate("header_admin")}
|
||||
<!--main-->
|
||||
<div class="midder">
|
||||
{php include template("admin/menu");}
|
||||
|
||||
<form method="POST" action="{SITE_URL}index.php?app=article&ac=admin&mg=cate&ts=edit_do">
|
||||
<table class="table table-hover">
|
||||
<tr><td>分类名称:</td><td><input class=" form-control" name="catename" value="{$strCate[catename]}" /></td></tr>
|
||||
|
||||
<tr><td>分类介绍:</td><td>
|
||||
|
||||
<textarea class=" form-control" name="cateinfo">{$strCate['cateinfo']}</textarea>
|
||||
|
||||
</td></tr>
|
||||
|
||||
<tr><td>排序ID:</td><td><input class=" form-control" name="orderid" value="{$strCate[orderid]}" /></td></tr>
|
||||
|
||||
<tr><td></td><td>
|
||||
<input type="hidden" name="cateid" value="{$strCate[cateid]}" />
|
||||
<input type="hidden" name="token" value="{$_SESSION['token']}" />
|
||||
<input class="btn btn-primary" type="submit" value="修改分类" />
|
||||
</td></tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
{php include pubTemplate("footer_admin")}
|
||||
@@ -0,0 +1,64 @@
|
||||
{php include pubTemplate("header_admin")}
|
||||
<!--main-->
|
||||
<div class="midder">
|
||||
|
||||
{php include template("admin/menu");}
|
||||
|
||||
<table class="table table-hover">
|
||||
|
||||
<thead class="thead-light fs14">
|
||||
<tr><th>分类ID</th><th>分类名字</th><th>排序<small>(排序数字越小越靠前)</small></th><th>操作</th></tr>
|
||||
</thead>
|
||||
|
||||
<tbody class="fs12">
|
||||
|
||||
{loop $arrCate $key $item}
|
||||
|
||||
<tr><td>{$item[cateid]}</td>
|
||||
|
||||
<td>I、{$item[catename]}</td>
|
||||
|
||||
<td>{$item[orderid]}</td>
|
||||
|
||||
<td>
|
||||
|
||||
<a class="btn btn-outline-secondary btn-sm" href="index.php?app=article&ac=admin&mg=cate&ts=add&referid={$item['cateid']}">添加二级分类</a>
|
||||
|
||||
<a class="btn btn-outline-secondary btn-sm" href="{SITE_URL}index.php?app=article&ac=admin&mg=cate&ts=edit&cateid={$item[cateid]}">修改</a>
|
||||
<a class="btn btn-outline-secondary btn-sm" href="{SITE_URL}index.php?app=article&ac=admin&mg=cate&ts=del&cateid={$item['cateid']}" onclick="return confirm('删除会清空所有文章下的该分类,也会删除该分类下的二级分类及清空二级分类文章关联,确定删除吗?')">删除</a>
|
||||
|
||||
</td></tr>
|
||||
|
||||
|
||||
|
||||
{loop $item['twocate'] $tkey $titem}
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td>{$titem[cateid]}</td>
|
||||
|
||||
<td class="pl-5">II、{$titem[catename]}</td>
|
||||
|
||||
<td>{$titem[orderid]}</td>
|
||||
|
||||
<td>
|
||||
|
||||
<a class="btn btn-outline-secondary btn-sm" href="{SITE_URL}index.php?app=article&ac=admin&mg=cate&ts=edit&cateid={$titem[cateid]}">修改</a>
|
||||
<a class="btn btn-outline-secondary btn-sm" href="{SITE_URL}index.php?app=article&ac=admin&mg=cate&ts=del&cateid={$titem['cateid']}" onclick="return confirm('删除会清空所有文章下的该分类,也会删除该分类下的二级分类及清空二级分类文章关联,确定删除吗?')">删除</a>
|
||||
|
||||
</td></tr>
|
||||
|
||||
|
||||
{/loop}
|
||||
|
||||
|
||||
|
||||
{/loop}
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
{php include pubTemplate("footer_admin")}
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
<div class="tabnav">
|
||||
<h6>文章管理</h6>
|
||||
<ul>
|
||||
<li {if $mg=='options'}class="select"{/if}><a href="{SITE_URL}index.php?app=article&ac=admin&mg=options">文章配置</a></li>
|
||||
|
||||
<li {if $mg=='permissions'}class="select"{/if}><a href="{SITE_URL}index.php?app=article&ac=admin&mg=permissions">权限配置</a></li>
|
||||
|
||||
<li {if $mg=='cate' && $ts=='list'}class="select"{/if}><a href="{SITE_URL}index.php?app=article&ac=admin&mg=cate&ts=list">分类列表</a></li>
|
||||
|
||||
<li {if $mg=='cate' && $ts=='add'}class="select"{/if}><a href="{SITE_URL}index.php?app=article&ac=admin&mg=cate&ts=add">新建分类</a></li>
|
||||
|
||||
<li {if $mg=='article' && $ts=='list'}class="select"{/if}><a href="{SITE_URL}index.php?app=article&ac=admin&mg=article&ts=list">文章列表</a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<div style="height: 100px;"></div>
|
||||
@@ -0,0 +1,29 @@
|
||||
{php include pubTemplate("header_admin")}
|
||||
|
||||
<div class="midder">
|
||||
|
||||
{php include template("admin/menu");}
|
||||
|
||||
<form method="POST" action="index.php?app=article&ac=admin&mg=options&ts=do">
|
||||
<table class="table table-hover">
|
||||
<tr><td width="150">APP名称:</td><td><input style="width:300px;" name="option[appname]" value="{$strOption[appname]}" /></td></tr>
|
||||
|
||||
<tr><td>APP介绍:</td><td><textarea style="width:300px;" name="option[appdesc]">{$strOption[appdesc]}</textarea></td></tr>
|
||||
|
||||
<tr><td>APP关键词:</td><td><input style="width:300px;" name="option[appkey]" value="{$strOption[appkey]}" /></td></tr>
|
||||
|
||||
<tr><td>会员发布:</td><td><input type="radio" name="option[allowpost]" value="0" {if $strOption['allowpost']=='0'}checked{/if} />不允许 <input type="radio" name="option[allowpost]" value="1" {if $strOption['allowpost']=='1'}checked{/if} />允许</td></tr>
|
||||
|
||||
<tr><td>文章是否审核:</td><td><input type="radio" name="option[isaudit]" value="0" {if $strOption['isaudit']=='0'}checked{/if} />不审核 <input type="radio" name="option[isaudit]" value="1" {if $strOption['isaudit']=='1'}checked{/if} />审核</td></tr>
|
||||
|
||||
|
||||
<tr><td></td><td>
|
||||
|
||||
<input class="btn btn-primary" type="submit" value="提交修改" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
{php include pubTemplate("footer_admin")}
|
||||
@@ -0,0 +1,148 @@
|
||||
{php include pubTemplate("header_admin")}
|
||||
|
||||
<div class="midder">
|
||||
|
||||
{php include template("admin/menu");}
|
||||
|
||||
|
||||
|
||||
<div class="mb-3">
|
||||
{loop $arrUg $key $item}
|
||||
<a class="btn btn-sm {if $item['ugid']==$ugid}btn-secondary{else}btn-outline-secondary{/if}" href="{SITE_URL}index.php?app=article&ac=admin&mg=permissions&ugid={$item['ugid']}">{$item['ugname']}</a>
|
||||
{/loop}
|
||||
</div>
|
||||
|
||||
|
||||
<form method="POST" action="index.php?app=article&ac=admin&mg=permissions&ts=do">
|
||||
|
||||
|
||||
<h6 class="font-weight-bold fs14">前台权限</h6>
|
||||
|
||||
<table class="table table-hover">
|
||||
|
||||
<tr>
|
||||
<td width="150">查看文章:</td>
|
||||
<td>
|
||||
<select name="option[article_show]">
|
||||
<option value="1" {if $TS_APP['permissions'][$ugid]['article_show']==1}selected{/if}>允许</option>
|
||||
<option value="0" {if $TS_APP['permissions'][$ugid]['article_show']==0}selected{/if}>拒绝</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!--不允许游客发布、修改、删除-->
|
||||
{if $ugid==1 || $ugid==2 || $ugid==3}
|
||||
<tr>
|
||||
<td>发布文章:</td>
|
||||
<td>
|
||||
<select name="option[article_add]">
|
||||
<option value="1" {if $TS_APP['permissions'][$ugid]['article_add']==1}selected{/if}>允许</option>
|
||||
<option value="0" {if $TS_APP['permissions'][$ugid]['article_add']==0}selected{/if}>拒绝</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>修改文章:</td>
|
||||
<td>
|
||||
<select name="option[article_edit]">
|
||||
<option value="1" {if $TS_APP['permissions'][$ugid]['article_edit']==1}selected{/if}>允许</option>
|
||||
<option value="0" {if $TS_APP['permissions'][$ugid]['article_edit']==0}selected{/if}>拒绝</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>删除文章:</td>
|
||||
<td>
|
||||
<select name="option[article_delete]">
|
||||
<option value="1" {if $TS_APP['permissions'][$ugid]['article_delete']==1}selected{/if}>允许</option>
|
||||
<option value="0" {if $TS_APP['permissions'][$ugid]['article_delete']==0}selected{/if}>拒绝</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
<!--管理权限-->
|
||||
{if $ugid==1 || $ugid==2}
|
||||
<h6 class="font-weight-bold fs14">后台权限</h6>
|
||||
<table class="table table-hover">
|
||||
<tr>
|
||||
<td width="150">文章配置:</td>
|
||||
<td>
|
||||
<select name="option[article_admin_options]">
|
||||
<option value="1" {if $TS_APP['permissions'][$ugid]['article_admin_options']==1}selected{/if}>允许</option>
|
||||
<option value="0" {if $TS_APP['permissions'][$ugid]['article_admin_options']==0}selected{/if}>拒绝</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>权限配置:</td>
|
||||
<td>
|
||||
<select name="option[article_admin_permissions]">
|
||||
<option value="1" {if $TS_APP['permissions'][$ugid]['article_admin_permissions']==1}selected{/if}>允许</option>
|
||||
<option value="0" {if $TS_APP['permissions'][$ugid]['article_admin_permissions']==0}selected{/if}>拒绝</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>添加分类:</td>
|
||||
<td>
|
||||
<select name="option[article_admin_cate_add]">
|
||||
<option value="1" {if $TS_APP['permissions'][$ugid]['article_admin_cate_add']==1}selected{/if}>允许</option>
|
||||
<option value="0" {if $TS_APP['permissions'][$ugid]['article_admin_cate_add']==0}selected{/if}>拒绝</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>修改分类:</td>
|
||||
<td>
|
||||
<select name="option[article_admin_cate_edit]">
|
||||
<option value="1" {if $TS_APP['permissions'][$ugid]['article_admin_cate_edit']==1}selected{/if}>允许</option>
|
||||
<option value="0" {if $TS_APP['permissions'][$ugid]['article_admin_cate_edit']==0}selected{/if}>拒绝</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
<h6 class="font-weight-bold fs14">API权限</h6>
|
||||
|
||||
<table class="table table-hover">
|
||||
|
||||
<tr>
|
||||
<td width="150">查看文章:</td>
|
||||
<td>
|
||||
<select name="option[article_api_show]">
|
||||
<option value="1" {if $TS_APP['permissions'][$ugid]['article_api_show']==1}selected{/if}>允许</option>
|
||||
<option value="0" {if $TS_APP['permissions'][$ugid]['article_api_show']==0}selected{/if}>拒绝</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
<input type="hidden" name="ugid" value="{$ugid}">
|
||||
|
||||
<input class="btn btn-primary" type="submit" value="提交修改" />
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
{php include pubTemplate("footer_admin")}
|
||||
@@ -0,0 +1,52 @@
|
||||
{php include pubTemplate("header_admin")}
|
||||
|
||||
<!--main-->
|
||||
<div class="midder">
|
||||
|
||||
{php include template("admin/menu");}
|
||||
|
||||
<div class="page">{$pageUrl}</div>
|
||||
|
||||
<table class="table table-hover">
|
||||
|
||||
|
||||
<thead class="thead-light fs14">
|
||||
<tr>
|
||||
<th>ID</th><th>用户ID</th><th>标题</th> <th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody class="fs12">
|
||||
|
||||
|
||||
|
||||
{loop $arrArticle $key $item}
|
||||
<tr><td>{$item['articleid']}</td><td>{$item['userid']}</td><td><a target="_blank" href="{tsUrl('article','show',array('id'=>$item['articleid']))}">{tsTitle($item['title'])}</a></td><td>
|
||||
|
||||
|
||||
|
||||
|
||||
{if $item['isaudit']==0}
|
||||
<a class="btn btn-outline-secondary btn-sm" href="{SITE_URL}index.php?app=article&ac=admin&mg=post&ts=isaudit1&articleid={$item['articleid']}">取消审核</a>
|
||||
{/if}
|
||||
|
||||
{if $item['isaudit']==1}
|
||||
<a class="btn btn-outline-secondary btn-sm" href="{SITE_URL}index.php?app=article&ac=admin&mg=post&ts=isaudit0&articleid={$item['articleid']}"><font color="red">审核</font></a>
|
||||
{/if}
|
||||
|
||||
|
||||
<a class="btn btn-outline-secondary btn-sm" href="{SITE_URL}index.php?app=article&ac=admin&mg=post&ts=isrecommend&articleid={$item['articleid']}">{if $item['isrecommend']==1}
|
||||
取消推荐
|
||||
{else}
|
||||
推荐
|
||||
{/if}</a>
|
||||
|
||||
<a class="btn btn-outline-secondary btn-sm" onclick="return confirm('确定删除?')" href="{SITE_URL}index.php?app=article&ac=admin&mg=post&ts=delete&articleid={$item['articleid']}">删除</a>
|
||||
</td></tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
{php include pubTemplate("footer_admin")}
|
||||
@@ -0,0 +1,133 @@
|
||||
{php include pubTemplate("header")}
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{SITE_URL}">首页</a></li>
|
||||
<li class="breadcrumb-item"><a href="{tsUrl('article')}">{$TS_APP['appname']}</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{$strCate['catename']}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
|
||||
|
||||
<div class="col-md-8">
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">{$strCate['catename']}</div>
|
||||
<div class="card-body">
|
||||
|
||||
<div class="clist">
|
||||
<ul>
|
||||
{loop $arrArticle $key $item}
|
||||
<li>
|
||||
{if $item['photo']}
|
||||
<a href="{tsUrl('article','show',array('id'=>$item[articleid]))}">
|
||||
<img style="float:left;" src="{php echo tsXimg($item['photo'],'article',180,140,$item['path'],'1')}" />
|
||||
</a>
|
||||
{/if}
|
||||
|
||||
<div class="title"><a href="{tsUrl('article','show',array('id'=>$item[articleid]))}">{$item[title]}</a></div>
|
||||
|
||||
<div class="info fs12"><a href="{tsUrl('user','space',array('id'=>$item[user][userid]))}">{$item[user][username]}</a> 发表于 {$item[addtime]}</div>
|
||||
|
||||
<div class="content">{if $item['gaiyao']}{tsTitle($item['gaiyao'])}{else}暂无概要{/if} (<a href="{tsUrl('article','show',array('id'=>$item[articleid]))}">查看全文</a>)</div>
|
||||
|
||||
<div class="cate tar fs12">{$item['count_view']}阅读 | {$item['count_comment']}评论</div>
|
||||
<div class="clear"></div>
|
||||
</li>
|
||||
{/loop}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="mt-4">{$pageUrl}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-md-4">
|
||||
|
||||
|
||||
<div class="mb-3">
|
||||
<a class="btn btn-info btn-block btn-lg" href="{tsUrl('article','add')}">写文章</a>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">分类</div>
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
{loop $arrCate $key $item}
|
||||
<a class="btn {if $item['cateid']==$cateid}btn-outline-primary{else}btn-link{/if}" href="{tsUrl('article','cate',array('id'=>$item['cateid']))}">{$item['catename']}</a>
|
||||
{/loop}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">推荐阅读</div>
|
||||
<div class="card-body">
|
||||
<div class="commlist">
|
||||
<ul>
|
||||
{loop $arrRecommend $key $item}
|
||||
<li><a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">{$item['title']}</a></li>
|
||||
{/loop}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">一周热门</div>
|
||||
<div class="card-body">
|
||||
<div class="commlist">
|
||||
<ul>
|
||||
{loop $arrHot7 $key $item}
|
||||
<li><a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">{$item['title']}</a></li>
|
||||
{/loop}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">一月热门</div>
|
||||
<div class="card-body">
|
||||
<div class="commlist">
|
||||
<ul>
|
||||
{loop $arrHot30 $key $item}
|
||||
<li><a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">{$item['title']}</a></li>
|
||||
{/loop}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!--广告位-->
|
||||
{php doAction('gobad','300')}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{php include pubTemplate("footer")}
|
||||
@@ -0,0 +1,163 @@
|
||||
{php include pubTemplate("header")}
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
//选择一级区域
|
||||
$('#cateid').change(function(){
|
||||
$("#select2").html('<img src="'+siteUrl+'public/images/loading.gif" />');
|
||||
var cateid = $(this).children('option:selected').val(); //弹出select的值
|
||||
|
||||
if(cateid==0){
|
||||
$("#select2").html('');
|
||||
|
||||
}else{
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "{SITE_URL}index.php?app=article&ac=ajax&ts=twocate&referid="+cateid,
|
||||
success: function(msg){
|
||||
$("#select2").html(msg);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{SITE_URL}">首页</a></li>
|
||||
<li class="breadcrumb-item"><a href="{tsUrl('article')}">{$TS_APP['appname']}</a></li>
|
||||
<li class="breadcrumb-item"><a href="{tsUrl('article','show',array('id'=>$strArticle['articleid']))}">{$strArticle['title']}</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">修改文章</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-2"></div>
|
||||
<div class="col-md-8">
|
||||
|
||||
|
||||
<form method="POST" action="{SITE_URL}index.php?app=article&ac=edit&ts=do" enctype="multipart/form-data">
|
||||
|
||||
<div class="form-group">
|
||||
<label>标题:</label>
|
||||
<input name="title" type="text" class="form-control" value="{$strArticle['title']}">
|
||||
</div>
|
||||
{if $arrCate}
|
||||
<div class="form-group">
|
||||
<label>分类:<small>(如不修改无须选择)</small></label>
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-6 col-md-6">
|
||||
|
||||
<select id="cateid" name="cateid" class="form-control">
|
||||
<option value="0">选择一级分类</option>
|
||||
{loop $arrCate $key $item}
|
||||
<option value ="{$item['cateid']}">{$item['catename']}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
|
||||
</div>
|
||||
<div id="select2" class="col-6 col-md-6">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="form-group">
|
||||
<label>内容:</label>
|
||||
|
||||
<div>
|
||||
<textarea id="tseditor" name="content">{$strArticle['content']}</textarea>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label>内容概要:</label>
|
||||
<textarea class="form-control" name="gaiyao">{$strArticle['gaiyao']}</textarea>
|
||||
<div class="c9 pt-1">
|
||||
<input type="checkbox" name="re_gaiyao" value="1" checked> 重新生成内容概要
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>标签:</label>
|
||||
<input name="tag" type="text" class="form-control" value="{$strArticle['tag']}">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>封面图片:</label>
|
||||
|
||||
{if $strArticle['photo']}
|
||||
<p>
|
||||
<img width="200" src="{$strArticle['photo_url']}" />
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
<div class="custom-file" onchange="imgView()">
|
||||
<input id="img-file" type="file" name="photo" class="custom-file-input" accept="image/jpeg,image/png">
|
||||
<label class="custom-file-label c9" for="img-file" data-browse="封面图">(支持jpg,png格式;大小640*360px)</label>
|
||||
</div>
|
||||
|
||||
<div id="img-view" style="display: none;">
|
||||
<img src="" id="img-show" height="200">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label>查看需要</label>
|
||||
<input type="text" name="score" value="{$strArticle['score']}" onkeyup="NumberCheck(this)" /> 积分
|
||||
</div>
|
||||
|
||||
|
||||
<input type="hidden" name="token" value="{$_SESSION['token']}" />
|
||||
<input type="hidden" name="articleid" value="{$strArticle['articleid']}" />
|
||||
<button class="btn btn-sm btn-info" type="submit">修改文章</button>
|
||||
|
||||
<a class="btn btn-outline-secondary btn-sm" href="{tsUrl('article','show',array('id'=>$strArticle['articleid']))}">返回文章</a>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-md-2"></div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
{php doAction('tseditor')}
|
||||
{php include pubTemplate("footer")}
|
||||
@@ -0,0 +1,237 @@
|
||||
{php include pubTemplate("header")}
|
||||
<div class="container">
|
||||
|
||||
|
||||
<nav aria-label="breadcrumb" class="position-relative">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{SITE_URL}">首页</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{$TS_APP['appname']}</li>
|
||||
</ol>
|
||||
|
||||
<a class="btn btn-sm btn-info position-absolute" style="z-index: 100;top:6px;right:6px;" href="{tsUrl('article','add')}">发布文章</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="mb-3">
|
||||
<a class="btn btn-sm {if $cateid=='0'}btn-outline-secondary{else}text-secondary{/if}" href="{tsUrl('article')}">全部</a>
|
||||
{loop $arrCate $key $item}
|
||||
<a class="btn btn-sm {if $cateid==$item['cateid']}btn-outline-secondary{else}text-secondary{/if}" href="{tsUrl('article','cate',array('id'=>$item['cateid']))}">{$item['catename']}</a>
|
||||
{/loop}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
|
||||
|
||||
<div class="col-md-8">
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h1 class="h5 font-weight-bold text-info">
|
||||
{if $strCate}
|
||||
{$strCate['catename']}
|
||||
{else}
|
||||
{$TS_APP['appname']}
|
||||
{/if}
|
||||
</h1>
|
||||
|
||||
{if $strCate && $strCate['cateinfo']}
|
||||
<div class="c9">
|
||||
{tsTitle($strCate['cateinfo'])}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
{if $ac=='index'}
|
||||
<div class="c9">
|
||||
{$TS_APP['appdesc']}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
{loop $arrArticle $key $item}
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
{if $item['photo']}
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4">
|
||||
<a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">
|
||||
<img class="mw-100" src="{$item['photo_url']}" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
|
||||
<div class="h5 font-weight-bold">
|
||||
<a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">{$item['title']}</a>
|
||||
{if $item['istop']=='1'}
|
||||
<img src="{SITE_URL}public/images/ding.png" width="24" height="24" title="[置顶]" alt="[置顶]" />
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="fs12 text-black-50"><a class="text-black-50" href="{tsUrl('user','space',array('id'=>$item['user']['userid']))}">{$item['user']['username']}</a> 发表于 {$item['addtime']}</div>
|
||||
|
||||
<div class="text-black-50 mt-1">{if $item['gaiyao']}{tsTitle($item['gaiyao'])}{else}暂无概要{/if} (<a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">查看全文</a>)</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="of c9 mt-3 fs12">
|
||||
|
||||
<div class="float-left">
|
||||
分类:<a href="{tsUrl('article','cate',array('id'=>$item['cate']['cateid']))}">{$item['cate']['catename']}</a>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
|
||||
<i class="bi bi-eye"></i> {$item['count_view']}
|
||||
|
||||
<i class="bi bi-chat-text ml-3"></i> {$item['count_comment']}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{else}
|
||||
|
||||
<div class="h5 font-weight-bold">
|
||||
<a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">{$item['title']}</a>
|
||||
{if $item['istop']=='1'}
|
||||
<img src="{SITE_URL}public/images/ding.png" width="24" height="24" title="[置顶]" alt="[置顶]" />
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="fs12 text-black-50"><a class="text-black-50" href="{tsUrl('user','space',array('id'=>$item['user']['userid']))}">{$item['user']['username']}</a> 发表于 {$item['addtime']}</div>
|
||||
|
||||
{if $item['score']==0}
|
||||
<div class="text-black-50 mt-1">{if $item['gaiyao']}{$item['gaiyao']}{else}暂无概要{/if} (<a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">查看全文</a>)</div>
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="of c9 mt-3 fs12">
|
||||
|
||||
<div class="float-left">
|
||||
分类:<a href="{tsUrl('article','cate',array('id'=>$item['cate']['cateid']))}">{$item['cate']['catename']}</a>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
|
||||
<i class="bi bi-eye"></i> {$item['count_view']}
|
||||
<i class="bi bi-chat-text ml-3"></i> {$item['count_comment']}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/loop}
|
||||
|
||||
|
||||
<div class="mt-4">{$pageUrl}</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-md-4">
|
||||
|
||||
|
||||
{if $arrTwoCate}
|
||||
<div class="card">
|
||||
<div class="card-header">二级分类</div>
|
||||
<div class="card-body">
|
||||
{loop $arrTwoCate $key $item}
|
||||
<a class="btn btn-sm {if $cateid==$item['cateid']}btn-outline-secondary{/if}" href="{tsUrl('article','cate',array('id'=>$item['cateid']))}">{$item['catename']}</a>
|
||||
{/loop}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">推荐阅读</div>
|
||||
<div class="card-body">
|
||||
<div class="commlist">
|
||||
<ul>
|
||||
{loop $arrRecommend $key $item}
|
||||
<li><a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">{$item['title']}</a></li>
|
||||
{/loop}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">一周热门</div>
|
||||
<div class="card-body">
|
||||
<div class="commlist">
|
||||
<ul>
|
||||
{loop $arrHot7 $key $item}
|
||||
<li><a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">{$item['title']}</a></li>
|
||||
{/loop}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">一月热门</div>
|
||||
<div class="card-body">
|
||||
<div class="commlist">
|
||||
<ul>
|
||||
{loop $arrHot30 $key $item}
|
||||
<li><a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">{$item['title']}</a></li>
|
||||
{/loop}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!--广告位-->
|
||||
{php doAction('gobad','300')}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{php include pubTemplate("footer")}
|
||||
@@ -0,0 +1,9 @@
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li role="presentation" {if $ac=='index'}class="active"{/if}><a href="{tsUrl('article')}">最新文章</a></li>
|
||||
{loop $arrCate $key $item}
|
||||
<li role="presentation" {if $ac=='cate' && $cateid==$item['cateid']}class="active"{/if}>
|
||||
<a href="{tsUrl('article','cate',array('id'=>$item['cateid']))}">{$item['catename']}</a>
|
||||
</li>{/loop}
|
||||
<li role="presentation" {if $ac=='tags'}class="active"{/if}><a href="{tsUrl('article','tags')}">标签</a></li>
|
||||
<li role="presentation" {if $ac=='add'}class="active"{/if}><a href="{tsUrl('article','add')}">写文章</a></li>
|
||||
</ul>
|
||||
@@ -0,0 +1,73 @@
|
||||
{php include pubTemplate("header")}
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="my_left">
|
||||
|
||||
{php include pubTemplate("my")}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-md-9">
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">我的文章</div>
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
<div class="of c9">
|
||||
|
||||
已发布{$articleNum}篇文章
|
||||
|
||||
<a target="_blank" class="btn btn-sm btn-info float-right" href="{tsUrl('article','add')}">发布文章</a>
|
||||
</div>
|
||||
|
||||
|
||||
<table class="table mt-3">
|
||||
<thead class="thead-light">
|
||||
<tr><th>标题</th><th>时间</th><th>操作</th></tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop $arrArticle $key $item}
|
||||
<tr><td>
|
||||
|
||||
<a target="_blank" href="{tsUrl('article','show',array('id'=>$item['articleid']))}">{tsTitle($item['title'])}</a></td><td class="text-black-50 fs12">{$item['addtime']}</td><td>
|
||||
|
||||
<a class="fs12 text-black-50" href="{SITE_URL}index.php?app=article&ac=edit&articleid={$item[articleid]}">修改</a> |
|
||||
|
||||
<a class="fs12 text-black-50" href="{SITE_URL}index.php?app=article&ac=delete&articleid={$item['articleid']}&token={$_SESSION['token']}">删除</a>
|
||||
|
||||
</td></tr>
|
||||
{/loop}
|
||||
<tbody>
|
||||
</table>
|
||||
|
||||
<div class="clear"></div>
|
||||
<div class="page">{$pageUrl}</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{php include pubTemplate("footer")}
|
||||
@@ -0,0 +1,253 @@
|
||||
{php include pubTemplate("header")}
|
||||
<div class="container">
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{SITE_URL}">首页</a></li>
|
||||
<li class="breadcrumb-item"><a href="{tsUrl('article')}">{$TS_APP['appname']}</a></li>
|
||||
{if $strArticle['cate']}
|
||||
<li class="breadcrumb-item">{if $strArticle['cate']}<a href="{tsUrl('article','cate',array('id'=>$strArticle['cate']['cateid']))}">{$strArticle['cate']['catename']}</a>{/if}</li>
|
||||
{/if}
|
||||
<li class="breadcrumb-item active" aria-current="page">{$strArticle[title]}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<div class="mb-3">
|
||||
<a class="btn btn-sm {if $cateid=='0'}btn-outline-secondary{else}text-secondary{/if}" href="{tsUrl('article')}">全部</a>
|
||||
{loop $arrCate $key $item}
|
||||
<a class="btn btn-sm {if $cateid==$item['cateid']}btn-outline-secondary{else}text-secondary{/if}" href="{tsUrl('article','cate',array('id'=>$item['cateid']))}">{$item['catename']}</a>
|
||||
{/loop}
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-8">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<h1 class="h5 pb-3 font-weight-bold">{$strArticle[title]}</h1>
|
||||
|
||||
<div class="media mt-3 mb-3">
|
||||
|
||||
<a class="mr-3" href="{tsUrl('user','space',array('id'=>$strArticle['user']['userid']))}"><img class="media-object rounded-circle" title="{$strArticle['user']['username']}" alt="{$strArticle['user']['username']}" src="{$strArticle['user']['face']}" width="36" height="36"></a>
|
||||
|
||||
|
||||
<div class="media-body">
|
||||
<div><a href="{tsUrl('user','space',array('id'=>$strArticle['userid']))}">{$strArticle['user']['username']}</a></div>
|
||||
<div class="c9 fs12">发表于 {$strArticle['addtime']}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if $strArticle['tags']}
|
||||
<div class="mb-3 mt-3">
|
||||
{loop $strArticle['tags'] $key $item}
|
||||
<a class="badge badge-secondary fw300 mr-2" href="{tsUrl('article','tag',array('id'=>$item['tagname']))}">{$item['tagname']}</a>
|
||||
{/loop}
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
{/if}
|
||||
|
||||
|
||||
{if $isread==1}
|
||||
<div class="alert alert-info">查看文章需要支付 <span class="text-danger">{$strArticle['score']}积分</span> <a class="btn btn-sm btn-success" href="javascript:void('0');" onclick="tsPost('index.php?app=article&ac=score&ts=pay',{'articleid':'{$articleid}'})">支付</a></div>
|
||||
{else}
|
||||
|
||||
<div class="article_show_content lh30 common-content">
|
||||
|
||||
{$strArticle[content]}
|
||||
|
||||
{$tpUrl}
|
||||
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
<!--文章内容底部插件钩子-->
|
||||
<div>{php doAction('article_show_footer')}</div>
|
||||
|
||||
|
||||
<div class="mt-3">{php doAction('gobad','468')}</div>
|
||||
|
||||
|
||||
<div class="of mt-3">
|
||||
|
||||
|
||||
<div class="float-left c9 fw300 pt-1">
|
||||
|
||||
<i class="bi bi-eye"></i> {$strArticle['count_view']}
|
||||
|
||||
<i class="bi bi-chat-text ml-3"></i> {$strArticle['count_comment']}
|
||||
|
||||
</div>
|
||||
|
||||
{if $TS_USER[isadmin]==1 || $TS_USER['userid']==$strArticle['userid']}
|
||||
<div class="float-right text-right">
|
||||
|
||||
<a class="btn btn-outline-secondary btn-sm" href="{SITE_URL}index.php?app=article&ac=edit&articleid={$strArticle['articleid']}"><i class="bi bi-pen"></i> 修改</a>
|
||||
<a onclick="return confirm('确定删除?')" class="btn btn-outline-secondary btn-sm" href="{SITE_URL}index.php?app=article&ac=delete&articleid={$strArticle['articleid']}&token={$_SESSION['token']}"><i class="bi bi-trash"></i> 删除</a>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
{if $strUp}
|
||||
<div class="fs13 text-secondary">上一篇:<a class="text-secondary" href="{tsUrl('article','show',array('id'=>$strUp['articleid']))}">{$strUp['title']}</a></div>
|
||||
{/if}
|
||||
{if $strNext}
|
||||
<div class="fs13 text-secondary">下一篇:<a class="text-secondary" href="{tsUrl('article','show',array('id'=>$strNext['articleid']))}">{$strNext['title']}</a></div>
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">评论{if $strArticle['count_comment']} <small class="text-secondary">({$strArticle['count_comment']})</small>{/if}</div>
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
|
||||
|
||||
<!--评论列表-->
|
||||
{php include pubTemplate("comment")}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="commentform">
|
||||
|
||||
{if tsIntval($TS_USER[userid])==0}
|
||||
<div class="tac pd20 fw300">
|
||||
<a href="{tsUrl('user','login')}">登录</a> | <a href="{tsUrl('user','register')}">注册</a>
|
||||
</div>
|
||||
{else}
|
||||
|
||||
<form id="comm-form" method="post" action="{SITE_URL}index.php?app=comment&ac=add">
|
||||
<div >
|
||||
<textarea id="tseditor" name="content"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
{if $TS_SITE['isauthcode']}
|
||||
<input class="form-control form-control-sm w-auto float-left" name="authcode" placeholder="输入验证码" />
|
||||
<img class="mt-1 ml-1" src="{tsUrl('pubs','code')}" onclick="javascript:newgdcode(this,this.src);" title="点击刷新验证码" alt="点击刷新验证码" style="cursor:pointer;"/>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div>是否公开:<input type="radio" name="ispublic" value="0" checked />公开 <input type="radio" name="ispublic" value="1" />不公开</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!--匿名发布-->
|
||||
{if $TS_SITE['isniming']==1}
|
||||
<div class="text-right">
|
||||
<span>匿名发布:</span>
|
||||
<input type="radio" name="isniming" value="0" checked> 否
|
||||
<input type="radio" name="isniming" value="1"> 是
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
<div class="text-right">
|
||||
<input type="hidden" name="ptable" value="article">
|
||||
<input type="hidden" name="pkey" value="articleid">
|
||||
<input type="hidden" name="pid" value="{$strArticle['articleid']}" />
|
||||
<input type="hidden" name="token" value="{$_SESSION['token']}" />
|
||||
<button class="btn btn-sm btn-info" type="submit">提交评论</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">最新文章</div>
|
||||
<div class="card-body">
|
||||
|
||||
<div class="commlist">
|
||||
<ul>
|
||||
{loop $arrArticle $key $item}
|
||||
<li><a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">{php echo tsTitle($item['title'])}</a></li>
|
||||
{/loop}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">推荐阅读</div>
|
||||
<div class="card-body">
|
||||
<div class="commlist">
|
||||
<ul>
|
||||
{loop $arrRecommend $key $item}
|
||||
<li><a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">{$item['title']}</a></li>
|
||||
{/loop}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">一周热门</div>
|
||||
<div class="card-body">
|
||||
<div class="commlist">
|
||||
<ul>
|
||||
{loop $arrHot7 $key $item}
|
||||
<li><a
|
||||
href="{tsUrl('article','show',array('id'=>$item['articleid']))}">{$item['title']}</a></li>
|
||||
{/loop}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">一月热门</div>
|
||||
<div class="card-body">
|
||||
<div class="commlist">
|
||||
<ul>
|
||||
{loop $arrHot30 $key $item}
|
||||
<li><a
|
||||
href="{tsUrl('article','show',array('id'=>$item['articleid']))}">{$item['title']}</a></li>
|
||||
{/loop}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!--广告位-->
|
||||
{php doAction('gobad','300')}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{php doAction('tseditor','mini')}
|
||||
{php include pubTemplate("footer")}
|
||||
@@ -0,0 +1,155 @@
|
||||
{php include pubTemplate("header")}
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{SITE_URL}">首页</a></li>
|
||||
<li class="breadcrumb-item"><a href="{tsUrl('article')}">{$TS_APP['appname']}</a></li>
|
||||
<li class="breadcrumb-item"><a href="{tsUrl('article','tags')}">标签</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{$strTag[tagname]}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<div class="row">
|
||||
|
||||
|
||||
<div class="col-md-8">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{loop $arrArticle $key $item}
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
{if $item['photo']}
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4">
|
||||
<a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">
|
||||
<img class="mw-100" src="{php echo tsXimg($item['photo'],'article',320,180,$item['path'],'1')}" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
|
||||
<div class="h5 fw400"><a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">{$item['title']}</a></div>
|
||||
|
||||
<div class="fs12 text-black-50"><a class="text-black-50" href="{tsUrl('user','space',array('id'=>$item[user][userid]))}">{$item['user']['username']}</a> 发表于 {$item['addtime']}</div>
|
||||
|
||||
<div class="text-black-50 mt-1">{if $item['gaiyao']}{tsTitle($item['gaiyao'])}{else}暂无概要{/if} (<a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">查看全文</a>)</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="of c9 mt-3 fs12">
|
||||
|
||||
<div class="float-left">
|
||||
分类:<a href="{tsUrl('article','cate',array('id'=>$item['cate']['cateid']))}">{$item['cate']['catename']}</a>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
|
||||
<i class="bi bi-eye"></i> {$item['count_view']}
|
||||
<i class="bi bi-chat-text ml-3"></i> {$item['count_comment']}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{else}
|
||||
|
||||
<div class="h5 fw400"><a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">{$item[title]}</a></div>
|
||||
|
||||
<div class="fs12 text-black-50"><a class="text-black-50" href="{tsUrl('user','space',array('id'=>$item['user']['userid']))}">{$item['user']['username']}</a> 发表于 {$item['addtime']}</div>
|
||||
|
||||
<div class="text-black-50 mt-1">{if $item['gaiyao']}{$item['gaiyao']}{else}暂无概要{/if} (<a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">查看全文</a>)</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="of c9 mt-3 fs12">
|
||||
|
||||
<div class="float-left">
|
||||
分类:<a href="{tsUrl('article','cate',array('id'=>$item['cate']['cateid']))}">{$item['cate']['catename']}</a>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
|
||||
<i class="bi bi-eye"></i> {$item['count_view']}
|
||||
<i class="bi bi-chat-text ml-3"></i> {$item['count_comment']}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{/loop}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page">{$pageUrl}</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">热门标签</div>
|
||||
<div class="card-body">
|
||||
<div>
|
||||
{loop $arrTag $key $item}
|
||||
<a class="badge badge-secondary mr-2 mb-2 fw300" href="{tsUrl('article','tag',array('id'=>urlencode($item['tagname'])))}">{$item['tagname']}</a>
|
||||
{/loop}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{php include pubTemplate("footer")}
|
||||
@@ -0,0 +1,34 @@
|
||||
{php include pubTemplate("header")}
|
||||
|
||||
<div class="container">
|
||||
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{SITE_URL}">首页</a></li>
|
||||
<li class="breadcrumb-item"><a href="{tsUrl('article')}">{$TS_APP['appname']}</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">标签</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<div>
|
||||
{loop $arrTag $key $item}
|
||||
<a class="badge badge-secondary mr-2 mb-2 fw300" href="{tsUrl('article','tag',array('id'=>urlencode($item[tagname])))}">{$item[tagname]}</a>
|
||||
{/loop}
|
||||
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div style="height:30px;"></div>
|
||||
<div class="page">{$pageUrl}</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{php include pubTemplate("footer")}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
@@ -0,0 +1,16 @@
|
||||
function recommend(articleid){
|
||||
$.post(siteUrl+'index.php?app=article&ac=recommend',{'articleid':articleid},function(rs){
|
||||
if(rs==0){
|
||||
|
||||
tsNotice('请登陆后再推荐');
|
||||
|
||||
}else if(rs == 1){
|
||||
|
||||
tsNotice('你已经推荐过');
|
||||
|
||||
}else if(rs == 2){
|
||||
|
||||
window.location.reload()
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
.catelist{}
|
||||
.catelist ul{}
|
||||
.catelist ul li{font-size:12px;height:30px;line-height:30px; width:140px;}
|
||||
.catelist .on{background:#999999;padding:5px 10px;color:#FFFFFF;}
|
||||
|
||||
.article_show_content{font-size:16px;line-height:30px;overflow: hidden;word-wrap: break-word;word-break: normal;}
|
||||
.article_show_content img{max-width: 100%;}
|
||||
|
||||
.article_show_content p{font-size:16px;}
|
||||
.article_show_content a{color:#49a5de}
|
||||
|
||||
|
||||
.article_video{
|
||||
background-color: #FFFFFF;
|
||||
border:dashed 2px #66afe9;
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
.article_video iframe{width: 100%;height:450px;}
|
||||
@media (max-width: 575.98px) {
|
||||
.article_video iframe{width: 100%;height:230px;}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
.catelist{}
|
||||
.catelist ul{}
|
||||
.catelist ul li{font-size:12px;height:30px;line-height:30px; width:140px;}
|
||||
.catelist .on{background:#999999;padding:5px 10px;color:#FFFFFF;}
|
||||
|
||||
.article_show_content{font-size:16px;line-height:30px;overflow: hidden;word-wrap: break-word;word-break: normal;}
|
||||
.article_show_content img{max-width: 100%;}
|
||||
|
||||
.article_show_content p{font-size:16px;}
|
||||
.article_show_content a{color:#49a5de}
|
||||
|
||||
|
||||
.article_video{
|
||||
background-color: #FFFFFF;
|
||||
border:dashed 2px #66afe9;
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
.article_video iframe{width: 100%;height:450px;}
|
||||
@media (max-width: 575.98px) {
|
||||
.article_video iframe{width: 100%;height:230px;}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
return array(
|
||||
|
||||
'name' => '附件',
|
||||
|
||||
'version' => '1.0',
|
||||
|
||||
'desc' => '附件',
|
||||
|
||||
'url' => 'https://lmve.net',
|
||||
|
||||
'email' => '1337087466@qq.com',
|
||||
|
||||
'author' => '无闻风',
|
||||
|
||||
'author_url' => 'https://lmve.net',
|
||||
|
||||
'isoption' => '1',
|
||||
|
||||
'isinstall' => '1',
|
||||
|
||||
'issql' => '0',
|
||||
|
||||
'issystem' => '1',
|
||||
|
||||
'isappnav' => '1',
|
||||
|
||||
'ismy'=>'1',
|
||||
|
||||
);
|
||||
@@ -0,0 +1,192 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
switch($ts){
|
||||
|
||||
//某一个attach
|
||||
case "":
|
||||
$albumid = isset($_GET['id']) ? intval($_GET['id']) : '0';
|
||||
|
||||
$strAlbum = $new['attach']->find('attach_album',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
//404
|
||||
if($albumid!=0)
|
||||
{
|
||||
|
||||
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('attach','album',array('id'=>$albumid,'page'=>''));
|
||||
|
||||
$lstart = $page*24-24;
|
||||
|
||||
$strUser = aac('user')->getSimpleUser($strAlbum['userid']);
|
||||
if($albumid!=0)
|
||||
{
|
||||
$arrattach = $new['attach']->findAll('attach',array(
|
||||
'albumid'=>$albumid,
|
||||
),'attachid desc',null,$lstart.',24');
|
||||
|
||||
$attachNum = $new['attach']->findCount('attach',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
}else
|
||||
{
|
||||
$userid = aac('user')->isLogin();
|
||||
$arrattach = $new['attach']->findAll('attach',array(
|
||||
'userid'=>$userid,
|
||||
'albumid'=>0,
|
||||
),'attachid desc',null,$lstart.',24');
|
||||
|
||||
$attachNum = $new['attach']->findCount('attach',array(
|
||||
'userid'=>$userid,
|
||||
));
|
||||
$strAlbum['albumname']="个人附件库";
|
||||
$strAlbum['userid']=$userid;
|
||||
|
||||
}
|
||||
|
||||
|
||||
foreach($arrattach as $key=>$item){
|
||||
$arrattach[$key]['attachdesc'] = tsTitle($item['attachdesc']);
|
||||
}
|
||||
|
||||
$pageUrl = pagination($attachNum, 24, $page, $url);
|
||||
|
||||
|
||||
$title = $strAlbum['albumname'];
|
||||
|
||||
|
||||
include template("album");
|
||||
|
||||
$new['attach']->update('attach_album',array(
|
||||
'albumid'=>$strAlbum['albumid'],
|
||||
),array(
|
||||
'count_view'=>$strAlbum['count_view']+1,
|
||||
));
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
//修改attach
|
||||
case "edit":
|
||||
|
||||
//用户是否登录
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
$albumid = intval($_GET['albumid']);
|
||||
|
||||
$strAlbum = $new['attach']->find('attach_album',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
if($strAlbum['userid'] == $userid || $TS_USER['isadmin']==1) {
|
||||
|
||||
$strAlbum['albumname'] = tsTitle($strAlbum['albumname']);
|
||||
$strAlbum['albumdesc'] = tsTitle($strAlbum['albumdesc']);
|
||||
|
||||
$title = '修改attach属性-'.$strAlbum['albumname'];
|
||||
include template("album_edit");
|
||||
|
||||
}else{
|
||||
|
||||
tsNotice('非法操作!');
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "editdo":
|
||||
|
||||
//用户是否登录
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
$albumid = intval($_POST['albumid']);
|
||||
|
||||
$strAlbum = $new['attach']->find('attach_album',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
if($strAlbum['userid']==$userid || $TS_USER['isadmin']==1){
|
||||
|
||||
$albumname = trim($_POST['albumname']);
|
||||
if($albumname == '') qiMsg("attach名称不能为空!");
|
||||
|
||||
$albumdesc = trim($_POST['albumdesc']);
|
||||
|
||||
|
||||
if($TS_USER['isadmin']==0){
|
||||
//过滤内容开始
|
||||
aac('system')->antiWord($albumname);
|
||||
aac('system')->antiWord($albumdesc);
|
||||
//过滤内容结束
|
||||
}
|
||||
|
||||
$new['attach']->update('attach_album',array(
|
||||
'userid'=>$strAlbum['userid'],
|
||||
'albumid'=>$strAlbum['albumid'],
|
||||
),array(
|
||||
'albumname'=>$albumname,
|
||||
'albumdesc'=>$albumdesc,
|
||||
));
|
||||
|
||||
header("Location: ".tsUrl('attach','album',array('id'=>$albumid)));
|
||||
}else{
|
||||
tsNotice('非法操作!');
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//删除attach
|
||||
case "del":
|
||||
|
||||
//用户是否登录
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
$albumid = intval($_GET['albumid']);
|
||||
|
||||
$strAlbum = $new['attach']->find('attach_album',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
if($strAlbum['userid'] == $userid || $TS_USER['isadmin'] == 1) {
|
||||
|
||||
$new['attach']->delete('attach_album',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
$new['attach']->delete('attach',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
header("Location: ".tsUrl('attach'));
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
//用户是否登录
|
||||
$userid = aac('user')->isLogin($js,$userkey);
|
||||
switch($ts){
|
||||
|
||||
case "do":
|
||||
|
||||
$authcode = strtolower($_POST['authcode']);
|
||||
|
||||
if ($TS_SITE ['isauthcode']) {
|
||||
if ($authcode != $_SESSION ['verify']) {
|
||||
getJson ( "验证码输入有误,请重新输入!" ,$js,0);
|
||||
}
|
||||
}
|
||||
|
||||
$attachid = intval($_POST['attachid']);
|
||||
$content = tsClean($_POST['content'],$js);
|
||||
$content2 = emptyText($_POST['content']);//测试空内容
|
||||
$ispublic = intval($_POST['ispublic']);
|
||||
|
||||
//过滤内容开始
|
||||
if($TS_USER['isadmin']==0){
|
||||
aac('system')->antiWord($content,$js);
|
||||
}
|
||||
//过滤内容结束
|
||||
|
||||
if($content2==''){
|
||||
getJson('没有任何内容是不允许你通过滴^_^',$js);
|
||||
}else{
|
||||
$commentid = $new['attach']->create('attach_comment',array(
|
||||
'attachid' => $attachid,
|
||||
'userid' => $userid,
|
||||
'content' => $content,
|
||||
'addtime'=> time(),
|
||||
));
|
||||
|
||||
|
||||
|
||||
//发送系统消息(通知楼主有人回复他的帖子啦)
|
||||
$strattach = $new['attach']->find('attach',array(
|
||||
'attachid'=>$attachid,
|
||||
));
|
||||
|
||||
if($strattach['userid'] != $TS_USER['userid']){
|
||||
|
||||
$msg_userid = '0';
|
||||
$msg_touserid = $strattach['userid'];
|
||||
$msg_content = '你的附件:《'.$strattach['attachname'].'》新增一条评论,快去看看给个回复吧^_^ ';
|
||||
$msg_tourl = tsUrl('attach','show',array('id'=>$attachid));
|
||||
aac('message')->sendmsg($msg_userid,$msg_touserid,$msg_content,$msg_tourl);
|
||||
|
||||
}
|
||||
|
||||
header("Location: ".tsUrl('attach','show',array('id'=>$attachid)));
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
//删除评论
|
||||
case "delete":
|
||||
|
||||
$commentid = intval($_GET['commentid']);
|
||||
|
||||
$strComment = $new['attach']->find('attach_comment',array(
|
||||
'commentid'=>$commentid,
|
||||
));
|
||||
|
||||
$strattach = $new['attach']->find('attach',array(
|
||||
'attachid'=>$strComment['attachid'],
|
||||
));
|
||||
|
||||
|
||||
|
||||
if($strattach['userid']==$userid || $TS_USER['isadmin']==1 || $strComment['userid']==$userid){
|
||||
|
||||
$new['attach']->delete('attach_comment',array(
|
||||
'commentid'=>$commentid,
|
||||
));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//跳转回到帖子页
|
||||
header("Location: ".tsUrl('attach','show',array('id'=>$strComment['attachid'])));
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
function download($dir,$name)
|
||||
{
|
||||
$arr=explode('.', $dir);
|
||||
$ext=end($arr); //end()返回数组的最后一个元素
|
||||
if($ext=='pdf')
|
||||
{
|
||||
$file = fopen($dir,"r"); // 打开文件
|
||||
// 输入文件标签
|
||||
Header("Content-type: application/pdf");
|
||||
Header("filename:" . $name);
|
||||
// 输出文件内容
|
||||
echo fread($file,filesize($dir));
|
||||
fclose($file);
|
||||
}else
|
||||
{
|
||||
$file = fopen($dir,"r"); // 打开文件
|
||||
// 输入文件标签
|
||||
Header("Content-type: application/octet-stream");
|
||||
Header("Accept-Ranges: bytes");
|
||||
Header("Accept-Length: ".filesize($dir));
|
||||
Header("Content-Disposition: attachment; filename=" . $name);
|
||||
// 输出文件内容
|
||||
echo fread($file,filesize($dir));
|
||||
fclose($file);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//***********************************************
|
||||
$userid = aac('user')->isLogin();
|
||||
if(aac('user')->isPublisher()==false) {tsNotice('你可能被限制或没有验证邮箱,检查邮箱是否认证。','->点击认证<-',tsUrl('user','verify'));}
|
||||
|
||||
$attachid=intval($_GET['id']);
|
||||
|
||||
$the_file=$new['attach']->find('attach',array(
|
||||
'attachid'=>$attachid,
|
||||
|
||||
));
|
||||
if($the_file) //检查数据表
|
||||
{
|
||||
$file_dir = "uploadfile/attach/".$the_file['attachurl'];
|
||||
if (!file_exists($file_dir)) { //检查文件是否存在
|
||||
echo "文件已删除";
|
||||
exit;
|
||||
}else{
|
||||
if($the_file['userid']==$userid)
|
||||
{
|
||||
$new['attach']->update('attach',array(
|
||||
'attachid'=>$attachid,
|
||||
),array(
|
||||
'count_view'=>$the_file['count_view']+1,
|
||||
));
|
||||
download($file_dir,$the_file['attachname']);
|
||||
exit;
|
||||
}else
|
||||
{
|
||||
if($the_file['pay']==0)//免费的
|
||||
{
|
||||
$new['attach']->update('attach',array(
|
||||
'attachid'=>$attachid,
|
||||
),array(
|
||||
'count_view'=>$the_file['count_view']+1,
|
||||
));
|
||||
download($file_dir,$the_file['attachname']);
|
||||
exit;
|
||||
|
||||
}else
|
||||
{
|
||||
if(aac('user')->delScore($userid,"download file:" . $the_file['attachname'],$the_file['pay']))
|
||||
{
|
||||
$new['attach']->update('attach',array(
|
||||
'attachid'=>$attachid,
|
||||
),array(
|
||||
'count_view'=>$the_file['count_view']+1,
|
||||
));
|
||||
download($file_dir,$the_file['attachname']);
|
||||
aac('user')->addScore($the_file['userid'],$userme['username']."download:" . $the_file['attachname'],$the_file['pay'],1);
|
||||
exit;
|
||||
}else
|
||||
{
|
||||
tsNotice('下载文件需要支付'.$the_file['pay'].'积分,你似乎不够!');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}else
|
||||
{
|
||||
echo "文件已删除";
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
$attachid = intval ( $_GET ['id'] );
|
||||
|
||||
$stredit = $new ['attach']->find ( 'attach', array ('attachid' => $attachid ) );
|
||||
$stredit['content'] = tsDecode($stredit['content']);
|
||||
if($stredit=='')
|
||||
{
|
||||
|
||||
tsNotice('NO!');
|
||||
}
|
||||
if($userid!=$stredit['userid'])
|
||||
{
|
||||
tsNotice('NO');
|
||||
|
||||
}
|
||||
include template ( "edit" );
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
$attachid = intval ( $_POST ['attachid'] );
|
||||
|
||||
$stredit = $new ['attach']->find ( 'attach', array ('attachid' => $attachid ) );
|
||||
|
||||
if($stredit=='')
|
||||
{
|
||||
|
||||
tsNotice('NO!');
|
||||
}
|
||||
if($userid!=$stredit['userid'])
|
||||
{
|
||||
tsNotice('NO');
|
||||
|
||||
}
|
||||
|
||||
|
||||
$attachname = trim($_POST['attachname']);
|
||||
|
||||
$pay=intval($_POST['pay']);
|
||||
|
||||
$new['attach'] -> update('attach', array('attachid' => $attachid), array(
|
||||
'attachname' => $attachname,
|
||||
'pay' => $pay,
|
||||
));
|
||||
header("Location: " . tsUrl('attach', 'show', array('id' => $attachid)));
|
||||
?>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
switch($ts){
|
||||
case "list":
|
||||
|
||||
$kw=urldecode(tsFilter($_GET['kw']));
|
||||
|
||||
$page = isset($_GET['page']) ? intval($_GET['page']) : '1';
|
||||
|
||||
$url = tsUrl('attach','editor',array('ts'=>'list','page'=>''));
|
||||
|
||||
$lstart = $page*10-10;
|
||||
|
||||
if($kw=='')
|
||||
{
|
||||
$attachlist = $new['attach']->findAll('attach',array('userid'=>$userid),'addtime desc',null,$lstart.',10');
|
||||
$albumNum = $new['attach']->findCount('attach');
|
||||
}else
|
||||
{
|
||||
$kw = t($kw);
|
||||
$attachlist = $db->fetch_all_assoc("select * from ".dbprefix."attach WHERE `userid` = '$userid' AND `attachname` like '%$kw%' order by addtime desc limit $lstart,10");
|
||||
$albumNum = $db->once_num_rows("select * from ".dbprefix."attach WHERE `userid` = '$userid' AND attachname like '%$kw%'");
|
||||
}
|
||||
|
||||
$pageUrl = pagination($albumNum, 10, $page, $url);
|
||||
|
||||
include template("editor");
|
||||
break;
|
||||
case "upload":
|
||||
$albumid=0;
|
||||
include template("upload");
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
$page = isset($_GET['page']) ? intval($_GET['page']) : '1';
|
||||
|
||||
$url = tsUrl('attach','index',array('page'=>''));
|
||||
|
||||
$lstart = $page*30-30;
|
||||
|
||||
$arrAlbum = $new['attach']->findAll('attach_album',"`isaudit`=0",'albumid desc',null,$lstart.',30');
|
||||
|
||||
foreach($arrAlbum as $key=>$item){
|
||||
$arrAlbum[$key]['albumname'] = tstitle($item['albumname']);
|
||||
$arrAlbum[$key]['albumdesc'] = tstitle($item['albumdesc']);
|
||||
}
|
||||
|
||||
$albumNum = $new['attach']->findCount('attach_album');
|
||||
|
||||
$pageUrl = pagination($albumNum, 30, $page, $url);
|
||||
|
||||
$title = '最新专辑';
|
||||
|
||||
$sitekey = $TS_APP['appkey'];
|
||||
$sitedesc = $TS_APP['appdesc'];
|
||||
include template("index");
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
//用户是否登录
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
//判断发布者状态
|
||||
if(aac('user')->isPublisher()==false) tsNotice('不好意思,你还没有权限发布内容!');
|
||||
|
||||
//发布时间限制
|
||||
if(aac('system')->pubTime()==false) tsNotice('不好意思,当前时间不允许发布内容!');
|
||||
|
||||
|
||||
switch($ts){
|
||||
|
||||
|
||||
case "":
|
||||
|
||||
$title = '新建库';
|
||||
include template("create");
|
||||
|
||||
break;
|
||||
|
||||
case "do":
|
||||
|
||||
|
||||
$albumname = trim($_POST['albumname']);
|
||||
$albumdesc = trim($_POST['albumdesc']);
|
||||
|
||||
if($albumname == '') {
|
||||
tsNotice("库名称不能为空!");
|
||||
}
|
||||
|
||||
//1审核后显示0不审核
|
||||
if ($TS_APP['isaudit']==1) {
|
||||
$isaudit = 1;
|
||||
} else {
|
||||
$isaudit = 0;
|
||||
}
|
||||
|
||||
if($TS_USER['isadmin']==0){
|
||||
//过滤内容开始
|
||||
aac('system')->antiWord($albumname);
|
||||
aac('system')->antiWord($albumdesc);
|
||||
//过滤内容结束
|
||||
}
|
||||
|
||||
$albumid = $new['attach']->create('attach_album',array(
|
||||
|
||||
'userid'=>$userid,
|
||||
'albumname'=>$albumname,
|
||||
'albumdesc'=>$albumdesc,
|
||||
'isaudit'=>$isaudit,
|
||||
'addtime'=>date('Y-m-d H:i:s'),
|
||||
'uptime'=>date('Y-m-d H:i:s'),
|
||||
|
||||
));
|
||||
|
||||
header("Location: ".tsUrl('attach','album',array('id'=>$albumid)));
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
$attachid=intval($_GET['id']);
|
||||
$strattach = $new['attach']->find('attach',array(
|
||||
'attachid'=>$attachid,
|
||||
));
|
||||
|
||||
if ($strattach == '') {
|
||||
header ( "HTTP/1.1 404 Not Found" );
|
||||
header ( "Status: 404 Not Found" );
|
||||
$title = '404';
|
||||
include pubTemplate ( "404" );
|
||||
exit ();
|
||||
}
|
||||
|
||||
$arrattachuser = aac ( 'user' )->getSimpleUser ( $strattach ['userid'] );
|
||||
|
||||
|
||||
//是否关注
|
||||
if($TS_USER['userid'] != '' && $TS_USER['userid'] != $arrattachuser['userid']){
|
||||
$userid=$arrattachuser['userid'];
|
||||
$followNum = $db->once_num_rows("select * from ".dbprefix."user_follow where userid='".$TS_USER['userid']."' and userid_follow='$userid'");
|
||||
if($followNum > '0'){
|
||||
$arrattachuser['isfollow'] = true;
|
||||
}else{
|
||||
$arrattachuser['isfollow'] = false;
|
||||
}
|
||||
}else{
|
||||
$arrattachuser['isfollow'] = false;
|
||||
}
|
||||
|
||||
// 是否审核
|
||||
if ($strattach ['isaudit'] == 1 && $TS_USER['isadmin']==0 && $TS_USER['userid']!=$strattach['userid']) {
|
||||
tsNotice ( '内容审核中...' );
|
||||
}
|
||||
|
||||
$file_dir = "uploadfile/attach/".$strattach['attachurl'];
|
||||
$filemd5=md5_file($file_dir);
|
||||
if($filemd5)
|
||||
{
|
||||
|
||||
}else
|
||||
{
|
||||
$filemd5="File_Erro!";
|
||||
|
||||
}
|
||||
|
||||
// 获取评论
|
||||
$page = isset ( $_GET ['page'] ) ? intval ( $_GET ['page'] ) : 1;
|
||||
$url = tsUrl ( 'attach', 'show', array (
|
||||
'id' => $attachid,
|
||||
'page' => ''
|
||||
) );
|
||||
$lstart = $page * 10 - 10;
|
||||
|
||||
$arrComments = $new ['attach']->findAll ( 'attach_comment', array (
|
||||
'attachid' => $attachid
|
||||
), 'addtime desc', null, $lstart . ',10' );
|
||||
|
||||
foreach ( $arrComments as $key => $item ) {
|
||||
$arrComment [] = $item;
|
||||
$arrComment[$key]['content'] = tsDecode($item['content']);
|
||||
$arrComment [$key] ['user'] = aac ( 'user' )->getSimpleUser ( $item ['userid'] );
|
||||
}
|
||||
|
||||
$commentNum = $new ['attach']->findCount ( 'attach_comment', array (
|
||||
'attachid' => $attachid
|
||||
) );
|
||||
|
||||
$pageUrl = pagination ( $commentNum, 10, $page, $url );
|
||||
|
||||
// 标签
|
||||
//$strattach ['tags'] = aac ( 'tag' )->getObjTagByObjid ( 'attach', 'attachid', $strattach ['attachid'] );
|
||||
$title = $strattach['attachname'];
|
||||
include template ( "show" );
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
switch($ts){
|
||||
case "":
|
||||
$albumid=intval($_GET['albumid']);
|
||||
include template("upload");
|
||||
break;
|
||||
case "add":
|
||||
$albumid=intval($_GET['albumid']);
|
||||
include template("add");
|
||||
break;
|
||||
case "do":
|
||||
$albumid = intval($_POST['albumid']);
|
||||
|
||||
|
||||
$strAlbum = $new['attach']->find('attach_album',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
if($strAlbum!=''){
|
||||
if($strAlbum['userid']!=$userid){
|
||||
getJson('非法操作3!');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($_FILES['file']==''){ts404();}
|
||||
//上传
|
||||
$attachid = $new['attach']->create('attach',array(
|
||||
'userid'=>$userid,
|
||||
'albumid'=>$albumid,
|
||||
'locationid'=>aac('user')->getLocationId($userid),
|
||||
'addtime' => date('Y-m-d H:i:s',time()),
|
||||
));
|
||||
//上传
|
||||
$arrUpload = tsUpload($_FILES['file'],$attachid,'attach',array('zip','rar','doc','txt','ppt','pdf','docx','mp4'));
|
||||
|
||||
if($arrUpload && $arrUpload['path'] && $arrUpload['url']){
|
||||
$new['attach']->update('attach',array(
|
||||
'attachid'=>$attachid,
|
||||
),array(
|
||||
'attachname'=>$arrUpload['name'],
|
||||
'attachtype'=>$arrUpload['type'],
|
||||
'path'=>$arrUpload['path'],
|
||||
'attachurl'=>$arrUpload['url'],
|
||||
'attachsize'=>$arrUpload['size'],
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
$count_attach = $new['attach']->findCount('attach',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
$new['attach']->update('attach_album',array(
|
||||
'albumid'=>$albumid,
|
||||
),array(
|
||||
'count_attach'=>$count_attach
|
||||
));
|
||||
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
class attach extends tsApp{
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
|
||||
|
||||
$skin = 'default';
|
||||
|
||||
|
||||
|
||||
$TS_APP['appname'] = 'attach';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
* APP独立数据库配置
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,64 @@
|
||||
{php include pubTemplate("header")}
|
||||
|
||||
|
||||
|
||||
|
||||
<link href="{SITE_URL}public/js/dropzone/dropzone.css" type="text/css" rel="stylesheet" />
|
||||
<script src="{SITE_URL}public/js/dropzone/dropzone.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
<div class="alert alert-info fs12">上传文件只支持:zip,rar,doc,txt,ppt,pdf,docx格式 <span class="c9 fs12">(上传格式请在后台配置)</span></div>
|
||||
|
||||
|
||||
|
||||
<form id ="myAwesomeDropzone" style="width:100%;border:dashed" action="/index.php?app=attach&ac=upload&ts=do" class="dropzone">
|
||||
<input type="hidden" name="albumid" value="{$albumid}">
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="clear"></div>
|
||||
|
||||
|
||||
<div class="mt-3">
|
||||
|
||||
<a class="btn btn-sm btn-outline-info" href="{tsUrl('attach','album',array('id'=>$albumid))}">取消上传</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
var locationurl = "{tsUrl('attach','album',array('id'=>$albumid))}"
|
||||
|
||||
Dropzone.options.myAwesomeDropzone = {
|
||||
paramName: "file", // The name that will be used to transfer the file
|
||||
maxFilesize: 50, // MB
|
||||
acceptedFiles:".zip,.rar,.doc,.txt,.ppt,.pdf,.docx",
|
||||
accept: function(file, done) {
|
||||
done();
|
||||
|
||||
},
|
||||
queuecomplete:function (file) {
|
||||
window.location = locationurl;
|
||||
}
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
{php include pubTemplate("footer")}
|
||||
@@ -0,0 +1,114 @@
|
||||
{php include pubTemplate("header")}
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{SITE_URL}">首页</a></li>
|
||||
<li class="breadcrumb-item"><a href="{tsUrl('attach')}">附件库</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{$strAlbum['albumname']}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
<h1 class="h3 fw400">{$title}</h1>
|
||||
|
||||
<hr />
|
||||
|
||||
<div class="c9 fs12">
|
||||
|
||||
<span class="mr-2">{$strAlbum[count_view]} 人浏览</span>
|
||||
|
||||
<span class="mr-2">{$strAlbum[count_attach]} 文件</span>
|
||||
<span>{$strAlbum[addtime]} 创建</span>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="row mt-3">
|
||||
|
||||
|
||||
{if $arrattach}
|
||||
<div class="page">{$pageUrl}</div>
|
||||
<table class="table table-sm table-bordered table-hover" style="font-size: 14px;">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>file id</th>
|
||||
<th>名称</th>
|
||||
<th>Size</th>
|
||||
<th>积分</th>
|
||||
<th>下载量</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{loop $arrattach $key $item}
|
||||
|
||||
<tr>
|
||||
<td>{$item[attachid]}</td>
|
||||
<td><a href="{tsUrl('attach','show',array('id'=>$item['attachid']))}">{$item[attachname]}</a></td>
|
||||
<td>{$item[attachsize]}</td>
|
||||
<td>{if $item[pay]==0}<font color="red">Free</font>{else}{$item[pay]}{/if}</td>
|
||||
<td>{$item[count_view]}</td>
|
||||
<td>
|
||||
<a href="{tsUrl('attach','down',array('id'=>$item[attachid]))}">下载</a>
|
||||
<a href="{tsUrl('attach','edit',array('id'=>$item[attachid]))}">修改</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
{/loop}
|
||||
</tbody>
|
||||
</table>
|
||||
{else}
|
||||
<br>
|
||||
<div class="pl">这个附件库现在还没有文件
|
||||
{if $strAlbum[userid] == $TS_USER[userid]}, 你可以<a href="{tsUrl('attach','upload',array('albumid'=>$strAlbum['albumid'],'ts'=>'add'))}">添加文件</a>{/if}
|
||||
</div>
|
||||
<br>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="page">{$pageUrl}</div>
|
||||
|
||||
<div class="text-black-50">{$strAlbum[albumdesc]}</div>
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<div class="tar fs12 c9 mt-3">
|
||||
|
||||
{if $strAlbum[userid] == $TS_USER[userid] || $TS_USER[isadmin]==1}
|
||||
{if $albumid!=0}
|
||||
> <a href="{tsUrl('attach','album',array('ts'=>'edit','albumid'=>$strAlbum['albumid']))}">修改附件库</a>
|
||||
{/if}
|
||||
> <a href="{tsUrl('attach','upload',array('albumid'=>$strAlbum['albumid'],'ts'=>'add'))}">添加文件</a>
|
||||
{/if}
|
||||
|
||||
|
||||
{if $strAlbum[userid] == $TS_USER[userid] || $TS_USER[isadmin]==1}
|
||||
{if $albumid!=0}
|
||||
> <a href="{tsUrl('attach','album',array('ts'=>'del','albumid'=>$strAlbum['albumid']))}">删除附件库</a>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{if $albumid!=0}
|
||||
> <a href="{tsUrl('attach','user',array('id'=>$strAlbum['userid']))}">{$strUser['username']}的附件库</a>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{php include pubTemplate("footer")}
|
||||
@@ -0,0 +1,68 @@
|
||||
{php include pubTemplate("header")}
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{SITE_URL}">首页</a></li>
|
||||
<li class="breadcrumb-item"><a href="{tsUrl('attach')}">附件</a></li>
|
||||
<li class="breadcrumb-item"><a href="{tsUrl('attach','album',array('id'=>$strAlbum['albumid']))}">{$strAlbum['albumname']}</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">修改附件</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-3"></div>
|
||||
<div class="col-md-6">
|
||||
|
||||
<form role="form" method="POST" action="{tsUrl('attach','album',array('ts'=>'editdo'))}">
|
||||
<div class="form-group">
|
||||
<label>附件名称(必填)</label>
|
||||
<input type="text" name="albumname" value="{$strAlbum['albumname']}" class="form-control" >
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>附件介绍:</label>
|
||||
<textarea class="form-control" rows="3" name="albumdesc">{$strAlbum['albumdesc']}</textarea>
|
||||
</div>
|
||||
|
||||
|
||||
<input type="hidden" name="albumid" value="{$strAlbum['albumid']}" />
|
||||
|
||||
<input type="hidden" name="token" value="{$_SESSION['token']}" />
|
||||
<button class="btn btn-sm btn-info" type="submit">修改附件</button>
|
||||
<a class="btn btn-sm text-black-50" href="{tsUrl('attach','album',array('id'=>$strAlbum['albumid']))}">返回附件</a>
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-md-3"></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{php include pubTemplate("footer")}
|
||||
@@ -0,0 +1,65 @@
|
||||
{php include pubTemplate("header")}
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{SITE_URL}">首页</a></li>
|
||||
<li class="breadcrumb-item"><a href="{tsUrl('attach')}">库</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">创建新库</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
{template menu}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4"></div>
|
||||
<div class="col-md-4">
|
||||
|
||||
<form role="form" method="POST" action="{tsUrl('attach','new',array('ts'=>'do'))}">
|
||||
<div class="form-group">
|
||||
<label>库名称(必填)</label>
|
||||
<input type="text" name="albumname" class="form-control" >
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>库介绍:</label>
|
||||
<textarea class="form-control" rows="3" name="albumdesc"></textarea>
|
||||
</div>
|
||||
|
||||
|
||||
<input type="hidden" name="token" value="{$_SESSION['token']}" />
|
||||
<button class="btn btn-sm btn-info" type="submit">创建库</button>
|
||||
<a class="btn btn-sm text-black-50" href="{tsUrl('attach','user',array('id'=>$userid))}">返回我的库</a>
|
||||
</form>
|
||||
|
||||
<p>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-4"></div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
{php include pubTemplate("footer")}
|
||||
@@ -0,0 +1,61 @@
|
||||
{php include pubTemplate("header")}
|
||||
|
||||
<div class="container">
|
||||
<nav aria-label="breadcrumb" class="position-relative">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{SITE_URL}">首页</a></li>
|
||||
<li class="breadcrumb-item"><a href="{tsUrl('attach')}">附件</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">修改附件信息</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-2"></div>
|
||||
<div class="col-md-8" style="max-width:100%;flex:100%;">
|
||||
|
||||
|
||||
|
||||
<form method="POST" action="{SITE_URL}index.php?app=attach&ac=editdo" enctype="multipart/form-data">
|
||||
<input name="attachid" value="{$stredit[attachid]}" hidden></input>
|
||||
<div class="form-group">
|
||||
<label>标题</label>
|
||||
<input name="attachname" type="text" class="form-control" required="required" value="{$stredit[attachname]}">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label>价格(积分型只能用整数)</label>
|
||||
<input name="pay" type="text" class="form-control" value="{$stredit[pay]}" required="required" oninput = "value=value.replace(/[^\d]/g,'')">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<button class="btn btn-sm btn-info" type="submit">提交修改</button>
|
||||
|
||||
|
||||
|
||||
<p></p>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-md-2"></div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{php include pubTemplate("footer")}
|
||||
@@ -0,0 +1,96 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>Title</title>
|
||||
|
||||
<link rel="stylesheet" href="/public/bootstrap/css/bootstrap.min.css" >
|
||||
<script>var siteUrl = '';</script>
|
||||
<script src="/public/js/jquery.min.js" type="text/javascript"></script>
|
||||
<script src="/public/bootstrap/js/bootstrap.min.js"></script>
|
||||
<link href="/public/fontawesome/css/fontawesome-all.css" rel="stylesheet">
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-6">
|
||||
|
||||
<form method="get" action="/index.php">
|
||||
<input type="hidden" name="app" value="attach" />
|
||||
<input type="hidden" name="ac" value="editor" />
|
||||
<input type="hidden" name="ts" value="list" />
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" class="form-control form-control-sm" placeholder="关键词" aria-label="Recipient's username" aria-describedby="button-addon2" name="kw" value="">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-sm btn-outline-secondary" type="submit" id="button-addon2">搜索</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-2 col-2">
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 col-4 text-right">
|
||||
|
||||
<a class="btn btn-sm btn-info" href="/index.php?app=attach&ac=editor&ts=upload">上传新附件</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="page">{$pageUrl}</div>
|
||||
|
||||
<table class="table table-sm table-bordered table-hover" style="font-size: 14px;">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>名称</th>
|
||||
<th>Size</th>
|
||||
<th>积分</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{loop $attachlist $key $item}
|
||||
<tr>
|
||||
<td>{$item[attachname]}</td>
|
||||
<td>{$item[attachsize]}</td>
|
||||
<td>{if $item[pay]==0}<font color="red">Free</font>{else}{$item[pay]}{/if}</td>
|
||||
<td>
|
||||
<a href="javascript:void('0');" onclick="insertAttach('{tsUrl('attach','show',array('id'=>$item[attachid]))}','{$item[pay]}','{$item[attachname]}')">插入</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<div class="page">
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
//插入附件
|
||||
function insertAttach(downurl,pay,attachname){
|
||||
|
||||
|
||||
var html = '<a class="font-weight-bold" target="_blank" href="'+downurl+'">'+attachname+'</a>';
|
||||
|
||||
self.parent.$('#tseditor').summernote('pasteHTML', html);
|
||||
self.parent.$('.ts-attach').removeClass('open').hide();
|
||||
self.parent.$('.note-modal-backdrop').hide();
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,49 @@
|
||||
{php include pubTemplate("header")}
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
<nav aria-label="breadcrumb" class="position-relative">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{SITE_URL}">首页</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">附件</li>
|
||||
</ol>
|
||||
|
||||
<a class="btn btn-sm btn-info position-absolute" style="z-index: 100;top:6px;right:120px;background-color:#FF9933" href="{tsUrl('attach','album')}">个人附件库</a>
|
||||
<a class="btn btn-sm btn-info position-absolute" style="z-index: 100;top:6px;right:6px;" href="{tsUrl('attach','new')}">创建附件库</a>
|
||||
|
||||
</nav>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
{template menu}
|
||||
|
||||
|
||||
<div class="row">
|
||||
{loop $arrAlbum $key $item}
|
||||
<div class="col-6 col-md-2 mb-3">
|
||||
<a href="{tsUrl('attach','album',array('id'=>$item[albumid]))}">
|
||||
<img class="mw100" src="{if $item[albumface] == ''}{SITE_URL}app/{$app}/skins/{$skin}/attach_album.png{else}{php echo tsXimg($item[albumface],'attach',320,'320',$item[path],1)}{/if}" alt="{$item[albumname]}">
|
||||
</a>
|
||||
|
||||
<div class="caption">
|
||||
<div class="title-cut mt-2">{$item[albumname]}</div>
|
||||
<div class="c9 fs12"> {$item[count_attach]}个附件</div>
|
||||
<div class="fs12 c9">{php echo date('Y-m-d',strtotime($item['addtime']))} 创建</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{/loop}
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="clear"></div>
|
||||
<div class="page">{$pageUrl}</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{php include pubTemplate("footer")}
|
||||
@@ -0,0 +1,172 @@
|
||||
{php include pubTemplate("header")}
|
||||
<div class="container">
|
||||
<nav aria-label="breadcrumb" class="position-relative">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{SITE_URL}">首页</a></li>
|
||||
<li class="breadcrumb-item"><a href="{tsUrl('attach')}">附件</a></li>
|
||||
|
||||
<li class="breadcrumb-item active" aria-current="page">{$strattach[attachname]}</li>
|
||||
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{if $strattach['tags']}
|
||||
<div class="mb-3 mt-3">
|
||||
{loop $strattach[tags] $key $strattach}
|
||||
<a class="badge badge-secondary fw300 mr-2" href="{tsUrl('attach','tag',array('id'=>$strattach['tagname']))}">{$strattach[tagname]}</a>
|
||||
{/loop}
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
{/if}
|
||||
<hr />
|
||||
<div><h1 class="h3 pb-3 fw400">{$strattach[attachname]}</h1></div>
|
||||
<table class="table table-sm table-bordered table-hover" style="font-size: 14px;">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>file id</th>
|
||||
<th>MD5值</th>
|
||||
<th>Size</th>
|
||||
<th>下载需要积分</th>
|
||||
<th>下载量</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{$strattach[attachid]}</td>
|
||||
<td>{$filemd5}</td>
|
||||
<td>{$strattach[attachsize]}</td>
|
||||
<td>{if $strattach[pay]==0}<font color="red">Free</font>{else}{$strattach[pay]}{/if}</td>
|
||||
<td>{$strattach[count_view]}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<a class="btn btn-sm btn-info position-absolute" href="{tsUrl('attach','down',array('id'=>$strattach['attachid']))}">下载{if $strattach[pay]>0}-{$strattach[pay]}积分{/if}</a>
|
||||
<br />
|
||||
<hr />
|
||||
<div>{php doAction('group_topic_footer')}</div>
|
||||
<hr />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-header">up主</div>
|
||||
<div class="card-body">
|
||||
<div class="facebox">
|
||||
<div class="face">
|
||||
<a href="{tsUrl('user','space',array('id'=>$arrattachuser['userid']))}"><img class="rounded-circle" title="{$arrattachuser[username]}" alt="{$arrattachuser[username]}" src="{$arrattachuser[face]}" width="36" height="36"></a>
|
||||
</div>
|
||||
<div class="info">
|
||||
{$arrattachuser[username]}
|
||||
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<ul class="other">
|
||||
<div class="mt-2 text-right">
|
||||
{if $arrattachuser[userid] != $TS_USER[userid]}
|
||||
{if $arrattachuser[isfollow]}
|
||||
<a class="btn btn-outline-secondary btn-sm" href="javascript:void('0');" onclick="unfollow('{$arrattachuser['userid']}','{$_SESSION['token']}');">取消关注</a>
|
||||
{else}
|
||||
<a class="btn btn-info btn-sm" href="javascript:void('0')" onclick="follow('{$arrattachuser['userid']}','{$_SESSION['token']}');">关注</a>
|
||||
{/if}
|
||||
|
||||
{/if}
|
||||
</div>
|
||||
</ul>
|
||||
<ul class="other"></ul>
|
||||
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-header">评论</div>
|
||||
<div class="card-body">
|
||||
|
||||
{if $arrComment}
|
||||
<div class="comment">
|
||||
<ul>
|
||||
{loop $arrComment $key $strattach}
|
||||
<li class="clearfix">
|
||||
<div class="user-face">
|
||||
<a href="{tsUrl('user','space',array('id'=>$strattach[user][userid]))}"><img class="rounded-circle" title="{$strattach[user][username]}" alt="{$strattach[user][username]}" src="{$strattach[user][face]}" width="48" /></a>
|
||||
</div>
|
||||
<div class="reply-doc">
|
||||
<h4>
|
||||
|
||||
<a class="c9" href="{tsUrl('user','space',array('id'=>$strattach[userid]))}">{$strattach[user][username]}</a>
|
||||
</h4>
|
||||
<p>{$strattach[content]}</p>
|
||||
<h4>{php echo date('Y-m-d H:i:s',$strattach[addtime])}</h4>
|
||||
{if $TS_USER[userid] == $strattach[userid] ||
|
||||
$TS_USER['isadmin']==1}
|
||||
<div class="mb-2 text-right">
|
||||
<a class="fs12 text-secondary" href="{SITE_URL}index.php?app=attach&ac=comment&ts=delete&commentid={$strattach['commentid']}"><i class="far fa-trash-alt"></i> 删除</a>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</li> {/loop}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="page">{$pageUrl}</div>
|
||||
{/if}
|
||||
|
||||
|
||||
<div>
|
||||
{if intval($TS_USER[userid])==0}
|
||||
<div class="pd20 tac">
|
||||
<a href="{tsUrl('user','login')}">登录</a> | <a href="{tsUrl('user','register')}">注册</a>
|
||||
</div>
|
||||
{else}
|
||||
<form method="POST" action="{SITE_URL}index.php?app=attach&ac=comment&ts=do">
|
||||
|
||||
|
||||
<div id="tseditor"></div>
|
||||
|
||||
<div style="display: none"><textarea name="content"></textarea></div>
|
||||
|
||||
|
||||
|
||||
<div class="mt-2 of">
|
||||
|
||||
|
||||
<div class="float-left">
|
||||
{if $TS_SITE['isauthcode']}
|
||||
验证码:<input name="authcode" />
|
||||
<img align="absmiddle" src="{tsUrl('pubs','code')}" onclick="javascript:newgdcode(this,this.src);" title="点击刷新验证码" alt="点击刷新验证码" style="cursor:pointer;"/>
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="float-right">
|
||||
<input type="hidden" name="attachid" value="{$strattach[attachid]}" />
|
||||
<input type="hidden" name="token" value="{$_SESSION['token']}" />
|
||||
|
||||
<button class="btn btn-sm btn-info" type="submit">评论</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{php doAction('tseditor','mini')}
|
||||
{php include pubTemplate("footer")}
|
||||
@@ -0,0 +1,63 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
|
||||
<link rel="stylesheet" href="/public/bootstrap/css/bootstrap.min.css" >
|
||||
<script>var siteUrl = '';</script>
|
||||
<script src="/public/js/jquery.min.js" type="text/javascript"></script>
|
||||
<script src="/public/bootstrap/js/bootstrap.min.js"></script>
|
||||
<link href="/public/fontawesome/css/fontawesome-all.css" rel="stylesheet">
|
||||
|
||||
|
||||
|
||||
<link href="/public/js/dropzone/dropzone.css" type="text/css" rel="stylesheet" />
|
||||
<script src="/public/js/dropzone/dropzone.js"></script>
|
||||
|
||||
<style>
|
||||
.fs12{font-size: 12px;}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
<div class="alert alert-info fs12">上传文件只支持:zip,rar,doc,txt,ppt,pdf,docx格式 <span class="c9 fs12">(上传格式请在后台配置)</span></div>
|
||||
|
||||
<form id ="myAwesomeDropzone" style="width:100%;border:dashed" action="/index.php?app=attach&ac=upload&ts=do" class="dropzone">
|
||||
<input type="hidden" name="albumid" value="{$albumid}">
|
||||
</form>
|
||||
|
||||
|
||||
<div class="text-center mt-3">
|
||||
<a class="btn btn-sm btn-outline-info" href="{tsUrl('attach','editor',array('ts'=>'list'))}">取消上传</a>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
var locationurl = "{tsUrl('attach','editor',array('ts'=>'list'))}"
|
||||
|
||||
Dropzone.options.myAwesomeDropzone = {
|
||||
paramName: "file", // The name that will be used to transfer the file
|
||||
maxFilesize: 5000, // MB
|
||||
acceptedFiles:".zip,.rar,.doc,.txt,.ppt,.pdf,.docx,.mp4",
|
||||
accept: function(file, done) {
|
||||
done();
|
||||
|
||||
},
|
||||
queuecomplete:function (file) {
|
||||
window.location = locationurl;
|
||||
}
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 188 KiB |
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
return array(
|
||||
'name' => '评论',
|
||||
'version' => '1.2',
|
||||
'desc' => '评论管理',
|
||||
'url' => 'http://www.thinksaas.cn',
|
||||
'email' => 'thinksaas@qq.com',
|
||||
'author' => '邱君',
|
||||
'author_url' => 'http://www.thinksaas.cn',
|
||||
'isoption' => '1',
|
||||
'isinstall' => '1',
|
||||
'issql' => '1',
|
||||
'issystem' => '1',
|
||||
'isappnav' => '0',
|
||||
'ismy'=>'1'
|
||||
);
|
||||
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
//用户是否登录
|
||||
$userid = aac('user')->isLogin($js,$userkey);
|
||||
|
||||
$authcode = strtolower((string) $_POST['authcode']);
|
||||
|
||||
if ($TS_SITE ['isauthcode'] && $authcode) {
|
||||
if ($authcode != $_SESSION ['verify']) {
|
||||
getJson ( "验证码输入有误,请重新输入!" ,$js,0);
|
||||
}
|
||||
}
|
||||
|
||||
$ptable = tsTrim($_POST['ptable']);
|
||||
if(!preg_match("/^[a-z_]*$/i", $ptable)){
|
||||
getJson('非法操作!',$js);
|
||||
}
|
||||
|
||||
$pkey = tsTrim($_POST['pkey']);
|
||||
if(!preg_match("/^[a-z_]*$/i", $pkey)){
|
||||
getJson('非法操作!',$js);
|
||||
}
|
||||
|
||||
$pid = tsIntval($_POST['pid']);
|
||||
|
||||
|
||||
$referid = tsIntval($_POST['referid']);
|
||||
$touserid = tsIntval($_POST['touserid']);
|
||||
|
||||
|
||||
$content = tsClean($_POST['content'],$js);
|
||||
$content2 = emptyText($_POST['content']);//测试空内容
|
||||
$ispublic = tsIntval($_POST['ispublic']);
|
||||
|
||||
|
||||
//匿名用户
|
||||
$isniming = tsIntval($_POST['isniming']);
|
||||
if($TS_SITE['isniming']==1 && $isniming==1) $userid = aac('user')->getNimingId();
|
||||
|
||||
|
||||
//过滤内容开始
|
||||
if($TS_USER['isadmin']==0){
|
||||
$content = antiWord($content);
|
||||
}
|
||||
//过滤内容结束
|
||||
|
||||
if($ptable=='' || $pkey=='' || $pid=='' || $content2=='' || $content==''){
|
||||
getJson('没有任何内容是不允许你通过滴^_^',$js);
|
||||
}else{
|
||||
|
||||
|
||||
$isaudit = 0;
|
||||
if($TS_APP['comment_isaudit']==1 && $TS_USER['isadmin']==0) $isaudit=1;
|
||||
|
||||
$commentid = $new['comment']->create('comment',array(
|
||||
'ptable'=>$ptable,
|
||||
'pkey'=>$pkey,
|
||||
'pid'=>$pid,
|
||||
|
||||
'referid'=>$referid,
|
||||
'userid'=>$userid,
|
||||
'touserid'=>$touserid,
|
||||
|
||||
'content' => $content,
|
||||
'ispublic'=>$ispublic,
|
||||
'isaudit'=>$isaudit,
|
||||
'addtime'=> time(),
|
||||
));
|
||||
|
||||
//统计评论数
|
||||
$count_comment = $new['comment']->findCount('comment',array(
|
||||
'ptable'=>$ptable,
|
||||
'pkey'=>$pkey,
|
||||
'pid'=>$pid,
|
||||
));
|
||||
|
||||
//更新项目最后回应时间和评论数
|
||||
$new['comment']->update($ptable,array(
|
||||
$pkey=>$pid,
|
||||
),array(
|
||||
'count_comment'=>$count_comment,
|
||||
'uptime'=>time(),
|
||||
));
|
||||
|
||||
#更新ptable评论数
|
||||
aac('pubs')->upPtableComment($ptable,$pkey,$pid,$count_comment);
|
||||
|
||||
//发送系统消息(通知楼主有人回复他的帖子啦)
|
||||
$strProject = $new['comment']->find($ptable,array(
|
||||
$pkey=>$pid,
|
||||
));
|
||||
|
||||
if($referid){
|
||||
|
||||
$strComment = $new['comment']->find('comment',array(
|
||||
'commentid'=>$referid,
|
||||
));
|
||||
|
||||
//创建消息
|
||||
if($strComment['userid'] != $userid){
|
||||
$msg_userid = $userid;
|
||||
$msg_touserid = $strComment['userid'];
|
||||
$msg_content = '回复了你:'.t($content);
|
||||
$msg_tourl = getProjectUrl($ptable,$pid);
|
||||
$msg_extend = json_encode(array(
|
||||
'ptable'=>$ptable,
|
||||
'pkey'=>$pkey,
|
||||
'pid'=>$pid,
|
||||
));
|
||||
aac('message')->sendmsg($msg_userid,$msg_touserid,$msg_content,$msg_tourl,$msg_extend);
|
||||
}
|
||||
|
||||
#上级评论用户加分
|
||||
aac ( 'user' )->doScore ( $TS_URL['app'], $TS_URL['ac'],$TS_URL['mg'],$TS_URL['api'], $TS_URL['ts'],$strComment['userid']);
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
//创建消息
|
||||
if($strProject['userid'] != $userid){
|
||||
$msg_userid = $userid;
|
||||
$msg_touserid = $strProject['userid'];
|
||||
$msg_content = '评论了你发布的:《'.$strProject['title'].'》';
|
||||
$msg_tourl = getProjectUrl($ptable,$pid);
|
||||
$msg_extend = json_encode(array(
|
||||
'ptable'=>$ptable,
|
||||
'pkey'=>$pkey,
|
||||
'pid'=>$pid,
|
||||
));
|
||||
aac('message')->sendmsg($msg_userid,$msg_touserid,$msg_content,$msg_tourl,$msg_extend);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$daytime = strtotime(date('Y-m-d 00:00:01'));
|
||||
$count_comment = $new['comment']->findCount('comment',"`userid`='$userid' and `addtime`>'$daytime'");
|
||||
|
||||
#每日前1条给积分
|
||||
if($count_comment<2){
|
||||
aac('user') -> doScore($TS_URL['app'], $TS_URL['ac'],$TS_URL['mg'],$TS_URL['api'], $TS_URL['ts']);
|
||||
}
|
||||
|
||||
getJson('评论成功',$js,2,getProjectUrl($ptable,$pid));
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
// 管理入口
|
||||
if (is_file('app/' . $TS_URL['app'] . '/action/admin/' . $mg . '.php')) {
|
||||
include_once 'app/' . $TS_URL['app'] . '/action/admin/' . $mg . '.php';
|
||||
} else {
|
||||
qiMsg('sorry:no index!');
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
switch ($ts){
|
||||
|
||||
case "list":
|
||||
|
||||
$userid = tsIntval($_GET['userid']);
|
||||
$ptable = isset($_GET['ptable']) ? tsTrim($_GET['ptable']) : '';
|
||||
$pid = tsIntval($_GET['pid']);
|
||||
|
||||
$page = tsIntval($_GET['page'],1);
|
||||
$url = SITE_URL.'index.php?app=comment&ac=admin&mg=comment&ts=list&ptable='.$ptable.'&userid='.$userid.'&page=';
|
||||
$lstart = $page*10-10;
|
||||
|
||||
$where = null;
|
||||
|
||||
if($ptable){
|
||||
$where = "`ptable`='$ptable'";
|
||||
}
|
||||
|
||||
if($userid){
|
||||
$where .= " and `userid`='$userid'";
|
||||
}
|
||||
|
||||
if($pid){
|
||||
$where .= "`pid`='$pid'";
|
||||
}
|
||||
|
||||
$arrComment = $new['comment']->findAll('comment',$where,'addtime desc',null,$lstart.',10');
|
||||
|
||||
$commentNum = $new['comment']->findCount('comment',$where);
|
||||
|
||||
$pageUrl = pagination($commentNum, 10, $page, $url);
|
||||
|
||||
include template("admin/comment_list");
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case "delete":
|
||||
|
||||
$commentid = tsIntval($_GET['commentid']);
|
||||
|
||||
$strComment = $new['comment']->find('comment',array(
|
||||
'commentid'=>$commentid,
|
||||
));
|
||||
|
||||
$ptable = $strComment['ptable'];
|
||||
$pkey = $strComment['pkey'];
|
||||
$pid = $strComment['pid'];
|
||||
|
||||
$new['comment']->delete('comment',array(
|
||||
'commentid'=>$commentid,
|
||||
));
|
||||
|
||||
$new['comment']->delComment($ptable,$pkey,$pid,$commentid);
|
||||
|
||||
#处理积分
|
||||
aac('user') -> doScore($TS_URL['app'], $TS_URL['ac'],$TS_URL['mg'],$TS_URL['api'], $TS_URL['ts'],$strComment['userid']);
|
||||
|
||||
qiMsg('删除成功');
|
||||
|
||||
break;
|
||||
|
||||
case "isaudit":
|
||||
|
||||
$commentid = tsIntval($_GET['commentid']);
|
||||
|
||||
$strComment = $new['comment']->find('comment',array(
|
||||
'commentid'=>$commentid,
|
||||
));
|
||||
|
||||
if($strComment['isaudit']==1){
|
||||
$isaudit = 0;
|
||||
}else{
|
||||
$isaudit = 1;
|
||||
}
|
||||
|
||||
$new['comment']->update('comment',array(
|
||||
'commentid'=>$commentid,
|
||||
),array(
|
||||
'isaudit'=>$isaudit,
|
||||
));
|
||||
|
||||
qiMsg('操作成功!');
|
||||
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
switch($ts){
|
||||
//基本配置
|
||||
case "":
|
||||
$strOption = getAppOptions('comment');
|
||||
|
||||
include template("admin/options");
|
||||
|
||||
break;
|
||||
|
||||
case "do":
|
||||
|
||||
$arrOption = $_POST['option'];
|
||||
|
||||
#更新app配置选项
|
||||
upAppOptions('comment',$arrOption);
|
||||
|
||||
#更新app导航和我的导航
|
||||
upAppNav('comment',$arrOption['appname']);
|
||||
|
||||
qiMsg('修改成功!');
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
|
||||
// api入口
|
||||
if (is_file ( 'app/' . $TS_URL['app'] . '/action/api/' . $TS_URL['api'] . '.php' )) {
|
||||
include_once 'app/' . $TS_URL['app'] . '/action/api/' . $TS_URL['api'] . '.php';
|
||||
} else {
|
||||
qiMsg ( 'sorry:no api!' );
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
//用户是否登录
|
||||
$userid = aac('user')->isLogin($js,$userkey);
|
||||
|
||||
$commentid = tsIntval($_GET['commentid']);
|
||||
|
||||
$strComment = $new['comment']->find('comment',array(
|
||||
'commentid'=>$commentid,
|
||||
));
|
||||
|
||||
$ptable = $strComment['ptable'];
|
||||
$pkey = $strComment['pkey'];
|
||||
$pid = $strComment['pid'];
|
||||
|
||||
if($TS_USER['isadmin']==1 || $strComment['userid']==$userid){
|
||||
|
||||
$new['comment']->delComment($ptable,$pkey,$pid,$commentid);
|
||||
|
||||
//处理积分
|
||||
aac('user')->doScore($TS_URL['app'], $TS_URL['ac'],$TS_URL['mg'],$TS_URL['api'], $TS_URL['ts'],$strComment['userid']);
|
||||
|
||||
}
|
||||
|
||||
//跳转回到详情页
|
||||
header("Location: ".getProjectUrl($ptable,$pid));
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
|
||||
// 我的入口
|
||||
if (is_file ( 'app/' . $TS_URL['app'] . '/action/my/' . $TS_URL['my'] . '.php' )) {
|
||||
$userid = aac('user')->isLogin();
|
||||
$strUser = aac('user')->getOneUser($userid);
|
||||
include_once 'app/' . $TS_URL['app'] . '/action/my/' . $TS_URL['my'] . '.php';
|
||||
} else {
|
||||
qiMsg ( 'sorry:no index!' );
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
|
||||
|
||||
$page = tsIntval($_GET['page'],1);
|
||||
$url = tsUrl ( 'comment', 'my', array ('my'=>'index','page' => '' ) );
|
||||
$lstart = $page * 20 - 20;
|
||||
|
||||
$arrComment = $new ['comment']->findAll ( 'comment', array (
|
||||
'userid' => $strUser['userid'],
|
||||
), 'addtime desc', null, $lstart . ',20' );
|
||||
|
||||
$commentNum = $new ['comment']->findCount ( 'comment', array (
|
||||
'userid' => $strUser['userid'],
|
||||
) );
|
||||
|
||||
$pageUrl = pagination ( $commentNum, 20, $page, $url );
|
||||
|
||||
|
||||
|
||||
$title = '我的评论';
|
||||
include template('my/index');
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
$referid = tsIntval($_GET['referid']);
|
||||
$userid = tsIntval($_GET['userid']);
|
||||
|
||||
$arrRecomment = $new['comment']->recomment($referid,$userid);
|
||||
|
||||
include template('recomment');
|
||||
@@ -0,0 +1,207 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
class comment extends tsApp {
|
||||
|
||||
//构造函数
|
||||
public function __construct($db) {
|
||||
$tsAppDb = array();
|
||||
include 'app/comment/config.php';
|
||||
//判断APP是否采用独立数据库
|
||||
if ($tsAppDb) {
|
||||
$db = new MySql($tsAppDb);
|
||||
}
|
||||
|
||||
parent::__construct($db);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取评论列表
|
||||
*
|
||||
* @param [type] $ptable
|
||||
* @param [type] $pkey
|
||||
* @param [type] $pid
|
||||
* @param [type] $page 当前页码
|
||||
* @param [type] $lstart 每页显示条数
|
||||
* @param [type] $puid 当前项目的用户ID
|
||||
* @param integer $uid 当前登录的用户ID
|
||||
* @param integer $ismb 是否手机浏览
|
||||
* @return void
|
||||
*/
|
||||
public function getCommentList($ptable,$pkey,$pid,$page,$lstart,$puid,$uid=0,$ismb=0){
|
||||
$arrComment = $this->findAll('comment',array(
|
||||
'ptable'=>$ptable,
|
||||
'pkey'=>$pkey,
|
||||
'pid'=>$pid,
|
||||
'referid'=>0,
|
||||
),'addtime desc',null,$lstart.',15');
|
||||
|
||||
foreach($arrComment as $key => $item){
|
||||
$arrComment[$key]['l'] = (($page-1) * 15) + $key + 1;
|
||||
//$arrComment[$key]['l'] = (($page-1) * 15) - $key + $commentNum;//盖楼
|
||||
$arrComment[$key]['user'] = aac('user')->getSimpleUser($item['userid']);
|
||||
$arrComment[$key]['content'] = tsDecode($item['content']);
|
||||
if($ismb){
|
||||
$arrComment[$key]['content'] = mobileHtml($arrComment[$key]['content']);
|
||||
}
|
||||
$arrComment[$key]['recomment'] = $this->recomment($item['commentid'],$puid,3,$uid,$ismb);
|
||||
$arrComment[$key]['recomment_num'] = $this->recommentNum($item['commentid']);
|
||||
|
||||
$arrComment[$key]['zzuid'] = $puid;//作者ID
|
||||
|
||||
$arrComment[$key]['iszz'] = 0;#作者1是0否
|
||||
if($item['userid']==$puid){
|
||||
$arrComment[$key]['iszz'] = 1;#作者1是0否
|
||||
}
|
||||
|
||||
$arrComment[$key]['isdelete'] = 0;#删除权限1有0无
|
||||
if($uid && $uid==$item['userid']){
|
||||
$arrComment[$key]['isdelete'] = 1;#删除权限1有0无
|
||||
}
|
||||
|
||||
$arrComment[$key]['iscomment'] = 0;#回复权限1有0无
|
||||
if($uid && $uid!=$item['userid']){
|
||||
$arrComment[$key]['iscomment'] = 1;#回复权限1有0无
|
||||
}
|
||||
|
||||
|
||||
$arrComment[$key]['datetime'] = date('m-d H:i',$item['addtime']);
|
||||
|
||||
}
|
||||
|
||||
return $arrComment;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取评论数
|
||||
*
|
||||
* @param [type] $ptable
|
||||
* @param [type] $pkey
|
||||
* @param [type] $pid
|
||||
* @return void
|
||||
*/
|
||||
public function getCommentNum($ptable,$pkey,$pid){
|
||||
$commentNum = $this->findCount('comment',array(
|
||||
'ptable'=>$ptable,
|
||||
'pkey'=>$pkey,
|
||||
'pid'=>$pid,
|
||||
'referid'=>0,
|
||||
));
|
||||
return $commentNum;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取评论下的回复列表
|
||||
*
|
||||
* @param [type] $referid 上级评论ID
|
||||
* @param [type] $puid 当前项目用户ID
|
||||
* @param integer $num 调用条数
|
||||
* @param integer $uid 当前登录的用户ID
|
||||
* @param integer $ismb 是否手机浏览
|
||||
* @return void
|
||||
*/
|
||||
function recomment($referid,$puid,$num=0,$uid=0,$ismb=0){
|
||||
|
||||
if($num){
|
||||
$limit = $num;
|
||||
}else{
|
||||
$limit = null;
|
||||
}
|
||||
|
||||
$arrComment = $this->findAll('comment',array(
|
||||
'referid'=>$referid,
|
||||
),'addtime desc',null,$limit);
|
||||
|
||||
foreach($arrComment as $key=>$item){
|
||||
$html = tsDecode($item['content']);
|
||||
if($ismb==1){
|
||||
$html = mobileHtml($html);
|
||||
}
|
||||
|
||||
$arrComment[$key]['content'] = $html;
|
||||
|
||||
$arrComment[$key]['user'] = aac('user')->getSimpleUser($item['userid']);
|
||||
$arrComment[$key]['datetime'] = date('m-d H:i',$item['addtime']);
|
||||
|
||||
if($item['touserid']){
|
||||
$arrComment[$key]['touser'] = aac('user')->getSimpleUser($item['touserid']);
|
||||
}
|
||||
|
||||
$arrComment[$key]['iszz'] = 0;#作者1是0否
|
||||
if($item['userid']==$puid){
|
||||
$arrComment[$key]['iszz'] = 1;#作者1是0否
|
||||
}
|
||||
|
||||
$arrComment[$key]['isdelete'] = 0;#删除权限1有0无
|
||||
if($uid && $uid==$item['userid']){
|
||||
$arrComment[$key]['isdelete'] = 1;#删除权限1有0无
|
||||
}
|
||||
|
||||
$arrComment[$key]['iscomment'] = 0;#回复权限1有0无
|
||||
if($uid && $uid!=$item['userid']){
|
||||
$arrComment[$key]['iscomment'] = 1;#回复权限1有0无
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return $arrComment;
|
||||
}
|
||||
|
||||
function recommentNum($referid){
|
||||
$num = $this->findCount('comment',array(
|
||||
'referid'=>$referid,
|
||||
));
|
||||
|
||||
return $num;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除评论
|
||||
*
|
||||
* @param [type] $ptable
|
||||
* @param [type] $pkey
|
||||
* @param [type] $pid
|
||||
* @param integer $commentid
|
||||
* @return void
|
||||
*/
|
||||
public function delComment($ptable,$pkey,$pid,$commentid=0){
|
||||
|
||||
if($commentid){
|
||||
$this->delete('comment',array(
|
||||
'commentid'=>$commentid,
|
||||
));
|
||||
#删除回复
|
||||
$this->delete('comment',array(
|
||||
'referid'=>$commentid,
|
||||
));
|
||||
}else{
|
||||
$this->delete('comment',array(
|
||||
'ptable'=>$ptable,
|
||||
'pkey'=>$pkey,
|
||||
'pid'=>$pid,
|
||||
));
|
||||
}
|
||||
|
||||
#统计评论数
|
||||
$count_comment = $this->findCount('comment',array(
|
||||
'ptable'=>$ptable,
|
||||
'pkey'=>$pkey,
|
||||
'pid'=>$pid,
|
||||
));
|
||||
|
||||
//更新评论数
|
||||
$this->update($ptable,array(
|
||||
$pkey=>$pid,
|
||||
),array(
|
||||
'count_comment'=>$count_comment,
|
||||
));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
$TS_APP['appname'] = '评论';
|
||||
@@ -0,0 +1,116 @@
|
||||
{php include pubTemplate("header_admin")}
|
||||
|
||||
<!--main-->
|
||||
<div class="midder">
|
||||
|
||||
{php include template("admin/menu");}
|
||||
|
||||
<div class="page">{$pageUrl}</div>
|
||||
|
||||
|
||||
<div class="mb-3">
|
||||
|
||||
|
||||
<form method="get" action="index.php">
|
||||
<input type="hidden" name="app" value="comment">
|
||||
<input type="hidden" name="ac" value="admin">
|
||||
<input type="hidden" name="mg" value="comment">
|
||||
<input type="hidden" name="ts" value="list">
|
||||
|
||||
<select name="ptable">
|
||||
|
||||
<option value="" {if $ptable==''}selected{/if}>全部</option>
|
||||
<option value="topic" {if $ptable=='topic'}selected{/if}>帖子</option>
|
||||
<option value="article" {if $ptable=='article'}selected{/if}>文章</option>
|
||||
<option value="photo" {if $ptable=='photo'}selected{/if}>图片</option>
|
||||
<option value="weibo" {if $ptable=='weibo'}selected{/if}>唠叨</option>
|
||||
<option value="video" {if $ptable=='video'}selected{/if}>视频</option>
|
||||
<option value="audio" {if $ptable=='audio'}selected{/if}>音频</option>
|
||||
<option value="event" {if $ptable=='event'}selected{/if}>活动</option>
|
||||
<option value="vote" {if $ptable=='vote'}selected{/if}>投票</option>
|
||||
<option value="study_lesson" {if $ptable=='study_lesson'}selected{/if}>课时</option>
|
||||
<option value="goods" {if $ptable=='goods'}selected{/if}>商品</option>
|
||||
|
||||
</select>
|
||||
|
||||
<input type="number" name="pid" placeholder="PID">
|
||||
|
||||
<input type="number" name="userid" placeholder="用户ID">
|
||||
|
||||
|
||||
<input type="submit" value="搜索">
|
||||
|
||||
<a class="btn btn-sm btn-outline-secondary" href="index.php?app=comment&ac=admin&mg=comment&ts=list&ptable={$ptable}">全部</a>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<table class="table table-hover">
|
||||
|
||||
<thead class="thead-light fs14">
|
||||
<tr><th>ID</th>
|
||||
|
||||
<th>UserID</th>
|
||||
|
||||
<th>PID</th>
|
||||
|
||||
<th>内容</th>
|
||||
|
||||
<th>时间</th>
|
||||
|
||||
<th>操作</th></tr>
|
||||
</thead>
|
||||
|
||||
|
||||
<tbody class="fs12">
|
||||
|
||||
|
||||
|
||||
{loop $arrComment $key $item}
|
||||
<tr>
|
||||
<td>{$item['commentid']}</td>
|
||||
<td>{$item['userid']}</td>
|
||||
<td>{$item['pid']} <a target="_blank" href="{php echo getProjectUrl($item['ptable'],$item['pid']);}">[查看内容]</a></td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
|
||||
<div style="width: 600px;">{php echo tsDecode($item['content'])}</div>
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td>{php echo date('Y-m-d H:i:s',$item['addtime'])}</td>
|
||||
|
||||
<td>
|
||||
|
||||
|
||||
|
||||
<a class="btn btn-sm btn-outline-secondary" href="{SITE_URL}index.php?app=comment&ac=admin&mg=comment&ts=isaudit&commentid={$item['commentid']}">
|
||||
|
||||
{if $item['isaudit']==1}
|
||||
审核
|
||||
{else}
|
||||
取消审核
|
||||
{/if}
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
<a class="btn btn-sm btn-outline-secondary" onclick="return confirm('确定删除?')" href="{SITE_URL}index.php?app=comment&ac=admin&mg=comment&ts=delete&commentid={$item['commentid']}">删除</a>
|
||||
|
||||
</td></tr>
|
||||
{/loop}
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
{php include pubTemplate("footer_admin")}
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
<div class="tabnav">
|
||||
<h6>评论管理</h6>
|
||||
<ul>
|
||||
<li {if $mg=='options'}class="select"{/if}><a href="{SITE_URL}index.php?app=comment&ac=admin&mg=options">基础配置</a></li>
|
||||
|
||||
<li {if $mg=='comment'}class="select"{/if}><a href="{SITE_URL}index.php?app=comment&ac=admin&mg=comment&ts=list">评论列表</a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<div style="height: 100px;"></div>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user