]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/BaseAdminModule.php
Use DI::baseUrl() for Search\Index.php
[friendica.git] / src / Module / BaseAdminModule.php
index dd89bcb6c769d88c815748b5805ffb47a51759e0..f985b4a4956c8fd6555c6e87355ec1d974581a4c 100644 (file)
@@ -6,7 +6,11 @@ use Friendica\BaseModule;
 use Friendica\Core\Addon;
 use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
-use Friendica\Core\System;
+use Friendica\Core\Session;
+use Friendica\DI;
+use Friendica\Network\HTTPException\ForbiddenException;
+
+require_once 'boot.php';
 
 /**
  * This abstract module is meant to be extended by all modules that are reserved to administrator users.
@@ -20,7 +24,7 @@ use Friendica\Core\System;
  */
 abstract class BaseAdminModule extends BaseModule
 {
-       public static function post()
+       public static function post(array $parameters = [])
        {
                if (!is_site_admin()) {
                        return;
@@ -32,36 +36,33 @@ abstract class BaseAdminModule extends BaseModule
                }
        }
 
-       public static function rawContent()
+       public static function rawContent(array $parameters = [])
        {
                if (!is_site_admin()) {
-                       System::httpExit(403);
+                       return '';
                }
 
                if (!empty($_SESSION['submanage'])) {
-                       System::httpExit(403);
+                       return '';
                }
 
                return '';
        }
 
-       public static function content()
+       public static function content(array $parameters = [])
        {
+               $a = DI::app();
+
                if (!is_site_admin()) {
-                       return Login::form();
+                       notice(L10n::t('Please login to continue.'));
+                       Session::set('return_path', DI::args()->getQueryString());
+                       DI::baseUrl()->redirect('login');
                }
 
                if (!empty($_SESSION['submanage'])) {
-                       return '';
+                       throw new ForbiddenException(L10n::t('Submanaged account can\'t access the administation pages. Please log back in as the master account.'));
                }
 
-               $a = self::getApp();
-
-               // APC deactivated, since there are problems with PHP 5.5
-               //if (function_exists("apc_delete")) {
-               // $toDelete = new APCIterator('user', APC_ITER_VALUE);
-               // apc_delete($toDelete);
-               //}
                // Header stuff
                $a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/settings_head.tpl'), []);