2021-12-14 18:32:47 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
2019-08-07 19:53:59 +00:00
|
|
|
|
2023-01-10 22:44:09 +00:00
|
|
|
namespace Shimmie2;
|
|
|
|
|
2023-07-03 15:03:34 +00:00
|
|
|
use MicroHTML\HTMLElement;
|
|
|
|
|
2019-08-07 19:53:59 +00:00
|
|
|
class UserBlockBuildingEvent extends Event
|
|
|
|
{
|
2024-01-20 19:47:26 +00:00
|
|
|
/** @var array<int, array{name: string|HTMLElement, link: string}> */
|
2021-03-14 23:43:50 +00:00
|
|
|
public array $parts = [];
|
2019-08-07 19:53:59 +00:00
|
|
|
|
2023-11-11 21:49:12 +00:00
|
|
|
public function add_link(string|HTMLElement $name, string $link, int $position = 50): void
|
2019-08-07 19:53:59 +00:00
|
|
|
{
|
|
|
|
while (isset($this->parts[$position])) {
|
|
|
|
$position++;
|
|
|
|
}
|
|
|
|
$this->parts[$position] = ["name" => $name, "link" => $link];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-26 15:13:28 +00:00
|
|
|
class UserOperationsBuildingEvent extends Event
|
2019-08-07 19:53:59 +00:00
|
|
|
{
|
2024-01-20 14:10:59 +00:00
|
|
|
/** @var string[] */
|
2021-03-14 23:43:50 +00:00
|
|
|
public array $parts = [];
|
2020-10-26 15:13:28 +00:00
|
|
|
|
2023-02-24 21:08:05 +00:00
|
|
|
public function __construct(public User $user, public BaseConfig $user_config)
|
2020-10-26 15:13:28 +00:00
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
}
|
2019-08-07 19:53:59 +00:00
|
|
|
|
2021-03-14 23:43:50 +00:00
|
|
|
public function add_html(string $html): void
|
2019-08-07 19:53:59 +00:00
|
|
|
{
|
|
|
|
$this->parts[] = $html;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class UserPageBuildingEvent extends Event
|
|
|
|
{
|
2024-01-20 14:10:59 +00:00
|
|
|
/** @var array<int, string> */
|
2021-03-14 23:43:50 +00:00
|
|
|
public array $stats = [];
|
2019-08-07 19:53:59 +00:00
|
|
|
|
2023-02-24 21:08:05 +00:00
|
|
|
public function __construct(public User $display_user)
|
2019-08-07 19:53:59 +00:00
|
|
|
{
|
2020-01-26 13:19:35 +00:00
|
|
|
parent::__construct();
|
2019-08-07 19:53:59 +00:00
|
|
|
}
|
|
|
|
|
2024-01-20 14:10:59 +00:00
|
|
|
public function add_stats(string $html, int $position = 50): void
|
2019-08-07 19:53:59 +00:00
|
|
|
{
|
|
|
|
while (isset($this->stats[$position])) {
|
|
|
|
$position++;
|
|
|
|
}
|
|
|
|
$this->stats[$position] = $html;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class UserCreationEvent extends Event
|
|
|
|
{
|
2023-02-24 21:08:05 +00:00
|
|
|
public function __construct(
|
|
|
|
public string $username,
|
|
|
|
public string $password,
|
|
|
|
public string $password2,
|
|
|
|
public string $email,
|
|
|
|
public bool $login
|
|
|
|
) {
|
2020-01-26 13:19:35 +00:00
|
|
|
parent::__construct();
|
2019-08-07 19:53:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class UserLoginEvent extends Event
|
|
|
|
{
|
2023-02-24 21:08:05 +00:00
|
|
|
public function __construct(public User $user)
|
2019-08-07 19:53:59 +00:00
|
|
|
{
|
2020-01-26 13:19:35 +00:00
|
|
|
parent::__construct();
|
2019-08-07 19:53:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class UserDeletionEvent extends Event
|
|
|
|
{
|
2023-02-24 21:08:05 +00:00
|
|
|
public function __construct(public int $id)
|
2019-08-07 19:53:59 +00:00
|
|
|
{
|
2020-01-26 13:19:35 +00:00
|
|
|
parent::__construct();
|
2019-08-07 19:53:59 +00:00
|
|
|
}
|
|
|
|
}
|