From 66b432b1242cb40a7455833effad9bc1a7bd8142 Mon Sep 17 00:00:00 2001 From: Mitsukarenai Date: Fri, 10 May 2013 13:17:27 +0200 Subject: [PATCH] =?UTF-8?q?support=20twitterbridge;=20lisez-moi=20!=20-=20?= =?UTF-8?q?contr=C3=B4le=20twitterbridge=20distante=20avec=20header=20d'er?= =?UTF-8?q?reur=20-=20ajout=20lien=20vers=20status=20de=20la=20twitterbrid?= =?UTF-8?q?ge=20NB:=20Autoblog=20ne=20devrait=20PAS=20manipuler=20la=20twi?= =?UTF-8?q?tterbridge:=20seul=20l'admin=20de=20la=20twitterbridge=20doit?= =?UTF-8?q?=20avoir=20le=20contr=C3=B4le=20sur=20sa=20whitelist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.php.example | 1 + index.php | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/config.php.example b/config.php.example index 84d6fa9..1493324 100644 --- a/config.php.example +++ b/config.php.example @@ -29,6 +29,7 @@ /** * More about TwitterBridge : https://github.com/mitsukarenai/twitterbridge + * replace FALSE with the twitterbridge request URL (example: 'http://www.suumitsu.eu/twitter/?u=' ) **/ // define( 'API_TWITTER', FALSE ); diff --git a/index.php b/index.php index 03b1bc4..ae4a066 100755 --- a/index.php +++ b/index.php @@ -519,6 +519,9 @@ if( !empty($_POST['socialinstance']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLO $sitetype = 'twitter'; $siteurl = 'http://twitter.com/'. $socialaccount; $rssurl = API_TWITTER.$socialaccount; + // check + $twitterbridge = get_headers($rssurl, 1); + if ($twitterbridge['0'] == 'HTTP/1.1 403 Forbidden') { $error[] = "La twitterbridge a refusé ce nom d'utilisateur:
\n
".htmlentities($twitterbridge['X-twitterbridge']).'
'; } } else $error[] = 'Vous devez définir une API Twitter -> RSS dans votre fichier de configuration (see TwitterBridge).'; @@ -555,14 +558,9 @@ if( !empty($_POST['socialinstance']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLO if( empty($error) ) { try { - // TwitterBridge user will be allowed after Autoblog creation - // TODO: Twitter user does not exist ? - // TODO: get remote like http://wwz.suumitsu.eu/twitter/whitelist.json, decode, check if is in array, return error or continue - if($sitetype != 'twitter') { $headers = get_headers($rssurl, 1); if (strpos($headers[0], '200') === FALSE) throw new Exception('Flux inaccessible (compte inexistant ?)'); - } createAutoblog($sitetype, ucfirst($socialinstance) .' - '. $socialaccount, $siteurl, $rssurl); $success[] = ' @@ -788,7 +786,7 @@ if( !empty($_POST['opml_file']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY
Twitter
'; + echo 'Twitter (via twitterbridge)
'; else echo 'Twitter
'; ?> Identica