diff --git a/admin.php b/admin.php index df4d036..6a393a8 100644 --- a/admin.php +++ b/admin.php @@ -12,6 +12,7 @@ * 入口:/feedback/admin.php */ require __DIR__ . '/lib/bootstrap.php'; +require __DIR__ . '/lib/admin_taxonomy.php'; $pdo = fb_db(); @@ -93,7 +94,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['act'])) { $act = (string)$_POST['act']; $t = fb_admin_thread($pdo, $id); - if (!$t && $act !== 'settings' && $act !== 'password') { + // 这些动作不针对某一条反馈(不依赖 $t),单独放行 + $noThread = in_array($act, ['settings', 'password'], true) + || fb_admin_is_taxonomy_act($act); + + if (!$t && !$noThread) { $msg = '问题不存在。'; $msgType = 'error'; @@ -182,6 +187,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['act'])) { fb_mod_log('delete', $id, '删除问题:' . fb_excerpt((string)$t['title'], 40)); $msg = '#' . $id . ' 已删除。'; + } elseif (fb_admin_is_taxonomy_act($act)) { + list($msg, $msgType) = fb_admin_taxonomy_action($pdo, $act, $_POST); + } elseif ($act === 'settings') { $msg = fb_admin_save_settings(); @@ -300,7 +308,7 @@ function fb_admin_save_settings() { * 页面 * ================================================================== */ $tab = (string)(isset($_GET['tab']) ? $_GET['tab'] : 'pending'); -if (!in_array($tab, ['pending', 'all', 'thread', 'settings', 'log'], true)) { $tab = 'pending'; } +if (!in_array($tab, ['pending', 'all', 'thread', 'taxonomy', 'statuses', 'settings', 'log'], true)) { $tab = 'pending'; } fb_layout_head('管理后台', ['robots' => 'noindex,nofollow']); ?> @@ -315,6 +323,8 @@ fb_layout_head('管理后台', ['robots' => 'noindex,nofollow']); @@ -343,9 +353,12 @@ fb_layout_head('管理后台', ['robots' => 'noindex,nofollow']); $visF = (string)(isset($_GET['vis']) ? $_GET['vis'] : ''); $catF = (string)(isset($_GET['cat']) ? $_GET['cat'] : ''); $qF = trim((string)(isset($_GET['q']) ? $_GET['q'] : '')); + $swF = isset($_GET['sw']) ? (int)$_GET['sw'] : 0; + $cidF = isset($_GET['cid']) ? (int)$_GET['cid'] : 0; if ($stF !== '') { $where[] = 'status = ?'; $args[] = $stF; } if ($visF === '1' || $visF === '0') { $where[] = 'visible = ?'; $args[] = (int)$visF; } - if ($catF !== '') { $where[] = 'category = ?'; $args[] = $catF; } + if ($swF > 0) { $where[] = 'software_id = ?'; $args[] = $swF; } + if ($cidF > 0) { $where[] = 'category_id = ?'; $args[] = $cidF; } if ($qF !== '') { $where[] = '(title LIKE ? OR body LIKE ?)'; $args[] = '%' . $qF . '%'; $args[] = '%' . $qF . '%'; } $wSql = $where ? ('WHERE ' . implode(' AND ', $where)) : ''; @@ -364,17 +377,29 @@ fb_layout_head('管理后台', ['robots' => 'noindex,nofollow']);
+ - + + 0 ? [fb_software($swF)] : fb_softwares(false); + foreach ($catSwList as $csw1): + if (!$csw1) { continue; } + foreach (fb_categories((int)$csw1['id'], false) as $c1): + ?> + + + +

+ 挂错软件或分类时在这里改正。换软件后分类选项会跟着变,需重新选择。 +

+
+ + +
+ +
+

以官方身份回复

@@ -481,7 +545,7 @@ fb_layout_head('管理后台', ['robots' => 'noindex,nofollow']); 同时把状态改为 @@ -499,7 +563,7 @@ fb_layout_head('管理后台', ['robots' => 'noindex,nofollow']);