Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sg_mail
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TYPO3
sg_mail
Commits
0a2f68e1
Commit
0a2f68e1
authored
7 years ago
by
Torsten Oppermann
Browse files
Options
Downloads
Patches
Plain Diff
[TASK] Refactoring some code, exception handling
parent
15859bab
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!2
Feature multiclient
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Classes/Controller/MailController.php
+28
-13
28 additions, 13 deletions
Classes/Controller/MailController.php
with
28 additions
and
13 deletions
Classes/Controller/MailController.php
+
28
−
13
View file @
0a2f68e1
...
...
@@ -71,14 +71,14 @@ class MailController extends ActionController {
* @param string $selectedExtension
* @param string $selectedLanguageLeft
* @param string $selectedLanguageRight
* @param string $selectedExtensionKey
* @param string $selectedTemplateKey
* @throws \InvalidArgumentException
* @throws \UnexpectedValueException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
*/
public
function
indexAction
(
$selectedTemplate
=
NULL
,
$selectedExtension
=
NULL
,
$selectedLanguageLeft
=
NULL
,
$selectedLanguageRight
=
NULL
,
$selectedExtensionKey
=
NULL
,
$selectedTemplateKey
=
NULL
$selectedLanguageRight
=
NULL
)
{
$siteRoot
=
BackendService
::
getSiteRoot
((
int
)
GeneralUtility
::
_GP
(
'id'
));
$siteRootId
=
$siteRoot
[
'uid'
];
...
...
@@ -106,20 +106,24 @@ class MailController extends ActionController {
// get last selected languages
if
(
$selectedLanguageLeft
===
NULL
)
{
$selectedLanguageLeft
=
$this
->
session
->
getDataByKey
(
'selectedLanguageLeft'
);
if
(
$selectedLanguageLeft
===
NULL
)
{
$selectedLanguageLeft
FromSession
=
$this
->
session
->
getDataByKey
(
'selectedLanguageLeft'
);
if
(
$selectedLanguageLeft
FromSession
===
NULL
)
{
$selectedLanguageLeft
=
$languages
[
0
];
}
else
{
$selectedLanguageLeft
=
$selectedLanguageLeftFromSession
;
}
}
if
(
$selectedLanguageRight
===
NULL
)
{
$selectedLanguageRight
=
$this
->
session
->
getDataByKey
(
'selectedLanguageRight'
);
if
(
$selectedLanguageRight
===
NULL
)
{
$selectedLanguageRight
FromSession
=
$this
->
session
->
getDataByKey
(
'selectedLanguageRight'
);
if
(
$selectedLanguageRight
FromSession
===
NULL
)
{
if
(
isset
(
$languages
[
1
]))
{
$selectedLanguageRight
=
$languages
[
1
];
}
else
{
$selectedLanguageRight
=
$languages
[
0
];
}
}
else
{
$selectedLanguageRight
=
$selectedLanguageRightFromSession
;
}
}
...
...
@@ -184,12 +188,10 @@ class MailController extends ActionController {
$langFile
=
GeneralUtility
::
readLLfile
(
'EXT:'
.
$selectedExtension
.
'/Resources/Private/Language/locallang.xlf'
,
$selectedLanguageLeft
);
$translatedSubject
=
''
;
$translatedSubject
=
$langFile
[
'default'
][
$subject
][
0
][
'target'
];
if
(
$langFile
[
$selectedLanguageLeft
][
$subject
][
0
])
{
$translatedSubject
=
$langFile
[
$selectedLanguageLeft
][
$subject
][
0
][
'target'
];
}
else
{
$translatedSubject
=
$langFile
[
'default'
][
$subject
][
0
][
'target'
];
}
$this
->
view
->
assign
(
...
...
@@ -200,12 +202,10 @@ class MailController extends ActionController {
$langFile
=
GeneralUtility
::
readLLfile
(
'EXT:'
.
$selectedExtension
.
'/Resources/Private/Language/locallang.xlf'
,
$selectedLanguageRight
);
$translatedSubject
=
''
;
$translatedSubject
=
$langFile
[
'default'
][
$subject
][
0
][
'target'
];
if
(
$langFile
[
$selectedLanguageLeft
][
$subject
][
0
][
$subject
])
{
$translatedSubject
=
$langFile
[
$selectedLanguageRight
][
$subject
][
0
][
'target'
];
}
else
{
$translatedSubject
=
$langFile
[
'default'
][
$subject
][
0
][
'target'
];
}
$this
->
view
->
assign
(
...
...
@@ -272,6 +272,11 @@ class MailController extends ActionController {
* @param string $ccRight
* @param string $bccRight
* @param string $replyToRight
* @throws \InvalidArgumentException
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
*/
public
function
saveAction
(
$contentLeft
=
NULL
,
$contentRight
=
NULL
,
$selectedExtension
=
NULL
,
$selectedTemplate
=
NULL
,
...
...
@@ -310,6 +315,9 @@ class MailController extends ActionController {
* @param string $selectedBcc
* @param string $selectedReplyTo
* @return Template $template
* @throws \InvalidArgumentException
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException
*/
private
function
saveTemplate
(
$selectedExtension
,
$selectedTemplate
,
$selectedLanguage
,
$selectedContent
,
$selectedSubject
,
...
...
@@ -360,6 +368,10 @@ class MailController extends ActionController {
* @param string $selectedExtensionKey
* @param string $selectedLanguageLeft
* @param string $selectedLanguageRight
* @throws \InvalidArgumentException
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
*/
public
function
sendTestMailAction
(
$emailAddress
,
$selectedExtensionKey
,
$selectedTemplateKey
,
$selectedLanguageLeft
,
$selectedLanguageRight
...
...
@@ -410,6 +422,9 @@ class MailController extends ActionController {
* @param string $template
* @param string $extensionKey
* @param string $language
* @throws \InvalidArgumentException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
*/
public
function
resetAction
(
$template
,
$extensionKey
,
$language
=
''
)
{
$this
->
templateRepository
->
deleteTemplate
(
$extensionKey
,
$template
,
$language
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment