From 787fc12ed97a05abbdd3cf9b9a618a14b77a8141 Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 8 Sep 2015 15:14:07 -0700 Subject: [PATCH] Improved handling of incorrect news URLs. --- news.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/news.php b/news.php index ea549f9c1..4df9489b6 100644 --- a/news.php +++ b/news.php @@ -92,7 +92,12 @@ if ($action == 'all' || $action == 'cat') $sub_action = intval(varset($tmp[1],0)); } - +if($action == 'extend' && empty($sub_action)) // item not found, redirect to avoid messing up search-engine data. +{ + $defaultUrl = e107::getUrl()->create('news/list/items'); + e107::getRedirect()->go($defaultUrl, null, 301); + exit; +} @@ -141,11 +146,18 @@ $nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'"; $newsRoute = 'list/all'; $newsUrlparms['id'] = $sub_action; } + else + { + $newsRoute = 'list/items'; + } + + - else $newsRoute = 'list/items'; $newsRoute = 'news/'.$newsRoute; + + if(vartrue($_GET['tag']) || substr($action,0,4) == 'tag=') { @@ -161,6 +173,7 @@ if(vartrue($_GET['tag']) || substr($action,0,4) == 'tag=') } /* +print_a(e_QUERY); echo "route= ".$newsRoute." "; echo "
action= ".$action." "; echo "
_GET= ".print_a($_GET,true);