SOURCE DOWNLOAD

木漏茶室源码下载中心

整站 PHP 源码:可浏览文件、复制路径、下载单文件或打包 ZIP。

发布版本 v6.25.231 升级后自动生成独立源码包,下载中心只发送这份冻结包 已排除 config.php / 用户数据 / 上传文件 / 升级备份
komorebi-forum 183 个节点 · PHP 8.3.37 · 完整源码 ZIP 1.31 MB
下载完整源码 ZIP 源码包大小:1.31 MB 安装教程 作者主页 免费开源 免费下载 ↓
COMMUNITY DEPLOYMENTS

已经跑起来的木漏茶室

从源码下载中心下载、完成安装并回传验证的站外站点。每个站点只计 1 次部署下载量;已记录站点会实时读取名称、版本、Logo 与在线状态,本机、内网和证书异常站点无法完成回传。

实时检测
2 个站点已部署

已展示全部 2 个站点。

pages/verify.php 8.1 KB · 发布包 v6.25.231
下载
<?php
/**
 * 认证中心:类型 / 认证款式(彩色 V)/ 认证称号 / 说明
 */
require_login();
feature_guard('verify');
$me = current_user();
$isAdmin = is_admin(current_user());
$status = (int) $me['verify_status'];
$styles = verify_styles();

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    check_csrf();
    $type = input('verify_type', 'official') === 'professional' ? 'professional' : 'official';
    $style = input('verify_style', 'blue');
    if (!isset($styles[$style]) || (!empty($styles[$style][2]) && !$isAdmin)) {
        $style = 'blue';
    }
    $title = mb_substr(trim((string) ($_POST['verify_title'] ?? '')), 0, 60);
    $info = mb_substr(trim((string) ($_POST['verify_info'] ?? '')), 0, 200);

    if ($info === '' && $isAdmin) {
        $info = '管理员认证';
    }
    if ($info === '') {
        flash('请填写认证说明,例如身份、作品或职业信息', 'err');
    } else {
        $cost = max(0, (int) setting('verify_cost', '200'));
        if ($isAdmin) {
            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, '', '', '', '', '', $me['id']]);
            flash('认证信息已保存,前台立即展示 ' . $styles[$style][0]);
            redirect(page_url('verify'));
        }
        if ($status === 1) {
            flash('申请正在审核中,请耐心等待', 'err');
            redirect(page_url('verify'));
        }
        if ($cost > 0 && (int) $me['points'] < $cost) {
            flash('认证需要消耗 ' . $cost . ' 积分,你当前只有 ' . (int) $me['points'] . ' 积分', 'err');
            redirect(page_url('verify'));
        }
        if ($cost > 0) {
            add_points($me['id'], -$cost);
            DB::insert('point_logs', [
                'user_id' => (int) $me['id'],
                'action' => 'verify',
                'delta' => -$cost,
                'note' => '认证申请:' . ($type === 'professional' ? '职业认证' : '官方认证') . ' · ' . $styles[$style][0],
                'created_at' => now(),
            ]);
        }
        // 只写入待审核值;当前已展示的认证 V 在管理员通过前保持不变
        DB::run('UPDATE ' . DB::table('users') . ' SET verify_status = 1, verify_pending_type = ?, verify_pending_style = ?, verify_pending_title = ?, verify_pending_info = ?, verify_reason = ?, verify_paid = ? WHERE id = ?',
            [$type, $style, $title, $info, '', $cost, $me['id']]);
        foreach (DB::all('SELECT id FROM ' . DB::table('users') . ' WHERE role IN (?,?)', ['admin', 'superadmin']) as $a) {
            notify($a['id'], $me['id'], 'verify', $me['id'], display_name($me) . ' 提交了认证申请:' . $styles[$style][0] . '(扣除 ' . $cost . ' 积分),待审核', page_url('admin', ['s' => 'verify']));
        }
        flash('认证申请已提交并扣除 ' . $cost . ' 积分,管理员审核后会通知你');
        redirect(page_url('verify'));
    }
}

$pendingType = (string) ($me['verify_pending_type'] ?? '');
$pendingStyle = (string) ($me['verify_pending_style'] ?? '');
$pendingTitle = (string) ($me['verify_pending_title'] ?? '');
$pendingInfo = (string) ($me['verify_pending_info'] ?? '');
$hasPending = in_array($status, [1, 3], true) && $pendingType !== '';

