Skip to content

Commit

Permalink
Added getCaptchaService function
Browse files Browse the repository at this point in the history
  • Loading branch information
anditv21 committed Oct 24, 2023
1 parent 299b608 commit 75911c7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/app/controllers/SystemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ public function getSystemData()
{
return $this->SystemData();
}

public function getCaptcha()
{
return $this->getCaptchaService();
}
}
26 changes: 26 additions & 0 deletions src/app/models/SystemModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,30 @@ protected function SystemData()
$result->relinkdiscord = (int) $result->relinkdiscord;
return $result;
}

protected function getCaptchaService()
{
$this->prepare('SELECT * FROM `system`');
$this->statement->execute();
$result = $this->statement->fetch();
return $result;
$service = $result->cap_service;
$site_key = $result->cap_key;

if ($service == 1)
{
return '<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
<div class="cf-turnstile" data-sitekey="' . $site_key . '" data-callback="javascriptCallback"></div>';
}
elseif ($service == 2)
{
return '<script src="https://www.hCaptcha.com/1/api.js" async defer></script>
<div class="h-captcha" data-sitekey="' . $site_key . '"></div>';
}
elseif ($service == 3)
{
return '<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<div class="g-recaptcha" data-sitekey="' . $site_key . '"></div>';
}
}
}

0 comments on commit 75911c7

Please sign in to comment.