Skip to content

Commit

Permalink
IP Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hhunderter committed Mar 20, 2024
1 parent da2962a commit 5f327a0
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
8 changes: 7 additions & 1 deletion config/config.php
Expand Up @@ -14,7 +14,7 @@ class Config extends \Ilch\Config\Install
{
public $config = [
'key' => 'radiohoerercharts',
'version' => '1.8.2',
'version' => '1.8.3',
'icon_small' => 'fa-solid fa-list-ol',
'author' => 'Reilard, Dennis alias hhunderter',
'link' => 'https://github.com/hhunderter/radiohoerercharts',
Expand Down Expand Up @@ -358,6 +358,12 @@ public function getUpdate(string $installedVersion): string
*/
// no break
case "1.8.2":
// update zu 1.8.3
/*
* IP Adresse wurde nicht gespeichert
*/
// no break
case "1.8.3":
// update zu 1.?.?
/*
*/
Expand Down
2 changes: 2 additions & 0 deletions controllers/Index.php
Expand Up @@ -101,6 +101,8 @@ public function indexAction()
if ($validation->isValid() && $validation_indb->isValid()) {
$validation->getErrorBag()->addError('hoerercharts-d', 'Manipulation');
}

$this->addMessage($validation->getErrorBag()->getErrorMessages(), 'danger', true);
$this->redirect()
->withInput()
->withErrors($validation->getErrorBag())
Expand Down
4 changes: 3 additions & 1 deletion mappers/HoererChartsUserVotes.php
Expand Up @@ -116,6 +116,7 @@ public function save(EntriesModel $model): int
->values($fields)
->execute();
}

return $result;
}

Expand Down Expand Up @@ -257,7 +258,7 @@ public function getEntryByUserSessionIp(?\Modules\User\Models\User $User = null)
if (!$voteId && $User_Id === 0) {
$voteId = (int) $this->db()->select('id')
->from($this->tablename)
->Where(['ip_address' => $ip])
->Where(['ip_address' => $ip, 'user_id' => 0])
->execute()
->fetchCell();
}
Expand Down Expand Up @@ -319,6 +320,7 @@ public function isVoted(?\Modules\User\Models\User $User = null): bool
$entryModel->setUserId($User_Id);
}
$entryModel->setSessionId(session_id());
$entryModel->setIp($this->getIp());
$this->save($entryModel);
return $returnvalue;
} else {
Expand Down
4 changes: 2 additions & 2 deletions models/HoererChartsList.php
Expand Up @@ -161,8 +161,8 @@ public function getArray(bool $withId = true): array
return array_merge(
($withId ? ['id' => $this->getId()] : []),
[
'hid' => $this->getHId(),
'list' => $this->getList(),
'hid' => $this->getHId(),
'list' => $this->getList(),
]
);
}
Expand Down
6 changes: 3 additions & 3 deletions models/HoererChartsUserVotes.php
Expand Up @@ -186,10 +186,10 @@ public function getArray(bool $withId = true): array
return array_merge(
($withId ? ['id' => $this->getId()] : []),
[
'user_id' => $this->getUserId(),
'session_id' => $this->getSessionId(),
'user_id' => $this->getUserId(),
'session_id' => $this->getSessionId(),
'last_activity' => $this->getLastActivity(),
'ip_address' => $this->getIp(),
'ip_address' => $this->getIp(),
]
);
}
Expand Down

0 comments on commit 5f327a0

Please sign in to comment.