<?php
/**
 * @copyright (c) Kufer Software GmbH, Oderstraße 7, D-84453 Mühldorf
 */

$sortId = 38;

$settingsArray = array();

$setting = new Setting();
$setting->description = 'Damit ein gelöstes Captcha für den Stammhörerlogin nötig ist, muss die Einstellung unter System / Sonstiges / Stammhörerlogin gesetzt werden.';
$setting->subGroup = 'Captchas';
$setting->toolId = 4;
$setting->config->loadConfiguration(SC_INFOTEXT);
array_push($settingsArray, $setting);

$setting = new Setting();
$setting->name = 'captchaTyp';
$setting->description = 'Captcha Typ';
$setting->help = '';
$setting->subGroup = 'Captchas';
$setting->toolId = 4;
$setting->config->loadConfiguration(SC_RADIO);
$setting->config->items = array(
  '1' => 'SimpleCaptcha',
  '2' => 'ReCaptcha',
  '3' => 'FriendlyCaptcha',
  '4' => 'CaptchaFox'
);
array_push($settingsArray, $setting);

$captchas = array();
$regex = '/^(.*?)\\.png$/i';
if ($dh = @opendir(BASEDIR . 'classes/captchas/simplecaptcha/resources/')) {
  while ($file = readdir($dh)) {
    if (preg_match($regex, $file, $result)) {
      $captchas[$result[0]] = '<img src="../classes/captchas/simplecaptcha/resources/' . CleanOperations::cleanStringForHtml($result[0]) . '" '
        . 'alt="' . CleanOperations::cleanStringForHtml($result[0]) . '" />';
    }
  }
}

$setting = new Setting();
$setting->name = 'simpleCaptchaBack';
$setting->description = 'Hintergrund';
$setting->help = '';
$setting->subGroup = 'SimpleCaptcha';
$setting->toolId = 4;
$setting->config->loadConfiguration(SC_RADIO);
$setting->config->items = $captchas;
array_push($settingsArray, $setting);

$setting = new Setting();
$setting->name = 'simpleCaptchaReload';
$setting->description = 'Reload-Button';
$setting->help = 'Legt fest, ob bei Verwendung des SimpleCaptchas ein Reload-Button für das Captcha angezeigt werden soll.';
$setting->subGroup = 'SimpleCaptcha';
$setting->toolId = 4;
$setting->config->loadConfiguration(SC_CHECKBOX);
array_push($settingsArray, $setting);

$setting = new Setting();
$setting->name = 'simpleCaptchaOnlyNumeric';
$setting->description = 'Nur Zahlen anzeigen';
$setting->help = 'Legt fest, ob bei Verwendung des Simplecaptchas nur Zahlen im Bild angezeigt werden sollen. '
  . 'Dies erleichtert zwar die Lesbarkeit für den Kunden, <strong>aber</strong> erhöht die Wahrscheinlichkeit, '
  . 'dass sich automatische, durch Bots generierte Anmeldungen häufen.';
$setting->subGroup = 'SimpleCaptcha';
$setting->toolId = 4;
$setting->config->loadConfiguration(SC_CHECKBOX);
array_push($settingsArray, $setting);

$setting = new Setting();
$setting->name = 'reCaptchaPrivateKey';
$setting->description = 'Geheimer Schlüssel (Private Key/Secret)';
$setting->help = '';
$setting->subGroup = 'ReCaptcha';
$setting->toolId = 4;
array_push($settingsArray, $setting);

$setting = new Setting();
$setting->name = 'reCaptchaPublicKey';
$setting->description = 'Websiteschlüssel (Public Key)';
$setting->help = '';
$setting->subGroup = 'ReCaptcha';
$setting->toolId = 4;
array_push($settingsArray, $setting);

$setting = new Setting();
$setting->name = 'reCaptchaHostname';
$setting->description = 'Hostname, falls dieser geprüft werden soll';
$setting->help = 'Kann und sollte in den Einstellungen des ReCaptchas gesetzt werden - dann ist eine Angabe hier nicht mehr nötig';
$setting->subGroup = 'ReCaptcha';
$setting->toolId = 4;
array_push($settingsArray, $setting);

$setting = new Setting();
$setting->name = 'reCaptchaVersion';
$setting->description = 'ReCaptcha Version';
$setting->help = '';
$setting->subGroup = 'ReCaptcha';
$setting->toolId = 4;
$setting->config->loadConfiguration(SC_RADIO);
$setting->config->items = array(
  '2' => 'Version 2',
  '3' => 'Version 3'
);
array_push($settingsArray, $setting);

