代码拉取完成,页面将自动刷新
同步操作将从 冰优/sxlog 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<?php
//作者:雪落
//时间:2022-01-10
//-------------------------------------------------
header('Content-Type: text/html; charset=utf-8');
date_default_timezone_set('PRC');
$_SERVER['_memory_usage'] = memory_get_usage();
$timeStart = microtime(true);
session_start();
//根目录
define('ROOT',str_replace('\\','/',__DIR__).'/');
//数据目录
define('DB',ROOT.'db/');
//类库目录
define('LIB',ROOT.'lib/');
//扩展目录
define('EXT',ROOT.'ext/');
//保存登陆状态
define('LOGIN', isset($_SESSION['login'])?$_SESSION['login']:0);
//版本
define('V','1.0.8');
//检测数据库是否可写
!is_writeable(DB) AND exit('db文件夹无写入权限,请检查!');
//引入库
include LIB.'function.php';
include LIB.'common.php';
include LIB.'fk.class.php';
include LIB.'tpl.class.php';
//配置信息
$conf = db('conf');
define('CONF', $conf);
//0:线上模式(无错)1:调试模式(无错+日志)2:开发模式(报错+日志)
define('DEBUG', $conf['debug']);
//伪静态url
$document_root = str_replace('\\','/',$_SERVER['DOCUMENT_ROOT']);
$home = substr(ROOT,substr($document_root,-1)==='/'?strlen($document_root)-1:strlen($document_root));
define('HOME',$home ? $home : '/');
define('URL',HOME.($conf['rewrite']?'':'?'));
function_exists('ini_set') AND ini_set('display_errors', DEBUG ? '1' : '0');
error_reporting(DEBUG ? E_ALL : 0);
DEBUG AND set_error_handler('errorHandle', -1);
//缓存信息
$_SESSION['ip'] = isset($_SESSION['ip']) ? $_SESSION['ip'] : ip();
$_SESSION['views'] = isset($_SESSION['views']) ? $_SESSION['views'] : [];
$_SESSION['isVisit'] = isset($_SESSION['isVisit']) ? $_SESSION['isVisit'] : 0;
$_SESSION['commentCount'] = isset($_SESSION['commentCount']) ? $_SESSION['commentCount'] : 0;
$_SESSION['loginCount'] = isset($_SESSION['loginCount']) ? $_SESSION['loginCount'] : 0;
$_SESSION['vcode'] = isset($_SESSION['vcode']) ? $_SESSION['vcode'] : 0;
//请求方式:POST、GET
$method = $_SERVER['REQUEST_METHOD'];
//是否为ajax请求
$ajax = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower(trim($_SERVER['HTTP_X_REQUESTED_WITH'])) == 'xmlhttprequest');
//当前主题模板绝对路径
define('TPLPATH',ROOT.'tpl/'.$conf['tpl'].'/');
//当前主题模板相对路径
define('TPL',HOME.'tpl/'.$conf['tpl'].'/');
//当前主题样式路径
define('TPL_STYLE',HOME.'tpl/'.$conf['tpl'].'/style/');
//公共样式路径
define('LIB_STYLE',HOME.'lib/style/');
//当前网址
$host = (isHttps() ? 'https' : 'https').'://'.$_SERVER['SERVER_NAME'].HOME;
//前端页面
$page = get(0,'str','index');
//后端页面
$adminPage = get(1,'str','index');
//时间戳
$time = time();
//hook钩子名称预设
//前端
$hook=['head-header'=>[],'head-footer'=>[],'css'=>[],'script'=>[],'body-header'=>[],'body-footer'=>[],'editor'=>[]];
//后端
foreach ([
//头部导航菜单
'header-menu-1','header-menu-2','header-menu-3',
//菜单
'menu-header','menu-footer','menu-top','menu-bottom','menu-1','menu-2','menu-3',
//首页
'index-header','index-footer','index-top','index-bottom','index-info-top','index-info-bottom','index-system','index-system-top','index-system-bottom','index-news','index-server','index-server-top','index-server-bottom',
//文章管理
'article-header','article-footer','article-bottom','article-sidebar-top','article-sidebar-bottom','article-menu-header','article-menu-footer','article-menu-left-top','article-menu-left-bottom','article-menu-right-top','article-menu-right-bottom','article-list-operate',
//文章添加
'article.create-top','article.create-bottom','article.create-form1','article.create-form2','article.create-form3',
//文章编辑
'article.editor-top','article.editor-bottom','article.editor-form1','article.editor-form2','article.editor-form3',
//导航设置
'navbar-header','navbar-footer',
//友情链接
'link-header','link-footer',
//设置
'setting-header','setting-footer','setting-top','setting-bottom','setting-1','setting-2',
//主题
'tpl-header','tpl-footer','tpl-top','tpl-bottom','tpl-list','tpl-operate1','tpl-operate2','tpl-operate3',
//扩展
'ext-header','ext-footer','ext-top','ext-bottom','ext-tip','ext-operate1','ext-operate2','ext-operate3','ext-tip-bottom',
//访客
'visit-header','visit-footer','visit-top','visit-bottom','visit-tip','visit-tip-bottom',
//错误
'error-header','error-footer','error-top','error-bottom','error-tip','error-tip-bottom',
//登录
'login-header','login-footer','login-1','login-2','login-3'
] as $extTag) {
$hook[$extTag] = [];
}
//模板编译
$tpl = new Tpl([
'path' => '/tpl/',
'name' => $conf['tpl'],
'compile' => $conf['compile'],
]);
//获取配置信息
if($ajax){
if(post('getConf','int')){
ajax(0,['HOME'=>HOME,'URL'=>URL]);
}
}
//检测安装
if(!$conf['install']){
if(!extension_loaded('curl')) exit('请开启curl扩展!');
if(!extension_loaded('gd')) exit('请开启gd扩展!');
if($page == 'install'){
if($method == 'POST'){
$conf['title'] = post('title','str',$conf['title']);
$conf['name'] = post('name','str',$conf['name']);
$conf['intro'] = post('intro','str',$conf['intro']);
$conf['password'] = post('password','str',$conf['password']);
$conf['install'] = post('install','bool',$conf['install']);
if($conf['password']){
$tpl->compile();
dbSave('conf',$conf);
}
jump();
}
}
include LIB.'install.php';
exit;
}
//ip黑名单检测
$ip = $_SESSION['ip'];
if($conf['blacklist']){
$blacklist = explode(' ',$conf['blacklist']);
$error = '你的IP被系统拉入黑名单,如需解除,请联系管理员!';
foreach($blacklist as $_ip){
if(strpos($_ip,'/') !== false){
preg_match($_ip,$ip) AND exit($error);
}else{
$ip == $_ip AND exit($error);
}
}
}
//记录ip访问
if(!$_SESSION['isVisit'] && $ip){
$_SESSION['isVisit'] = 1;
$visit = db('visit');
if(isset($visit[$ip]) && date('Y-m-d',$visit[$ip]) !== date('Y-m-d')) unset($visit[$ip]);
//更新ip信息
$visit[$ip]=$time;
dbSave('visit',$visit);
//更新浏览量
$conf['views'] += 1;
dbSave('conf',$conf);
}
//文章列表
$articleList = db('article',[],['time'=>1]);
//分类标签
$tagList = db('tag');
//导航链接
$navbarList = initLink($conf['navbar']);
//友情链接
$linkList = initLink($conf['link']);
//加载已安装的扩展
$extList = db('ext');
foreach ($extList as $v) {
$commonPath = EXT.$v.'/common.php';
if(is_file($commonPath)) include $commonPath;
}
foreach ($extList as $v) {
$mainPath = EXT.$v.'/main.php';
if(is_file($mainPath)) include $mainPath;
}
//加载模板中的公共文件
$mainPath = TPLPATH.'main.php';
if(is_file($mainPath)) include $mainPath;
//页面路由
switch($page){
//验证码
case 'vcode':
include LIB.'vcode.class.php';
$code = new vcode($conf['vcode']['width'],$conf['vcode']['height'],$conf['vcode']['length']);
$_SESSION['vcode'] = $code->getCode();
echo $code->outimg();
exit;
//首页
case 'index':
$pageNum = get(1,'int',1);
$pageSize = $conf['article']['paging'];
$article = getArticle(LOGIN?[]:['private'=>0],['time'=>1,'top'=>1],'index/{page}',$pageNum,$pageSize);
include $tpl->view('index');
break;
//分类标签
case 'tag':
$tag = get(1,'urldecode');
$articleList = getTag($tag);
$cond = ['tag'=>['IN'=>$tag]];
if(!LOGIN)$cond['private'] = 0;
$pageNum = get(2,'int',1);
$pageSize = $conf['article']['paging'];
$article = getArticle($cond,[],'tag/'.$tag.'/{page}',$pageNum,$pageSize);
include $tpl->view(is_file(TPLPATH.'tag.php')?'tag':'index');
break;
//搜索页
case 'search':
$searchName = post('name','urldecode');
$searchName AND jump('search&name='.$searchName);
$searchName = get('name','urldecode');
$cond = ['title'=>['LIKE'=>$searchName]];
if(!LOGIN) $cond['private'] = 0;
$pageNum = get(1,'int',1);
$pageSize = $conf['article']['paging'];
$article = getArticle($cond,['time'=>1,'top'=>1],'search/{page}&name='.$searchName,$pageNum,$pageSize);
include $tpl->view(is_file(TPLPATH.'search.php')?'search':'index');
break;
//评论
case 'comment':
$action = get(1,'str');
//删除留言
if($action == 'delete'){
if(!LOGIN) jump('login');
$articleId = get(2);
delComment('comment/'.$articleId,get(3,'int',0));
commentsInit($articleId);
jump($articleId);
}
//添加留言
if($method == 'POST'){
$vcode = post('vcode','str');
if($conf['vcode']['open'] && (!$vcode || strtolower($_SESSION['vcode']) !== strtolower($vcode))){
prompt('验证码不正确');
}
if($_SESSION['commentCount'] > $conf['comment']['restrict']){
prompt('每日评论次数不能超过'.$conf['comment']['restrict'].'次哦!');
}
$pid = post('pid','int',0);
$content = trim(post('content','stripTags'));
if(mb_strlen($content) > 2000){
prompt('留言字数不能大于2000');
}
$pageName = post('page');
$path = $pageName ? 'comment/'.$pageName : 'comment';
if($pageName){
if(!isset($articleList[$pageName]) || !$articleList[$pageName]['comment']) prompt('非法操作');
$path = 'comment/'.$pageName;
}else{
$path = 'comment';
}
$comment = db($path);
$id = $comment ? $comment[count($comment)-1]['id'] + 1 : 1;
if(!empty($content)){
$arr = ['id' => $id,'pid' => $pid,'admin' => LOGIN,'content' => $content,'ip' => $ip,'time' => $time];
$selComment = arrWhere($comment,['ip'=>$ip,'content'=>$content,'time'=>['>'=>strtotime(date('Y-m-d',time()))]]);
if(count($selComment) > 2) prompt('非法操作!');
$comment[] = $arr;
dbSave($path,$comment);
$conf['comment']['count'] += 1;
dbSave('conf',$conf);
$_SESSION['commentCount'] += 1;
unset($_SESSION['vcode']);
}else{
prompt('留言内容不能为空');
}
commentsInit($pageName);
jump($pageName);
}
break;
//上传
case 'upload':
if(!LOGIN) ajax(1,'请登录');
$path = post('path','');
include LIB.'upload.class.php';
//参数(input控件name名称 , 文件上传路径)
$up = new Upload('file','db/upload/'.$path);
//设置上传文件的最大尺寸 1=1M
$up->setMaxSize(100);
$up->multiFile();
$error = $up->getErrorMsg();
$error AND ajax(1,is_array($error) ? $error[0] : $error);
$fileList = $up->getUploadFiles();
ajax(0,$fileList);
break;
//导入
case 'import':
if(!LOGIN) ajax(1,'请登录');
if(isset($_FILES['file']) && $_FILES['file']){
if(pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION) == 'sx'){
unsx($_FILES['file']['tmp_name']);
unlink($_FILES['file']['tmp_name']);
ajax(0,'导入成功');
}
}
ajax(1,'导入失败');
break;
//提示
case 'prompt':
if(empty($_SESSION['prompt'])) jump();
$prompt = $_SESSION['prompt']['text'];
$url = $_SESSION['prompt']['url'];
include $tpl->view($page);
unset($_SESSION['prompt']);
break;
//登录
case 'login':
if(is_file(TPLPATH.'login.php')){
include $tpl->view('login');
}else{
jump('admin/login');
}
break;
//后台
case 'admin':
$adminPage = get(1,'string','index');
//模板编译
$adminTpl = new Tpl([
'path' => '/lib/',
'name' => 'admin',
'compile' => $conf['compile'],
]);
//登录
if($adminPage == 'login'){
$conf['title'] = $conf['title'].'-登录';
if($method == 'POST'){
if($_SESSION['loginCount'] > 9) prompt('密码错误次数太多,请好好想想哦!');
$password = trim(post('password'));
if(!empty($password)){
if($password === (string)$conf['password']){
$_SESSION['login'] = 1;
}else{
$_SESSION['loginCount'] += 1;
prompt('密码错误');
}
}else{
prompt('密码不能为空');
}
jump();
}
include $adminTpl->view('login');
exit;
}
//提示
if($adminPage == 'prompt'){
if(empty($_SESSION['prompt'])) jump('admin');
$prompt = $_SESSION['prompt']['text'];
$url = $_SESSION['prompt']['url'];
include $adminTpl->view('prompt');
unset($_SESSION['prompt']);
exit;
}
if(!LOGIN) jump('login');
//后台路由
switch($adminPage){
//登出
case 'demo':
$res = curl('https://xueluo.cn/api/getVersion');
echo $res;
exit;
break;
//登出
case 'logout':
session_destroy();
jump();
break;
//查看phpinfo
case 'phpinfo':
print_r(phpinfo());
exit;
//查看server
case 'server':
echo '<!DOCTYPE html><html lang="zh-Hans"><head><meta http-equiv="Content-Type" content="text/html" charset="UTF-8"/><title>server</title></head><body style="white-space:pre-wrap;">';
print_r($_SERVER);
echo '</body></html>';
exit;
//检查更新
case 'checkUpdate':
ajax(0,checkUpdate());
break;
//数据库版本更新
case 'dbUpdate':
$data = curl('https://xueluo.cn/api/getDb');
if($data){
dbSync(type($data,'array'));
$conf = db('conf');
delCompile();
ajax(0,'更新成功');
}
ajax(1,'更新失败');
break;
//核心文件更新
case 'update':
$data = curl('https://xueluo.cn/api/getSxlog');
if($data){
unsx($data);
$list = db('list');
if(!$conf['db'] || $conf['db']['version'] != $list['#version']) dbSync($list);
delCompile();
ajax(0,'更新成功');
}
ajax(1,'更新失败');
break;
//首页
case 'index':
$_SESSION['updateAlert'] = isset($_SESSION['updateAlert']) ? 0 : 1;
include $adminTpl->view('index');
break;
//文章管理
case 'article':
$type = get(2,'str');
//分类标签
if($type == 'tag'){
$tag = get(3,'urldecode');
$articleList = getTag($tag);
$pageNum = get(4,'int',1);
$pageSize = $conf['article']['paging'];
$article = getArticle(['tag'=>['IN'=>$tag]],[],'admin/article/tag/'.$tag.'/{page}',$pageNum,$pageSize);
include $adminTpl->view('article');
}
//批量删除
elseif($type == 'delete'){
$id = post('id');
if(!$id) {
$id = get(3,'string');
$id = $id ? [$id] : 0;
}
if($id){
foreach ($id as $v) {
if(isset($articleList[$v])){
delContentFiles(db('article/'.$v,false));
$conf['article']['count'] -= 1;
unset($articleList[$v]);
delFile(dbPath('article/'.$v));
delFile(dbPath('comment/'.$v));
}
}
dbSave('conf',$conf);
dbSave('article',$articleList);
tagInit();
ajax(0,'删除成功');
}
ajax(1,'删除失败');
}
//移动分类
elseif($type == 'move'){
$id = post('id');
$tag = post('tag','str');
if($id && $tag){
foreach ($id as $v) {
if(isset($articleList[$v])){
$articleList[$v]['tag'] = $tag ? [$tag] : [];
}
}
dbSave('article',$articleList);
tagInit();
ajax(0,'操作成功');
}
ajax(1,'操作失败');
}
//创建
elseif($type == 'create'){
if($method == 'POST'){
$title = trim(post('title','stripTags'));
$content = trim(post('content'));
$id = trim(post('name'));
//是否为自定义url
$id = empty($id)?'T'.$time:$id;
if(isset($articleList[$id])) prompt('已存在该URL名称');
$tag = post('tag','trim',[]);
if($tag){
$tag = preg_replace('/\s+/',' ',$tag);
$tag = explode(' ', $tag);
}
$path = dbPath('article/'.$id);
if(!empty($content)){
$intro = post('intro','string');
if(!$intro){
$fk = new fk($content);
$html = preg_replace('/<[^>]+>/i','',$fk->html);
$html = preg_replace('/[\r\n]+/','',$html);
$intro = mb_substr($html,0,$conf['brief'],'utf-8');
}
//获取第一张图片
preg_match('/(\[img (.*?\.(jpg|jpeg|png|gif|bmp|tif)).*?\])/i', $content, $img);
$img = $img ? $img[2] : false;
$top = post('top','int',0);
$private = post('private','int',0);
$comment = post('comment','int',0);
if(save($path,$content)){
$articleList[$id] = [
'id'=>$id,
'title'=>$title,
'intro'=>$intro,
'img'=>$img,
'time'=>$time,
'top'=>$top,
'private'=>$private,
'views'=>0,
'comment'=>$comment,
'comments'=>0,
'tag'=>$tag
];
$conf['article']['count'] += 1;
dbSave('conf',$conf);
if(!dbSave('article',$articleList)){
delFile($path);
}
tagInit();
}
}
jump('admin/article');
}
include $adminTpl->view('article.create');
}
//编辑
elseif($type == 'editor'){
$id = get(3,'str');
$article = getArticle(['id'=>$id]);
if($article['list']){
$article = $article['list'][$id];
}else{
prompt('没有该数据');
}
$article['content'] = db('article/'.$id,false);
if($method == 'POST'){
$title = trim(post('title','stripTags'));
$content = trim(post('content'));
$path = dbPath('article/'.$id);
if(!empty($content)){
$intro = post('intro','string');
if(!$intro){
$fk = new fk($content);
$html = preg_replace('/<[^>]+>/i','',$fk->html);
$html = preg_replace('/[\r\n]+/','',$html);
$intro = mb_substr($html,0,$conf['brief'],'utf-8');
}
//获取第一张图片
$img = false;
if(strpos($content,'[!img]') === false){
preg_match('/img (src\s*=\s*[\'|"]+)?(.*?\.(jpg|jpeg|png|gif|bmp|tif))/i', $content, $img);
$img = $img ? $img[2] : false;
}
//判断编辑的文档是不是为上个文档的url,不是的话,删除旧有的数据,建立新数据
$name = trim(post('name'));
$newId = empty($name)?'T'.$time:$name;
//从内容中提取时间
preg_match('/\[\s*时间\s*\]\s*([\d\-\:\s]+)/i', $content, $match);
$time = $article['time'];
$top = post('top','int',0);
$private = post('private','int',0);
$comment = post('comment','int',0);
$views = $articleList[$id]['views'];
$comments = $articleList[$id]['comments'];
$tag = post('tag','trim',[]);
if($tag){
$tag = preg_replace('/\s+/',' ',$tag);
$tag = explode(' ', $tag);
}
if($newId != $id){
delFile($path);
unset($articleList[$id]);
$path = dbPath('article/'.$newId);
//重命名comment文件
include LIB.'file.util.class.php';
$util = new fileUtil();
$util->rename(DB.'comment/'.$id.'.php',$newId.'.php');
}
if(save($path,$content)){
$articleList[$newId] = [
'id'=>$newId,
'title'=>$title,
'intro'=>$intro,
'img'=>$img,
'time'=>$time,
'top'=>$top,
'private'=>$private,
'views'=>$views,
'comment'=>$comment,
'comments'=>$comments,
'tag'=>$tag
];
if(!dbSave('article',$articleList)){
delFile($path);
prompt('编辑失败');
}
tagInit();
}else{
prompt('编辑失败');
}
}else{
prompt('内容不能为空');
}
jump('admin/article');
}
include $adminTpl->view('article.editor');
}else{
$pageNum = get(2,'int',1);
$pageSize = $conf['article']['paging'];
$article = getArticle(LOGIN?[]:['private'=>0],['time'=>1,'top'=>1],'admin/article/{page}',$pageNum,$pageSize);
include $adminTpl->view('article');
}
break;
//导航设置
case 'navbar':
if($method == 'POST'){
$conf['navbar'] = post('navbar','str','');
dbSave('conf',$conf);
jump('admin/navbar');
}
include $adminTpl->view('navbar');
break;
//友情链接
case 'link':
if($method == 'POST'){
$conf['link'] = post('link','str','');
dbSave('conf',$conf);
jump('admin/link');
}
include $adminTpl->view('link');
break;
//基础设置
case 'setting':
$tplList = getTpl();
if($method == 'POST'){
$conf['title'] = post('title','str','');
$conf['name'] = post('name','str','');
$conf['intro'] = post('intro','str','');
$conf['mood'] = post('mood','str','');
$conf['key'] = post('key','str','');
$conf['desc'] = post('desc','str','');
$conf['brief'] = post('brief','int',0);
$conf['password'] = post('password','str',$conf['password']);
$compile = post('compile','bool');
if($compile !== $conf['compile']){
$conf['compile'] = $compile;
delCompile();
}
$conf['debug'] = post('debug','int',$conf['debug']);
$rewrite = post('rewrite','bool');
if($rewrite !== $conf['rewrite']){
$conf['rewrite'] = $rewrite;
delCompile();
}
$conf['comment']['restrict'] = post('commentRestrict','int',$conf['comment']['restrict']);
$conf['comment']['paging'] = post('commentPaging','int',$conf['comment']['paging']);
$conf['article']['paging'] = post('articlePaging','int',$conf['article']['paging']);
$conf['vcode']['open'] = post('vcodeOpen','bool',false);
$conf['vcode']['width'] = post('vcodeWidth','int',80);
$conf['vcode']['height'] = post('vcodeHeight','int',32);
$conf['vcode']['length'] = post('vcodeLength','int',4);
$conf['icp'] = post('icp','str','');
$conf['views'] = post('views','int',0);
$conf['blacklist'] = post('blacklist','str','');
$conf['js'] = post('js','str','');
dbSave('conf',$conf);
jump('admin/setting');
}
include $adminTpl->view('setting');
break;
//编译模板
case 'compile':
delCompile();
jump('admin/tpl');
break;
//主题管理
case 'tpl':
$tpl = getTpl();
$tplPage = get(2,'str');
$tplId = get(3,'str');
if($tplId && isset($tpl['list'][$tplId])){
if($tplPage == 'install'){
$conf = db('conf');
$conf['tpl'] = $tplId;
dbSave('conf',$conf);
}
elseif($tplPage == 'delete'){
include LIB.'file.util.class.php';
$util = new fileUtil();
$util->delete(ROOT.'tpl/'.$tplId);
}
elseif($tplPage == 'download'){
$sx = sx(ROOT.'tpl/'.$tplId);
echo $sx;
exit;
}
jump('admin/tpl');
}
include $adminTpl->view('tpl');
break;
//扩展管理
case 'ext':
$ext = getExt();
$extPage = get(2,'str');
$extId = get(3,'str');
$extList = db('ext');
if($extId && isset($ext['list'][$extId])){
$extConfPath = EXT.$extId.'/conf.php';
$extConf = include $extConfPath;
if($extPage == 'install'){
if(!in_array($extId,$extList)){
$extList[] = $extId;
dbSave('ext',$extList);
$installPath = EXT.$extId.'/install.php';
if(is_file($installPath)) include $installPath;
}
}
elseif($extPage == 'uninstall'){
if(in_array($extId,$extList)){
array_splice($extList,array_search($extId,$extList),1);
dbSave('ext',$extList);
$uninstallPath = EXT.$extId.'/uninstall.php';
if(is_file($uninstallPath)) include $uninstallPath;
}
}
elseif($extPage == 'delete'){
include LIB.'file.util.class.php';
$util = new fileUtil();
$util->delete(EXT.$extId);
}
elseif($extPage == 'download'){
$sx = sx(EXT.$extId);
echo $sx;
exit;
}
jump('admin/ext');
}
include $adminTpl->view('ext');
break;
//访客
case 'visit':
if(get(2) == 'delete'){
dbSave('visit',[]);
jump('admin/visit');
}
$pageNum = get(2,'int',1);
$pageSize = 30;
$visit = getVisit('admin/visit/{page}', $pageNum, $pageSize);
include $adminTpl->view('visit');
break;
//错误日志
case 'error':
if(get(2) == 'delete'){
dbSave('error',[]);
jump('admin/error');
}
$pageNum = get(2,'int',1);
$pageSize = 30;
$error = getError([],['time'=>1],'admin/error/{page}', $pageNum, $pageSize);
include $adminTpl->view('error');
break;
//其它
default:
prompt('没有这个页面');
}
break;
//其它
default:
$id = get(0,'string');
if(isset($articleList[$id]) && $data = db('article/'.$id,false)){
if($articleList[$id]['private'] && !LOGIN){
prompt('游客无法访问私密文章,请登录!');
}
}else{
prompt('没有该数据');
}
$page = 'page';
$article = $articleList[$id];
$article['id'] = $id;
$article['tag'] = $articleList[$id]['tag'];
//网站描述和标题
$conf['desc'] = $article['intro'];
$conf['title'] = $conf['title'].'-'.$articleList[$id]['title'];
$fk = new fk($data);
$article['content'] = $fk->html;
//留言板
$pageNum = get(1,'int',1);
$pageSize = $conf['comment']['paging'];
$comment = getComment($id,[],[],$id.'/{page}',$pageNum,$pageSize);
//更新浏览量
if(!in_array($id,$_SESSION['views'])){
$_SESSION['views'][]=$id;
$articleList[$id]['views'] += 1;
dbSave('article',$articleList);
}
include $tpl->view('page');
}
?>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。