diff --git a/endpoints/signature/delete.php b/endpoints/signature/delete.php new file mode 100644 index 00000000..3266220c --- /dev/null +++ b/endpoints/signature/delete.php @@ -0,0 +1,30 @@ + ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkIdListUnsigned']] + ); + + public function __construct(string $pageParam) + { + parent::__construct($pageParam); + } + + protected function generate() : void + { + if (!$this->assertGET('id')) + $this->generate404(); + + // DB::Aowow()->query(DELETE FROM ?_account_signatures WHERE `id` IN (?a) { AND `accountId` = ?d }', $this->_get['id], User::isInGroup(U_GROUP_MODERATOR) ? DBSIMPLE_SKIP : User::$id); + } +} + +?> diff --git a/endpoints/signature/generate.php b/endpoints/signature/generate.php new file mode 100644 index 00000000..af88f9d7 --- /dev/null +++ b/endpoints/signature/generate.php @@ -0,0 +1,60 @@ + ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkProfileId']] + ); + + public function __construct(string $pageParam) + { + parent::__construct($pageParam); + } + + protected function generate() : void + { + parent::generate(); + + if (!$this->assertGET('id')) + $this->generate404(); + + // find file in storage + + // build image + } + + public function generate404(?string $out = null) : never + { + // "Signature Unavailable" + $out = /*data:image/png;base64,*/'iVBORw0KGgoAAAANSUhEUgAAAdQAAAA8CAIAAABQJdxgAAALbElEQVR4nO3bXWxT5R8H8OectnvtDtB2fVnXN6Cr29zW0SCSjMgSh0YSifPtjgsu1EuvjXFojPfKDRLitYQYxEggEwzhQiJb1+GG4MrWjrbr1petW6FubXee/8UTT05aKBv85az4/VyY9uyc5y32y9PfOeXMZjMBAIBni1d6AAAA/0UIXwAABSB8AQAUgPAFAFAAwhcAQAEIXwAABSB8AQAUgPAFAFAAwhcAQAEIXwAABSB8AQAUgPAFAFAAwhcAQAEIXwAABSB8AQAUgPAFAFAAwhcAQAEIXwAABSB8AQAUgPAFAFAAwhcAQAEIXwAABaiVHgDA8+bzzz+XXouiKH+72TM33hRUHYRv1di7d++BAwcEQZCOcBzHXgwNDR07dsxkMhFCFhYWvvvuO2WG+K8pD52hoa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YXFxcWpq6ssvv1R6gAD/ddj5Pp8KhUIkEmlpaTEYDKxiSCnNZDKhUGh4eFjp0QEAdr7PKbvdzn4KJb+xns1mf/vtt+vXrys4MABgEL4AAArA0w4AAApA+AIAKADhCwCgAIQvAIACEL4AAApA+AIAKADhCwCgAIQvAIACEL4AAApA+AIAKADhCwCgAIQvAIACEL4AAApA+AIAKADhCwCgAIQvAIACEL4AAApA+AIAKADhCwCggP8BQFB72fG1SEAAAAAASUVORK5CYII='; + parent::generate404(base64_decode($out)); + } + + protected static function checkProfileId(string $sigId) : ?int + { + if (preg_match('/^(\d+)\.png$/i', $sigId, $m)) + return $m[0]; + + return null; + } +} + +?> diff --git a/endpoints/signature/signature.php b/endpoints/signature/signature.php new file mode 100644 index 00000000..dfe34e9e --- /dev/null +++ b/endpoints/signature/signature.php @@ -0,0 +1,55 @@ + ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkProfile']] // optional - full profile string to build sig from + ); + + private int $id = 0; + + public function __construct(string $pageParam) + { + parent::__construct($pageParam); + + if ($pageParam) + $this->id = intVal($pageParam); + else if ($this->assertGET('profile')) + $this->id = $this->_get['profile']; + else + $this->generateError(); + } + + protected function generate() : void + { + // show editor + + parent::generate(); + } + + protected static function checkProfile(string $profile) : ?int + { + if (!preg_match('/^([a-z]+)\.([a-z_]+)\.(.+)$/i', $profile, $m)) + return null; + + [, $region, $realm, $char] = $m; + + $realms = Profiler::getRealms(); + if ($rId = array_find_key($realms, fn($x) => $x['region'] == $region && $x['name'] == $realm)) + return DB::Aowow()->selectCell('SELECT `id` FROM ?_profiler_profiles WHERE `realm` = ?d AND `custom` = 0 AND `name` = ?', $rId, urldecode($char)) ?: null; + + return null; + } +} + +?> diff --git a/endpoints/user/user.php b/endpoints/user/user.php index 20af4077..d6ad92a1 100644 --- a/endpoints/user/user.php +++ b/endpoints/user/user.php @@ -260,6 +260,17 @@ class UserBaseResponse extends TemplateResponse if ($chars = $characters->getListviewData(PROFILEINFO_CHARACTER | PROFILEINFO_USER)) $this->charactersLvData = array_values($chars); } + + // signatures + /* $this->lvTabs->addListviewTab(new Listview(array( + * 'id' => 'signatures', + * 'name' => '$LANG.tab_signatures', + * 'hiddenCols' => ['name','faction','location','guild'], + * 'extraCols' => ['$Listview.extraCols.signature'], + * 'onBeforeCreate' => '$Listview.funcBox.beforeUserSignatures', + * 'data' => [ ProfileList->getListviewData() ] // no extra signature related data observed + * ), 'profile')); + */ } // My Guides