From 08c85cada886b78230c9594a9dc25785b7417fe0 Mon Sep 17 00:00:00 2001 From: merdan Date: Thu, 15 Apr 2021 14:44:43 +0500 Subject: [PATCH] env --- config/app.php | 6 +- config/cache.php | 2 +- config/cms.php | 10 +- config/database.php | 42 +-- config/mail.php | 12 +- config/queue.php | 2 +- config/session.php | 2 +- .../updates/scf_tables_05.php | 31 ++ .../vendor/google/recaptcha/LICENSE | 29 ++ .../vendor/google/recaptcha/README.md | 140 +++++++++ .../vendor/google/recaptcha/composer.json | 39 +++ .../recaptcha/src/ReCaptcha/ReCaptcha.php | 269 ++++++++++++++++++ .../recaptcha/src/ReCaptcha/RequestMethod.php | 50 ++++ .../src/ReCaptcha/RequestMethod/Curl.php | 82 ++++++ .../src/ReCaptcha/RequestMethod/CurlPost.php | 104 +++++++ .../src/ReCaptcha/RequestMethod/Post.php | 88 ++++++ .../src/ReCaptcha/RequestMethod/Socket.php | 112 ++++++++ .../ReCaptcha/RequestMethod/SocketPost.php | 108 +++++++ .../src/ReCaptcha/RequestParameters.php | 111 ++++++++ .../recaptcha/src/ReCaptcha/Response.php | 218 ++++++++++++++ .../vendor/google/recaptcha/src/autoload.php | 69 +++++ ...r_table_update_rainlab_blog_categories.php | 23 ++ ...table_update_rainlab_blog_categories_2.php | 23 ++ ...table_update_rainlab_blog_categories_3.php | 23 ++ ...r_table_update_vdlp_rssfetcher_sources.php | 23 ++ 25 files changed, 1580 insertions(+), 38 deletions(-) create mode 100644 plugins/janvince/smallcontactform/updates/scf_tables_05.php create mode 100644 plugins/janvince/smallcontactform/vendor/google/recaptcha/LICENSE create mode 100644 plugins/janvince/smallcontactform/vendor/google/recaptcha/README.md create mode 100644 plugins/janvince/smallcontactform/vendor/google/recaptcha/composer.json create mode 100644 plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/ReCaptcha.php create mode 100644 plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/RequestMethod.php create mode 100644 plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Curl.php create mode 100644 plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/CurlPost.php create mode 100644 plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Post.php create mode 100644 plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Socket.php create mode 100644 plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/SocketPost.php create mode 100644 plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/RequestParameters.php create mode 100644 plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/Response.php create mode 100644 plugins/janvince/smallcontactform/vendor/google/recaptcha/src/autoload.php create mode 100644 plugins/rainlab/blog/updates/builder_table_update_rainlab_blog_categories.php create mode 100644 plugins/rainlab/blog/updates/builder_table_update_rainlab_blog_categories_2.php create mode 100644 plugins/rainlab/blog/updates/builder_table_update_rainlab_blog_categories_3.php create mode 100644 plugins/vdlp/rssfetcher/updates/builder_table_update_vdlp_rssfetcher_sources.php diff --git a/config/app.php b/config/app.php index d073ca3bc..d783633ab 100644 --- a/config/app.php +++ b/config/app.php @@ -16,7 +16,7 @@ return [ | */ - 'debug' => true, + 'debug' => env('APP_DEBUG', true), /* |-------------------------------------------------------------------------- @@ -41,7 +41,7 @@ return [ | */ - 'url' => 'http://localhost', + 'url' => env('APP_URL', 'http://localhost'), /* |-------------------------------------------------------------------------- @@ -107,7 +107,7 @@ return [ | */ - 'key' => 'eewJAqF0bRZuyNoSULErcjKkZWZKFeK6', + 'key' => env('APP_KEY', ''), 'cipher' => 'AES-256-CBC', diff --git a/config/cache.php b/config/cache.php index 251771724..ba95b1801 100644 --- a/config/cache.php +++ b/config/cache.php @@ -13,7 +13,7 @@ return [ | */ - 'default' => 'file', + 'default' => env('CACHE_DRIVER', 'file'), /* |-------------------------------------------------------------------------- diff --git a/config/cms.php b/config/cms.php index 07def4008..afcde7d79 100644 --- a/config/cms.php +++ b/config/cms.php @@ -156,7 +156,7 @@ return [ | */ - 'enableRoutesCache' => false, + 'enableRoutesCache' => env('ROUTES_CACHE', false), /* |-------------------------------------------------------------------------- @@ -196,7 +196,7 @@ return [ | */ - 'enableAssetCache' => false, + 'enableAssetCache' => env('ASSET_CACHE', false), /* |-------------------------------------------------------------------------- @@ -250,7 +250,7 @@ return [ | */ - 'databaseTemplates' => false, + 'databaseTemplates' => env('DATABASE_TEMPLATES', false), /* |-------------------------------------------------------------------------- @@ -360,7 +360,7 @@ return [ | */ - 'linkPolicy' => 'detect', + 'linkPolicy' => env('LINK_POLICY', 'detect'), /* |-------------------------------------------------------------------------- @@ -396,7 +396,7 @@ return [ | */ - 'enableCsrfProtection' => false, + 'enableCsrfProtection' => env('ENABLE_CSRF', false), /* |-------------------------------------------------------------------------- diff --git a/config/database.php b/config/database.php index d8baebc80..4d0464719 100644 --- a/config/database.php +++ b/config/database.php @@ -26,7 +26,7 @@ return [ | */ - 'default' => 'mysql', + 'default' => env('DB_CONNECTION', 'mysql'), /* |-------------------------------------------------------------------------- @@ -48,18 +48,18 @@ return [ 'sqlite' => [ 'driver' => 'sqlite', - 'database' => 'storage/database.sqlite', + 'database' => env('DB_DATABASE', 'storage/database.sqlite'), 'prefix' => '', ], 'mysql' => [ 'driver' => 'mysql', 'engine' => 'InnoDB', - 'host' => '192.168.1.2', - 'port' => '3306', - 'database' => 'orient', - 'username' => 'orient', - 'password' => 'orient', + 'host' => env('DB_HOST', '192.168.1.2'), + 'port' => env('DB_PORT', '3306'), + 'database' => env('DB_DATABASE', 'orient'), + 'username' => env('DB_USERNAME', ''), + 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', @@ -68,11 +68,11 @@ return [ 'pgsql' => [ 'driver' => 'pgsql', - 'host' => 'localhost', - 'port' => 5432, - 'database' => 'database', - 'username' => 'root', - 'password' => '', + 'host' => env('DB_HOST', 'localhost'), + 'port' => env('DB_PORT', 5432), + 'database' => env('DB_DATABASE', 'database'), + 'username' => env('DB_USERNAME', ''), + 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8', 'prefix' => '', 'schema' => 'public', @@ -80,11 +80,11 @@ return [ 'sqlsrv' => [ 'driver' => 'sqlsrv', - 'host' => 'localhost', - 'port' => 1433, - 'database' => 'database', - 'username' => 'root', - 'password' => '', + 'host' => env('DB_HOST', 'localhost'), + 'port' => env('DB_PORT', 5432), + 'database' => env('DB_DATABASE', 'database'), + 'username' => env('DB_USERNAME', ''), + 'password' => env('DB_PASSWORD', ''), 'prefix' => '', ], @@ -120,9 +120,9 @@ return [ 'cluster' => false, 'default' => [ - 'host' => '127.0.0.1', - 'password' => null, - 'port' => 6379, + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'password' => env('REDIS_PASSWORD', null), + 'port' => env('REDIS_PORT', 6379), 'database' => 0, ], @@ -143,5 +143,5 @@ return [ | */ - 'useConfigForTesting' => false, + 'useConfigForTesting' => env('DB_USE_CONFIG_FOR_TESTING', false), ]; diff --git a/config/mail.php b/config/mail.php index 4c471d568..d707395ac 100644 --- a/config/mail.php +++ b/config/mail.php @@ -16,7 +16,7 @@ return [ | */ - 'driver' => 'smtp', + 'driver' => env('MAIL_DRIVER', 'smtp'), /* |-------------------------------------------------------------------------- @@ -29,7 +29,7 @@ return [ | */ - 'host' => 'smtp.mailgun.org', + 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), /* |-------------------------------------------------------------------------- @@ -42,7 +42,7 @@ return [ | */ - 'port' => 587, + 'port' => env('MAIL_PORT', 587), /* |-------------------------------------------------------------------------- @@ -68,7 +68,7 @@ return [ | */ - 'encryption' => 'tls', + 'encryption' => env('MAIL_ENCRYPTION', 'tls'), /* |-------------------------------------------------------------------------- @@ -81,7 +81,7 @@ return [ | */ - 'username' => null, + 'username' => env('MAIL_USERNAME', null), /* |-------------------------------------------------------------------------- @@ -94,7 +94,7 @@ return [ | */ - 'password' => null, + 'password' => env('MAIL_PASSWORD', null), /* |-------------------------------------------------------------------------- diff --git a/config/queue.php b/config/queue.php index de27ab7f1..3b8f5d36b 100644 --- a/config/queue.php +++ b/config/queue.php @@ -16,7 +16,7 @@ return [ | */ - 'default' => 'sync', + 'default' => env('QUEUE_DRIVER', 'sync'), /* |-------------------------------------------------------------------------- diff --git a/config/session.php b/config/session.php index 39159a008..2b48b18d4 100644 --- a/config/session.php +++ b/config/session.php @@ -16,7 +16,7 @@ return [ | */ - 'driver' => 'cookie', + 'driver' => env('SESSION_DRIVER', 'cookie'), /* |-------------------------------------------------------------------------- diff --git a/plugins/janvince/smallcontactform/updates/scf_tables_05.php b/plugins/janvince/smallcontactform/updates/scf_tables_05.php new file mode 100644 index 000000000..3e06a2c8f --- /dev/null +++ b/plugins/janvince/smallcontactform/updates/scf_tables_05.php @@ -0,0 +1,31 @@ +text('url', 2000)->nullable()->change(); + }); + } + } + + public function down() + { + if (Schema::hasColumn('janvince_smallcontactform_messages', 'form_description')) + { + Schema::table('janvince_smallcontactform_messages', function($table) + { + $table->text('url')->nullable()->change(); + }); + } + } +} diff --git a/plugins/janvince/smallcontactform/vendor/google/recaptcha/LICENSE b/plugins/janvince/smallcontactform/vendor/google/recaptcha/LICENSE new file mode 100644 index 000000000..d147b35b3 --- /dev/null +++ b/plugins/janvince/smallcontactform/vendor/google/recaptcha/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2019, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/plugins/janvince/smallcontactform/vendor/google/recaptcha/README.md b/plugins/janvince/smallcontactform/vendor/google/recaptcha/README.md new file mode 100644 index 000000000..92e8deae7 --- /dev/null +++ b/plugins/janvince/smallcontactform/vendor/google/recaptcha/README.md @@ -0,0 +1,140 @@ +# reCAPTCHA PHP client library + +[![Build Status](https://travis-ci.org/google/recaptcha.svg)](https://travis-ci.org/google/recaptcha) +[![Coverage Status](https://coveralls.io/repos/github/google/recaptcha/badge.svg)](https://coveralls.io/github/google/recaptcha) +[![Latest Stable Version](https://poser.pugx.org/google/recaptcha/v/stable.svg)](https://packagist.org/packages/google/recaptcha) +[![Total Downloads](https://poser.pugx.org/google/recaptcha/downloads.svg)](https://packagist.org/packages/google/recaptcha) + +reCAPTCHA is a free CAPTCHA service that protects websites from spam and abuse. +This is a PHP library that wraps up the server-side verification step required +to process responses from the reCAPTCHA service. This client supports both v2 +and v3. + +- reCAPTCHA: https://www.google.com/recaptcha +- This repo: https://github.com/google/recaptcha +- Hosted demo: https://recaptcha-demo.appspot.com/ +- Version: 1.2.4 +- License: BSD, see [LICENSE](LICENSE) + +## Installation + +### Composer (recommended) + +Use [Composer](https://getcomposer.org) to install this library from Packagist: +[`google/recaptcha`](https://packagist.org/packages/google/recaptcha) + +Run the following command from your project directory to add the dependency: + +```sh +composer require google/recaptcha "^1.2" +``` + +Alternatively, add the dependency directly to your `composer.json` file: + +```json +"require": { + "google/recaptcha": "^1.2" +} +``` + +### Direct download + +Download the [ZIP file](https://github.com/google/recaptcha/archive/master.zip) +and extract into your project. An autoloader script is provided in +`src/autoload.php` which you can require into your script. For example: + +```php +require_once '/path/to/recaptcha/src/autoload.php'; +$recaptcha = new \ReCaptcha\ReCaptcha($secret); +``` + +The classes in the project are structured according to the +[PSR-4](http://www.php-fig.org/psr/psr-4/) standard, so you can also use your +own autoloader or require the needed files directly in your code. + +## Usage + +First obtain the appropriate keys for the type of reCAPTCHA you wish to +integrate for v2 at https://www.google.com/recaptcha/admin or v3 at +https://g.co/recaptcha/v3. + +Then follow the [integration guide on the developer +site](https://developers.google.com/recaptcha/intro) to add the reCAPTCHA +functionality into your frontend. + +This library comes in when you need to verify the user's response. On the PHP +side you need the response from the reCAPTCHA service and secret key from your +credentials. Instantiate the `ReCaptcha` class with your secret key, specify any +additional validation rules, and then call `verify()` with the reCAPTCHA +response and user's IP address. For example: + +```php +setExpectedHostname('recaptcha-demo.appspot.com') + ->verify($gRecaptchaResponse, $remoteIp); +if ($resp->isSuccess()) { + // Verified! +} else { + $errors = $resp->getErrorCodes(); +} +``` + +The following methods are available: + +- `setExpectedHostname($hostname)`: ensures the hostname matches. You must do + this if you have disabled "Domain/Package Name Validation" for your + credentials. +- `setExpectedApkPackageName($apkPackageName)`: if you're verifying a response + from an Android app. Again, you must do this if you have disabled + "Domain/Package Name Validation" for your credentials. +- `setExpectedAction($action)`: ensures the action matches for the v3 API. +- `setScoreThreshold($threshold)`: set a score threshold for responses from the + v3 API +- `setChallengeTimeout($timeoutSeconds)`: set a timeout between the user passing + the reCAPTCHA and your server processing it. + +Each of the `set`\*`()` methods return the `ReCaptcha` instance so you can chain +them together. For example: + +```php +setExpectedHostname('recaptcha-demo.appspot.com') + ->setExpectedAction('homepage') + ->setScoreThreshold(0.5) + ->verify($gRecaptchaResponse, $remoteIp); + +if ($resp->isSuccess()) { + // Verified! +} else { + $errors = $resp->getErrorCodes(); +} +``` + +You can find the constants for the libraries error codes in the `ReCaptcha` +class constants, e.g. `ReCaptcha::E_HOSTNAME_MISMATCH` + +For more details on usage and structure, see [ARCHITECTURE](ARCHITECTURE.md). + +### Examples + +You can see examples of each reCAPTCHA type in [examples/](examples/). You can +run the examples locally by using the Composer script: + +```sh +composer run-script serve-examples +``` + +This makes use of the in-built PHP dev server to host the examples at +http://localhost:8080/ + +These are also hosted on Google AppEngine Flexible environment at +https://recaptcha-demo.appspot.com/. This is configured by +[`app.yaml`](./app.yaml) which you can also use to [deploy to your own AppEngine +project](https://cloud.google.com/appengine/docs/flexible/php/download). + +## Contributing + +No one ever has enough engineers, so we're very happy to accept contributions +via Pull Requests. For details, see [CONTRIBUTING](CONTRIBUTING.md) diff --git a/plugins/janvince/smallcontactform/vendor/google/recaptcha/composer.json b/plugins/janvince/smallcontactform/vendor/google/recaptcha/composer.json new file mode 100644 index 000000000..ab6b4f1c0 --- /dev/null +++ b/plugins/janvince/smallcontactform/vendor/google/recaptcha/composer.json @@ -0,0 +1,39 @@ +{ + "name": "google/recaptcha", + "description": "Client library for reCAPTCHA, a free service that protects websites from spam and abuse.", + "type": "library", + "keywords": ["recaptcha", "captcha", "spam", "abuse"], + "homepage": "https://www.google.com/recaptcha/", + "license": "BSD-3-Clause", + "support": { + "forum": "https://groups.google.com/forum/#!forum/recaptcha", + "source": "https://github.com/google/recaptcha" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36|^5.7.27|^6.59|^7.5.11", + "friendsofphp/php-cs-fixer": "^2.2.20|^2.15", + "php-coveralls/php-coveralls": "^2.1" + }, + "autoload": { + "psr-4": { + "ReCaptcha\\": "src/ReCaptcha" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "scripts": { + "lint": "vendor/bin/php-cs-fixer -vvv fix --using-cache=no --dry-run .", + "lint-fix": "vendor/bin/php-cs-fixer -vvv fix --using-cache=no .", + "test": "vendor/bin/phpunit --colors=always", + "serve-examples": "@php -S localhost:8080 -t examples" + }, + "config": { + "process-timeout": 0 + } +} diff --git a/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/ReCaptcha.php b/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/ReCaptcha.php new file mode 100644 index 000000000..31ec44a07 --- /dev/null +++ b/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/ReCaptcha.php @@ -0,0 +1,269 @@ +secret = $secret; + $this->requestMethod = (is_null($requestMethod)) ? new RequestMethod\Post() : $requestMethod; + } + + /** + * Calls the reCAPTCHA siteverify API to verify whether the user passes + * CAPTCHA test and additionally runs any specified additional checks + * + * @param string $response The user response token provided by reCAPTCHA, verifying the user on your site. + * @param string $remoteIp The end user's IP address. + * @return Response Response from the service. + */ + public function verify($response, $remoteIp = null) + { + // Discard empty solution submissions + if (empty($response)) { + $recaptchaResponse = new Response(false, array(self::E_MISSING_INPUT_RESPONSE)); + return $recaptchaResponse; + } + + $params = new RequestParameters($this->secret, $response, $remoteIp, self::VERSION); + $rawResponse = $this->requestMethod->submit($params); + $initialResponse = Response::fromJson($rawResponse); + $validationErrors = array(); + + if (isset($this->hostname) && strcasecmp($this->hostname, $initialResponse->getHostname()) !== 0) { + $validationErrors[] = self::E_HOSTNAME_MISMATCH; + } + + if (isset($this->apkPackageName) && strcasecmp($this->apkPackageName, $initialResponse->getApkPackageName()) !== 0) { + $validationErrors[] = self::E_APK_PACKAGE_NAME_MISMATCH; + } + + if (isset($this->action) && strcasecmp($this->action, $initialResponse->getAction()) !== 0) { + $validationErrors[] = self::E_ACTION_MISMATCH; + } + + if (isset($this->threshold) && $this->threshold > $initialResponse->getScore()) { + $validationErrors[] = self::E_SCORE_THRESHOLD_NOT_MET; + } + + if (isset($this->timeoutSeconds)) { + $challengeTs = strtotime($initialResponse->getChallengeTs()); + + if ($challengeTs > 0 && time() - $challengeTs > $this->timeoutSeconds) { + $validationErrors[] = self::E_CHALLENGE_TIMEOUT; + } + } + + if (empty($validationErrors)) { + return $initialResponse; + } + + return new Response( + false, + array_merge($initialResponse->getErrorCodes(), $validationErrors), + $initialResponse->getHostname(), + $initialResponse->getChallengeTs(), + $initialResponse->getApkPackageName(), + $initialResponse->getScore(), + $initialResponse->getAction() + ); + } + + /** + * Provide a hostname to match against in verify() + * This should be without a protocol or trailing slash, e.g. www.google.com + * + * @param string $hostname Expected hostname + * @return ReCaptcha Current instance for fluent interface + */ + public function setExpectedHostname($hostname) + { + $this->hostname = $hostname; + return $this; + } + + /** + * Provide an APK package name to match against in verify() + * + * @param string $apkPackageName Expected APK package name + * @return ReCaptcha Current instance for fluent interface + */ + public function setExpectedApkPackageName($apkPackageName) + { + $this->apkPackageName = $apkPackageName; + return $this; + } + + /** + * Provide an action to match against in verify() + * This should be set per page. + * + * @param string $action Expected action + * @return ReCaptcha Current instance for fluent interface + */ + public function setExpectedAction($action) + { + $this->action = $action; + return $this; + } + + /** + * Provide a threshold to meet or exceed in verify() + * Threshold should be a float between 0 and 1 which will be tested as response >= threshold. + * + * @param float $threshold Expected threshold + * @return ReCaptcha Current instance for fluent interface + */ + public function setScoreThreshold($threshold) + { + $this->threshold = floatval($threshold); + return $this; + } + + /** + * Provide a timeout in seconds to test against the challenge timestamp in verify() + * + * @param int $timeoutSeconds Expected hostname + * @return ReCaptcha Current instance for fluent interface + */ + public function setChallengeTimeout($timeoutSeconds) + { + $this->timeoutSeconds = $timeoutSeconds; + return $this; + } +} diff --git a/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/RequestMethod.php b/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/RequestMethod.php new file mode 100644 index 000000000..0a2a6716e --- /dev/null +++ b/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/RequestMethod.php @@ -0,0 +1,50 @@ +curl = (is_null($curl)) ? new Curl() : $curl; + $this->siteVerifyUrl = (is_null($siteVerifyUrl)) ? ReCaptcha::SITE_VERIFY_URL : $siteVerifyUrl; + } + + /** + * Submit the cURL request with the specified parameters. + * + * @param RequestParameters $params Request parameters + * @return string Body of the reCAPTCHA response + */ + public function submit(RequestParameters $params) + { + $handle = $this->curl->init($this->siteVerifyUrl); + + $options = array( + CURLOPT_POST => true, + CURLOPT_POSTFIELDS => $params->toQueryString(), + CURLOPT_HTTPHEADER => array( + 'Content-Type: application/x-www-form-urlencoded' + ), + CURLINFO_HEADER_OUT => false, + CURLOPT_HEADER => false, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_SSL_VERIFYPEER => true + ); + $this->curl->setoptArray($handle, $options); + + $response = $this->curl->exec($handle); + $this->curl->close($handle); + + if ($response !== false) { + return $response; + } + + return '{"success": false, "error-codes": ["'.ReCaptcha::E_CONNECTION_FAILED.'"]}'; + } +} diff --git a/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Post.php b/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Post.php new file mode 100644 index 000000000..a4ff716fb --- /dev/null +++ b/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Post.php @@ -0,0 +1,88 @@ +siteVerifyUrl = (is_null($siteVerifyUrl)) ? ReCaptcha::SITE_VERIFY_URL : $siteVerifyUrl; + } + + /** + * Submit the POST request with the specified parameters. + * + * @param RequestParameters $params Request parameters + * @return string Body of the reCAPTCHA response + */ + public function submit(RequestParameters $params) + { + $options = array( + 'http' => array( + 'header' => "Content-type: application/x-www-form-urlencoded\r\n", + 'method' => 'POST', + 'content' => $params->toQueryString(), + // Force the peer to validate (not needed in 5.6.0+, but still works) + 'verify_peer' => true, + ), + ); + $context = stream_context_create($options); + $response = file_get_contents($this->siteVerifyUrl, false, $context); + + if ($response !== false) { + return $response; + } + + return '{"success": false, "error-codes": ["'.ReCaptcha::E_CONNECTION_FAILED.'"]}'; + } +} diff --git a/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Socket.php b/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Socket.php new file mode 100644 index 000000000..236bd5f5d --- /dev/null +++ b/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Socket.php @@ -0,0 +1,112 @@ +handle = fsockopen($hostname, $port, $errno, $errstr, (is_null($timeout) ? ini_get("default_socket_timeout") : $timeout)); + + if ($this->handle != false && $errno === 0 && $errstr === '') { + return $this->handle; + } + return false; + } + + /** + * fwrite + * + * @see http://php.net/fwrite + * @param string $string + * @param int $length + * @return int | bool + */ + public function fwrite($string, $length = null) + { + return fwrite($this->handle, $string, (is_null($length) ? strlen($string) : $length)); + } + + /** + * fgets + * + * @see http://php.net/fgets + * @param int $length + * @return string + */ + public function fgets($length = null) + { + return fgets($this->handle, $length); + } + + /** + * feof + * + * @see http://php.net/feof + * @return bool + */ + public function feof() + { + return feof($this->handle); + } + + /** + * fclose + * + * @see http://php.net/fclose + * @return bool + */ + public function fclose() + { + return fclose($this->handle); + } +} diff --git a/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/SocketPost.php b/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/SocketPost.php new file mode 100644 index 000000000..464bc28d4 --- /dev/null +++ b/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/SocketPost.php @@ -0,0 +1,108 @@ +socket = (is_null($socket)) ? new Socket() : $socket; + $this->siteVerifyUrl = (is_null($siteVerifyUrl)) ? ReCaptcha::SITE_VERIFY_URL : $siteVerifyUrl; + } + + /** + * Submit the POST request with the specified parameters. + * + * @param RequestParameters $params Request parameters + * @return string Body of the reCAPTCHA response + */ + public function submit(RequestParameters $params) + { + $errno = 0; + $errstr = ''; + $urlParsed = parse_url($this->siteVerifyUrl); + + if (false === $this->socket->fsockopen('ssl://' . $urlParsed['host'], 443, $errno, $errstr, 30)) { + return '{"success": false, "error-codes": ["'.ReCaptcha::E_CONNECTION_FAILED.'"]}'; + } + + $content = $params->toQueryString(); + + $request = "POST " . $urlParsed['path'] . " HTTP/1.0\r\n"; + $request .= "Host: " . $urlParsed['host'] . "\r\n"; + $request .= "Content-Type: application/x-www-form-urlencoded\r\n"; + $request .= "Content-length: " . strlen($content) . "\r\n"; + $request .= "Connection: close\r\n\r\n"; + $request .= $content . "\r\n\r\n"; + + $this->socket->fwrite($request); + $response = ''; + + while (!$this->socket->feof()) { + $response .= $this->socket->fgets(4096); + } + + $this->socket->fclose(); + + if (0 !== strpos($response, 'HTTP/1.0 200 OK')) { + return '{"success": false, "error-codes": ["'.ReCaptcha::E_BAD_RESPONSE.'"]}'; + } + + $parts = preg_split("#\n\s*\n#Uis", $response); + + return $parts[1]; + } +} diff --git a/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/RequestParameters.php b/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/RequestParameters.php new file mode 100644 index 000000000..e9ba45354 --- /dev/null +++ b/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/RequestParameters.php @@ -0,0 +1,111 @@ +secret = $secret; + $this->response = $response; + $this->remoteIp = $remoteIp; + $this->version = $version; + } + + /** + * Array representation. + * + * @return array Array formatted parameters. + */ + public function toArray() + { + $params = array('secret' => $this->secret, 'response' => $this->response); + + if (!is_null($this->remoteIp)) { + $params['remoteip'] = $this->remoteIp; + } + + if (!is_null($this->version)) { + $params['version'] = $this->version; + } + + return $params; + } + + /** + * Query string representation for HTTP request. + * + * @return string Query string formatted parameters. + */ + public function toQueryString() + { + return http_build_query($this->toArray(), '', '&'); + } +} diff --git a/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/Response.php b/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/Response.php new file mode 100644 index 000000000..55838c074 --- /dev/null +++ b/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/ReCaptcha/Response.php @@ -0,0 +1,218 @@ +success = $success; + $this->hostname = $hostname; + $this->challengeTs = $challengeTs; + $this->apkPackageName = $apkPackageName; + $this->score = $score; + $this->action = $action; + $this->errorCodes = $errorCodes; + } + + /** + * Is success? + * + * @return boolean + */ + public function isSuccess() + { + return $this->success; + } + + /** + * Get error codes. + * + * @return array + */ + public function getErrorCodes() + { + return $this->errorCodes; + } + + /** + * Get hostname. + * + * @return string + */ + public function getHostname() + { + return $this->hostname; + } + + /** + * Get challenge timestamp + * + * @return string + */ + public function getChallengeTs() + { + return $this->challengeTs; + } + + /** + * Get APK package name + * + * @return string + */ + public function getApkPackageName() + { + return $this->apkPackageName; + } + /** + * Get score + * + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * Get action + * + * @return string + */ + public function getAction() + { + return $this->action; + } + + public function toArray() + { + return array( + 'success' => $this->isSuccess(), + 'hostname' => $this->getHostname(), + 'challenge_ts' => $this->getChallengeTs(), + 'apk_package_name' => $this->getApkPackageName(), + 'score' => $this->getScore(), + 'action' => $this->getAction(), + 'error-codes' => $this->getErrorCodes(), + ); + } +} diff --git a/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/autoload.php b/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/autoload.php new file mode 100644 index 000000000..7947a1050 --- /dev/null +++ b/plugins/janvince/smallcontactform/vendor/google/recaptcha/src/autoload.php @@ -0,0 +1,69 @@ +boolean('status')->default(1); + }); + } + + public function down() + { + Schema::table('rainlab_blog_categories', function($table) + { + $table->dropColumn('status'); + }); + } +} diff --git a/plugins/rainlab/blog/updates/builder_table_update_rainlab_blog_categories_2.php b/plugins/rainlab/blog/updates/builder_table_update_rainlab_blog_categories_2.php new file mode 100644 index 000000000..bd14a8ef5 --- /dev/null +++ b/plugins/rainlab/blog/updates/builder_table_update_rainlab_blog_categories_2.php @@ -0,0 +1,23 @@ +renameColumn('status', 'is_active'); + }); + } + + public function down() + { + Schema::table('rainlab_blog_categories', function($table) + { + $table->renameColumn('is_active', 'status'); + }); + } +} diff --git a/plugins/rainlab/blog/updates/builder_table_update_rainlab_blog_categories_3.php b/plugins/rainlab/blog/updates/builder_table_update_rainlab_blog_categories_3.php new file mode 100644 index 000000000..86fc83d63 --- /dev/null +++ b/plugins/rainlab/blog/updates/builder_table_update_rainlab_blog_categories_3.php @@ -0,0 +1,23 @@ +renameColumn('is_active', 'status'); + }); + } + + public function down() + { + Schema::table('rainlab_blog_categories', function($table) + { + $table->renameColumn('status', 'is_active'); + }); + } +} diff --git a/plugins/vdlp/rssfetcher/updates/builder_table_update_vdlp_rssfetcher_sources.php b/plugins/vdlp/rssfetcher/updates/builder_table_update_vdlp_rssfetcher_sources.php new file mode 100644 index 000000000..0a279008b --- /dev/null +++ b/plugins/vdlp/rssfetcher/updates/builder_table_update_vdlp_rssfetcher_sources.php @@ -0,0 +1,23 @@ +string('locale')->default('en'); + }); + } + + public function down() + { + Schema::table('vdlp_rssfetcher_sources', function($table) + { + $table->dropColumn('locale'); + }); + } +}