diff --git a/Rocksolid_Light/rocksolid/article-flat.php b/Rocksolid_Light/rocksolid/article-flat.php index cbf4fc4..d094349 100644 --- a/Rocksolid_Light/rocksolid/article-flat.php +++ b/Rocksolid_Light/rocksolid/article-flat.php @@ -12,6 +12,14 @@ // register parameters $id=$_REQUEST["id"]; $group=_rawurldecode($_REQUEST["group"]); + + $findsection = get_section_by_group($group); + if(trim($findsection) !== $config_name) { + $newurl = preg_replace("|/$config_name/|", "/$findsection/", $_SERVER['REQUEST_URI']); + header("Location: $newurl"); + die(); + } + if(isset($_REQUEST["first"])) $first=$_REQUEST["first"]; diff --git a/Rocksolid_Light/rocksolid/newsportal.php b/Rocksolid_Light/rocksolid/newsportal.php index f6ee0ab..9c34373 100644 --- a/Rocksolid_Light/rocksolid/newsportal.php +++ b/Rocksolid_Light/rocksolid/newsportal.php @@ -336,6 +336,33 @@ function testGroup($groupname) { } } +function get_section_by_group($groupname) { + global $CONFIG, $config_dir; + $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; + } + $section = ""; + $glfp=fopen($config_dir.$menuitem[0]."/groups.txt", 'r'); + while($gl=fgets($glfp)) { + $group_name = preg_split("/( |\t)/", $gl, 2); + if(stripos(trim($groupname), trim($group_name[0])) !== false) { + fclose($glfp); + $section=$menuitem[0]; + fclose($glfp); + return $section; + } + } + } + fclose($glfp); + return false; +} + function testGroups($newsgroups) { $groups=explode(",",$newsgroups); $count=count($groups); diff --git a/Rocksolid_Light/rocksolid/thread.php b/Rocksolid_Light/rocksolid/thread.php index 57ddaf1..a4adc97 100644 --- a/Rocksolid_Light/rocksolid/thread.php +++ b/Rocksolid_Light/rocksolid/thread.php @@ -15,6 +15,13 @@ if(isset($_REQUEST["first"])) if(isset($_REQUEST["last"])) $last=intval($_REQUEST["last"]); + $findsection = get_section_by_group($group); + if(trim($findsection) !== $config_name) { + $newurl = preg_replace("|/$config_name/|", "/$findsection/", $_SERVER['REQUEST_URI']); + header("Location: $newurl"); + die(); + } + $thread_show["latest"]=true; $title.= ' - '.$group; include "head.inc";