siteMap();}
if(MOD == 's'){$this->shareView(ST);}
}
public function makeFooter(){
$powerBy = LNG("common.copyright.powerBy");
$homePage = str_replace('%s',APP_HOST,LNG('common.copyright.homepage'));
$isKeep = _get($this->in,'keep') == '1' ? 'keep=1':null;
$siteMap = urlApi('sitemap',$isKeep);
$link = 'https://github.com/kalcaddle/kodbox';
$html = "
\n\t";
echo $html;
}
/**
* 搜索引擎抓取:
* 1. 外链分享列表;分页处理;
* 2. 外链分享文件概览,文件夹子文件 (文本文件内容截取10k);
* 3. 外链分享文件夹列表;
*/
public function siteMap(){
if($this->config['settings']['allowSEO'] != 1){ // keep=1
header('HTTP/1.1 404 Not Found');
return show_tips("Not allow robots!");
}
if(!defined("USER_ID")){define("USER_ID",0);}
switch(ST){
case 'index': $this->shareList();exit;break;
case 'share': $this->shareView(ACT);exit;break;
case 'file' : $this->shareFileOut();exit;break;
default: break;
}
}
private function displayContent($html,$link=''){
if(!$html) return;
$link = $link ? $link : APP_HOST;
$location = '';
$GLOBALS['templateContent'] = "
".LNG('common.download')."
".LNG('explorer.share.errorShowTips')."
";
}
}else{
$html .= $this->shareViewFolder($shareInfo,$pathInfo);
}
$this->displayContent($html,$linkTrue);
}
private function shareFileOut(){
$shareInfo= Model('Share')->getInfoByHash(ACT);
$error = $this->shareCheck($shareInfo);
if($error) return $this->displayError($error);
$viewPath = trim(_get($this->in,'view',''),'/');
$sourcePath = $shareInfo['sourcePath'].'/'.$viewPath;
$pathInfo = IO::infoFullSimple($sourcePath);
if(!$pathInfo) return $this->displayError(LNG('common.pathNotExists'));
IO::fileOut($pathInfo['path']);exit;
}
private function shareViewFolder($shareInfo,$pathInfo){
$pathPre = _get($shareInfo['sourceInfo'],'pathDisplay',$shareInfo['sourceInfo']['path']);
$list = IO::listPath($pathInfo['path']);
$fileList = KodSort::arraySort($list['fileList'],'name');
$folderList = KodSort::arraySort($list['folderList'],'name');
$listAll = array_merge($folderList,$fileList);
$listAll = array_slice($listAll,0,2000);
$listHtml = '';
foreach ($listAll as $pathInfo){
$pathDisplay = _get($pathInfo,'pathDisplay',$pathInfo['path']);
if(substr($pathDisplay,0,strlen($pathPre)) != $pathPre) continue;
$viewPath = substr($pathDisplay,strlen($pathPre));
$link = $this->shareLink($shareInfo,$viewPath);
$time = date('Y-m-d H:i',$pathInfo['createTime']);
$size = size_format($pathInfo['size']);
$size = $pathInfo['type'] != 'folder' || $pathInfo['size'] ? $size:'';
$ext = $pathInfo['type'] == 'folder' ? 'folder' : $pathInfo['ext'];
$listHtml .= "