]> git.mxchange.org Git - friendica.git/blobdiff - include/conversation.php
missing use and self
[friendica.git] / include / conversation.php
index 0362e9a4459f1d9730e13f4148b37cc6fb84660d..47adfc0dfbf971dec2677a46669d091b9db249e7 100644 (file)
@@ -6,10 +6,12 @@
 use Friendica\App;
 use Friendica\Content\ContactSelector;
 use Friendica\Content\Feature;
+use Friendica\Content\Pager;
 use Friendica\Content\Text\BBCode;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
+use Friendica\Core\Logger;
 use Friendica\Core\PConfig;
 use Friendica\Core\Protocol;
 use Friendica\Core\System;
@@ -353,7 +355,8 @@ function localize_item(&$item)
        $author = ['uid' => 0, 'id' => $item['author-id'],
                'network' => $item['author-network'], 'url' => $item['author-link']];
 
-       if (!empty($item['plink'])) {
+       // Only create a redirection to a magic link when logged in
+       if (!empty($item['plink']) && (local_user() || remote_user())) {
                $item['plink'] = Contact::magicLinkbyContact($author, $item['plink']);
        }
 }
@@ -432,8 +435,8 @@ function conv_get_blocklist()
  * that are based on unique features of the calling module.
  *
  */
-function conversation(App $a, array $items, $mode, $update, $preview = false, $order = 'commented', $uid = 0) {
-
+function conversation(App $a, array $items, Pager $pager, $mode, $update, $preview = false, $order = 'commented', $uid = 0)
+{
        $ssl_state = (local_user() ? true : false);
 
        $profile_owner = 0;
@@ -468,7 +471,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
                                . ((x($_GET, 'cmax'))   ? '&cmax='   . $_GET['cmax']   : '')
                                . ((x($_GET, 'file'))   ? '&file='   . $_GET['file']   : '')
 
-                               . "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
+                               . "'; var profile_page = " . $pager->getPage() . "; </script>\r\n";
                }
        } elseif ($mode === 'profile') {
                $items = conversation_add_children($items, false, $order, $uid);
@@ -487,7 +490,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
 
                                $live_update_div = '<div id="live-profile"></div>' . "\r\n"
                                        . "<script> var profile_uid = " . $a->profile['profile_uid']
-                                       . "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
+                                       . "; var netargs = '?f='; var profile_page = " . $pager->getPage() . "; </script>\r\n";
                        }
                }
        } elseif ($mode === 'notes') {
@@ -497,7 +500,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
                if (!$update) {
                        $live_update_div = '<div id="live-notes"></div>' . "\r\n"
                                . "<script> var profile_uid = " . local_user()
-                               . "; var netargs = '/?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
+                               . "; var netargs = '/?f='; var profile_page = " . $pager->getPage() . "; </script>\r\n";
                }
        } elseif ($mode === 'display') {
                $items = conversation_add_children($items, false, $order, $uid);
@@ -515,7 +518,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
                if (!$update) {
                        $live_update_div = '<div id="live-community"></div>' . "\r\n"
                                . "<script> var profile_uid = -1; var netargs = '" . substr($a->cmd, 10)
-                               ."/?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
+                               ."/?f='; var profile_page = " . $pager->getPage() . "; </script>\r\n";
                }
        } elseif ($mode === 'contacts') {
                $items = conversation_add_children($items, true, $order, $uid);
@@ -524,7 +527,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
                if (!$update) {
                        $live_update_div = '<div id="live-contacts"></div>' . "\r\n"
                                . "<script> var profile_uid = -1; var netargs = '" . substr($a->cmd, 9)
-                               ."/?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
+                               ."/?f='; var profile_page = " . $pager->getPage() . "; </script>\r\n";
                }
        } elseif ($mode === 'search') {
                $live_update_div = '<div id="live-search"></div>' . "\r\n";
@@ -533,7 +536,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
        $page_dropping = ((local_user() && local_user() == $profile_owner) ? true : false);
 
        if (!$update) {
-               $_SESSION['return_url'] = $a->query_string;
+               $_SESSION['return_path'] = $a->query_string;
        }
 
        $cb = ['items' => $items, 'mode' => $mode, 'update' => $update, 'preview' => $preview];
@@ -749,7 +752,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
 
                        $threads = $conv->getTemplateData($conv_responses);
                        if (!$threads) {
-                               logger('[ERROR] conversation : Failed to get template data.', LOGGER_DEBUG);
+                               Logger::log('[ERROR] conversation : Failed to get template data.', LOGGER_DEBUG);
                                $threads = [];
                        }
                }
@@ -853,8 +856,8 @@ function item_photo_menu($item) {
 
        if ($cid && !$item['self']) {
                $poke_link = 'poke/?f=&c=' . $cid;
-               $contact_url = 'contacts/' . $cid;
-               $posts_link = 'contacts/' . $cid . '/posts';
+               $contact_url = 'contact/' . $cid;
+               $posts_link = 'contact/' . $cid . '/posts';
 
                if (in_array($network, [Protocol::DFRN, Protocol::DIASPORA])) {
                        $pm_url = 'message/new/' . $cid;