]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Group.php
Remove unused `use` statements & remove PConfig class
[friendica.git] / src / Module / Group.php
index 5699d2d30bf87d586477ec66b33e79520cc95bf2..6542cc74a8b02abc984fbdc128a74cc368487bd3 100644 (file)
@@ -8,10 +8,10 @@ namespace Friendica\Module;
 use Friendica\BaseModule;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
-use Friendica\Core\PConfig;
 use Friendica\Core\Renderer;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
+use Friendica\DI;
 use Friendica\Model;
 use Friendica\Util\Strings;
 
@@ -21,15 +21,15 @@ class Group extends BaseModule
 {
        public static function post(array $parameters = [])
        {
-               $a = self::getApp();
+               $a = DI::app();
 
-               if ($a->isAjax()) {
+               if (DI::mode()->isAjax()) {
                        self::ajaxPost();
                }
 
                if (!local_user()) {
                        notice(L10n::t('Permission denied.'));
-                       $a->internalRedirect();
+                       DI::baseUrl()->redirect();
                }
 
                // @TODO: Replace with parameter from router
@@ -42,12 +42,12 @@ class Group extends BaseModule
                                info(L10n::t('Group created.'));
                                $r = Model\Group::getIdByName(local_user(), $name);
                                if ($r) {
-                                       $a->internalRedirect('group/' . $r);
+                                       DI::baseUrl()->redirect('group/' . $r);
                                }
                        } else {
                                notice(L10n::t('Could not create group.'));
                        }
-                       $a->internalRedirect('group');
+                       DI::baseUrl()->redirect('group');
                }
 
                // @TODO: Replace with parameter from router
@@ -57,7 +57,7 @@ class Group extends BaseModule
                        $group = DBA::selectFirst('group', ['id', 'name'], ['id' => $a->argv[1], 'uid' => local_user()]);
                        if (!DBA::isResult($group)) {
                                notice(L10n::t('Group not found.'));
-                               $a->internalRedirect('contact');
+                               DI::baseUrl()->redirect('contact');
                        }
                        $groupname = Strings::escapeTags(trim($_POST['groupname']));
                        if (strlen($groupname) && ($groupname != $group['name'])) {
@@ -71,7 +71,7 @@ class Group extends BaseModule
        public static function ajaxPost()
        {
                try {
-                       $a = self::getApp();
+                       $a = DI::app();
 
                        if (!local_user()) {
                                throw new \Exception(L10n::t('Permission denied.'), 403);
@@ -134,18 +134,18 @@ class Group extends BaseModule
                        throw new \Friendica\Network\HTTPException\ForbiddenException();
                }
 
-               $a = self::getApp();
+               $a = DI::app();
 
-               $a->page['aside'] = Model\Group::sidebarWidget('contact', 'group', 'extended', (($a->argc > 1) ? $a->argv[1] : 'everyone'));
+               DI::page()['aside'] = Model\Group::sidebarWidget('contact', 'group', 'extended', (($a->argc > 1) ? $a->argv[1] : 'everyone'));
 
                // With no group number provided we jump to the unassigned contacts as a starting point
                // @TODO: Replace with parameter from router
                if ($a->argc == 1) {
-                       $a->internalRedirect('group/none');
+                       DI::baseUrl()->redirect('group/none');
                }
 
                // Switch to text mode interface if we have more than 'n' contacts or group members
-               $switchtotext = PConfig::get(local_user(), 'system', 'groupedit_image_limit');
+               $switchtotext = DI::pConfig()->get(local_user(), 'system', 'groupedit_image_limit');
                if (is_null($switchtotext)) {
                        $switchtotext = Config::get('system', 'groupedit_image_limit', 200);
                }
@@ -199,7 +199,7 @@ class Group extends BaseModule
                        if (intval($a->argv[2])) {
                                if (!Model\Group::exists($a->argv[2], local_user())) {
                                        notice(L10n::t('Group not found.'));
-                                       $a->internalRedirect('contact');
+                                       DI::baseUrl()->redirect('contact');
                                }
 
                                if (Model\Group::remove($a->argv[2])) {
@@ -208,7 +208,7 @@ class Group extends BaseModule
                                        notice(L10n::t('Unable to remove group.'));
                                }
                        }
-                       $a->internalRedirect('group');
+                       DI::baseUrl()->redirect('group');
                }
 
                // @TODO: Replace with parameter from router
@@ -225,7 +225,7 @@ class Group extends BaseModule
                        $group = DBA::selectFirst('group', ['id', 'name'], ['id' => $a->argv[1], 'uid' => local_user(), 'deleted' => false]);
                        if (!DBA::isResult($group)) {
                                notice(L10n::t('Group not found.'));
-                               $a->internalRedirect('contact');
+                               DI::baseUrl()->redirect('contact');
                        }
 
                        $members = Model\Contact::getByGroupId($group['id']);