Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4af7ae3521
|
||
|
|
9d4cb86d41
|
||
|
|
bf4520a7dd
|
||
|
|
fda796ab18
|
||
|
|
ba33a9bb37
|
||
|
|
8a20bb76ef
|
No files matched your search
@@ -0,0 +1,9 @@
|
||||
# SokoWeb
|
||||
|
||||
[](https://ci.esoko.eu/job/soko-web/job/master/)
|
||||
|
||||
This is the SokoWeb framework.
|
||||
|
||||
---
|
||||
|
||||
*License: **GNU GPL 3.0**. Full license text can be found in file `LICENSE`.*
|
||||
@@ -12,6 +12,8 @@ interface IRequest
|
||||
|
||||
public function post(string $key);
|
||||
|
||||
public function header(string $key);
|
||||
|
||||
public function session(): ISession;
|
||||
|
||||
public function setUser(?IUser $user): void;
|
||||
|
||||
@@ -57,7 +57,7 @@ class PersistentDataManager
|
||||
$value = current($data);
|
||||
$relation = key($relations);
|
||||
|
||||
if (strpos($key, '__') == false) {
|
||||
if (strpos($key, '__') === false) {
|
||||
$method = 'set' . str_replace('_', '', ucwords($key, '_'));
|
||||
|
||||
if (method_exists($model, $method) && isset($value)) {
|
||||
|
||||
+19
-1
@@ -15,15 +15,24 @@ class Request implements IRequest
|
||||
|
||||
private array $post;
|
||||
|
||||
private array $headers;
|
||||
|
||||
private Session $session;
|
||||
|
||||
private ?IUser $user = null;
|
||||
|
||||
public function __construct(string $base, array &$get, array &$post, array &$session, IUserRepository $userRepository)
|
||||
public function __construct(
|
||||
string $base,
|
||||
array &$get,
|
||||
array &$post,
|
||||
array $headers,
|
||||
array &$session,
|
||||
IUserRepository $userRepository)
|
||||
{
|
||||
$this->base = $base;
|
||||
$this->get = &$get;
|
||||
$this->post = &$post;
|
||||
$this->headers = $headers;
|
||||
$this->session = new Session($session);
|
||||
|
||||
$userId = $this->session->get('userId');
|
||||
@@ -64,6 +73,15 @@ class Request implements IRequest
|
||||
return null;
|
||||
}
|
||||
|
||||
public function header($key)
|
||||
{
|
||||
if (isset($this->headers[$key])) {
|
||||
return $this->headers[$key];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function session(): ISession
|
||||
{
|
||||
return $this->session;
|
||||
|
||||
Reference in new issue
Block a user