2019-04-26 00:08:08 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Friendica\Module\Admin\Item;
|
|
|
|
|
|
|
|
use Friendica\Core\L10n;
|
|
|
|
use Friendica\Core\Renderer;
|
|
|
|
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
|
|
|
{
|
|
|
|
public static function content()
|
|
|
|
{
|
2019-04-27 22:23:29 -04:00
|
|
|
parent::content();
|
2019-04-26 00:08:08 -04:00
|
|
|
|
|
|
|
$a = self::getApp();
|
|
|
|
|
2019-04-27 22:23:29 -04:00
|
|
|
$guid = null;
|
2019-04-26 00:08:08 -04:00
|
|
|
if (!empty($a->argv[1])) {
|
|
|
|
$guid = $a->argv[1];
|
|
|
|
}
|
|
|
|
|
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, [
|
|
|
|
'$guid' => ['guid', L10n::t('Item Guid'), $guid, ''],
|
|
|
|
'$source' => $source,
|
|
|
|
'$item_uri' => $item_uri,
|
|
|
|
'$item_id' => $item_id,
|
|
|
|
'$terms' => $terms,
|
|
|
|
]);
|
|
|
|
|
|
|
|
return $o;
|
|
|
|
}
|
|
|
|
}
|