first commit
This commit is contained in:
		
							
								
								
									
										21
									
								
								vendor/ralouphie/getallheaders/LICENSE
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								vendor/ralouphie/getallheaders/LICENSE
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| The MIT License (MIT) | ||||
|  | ||||
| Copyright (c) 2014 Ralph Khattar | ||||
|  | ||||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
| of this software and associated documentation files (the "Software"), to deal | ||||
| in the Software without restriction, including without limitation the rights | ||||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||
| copies of the Software, and to permit persons to whom the Software is | ||||
| furnished to do so, subject to the following conditions: | ||||
|  | ||||
| The above copyright notice and this permission notice shall be included in all | ||||
| copies or substantial portions of the Software. | ||||
|  | ||||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||
| SOFTWARE. | ||||
							
								
								
									
										27
									
								
								vendor/ralouphie/getallheaders/README.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								vendor/ralouphie/getallheaders/README.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| getallheaders | ||||
| ============= | ||||
|  | ||||
| PHP `getallheaders()` polyfill. Compatible with PHP >= 5.3. | ||||
|  | ||||
| [](https://travis-ci.org/ralouphie/getallheaders) | ||||
| [](https://coveralls.io/r/ralouphie/getallheaders?branch=master) | ||||
| [](https://packagist.org/packages/ralouphie/getallheaders) | ||||
| [](https://packagist.org/packages/ralouphie/getallheaders) | ||||
| [](https://packagist.org/packages/ralouphie/getallheaders) | ||||
|  | ||||
|  | ||||
| This is a simple polyfill for [`getallheaders()`](http://www.php.net/manual/en/function.getallheaders.php). | ||||
|  | ||||
| ## Install | ||||
|  | ||||
| For PHP version **`>= 5.6`**: | ||||
|  | ||||
| ``` | ||||
| composer require ralouphie/getallheaders | ||||
| ``` | ||||
|  | ||||
| For PHP version **`< 5.6`**: | ||||
|  | ||||
| ``` | ||||
| composer require ralouphie/getallheaders "^2" | ||||
| ``` | ||||
							
								
								
									
										46
									
								
								vendor/ralouphie/getallheaders/src/getallheaders.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								vendor/ralouphie/getallheaders/src/getallheaders.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,46 @@ | ||||
| <?php | ||||
|  | ||||
| if (!function_exists('getallheaders')) { | ||||
|  | ||||
|     /** | ||||
|      * Get all HTTP header key/values as an associative array for the current request. | ||||
|      * | ||||
|      * @return string[string] The HTTP header key/value pairs. | ||||
|      */ | ||||
|     function getallheaders() | ||||
|     { | ||||
|         $headers = array(); | ||||
|  | ||||
|         $copy_server = array( | ||||
|             'CONTENT_TYPE'   => 'Content-Type', | ||||
|             'CONTENT_LENGTH' => 'Content-Length', | ||||
|             'CONTENT_MD5'    => 'Content-Md5', | ||||
|         ); | ||||
|  | ||||
|         foreach ($_SERVER as $key => $value) { | ||||
|             if (substr($key, 0, 5) === 'HTTP_') { | ||||
|                 $key = substr($key, 5); | ||||
|                 if (!isset($copy_server[$key]) || !isset($_SERVER[$key])) { | ||||
|                     $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $key)))); | ||||
|                     $headers[$key] = $value; | ||||
|                 } | ||||
|             } elseif (isset($copy_server[$key])) { | ||||
|                 $headers[$copy_server[$key]] = $value; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         if (!isset($headers['Authorization'])) { | ||||
|             if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) { | ||||
|                 $headers['Authorization'] = $_SERVER['REDIRECT_HTTP_AUTHORIZATION']; | ||||
|             } elseif (isset($_SERVER['PHP_AUTH_USER'])) { | ||||
|                 $basic_pass = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : ''; | ||||
|                 $headers['Authorization'] = 'Basic ' . base64_encode($_SERVER['PHP_AUTH_USER'] . ':' . $basic_pass); | ||||
|             } elseif (isset($_SERVER['PHP_AUTH_DIGEST'])) { | ||||
|                 $headers['Authorization'] = $_SERVER['PHP_AUTH_DIGEST']; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         return $headers; | ||||
|     } | ||||
|  | ||||
| } | ||||
		Reference in New Issue
	
	Block a user