From 589f87d32f1acd53cdd54f0cb0640c0b9823cdaa Mon Sep 17 00:00:00 2001 From: icret Date: Thu, 9 Mar 2023 21:45:54 +0800 Subject: [PATCH] `applicaton->app` --- admin/admin.inc.php | 11 +- admin/chart.php | 2 +- admin/zui.chart.php | 2 +- app/Ftp.php | 270 ++++++++++++++++++++++++++++++++++++++++ app/check_admin.inc.php | 2 +- app/footer.php | 2 +- app/function.php | 164 +++++++++++++++++------- config/config.php | 4 +- docs/update.md | 2 +- install/index.php | 2 +- install/install.php | 2 +- 11 files changed, 409 insertions(+), 54 deletions(-) create mode 100644 app/Ftp.php diff --git a/admin/admin.inc.php b/admin/admin.inc.php index afa40e6..5766070 100755 --- a/admin/admin.inc.php +++ b/admin/admin.inc.php @@ -770,6 +770,13 @@ auto_delete(); //定时删除 +
+
+ + > + +
+
@@ -952,7 +959,7 @@ auto_delete(); //定时删除 Manual Telegram Discuss - +

程序依赖
@@ -987,7 +994,7 @@ auto_delete(); //定时删除
* 下载 ip2region.xdb IP数据库上传到 /app/ip2region/ 文件夹, 如遇到下载失败可访问开源地址下载: [ Github | Gitee ] 更新方法与此相同。
- +
diff --git a/admin/zui.chart.php b/admin/zui.chart.php index f8aecc4..5c28227 100755 --- a/admin/zui.chart.php +++ b/admin/zui.chart.php @@ -120,7 +120,7 @@ if (is_array($char_data)) {
当前版本
- +
diff --git a/app/Ftp.php b/app/Ftp.php new file mode 100644 index 0000000..556e485 --- /dev/null +++ b/app/Ftp.php @@ -0,0 +1,270 @@ + 'ssl_connect', + 'getoption' => 'get_option', + 'setoption' => 'set_option', + 'nbcontinue' => 'nb_continue', + 'nbfget' => 'nb_fget', + 'nbfput' => 'nb_fput', + 'nbget' => 'nb_get', + 'nbput' => 'nb_put', + ); + + /** @var resource|\FTP\Connection */ + private $resource; + + /** @var array */ + private $state; + + /** @var string */ + private $errorMsg; + + + /** + * @param string URL ftp://... + * @param bool + */ + public function __construct($url = NULL, $passiveMode = TRUE) + { + if (!extension_loaded('ftp')) { + throw new Exception('PHP extension FTP is not loaded.'); + } + if ($url) { + $parts = parse_url($url); + if (!isset($parts['scheme']) || !in_array($parts['scheme'], array('ftp', 'ftps', 'sftp'))) { + throw new InvalidArgumentException('Invalid URL.'); + } + $func = $parts['scheme'] === 'ftp' ? 'connect' : 'ssl_connect'; + if (empty($parts['port'])) { + $this->$func($parts['host']); + } else { + $this->$func($parts['host'], (int) $parts['port']); + } + $this->login(urldecode($parts['user']), urldecode($parts['pass'])); + $this->pasv((bool) $passiveMode); + if (isset($parts['path'])) { + $this->chdir($parts['path']); + } + } + } + + + /** + * Magic method (do not call directly). + * @param string method name + * @param array arguments + * @return mixed + * @throws Exception + * @throws FtpException + */ + public function __call($name, $args) + { + $name = strtolower($name); + $silent = strncmp($name, 'try', 3) === 0; + $func = $silent ? substr($name, 3) : $name; + $func = 'ftp_' . (isset(self::$aliases[$func]) ? self::$aliases[$func] : $func); + + if (!function_exists($func)) { + throw new Exception("Call to undefined method Ftp::$name()."); + } + + $this->errorMsg = NULL; + set_error_handler(array($this, '_errorHandler')); + + if ($func === 'ftp_connect' || $func === 'ftp_ssl_connect') { + $this->state = array($name => $args); + $this->resource = call_user_func_array($func, $args); + $res = NULL; + + } elseif (!is_resource($this->resource) && !$this->resource instanceof \FTP\Connection) { + restore_error_handler(); + throw new FtpException("Not connected to FTP server. Call connect() or ssl_connect() first."); + + } else { + if ($func === 'ftp_login' || $func === 'ftp_pasv') { + $this->state[$name] = $args; + } + + array_unshift($args, $this->resource); + $res = call_user_func_array($func, $args); + + if ($func === 'ftp_chdir' || $func === 'ftp_cdup') { + $this->state['chdir'] = array(ftp_pwd($this->resource)); + } + } + + restore_error_handler(); + if (!$silent && $this->errorMsg !== NULL) { + if (ini_get('html_errors')) { + $this->errorMsg = html_entity_decode(strip_tags($this->errorMsg)); + } + + if (($a = strpos($this->errorMsg, ': ')) !== FALSE) { + $this->errorMsg = substr($this->errorMsg, $a + 2); + } + + throw new FtpException($this->errorMsg); + } + + return $res; + } + + + /** + * Internal error handler. Do not call directly. + */ + public function _errorHandler($code, $message) + { + $this->errorMsg = $message; + } + + + /** + * Reconnects to FTP server. + * @return void + */ + public function reconnect() + { + @ftp_close($this->resource); // intentionally @ + foreach ($this->state as $name => $args) { + call_user_func_array(array($this, $name), $args); + } + } + + + /** + * Checks if file or directory exists. + * @param string + * @return bool + */ + public function fileExists($file) + { + return (bool) $this->nlist($file); + } + + + /** + * Checks if directory exists. + * @param string + * @return bool + */ + public function isDir($dir) + { + $current = $this->pwd(); + try { + $this->chdir($dir); + } catch (FtpException $e) { + } + $this->chdir($current); + return empty($e); + } + + + /** + * Recursive creates directories. + * @param string + * @return void + */ + public function mkDirRecursive($dir) + { + $parts = explode('/', $dir); + $path = ''; + while (!empty($parts)) { + $path .= array_shift($parts); + try { + if ($path !== '') $this->mkdir($path); + } catch (FtpException $e) { + if (!$this->isDir($path)) { + throw new FtpException("Cannot create directory '$path'."); + } + } + $path .= '/'; + } + } + + + /** + * Recursive deletes path. + * @param string + * @return void + */ + public function deleteRecursive($path) + { + if (!$this->tryDelete($path)) { + foreach ((array) $this->nlist($path) as $file) { + if ($file !== '.' && $file !== '..') { + $this->deleteRecursive(strpos($file, '/') === FALSE ? "$path/$file" : $file); + } + } + $this->rmdir($path); + } + } + +} + + + +class FtpException extends Exception +{ +} diff --git a/app/check_admin.inc.php b/app/check_admin.inc.php index e05dd7b..0a98315 100644 --- a/app/check_admin.inc.php +++ b/app/check_admin.inc.php @@ -66,7 +66,7 @@ if (!file_exists(__DIR__ . '/ip2region/ip2region.xdb')) { } // 检查当前版本与GitHub版本 -if (getVersion() !== get_current_version()) { +if (getVersion() !== APP_VERSION) { echo ' new $.zui.Messager("当前版本与GitHub不一致,请检查当前是否最新版本!",{ type: "danger", // 定义颜色主题 diff --git a/app/footer.php b/app/footer.php index 3c26b21..24ac336 100644 --- a/app/footer.php +++ b/app/footer.php @@ -199,7 +199,7 @@ if ($config['notice_status'] > 0) : ?> }); // console - console.log("%cEasyImage ", "background: rgba(252,234,187,1);background: -moz-linear-gradient(left, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%,rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 0.5%);background: -webkit-gradient(left top, right top, color-stop(0%, rgba(252,234,187,1)), color-stop(12%, rgba(175,250,77,1)), color-stop(28%, rgba(0,247,49,1)), color-stop(39%, rgba(0,210,247,1)), color-stop(51%, rgba(0,189,247,1)), color-stop(64%, rgba(133,108,217,1)), color-stop(78%, rgba(177,0,247,1)), color-stop(87%, rgba(247,0,189,1)), color-stop(0.5%, rgba(245,22,52,1)));background: -webkit-linear-gradient(left, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%, rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 0.5%);background: -o-linear-gradient(left, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%, rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 0.5%);background: -ms-linear-gradient(left, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%, rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 0.5%);background: linear-gradient(to right, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%, rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 0.5%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fceabb', endColorstr='#f51634', GradientType=1 );font-size:2.34em;font-weight:bold") + console.log("%cEasyImage ", "background: rgba(252,234,187,1);background: -moz-linear-gradient(left, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%,rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 0.5%);background: -webkit-gradient(left top, right top, color-stop(0%, rgba(252,234,187,1)), color-stop(12%, rgba(175,250,77,1)), color-stop(28%, rgba(0,247,49,1)), color-stop(39%, rgba(0,210,247,1)), color-stop(51%, rgba(0,189,247,1)), color-stop(64%, rgba(133,108,217,1)), color-stop(78%, rgba(177,0,247,1)), color-stop(87%, rgba(247,0,189,1)), color-stop(0.5%, rgba(245,22,52,1)));background: -webkit-linear-gradient(left, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%, rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 0.5%);background: -o-linear-gradient(left, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%, rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 0.5%);background: -ms-linear-gradient(left, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%, rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 0.5%);background: linear-gradient(to right, rgba(252,234,187,1) 0%, rgba(175,250,77,1) 12%, rgba(0,247,49,1) 28%, rgba(0,210,247,1) 39%, rgba(0,189,247,1) 51%, rgba(133,108,217,1) 64%, rgba(177,0,247,1) 78%, rgba(247,0,189,1) 87%, rgba(245,22,52,1) 0.5%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fceabb', endColorstr='#f51634', GradientType=1 );font-size:2.34em;font-weight:bold") console.log('%c图床作者及演示网站: https://png.cm\n作为开发者你可以对相应的后台功能进行扩展(增删改相应代码), 但请保留代码中相关来源信息(例如: 本人博客, 邮箱等);\n本程序由 Icret 独自开发并完全开源, 碰到收费发布的请不要轻易付款; 本人仅为程序开源创作, 如非法网站使用与本人无关, 请勿用于非法用途.%c ', 'color: #eaad1a; padding:5px 0; border:1px solid #448ef6; font-size:12px;', ''); diff --git a/app/function.php b/app/function.php index 10e5414..80d9763 100644 --- a/app/function.php +++ b/app/function.php @@ -2,18 +2,19 @@ /** * @author icret + * @link https://png.cm * @email lemonim@qq.com * @project EasyImage2.0 - 简单图床 * @Github https://github.com/icret/easyImages2.0 * QQ Group 954441002 - * @Last 2023-02-26 17:38:57 + * @Last 2023-03-09 17:38:57 * 上传服务器后第一次打开会检查运行环境,请根据提示操作; * 检查环境仅会在第一开始开始出现,并在config目录下生成EasyImage.lock文件,如需再次查看请删除此文件。 * 敬请注意:本程序为开源程序,你可以使用本程序在任何非商业项目或者网站中。但请你务必保留代码中相关信息(页面logo和页面上必要的链接可以更改) * 本人仅为程序开源创作,如非法网站与本人无关,请勿用于非法用途 - * 请为本人博客(blog.png.cm)加上网址链接,谢谢支持。作为开发者你可以对相应的后台功能进行扩展(增删改相应代码),但请保留代码中相关来源信息(例如:本人博客,邮箱等) + * 请为本人网站 (https://png.cm) 加上网址链接,谢谢支持。作为开发者你可以对相应的后台功能进行扩展(增删改相应代码),但请保留代码中相关来源信息(例如:本人博客,邮箱等) * 如果因安装问题或其他问题可以给我发邮件。 */ @@ -30,6 +31,8 @@ ini_set('memory_limit', '512M'); define('APP_ROOT', str_replace('\\', '/', realpath(dirname(__FILE__) . '/../'))); // 判断当前的系统类型是否为windows define('IS_WIN', strstr(PHP_OS, 'WIN') ? 1 : 0); +// 定义当前版本 +define('APP_VERSION', '2.7.8'); /*---------------基础配置结束-------------------*/ @@ -37,6 +40,21 @@ require_once APP_ROOT . '/config/config.php'; require_once APP_ROOT . '/config/config.guest.php'; require_once __DIR__ . '/WaterMask.php'; +/** + * 开启DEBUG + * 2023-03-09 + */ +function easyimage_debug() +{ + global $config; + if ($config['Debug']) { + + if (!ini_get('display_errors')) { + ini_set('display_errors', 'On'); + } + error_reporting(E_ALL); + } +} /** * 判断GIF图片是否为动态 * @param $filename string 文件 @@ -66,7 +84,7 @@ function isWebpAnimated($src) // not animated return false; - /* 2023-01-24 判断webp是否为动画 + /* 2023-01-24 判断webp是否为动画 $result = false; $fh = fopen($src, "rb"); fseek($fh, 12); @@ -299,7 +317,7 @@ function imgName($source = null) { global $config; - function create_guid() // guid生成函数 + function create_guid() // guid生成函数 { if (function_exists('com_create_guid') === true) { return trim(com_create_guid(), '{}'); @@ -486,9 +504,9 @@ function getFile($dir) * @param string $dir_fileName_suffix 获取文件列表:目录+文件名*:全匹配+文件后缀 *: 全匹配 {jpg,png,gif}:匹配指定格式 * 递归文件数量:目录 * @example get_file_by_glob(__DIR__ . '/i/cache/*.*', $type = 'list'); // 获取目录文件列表 - * @example get_file_by_glob(__DIR__ . '/i/', $type = 'number'); // 递归获取文件夹数量 + * @example get_file_by_glob(__DIR__ . '/i/', $type = 'number'); // 递归获取文件夹数量 * @param string $type list|number 返回列表还是数量 - * @return array|int 返回数组|数量 + * @return array|int 返回数组|数量 */ function get_file_by_glob($dir_fileName_suffix, $type = 'list') { @@ -500,7 +518,7 @@ function get_file_by_glob($dir_fileName_suffix, $type = 'list') if ($glob) { foreach ($glob as $v) { - if (is_file($v)) $res[] = basename($v); + if (is_file($v)) $res[] = basename($v); } // 排序 if ($res) { @@ -562,7 +580,7 @@ function getdirnum($file) /** * 把文件或目录的大小转化为容易读的方式 - * disk_free_space - 磁盘可用空间(比如填写D盘某文件夹,则会现在D盘剩余空间) + * disk_free_space - 磁盘可用空间(比如填写D盘某文件夹,则会现在D盘剩余空间) * disk_total_space — 磁盘总空间(比如填写D盘某文件夹,则会现在D盘总空间) * @param $number * @return string @@ -588,7 +606,7 @@ function getDistUsed($number) /** * 加密/解密图片路径 * @param string $data 要加密的内容 - * @param int $mode =1或0 1解密 0加密 + * @param int $mode =1或0 1解密 0加密 * @param String $key 盐 */ function urlHash($data, $mode, $key = null) @@ -616,7 +634,7 @@ function getDel($url, $type) { global $config; // url本地化 - $url = htmlspecialchars(str_replace($config['domain'], '', $url)); // 过滤html 获取url path + $url = htmlspecialchars(str_replace($config['domain'], '', $url)); // 过滤html 获取url path $url = urldecode(trim($url)); if ($type == 'url') { @@ -666,7 +684,7 @@ function getDel($url, $type) /** * 判断是否此用户登录 - * @param string $user 判断登录者权限 当$user=null 时检查是否登录, 不区分身份 + * @param string $user 判断登录者权限 当$user=null 时检查是否登录, 不区分身份 * @return bool 是|否 */ function is_who_login($user) @@ -774,7 +792,7 @@ function getVersion($name = 'tag_name') return '获取版本文件失败,请检查curl或者网络 错误信息: ' . $e->getMessage(); } } else { - return '已关闭环境自检, 当前版本:' . get_current_version(); + return '已关闭环境自检, 当前版本:' . APP_VERSION; } } @@ -882,7 +900,7 @@ function checkImg($imageUrl, $type = 1, $dir = 'suspic/') /** # 使用moderatecontent */ if ($type == 1) { $response = moderatecontent_json($imageUrl); - if ($response['rating_index'] == 3 or $response['predictions']['adult'] > $config['checkImg_value']) { // (1 = everyone, 2 = teen, 3 = adult) + if ($response['rating_index'] == 3 or $response['predictions']['adult'] > $config['checkImg_value']) { // (1 = everyone, 2 = teen, 3 = adult) $bad_pic = true; } } @@ -932,7 +950,7 @@ function checkImg($imageUrl, $type = 1, $dir = 'suspic/') // } // } - if ($res['Sexy'] * 100 > $config['checkImg_value'] or $res['Porn'] * 100 > $config['checkImg_value']) { + if ($res['Sexy'] * 100 > $config['checkImg_value'] or $res['Porn'] * 100 > $config['checkImg_value']) { $bad_pic = true; } } @@ -945,14 +963,14 @@ function checkImg($imageUrl, $type = 1, $dir = 'suspic/') /** # 如果违规则移动图片到违规文件夹 */ if ($bad_pic == true) { - $old_path = APP_ROOT . parse_url($imageUrl)['path']; // 提交网址中的文件路径 /i/2021/10/29/p8vypd.png - $name = parse_url($imageUrl)['path']; // 获得图片的相对地址 - $name = str_replace($config['path'], '', $name); // 去除 path目录 - $name = str_replace('/', '_', $name); // 文件名 2021_10_30_p8vypd.png - $new_path = APP_ROOT . $config['path'] . $dir . $name; // 新路径含文件名 - $suspic_dir = APP_ROOT . $config['path'] . $dir; // suspic路径 + $old_path = APP_ROOT . parse_url($imageUrl)['path']; // 提交网址中的文件路径 /i/2021/10/29/p8vypd.png + $name = parse_url($imageUrl)['path']; // 获得图片的相对地址 + $name = str_replace($config['path'], '', $name); // 去除 path目录 + $name = str_replace('/', '_', $name); // 文件名 2021_10_30_p8vypd.png + $new_path = APP_ROOT . $config['path'] . $dir . $name; // 新路径含文件名 + $suspic_dir = APP_ROOT . $config['path'] . $dir; // suspic路径 - if (!is_dir($suspic_dir)) { // 创建suspic目录并移动 + if (!is_dir($suspic_dir)) { // 创建suspic目录并移动 mkdir($suspic_dir, 0777, true); } if (is_file($old_path)) { @@ -972,11 +990,11 @@ function re_checkImg($name, $dir = 'suspic/') { global $config; - $fileToPath = str_replace('_', '/', $name); // 将图片名称还原为带路径的名称,eg:2021_11_03_pbmn1a.jpg =>2021/11/03/pbmn1a.jpg - $now_path_file = APP_ROOT . $config['path'] . $dir . $name; // 当前图片绝对位置 */i/suspic/2021_10_30_p8vypd.png + $fileToPath = str_replace('_', '/', $name); // 将图片名称还原为带路径的名称,eg:2021_11_03_pbmn1a.jpg =>2021/11/03/pbmn1a.jpg + $now_path_file = APP_ROOT . $config['path'] . $dir . $name; // 当前图片绝对位置 */i/suspic/2021_10_30_p8vypd.png if (is_file($now_path_file)) { - $to_file = APP_ROOT . $config['path'] . $fileToPath; // 要还原图片的绝对位置 */i/2021/10/30/p8vypd.png - rename($now_path_file, $to_file); // 移动文件 + $to_file = APP_ROOT . $config['path'] . $fileToPath; // 要还原图片的绝对位置 */i/2021/10/30/p8vypd.png + rename($now_path_file, $to_file); // 移动文件 return true; } } @@ -990,15 +1008,15 @@ function creat_thumbnail_images($imgName) require_once __DIR__ . '/class.thumb.php'; global $config; - $old_img_path = APP_ROOT . config_path() . $imgName; // 获取要创建缩略图文件的绝对路径 + $old_img_path = APP_ROOT . config_path() . $imgName; // 获取要创建缩略图文件的绝对路径 $cache_path = APP_ROOT . $config['path'] . 'cache/'; // cache目录的绝对路径 - if (!is_dir($cache_path)) { // 创建cache目录 + if (!is_dir($cache_path)) { // 创建cache目录 mkdir($cache_path, 0777, true); } - if (!isGifAnimated($old_img_path)) { // 仅针对非gif创建图片缩略图 + if (!isGifAnimated($old_img_path)) { // 仅针对非gif创建图片缩略图 $new_imgName = APP_ROOT . $config['path'] . 'cache/' . date('Y_m_d') . '_' . $imgName; // 缩略图缓存的绝对路径 - Thumb::out($old_img_path, $new_imgName, $config['thumbnail_w'], $config['thumbnail_h']); // 保存缩略图 + Thumb::out($old_img_path, $new_imgName, $config['thumbnail_w'], $config['thumbnail_h']); // 保存缩略图 } } @@ -1012,13 +1030,13 @@ function return_thumbnail_images($url) global $config; $cache_image_file = str_replace($config['imgurl'], '', $url); - if (isGifAnimated(APP_ROOT . $cache_image_file)) { // 仅读取非gif的缩略图 - return $url; // 如果是gif则直接返回url + if (isGifAnimated(APP_ROOT . $cache_image_file)) { // 仅读取非gif的缩略图 + return $url; // 如果是gif则直接返回url } else { - $cache_image_file = str_replace($config['path'], '', $cache_image_file); // 将网址中的/i/去除 - $cache_image_file = str_replace('/', '_', $cache_image_file); // 将文件的/转换为_ + $cache_image_file = str_replace($config['path'], '', $cache_image_file); // 将网址中的/i/去除 + $cache_image_file = str_replace('/', '_', $cache_image_file); // 将文件的/转换为_ $isFile = APP_ROOT . $config['path'] . 'cache/' . $cache_image_file; // 缓存文件的绝对路径 - if (file_exists($isFile)) { // 缓存文件是否存在 + if (file_exists($isFile)) { // 缓存文件是否存在 return $config['imgurl'] . $config['path'] . 'cache/' . $cache_image_file; // 存在则返回缓存文件 } else { return $url; // 不存在直接返回url @@ -1051,7 +1069,7 @@ function creat_thumbnail_by_list($imgUrl) { global $config; - ini_set('max_execution_time', '300'); // 脚本运行的时间(以秒为单位)0不限制 + ini_set('max_execution_time', '300'); // 脚本运行的时间(以秒为单位)0不限制 // 过滤非指定格式 if (!in_array(pathinfo($imgUrl, PATHINFO_EXTENSION), array('png', 'gif', 'jpeg', 'jpg', 'webp', 'bmp'))) { @@ -1091,7 +1109,7 @@ function creat_thumbnail_by_list($imgUrl) if (isGifAnimated($abPathName)) { return $imgUrl; } - // 如果是webp动图则直接返回网址 + // 如果是webp动图则直接返回网址 if (isWebpAnimated($abPathName)) { return $imgUrl; } @@ -1219,7 +1237,7 @@ function writefile($filename, $writetext, $openmod = 'w') /** * 获得用户的真实IP地址 * 来源:ecshop - * @return mixed|string string + * @return mixed|string string */ function real_ip() { @@ -1267,7 +1285,7 @@ function real_ip() /** * IP黑白名单检测,支持IP段检测 * @param string $ipNow 要检测的IP - * @param string|array $ipList 白名单IP或者黑名单IP + * @param string|array $ipList 白名单IP或者黑名单IP * @return boolean false|true true:白名单模式,false:黑名单模式 * @return bool */ @@ -1324,7 +1342,7 @@ function privateToken($length = 32) { $output = ''; for ($a = 0; $a < $length; $a++) { - $output .= chr(mt_rand(65, 122)); //生成php随机数 + $output .= chr(mt_rand(65, 122)); //生成php随机数 } return md5($output); } @@ -1395,7 +1413,7 @@ function rand_imgurl($text = null) { global $config; $url = isset($text) ? $text : $config['imgurl']; - $url = explode(',', $url); + $url = explode(',', $url); return $url[array_rand($url, 1)]; } @@ -1450,11 +1468,11 @@ function water($source) // 过滤gif if (!is_Gif_Webp_Animated($source)) { $arr = [ - # 水印图片路径(如果不存在将会被当成是字符串水印) + # 水印图片路径(如果不存在将会被当成是字符串水印) 'res' => $config['waterText'], - # 水印显示位置 + # 水印显示位置 'pos' => $config['waterPosition'], - # 不指定name(会覆盖原图,也就是保存成thumb.jpeg) + # 不指定name(会覆盖原图,也就是保存成thumb.jpeg) 'name' => $source, 'font' => APP_ROOT . $config['textFont'], 'fontSize' => $config['textSize'], @@ -1726,7 +1744,7 @@ function write_login_log($user, $pass, $msg) * @param String $way 使用方式 upload 上传 | delete 删除 */ -function any_upload($remoteFile = null, $localFile = null, $way = 'upload') +function FTP_upload($remoteFile = null, $localFile = null, $way = 'upload') { global $config; @@ -1757,4 +1775,62 @@ function any_upload($remoteFile = null, $localFile = null, $way = 'upload') break; } $ftp->close(); + // 上传完毕是否删除本地文件 + if ($config['ftped_del_local']) { + @unlink($localFile); + } +} + +/** + * 其他上传 + * 支持: FTP上传 + * @link https://github.com/dg/ftp-php + * @param String $remoteFile 远程地址 + * @param String $localFile 本地地址 + * @param String $way 使用方式 upload 上传 | delete 删除 + */ + +function any_upload($remoteFile = null, $localFile = null, $way = 'upload') +{ + global $config; + + if (!$config['ftp_status']) exit; + require_once __DIR__ . '/Ftp.php'; + + // 登录FTP + try { + $ftp = new Ftp; + $ftp->connect($config['ftp_host'], $config['ftp_port'], $config['ftp_time']); + $ftp->login($config['ftp_user'], $config['ftp_pass']); + $ftp->pasv($config['ftp_pasv']); + } catch (FtpException $e) { + echo 'Error: ', $e->getMessage(); + } + + switch ($way) { + case 'upload': + try { + // 创建文件夹 + $dir = pathinfo($remoteFile, PATHINFO_DIRNAME); + if (!$ftp->isDir($dir)) { + $ftp->mkDir($dir); + } + + // 上传文件 远端->本地 + $ftp->put($remoteFile, $localFile); + } catch (FtpException $e) { + echo 'Error: ', $e->getMessage(); + } + break; + case 'delete': + $ftp->tryDelete($remoteFile); + break; + } + // 关闭FTP + $ftp->close(); + + // 上传完毕是否删除本地文件 + if ($config['ftped_del_local']) { + @unlink($localFile); + } } diff --git a/config/config.php b/config/config.php index 2375f39..c084380 100755 --- a/config/config.php +++ b/config/config.php @@ -22,6 +22,7 @@ $config=Array 'ftp_pasv'=>1, 'ftp_ssl'=>0, 'ftp_time'=>30, + 'ftped_del_local'=>0, 'captcha'=>0, 'mustLogin'=>0, 'apiStatus'=>0, @@ -70,6 +71,7 @@ $config=Array 'listDate'=>10, 'customize'=>'', 'checkEnv'=>1, + 'Debug'=>1, 'allowed'=>1, 'upload_logs'=>1, 'cache_freq'=>2, @@ -130,5 +132,5 @@ $config=Array
', 'terms'=>'

服务条款


访问我们网站除主页和本“条款”页面以外的任何页面,即表示您同意这些使用条款和我们的隐私政策。如果您不同意,请不要使用我们的网站。

  1. 您使用我们的网站进行除简单访问/查看之外的任何事情(即上传、下载、评论等),不仅构成您的同意,而且构成您的电子签名,这意味着您受这些条款的合同约束,并且通过我们的隐私政策。
  2. 我们保留在使用过多带宽或以其他方式滥用系统的用户帐户上禁用直接链接的权利。
  3. 请勿上传儿童色情内容或威胁、骚扰、诽谤或鼓励非法行为的材料。不要使用本网站作为内容交付网络。如果你这样做(我们将成为法官),或者如果你做了任何违法的事情,除了我们可能拥有的任何其他合法权利之外,我们将禁止你以及你从中盗链的网站,删除你的所有图片,报告如有必要,您可以向当局报告,并阻止您查看本网站上托管的任何图像。我们是认真的。
  4. 用户必须同意遵守适用于其所在地的所有法律,包括版权和商标法。不允许使用侵犯版权或商标的图片。如果有人对您提出侵权索赔,您将被要求删除受版权保护的文件,直到问题得到解决。如果本网站的参与者之间存在争议,我们没有义务参与其中。
  5. 您可以匿名上传图像,并与您的朋友、家人、在线站点以及社交网络在线共享。
  6. 如果您在我们的网站上看到任何不应该出现的内容,因为它违反了我们的政策或出于任何其他原因,请通过电子邮件联系告知我们
  7. 声明通知中的信息准确无误,否则会受到伪证处罚。为此,请包括以下声明: “我发誓,通知中的信息准确无误,并且我是(版权)所有者或被授权代表专有权的所有者行事,在作伪证的处罚下涉嫌侵权”。

如果发生调查,本网站承诺与任何和所有法律机构合作。

隐私政策


一般:

当您访问本网站或使用本政策中进一步概述的服务(“服务”)时,本网站致力于保护您的隐私。作为使用本网站服务的条件,您同意向本网站提供某些个人信息。该信息包括但不限于: 电子邮件地址和您计算机的唯一 IP 地址(如果有)、财务信息(您的 Paypal 帐户使用的电子邮件地址)和人口统计信息(例如,邮政编码、邮政编码、家乡、性别、购买历史信息和年龄以及不是您计算机独有的 IP 地址)。请注意,我们不会在本网站的任何地方故意收集 13 岁以下儿童的联系信息或财务信息。请定期查看本隐私政策,因为我们可能会不时对其进行更新。本隐私政策的最后修订日期为 2021年10月25日。您每次访问本网站、使用服务或向我们提供信息时,即表示您当时接受本隐私政策中描述的做法。您同意,通过使用本网站,您明确并肯定地同意我们使用和披露您提供的信息,并同意接收电子邮件,如下面的隐私政策所述。

隐私政策变更:

随着新功能添加到网站或我们纳入用户的建议,本政策可能会随着时间的推移进行修订。如果我们打算以与我们收集信息时声明的方式大不相同的方式使用或披露您的个人身份信息,您将可以选择我们是否以这种新方式使用或披露您的信息。我们还将在我们的网站显着位置发布隐私政策已修订的通知,以便您可以随时查看我们收集的信息、我们将如何使用该信息以及在何种条件下我们将向任何人披露这些信息。

如何使用您的信息:

我们使用联系信息(即您的电子邮件地址)来帮助我们有效地执行帐户任务(更改密码、找回丢失的密码)、提供您请求的服务、执行质量保证、销售分析和其他业务分析,并就相关事宜与您联系与您向我们下的任何订单。除非满足任何法律、法规、政府要求或司法命令,否则不会将您的财务信息用于其他用途。当您通过本网站进行购买或在本网站注册时,您将向我们提供一个电子邮件地址,我们或这些服务提供商可能会出于本段所述目的与您联系。

联系您获取优惠和促销信息:

您同意,考虑到我们提供的服务的使用,允许我们使用您的个人信息向您发送营销和促销材料。我们也可能向您发送宣传第三方产品的营销和宣传材料。我们不会出租或出售您的个人信息以供第三方使用。这些材料可能包括但不限于: 向您提供有关如何使用服务的附加信息的时事通讯,以及来自我们或第三方的商品和服务的促销优惠。

人口统计信息的使用:

我们可能会使用您的人口统计信息进行业务分析或根据您的兴趣定制网站和通讯。我们可能会与广告商和其他第三方共享匿名的汇总人口统计信息,以便他们可以针对适当的受众定制广告和通信。在本隐私政策允许我们共享您的联系信息或财务信息的任何时候,我们也可能会同时共享您的人口统计信息。

向政府实体披露:

当我们确定此类披露是遵守法律、与执法部门合作或寻求执法协助或保护我们或网站其他访问者或用户的利益或安全时,我们可能会披露特定的联系信息。服务。此外,如果我们发生合并、收购、合并、剥离或破产,您的联系信息可能会传递给第三方。

Cookie 和其他网站跟踪数据的使用:

Cookies : “cookie”是我们保存在您计算机硬盘上的包含非个人信息的小文件。这些 cookie 有助于让您更快地访问您已经访问过的页面。它们还允许您个性化您的页面,并优化您在我们网站上的体验。我们还使用 cookie 来帮助我们了解有多少人访问了我们的网站、他们访问了我们的哪些网页以及他们在那里停留的时间。此信息可帮助我们确定我们的哪些网络功能非常成功以及哪些网站可能需要改进。您可以通过在浏览器的首选项或选项菜单中指明这一点来禁用计算机上的 cookie。大多数浏览器会自动接受 cookie,但允许您禁用它们。禁用 cookie 可能会阻止您正确使用服务或访问网站。

会话 ID:

“会话 ID”允许我们在多个网页请求中识别特定用户。此会话 ID 会尽可能保存在您的 cookie 文件中。如果 cookie 未启用,或者如果用户的 Internet 浏览器程序不支持 cookie,则我们将在请求的网页中放置会话 ID。这使最终用户不必为每个网页请求不断地重新输入某些信息,例如帐户名和密码。每当用户关闭其 Internet 浏览器时,此会话 ID 就会过期。

网站跟踪、报告:

我们的许多网页还包含特殊的电子图像(称为“单像素 gif”或“gif”),使我们能够仅收集非个人身份的流量统计数据和有关我们网站访问者的其他汇总信息。本站(通过自身或第三方)使用此技术收集和积累匿名数据,帮助我们了解和分析访问我们网站的人的体验,并连同您提供的其他信息,定制您未来的访问并改进我们的网站网站。例如,我们捕获有关所用浏览器类型、操作系统软件(例如 Windows 95 与 98 或 Macintosh)、cookie 偏好(用户是否打开或关闭它们)和搜索引擎关键字(哪些关键字做了什么)的数据。访问者用于访问我们的网站)。我们还记录了访问次数,所采取的路径,以及在我们网站内的站点和页面上花费的时间。请记住,这些信息都不是个人身份信息,我们只将这些信息分发给我们的内部员工以及与我们签署了保密协议的合作伙伴。我们与合作伙伴共享的任何信息都反映了整个网站或 Internet 使用趋势,而不是个别信息。

