Commit 622cbe71 authored by Tino Goratsch's avatar Tino Goratsch

bug fixes and minor improvements

parent e532ad43
......@@ -83,16 +83,16 @@ class Create extends AbstractFrontendAction
{
return $this->actionHelper->handlePostAction(
function () use ($formData, $module, $entryId) {
$ip = $this->request->getServer()->get('REMOTE_ADDR', '');
$ipAddress = $this->request->getSymfonyRequest()->getClientIp();
$this->formValidation
->setIpAddress($ip)
->setIpAddress($ipAddress)
->validate($formData);
$insertValues = [
'id' => '',
'date' => $this->date->toSQL(),
'ip' => $ip,
'ip' => $ipAddress,
'name' => $this->get('core.helpers.secure')->strEncode($formData['name']),
'user_id' => $this->user->isAuthenticated() === true ? $this->user->getUserId() : null,
'message' => $this->get('core.helpers.secure')->strEncode($formData['message']),
......
......@@ -130,15 +130,17 @@ class Create extends AbstractAction
{
return $this->actionHelper->handlePostAction(
function () use ($formData) {
$ipAddress = $this->request->getSymfonyRequest()->getClientIp();
$this->formValidation
->setIpAddress($this->request->getServer()->get('REMOTE_ADDR', ''))
->setIpAddress($ipAddress)
->setNewsletterAccess($this->newsletterActive)
->validate($formData);
$insertValues = [
'id' => '',
'date' => $this->date->toSQL(),
'ip' => $this->request->getServer()->get('REMOTE_ADDR', ''),
'ip' => $ipAddress,
'name' => $this->get('core.helpers.secure')->strEncode($formData['name']),
'user_id' => $this->user->isAuthenticated() ? $this->user->getUserId() : null,
'message' => $this->get('core.helpers.secure')->strEncode($formData['message']),
......
{$LAYOUT='Guestbook/layout.midal.tpl'}
{$LAYOUT='Guestbook/layout.modal.tpl'}
{extends file="asset:System/layout.ajax-form.tpl"}
......
......@@ -88,12 +88,12 @@ class Index extends Core\Controller\AbstractFrontendAction
$query = $this->voteRepository->getVotesByUserId(
$pollId,
$this->user->getUserId(),
$this->request->getServer()->get('REMOTE_ADDR', '')
$this->request->getSymfonyRequest()->getClientIp()
);
} else { // For guest users check against the IP-address
$query = $this->voteRepository->getVotesByIpAddress(
$pollId,
$this->request->getServer()->get('REMOTE_ADDR', '')
$this->request->getSymfonyRequest()->getClientIp()
);
}
......
......@@ -99,7 +99,7 @@ class Vote extends Core\Controller\AbstractFrontendAction
{
return $this->actionHelper->handlePostAction(
function () use ($formData, $time, $pollId) {
$ipAddress = $this->request->getServer()->get('REMOTE_ADDR', '');
$ipAddress = $this->request->getSymfonyRequest()->getClientIp();
$this->voteValidation
->setPollId($pollId)
......
......@@ -100,12 +100,12 @@ class Index extends Core\Controller\AbstractWidgetAction
$votes = $this->voteRepository->getVotesByUserId(
$pollId,
$this->user->getUserId(),
$this->request->getServer()->get('REMOTE_ADDR', '')
$this->request->getSymfonyRequest()->getClientIp()
);
} else { // For guest users check against the ip address
$votes = $this->voteRepository->getVotesByIpAddress(
$pollId,
$this->request->getServer()->get('REMOTE_ADDR', '')
$this->request->getSymfonyRequest()->getClientIp()
);
}
......
Markdown is supported
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