Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

+110 -2
View File
@@ -3,7 +3,7 @@
* @brief Forums Application Class
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2014 Invision Power Services, Inc.
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Forums
* @since 07 Jan 2014
* @version
@@ -70,7 +70,7 @@ class _Application extends \IPS\Application
}
else
{
$clause = array( 'poll_state=0' );
$clause = array( 'poll_state=0 or poll_state IS NULL' );
}
break;
@@ -127,4 +127,112 @@ class _Application extends \IPS\Application
\IPS\Content\Search\Index::i()->index( \IPS\forums\Topic::load( 1 ) );
\IPS\Content\Search\Index::i()->index( \IPS\forums\Topic\Post::load( 1 ) );
}
/**
* Default front navigation
*
* @code
// Each item...
array(
'key' => 'Example', // The extension key
'app' => 'core', // [Optional] The extension application. If ommitted, uses this application
'config' => array(...), // [Optional] The configuration for the menu item
'title' => 'SomeLangKey', // [Optional] If provided, the value of this language key will be copied to menu_item_X
'children' => array(...), // [Optional] Array of child menu items for this item. Each has the same format.
)
return array(
'rootTabs' => array(), // These go in the top row
'browseTabs' => array(), // These go under the Browse tab on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Browse tab may not exist)
'browseTabsEnd' => array(), // These go under the Browse tab after all other items on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Browse tab may not exist)
'activityTabs' => array(), // These go under the Activity tab on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Activity tab may not exist)
)
* @endcode
* @return array
*/
public function defaultFrontNavigation()
{
return array(
'rootTabs' => array(),
'browseTabs' => array( array( 'key' => 'Forums' ) ),
'browseTabsEnd' => array(),
'activityTabs' => array()
);
}
/**
* Perform some legacy URL parameter conversions
*
* @return void
*/
public function convertLegacyParameters()
{
/* Convert &showtopic= @link https://community.invisionpower.com/4bugtrack/active-reports/double-redirects-in-legacyredirect-method-may-cause-seo-issues-r8934/ */
if ( isset( \IPS\Request::i()->showtopic ) and is_numeric( \IPS\Request::i()->showtopic ) )
{
$base = NULL;
$seoTemplate = NULL;
$seoTitles = array();
try
{
$topic = \IPS\forums\Topic::load( \IPS\Request::i()->showtopic );
if ( $topic->canView() )
{
$base = 'front';
$seoTemplate = 'forums_topic';
$seoTitles = array( $topic->title_seo );
}
} catch( \Exception $e ) {}
$url = \IPS\Http\Url::internal( 'app=forums&module=forums&controller=topic&id=' . \IPS\Request::i()->showtopic, $base, $seoTemplate, $seoTitles );
if ( isset( \IPS\Request::i()->p ) or isset( \IPS\Request::i()->findpost ) )
{
$url = $url->setQueryString( array( 'do' => 'findComment', 'comment' => \IPS\Request::i()->p ?: \IPS\Request::i()->findpost ) );
}
elseif ( isset( \IPS\Request::i()->page ) )
{
$url = $url->setQueryString( array( 'page' => \IPS\Request::i()->page ) );
}
\IPS\Output::i()->redirect( $url );
}
/* Convert &showforum= */
if ( isset( \IPS\Request::i()->showforum ) and is_numeric( \IPS\Request::i()->showforum ) )
{
$base = NULL;
$seoTemplate = NULL;
$seoTitles = array();
try
{
$forum = \IPS\forums\Forum::load( \IPS\Request::i()->showforum );
if ( $forum->can( 'view' ) )
{
$base = 'front';
$seoTemplate = 'forums_forum';
$seoTitles = array( $forum->name_seo );
}
} catch ( \Exception $e ) {}
$url = \IPS\Http\Url::internal( 'app=forums&module=forums&controller=forums&id=' . \IPS\Request::i()->showforum, $base, $seoTemplate, $seoTitles );
\IPS\Output::i()->redirect( $url );
}
/* Convert /topic/123-example/&p= */
if ( isset( \IPS\Request::i()->p ) AND is_numeric( \IPS\Request::i()->p ) AND ( \IPS\Request::i()->url() instanceof \IPS\Http\Url\Friendly ) AND \IPS\Request::i()->url()->seoTemplate == 'forums_topic' )
{
/* We do this a little differently as the topic seo title is already known at this point */
try
{
$post = \IPS\forums\Topic\Post::loadAndCheckPerms( \IPS\Request::i()->p );
\IPS\Output::i()->redirect( $post->url() );
}
catch( \Exception $e ) {}
}
}
}