This commit is contained in:
@@ -3,6 +3,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace App;
|
||||
|
||||
use App\Avatar\Lorelei;
|
||||
|
||||
final class AccountPages
|
||||
{
|
||||
public static function register(App $app): array
|
||||
@@ -363,7 +365,7 @@ final class AccountPages
|
||||
$profile['contact_phone'] = $crypto->decrypt((string)$profile['contact_phone']) ?: '';
|
||||
}
|
||||
}
|
||||
$profile = array_merge($profile, Avatar::normalize($profile));
|
||||
$profile = array_merge($profile, Lorelei::normalize($profile));
|
||||
|
||||
$children = [];
|
||||
$stmt = $pdo?->prepare('SELECT id, encrypted_first_name AS first_name, note, gender, birthdate, age_years FROM children WHERE user_id = :id ORDER BY id DESC');
|
||||
@@ -420,7 +422,7 @@ final class AccountPages
|
||||
if (!in_array($section, $allowedSections, true)) {
|
||||
$section = 'profile';
|
||||
}
|
||||
$avatarPresetOptions = Avatar::seedChoices((string)$profile['avatar_preset']);
|
||||
$avatarPresetOptions = Lorelei::seedChoices((string)$profile['avatar_preset']);
|
||||
|
||||
return compact(
|
||||
'flash',
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App;
|
||||
namespace App\Avatar;
|
||||
|
||||
final class Avatar
|
||||
final class Lorelei
|
||||
{
|
||||
public static function defaults(): array
|
||||
{
|
||||
@@ -90,7 +90,7 @@ final class Avatar
|
||||
]];
|
||||
|
||||
$seen = [$selectedSeed => true];
|
||||
$base = abs((int)crc32($selectedSeed));
|
||||
$base = abs((int) crc32($selectedSeed));
|
||||
$index = 0;
|
||||
|
||||
while (count($choices) < $count) {
|
||||
@@ -141,7 +141,7 @@ final class Avatar
|
||||
$seed = self::normalizeSeed($seed);
|
||||
$initials = strtoupper(substr(preg_replace('/[^a-z]/', '', $seed) ?: 'pk', 0, 2));
|
||||
$palette = ['#f5efe5', '#d9c7b3', '#8f6f54', '#37485a', '#c88f5b'];
|
||||
$hash = abs((int)crc32($seed));
|
||||
$hash = abs((int) crc32($seed));
|
||||
$bg = $palette[$hash % count($palette)];
|
||||
$fg = $hash % 2 === 0 ? '#243142' : '#ffffff';
|
||||
|
||||
@@ -3,6 +3,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace App;
|
||||
|
||||
use App\Avatar\Lorelei;
|
||||
|
||||
final class Community
|
||||
{
|
||||
private ?array $forumStructure = null;
|
||||
@@ -151,7 +153,7 @@ final class Community
|
||||
$where = $conditions ? ('AND ' . implode(' AND ', $conditions)) : '';
|
||||
|
||||
$avatarSelect = $this->hasColumn('user_profiles', 'avatar_outfit_color')
|
||||
? ', ' . Avatar::selectColumns('p')
|
||||
? ', ' . Lorelei::selectColumns('p')
|
||||
: '';
|
||||
$sql = "SELECT ft.id, ft.title, ft.body, ft.created_at, ft.updated_at,
|
||||
u.id as uid, u.created_at as user_created,
|
||||
@@ -207,7 +209,7 @@ final class Community
|
||||
{
|
||||
$select = 'ft.*, p.display_name';
|
||||
if ($this->hasColumn('user_profiles', 'avatar_outfit_color')) {
|
||||
$select .= ', ' . Avatar::selectColumns('p');
|
||||
$select .= ', ' . Lorelei::selectColumns('p');
|
||||
}
|
||||
$join = '';
|
||||
if ($this->hasColumn('forum_threads', 'board_id') && $this->hasTable('forum_boards') && $this->hasTable('forum_categories')) {
|
||||
@@ -227,7 +229,7 @@ final class Community
|
||||
{
|
||||
$select = 'fp.*, p.display_name';
|
||||
if ($this->hasColumn('user_profiles', 'avatar_outfit_color')) {
|
||||
$select .= ', ' . Avatar::selectColumns('p');
|
||||
$select .= ', ' . Lorelei::selectColumns('p');
|
||||
}
|
||||
if ($this->hasColumn('forum_posts', 'highlighted_at')) {
|
||||
$select .= ', hp.display_name AS highlighted_by_name';
|
||||
|
||||
@@ -3,6 +3,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace App;
|
||||
|
||||
use App\Avatar\Lorelei;
|
||||
|
||||
final class ProfileSettings
|
||||
{
|
||||
private bool $schemaEnsured = false;
|
||||
@@ -87,7 +89,7 @@ final class ProfileSettings
|
||||
}
|
||||
|
||||
$this->ensureSchema();
|
||||
$avatar = Avatar::normalize($avatarConfig);
|
||||
$avatar = Lorelei::normalize($avatarConfig);
|
||||
$stmt = $this->pdo->prepare(
|
||||
'UPDATE user_profiles
|
||||
SET avatar_preset = :preset,
|
||||
|
||||
Reference in New Issue
Block a user