Fix git conflict for newsportal.php while merging.
This commit is contained in:
commit
be613eb855
|
@ -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,8 +791,8 @@ 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;
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -640,7 +640,7 @@ function groups_show($gruppen)
|
||||||
// Get last article info from article database
|
// Get last article info from article database
|
||||||
// First check memcache
|
// First check memcache
|
||||||
if ($memcacheD) {
|
if ($memcacheD) {
|
||||||
$lar_memcache = 'lastarticleinfo-' . $g->name;
|
$lar_memcache = $memcache_key_prefix . '_' . 'lastarticleinfo-' . $g->name;
|
||||||
$groupfile = $spooldir . '/' . $g->name . '-lastarticleinfo.dat';
|
$groupfile = $spooldir . '/' . $g->name . '-lastarticleinfo.dat';
|
||||||
if ($lastarticleinfo = unserialize($memcacheD->get($lar_memcache))) {
|
if ($lastarticleinfo = unserialize($memcacheD->get($lar_memcache))) {
|
||||||
if ($lastarticleinfo && file_exists($groupfile) && filemtime($groupfile) <= $lastarticleinfo['date']) {
|
if ($lastarticleinfo && file_exists($groupfile) && filemtime($groupfile) <= $lastarticleinfo['date']) {
|
||||||
|
@ -691,9 +691,9 @@ function groups_show($gruppen)
|
||||||
$memcacheD->add($lar_memcache, serialize($row), $memcache_ttl);
|
$memcacheD->add($lar_memcache, serialize($row), $memcache_ttl);
|
||||||
if ($enable_memcache_logging) {
|
if ($enable_memcache_logging) {
|
||||||
if ($nicole) {
|
if ($nicole) {
|
||||||
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " Updated $lar_memcache", FILE_APPEND);
|
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache update) $lar_memcache", FILE_APPEND);
|
||||||
} else {
|
} else {
|
||||||
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " Wrote $lar_memcache", FILE_APPEND);
|
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache write) $lar_memcache", FILE_APPEND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1625,7 +1625,7 @@ function get_newsgroups_by_msgid($msgid, $noarray = false)
|
||||||
include $config_dir . '/memcache.inc.php';
|
include $config_dir . '/memcache.inc.php';
|
||||||
}
|
}
|
||||||
if ($memcacheD) {
|
if ($memcacheD) {
|
||||||
$key = 'get_newsgroups_by_msgid-' . $msgid;
|
$key = $memcache_key_prefix . '_' . 'get_newsgroups_by_msgid-' . $msgid;
|
||||||
if ($groups = $memcacheD->get($key)) {
|
if ($groups = $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);
|
||||||
|
@ -1653,7 +1653,7 @@ function get_newsgroups_by_msgid($msgid, $noarray = false)
|
||||||
if ($groups && $memcacheD) {
|
if ($groups && $memcacheD) {
|
||||||
$nicole = $memcacheD->add($key, $groups, $memcache_ttl);
|
$nicole = $memcacheD->add($key, $groups, $memcache_ttl);
|
||||||
if ($enable_memcache_logging && $nicole) {
|
if ($enable_memcache_logging && $nicole) {
|
||||||
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " Wrote $key", FILE_APPEND);
|
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache write) $key", FILE_APPEND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1902,7 +1902,7 @@ function np_get_db_article($article, $group, $makearray = 1, $dbh = null)
|
||||||
$ok_article = 0;
|
$ok_article = 0;
|
||||||
// Check memcache
|
// Check memcache
|
||||||
if ($memcacheD) {
|
if ($memcacheD) {
|
||||||
$article_key = 'article.db3-' . $group . ':' . $article;
|
$article_key = $memcache_key_prefix . '_' . 'article.db3-' . $group . ':' . $article;
|
||||||
if ($msg2 = $memcacheD->get($article_key)) {
|
if ($msg2 = $memcacheD->get($article_key)) {
|
||||||
$ok_article = 1;
|
$ok_article = 1;
|
||||||
if ($enable_memcache_logging) {
|
if ($enable_memcache_logging) {
|
||||||
|
@ -1942,7 +1942,7 @@ function np_get_db_article($article, $group, $makearray = 1, $dbh = null)
|
||||||
if ($ok_article == 1 && $memcacheD) {
|
if ($ok_article == 1 && $memcacheD) {
|
||||||
$nicole = $memcacheD->add($article_key, $msg2, $memcache_ttl);
|
$nicole = $memcacheD->add($article_key, $msg2, $memcache_ttl);
|
||||||
if ($enable_memcache_logging && $nicole) {
|
if ($enable_memcache_logging && $nicole) {
|
||||||
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " Wrote $article_key", FILE_APPEND);
|
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache write) $article_key", FILE_APPEND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1968,24 +1968,24 @@ function get_poster_name($name)
|
||||||
$fromline = address_decode($name, "nowhere");
|
$fromline = address_decode($name, "nowhere");
|
||||||
if (! isset($fromline[0]["host"]))
|
if (! isset($fromline[0]["host"]))
|
||||||
$fromline[0]["host"] = "";
|
$fromline[0]["host"] = "";
|
||||||
$name_from = $fromline[0]["mailbox"] . "@" . $fromline[0]["host"];
|
$name_from = $fromline[0]["mailbox"] . "@" . $fromline[0]["host"];
|
||||||
$name_username = $fromline[0]["mailbox"];
|
$name_username = $fromline[0]["mailbox"];
|
||||||
if (! isset($fromline[0]["personal"])) {
|
if (! isset($fromline[0]["personal"])) {
|
||||||
$poster_name = $fromline[0]["mailbox"];
|
$poster_name = $fromline[0]["mailbox"];
|
||||||
} else {
|
|
||||||
$poster_name = $fromline[0]["personal"];
|
|
||||||
}
|
|
||||||
if (trim($poster_name) == '') {
|
|
||||||
$fromoutput = explode("<", html_entity_decode($name));
|
|
||||||
if (strlen($fromoutput[0]) < 1) {
|
|
||||||
$poster_name = $fromoutput[1];
|
|
||||||
} else {
|
} else {
|
||||||
$poster_name = $fromoutput[0];
|
$poster_name = $fromline[0]["personal"];
|
||||||
}
|
}
|
||||||
}
|
if (trim($poster_name) == '') {
|
||||||
$thisposter['name'] = $poster_name;
|
$fromoutput = explode("<", html_entity_decode($name));
|
||||||
$thisposter['from'] = $name_from;
|
if (strlen($fromoutput[0]) < 1) {
|
||||||
return ($thisposter);
|
$poster_name = $fromoutput[1];
|
||||||
|
} else {
|
||||||
|
$poster_name = $fromoutput[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$thisposter['name'] = $poster_name;
|
||||||
|
$thisposter['from'] = $name_from;
|
||||||
|
return ($thisposter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2090,9 +2090,25 @@ function disable_page_by_user_agent($client_device, $useragent, $script = "Page"
|
||||||
function throttle_hits($client_device)
|
function throttle_hits($client_device)
|
||||||
{
|
{
|
||||||
global $CONFIG, $OVERRIDES, $logdir, $config_name;
|
global $CONFIG, $OVERRIDES, $logdir, $config_name;
|
||||||
|
$logfile = $logdir . '/newsportal.log';
|
||||||
|
|
||||||
$client_device = get_client_user_agent_info();
|
$client_device = get_client_user_agent_info();
|
||||||
|
$client_device = strtolower($client_device);
|
||||||
|
$useragent = strtolower($useragent);
|
||||||
|
|
||||||
$_SESSION['rsactive'] = true;
|
$_SESSION['rsactive'] = true;
|
||||||
|
|
||||||
|
if (isset($OVERRIDES['block_by_user_agent'])) {
|
||||||
|
$ua = strtolower($_SERVER["HTTP_USER_AGENT"]);
|
||||||
|
foreach($OVERRIDES['block_by_user_agent'] as $user_agent) {
|
||||||
|
if(stripos($ua, $user_agent) !== false) {
|
||||||
|
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Blocking " . $_SERVER['REMOTE_ADDR'] . " '" . $user_agent . "' listed in block list", FILE_APPEND);
|
||||||
|
$_SESSION['throttled'] = true;
|
||||||
|
header("HTTP/1.0 403 Forbidden");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// $loadrate = allowed article request per second
|
// $loadrate = allowed article request per second
|
||||||
$loadrate = .15;
|
$loadrate = .15;
|
||||||
if ($client_device == "bot") {
|
if ($client_device == "bot") {
|
||||||
|
@ -2102,7 +2118,6 @@ function throttle_hits($client_device)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$logfile = $logdir . '/newsportal.log';
|
|
||||||
if (! isset($_SESSION['starttime'])) {
|
if (! isset($_SESSION['starttime'])) {
|
||||||
$_SESSION['starttime'] = time();
|
$_SESSION['starttime'] = time();
|
||||||
$_SESSION['views'] = 0;
|
$_SESSION['views'] = 0;
|
||||||
|
@ -2395,8 +2410,8 @@ function insert_article_from_array($this_article, $check_duplicates = true)
|
||||||
return "441 Insert failed (duplicate)\r\n";
|
return "441 Insert failed (duplicate)\r\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Allow a message to be approximately 2 minutes in the future, but not more.
|
||||||
if ($this_article['epochdate'] > time()) {
|
if ($this_article['epochdate'] > (time() + 120)) {
|
||||||
echo "\n(newsportal)Article date in future. Skipping: " . $group . ":" . $this_article['mid'];
|
echo "\n(newsportal)Article date in future. Skipping: " . $group . ":" . $this_article['mid'];
|
||||||
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Article date in future. Skipping: " . $group . ":" . $this_article['mid'], FILE_APPEND);
|
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Article date in future. Skipping: " . $group . ":" . $this_article['mid'], FILE_APPEND);
|
||||||
return "441 Insert failed (article date in future)\r\n";
|
return "441 Insert failed (article date in future)\r\n";
|
||||||
|
@ -2457,10 +2472,10 @@ function insert_article_from_array($this_article, $check_duplicates = true)
|
||||||
include $config_dir . '/memcache.inc.php';
|
include $config_dir . '/memcache.inc.php';
|
||||||
}
|
}
|
||||||
if ($memcacheD) {
|
if ($memcacheD) {
|
||||||
$article_key = 'article.db3-' . $group . ':' . $this_article['local'];
|
$article_key = $memcache_key_prefix . '_' . 'article.db3-' . $group . ':' . $this_article['local'];
|
||||||
$nicole = $memcacheD->add($article_key, $this_article['article'], $memcache_ttl);
|
$nicole = $memcacheD->add($article_key, $this_article['article'], $memcache_ttl);
|
||||||
if ($enable_memcache_logging && $nicole) {
|
if ($enable_memcache_logging && $nicole) {
|
||||||
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " Wrote (new) $article_key", FILE_APPEND);
|
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache write) (new) $article_key", FILE_APPEND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -2537,7 +2552,7 @@ function get_db_data_from_msgid($msgid, $group)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($memcacheD) {
|
if ($memcacheD) {
|
||||||
$row_cache = 'get_db_data_from_msgid-' . $msgid;
|
$row_cache = $memcache_key_prefix . '_' . 'get_db_data_from_msgid-' . $msgid;
|
||||||
if ($row = $memcacheD->get($row_cache)) {
|
if ($row = $memcacheD->get($row_cache)) {
|
||||||
if ($enable_memcache_logging) {
|
if ($enable_memcache_logging) {
|
||||||
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache hit) $row_cache", FILE_APPEND);
|
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache hit) $row_cache", FILE_APPEND);
|
||||||
|
@ -2565,7 +2580,7 @@ function get_db_data_from_msgid($msgid, $group)
|
||||||
if ($memcacheD) {
|
if ($memcacheD) {
|
||||||
$nicole = $memcacheD->add($row_cache, $row, $memcache_ttl);
|
$nicole = $memcacheD->add($row_cache, $row, $memcache_ttl);
|
||||||
if ($enable_memcache_logging && $nicole) {
|
if ($enable_memcache_logging && $nicole) {
|
||||||
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " Wrote $row_cache", FILE_APPEND);
|
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache write) $row_cache", FILE_APPEND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $row;
|
return $row;
|
||||||
|
@ -2611,7 +2626,7 @@ function get_data_from_msgid($msgid, $thisgroup = null)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($memcacheD) {
|
if ($memcacheD) {
|
||||||
$row_cache = 'get_data_from_msgid-' . $msgid;
|
$row_cache = $memcache_key_prefix . '_' . 'get_data_from_msgid-' . $msgid;
|
||||||
if ($row = $memcacheD->get($row_cache)) {
|
if ($row = $memcacheD->get($row_cache)) {
|
||||||
if ($enable_memcache_logging) {
|
if ($enable_memcache_logging) {
|
||||||
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache hit) $row_cache", FILE_APPEND);
|
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache hit) $row_cache", FILE_APPEND);
|
||||||
|
@ -2644,7 +2659,7 @@ function get_data_from_msgid($msgid, $thisgroup = null)
|
||||||
if ($memcacheD) {
|
if ($memcacheD) {
|
||||||
$nicole = $memcacheD->add($row_cache, $row, $memcache_ttl);
|
$nicole = $memcacheD->add($row_cache, $row, $memcache_ttl);
|
||||||
if ($enable_memcache_logging && $nicole) {
|
if ($enable_memcache_logging && $nicole) {
|
||||||
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " Wrote $row_cache", FILE_APPEND);
|
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " (cache write) $row_cache", FILE_APPEND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $row;
|
return $row;
|
||||||
|
@ -2806,7 +2821,7 @@ function delete_message($messageid, $group = null, $overview_dbh = null)
|
||||||
]);
|
]);
|
||||||
// Delete article from memcache
|
// Delete article from memcache
|
||||||
if ($memcacheD) {
|
if ($memcacheD) {
|
||||||
$article_key = 'article.db3-' . $group . ':' . $row['number'];
|
$article_key = $memcache_key_prefix . '_' . 'article.db3-' . $group . ':' . $row['number'];
|
||||||
$result = $memcacheD->delete($article_key);
|
$result = $memcacheD->delete($article_key);
|
||||||
if ($enable_memcache_logging) {
|
if ($enable_memcache_logging) {
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
@ -2877,14 +2892,14 @@ function wrap_post($body)
|
||||||
$depth = 0;
|
$depth = 0;
|
||||||
while ($line[$depth] == '>') {
|
while ($line[$depth] == '>') {
|
||||||
$depth ++;
|
$depth ++;
|
||||||
if($depth > 30) {
|
if ($depth > 30) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (strlen($line) > $line_length) {
|
if (strlen($line) > $line_length) {
|
||||||
// HERE is where we wrap quoted lines (not so easy)
|
// HERE is where we wrap quoted lines (not so easy)
|
||||||
$start = substr($line, 0, $depth + 1);
|
$start = substr($line, 0, $depth + 1);
|
||||||
$end = substr($line, $depth +1);
|
$end = substr($line, $depth + 1);
|
||||||
$line_wrapped = $start . mb_wordwrap($end, $line_length);
|
$line_wrapped = $start . mb_wordwrap($end, $line_length);
|
||||||
$line_wrapped = preg_split("/\n/", $line_wrapped);
|
$line_wrapped = preg_split("/\n/", $line_wrapped);
|
||||||
foreach ($line_wrapped as $lw) {
|
foreach ($line_wrapped as $lw) {
|
||||||
|
|
|
@ -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 '">';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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
|
||||||
];
|
];
|
||||||
|
|
|
@ -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');
|
||||||
|
@ -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);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.9.85
|
0.9.86
|
||||||
|
|
Loading…
Reference in New Issue