forked from Cavemanon/cavepaintings
updates
This commit is contained in:
@ -25,10 +25,10 @@ function captcha_get_html(): string
|
||||
$captcha = "
|
||||
<div class=\"g-recaptcha\" data-sitekey=\"{$r_publickey}\"></div>
|
||||
<script type=\"text/javascript\" src=\"https://www.google.com/recaptcha/api.js\"></script>";
|
||||
} else {
|
||||
} /*else {
|
||||
session_start();
|
||||
$captcha = \Securimage::getCaptchaHtml(['securimage_path' => './vendor/dapphp/securimage/']);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
return $captcha;
|
||||
}
|
||||
@ -51,14 +51,14 @@ function captcha_check(): bool
|
||||
log_info("core", "Captcha failed (ReCaptcha): " . implode("", $resp->getErrorCodes()));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
} /*else {
|
||||
session_start();
|
||||
$securimg = new \Securimage();
|
||||
if ($securimg->check($_POST['captcha_code']) === false) {
|
||||
log_info("core", "Captcha failed (Securimage)");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -23,7 +23,6 @@ class Image
|
||||
public const IMAGE_DIR = "images";
|
||||
public const THUMBNAIL_DIR = "thumbs";
|
||||
|
||||
#[Field]
|
||||
public ?int $id = null;
|
||||
#[Field]
|
||||
public int $height = 0;
|
||||
@ -89,15 +88,26 @@ class Image
|
||||
}
|
||||
}
|
||||
|
||||
#[Field(name: "post_id")]
|
||||
public function graphql_oid(): int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
#[Field(name: "id")]
|
||||
public function graphql_guid(): string
|
||||
{
|
||||
return "post:{$this->id}";
|
||||
}
|
||||
|
||||
#[Query(name: "post")]
|
||||
public static function by_id(int $id): ?Image
|
||||
public static function by_id(int $post_id): ?Image
|
||||
{
|
||||
global $database;
|
||||
if ($id > 2**32) {
|
||||
if ($post_id > 2**32) {
|
||||
// for some reason bots query huge numbers and pollute the DB error logs...
|
||||
return null;
|
||||
}
|
||||
$row = $database->get_row("SELECT * FROM images WHERE images.id=:id", ["id"=>$id]);
|
||||
$row = $database->get_row("SELECT * FROM images WHERE images.id=:id", ["id"=>$post_id]);
|
||||
return ($row ? new Image($row) : null);
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,6 @@ function _new_user(array $row): User
|
||||
#[Type(name: "User")]
|
||||
class User
|
||||
{
|
||||
#[Field]
|
||||
public int $id;
|
||||
#[Field]
|
||||
public string $name;
|
||||
@ -73,6 +72,18 @@ class User
|
||||
return $user;
|
||||
}
|
||||
|
||||
#[Field(name: "user_id")]
|
||||
public function graphql_oid(): int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
#[Field(name: "id")]
|
||||
public function graphql_guid(): string
|
||||
{
|
||||
return "user:{$this->id}";
|
||||
}
|
||||
|
||||
|
||||
public static function by_session(string $name, string $session): ?User
|
||||
{
|
||||
global $cache, $config, $database;
|
||||
@ -105,6 +116,7 @@ class User
|
||||
return is_null($row) ? null : new User($row);
|
||||
}
|
||||
|
||||
#[Query(name: "user")]
|
||||
public static function by_name(string $name): ?User
|
||||
{
|
||||
global $database;
|
||||
|
Reference in New Issue
Block a user