aowow/endpoints/icon/get-id-from-name.php
Sarjuuk 69df50619a DB/Dependency
* remove unmaintained DbSimple
 * add package db/dibi as substitute db abstraction
2026-02-26 16:26:02 +01:00

29 lines
633 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` = %s', $this->_get['name']))
$this->result = $id;
}
}
?>