Move phpinfo module to src/Module/Admin

This commit is contained in:
Hypolite Petovan 2019-04-25 23:56:14 -04:00
parent ad02fd140a
commit fa4b42c6dd
4 changed files with 34 additions and 15 deletions

View file

@ -1,14 +0,0 @@
<?php
/**
* @file mod/phpinfo.php
*/
function phpinfo_content()
{
if (!is_site_admin()) {
return false;
}
phpinfo();
exit();
}

View file

@ -140,6 +140,8 @@ class Router
$collector->addRoute(['GET'] , '/logs/view' , Module\Admin\Logs\View::class);
$collector->addRoute(['GET', 'POST'], '/logs' , Module\Admin\Logs\Settings::class);
$collector->addRoute(['GET'] , '/phpinfo' , Module\Admin\PhpInfo::class);
$collector->addRoute(['GET'] , '/queue[/deferred]' , Module\Admin\Queue::class);
$collector->addRoute(['GET', 'POST'], '/site' , Module\Admin\Site::class);

View file

@ -0,0 +1,16 @@
<?php
namespace Friendica\Module\Admin;
use Friendica\Module\BaseAdminModule;
class PhpInfo extends BaseAdminModule
{
public static function rawContent()
{
parent::rawContent();
phpinfo();
exit();
}
}

View file

@ -5,6 +5,7 @@ namespace Friendica\Module;
use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
abstract class BaseAdminModule extends BaseModule
@ -21,6 +22,19 @@ abstract class BaseAdminModule extends BaseModule
}
}
public static function rawContent()
{
if (!is_site_admin()) {
System::httpExit(403);
}
if (!empty($_SESSION['submanage'])) {
System::httpExit(403);
}
return '';
}
public static function content()
{
if (!is_site_admin()) {
@ -75,6 +89,7 @@ abstract class BaseAdminModule extends BaseModule
'logsview' => ['admin/logs/view' , L10n::t('View Logs') , 'viewlogs'],
]],
'diagnostics' => [L10n::t('Diagnostics'), [
'phpinfo' => ['admin/phpinfo' , L10n::t('PHP Info') , 'phpinfo'],
'itemsource' => ['admin/item/source' , L10n::t('Item Source') , 'itemsource'],
]],
];