Avoid retrieving articles multiple times for display_full_headers.
This commit is contained in:
parent
9cf227363f
commit
95f1b1c149
|
@ -185,7 +185,7 @@ function message_parse($rawmessage)
|
||||||
*/
|
*/
|
||||||
function message_read($id, $bodynum = 0, $group = "")
|
function message_read($id, $bodynum = 0, $group = "")
|
||||||
{
|
{
|
||||||
global $CONFIG, $config_name, $cache_articles, $spooldir, $spoolpath, $logdir, $text_error, $ns;
|
global $CONFIG, $config_name, $cache_articles, $spooldir, $spoolpath, $logdir, $text_error, $ns, $current_article;
|
||||||
$logfile = $logdir . '/newsportal.log';
|
$logfile = $logdir . '/newsportal.log';
|
||||||
if (! testGroup($group)) {
|
if (! testGroup($group)) {
|
||||||
echo $text_error["read_access_denied"];
|
echo $text_error["read_access_denied"];
|
||||||
|
@ -227,6 +227,7 @@ function message_read($id, $bodynum = 0, $group = "")
|
||||||
unset($rawmessage);
|
unset($rawmessage);
|
||||||
if ($CONFIG['article_database'] == '1') {
|
if ($CONFIG['article_database'] == '1') {
|
||||||
$rawmessage = np_get_db_article($id, $group, 1);
|
$rawmessage = np_get_db_article($id, $group, 1);
|
||||||
|
$current_article = $rawmessage;
|
||||||
} else {
|
} else {
|
||||||
$articlepath = $spoolpath . preg_replace('/\./', '/', $group) . "/" . $id;
|
$articlepath = $spoolpath . preg_replace('/\./', '/', $group) . "/" . $id;
|
||||||
if (file_exists($articlepath)) {
|
if (file_exists($articlepath)) {
|
||||||
|
@ -601,15 +602,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 +767,10 @@ 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;
|
||||||
|
if (! isset($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 +793,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";
|
||||||
|
|
Loading…
Reference in New Issue