IP地址:

每次您访问本网站时,我们都会自动收集您的 IP 地址和您来自的网页。为了为您管理和优化站点并诊断我们站点的问题,我们使用您的 IP 地址来帮助识别您的身份并收集有关您的广泛人口统计信息。

来自其他网站的信息:

我们可能会放置指向其他方运营的其他网站的链接,并且可能会不时在我们的促销电子邮件中包含指向第三方网站的信息和链接。其中一些其他网站包含我们的品牌名称和商标以及我们拥有的其他知识产权;其他人没有。当您点击这些链接并访问这些其他网站时,无论它们是否包含我们的品牌名称、商标和其他知识产权,您都需要注意,我们不控制这些其他网站或这些其他网站”商业惯例,并且本隐私政策不适用于这些其他网站。因此,这些其他网站的运营商可能会收集有关您的不同类型的信息,并且可能以不同于我们在网站上收集信息的方式使用和披露该信息。我们鼓励您查看他们的隐私政策,并提醒您我们不对他们的行为负责。

信息存储:

您理解并同意我们在服务器上存储和处理您的信息,并且通过向我们提供任何数据,您同意将此类信息传输到网站服务器。当您从我们帐户中删除文件时,您与该文件之间将不再存在任何链接。删除的文件可能会缓存在我们服务器中以节省带宽,以防其他人请求它们。

