Version 4.5.0

This commit is contained in:
Neo committed 2025-12-19 05:51:58 -08:00
1 parent 1a0c7fd3c2
commit f79dcf067a
3791 files changed
+248032 -76372

No files matched your search

+84 -3
View File
@@ -23,13 +23,75 @@ class _Application extends \IPS\Application
*/
public function init()
{
/* If the viewing member cannot view the board (ex: guests must login first), then send a 404 Not Found header here, before the Login page shows in the dispatcher */
if ( !\IPS\Member::loggedIn()->group['g_view_board'] and ( \IPS\Request::i()->module == 'blogs' and \IPS\Request::i()->controller == 'view' and \IPS\Request::i()->do == 'rss' ) )
/* Handle RSS requests */
if ( \IPS\Request::i()->module == 'blogs' and \IPS\Request::i()->controller == 'view' and \IPS\Request::i()->do == 'rss' )
{
\IPS\Output::i()->error( 'node_error', '2B221/1', 404, '' );
$member = NULL;
if( \IPS\Request::i()->member AND \IPS\Request::i()->key )
{
$member = \IPS\Member::load( \IPS\Request::i()->member );
if( !\IPS\Login::compareHashes( md5( ( $member->members_pass_hash ?: $member->email ) . $member->members_pass_salt ), (string) \IPS\Request::i()->key ) )
{
$member = NULL;
}
}
$this->sendBlogRss( $member ?? new \IPS\Member );
if( !\IPS\Member::loggedIn()->group['g_view_board'] )
{
\IPS\Output::i()->error( 'node_error', '2B221/1', 404, '' );
}
}
}
/**
* Send the blog's RSS feed for the indicated member
*
* @param \IPS\Member $member Member
* @return void
*/
protected function sendBlogRss( $member )
{
try
{
$blog = \IPS\blog\Blog::load( \IPS\Request::i()->id );
if( !$blog->can( 'view', $member ) )
{
throw new \OutOfRangeException;
}
}
catch ( \OutOfRangeException $e )
{
/* We'll let the regular controller handle the error */
return;
}
if( !\IPS\Settings::i()->blog_allow_rss or !$blog->settings['allowrss'] )
{
\IPS\Output::i()->error( 'blog_rss_offline', '2B201/5', 403, 'blog_rss_offline_admin' );
}
/* We have to use get() to ensure CDATA tags wrap the blog title properly */
$title = $blog->member_id ? $blog->name : $member->language()->get( "blogs_blog_{$blog->id}" );
$document = \IPS\Xml\Rss::newDocument( $blog->url(), $title, $blog->description );
foreach ( \IPS\blog\Entry::getItemsWithPermission( array( array( 'entry_blog_id=?', $blog->id ), array( 'entry_status!=?', 'draft' ) ), 'entry_date DESC', 25, 'read', \IPS\Content\Hideable::FILTER_PUBLIC_ONLY, 0, $member, FALSE, FALSE, FALSE, FALSE, NULL, $blog ) as $entry )
{
$document->addItem( $entry->name, $entry->url(), $entry->content, \IPS\DateTime::ts( $entry->date ), $entry->id );
}
/* @note application/rss+xml is not a registered IANA mime-type so we need to stick with text/xml for RSS */
\IPS\Output::i()->sendOutput( $document->asXML(), 200, 'text/xml', array(), TRUE );
}
/**
* Perform any additional installation needs
*
* @return void
*/
public function installOther()
{
/* Allow non guests to create and comment on Blogs */
@@ -39,6 +101,13 @@ class _Application extends \IPS\Application
$group->g_blog_allowcomment = TRUE;
$group->save();
}
/* Create new default category */
$category = new \IPS\blog\Category;
$category->seo_name = 'general';
$category->save();
\IPS\Lang::saveCustom( 'blog', "blog_category_{$category->id}", "General" );
}
/**
@@ -84,4 +153,16 @@ class _Application extends \IPS\Application
'activityTabs' => array()
);
}
/**
* Return an array of specific links to add to the sitemap
*
* @return array
*/
public function sitemapLinks()
{
return array(
\IPS\Http\Url::internal( 'app=blog&module=blogs&controller=browse', 'front', 'blogs' ),
);
}
}