mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2025-01-23 23:31:52 +00:00
feat: add captcha
This commit is contained in:
parent
0d931e270b
commit
0bf1a2f998
@ -16,7 +16,7 @@ getAptPackage(){
|
||||
#Update apt sources and install
|
||||
dpkg -s gnupg 2>/dev/null || (apt-get update && apt-get install -y gnupg)
|
||||
echo "deb http://ppa.launchpad.net/stesie/libv8/ubuntu bionic main" | tee /etc/apt/sources.list.d/stesie-libv8.list && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D858A0DF
|
||||
apt-get update && apt-get install -y vim ntp zip unzip curl wget apache2 libapache2-mod-xsendfile libapache2-mod-php php php-dev php-pear php-zip php-mysql php-mbstring mysql-server cmake fp-compiler re2c libv8-7.5-dev libyaml-dev python python3 python3-requests openjdk-8-jdk openjdk-11-jdk
|
||||
apt-get update && apt-get install -y vim ntp zip unzip curl wget apache2 libapache2-mod-xsendfile libapache2-mod-php php php-dev php-pear php-zip php-mysql php-mbstring php-gd php-intl php-xsl mysql-server cmake fp-compiler re2c libv8-7.5-dev libyaml-dev python python3 python3-requests openjdk-8-jdk openjdk-11-jdk
|
||||
#Install PHP extensions
|
||||
yes | pecl install yaml
|
||||
git clone https://github.com/phpv8/v8js.git --depth=1 /tmp/pear/download/v8js-master && cd /tmp/pear/download/v8js-master
|
||||
|
@ -14,7 +14,7 @@ getAptPackage(){
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
dpkg -s gnupg 2>/dev/null || (apt-get update && apt-get install -y gnupg)
|
||||
echo "deb http://ppa.launchpad.net/stesie/libv8/ubuntu bionic main" | tee /etc/apt/sources.list.d/stesie-libv8.list && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D858A0DF
|
||||
apt-get update && apt-get install -y vim ntp zip unzip curl wget apache2 libapache2-mod-xsendfile libapache2-mod-php php php-dev php-pear php-zip php-mysql php-mbstring g++ cmake re2c libv8-7.5-dev libyaml-dev
|
||||
apt-get update && apt-get install -y vim ntp zip unzip curl wget apache2 libapache2-mod-xsendfile libapache2-mod-php php php-dev php-pear php-zip php-mysql php-mbstring php-gd php-intl php-xsl g++ cmake re2c libv8-7.5-dev libyaml-dev
|
||||
#Install PHP extensions
|
||||
printf "/opt/libv8-7.5\n\n" | pecl install v8js yaml
|
||||
}
|
||||
|
3
web/.gitignore
vendored
3
web/.gitignore
vendored
@ -1,2 +1,5 @@
|
||||
.idea
|
||||
.php_cs.cache
|
||||
|
||||
composer.phar
|
||||
composer.lock
|
||||
|
13
web/app/controllers/captcha.php
Normal file
13
web/app/controllers/captcha.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
use Gregwar\Captcha\PhraseBuilder;
|
||||
use Gregwar\Captcha\CaptchaBuilder;
|
||||
|
||||
$builder = new CaptchaBuilder;
|
||||
$builder->build();
|
||||
$_SESSION['phrase'] = $builder->getPhrase();
|
||||
|
||||
header('Content-Type: image/jpeg');
|
||||
$builder->build()->output();
|
||||
|
||||
?>
|
@ -1,4 +1,7 @@
|
||||
<?php
|
||||
use Gregwar\Captcha\PhraseBuilder;
|
||||
use Gregwar\Captcha\CaptchaBuilder;
|
||||
|
||||
if (Auth::check()) {
|
||||
redirectTo('/');
|
||||
}
|
||||
@ -15,6 +18,11 @@
|
||||
}
|
||||
$username = $_POST['username'];
|
||||
$password = $_POST['password'];
|
||||
$captcha = $_POST['captcha'];
|
||||
|
||||
if (!isset($_SESSION['phrase']) || !PhraseBuilder::comparePhrases($_SESSION['phrase'], $captcha)) {
|
||||
return "bad_captcha";
|
||||
}
|
||||
|
||||
if (!validateUsername($username)) {
|
||||
return "failed";
|
||||
@ -38,6 +46,7 @@
|
||||
|
||||
if (isset($_POST['login'])) {
|
||||
echo handleLoginPost();
|
||||
unset($_SESSION['phrase']);
|
||||
die();
|
||||
}
|
||||
?>
|
||||
@ -61,6 +70,16 @@
|
||||
<span class="help-block" id="help-password"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="div-captcha" class="form-group">
|
||||
<label for="input-captcha" class="col-sm-2 control-label"><?= UOJLocale::get('verification code') ?></label>
|
||||
<div class="col-sm-3" style="max-width: 60%">
|
||||
<input type="text" class="form-control" id="input-captcha" name="captcha" placeholder="<?= UOJLocale::get('enter verification code') ?>" maxlength="20" style="display: inline-block; width: 12em;" />
|
||||
<div style="display: inline-block; margin-left: 8px; position: relative; top: -2px; cursor: pointer;">
|
||||
<img id="captcha" src="" />
|
||||
</div>
|
||||
<span class="help-block" id="help-captcha" style="display: block"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-3">
|
||||
<button type="submit" id="button-submit" class="btn btn-secondary"><?= UOJLocale::get('submit') ?></button>
|
||||
@ -76,6 +95,11 @@ function validateLoginPost() {
|
||||
return ok;
|
||||
}
|
||||
|
||||
function refreshCaptcha() {
|
||||
var timestamp = new Date().getTime();
|
||||
$("#captcha").attr("src", "/captcha" + '?' + timestamp);
|
||||
}
|
||||
|
||||
function submitLoginPost() {
|
||||
if (!validateLoginPost()) {
|
||||
return false;
|
||||
@ -85,25 +109,40 @@ function submitLoginPost() {
|
||||
_token : "<?= crsf_token() ?>",
|
||||
login : '',
|
||||
username : $('#input-username').val(),
|
||||
password : md5($('#input-password').val(), "<?= getPasswordClientSalt() ?>")
|
||||
password : md5($('#input-password').val(), "<?= getPasswordClientSalt() ?>"),
|
||||
captcha: $('#input-captcha').val(),
|
||||
}, function(msg) {
|
||||
$('#div-captcha').removeClass('has-error');
|
||||
$('#div-username').removeClass('has-error');
|
||||
$('#div-password').removeClass('has-error');
|
||||
$('#help-captcha').html('');
|
||||
$('#help-username').html('');
|
||||
$('#help-password').html('');
|
||||
|
||||
if (msg == 'ok') {
|
||||
var prevUrl = document.referrer;
|
||||
if (prevUrl == '' || /.*\/login.*/.test(prevUrl) || /.*\/logout.*/.test(prevUrl) || /.*\/register.*/.test(prevUrl) || /.*\/reset-password.*/.test(prevUrl)) {
|
||||
prevUrl = '/';
|
||||
};
|
||||
window.location.href = prevUrl;
|
||||
} else if (msg == 'bad_captcha') {
|
||||
$('#div-captcha').addClass('has-error');
|
||||
$('#help-captcha').html('验证码错误。');
|
||||
refreshCaptcha();
|
||||
} else if (msg == 'banned') {
|
||||
$('#div-username').addClass('has-error');
|
||||
$('#help-username').html('该用户已被封停,请联系管理员。');
|
||||
refreshCaptcha();
|
||||
} else if (msg == 'expired') {
|
||||
$('#div-username').addClass('has-error');
|
||||
$('#help-username').html('页面会话已过期。');
|
||||
refreshCaptcha();
|
||||
} else {
|
||||
$('#div-username').addClass('has-error');
|
||||
$('#help-username').html('用户名或密码错误。');
|
||||
$('#div-password').addClass('has-error');
|
||||
$('#help-password').html('用户名或密码错误。<a href="/forgot-password">忘记密码?</a>');
|
||||
refreshCaptcha();
|
||||
}
|
||||
});
|
||||
return true;
|
||||
@ -114,6 +153,9 @@ $(document).ready(function() {
|
||||
e.preventDefault();
|
||||
submitLoginPost();
|
||||
});
|
||||
$("#captcha").click(function(e) {
|
||||
refreshCaptcha();
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
@ -2,7 +2,10 @@
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
|
||||
spl_autoload_register(function($class_name) {
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/app/models/' . $class_name . '.php';
|
||||
$lib = $_SERVER['DOCUMENT_ROOT'] . '/app/models/' . $class_name . '.php';
|
||||
if (file_exists($lib)) {
|
||||
require_once $lib;
|
||||
}
|
||||
});
|
||||
|
||||
function requireLib($name) { // html lib
|
||||
|
@ -21,6 +21,7 @@ return [
|
||||
'username' => 'Username',
|
||||
'password' => 'Password',
|
||||
'new password' => 'New password',
|
||||
'verification code' => 'Verification code',
|
||||
'email' => 'Email',
|
||||
'QQ' => 'QQ',
|
||||
'sex' => 'Sex',
|
||||
@ -61,6 +62,7 @@ return [
|
||||
'enter your new password' => 'Enter your new password',
|
||||
're-enter your new password' => 'Re-enter your new password',
|
||||
'enter your QQ' => 'Enter your QQ',
|
||||
'enter verification code' => 'Enter verification code',
|
||||
'refuse to answer' => 'Refuse to answer',
|
||||
'male' => 'Male',
|
||||
'female' => 'Female',
|
||||
|
@ -21,6 +21,7 @@ return [
|
||||
'username' => '用户名',
|
||||
'password' => '密码',
|
||||
'new password' => '新密码',
|
||||
'verification code' => '验证码',
|
||||
'email' => 'Email',
|
||||
'QQ' => 'QQ',
|
||||
'sex' => '性别',
|
||||
@ -55,12 +56,13 @@ return [
|
||||
'leave it blank if you do not want to change the password' => '如果不想修改密码请留空',
|
||||
'change avatar help' => '想改头像?见<a href="/faq">帮助</a>',
|
||||
'enter your username' => '输入用户名',
|
||||
'enter your email' => '输入Email',
|
||||
'enter your email' => '输入 Email',
|
||||
'enter your password' => '输入密码',
|
||||
're-enter your password' => '重新输入密码',
|
||||
'enter your new password' => '输入新密码',
|
||||
're-enter your new password' => '重新输入新密码',
|
||||
'enter your QQ' => '输入QQ',
|
||||
'enter verification code' => '输入验证码',
|
||||
'refuse to answer' => '拒绝回答',
|
||||
'male' => '男',
|
||||
'female' => '女',
|
||||
|
@ -50,6 +50,7 @@ Route::group([
|
||||
Route::any('/faq', '/faq.php');
|
||||
Route::any('/ranklist', '/ranklist.php?type=rating');
|
||||
|
||||
Route::any('/captcha', '/captcha.php');
|
||||
Route::any('/login', '/login.php');
|
||||
Route::any('/logout', '/logout.php');
|
||||
Route::any('/register', '/register.php');
|
||||
|
5
web/composer.json
Normal file
5
web/composer.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"require": {
|
||||
"gregwar/captcha": "1.*"
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php';
|
||||
require $_SERVER['DOCUMENT_ROOT'] . '/app/libs/uoj-lib.php';
|
||||
|
||||
require UOJContext::documentRoot().'/app/route.php';
|
||||
|
7
web/vendor/autoload.php
vendored
Normal file
7
web/vendor/autoload.php
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
// autoload.php @generated by Composer
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInite9f59116cb3d815416daaf015687f2ec::getLoader();
|
445
web/vendor/composer/ClassLoader.php
vendored
Normal file
445
web/vendor/composer/ClassLoader.php
vendored
Normal file
@ -0,0 +1,445 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
/**
|
||||
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
||||
*
|
||||
* $loader = new \Composer\Autoload\ClassLoader();
|
||||
*
|
||||
* // register classes with namespaces
|
||||
* $loader->add('Symfony\Component', __DIR__.'/component');
|
||||
* $loader->add('Symfony', __DIR__.'/framework');
|
||||
*
|
||||
* // activate the autoloader
|
||||
* $loader->register();
|
||||
*
|
||||
* // to enable searching the include path (eg. for PEAR packages)
|
||||
* $loader->setUseIncludePath(true);
|
||||
*
|
||||
* In this example, if you try to use a class in the Symfony\Component
|
||||
* namespace or one of its children (Symfony\Component\Console for instance),
|
||||
* the autoloader will first look for the class under the component/
|
||||
* directory, and it will then fallback to the framework/ directory if not
|
||||
* found before giving up.
|
||||
*
|
||||
* This class is loosely based on the Symfony UniversalClassLoader.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
* @see https://www.php-fig.org/psr/psr-0/
|
||||
* @see https://www.php-fig.org/psr/psr-4/
|
||||
*/
|
||||
class ClassLoader
|
||||
{
|
||||
// PSR-4
|
||||
private $prefixLengthsPsr4 = array();
|
||||
private $prefixDirsPsr4 = array();
|
||||
private $fallbackDirsPsr4 = array();
|
||||
|
||||
// PSR-0
|
||||
private $prefixesPsr0 = array();
|
||||
private $fallbackDirsPsr0 = array();
|
||||
|
||||
private $useIncludePath = false;
|
||||
private $classMap = array();
|
||||
private $classMapAuthoritative = false;
|
||||
private $missingClasses = array();
|
||||
private $apcuPrefix;
|
||||
|
||||
public function getPrefixes()
|
||||
{
|
||||
if (!empty($this->prefixesPsr0)) {
|
||||
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getPrefixesPsr4()
|
||||
{
|
||||
return $this->prefixDirsPsr4;
|
||||
}
|
||||
|
||||
public function getFallbackDirs()
|
||||
{
|
||||
return $this->fallbackDirsPsr0;
|
||||
}
|
||||
|
||||
public function getFallbackDirsPsr4()
|
||||
{
|
||||
return $this->fallbackDirsPsr4;
|
||||
}
|
||||
|
||||
public function getClassMap()
|
||||
{
|
||||
return $this->classMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $classMap Class to filename map
|
||||
*/
|
||||
public function addClassMap(array $classMap)
|
||||
{
|
||||
if ($this->classMap) {
|
||||
$this->classMap = array_merge($this->classMap, $classMap);
|
||||
} else {
|
||||
$this->classMap = $classMap;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix, either
|
||||
* appending or prepending to the ones previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param array|string $paths The PSR-0 root directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*/
|
||||
public function add($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
(array) $paths,
|
||||
$this->fallbackDirsPsr0
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
$this->fallbackDirsPsr0,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$first = $prefix[0];
|
||||
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
||||
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
||||
|
||||
return;
|
||||
}
|
||||
if ($prepend) {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$this->prefixesPsr0[$first][$prefix]
|
||||
);
|
||||
} else {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
$this->prefixesPsr0[$first][$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace, either
|
||||
* appending or prepending to the ones previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param array|string $paths The PSR-4 base directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function addPsr4($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
// Register directories for the root namespace.
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
(array) $paths,
|
||||
$this->fallbackDirsPsr4
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
$this->fallbackDirsPsr4,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
||||
// Register directories for a new namespace.
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
} elseif ($prepend) {
|
||||
// Prepend directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$this->prefixDirsPsr4[$prefix]
|
||||
);
|
||||
} else {
|
||||
// Append directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
$this->prefixDirsPsr4[$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix,
|
||||
* replacing any others previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param array|string $paths The PSR-0 base directories
|
||||
*/
|
||||
public function set($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr0 = (array) $paths;
|
||||
} else {
|
||||
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace,
|
||||
* replacing any others previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param array|string $paths The PSR-4 base directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function setPsr4($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr4 = (array) $paths;
|
||||
} else {
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns on searching the include path for class files.
|
||||
*
|
||||
* @param bool $useIncludePath
|
||||
*/
|
||||
public function setUseIncludePath($useIncludePath)
|
||||
{
|
||||
$this->useIncludePath = $useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to check if the autoloader uses the include path to check
|
||||
* for classes.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getUseIncludePath()
|
||||
{
|
||||
return $this->useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns off searching the prefix and fallback directories for classes
|
||||
* that have not been registered with the class map.
|
||||
*
|
||||
* @param bool $classMapAuthoritative
|
||||
*/
|
||||
public function setClassMapAuthoritative($classMapAuthoritative)
|
||||
{
|
||||
$this->classMapAuthoritative = $classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should class lookup fail if not found in the current class map?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isClassMapAuthoritative()
|
||||
{
|
||||
return $this->classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
||||
*
|
||||
* @param string|null $apcuPrefix
|
||||
*/
|
||||
public function setApcuPrefix($apcuPrefix)
|
||||
{
|
||||
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The APCu prefix in use, or null if APCu caching is not enabled.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getApcuPrefix()
|
||||
{
|
||||
return $this->apcuPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers this instance as an autoloader.
|
||||
*
|
||||
* @param bool $prepend Whether to prepend the autoloader or not
|
||||
*/
|
||||
public function register($prepend = false)
|
||||
{
|
||||
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters this instance as an autoloader.
|
||||
*/
|
||||
public function unregister()
|
||||
{
|
||||
spl_autoload_unregister(array($this, 'loadClass'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the given class or interface.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
* @return bool|null True if loaded, null otherwise
|
||||
*/
|
||||
public function loadClass($class)
|
||||
{
|
||||
if ($file = $this->findFile($class)) {
|
||||
includeFile($file);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the path to the file where the class is defined.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
*
|
||||
* @return string|false The path if found, false otherwise
|
||||
*/
|
||||
public function findFile($class)
|
||||
{
|
||||
// class map lookup
|
||||
if (isset($this->classMap[$class])) {
|
||||
return $this->classMap[$class];
|
||||
}
|
||||
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
||||
return false;
|
||||
}
|
||||
if (null !== $this->apcuPrefix) {
|
||||
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
||||
if ($hit) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
$file = $this->findFileWithExtension($class, '.php');
|
||||
|
||||
// Search for Hack files if we are running on HHVM
|
||||
if (false === $file && defined('HHVM_VERSION')) {
|
||||
$file = $this->findFileWithExtension($class, '.hh');
|
||||
}
|
||||
|
||||
if (null !== $this->apcuPrefix) {
|
||||
apcu_add($this->apcuPrefix.$class, $file);
|
||||
}
|
||||
|
||||
if (false === $file) {
|
||||
// Remember that this class does not exist.
|
||||
$this->missingClasses[$class] = true;
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
private function findFileWithExtension($class, $ext)
|
||||
{
|
||||
// PSR-4 lookup
|
||||
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
||||
|
||||
$first = $class[0];
|
||||
if (isset($this->prefixLengthsPsr4[$first])) {
|
||||
$subPath = $class;
|
||||
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
||||
$subPath = substr($subPath, 0, $lastPos);
|
||||
$search = $subPath . '\\';
|
||||
if (isset($this->prefixDirsPsr4[$search])) {
|
||||
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
||||
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
||||
if (file_exists($file = $dir . $pathEnd)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-4 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr4 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 lookup
|
||||
if (false !== $pos = strrpos($class, '\\')) {
|
||||
// namespaced class name
|
||||
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
||||
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
||||
} else {
|
||||
// PEAR-like class name
|
||||
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
||||
}
|
||||
|
||||
if (isset($this->prefixesPsr0[$first])) {
|
||||
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
||||
if (0 === strpos($class, $prefix)) {
|
||||
foreach ($dirs as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr0 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 include paths.
|
||||
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope isolated include.
|
||||
*
|
||||
* Prevents access to $this/self from included files.
|
||||
*/
|
||||
function includeFile($file)
|
||||
{
|
||||
include $file;
|
||||
}
|
237
web/vendor/composer/InstalledVersions.php
vendored
Normal file
237
web/vendor/composer/InstalledVersions.php
vendored
Normal file
@ -0,0 +1,237 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Composer;
|
||||
|
||||
use Composer\Semver\VersionParser;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class InstalledVersions
|
||||
{
|
||||
private static $installed = array (
|
||||
'root' =>
|
||||
array (
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => '0d931e270b425b35fabb421ea21043ba2aaf9786',
|
||||
'name' => '__root__',
|
||||
),
|
||||
'versions' =>
|
||||
array (
|
||||
'__root__' =>
|
||||
array (
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => '0d931e270b425b35fabb421ea21043ba2aaf9786',
|
||||
),
|
||||
'gregwar/captcha' =>
|
||||
array (
|
||||
'pretty_version' => 'v1.1.9',
|
||||
'version' => '1.1.9.0',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => '4bb668e6b40e3205a020ca5ee4ca8cff8b8780c5',
|
||||
),
|
||||
'symfony/finder' =>
|
||||
array (
|
||||
'pretty_version' => 'v6.0.3',
|
||||
'version' => '6.0.3.0',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => '8661b74dbabc23223f38c9b99d3f8ade71170430',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getInstalledPackages()
|
||||
{
|
||||
return array_keys(self::$installed['versions']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function isInstalled($packageName)
|
||||
{
|
||||
return isset(self::$installed['versions'][$packageName]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function satisfies(VersionParser $parser, $packageName, $constraint)
|
||||
{
|
||||
$constraint = $parser->parseConstraints($constraint);
|
||||
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
|
||||
|
||||
return $provided->matches($constraint);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getVersionRanges($packageName)
|
||||
{
|
||||
if (!isset(self::$installed['versions'][$packageName])) {
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
$ranges = array();
|
||||
if (isset(self::$installed['versions'][$packageName]['pretty_version'])) {
|
||||
$ranges[] = self::$installed['versions'][$packageName]['pretty_version'];
|
||||
}
|
||||
if (array_key_exists('aliases', self::$installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['aliases']);
|
||||
}
|
||||
if (array_key_exists('replaced', self::$installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['replaced']);
|
||||
}
|
||||
if (array_key_exists('provided', self::$installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['provided']);
|
||||
}
|
||||
|
||||
return implode(' || ', $ranges);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getVersion($packageName)
|
||||
{
|
||||
if (!isset(self::$installed['versions'][$packageName])) {
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
if (!isset(self::$installed['versions'][$packageName]['version'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return self::$installed['versions'][$packageName]['version'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getPrettyVersion($packageName)
|
||||
{
|
||||
if (!isset(self::$installed['versions'][$packageName])) {
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
if (!isset(self::$installed['versions'][$packageName]['pretty_version'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return self::$installed['versions'][$packageName]['pretty_version'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getReference($packageName)
|
||||
{
|
||||
if (!isset(self::$installed['versions'][$packageName])) {
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
if (!isset(self::$installed['versions'][$packageName]['reference'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return self::$installed['versions'][$packageName]['reference'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getRootPackage()
|
||||
{
|
||||
return self::$installed['root'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getRawData()
|
||||
{
|
||||
return self::$installed;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function reload($data)
|
||||
{
|
||||
self::$installed = $data;
|
||||
}
|
||||
}
|
21
web/vendor/composer/LICENSE
vendored
Normal file
21
web/vendor/composer/LICENSE
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
Copyright (c) Nils Adermann, Jordi Boggiano
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
10
web/vendor/composer/autoload_classmap.php
vendored
Normal file
10
web/vendor/composer/autoload_classmap.php
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
// autoload_classmap.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
||||
);
|
9
web/vendor/composer/autoload_namespaces.php
vendored
Normal file
9
web/vendor/composer/autoload_namespaces.php
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
// autoload_namespaces.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
);
|
11
web/vendor/composer/autoload_psr4.php
vendored
Normal file
11
web/vendor/composer/autoload_psr4.php
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
// autoload_psr4.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
|
||||
'Gregwar\\' => array($vendorDir . '/gregwar/captcha/src/Gregwar'),
|
||||
);
|
55
web/vendor/composer/autoload_real.php
vendored
Normal file
55
web/vendor/composer/autoload_real.php
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInite9f59116cb3d815416daaf015687f2ec
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
public static function loadClassLoader($class)
|
||||
{
|
||||
if ('Composer\Autoload\ClassLoader' === $class) {
|
||||
require __DIR__ . '/ClassLoader.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Composer\Autoload\ClassLoader
|
||||
*/
|
||||
public static function getLoader()
|
||||
{
|
||||
if (null !== self::$loader) {
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInite9f59116cb3d815416daaf015687f2ec', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInite9f59116cb3d815416daaf015687f2ec', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInite9f59116cb3d815416daaf015687f2ec::getInitializer($loader));
|
||||
} else {
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
|
||||
$map = require __DIR__ . '/autoload_psr4.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->setPsr4($namespace, $path);
|
||||
}
|
||||
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
}
|
||||
}
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
44
web/vendor/composer/autoload_static.php
vendored
Normal file
44
web/vendor/composer/autoload_static.php
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
// autoload_static.php @generated by Composer
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInite9f59116cb3d815416daaf015687f2ec
|
||||
{
|
||||
public static $prefixLengthsPsr4 = array (
|
||||
'S' =>
|
||||
array (
|
||||
'Symfony\\Component\\Finder\\' => 25,
|
||||
),
|
||||
'G' =>
|
||||
array (
|
||||
'Gregwar\\' => 8,
|
||||
),
|
||||
);
|
||||
|
||||
public static $prefixDirsPsr4 = array (
|
||||
'Symfony\\Component\\Finder\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/finder',
|
||||
),
|
||||
'Gregwar\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/gregwar/captcha/src/Gregwar',
|
||||
),
|
||||
);
|
||||
|
||||
public static $classMap = array (
|
||||
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInite9f59116cb3d815416daaf015687f2ec::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInite9f59116cb3d815416daaf015687f2ec::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInite9f59116cb3d815416daaf015687f2ec::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
}
|
130
web/vendor/composer/installed.json
vendored
Normal file
130
web/vendor/composer/installed.json
vendored
Normal file
@ -0,0 +1,130 @@
|
||||
{
|
||||
"packages": [
|
||||
{
|
||||
"name": "gregwar/captcha",
|
||||
"version": "v1.1.9",
|
||||
"version_normalized": "1.1.9.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Gregwar/Captcha.git",
|
||||
"reference": "4bb668e6b40e3205a020ca5ee4ca8cff8b8780c5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Gregwar/Captcha/zipball/4bb668e6b40e3205a020ca5ee4ca8cff8b8780c5",
|
||||
"reference": "4bb668e6b40e3205a020ca5ee4ca8cff8b8780c5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-gd": "*",
|
||||
"ext-mbstring": "*",
|
||||
"php": ">=5.3.0",
|
||||
"symfony/finder": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^6.4"
|
||||
},
|
||||
"time": "2020-03-24T14:39:05+00:00",
|
||||
"type": "captcha",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Gregwar\\": "src/Gregwar"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Grégoire Passault",
|
||||
"email": "g.passault@gmail.com",
|
||||
"homepage": "http://www.gregwar.com/"
|
||||
},
|
||||
{
|
||||
"name": "Jeremy Livingston",
|
||||
"email": "jeremy.j.livingston@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Captcha generator",
|
||||
"homepage": "https://github.com/Gregwar/Captcha",
|
||||
"keywords": [
|
||||
"bot",
|
||||
"captcha",
|
||||
"spam"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/Gregwar/Captcha/issues",
|
||||
"source": "https://github.com/Gregwar/Captcha/tree/master"
|
||||
},
|
||||
"install-path": "../gregwar/captcha"
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
"version": "v6.0.3",
|
||||
"version_normalized": "6.0.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/finder.git",
|
||||
"reference": "8661b74dbabc23223f38c9b99d3f8ade71170430"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/8661b74dbabc23223f38c9b99d3f8ade71170430",
|
||||
"reference": "8661b74dbabc23223f38c9b99d3f8ade71170430",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.0.2"
|
||||
},
|
||||
"time": "2022-01-26T17:23:29+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Finder\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Finds files and directories via an intuitive fluent interface",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/finder/tree/v6.0.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"install-path": "../symfony/finder"
|
||||
}
|
||||
],
|
||||
"dev": true,
|
||||
"dev-package-names": []
|
||||
}
|
42
web/vendor/composer/installed.php
vendored
Normal file
42
web/vendor/composer/installed.php
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
<?php return array (
|
||||
'root' =>
|
||||
array (
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => '0d931e270b425b35fabb421ea21043ba2aaf9786',
|
||||
'name' => '__root__',
|
||||
),
|
||||
'versions' =>
|
||||
array (
|
||||
'__root__' =>
|
||||
array (
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => '0d931e270b425b35fabb421ea21043ba2aaf9786',
|
||||
),
|
||||
'gregwar/captcha' =>
|
||||
array (
|
||||
'pretty_version' => 'v1.1.9',
|
||||
'version' => '1.1.9.0',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => '4bb668e6b40e3205a020ca5ee4ca8cff8b8780c5',
|
||||
),
|
||||
'symfony/finder' =>
|
||||
array (
|
||||
'pretty_version' => 'v6.0.3',
|
||||
'version' => '6.0.3.0',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => '8661b74dbabc23223f38c9b99d3f8ade71170430',
|
||||
),
|
||||
),
|
||||
);
|
5
web/vendor/gregwar/captcha/.gitignore
vendored
Normal file
5
web/vendor/gregwar/captcha/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
.idea/
|
||||
demo/*.jpg
|
||||
demo/*.pgm
|
||||
demo/temp/
|
||||
vendor/
|
16
web/vendor/gregwar/captcha/.travis.yml
vendored
Normal file
16
web/vendor/gregwar/captcha/.travis.yml
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.3.3
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
- 7.1
|
||||
- 7.2
|
||||
- hhvm
|
||||
|
||||
script:
|
||||
- composer install
|
||||
- phpunit
|
19
web/vendor/gregwar/captcha/LICENSE
vendored
Normal file
19
web/vendor/gregwar/captcha/LICENSE
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) <2012-2017> Grégoire Passault
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
146
web/vendor/gregwar/captcha/README.md
vendored
Normal file
146
web/vendor/gregwar/captcha/README.md
vendored
Normal file
@ -0,0 +1,146 @@
|
||||
Captcha
|
||||
=======
|
||||
|
||||
![Captchas examples](http://gregwar.com/captchas.png)
|
||||
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YUXRLWHQSWS6L)
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
With composer :
|
||||
|
||||
``` json
|
||||
{
|
||||
...
|
||||
"require": {
|
||||
"gregwar/captcha": "1.*"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
You can create a captcha with the `CaptchaBuilder` :
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use Gregwar\Captcha\CaptchaBuilder;
|
||||
|
||||
$builder = new CaptchaBuilder;
|
||||
$builder->build();
|
||||
```
|
||||
|
||||
You can then save it to a file :
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$builder->save('out.jpg');
|
||||
```
|
||||
|
||||
Or output it directly :
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
header('Content-type: image/jpeg');
|
||||
$builder->output();
|
||||
```
|
||||
|
||||
Or inline it directly in the HTML page:
|
||||
|
||||
```php
|
||||
<img src="<?php echo $builder->inline(); ?>" />
|
||||
```
|
||||
|
||||
You'll be able to get the code and compare it with a user input :
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
// Example: storing the phrase in the session to test for the user
|
||||
// input later
|
||||
$_SESSION['phrase'] = $builder->getPhrase();
|
||||
```
|
||||
|
||||
You can compare the phrase with user input:
|
||||
```php
|
||||
if($builder->testPhrase($userInput)) {
|
||||
// instructions if user phrase is good
|
||||
}
|
||||
else {
|
||||
// user phrase is wrong
|
||||
}
|
||||
```
|
||||
|
||||
API
|
||||
===
|
||||
|
||||
You can use theses functions :
|
||||
|
||||
* **__construct($phrase = null)**, constructs the builder with the given phrase, if the phrase is null, a random one will be generated
|
||||
* **getPhrase()**, allow you to get the phrase contents
|
||||
* **setDistortion($distortion)**, enable or disable the distortion, call it before `build()`
|
||||
* **isOCRReadable()**, returns `true` if the OCR can be read using the `ocrad` software, you'll need to have shell_exec enabled, imagemagick and ocrad installed
|
||||
* **buildAgainstOCR($width = 150, $height = 40, $font = null)**, builds a code until it is not readable by `ocrad`
|
||||
* **build($width = 150, $height = 40, $font = null)**, builds a code with the given $width, $height and $font. By default, a random font will be used from the library
|
||||
* **save($filename, $quality = 80)**, saves the captcha into a jpeg in the $filename, with the given quality
|
||||
* **get($quality = 80)**, returns the jpeg data
|
||||
* **output($quality = 80)**, directly outputs the jpeg code to a browser
|
||||
* **setBackgroundColor($r, $g, $b)**, sets the background color to force it (this will disable many effects and is not recommended)
|
||||
* **setBackgroundImages(array($imagepath1, $imagePath2))**, Sets custom background images to be used as captcha background. It is recommended to disable image effects when passing custom images for background (ignore_all_effects). A random image is selected from the list passed, the full paths to the image files must be passed.
|
||||
* **setInterpolation($interpolate)**, enable or disable the interpolation (enabled by default), disabling it will be quicker but the images will look uglier
|
||||
* **setIgnoreAllEffects($ignoreAllEffects)**, disable all effects on the captcha image. Recommended to use when passing custom background images for the captcha.
|
||||
* **testPhrase($phrase)**, returns true if the given phrase is good
|
||||
* **setMaxBehindLines($lines)**, sets the maximum number of lines behind the code
|
||||
* **setMaxFrontLines($lines)**, sets the maximum number of lines on the front of the code
|
||||
|
||||
If you want to change the number of character, you can call the phrase builder directly using
|
||||
extra parameters:
|
||||
|
||||
```php
|
||||
use Gregwar\Captcha\CaptchaBuilder;
|
||||
use Gregwar\Captcha\PhraseBuilder;
|
||||
|
||||
// Will build phrases of 3 characters
|
||||
$phraseBuilder = new PhraseBuilder(4)
|
||||
|
||||
// Will build phrases of 5 characters, only digits
|
||||
$phraseBuilder = new PhraseBuilder(5, '0123456789');
|
||||
|
||||
// Pass it as first argument of CaptchaBuilder, passing it the phrase
|
||||
// builder
|
||||
$captcha = new CaptchaBuilder(null, $phraseBuilder);
|
||||
```
|
||||
|
||||
You can also pass directly the wanted phrase to the builder:
|
||||
|
||||
```php
|
||||
// Building a Captcha with the "hello" phrase
|
||||
$captcha = new CaptchaBuilder('hello');
|
||||
```
|
||||
|
||||
Complete example
|
||||
================
|
||||
|
||||
If you want to see an example you can have a look at he ``demo/form.php``, which uses ``demo/session.php`` to
|
||||
render a captcha and check it after the submission
|
||||
|
||||
Symfony Bundle
|
||||
================
|
||||
|
||||
You can have a look at the following repository to enjoy the Symfony 2 bundle packaging this captcha generator :
|
||||
https://github.com/Gregwar/CaptchaBundle
|
||||
|
||||
Yii2 Extension
|
||||
===============
|
||||
|
||||
You can use the following extension for integrating with Yii2 Framework :
|
||||
https://github.com/juliardi/yii2-captcha
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
This library is under MIT license, have a look to the `LICENSE` file
|
33
web/vendor/gregwar/captcha/composer.json
vendored
Normal file
33
web/vendor/gregwar/captcha/composer.json
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "gregwar/captcha",
|
||||