diff --git a/class/comment.php b/class/comment.php index 6588bf0..03b37d0 100644 --- a/class/comment.php +++ b/class/comment.php @@ -1229,12 +1229,11 @@ function commentPostDelete($comment_id) */ function commentAdminSettingsEdit($tpl_dir) { - global $AVE_DB, $AVE_Template; + global $AVE_DB, $AVE_Template, $sess; // Добавили $sess в global для редиректа $request_sub = $_REQUEST['sub'] ?? ''; $post_max_chars = $_POST['comment_max_chars'] ?? 0; $post_user_groups = $_POST['comment_user_groups'] ?? array(); - $post_user_groups_read = $_POST['comment_user_groups_read'] ?? array(); $post_need_approve = $_POST['comment_need_approve'] ?? 0; @@ -1243,25 +1242,13 @@ function commentAdminSettingsEdit($tpl_dir) $post_use_page_nav = $_POST['comment_use_page_nav'] ?? 0; $post_page_nav_count = $_POST['comment_page_nav_count'] ?? 0; - // НОВОЕ: Настройка разрешения загрузки файлов $post_allow_files = $_POST['comment_allow_files'] ?? 0; - - // ДОБАВЛЕНО: Разрешение анонимам загружать изображения $post_allow_files_anon = $_POST['comment_allow_files_anon'] ?? 0; - - // НОВОЕ: Тип рейтинга (0 - звезды, 1 - лайки) $post_rating_type = $_POST['comment_rating_type'] ?? 0; - - // НОВОЕ: ВКЛ/ВЫКЛ авторских звезд $post_show_user_rating = $_POST['comment_show_user_rating'] ?? 0; - - // НОВОЕ: Разрешение голосования анонимам $post_rating_anon_vote = $_POST['comment_rating_anon_vote'] ?? 0; - - // НОВОЕ: Разрешение анонимам ставить звезды (Авторский рейтинг) $post_rating_anon_set = $_POST['comment_rating_anon_set'] ?? 0; - // Данные для универсальных полей $post_show_f1 = $_POST['comment_show_f1'] ?? 0; $post_req_f1 = $_POST['comment_req_f1'] ?? 0; $post_name_f1 = $_POST['comment_name_f1'] ?? ''; @@ -1270,10 +1257,10 @@ function commentAdminSettingsEdit($tpl_dir) $post_req_f2 = $_POST['comment_req_f2'] ?? 0; $post_name_f2 = $_POST['comment_name_f2'] ?? ''; - if ($request_sub == 'save') + // Обработка сохранения (и для AJAX 'apply', и для формы 'save') + if ($request_sub == 'save' || $request_sub == 'apply') { $max_chars = (empty($post_max_chars) || $post_max_chars < 50) ? 50 : $post_max_chars; - $clean_name_f1 = htmlspecialchars(stripslashes($post_name_f1), ENT_QUOTES); $clean_name_f2 = htmlspecialchars(stripslashes($post_name_f2), ENT_QUOTES); @@ -1281,8 +1268,8 @@ function commentAdminSettingsEdit($tpl_dir) UPDATE " . PREFIX . "_module_comments SET comment_max_chars = '" . (int)$max_chars . "', - comment_user_groups = '" . implode(',', $post_user_groups) . "', - comment_user_groups_read = '" . implode(',', $post_user_groups_read) . "', + comment_user_groups = '" . addslashes(implode(',', $post_user_groups)) . "', + comment_user_groups_read = '" . addslashes(implode(',', $post_user_groups_read)) . "', comment_need_approve = '" . (int)$post_need_approve . "', comment_active = '" . (int)$post_active . "', comment_use_antispam = '" . (int)$post_use_antispam . "', @@ -1296,23 +1283,36 @@ function commentAdminSettingsEdit($tpl_dir) comment_rating_anon_set = '" . (int)$post_rating_anon_set . "', comment_show_f1 = '" . (int)$post_show_f1 . "', comment_req_f1 = '" . (int)$post_req_f1 . "', - comment_name_f1 = '" . $clean_name_f1 . "', + comment_name_f1 = '" . addslashes($clean_name_f1) . "', comment_show_f2 = '" . (int)$post_show_f2 . "', comment_req_f2 = '" . (int)$post_req_f2 . "', - comment_name_f2 = '" . $clean_name_f2 . "' + comment_name_f2 = '" . addslashes($clean_name_f2) . "' WHERE Id = 1 "); + + // Если это AJAX запрос "Применить" + if ($request_sub == 'apply') { + @ob_clean(); + echo "success"; + exit; + } + + // Если это обычное "Сохранить" - уходим на главную модулей + if ($request_sub == 'save') { + header("Location: index.php?do=modules&cp=" . $sess); + exit; + } } $row = $this->_commentSettingsGet(); - $row['comment_user_groups'] = explode(',', $row['comment_user_groups']); $row['comment_user_groups_read'] = explode(',', $row['comment_user_groups_read']); $AVE_Template->assign($row); $AVE_Template->assign('content', $AVE_Template->fetch($tpl_dir . $this->_admin_settings_tpl)); } + } ?> \ No newline at end of file diff --git a/templates/admin_settings.tpl b/templates/admin_settings.tpl index ce60eda..6ca920b 100644 --- a/templates/admin_settings.tpl +++ b/templates/admin_settings.tpl @@ -23,7 +23,7 @@
{#COMMENT_MODULE_COMENTS#}
-
+ @@ -183,10 +183,70 @@
- +
+
+ + + или + + + + Отменить +
+
+
- \ No newline at end of file + + + \ No newline at end of file