]> git.mxchange.org Git - friendica.git/commitdiff
Move phpinfo module to src/Module/Admin
authorHypolite Petovan <hypolite@mrpetovan.com>
Fri, 26 Apr 2019 03:56:14 +0000 (23:56 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Thu, 2 May 2019 13:52:53 +0000 (09:52 -0400)
mod/phpinfo.php [deleted file]
src/App/Router.php
src/Module/Admin/PhpInfo.php [new file with mode: 0644]
src/Module/BaseAdminModule.php

diff --git a/mod/phpinfo.php b/mod/phpinfo.php
deleted file mode 100644 (file)
index 3228d25..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-/**
- * @file mod/phpinfo.php
- */
-
-function phpinfo_content()
-{
-       if (!is_site_admin()) {
-               return false;
-       }
-
-       phpinfo();
-       exit();
-}
index e0048a3321aadea4e99daedd7445b534cd68d772..e2a6719f6c941caf6aa54bae96ef4f2248a21835 100644 (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);
diff --git a/src/Module/Admin/PhpInfo.php b/src/Module/Admin/PhpInfo.php
new file mode 100644 (file)
index 0000000..2d0e9c1
--- /dev/null
@@ -0,0 +1,16 @@
+<?php\r
+\r
+namespace Friendica\Module\Admin;\r
+\r
+use Friendica\Module\BaseAdminModule;\r
+\r
+class PhpInfo extends BaseAdminModule\r
+{\r
+       public static function rawContent()\r
+       {\r
+               parent::rawContent();\r
+\r
+               phpinfo();\r
+               exit();\r
+       }\r
+}\r
index 42197aa51cc59e316337ff88d12514a1f5090396..b06eed24e5fbbcbd966c9f6b151aa391f37f8e04 100644 (file)
@@ -5,6 +5,7 @@ namespace Friendica\Module;
 use Friendica\BaseModule;\r
 use Friendica\Core\L10n;\r
 use Friendica\Core\Renderer;\r
+use Friendica\Core\System;\r
 use Friendica\Database\DBA;\r
 \r
 abstract class BaseAdminModule extends BaseModule\r
@@ -21,6 +22,19 @@ abstract class BaseAdminModule extends BaseModule
                }\r
        }\r
 \r
+       public static function rawContent()\r
+       {\r
+               if (!is_site_admin()) {\r
+                       System::httpExit(403);\r
+               }\r
+\r
+               if (!empty($_SESSION['submanage'])) {\r
+                       System::httpExit(403);\r
+               }\r
+\r
+               return '';\r
+       }\r
+\r
        public static function content()\r
        {\r
                if (!is_site_admin()) {\r
@@ -71,10 +85,11 @@ abstract class BaseAdminModule extends BaseModule
                                'deleteitem'   => ['admin/item/delete' , L10n::t('Delete Item')             , 'deleteitem'],\r
                        ]],\r
                        'logs' => [L10n::t('Logs'), [\r
-                               'logsconfig'   => ['admin/logs/', L10n::t('Logs')                   , 'logs'],\r
+                               'logsconfig'   => ['admin/logs/', L10n::t('Logs')                           , 'logs'],\r
                                'logsview'     => ['admin/logs/view'    , L10n::t('View Logs')              , 'viewlogs'],\r
                        ]],\r
                        'diagnostics' => [L10n::t('Diagnostics'), [\r
+                               'phpinfo'      => ['admin/phpinfo'           , L10n::t('PHP Info')          , 'phpinfo'],\r
                                'itemsource'   => ['admin/item/source' , L10n::t('Item Source')             , 'itemsource'],\r
                        ]],\r
                ];\r