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 |
request_interface.php
001 <?php
002 /**
003 *
004 * This file is part of the phpBB Forum Software package.
005 *
006 * @copyright (c) phpBB Limited <https://www.phpbb.com>
007 * @license GNU General Public License, version 2 (GPL-2.0)
008 *
009 * For full copyright and license information, please see
010 * the docs/CREDITS.txt file.
011 *
012 */
013
014 namespace phpbb\request;
015
016 /**
017 * An interface through which all application input can be accessed.
018 */
019 interface request_interface
020 {
021 /**#@+
022 * Constant identifying the super global with the same name.
023 */
024 const POST = 0;
025 const GET = 1;
026 const REQUEST = 2;
027 const COOKIE = 3;
028 const SERVER = 4;
029 const FILES = 5;
030 /**#@-*/
031
032 /**
033 * This function allows overwriting or setting a value in one of the super global arrays.
034 *
035 * Changes which are performed on the super globals directly will not have any effect on the results of
036 * other methods this class provides. Using this function should be avoided if possible! It will
037 * consume twice the the amount of memory of the value
038 *
039 * @param string $var_name The name of the variable that shall be overwritten
040 * @param mixed $value The value which the variable shall contain.
041 * If this is null the variable will be unset.
042 * @param string $super_global (\phpbb\request\request_interface::POST|GET|REQUEST|COOKIE)
043 * Specifies which super global shall be changed
044 */
045 public function overwrite($var_name, $value, $super_global = \phpbb\request\request_interface::REQUEST);
046
047 /**
048 * Central type safe input handling function.
049 * All variables in GET or POST requests should be retrieved through this function to maximise security.
050 *
051 * @param string|array $var_name The form variable's name from which data shall be retrieved.
052 * If the value is an array this may be an array of indizes which will give
053 * direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a")
054 * then specifying array("var", 1) as the name will return "a".
055 * @param mixed $default A default value that is returned if the variable was not set.
056 * This function will always return a value of the same type as the default.
057 * @param bool $multibyte If $default is a string this parameter has to be true if the variable may contain any UTF-8 characters
058 * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks
059 * @param string $super_global (\phpbb\request\request_interface::POST|GET|REQUEST|COOKIE)
060 * Specifies which super global shall be changed
061 *
062 * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the
063 * the same as that of $default. If the variable is not set $default is returned.
064 */
065 public function variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST);
066
067 /**
068 * Get a variable without trimming strings and without escaping.
069 * This method MUST NOT be used with queries.
070 * Same functionality as variable(), except does not run trim() on strings
071 * and does not escape input.
072 * This method should only be used when the raw input is needed without
073 * any escaping, i.e. for database password during the installation.
074 *
075 * @param string|array $var_name The form variable's name from which data shall be retrieved.
076 * If the value is an array this may be an array of indizes which will give
077 * direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a")
078 * then specifying array("var", 1) as the name will return "a".
079 * @param mixed $default A default value that is returned if the variable was not set.
080 * This function will always return a value of the same type as the default.
081 * @param string $super_global (\phpbb\request\request_interface::POST|GET|REQUEST|COOKIE)
082 * Specifies which super global shall be changed
083 *
084 * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the
085 * the same as that of $default. If the variable is not set $default is returned.
086 */
087 public function raw_variable($var_name, $default, $super_global = \phpbb\request\request_interface::REQUEST);
088
089 /**
090 * Shortcut method to retrieve SERVER variables.
091 *
092 * @param string|array $var_name See \phpbb\request\request_interface::variable
093 * @param mixed $default See \phpbb\request\request_interface::variable
094 *
095 * @return mixed The server variable value.
096 */
097 public function server($var_name, $default = '');
098
099 /**
100 * Shortcut method to retrieve the value of client HTTP headers.
101 *
102 * @param string|array $header_name The name of the header to retrieve.
103 * @param mixed $default See \phpbb\request\request_interface::variable
104 *
105 * @return mixed The header value.
106 */
107 public function header($header_name, $default = '');
108
109 /**
110 * Checks whether a certain variable was sent via POST.
111 * To make sure that a request was sent using POST you should call this function
112 * on at least one variable.
113 *
114 * @param string $name The name of the form variable which should have a
115 * _p suffix to indicate the check in the code that creates the form too.
116 *
117 * @return bool True if the variable was set in a POST request, false otherwise.
118 */
119 public function is_set_post($name);
120
121 /**
122 * Checks whether a certain variable is set in one of the super global
123 * arrays.
124 *
125 * @param string $var Name of the variable
126 * @param string $super_global (\phpbb\request\request_interface::POST|GET|REQUEST|COOKIE)
127 * Specifies which super global shall be changed
128 *
129 * @return bool True if the variable was sent as input
130 */
131 public function is_set($var, $super_global = \phpbb\request\request_interface::REQUEST);
132
133 /**
134 * Checks whether the current request is an AJAX request (XMLHttpRequest)
135 *
136 * @return bool True if the current request is an ajax request
137 */
138 public function is_ajax();
139
140 /**
141 * Checks if the current request is happening over HTTPS.
142 *
143 * @return bool True if the request is secure.
144 */
145 public function is_secure();
146
147 /**
148 * Returns all variable names for a given super global
149 *
150 * @param string $super_global (\phpbb\request\request_interface::POST|GET|REQUEST|COOKIE)
151 * The super global from which names shall be taken
152 *
153 * @return array All variable names that are set for the super global.
154 * Pay attention when using these, they are unsanitised!
155 */
156 public function variable_names($super_global = \phpbb\request\request_interface::REQUEST);
157
158 /**
159 * Returns the original array of the requested super global
160 *
161 * @param string $super_global (\phpbb\request\request_interface::POST|GET|REQUEST|COOKIE)
162 * The super global which will be returned
163 *
164 * @return array The original array of the requested super global.
165 */
166 public function get_super_global($super_global = \phpbb\request\request_interface::REQUEST);
167
168 /**
169 * Escape a string variable.
170 *
171 * @param mixed $value The contents to fill with
172 * @param bool $multibyte Indicates whether string values may contain UTF-8 characters.
173 * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks.
174 * @return string|array
175 */
176 public function escape($value, $multibyte);
177 }
178