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'] = '��ȡ�����г���';
?>