10 use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
63 $this->request_overrides = [];
72 $trusted_proxies = $config->http_request_trusted_proxy_ips;
73 if (empty($trusted_proxies)) {
77 $allowed_headers = $config->http_request_trusted_proxy_headers;
78 if (empty($allowed_headers)) {
79 $allowed_headers = self::HEADER_X_FORWARDED_FOR | self::HEADER_X_FORWARDED_HOST | self::HEADER_X_FORWARDED_PORT | self::HEADER_X_FORWARDED_PROTO;
82 $this->setTrustedProxies($trusted_proxies, $allowed_headers);
143 if ($override_request) {
146 $this->request->set($key,
$value);
150 unset($this->filtered_params);
151 unset($this->unfiltered_params);
170 $values = $this->
getParams($filter_result);
183 if (isset($this->filtered_params) && isset($this->unfiltered_params)) {
188 $query = $this->query->all();
190 $post = $this->request->all();
215 if (isset(
$url[
'port']) &&
$url[
'port']) {
221 $page .= $this->getRequestUri();
236 $path = htmlspecialchars(
$path, ENT_QUOTES,
'UTF-8');
242 return explode(
'/',
$path);
253 $base_path =
trim($this->getBasePath(),
'/');
254 $server = $this->server->all();
257 return $this->duplicate(null, null, null, null, null,
$server);
282 if (php_sapi_name() ===
'cli-server') {
283 $path = $this->getRequestUri();
285 $path = $this->getPathInfo();
288 return preg_replace(
'~(\?.*)$~',
'',
$path);
295 $ip = parent::getClientIp();
297 if ($ip == $this->server->get(
'REMOTE_ADDR')) {
299 $ip_addresses = $this->server->get(
'HTTP_X_REAL_IP');
301 $ip_addresses = explode(
',', $ip_addresses);
303 return array_pop($ip_addresses);
314 return (strtolower($this->headers->get(
'X-Requested-With') ?:
'') ===
'xmlhttprequest' 315 || $this->query->get(
'X-Requested-With') ===
'XMLHttpRequest' 316 || $this->request->get(
'X-Requested-With') ===
'XMLHttpRequest');
334 return rtrim($this->getSchemeAndHttpHost() .
$base_url,
'/') .
'/';
343 if ($this->getPathInfo() !== (
'/' . self::REWRITE_TEST_TOKEN)) {
347 if (!$this->
get(self::REWRITE_TEST_TOKEN)) {
370 return php_sapi_name() ===
'cli-server';
382 if (!is_file($file)) {
387 $extensions =
".3gp, .apk, .avi, .bmp, .css, .csv, .doc, .docx, .flac, .gif, .gz, .gzip, .htm, .html, .ics, .jpe, .jpeg, .jpg, .js, .kml, .kmz, .m4a, .mov, .mp3, .mp4, .mpeg, .mpg, .odp, .ods, .odt, .oga, .ogg, .ogv, .pdf, .pdf, .png, .pps, .pptx, .qt, .svg, .swf, .tar, .text, .tif, .txt, .wav, .webm, .wmv, .xls, .xlsx, .xml, .xsl, .xsd, and .zip";
390 $ext = pathinfo($file, PATHINFO_EXTENSION);
395 $ext = preg_quote($ext,
'~');
413 if (!is_array($files)) {
439 if ($check_for_validity && !$file->isValid()) {
473 if ($config_host === $this->getHost()) {
488 $reported_bytes = $this->server->get(
'CONTENT_LENGTH');
491 $post_data_count =
count($this->request->all());
495 $post_body_length = is_string($content) ?
elgg_strlen($content) : 0;
499 $is_valid =
function() use ($reported_bytes, $post_data_count, $post_body_length, $file_count) {
500 if (empty($reported_bytes)) {
505 if (empty($post_data_count) && empty($post_body_length) && empty($file_count)) {
520 'post_size' => $reported_bytes,
521 'visible_errors' =>
true,
522 ],
elgg_echo(
'actiongatekeeper:uploadexceeded'),
"The 'action_gatekeeper:upload_exceeded_msg', 'all' has been deprecated",
'4.3');
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.
getFiles($input_name)
Returns an array of uploaded file objects regardless of upload status/errors.
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
validateRequestBodyTruncated()
Validate that the request body hasn't been truncated (eg.
elgg parse_url
Parse a URL into its parts.
setUrlSegments(array $segments)
Get a cloned request with new Elgg URL segments.
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
sniffElggUrl()
Sniff the Elgg site URL with trailing slash.
isCliServable($root)
Is the request pointing to a file that the CLI server can handle?
elgg_strlen()
Wrapper function for mb_strlen().
$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
if(elgg_view_exists('elgg/admin.js')) $segments
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.
getUrlSegments(bool $raw=false)
Get the Elgg URL segments.
elgg_get_site_url()
Get the URL for the current (or specified) site, ending with "/".
elgg_trigger_deprecated_plugin_hook($hook, $type, $params=null, $returnvalue=null, $message=null, $version=null)
Trigger an plugin hook normally, but send a notice about deprecated use if any handlers are registere...
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
if($container instanceof ElggGroup &&$container->guid!=elgg_get_page_owner_guid()) $key
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.
getFile($input_name, $check_for_validity=true)
Returns the first file found based on the input name.
$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.
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.