version 4.38 release
parent
ae89910dc9
commit
4bdfcd6005
11
ChangeLog.md
11
ChangeLog.md
|
@ -1,3 +1,13 @@
|
|||
### ver4.38 `2019/2/25`
|
||||
-----
|
||||
#### update:
|
||||
- 针对移动端APP进行兼容适配优化
|
||||
- 部门列表过多时,排序效率优化。
|
||||
- https请求优化兼容
|
||||
- cad分享无法预览问题解决
|
||||
- 新增hook点
|
||||
- 其他细节优化
|
||||
|
||||
### ver4.37 `2018/11/28`
|
||||
-----
|
||||
#### update:
|
||||
|
@ -28,7 +38,6 @@
|
|||
- 插件配置:文件选择组件支持配置参数;同文件选择组件参数;插件表单组件formMake增强
|
||||
- 断点续传分片重传加入延时;断网等类似情况下15s内自动上传
|
||||
- 通用前端worker调用支持
|
||||
- 分享的的失效时间可以设置当前时间前
|
||||
- 分享的的失效时间是否可以设置到分钟
|
||||
- 分享后设置禁止下载,禁用打开方式等相关操作
|
||||
- https的curl请求加入ssl版本声明;兼容性调整
|
||||
|
|
|
@ -917,7 +917,7 @@ class explorer extends Controller{
|
|||
file_put_out($this->path,true);
|
||||
}
|
||||
//文件下载后删除,用于文件夹下载
|
||||
public function fileDownloadRemove(){
|
||||
public function fileDownloadRemove(){
|
||||
$path = get_path_this(_DIR_CLEAR($this->in['path']));
|
||||
$path = iconv_system(USER_TEMP.$path);
|
||||
$fileName = substr(get_path_this($path),10);//前10个字符为随机前缀
|
||||
|
@ -1167,6 +1167,11 @@ class explorer extends Controller{
|
|||
//通用预览
|
||||
public function fileView(){
|
||||
Hook::trigger("explorer.fileViewStart",$this->path);
|
||||
if(!isset($this->in['path'])){
|
||||
show_tips('参数错误!');
|
||||
}
|
||||
$this->tpl = TEMPLATE.'api/';
|
||||
$this->display('view.html');
|
||||
}
|
||||
//通用保存
|
||||
public function fileSave(){
|
||||
|
|
|
@ -30,7 +30,7 @@ class pluginApp extends Controller{
|
|||
if(!$_SESSION['kodLogin']){
|
||||
show_tips("出错了!您尚未登录",APP_HOST,3);
|
||||
}
|
||||
show_tips("出错了!插件未开启,或您没有{$app}插件的权限");
|
||||
show_tips("出错了!插件未开启,或您没有{$app}插件的权限!");
|
||||
}
|
||||
|
||||
$appConfig = $model->getConfig($app);
|
||||
|
@ -63,7 +63,7 @@ class pluginApp extends Controller{
|
|||
return false;
|
||||
}
|
||||
$share = KOD_USER_SHARE;
|
||||
if(substr($this->in['path'],0,strlen($share)) == $share){
|
||||
if(substr(urldecode($this->in['path']),0,strlen($share)) == $share){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -197,6 +197,7 @@ class pluginApp extends Controller{
|
|||
"versionHash" => $this->config['settingSystem']['versionHash'],
|
||||
"systemOS" => $this->config['systemOS'],
|
||||
"phpVersion" => PHP_VERSION,
|
||||
"channel" => INSTALL_CHANNEL,
|
||||
"lang" => I18n::getType()
|
||||
);
|
||||
$info = url_request($api,'POST',$param);
|
||||
|
|
|
@ -249,6 +249,10 @@ class share extends Controller{
|
|||
'ACT' => $this->in['act'],
|
||||
);
|
||||
|
||||
if(ST.''.ACT == 'explorer.fileView'){
|
||||
unset($theConfig['sharePage']);
|
||||
}
|
||||
|
||||
$userConfig = $GLOBALS['config']['settingDefault'];
|
||||
if(isset($this->in['user'])){
|
||||
$member = systemMember::loadData();
|
||||
|
|
|
@ -139,7 +139,7 @@ class user extends Controller{
|
|||
$GLOBALS['isRoot'] = 0;
|
||||
}
|
||||
|
||||
define('DESKTOP_FOLDER',$this->config['settingSystemDefault']['desktopFolder']);
|
||||
define('DESKTOP_FOLDER',$this->config['settingSystem']['desktopFolder']);
|
||||
$this->config['user'] = FileCache::load(USER.'data/config.php');
|
||||
|
||||
if(!is_array($this->config['user'])){
|
||||
|
@ -309,6 +309,22 @@ class user extends Controller{
|
|||
}
|
||||
echo 'LNG='.$lang.';G.useTime='.$useTime.';';
|
||||
}
|
||||
public function appConfig(){
|
||||
$theConfig = array(
|
||||
'lang' => I18n::getType(),
|
||||
'isRoot' => $GLOBALS['isRoot'],
|
||||
'userID' => $this->user['userID'],
|
||||
'myhome' => MYHOME,
|
||||
'settings' => array(
|
||||
'updloadChunkSize' => file_upload_size(),
|
||||
'updloadThreads' => $this->config['settings']['updloadThreads'],
|
||||
'uploadCheckChunk' => $this->config['settings']['uploadCheckChunk'],
|
||||
),
|
||||
'version' => KOD_VERSION,
|
||||
// 'userConfig' => $this->config['user'],
|
||||
);
|
||||
show_json($theConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录view
|
||||
|
@ -425,7 +441,7 @@ class user extends Controller{
|
|||
|
||||
//首次登陆,初始化app 没有最后登录时间
|
||||
$this->_loginSuccess($user);//登陆成功
|
||||
if($user['lastLogin'] == ''){
|
||||
if(!$user['lastLogin']){
|
||||
$app = init_controller('app');
|
||||
$app->initApp($user);
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -93,16 +93,17 @@ function str_trim($str,$remove){
|
|||
return str_rtrim(str_ltrim($str,$remove),$remove);
|
||||
}
|
||||
function str_ltrim($str,$remove){
|
||||
if(!$str || !$remove) return false;
|
||||
if(!$str || !$remove) return $str;
|
||||
while(substr($str,0,strlen($remove)) == $remove){
|
||||
$str = substr($str,strlen($remove));
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
function str_rtrim($str,$remove){
|
||||
if(!$str || !$remove) return false;
|
||||
if(!$str || !$remove) return $str;
|
||||
while(substr($str,-strlen($remove)) == $remove){
|
||||
$str = substr($str,0,-strlen($remove));
|
||||
echo $str;
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
|
|
@ -657,83 +657,14 @@ function dir_list($path){
|
|||
return array_merge($dirs,$files);
|
||||
}
|
||||
|
||||
/**
|
||||
* 借用临时文件方式对读写文件进行锁定标记
|
||||
*
|
||||
* fopen mode: http://www.w3school.com.cn/php/func_filesystem_fopen.asp
|
||||
* flock mode: http://www.w3school.com.cn/php/func_filesystem_flock.asp
|
||||
*/
|
||||
function file_lock($file,$open=true,$type='read',$timeout=5){
|
||||
clearstatcache();
|
||||
$lockFile = $file.'.'.$type.'.lock';
|
||||
$lockRead = $file.'.read.lock';
|
||||
$lockWrite = $file.'.write.lock';
|
||||
if(!$open){
|
||||
@unlink($lockFile);
|
||||
clearstatcache();
|
||||
return;
|
||||
}
|
||||
|
||||
$startTime = microtime(true);
|
||||
do{
|
||||
clearstatcache();
|
||||
$canLock = true;
|
||||
if( $type=='read' ){
|
||||
if( file_exists($lockWrite) ){
|
||||
$canLock = false;
|
||||
}
|
||||
}else if( $type=='write' ){
|
||||
if( file_exists($lockWrite) || file_exists($lockRead) ){
|
||||
$canLock = false;
|
||||
}
|
||||
}
|
||||
if(!$canLock){
|
||||
usleep(mt_rand(10, 50) * 1000);//10~50ms;
|
||||
}
|
||||
} while((!$canLock) && ((microtime(true) - $startTime) < $timeout ));
|
||||
$result = false;
|
||||
if($canLock){
|
||||
$result = file_put_contents($lockFile,time(),LOCK_EX);
|
||||
clearstatcache();
|
||||
$result = $result && file_exists($lockFile);
|
||||
//if(!$result){write_log($_GET['action'].';file not exists','test2');}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// 安全读取文件,避免并发下读取数据为空
|
||||
function file_read_safe1($file,$timeout = 5){
|
||||
if(file_lock($file,true,'read',$timeout)){
|
||||
$fp = @fopen($file, 'r');
|
||||
if(!$fp || !flock($fp, LOCK_EX)) return false;
|
||||
$result = fread($fp, filesize($file));
|
||||
flock($fp,LOCK_UN);fclose($fp);
|
||||
|
||||
file_lock($file,false,'read');
|
||||
return $result;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// 安全读取文件,避免并发下读取数据为空
|
||||
function file_wirte_safe1($file,$buffer,$timeout=5){
|
||||
if(file_lock($file,true,'write',$timeout)){
|
||||
$result = @file_put_contents($file,$buffer,LOCK_EX);
|
||||
file_lock($file,false,'write');
|
||||
return $result;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// 安全读取文件,避免并发下读取数据为空
|
||||
function file_read_safe($file,$timeout = 5){
|
||||
//return file_read_safe1($file,$timeout);
|
||||
function file_read_safe($file,$timeout = 3){
|
||||
if(!$file || !file_exists($file)) return false;
|
||||
$fp = @fopen($file, 'r');
|
||||
if(!$fp) return false;
|
||||
$startTime = microtime(true);
|
||||
do{
|
||||
$locked = flock($fp, LOCK_EX|LOCK_NB);//LOCK_EX|LOCK_NB
|
||||
$locked = flock($fp, LOCK_SH);//LOCK_EX|LOCK_NB
|
||||
if(!$locked){
|
||||
usleep(mt_rand(1, 50) * 1000);//1~50ms;
|
||||
}
|
||||
|
@ -753,8 +684,7 @@ function file_read_safe($file,$timeout = 5){
|
|||
}
|
||||
|
||||
// 安全读取文件,避免并发下读取数据为空
|
||||
function file_wirte_safe($file,$buffer,$timeout=5){
|
||||
//return file_wirte_safe1($file,$buffer,$timeout);
|
||||
function file_wirte_safe($file,$buffer,$timeout=3){
|
||||
clearstatcache();
|
||||
if(strlen($file) == 0 || !$file || !file_exists($file)) return false;
|
||||
$fp = fopen($file,'r+');
|
||||
|
@ -1069,21 +999,11 @@ function file_put_out($file,$download=-1,$downFilename=false){
|
|||
}
|
||||
|
||||
$mime = get_file_mime(get_path_ext($filename));
|
||||
$filenameOutput = rawurlencode(iconv_app($filename));
|
||||
if ($download === -1 && !mime_support($mime)){
|
||||
$download = true;
|
||||
}
|
||||
$headerName = $filenameOutput;
|
||||
if(ua_has("Chrome") && !ua_has('Edge')){ //chrome下载
|
||||
$filenameOutput = '"'.$filenameOutput.'"';
|
||||
}
|
||||
if(!is_wap()){
|
||||
$headerName.=";filename*=utf-8''".$filenameOutput;
|
||||
}
|
||||
if( ua_has("Safari") && !ua_has('Edge')){//safari 中文下载问题
|
||||
$headerName = rawurldecode($filenameOutput);
|
||||
}
|
||||
//var_dump($headerName,$filenameOutput,$_SERVER['HTTP_USER_AGENT']);exit;
|
||||
$headerName = rawurlencode(iconv_app($filename));
|
||||
$headerName = '"'.$headerName."\"; filename*=utf-8''".$headerName;
|
||||
if ($download) {
|
||||
header('Content-Type: application/octet-stream');
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
|
|
|
@ -133,7 +133,7 @@ function serverInfo(){
|
|||
"php" => floatval(PHP_VERSION),
|
||||
"server"=> $_SERVER['SERVER_SOFTWARE'],
|
||||
"lib" => $libStr,
|
||||
"info" => php_uname().';phpv='.PHP_VERSION,
|
||||
"info" => php_uname().';php='.PHP_VERSION,
|
||||
);
|
||||
$result = str_replace("\/","@",json_encode($env));
|
||||
return $result;
|
||||
|
|
|
@ -361,7 +361,7 @@ function url_request($url,$method='GET',$data=false,$headers=false,$options=fals
|
|||
curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
curl_setopt($ch, CURLOPT_SSLVERSION,1);//1|5|6; http://t.cn/RZy5nXF
|
||||
// curl_setopt($ch, CURLOPT_SSLVERSION,1);//1|5|6; http://t.cn/RZy5nXF
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT,$timeout);
|
||||
curl_setopt($ch, CURLOPT_REFERER,get_url_link($url));
|
||||
curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.94 Safari/537.36');
|
||||
|
|
|
@ -22,19 +22,18 @@ class Downloader {
|
|||
if(!$url){
|
||||
return array('code'=>false,'data'=>'url error!');
|
||||
}
|
||||
|
||||
//默认下载方式if not support range
|
||||
if(!$fileHeader['supportRange'] ||
|
||||
$fileHeader['length'] == 0 ){
|
||||
@unlink($saveTemp);
|
||||
@unlink($saveFile);
|
||||
@unlink($saveTemp);@unlink($saveFile);
|
||||
$result = self::fileDownloadFopen($url,$saveFile,$fileHeader['length']);
|
||||
if($result['code']) {
|
||||
return $result;
|
||||
}else{
|
||||
@unlink($saveTemp);
|
||||
@unlink($saveFile);
|
||||
return self::fileDownloadCurl($url,$saveFile,false,0,$fileHeader['length']);
|
||||
@unlink($saveTemp);@unlink($saveFile);
|
||||
$result = self::fileDownloadCurl($url,$saveFile,false,0,$fileHeader['length']);
|
||||
@unlink($saveTemp);@unlink($saveFile);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,7 +105,7 @@ class Downloader {
|
|||
if($headerSize != 0 && $filesize != $headerSize){
|
||||
return array('code'=>false,'data'=>'file size error');
|
||||
}
|
||||
|
||||
self::checkGzip($fileTemp);
|
||||
if(!@rename($fileTemp,$fileName)){
|
||||
usleep(round(rand(0,1000)*50));//0.01~10ms
|
||||
@unlink($fileName);
|
||||
|
@ -152,6 +151,7 @@ class Downloader {
|
|||
}
|
||||
|
||||
if($res && filesize($fileTemp) != 0){
|
||||
self::checkGzip($fileTemp);
|
||||
if(!@rename($fileTemp,$fileName)){
|
||||
@unlink($fileName);
|
||||
$res = @rename($fileTemp,$fileName);
|
||||
|
@ -166,4 +166,15 @@ class Downloader {
|
|||
return array('code'=>false,'data'=>'file create error');
|
||||
}
|
||||
}
|
||||
|
||||
static function checkGzip($file){
|
||||
$char = "\x1f\x8b";
|
||||
$str = file_sub_str($file,0,2);
|
||||
if($char != $str) return;
|
||||
|
||||
ob_start();
|
||||
readgzfile($file);
|
||||
$out = ob_get_clean();
|
||||
file_put_contents($file,$out);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ class I18n{
|
|||
$lang = "en";
|
||||
$arr = $GLOBALS['config']['settingAll']['language'];
|
||||
$langs = array();
|
||||
if(!$arr) return 'zh-CN';
|
||||
foreach ($arr as $key => $value) {
|
||||
$langs[$key] = $key;
|
||||
}
|
||||
|
|
|
@ -243,11 +243,12 @@ class kodRarArchive {
|
|||
|
||||
// 不允许双引号
|
||||
function escapeShell($param){
|
||||
return escapeshellarg($param);
|
||||
//$param = escapeshellarg($param);
|
||||
$os = strtoupper(substr(PHP_OS, 0,3));
|
||||
if ( $os != 'WIN' && $os != 'DAR') {//linux
|
||||
$param = str_replace('!','\!',$param);
|
||||
}
|
||||
$param = rtrim($param,"\\");
|
||||
return '"'.str_replace(array('"',"\0"),'_',$param).'"';
|
||||
return '"'.str_replace(array('"',"\0",'`'),'_',$param).'"';
|
||||
}
|
||||
|
|
|
@ -177,6 +177,9 @@ class pluginModel{
|
|||
$list = $this->loadData();
|
||||
$result = array();
|
||||
foreach ($list as $key => $item) {
|
||||
if(!plugin_check_allow($key)){
|
||||
continue;
|
||||
}
|
||||
unset($item['regiest']);
|
||||
$package = Hook::apply($item['id'].'Plugin.appPackage');
|
||||
if(is_array($package)){
|
||||
|
|
|
@ -76,10 +76,11 @@
|
|||
<script type="text/javascript">
|
||||
G.shareInfo = {
|
||||
path:"<?php echo $_GET['path'];?>",
|
||||
name:"<?php echo $name;?>",
|
||||
name:"<?php echo get_path_this($_GET['path']);?>",
|
||||
mtime:0,
|
||||
size:0
|
||||
}
|
||||
<?php if(ST.'.'.ACT == 'explorer.fileView'){echo "G.shareInfo.view = true;";}?>
|
||||
G['accessToken'] = "<?php echo access_token_get();?>";
|
||||
seajs.config({
|
||||
base: "<?php echo STATIC_PATH;?>js/",
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<script type="text/javascript" src="<?php echo STATIC_PATH;?>js/lib/seajs/sea.js?ver=<?php echo KOD_VERSION;?>"></script>
|
||||
<?php
|
||||
//commonjs
|
||||
Hook::trigger('templateCommonFooter');
|
||||
if(ST == 'share' || isset($GLOBALS['loadCommonJs'])){
|
||||
if(isset($_GET['user'])){
|
||||
$userInfo = '&user='.clear_html($_GET['user']).'&sid='.clear_html($_GET['sid']);
|
||||
|
@ -45,3 +44,4 @@
|
|||
]
|
||||
});
|
||||
</script>
|
||||
<?php Hook::trigger('templateCommonFooter');?>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<?php Hook::trigger('templateCommonHeaderStart'); ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
<?php include(TEMPLATE.'common/header.html');?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<link href="<?php echo STATIC_PATH;?>style/common.css?ver=<?php echo KOD_VERSION;?>" rel="stylesheet"/>
|
||||
<link href="./static/style/font-awesome/css/font-awesome.css?ver=<?php echo KOD_VERSION;?>" rel="stylesheet">
|
||||
<title><?php echo $title;?></title>
|
||||
<script type="text/javascript" src="<?php echo STATIC_PATH;?>js/lib/jquery-1.8.0.min.js?ver=<?php echo KOD_VERSION;?>"></script>
|
||||
<style type="text/css">
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
$error = php_env_check();
|
||||
$login = LNG('login');
|
||||
if ($error=='') {
|
||||
echo '<div class="success"><h4>Successful!</h4>';
|
||||
echo '<div class="success">';
|
||||
}else{
|
||||
echo '<div class="error"><h4>error:</h4>'.$error."<br/>";
|
||||
$login = LNG('php_env_error_ignore');
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
<div class="inputs admin-password"><input type="text" placeholder="LICENSE KEY" autocomplete="off"/></div>
|
||||
<a href="javascript:void(0);" class="LICENSE_SUBMIT btn btn-primary">注册授权</a>
|
||||
<div class="links">
|
||||
<a href="./index.php?user/versionInstall&reset=1" class="btn btn-link"><?php echo LNG('use_free');?></a>
|
||||
<a href="http://kodcloud.com/buy.html#<?php echo I18n::getType();?>" target="_blank" class="btn btn-link"><?php echo LNG('learn_more');?></a>
|
||||
<a href="./index.php?user/versionInstall&reset=1" class="btn btn-link license-use-free"><?php echo LNG('use_free');?></a>
|
||||
<a href="http://kodcloud.com/buy.html#<?php echo I18n::getType();?>" target="_blank" class="btn btn-link license-learn-more"><?php echo LNG('learn_more');?></a>
|
||||
</div>
|
||||
<br/>
|
||||
</div>
|
||||
|
|
|
@ -108,7 +108,6 @@ if (file_exists(BASIC_PATH.'config/setting_user.php')) {
|
|||
if(file_exists(CONTROLLER_DIR.'debug.class.php')){
|
||||
include_once(CONTROLLER_DIR.'debug.class.php');
|
||||
}
|
||||
|
||||
init_common();
|
||||
$config['autorun'] = array(
|
||||
array('controller'=>'user','function'=>'loginCheck'),
|
||||
|
|
|
@ -30,6 +30,10 @@ if($config['systemOS'] == 'windows'){
|
|||
if(strstr($_SERVER['SERVER_SOFTWARE'],'-IIS')){
|
||||
$config['settings']['updloadBindary'] = 0;
|
||||
}
|
||||
//自适应https
|
||||
if(substr(APP_HOST,0,8) == 'https://'){
|
||||
$config['settings']['pluginServer'] = str_replace("http://",'https://',$config['settings']['pluginServer']);
|
||||
}
|
||||
|
||||
$config['settings']['appType'] = array(
|
||||
array('type' => 'tools','name' => 'app_group_tools','class' => 'icon-suitcase'),
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
<?php
|
||||
define('KOD_VERSION','4.37');
|
||||
define('KOD_VERSION','4.38');
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -567,7 +567,6 @@ define(function(require, exports) {
|
|||
{'core.pathClear':coreCode.pathClear},
|
||||
{'core.pathThis':coreCode.pathThis},
|
||||
{'core.pathExt':coreCode.pathExt},
|
||||
{strSortChina:pathTools.strSortChina},
|
||||
{makeTree:makeTree,treeDataSort:treeDataSort,currentFileUrl:currentFileUrl}
|
||||
]);
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -646,92 +646,85 @@ var pathTools = (function(){
|
|||
}
|
||||
};
|
||||
|
||||
var strSortChina = function(a,b){
|
||||
var arr = '0123456789零一二三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟万';//
|
||||
/**
|
||||
* 5000项
|
||||
* sort:a==b?0:(a>b?1:-1) 0.004s
|
||||
* pathTools.strSort(a,b) 5.0s
|
||||
* a.localeCompare(b) 6.0s
|
||||
*
|
||||
* ['3',"1",'2','21','我','月',"二", "四","一","三",'安','巴士','秦','a','b','z','1.a','2.b','3.d','23.f']
|
||||
* ['1.595','1.52e7','1.58e3']
|
||||
* 参考
|
||||
* https://github.com/overset/javascript-natural-sort/blob/master/naturalSort.js
|
||||
*/
|
||||
var strSort = function(a,b){
|
||||
if($.isNumeric(a) && $.isNumeric(b)){
|
||||
a = parseFloat(a);b = parseFloat(b);
|
||||
return a==b?0:(a>b?1:-1);
|
||||
}
|
||||
/*
|
||||
//时间戳排序;耗时操作 为兼容国外时间 ['10-12-2008','10-11-2008','10-11-2007','10-12-2007']
|
||||
var aDate = (new Date(a)).getTime(),bDate = aDate ? (new Date(b)).getTime() : null;
|
||||
if (bDate){
|
||||
return aDate==bDate?0:(aDate>bDate?1:-1);
|
||||
}
|
||||
*/
|
||||
var substrNumber = function(str,from){
|
||||
res = '';
|
||||
for (var i = from; i < str.length; i++) {
|
||||
var char = str.charAt(i);
|
||||
if($.isNumeric(char) || char == '.'){
|
||||
res += char+'';
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return parseFloat(res);
|
||||
}
|
||||
var arr = '零一二三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟万';//
|
||||
for (var i=0;i<Math.max(a.length,b.length);i++){
|
||||
if (a.charAt(i) != b.charAt(i)){
|
||||
var aIndex = arr.indexOf(a.charAt(i));
|
||||
var bIndex = arr.indexOf(b.charAt(i));
|
||||
if(aIndex!=-1 && bIndex!=-1){//有该字符
|
||||
if(aIndex>bIndex){
|
||||
return 1;
|
||||
}else if(aIndex<bIndex){
|
||||
return -1;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}else{//字符比较
|
||||
if(a.charAt(i)>b.charAt(i)){
|
||||
return 1;
|
||||
}else if(a.charAt(i)<b.charAt(i)){
|
||||
return -1;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
var aChar = a.charAt(i),bChar = b.charAt(i);
|
||||
//连续数字时比较数值;
|
||||
if($.isNumeric(aChar) && $.isNumeric(bChar)){
|
||||
var aNum = substrNumber(a,i),bNum = substrNumber(b,i);
|
||||
if(aNum==bNum){
|
||||
i += aNum.toString().length-1;
|
||||
continue;
|
||||
}
|
||||
return aNum>bNum?1:-1;
|
||||
}
|
||||
if( aChar.charCodeAt() < 255 && bChar.charCodeAt() < 255){
|
||||
if(aChar==bChar) continue;
|
||||
return aChar>bChar?1:-1;
|
||||
}
|
||||
var aIndex = arr.indexOf(aChar);
|
||||
var bIndex = arr.indexOf(bChar);
|
||||
if( aIndex!=-1 && bIndex!=-1 ){//有该字符
|
||||
if(aIndex==bIndex) continue;
|
||||
return (aIndex>bIndex?1:-1);
|
||||
}else{
|
||||
//英文字符排在中文字符前
|
||||
if( aChar.charCodeAt() < 255 || bChar.charCodeAt() < 255){
|
||||
if(bChar==bChar) continue;
|
||||
return aChar>bChar?1:-1;
|
||||
}
|
||||
//中文数字排在所有汉字前
|
||||
if(aIndex !=-1 ) return -1;
|
||||
if(bIndex !=-1 ) return 1;
|
||||
return aChar.localeCompare(bChar);//中文按拼音进行排序
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//字符串排序函数 ;222>111,bbb>aaa; bbb(1).txt>bbb(0).txt [bbb(100).txt>bbb(55).txt]
|
||||
//https://github.com/overset/javascript-natural-sort/blob/master/speed-tests.html
|
||||
var strSort = function(a,b){
|
||||
if(a==undefined || b==undefined){
|
||||
return 0;
|
||||
}
|
||||
if($.isNumeric(a) && $.isNumeric(b)){
|
||||
a = parseFloat(a);b = parseFloat(b);
|
||||
return a>b?1:(a==b?0:-1);
|
||||
}
|
||||
var re = /([0-9\.]+)/g, // /(-?[0-9\.]+)/g, 负数 2016-11-09 2016-11-10歧义
|
||||
x = a.toString().toLowerCase() || '',
|
||||
y = b.toString().toLowerCase() || '',
|
||||
nC = String.fromCharCode(0),
|
||||
xN = x.replace( re, nC + '$1' + nC ).split(nC),
|
||||
yN = y.replace( re, nC + '$1' + nC ).split(nC),
|
||||
xD = (new Date(x)).getTime(),
|
||||
yD = xD ? (new Date(y)).getTime() : null;
|
||||
|
||||
if ( yD ){//时间戳排序
|
||||
if ( xD < yD ){
|
||||
return -1;
|
||||
}else if ( xD > yD ){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
for( var cLoc = 0, numS = Math.max(xN.length, yN.length); cLoc < numS; cLoc++ ) {
|
||||
oFxNcL = parseFloat(xN[cLoc]) || xN[cLoc];
|
||||
oFyNcL = parseFloat(yN[cLoc]) || yN[cLoc];
|
||||
if(oFxNcL== oFyNcL){
|
||||
continue;
|
||||
}
|
||||
if(typeof(oFxNcL) == 'string' && typeof(oFyNcL)== 'string'){
|
||||
//自定义字符大小顺序
|
||||
var resultCurrent = strSortChina(oFxNcL,oFyNcL);
|
||||
if(resultCurrent!=0){
|
||||
return resultCurrent;
|
||||
}
|
||||
}else{
|
||||
if (oFxNcL < oFyNcL){
|
||||
return -1;
|
||||
}else if (oFxNcL > oFyNcL){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return a>b?1:(a==b?0:-1);//test,test123 情况用原始对比
|
||||
}
|
||||
|
||||
return {
|
||||
fileSize:fileSize,
|
||||
strSort:strSort,
|
||||
strSortChina:strSortChina,
|
||||
pathThis:pathThis
|
||||
}
|
||||
})();
|
||||
|
||||
|
||||
|
||||
//是否在数组中。
|
||||
var inArray = function(arr,value) {
|
||||
for (var i=0,l = arr.length ; i <l ; i++) {
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
|||
/* power by kodexplorer ver 4.37(2018-11-28) [build 1543400682.6513] */
|
||||
/* power by kodexplorer ver 4.38(2019-02-25) [build 1551093258.4711] */
|
||||
@import url('./fileIcon.css');
|
||||
@import url('./common.css');
|
||||
.frame-main{position:absolute;top:40px;width:100%;bottom:0px;}.frame-main .tools-left{background:#f8f8f8 url("../../../images/common/bg.gif") 0 0px;position:fixed;line-height:30px;padding-left:20px;height:28px;border-bottom:1px solid #ddd;left:0;width:100%;}.frame-main .tools-left a{font-size:1.25em;font-weight:800;text-decoration:none;color:#999;text-shadow:0 0 3px;display:inline-block;padding:2px 6px;margin-top:0;height:20px;line-height:20px;}.frame-main .tools-left a:hover{background:url("../../../images/common/buttons_40.png") 0 0px repeat-x;-webkit-box-shadow:0 2px 8px rgba(0,0,0,0.8);-moz-box-shadow:0 2px 8px rgba(0,0,0,0.8);box-shadow:0 2px 8px rgba(0,0,0,0.8);-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;}.frame-main .frame-left{position:absolute;left:0;top:30px;bottom:0;width:200px;background:#fff;background-attachment:fixed;overflow:auto;}.frame-main .frame-left .ztree{margin-top:0;}.frame-main .frame-left .ztree li.level0{margin-bottom:5px;}.frame-main .frame-resize{width:10px;cursor:col-resize;z-index:100;position:absolute;left:195px;top:0;bottom:0;overflow:hidden;background:url("../../../images/common/resize.png") 0px 50% no-repeat;}.frame-main .frame-resize.active{background:#000;opacity:0.2;filter:alpha(opacity=20);}.frame-main .frame-right{left:200px;right:0;position:absolute;top:0;bottom:0;overflow:auto;}.frame-main .frame-right .frame-right-main .resize-mask{z-index:999;position:absolute;left:0;top:0;bottom:0;right:0;display:none;}.frame-main .frame-right .frame-right-main .frame{height:100%;border-left:1px solid #ddd;overflow:hidden;}
|
||||
/* ver 4.37(2018-11-28) [build 1543400682.6514] */
|
||||
/* ver 4.38(2019-02-25) [build 1551093258.4712] */
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue