]> git.mxchange.org Git - friendica.git/commitdiff
Left trim at sign from nicks in ACL
authorHypolite Petovan <mrpetovan@gmail.com>
Tue, 11 Apr 2017 02:09:49 +0000 (22:09 -0400)
committerHypolite Petovan <mrpetovan@gmail.com>
Tue, 11 Apr 2017 02:09:49 +0000 (22:09 -0400)
include/acl_selectors.php
mod/acl.php

index f4b644d68fb0201a322db05d497f324fe31f74df..8404c8f4b6cd87336741175dff3bf0be2b25fc10 100644 (file)
@@ -627,14 +627,14 @@ function acl_lookup(App $a, $out_type = 'json') {
                                dbesc($search),
                                implode("','", $known_contacts)
                );
-               if (dbm::is_result($r)){
+               if (dbm::is_result($r)) {
                        foreach ($r as $row) {
-                               // nickname..
                                $up = parse_url($row['author-link']);
-                               $nick = explode("/",$up['path']);
-                               $nick = $nick[count($nick)-1];
-                               $nick .= "@".$up['host'];
-                               // /nickname
+                               $nick = explode('/', $up['path']);
+                               // Fix for Mastodon URLs with format https://domain.tld/@nick
+                               $nick = ltrim($nick[count($nick) - 1], '@');
+                               $nick .= '@' . $up['host'];
+
                                $unknow_contacts[] = array(
                                        'type'    => 'c',
                                        'photo'   => proxy_url($row['author-avatar'], false, PROXY_SIZE_MICRO),
index 04aa9f50a6ff3b6ce4c847cc41717ded31a57314..9220bc77a9097198aed0bc2c5b7e3800eaf245a7 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /* ACL selector json backend */
 
-require_once("include/acl_selectors.php");
+require_once 'include/acl_selectors.php';
 
 function acl_init(App $a) {
        acl_lookup($a);