Move checking user's subscription array to a function in overboard.php.
This commit is contained in:
parent
6f62f72a1b
commit
61e1fedfc7
|
@ -313,12 +313,9 @@ function display_threads($threads, $oldest)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip if not in registered users sub list
|
// Skip if not in registered users sub list
|
||||||
$checkgroup = $target_head['newsgroup'];
|
if (! check_group_for_user($target_head['newsgroup'], $userdata, $user_config)) {
|
||||||
if (! isset($userdata[$checkgroup])) {
|
|
||||||
if (isset($user_config['hide_unsub']) && $user_config['hide_unsub'] == 'hide') {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Check if only displaying new posts in section
|
// Check if only displaying new posts in section
|
||||||
if ($newonly) {
|
if ($newonly) {
|
||||||
|
@ -344,12 +341,9 @@ function display_threads($threads, $oldest)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Skip if not in registered users sub list
|
// Skip if not in registered users sub list
|
||||||
$checkgroup = $target['newsgroup'];
|
if (! check_group_for_user($target['newsgroup'], $userdata, $user_config)) {
|
||||||
if (! isset($userdata[$checkgroup])) {
|
|
||||||
if (isset($user_config['hide_unsub']) && $user_config['hide_unsub'] == 'hide') {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// Check if only displaying new posts in section
|
// Check if only displaying new posts in section
|
||||||
if ($newonly) {
|
if ($newonly) {
|
||||||
$allgroups = get_group_array_from_msgid($new);
|
$allgroups = get_group_array_from_msgid($new);
|
||||||
|
@ -493,15 +487,12 @@ function display_flat($threads, $oldest)
|
||||||
$results = 0;
|
$results = 0;
|
||||||
foreach ($threads as $key => $value) {
|
foreach ($threads as $key => $value) {
|
||||||
$target = $this_overboard['msgids'][$value];
|
$target = $this_overboard['msgids'][$value];
|
||||||
$checkgroup = $target['newsgroup'];
|
|
||||||
if (! isset($target['msgid'])) {
|
if (! isset($target['msgid'])) {
|
||||||
$target = get_data_from_msgid($value);
|
$target = get_data_from_msgid($value);
|
||||||
}
|
}
|
||||||
if (! isset($userdata[$checkgroup])) {
|
if (! check_group_for_user($target['newsgroup'], $userdata, $user_config)) {
|
||||||
if (isset($user_config['hide_unsub']) && $user_config['hide_unsub'] == 'hide') {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if ($target['date'] < $oldest) {
|
if ($target['date'] < $oldest) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -640,6 +631,32 @@ function show_overboard_header($grouplist)
|
||||||
echo '</tr></table>';
|
echo '</tr></table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return TRUE unless group is not subscribed by user
|
||||||
|
// It is assumed $newsgroups to check are verified to be in SECTION
|
||||||
|
function check_group_for_user($newsgroups, $userdata, $user_config)
|
||||||
|
{
|
||||||
|
if(!is_array($userdata)) {
|
||||||
|
// No logged in user
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
$testgroup = preg_split("/\ |\,/", $newsgroups);
|
||||||
|
$ok = true;
|
||||||
|
foreach ($testgroup as $checkgroup) {
|
||||||
|
if (! isset($userdata[$checkgroup])) {
|
||||||
|
if (isset($user_config['hide_unsub']) && $user_config['hide_unsub'] == 'hide') {
|
||||||
|
$ok = false;
|
||||||
|
} else {
|
||||||
|
$ok = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$ok = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $ok;
|
||||||
|
}
|
||||||
|
|
||||||
function show_overboard_style_toggle()
|
function show_overboard_style_toggle()
|
||||||
{
|
{
|
||||||
echo '<form method="post" action="' . $_SERVER['REQUEST_URI'] . '">';
|
echo '<form method="post" action="' . $_SERVER['REQUEST_URI'] . '">';
|
||||||
|
|
Loading…
Reference in New Issue