TinyImg 2.0.0:更名、下线 SM.MS、新增后台 Token 设置页

基于 ImgURL 1.x 的二次开发版本,主要变更:

1. 更名
   - 项目定名为 TinyImg,源码中不再出现旧品牌字样(0 处)
   - static/imgurl.js -> static/tinyimg.js
   - db/imgurl-simple.db3 -> db/tinyimg-simple.db3

2. 移除 SM.MS 上传
   - 删除 embed.js 中的 upload.render / smshow / deletesm
   - miniup.html 去掉 SM.MS 选项卡;前台与后台导航移除入口
   - sm.php、functions/sm.php、admin/smadmin.php 改为下线说明页
   - admin/delete.php 移除 type=sm 分支;class.admin.php 删除 querysm()/deletesm()

3. 新增后台 Token 设置(admin/setting.php + functions/token.php)
   - 生成 / 自定义 / 启用 / 停用 / 清空,全部校验 Session CSRF
   - 存储于 db/tinyimg-token.php(首行 <?php exit; 守卫)
   - config.php 的 api_token 仅作兼容回退,保存一次后由文件接管
   - 完整 Token 不写入页面 HTML:默认只渲染掩码,点「显示/复制」时
     经 POST action=reveal(同源 + CSRF + 仅登录会话)按需取回

4. 上传端点鉴权
   - 统一使用 X-TinyImg-Token 请求头,hash_equals 比较,空配置 fail closed
   - 新增 ?ping=1 自检,返回版本、鉴权方式、管理员目录,供写作插件测试连接

5. 版本号
   - 统一为 v2.0.0(20261104),前后台页脚引用 functions/version.php

6. 兼容性修复
   - class.upload.php 中 $size{...} 花括号下标改为 $size[...](PHP 8 已移除该语法)

7. 仓库整理
   - .gitignore 排除 config.php / db/tinyimg-token.php / 运行时目录,
     保留 db/.htaccess 与空模板 db/tinyimg-simple.db3
   - .gitattributes 统一 LF
