From b6be00ae1cf685f57b9459080a2c263dd029ec4e Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Sun, 14 Jan 2024 06:53:02 -0700 Subject: [PATCH] Add 'groups' link and auto populating groups list. --- Rocksolid_Light/common/grouplist.php | 51 ++++++++++++++++++++++++++++ Rocksolid_Light/rslight/links.conf | 1 + 2 files changed, 52 insertions(+) create mode 100644 Rocksolid_Light/common/grouplist.php diff --git a/Rocksolid_Light/common/grouplist.php b/Rocksolid_Light/common/grouplist.php new file mode 100644 index 0000000..122327c --- /dev/null +++ b/Rocksolid_Light/common/grouplist.php @@ -0,0 +1,51 @@ +List of Available Newsgroups:'; +// Use cache if new enough +if (filemtime($cache_filename) > (time() - 3600)) { + echo file_get_contents($cache_filename); + exit(); +} + +ob_start(); +echo ''; + +$menulist = file($config_dir . "menu.conf", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); + +foreach ($menulist as $menu) { + $groups_array = array(); + if (($menu[0] == '#') || trim($menu) == "") { + continue; + } + $menuitem = explode(':', $menu); + if($menuitem[0] == 'spoolnews') { + continue; + } + if ($menuitem[2] == '1') { + $in_gl = file($config_dir . $menuitem[0] . "/groups.txt"); + foreach ($in_gl as $ok_group) { + if (($ok_group[0] == ':') || (trim($ok_group) == "")) { + continue; + } + $ok_group = preg_split("/( |\t)/", trim($ok_group), 2); + $groups_array[] = $menuitem[0].'/thread.php?group='.urlencode($ok_group[0]); + } + } + echo '
  Section: '.$menuitem[0].'
'; + foreach($groups_array as $thisgroup) { + $group = explode("group=", $thisgroup); + echo '
'.urldecode($group[1])."
\r\n"; + } +} + +echo '
'; +//echo ob_get_contents(); +file_put_contents($cache_filename, ob_get_contents()); +ob_end_flush(); +echo ''; +?> \ No newline at end of file diff --git a/Rocksolid_Light/rslight/links.conf b/Rocksolid_Light/rslight/links.conf index 397aebe..fb81391 100644 --- a/Rocksolid_Light/rslight/links.conf +++ b/Rocksolid_Light/rslight/links.conf @@ -4,4 +4,5 @@ mail:/spoolnews/mail.php files:/spoolnews/files.php register:/common/register.php nodelist:/common/nodelist.php +groups:/common/grouplist.php #faq:/common/faq.txt