Add ability to crosspost new thread (max 3 groups).

This commit is contained in:
Retro_Guy 2024-07-12 06:54:15 -07:00
parent ff689009ed
commit 932d9a14ad
1 changed files with 37 additions and 1 deletions

View File

@ -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 '<h1 class="np_thread_headline">';
echo '<a href="' . $file_index . '" target=' . $frame['menu'] . '>' . basename(getcwd()) . '</a> / ';
echo '<a href="' . $file_thread . '?group=' . rawurlencode($returngroup) . '" target=' . $frame["content"] . '>' . htmlspecialchars(group_display_name($returngroup)) . '</a>';
@ -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 '</td><td>';
echo '<label for="newsgroups">' . $head->newsgroups . '</label>';
echo '</tr><tr>';
} else {
echo '<td align="right"><b>Newsgroups:</b></td>';
echo '<td>';
if($allow_ngs_edit) {
echo '<input tclass="post" type="text" name="fgroups" size="40" value="' . $newsgroups . '">';
echo "&nbsp;comma separated, max $max_crosspost groups";
} else {
echo '<input tclass="post" type="text" name="fgroups" size="40" value="' . $newsgroups . '" readonly>';
}
echo '</td><td>';
echo '</tr><tr>';
}
echo '<td align="right"><b>' . $text_post["name"] . '</b></td>';