From: Hypolite Petovan Date: Fri, 19 Oct 2018 02:49:25 +0000 (-0400) Subject: Add itemsource module X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d0681075bf7b6d1bf998da8ac2c43ce2134f4804;p=friendica.git Add itemsource module --- diff --git a/src/Model/Conversation.php b/src/Model/Conversation.php index be1eaf2295..25075dcfbe 100644 --- a/src/Model/Conversation.php +++ b/src/Model/Conversation.php @@ -26,6 +26,11 @@ class Conversation const PARCEL_TWITTER = 67; const PARCEL_UNKNOWN = 255; + public static function getByItemUri($item_uri) + { + return DBA::selectFirst('conversation', [], ['item-uri' => $item_uri]); + } + /** * @brief Store the conversation data * diff --git a/src/Module/Itemsource.php b/src/Module/Itemsource.php new file mode 100644 index 0000000000..bcbd557182 --- /dev/null +++ b/src/Module/Itemsource.php @@ -0,0 +1,39 @@ + + */ +class Itemsource extends \Friendica\BaseModule +{ + public static function content() + { + if (!is_site_admin()) { + return; + } + + $source = ''; + $item_uri = ''; + if (!empty($_REQUEST['guid'])) { + $item = Model\Item::selectFirst([], ['guid' => $_REQUEST['guid']]); + + $conversation = Model\Conversation::getByItemUri($item['uri']); + + $item_uri = $item['uri']; + $source = htmlspecialchars($conversation['source']); + } + + $tpl = get_markup_template('debug/itemsource.tpl'); + $o = replace_macros($tpl, [ + '$guid' => ['guid', L10n::t('Item Guid'), htmlentities(defaults($_REQUEST, 'guid', '')), ''], + '$source' => $source, + '$item_uri' => $item_uri + ]); + + return $o; + } +} diff --git a/view/templates/debug/itemsource.tpl b/view/templates/debug/itemsource.tpl new file mode 100644 index 0000000000..377409ebf3 --- /dev/null +++ b/view/templates/debug/itemsource.tpl @@ -0,0 +1,28 @@ +

Item Source

+
+
+
+ {{include file="field_input.tpl" field=$guid}} +
+

+
+
+ +{{if $source}} +
+
+
+

Item URI

+
+
+ {{$item_uri}} +
+
+
+
+

Source

+
+
{{$source}}
+
+
+{{/if}}