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

+50 -4
View File
@@ -182,6 +182,7 @@ class _topics extends \IPS\Content\Api\ItemController
* @throws 1F294/5 NO_TITLE No title was supplied
* @throws 1F294/4 NO_POST No post was supplied
* @throws 2F294/C NO_PERMISSION The authorized user does not have permission to create a topic in that forum
* @throws 3F294/D NO_ANON_PERMISSION The topic is set for anonymous posting, but the author does not have permission to post anonymously
* @return \IPS\forums\Topic
*/
public function POSTindex()
@@ -221,8 +222,24 @@ class _topics extends \IPS\Content\Api\ItemController
}
else
{
$author = new \IPS\Member;
$author->name = \IPS\Request::i()->author_name;
if ( \IPS\Request::i()->author === 0 )
{
$author = new \IPS\Member;
$author->name = \IPS\Request::i()->author_name;
}
else
{
throw new \IPS\Api\Exception( 'NO_AUTHOR', '1F294/3', 400 );
}
}
}
/* Check anonymous posting */
if ( isset( \IPS\Request::i()->anonymous ) and $author->member_id )
{
if ( ! $forum->canPostAnonymously( 0, $author ) )
{
throw new \IPS\Api\Exception( 'NO_ANON_PERMISSION', '3F294/D', 403 );
}
}
@@ -269,6 +286,7 @@ class _topics extends \IPS\Content\Api\ItemController
* @throws 1F294/7 NO_FORUM The forum ID does not exist or the authorized user does not have permission to post in it
* @throws 1F294/8 NO_AUTHOR The author ID does not exist
* @throws 2F294/A NO_PERMISSION The authorized user does not have permission to edit the topic
* @throws 1F294/E INVALID_DATE The date is invalid
* @return \IPS\forums\Topic
*/
public function POSTitem( $id )
@@ -337,10 +355,38 @@ class _topics extends \IPS\Content\Api\ItemController
}
}
}
/* Do we have a date? */
if ( isset( \IPS\Request::i()->date ) ) {
try
{
$date = new \IPS\DateTime( \IPS\Request::i()->date );
}
catch( \Exception $e )
{
throw new \IPS\Api\Exception( 'INVALID_DATE', '1F294/E', 400 );
}
/* Do we have a first comment? */
if ( $commentObj = $topic->firstComment() )
{
try
{
$commentClass = $topic::$commentClass;
$field = $commentClass::$databaseColumnMap['date'];
$commentObj->$field = $date->getTimestamp();
$commentObj->save();
}
catch( \Exception $e ) {}
}
}
/* Everything else */
$this->_createOrUpdate( $topic, 'edit' );
/* Save and return */
$topic->save();
return new \IPS\Api\Response( 200, $topic->apiOutput( $this->member ) );