Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -11,40 +11,52 @@
|
||||
namespace IPS\core\modules\admin\activitystats;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\core\Statistics\Chart;
|
||||
use IPS\Dispatcher;
|
||||
use IPS\Dispatcher\Controller;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
use IPS\Output;
|
||||
use IPS\Request;
|
||||
use IPS\Settings;
|
||||
use IPS\Theme;
|
||||
use function defined;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Email statistics
|
||||
*/
|
||||
class _emailstats extends \IPS\Dispatcher\Controller
|
||||
class emailstats extends Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
public static bool $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* @brief Allow MySQL RW separation for efficiency
|
||||
*/
|
||||
public static $allowRWSeparation = TRUE;
|
||||
public static bool $allowRWSeparation = TRUE;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
public function execute() : void
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'emailstats_manage' );
|
||||
Dispatcher::i()->checkAcpPermission( 'emailstats_manage' );
|
||||
|
||||
/* We can only view the stats if we have logging enabled */
|
||||
if( \IPS\Settings::i()->prune_log_emailstats == 0 )
|
||||
if( Settings::i()->prune_log_emailstats == 0 )
|
||||
{
|
||||
\IPS\Output::i()->error( 'emaillogs_not_enabled', '1C395/1', 403, '' );
|
||||
Output::i()->error( 'emaillogs_not_enabled', '1C395/1', 403, '' );
|
||||
}
|
||||
|
||||
parent::execute();
|
||||
@@ -55,20 +67,18 @@ class _emailstats extends \IPS\Dispatcher\Controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
protected function manage() : void
|
||||
{
|
||||
$activeTab = $this->_getActiveTab();
|
||||
|
||||
$chart = \IPS\core\Statistics\Chart::loadFromExtension( 'core', ( $activeTab === 'emails' ) ? 'Emails' : 'EmailClicks' )->getChart( \IPS\Http\Url::internal( "app=core&module=activitystats&controller=emailstats&tab={$activeTab}" ) );
|
||||
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
$chart = Chart::loadFromExtension( 'core', ( $activeTab === 'emails' ) ? 'Emails' : 'EmailClicks' )->getChart( Url::internal( "app=core&module=activitystats&controller=emailstats&tab={$activeTab}" ) );
|
||||
if ( Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->output = (string) $chart;
|
||||
Output::i()->output = (string) $chart;
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_activitystats_emailstats');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core' )->tabs( $this->_getAvailableTabs(), $activeTab, (string) $chart, \IPS\Http\Url::internal( "app=core&module=activitystats&controller=emailstats" ), 'tab', '', 'ipsPad' );
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack('menu__core_activitystats_emailstats');
|
||||
Output::i()->output = Theme::i()->getTemplate( 'global', 'core' )->tabs( $this->_getAvailableTabs(), $activeTab, (string) $chart, Url::internal( "app=core&module=activitystats&controller=emailstats" ), 'tab', '', 'i-padding_3' );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,10 +87,10 @@ class _emailstats extends \IPS\Dispatcher\Controller
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _getActiveTab()
|
||||
protected function _getActiveTab() : string
|
||||
{
|
||||
\IPS\Request::i()->tab ??= 'emails';
|
||||
return ( array_key_exists( \IPS\Request::i()->tab, $this->_getAvailableTabs() ) ) ? \IPS\Request::i()->tab : 'emails';
|
||||
Request::i()->tab ??= 'emails';
|
||||
return ( array_key_exists( Request::i()->tab, $this->_getAvailableTabs() ) ) ? Request::i()->tab : 'emails';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,7 +98,7 @@ class _emailstats extends \IPS\Dispatcher\Controller
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function _getAvailableTabs()
|
||||
protected function _getAvailableTabs() : array
|
||||
{
|
||||
return array(
|
||||
'emails' => 'stats_emailstats_emails',
|
||||
|
||||
Reference in new issue
Block a user