From 932d9a14addad1b86a06350a6f74cc9af694102a Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Fri, 12 Jul 2024 06:54:15 -0700 Subject: [PATCH] Add ability to crosspost new thread (max 3 groups). --- Rocksolid_Light/rocksolid/post.php | 38 +++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/Rocksolid_Light/rocksolid/post.php b/Rocksolid_Light/rocksolid/post.php index deadc76..04ef308 100644 --- a/Rocksolid_Light/rocksolid/post.php +++ b/Rocksolid_Light/rocksolid/post.php @@ -67,6 +67,15 @@ if ($OVERRIDES['enable_post_log'] > 0) { @$abspeichern = $_REQUEST["abspeichern"]; @$references = $_REQUEST["references"]; @$id = $_REQUEST["id"]; + +if($type == 'reply') { + $max_crosspost = 12; + $allow_ngs_edit = false; +} else { + $max_crosspost = 3; + $allow_ngs_edit = true; +} + if (! isset($group) && isset($newsgroups)) { $group = $newsgroups; } @@ -106,6 +115,15 @@ if ($_REQUEST['returngroup']) { $returngroup = $thisgroup; } +$linkgroups = preg_split("/[\s,]+/", $returngroup); +foreach($linkgroups as $linkgroup) { + $linkgroup = trim($linkgroup); + if (get_section_by_group($linkgroup)) { + $returngroup = $linkgroup; + break; + } +} + echo '

'; echo '' . basename(getcwd()) . ' / '; echo '' . htmlspecialchars(group_display_name($returngroup)) . ''; @@ -219,7 +237,13 @@ if ($type == "post") { $type = "retry"; $error = $text_post["missing_subject"]; } - + if($allow_ngs_edit) { + $grouptotal = preg_split("/\,/", $newsgroups); + if(count($grouptotal) > $max_crosspost) { + $type = "retry"; + $error = "Too many newsgroups"; + } + } // captcha-check if (($post_captcha) && (captcha::check() == false)) { $type = "retry"; @@ -398,6 +422,7 @@ if ($show == 1) { $ngroups = preg_split("/[\s,]+/", $newsgroups); $found = false; foreach ($ngroups as $group) { + $group = trim($group); if (get_section_by_group($group)) { $found = true; break; @@ -441,6 +466,17 @@ if ($show == 1) { echo ''; echo ''; echo ''; + } else { + echo 'Newsgroups:'; + echo ''; + if($allow_ngs_edit) { + echo ''; + echo " comma separated, max $max_crosspost groups"; + } else { + echo ''; + } + echo ''; + echo ''; } echo '' . $text_post["name"] . '';