建议用 xiuno-plugin-dev skill 检查下插件。
严重 Bug(需修复)
# | 文件 | 行号 | 问题 | 影响 |
|---|
1 | model/LaityTipService.php
| L202 | validateTip 中 $receiver = function_exists('user_read') ? user_read($toUid) : user_read($toUid); — 两个分支相同,三元运算符无意义
| 死代码,回退逻辑失效 |
2 | model/LaityTipService.php
| L217 | $thread = function_exists('thread_read') ? thread_read($tid) : thread_read($tid); — 同上
| 死代码 |
3 | model/LaityTipService.php
| L567-584 | readUserRobust 注释说 4 级回退,但第 1、2 级都是 user_read,第 2 级应为 user_read_cache
| 回退链断裂 |
4 | hook/thread_plugin_body.htm
| L45 | $fu = function_exists('user_read') ? user_read(...) : user_read(...); — 同上
| 死代码 |
5 | route/laity_tip_open.php
| L47, L49 | $receiver = function_exists('user__read') ? user__read($toUid) : user_read($toUid); 然后访问 $receiver['display_name']。user__read 是原始层(纯 DB),不返回 display_name 虚拟字段(user_format() 派生)。应改为 user_read(业务层)
| display_name 永远为空,fallback 到 username,违反"优先使用 display_name"规范
|
规范违反
# | 文件 | 问题 | 项目规则 |
|---|
6 | hook/model_thread_delete_end.php、hook/model_post_delete_end.php、hook/model_route_table_end.php
| 缺少 <?php exit; 防护(而 model_inc_file.php 有) | skill 要求 PHP hook 有 <?php exit; 防直接访问 |
7 | hook/header_link_after.htm、hook/footer_js_after.htm
| CSS/JS 引用未带 static_version 版本号 | JS/CSS 修改后必须递增 conf.php 的 static_version 强制浏览器刷新 |
8 | setting.php L18、route/laity_tip_revoke.php L16
| if (intval($user['gid'] ?? 0) != 1) 只允许 gid=1,不允许 gid=2
| 项目规则:管理员组(gid=1,2)绕过版块权限。如是有意只允许超级管理员,需注释说明 |
9 | hook/header_link_after.htm L5、hook/footer_js_after.htm L6
| 路径拼接 $conf['view_url'] . '../plugin/Laity_tip/' 用相对路径 ../,部署环境变化时易断裂 | 建议用框架 plugin URL 函数或绝对路径 |
建议优化
# | 文件 | 问题 | 建议 |
|---|
10 | conf.json
| "bbs_version": "1.1.1"
| XIUNOX 建议用 1.1, 兼容版本1.1.0-1.1.xxx |
11 | install.php L168-178
| 主动 @include _include($lang_src) 预热 lang 缓存,$_SERVER['lang'] 赋值时机不规范 | 预热逻辑可能产生副作用,建议仅删缓存让框架按需重编译 |
12 | view/htm/setting.htm L19
| 手动写 <input type="hidden" name="csrf_token" value="..."> | 用 CsrfService::input() 更规范 |
13 | route/laity_tip_open.php L114
| CsrfService 不存在时 fallback 输出空 csrf_token | 空 token 会导致 CSRF 校验失败,建议直接报错或跳过 |
14 | view/htm/laity_tip_thread_rank.htm L33、laity_tip_sent.htm L34、laity_tip_received.htm L34
| <li class="py-3 border-top"> 用 border 分隔列表项
| 项目规则偏好用间距或 <hr> 分隔;且首项也会有 border-top |