Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -35,15 +35,32 @@ class _PermissionCache extends \IPS\Widget
|
||||
* @param array $configuration Widget custom configuration
|
||||
* @param null|string|array $access Array/JSON string of executable apps (core=sidebar only, content=IP.Content only, etc)
|
||||
* @param null|string $orientation Orientation (top, bottom, right, left)
|
||||
* @param boolean $allowReuse If true, when the block is used, it will remain in the sidebar so it can be used again.
|
||||
* @param string $menuStyle Menu is a drop down menu, modal is a bigger modal panel.
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( $uniqueKey, array $configuration, $access=null, $orientation=null )
|
||||
{
|
||||
parent::__construct( $uniqueKey, $configuration, $access, $orientation );
|
||||
|
||||
if( !$this->cacheKey )
|
||||
{
|
||||
/* We want to use the user's permissions array which will validate social groups, clubs and groups. But, we need to remove the individual member entry */
|
||||
$member = \IPS\Member::loggedIn() ?: new \IPS\Member;
|
||||
$permissions = $member->permissionArray();
|
||||
|
||||
/* For permissions based cache we need to store once per language and permission config */
|
||||
$this->cacheKey = "widget_{$this->key}_" . $this->uniqueKey . '_' . md5( json_encode( $configuration ) . "_" . \IPS\Member::loggedIn()->language()->id . "_" . \IPS\Member::loggedIn()->skin . "_" . json_encode( \IPS\Member::loggedIn()->groups ) . "_" . $orientation );
|
||||
foreach( $permissions as $key => $entry )
|
||||
{
|
||||
if( mb_substr( $entry, 0, 1 ) === 'm' )
|
||||
{
|
||||
unset( $permissions[ $key ] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* We sort to ensure the array is always in the same order */
|
||||
sort( $permissions );
|
||||
|
||||
/* For permissions based cache we need to store once per language and permission config */
|
||||
$this->cacheKey = "widget_{$this->key}_" . $this->uniqueKey . '_' . md5( json_encode( $this->configuration ) . "_" . \IPS\Member::loggedIn()->language()->id . "_" . \IPS\Member::loggedIn()->skin . "_" . json_encode( $permissions ) . "_" . $this->orientation );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,7 @@ abstract class _Widget
|
||||
|
||||
$this->init();
|
||||
|
||||
$this->uniqueKey = ( empty( $uniqueKey ) ) ? ( $this->key ?: uniqid() ) : $uniqueKey;
|
||||
$this->uniqueKey = ( empty( $uniqueKey ) ) ? ( $this->key ?: mt_rand() ) : $uniqueKey;
|
||||
|
||||
if ( !$this->hasConfiguration() )
|
||||
{
|
||||
@@ -202,7 +202,6 @@ abstract class _Widget
|
||||
/**
|
||||
* Get Template Location
|
||||
* Returns the template app/location/group/name params
|
||||
|
||||
* @return array
|
||||
*/
|
||||
public function getTemplateLocation()
|
||||
@@ -228,9 +227,11 @@ abstract class _Widget
|
||||
public function output()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$args['orientation'] = $this->orientation;
|
||||
$args[] = $this->orientation;
|
||||
|
||||
$output = call_user_func_array( $this->template, $args );
|
||||
$template = $this->template;
|
||||
|
||||
$output = $template( ...$args );
|
||||
|
||||
return $output;
|
||||
}
|
||||
@@ -683,10 +684,6 @@ abstract class _Widget
|
||||
}
|
||||
|
||||
$return = array();
|
||||
if ( $app->directory != 'core' and isset( \IPS\Data\Store::i()->widgets['core']['announcements'] ) )
|
||||
{
|
||||
$return[] = \IPS\Data\Store::i()->widgets['core']['announcements'];
|
||||
}
|
||||
if ( isset( \IPS\Data\Store::i()->widgets[ $app->directory ] ) )
|
||||
{
|
||||
foreach ( \IPS\Data\Store::i()->widgets[ $app->directory ] as $widget )
|
||||
|
||||
Reference in new issue
Block a user