Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -11,7 +11,7 @@
|
||||
namespace IPS\core\modules\admin\promotion;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -21,7 +21,12 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
* Share Link Services
|
||||
*/
|
||||
class _sharelinks extends \IPS\Node\Controller
|
||||
{
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Node Class
|
||||
*/
|
||||
@@ -41,9 +46,11 @@ class _sharelinks extends \IPS\Node\Controller
|
||||
/* First, see if any are missing */
|
||||
$nodeClass = $this->nodeClass;
|
||||
|
||||
$shareServices = \IPS\Content\ShareServices::services();
|
||||
|
||||
foreach( $nodeClass::roots() as $node )
|
||||
{
|
||||
if( !file_exists( \IPS\ROOT_PATH . '/system/Content/ShareServices/' . ucwords( $node->key ) . '.php' ) )
|
||||
if( !isset( $shareServices[ ucwords( $node->key ) ] ) )
|
||||
{
|
||||
$node->delete();
|
||||
$reloadRoots = TRUE;
|
||||
@@ -51,26 +58,19 @@ class _sharelinks extends \IPS\Node\Controller
|
||||
}
|
||||
|
||||
/* Now see if there are any new classes */
|
||||
foreach( new \DirectoryIterator( \IPS\ROOT_PATH . '/system/Content/ShareServices/' ) as $file )
|
||||
foreach( \IPS\Content\ShareServices::services() as $id => $className )
|
||||
{
|
||||
if( $file->isDir() OR $file->isDot() OR $file->getExtension() !== 'php' )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$className = str_replace( '.php', '', $file->getFilename() );
|
||||
|
||||
try
|
||||
{
|
||||
$nodeClass::load( mb_strtolower( $className ), 'share_key' );
|
||||
$nodeClass::load( mb_strtolower( $id ), 'share_key' );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
/* Class does not exist - let's add it */
|
||||
$newService = new \IPS\core\ShareLinks\Service;
|
||||
$newService->key = mb_strtolower( $className );
|
||||
$newService->key = mb_strtolower( $id );
|
||||
$newService->groups = '*';
|
||||
$newService->title = $className;
|
||||
$newService->title = $id;
|
||||
$newService->enabled = 0;
|
||||
$newService->save();
|
||||
|
||||
|
||||
Reference in new issue
Block a user