Commit e44e9268 authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

[TASK] Cleanup

parent 57d02059
......@@ -25,7 +25,6 @@
namespace SGalinski\SgMail\Controller;
use SGalinski\SgMail\Service\BackendService;
use SGalinski\SgMail\Service\RegisterService;
use TYPO3\CMS\Backend\Template\Components\ButtonBar;
use TYPO3\CMS\Backend\Template\Components\DocHeaderComponent;
......@@ -37,7 +36,6 @@ use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Mvc\Request;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use function count;
......
......@@ -27,21 +27,14 @@ namespace SGalinski\SgMail\Service;
use InvalidArgumentException;
use SGalinski\SgMail\Domain\Repository\FrontendUserGroupRepository;
use SGalinski\SgMail\Domain\Repository\MailRepository;
use TYPO3\CMS\Backend\Template\Components\ButtonBar;
use TYPO3\CMS\Backend\Template\Components\DocHeaderComponent;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
use TYPO3\CMS\Extbase\Mvc\Request;
use TYPO3\CMS\Extbase\Object\Exception;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use UnexpectedValueException;
use function count;
use function in_array;
......
<?php
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
namespace SGalinski\SgMail\Session;
use TYPO3\CMS\Core\SingletonInterface;
/**
* PHP Session handler
*/
class PhpSession implements SingletonInterface {
/**
* @var string
*/
protected $sessionKey;
/**
* Constructor
*/
public function __construct() {
session_start();
$this->sessionKey = uniqid('sgalinski', TRUE);
}
/**
* @param string $sessionKey
* @return void
*/
public function setSessionKey(string $sessionKey): void {
$this->sessionKey = $sessionKey;
}
/**
* Returns the current session key
*
* @return string
*/
public function getSessionKey(): string {
return $this->sessionKey;
}
/**
* Exchanges the complete session data
*
* @param mixed $data
* @return void
*/
public function exchangeData($data): void {
$this->destroy();
$_SESSION[$this->sessionKey] = $data;
}
/**
* Returns the complete session data
*
* @return mixed
*/
public function getData() {
return $_SESSION[$this->sessionKey];
}
/**
* Sets data inside the session below the given key
*
* @param string $key
* @param mixed $data
* @return void
*/
public function setDataByKey(string $key, $data): void {
$_SESSION[$this->sessionKey][$key] = $data;
}
/**
* Returns data of the session defined by the given key
*
* @param string $key
* @return mixed
*/
public function getDataByKey(string $key) {
return $_SESSION[$this->sessionKey][$key];
}
/**
* Removes data defined by the given key.
*
* @param string $key
* @return void
*/
public function unsetDataByKey(string $key): void {
unset($_SESSION[$this->sessionKey][$key]);
}
/**
* Removes all session data
*
* @return void
*/
public function destroy(): void {
unset($_SESSION[$this->sessionKey]);
}
}
......@@ -31,6 +31,11 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite;
use TYPO3\CMS\Install\Updates\UpgradeWizardInterface;
/**
* Class LanguageMigrationUpdate
*
* @package SGalinski\SgMail\Updates
*/
class LanguageMigrationUpdate implements UpgradeWizardInterface {
public const IDENTIFIER = 'sgmail_languagemigrationupdate';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment