]> git.mxchange.org Git - friendica.git/blobdiff - mod/item.php
Fix spaces around t() and tt()
[friendica.git] / mod / item.php
index 8c6b181c0d557dfdbd4631e45fb09359d0375877..2cdfb0d66b4e5bf01994507ceda51d3d9d45f04d 100644 (file)
@@ -239,6 +239,7 @@ function item_post(&$a) {
                                }
                                else {
                                        $newname = $name;
+                                       $alias = '';
                                        if(strstr($name,'_')) {
                                                $newname = str_replace('_',' ',$name);
                                                $r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
@@ -257,6 +258,8 @@ function item_post(&$a) {
                                                if($r[0]['network'] === 'stat') {
                                                        $newname = $r[0]['nick'];
                                                        $stat = true;
+                                                       if($r[0]['alias'])
+                                                               $alias = $r[0]['alias'];
                                                }
                                                else
                                                        $newname = $r[0]['name'];
@@ -271,6 +274,16 @@ function item_post(&$a) {
                                        if(strlen($str_tags))
                                                $str_tags .= ',';
                                        $str_tags .= '@[url=' . $profile . ']' . $newname       . '[/url]';
+
+                                       // Status.Net seems to require the numeric ID URL in a mention if the person isn't 
+                                       // subscribed to you. But the nickname URL is OK if they are. Grrr. We'll tag both. 
+
+                                       if(strlen($alias)) {
+                                               if(strlen($str_tags))
+                                                       $str_tags .= ',';
+                                               $str_tags .= '@[url=' . $alias . ']' . $newname . '[/url]';
+                                       }
+
                                }
                        }
                }
@@ -406,8 +419,8 @@ function item_post(&$a) {
                                        '$body' => strip_tags(bbcode($datarray['body']))
                                ));
 
-                               $res = mail($user['email'], $from . t(" commented on your item at ") . $a->config['sitename'],
-                                       $email_tpl,t("From: Administrator@") . $a->get_hostname() );
+                               $res = mail($user['email'], sprintf( t("%s commented on your item at %s") ,$from,$a->config['sitename']),
+                                       $email_tpl,"From: " . t("Administrator") . "@" . $a->get_hostname() );
                        }
                }
                else {
@@ -429,8 +442,8 @@ function item_post(&$a) {
                                        '$body' => strip_tags(bbcode($datarray['body']))
                                ));
 
-                               $res = mail($user['email'], $from . t(" posted on your profile wall at ") . $a->config['sitename'],
-                                       $email_tpl,t("From: Administrator@") . $a->get_hostname() );
+                               $res = mail($user['email'], sprintf( t("%s posted on your profile wall at %s") ,$from, $a->config['sitename']),
+                                       $email_tpl,"From: " . t("Administrator@") . "@" . $a->get_hostname() );
                        }
                }
 
@@ -460,11 +473,7 @@ function item_post(&$a) {
                // NOTREACHED
        }
 
-       $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
-
-       logger('mod_item: notifier invoked: ' . "\"$php_path\" \"include/notifier.php\" \"$notify_type\" \"$post_id\" &");
-
-       proc_run($php_path, "include/notifier.php", $notify_type, "$post_id");
+       proc_run('php', "include/notifier.php", $notify_type, "$post_id");
 
        $datarray['id'] = $post_id;
 
@@ -477,13 +486,13 @@ function item_post(&$a) {
                                $addr = trim($recip);
                                if(! strlen($addr))
                                        continue;
-                               $disclaimer = '<hr />' . t('This message was sent to you by ') . $a->user['username'] 
-                                       . t(', a member of the Friendika social network.') . '<br />';
+                               $disclaimer = '<hr />' . sprintf(t('This message was sent to you by %s, a member of the Friendika social network.'),$a->user['username']) 
+                                       . '<br />';
                                $disclaimer .= t('You may visit them online at') . ' ' 
                                        . $a->get_baseurl() . '/profile/' . $a->user['nickname'] . '<br />';
                                $disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . '<br />'; 
 
-                               $subject  = '[Friendika]' . ' ' . $a->user['username'] . ' ' . t('posted an update.');
+                               $subject  = '[Friendika]' . ' ' . sprintf( t('%s posted an update.'),$a->user['username']);
                                $headers  = 'From: ' . $a->user['username'] . ' <' . $a->user['email'] . '>' . "\n";
                                $headers .= 'MIME-Version: 1.0' . "\n";
                                $headers .= 'Content-Type: text/html; charset=UTF-8' . "\n";
@@ -595,12 +604,10 @@ function item_content(&$a) {
                                }       
                        }
                        $drop_id = intval($item['id']);
-                       $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
                        
                        // send the notification upstream/downstream as the case may be
 
-                       //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" &", array(), $foo));
-                       proc_run($php_path,"include/notifier.php","drop","$drop_id");
+                       proc_run('php',"include/notifier.php","drop","$drop_id");
 
                        goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
                        //NOTREACHED