Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

@@ -2,9 +2,9 @@
/**
* @brief Abstract Front Navigation Extension
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Core
* @since 30 Jun 2015
* @version SVN_VERSION_NUMBER
@@ -24,11 +24,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
abstract class _FrontNavigationAbstract
{
const DEFAULT_LOCATION_ROOT = NULL;
const DEFAULT_LOCATION_BROWSE = 1;
const DEFAULT_LOCATION_ACTIVITY = 2;
const DEFAULT_LOCATION_MORE = 3;
/**
* @brief Store sub item objects for re-use later
*/
protected $subItems = NULL;
/**
* Get sub items of an item
*
@@ -36,27 +36,25 @@ abstract class _FrontNavigationAbstract
*/
public function subItems()
{
$frontNavigation = \IPS\core\FrontNavigation::frontNavigation();
$return = array();
if ( isset( $frontNavigation[ $this->id ] ) )
if ( $this->subItems === NULL )
{
foreach ( $frontNavigation[ $this->id ] as $item )
$this->subItems = array();
$frontNavigation = \IPS\core\FrontNavigation::frontNavigation();
if ( isset( $frontNavigation[ $this->id ] ) )
{
$class = 'IPS\\' . $item['app'] . '\extensions\core\FrontNavigation\\' . $item['extension'];
$return[ $item['id'] ] = new $class( json_decode( $item['config'], TRUE ), $item['id'], $item['permissions'] );
foreach ( $frontNavigation[ $this->id ] as $item )
{
$class = 'IPS\\' . $item['app'] . '\extensions\core\FrontNavigation\\' . $item['extension'];
if ( class_exists( $class ) )
{
$this->subItems[ $item['id'] ] = new $class( json_decode( $item['config'], TRUE ), $item['id'], $item['permissions'] );
}
}
}
}
return $return;
}
/**
* Default Location
*
* @return string
*/
public static function defaultLocation()
{
return static::DEFAULT_LOCATION_BROWSE;
return $this->subItems;
}
/**
@@ -133,19 +131,48 @@ abstract class _FrontNavigationAbstract
}
/**
* Can access?
* Can this item be used at all?
* For example, if this will link to a particular feature which has been diabled, it should
* not be available, even if the user has permission
*
* @return bool
*/
public static function isEnabled()
{
return TRUE;
}
/**
* Can the currently logged in user access the content this item links to?
*
* @return bool
*/
public function canAccessContent()
{
return TRUE;
}
/**
* Can the currently logged in user see this menu item?
*
* @return bool
*/
public function canView()
{
if ( $this->permissions and $this->permissions != '*' )
if ( static::isEnabled() )
{
return \IPS\Member::loggedIn()->inGroup( explode( ',', $this->permissions ) );
if ( $this->permissions === NULL ) // NULL indicates "Show this item to users who can access its content."
{
return $this->canAccessContent();
}
else
{
return $this->permissions == '*' ? TRUE : \IPS\Member::loggedIn()->inGroup( explode( ',', $this->permissions ) );
}
}
return TRUE;
return FALSE;
}
/**
* Get Title
*
@@ -169,7 +196,7 @@ abstract class _FrontNavigationAbstract
{
return '';
}
/**
* Is Active?
*
@@ -177,6 +204,21 @@ abstract class _FrontNavigationAbstract
*/
public function active()
{
return FALSE;
}
/**
* Is this item, or any of it's child items, active?
*
* @return bool
*/
public function activeOrChildActive()
{
if ( $this->active() )
{
return TRUE;
}
foreach ( $this->subItems() as $item )
{
if ( $item->active() )
@@ -191,9 +233,10 @@ abstract class _FrontNavigationAbstract
/**
* Children
*
* @param bool $noStore If true, will skip datastore and get from DB (used for ACP preview)
* @return array
*/
public function children()
public function children( $noStore=FALSE )
{
return NULL;
}