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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

Socket.php

Zuletzt modifiziert: 02.04.2025, 15:04 - Dateigröße: 3.30 KiB


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\RequestMethod;
036   
037  /**
038   * Convenience wrapper around native socket and file functions to allow for
039   * mocking.
040   */
041  class Socket
042  {
043      private $handle = null;
044   
045      /**
046       * fsockopen
047       *
048       * @see http://php.net/fsockopen
049       * @param string $hostname
050       * @param int $port
051       * @param int $errno
052       * @param string $errstr
053       * @param float $timeout
054       * @return resource
055       */
056      public function fsockopen($hostname, $port = -1, &$errno = 0, &$errstr = '', $timeout = null)
057      {
058          $this->handle = fsockopen($hostname, $port, $errno, $errstr, (is_null($timeout) ? ini_get("default_socket_timeout") : $timeout));
059   
060          if ($this->handle != false && $errno === 0 && $errstr === '') {
061              return $this->handle;
062          }
063          return false;
064      }
065   
066      /**
067       * fwrite
068       *
069       * @see http://php.net/fwrite
070       * @param string $string
071       * @param int $length
072       * @return int | bool
073       */
074      public function fwrite($string, $length = null)
075      {
076          return fwrite($this->handle, $string, (is_null($length) ? strlen($string) : $length));
077      }
078   
079      /**
080       * fgets
081       *
082       * @see http://php.net/fgets
083       * @param int $length
084       * @return string
085       */
086      public function fgets($length = null)
087      {
088          return fgets($this->handle, $length);
089      }
090   
091      /**
092       * feof
093       *
094       * @see http://php.net/feof
095       * @return bool
096       */
097      public function feof()
098      {
099          return feof($this->handle);
100      }
101   
102      /**
103       * fclose
104       *
105       * @see http://php.net/fclose
106       * @return bool
107       */
108      public function fclose()
109      {
110          return fclose($this->handle);
111      }
112  }
113