Skip to content

Commit

Permalink
[K6.3] Replace deprecated usage of BaseController::getInstance
Browse files Browse the repository at this point in the history
  • Loading branch information
xillibit committed Oct 22, 2023
1 parent 836d030 commit ef0d777
Show file tree
Hide file tree
Showing 17 changed files with 37 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@

use Exception;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Kunena\Forum\Libraries\Controller\KunenaControllerDisplay;
use Kunena\Forum\Libraries\Forum\Announcement\KunenaAnnouncementHelper;
use Kunena\Forum\Libraries\Route\KunenaRoute;
use Joomla\CMS\Factory;
use Kunena\Forum\Libraries\Controller\KunenaController;

/**
* Class ComponentAnnouncementControllerEditDisplay
Expand Down Expand Up @@ -63,7 +64,8 @@ protected function before()

if (!$Itemid && $this->config->sefRedirect) {
$itemid = KunenaRoute::fixMissingItemID();
$controller = BaseController::getInstance("kunena");
$controller = new KunenaController();
$controller = Factory::getApplication()->bootComponent('com_kunena')->getMVCFactory()->createController('kunena');

if ($id) {
$controller->setRedirect(KunenaRoute::_("index.php?option=com_kunena&view=announcement&layout=edit&id={$id}&Itemid={$itemid}", false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

use Exception;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Kunena\Forum\Libraries\Controller\KunenaControllerDisplay;
use Kunena\Forum\Libraries\Forum\Announcement\KunenaAnnouncementHelper;
use Kunena\Forum\Libraries\Route\KunenaRoute;
use Kunena\Forum\Libraries\Controller\KunenaController;

/**
* Class ComponentAnnouncementControllerItemDisplay
Expand Down Expand Up @@ -62,7 +62,7 @@ protected function before()

if (!$Itemid && $this->config->sefRedirect) {
$itemid = KunenaRoute::fixMissingItemID();
$controller = BaseController::getInstance("kunena");
$controller = new KunenaController();
$controller->setRedirect(KunenaRoute::_("index.php?option=com_kunena&view=announcement&layout=default&id={$id}&Itemid={$itemid}", false));
$controller->redirect();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

use Exception;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Kunena\Forum\Libraries\Controller\KunenaControllerDisplay;
use Kunena\Forum\Libraries\Forum\Announcement\KunenaAnnouncementHelper;
use Kunena\Forum\Libraries\Pagination\KunenaPagination;
use Kunena\Forum\Libraries\Route\KunenaRoute;
use Kunena\Forum\Libraries\User\KunenaUserHelper;
use Kunena\Forum\Libraries\Controller\KunenaController;

/**
* Class AnnouncementListingDisplay
Expand Down Expand Up @@ -68,7 +68,7 @@ protected function before()

if (!$Itemid && $this->config->sefRedirect) {
$itemid = KunenaRoute::fixMissingItemID();
$controller = BaseController::getInstance("kunena");
$controller = new KunenaController();
$controller->setRedirect(KunenaRoute::_("index.php?option=com_kunena&view=announcement&layout=listing&Itemid={$itemid}", false));
$controller->redirect();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
use Joomla\CMS\Cache\CacheControllerFactoryInterface;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Controller\BaseController;
use Kunena\Forum\Libraries\Controller\Application\Display;
use Kunena\Forum\Libraries\Layout\KunenaLayout;
use Kunena\Forum\Libraries\Layout\KunenaPage;
use Kunena\Forum\Libraries\Route\KunenaRoute;
use Kunena\Forum\Libraries\Controller\KunenaController;

/**
* Class ComponentKunenaControllerApplicationMiscDisplay
Expand Down Expand Up @@ -135,7 +135,7 @@ protected function before()
$itemidfix = KunenaRoute::fixMissingItemID();
}

$controller = BaseController::getInstance("kunena");
$controller = new KunenaController();
$controller->setRedirect(KunenaRoute::_("index.php?option=com_kunena&view=misc&Itemid={$itemidfix}", false));
$controller->redirect();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Uri\Uri;
use Joomla\Database\Exception\ExecutionFailureException;
use Joomla\Registry\Registry;
Expand All @@ -34,6 +33,7 @@
use Kunena\Forum\Libraries\Route\KunenaRoute;
use Kunena\Forum\Libraries\User\KunenaUser;
use Kunena\Forum\Libraries\User\KunenaUserHelper;
use Kunena\Forum\Libraries\Controller\KunenaController;

/**
* Class ComponentKunenaControllerApplicationMiscDisplay
Expand Down Expand Up @@ -111,7 +111,7 @@ protected function before()
$this->layout = $this->input->getInt('layout');

if (!$Itemid && $this->config->sefRedirect) {
$controller = BaseController::getInstance("kunena");
$controller = new KunenaController();

if ($this->config->indexId) {
$itemidfix = $this->config->indexId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

use Exception;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Uri\Uri;
use Kunena\Forum\Libraries\Access\KunenaAccess;
use Kunena\Forum\Libraries\Controller\KunenaControllerDisplay;
Expand All @@ -31,6 +30,7 @@
use Kunena\Forum\Libraries\User\KunenaUser;
use Kunena\Forum\Libraries\User\KunenaUserHelper;
use Kunena\Forum\Site\Model\CategoryModel;
use Kunena\Forum\Libraries\Controller\KunenaController;

/**
* Class ComponentKunenaControllerApplicationMiscDisplay
Expand Down Expand Up @@ -109,7 +109,7 @@ protected function before()

if (!$Itemid && $format != 'feed' && $this->config->sefRedirect) {
$itemid = KunenaRoute::fixMissingItemID();
$controller = BaseController::getInstance("kunena");
$controller = new KunenaController();
$controller->setRedirect(KunenaRoute::_("index.php?option=com_kunena&view=category&catid={$catid}&Itemid={$itemid}", false));
$controller->redirect();
}
Expand Down Expand Up @@ -158,7 +158,7 @@ protected function before()

if ($limitstart > 1 && !$this->topics) {
$itemid = KunenaRoute::fixMissingItemID();
$controller = BaseController::getInstance("kunena");
$controller = new KunenaController();
$controller->setRedirect(KunenaRoute::_("index.php?option=com_kunena&view=category&catid={$catid}&Itemid={$itemid}", false));
$controller->redirect();
}
Expand Down
4 changes: 2 additions & 2 deletions src/site/src/Controller/Credits/Display/CreditsDisplay.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
\defined('_JEXEC') or die();

use Exception;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Plugin\PluginHelper;
use Kunena\Forum\Libraries\Controller\KunenaControllerDisplay;
use Kunena\Forum\Libraries\Factory\KunenaFactory;
use Kunena\Forum\Libraries\Route\KunenaRoute;
use Kunena\Forum\Libraries\Controller\KunenaController;

/**
* Class ComponentKunenaControllerApplicationMiscDisplay
Expand Down Expand Up @@ -83,7 +83,7 @@ protected function before()

if (!$Itemid && $this->config->sefRedirect) {
$itemid = KunenaRoute::fixMissingItemID();
$controller = BaseController::getInstance("kunena");
$controller = new KunenaController();
$controller->setRedirect(KunenaRoute::_("index.php?option=com_kunena&view=credits&Itemid={$itemid}", false));
$controller->redirect();
}
Expand Down
5 changes: 2 additions & 3 deletions src/site/src/Controller/Search/Form/SearchFormDisplay.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@
\defined('_JEXEC') or die();

use Exception;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Kunena\Forum\Libraries\Access\KunenaAccess;
use Kunena\Forum\Libraries\Controller\KunenaControllerDisplay;
use Kunena\Forum\Libraries\Route\KunenaRoute;
use Kunena\Forum\Libraries\User\KunenaUserHelper;
use Kunena\Forum\Site\Model\SearchModel;
use Kunena\Forum\Libraries\Controller\KunenaController;

/**
* Class ComponentSearchControllerFormDisplay
Expand Down Expand Up @@ -84,7 +83,7 @@ protected function before()
$itemidfix = KunenaRoute::fixMissingItemID();
}

$controller = BaseController::getInstance("kunena");
$controller = new KunenaController();
$controller->setRedirect(KunenaRoute::_("index.php?option=com_kunena&view=search&Itemid={$itemidfix}", false));
$controller->redirect();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@

use Exception;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Kunena\Forum\Libraries\Controller\KunenaControllerDisplay;
use Kunena\Forum\Libraries\Exception\KunenaExceptionAuthorise;
use Kunena\Forum\Libraries\Factory\KunenaFactory;
use Kunena\Forum\Libraries\Forum\KunenaStatistics;
use Kunena\Forum\Libraries\Route\KunenaRoute;
use Kunena\Forum\Libraries\Controller\KunenaController;

/**
* Class ComponentStatisticsControllerGeneralDisplay
Expand Down Expand Up @@ -104,7 +104,7 @@ protected function before()

if (!$Itemid && $this->config->sefRedirect) {
$itemid = KunenaRoute::fixMissingItemID();
$controller = BaseController::getInstance("kunena");
$controller = new KunenaController();
$controller->setRedirect(KunenaRoute::_("index.php?option=com_kunena&view=statistics&Itemid={$itemid}", false));
$controller->redirect();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@

use Exception;
use Joomla\CMS\Document\HtmlDocument;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Kunena\Forum\Libraries\Attachment\KunenaAttachmentHelper;
use Kunena\Forum\Libraries\Controller\KunenaControllerDisplay;
use Kunena\Forum\Libraries\Exception\KunenaExceptionAuthorise;
Expand All @@ -29,6 +27,7 @@
use Kunena\Forum\Libraries\KunenaPrivate\KunenaPrivateMessage;
use Kunena\Forum\Libraries\Route\KunenaRoute;
use Kunena\Forum\Libraries\User\KunenaUserHelper;
use Kunena\Forum\Libraries\Controller\KunenaController;

/**
* Class ComponentTopicControllerFormCreateDisplay
Expand Down Expand Up @@ -122,7 +121,7 @@ protected function before()
$itemidfix = KunenaRoute::fixMissingItemID();
}

$controller = BaseController::getInstance("kunena");
$controller = new KunenaController();

if ($catid) {
$controller->setRedirect(KunenaRoute::_("index.php?option=com_kunena&view=topic&layout=create&catid={$catid}&Itemid={$itemidfix}", false));
Expand Down
4 changes: 2 additions & 2 deletions src/site/src/Controller/Topic/Item/TopicItemDisplay.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
use Joomla\CMS\Cache\CacheControllerFactoryInterface;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Uri\Uri;
use Joomla\Registry\Registry;
Expand All @@ -44,6 +43,7 @@
use Kunena\Forum\Libraries\User\KunenaUser;
use Kunena\Forum\Libraries\User\KunenaUserHelper;
use stdClass;
use Kunena\Forum\Libraries\Controller\KunenaController;

/**
* Class ComponentTopicControllerItemDisplay
Expand Down Expand Up @@ -133,7 +133,7 @@ protected function before()

if (!$Itemid && $format != 'feed' && $this->config->sefRedirect) {
$itemid = KunenaRoute::fixMissingItemID();
$controller = BaseController::getInstance("kunena");
$controller = new KunenaController();
$controller->setRedirect(KunenaRoute::_("index.php?option=com_kunena&view=topic&catid={$catid}&id={$id}&Itemid={$itemid}", false));
$controller->redirect();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use Exception;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Kunena\Forum\Libraries\Access\KunenaAccess;
use Kunena\Forum\Libraries\Forum\Category\KunenaCategoryHelper;
use Kunena\Forum\Libraries\Forum\Topic\KunenaTopicFinder;
Expand All @@ -27,6 +26,7 @@
use Kunena\Forum\Libraries\User\KunenaUserHelper;
use Kunena\Forum\Site\Controller\Topic\Listing\ListDisplay;
use Kunena\Forum\Libraries\Forum\Message\KunenaMessageHelper;
use Kunena\Forum\Libraries\Controller\KunenaController;

/**
* Class ComponentTopicControllerListDisplay
Expand Down Expand Up @@ -72,7 +72,7 @@ protected function before()
$itemidfix = KunenaRoute::fixMissingItemID();
}

$controller = BaseController::getInstance("kunena");
$controller = new KunenaController();
$controller->setRedirect(KunenaRoute::_("index.php?option=com_kunena&view=topics&layout=moderator&Itemid={$itemidfix}", false));
$controller->redirect();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Joomla\CMS\Date\Date;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Uri\Uri;
use Kunena\Forum\Libraries\Factory\KunenaFactory;
use Kunena\Forum\Libraries\Forum\Category\KunenaCategoryHelper;
Expand All @@ -29,6 +28,7 @@
use Kunena\Forum\Libraries\User\KunenaUserHelper;
use Kunena\Forum\Site\Controller\Topic\Listing\ListDisplay;
use Kunena\Forum\Site\Model\TopicsModel;
use Kunena\Forum\Libraries\Controller\KunenaController;

/**
* Class ComponentTopicControllerListRecentDisplay
Expand Down Expand Up @@ -84,7 +84,7 @@ protected function before()
$itemidfix = KunenaRoute::fixMissingItemID();
}

$controller = BaseController::getInstance("kunena");
$controller = new KunenaController();
$controller->setRedirect(KunenaRoute::_("index.php?option=com_kunena&view=topics&mode={$this->state->get('list.mode')}&Itemid={$itemidfix}", false));
$controller->redirect();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
use Joomla\CMS\Date\Date;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Kunena\Forum\Libraries\Access\KunenaAccess;
use Kunena\Forum\Libraries\Factory\KunenaFactory;
use Kunena\Forum\Libraries\Forum\Topic\KunenaTopicFinder;
Expand All @@ -30,6 +29,7 @@
use Kunena\Forum\Libraries\User\KunenaUserHelper;
use Kunena\Forum\Site\Controller\Topic\Listing\ListDisplay;
use Kunena\Forum\Site\Model\TopicsModel;
use Kunena\Forum\Libraries\Controller\KunenaController;

/**
* Class ComponentTopicControllerListDisplay
Expand Down Expand Up @@ -103,7 +103,7 @@ protected function before()
$itemidfix = KunenaRoute::fixMissingItemID();
}

$controller = BaseController::getInstance("kunena");
$controller = new KunenaController();
$controller->setRedirect(KunenaRoute::_("index.php?option=com_kunena&view=topics&layout=unread&Itemid={$itemidfix}", false));
$controller->redirect();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Joomla\CMS\Date\Date;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Uri\Uri;
use Kunena\Forum\Libraries\Factory\KunenaFactory;
use Kunena\Forum\Libraries\Forum\Category\KunenaCategoryHelper;
Expand All @@ -29,6 +28,7 @@
use Kunena\Forum\Libraries\User\KunenaUserHelper;
use Kunena\Forum\Site\Controller\Topic\Listing\ListDisplay;
use Kunena\Forum\Site\Model\TopicsModel;
use Kunena\Forum\Libraries\Controller\KunenaController;

/**
* Class ComponentTopicControllerListUserDisplay
Expand Down Expand Up @@ -151,7 +151,7 @@ protected function before()
$format = $this->input->getCmd('format');

if (!$Itemid && $format != 'feed') {
$controller = BaseController::getInstance("kunena");
$controller = new KunenaController();

if ($this->config->profileId) {
$itemidfix = $this->config->profileId;
Expand Down
4 changes: 2 additions & 2 deletions src/site/src/Controller/User/Item/UserItemDisplay.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use Exception;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\User\User;
use Joomla\CMS\User\UserFactoryInterface;
Expand All @@ -31,6 +30,7 @@
use Kunena\Forum\Libraries\User\KunenaUser;
use Kunena\Forum\Libraries\User\KunenaUserHelper;
use Kunena\Forum\Site\Model\UserModel;
use Kunena\Forum\Libraries\Controller\KunenaController;

/**
* Class ComponentUserControllerItemDisplay
Expand Down Expand Up @@ -149,7 +149,7 @@ protected function before()
$format = $this->input->getCmd('format');

if (!$Itemid && $format != 'feed' && $this->config->sefRedirect) {
$controller = BaseController::getInstance("kunena");
$controller = new KunenaController();

if ($this->config->profileId) {
$itemidfix = $this->config->profileId;
Expand Down
Loading

0 comments on commit ef0d777

Please sign in to comment.