Fix git conflict for newsportal.php while merging.

This commit is contained in:
Retro_Guy 2024-05-22 23:30:15 -07:00
commit be613eb855
9 changed files with 3006 additions and 2964 deletions

View File

@ -601,15 +601,19 @@ function copy_messageid()
function display_full_headers($article, $group, $name, $from, $getface = false) function display_full_headers($article, $group, $name, $from, $getface = false)
{ {
global $spoolpath, $CONFIG; global $spoolpath, $CONFIG, $current_message;
if ($CONFIG['article_database'] == '1') { if (! isset($current_message)) {
$message = np_get_db_article($article, $group, 1); if ($CONFIG['article_database'] == '1') {
} else { $message = np_get_db_article($article, $group, 1);
$thisgroup = $spoolpath . "/" . preg_replace('/\./', '/', $group); } else {
if (! file_exists($group . "/" . $article)) { $thisgroup = $spoolpath . "/" . preg_replace('/\./', '/', $group);
// Return something useful if (! file_exists($group . "/" . $article)) {
// Return something useful
}
$message = file($thisgroup . "/" . $article, FILE_IGNORE_NEW_LINES);
} }
$message = file($thisgroup . "/" . $article, FILE_IGNORE_NEW_LINES); } else {
$message = $current_message;
} }
if (isset($sendface)) { if (isset($sendface)) {
unlink($sendface); unlink($sendface);
@ -762,7 +766,9 @@ function message_show($group, $id, $attachment = 0, $article_data = false, $maxl
global $file_article, $file_article_full, $OVERRIDES, $spooldir; global $file_article, $file_article_full, $OVERRIDES, $spooldir;
global $text_header, $text_article, $article_showthread, $file_attachment, $attachment_show; global $text_header, $text_article, $article_showthread, $file_attachment, $attachment_show;
global $block_xnoarchive, $article_graphicquotes; global $block_xnoarchive, $article_graphicquotes;
global $CONFIG; global $CONFIG, $current_message;
$current_message = np_get_db_article($id, $group, 1);
if ($article_data == false) if ($article_data == false)
$article_data = message_read($id, $attachment, $group); $article_data = message_read($id, $attachment, $group);
$head = $article_data->header; $head = $article_data->header;
@ -785,14 +791,14 @@ function message_show($group, $id, $attachment = 0, $article_data = false, $maxl
} }
} }
$block = false; $block = false;
foreach($blocked_user_config as $key => $value) { foreach ($blocked_user_config as $key => $value) {
$blockme = '/'.addslashes($key).'/'; $blockme = '/' . addslashes($key) . '/';
if (preg_match($blockme, $head->from)) { if (preg_match($blockme, $head->from)) {
$block = true; $block = true;
break; break;
} }
} }
if ($block == true) { if ($block == true) {
echo '<hr><p class=np_ob_posted_date>(message #' . $head->number . ' hidden by your blocklist)</p><hr>'; echo '<hr><p class=np_ob_posted_date>(message #' . $head->number . ' hidden by your blocklist)</p><hr>';
return "blocked"; return "blocked";

View File

@ -572,7 +572,7 @@ function message_post($subject, $from, $newsgroups, $ref, $body, $encryptthis =
$body .= "\r\n--------------" . $boundary . "\r\n"; $body .= "\r\n--------------" . $boundary . "\r\n";
} }
fputs($ns, 'Message-ID: ' . $msgid . "\r\n"); fputs($ns, 'Message-ID: ' . $msgid . "\r\n");
if ($userconfig['xface'] !== '' && $myconfig) { if (trim($userconfig['xface']) !== '' && $myconfig) {
fputs($ns, 'X-Face: ' . $userconfig['xface'] . "\r\n"); fputs($ns, 'X-Face: ' . $userconfig['xface'] . "\r\n");
} }
if ($do_attach) { if ($do_attach) {

View File

@ -73,7 +73,7 @@ function thread_cache_load($group)
} }
// Check memcache // Check memcache
if ($memcacheD) { if ($memcacheD) {
$key = 'thread_cache-' . $group; $key = $memcache_key_prefix . '_' . 'thread_cache-' . $group;
if ($headers = unserialize(gzuncompress($memcacheD->get($key)))) { if ($headers = unserialize(gzuncompress($memcacheD->get($key)))) {
if ($enable_memcache_logging) { if ($enable_memcache_logging) {
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache hit) $key", FILE_APPEND); file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache hit) $key", FILE_APPEND);
@ -94,7 +94,7 @@ function thread_cache_load($group)
$dbh = null; $dbh = null;
} }
if ($memcacheD) { if ($memcacheD) {
$key = 'thread_cache-' . $group; $key = $memcache_key_prefix . '_' . 'thread_cache-' . $group;
$add_thread = gzcompress(serialize($headers), 9); $add_thread = gzcompress(serialize($headers), 9);
$thread_bytes = strlen($add_thread); $thread_bytes = strlen($add_thread);
@ -107,7 +107,7 @@ function thread_cache_load($group)
} }
if ($nicole && $enable_memcache_logging) { if ($nicole && $enable_memcache_logging) {
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache miss) Wrote $key (" . strlen($add_thread) . " bytes)", FILE_APPEND); file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache write) $key (" . strlen($add_thread) . " bytes)", FILE_APPEND);
} }
if ($too_big) { if ($too_big) {
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " $key too large (" . $thread_bytes . " bytes)", FILE_APPEND); file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " $key too large (" . $thread_bytes . " bytes)", FILE_APPEND);
@ -151,7 +151,7 @@ function thread_cache_save($headers, $group)
$dbh->commit(); $dbh->commit();
$dbh = null; $dbh = null;
if ($memcacheD) { if ($memcacheD) {
$key = 'thread_cache-' . $group; $key = $memcache_key_prefix . '_' . 'thread_cache-' . $group;
$del = $memcacheD->delete($key); $del = $memcacheD->delete($key);
$add_thread = gzcompress(serialize($headers), 9); $add_thread = gzcompress(serialize($headers), 9);
$thread_bytes = strlen($add_thread); $thread_bytes = strlen($add_thread);
@ -164,10 +164,10 @@ function thread_cache_save($headers, $group)
} }
if ($enable_memcache_logging) { if ($enable_memcache_logging) {
if ($del) { if ($del) {
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " Deleted $key", FILE_APPEND); file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache delete) $key", FILE_APPEND);
} }
if ($nicole) { if ($nicole) {
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " Wrote $key (" . $thread_bytes . " bytes)", FILE_APPEND); file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache write) $key (" . $thread_bytes . " bytes)", FILE_APPEND);
} }
if ($too_big) { if ($too_big) {
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " $key too large (" . $thread_bytes . " bytes)", FILE_APPEND); file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " $key too large (" . $thread_bytes . " bytes)", FILE_APPEND);
@ -368,8 +368,10 @@ function thread_load_newsserver(&$ns, $groupname, $poll)
$overviewformat = thread_overview_read($ns); $overviewformat = thread_overview_read($ns);
$spoolfilename = $spooldir . '/' . $groupname . '-data.db3'; $spoolfilename = $spooldir . '/' . $groupname . '-data.db3';
fputs($ns, "GROUP $groupname\r\n"); // select a group fputs($ns, "GROUP $groupname\r\n"); // select a group
$groupinfo = explode(" ", line_read($ns)); $response = line_read($ns);
if (substr($groupinfo[0], 0, 1) != 2) { $groupinfo = explode(" ", $response);
if (strcmp(substr($groupinfo[0], 0, 3), "211") != 0) {
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Response to group command for " . $groupname . ": " . $response, FILE_APPEND);
echo "<p>" . $text_error["error:"] . "</p>"; echo "<p>" . $text_error["error:"] . "</p>";
echo "<p>" . $text_thread["no_such_group"] . "</p>"; echo "<p>" . $text_thread["no_such_group"] . "</p>";
flush(); flush();

File diff suppressed because it is too large Load Diff

View File

@ -464,6 +464,7 @@ if ($show == 1) {
echo 'class="postbody" id="postbody" '; echo 'class="postbody" id="postbody" ';
echo 'name="' . md5($fieldencrypt . "body") . '" wrap="soft">'; echo 'name="' . md5($fieldencrypt . "body") . '" wrap="soft">';
$bodyzeile = wrap_post($bodyzeile);
if ((isset($bodyzeile)) && ($post_autoquote)) if ((isset($bodyzeile)) && ($post_autoquote))
echo htmlspecialchars($bodyzeile); echo htmlspecialchars($bodyzeile);
if (is_string($body)) if (is_string($body))
@ -472,8 +473,9 @@ if ($show == 1) {
if (! $post_autoquote) { if (! $post_autoquote) {
echo '<input type="hidden" id="hidebody"'; echo '<input type="hidden" id="hidebody"';
echo 'value="'; echo 'value="';
if (isset($bodyzeile)) if (isset($bodyzeile)) {
echo htmlspecialchars($bodyzeile); echo htmlspecialchars($bodyzeile);
}
echo '">'; echo '">';
?> ?>

View File

@ -24,6 +24,13 @@ $memcache_ttl = 14400;
*/ */
$memcache_maxitemsize = 1024000; $memcache_maxitemsize = 1024000;
/*
* A string to prepend to cached key names
* Required if using more than one rslight instance
* with one memcache instance
*/
$memcache_key_prefix = 'rsl';
/* PLEASE DO NOT EDIT BELOW THIS LINE */ /* PLEASE DO NOT EDIT BELOW THIS LINE */
if ($enable_memcache) { if ($enable_memcache) {

View File

@ -72,6 +72,10 @@ return [
// Rate per second that a 'bot' may load pages // Rate per second that a 'bot' may load pages
'throttle_hits_bot_loadrate' => '.1', 'throttle_hits_bot_loadrate' => '.1',
// Block connections when one of these strings is
// contained in user_agent string
// 'block_by_user_agent' => array("semrushbot", "bytespider"),
// Just leave this here to avoid comma errors // Just leave this here to avoid comma errors
'comma' => true 'comma' => true
]; ];

View File

@ -122,7 +122,7 @@ if ($CONFIG['remote_server'] == '') {
} }
} }
if ($CONFIG['remote_server'] != '') { if ($CONFIG['remote_server'] != '') {
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " remote_server: " . $CONFIG['remote_server'], FILE_APPEND); file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Connecting: " . $CONFIG['remote_server'] . ":" . $CONFIG['remote_port'], FILE_APPEND);
$ns = nntp2_open($CONFIG['remote_server'], $CONFIG['remote_port']); $ns = nntp2_open($CONFIG['remote_server'], $CONFIG['remote_port']);
if (! $ns) { if (! $ns) {
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Failed to connect to " . $CONFIG['remote_server'] . ":" . $CONFIG['remote_port'], FILE_APPEND); file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Failed to connect to " . $CONFIG['remote_server'] . ":" . $CONFIG['remote_port'], FILE_APPEND);
@ -194,6 +194,7 @@ function get_articles($ns, $group)
fputs($ns, "group " . $group . "\r\n"); fputs($ns, "group " . $group . "\r\n");
$response = line_read($ns); $response = line_read($ns);
if (strcmp(substr($response, 0, 3), "211") != 0) { if (strcmp(substr($response, 0, 3), "211") != 0) {
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Response to group command for " . $group . ": " . $response, FILE_APPEND);
echo "\n" . $response; echo "\n" . $response;
return (1); return (1);
} }
@ -234,11 +235,15 @@ function get_articles($ns, $group)
} else { } else {
$getlast = $detail[3]; $getlast = $detail[3];
} }
if ($article > $getlast || $article == $getlast) {
fputs($ns, "xover " . $article . "-" . $getlast . "\r\n"); // This is probably not necessary
fputs($ns, "xover " . $getlast . "\r\n");
} else {
fputs($ns, "xover " . $article . "-" . $getlast . "\r\n");
}
$response = line_read($ns); // and once more $response = line_read($ns); // and once more
if ((substr($response, 0, 3) != "224")) { if ((substr($response, 0, 3) != "224")) {
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Cannot get overview from " . $CONFIG['remote_server'] . " for " . $group, FILE_APPEND); file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Cannot get overview from " . $CONFIG['remote_server'] . " for " . $group . " (requested: xover " . $article . "-" . $getlast . " received " . $response . ")", FILE_APPEND);
return false; return false;
} }
while (trim($response = line_read($ns)) !== '.') { while (trim($response = line_read($ns)) !== '.') {
@ -292,6 +297,7 @@ function get_articles($ns, $group)
$is_header = 1; $is_header = 1;
$body = ""; $body = "";
$content_transfer_encoding = null; $content_transfer_encoding = null;
$response = str_replace("\n", "", str_replace("\r", "", $response));
while (strcmp($response, ".") != 0) { while (strcmp($response, ".") != 0) {
$is_xref = false; $is_xref = false;
$bytes = $bytes + mb_strlen($response, '8bit'); $bytes = $bytes + mb_strlen($response, '8bit');
@ -344,7 +350,7 @@ function get_articles($ns, $group)
$enco = explode(': ', $response, 2); $enco = explode(': ', $response, 2);
$content_transfer_encoding = $enco[1]; $content_transfer_encoding = $enco[1];
} }
if (stripos($response, "Newsgroups: ") === 0) { if (stripos($response, "Newsgroups: ") === 0) {
$response = str_ireplace($group, $group, $response); $response = str_ireplace($group, $group, $response);
// Identify each group name for xref // Identify each group name for xref
@ -412,7 +418,7 @@ function get_articles($ns, $group)
$integrity = check_article_integrity(file($articleHandle)); $integrity = check_article_integrity(file($articleHandle));
if (($banned !== false) || ($integrity !== false)) { if (($banned !== false) || ($integrity !== false)) {
unlink($articleHandle); unlink($articleHandle);
if($integrity) { if ($integrity) {
file_put_contents($logfile, "\n" . format_log_date() . $integrity, FILE_APPEND); file_put_contents($logfile, "\n" . format_log_date() . $integrity, FILE_APPEND);
} elseif ($banned) { } elseif ($banned) {
file_put_contents($spamlog, "\n" . format_log_date() . " " . $banned . " :\tSPAM\t" . $mid[1] . "\t" . $groupnames[1] . "\t" . $from[1], FILE_APPEND); file_put_contents($spamlog, "\n" . format_log_date() . " " . $banned . " :\tSPAM\t" . $mid[1] . "\t" . $groupnames[1] . "\t" . $from[1], FILE_APPEND);

View File

@ -1 +1 @@
0.9.85 0.9.86