Merge branch 'devel'
This commit is contained in:
commit
1e9d2838cc
|
@ -1128,36 +1128,34 @@ function html_parse($text)
|
|||
|
||||
function display_links_in_body($text)
|
||||
{
|
||||
global $config_dir;
|
||||
preg_match_all('/(https?|ftp|scp|news|gopher|gemini|telnet):\/\/[a-zA-Z0-9.?%=\-\+\;\:\,\~\@\!\(\)\$\#&_\/]+/', $text, $matches);
|
||||
$found = array();
|
||||
$isquote = false;
|
||||
if (strpos($text, ">") == 0) {
|
||||
$isquote = true;
|
||||
echo '<blockquote class="np_article_quote">';
|
||||
}
|
||||
foreach ($matches[0] as $match) {
|
||||
if (! $match) {
|
||||
continue;
|
||||
}
|
||||
if (in_array($match, $found)) {
|
||||
continue;
|
||||
}
|
||||
$found[] = $match;
|
||||
$linkurl = preg_replace("/(<|>)/", ' ', htmlspecialchars_decode($match));
|
||||
$url = preg_replace("/(<|>)/", ' ', $match);
|
||||
$pattern = preg_quote($url);
|
||||
$pattern = "!$pattern!";
|
||||
$text = preg_replace($pattern, '<a href="' . $linkurl . '" rel="nofollow" target="_blank">' . $url . '</a>', $text, 1);
|
||||
}
|
||||
if (file_exists($config_dir . '/rewrite_body.inc.php')) {
|
||||
include ($config_dir . '/rewrite_body.inc.php');
|
||||
}
|
||||
|
||||
echo $text;
|
||||
if ($isquote) {
|
||||
echo '</blockquote>';
|
||||
}
|
||||
global $config_dir;
|
||||
preg_match_all('/(https?|ftp|scp|news|gopher|gemini|telnet):\/\/[a-zA-Z0-9.?%=\-\+\;\:\,\~\@\!\(\)\$\#&_\/]+/', $text, $matches);
|
||||
$isquote = false;
|
||||
if (strpos($text, ">") == 0) {
|
||||
$isquote = true;
|
||||
echo '<blockquote class="np_article_quote">';
|
||||
}
|
||||
foreach ($matches[0] as $match) {
|
||||
if (! $match) {
|
||||
continue;
|
||||
}
|
||||
// Get rid of unwanted trailing characters
|
||||
$match = rtrim(htmlspecialchars_decode($match), '/>,"');
|
||||
$match = htmlspecialchars($match);
|
||||
$linkurl = preg_replace("/(<|>)/", '', htmlspecialchars_decode($match));
|
||||
$url = preg_replace("/(<|>)/", ' ', $match);
|
||||
$pattern = preg_quote($url);
|
||||
$pattern = "!$pattern!";
|
||||
$text = preg_replace($pattern, '<a href="' . $linkurl . '" rel="nofollow" target="_blank">' . $url . '</a>', $text, 1);
|
||||
}
|
||||
if (file_exists($config_dir . '/rewrite_body.inc.php')) {
|
||||
include ($config_dir . '/rewrite_body.inc.php');
|
||||
}
|
||||
|
||||
echo $text;
|
||||
if ($isquote) {
|
||||
echo '</blockquote>';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -308,12 +308,6 @@ function display_threads($threads, $oldest)
|
|||
$style = 0;
|
||||
$results = 0;
|
||||
foreach ($nicole as $key => $value) {
|
||||
// Skip if not in registered users sub list
|
||||
if (! $foundgroup_head = check_group_for_user($key, $userdata, $user_config, true)) {
|
||||
// testing: continuing here may break newsgroup identification
|
||||
// and not display articles that should be displayed
|
||||
// continue;
|
||||
}
|
||||
$target_head = $this_overboard['msgids'][$key];
|
||||
if (! isset($target_head['msgid'])) {
|
||||
$target_head = get_data_from_msgid($key);
|
||||
|
@ -422,6 +416,9 @@ function display_threads($threads, $oldest)
|
|||
}
|
||||
}
|
||||
$display .= '</td></tr>';
|
||||
if ($results > ($maxdisplay - 1)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$display .= "</table>";
|
||||
|
|
|
@ -356,6 +356,7 @@ function process_post($message, $group)
|
|||
$body = "";
|
||||
$ref = 0;
|
||||
$sub = 0;
|
||||
$ng = 0;
|
||||
$response = "";
|
||||
$bytes = 0;
|
||||
$lines = 0;
|
||||
|
@ -372,6 +373,23 @@ function process_post($message, $group)
|
|||
if (strpos($line, ': ') !== false) {
|
||||
$ref = 0;
|
||||
$sub = 0;
|
||||
$ng = 0;
|
||||
} else {
|
||||
if (preg_match('/^\s/', $line)) {
|
||||
if ($ng == 1) {
|
||||
$newsgroups = $newsgroups . ',' . trim($line);
|
||||
$newsgroups = preg_replace('/\,\,/', ',', $newsgroups);
|
||||
continue;
|
||||
}
|
||||
if ($ref == 1) {
|
||||
$references = $references . $line;
|
||||
continue;
|
||||
}
|
||||
if ($sub == 1) {
|
||||
$subject = $subject . $line;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (stripos($line, "Path: ") === 0) {
|
||||
$response = "441 Posting failed (Header preloading denied)\r\n";
|
||||
|
@ -403,18 +421,14 @@ function process_post($message, $group)
|
|||
if (stripos($line, "Newsgroups: ") === 0) {
|
||||
$ngroups = explode(': ', $line);
|
||||
$newsgroups = $ngroups[1];
|
||||
$ng = 1;
|
||||
}
|
||||
if (stripos($line, "References: ") === 0) {
|
||||
$references_line = explode(': ', $line);
|
||||
$references = $references_line[1];
|
||||
$ref = 1;
|
||||
}
|
||||
if (preg_match('/^\s/', $line) && $ref == 1) {
|
||||
$references = $references . $line;
|
||||
}
|
||||
if (preg_match('/^\s/', $line) && $sub == 1) {
|
||||
$subject = $subject . $line;
|
||||
}
|
||||
|
||||
if (stripos($line, "Message-ID: ") !== false) {
|
||||
$mid = explode(': ', $line);
|
||||
$no_mid = 0;
|
||||
|
@ -470,6 +484,7 @@ function process_post($message, $group)
|
|||
}
|
||||
$is_header = 1;
|
||||
$lines = 0;
|
||||
$ng = 0;
|
||||
foreach ($message as $line) {
|
||||
if (trim($line) == "" || $lines > 0) {
|
||||
$is_header = 0;
|
||||
|
@ -477,7 +492,17 @@ function process_post($message, $group)
|
|||
}
|
||||
if (stripos($line, "Newsgroups: ") === 0 && $is_header == 1) {
|
||||
fputs($postfilehandle, "Newsgroups: " . $newsgroups . "\r\n");
|
||||
$ng = 1;
|
||||
} else {
|
||||
if (strpos($line, ': ') !== false) {
|
||||
$ng = 0;
|
||||
} else {
|
||||
if (preg_match('/^\s/', $line)) {
|
||||
if ($ng == 1) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
fputs($postfilehandle, $line . "\r\n");
|
||||
}
|
||||
}
|
||||
|
@ -1125,7 +1150,7 @@ function insert_article($section, $nntp_group, $filename, $subject_i, $from_i, $
|
|||
{
|
||||
global $enable_rslight, $spooldir, $CONFIG, $OVERRIDES, $logdir, $lockdir, $logfile;
|
||||
|
||||
if(is_moderated($nntp_group)) {
|
||||
if (is_moderated($nntp_group)) {
|
||||
file_put_contents($logfile, "\n" . format_log_date() . " " . $section . " Moderated group... Queuing local post: " . $nntp_group, FILE_APPEND);
|
||||
$return_val = "240 Article received OK (queued for moderation)\r\n";
|
||||
return ($return_val);
|
||||
|
|
|
@ -217,6 +217,7 @@ function get_articles($ns, $group)
|
|||
$local = get_next_article_number($group);
|
||||
}
|
||||
# Split group response line to get last article number
|
||||
# $article is the next number we want, not the last we retrieved
|
||||
$detail = explode(" ", $response);
|
||||
if (! isset($article)) {
|
||||
$article = $detail[2];
|
||||
|
@ -227,6 +228,11 @@ function get_articles($ns, $group)
|
|||
if ($article < $detail[2]) {
|
||||
$article = $detail[2];
|
||||
}
|
||||
if ($article > $detail[3]) {
|
||||
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " " . $CONFIG['remote_server'] . " for " . $group . " We are up to date", FILE_APPEND);
|
||||
// Just in case we have an error and $article is too large:
|
||||
$article = $detail[3] + 1;
|
||||
} else {
|
||||
// Get overview from server
|
||||
$server_overview = array();
|
||||
$re = false;
|
||||
|
@ -292,6 +298,7 @@ function get_articles($ns, $group)
|
|||
$bytes = 0;
|
||||
$ref = 0;
|
||||
$sub = 0;
|
||||
$ng = 0;
|
||||
$banned = false;
|
||||
$integrity = false;
|
||||
$is_header = 1;
|
||||
|
@ -312,6 +319,7 @@ function get_articles($ns, $group)
|
|||
if (strpos($response, ': ') !== false) {
|
||||
$ref = 0;
|
||||
$sub = 0;
|
||||
$ng = 0;
|
||||
}
|
||||
// Find article date
|
||||
if (stripos($response, "Date: ") === 0) {
|
||||
|
@ -372,6 +380,7 @@ function get_articles($ns, $group)
|
|||
$current_article['xref'] .= ' ' . $agroup . ':' . $artnum;
|
||||
}
|
||||
}
|
||||
$ng = 1;
|
||||
}
|
||||
if (stripos($response, "Xref: ") === 0) {
|
||||
if (isset($CONFIG['enable_nntp']) && $CONFIG['enable_nntp'] == true) {
|
||||
|
@ -388,6 +397,11 @@ function get_articles($ns, $group)
|
|||
$references = $this_references[1];
|
||||
$ref = 1;
|
||||
}
|
||||
if (preg_match('/^\s/', $response) && $ng == 1) {
|
||||
$addgroups = preg_split("/\ |\,/", trim($response));
|
||||
$allgroups = array_merge($allgroups, $addgroups);
|
||||
}
|
||||
|
||||
if (preg_match('/^\s/', $response) && $ref == 1) {
|
||||
$references = $references . $response;
|
||||
}
|
||||
|
@ -516,6 +530,7 @@ function get_articles($ns, $group)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// END GET INDIVIDUAL ARTICLE
|
||||
$article --;
|
||||
// $local--;
|
||||
|
@ -533,32 +548,8 @@ function get_articles($ns, $group)
|
|||
}
|
||||
}
|
||||
# Save config
|
||||
$grouplist = file($remote_groupfile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
$saveconfig = fopen($remote_groupfile, 'w+');
|
||||
foreach ($grouplist as $savegroup) {
|
||||
$name = explode(':', $savegroup);
|
||||
if (strcmp($name[0], $group) == 0) {
|
||||
fputs($saveconfig, $group . ":" . $article . "\n");
|
||||
} else {
|
||||
fputs($saveconfig, $savegroup . "\n");
|
||||
}
|
||||
}
|
||||
fclose($saveconfig);
|
||||
$grouplist = file($local_groupfile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
$saveconfig = fopen($local_groupfile, 'w+');
|
||||
foreach ($grouplist as $savegroup) {
|
||||
$name = explode(':', $savegroup);
|
||||
if (strcmp($name[0], $group) == 0) {
|
||||
fputs($saveconfig, $group . ":" . $local . "\n");
|
||||
} else {
|
||||
fputs($saveconfig, $savegroup . "\n");
|
||||
}
|
||||
}
|
||||
fclose($saveconfig);
|
||||
if ($CONFIG['article_database'] == '1') {
|
||||
$article_dbh = null;
|
||||
}
|
||||
$dbh = null;
|
||||
save_config_value($remote_groupfile, $group, $article, true);
|
||||
save_config_value($local_groupfile, $group, $local, true);
|
||||
}
|
||||
|
||||
function create_spool_groups($in_groups, $out_groups)
|
||||
|
|
|
@ -1 +1 @@
|
|||
0.9.87
|
||||
0.9.875
|
||||
|
|
Loading…
Reference in New Issue