木漏茶室源码下载中心
整站 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/quote.php
7.6 KB · 发布包 v6.25.232
<?php
/**
* 后台 · 毒鸡汤(每日一言扩展)
*/
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
check_csrf();
$act = (string) input('act');
if ($act === 'add') {
$content = trim((string) input('content'));
if ($content === '') {
flash('句子不能为空', 'err');
} elseif (mb_strlen($content, 'UTF-8') > 120) {
flash('句子太长,请控制在 120 字以内', 'err');
} else {
$nextSort = (int) DB::val('SELECT COALESCE(MAX(sort), 0) FROM ' . DB::table('quotes'), [], 0) + 1;
DB::insert('quotes', [
'content' => $content,
'source' => 'manual',
'status' => 1,
'sort' => $nextSort,
'created_at' => date('Y-m-d H:i:s'),
]);
flash('已添加一条毒鸡汤');
}
} elseif ($act === 'del') {
DB::delete('quotes', 'id = ?', [(int) input('id')]);
flash('已删除该句子');
} elseif ($act === 'random') {
$item = quote_fetch_network();
$nextSort = (int) DB::val('SELECT COALESCE(MAX(sort), 0) FROM ' . DB::table('quotes'), [], 0) + 1;
DB::insert('quotes', [
'content' => $item['content'],
'source' => $item['source'],
'status' => 1,
'sort' => $nextSort,
'created_at' => date('Y-m-d H:i:s'),
]);
$ok = $item['source'] === 'network';
flash($ok ? '已抓取一条网络毒鸡汤' : '网络暂不可达,已从本地毒鸡汤库随机添加一条', $ok ? 'ok' : 'err');
} elseif ($act === 'move') {
$qid = (int) input('id');
$dir = input('dir') === 'up' ? 'up' : 'down';
$ordered = array_map('intval', array_column(DB::all('SELECT id FROM ' . DB::table('quotes') . ' ORDER BY sort ASC, id ASC'), 'id'));
$idx = array_search($qid, $ordered, true);
if ($idx !== false) {
$target = $dir === 'up' ? $idx - 1 : $idx + 1;
if ($target >= 0 && $target < count($ordered)) {
$tmp = $ordered[$idx];
$ordered[$idx] = $ordered[$target];
$ordered[$target] = $tmp;
foreach ($ordered as $i => $oid) {
DB::run('UPDATE ' . DB::table('quotes') . ' SET sort = ? WHERE id = ?', [$i + 1, $oid]);
}
flash('毒鸡汤顺序已调整');
}
}
} elseif ($act === 'edit') {
$qid = (int) input('id');
$content = trim((string) input('content'));
if ($qid <= 0) {
flash('句子不存在', 'err');
} elseif ($content === '') {
flash('句子不能为空', 'err');
} elseif (mb_strlen($content, 'UTF-8') > 120) {
flash('句子太长,请控制在 120 字以内', 'err');
} elseif (!DB::val('SELECT COUNT(*) FROM ' . DB::table('quotes') . ' WHERE id = ?', [$qid], 0)) {
flash('句子不存在', 'err');
} else {
DB::run('UPDATE ' . DB::table('quotes') . ' SET content = ? WHERE id = ?', [$content, $qid]);
flash('毒鸡汤已修改');
}
} elseif ($act === 'interval') {
$seconds = max(5, min(86400, (int) input('seconds', 10)));
set_setting('quote_interval', (string) $seconds);
set_setting('quote_interval_sec', '1');
flash('已设置每 ' . $seconds . ' 秒自动切换到下一条');
}
redirect(admin_url('quote'));
}
$rows = DB::all('SELECT * FROM ' . DB::table('quotes') . ' ORDER BY sort ASC, id ASC');
$interval = quote_interval_seconds();
?>
<div class="admin-head">
<div><h1>毒鸡汤</h1><p>每日一言已从「站点设置」迁到这里,可手动增删、抓取网络句子、设置自动切换时间</p></div>
<div class="admin-quick">
<form method="post">
<?= csrf_field() ?><input type="hidden" name="act" value="random">
<button class="btn-mini" type="submit">随机抓取网络毒鸡汤</button>
</form>
</div>
</div>
<section class="panel">
<h2 class="section-title">自动切换</h2>
<form method="post" class="quote-interval-form">
<?= csrf_field() ?><input type="hidden" name="act" value="interval">
<div class="field">
<label>每条停留时长(秒)</label>
<input type="number" name="seconds" min="5" max="86400" step="1" value="<?= (int) $interval ?>">
</div>
<p class="muted">到点后首页「今日毒鸡汤」自动淡出并跳到下一条,循环播放;建议 10–30 秒,最短 5 秒。</p>
<button class="btn-primary" type="submit">保存切换时间</button>
</form>
</section>
<section class="panel">
<h2 class="section-title">手动添加</h2>
<form method="post" class="form-card quote-add-form">
<?= csrf_field() ?><input type="hidden" name="act" value="add">
<textarea name="content" rows="2" maxlength="120" placeholder="写一句毒鸡汤,最多 120 字…" required></textarea>
<button class="btn-primary" type="submit">添加到毒鸡汤库</button>
</form>
</section>
<section class="panel">
<div class="panel-head row">
<h2>句子列表</h2>
<span class="muted">共 <?= count($rows) ?> 条 · 首页按这里的顺序循环</span>
</div>
<?php if (!$rows): ?>
<p class="muted">还没有句子,先添加一条或随机抓取一条吧。</p>
<?php else: ?>
<div class="quote-list">
<?php foreach ($rows as $i => $r): ?>
<div class="quote-item">
<div class="quote-row">
<div class="quote-main">
<p><?= e($r['content']) ?></p>
<span class="quote-meta">
<?= $r['source'] === 'network' ? '网络' : ($r['source'] === 'manual' ? '手动添加' : '默认') ?>
· <?= e($r['created_at']) ?>
</span>
</div>
<div class="quote-ops">
<form method="post">
<?= csrf_field() ?><input type="hidden" name="act" value="move"><input type="hidden" name="id" value="<?= (int) $r['id'] ?>"><input type="hidden" name="dir" value="up">
<button class="link-btn" type="submit" title="上移" <?= $i === 0 ? 'disabled' : '' ?>>↑</button>
</form>
<form method="post">
<?= csrf_field() ?><input type="hidden" name="act" value="move"><input type="hidden" name="id" value="<?= (int) $r['id'] ?>"><input type="hidden" name="dir" value="down">
<button class="link-btn" type="submit" title="下移" <?= $i === count($rows) - 1 ? 'disabled' : '' ?>>↓</button>
</form>
<button class="btn-mini ghost quote-edit-toggle" type="button">编辑</button>
<form method="post" data-confirm="删除这条毒鸡汤?">
<?= csrf_field() ?><input type="hidden" name="act" value="del"><input type="hidden" name="id" value="<?= (int) $r['id'] ?>">
<button class="btn-mini danger" type="submit">删除</button>
</form>
</div>
</div>
<form method="post" class="quote-edit-form" hidden>
<?= csrf_field() ?><input type="hidden" name="act" value="edit"><input type="hidden" name="id" value="<?= (int) $r['id'] ?>">
<textarea name="content" rows="3" maxlength="120" required><?= e($r['content']) ?></textarea>
<div class="quote-edit-actions">
<button class="btn-primary" type="submit">保存修改</button>
<button class="btn-mini ghost" type="button" data-quote-cancel>取消</button>
</div>
</form>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</section>