Version 4.7.0

This commit is contained in:
Neo committed 2025-12-19 16:00:35 -08:00
1 parent 517a5e1f70
commit 8ba7d43898
1933 files changed
+65613 -11332

No files matched your search

+43 -38
View File
@@ -79,7 +79,7 @@ class _forums extends \IPS\Node\Api\NodeController
* @apiparam int min_content The minimum amount of posts to be able to view
* @apiparam int can_see_others 0|1 Users can see topics posted by other users?
* @apiparam object permissions An object with the keys as permission options (view, read, add, reply, attachments) and values as permissions to use (which may be * to grant access to all groups, or an array of group IDs to permit access to)
* @apiparam string redirect_url If creating a redirect forum, the URL to redirect too.
* @apiparam string redirect_url If creating a redirect forum, the URL to redirect to.
* @return \IPS\forums\Forum
* @throws 1F363/2 NO_TITLE A title for the forum must be supplied
* @throws 1F363/3 NO_REDIRECT_URL No redirect URL supplied.
@@ -162,46 +162,51 @@ class _forums extends \IPS\Node\Api\NodeController
}
}
$forum->parent_id = (int) \IPS\Request::i()->parent ?: -1;
if ( !isset( \IPS\Request::i()->type ) )
if( isset( \IPS\Request::i()->parent ) )
{
if ( $forum->parent_id === -1 )
$forum->parent_id = (int) \IPS\Request::i()->parent ?: -1;
if ( !isset( \IPS\Request::i()->type ) )
{
\IPS\Request::i()->type = 'category';
}
else
{
\IPS\Request::i()->type = 'normal';
}
}
switch( \IPS\Request::i()->type )
{
case 'category':
$forum->sub_can_post = 0;
break;
case 'normal':
$forum->sub_can_post = 1;
break;
case 'qa':
$forum->forums_bitoptions['bw_enable_answers'] = TRUE;
break;
case 'redirect':
if ( !isset( \IPS\Request::i()->redirect_url ) )
if ( $forum->parent_id === -1 )
{
throw new \IPS\Api\Exception( 'NO_REDIRECT_URL', '1F363/3', 400 );
\IPS\Request::i()->type = 'category';
}
$forum->redirect_on = 1;
$forum->redirect_url = \IPS\Request::i()->redirect_url;
break;
default:
throw new \IPS\Api\Exception( 'INVALID_TYPE', '1F363/4', 400 );
else
{
\IPS\Request::i()->type = 'normal';
}
}
switch ( \IPS\Request::i()->type )
{
case 'category':
$forum->sub_can_post = 0;
break;
case 'normal':
case 'discussion':
$forum->sub_can_post = 1;
break;
case 'qa':
case 'questions':
$forum->forums_bitoptions['bw_enable_answers'] = TRUE;
break;
case 'redirect':
if ( !isset( \IPS\Request::i()->redirect_url ) )
{
throw new \IPS\Api\Exception( 'NO_REDIRECT_URL', '1F363/3', 400 );
}
$forum->redirect_on = 1;
$forum->redirect_url = \IPS\Request::i()->redirect_url;
break;
default:
throw new \IPS\Api\Exception( 'INVALID_TYPE', '1F363/4', 400 );
}
}
if ( isset( \IPS\Request::i()->password ) )
@@ -231,7 +236,7 @@ class _forums extends \IPS\Node\Api\NodeController
$forum = parent::_createOrUpdate( $forum );
unset( \IPS\Data\Store::i()->forumsHavePasswords );
unset( \IPS\Data\Store::i()->forumsCustomNodes );
return $forum;
}