]> git.mxchange.org Git - friendica.git/blobdiff - include/api.php
Merge pull request #3284 from annando/issue-3278
[friendica.git] / include / api.php
index 701e527cc8236ad86b43aaf04b0d38f500f7f5b4..9fc853340af520d22f9a56b945906a7bd54e9fd2 100644 (file)
@@ -352,6 +352,7 @@ use \Friendica\Core\Config;
                                        }
                                }
                        }
+                       logger('API call not implemented: '.$a->query_string);
                        throw new NotImplementedException();
                } catch (HTTPException $e) {
                        header("HTTP/1.1 {$e->httpcode} {$e->httpdesc}");
@@ -2720,6 +2721,7 @@ use \Friendica\Core\Config;
                return api_format_data('config', $type, array('config' => $config));
 
        }
+       api_register_func('api/gnusocial/config','api_statusnet_config',false);
        api_register_func('api/statusnet/config','api_statusnet_config',false);
 
        function api_statusnet_version($type) {
@@ -2728,6 +2730,7 @@ use \Friendica\Core\Config;
 
                return api_format_data('version', $type, array('version' => $fake_statusnet_version));
        }
+       api_register_func('api/gnusocial/version','api_statusnet_version',false);
        api_register_func('api/statusnet/version','api_statusnet_version',false);
 
        /**
@@ -3963,7 +3966,7 @@ use \Friendica\Core\Config;
                $multi_profiles = feature_enabled(api_user(),'multi_profiles');
                $directory = get_config('system', 'directory');
 
-// get data of the specified profile id or all profiles of the user if not specified
+               // get data of the specified profile id or all profiles of the user if not specified
                if ($profileid != 0) {
                        $r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `id` = %d",
                                intval(api_user()),
@@ -3971,11 +3974,10 @@ use \Friendica\Core\Config;
                        // error message if specified gid is not in database
                        if (!dbm::is_result($r))
                                throw new BadRequestException("profile_id not available");
-               }
-               else
+               } else {
                        $r = q("SELECT * FROM `profile` WHERE `uid` = %d",
                                intval(api_user()));
-
+               }
                // loop through all returned profiles and retrieve data and users
                $k = 0;
                foreach ($r as $rr) {
@@ -4002,9 +4004,11 @@ use \Friendica\Core\Config;
                }
 
                // return settings, authenticated user and profiles data
+               $self = q("SELECT `nurl` FROM `contact` WHERE `uid`= %d AND `self` LIMIT 1", intval(api_user()));
+
                $result = array('multi_profiles' => $multi_profiles ? true : false,
                                                'global_dir' => $directory,
-                                               'friendica_owner' => api_get_user($a, intval(api_user())),
+                                               'friendica_owner' => api_get_user($a, $self[0]['nurl']),
                                                'profiles' => $profiles);
                return api_format_data("friendica_profiles", $type, array('$result' => $result));
        }