Skip to content

Commit

Permalink
4.52 release
Browse files Browse the repository at this point in the history
  • Loading branch information
kalcaddle committed Dec 14, 2023
1 parent dfb3597 commit 5cf233f
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 47 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### ver4.52 `2023/12/15`
- 安全问题修复

### ver4.51 `2023/4/6`
- 兼容性调整

Expand Down
4 changes: 2 additions & 2 deletions app/controller/api.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ private function setIdentify(){
public function checkAccessToken(){
$model = $this->loadModel('Plugin');
$config = $model->getConfig('fileView');
if(!$config['apiKey']){
return;
if(!$config || !$config['apiKey']){
show_tips('fileView not open ,or apiKey is empty!');
}
$timeTo = isset($this->in['timeTo'])?intval($this->in['timeTo']):'';
$token = md5($config['apiKey'].$this->in['path'].$timeTo);
Expand Down
2 changes: 1 addition & 1 deletion app/controller/utils.php

Large diffs are not rendered by default.

14 changes: 5 additions & 9 deletions app/function/file.function.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function iconv_system($str){
return $result;
}
function iconv_to($str,$from,$to){
if(!$from || !$to) return $str;
if (strtolower($from) == strtolower($to)){
return $str;
}
Expand Down Expand Up @@ -249,14 +250,9 @@ function get_path_father($path){
function get_path_ext($path){
$name = get_path_this($path);
$ext = '';
if(strstr($name,'.')){
$ext = substr($name,strrpos($name,'.')+1);
$ext = strtolower($ext);
}
if (strlen($ext)>3 && preg_match("/([\x81-\xfe][\x40-\xfe])/", $ext, $match)) {
$ext = '';
}
return htmlspecialchars($ext);
if(strstr($name,'.')){$ext = substr($name,strrpos($name,'.')+1);}
$isMatch = preg_match("/[0-9a-zA-Z_]+/",$ext,$match);// 只允许数字字母和下划线
return ($isMatch && $match[0]) ? strtolower($match[0]):'';
}


Expand Down Expand Up @@ -1011,7 +1007,7 @@ function file_put_out($file,$download=-1,$downFilename=false){
header('Content-Disposition: attachment;filename='.$headerName);
}else{
header('Content-Type: '.$mime);
header('Content-Disposition: inline;filename='.$headerName);
//header('Content-Disposition: inline;filename='.$headerName);
if(strstr($mime,'text/')){
//$charset = get_charset(file_get_contents($file));
header('Content-Type: '.$mime.'; charset=');//避免自动追加utf8导致gbk网页乱码
Expand Down
21 changes: 6 additions & 15 deletions app/function/helper.function.php
Original file line number Diff line number Diff line change
Expand Up @@ -456,21 +456,12 @@ function hash_path($path,$addExt=false){
$password = $GLOBALS['config']['settingSystem']['systemPassword'];
}

$pre = substr(md5($path.$password),0,8);
$result = $pre.md5($path);
if(file_exists($path)){
$result = $pre.md5($path.filemtime($path));
if(filesize($path) < 50*1024*1024){
$fileMd5 = @md5_file($path);
if($fileMd5){
$result = $fileMd5;
}
}
}
if($addExt){
$result = $result.'.'.get_path_ext($path);
}
return $result;
$pre = substr(md5('kod-system'.$password),0,8);
$result = md5($path);
if(file_exists($path)){$result = file_hash_simple($path);}
if($addExt){$result = $result.'.'.get_path_ext($path);}

return $pre.$result;
}


Expand Down
5 changes: 2 additions & 3 deletions app/kod/ImageThumb.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ function distortion($toFile, $toW, $toH){
}
// 生成按比例缩放的缩图
function prorate($toFile, $toW, $toH){
if(!$this->im){
return false;
}
if(!$this->im){return false;}
$toWH = $toW / $toH;
$srcWH = $this->srcW / $this->srcH;
if ($toWH<=$srcWH) {
Expand All @@ -112,6 +110,7 @@ function prorate($toFile, $toW, $toH){
}
// 生成最小裁剪后的缩图
function cut($toFile, $toW, $toH){
if(!$this->im){return false;}
$toWH = $toW / $toH;
$srcWH = $this->srcW / $this->srcH;
if ($toWH<=$srcWH) {
Expand Down
8 changes: 4 additions & 4 deletions app/sdks/lessc.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ protected function compileProp($prop, $block, $out) {
if ($suffix !== null &&
$subProp[0] == "assign" &&
is_string($subProp[1]) &&
$subProp[1]{0} != $this->vPrefix)
$subProp[1][0] != $this->vPrefix)
{
$subProp[2] = array(
'list', ' ',
Expand Down Expand Up @@ -1765,7 +1765,7 @@ protected function injectVariables($args) {
$this->pushEnv();
$parser = new lessc_parser($this, __METHOD__);
foreach ($args as $name => $strValue) {
if ($name{0} != '@') $name = '@'.$name;
if ($name[0] != '@') $name = '@'.$name;
$parser->count = 0;
$parser->buffer = (string)$strValue;
if (!$parser->propertyValue($value)) {
Expand Down Expand Up @@ -2421,7 +2421,7 @@ protected function parseChunk() {
$hidden = true;
if (!isset($block->args)) {
foreach ($block->tags as $tag) {
if (!is_string($tag) || $tag{0} != $this->lessc->mPrefix) {
if (!is_string($tag) || $tag[0] != $this->lessc->mPrefix) {
$hidden = false;
break;
}
Expand Down Expand Up @@ -2475,7 +2475,7 @@ protected function isDirective($dirname, $directives) {
protected function fixTags($tags) {
// move @ tags out of variable namespace
foreach ($tags as &$tag) {
if ($tag{0} == $this->lessc->vPrefix)
if ($tag[0] == $this->lessc->vPrefix)
$tag[0] = $this->lessc->mPrefix;
}
return $tags;
Expand Down
4 changes: 2 additions & 2 deletions config/version.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php
define('KOD_VERSION','4.51');
define('KOD_VERSION_BUILD','02');//time(),20230330
define('KOD_VERSION','4.52');
define('KOD_VERSION_BUILD','01');//time(),20231212
2 changes: 1 addition & 1 deletion plugins/toolsCommon/static/pie/.pie.tif

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions static/style/skin/base/app_code_edit.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions static/style/skin/base/app_desktop.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions static/style/skin/base/app_editor.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions static/style/skin/base/app_explorer.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions static/style/skin/base/app_setting.css

Large diffs are not rendered by default.

0 comments on commit 5cf233f

Please sign in to comment.