$setting = new Setting();
$setting->name = 'reCaptchaThreshold';
$setting->description = 'ReCaptcha V3 - Schwellwert';
$setting->help = 'Google ReCaptcha bewertet das Verhalten der Webseitenbesucher und erstellt daraus einen Wert zwischen 0,0 und 1,0. '
  . 'Ist der Wert größer, als der hier angegebene, so wird der Besucher als Mensch akzeptiert. Default: ' . CAPTCHA_RECAPTCH_DEFAULT_THRESHOLD;
$setting->subGroup = 'ReCaptcha';
$setting->toolId = 4;
$setting->config->loadConfiguration(SC_INPUTFLOAT);
$setting->config->allowNegative = false;
$setting->config->onlyFloat = true;
array_push($settingsArray, $setting);


$setting = new Setting();
$setting->description = 'Weitere Infos unter <a href="https://friendlycaptcha.com/de/">https://friendlycaptcha.com/de/</a>';
$setting->subGroup = 'FriendlyCaptcha';
$setting->toolId = 4;
$setting->config->loadConfiguration(SC_INFOTEXT);
array_push($settingsArray, $setting);


$setting = new Setting();
$setting->name = 'friendlyCaptchaSiteKey';
$setting->description = 'Site Key';
$setting->help = 'Der SiteKey von FriendlyCaptcha.';
$setting->subGroup = 'FriendlyCaptcha';
$setting->toolId = 4;
array_push($settingsArray, $setting);

$setting = new Setting();
$setting->name = 'friendlyCaptchaSecret';
$setting->description = 'Secret / API Key';
$setting->help = 'Das Secret / API Key von FriendlyCaptcha.';
$setting->subGroup = 'FriendlyCaptcha';
$setting->toolId = 4;
array_push($settingsArray, $setting);

$setting = new Setting();
$setting->name = 'friendlyCaptchaEndpoint';
$setting->description = 'EU Endpunkt verwenden';
$setting->help = 'FriendlyCaptcha bietet die Möglichkeit, einen EU-Endpunkt zu verwenden. 
Da dann eine andere API angeprochen werden muss, kann man das hier umstellen.';
$setting->subGroup = 'FriendlyCaptcha';
$setting->toolId = 4;
$setting->config->loadConfiguration(SC_RADIO);
$setting->config->items = array(
  'Global' => 'Globaler Ednpunkt',
  'Eu' => 'EU Endpunkt'
);
array_push($settingsArray, $setting);

$setting = new Setting();
$setting->description = 'Weitere Infos unter <a href="https://captchafox.com/de">https://captchafox.com/de</a>';
$setting->subGroup = 'CaptchaFox';
$setting->toolId = 4;
$setting->config->loadConfiguration(SC_INFOTEXT);
array_push($settingsArray, $setting);


$setting = new Setting();
$setting->name = 'captchaFoxSiteKey';
$setting->description = 'Site Key';
$setting->help = 'Der SiteKey von CaptchaFox.';
$setting->subGroup = 'CaptchaFox';
$setting->toolId = 4;
array_push($settingsArray, $setting);

$setting = new Setting();
$setting->name = 'captchaFoxSecret';
$setting->description = 'Secret Key';
$setting->help = 'Der Secret Key von CaptchaFox.';
$setting->subGroup = 'CaptchaFox';
$setting->toolId = 4;
array_push($settingsArray, $setting);

$setting = new Setting();
$setting->name = 'captchaFoxLanguage';
$setting->description = 'Sprache';
$setting->help = 'Die Sprache von CaptchaFox erzwingen. Lokale Sprache wird erfragt, wenn leer.';
$setting->subGroup = 'CaptchaFox';
$setting->toolId = 4;
array_push($settingsArray, $setting);

$setting = new Setting();
$setting->name = 'captchaFoxModus';
$setting->description = 'Modus';
$setting->help = 'Default ist inline';
$setting->subGroup = 'CaptchaFox';
$setting->toolId = 4;
$setting->config->loadConfiguration(SC_RADIO);
$setting->config->items = array(
  'inline' => 'Inline',
  'popup' => 'PopUp',
  'hidden' => 'Hidden'
);
array_push($settingsArray, $setting);

$setting = new Setting();
$setting->name = 'captchaFoxTheme';
$setting->description = 'Theme';
$setting->help = 'Default ist light';
$setting->subGroup = 'CaptchaFox';
$setting->toolId = 4;
$setting->config->loadConfiguration(SC_RADIO);
$setting->config->items = array(
  'light' => 'Light',
  'dark' => 'Dark'
);
array_push($settingsArray, $setting);