Skip to content

Commit

Permalink
version 4.25 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
kalcaddle committed Dec 1, 2017
1 parent c843158 commit 7c53d60
Show file tree
Hide file tree
Showing 283 changed files with 6,535 additions and 5,642 deletions.
546 changes: 292 additions & 254 deletions ChangeLog.md

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
- [中文文档](http://kodcloud.com/#lang=zh_CN)
- [Donate](https://www.paypal.me/kalcaddle)

### Source code
----
- [github](https://github.com/kalcaddle/KodExplorer)
- [gitee](https://gitee.com/kalcaddle/KODExplorer)

# Features
- Use experience like operating system, Rich context menu and toolbar, drag and drop, shortcut keys......
- Available in more than 40 languages.
Expand Down Expand Up @@ -169,8 +174,10 @@ kod is made possible by the following open source projects.
* ...



# License
kodcloud is issued under GPLv3. license.[License](http://kodcloud.com/tools/licenses/license.txt)
Contact: kalcaddle#qq.com
Contact: warlee#kodcloud.com
Copyright (C) 2013 kodcloud.com

# 版权声明
kodexplorer 使用 GPL v3 协议.
24 changes: 13 additions & 11 deletions app/api/sso.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ static private function init(){
$sessionID = $_COOKIE[$sessionName]?$_COOKIE[$sessionName]:md5(uniqid());
$basicPath = dirname(dirname(dirname(__FILE__))).'/';
$sessionPath = $basicPath.'data/session/';
if(file_exists($basicPath.'define.php')){
include($basicPath.'define.php');
if(file_exists($basicPath.'config/define.php')){
include($basicPath.'config/define.php');
$sessionPath = DATA_PATH.'session/';
}
if(!file_exists($sessionPath)){
Expand Down Expand Up @@ -78,12 +78,16 @@ static public function sessionAuth($appKey,$auth,$kodHost='',$appUrl=''){
if(strstr($appUrl,'/plugins/')){
$kodHost = substr($appUrl,0,strpos($appUrl,'/plugins/'));
}else{
$kodHost = $_SERVER['HTTP_REFERER'];
if(strstr($kodHost,'/index.php?')){
$kodHost = substr($kodHost,0,strpos($kodHost,'/index.php?'));
}else if(strstr($kodHost,'/?')){
$kodHost = substr($kodHost,0,strpos($kodHost,'/?'));
}
if(isset($_COOKIE['APP_HOST'])){
$kodHost = $_COOKIE['APP_HOST'];
}else{
$kodHost = $_SERVER['HTTP_REFERER'];
if(strstr($kodHost,'/index.php?')){
$kodHost = substr($kodHost,0,strpos($kodHost,'/index.php?'));
}else if(strstr($kodHost,'/?')){
$kodHost = substr($kodHost,0,strpos($kodHost,'/?'));
}
}
}
}
$authUrl = rtrim($kodHost,'/').'/index.php?user/sso&app='.$appKey.'&'.$auth;
Expand All @@ -96,6 +100,4 @@ static public function sessionAuth($appKey,$auth,$kodHost='',$appUrl=''){
exit;
}
}
}


}
9 changes: 4 additions & 5 deletions app/controller/editor.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ private function themeSet(){
public function fileGet(){
if(isset($this->in['fileUrl'])){
$pass = $this->config['settingSystem']['systemPassword'];
$fileUrl = _DIR_CLEAR($this->in['fileUrl']);
$fileUrl = str_replace(':/','://',$fileUrl);
$fileUrl = $this->in['fileUrl'];
if(!request_url_safe($fileUrl)){
show_json(LNG('url error!'),false);
}
$urlInfo = parse_url_query($fileUrl);
if( isset($urlInfo['fid']) &&
strlen(Mcrypt::decode($urlInfo['fid'],$pass)) != 0
Expand All @@ -58,9 +60,6 @@ public function fileGet(){
$displayName = rawurldecode($urlInfo['downFilename']);
}
}else{
if(is_file($filepath) || substr($filepath,0,4) != 'http'){
show_json(LNG('not url'),false);
}
$displayName = rawurldecode($urlInfo['name']);
$filepath = $fileUrl.'&accessToken='.access_token_get();
}
Expand Down
59 changes: 40 additions & 19 deletions app/controller/explorer.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function pathInfo(){
if (count($infoList)==1 && $infoList[0]['type']!='folder') {//单个文件
$file = $infoList[0]['path'];
if( $GLOBALS['isRoot'] ||
$GLOBALS['auth']["explorer.fileDownloa"]==1 ||
$GLOBALS['auth']["explorer.fileDownload"]==1 ||
isset($this->in['viewPage'])){
$data['downloadPath'] = _make_file_proxy($file);
}
Expand Down Expand Up @@ -156,16 +156,28 @@ public function mkdir(){
}
$new = rtrim($this->path,'/');
$new = get_filename_auto($new,'',$repeatType);//已存在处理 创建副本
Hook::trigger("explorer.mkdirBefore",$new);
if(mk_dir($new,DEFAULT_PERRMISSIONS)){
chmod_path($new,DEFAULT_PERRMISSIONS);
Hook::trigger("explorer.mkdirAfter",$new);
if($this->_mkdir($new)){
show_json(LNG('create_success'),true,_DIR_OUT(iconv_app($new)) );
}else{
show_json(LNG('create_error'),false);
}
}

private function _mkdir($path){
if(!$GLOBALS['isRoot']){
//IIS6 解析漏洞 /a.php/2.jpg 得到解析
$temp = str_replace('\\','/',$path);
if(substr(rtrim($temp,'/'),-4) == '.php'){
show_json(LNG('no_permission_ext'),false);
}
}
Hook::trigger("explorer.mkdirBefore",$path);
if(mk_dir($path,DEFAULT_PERRMISSIONS)){
chmod_path($path,DEFAULT_PERRMISSIONS);
Hook::trigger("explorer.mkdirAfter",$path);
return true;
}
return false;
}
public function pathRname(){
$rnameTo=_DIR($this->in['rnameTo']);
if (file_exists_case($rnameTo)) {
Expand Down Expand Up @@ -964,9 +976,8 @@ public function unzip(){
$unzipToAdd = $name;
}

//所在目录不可写
mk_dir($unzipTo);
if (!path_writeable($unzipTo)){
$this->_mkdir($unzipTo);
if (!path_writeable($unzipTo)){//所在目录不可写
show_json(LNG('no_permission_write'),false);
}
$unzipTo = $unzipTo.$unzipToAdd;
Expand Down Expand Up @@ -1007,7 +1018,15 @@ public function imageRotate(){
}
//缩略图
public function image(){
if (filesize($this->path) <= 1024*50 ||
$thumbWidth = 250;
if(isset($this->in['thumbWidth'])){
$thumbWidth = intval($this->in['thumbWidth']);//自定义预览大图
}
if(substr($this->path,0,4) == 'http'){
header('Location: '.$this->in['path']);
exit;
}
if (@filesize($this->path) <= 1024*50 ||
!function_exists('imagecolorallocate') ) {//小于50k或者不支持gd库 不再生成缩略图
file_put_out($this->path,false);
return;
Expand All @@ -1016,17 +1035,17 @@ public function image(){
mk_dir(DATA_THUMB);
}
$image = $this->path;
$imageMd5 = @md5_file($image);//文件md5
$imageMd5 = @md5_file($image).'_'.$thumbWidth;//文件md5
if (strlen($imageMd5)<5) {
$imageMd5 = md5($image);
$imageMd5 = md5($image).'_'.$thumbWidth;
}
$imageThumb = DATA_THUMB.$imageMd5.'.png';
if (!file_exists($imageThumb)){//如果拼装成的url不存在则没有生成过
if (get_path_father($image)==DATA_THUMB){//当前目录则不生成缩略图
$imageThumb=$this->path;
}else {
$cm = new ImageThumb($image,'file');
$cm->prorate($imageThumb,250,250);//生成等比例缩略图
$cm->prorate($imageThumb,$thumbWidth,$thumbWidth);//生成等比例缩略图
}
}
if (!file_exists($imageThumb) ||
Expand Down Expand Up @@ -1063,7 +1082,7 @@ public function serverDownload() {
}
//下载
$savePath = _DIR(rawurldecode($this->in['savePath']));
mk_dir($savePath);
$this->_mkdir($savePath);
if (!$savePath || !path_writeable($savePath)){
show_json(LNG('no_permission_write'),false);
}
Expand All @@ -1078,7 +1097,7 @@ public function serverDownload() {
$filename = $header['name'];
}

$saveFile = $savePath.$filename;
$saveFile = $savePath._DIR_CLEAR($filename);
if (!checkExt($saveFile)){//不允许的扩展名
$saveFile = $savePath.date('h:i:s').'.dat';
}
Expand Down Expand Up @@ -1136,7 +1155,7 @@ public function fileUpload(){
$fullPath = _DIR_CLEAR(rawurldecode($this->in['fullPath']));
$fullPath = get_path_father($fullPath);
$fullPath = iconv_system($fullPath);
if (mk_dir($savePath.$fullPath)) {
if ($this->_mkdir($savePath.$fullPath)) {
$savePath = $savePath.$fullPath;
}
}
Expand All @@ -1162,10 +1181,12 @@ private function _pathShare(&$list){
$value['exists'] = intval(file_exists($thePath));
$value['metaInfo'] = 'path-self-share';
$value['menuType'] = "menu-share-path";
$value['aa'] = $thePath;
if(is_file($thePath)){
$value['size'] = get_filesize($thePath);;
}

//分享列表oexe
if(get_path_ext($value['name']) == 'oexe'){
if(get_path_ext($value['name']) == 'oexe' && is_file($thePath) ){
$json = json_decode(@file_get_contents($thePath),true);
if(is_array($json)) $value = array_merge($value,$json);
}
Expand Down Expand Up @@ -1225,7 +1246,7 @@ private function _pathFav(&$list){
}

//分享列表oexe
if(get_path_ext($val['name']) == 'oexe'){
if(get_path_ext($val['name']) == 'oexe' && is_file($thePath)){
$json = json_decode(@file_get_contents($thePath),true);
if(is_array($json)) $val = array_merge($val,$json);
}
Expand Down
45 changes: 27 additions & 18 deletions app/controller/share.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ public function search(){
public function fileUpload(){
$fileName = $_FILES['file']['name']? $_FILES['file']['name']:$GLOBALS['in']['name'];
$GLOBALS['isRoot']=0;
$GLOBALS['auth']['extNotAllow'] = "php|asp|jsp|html|htm|htaccess";
$GLOBALS['auth']['extNotAllow'] = "htm|html|php|phtml|pwml|asp|aspx|ascx|jsp|pl|htaccess|shtml|shtm|phtm";
if(!checkExt($fileName)){
show_json(LNG('no_permission_ext'),false);
}
Expand Down Expand Up @@ -411,7 +411,7 @@ public function fileUpload(){
//代理输出
public function fileProxy(){
$mime = get_file_mime(get_path_ext($this->path));
if($mime == 'text/plain'){//文本则转编码
if($mime == 'text/plain' && is_file($this->path)){//文本则转编码
$fileContents = file_get_contents($this->path);
$charset=get_charset($fileContents);
if ($charset!='' || $charset!='utf-8') {
Expand Down Expand Up @@ -495,9 +495,8 @@ private function zip($zipPath){
public function fileGet(){
if(isset($this->in['fileUrl'])){ //http
$displayName = $this->in['name'];
$filepath = _DIR_CLEAR($this->in['fileUrl']);
$filepath = str_replace(':/','://',$filepath);
if(is_file($filepath) || substr($filepath,0,4) != 'http'){
$filepath = $this->in['fileUrl'];
if(!request_url_safe($filepath)){
show_json(LNG('url error!'),false);
}
}else{
Expand Down Expand Up @@ -538,31 +537,41 @@ function_exists("mb_convert_encoding")
}

public function image(){
if (filesize($this->path) <= 1024*50 ||
$thumbWidth = 250;
if(isset($this->in['thumbWidth'])){
$thumbWidth = intval($this->in['thumbWidth']);//自定义预览大图
}
if(substr($this->path,0,4) == 'http'){
header('Location: '.$this->in['path']);
exit;
}
if (@filesize($this->path) <= 1024*50 ||
!function_exists('imagecolorallocate') ) {//小于50k或者不支持gd库 不再生成缩略图
file_put_out($this->path);
file_put_out($this->path,false);
return;
}
$image = $this->path;
$image_md5 = @md5_file($image);//文件md5
if (strlen($image_md5)<5) {
$image_md5 = md5($image);
}
$imageThumb = DATA_THUMB.$image_md5.'.png';
if (!is_dir(DATA_THUMB)){
mk_dir(DATA_THUMB);
}
$image = $this->path;
$imageMd5 = @md5_file($image).'_'.$thumbWidth;//文件md5
if (strlen($imageMd5)<5) {
$imageMd5 = md5($image).'_'.$thumbWidth;
}
$imageThumb = DATA_THUMB.$imageMd5.'.png';
if (!file_exists($imageThumb)){//如果拼装成的url不存在则没有生成过
if (get_path_father($image)==DATA_THUMB){//当前目录则不生成缩略图
$imageThumb = $this->path;
$imageThumb=$this->path;
}else {
$cm=new ImageThumb($image,'file');
$cm->prorate($imageThumb,224,200);//生成等比例缩略图
$cm = new ImageThumb($image,'file');
$cm->prorate($imageThumb,$thumbWidth,$thumbWidth);//生成等比例缩略图
}
}
if (!file_exists($imageThumb) || filesize($imageThumb)<100){//缩略图生成失败则用默认图标
$imageThumb = $this->path;
if (!file_exists($imageThumb) ||
filesize($imageThumb)<100){//缩略图生成失败则使用原图
$imageThumb=$this->path;
}
file_put_out($imageThumb,false);
file_put_out($imageThumb);//输出
}

Expand Down
2 changes: 1 addition & 1 deletion app/controller/systemMember.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ public function edit() {
unset($userInfo['homePath']);
}
if($this->sql->set($userID,$userInfo)){
self::spaceChange($userID);//重置用户使用空间
//self::spaceChange($userID);//重置用户使用空间
show_json(LNG('success'),true,$userInfo);
}
show_json(LNG('error_repeat'),false);
Expand Down
Loading

0 comments on commit 7c53d60

Please sign in to comment.