$curStyle = $hasPending && isset($styles[$pendingStyle]) ? $pendingStyle : verify_style_of($me);
if (!isset($styles[$curStyle]) || (!empty($styles[$curStyle][2]) && !$isAdmin)) {
    $curStyle = 'blue';
}
$curType = $hasPending ? $pendingType : ($me['verify_type'] !== '' ? $me['verify_type'] : 'official');
$curTitle = $hasPending ? $pendingTitle : (string) ($me['verify_title'] ?? '');
$curInfo = $hasPending ? $pendingInfo : (string) ($me['verify_info'] ?? '');
$vCost = max(0, (int) setting('verify_cost', '200'));
$submitLabel = $isAdmin ? '保存认证信息' : ($status === 1 ? '申请审核中' : ((int) $me['verified'] === 1 ? '提交认证变更' : '提交认证申请'));
if (!$isAdmin && $vCost > 0 && $status !== 1) {
    $submitLabel .= '(' . $vCost . ' 积分)';
}
$GLOBALS['PAGE'] = 'verify';
render_header('认证中心');
?>
<section class="verify-wrap">
  <div class="panel verify-panel">
    <div class="panel-head row">
      <div>
        <h1><?= $isAdmin ? '修改认证信息' : '认证中心' ?></h1>
        <p><?= $isAdmin ? '保存后立即生效并在前台展示大 V 标识。' : e(setting('verify_notice', '提交后由管理员审核,通过后在昵称旁展示彩色 V 标识。')) ?></p>
      </div>
      <?php if ((int) $me['verified'] === 1): ?>
        <div class="verify-current"><?= verify_badge($me) ?><span><?= e(verify_title_of($me)) ?></span></div>
      <?php endif; ?>
    </div>

    <div class="verify-status">
      <?php if ($status === 1 && !$isAdmin): ?>
        <span class="badge warn">审核中</span><p>你的申请已提交:<?= e($pendingInfo !== '' ? $pendingInfo : $curInfo) ?></p>
        <?php if ((int) $me['verified'] === 1): ?><p class="auth-tip">当前认证 V 继续保留,审核通过后才会替换为本次申请的款式。</p><?php endif; ?>
      <?php elseif ($status === 3 && !$isAdmin): ?>
        <span class="badge danger">未通过</span><p>驳回原因:<?= e($me['verify_reason'] !== '' ? $me['verify_reason'] : '资料不足') ?></p>
        <?php if ((int) $me['verified'] === 1): ?><p class="auth-tip">本次修改未通过,你原有的认证 V 仍然保留。</p><?php endif; ?>
      <?php elseif ((int) $me['verified'] === 1): ?>
        <span class="badge ok">已认证</span>
        <p><?= e(verify_title_of($me)) ?></p>
      <?php else: ?>
        <p>你还没有提交认证申请。</p>
      <?php endif; ?>
      <?php if (!$isAdmin): ?><p class="auth-tip">每次提交或修改认证消耗 <?= $vCost ?> 积分 · 当前余额:<?= (int) $me['points'] ?> 积分<?= $vCost === 0 ? '(当前免费)' : ' · 审核未通过将退还本次积分' ?></p><?php endif; ?>
    </div>

    <form method="post" class="verify-form-card">
      <?= csrf_field() ?>
      <input type="hidden" name="act" value="save">

      <label class="vf-label">认证类型</label>
      <div class="type-pills">
        <label class="type-pill <?= $curType === 'official' ? 'on' : '' ?>">
          <input type="radio" name="verify_type" value="official" <?= $curType === 'official' ? 'checked' : '' ?>> 官方认证
        </label>
        <label class="type-pill <?= $curType === 'professional' ? 'on' : '' ?>">
          <input type="radio" name="verify_type" value="professional" <?= $curType === 'professional' ? 'checked' : '' ?>> 职业认证
        </label>
      </div>

      <label class="vf-label">认证款式(管理员可随意切换)</label>
      <div class="style-grid">
        <?php foreach ($styles as $key => $item): ?>
          <?php if (!empty($item[2]) && !$isAdmin) { continue; } ?>
          <label class="style-pill style-<?= $key ?> <?= $curStyle === $key ? 'on' : '' ?>">
            <input type="radio" name="verify_style" value="<?= $key ?>" <?= $curStyle === $key ? 'checked' : '' ?>>
            <i class="v-dot">V</i><span><?= e($item[0]) ?></span>
          </label>
        <?php endforeach; ?>
      </div>

      <label class="vf-label">认证称号(前台展示)</label>
      <input type="text" name="verify_title" maxlength="60" placeholder="例如:木漏茶室官方人员"
             value="<?= e($curTitle) ?>">

      <label class="vf-label">认证说明(选填,前台可见)</label>
      <textarea name="verify_info" rows="4" maxlength="200" placeholder="简要说明认证理由,用户可在个人资料中看到"><?= e($curInfo) ?></textarea>

      <button class="btn-primary block" type="submit" <?= (!$isAdmin && $status === 1) ? 'disabled' : '' ?>><?= e($submitLabel) ?></button>
      <p class="auth-tip">认证仅用于身份标识,不代表平台对内容的担保。</p>
    </form>
  </div>
</section>
<?php render_footer(); ?>
主题