]> git.mxchange.org Git - friendica.git/blobdiff - include/conversation.php
typo correction of try_files directive (#5387)
[friendica.git] / include / conversation.php
index 5ce02a55f698e3bd25b7a3ebfc1fdb9c5d5cce82..21b700f2fe0e42de4f0c9477ecd12b462454b8a1 100644 (file)
@@ -349,7 +349,10 @@ function localize_item(&$item)
        // add sparkle links to appropriate permalinks
        $author = ['uid' => 0, 'id' => $item['author-id'],
                'network' => $item['author-network'], 'url' => $item['author-link']];
-       $item['plink'] = Contact::magicLinkbyContact($author, $item['plink']);
+
+       if (!empty($item['plink'])) {
+               $item['plink'] = Contact::magicLinkbyContact($author, $item['plink']);
+       }
 }
 
 /**
@@ -402,7 +405,7 @@ function visible_activity($item) {
  * that are based on unique features of the calling module.
  *
  */
-function conversation(App $a, $items, $mode, $update, $preview = false, $order = 'commented', $uid = 0) {
+function conversation(App $a, array $items, $mode, $update, $preview = false, $order = 'commented', $uid = 0) {
        require_once 'mod/proxy.php';
 
        $ssl_state = ((local_user()) ? true : false);
@@ -482,7 +485,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order =
                $profile_owner = $a->profile['uid'];
                if (!$update) {
                        $live_update_div = '<div id="live-display"></div>' . "\r\n"
-                               . "<script> var profile_uid = " . $_SESSION['uid'] . ";"
+                               . "<script> var profile_uid = " . defaults($_SESSION, 'uid', 0) . ";"
                                . " var profile_page = 1; </script>";
                }
        } elseif ($mode === 'community') {
@@ -631,8 +634,8 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order =
 
                                $tmp_item = [
                                        'template' => $tpl,
-                                       'id' => (($preview) ? 'P0' : $item['item_id']),
-                                       'guid' => (($preview) ? 'Q0' : $item['guid']),
+                                       'id' => ($preview ? 'P0' : $item['id']),
+                                       'guid' => ($preview ? 'Q0' : $item['guid']),
                                        'network' => $item['network'],
                                        'network_name' => ContactSelector::networkToName($item['network'], $profile_link),
                                        'linktitle' => L10n::t('View %s\'s profile @ %s', $profile_name, $item['author-link']),
@@ -679,7 +682,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order =
                                $arr = ['item' => $item, 'output' => $tmp_item];
                                Addon::callHooks('display_item', $arr);
 
-                               $threads[$threadsid]['id'] = $item['item_id'];
+                               $threads[$threadsid]['id'] = $item['id'];
                                $threads[$threadsid]['network'] = $item['network'];
                                $threads[$threadsid]['items'] = [$arr['output']];
 
@@ -765,7 +768,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order =
  *
  * @return array items with parents and comments
  */
-function conversation_add_children($parents, $block_authors, $order, $uid) {
+function conversation_add_children(array $parents, $block_authors, $order, $uid) {
        $max_comments = Config::get('system', 'max_comments', 100);
 
        $params = ['order' => ['uid', 'commented' => true]];