2011-12-12 19:32:29 +00:00
|
|
|
<?php
|
2012-12-23 19:05:51 +00:00
|
|
|
class Handler implements IHandler {
|
2021-11-13 14:05:43 +00:00
|
|
|
// TODO: class properties can be switched to PHP typing if/when the minimum PHP_VERSION is raised to 7.4.0+
|
|
|
|
/** @var PDO */
|
2017-12-01 12:31:16 +00:00
|
|
|
protected $pdo;
|
2021-11-13 14:05:43 +00:00
|
|
|
|
|
|
|
/** @var array<int|string, mixed> */
|
2011-12-12 19:32:29 +00:00
|
|
|
protected $args;
|
|
|
|
|
2021-11-13 14:05:43 +00:00
|
|
|
/**
|
|
|
|
* @param array<int|string, mixed> $args
|
|
|
|
*/
|
|
|
|
function __construct(array $args) {
|
2017-12-01 12:31:16 +00:00
|
|
|
$this->pdo = Db::pdo();
|
2011-12-12 19:32:29 +00:00
|
|
|
$this->args = $args;
|
|
|
|
}
|
|
|
|
|
2021-11-12 02:01:31 +00:00
|
|
|
function csrf_ignore(string $method): bool {
|
2020-09-15 15:16:33 +00:00
|
|
|
return false;
|
2011-12-26 08:02:52 +00:00
|
|
|
}
|
|
|
|
|
2021-11-13 14:05:43 +00:00
|
|
|
function before(string $method): bool {
|
2011-12-12 19:32:29 +00:00
|
|
|
return true;
|
|
|
|
}
|
2011-12-12 20:20:53 +00:00
|
|
|
|
2021-11-13 14:05:43 +00:00
|
|
|
function after(): bool {
|
2011-12-12 20:20:53 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-09-10 15:01:06 +00:00
|
|
|
|
2021-11-18 18:07:43 +00:00
|
|
|
/**
|
|
|
|
* @param mixed $p
|
|
|
|
*/
|
|
|
|
protected static function _param_to_bool($p): bool {
|
2021-11-18 18:16:50 +00:00
|
|
|
if (is_string($p)) {
|
|
|
|
$p = clean($p);
|
|
|
|
}
|
2021-11-18 18:07:43 +00:00
|
|
|
return $p && ($p !== "f" && $p !== "false");
|
|
|
|
}
|
2020-09-15 15:16:33 +00:00
|
|
|
}
|