Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -386,8 +386,8 @@ class _advertisements extends \IPS\Dispatcher\Controller
|
||||
$locations,
|
||||
TRUE,
|
||||
array(
|
||||
'options' => array_combine( array_keys( $defaultLocations ), array_keys( $defaultLocations ) ),
|
||||
'toggles' => $defaultLocations,
|
||||
'options' => array_combine( array_keys( $defaultLocations ), array_keys( $defaultLocations ) ),
|
||||
'toggles' => $defaultLocations,
|
||||
),
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -463,15 +463,26 @@ class _advertisements extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$images = array( 'large' => (string) $values['ad_image'] );
|
||||
|
||||
if( isset( $values['ad_image_small'] ) AND $values['ad_image_small'] )
|
||||
if( $values['ad_image_more'] and isset( $values['ad_image_small'] ) AND $values['ad_image_small'] )
|
||||
{
|
||||
$images['small'] = (string) $values['ad_image_small'];
|
||||
}
|
||||
|
||||
if( isset( $values['ad_image_medium'] ) AND $values['ad_image_medium'] )
|
||||
if( $values['ad_image_more'] and isset( $values['ad_image_medium'] ) AND $values['ad_image_medium'] )
|
||||
{
|
||||
$images['medium'] = (string) $values['ad_image_medium'];
|
||||
}
|
||||
|
||||
/* If there are images, but we disabled additional images, remove them */
|
||||
if( !$values['ad_image_more'] and isset( $values['ad_image_small'] ) AND $values['ad_image_small'] )
|
||||
{
|
||||
$values['ad_image_small']->delete();
|
||||
}
|
||||
|
||||
if( !$values['ad_image_more'] and isset( $values['ad_image_medium'] ) AND $values['ad_image_medium'] )
|
||||
{
|
||||
$values['ad_image_medium']->delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -349,18 +349,72 @@ 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() );
|
||||
|
||||
/* Have we set up Facebook yet? */
|
||||
if ( !$facebook OR ! $facebook->settings['client_id'] )
|
||||
/* We are using the default app here */
|
||||
if ( \is_numeric( \IPS\Settings::i()->promote_facebook_auth ) )
|
||||
{
|
||||
/* Nope, so lets do that first... */
|
||||
return \IPS\Theme::i()->getTemplate( 'promote' )->warningNoFacebookApp();
|
||||
/* Have we set up Facebook yet? */
|
||||
if ( !$facebook OR ! $facebook->settings['client_id'] )
|
||||
{
|
||||
/* Nope, so lets do that first... */
|
||||
return \IPS\Theme::i()->getTemplate( 'promote' )->warningNoFacebookApp();
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* We are using our custom app here */
|
||||
$facebook->settings = json_decode( \IPS\Settings::i()->promote_facebook_auth, TRUE );
|
||||
}
|
||||
|
||||
/* promote_facebook_auth: value 0 means not set up, value 1 means using default, JSON means using custom */
|
||||
if ( ! \IPS\Settings::i()->promote_facebook_auth )
|
||||
{
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$json = array();
|
||||
|
||||
if ( ! \is_int( \IPS\Settings::i()->promote_facebook_auth ) )
|
||||
{
|
||||
$json = json_decode( \IPS\Settings::i()->promote_facebook_auth, TRUE );
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'promote_facebook_auth_choose', ( \IPS\Settings::i()->promote_facebook_auth === 0 or \IPS\Settings::i()->promote_facebook_auth === 1 ) ? 1 : 0, FALSE, array( 'options' => array(
|
||||
0 => 'promote_facebook_auth_choose_default',
|
||||
1 => 'promote_facebook_auth_choose_custom'
|
||||
),
|
||||
'toggles' => array(
|
||||
1 => array( 'promote_facebook_auth_id', 'promote_facebook_auth_secret' )
|
||||
) ), NULL, NULL, NULL, 'promote_facebook_auth_choose' ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'promote_facebook_auth_id', ( isset( $json['client_id'] ) ? $json['client_id'] : NULL ), TRUE, array(), NULL, NULL, NULL, 'promote_facebook_auth_id' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'promote_facebook_auth_secret', ( isset( $json['client_secret'] ) ? $json['client_secret'] : NULL ), TRUE, array(), NULL, NULL, NULL, 'promote_facebook_auth_secret' ) );
|
||||
|
||||
\IPS\Member::loggedIn()->language()->words['promote_facebook_auth_id_desc'] = \IPS\Member::loggedIn()->language()->addToStack( 'login_handler_Facebook_info', FALSE, array( 'sprintf' => array( (string) \IPS\Http\Url::internal( 'oauth/callback/', 'none' ) ) ) );
|
||||
|
||||
/* Are we saving? */
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
/* Default to .. default */
|
||||
$auth = 1;
|
||||
|
||||
if ( $values['promote_facebook_auth_choose'] == 1 )
|
||||
{
|
||||
$auth = array(
|
||||
'client_id' => $values['promote_facebook_auth_id'],
|
||||
'client_secret' => $values['promote_facebook_auth_secret']
|
||||
);
|
||||
}
|
||||
|
||||
\IPS\Settings::i()->changeValues( array( 'promote_facebook_auth' => json_encode( $auth ) ) );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=promotion&controller=promote&tab=" . \IPS\Request::i()->tab ), 'saved' );
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/* Have we synchronized our user account with Facebook? */
|
||||
if ( ! $facebook->canProcess( \IPS\Member::loggedIn() ) )
|
||||
if ( ! $account->isConnected( \IPS\Member::loggedIn() ) )
|
||||
{
|
||||
/* Nope, so lets do that now... */
|
||||
return \IPS\Theme::i()->getTemplate( 'promote' )->warningNoFacebookUser( $facebook );
|
||||
return \IPS\Theme::i()->getTemplate( 'promote' )->warningNoFacebookUser( $facebook, \is_numeric( \IPS\Settings::i()->promote_facebook_auth ) );
|
||||
}
|
||||
|
||||
/* Do we have post to page permissions? */
|
||||
@@ -383,9 +437,13 @@ class _promote extends \IPS\Dispatcher\Controller
|
||||
'page_name' => NULL,
|
||||
'enabled' => NULL,
|
||||
'page' => NULL,
|
||||
'group' => 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" ) );
|
||||
}
|
||||
|
||||
@@ -559,7 +617,7 @@ class _promote extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$promote = \IPS\core\Promote::load( $val );
|
||||
|
||||
return $promote->objectTitle . ' (' . $val . ')';
|
||||
return htmlspecialchars( $promote->objectTitle, ENT_QUOTES | ENT_DISALLOWED, 'UTF-8', FALSE ) . ' (' . $val . ')';
|
||||
|
||||
}
|
||||
catch ( \Exception $e ) { }
|
||||
|
||||
@@ -214,7 +214,6 @@ class _seo extends \IPS\Dispatcher\Controller
|
||||
if( !$form->error )
|
||||
{
|
||||
$values['sitemap_url'] = (string) $values['sitemap_url'];
|
||||
$form->saveAsSettings( $values );
|
||||
|
||||
foreach( \IPS\Application::allExtensions( 'core', 'Sitemap', FALSE, 'core' ) as $extKey => $extension )
|
||||
{
|
||||
@@ -224,6 +223,8 @@ class _seo extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
|
||||
$form->saveAsSettings( array( 'sitemap_url' => $values['sitemap_url'] ) );
|
||||
|
||||
/* Clear guest page caches */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
|
||||
Reference in new issue
Block a user