diff --git a/actions/apiexternalusershow.php b/actions/apiexternalusershow.php index 1f04371..b6cda9b 100644 --- a/actions/apiexternalusershow.php +++ b/actions/apiexternalusershow.php @@ -67,14 +67,48 @@ class ApiExternalUserShowAction extends ApiPrivateAuthAction // get local profile $local_profile = Profile::getKV('profileurl',$profileurl); + if($local_profile) { $this->profile->local = $this->twitterUserArray($local_profile); + + $username = $this->profile->local['screen_name']; + + // if profile url is not ending with nickname, this is probably a single user instance + if(!substr($profileurl, -strlen($username))===$username) { + $instanceurl = $profileurl; + error_log('1'); + } + + // multi user instance + else { + error_log('2'); + $instanceurl = substr($profileurl, 0, strrpos($profileurl, '/')); + } + + } + + // we don't know this user + else { + + // if profile url ends with '/' this is probably an unknown single user instance + if(substr($profileurl, -1)==='/') { + $instanceurl = $profileurl; + $username = 1; + error_log('3'); + } + + // multi user instance + else { + $username = substr($profileurl, strrpos($profileurl, '/')+1); + $instanceurl = substr($profileurl, 0, strrpos($profileurl, '/')); + error_log('4'); + } + } // get profile from external instance - $instanceurl = substr($profileurl, 0, strrpos($profileurl, '/')); - $username = substr($profileurl, strrpos($profileurl, '/')+1); - $apicall = $instanceurl.'/api/users/show.json?id='.$username; + $apicall = $instanceurl.'/api/users/show.json?id='.$username; + error_log('apicall:'.$apicall); stream_context_set_default(array('http' => array('method' => 'GET'))); $this->profile->external = json_decode(file_get_contents($apicall)); diff --git a/actions/qvitter.php b/actions/qvitter.php index dac7991..2ccdeb7 100644 --- a/actions/qvitter.php +++ b/actions/qvitter.php @@ -715,7 +715,7 @@ class QvitterAction extends ApiAction - + diff --git a/js/dom-functions.js b/js/dom-functions.js index c385406..6bfe45e 100644 --- a/js/dom-functions.js +++ b/js/dom-functions.js @@ -1139,6 +1139,10 @@ function popUpAction(popupId, heading, bodyHtml, footerHtml){ function convertNewGNUSocialURItoURL(obj) { + if(typeof obj.uri == 'undefined') { + obj.uri = ''; + } + if(obj.uri.substring(0,4) != 'http') { // guess the url if we only have the non-url uri @@ -1779,7 +1783,7 @@ function buildQueetHtml(obj, idInStream, extraClassesThisRun, requeeted_by) { // in-groups html var in_groups_html = ''; - if(obj.statusnet_in_groups !== false && typeof obj.statusnet_in_groups != 'undefined') { + if(typeof obj.statusnet_in_groups != 'undefined' && obj.statusnet_in_groups !== false && typeof obj.statusnet_in_groups === 'object') { $.each(obj.statusnet_in_groups,function(){ in_groups_html = '!' + obj.statusnet_in_groups.nickname + ''; }); @@ -1805,7 +1809,7 @@ function buildQueetHtml(obj, idInStream, extraClassesThisRun, requeeted_by) { var requeetedByHtml = ' ' + requeeted_by.user.name + ''; requeetHtml = '