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; return true;
} else { } else {
/* Find section */ /* Find section */
$menulist = file($config_dir . "menu.conf", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); if (get_section_by_group($groupname, false)) {
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);
return true; return true;
} } else {
}
}
fclose($glfp);
return false; return false;
} }
}
} else { } else {
return true; return true;
} }
@ -1296,7 +1280,8 @@ function group_display_name($gname)
return $gname; return $gname;
} }
function verify_logged_in($name) { function verify_logged_in($name)
{
global $CONFIG, $auth_log, $debug_log; global $CONFIG, $auth_log, $debug_log;
$logged_in = false; $logged_in = false;
@ -1344,7 +1329,8 @@ function verify_logged_in($name) {
return $logged_in; return $logged_in;
} }
function set_user_logged_in_cookies($name, $keys) { function set_user_logged_in_cookies($name, $keys)
{
global $debug_log, $CONFIG; global $debug_log, $CONFIG;
$name = trim($name); $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; global $client_ip_address;
if ($sockip) { if ($sockip) {
if (preg_match("/\./", $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() function format_log_date()
{ {
return date('M d H:i:s'); return date('M d H:i:s');
@ -3008,7 +3006,8 @@ function check_article_integrity($rawmessage)
} }
/* Remove or replace characters in a string */ /* Remove or replace characters in a string */
function sanitize_header($text) { function sanitize_header($text)
{
return preg_replace("/\`/", "'", $text); return preg_replace("/\`/", "'", $text);
} }
@ -3065,7 +3064,7 @@ function wrap_post($body)
function delete_message_from_overboard($config_name, $group, $messageid) function delete_message_from_overboard($config_name, $group, $messageid)
{ {
GLOBAL $spooldir; global $spooldir;
$cachefile = $spooldir . "/" . $config_name . "-overboard.dat"; $cachefile = $spooldir . "/" . $config_name . "-overboard.dat";
if (is_file($cachefile)) { if (is_file($cachefile)) {
$cached_overboard = unserialize(file_get_contents($cachefile)); $cached_overboard = unserialize(file_get_contents($cachefile));