From 79e8734c1987a3bcb0f633954ebedb5668502fb2 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Thu, 14 Mar 2013 18:25:10 +0100 Subject: [PATCH] Add twitter allowed users JSON export --- 0.3/functions.php | 4 ++-- 0.3/index.php | 28 ++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/0.3/functions.php b/0.3/functions.php index 10bf442..3efb263 100755 --- a/0.3/functions.php +++ b/0.3/functions.php @@ -130,10 +130,10 @@ function getTimeout( $type ) { function updateType($siteurl) { if( strpos($siteurl, 'twitter.com') !== FALSE ) { - return array('type' => 'microblog', 'name' => 'twitter'); + return array('type' => 'twitter', 'name' => 'twitter'); } elseif ( strpos( $siteurl, 'identi.ca') !== FALSE ) { - return array('type' => 'microblog', 'name' => 'identica'); + return array('type' => 'identica', 'name' => 'identica'); } elseif( strpos( $siteurl, 'shaarli' ) !== FALSE ) { return array('type' => 'shaarli', 'name' => 'shaarli'); diff --git a/0.3/index.php b/0.3/index.php index 842db4b..3066f69 100755 --- a/0.3/index.php +++ b/0.3/index.php @@ -278,6 +278,30 @@ if (isset($_GET['export'])) { 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 **/ @@ -460,12 +484,12 @@ if(!empty($_POST['socialaccount']) && !empty($_POST['socialinstance']) && ALLOW_ $socialinstance = strtolower(escape($_POST['socialinstance'])); if($socialinstance === 'twitter') { - $sitetype = 'microblog'; + $sitetype = 'twitter'; $siteurl = "http://twitter.com/$socialaccount"; $rssurl = $apitwitter.$socialaccount; } elseif($socialinstance === 'identica') { - $sitetype = 'microblog'; + $sitetype = 'identica'; $siteurl = "http://identi.ca/$socialaccount"; $rssurl = "http://identi.ca/api/statuses/user_timeline/$socialaccount.rss"; }