Add twitter allowed users JSON export

This commit is contained in:
ArthurHoaro 2013-03-14 18:25:10 +01:00
parent a7075c82f3
commit 79e8734c19
2 changed files with 28 additions and 4 deletions

View file

@ -130,10 +130,10 @@ function getTimeout( $type ) {
function updateType($siteurl) { function updateType($siteurl) {
if( strpos($siteurl, 'twitter.com') !== FALSE ) { if( strpos($siteurl, 'twitter.com') !== FALSE ) {
return array('type' => 'microblog', 'name' => 'twitter'); return array('type' => 'twitter', 'name' => 'twitter');
} }
elseif ( strpos( $siteurl, 'identi.ca') !== FALSE ) { elseif ( strpos( $siteurl, 'identi.ca') !== FALSE ) {
return array('type' => 'microblog', 'name' => 'identica'); return array('type' => 'identica', 'name' => 'identica');
} }
elseif( strpos( $siteurl, 'shaarli' ) !== FALSE ) { elseif( strpos( $siteurl, 'shaarli' ) !== FALSE ) {
return array('type' => 'shaarli', 'name' => 'shaarli'); return array('type' => 'shaarli', 'name' => 'shaarli');

View file

@ -278,6 +278,30 @@ if (isset($_GET['export'])) {
die; die;
} }
/**
* JSON Allowed Twitter accounts export
**/
if (isset($_GET['export_twitter'])) {
header('Content-Type: application/json');
$directory = "./";
$subdirs = glob($directory . "*");
$response = array();
foreach($subdirs as $unit) {
if(is_dir($unit)) {
$unit=substr($unit, 2);
$ini = parse_ini_file($unit.'/vvb.ini');
if( $ini['SITE_TYPE'] == 'twitter' ) {
preg_match('#twitter\.com/(.+)#', $ini['SITE_URL'], $username);
$response[] = $username[1];
}
unset($ini);
}
}
echo json_encode( $response );
die;
}
/** /**
* OPML Full Export * OPML Full Export
**/ **/
@ -460,12 +484,12 @@ if(!empty($_POST['socialaccount']) && !empty($_POST['socialinstance']) && ALLOW_
$socialinstance = strtolower(escape($_POST['socialinstance'])); $socialinstance = strtolower(escape($_POST['socialinstance']));
if($socialinstance === 'twitter') { if($socialinstance === 'twitter') {
$sitetype = 'microblog'; $sitetype = 'twitter';
$siteurl = "http://twitter.com/$socialaccount"; $siteurl = "http://twitter.com/$socialaccount";
$rssurl = $apitwitter.$socialaccount; $rssurl = $apitwitter.$socialaccount;
} }
elseif($socialinstance === 'identica') { elseif($socialinstance === 'identica') {
$sitetype = 'microblog'; $sitetype = 'identica';
$siteurl = "http://identi.ca/$socialaccount"; $siteurl = "http://identi.ca/$socialaccount";
$rssurl = "http://identi.ca/api/statuses/user_timeline/$socialaccount.rss"; $rssurl = "http://identi.ca/api/statuses/user_timeline/$socialaccount.rss";
} }