木漏茶室源码下载中心
整站 PHP 源码:可浏览文件、复制路径、下载单文件或打包 ZIP。
发布版本 v6.25.232
升级后自动生成独立源码包,下载中心只发送这份冻结包
已排除 config.php / 用户数据 / 上传文件 / 升级备份
COMMUNITY DEPLOYMENTS
已经跑起来的木漏茶室
从源码下载中心下载、完成安装并回传验证的站外站点。每个站点只计 1 次部署下载量;已记录站点会实时读取名称、版本、Logo 与在线状态,本机、内网和证书异常站点无法完成回传。
实时检测
2
个站点已部署
木
木漏茶室
mlcs.xnn.lol · v6.25.232
访问 ↗
2026.11.21
在线
木
木漏茶室
mlcs.nbnb.mom · v6.25.232
访问 ↗
2026.11.20
在线
已展示全部 2 个站点。
admin/verify.php
11.9 KB · 发布包 v6.25.232
<?php
/**
* 后台 · 认证审核:待审值独立保存,通过后才替换前台认证
*/
$vStyles = verify_styles();
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
check_csrf();
$act = input('act');
$uid = (int) input('uid');
$user = user_by_id($uid);
if (!$user) {
flash('用户不存在', 'err');
redirect(admin_url('verify'));
}
if ($act === 'approve') {
$type = input('verify_type', $user['verify_pending_type'] ?: $user['verify_type']) === 'professional' ? 'professional' : 'official';
$style = (string) input('verify_style', $user['verify_pending_style'] ?: verify_style_of($user));
if (!isset($vStyles[$style])) {
$style = verify_style_of($user);
}
$title = mb_substr(trim((string) ($_POST['verify_title'] ?? ($user['verify_pending_title'] ?: $user['verify_title']))), 0, 60);
$info = mb_substr(trim((string) ($_POST['verify_info'] ?? ($user['verify_pending_info'] ?: $user['verify_info']))), 0, 200);
if ($info === '') {
$info = $title !== '' ? $title : '认证账号';
}
DB::run('UPDATE ' . DB::table('users') . ' SET verified = 1, verify_status = 2, verify_type = ?, verify_style = ?, verify_title = ?, verify_info = ?, verify_reason = ?, verify_paid = 0, verify_pending_type = ?, verify_pending_style = ?, verify_pending_title = ?, verify_pending_info = ? WHERE id = ?',
[$type, $style, $title, $info, '', '', '', '', '', $uid]);
$wasVerified = (int) $user['verified'] === 1;
notify($uid, current_user()['id'], 'verify', $uid, $wasVerified ? '你的认证变更已通过:' . $vStyles[$style][0] : '你的认证申请已通过:' . $vStyles[$style][0]);
flash('已通过 ' . display_name($user) . ' 的认证,前台展示 ' . $vStyles[$style][0]);
} elseif ($act === 'reject') {
$reason = mb_substr(trim((string) ($_POST['reason'] ?? '')), 0, 100);
if ($reason === '') {
flash('请填写驳回理由,用户会在认证中心看到该原因', 'err');
redirect(admin_url('verify'));
}
// 驳回不撤销原有认证;已支付的本次申请积分原路退还,且只退一次。
$paid = (int) ($user['verify_paid'] ?? 0);
$refunded = 0;
if ($paid > 0) {
DB::$pdo->beginTransaction();
try {
$stmt = DB::run('UPDATE ' . DB::table('users') . ' SET verify_status = 3, verify_reason = ?, verify_paid = 0 WHERE id = ? AND verify_paid = ?', [$reason, $uid, $paid]);
if ($stmt->rowCount() > 0) {
add_points((int) $user['id'], $paid);
DB::insert('point_logs', [
'user_id' => (int) $user['id'],
'action' => 'verify',
'delta' => $paid,
'note' => '认证申请未通过,退还 ' . $paid . ' 积分:' . $reason,
'created_at' => now(),
]);
$refunded = $paid;
}
DB::$pdo->commit();
} catch (Throwable $e) {
if (DB::$pdo->inTransaction()) { DB::$pdo->rollBack(); }
flash('驳回时退还积分失败,请稍后重试', 'err');
redirect(admin_url('verify'));
}
} else {
DB::run('UPDATE ' . DB::table('users') . ' SET verify_status = 3, verify_reason = ?, verify_paid = 0 WHERE id = ?', [$reason, $uid]);
}
$refundText = $refunded > 0 ? ';已退还 ' . $refunded . ' 积分' : '';
notify($uid, current_user()['id'], 'verify', $uid, '你的认证申请被驳回:' . $reason . $refundText . ((int) $user['verified'] === 1 ? '(原有认证 V 继续保留)' : ''));
flash('已驳回该认证申请,原有认证状态保持不变' . ($refunded > 0 ? ';已退还 ' . $refunded . ' 积分' : ''));
} elseif ($act === 'revoke') {
DB::run('UPDATE ' . DB::table('users') . ' SET verified = 0, verify_status = 0, verify_reason = ?, verify_paid = 0, verify_pending_type = ?, verify_pending_style = ?, verify_pending_title = ?, verify_pending_info = ? WHERE id = ?',
['管理员撤销', '', '', '', '', $uid]);
notify($uid, current_user()['id'], 'verify', $uid, '管理员撤销了你的认证');
flash('已撤销该用户的认证');
}
redirect(admin_url('verify'));
}
$status = input('status', '0');
$status = in_array($status, ['0', '1', '2'], true) ? $status : '0';
$pending = DB::all('SELECT * FROM ' . DB::table('users') . ' WHERE verify_status = 1 ORDER BY id DESC LIMIT 100');
$approved = DB::all('SELECT * FROM ' . DB::table('users') . ' WHERE verified = 1 ORDER BY id DESC LIMIT 100');
$rejected = DB::all('SELECT * FROM ' . DB::table('users') . ' WHERE verify_status = 3 ORDER BY id DESC LIMIT 100');
$pendingCount = DB::count('users', 'verify_status = 1');
$approvedCount = DB::count('users', 'verified = 1');
$rejectedCount = DB::count('users', 'verify_status = 3');
/**
* 取本次申请值;老数据没有待审字段时回退到正式字段
*/
function verify_review_request($u, $styles)
{
$type = (string) ($u['verify_pending_type'] ?? '');
if ($type === '') $type = (string) ($u['verify_type'] ?? 'official');
$style = (string) ($u['verify_pending_style'] ?? '');
if (!isset($styles[$style])) $style = verify_style_of($u);
$title = (string) ($u['verify_pending_title'] ?? '');
if ($title === '') $title = (string) ($u['verify_title'] ?? '');
$info = (string) ($u['verify_pending_info'] ?? '');
if ($info === '') $info = (string) ($u['verify_info'] ?? '');
return [$type === 'professional' ? 'professional' : 'official', $style, $title, $info];
}
?>
<div class="admin-head">
<div><h1>认证审核</h1><p><?= (int) $pendingCount ?> 份待审核 · 已通过 <?= (int) $approvedCount ?> 位 · 已驳回 <?= (int) $rejectedCount ?> 份</p></div>
<div class="admin-quick">
<a class="btn-mini <?= $status === '0' ? '' : 'ghost' ?>" href="<?= e(admin_url('verify', ['status' => '0'])) ?>">待审核<?php if ($pendingCount): ?><i class="report-tab-badge"><?= (int) $pendingCount ?></i><?php endif; ?></a>
<a class="btn-mini <?= $status === '1' ? '' : 'ghost' ?>" href="<?= e(admin_url('verify', ['status' => '1'])) ?>">已通过</a>
<a class="btn-mini <?= $status === '2' ? '' : 'ghost' ?>" href="<?= e(admin_url('verify', ['status' => '2'])) ?>">已驳回</a>
</div>
</div>
<?php if ($status === '0'): ?>
<section class="panel">
<h2 class="section-title">待审核</h2>
<?php if (!$pending): ?>
<?php empty_state('没有待审核的申请'); ?>
<?php else: ?>
<?php foreach ($pending as $u): ?>
<?php list($rType, $rStyle, $rTitle, $rInfo) = verify_review_request($u, $vStyles); ?>
<div class="verify-card">
<div class="verify-user">
<?= avatar_html($u) ?>
<div>
<a href="<?= e(page_url('user', ['id' => $u['id']])) ?>"><?= e(display_name($u)) ?></a>
<span>@<?= e($u['username']) ?> · 申请于 <?= e(time_ago($u['created_at'])) ?></span>
<span>当前:<?php if ((int) $u['verified'] === 1): ?><?= verify_badge($u) ?> <?= e(verify_title_of($u)) ?><?php else: ?>未认证<?php endif; ?></span>
<span>申请:<b class="v-badge v-<?= e($rStyle) ?>">V</b> <?= e($vStyles[$rStyle][0]) ?> · <?= e($rType === 'professional' ? '职业认证' : '官方认证') ?> · 扣除 <?= (int) ($u['verify_paid'] ?? 0) ?> 积分</span>
<?php if ($rTitle !== ''): ?><span>称号:<?= e($rTitle) ?></span><?php endif; ?>
<span>说明:<?= e($rInfo) ?></span>
</div>
</div>
<form method="post" class="verify-form">
<?= csrf_field() ?>
<input type="hidden" name="uid" value="<?= (int) $u['id'] ?>">
<label>认证类型</label>
<select name="verify_type">
<option value="official" <?= $rType === 'official' ? 'selected' : '' ?>>官方认证</option>
<option value="professional" <?= $rType === 'professional' ? 'selected' : '' ?>>职业认证</option>
</select>
<label>认证款式</label>
<select name="verify_style">
<?php foreach ($vStyles as $sk => $si): ?>
<option value="<?= e($sk) ?>" <?= $rStyle === $sk ? 'selected' : '' ?>><?= e($si[0]) ?></option>
<?php endforeach; ?>
</select>
<label>认证称号(前台展示)</label>
<input type="text" name="verify_title" maxlength="60" value="<?= e($rTitle) ?>">
<label>认证说明(可修改)</label>
<textarea name="verify_info" rows="2" maxlength="200"><?= e($rInfo) ?></textarea>
<div class="verify-actions">
<button class="btn-mini" type="submit" name="act" value="approve">审核通过</button>
</div>
</form>
<form method="post" class="verify-reject">
<?= csrf_field() ?>
<input type="hidden" name="uid" value="<?= (int) $u['id'] ?>">
<input type="hidden" name="act" value="reject">
<input type="text" name="reason" maxlength="100" placeholder="驳回理由(必填)" required>
<button class="link-btn danger" type="submit">审核失败</button>
</form>
</div>
<?php endforeach; ?>
<?php endif; ?>
</section>
<?php elseif ($status === '1'): ?>
<section class="panel">
<h2 class="section-title">已通过认证</h2>
<?php if (!$approved): ?>
<?php empty_state('还没有认证用户'); ?>
<?php else: ?>
<div class="admin-table compact">
<?php foreach ($approved as $u): ?>
<div class="at-row">
<?= avatar_html($u, 'at-avatar') ?>
<div class="at-main"><a href="<?= e(page_url('user', ['id' => $u['id']])) ?>"><?= e(display_name($u)) ?></a>
<span><?= verify_badge($u) ?> · <?= e($u['verify_type'] === 'professional' ? '职业认证' : '官方认证') ?> · <?= e($u['verify_info']) ?></span></div>
<form method="post" class="inline-form" data-confirm="撤销该认证?">
<?= csrf_field() ?><input type="hidden" name="act" value="revoke"><input type="hidden" name="uid" value="<?= (int) $u['id'] ?>">
<button class="link-btn danger" type="submit">撤销</button>
</form>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</section>
<?php else: ?>
<section class="panel">
<h2 class="section-title">已驳回</h2>
<?php if (!$rejected): ?>
<?php empty_state('没有已驳回的认证申请'); ?>
<?php else: ?>
<div class="admin-table compact">
<?php foreach ($rejected as $u): ?>
<?php list($rType, $rStyle, $rTitle, $rInfo) = verify_review_request($u, $vStyles); ?>
<div class="at-row">
<?= avatar_html($u, 'at-avatar') ?>
<div class="at-main"><a href="<?= e(page_url('user', ['id' => $u['id']])) ?>"><?= e(display_name($u)) ?></a>
<span>申请:<?= e($vStyles[$rStyle][0]) ?> · 驳回原因:<?= e($u['verify_reason'] !== '' ? $u['verify_reason'] : '资料不足') ?></span>
<?php if ((int) $u['verified'] === 1): ?><span>原有认证:<?= verify_badge($u) ?> <?= e(verify_title_of($u)) ?>(继续保留)</span><?php endif; ?>
</div>
<form method="post" class="inline-form">
<?= csrf_field() ?><input type="hidden" name="act" value="approve"><input type="hidden" name="uid" value="<?= (int) $u['id'] ?>">
<input type="hidden" name="verify_type" value="<?= e($rType) ?>">
<input type="hidden" name="verify_style" value="<?= e($rStyle) ?>">
<input type="hidden" name="verify_title" value="<?= e($rTitle) ?>">
<input type="hidden" name="verify_info" value="<?= e($rInfo) ?>">
<button class="link-btn" type="submit">重新通过</button>
</form>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</section>
<?php endif; ?>