Move /itemsource to src/Module/Admin
This commit is contained in:
parent
bc5d1384e1
commit
ad02fd140a
4 changed files with 59 additions and 1 deletions
|
@ -135,6 +135,7 @@ class Router
|
||||||
$collector->addRoute(['GET'] , '/federation' , Module\Admin\Federation::class);
|
$collector->addRoute(['GET'] , '/federation' , Module\Admin\Federation::class);
|
||||||
|
|
||||||
$collector->addRoute(['GET', 'POST'], '/item/delete' , Module\Admin\Item\Delete::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'] , '/logs/view' , Module\Admin\Logs\View::class);
|
||||||
$collector->addRoute(['GET', 'POST'], '/logs' , Module\Admin\Logs\Settings::class);
|
$collector->addRoute(['GET', 'POST'], '/logs' , Module\Admin\Logs\Settings::class);
|
||||||
|
|
54
src/Module/Admin/Item/Source.php
Normal file
54
src/Module/Admin/Item/Source.php
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
<?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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -74,6 +74,9 @@ abstract class BaseAdminModule extends BaseModule
|
||||||
'logsconfig' => ['admin/logs/', L10n::t('Logs') , 'logs'],
|
'logsconfig' => ['admin/logs/', L10n::t('Logs') , 'logs'],
|
||||||
'logsview' => ['admin/logs/view' , L10n::t('View Logs') , 'viewlogs'],
|
'logsview' => ['admin/logs/view' , L10n::t('View Logs') , 'viewlogs'],
|
||||||
]],
|
]],
|
||||||
|
'diagnostics' => [L10n::t('Diagnostics'), [
|
||||||
|
'itemsource' => ['admin/item/source' , L10n::t('Item Source') , 'itemsource'],
|
||||||
|
]],
|
||||||
];
|
];
|
||||||
|
|
||||||
$addons_admin = [];
|
$addons_admin = [];
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<h2>Item Source</h2>
|
<h2>Item Source</h2>
|
||||||
<form action="itemsource" method="get" class="panel panel-default">
|
<form action="admin/item/source" method="get" class="panel panel-default">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
{{include file="field_input.tpl" field=$guid}}
|
{{include file="field_input.tpl" field=$guid}}
|
Loading…
Reference in a new issue