diff --git a/admin/chart.php b/admin/chart.php
old mode 100644
new mode 100755
diff --git a/admin/index.php b/admin/index.php
old mode 100644
new mode 100755
diff --git a/admin/manager.php b/admin/manager.php
old mode 100644
new mode 100755
diff --git a/admin/terms.php b/admin/terms.php
old mode 100644
new mode 100755
diff --git a/admin/verson.txt b/admin/verson.txt
old mode 100644
new mode 100755
index 6816713..952f449
--- a/admin/verson.txt
+++ b/admin/verson.txt
@@ -1 +1 @@
-2.6.5
\ No newline at end of file
+2.6.6
\ No newline at end of file
diff --git a/admin/zui.chart.php b/admin/zui.chart.php
old mode 100644
new mode 100755
diff --git a/api/index.php b/api/index.php
old mode 100644
new mode 100755
diff --git a/api/public.php b/api/public.php
old mode 100644
new mode 100755
diff --git a/application/TimThumb.php b/application/TimThumb.php
old mode 100644
new mode 100755
diff --git a/application/WaterMask.php b/application/WaterMask.php
old mode 100644
new mode 100755
diff --git a/application/captcha.php b/application/captcha.php
old mode 100644
new mode 100755
diff --git a/application/chart.php b/application/chart.php
old mode 100644
new mode 100755
diff --git a/application/check.php b/application/check.php
old mode 100644
new mode 100755
diff --git a/application/check_admin.inc.php b/application/check_admin.inc.php
old mode 100644
new mode 100755
diff --git a/application/class.snowflake.php b/application/class.snowflake.php
new file mode 100755
index 0000000..2eb7093
--- /dev/null
+++ b/application/class.snowflake.php
@@ -0,0 +1,45 @@
+
+ * 默认情况下41bit的时间戳可以支持该算法使用到2082年,10bit的工作机器id可以支持1023台机器,序列号支持1毫秒产生4095个自增序列id
+ * @author zhangqi
+ * @link https://www.cnblogs.com/njccqx/p/13402169.html
+ */
+class SnowFlake
+{
+ const EPOCH = 1479533469598; //开始时间,固定一个小于当前时间的毫秒数
+ const max12bit = 4095;
+ const max41bit = 1099511627775;
+
+ static $machineId = 1; // 机器id
+
+ public static function machineId($mId = 0)
+ {
+ self::$machineId = $mId;
+ }
+
+ public static function createOnlyId()
+ {
+ // 时间戳 42字节
+ $time = floor(microtime(true) * 1000);
+ // 当前时间 与 开始时间 差值
+ $time -= self::EPOCH;
+ // 二进制的 毫秒级时间戳
+ $base = decbin(self::max41bit + $time);
+ // 机器id 10 字节
+ if (!self::$machineId) {
+ $machineid = self::$machineId;
+ } else {
+ $machineid = str_pad(decbin(self::$machineId), 10, "0", STR_PAD_LEFT);
+ }
+ // 序列数 12字节
+ $random = str_pad(decbin(mt_rand(0, self::max12bit)), 12, "0", STR_PAD_LEFT);
+ // 拼接
+ $base = $base . $machineid . $random;
+ // 转化为 十进制 返回
+ return bindec($base);
+ }
+}
+// SnowFlake::machineId("1"); //机器编号
+// echo SnowFlake::createOnlyId();//分布式id
diff --git a/application/class.thumb.php b/application/class.thumb.php
old mode 100644
new mode 100755
diff --git a/application/class.upload.php b/application/class.upload.php
old mode 100644
new mode 100755
index 5552b0d..fd58ea3
--- a/application/class.upload.php
+++ b/application/class.upload.php
@@ -405,12 +405,28 @@ class Upload {
/**
* Set this variable to false if you don't want to turn dangerous scripts into simple text files
+ * The list of blacklisted extensions is in {@link dangerous}
+ *
+ * Note that this check happens before checking for forbidden MIME types or extensions
+ * If you want to forbid uploads rather than turning scripts into text files,
+ * set {@link no_script} to false and use {@link forbidden} instead
*
* @access public
* @var boolean
*/
var $no_script;
+ /**
+ * Dangerous file extensions
+ *
+ * List of dangerous extensions, that are enforced if {@link no_script} is true
+ * If the file has such extension, then it is turned into a text file
+ *
+ * @access public
+ * @var array
+ */
+ var $dangerous;
+
/**
* Set this variable to true to allow automatic renaming of the file
* if the file already exists
@@ -1662,12 +1678,12 @@ class Upload {
var $mime_types;
/**
- * Allowed MIME types
+ * Allowed MIME types or file extensions
*
* Default is a selection of safe mime-types, but you might want to change it
*
- * Simple wildcards are allowed, such as image/* or application/*
- * If there is only one MIME type allowed, then it can be a string instead of an array
+ * Simple wildcards are allowed for MIME types, such as image/* or application/*
+ * If there is only one MIME type allowed or file extension, then it can be a string instead of an array
*
* @access public
* @var array OR string
@@ -1675,30 +1691,23 @@ class Upload {
var $allowed;
/**
- * Forbidden MIME types
+ * Forbidden MIME types or file extensions
*
- * Default is a selection of safe mime-types, but you might want to change it
+ * Default is a selection of forbidden file extensions, but you might want to change it
* To only check for forbidden MIME types, and allow everything else, set {@link allowed} to array('* / *') without the spaces
*
- * Simple wildcards are allowed, such as image/* or application/*
- * If there is only one MIME type forbidden, then it can be a string instead of an array
+ * Note that if {@link no_script} is activated, dangerous scripts with extensions in {@link dangerous}
+ * will be set to have a .txt extension prior to checking for forbidden extensions
+ * If you want to forbid uploads rather than turning scripts into text files, set {@link no_script} to false
+ *
+ * Simple wildcards are allowed for MIME types, such as image/* or application/*
+ * If there is only one MIME type or file extension forbidden, then it can be a string instead of an array
*
* @access public
* @var array OR string
*/
var $forbidden;
- /**
- * Blacklisted file extensions
- *
- * List of blacklisted extensions, that are enforced if {@link no_script} is true
- *
- * @access public
- * @var array
- */
- var $blacklist;
-
-
/**
* Array of translated error messages
*
@@ -1853,7 +1862,35 @@ class Upload {
$this->image_frame_colors = '#FFFFFF #999999 #666666 #000000';
$this->image_frame_opacity = 100;
- $this->forbidden = array();
+ $this->dangerous = array(
+ 'php',
+ 'php7',
+ 'php6',
+ 'php5',
+ 'php4',
+ 'php3',
+ 'phtml',
+ 'pht',
+ 'phpt',
+ 'phtm',
+ 'phps',
+ 'inc',
+ 'pl',
+ 'py',
+ 'cgi',
+ 'asp',
+ 'js',
+ 'sh',
+ 'bat',
+ 'phar',
+ 'wsdl',
+ );
+
+ $this->forbidden = array_merge($this->dangerous, array(
+ 'exe',
+ 'dll',
+ ));
+
$this->allowed = array(
'application/arj',
'application/excel',
@@ -2036,27 +2073,6 @@ class Upload {
'csv' => 'text/csv',
);
- $this->blacklist = array(
- 'php',
- 'php7',
- 'php6',
- 'php5',
- 'php4',
- 'php3',
- 'phtml',
- 'pht',
- 'phpt',
- 'phtm',
- 'phps',
- 'inc',
- 'pl',
- 'py',
- 'cgi',
- 'asp',
- 'js',
- 'sh',
- 'phar',
- );
}
@@ -2093,7 +2109,7 @@ class Upload {
*/
function upload($file, $lang = 'en_GB') {
- $this->version = '05/10/2021';
+ $this->version = '13/06/2022';
$this->file_src_name = '';
$this->file_src_name_body = '';
@@ -2429,7 +2445,7 @@ class Upload {
// checks MIME type with Fileinfo PECL extension
if (!$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === false) {
if ($this->mime_fileinfo) {
- $this->log .= '- Checking MIME type with Fileinfo PECL extension
';
+ $this->log .= '- checking MIME type with Fileinfo PECL extension
';
if ($this->function_enabled('finfo_open')) {
$path = null;
if ($this->mime_fileinfo !== '') {
@@ -2493,7 +2509,7 @@ class Upload {
// checks MIME type with shell if unix access is authorized
if (!$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === false) {
if ($this->mime_file) {
- $this->log .= '- Checking MIME type with UNIX file() command
';
+ $this->log .= '- checking MIME type with UNIX file() command
';
if (substr(PHP_OS, 0, 3) != 'WIN') {
if ($this->function_enabled('exec') && $this->function_enabled('escapeshellarg')) {
if (strlen($mime = @exec("file -bi ".escapeshellarg($this->file_src_pathname))) != 0) {
@@ -2522,7 +2538,7 @@ class Upload {
// checks MIME type with mime_magic
if (!$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === false) {
if ($this->mime_magic) {
- $this->log .= '- Checking MIME type with mime.magic file (mime_content_type())
';
+ $this->log .= '- checking MIME type with mime.magic file (mime_content_type())
';
if ($this->function_enabled('mime_content_type')) {
$this->file_src_mime = mime_content_type($this->file_src_pathname);
$this->log .= ' MIME type detected as ' . $this->file_src_mime . ' by mime_content_type()
';
@@ -2543,7 +2559,7 @@ class Upload {
// checks MIME type with getimagesize()
if (!$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === false) {
if ($this->mime_getimagesize) {
- $this->log .= '- Checking MIME type with getimagesize()
';
+ $this->log .= '- checking MIME type with getimagesize()
';
$info = getimagesize($this->file_src_pathname);
if (is_array($info) && array_key_exists('mime', $info)) {
$this->file_src_mime = trim($info['mime']);
@@ -2586,7 +2602,7 @@ class Upload {
// we need to work some magic if we upload via Flash
if ($this->file_src_mime == 'application/octet-stream' || !$this->file_src_mime || !is_string($this->file_src_mime) || empty($this->file_src_mime) || strpos($this->file_src_mime, '/') === false) {
if ($this->file_src_mime == 'application/octet-stream') $this->log .= '- Flash may be rewriting MIME as application/octet-stream
';
- $this->log .= '- Try to guess MIME type from file extension (' . $this->file_src_name_ext . '): ';
+ $this->log .= '- try to guess MIME type from file extension (' . $this->file_src_name_ext . '): ';
if (array_key_exists($this->file_src_name_ext, $this->mime_types)) $this->file_src_mime = $this->mime_types[$this->file_src_name_ext];
if ($this->file_src_mime == 'application/octet-stream') {
$this->log .= 'doesn\'t look like anything known
';
@@ -2600,9 +2616,14 @@ class Upload {
}
// determine whether the file is an image
- if ($this->file_src_mime && is_string($this->file_src_mime) && !empty($this->file_src_mime) && array_key_exists($this->file_src_mime, $this->image_supported)) {
- $this->file_is_image = true;
- $this->image_src_type = $this->image_supported[$this->file_src_mime];
+ if ($this->file_src_mime && is_string($this->file_src_mime) && !empty($this->file_src_mime)) {
+ if (array_key_exists($this->file_src_mime, $this->image_supported)) {
+ $this->file_is_image = true;
+ $this->image_src_type = $this->image_supported[$this->file_src_mime];
+ $this->log .= '- file is an image, and its type is supported by GD
';
+ } else if (strpos($this->file_src_mime, 'image/') !== FALSE && sizeof($this->image_supported) == 0) {
+ $this->log .= '- file may be an image, but its type is not supported; is GD installed ?
';
+ }
}
// if the file is an image, we gather some useful data
@@ -2629,7 +2650,7 @@ class Upload {
}
$this->log .= '
source variables';
- $this->log .= '- You can use all these before calling process()
';
+ $this->log .= '- you can use all these before calling process()
';
$this->log .= ' file_src_name : ' . $this->file_src_name . '
';
$this->log .= ' file_src_name_body : ' . $this->file_src_name_body . '
';
$this->log .= ' file_src_name_ext : ' . $this->file_src_name_ext . '
';
@@ -3120,7 +3141,7 @@ class Upload {
}
// if the file is text based, or has a dangerous extension, we rename it as .txt
if ((((substr($this->file_src_mime, 0, 5) == 'text/' && $this->file_src_mime != 'text/rtf') || strpos($this->file_src_mime, 'javascript') !== false) && (substr($file_src_name, -4) != '.txt'))
- || preg_match('/\.(' . implode('|', $this->blacklist) . ')$/i', $this->file_src_name)
+ || preg_match('/\.(' . implode('|', $this->dangerous) . ')$/i', $this->file_src_name)
|| $this->file_force_extension && empty($file_src_name_ext)) {
$this->file_src_mime = 'text/plain';
if ($this->file_src_name_ext) $file_src_name_body = $file_src_name_body . '.' . $this->file_src_name_ext;
@@ -3136,22 +3157,39 @@ class Upload {
} else if ($this->mime_check && !empty($this->file_src_mime) && strpos($this->file_src_mime, '/') !== false) {
list($m1, $m2) = explode('/', $this->file_src_mime);
$allowed = false;
- // check wether the mime type is allowed
+ // check wether the mime type or file extension is allowed
if (!is_array($this->allowed)) $this->allowed = array($this->allowed);
foreach($this->allowed as $k => $v) {
- list($v1, $v2) = explode('/', $v);
- if (($v1 == '*' && $v2 == '*') || ($v1 == $m1 && ($v2 == $m2 || $v2 == '*'))) {
- $allowed = true;
- break;
+ if (strpos($v, '/') == false) {
+ if ($v == '*' || strtolower($v) == strtolower($file_src_name_ext)) {
+ $allowed = true;
+ break;
+ }
+ } else {
+ list($v1, $v2) = explode('/', $v);
+ if (($v1 == '*' && $v2 == '*') || ($v1 == $m1 && ($v2 == $m2 || $v2 == '*'))) {
+ $allowed = true;
+ break;
+ }
}
}
- // check wether the mime type is forbidden
+ if (!$allowed) $this->log .= '- MIME type and/or extension is not allowed !
';
+ // check wether the mime type or file extension is forbidden
if (!is_array($this->forbidden)) $this->forbidden = array($this->forbidden);
foreach($this->forbidden as $k => $v) {
- list($v1, $v2) = explode('/', $v);
- if (($v1 == '*' && $v2 == '*') || ($v1 == $m1 && ($v2 == $m2 || $v2 == '*'))) {
- $allowed = false;
- break;
+ if (strpos($v, '/') == false) {
+ if ($v == '*' || strtolower($v) == strtolower($file_src_name_ext)) {
+ $allowed = false;
+ $this->log .= '- extension ' . $v . ' is forbidden !
';
+ break;
+ }
+ } else {
+ list($v1, $v2) = explode('/', $v);
+ if (($v1 == '*' && $v2 == '*') || ($v1 == $m1 && ($v2 == $m2 || $v2 == '*'))) {
+ $allowed = false;
+ $this->log .= '- MIME type ' . $v . ' is forbidden !
';
+ break;
+ }
}
}
if (!$allowed) {
@@ -3159,6 +3197,7 @@ class Upload {
$this->error = $this->translate('incorrect_file');
} else {
$this->log .= '- file mime OK : ' . $this->file_src_mime . '
';
+ $this->log .= '- file extension OK : ' . $file_src_name_ext . '
';
}
} else {
$this->log .= '- file mime (not checked) : ' . $this->file_src_mime . '
';
@@ -4504,10 +4543,9 @@ class Upload {
$this->log .= 'error
';
$this->image_text_font = 5;
}
- }
// if the font is a string with a TTF font path, we check if we can access the font file
- if (!is_numeric($this->image_text_font) && strlen($this->image_text_font) > 4 && substr(strtolower($this->image_text_font), -4) == '.ttf') {
+ } else if (!is_numeric($this->image_text_font) && strlen($this->image_text_font) > 4 && substr(strtolower($this->image_text_font), -4) == '.ttf') {
$this->log .= ' try to load font ' . $this->image_text_font . '... ';
if (strpos($this->image_text_font, '/') === false) $this->image_text_font = "./" . $this->image_text_font;
if (file_exists($this->image_text_font) && is_readable($this->image_text_font)) {
diff --git a/application/class.version.php b/application/class.version.php
old mode 100644
new mode 100755
diff --git a/application/compress/Imagick/class.Imgcompress.php b/application/compress/Imagick/class.Imgcompress.php
old mode 100644
new mode 100755
diff --git a/application/compress/TinyImg/TinyImg.php b/application/compress/TinyImg/TinyImg.php
old mode 100644
new mode 100755
diff --git a/application/compress/TinyImg/cacert.pem b/application/compress/TinyImg/cacert.pem
old mode 100644
new mode 100755
diff --git a/application/compress/function.compress.php b/application/compress/function.compress.php
old mode 100644
new mode 100755
diff --git a/application/compressing.php b/application/compressing.php
old mode 100644
new mode 100755
diff --git a/application/del.php b/application/del.php
old mode 100644
new mode 100755
diff --git a/application/down.php b/application/down.php
old mode 100644
new mode 100755
diff --git a/application/footer.php b/application/footer.php
old mode 100644
new mode 100755
index f7d5809..db3398f
--- a/application/footer.php
+++ b/application/footer.php
@@ -42,13 +42,11 @@ if ($config['notice_status'] == 1 && !empty($config['notice'])) : ?>
- © 2018-
- EasyImage
- By
- Icret
- DMCA
+ © 2018-
+ EasyImage
+ DMCA
-
+
@@ -70,6 +71,9 @@ if ($config['ad_top']) echo $config['ad_top_info'];
查看
下载
+
+ 举报
+
回收
删除
@@ -78,9 +82,8 @@ if ($config['ad_top']) echo $config['ad_top_info'];
- 此图片来自网友上传, 不代表本站立场, 若有侵权, 请联系管理员删除!
+ 此图片来自网友上传, 不代表本站立场, 若有侵权, 请举报或联系管理员!
-
-
-
-
-
- 论坛代码
-
-
-
+
+
-
-
-
+
+
/** 底部广告 */ if ($config['ad_bot']) echo $config['ad_bot_info']; ?>
+
+
+
+
+
+ ';
+ }
+ } else {
+ echo ' 本月还没有上传的图片哟~~ 快来上传第一张吧~! ';
+ }
+ ?>
+
+
+
diff --git a/application/lang/class.upload.xx_XX.php b/application/lang/class.upload.xx_XX.php
old mode 100644
new mode 100755
diff --git a/application/lang/class.upload.zh_CN.gb-2312.php b/application/lang/class.upload.zh_CN.gb-2312.php
new file mode 100755
index 0000000..4cb4b11
--- /dev/null
+++ b/application/lang/class.upload.zh_CN.gb-2312.php
@@ -0,0 +1,86 @@
+
\ No newline at end of file
diff --git a/application/lang/class.upload.zh_CN.php b/application/lang/class.upload.zh_CN.php
old mode 100644
new mode 100755
diff --git a/application/lang/class.upload.zh_TW.php b/application/lang/class.upload.zh_TW.php
old mode 100644
new mode 100755
diff --git a/application/list.php b/application/list.php
old mode 100644
new mode 100755
index 3bc44ad..644d34a
--- a/application/list.php
+++ b/application/list.php
@@ -61,13 +61,16 @@ if ($config['ad_top']) echo $config['ad_top_info'];
$linkUrl = rand_imgurl() . $config_path . $value; // 图片复制与原图地址
?>
-
+
-
+
+
+
+
diff --git a/application/md5.php b/application/md5.php
old mode 100644
new mode 100755
diff --git a/application/post_del.php b/application/post_del.php
old mode 100644
new mode 100755
diff --git a/application/process.php b/application/process.php
old mode 100644
new mode 100755
diff --git a/application/read_log.php b/application/read_log.php
old mode 100644
new mode 100755
diff --git a/application/thumb.php b/application/thumb.php
old mode 100644
new mode 100755
diff --git a/application/total_files.php b/application/total_files.php
old mode 100644
new mode 100755
diff --git a/application/upload.php b/application/upload.php
old mode 100644
new mode 100755
diff --git a/config/api_key.php b/config/api_key.php
old mode 100644
new mode 100755
diff --git a/config/config.guest.php b/config/config.guest.php
old mode 100644
new mode 100755
diff --git a/config/config.manager.php b/config/config.manager.php
old mode 100644
new mode 100755
diff --git a/config/config.php b/config/config.php
old mode 100644
new mode 100755
index f79a33b..a4c7a9d
--- a/config/config.php
+++ b/config/config.php
@@ -14,9 +14,9 @@ $config=Array
'imgurl'=>'http://127.0.0.1',
'user'=>'admin',
'password'=>'e6e061838856bf47e1de730719fb2609',
- 'captcha'=>1,
+ 'captcha'=>0,
'mustLogin'=>0,
- 'apiStatus'=>0,
+ 'apiStatus'=>1,
'path'=>'/i/',
'mime'=>'image/*,video/*',
'imgName'=>'default',
@@ -64,6 +64,7 @@ $config=Array
'dark-mode'=>1,
'show_user_hash_del'=>1,
'show_exif_info'=>1,
+ 'info_rand_pic'=>1,
'chart_on'=>1,
'check_ip'=>0,
'check_ip_model'=>0,
@@ -84,6 +85,7 @@ $config=Array
),
'language'=>0,
'login_bg'=>'https://img.paulzzh.com/touhou/random',
+ 'report'=>'',
'image_recycl'=>1,
'tinyfilemanager'=>1,
'delDir'=>'thumbnails/',
@@ -94,7 +96,7 @@ $config=Array
'guest_path_status'=>0,
'token_path_status'=>0,
'admin_path'=>'u',
- 'update'=>'2022-05-27 00:06:41',
+ 'update'=>'2022-07-09 18:39:54',
'footer'=>' 请勿上传违反中国政策的图片
|