如何联系我们:

如果您对您提交给我们这个隐私政策或信息有任何疑问,您可以通过邮件方式联系我们

数字千年版权法案


要向我们提交版权侵权通知,您需要发送书面通知,其中包含《数字千年版权法》第 512(c)(3) 条要求和规定的信息。

要撰写适当的 DMCA 通知,请说明以下信息:

  1. 表明自己是您认为受到侵犯的版权作品或专有权的所有者,或代表此类所有者行事的人,并提供物理签名(纸质形式时)或电子签名(电子形式时) )。
  2. 指明您认为受到侵权的受版权保护的作品,或者如果有大量作品受到侵权,请提供作品的代表性清单。
  3. 通过在我们站点上提供包含这些材料的 Web URL,确定侵犯您的版权作品的材料的位置。请不要发送附加的图像、pdf 或其他文件格式的文件,而只能发送包含我们网址的列表。在信函正文中提供所有 URL 是帮助我们快速处理您的请求的最佳方式。
  4. 说明您的联系信息,包括您的姓名、街道地址、电话号码和电子邮件地址。如果您代表版权所有者行事,请同时说明您与版权所有者的关系(例如律师、供应商、代理人)。
  5. 声明您“真诚地相信上述材料的使用未经版权所有者、其代理人或法律授权”。
  6. 声明通知中的信息准确无误,否则会受到伪证处罚。为此,请包括以下声明: “我发誓,通知中的信息准确无误,并且我是(版权)所有者或被授权代表专有权的所有者行事,在作伪证的处罚下涉嫌侵权”。
  7. 请用中文书写,所有电子邮件是任何其他语言都将被忽略。
  8. 要行使您的 DMCA 权利,您必须将适当的 DMCA 通知发送至我们的指定代理至电子邮件。

