2019-04-26 00:08:08 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Friendica\Module\Admin\Item;
|
|
|
|
|
|
|
|
use Friendica\Core\Renderer;
|
2019-12-15 16:34:11 -05:00
|
|
|
use Friendica\DI;
|
2019-04-26 00:08:08 -04:00
|
|
|
use Friendica\Model;
|
2019-04-27 22:23:29 -04:00
|
|
|
use Friendica\Module\BaseAdminModule;
|
2019-04-26 00:08:08 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Hypolite Petovan <mrpetovan@gmail.com>
|
|
|
|
*/
|
2019-04-27 22:23:29 -04:00
|
|
|
class Source extends BaseAdminModule
|
|
|
|
|
2019-04-26 00:08:08 -04:00
|
|
|
{
|
2019-11-05 16:48:54 -05:00
|
|
|
public static function content(array $parameters = [])
|
2019-04-26 00:08:08 -04:00
|
|
|
{
|
2019-11-05 15:22:54 -05:00
|
|
|
parent::content($parameters);
|
2019-04-26 00:08:08 -04:00
|
|
|
|
2019-12-15 16:34:11 -05:00
|
|
|
$a = DI::app();
|
2019-04-26 00:08:08 -04:00
|
|
|
|
2019-04-27 22:23:29 -04:00
|
|
|
$guid = null;
|
2019-08-18 09:14:03 -04:00
|
|
|
// @TODO: Replace with parameter from router
|
|
|
|
if (!empty($a->argv[3])) {
|
|
|
|
$guid = $a->argv[3];
|
2019-04-26 00:08:08 -04:00
|
|
|
}
|
|
|
|
|
2019-08-18 09:01:03 -04:00
|
|
|
$guid = $_REQUEST['guid'] ?? $guid;
|
2019-04-26 00:08:08 -04:00
|
|
|
|
|
|
|
$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, [
|
2020-01-18 14:52:34 -05:00
|
|
|
'$guid' => ['guid', DI::l10n()->t('Item Guid'), $guid, ''],
|
2019-04-26 00:08:08 -04:00
|
|
|
'$source' => $source,
|
|
|
|
'$item_uri' => $item_uri,
|
|
|
|
'$item_id' => $item_id,
|
|
|
|
'$terms' => $terms,
|
|
|
|
]);
|
|
|
|
|
|
|
|
return $o;
|
|
|
|
}
|
|
|
|
}
|