]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Itemsource.php
Merge pull request #7044 from MrPetovan/task/router
[friendica.git] / src / Module / Itemsource.php
index 2da679eeefffd725cc3cb680d71bf37badd474e5..d781db3ac5d207b54bdfb4f3a7050e17587acdfa 100644 (file)
@@ -17,22 +17,37 @@ class Itemsource extends \Friendica\BaseModule
                        return;
                }
 
+               $a = self::getApp();
+
+               // @TODO: Replace with parameter from router
+               if (!empty($a->argv[1])) {
+                       $guid = $a->argv[1];
+               }
+
+               $guid = defaults($_REQUEST['guid'], $guid);
+
                $source = '';
                $item_uri = '';
-               if (!empty($_REQUEST['guid'])) {
-                       $item = Model\Item::selectFirst([], ['guid' => $_REQUEST['guid']]);
+               $item_id = '';
+               $terms = [];
+               if (!empty($guid)) {
+                       $item = Model\Item::selectFirst(['id', 'guid', 'uri'], ['guid' => $guid]);
 
                        $conversation = Model\Conversation::getByItemUri($item['uri']);
 
+                       $item_id = $item['id'];
                        $item_uri = $item['uri'];
-                       $source = htmlspecialchars($conversation['source']);
+                       $source = $conversation['source'];
+                       $terms = Model\Term::tagArrayFromItemId($item['id'], [Model\Term::HASHTAG, Model\Term::MENTION, Model\Term::IMPLICIT_MENTION]);
                }
 
                $tpl = Renderer::getMarkupTemplate('debug/itemsource.tpl');
                $o = Renderer::replaceMacros($tpl, [
-                       '$guid'          => ['guid', L10n::t('Item Guid'), htmlentities(defaults($_REQUEST, 'guid', '')), ''],
+                       '$guid'          => ['guid', L10n::t('Item Guid'), $guid, ''],
                        '$source'        => $source,
-                       '$item_uri'      => $item_uri
+                       '$item_uri'      => $item_uri,
+                       '$item_id'       => $item_id,
+                       '$terms'         => $terms,
                ]);
 
                return $o;