friendica/src/Module/Admin/Item/Source.php

58 lines
1.3 KiB
PHP
Raw Normal View History

2019-04-26 00:08:08 -04:00
<?php
namespace Friendica\Module\Admin\Item;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\DI;
2019-04-26 00:08:08 -04:00
use Friendica\Model;
use Friendica\Module\BaseAdminModule;
2019-04-26 00:08:08 -04:00
/**
* @author Hypolite Petovan <mrpetovan@gmail.com>
*/
class Source extends BaseAdminModule
2019-04-26 00:08:08 -04: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
$a = DI::app();
2019-04-26 00:08:08 -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
}
$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, [
'$guid' => ['guid', L10n::t('Item Guid'), $guid, ''],
'$source' => $source,
'$item_uri' => $item_uri,
'$item_id' => $item_id,
'$terms' => $terms,
]);
return $o;
}
}