Version 5.0.0 beta 1

This commit is contained in:
Neo committed 2025-12-19 16:27:35 -08:00
1 parent 25ddeb65d6
commit 15c7beabc5
6736 files changed
+627902 -497943

No files matched your search

@@ -11,43 +11,57 @@
namespace IPS\core\modules\admin\promotion;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use IPS\Content\ShareServices;
use IPS\core\ShareLinks\Service;
use IPS\Db;
use IPS\Dispatcher;
use IPS\Http\Url;
use IPS\Node\Controller;
use IPS\Node\Model;
use IPS\Output;
use IPS\Request;
use OutOfRangeException;
use function defined;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* Share Link Services
*/
class _sharelinks extends \IPS\Node\Controller
class sharelinks extends Controller
{
/**
* @brief Has been CSRF-protected
*/
public static $csrfProtected = TRUE;
public static bool $csrfProtected = TRUE;
/**
* Node Class
*/
protected $nodeClass = '\IPS\core\ShareLinks\Service';
protected string $nodeClass = '\IPS\core\ShareLinks\Service';
/**
* Execute
*
* @return void
*/
public function execute()
public function execute() : void
{
\IPS\Dispatcher::i()->checkAcpPermission( 'sharelinks_manage' );
Dispatcher::i()->checkAcpPermission( 'sharelinks_manage' );
$reloadRoots = FALSE;
/* First, see if any are missing */
$nodeClass = $this->nodeClass;
$shareServices = \IPS\Content\ShareServices::services();
$shareServices = ShareServices::services();
/* @var Model $nodeClass */
foreach( $nodeClass::roots() as $node )
{
if( !isset( $shareServices[ ucwords( $node->key ) ] ) )
@@ -58,16 +72,16 @@ class _sharelinks extends \IPS\Node\Controller
}
/* Now see if there are any new classes */
foreach( \IPS\Content\ShareServices::services() as $id => $className )
foreach( ShareServices::services() as $id => $className )
{
try
{
$nodeClass::load( mb_strtolower( $id ), 'share_key' );
}
catch( \OutOfRangeException $e )
catch( OutOfRangeException $e )
{
/* Class does not exist - let's add it */
$newService = new \IPS\core\ShareLinks\Service;
$newService = new Service;
$newService->key = mb_strtolower( $id );
$newService->groups = '*';
$newService->title = $id;
@@ -83,7 +97,7 @@ class _sharelinks extends \IPS\Node\Controller
$nodeClass::resetRootResult();
}
return parent::execute();
parent::execute();
}
/**
@@ -91,7 +105,7 @@ class _sharelinks extends \IPS\Node\Controller
*
* @return array
*/
public function _getRootButtons()
public function _getRootButtons(): array
{
return array();
}
@@ -101,16 +115,13 @@ class _sharelinks extends \IPS\Node\Controller
*
* @return void
*/
public function delete()
public function delete() : void
{
/* Make sure the user confirmed the deletion */
\IPS\Request::i()->confirmedDelete();
Request::i()->confirmedDelete();
\IPS\Db::i()->delete( 'core_share_links', array( 'share_id=?', (int) \IPS\Request::i()->id ) );
Db::i()->delete( 'core_share_links', array( 'share_id=?', (int) Request::i()->id ) );
/* Clear guest page caches */
\IPS\Data\Cache::i()->clearAll();
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=promotion&controller=sharelinks' ), 'saved' );
Output::i()->redirect( Url::internal( 'app=core&module=promotion&controller=sharelinks' ), 'saved' );
}
}