Version 4.6.0
This commit is contained in:
1 parent
f79dcf067a
commit
517a5e1f70
2036 files changed
+110041
-26162
No files matched your search
@@ -0,0 +1,43 @@
|
||||
//<?php
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
class cms_hook_apiForum extends _HOOK_CLASS_
|
||||
{
|
||||
/**
|
||||
* Delete
|
||||
*
|
||||
* @param int $id ID Number
|
||||
* @param int|NULL $deleteChildrenOrMove -1 to delete all child nodes, or the new parent node ID to move the children to
|
||||
* @throws 2F363/7 The node ID does not exist
|
||||
* @throws 2F363/6 The target node cannot be deleted because it is in use by a CMS Database
|
||||
* @return \IPS\Api\Response
|
||||
*/
|
||||
public function _delete( $id, $deleteChildrenOrMove = NULL )
|
||||
{
|
||||
$nodeClass = $this->class;
|
||||
|
||||
try
|
||||
{
|
||||
$node = $nodeClass::load( $id );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Api\Exception( 'INVALID_ID', '2F363/7', 404 );
|
||||
}
|
||||
|
||||
/* isUsedByCms in cms/hooks/Forum.php */
|
||||
if ( $db = $node->isUsedByCms() )
|
||||
{
|
||||
throw new \IPS\Api\Exception( 'FORUM_USED_BY_DATABASE', '2F363/6', 403 );
|
||||
}
|
||||
else
|
||||
{
|
||||
return parent::_delete( $id, $deleteChildrenOrMove );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user