Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -197,14 +197,28 @@ class _Dispatcher extends \IPS\Dispatcher
|
||||
{
|
||||
$url .= '/' . $path;
|
||||
$recordClass = '\IPS\cms\Records' . $database->id;
|
||||
|
||||
$isLegacyCategoryUrl = FALSE;
|
||||
|
||||
if ( $database->use_categories )
|
||||
{
|
||||
$catClass = '\IPS\cms\Categories' . $database->id;
|
||||
$category = $catClass::loadFromPath( $path, $database->id );
|
||||
|
||||
/* /_/ was used in IP.Board 3.x to denote the articles database */
|
||||
if ( $category === NULL AND mb_substr( $path, 0, 2 ) === '_/' )
|
||||
{
|
||||
$category = $catClass::loadFromPath( mb_substr( $path, 2 ), $database->id );
|
||||
|
||||
/* We may have a record URL still, so set a flag to handle this later if we never find anything */
|
||||
if ( $category !== NULL )
|
||||
{
|
||||
$isLegacyCategoryUrl = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $category === NULL )
|
||||
{
|
||||
|
||||
/* Is this a record? */
|
||||
$bits = explode( '/', $path );
|
||||
$slug = array_pop( $bits );
|
||||
@@ -261,6 +275,12 @@ class _Dispatcher extends \IPS\Dispatcher
|
||||
}
|
||||
catch( \OutOfRangeException $ex )
|
||||
{
|
||||
/* We are absolutely certain this is not a record, but we have found a legacy category - redirect */
|
||||
if ( $isLegacyCategoryUrl === TRUE )
|
||||
{
|
||||
\IPS\Output::i()->redirect( $category->url() );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->error( 'page_doesnt_exist', '2T251/5', 404 );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user