Version 5.0.13
This commit is contained in:
1 parent
b89858b2ff
commit
5efe744c5f
1407 files changed
+69690
-30177
No files matched your search
+65
-44
@@ -278,6 +278,11 @@ class Admin extends Standard
|
||||
{
|
||||
foreach ( Db::i()->select( '*', 'core_acp_search_index' ) as $word )
|
||||
{
|
||||
if( !empty( $word['callback'] ) and !eval( $word['callback'] ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->searchKeywords[ $word['url'] ]['lang_key'] = $word['lang_key'];
|
||||
$this->searchKeywords[ $word['url'] ]['restriction'] = $word['restriction'];
|
||||
$this->searchKeywords[ $word['url'] ]['keywords'][] = $word['keyword'];
|
||||
@@ -422,10 +427,11 @@ class Admin extends Standard
|
||||
public function buildMenu(bool $rebuild=FALSE ): ?array
|
||||
{
|
||||
$acpTabOrder = $this->_getAcpTabOrder();
|
||||
$alwaysFirst = [];
|
||||
|
||||
if ( $this->menu === NULL or $rebuild === TRUE )
|
||||
if ( $this->menu === null or $rebuild === true )
|
||||
{
|
||||
$this->menu = array( 'tabs' => array(), 'defaults' => array(), 'badges' );
|
||||
$this->menu = ['tabs' => [], 'defaults' => [], 'badges'];
|
||||
|
||||
foreach ( Application::applications() as $app )
|
||||
{
|
||||
@@ -433,11 +439,15 @@ class Admin extends Standard
|
||||
{
|
||||
$appMenu = $app->acpMenu();
|
||||
|
||||
if ( $acpTabOrder !== NULL and isset( $acpTabOrder[ $app->directory ] ) and $app->directory == 'nexus' )
|
||||
if ( $appItemsFirst = $app->acpMenuItemsAlwayFirst() and count( $appItemsFirst ) )
|
||||
{
|
||||
uksort( $appMenu, function( $a, $b ) use ( $acpTabOrder, $app )
|
||||
{
|
||||
return array_search( "{$app->directory}_{$a}", $acpTabOrder[ $app->directory ] ) - array_search( "{$app->directory}_{$b}", $acpTabOrder[ $app->directory ] );
|
||||
$alwaysFirst = array_merge( $alwaysFirst, $appItemsFirst );
|
||||
}
|
||||
|
||||
if ( $acpTabOrder !== null and isset( $acpTabOrder[$app->directory] ) and $app->directory == 'nexus' )
|
||||
{
|
||||
uksort( $appMenu, function ( $a, $b ) use ( $acpTabOrder, $app ) {
|
||||
return array_search( "{$app->directory}_{$a}", $acpTabOrder[$app->directory] ) - array_search( "{$app->directory}_{$b}", $acpTabOrder[$app->directory] );
|
||||
} );
|
||||
}
|
||||
|
||||
@@ -455,34 +465,34 @@ class Admin extends Standard
|
||||
|
||||
if ( Member::loggedIn()->hasAcpRestriction( $app, $moduleToCheck ) )
|
||||
{
|
||||
if( !$item['restriction'] )
|
||||
if ( !$item['restriction'] )
|
||||
{
|
||||
$canAccess = TRUE;
|
||||
$canAccess = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( mb_strpos( $item['restriction'], ',' ) )
|
||||
if ( mb_strpos( $item['restriction'], ',' ) )
|
||||
{
|
||||
$restrictions = explode( ',', $item['restriction'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$restrictions = array( $item['restriction'] );
|
||||
$restrictions = [$item['restriction']];
|
||||
}
|
||||
|
||||
$canAccess = FALSE;
|
||||
$canAccess = false;
|
||||
|
||||
foreach( $restrictions as $restrictionKey )
|
||||
foreach ( $restrictions as $restrictionKey )
|
||||
{
|
||||
if( Member::loggedIn()->hasAcpRestriction( $app, $moduleToCheck, $restrictionKey ) )
|
||||
if ( Member::loggedIn()->hasAcpRestriction( $app, $moduleToCheck, $restrictionKey ) )
|
||||
{
|
||||
$canAccess = TRUE;
|
||||
$canAccess = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( isset( $item['activemenuitem'] ) and $item['activemenuitem'] )
|
||||
if ( isset( $item['activemenuitem'] ) and $item['activemenuitem'] )
|
||||
{
|
||||
$groupKey = substr( $item['activemenuitem'], 0, strrpos( $item['activemenuitem'], '_' ) );
|
||||
$itemKey = substr( $item['activemenuitem'], strrpos( $item['activemenuitem'], '_' ) + 1 );
|
||||
@@ -494,13 +504,13 @@ class Admin extends Standard
|
||||
|
||||
if ( $canAccess )
|
||||
{
|
||||
$this->menu['tabs'][ $item['tab'] ][ "{$groupKey}" ][ $itemKey ] = "app={$app->directory}&module={$moduleUrl}&controller={$item['controller']}" . ( $item['do'] ? "&do={$item['do']}" : '' );
|
||||
$this->menu['tabs'][$item['tab']]["{$groupKey}"][$itemKey] = "app={$app->directory}&module={$moduleUrl}&controller={$item['controller']}" . ( $item['do'] ? "&do={$item['do']}" : '' );
|
||||
}
|
||||
|
||||
/* Custom badge */
|
||||
if( isset( $item['badge'] ) and $item['badge'] )
|
||||
if ( isset( $item['badge'] ) and $item['badge'] )
|
||||
{
|
||||
$this->menu['badges'][ "{$groupKey}_{$itemKey}" ] = $item['badge'];
|
||||
$this->menu['badges']["{$groupKey}_{$itemKey}"] = $item['badge'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -510,53 +520,51 @@ class Admin extends Standard
|
||||
}
|
||||
|
||||
/* Developer Center */
|
||||
if( \IPS\IN_DEV )
|
||||
if ( \IPS\IN_DEV )
|
||||
{
|
||||
$currentApp = Request::i()->appKey ?? 'core';
|
||||
foreach( $this->menu['tabs']['developer'] as $module => $controllers )
|
||||
foreach ( $this->menu['tabs']['developer'] as $module => $controllers )
|
||||
{
|
||||
foreach( $controllers as $key => $url )
|
||||
foreach ( $controllers as $key => $url )
|
||||
{
|
||||
parse_str( $url, $params );
|
||||
$params['module'] = 'developer';
|
||||
$params['appKey'] = $currentApp;
|
||||
$this->menu['tabs']['developer'][ $module ][ $key ] = http_build_query( $params );
|
||||
$this->menu['tabs']['developer'][$module][$key] = http_build_query( $params );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $acpTabOrder !== NULL )
|
||||
|
||||
if ( $acpTabOrder !== null )
|
||||
{
|
||||
$_apps = array_keys( $acpTabOrder );
|
||||
uksort( $this->menu['tabs'], function($a, $b) use ( $_apps )
|
||||
{
|
||||
if( !in_array( $a, $_apps ) )
|
||||
$_apps = array_keys( $acpTabOrder );
|
||||
uksort( $this->menu['tabs'], function ( $a, $b ) use ( $_apps ) {
|
||||
if ( !in_array( $a, $_apps ) )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( !in_array( $b, $_apps ) )
|
||||
if ( !in_array( $b, $_apps ) )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return array_search( $a, $_apps ) - array_search( $b, $_apps );
|
||||
} );
|
||||
|
||||
foreach( $acpTabOrder as $app => $submenu )
|
||||
|
||||
foreach ( $acpTabOrder as $app => $submenu )
|
||||
{
|
||||
if ( !empty( $submenu ) )
|
||||
{
|
||||
if( isset( $this->menu['tabs'][ $app ] ) )
|
||||
if ( isset( $this->menu['tabs'][$app] ) )
|
||||
{
|
||||
uksort( $this->menu['tabs'][ $app ], function($a, $b) use ( $submenu )
|
||||
{
|
||||
if( !in_array( $a, $submenu ) )
|
||||
uksort( $this->menu['tabs'][$app], function ( $a, $b ) use ( $submenu ) {
|
||||
if ( !in_array( $a, $submenu ) )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( !in_array( $b, $submenu ) )
|
||||
if ( !in_array( $b, $submenu ) )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@@ -564,11 +572,10 @@ class Admin extends Standard
|
||||
return array_search( $a, $submenu ) - array_search( $b, $submenu );
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
if ( isset( $this->menu['defaults'] ) )
|
||||
{
|
||||
uksort( $this->menu['defaults'], function($a, $b) use ( $acpTabOrder )
|
||||
{
|
||||
uksort( $this->menu['defaults'], function ( $a, $b ) use ( $acpTabOrder ) {
|
||||
return array_search( $a, $acpTabOrder );
|
||||
} );
|
||||
}
|
||||
@@ -577,15 +584,29 @@ class Admin extends Standard
|
||||
}
|
||||
|
||||
/* Now set the tab defaults */
|
||||
foreach( $this->menu['tabs'] as $tab => $menu )
|
||||
foreach ( $this->menu['tabs'] as $tab => $menu )
|
||||
{
|
||||
if ( !isset( $this->menu['defaults'][ $tab ] ) )
|
||||
if ( !isset( $this->menu['defaults'][$tab] ) )
|
||||
{
|
||||
foreach( $menu as $group => $submenu )
|
||||
foreach ( $menu as $group => $submenu )
|
||||
{
|
||||
$this->menu['defaults'][ $tab ] = array_values($submenu)[0];
|
||||
$this->menu['defaults'][$tab] = array_values( $submenu )[0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Set any items to be first */
|
||||
foreach ( $alwaysFirst as $entry )
|
||||
{
|
||||
foreach ( $entry as $key => $menuItem )
|
||||
{
|
||||
if ( isset( $this->menu['tabs'][$key] ) and isset( $this->menu['tabs'][$key][$menuItem] ) )
|
||||
{
|
||||
$first = $this->menu['tabs'][$key][$menuItem];
|
||||
unset( $this->menu['tabs'][$key][$menuItem] );
|
||||
$this->menu['tabs'][$key] = array_merge( [$menuItem => $first], $this->menu['tabs'][$key] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ abstract class Controller
|
||||
*/
|
||||
public function execute() : void
|
||||
{
|
||||
if ( !empty( static::$dataLayerContext ) AND Settings::i()->core_datalayer_enabled AND !Request::i()->isAjax() )
|
||||
if ( !empty( static::$dataLayerContext ) AND DataLayer::enabled() AND !Request::i()->isAjax() )
|
||||
{
|
||||
foreach ( static::$dataLayerContext as $property => $data )
|
||||
{
|
||||
|
||||
+13
-32
@@ -19,6 +19,7 @@ use InvalidArgumentException;
|
||||
use IPS\Application;
|
||||
use IPS\Content\Search\SearchContent;
|
||||
use IPS\core\Alerts\Alert;
|
||||
use IPS\core\DataLayer;
|
||||
use IPS\core\IndexNow;
|
||||
use IPS\core\Rss;
|
||||
use IPS\Data\Cache;
|
||||
@@ -27,6 +28,7 @@ use IPS\Data\Store;
|
||||
use IPS\DateTime;
|
||||
use IPS\Db;
|
||||
use IPS\Developer;
|
||||
use IPS\Dispatcher;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Http\Url\Friendly;
|
||||
use IPS\Http\Url\Internal;
|
||||
@@ -513,7 +515,7 @@ class Front extends Standard
|
||||
{
|
||||
foreach( Application::applications() as $directory => $application )
|
||||
{
|
||||
if ( $application->_enabled )
|
||||
if ( $application->enabled )
|
||||
{
|
||||
if( method_exists( $application, 'convertLegacyParameters' ) )
|
||||
{
|
||||
@@ -561,32 +563,6 @@ class Front extends Standard
|
||||
}
|
||||
}
|
||||
catch ( UnderflowException $e ) {}
|
||||
|
||||
if ( Output::i()->allowDefaultWidgets )
|
||||
{
|
||||
$defaultAreas = [];
|
||||
foreach ( Widget::appDefaults( $this->application ) as $widget )
|
||||
{
|
||||
$areaKey = $widget['default_area'];
|
||||
|
||||
/* If another app has already defined this area or the area has been filled by the page builder, don't overwrite it */
|
||||
if ( isset( $widgets[ $areaKey ] ) and !isset( $defaultAreas[ $areaKey ] ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$widget['unique'] = $widget['key'];
|
||||
if ( !isset( $widgets[ $areaKey ] ) )
|
||||
{
|
||||
$defaultAreas[ $areaKey ] = 1;
|
||||
$widgets[ $areaKey ] = Area::create( $widget['default_area'], [ $widget ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$widgets[ $areaKey ]->addWidget( $widget );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( count( $widgets ) )
|
||||
{
|
||||
@@ -682,11 +658,14 @@ class Front extends Standard
|
||||
/* Meta tags */
|
||||
Output::i()->buildMetaTags();
|
||||
|
||||
/* Data Attributes */
|
||||
Output::i()->setBodyAttributes();
|
||||
|
||||
/* Check MFA */
|
||||
$this->checkMfa();
|
||||
|
||||
/* Check Alerts */
|
||||
$this->checkAlerts();
|
||||
static::checkAlerts( $this );
|
||||
|
||||
/* Loader Extension */
|
||||
foreach( Application::allExtensions( 'core', 'Loader' ) as $loader )
|
||||
@@ -888,7 +867,7 @@ FILE;
|
||||
if ( !Request::i()->isAjax() )
|
||||
{
|
||||
Output::i()->globalControllers[] = 'core.front.core.app';
|
||||
if ( Settings::i()->core_datalayer_enabled )
|
||||
if ( DataLayer::enabled() )
|
||||
{
|
||||
Output::i()->globalControllers[] = 'core.front.core.dataLayer';
|
||||
}
|
||||
@@ -965,11 +944,13 @@ FILE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check and process alerts for the logged-in member.
|
||||
*
|
||||
*
|
||||
* @param Dispatcher $dispatcher The dispatcher instance controlling the current request.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function checkAlerts() : void
|
||||
public static function checkAlerts( Dispatcher $dispatcher ) : void
|
||||
{
|
||||
/* Don't get in the way of validating members */
|
||||
if ( Member::loggedIn()->members_bitoptions['validating'] )
|
||||
@@ -985,7 +966,7 @@ FILE;
|
||||
|
||||
/* Don't get in the way of the ModCP, registering, logging in, etc */
|
||||
$ignoreControllers = [ 'modcp', 'register', 'login', 'redirect', 'cookies', 'lostpass' ];
|
||||
if( !Request::i()->isAjax() and !in_array( $this->controller, $ignoreControllers ) AND $alert = Alert::getNextAlertForMember( Member::loggedIn() ) )
|
||||
if( !Request::i()->isAjax() and !in_array( $dispatcher->controller, $ignoreControllers ) AND $alert = Alert::getNextAlertForMember( Member::loggedIn() ) )
|
||||
{
|
||||
$alert->viewed( Member::loggedIn() );
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ abstract class Standard extends Dispatcher
|
||||
catch ( OutOfRangeException $e )
|
||||
{
|
||||
$applications = Application::applications();
|
||||
|
||||
|
||||
foreach( $applications as $application )
|
||||
{
|
||||
if( $application->default )
|
||||
@@ -191,7 +191,7 @@ abstract class Standard extends Dispatcher
|
||||
$this->application = $application;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( !isset( $this->application ) )
|
||||
{
|
||||
$this->application = array_shift( $applications );
|
||||
@@ -203,7 +203,7 @@ abstract class Standard extends Dispatcher
|
||||
else
|
||||
{
|
||||
$applications = Application::applications();
|
||||
|
||||
|
||||
foreach( $applications as $application )
|
||||
{
|
||||
if( $application->default )
|
||||
@@ -211,7 +211,7 @@ abstract class Standard extends Dispatcher
|
||||
$this->application = $application;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( !isset( $this->application ) )
|
||||
{
|
||||
$this->application = array_shift( $applications );
|
||||
|
||||
Reference in new issue
Block a user