diff --git a/Rocksolid_Light/common/version.txt b/Rocksolid_Light/common/version.txt index b13608b..1bc067b 100644 --- a/Rocksolid_Light/common/version.txt +++ b/Rocksolid_Light/common/version.txt @@ -1 +1 @@ -0.9.157 +0.9.158 diff --git a/Rocksolid_Light/rocksolid/article-flat.php b/Rocksolid_Light/rocksolid/article-flat.php index 147ffb5..ea33b89 100644 --- a/Rocksolid_Light/rocksolid/article-flat.php +++ b/Rocksolid_Light/rocksolid/article-flat.php @@ -124,35 +124,8 @@ if ($message) { $thread = thread_load($group); $subthread = thread_getsubthreadids($message->header->id, $thread); if (! $subthread) { - $date_window = 86400; - $msg_log_file = $spooldir . '/admin_msg_log.dat'; echo '
Group is rebuilding... Please try again later
'; - if (file_exists($msg_log_file)) { - $admin_msg_log = unserialize(file_get_contents($msg_log_file)); - } else { - $admin_msg_log = array(); - } - if (! isset($admin_msg_log[$group])) { - $admin_msg_log[$group] = 0; - } - if ($admin_msg_log[$group] < (time() - $date_window)) { - if ($admin_msg_log[$group] != 0) { - $msg_from = 'admin'; - $msg_to = 'admin'; - $msg_body = format_log_date() . " " . $config_name . " GROUP ERROR: " . $group . ":" . $message->header->number . " may need repair"; - $msg_body_2 = "\n\nRun maintenance.php -import " . $group; - $msg_subject = "ERROR in $group"; - if (isset($OVERRIDES['send_admin_debug_messages']) && $OVERRIDES['send_admin_debug_messages'] == true) { - send_admin_message($msg_to, $msg_from, $msg_subject, $msg_body . $msg_body_2); - send_internet_email($subject, $msg_subject, $msg_body . $msg_body_2); - } - file_put_contents($debug_log, "\n" . $msg_body, FILE_APPEND); - $admin_msg_log[$group] = 0; - } else { - $admin_msg_log[$group] = time(); - } - } - file_put_contents($msg_log_file, serialize($admin_msg_log)); + repair_broken_group($group); exit(); } if ($thread_articles == false) { diff --git a/Rocksolid_Light/rocksolid/index.php b/Rocksolid_Light/rocksolid/index.php index dd0fca3..8ef558a 100644 --- a/Rocksolid_Light/rocksolid/index.php +++ b/Rocksolid_Light/rocksolid/index.php @@ -79,6 +79,17 @@ echo ''; flush(); +// Subscribe to group +if (isset($_GET['subscribe'])) { + if (isset($_COOKIE['mail_name'])) { + if ($userdata = get_user_mail_auth_data($_COOKIE['mail_name'])) { + $userfile = $spooldir . '/' . strtolower($_COOKIE['mail_name']) . '-articleviews.dat'; + $thisgroup = _rawurldecode($_GET['subscribe']); + $userdata[$thisgroup] = time(); + file_put_contents($userfile, serialize($userdata)); + } + } +} // Unsubscribe from group if (isset($_GET['unsub'])) { if (isset($_COOKIE['mail_name'])) { @@ -91,7 +102,6 @@ if (isset($_GET['unsub'])) { $newsubs[$key] = $usertime; } } - $userfile = $spooldir . '/' . strtolower($_COOKIE['mail_name']) . '-articleviews.dat'; file_put_contents($userfile, serialize($newsubs)); } } diff --git a/Rocksolid_Light/rocksolid/lib/message.inc.php b/Rocksolid_Light/rocksolid/lib/message.inc.php index cad9e72..a83f57a 100644 --- a/Rocksolid_Light/rocksolid/lib/message.inc.php +++ b/Rocksolid_Light/rocksolid/lib/message.inc.php @@ -811,23 +811,21 @@ function message_show($group, $id, $attachment = 0, $article_data = false, $maxl $body = $article_data->body[$attachment]; if ($head) { // User blocklist + $blocked_user_config = array(); if ($userdata = get_user_mail_auth_data($_COOKIE['mail_name'])) { $userfile = $spooldir . '/' . strtolower($_COOKIE['mail_name']) . '-blocked_posters.dat'; if (file_exists($userfile)) { $blocked_user_config = unserialize(file_get_contents($userfile)); - } else { - $blocked_user_config = null; + } + $block = false; + foreach ($blocked_user_config as $key => $value) { + $blockme = '/' . addslashes($key) . '/'; + if (preg_match($blockme, $head->from)) { + $block = true; + break; + } } } - $block = false; - foreach ($blocked_user_config as $key => $value) { - $blockme = '/' . addslashes($key) . '/'; - if (preg_match($blockme, $head->from)) { - $block = true; - break; - } - } - if ($block == true) { echo '

(message #' . $head->number . ' hidden by your blocklist)


'; return "blocked"; diff --git a/Rocksolid_Light/rocksolid/newsportal.php b/Rocksolid_Light/rocksolid/newsportal.php index facdff3..5b08f13 100644 --- a/Rocksolid_Light/rocksolid/newsportal.php +++ b/Rocksolid_Light/rocksolid/newsportal.php @@ -751,6 +751,10 @@ function groups_show($gruppen) } else { if (isset($user_config['hide_unsub']) && $user_config['hide_unsub'] == 'hide') { continue; + } else { + $groupdisplay .= '

'; + $groupdisplay .= '(subscribe)'; + $groupdisplay .= '' . $url . '', $text, 1); } - if (file_exists($config_dir . '/rewrite_body.inc.php')) { - include($config_dir . '/rewrite_body.inc.php'); - } - + $text = rewrite_body($text); echo $text; if ($isquote) { echo ''; @@ -1168,6 +1178,7 @@ function display_links_in_body($text) */ function readPlainHeader(&$ns, $group, $articleNumber) { + global $text_error; fputs($ns, "GROUP $group\r\n"); $line = line_read($ns); fputs($ns, "HEAD $articleNumber\r\n"); @@ -1298,7 +1309,7 @@ function verify_logged_in($name) $_SESSION['start_stamp'] = time(); } - if (! isset($_SESSION['start_address'])) { + if (! isset($_SESSION['start_address'])) { $_SESSION['start_address'] = $_SERVER['REMOTE_ADDR']; $ip_pass = true; file_put_contents($auth_log, "\n" . logging_prefix() . " IP address SET for: " . $name, FILE_APPEND); @@ -2359,7 +2370,7 @@ function send_internet_email($subject, $body, $mail_to = false, $mail_from = fal $mail = new PHPMailer\PHPMailer\PHPMailer(); } - if(!$mail) { + if (!$mail) { return false; } @@ -2416,6 +2427,10 @@ function send_internet_email($subject, $body, $mail_to = false, $mail_from = fal } } +/* get_user_mail_auth_data is poorly named but + * it retrieves newsgroup status per user info + * for subscribe/unsubscribe/read/unread + */ function get_user_mail_auth_data($user) { global $spooldir; diff --git a/Rocksolid_Light/rocksolid/overboard.php b/Rocksolid_Light/rocksolid/overboard.php index 71e117f..d63013a 100644 --- a/Rocksolid_Light/rocksolid/overboard.php +++ b/Rocksolid_Light/rocksolid/overboard.php @@ -32,16 +32,16 @@ if (! isset($_SESSION['last_access']) || (time() - $_SESSION['last_access']) > 6 } if (isset($frames_on) && $frames_on === true) { - ?> - +?> + ($maxdisplay - 2)) { + if ($results++ > ($maxdisplay - 2)) { break; } // } @@ -313,7 +313,7 @@ function display_threads($threads, $oldest) $style = 0; $results = 0; foreach ($nicole as $key => $value) { - if(isset($target_head)) { + if (isset($target_head)) { unset($target_head); } if (isset($this_overboard['msgids'][$key])) { @@ -342,7 +342,7 @@ function display_threads($threads, $oldest) } } } - $results ++; + $results++; $skip = ''; if ($nohead) { if (($style % 2) == 0) { @@ -350,46 +350,46 @@ function display_threads($threads, $oldest) } else { $display .= ''; } - $display .= '

'; - $url = $thissite . "/article-flat.php?id=" . $target_head['number'] . "&group=" . _rawurlencode($target_head['newsgroup']) . "#" . $target_head['number']; - $display .= '

'; - $display .= '' . headerDecode($target_head['subject']) . '

'; - $display .= '' . $target_head['newsgroup'] . ''; - $timetest = $oldest; - if ($newonly) { - $timetest = $userdata[$target_head['newsgroup']]; - } - if ((($target_head['date'] < $timetest) || $result_count > 10) && isset($target_head['date'])) { - $poster = get_poster_name(mb_decode_mimeheader($target_head['name'])); - $block = false; - foreach ($blocked_user_config as $bkey => $bvalue) { - $blockme = '/' . addslashes($bkey) . '/'; - if (preg_match($blockme, $target_head['name'])) { - $block = true; - break; - } + if ($target_head) { + $display .= '
'; + $url = $thissite . "/article-flat.php?id=" . $target_head['number'] . "&group=" . _rawurlencode($target_head['newsgroup']) . "#" . $target_head['number']; + $display .= '

'; + $display .= '' . headerDecode($target_head['subject']) . '

'; + $display .= '' . $target_head['newsgroup'] . ''; + $timetest = $oldest; + if ($newonly) { + $timetest = $userdata[$target_head['newsgroup']]; } - if ($block) { - $display .= '

'; - $display .= '

'; - $display .= '(message #' . $target_head['number'] . ' hidden by your blocklist)'; - } else { - $display .= '

Posted: ' . get_date_interval(date("D, j M Y H:i T", $target_head['date'])) . ' by: ' . create_name_link($poster['name'], $poster['from']) . '

'; - if ($CONFIG['article_database'] == '1') { - $article = get_db_data_from_msgid($target_head['msgid'], $target_head['newsgroup'], 1); - - $text = $article['search_snippet']; - if (file_exists($config_dir . '/rewrite_body.inc.php')) { - include ($config_dir . '/rewrite_body.inc.php'); + if ((($target_head['date'] < $timetest) || $result_count > 10) && isset($target_head['date'])) { + $poster = get_poster_name(mb_decode_mimeheader($target_head['name'])); + $block = false; + foreach ($blocked_user_config as $bkey => $bvalue) { + $blockme = '/' . addslashes($bkey) . '/'; + if (preg_match($blockme, $target_head['name'])) { + $block = true; + break; } - $display .= strip_tags(wordwrap(substr($text, 0, $snippetlength), ($snippetlength / 2), "
\n", true)); } + if ($block) { + $display .= '

'; + $display .= '

'; + $display .= '(message #' . $target_head['number'] . ' hidden by your blocklist)'; + } else { + $display .= '

Posted: ' . get_date_interval(date("D, j M Y H:i T", $target_head['date'])) . ' by: ' . create_name_link($poster['name'], $poster['from']) . '

'; + if ($CONFIG['article_database'] == '1') { + $article = get_db_data_from_msgid($target_head['msgid'], $target_head['newsgroup'], 1); + + $text = $article['search_snippet']; + $text = rewrite_body($text); + $display .= strip_tags(wordwrap(substr($text, 0, $snippetlength), ($snippetlength / 2), "
\n", true)); + } + } + $skip = $target_head['number']; } - $skip = $target_head['number']; + $display .= '
'; + $style++; + $nohead = false; } - $display .= '
'; - $style ++; - $nohead = false; } if ($skip != $target['number']) { $poster = get_poster_name(mb_decode_mimeheader($target['name'])); @@ -420,11 +420,9 @@ function display_threads($threads, $oldest) if ($CONFIG['article_database'] == '1') { $article = get_db_data_from_msgid($target['msgid'], $target['newsgroup'], 1); $text = $article['search_snippet']; - if (file_exists($config_dir . '/rewrite_body.inc.php')) { - include ($config_dir . '/rewrite_body.inc.php'); - } + $text = rewrite_body($text); $display .= strip_tags(html_parse(text2html(substr($text, 0, $snippetlength)))); - // $display .= strip_tags(htmlentities(substr($text, 0, $snippetlength))); + // $display .= strip_tags(htmlentities(substr($text, 0, $snippetlength))); } if ($target['date'] < $expireme) { unset($this_overboard['threads'][$target['date']]); @@ -544,13 +542,13 @@ function display_flat($threads, $oldest) $display .= '

'; // link for (thread), if possible - if(isset($target_head)) { + if (isset($target_head)) { unset($target_head); } // Display 'full thread' link if available if (isset($this_overboard['threadlink'][$value])) { $target_head = get_data_from_msgid($this_overboard['threadlink'][$value]); - if ($target_head !== false) { + if ($target_head !== false) { $display .= ' (full thread)'; } } @@ -559,14 +557,12 @@ function display_flat($threads, $oldest) if ($CONFIG['article_database'] == '1') { $article = get_db_data_from_msgid($target['msgid'], $target['newsgroup'], 1); $text = $article['search_snippet']; - if (file_exists($config_dir . '/rewrite_body.inc.php')) { - include ($config_dir . '/rewrite_body.inc.php'); - } + $text = rewrite_body($text); $display .= strip_tags(html_parse(text2html(substr($text, 0, $snippetlength)))); //$display .= htmlentities(substr($text, 0, $snippetlength)); } } - $results ++; + $results++; if ($results > ($maxdisplay - 1)) { break; } diff --git a/Rocksolid_Light/rocksolid/post.php b/Rocksolid_Light/rocksolid/post.php index c0e65d3..4ffc48e 100644 --- a/Rocksolid_Light/rocksolid/post.php +++ b/Rocksolid_Light/rocksolid/post.php @@ -59,6 +59,8 @@ if (isset($_REQUEST['followupto']) && trim($_REQUEST['followupto']) != '') { $followupto = null; } +$max_followupto = 1; + // Check some header strings for bad characters $newsgroups = sanitize_header($newsgroups); $subject = sanitize_header($subject); @@ -289,6 +291,11 @@ if ($type == "post") { $type = "retry"; $error = "Too many newsgroups"; } + $followuptotal = preg_split("/( |\,)/", $followupto); + if (count($followuptotal) > $max_followupto) { + $type = "retry"; + $error = "Too many groups in followup-to"; + } } // captcha-check if (($post_captcha) && (captcha::check() == false)) { @@ -530,7 +537,7 @@ if ($show == 1) { echo ''; echo 'Followup-To:'; echo ''; - echo ''; + echo ''; echo " (optional)"; } else { echo ''; @@ -603,7 +610,7 @@ if ($show == 1) { echo '