Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
RequestParameters.php
001 <?php
002 /**
003 * This is a PHP library that handles calling reCAPTCHA.
004 *
005 * BSD 3-Clause License
006 * @copyright (c) 2019, Google Inc.
007 * @link https://www.google.com/recaptcha
008 * All rights reserved.
009 *
010 * Redistribution and use in source and binary forms, with or without
011 * modification, are permitted provided that the following conditions are met:
012 * 1. Redistributions of source code must retain the above copyright notice, this
013 * list of conditions and the following disclaimer.
014 *
015 * 2. Redistributions in binary form must reproduce the above copyright notice,
016 * this list of conditions and the following disclaimer in the documentation
017 * and/or other materials provided with the distribution.
018 *
019 * 3. Neither the name of the copyright holder nor the names of its
020 * contributors may be used to endorse or promote products derived from
021 * this software without specific prior written permission.
022 *
023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
024 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
025 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
026 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
027 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
028 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
029 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
030 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
031 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
032 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
033 */
034
035 namespace ReCaptcha;
036
037 /**
038 * Stores and formats the parameters for the request to the reCAPTCHA service.
039 */
040 class RequestParameters
041 {
042 /**
043 * The shared key between your site and reCAPTCHA.
044 * @var string
045 */
046 private $secret;
047
048 /**
049 * The user response token provided by reCAPTCHA, verifying the user on your site.
050 * @var string
051 */
052 private $response;
053
054 /**
055 * Remote user's IP address.
056 * @var string
057 */
058 private $remoteIp;
059
060 /**
061 * Client version.
062 * @var string
063 */
064 private $version;
065
066 /**
067 * Initialise parameters.
068 *
069 * @param string $secret Site secret.
070 * @param string $response Value from g-captcha-response form field.
071 * @param string $remoteIp User's IP address.
072 * @param string $version Version of this client library.
073 */
074 public function __construct($secret, $response, $remoteIp = null, $version = null)
075 {
076 $this->secret = $secret;
077 $this->response = $response;
078 $this->remoteIp = $remoteIp;
079 $this->version = $version;
080 }
081
082 /**
083 * Array representation.
084 *
085 * @return array Array formatted parameters.
086 */
087 public function toArray()
088 {
089 $params = array('secret' => $this->secret, 'response' => $this->response);
090
091 if (!is_null($this->remoteIp)) {
092 $params['remoteip'] = $this->remoteIp;
093 }
094
095 if (!is_null($this->version)) {
096 $params['version'] = $this->version;
097 }
098
099 return $params;
100 }
101
102 /**
103 * Query string representation for HTTP request.
104 *
105 * @return string Query string formatted parameters.
106 */
107 public function toQueryString()
108 {
109 return http_build_query($this->toArray(), '', '&');
110 }
111 }
112