Add random trailing decimal to article times to avoid overlap in overboard.
This commit is contained in:
parent
f33a50e500
commit
132ef97191
|
@ -69,7 +69,7 @@ if (isset($_GET['thisgroup'])) {
|
||||||
$article_age = 30;
|
$article_age = 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
$version = 1.2;
|
$version = 1.25;
|
||||||
|
|
||||||
# How long in seconds to cache results
|
# How long in seconds to cache results
|
||||||
$cachetime = 60;
|
$cachetime = 60;
|
||||||
|
@ -197,17 +197,19 @@ foreach ($grouplist as $findgroup) {
|
||||||
$this_overboard['lastmessage'] = $target['date'];
|
$this_overboard['lastmessage'] = $target['date'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! isset($this_overboard['threads'][$target['date']])) {
|
// Must handle crossposted articles (time is equal)
|
||||||
$this_overboard['threads'][$target['date']] = $thismsgid;
|
$unique_date = $target['date'] . "." . rand(0, 4) . rand(0, 40);
|
||||||
$this_overboard['msgids'][$thismsgid] = $target;
|
// if (! isset($this_overboard['threads'][$unique_date])) {
|
||||||
if (trim($overviewline['refs']) != '') {
|
$this_overboard['threads'][$unique_date] = $thismsgid;
|
||||||
$ref = preg_split("/[\s]+/", $overviewline['refs']);
|
$this_overboard['msgids'][$thismsgid] = $target;
|
||||||
$this_overboard['threadlink'][$thismsgid] = $ref[0];
|
if (trim($overviewline['refs']) != '') {
|
||||||
}
|
$ref = preg_split("/[\s]+/", $overviewline['refs']);
|
||||||
if ($results ++ > ($maxdisplay - 2)) {
|
$this_overboard['threadlink'][$thismsgid] = $ref[0];
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if ($results ++ > ($maxdisplay - 2)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -239,13 +241,12 @@ function expire_overboard($cachefile)
|
||||||
$prune = false;
|
$prune = false;
|
||||||
if ($this_overboard['expire'] < (time() - 86400)) {
|
if ($this_overboard['expire'] < (time() - 86400)) {
|
||||||
$prune = true;
|
$prune = true;
|
||||||
foreach ($this_overboard['msgids'] as $key => $value) {
|
foreach ($this_overboard['threads'] as $key => $value) {
|
||||||
$target = $this_overboard['msgids'][$key];
|
if ($key < (time() - (86400 * $article_age))) {
|
||||||
if ($target['date'] < (time() - (86400 * $article_age))) {
|
|
||||||
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Expiring: " . $target['newsgroup'] . ":" . $target['number'], FILE_APPEND);
|
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Expiring: " . $target['newsgroup'] . ":" . $target['number'], FILE_APPEND);
|
||||||
unset($this_overboard['threads'][$target['date']]);
|
unset($this_overboard['threads'][$key]);
|
||||||
unset($this_overboard['msgids'][$key]);
|
unset($this_overboard['msgids'][$value]);
|
||||||
unset($this_overboard['threadlink'][$key]);
|
unset($this_overboard['threadlink'][$value]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this_overboard['expire'] = time();
|
$this_overboard['expire'] = time();
|
||||||
|
@ -485,11 +486,17 @@ function display_flat($threads, $oldest)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$results = 0;
|
$results = 0;
|
||||||
|
$shown = array();
|
||||||
foreach ($threads as $key => $value) {
|
foreach ($threads as $key => $value) {
|
||||||
$target = $this_overboard['msgids'][$value];
|
$target = $this_overboard['msgids'][$value];
|
||||||
if (! isset($target['msgid'])) {
|
if (! isset($target['msgid'])) {
|
||||||
$target = get_data_from_msgid($value);
|
$target = get_data_from_msgid($value);
|
||||||
}
|
}
|
||||||
|
if(isset($shown[$value.$target['newsgroup']])) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
$shown[$value.$target['newsgroup']] = $value;
|
||||||
|
}
|
||||||
if (! check_group_for_user($target['newsgroup'], $userdata, $user_config)) {
|
if (! check_group_for_user($target['newsgroup'], $userdata, $user_config)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -633,26 +640,23 @@ function show_overboard_header($grouplist)
|
||||||
|
|
||||||
// Return TRUE unless group is not subscribed by user
|
// Return TRUE unless group is not subscribed by user
|
||||||
// It is assumed $newsgroups to check are verified to be in SECTION
|
// It is assumed $newsgroups to check are verified to be in SECTION
|
||||||
function check_group_for_user($newsgroups, $userdata, $user_config)
|
function check_group_for_user($newsgroup, $userdata, $user_config)
|
||||||
{
|
{
|
||||||
if(!is_array($userdata)) {
|
global $logdir, $config_name;
|
||||||
|
$logfile = $logdir . '/overboard.log';
|
||||||
|
if (! is_array($userdata)) {
|
||||||
// No logged in user
|
// No logged in user
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$testgroup = preg_split("/\ |\,/", $newsgroups);
|
|
||||||
$ok = true;
|
$ok = true;
|
||||||
foreach ($testgroup as $checkgroup) {
|
if (! isset($userdata[$newsgroup])) {
|
||||||
if (! isset($userdata[$checkgroup])) {
|
if (isset($user_config['hide_unsub']) && $user_config['hide_unsub'] == 'hide') {
|
||||||
if (isset($user_config['hide_unsub']) && $user_config['hide_unsub'] == 'hide') {
|
$ok = false;
|
||||||
$ok = false;
|
|
||||||
} else {
|
|
||||||
$ok = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$ok = true;
|
$ok = true;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$ok = true;
|
||||||
}
|
}
|
||||||
return $ok;
|
return $ok;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue