]> git.mxchange.org Git - friendica.git/blobdiff - mod/subthread.php
Merge pull request #4328 from tobiasd/20180125-msg
[friendica.git] / mod / subthread.php
index d4b861baabd7144ee9eba7bd92e8dad4f200bd76..9502b7f8d090b1890f98047af109e5109983943b 100644 (file)
@@ -1,11 +1,16 @@
 <?php
-
+/**
+ * @file mod/subthread.php
+ */
 use Friendica\App;
+use Friendica\Core\Addon;
+use Friendica\Core\L10n;
 use Friendica\Core\System;
+use Friendica\Database\DBM;
 
-require_once('include/security.php');
-require_once('include/bbcode.php');
-require_once('include/items.php');
+require_once 'include/security.php';
+require_once 'include/bbcode.php';
+require_once 'include/items.php';
 
 function subthread_content(App $a) {
 
@@ -22,7 +27,7 @@ function subthread_content(App $a) {
                dbesc($item_id)
        );
 
-       if(! $item_id || (! dbm::is_result($r))) {
+       if(! $item_id || (! DBM::is_result($r))) {
                logger('subthread: no item ' . $item_id);
                return;
        }
@@ -31,7 +36,7 @@ function subthread_content(App $a) {
 
        $owner_uid = $item['uid'];
 
-       if(! can_write_wall($a,$owner_uid)) {
+       if(! can_write_wall($owner_uid)) {
                return;
        }
 
@@ -43,7 +48,7 @@ function subthread_content(App $a) {
                        intval($item['contact-id']),
                        intval($item['uid'])
                );
-               if (! dbm::is_result($r)) {
+               if (! DBM::is_result($r)) {
                        return;
                }
                if (! $r[0]['self']) {
@@ -57,7 +62,7 @@ function subthread_content(App $a) {
                WHERE `contact`.`self` = 1 AND `contact`.`uid` = %d LIMIT 1",
                intval($owner_uid)
        );
-       if (dbm::is_result($r))
+       if (DBM::is_result($r))
                $owner = $r[0];
 
        if (! $owner) {
@@ -78,7 +83,7 @@ function subthread_content(App $a) {
                        intval($_SESSION['visitor_id']),
                        intval($owner_uid)
                );
-               if (dbm::is_result($r))
+               if (DBM::is_result($r))
                        $contact = $r[0];
        }
        if (! $contact) {
@@ -87,7 +92,7 @@ function subthread_content(App $a) {
 
        $uri = item_new_uri($a->get_hostname(),$owner_uid);
 
-       $post_type = (($item['resource-id']) ? t('photo') : t('status'));
+       $post_type = (($item['resource-id']) ? L10n::t('photo') : L10n::t('status'));
        $objtype = (($item['resource-id']) ? ACTIVITY_OBJ_IMAGE : ACTIVITY_OBJ_NOTE );
        $link = xmlify('<link rel="alternate" type="text/html" href="' . System::baseUrl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n") ;
        $body = $item['body'];
@@ -103,13 +108,13 @@ function subthread_content(App $a) {
                <content>$body</content>
        </object>
 EOT;
-       $bodyverb = t('%1$s is following %2$s\'s %3$s');
+       $bodyverb = L10n::t('%1$s is following %2$s\'s %3$s');
 
        if (! isset($bodyverb)) {
                return;
        }
 
-       $arr = array();
+       $arr = [];
 
        $arr['guid'] = get_guid(32);
        $arr['uri'] = $uri;
@@ -143,7 +148,6 @@ EOT;
        $arr['deny_gid'] = $item['deny_gid'];
        $arr['visible'] = 1;
        $arr['unseen'] = 1;
-       $arr['last-child'] = 0;
 
        $post_id = item_store($arr);
 
@@ -156,7 +160,7 @@ EOT;
 
        $arr['id'] = $post_id;
 
-       call_hooks('post_local_end', $arr);
+       Addon::callHooks('post_local_end', $arr);
 
        killme();