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)
{
global $spoolpath, $CONFIG;
if ($CONFIG['article_database'] == '1') {
$message = np_get_db_article($article, $group, 1);
} else {
$thisgroup = $spoolpath . "/" . preg_replace('/\./', '/', $group);
if (! file_exists($group . "/" . $article)) {
// Return something useful
global $spoolpath, $CONFIG, $current_message;
if (! isset($current_message)) {
if ($CONFIG['article_database'] == '1') {
$message = np_get_db_article($article, $group, 1);
} else {
$thisgroup = $spoolpath . "/" . preg_replace('/\./', '/', $group);
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)) {
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 $text_header, $text_article, $article_showthread, $file_attachment, $attachment_show;
global $block_xnoarchive, $article_graphicquotes;
global $CONFIG;
global $CONFIG, $current_message;
$current_message = np_get_db_article($id, $group, 1);
if ($article_data == false)
$article_data = message_read($id, $attachment, $group);
$head = $article_data->header;
@ -785,14 +791,14 @@ function message_show($group, $id, $attachment = 0, $article_data = false, $maxl
}
}
$block = false;
foreach($blocked_user_config as $key => $value) {
$blockme = '/'.addslashes($key).'/';
foreach ($blocked_user_config as $key => $value) {
$blockme = '/' . addslashes($key) . '/';
if (preg_match($blockme, $head->from)) {
$block = true;
break;
}
}
if ($block == true) {
echo '<hr><p class=np_ob_posted_date>(message #' . $head->number . ' hidden by your blocklist)</p><hr>';
return "blocked";

View File

@ -572,7 +572,7 @@ function message_post($subject, $from, $newsgroups, $ref, $body, $encryptthis =
$body .= "\r\n--------------" . $boundary . "\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");
}
if ($do_attach) {

View File

@ -73,7 +73,7 @@ function thread_cache_load($group)
}
// Check memcache
if ($memcacheD) {
$key = 'thread_cache-' . $group;
$key = $memcache_key_prefix . '_' . 'thread_cache-' . $group;
if ($headers = unserialize(gzuncompress($memcacheD->get($key)))) {
if ($enable_memcache_logging) {
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;
}
if ($memcacheD) {
$key = 'thread_cache-' . $group;
$key = $memcache_key_prefix . '_' . 'thread_cache-' . $group;
$add_thread = gzcompress(serialize($headers), 9);
$thread_bytes = strlen($add_thread);
@ -107,7 +107,7 @@ function thread_cache_load($group)
}
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) {
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 = null;
if ($memcacheD) {
$key = 'thread_cache-' . $group;
$key = $memcache_key_prefix . '_' . 'thread_cache-' . $group;
$del = $memcacheD->delete($key);
$add_thread = gzcompress(serialize($headers), 9);
$thread_bytes = strlen($add_thread);
@ -164,10 +164,10 @@ function thread_cache_save($headers, $group)
}
if ($enable_memcache_logging) {
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) {
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) {
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);
$spoolfilename = $spooldir . '/' . $groupname . '-data.db3';
fputs($ns, "GROUP $groupname\r\n"); // select a group
$groupinfo = explode(" ", line_read($ns));
if (substr($groupinfo[0], 0, 1) != 2) {
$response = line_read($ns);
$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_thread["no_such_group"] . "</p>";
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 'name="' . md5($fieldencrypt . "body") . '" wrap="soft">';
$bodyzeile = wrap_post($bodyzeile);
if ((isset($bodyzeile)) && ($post_autoquote))
echo htmlspecialchars($bodyzeile);
if (is_string($body))
@ -472,8 +473,9 @@ if ($show == 1) {
if (! $post_autoquote) {
echo '<input type="hidden" id="hidebody"';
echo 'value="';
if (isset($bodyzeile))
if (isset($bodyzeile)) {
echo htmlspecialchars($bodyzeile);
}
echo '">';
?>

View File

@ -24,6 +24,13 @@ $memcache_ttl = 14400;
*/
$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 */
if ($enable_memcache) {

View File

@ -72,6 +72,10 @@ return [
// Rate per second that a 'bot' may load pages
'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
'comma' => true
];

View File

@ -122,7 +122,7 @@ 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']);
if (! $ns) {
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");
$response = line_read($ns);
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;
return (1);
}
@ -234,11 +235,15 @@ function get_articles($ns, $group)
} else {
$getlast = $detail[3];
}
fputs($ns, "xover " . $article . "-" . $getlast . "\r\n");
if ($article > $getlast || $article == $getlast) {
// 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
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;
}
while (trim($response = line_read($ns)) !== '.') {
@ -292,6 +297,7 @@ function get_articles($ns, $group)
$is_header = 1;
$body = "";
$content_transfer_encoding = null;
$response = str_replace("\n", "", str_replace("\r", "", $response));
while (strcmp($response, ".") != 0) {
$is_xref = false;
$bytes = $bytes + mb_strlen($response, '8bit');
@ -344,7 +350,7 @@ function get_articles($ns, $group)
$enco = explode(': ', $response, 2);
$content_transfer_encoding = $enco[1];
}
if (stripos($response, "Newsgroups: ") === 0) {
$response = str_ireplace($group, $group, $response);
// Identify each group name for xref
@ -412,7 +418,7 @@ function get_articles($ns, $group)
$integrity = check_article_integrity(file($articleHandle));
if (($banned !== false) || ($integrity !== false)) {
unlink($articleHandle);
if($integrity) {
if ($integrity) {
file_put_contents($logfile, "\n" . format_log_date() . $integrity, FILE_APPEND);
} elseif ($banned) {
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