twitterbridge API compatibility

This commit is contained in:
ArthurHoaro 2013-03-20 15:53:16 +01:00
parent efad8ab1c6
commit d1b3d153f9
2 changed files with 18 additions and 10 deletions

View file

@ -686,7 +686,7 @@ if($site_type == 'generic') // custom CSS for generic
.article { background-color:white;padding: 12px 10px 12px 10px;border:1px solid #aaa;max-width:70em;margin:1em auto;box-shadow:0px 5px 7px #aaa; }
.footer { text-align:center; font-size: small; color:#333; clear: both; }';
}
else if($site_type == 'microblog') // custom CSS for microblog
else if($site_type == 'microblog' || $site_type == 'twitter' || $site_type == 'identica') // custom CSS for microblog
{
$css = $css.'.header h1 a { color: #333;font-size:40pt;text-shadow: #ccc 0px 5px 5px; }
.article .title h2 { width: 10em;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;font-size: 0.7em;margin: 0; color:#333; text-shadow: 1px 1px 1px #fff; }

View file

@ -483,10 +483,13 @@ if(!empty($_POST['socialaccount']) && !empty($_POST['socialinstance']) && ALLOW_
$socialinstance = strtolower(escape($_POST['socialinstance']));
if($socialinstance === 'twitter') {
/*$sitetype = 'twitter';
$siteurl = "http://twitter.com/$socialaccount";
$rssurl = $apitwitter.$socialaccount; */
$error[] = "Twitter veut mettre à mort son API ouverte. Du coup on peut plus faire ça comme ça.";
if( $apitwitter !== FALSE ) {
$sitetype = 'twitter';
$siteurl = "http://twitter.com/$socialaccount";
$rssurl = $apitwitter.$socialaccount;
}
else
$error[] = "Twitter veut mettre à mort son API ouverte. Du coup on peut plus faire ça comme ça.";
}
elseif($socialinstance === 'identica') {
$sitetype = 'identica';
@ -508,9 +511,12 @@ if(!empty($_POST['socialaccount']) && !empty($_POST['socialinstance']) && ALLOW_
}
if( !isset($rssurl['error']) && !isset($siteurl['error']) ) {
$headers = get_headers($rssurl, 1);
if (strpos($headers[0], '200') == FALSE) {
$error[] = "Flux inaccessible (compte inexistant ?)";
// Twitterbridge do NOT allow this user yet => No check
if( $sitetype != 'twitter' ) {
$headers = get_headers($rssurl, 1);
if (strpos($headers[0], '200') == FALSE) {
$error[] = "Flux inaccessible (compte inexistant ?)";
}
}
if( empty($error) ) {
$error = array_merge( $error, createAutoblog($sitetype, ucfirst($socialinstance) .' - '. $socialaccount, $siteurl, $rssurl, $error));
@ -745,8 +751,10 @@ if( !empty($_POST['opml_file']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY
<form method="POST">
<input placeholder="Identifiant du compte" type="text" name="socialaccount" id="socialaccount"><br>
<?php /*<input type="radio" name="socialinstance" value="twitter">Twitter<br>*/ ?>
<s>Twitter</s><br>
<?php
if( $apitwitter !== FALSE )
echo '<input type="radio" name="socialinstance" value="twitter">Twitter<br>';
else echo '<s>Twitter</s><br>'; ?>
<input type="radio" name="socialinstance" value="identica">Identica<br>
<input type="radio" name="socialinstance" value="statusnet">
<input placeholder="statusnet.personnel.com" type="text" name="statusneturl" id="statusneturl"><br>