forked from AgenturPottkinder/typo3_forum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Make User profile displayable again
- Loading branch information
1 parent
b5b3a5f
commit 1964963
Showing
21 changed files
with
381 additions
and
617 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = tab | ||
indent_size = 4 | ||
|
||
[Makefile] | ||
indent_style = tab | ||
|
||
[*.yml] | ||
indent_size = 2 | ||
|
||
[*.conf] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,7 @@ | |
/* * | ||
* COPYRIGHT NOTICE * | ||
* * | ||
* (c) 2013 Martin Helmich <[email protected]> * | ||
* Sebastian Gieselmann <[email protected]> * | ||
* Ruven Fehling <[email protected]> * | ||
* Mittwald CM Service GmbH & Co KG * | ||
* (c) 2015 Mittwald CM Service GmbH & Co KG * | ||
* All rights reserved * | ||
* * | ||
* This script is part of the TYPO3 project. The TYPO3 project is * | ||
|
@@ -28,71 +25,49 @@ | |
* */ | ||
|
||
|
||
use Mittwald\Typo3Forum\Domain\Exception\Authentication\NoAccessException; | ||
use Mittwald\Typo3Forum\Domain\Exception\Authentication\NotLoggedInException; | ||
|
||
class ForumController extends AbstractController { | ||
|
||
/** | ||
* A forum repository. | ||
* @var \TYPO3\CMS\Core\Database\DatabaseConnection | ||
*/ | ||
protected $databaseConnection; | ||
|
||
/** | ||
* @var \Mittwald\Typo3Forum\Domain\Repository\Forum\ForumRepository | ||
* @inject | ||
*/ | ||
protected $forumRepository; | ||
|
||
|
||
/** | ||
* A topic repository. | ||
* @var \Mittwald\Typo3Forum\Domain\Repository\Forum\TopicRepository | ||
* @inject | ||
*/ | ||
protected $topicRepository; | ||
|
||
|
||
/** | ||
* The ads repository. | ||
* @var \Mittwald\Typo3Forum\Domain\Repository\Forum\AdsRepository | ||
* @inject | ||
*/ | ||
protected $adsRepository; | ||
|
||
/** | ||
* The virtual root forum. | ||
* @var \Mittwald\Typo3Forum\Domain\Model\Forum\RootForum | ||
* @inject | ||
*/ | ||
protected $rootForum; | ||
|
||
|
||
// | ||
// DEPENDENCY INJECTION METHODS | ||
// | ||
|
||
|
||
|
||
/** | ||
* Constructor of this controller. Needs to get all required repositories injected. | ||
* | ||
* @param \Mittwald\Typo3Forum\Domain\Repository\Forum\ForumRepository $forumRepository An instance of the forum repository. | ||
* @param \Mittwald\Typo3Forum\Domain\Repository\Forum\TopicRepository $topicRepository An instance of the topic repository. | ||
* @param \Mittwald\Typo3Forum\Domain\Model\Forum\RootForum $rootForum An instance of the virtual root forum. | ||
* @param \Mittwald\Typo3Forum\Service\SessionHandlingService $sessionHandling | ||
* @param \Mittwald\Typo3Forum\Domain\Repository\Forum\AdsRepository $adsRepository | ||
*/ | ||
public function __construct(\Mittwald\Typo3Forum\Domain\Repository\Forum\ForumRepository $forumRepository, | ||
\Mittwald\Typo3Forum\Domain\Repository\Forum\TopicRepository $topicRepository, | ||
\Mittwald\Typo3Forum\Domain\Model\Forum\RootForum $rootForum, | ||
\Mittwald\Typo3Forum\Service\SessionHandlingService $sessionHandling, | ||
\Mittwald\Typo3Forum\Domain\Repository\Forum\AdsRepository $adsRepository) { | ||
parent::__construct(); | ||
$this->forumRepository = $forumRepository; | ||
$this->topicRepository = $topicRepository; | ||
$this->rootForum = $rootForum; | ||
$this->sessionHandling = $sessionHandling; | ||
$this->adsRepository = $adsRepository; | ||
public function initializeAction() { | ||
$this->databaseConnection = $GLOBALS['TYPO3_DB']; | ||
} | ||
|
||
|
||
|
||
// | ||
// ACTION METHODS | ||
// | ||
|
||
|
||
|
||
/** | ||
* Index action. Displays the first two levels of the forum tree. | ||
* @return void | ||
|
@@ -103,8 +78,6 @@ public function indexAction() { | |
$this->view->assign('forums', $forums); | ||
} | ||
|
||
|
||
|
||
/** | ||
* Show action. Displays a single forum, all subforums of this forum and the | ||
* topics contained in this forum. | ||
|
@@ -127,8 +100,6 @@ public function showAction(\Mittwald\Typo3Forum\Domain\Model\Forum\Forum $forum) | |
->assign('topics', $topics); | ||
} | ||
|
||
|
||
|
||
/** | ||
* Updates a forum. | ||
* This action method updates a forum. Admin authorization is required. | ||
|
@@ -146,23 +117,21 @@ public function updateAction(\Mittwald\Typo3Forum\Domain\Model\Forum\Forum $foru | |
$this->redirect('index'); | ||
} | ||
|
||
|
||
|
||
/** | ||
* Creates a forum. | ||
* This action method creates a new forum. Admin authorization is required for | ||
* creating child forums, root forums may only be created from backend. | ||
* | ||
* @param \Mittwald\Typo3Forum\Domain\Model\Forum\Forum $forum The forum to be created. | ||
* | ||
* @throws \Mittwald\Typo3Forum\Domain\Exception\Authentication\NoAccessException | ||
* @throws NoAccessException | ||
* @dontverifyrequesthash | ||
*/ | ||
public function createAction(\Mittwald\Typo3Forum\Domain\Model\Forum\Forum $forum) { | ||
if ($forum->getParent() !== NULL) { | ||
$this->authenticationService->assertAdministrationAuthorization($forum->getParent()); | ||
} /** @noinspection PhpUndefinedConstantInspection */ elseif (TYPO3_MODE !== 'BE') { | ||
throw new \Mittwald\Typo3Forum\Domain\Exception\Authentication\NoAccessException('This operation is allowed only from the TYPO3 backend.'); | ||
throw new NoAccessException('This operation is allowed only from the TYPO3 backend.'); | ||
} | ||
|
||
$this->forumRepository->add($forum); | ||
|
@@ -177,13 +146,13 @@ public function createAction(\Mittwald\Typo3Forum\Domain\Model\Forum\Forum $foru | |
* Mark a whole forum as read | ||
* @param \Mittwald\Typo3Forum\Domain\Model\Forum\Forum $forum | ||
* | ||
* @throws \Mittwald\Typo3Forum\Domain\Exception\Authentication\NotLoggedInException | ||
* @throws NotLoggedInException | ||
* @return void | ||
*/ | ||
public function markReadAction(\Mittwald\Typo3Forum\Domain\Model\Forum\Forum $forum) { | ||
$user = $this->getCurrentUser(); | ||
if ($user->isAnonymous()) { | ||
throw new \Mittwald\Typo3Forum\Domain\Exception\Authentication\NotLoggedInException("You need to be logged in.", 1288084981); | ||
throw new NotLoggedInException("You need to be logged in.", 1288084981); | ||
} | ||
$forumStorage = array(); | ||
$forumStorage[] = $forum; | ||
|
@@ -192,6 +161,7 @@ public function markReadAction(\Mittwald\Typo3Forum\Domain\Model\Forum\Forum $fo | |
} | ||
|
||
foreach($forumStorage AS $checkForum) { | ||
/** @var \Mittwald\Typo3Forum\Domain\Model\Forum\Forum $checkForum */ | ||
if(intval($this->settings['useSqlStatementsOnCriticalFunctions']) == 0) { | ||
foreach($checkForum->getTopics() AS $topic) { | ||
$topic->addReader($user); | ||
|
@@ -202,8 +172,7 @@ public function markReadAction(\Mittwald\Typo3Forum\Domain\Model\Forum\Forum $fo | |
foreach($topics AS $topic) { | ||
$values = array('uid_foreign' => intval($topic['uid']), | ||
'uid_local' => intval($user->getUid())); | ||
$query = $GLOBALS['TYPO3_DB']->INSERTquery('tx_typo3forum_domain_model_user_readtopic',$values); | ||
$res = $GLOBALS['TYPO3_DB']->sql_query($query); | ||
$this->databaseConnection->exec_INSERTquery('tx_typo3forum_domain_model_user_readtopic', $values); | ||
} | ||
} | ||
|
||
|
@@ -219,13 +188,13 @@ public function markReadAction(\Mittwald\Typo3Forum\Domain\Model\Forum\Forum $fo | |
* Show all unread topics of the current user | ||
* @param \Mittwald\Typo3Forum\Domain\Model\Forum\Forum $forum | ||
* | ||
* @throws \Mittwald\Typo3Forum\Domain\Exception\Authentication\NotLoggedInException | ||
* @throws NotLoggedInException | ||
* @return void | ||
*/ | ||
public function showUnreadAction(\Mittwald\Typo3Forum\Domain\Model\Forum\Forum $forum) { | ||
$user = $this->getCurrentUser(); | ||
if ($user->isAnonymous()) { | ||
throw new \Mittwald\Typo3Forum\Domain\Exception\Authentication\NotLoggedInException("You need to be logged in.", 1288084981); | ||
throw new NotLoggedInException("You need to be logged in.", 1288084981); | ||
} | ||
$topics = array(); | ||
$unreadTopics = array(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
<?php | ||
namespace Mittwald\Typo3Forum\Controller; | ||
|
||
/* * | ||
* COPYRIGHT NOTICE * | ||
* * | ||
* (c) 2013 Martin Helmich <[email protected]> * | ||
* Sebastian Gieselmann <[email protected]> * | ||
* Ruven Fehling <[email protected]> * | ||
* Mittwald CM Service GmbH & Co KG * | ||
* (c) 2015 Mittwald CM Service GmbH & Co KG * | ||
* All rights reserved * | ||
* * | ||
* This script is part of the TYPO3 project. The TYPO3 project is * | ||
|
@@ -26,134 +24,57 @@ | |
* This copyright notice MUST APPEAR in all copies of the script! * | ||
* */ | ||
|
||
|
||
/** | ||
* | ||
* This class implements a simple dispatcher for a mm_form eID script. | ||
* | ||
* @author Martin Helmich <[email protected]> | ||
* @author Sebastian Gieselmann <[email protected]> | ||
* @author Ruven Fehling <[email protected]> | ||
* @package Typo3Forum | ||
* @subpackage Controller | ||
* @version $Id$ | ||
* | ||
* @copyright 2012 Martin Helmich <[email protected]> | ||
* Mittwald CM Service GmbH & Co. KG | ||
* http://www.mittwald.de | ||
* @license GNU Public License, version 2 | ||
* http://opensource.org/licenses/gpl-license.php | ||
* | ||
*/ | ||
class UserController extends \Mittwald\Typo3Forum\Controller\AbstractController { | ||
|
||
|
||
|
||
/* | ||
* ATTRIBUTES | ||
*/ | ||
|
||
|
||
class UserController extends AbstractController { | ||
|
||
/** | ||
* The userfield repository. | ||
* @var \Mittwald\Typo3Forum\Domain\Repository\User\UserfieldRepository | ||
* @inject | ||
*/ | ||
protected $userfieldRepository = NULL; | ||
|
||
|
||
/** | ||
* The topic repository. | ||
* @var \Mittwald\Typo3Forum\Domain\Repository\Forum\TopicRepository | ||
* @inject | ||
*/ | ||
protected $topicRepository = NULL; | ||
|
||
|
||
/** | ||
* The forum repository. | ||
* @var \Mittwald\Typo3Forum\Domain\Repository\Forum\ForumRepository | ||
* @inject | ||
*/ | ||
protected $forumRepository = NULL; | ||
|
||
|
||
|
||
/** | ||
* The forum repository. | ||
* @var \Mittwald\Typo3Forum\Domain\Repository\User\PrivateMessagesRepository | ||
* @inject | ||
*/ | ||
protected $messageRepository = NULL; | ||
|
||
|
||
/** | ||
* A message factory. | ||
* @var \Mittwald\Typo3Forum\Domain\Factory\User\PrivateMessagesFactory | ||
* @inject | ||
*/ | ||
protected $privateMessagesFactory; | ||
|
||
|
||
/** | ||
* The rank repository. | ||
* @var \Mittwald\Typo3Forum\Domain\Repository\User\RankRepository | ||
* @inject | ||
*/ | ||
protected $rankRepository = NULL; | ||
|
||
|
||
/** | ||
* The notification repository. | ||
* @var \Mittwald\Typo3Forum\Domain\Repository\User\NotificationRepository | ||
* @inject | ||
*/ | ||
protected $notificationRepository = NULL; | ||
|
||
|
||
/* | ||
* DEPENDENCY INJECTORS | ||
*/ | ||
|
||
|
||
|
||
/** | ||
* Constructor. Used primarily for dependency injection. | ||
* | ||
* @param \\Mittwald\Typo3Forum\Domain\Repository\Forum\ForumRepository $forumRepository | ||
* An instance of the forum repository. | ||
* @param \\Mittwald\Typo3Forum\Domain\Repository\Forum\TopicRepository $topicRepository | ||
* An instance of the topic repository. | ||
* @param \\Mittwald\Typo3Forum\Domain\Repository\User\UserfieldRepository $userfieldRepository | ||
* An instance of the userfield repository. | ||
* @param \Mittwald\Typo3Forum\Domain\Repository\User\PrivateMessagesRepository $messageRepository | ||
* An instance of the private message repository. | ||
* @param \Mittwald\Typo3Forum\Domain\Factory\User\PrivateMessagesFactory $privateMessagesFactory | ||
* An instance of the private message factory | ||
* @param \Mittwald\Typo3Forum\Domain\Repository\User\RankRepository $rankRepository | ||
* An instance of the rank repository | ||
* @param \Mittwald\Typo3Forum\Domain\Repository\User\NotificationRepository | ||
* An instance of the notification repository | ||
*/ | ||
public function __construct(\Mittwald\Typo3Forum\Domain\Repository\Forum\ForumRepository $forumRepository, | ||
\Mittwald\Typo3Forum\Domain\Repository\Forum\TopicRepository $topicRepository, | ||
\Mittwald\Typo3Forum\Domain\Repository\User\UserfieldRepository $userfieldRepository, | ||
\Mittwald\Typo3Forum\Domain\Repository\User\PrivateMessagesRepository $messageRepository, | ||
\Mittwald\Typo3Forum\Domain\Factory\User\PrivateMessagesFactory $privateMessagesFactory, | ||
\Mittwald\Typo3Forum\Domain\Repository\User\RankRepository $rankRepository, | ||
\Mittwald\Typo3Forum\Domain\Repository\User\NotificationRepository $notificationRepository) { | ||
parent::__construct(); | ||
$this->forumRepository = $forumRepository; | ||
$this->topicRepository = $topicRepository; | ||
$this->userfieldRepository = $userfieldRepository; | ||
$this->messageRepository = $messageRepository; | ||
$this->privateMessagesFactory = $privateMessagesFactory; | ||
$this->rankRepository = $rankRepository; | ||
$this->notificationRepository = $notificationRepository; | ||
} | ||
|
||
|
||
|
||
/* | ||
* ACTION METHODS | ||
*/ | ||
|
||
|
||
|
||
/** | ||
* Displays a list of all existing users. | ||
* @return void | ||
|
Oops, something went wrong.