2018-10-19 04:49:25 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Friendica\Module;
|
|
|
|
|
|
|
|
use Friendica\Core\L10n;
|
2018-10-31 15:35:50 +01:00
|
|
|
use Friendica\Core\Renderer;
|
2018-10-19 04:49:25 +02:00
|
|
|
use Friendica\Model;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Hypolite Petovan <mrpetovan@gmail.com>
|
|
|
|
*/
|
|
|
|
class Itemsource extends \Friendica\BaseModule
|
|
|
|
{
|
|
|
|
public static function content()
|
|
|
|
{
|
|
|
|
if (!is_site_admin()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-02-09 05:12:05 +01:00
|
|
|
$a = self::getApp();
|
|
|
|
|
2019-05-01 20:16:21 +02:00
|
|
|
// @TODO: Replace with parameter from router
|
2019-02-09 05:12:05 +01:00
|
|
|
if (!empty($a->argv[1])) {
|
|
|
|
$guid = $a->argv[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
$guid = defaults($_REQUEST['guid'], $guid);
|
|
|
|
|
2018-10-19 04:49:25 +02:00
|
|
|
$source = '';
|
|
|
|
$item_uri = '';
|
2019-02-22 03:37:23 +01:00
|
|
|
$item_id = '';
|
|
|
|
$terms = [];
|
2019-02-09 05:12:05 +01:00
|
|
|
if (!empty($guid)) {
|
2019-02-22 03:37:23 +01:00
|
|
|
$item = Model\Item::selectFirst(['id', 'guid', 'uri'], ['guid' => $guid]);
|
2018-10-19 04:49:25 +02:00
|
|
|
|
|
|
|
$conversation = Model\Conversation::getByItemUri($item['uri']);
|
|
|
|
|
2019-02-22 03:37:23 +01:00
|
|
|
$item_id = $item['id'];
|
2018-10-19 04:49:25 +02:00
|
|
|
$item_uri = $item['uri'];
|
2018-12-25 17:37:32 +01:00
|
|
|
$source = $conversation['source'];
|
2019-02-22 03:37:23 +01:00
|
|
|
$terms = Model\Term::tagArrayFromItemId($item['id'], [Model\Term::HASHTAG, Model\Term::MENTION, Model\Term::IMPLICIT_MENTION]);
|
2018-10-19 04:49:25 +02:00
|
|
|
}
|
|
|
|
|
2018-10-31 15:44:06 +01:00
|
|
|
$tpl = Renderer::getMarkupTemplate('debug/itemsource.tpl');
|
2018-10-31 15:35:50 +01:00
|
|
|
$o = Renderer::replaceMacros($tpl, [
|
2019-02-22 03:37:23 +01:00
|
|
|
'$guid' => ['guid', L10n::t('Item Guid'), $guid, ''],
|
2018-10-19 04:49:25 +02:00
|
|
|
'$source' => $source,
|
2019-02-22 03:37:23 +01:00
|
|
|
'$item_uri' => $item_uri,
|
|
|
|
'$item_id' => $item_id,
|
|
|
|
'$terms' => $terms,
|
2018-10-19 04:49:25 +02:00
|
|
|
]);
|
|
|
|
|
|
|
|
return $o;
|
|
|
|
}
|
|
|
|
}
|