]> git.mxchange.org Git - friendica.git/blobdiff - mod/item.php
rino recipient patch
[friendica.git] / mod / item.php
index 703267992d9861435a31dcdb1d8a09ca0da373d0..504856d7d2d9883618edefa4ac4f8b8157e7c42e 100644 (file)
@@ -119,13 +119,21 @@ function item_post(&$a) {
        $tags = get_tags($body);
 
 
-       if($tags) {
+       if(count($tags)) {
                foreach($tags as $tag) {
+                       if(strpos($tag,'#') === 0) {
+                               $basetag = str_replace('_',' ',substr($tag,1));
+                               $body = str_replace($tag,'#[url=' . $a->get_baseurl() . '/search?search=' . rawurlencode($basetag) . ']' . $basetag . '[/url]',$body);
+                               if(strlen($str_tags))
+                                       $str_tags .= ',';
+                               $str_tags .= '#[url=' . $a->get_baseurl() . '/search?search=' . rawurlencode($basetag) . ']' . $basetag . '[/url]';
+                               continue;
+                       }
                        if(strpos($tag,'@') === 0) {
                                $name = substr($tag,1);
-                               if(strpos($name,'@')) {
+                               if((strpos($name,'@')) || (strpos($name,'http://'))) {
                                        $newname = $name;
-                                       $links = @webfinger($name);
+                                       $links = @lrdd($name);
                                        if(count($links)) {
                                                foreach($links as $link) {
                                                        if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page')
@@ -155,6 +163,7 @@ function item_post(&$a) {
                                        }
                                        if(count($r)) {
                                                $profile = $r[0]['url'];
+                                               $newname = $r[0]['name'];
                                                if(strlen($inform))
                                                        $inform .= ',';
                                                $inform .= 'cid:' . $r[0]['id'];
@@ -162,9 +171,9 @@ function item_post(&$a) {
                                }
                                if($profile) {
                                        $body = str_replace($name,'[url=' . $profile . ']' . $newname   . '[/url]', $body);
+                                       $profile = str_replace(',','%2c',$profile);
                                        if(strlen($str_tags))
                                                $str_tags .= ',';
-                                       $profile = str_replace(',','%2c',$profile);
                                        $str_tags .= '@[url=' . $profile . ']' . $newname       . '[/url]';
                                }
                        }
@@ -219,6 +228,7 @@ function item_post(&$a) {
                dbesc($uri));
        if(count($r)) {
                $post_id = $r[0]['id'];
+               logger('mod_item: saved item ' . $post_id);
 
                if($parent) {
 
@@ -251,6 +261,7 @@ function item_post(&$a) {
                                        '$username' => $user['username'],
                                        '$email' => $user['email'],
                                        '$from' => $from,
+                                       '$display' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
                                        '$body' => strip_tags(bbcode($body))
                                ));
 
@@ -273,6 +284,7 @@ function item_post(&$a) {
                                        '$username' => $user['username'],
                                        '$email' => $user['email'],
                                        '$from' => $from,
+                                       '$display' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
                                        '$body' => strip_tags(bbcode($body))
                                ));
 
@@ -301,9 +313,10 @@ function item_post(&$a) {
        }
 
        $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
-       $proc_debug = get_config('system','proc_debug');
 
-       proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"$notify_type\" \"$post_id\" $proc_debug &",
+       logger('mod_item: notifier invoked: ' . "\"$php_path\" \"include/notifier.php\" \"$notify_type\" \"$post_id\" &");
+
+       proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"$notify_type\" \"$post_id\" &",
                array(),$foo));
 
        goaway($a->get_baseurl() . "/" . $_POST['return'] );
@@ -390,12 +403,10 @@ function item_content(&$a) {
                        }
                        $drop_id = intval($item['id']);
                        $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
-                       $proc_debug = get_config('system','proc_debug');
-
                        
                        // send the notification upstream/downstream as the case may be
 
-                       proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" $proc_debug &",
+                       proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" &",
                                array(), $foo));
 
                        goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);