Continue with feature to hide unsubscribed groups. Add default and also option in overrides.inc.php.
This commit is contained in:
parent
09d69ab2de
commit
fd5285ba88
|
@ -4,7 +4,7 @@ $title .= ' - Available Newsgroups';
|
|||
include "head.inc";
|
||||
|
||||
$cache_filename = $spooldir . '/grouplist-cache.txt';
|
||||
|
||||
echo '<center>';
|
||||
echo '<h3>List of Available Newsgroups:</h3>';
|
||||
// Use cache if new enough
|
||||
if (filemtime($cache_filename) > (time() - 3600)) {
|
||||
|
@ -61,8 +61,8 @@ foreach ($groups_array as $thisgroup) {
|
|||
}
|
||||
|
||||
echo '</table>';
|
||||
// echo ob_get_contents();
|
||||
echo '</center>';
|
||||
include "tail.inc";
|
||||
echo '</body></html>';
|
||||
file_put_contents($cache_filename, ob_get_contents());
|
||||
ob_end_flush();
|
||||
echo '</body></html>';
|
||||
?>
|
|
@ -595,7 +595,7 @@ function groups_read($server, $port, $load = 0, $force_reload = false)
|
|||
|
||||
function groups_show($gruppen)
|
||||
{
|
||||
global $gl_age, $frame, $spooldir, $logdir, $CONFIG, $spoolnews;
|
||||
global $gl_age, $frame, $spooldir, $config_dir, $logdir, $CONFIG, $OVERRIDES, $spoolnews;
|
||||
if ($gruppen == false)
|
||||
return;
|
||||
global $file_thread, $text_groups;
|
||||
|
@ -607,9 +607,19 @@ function groups_show($gruppen)
|
|||
$subs = array();
|
||||
$nonsubs = array();
|
||||
$user = null;
|
||||
// Get registered user settings
|
||||
if (isset($_COOKIE['mail_name'])) {
|
||||
if ($userdata = get_user_mail_auth_data($_COOKIE['mail_name'])) {
|
||||
$userfile = $spooldir . '/' . strtolower($_COOKIE['mail_name']) . '-articleviews.dat';
|
||||
$user_config = unserialize(file_get_contents($config_dir . '/userconfig/' . strtolower($_COOKIE['mail_name']) . '.config'));
|
||||
}
|
||||
|
||||
if (! isset($user_config['hide_unsub'])) {
|
||||
if (isset($OVERRIDES['hide_unsub'])) {
|
||||
$user_config['hide_unsub'] = $OVERRIDES['hide_unsub'];
|
||||
} else {
|
||||
$user_config['hide_unsub'] = 'hide';
|
||||
}
|
||||
}
|
||||
}
|
||||
for ($i = 0; $i < $c; $i ++) {
|
||||
|
@ -683,6 +693,10 @@ function groups_show($gruppen)
|
|||
$groupdisplay .= ' <a href="overboard.php?thisgroup=' . urlencode($g->name) . '&time=' . $userdata[$g->name] . '"><b>(new)</b></a> ';
|
||||
}
|
||||
$groupdisplay .= '</p';
|
||||
} else {
|
||||
if (isset($user_config['hide_unsub']) && $user_config['hide_unsub'] == 'hide') {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/* Display article count */
|
||||
$groupdisplay .= '</td><td class="' . $lineclass . '">';
|
||||
|
@ -733,6 +747,10 @@ function groups_show($gruppen)
|
|||
echo $nonsub;
|
||||
}
|
||||
echo "</td></div></table>\n";
|
||||
if (isset($user_config['hide_unsub']) && $user_config['hide_unsub'] == 'hide') {
|
||||
echo '<font class="np_last_posted_date"> Unsubscribed groups are HIDDEN. Visit <a href="/spoolnews/user.php">User/Configuration</a> to change<br />';
|
||||
echo ' or select groups from <a href="/common/grouplist.php">Grouplist</a> to add groups</font>';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1949,7 +1967,7 @@ function get_user_mail_auth_data($user)
|
|||
$userfile = $spooldir . '/' . $user . '-articleviews.dat';
|
||||
if (is_file($userfile)) {
|
||||
$userdata = unserialize(file_get_contents($userfile));
|
||||
if(!is_array($userdata)) {
|
||||
if (! $userdata['DO.NOT.DELETE']) {
|
||||
$userdata['DO.NOT.DELETE'] = time();
|
||||
}
|
||||
} else {
|
||||
|
@ -2372,7 +2390,8 @@ function delete_message($messageid, $group=null, $overview_dbh=null)
|
|||
|
||||
// This function returns FALSE if article is OK
|
||||
// Else returns a string with reason for failure
|
||||
function check_article_integrity($rawmessage) {
|
||||
function check_article_integrity($rawmessage)
|
||||
{
|
||||
global $CONFIG, $logfile;
|
||||
$returnval = false;
|
||||
$count_rawmessage = count($rawmessage);
|
||||
|
|
|
@ -25,6 +25,11 @@ return [
|
|||
// Disable Message-ID search in header
|
||||
'disable_msgid_search' => false,
|
||||
|
||||
// Set default for new registered users to 'show' or 'hide'
|
||||
// Unsubscribed groups (else default is 'hide')
|
||||
// Must be 'show' or 'hide'
|
||||
'hide_unsub' => 'hide',
|
||||
|
||||
// Reserved aliases
|
||||
'reserved_names' => array("admin", "sysop", "rslight"),
|
||||
|
||||
|
|
|
@ -294,6 +294,7 @@ if (isset($_POST['command']) && $_POST['command'] == 'SaveConfig') {
|
|||
$user_config['xface'] = $_POST['xface'];
|
||||
$user_config['timezone'] = $_POST['timezone'];
|
||||
$user_config['theme'] = $_POST['listbox'];
|
||||
$user_config['hide_unsub'] = $_POST['hide_unsub'];
|
||||
file_put_contents($config_dir . '/userconfig/' . $user . '.config', serialize($user_config));
|
||||
$_SESSION['theme'] = $user_config['theme'];
|
||||
$mysubs = explode("\n", $_POST['subscribed']);
|
||||
|
@ -392,7 +393,27 @@ if (isset($_POST['command']) && $_POST['command'] == 'Configuration') {
|
|||
echo '</td>';
|
||||
echo '</tr>';
|
||||
// Subscriptions
|
||||
if(!isset($user_config['hide_unsub'])) {
|
||||
$user_config['hide_unsub'] = 'show';
|
||||
}
|
||||
echo '<td class="np_result_line1" style="word-wrap:break-word";><h3>Subscribed:</h3></td>';
|
||||
echo '<tr><td class="np_result_line1" style="word-wrap:break-word";>';
|
||||
|
||||
if($user_config['hide_unsub'] == 'hide') {
|
||||
echo '<input type="radio" name="hide_unsub" id="hide" value="hide" checked="checked">';
|
||||
} else {
|
||||
echo '<input type="radio" name="hide_unsub" id="hide" value="hide">';
|
||||
}
|
||||
echo '<label for="hide_unsub"> Hide Unsubscribed Groups</label><br />';
|
||||
|
||||
if($user_config['hide_unsub'] == 'show') {
|
||||
echo '<input type="radio" name="hide_unsub" id="show" value="show" checked="checked">';
|
||||
} else {
|
||||
echo '<input type="radio" name="hide_unsub" id="show" value="show">';
|
||||
}
|
||||
echo '<label for="hide_unsub"> Show All Groups</label>';
|
||||
echo '</td></tr>';
|
||||
|
||||
echo '</tr><tr><td class="np_result_line1" style="word-wrap:break-word";><textarea class="configuration" id="subscribed" name="subscribed" rows="10" cols="40">';
|
||||
foreach ($userdata as $key => $value) {
|
||||
if($key == "DO.NOT.DELETE") {
|
||||
|
|
Loading…
Reference in New Issue