Version 4.7.0
This commit is contained in:
1 parent
517a5e1f70
commit
8ba7d43898
1933 files changed
+65613
-11332
No files matched your search
@@ -206,7 +206,12 @@ class _Admin extends \IPS\Dispatcher\Standard
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_module_permission', '2S107/1', 403, '' );
|
||||
}
|
||||
|
||||
|
||||
if( ! \IPS\Application::appIsEnabled( $this->application->directory ) )
|
||||
{
|
||||
\IPS\Output::i()->error( 'requested_route_404', '2S107/5', 404, '' );
|
||||
}
|
||||
|
||||
/* Support is not available for demos */
|
||||
if ( \IPS\DEMO_MODE AND $this->module->application === 'core' AND $this->module->key === 'support' )
|
||||
{
|
||||
@@ -515,7 +520,18 @@ class _Admin extends \IPS\Dispatcher\Standard
|
||||
|
||||
return $this->acpTabOrder;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Display a link in a custom format
|
||||
*
|
||||
* @param string $url The URL from the menu system
|
||||
* @return string|null
|
||||
*/
|
||||
public function acpMenuCustom( $url ): ?string
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Do we have permission to use this module?
|
||||
*
|
||||
@@ -534,13 +550,77 @@ class _Admin extends \IPS\Dispatcher\Standard
|
||||
* @param string $key Permission Key
|
||||
* @param \IPS\Application|null $app Application (NULL will default to current)
|
||||
* @param \IPS\Module|string|null $module Module (NULL will default to current)
|
||||
* @param boolean $return Return boolean (true/false) instead of throwing an error
|
||||
* @return void
|
||||
*/
|
||||
public function checkAcpPermission( $key, $app=NULL, $module=NULL )
|
||||
public function checkAcpPermission( $key, $app=NULL, $module=NULL, $return=FALSE )
|
||||
{
|
||||
if ( !\IPS\Member::loggedIn()->hasAcpRestriction( ( $app ?: $this->application ), ( $module ?: $this->module ), $key ) )
|
||||
{
|
||||
if ( $return )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
\IPS\Output::i()->error( 'no_module_permission', '2S107/2', 403, '' );
|
||||
}
|
||||
|
||||
if ( $return )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show switch link
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
final public static function showSwitchLink(): bool
|
||||
{
|
||||
if ( \IPS\CIC )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Don't show if installation was less than a month ago */
|
||||
if ( time() < \IPS\Settings::i()->board_start + ( 86400 * 30 ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! isset( \IPS\Request::i()->cookie['acpLinkSnooze'] ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
$value = json_decode( \IPS\Request::i()->cookie['acpLinkSnooze'], true );
|
||||
|
||||
if ( $value['hits'] < 3 )
|
||||
{
|
||||
/* Show every 30 days */
|
||||
if ( time() < ( $value['lastClick'] + ( 86400 * 30 ) ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if ( $value['hits'] < 9 )
|
||||
{
|
||||
/* Show every 60 days */
|
||||
if ( time() < ( $value['lastClick'] + ( 86400 * 60 ) ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Show every 90 days */
|
||||
if ( time() < ( $value['lastClick'] + ( 86400 * 90 ) ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user