]> git.mxchange.org Git - friendica.git/blobdiff - include/text.php
Merge pull request #7711 from annando/gserver-2
[friendica.git] / include / text.php
index 052bdc4c3c3f76edc43de78f96436eea4ad3084d..2050e57026e77453560e4a81f6e53f56358289e7 100644 (file)
@@ -4,11 +4,11 @@
  */
 
 use Friendica\App;
-use Friendica\Content\Smilies;
 use Friendica\Content\Text\BBCode;
 use Friendica\Core\Protocol;
 use Friendica\Model\Contact;
 use Friendica\Model\FileTag;
+use Friendica\Model\Group;
 use Friendica\Util\Strings;
 
 /**
@@ -20,18 +20,9 @@ use Friendica\Util\Strings;
 function expand_acl($s) {
        // turn string array of angle-bracketed elements into numeric array
        // e.g. "<1><2><3>" => array(1,2,3);
-       $ret = [];
+       preg_match_all('/<(' . Group::FOLLOWERS . '|'. Group::MUTUALS . '|[0-9]+)>/', $s, $matches, PREG_PATTERN_ORDER);
 
-       if (strlen($s)) {
-               $t = str_replace('<', '', $s);
-               $a = explode('>', $t);
-               foreach ($a as $aa) {
-                       if (intval($aa)) {
-                               $ret[] = intval($aa);
-                       }
-               }
-       }
-       return $ret;
+       return $matches[1];
 }
 
 
@@ -42,6 +33,8 @@ function expand_acl($s) {
 function sanitise_acl(&$item) {
        if (intval($item)) {
                $item = '<' . intval(Strings::escapeTags(trim($item))) . '>';
+       } elseif (in_array($item, [Group::FOLLOWERS, Group::MUTUALS])) {
+               $item = '<' . $item . '>';
        } else {
                unset($item);
        }
@@ -129,7 +122,7 @@ function redir_private_images($a, &$item)
                        }
 
                        if ((local_user() == $item['uid']) && ($item['private'] == 1) && ($item['contact-id'] != $a->contact['id']) && ($item['network'] == Protocol::DFRN)) {
-                               $img_url = 'redir?f=1&quiet=1&url=' . urlencode($mtch[1]) . '&conurl=' . urlencode($item['author-link']);
+                               $img_url = 'redir/' . $item['contact-id'] . '?url=' . urlencode($mtch[1]);
                                $item['body'] = str_replace($mtch[0], '[img]' . $img_url . '[/img]', $item['body']);
                        }
                }
@@ -140,7 +133,7 @@ function redir_private_images($a, &$item)
  * @brief Given a text string, convert from bbcode to html and add smilie icons.
  *
  * @param string $text String with bbcode.
- * @return string Formattet HTML.
+ * @return string Formatted HTML
  * @throws \Friendica\Network\HTTPException\InternalServerErrorException
  */
 function prepare_text($text)