<?php

$baseUrl = \LaravelCaptcha\Support\LaravelInformation::getBaseUrl();
$BotDetect = \CaptchaConfiguration::GetSettings();
$BotDetect->HandlerUrl = $baseUrl . '/captcha-handler';
// use Laravel session to store persist Captcha codes and other Captcha data
$BotDetect->SaveFunctionName = 'LA_Session_Save';
$BotDetect->LoadFunctionName = 'LA_Session_Load';
$BotDetect->ClearFunctionName = 'LA_Session_Clear';
\CaptchaConfiguration::SaveSettings($BotDetect);
// re-define custom session handler functions
function LA_Session_Save($key, $value)
{
    // save the given value with the given string key
    \Session::put($key, serialize($value));
}
function LA_Session_Load($key)
{
    // load persisted value for the given string key
    if (\Session::has($key)) {
        return unserialize(\Session::get($key));
        // NOTE: returns false in case of failure
    }
}
function LA_Session_Clear($key)
{
    // clear persisted value for the given string key
    if (\Session::has($key)) {
        \Session::remove($key);
    }
}
Пример #2
0
 /**
  * Generate Captcha layout stylesheet url.
  *
  * @return string
  */
 function captcha_layout_stylesheet_url()
 {
     return LaravelInformation::getBaseUrl() . '/captcha-handler?get=bdc-layout-stylesheet.css';
 }
 /**
  * @param  string  $param
  * @return string|null
  */
 private function getUrlParameter($param)
 {
     if (version_compare(LaravelInformation::getVersion(), '5.0', '>=')) {
         // laravel v5.x
         $value = Request::input($param);
     } else {
         // laravel v4.x
         $value = \Input::get($param);
     }
     return $value;
 }
Пример #4
0
 /**
  * Physical path of user captcha config file.
  *
  * @return string
  */
 public static function getUserCaptchaConfigFilePath()
 {
     return LaravelInformation::getConfigPath('captcha.php');
 }
Пример #5
0
<?php

// Copyright © Captcha, Inc. (formerly Lanapsoft, Inc.) 2004-2016. All rights reserved.
// BotDetect, BotDetect CAPTCHA, Lanap, Lanap CAPTCHA, Lanap BotDetect, Lanap BotDetect CAPTCHA, Lanapsoft, Lanapsoft CAPTCHA, Lanapsoft BotDetect, Lanapsoft BotDetect CAPTCHA, and Lanap Software are trademarks or registered trademarks of Captcha, Inc.
// PHP 5.2.x compatibility workaround
if (!defined('__DIR__')) {
    define('__DIR__', dirname(__FILE__));
}
// 1. define BotDetect paths
// physical path to Captcha library files (the BotDetect folder)
$BDC_Include_Path = __DIR__ . '/../../../captcha/lib/botdetect/';
// BotDetect Url prefix (base Url of the BotDetect public resources)
$BDC_Url_Root = \LaravelCaptcha\Support\LaravelInformation::getBaseUrl() . '/captcha-handler?get=';
// physical path to the folder with the (optional!) config override file
$BDC_Config_Override_Path = __DIR__;
// normalize paths
if (is_file(__DIR__ . '/botdetect/CaptchaIncludes.php')) {
    // in case a local copy of the library exists, it is always used
    $BDC_Include_Path = __DIR__ . '/botdetect/';
    $BDC_Url_Root = 'botdetect/public/';
} else {
    // clean-up path specifications
    $BDC_Include_Path = BDC_NormalizePath($BDC_Include_Path);
    $BDC_Url_Root = rtrim(BDC_NormalizePath($BDC_Url_Root), '/');
    $BDC_Config_Override_Path = BDC_NormalizePath($BDC_Config_Override_Path);
}
define('BDC_INCLUDE_PATH', $BDC_Include_Path);
define('BDC_URL_ROOT', $BDC_Url_Root);
define('BDC_CONFIG_OVERRIDE_PATH', $BDC_Config_Override_Path);
function BDC_NormalizePath($p_Path)
{