This commit is contained in:
terry
2026-11-05 17:30:05 +08:00
parent 39e84a0fac
commit aac91aa9b6
180 changed files with 15976 additions and 2 deletions
@@ -0,0 +1,86 @@
<?php
// +------------------------------------------------------------------------+
// | class.upload.zh_CN.php |
// +------------------------------------------------------------------------+
// | Copyright (c) caoshiwei 2008. All rights reserved. |
// | Version 0.25 |
// | Last modified 09/29/2008 |
// | Email [email protected] |
// | Web http://www.hfut.edu.cn |
// +------------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License version 2 as |
// | published by the Free Software Foundation. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the |
// | Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
// | Boston, MA 02111-1307 USA |
// | |
// | Please give credit on sites that use class.upload and submit changes |
// | of the script so other people can use them as well. |
// | This script is free to use, don't abuse. |
// +------------------------------------------------------------------------+
/**
* Class upload Chinese translation
*
* @version 0.25
* @codepage gb-2312
* @author Shiwei Cao ([email protected])
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @copyright Shiwei Cao
* @package cmf
* @subpackage external
*/
$translation = array();
$translation['file_error'] = '�ļ������������ԡ�';
$translation['local_file_missing'] = '�����ļ������ڡ�';
$translation['local_file_not_readable'] = '�����ļ����ɶ��';
$translation['uploaded_too_big_ini'] = '�ļ��ϼ����� (�ϴ����ļ���С������php.ini��upload_max_filesize���õĴ�С)��';
$translation['uploaded_too_big_html'] = '�ļ��ϼ����� (�ϴ����ļ���С������HTML �����õĴ�С)��';
$translation['uploaded_partial'] = '�ļ��ϼ����� (�ϴ����ļ����ֶ�ʧ)��';
$translation['uploaded_missing'] = '�ļ��ϼ����� (�ϴ��ļ���ʧ)��';
$translation['uploaded_unknown'] = '�ļ��ϼ����� (δ֪����).';
$translation['try_again'] = '�ļ��ϼ����� �����ԡ�';
$translation['file_too_big'] = '�ļ�̫����';
$translation['no_mime'] = 'δ֪�ļ����͡�';
$translation['incorrect_file'] = '����ȷ���ļ���ʽ��';
$translation['image_too_wide'] = 'ͼƬ����̫����';
$translation['image_too_narrow'] = 'ͼƬ����̫С��';
$translation['image_too_high'] = 'ͼƬ�߶�̫����';
$translation['image_too_short'] = 'ͼƬ�߶�̫С��';
$translation['ratio_too_high'] = 'ͼƬ��/�߱���̫��(ͼƬ����̫��)��';
$translation['ratio_too_low'] = 'ͼƬ��/�߱���̫��(ͼƬ�߶�̫��).';
$translation['too_many_pixels'] = 'ͼƬλ��̫�ߡ�';
$translation['not_enough_pixels'] = 'ͼƬλ������';
$translation['file_not_uploaded'] = '�ļ�δ�ϴ������ܽ��д���';
$translation['already_exists'] = '%s �Ѿ����ڣ��������ļ�����';
$translation['temp_file_missing'] = '������(��ʱ)Դ�ļ�����ȷ�����ܽ��д���';
$translation['source_missing'] = '���ϴ����ļ���ʧ�����ܽ��д���';
$translation['destination_dir'] = 'Ŀ���ļ�Ŀ¼���ܱ����������ܽ��д���';
$translation['destination_dir_missing'] = 'Ŀ���ļ�Ŀ¼�����ڣ����ܽ��д���';
$translation['destination_path_not_dir'] = 'Ŀ¼·������һ����Ч��Ŀ¼�����ܽ��д���';
$translation['destination_dir_write'] = '������Ŀ���ļ�Ŀ¼����Ϊ��д�ģ����ܽ��д���';
$translation['destination_path_write'] = 'Ŀ¼·���Dz�����д�ģ����ܽ��д���';
$translation['temp_file'] = '���ܴ�����ʱ�ļ������ܽ��д���';
$translation['source_not_readable'] = 'Դ�ļ������Զ�����ܽ��д���';
$translation['no_create_support'] = '%s ��֧�ִ���';
$translation['create_error'] = '��Դ�ļ����� %s ͼƬ�����г���';
$translation['source_invalid'] = '�޷���ȡԭʼͼƬ��ȷ���Dz�����ȷ��ͼƬ�ļ���';
$translation['gd_missing'] = 'GD ���񲻿���ʹ�á�';
$translation['watermark_no_create_support'] = '%s ������֧��, ���ܶ�ȡˮӡ�ļ���';
$translation['watermark_create_error'] = '%s ��֧�ֶ�, ���ܴ���ˮӡ��';
$translation['watermark_invalid'] = 'δ֪�ļ���ʽ, �޷���ȡˮӡ�ļ���';
$translation['file_create'] = '%s ��֧�ִ�����';
$translation['no_conversion_type'] = 'δ����ת������';
$translation['copy_failed'] = '�ڷ������ϸ����ļ�ʱ���� copy() ����ʧ��.';
$translation['reading_failed'] = '��ȡ�����г���';
?>
@@ -0,0 +1,85 @@
<?php
// +------------------------------------------------------------------------+
// | class.upload.zh_CN.php |
// +------------------------------------------------------------------------+
// | Copyright (c) caoshiwei 2008. All rights reserved. |
// | Version 0.25 |
// | Last modified 09/29/2008 |
// | Email [email protected] |
// | Web http://www.hfut.edu.cn |
// +------------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License version 2 as |
// | published by the Free Software Foundation. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the |
// | Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
// | Boston, MA 02111-1307 USA |
// | |
// | Please give credit on sites that use class.upload and submit changes |
// | of the script so other people can use them as well. |
// | This script is free to use, don't abuse. |
// +------------------------------------------------------------------------+
/**
* Class upload Chinese translation
*
* @version 0.25
* @author Shiwei Cao ([email protected])
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @copyright Shiwei Cao
* @package cmf
* @subpackage external
*/
$translation = array();
$translation['file_error'] = '文件错误,请重试。';
$translation['local_file_missing'] = '本地文件不存在。';
$translation['local_file_not_readable'] = '本地文件不可读。';
$translation['uploaded_too_big_ini'] = '文件上件出错 (上传的文件大小超过了php.ini中upload_max_filesize设置的大小)。';
$translation['uploaded_too_big_html'] = '文件上件出错 (上传的文件大小超过了HTML 表单设置的大小)。';
$translation['uploaded_partial'] = '文件上件出错 (上传的文件部分丢失)。';
$translation['uploaded_missing'] = '文件上件出错 (上传文件丢失)。';
$translation['uploaded_unknown'] = '文件上件出错 (未知错误).';
$translation['try_again'] = '文件上件出错。 请重试。';
$translation['file_too_big'] = '文件太大。';
$translation['no_mime'] = '未知文件类型。';
$translation['incorrect_file'] = '不正确的文件格式。';
$translation['image_too_wide'] = '图片宽度太大。';
$translation['image_too_narrow'] = '图片宽度太小。';
$translation['image_too_high'] = '图片高度太大。';
$translation['image_too_short'] = '图片高度太小。';
$translation['ratio_too_high'] = '图片宽/高比率太高(图片宽度太大)。';
$translation['ratio_too_low'] = '图片宽/高比率太低(图片高度太大).';
$translation['too_many_pixels'] = '图片位数太高。';
$translation['not_enough_pixels'] = '图片位数不够';
$translation['file_not_uploaded'] = '文件未上传,不能进行处理。';
$translation['already_exists'] = '%s 已经存在,请更换文件名。';
$translation['temp_file_missing'] = '处理的(临时)源文件不正确,不能进行处理。';
$translation['source_missing'] = '已上传的文件丢失,不能进行处理。';
$translation['destination_dir'] = '目标文件目录不能被创建,不能进行处理。';
$translation['destination_dir_missing'] = '目标文件目录不存在,不能进行处理。';
$translation['destination_path_not_dir'] = '目录路径不是一个有效的目录,不能进行处理。';
$translation['destination_dir_write'] = '不能让目标文件目录设置为可写的,不能进行处理。';
$translation['destination_path_write'] = '目录路径是不可以写的,不能进行处理。';
$translation['temp_file'] = '不能创建临时文件,不能进行处理。';
$translation['source_not_readable'] = '源文件不可以读,不能进行处理。';
$translation['no_create_support'] = '%s 不支持创建';
$translation['create_error'] = '从源文件创建 %s 图片过程中出错。';
$translation['source_invalid'] = '无法读取原始图片,确认是不是正确的图片文件?';
$translation['gd_missing'] = 'GD 好像不可以使用。';
$translation['watermark_no_create_support'] = '%s 创建不支持, 不能读取水印文件。';
$translation['watermark_create_error'] = '%s 不支持读, 不能创建水印。';
$translation['watermark_invalid'] = '未知文件格式, 无法读取水印文件。';
$translation['file_create'] = '%s 不支持创建。';
$translation['no_conversion_type'] = '未定义转换类型';
$translation['copy_failed'] = '在服务器上复制文件时出错。 copy() 操作失败.';
$translation['reading_failed'] = '读取过程中出错。';
?>
@@ -0,0 +1,87 @@
<?php
// +------------------------------------------------------------------------+
// | class.upload.zh_TW.php |
// +------------------------------------------------------------------------+
// | Copyright (c) Yang Chih-Wen 2009. All rights reserved. |
// | Version 0.28 |
// | Last modified 15/08/2009 |
// | Email [email protected] |
// | Web http://www.doubleservice.com/ |
// +------------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License version 2 as |
// | published by the Free Software Foundation. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the |
// | Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
// | Boston, MA 02111-1307 USA |
// | |
// | Please give credit on sites that use class.upload and submit changes |
// | of the script so other people can use them as well. |
// | This script is free to use, don't abuse. |
// +------------------------------------------------------------------------+
/**
* Class upload Traditional Chinese translation
*
* @version 0.28
* @author Yang Chih-Wen ([email protected])
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @copyright Yang Chih-Wen
* @package cmf
* @subpackage external
*/
$translation = array();
$translation['file_error'] = '檔案錯誤,請重試。';
$translation['local_file_missing'] = '本地端的檔案不存在。';
$translation['local_file_not_readable'] = '本地端的檔案不可讀取。';
$translation['uploaded_too_big_ini'] = '檔案上傳出錯 (上傳的檔案超過了 php.ini 中 upload_max_filesize 指定的大小)。';
$translation['uploaded_too_big_html'] = '檔案上傳出錯 (上傳的檔案超過了 HTML 表單中 MAX_FILE_SIZE 指定的大小)。';
$translation['uploaded_partial'] = '檔案上傳出錯 (只有部份的檔案被上傳)。';
$translation['uploaded_missing'] = '檔案上傳出錯 (沒有檔案被上傳)。';
$translation['uploaded_no_tmp_dir'] = '檔案上傳出錯 (找不到暫存目錄)。';
$translation['uploaded_cant_write'] = '檔案上傳出錯 (檔案寫入失敗)。';
$translation['uploaded_err_extension'] = '檔案上傳出錯 (檔案上傳被 extension 中斷)。';
$translation['uploaded_unknown'] = '檔案上傳出錯 (未知的錯誤)。';
$translation['try_again'] = '檔案上傳出錯,請重試。';
$translation['file_too_big'] = '檔案太大了。';
$translation['no_mime'] = '未知的 MIME Type 檔案類型。';
$translation['incorrect_file'] = '不正確的 MIME Type 檔案類型。';
$translation['image_too_wide'] = '圖片寬度太大。';
$translation['image_too_narrow'] = '圖片寬度太小。';
$translation['image_too_high'] = '圖片高度太大。';
$translation['image_too_short'] = '圖片高度太小。';
$translation['ratio_too_high'] = '圖片寬高比率太大 (圖片寬度太大)。';
$translation['ratio_too_low'] = '圖片寬高比率太小 (圖片高度太大)。';
$translation['too_many_pixels'] = '圖片像素太多。';
$translation['not_enough_pixels'] = '圖片像素太少。';
$translation['file_not_uploaded'] = '檔案未上傳,無法繼續進行處理。';
$translation['already_exists'] = '%s 已經存在,請更改檔名。';
$translation['temp_file_missing'] = '暫存的原始檔案不正確,無法繼續進行處理。';
$translation['source_missing'] = '已上傳的原始檔案不正確,無法繼續進行處理。';
$translation['destination_dir'] = '無法創建目標目錄,無法繼續進行處理。';
$translation['destination_dir_missing'] = '目標目錄不存在,無法繼續進行處理。';
$translation['destination_path_not_dir'] = '目標路徑不是一個有效的目錄,無法繼續進行處理。';
$translation['destination_dir_write'] = '目標目錄不能設定為可寫入,無法繼續進行處理。';
$translation['destination_path_write'] = '目錄路徑不可寫入,無法繼續進行處理。';
$translation['temp_file'] = '不能創建暫存檔案,無法繼續進行處理。';
$translation['source_not_readable'] = '原始檔案不可讀取,無法繼續進行處理。';
$translation['no_create_support'] = '不支援 %s 創建功能。';
$translation['create_error'] = '從原始檔案創建 %s 圖片過程中出錯。';
$translation['source_invalid'] = '無法讀取原始圖片,請確認是否為正確的圖片檔?';
$translation['gd_missing'] = '無法使用 GD 函式庫。';
$translation['watermark_no_create_support'] = '不支援 %s 創建功能,無法讀取浮水印。';
$translation['watermark_create_error'] = '不支援 %s 讀取功能,無法創建浮水印。';
$translation['watermark_invalid'] = '未知的圖片格式,無法讀取浮水印。';
$translation['file_create'] = '不支援 %s 創建功能。';
$translation['no_conversion_type'] = '未定義的轉換類型。';
$translation['copy_failed'] = '在伺服端複製檔案時出錯,copy() 操作失敗。';
$translation['reading_failed'] = '讀檔過程中出錯。';
?>