aowow/endpoints/icon/get-id-from-name.php
Sarjuuk 6557e70d5c Template/Update (Part 47)
* split global.js into its components, so it can be reasonably processed by setup
 * make reputation requirements configurable
 * move Markup and Locale back into global.js (removed associated build scripts)
 * extend Icon to display iconId in lightbox popup
2025-09-25 16:01:14 +02:00

29 lines
632 B
PHP

<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
class IconGetidfromnameResponse extends TextResponse
{
protected array $expectedGET = array(
'name' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => '/^[\w_-]+$/']]
);
protected function generate() : void
{
if (!$this->assertGET('name'))
{
$this->result = 'null';
return;
}
$this->result = 0;
if ($id = DB::Aowow()->selectCell('SELECT `id` FROM ?_icons WHERE `name` = ?', $this->_get['name']))
$this->result = $id;
}
}
?>