未能包含上述所有信息可能会导致 DMCA 通知的处理延迟。请注意,根据 DMCA 第 512(f) 条,任何故意歪曲材料或活动侵权的人都可能需要承担责任。

如果我们收到声称侵犯版权的适当通知,它将通过删除或禁止访问声称侵权或成为侵权活动主题的材料迅速做出回应。请注意,我们不一定会向报告者发送有关删除操作的确认。

', - 'update'=>'2023-03-09 02:48:37' + 'update'=>'2023-03-09 21:43:52' ); \ No newline at end of file diff --git a/docs/update.md b/docs/update.md index 9b63110..6ddb3a8 100644 --- a/docs/update.md +++ b/docs/update.md @@ -1,7 +1,7 @@ * 2023-03-06 v2.7.8 - 增加WEB端上传签名 - 修改目录命名 `applicaton->app` -- 修复两处漏洞 +- 修复漏洞 * 2023-03-05 v2.7.7 - 增加登录日志 diff --git a/install/index.php b/install/index.php index 545fbca..366d122 100755 --- a/install/index.php +++ b/install/index.php @@ -191,7 +191,7 @@ function checkPASS($name) EasyImage By - Icret Version: + Icret Version: diff --git a/install/install.php b/install/install.php index 1483289..757ef40 100755 --- a/install/install.php +++ b/install/install.php @@ -181,7 +181,7 @@ if ($state !== 'checked') { EasyImage By - Icret Version: + Icret Version: