Index: branches/5.3.x/core/kernel/utility/http_query.php =================================================================== diff -u -N -r15910 -r15957 --- branches/5.3.x/core/kernel/utility/http_query.php (.../http_query.php) (revision 15910) +++ branches/5.3.x/core/kernel/utility/http_query.php (.../http_query.php) (revision 15957) @@ -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 * @@ -800,4 +760,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; + } + } Index: branches/5.3.x/core/kernel/processors/main_processor.php =================================================================== diff -u -N -r15928 -r15957 --- branches/5.3.x/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 15928) +++ branches/5.3.x/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 15957) @@ -1,6 +1,6 @@ _requestHeaders(); + $headers = $this->Application->HttpQuery->getHeaders(); // Checking if the client is validating his cache and if it is current. if ( isset($headers['If-Modified-Since']) && (strtotime($headers['If-Modified-Since']) > $last_modified - $params['cache']) ) { @@ -1069,29 +1069,6 @@ return ''; } - protected function _requestHeaders() - { - 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 $skey) { - if (substr($skey, 0, 5) == 'HTTP_') { - $headername = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($skey, 0, 5))))); - $headers[$headername] = $_SERVER[$skey]; - } - } - - return $headers; - } - function Header($params) { header($params['data']); Index: branches/5.3.x/tools/debug_sample.php =================================================================== diff -u -N -r15578 -r15957 --- branches/5.3.x/tools/debug_sample.php (.../debug_sample.php) (revision 15578) +++ branches/5.3.x/tools/debug_sample.php (.../debug_sample.php) (revision 15957) @@ -1,6 +1,6 @@ SetError('UserLogin', 'session_expired', 'la_text_sess_expired'); } - if ( ($user_id != USER_GUEST) && defined('DBG_REQUREST_LOG') && DBG_REQUREST_LOG ) { - $this->HttpQuery->writeRequestLog(DBG_REQUREST_LOG); - } + $this->HandleEvent(new kEvent('adm:OnLogHttpRequest')); if ( $user_id != USER_GUEST ) { // normal users + root Index: branches/5.3.x/core/units/admin/admin_events_handler.php =================================================================== diff -u -N -r15943 -r15957 --- branches/5.3.x/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 15943) +++ branches/5.3.x/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 15957) @@ -1,6 +1,6 @@ Application->LoggedIn() ) { + $log = $this->Application->log('HTTP_REQUEST')->addRequestData(); + + if ( !$log->write() ) { + trigger_error('Unable to log Http Request due disabled "System Log"', E_USER_WARNING); + } + } + } } /** Index: branches/5.3.x/core/kernel/utility/logger.php =================================================================== diff -u -N -r15928 -r15957 --- branches/5.3.x/core/kernel/utility/logger.php (.../logger.php) (revision 15928) +++ branches/5.3.x/core/kernel/utility/logger.php (.../logger.php) (revision 15957) @@ -1,6 +1,6 @@ $_GET, '_POST' => $_POST, '_COOKIE' => $_COOKIE); + $request_data = array( + 'Headers' => $this->Application->HttpQuery->getHeaders(), + ); - foreach ($request_variables as $title => $data) { + $request_variables = Array('_GET' => $_GET, '_POST' => $_POST, '_COOKIE' => $_COOKIE); + + foreach ( $request_variables as $title => $data ) { if ( !$data ) { continue; } @@ -724,7 +727,7 @@ { if ( !$this->_logRecord || $this->_logRecord['LogLevel'] > $this->_maxLogLevel || $this->_state == self::STATE_DISABLED ) { // nothing to save OR less detailed logging requested OR disabled - return true; + return false; } $this->_logRecord['LogMemoryUsed'] = memory_get_usage();