Add 'subscribe' link to unsubscribed groups.
This commit is contained in:
parent
ad40a9fb38
commit
7f6649333b
|
@ -79,6 +79,17 @@ echo '<td width=100%></td></tr></table>';
|
|||
|
||||
flush();
|
||||
|
||||
// Subscribe to group
|
||||
if (isset($_GET['subscribe'])) {
|
||||
if (isset($_COOKIE['mail_name'])) {
|
||||
if ($userdata = get_user_mail_auth_data($_COOKIE['mail_name'])) {
|
||||
$userfile = $spooldir . '/' . strtolower($_COOKIE['mail_name']) . '-articleviews.dat';
|
||||
$thisgroup = _rawurldecode($_GET['subscribe']);
|
||||
$userdata[$thisgroup] = time();
|
||||
file_put_contents($userfile, serialize($userdata));
|
||||
}
|
||||
}
|
||||
}
|
||||
// Unsubscribe from group
|
||||
if (isset($_GET['unsub'])) {
|
||||
if (isset($_COOKIE['mail_name'])) {
|
||||
|
@ -91,7 +102,6 @@ if (isset($_GET['unsub'])) {
|
|||
$newsubs[$key] = $usertime;
|
||||
}
|
||||
}
|
||||
$userfile = $spooldir . '/' . strtolower($_COOKIE['mail_name']) . '-articleviews.dat';
|
||||
file_put_contents($userfile, serialize($newsubs));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -751,6 +751,10 @@ function groups_show($gruppen)
|
|||
} else {
|
||||
if (isset($user_config['hide_unsub']) && $user_config['hide_unsub'] == 'hide') {
|
||||
continue;
|
||||
} else {
|
||||
$groupdisplay .= '</span><p class="np_group_user_tools">';
|
||||
$groupdisplay .= '<a class="np_group_user_tools" href="index.php?subscribe=' . urlencode($g->name) . '">(subscribe)</a>';
|
||||
$groupdisplay .= '</p';
|
||||
}
|
||||
}
|
||||
/* Display article count */
|
||||
|
@ -1130,7 +1134,8 @@ function html_parse($text)
|
|||
return ($ntext);
|
||||
}
|
||||
|
||||
function rewrite_body($text) {
|
||||
function rewrite_body($text)
|
||||
{
|
||||
global $config_dir;
|
||||
if (file_exists($config_dir . '/rewrite_body.inc.php')) {
|
||||
include($config_dir . '/rewrite_body.inc.php');
|
||||
|
@ -1304,7 +1309,7 @@ function verify_logged_in($name)
|
|||
$_SESSION['start_stamp'] = time();
|
||||
}
|
||||
|
||||
if (! isset($_SESSION['start_address'])) {
|
||||
if (! isset($_SESSION['start_address'])) {
|
||||
$_SESSION['start_address'] = $_SERVER['REMOTE_ADDR'];
|
||||
$ip_pass = true;
|
||||
file_put_contents($auth_log, "\n" . logging_prefix() . " IP address SET for: " . $name, FILE_APPEND);
|
||||
|
@ -2365,7 +2370,7 @@ function send_internet_email($subject, $body, $mail_to = false, $mail_from = fal
|
|||
$mail = new PHPMailer\PHPMailer\PHPMailer();
|
||||
}
|
||||
|
||||
if(!$mail) {
|
||||
if (!$mail) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2422,6 +2427,10 @@ function send_internet_email($subject, $body, $mail_to = false, $mail_from = fal
|
|||
}
|
||||
}
|
||||
|
||||
/* get_user_mail_auth_data is poorly named but
|
||||
* it retrieves newsgroup status per user info
|
||||
* for subscribe/unsubscribe/read/unread
|
||||
*/
|
||||
function get_user_mail_auth_data($user)
|
||||
{
|
||||
global $spooldir;
|
||||
|
|
Loading…
Reference in New Issue