Index: branches/5.2.x/core/kernel/utility/http_query.php =================================================================== diff -u -N -r16339 -r16434 --- branches/5.2.x/core/kernel/utility/http_query.php (.../http_query.php) (revision 16339) +++ branches/5.2.x/core/kernel/utility/http_query.php (.../http_query.php) (revision 16434) @@ -1,6 +1,6 @@ Application->recallObject('Session'); - /* @var $session Session */ - - $user_id = $session->GetField('PortalUserId'); - $admin_mark = $this->Application->isAdmin ? 'ADMIN' : 'FRONT'; - - $data = '[' . date('D M d H:i:s Y') . '] ' . $admin_mark . '; ip: ' . $this->getClientIp() . '; user_id: ' . $user_id . '; sid: ' . $this->Application->GetSID() . '; request: ' . "\n"; - if ( $this->Get ) { - $data .= "_GET:\n" . print_r($this->Get, true); - } - - if ( $this->Post ) { - $data .= "_POST:\n" . print_r($this->Post, true); - } - - if ( $this->Cookie ) { - $data .= "_COOKIE:\n" . print_r($this->Cookie, true); - } - $data .= str_repeat('=', 100) . "\n"; - - fwrite($fp, $data); - fclose($fp); - } - else { - trigger_error('Request Log directory not writable', E_USER_WARNING); - } - } - else { - trigger_error('Request Log directory not writable', E_USER_WARNING); - } - } - /** * Checks, that url is empty * @@ -815,4 +775,34 @@ return isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''; } + + /** + * Returns headers + * + * @return array + * @access public + */ + public function getHeaders() + { + if ( function_exists('apache_request_headers') ) { + // If apache_request_headers() exists... + $headers = apache_request_headers(); + + if ( $headers ) { + return $headers; // And works... Use it + } + } + + $headers = array(); + + foreach ( array_keys($_SERVER) as $server_key ) { + if ( substr($server_key, 0, 5) == 'HTTP_' ) { + $header_name = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($server_key, 0, 5))))); + $headers[$header_name] = $_SERVER[$server_key]; + } + } + + return $headers; + } + }