Compare commits
7 Commits
88cf11d45d
...
9ee8ae39df
Author | SHA1 | Date |
---|---|---|
tracer | 9ee8ae39df | |
tracer | 70aa4d1f06 | |
tracer | 2f99531780 | |
tracer | 60860a0bce | |
tracer | bb3d0f6e1b | |
tracer | 7ee8e8860e | |
tracer | 32dcab7592 |
|
@ -12,6 +12,11 @@ ini_set(option: 'display_startup_errors', value: 1);
|
||||||
// no one sane should ignore deprecations
|
// no one sane should ignore deprecations
|
||||||
error_reporting(error_level: E_ALL);
|
error_reporting(error_level: E_ALL);
|
||||||
|
|
||||||
|
// just during dev
|
||||||
|
opcache_reset();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
require dirname(path: __DIR__) . '/src/bootstrap.php';
|
require dirname(path: __DIR__) . '/src/bootstrap.php';
|
||||||
|
|
|
@ -32,6 +32,7 @@ class SecurityController
|
||||||
$password = $_POST['password'] ?? '';
|
$password = $_POST['password'] ?? '';
|
||||||
|
|
||||||
if ($nick && $password) {
|
if ($nick && $password) {
|
||||||
|
$nick = strtolower(string: $nick);
|
||||||
if ($user = $this->userRepository->findbyNick(nick: $nick)) {
|
if ($user = $this->userRepository->findbyNick(nick: $nick)) {
|
||||||
if (password_verify(password: $password, hash: $user->getPassword())) {
|
if (password_verify(password: $password, hash: $user->getPassword())) {
|
||||||
$_SESSION['user_id'] = $user->getId();
|
$_SESSION['user_id'] = $user->getId();
|
||||||
|
|
|
@ -105,7 +105,6 @@ class AddressRepository
|
||||||
public function update(AddressBookEntry $address): bool|int
|
public function update(AddressBookEntry $address): bool|int
|
||||||
{
|
{
|
||||||
$id = $address->getId();
|
$id = $address->getId();
|
||||||
$owner = $address->getOwner();
|
|
||||||
$first = $address->getFirst();
|
$first = $address->getFirst();
|
||||||
$last = $address->getLast();
|
$last = $address->getLast();
|
||||||
$street = $address->getStreet();
|
$street = $address->getStreet();
|
||||||
|
|
|
@ -71,6 +71,8 @@ class UserRepository
|
||||||
|
|
||||||
public function findByNick(string $nick): ?User
|
public function findByNick(string $nick): ?User
|
||||||
{
|
{
|
||||||
|
$nick = strtolower(string: $nick);
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT id, nick, password, first, last, is_admin
|
SELECT id, nick, password, first, last, is_admin
|
||||||
FROM " . DatabaseConnection::TABLE_USERS . "
|
FROM " . DatabaseConnection::TABLE_USERS . "
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
|
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -84,7 +84,7 @@ class Router
|
||||||
|
|
||||||
foreach ($this->dynamicRoutes as $route) {
|
foreach ($this->dynamicRoutes as $route) {
|
||||||
// PHPStorm doesn't know that $parameters are always available,
|
// PHPStorm doesn't know that $parameters are always available,
|
||||||
// (as it is a dynamic route) so I init the array just to make PHPStorm happy.
|
// (as it this are dynamic routes) so I init the array just to make PHPStorm happy.
|
||||||
$parameters = [];
|
$parameters = [];
|
||||||
if (preg_match(pattern: $route->getRegex(), subject: $requestUri, matches: $matches)) {
|
if (preg_match(pattern: $route->getRegex(), subject: $requestUri, matches: $matches)) {
|
||||||
foreach ($route->getParameters() as $id => $parameter) {
|
foreach ($route->getParameters() as $id => $parameter) {
|
||||||
|
|
|
@ -13,8 +13,6 @@ namespace App\Service;
|
||||||
* using PHP as a templating engine.
|
* using PHP as a templating engine.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use JetBrains\PhpStorm\NoReturn;
|
|
||||||
|
|
||||||
class Template
|
class Template
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -28,8 +26,7 @@ class Template
|
||||||
/*
|
/*
|
||||||
* Add variables to template and throw it out
|
* Add variables to template and throw it out
|
||||||
*/
|
*/
|
||||||
#[NoReturn]
|
public function render(string $templateName, array $vars = []): never
|
||||||
public function render(string $templateName, array $vars = []): void
|
|
||||||
{
|
{
|
||||||
// assign template vars
|
// assign template vars
|
||||||
foreach ($vars as $name => $value) {
|
foreach ($vars as $name => $value) {
|
||||||
|
|
Loading…
Reference in New Issue