Rewrite url if group changes section in thread.php and article-flat.php
This commit is contained in:
parent
c1111c155d
commit
5f531dc6da
|
@ -12,6 +12,14 @@
|
||||||
// register parameters
|
// register parameters
|
||||||
$id=$_REQUEST["id"];
|
$id=$_REQUEST["id"];
|
||||||
$group=_rawurldecode($_REQUEST["group"]);
|
$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"]))
|
if(isset($_REQUEST["first"]))
|
||||||
$first=$_REQUEST["first"];
|
$first=$_REQUEST["first"];
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
function testGroups($newsgroups) {
|
||||||
$groups=explode(",",$newsgroups);
|
$groups=explode(",",$newsgroups);
|
||||||
$count=count($groups);
|
$count=count($groups);
|
||||||
|
|
|
@ -15,6 +15,13 @@ if(isset($_REQUEST["first"]))
|
||||||
if(isset($_REQUEST["last"]))
|
if(isset($_REQUEST["last"]))
|
||||||
$last=intval($_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;
|
$thread_show["latest"]=true;
|
||||||
$title.= ' - '.$group;
|
$title.= ' - '.$group;
|
||||||
include "head.inc";
|
include "head.inc";
|
||||||
|
|
Loading…
Reference in New Issue