$collector->addRoute(['GET'] , '/federation' , Module\Admin\Federation::class);
$collector->addRoute(['GET', 'POST'], '/item/delete' , Module\Admin\Item\Delete::class);
+ $collector->addRoute(['GET', 'POST'], '/item/source[/{guid}]' , Module\Admin\Item\Source::class);
$collector->addRoute(['GET'] , '/logs/view' , Module\Admin\Logs\View::class);
$collector->addRoute(['GET', 'POST'], '/logs' , Module\Admin\Logs\Settings::class);
--- /dev/null
+<?php
+
+namespace Friendica\Module\Admin\Item;
+
+use Friendica\Core\L10n;
+use Friendica\Core\Renderer;
+use Friendica\Model;
+
+/**
+ * @author Hypolite Petovan <mrpetovan@gmail.com>
+ */
+class Source extends \Friendica\BaseModule
+{
+ public static function content()
+ {
+ if (!is_site_admin()) {
+ return;
+ }
+
+ $a = self::getApp();
+
+ if (!empty($a->argv[1])) {
+ $guid = $a->argv[1];
+ }
+
+ $guid = defaults($_REQUEST['guid'], $guid);
+
+ $source = '';
+ $item_uri = '';
+ $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 = $conversation['source'];
+ $terms = Model\Term::tagArrayFromItemId($item['id'], [Model\Term::HASHTAG, Model\Term::MENTION, Model\Term::IMPLICIT_MENTION]);
+ }
+
+ $tpl = Renderer::getMarkupTemplate('admin/item/source.tpl');
+ $o = Renderer::replaceMacros($tpl, [
+ '$guid' => ['guid', L10n::t('Item Guid'), $guid, ''],
+ '$source' => $source,
+ '$item_uri' => $item_uri,
+ '$item_id' => $item_id,
+ '$terms' => $terms,
+ ]);
+
+ return $o;
+ }
+}
'logsconfig' => ['admin/logs/', L10n::t('Logs') , 'logs'],\r
'logsview' => ['admin/logs/view' , L10n::t('View Logs') , 'viewlogs'],\r
]],\r
+ 'diagnostics' => [L10n::t('Diagnostics'), [\r
+ 'itemsource' => ['admin/item/source' , L10n::t('Item Source') , 'itemsource'],\r
+ ]],\r
];\r
\r
$addons_admin = [];\r
--- /dev/null
+<h2>Item Source</h2>
+<form action="admin/item/source" method="get" class="panel panel-default">
+ <div class="panel-body">
+ <div class="form-group">
+ {{include file="field_input.tpl" field=$guid}}
+ </div>
+ <p><button type="submit" class="btn btn-primary">Submit</button></p>
+ </div>
+</form>
+
+{{if $source}}
+<div class="itemsource-results">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h3 class="panel-title">Item Id</h3>
+ </div>
+ <div class="panel-body">
+ {{$item_id}}
+ </div>
+ </div>
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h3 class="panel-title">Item URI</h3>
+ </div>
+ <div class="panel-body">
+ {{$item_uri}}
+ </div>
+ </div>
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h3 class="panel-title">Terms</h3>
+ </div>
+ <div class="panel-body">
+ <table class="table table-condensed table-striped">
+ <tr>
+ <th>Type</th>
+ <th>Term</th>
+ <th>URL</th>
+ </tr>
+ {{foreach $terms as $term}}
+ <tr>
+ <td>
+ {{if $term.type == 1}}Tag{{/if}}
+ {{if $term.type == 2}}Mention{{/if}}
+ {{if $term.type == 8}}Implicit Mention{{/if}}
+ </td>
+ <td>
+ {{$term.term}}
+ </td>
+ <td>
+ {{$term.url}}
+ </td>
+ </tr>
+ {{/foreach}}
+ </table>
+ </div>
+ </div>
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h3 class="panel-title">Source</h3>
+ </div>
+ <pre><code class="language-php">{{$source}}</code></pre>
+ </div>
+</div>
+{{/if}}
+++ /dev/null
-<h2>Item Source</h2>
-<form action="itemsource" method="get" class="panel panel-default">
- <div class="panel-body">
- <div class="form-group">
- {{include file="field_input.tpl" field=$guid}}
- </div>
- <p><button type="submit" class="btn btn-primary">Submit</button></p>
- </div>
-</form>
-
-{{if $source}}
-<div class="itemsource-results">
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">Item Id</h3>
- </div>
- <div class="panel-body">
- {{$item_id}}
- </div>
- </div>
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">Item URI</h3>
- </div>
- <div class="panel-body">
- {{$item_uri}}
- </div>
- </div>
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">Terms</h3>
- </div>
- <div class="panel-body">
- <table class="table table-condensed table-striped">
- <tr>
- <th>Type</th>
- <th>Term</th>
- <th>URL</th>
- </tr>
- {{foreach $terms as $term}}
- <tr>
- <td>
- {{if $term.type == 1}}Tag{{/if}}
- {{if $term.type == 2}}Mention{{/if}}
- {{if $term.type == 8}}Implicit Mention{{/if}}
- </td>
- <td>
- {{$term.term}}
- </td>
- <td>
- {{$term.url}}
- </td>
- </tr>
- {{/foreach}}
- </table>
- </div>
- </div>
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">Source</h3>
- </div>
- <pre><code class="language-php">{{$source}}</code></pre>
- </div>
-</div>
-{{/if}}