Index: core/kernel/application.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/kernel/application.php (revision 15917) +++ core/kernel/application.php (revision ) @@ -2016,9 +2016,7 @@ $user->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: core/units/admin/admin_events_handler.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/units/admin/admin_events_handler.php (revision 15917) +++ core/units/admin/admin_events_handler.php (revision ) @@ -1197,6 +1197,47 @@ echo $popup_info['PopupWidth'] . 'x' . $popup_info['PopupHeight']; } } + + /** + * Writes HTTP request to System Log + * + * @param kEvent $event + * @return void + * @access public + */ + public function OnLogHttpRequest(kEvent $event) + { + $session = $this->Application->recallObject('Session'); + /* @var $session Session */ + + $user_id = $session->GetField('PortalUserId'); + + if ( ($user_id != USER_GUEST) && defined('DBG_REQUREST_LOG') && DBG_REQUREST_LOG ) { + + $admin_mark = $this->Application->isAdmin ? 'ADMIN' : 'FRONT'; + + $data = '[' . date('D M d H:i:s Y') . '] ' . $admin_mark . '; ip: ' . $this->Application->HttpQuery->getClientIp() . '; user_id: ' . $user_id . '; sid: ' . $this->Application->GetSID() . '; request: ' . "\n"; + if ( $this->Application->HttpQuery->Get ) { + $data .= "_GET:\n" . print_r($this->Application->HttpQuery->Get, true); + } + + if ( $this->Application->HttpQuery->Post ) { + $data .= "_POST:\n" . print_r($this->Application->HttpQuery->Post, true); + } + + if ( $this->Application->HttpQuery->Cookie ) { + $data .= "_COOKIE:\n" . print_r($this->Application->HttpQuery->Cookie, true); + } + + $headers = apache_request_headers(); + + if ( $headers ) { + $data .= "HEADERS:\n" . print_r($headers, true); + } + + $this->Application->log(nl2br($data), null, true); + } + } } /** \ No newline at end of file Index: core/kernel/utility/http_query.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/kernel/utility/http_query.php (revision 15917) +++ core/kernel/utility/http_query.php (revision ) @@ -715,46 +715,6 @@ return $ret; } - function writeRequestLog($filename) - { - $log_file = (defined('RESTRICTED') ? RESTRICTED : FULL_PATH) . '/' . $filename; - - if ( is_writable(dirname($log_file)) ) { - $fp = fopen($log_file, 'a'); - - if ( $fp ) { - $session = $this->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 *