10 use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
69 $this->request_overrides = [];
80 $trusted_proxies = $config->http_request_trusted_proxy_ips;
81 if (empty($trusted_proxies)) {
85 $allowed_headers = $config->http_request_trusted_proxy_headers;
86 if (empty($allowed_headers)) {
87 $allowed_headers = self::HEADER_X_FORWARDED_FOR | self::HEADER_X_FORWARDED_HOST | self::HEADER_X_FORWARDED_PORT | self::HEADER_X_FORWARDED_PROTO;
90 $this->setTrustedProxies($trusted_proxies, $allowed_headers);
151 if ($override_request) {
154 $this->request->set($key,
$value);
158 unset($this->filtered_params);
159 unset($this->unfiltered_params);
178 $values = $this->
getParams($filter_result);
190 public function getParams(
bool $filter_result =
true): array {
191 if (isset($this->filtered_params) && isset($this->unfiltered_params)) {
196 $query = $this->query->all();
198 $post = $this->request->all();
223 if (isset(
$url[
'port']) &&
$url[
'port']) {
229 $page .= $this->getRequestUri();
244 $path = htmlspecialchars(
$path, ENT_QUOTES,
'UTF-8');
251 return explode(
'/',
$path);
262 $base_path =
trim($this->getBasePath(),
'/');
263 $server = $this->server->all();
264 $server[
'REQUEST_URI'] =
"$base_path/" .
implode(
'/', $segments);
266 return $this->duplicate(null, null, null, null, null, $server);
291 if (PHP_SAPI ===
'cli-server') {
292 $path = $this->getRequestUri();
294 $path = $this->getPathInfo();
297 return preg_replace(
'~(\?.*)$~',
'',
$path);
304 $ip = parent::getClientIp();
306 if ($ip == $this->server->get(
'REMOTE_ADDR')) {
308 $ip_addresses = $this->server->get(
'HTTP_X_REAL_IP');
310 $ip_addresses = explode(
',', $ip_addresses);
312 return array_pop($ip_addresses);
323 return (strtolower($this->headers->get(
'X-Requested-With') ?:
'') ===
'xmlhttprequest' 324 || $this->query->get(
'X-Requested-With') ===
'XMLHttpRequest' 325 || $this->request->get(
'X-Requested-With') ===
'XMLHttpRequest');
343 return rtrim($this->getSchemeAndHttpHost() .
$base_url,
'/') .
'/';
352 if ($this->getPathInfo() !== (
'/' . self::REWRITE_TEST_TOKEN)) {
356 if (!$this->
get(self::REWRITE_TEST_TOKEN)) {
379 return PHP_SAPI ===
'cli-server';
391 if (!is_file($file)) {
396 $extensions =
'.3gp, .apk, .avi, .bmp, .css, .csv, .doc, .docx, .flac, .gif, .gz, .gzip, .htm, .html, .ics,';
397 $extensions .=
' .jpe, .jpeg, .jpg, .js, .kml, .kmz, .m4a, .mjs, .mov, .mp3, .mp4, .mpeg, .mpg, .odp, .ods, .odt,';
398 $extensions .=
' .oga, .ogg, .ogv, .pdf, .pdf, .png, .pps, .pptx, .qt, .svg, .swf, .tar, .text, .tif, .txt,';
399 $extensions .=
' .wav, .webm, .wmv, .xls, .xlsx, .xml, .xsl, .xsd, and .zip';
402 $ext = pathinfo($file, PATHINFO_EXTENSION);
407 $ext = preg_quote($ext,
'~');
420 $files = $this->
files->get($input_name);
425 if (!is_array($files)) {
441 $files = $this->
getFiles($input_name);
451 if ($check_for_validity && !$file->isValid()) {
484 $config_host = parse_url(
$config->wwwroot, PHP_URL_HOST);
485 if ($config_host === $this->getHost()) {
500 $reported_bytes = $this->server->get(
'CONTENT_LENGTH');
503 $post_data_count =
count($this->request->all());
507 $post_body_length = is_string($content) ?
elgg_strlen($content) : 0;
511 $is_valid =
function() use ($reported_bytes, $post_data_count, $post_body_length, $file_count) {
512 if (empty($reported_bytes)) {
517 if (empty($post_data_count) && empty($post_body_length) && empty($file_count)) {
548 $path = parse_url($config->wwwroot, PHP_URL_PATH);
validate()
Validate the request.
validateRequestHostHeader()
Validate that the request was made on the correct host.
getElggPath()
Get the Request URI minus querystring.
initializeTrustedProxyConfiguration(Config $config)
Configure trusted proxy servers to allow access to more client information.
isCliServer()
Is PHP running the CLI server front controller.
getParam(string $key, $default=null, bool $filter_result=true)
Get some input from variables passed submitted through GET or POST.
setRoute(Route $route)
Sets the route matched for this request by the router.
getFirstUrlSegment()
Get first Elgg URL segment.
initializeContext()
Initialize context stack.
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
validateRequestBodyTruncated()
Validate that the request body hasn't been truncated (eg.
setUrlSegments(array $segments)
Get a cloned request with new Elgg URL segments.
sniffElggUrl()
Sniff the Elgg site URL with trailing slash.
elgg_strlen()
Wrapper function for mb_strlen().
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
$config
Advanced site settings, debugging section.
setParam(string $key, $value, bool $override_request=false)
Sets an input value that may later be retrieved by get_input.
if(!$pagination &&$limit!==false &&!empty($items)&&count($items) >=$limit) $base_url
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition files
getCurrentURL()
Returns current page URL.
static isCli()
Is application running in CLI.
getRoute()
Returns the route matched for this request by the router.
isAction()
Is the request an action.
isCliServable(string $root)
Is the request pointing to a file that the CLI server can handle?
getUrlSegments(bool $raw=false)
Get the Elgg URL segments.
elgg_get_site_url()
Get the URL for the current (or specified) site, ending with "/".
getFiles(string $input_name)
Returns an array of uploaded file objects regardless of upload status/errors.
if($container instanceof ElggGroup &&$container->guid!=elgg_get_page_owner_guid()) $key
bool $_integration_testing
getContextStack()
Returns context stack.
isRewriteCheck()
Is the request for checking URL rewriting?
Thrown when request is malformatted.
getParams(bool $filter_result=true)
Returns all values parsed from the request.
$content
Set robots.txt action.
foreach($plugin_guids as $guid) if(empty($deactivated_plugins)) $url
_elgg_services()
Get the global service provider.
const REWRITE_TEST_OUTPUT
$attributes
Elgg AJAX loader.
getFile(string $input_name, bool $check_for_validity=true)
Returns the first file found based on the input name.
getMatchedParameters()
Get matched parameters.
Manages a global stack of strings for sharing information about the current execution context...
__construct(array $query=[], array $request=[], array $attributes=[], array $cookies=[], array $files=[], array $server=[], $content=null)
{}
correctBaseURL(\Elgg\Config $config)
Correct the base URL of the request.