Version 4.7.13
This commit is contained in:
1 parent
fd22d99e69
commit
7124a02564
954 files changed
+29277
-59308
No files matched your search
@@ -550,4 +550,46 @@ class _Twitter extends \IPS\Login\Handler\OAuth1
|
||||
|
||||
return $this->_sendRequest( 'post', \IPS\Http\Url::external('https://upload.twitter.com/1.1/media/upload.json'), array(), $accessToken, $accessTokenSecret, array(), array( $mimeBoundary, $data ) )->decodeJson();
|
||||
}
|
||||
|
||||
/**
|
||||
* [Node] Set whether this node is enabled
|
||||
*
|
||||
* @param bool|int $enabled Whether to set it enabled or disabled
|
||||
* @return void
|
||||
*/
|
||||
protected function set__enabled( $enabled )
|
||||
{
|
||||
parent::set__enabled( $enabled );
|
||||
$this->_checkSocialPromotes();
|
||||
}
|
||||
|
||||
/**
|
||||
* [ActiveRecord] Delete Record
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
parent::delete();
|
||||
$this->_checkSocialPromotes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable social promotes Twitter method if all Twitter login handlers are disabled
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _checkSocialPromotes()
|
||||
{
|
||||
try
|
||||
{
|
||||
\IPS\Db::i()->select( '*', 'core_login_methods', array( 'login_classname=? AND login_id!=?', 'IPS\Login\Handler\OAuth1\Twitter', $this->_id ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
$promoter = \IPS\core\Promote::getPromoter('Twitter');
|
||||
$promoter->enabled = FALSE;
|
||||
$promoter->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user