Add function to wipe newsportal data per group.

This commit is contained in:
Retro_Guy 2024-09-28 09:15:51 -07:00
parent 211044cdc5
commit b0f6e182f4
1 changed files with 81 additions and 82 deletions

View File

@ -342,28 +342,12 @@ function testGroup($groupname)
return true;
} else {
/* Find section */
$menulist = file($config_dir . "menu.conf", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach ($menulist as $menu) {
if ($menu[0] == '#') {
continue;
}
$menuitem = explode(':', $menu);
if ($menuitem[1] == '0') {
continue;
}
$glfp = fopen($config_dir . $menuitem[0] . "/groups.txt", 'r');
$section = "";
while ($gl = fgets($glfp)) {
$group_name = preg_split("/( |\t)/", $gl, 2);
if (stripos(trim($groupname), trim($group_name[0])) !== false) {
fclose($glfp);
if (get_section_by_group($groupname, false)) {
return true;
}
}
}
fclose($glfp);
} else {
return false;
}
}
} else {
return true;
}
@ -1296,7 +1280,8 @@ function group_display_name($gname)
return $gname;
}
function verify_logged_in($name) {
function verify_logged_in($name)
{
global $CONFIG, $auth_log, $debug_log;
$logged_in = false;
@ -1344,7 +1329,8 @@ function verify_logged_in($name) {
return $logged_in;
}
function set_user_logged_in_cookies($name, $keys) {
function set_user_logged_in_cookies($name, $keys)
{
global $debug_log, $CONFIG;
$name = trim($name);
@ -1625,7 +1611,8 @@ function check_spam($subject, $from, $newsgroups, $ref, $body, $msgid, $useheade
);
}
function logging_prefix($sockip = null) {
function logging_prefix($sockip = null)
{
global $client_ip_address;
if ($sockip) {
if (preg_match("/\./", $sockip)) {
@ -1645,6 +1632,17 @@ function logging_prefix($sockip = null) {
}
}
function wipe_newsportal_spool_info($group) {
global $spooldir;
$gpath = $spooldir . '/' . $group;
@unlink($gpath . '-cache.txt');
@unlink($gpath . '-data.dat');
@unlink($gpath . '-firstarticleinfo.dat');
@unlink($gpath . '-lastarticleinfo.dat');
@unlink($gpath . '-info.txt');
@unlink($gpath . '-overboard.dat');
}
function format_log_date()
{
return date('M d H:i:s');
@ -3008,7 +3006,8 @@ function check_article_integrity($rawmessage)
}
/* Remove or replace characters in a string */
function sanitize_header($text) {
function sanitize_header($text)
{
return preg_replace("/\`/", "'", $text);
}
@ -3065,7 +3064,7 @@ function wrap_post($body)
function delete_message_from_overboard($config_name, $group, $messageid)
{
GLOBAL $spooldir;
global $spooldir;
$cachefile = $spooldir . "/" . $config_name . "-overboard.dat";
if (is_file($cachefile)) {
$cached_overboard = unserialize(file_get_contents($cachefile));