$catKeys ? (string)$catKeys[0] : '', 'title' => '', 'body' => '', 'name' => '', 'email' => '', 'phone' => '', ]; if ($_SERVER['REQUEST_METHOD'] === 'POST') { foreach (['category_id', 'title', 'body', 'name', 'email', 'phone'] as $k) { $form[$k] = trim(isset($_POST[$k]) ? (string)$_POST[$k] : ''); } // POST 里带了 software_id 时以它为准(切换软件后表单会跟着变) if (isset($_POST['software_id']) && ctype_digit((string)$_POST['software_id'])) { $swPost = fb_software((int)$_POST['software_id']); if ($swPost && (int)$swPost['enabled'] === 1) { $sw = $swPost; $swId = (int)$swPost['id']; } } $capInput = isset($_POST['captcha']) ? (string)$_POST['captcha'] : ''; $hp = trim(isset($_POST['website']) ? (string)$_POST['website'] : ''); $t0 = isset($_POST['t0']) ? (int)$_POST['t0'] : 0; list($attOk, $attList, $attErr) = fb_attach_parse(isset($_POST['attachments']) ? $_POST['attachments'] : ''); // 分类必须属于这个软件,否则视为未选 $curCatId = ctype_digit($form['category_id']) ? (int)$form['category_id'] : 0; $curCat = $curCatId ? fb_category($curCatId) : null; if (!$curCat || (int)$curCat['software_id'] !== $swId) { $curCat = null; $form['category_id'] = ''; } if (!fb_csrf_ok(isset($_POST['csrf']) ? $_POST['csrf'] : '')) { $err = '会话已过期,请重新提交。'; } elseif ($hp !== '') { $err = '提交未通过校验,请重试。'; } elseif ($t0 > 0 && (time() - $t0) < max(0, (int)fb_cfg('post_min_seconds', 3))) { $err = '提交过于频繁,请稍候再试。'; } elseif (fb_len($form['title']) < 4 || fb_len($form['title']) > 80) { $err = '标题请填写 4~80 个字符。'; } elseif (!fb_valid_body($form['body'])) { $err = '问题描述请填写 2~5000 个字符。'; } elseif (!fb_valid_name($form['name'])) { $err = '请填写昵称(1~24 个字符)。'; } elseif (!filter_var($form['email'], FILTER_VALIDATE_EMAIL)) { $err = '请填写有效的邮箱地址(用于接收回复通知)。'; } elseif ($form['phone'] !== '' && !preg_match('/^[0-9+\-\s()]{5,30}$/', $form['phone'])) { $err = '手机号格式不正确(可留空)。'; } elseif (!$attOk) { $err = $attErr; } elseif (!fb_rate_check('thread', (int)fb_cfg('rate_limit.thread_per_hour', 5))) { $err = '发帖过于频繁,请稍后再试。'; } else { // 附件回源复核 + 全站总量检查(放在人机验证之前,避免验证码被无效消耗) list($vOk, $vList, $vErr) = fb_attach_verify($attList); if (!$vOk) { $err = $vErr; $atts = $attList; } elseif (!fb_attach_cap_ok($pdo, $vList)) { $err = '附件存储空间已满,请减少附件后重试。'; $atts = $vList; } elseif (!fb_captcha_check($capInput)) { $err = '人机验证未通过,请重新作答。'; $atts = $vList; } else { $now = time(); // 审核:开启后新提交默认不公开(visible=0),管理员通过后才会出现在列表 $visible = fb_moderation_on() ? 0 : 1; $ins = $pdo->prepare('INSERT INTO threads(title, body, category, category_id, software_id, author_name, author_email, author_phone, status, visible, reply_count, created_at, updated_at, ip_hash) VALUES(?,?,?,?,?,?,?,?,?,?,0,?,?,?)'); $ins->execute([ $form['title'], $form['body'], $curCat ? (string)$curCat['slug'] : 'other', // 老列留个值,便于回退与检索 $curCat ? (int)$curCat['id'] : null, $swId > 0 ? $swId : null, $form['name'], $form['email'], $form['phone'] !== '' ? $form['phone'] : null, 'open', $visible, $now, $now, fb_ip_hash(), ]); $newId = (int)$pdo->lastInsertId(); fb_attach_save($pdo, $newId, null, $vList); fb_rate_hit('thread'); // 通知管理员「有新反馈」(工单 #2) // 此前 notify.admin_new_thread 这个设置项是**假的** —— // 白名单里有、后台有勾选框,但没有任何代码实现它。 // 用户反馈「提交了反馈却收不到邮件」正是这个原因。 try { $stNt = $pdo->prepare('SELECT * FROM threads WHERE id = ?'); $stNt->execute([$newId]); $newThread = $stNt->fetch(PDO::FETCH_ASSOC); if ($newThread) { $swName = ''; if (!empty($swId)) { $swRow = fb_software((int)$swId); if ($swRow) { $swName = (string)$swRow['name']; } } /* ① 先给提交人发「已收到」回执 —— 让他知道东西送达了、正在等审核。 * 这一步是用户最在意的:提交完页面跳走了,没有回执就等于石沉大海。 * 放在管理员通知之前,是因为回执对人的价值更高,且失败互不影响。 */ fb_notify_event($pdo, 'receipt', $newThread, ['software_name' => $swName]); /* ② 再通知管理员「有新反馈」 */ fb_notify_event($pdo, 'new', $newThread, ['software_name' => $swName]); } } catch (Throwable $e) { // 发信失败绝不能让用户提交失败 —— 反馈已经存库了 } fb_redirect('thread.php?id=' . $newId . '&submitted=1'); } } } fb_layout_head('我要反馈', ['robots' => 'noindex,follow', 'software' => $sw]); ?>
← 返回问题列表

我要反馈

你正在为「」提交反馈

请描述你遇到的问题或想要的功能。提交后会先进入审核,确认为有效问题后才会公开显示;若经确认不是应用的问题,我们会把结论与说明通过邮件发送给你(请填写常用邮箱)。

所属软件 *换软件会刷新下面的分类

提示:本页面不会公开展示你的邮箱与手机号。请勿在内容中填写密码等敏感信息。可上传截图或录屏帮助说明问题;文件会直接传到对象存储,不占用本站服务器空间。