Version 4.5.0

This commit is contained in:
Neo committed 2025-12-19 05:51:58 -08:00
1 parent 1a0c7fd3c2
commit f79dcf067a
3791 files changed
+248032 -76372

No files matched your search

@@ -11,7 +11,7 @@
namespace IPS\core\modules\admin\promotion;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -22,6 +22,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class _promote extends \IPS\Dispatcher\Controller
{
/**
* @brief Has been CSRF-protected
*/
public static $csrfProtected = TRUE;
/**
* @brief Active tab
*/
@@ -50,7 +55,8 @@ class _promote extends \IPS\Dispatcher\Controller
protected function manage()
{
/* Work out output */
$activeTabContents = call_user_func( array( $this, '_manage' . mb_ucfirst( $this->activeTab ) ) );
$methodFunction = '_manage' . mb_ucfirst( $this->activeTab );
$activeTabContents = $this->$methodFunction();
/* If this is an AJAX request, just return it */
if( \IPS\Request::i()->isAjax() )
@@ -269,6 +275,8 @@ class _promote extends \IPS\Dispatcher\Controller
if ( isset( \IPS\Request::i()->clear ) and \IPS\Request::i()->clear === 'true' )
{
\IPS\Session::i()->csrfCheck();
/* We want to clear settings */
$account->enabled = FALSE;
$account->saveSettings( array(
@@ -315,7 +323,7 @@ class _promote extends \IPS\Dispatcher\Controller
/* Are we saving? */
if ( $values = $form->values() )
{
if ( is_array( $values['promote_twitter_tags'] ) )
if ( \is_array( $values['promote_twitter_tags'] ) )
{
array_walk( $values['promote_twitter_tags'], function( &$value )
{
@@ -349,6 +357,28 @@ class _promote extends \IPS\Dispatcher\Controller
$facebook = \IPS\Login\Handler::findMethod('IPS\Login\Handler\Oauth2\Facebook');
$account = \IPS\core\Promote::getPromoter('Facebook')->setMember( \IPS\Member::loggedIn() );
if ( isset( \IPS\Request::i()->clear ) and \IPS\Request::i()->clear === 'true' )
{
\IPS\Session::i()->csrfCheck();
/* We want to clear settings */
$account->enabled = FALSE;
$account->saveSettings( array(
'token' => NULL,
'owner' => NULL,
'page_name' => NULL,
'enabled' => NULL,
'page' => NULL,
'group' => NULL,
'member_token' => NULL,
'shareable' => NULL
) );
\IPS\Settings::i()->changeValues( array( 'promote_facebook_auth' => '' ) );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=promotion&controller=promote&tab=facebook" ) );
}
/* We are using the default app here */
if ( \is_numeric( \IPS\Settings::i()->promote_facebook_auth ) )
{
@@ -426,27 +456,7 @@ class _promote extends \IPS\Dispatcher\Controller
}
$form = new \IPS\Helpers\Form;
if ( isset( \IPS\Request::i()->clear ) and \IPS\Request::i()->clear === 'true' )
{
/* We want to clear settings */
$account->enabled = FALSE;
$account->saveSettings( array(
'token' => NULL,
'owner' => NULL,
'page_name' => NULL,
'enabled' => NULL,
'page' => NULL,
'group' => NULL,
'member_token' => NULL,
'shareable' => NULL
) );
\IPS\Settings::i()->changeValues( array( 'promote_facebook_auth' => '' ) );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=promotion&controller=promote&tab=facebook" ) );
}
/* We're all set, so show the form! */
$pages = $facebook->getPages( \IPS\Member::loggedIn() );
$options = array();
@@ -517,7 +527,7 @@ class _promote extends \IPS\Dispatcher\Controller
/* Are we saving? */
if ( $values = $form->values() )
{
if ( is_array( $values['promote_facebook_tags'] ) )
if ( \is_array( $values['promote_facebook_tags'] ) )
{
array_walk( $values['promote_facebook_tags'], function( &$value )
{
@@ -646,6 +656,8 @@ class _promote extends \IPS\Dispatcher\Controller
*/
protected function reschedule()
{
\IPS\Session::i()->csrfCheck();
\IPS\core\Promote::rescheduleQueue();
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=promotion&controller=promote&tab=schedule" ), 'promote_rescheduled_done' );