Changeset View
Changeset View
Standalone View
Standalone View
core/kernel/utility/http_query.php
Show First 20 Lines • Show All 439 Lines • ▼ Show 20 Line(s) | |||||
*/ | */ | ||||
function refererIsOurSite() | function refererIsOurSite() | ||||
{ | { | ||||
if ( !array_key_exists('HTTP_REFERER', $_SERVER) ) { | if ( !array_key_exists('HTTP_REFERER', $_SERVER) ) { | ||||
// no referer -> don't care what happens | // no referer -> don't care what happens | ||||
return false; | return false; | ||||
} | } | ||||
/** @var SiteHelper $site_helper */ | |||||
$site_helper = $this->Application->recallObject('SiteHelper'); | $site_helper = $this->Application->recallObject('SiteHelper'); | ||||
/* @var $site_helper SiteHelper */ | |||||
$found = false; | $found = false; | ||||
$http_referer = $_SERVER['HTTP_REFERER']; | $http_referer = $_SERVER['HTTP_REFERER']; | ||||
preg_match('/^(.*?):\/\/(.*?)(\/|$)/', $http_referer, $regs); // 1 - protocol, 2 - domain | preg_match('/^(.*?):\/\/(.*?)(\/|$)/', $http_referer, $regs); // 1 - protocol, 2 - domain | ||||
if ($regs[1] == 'https') { | if ($regs[1] == 'https') { | ||||
$found = $site_helper->getDomainByName('SSLUrl', $http_referer) > 0; | $found = $site_helper->getDomainByName('SSLUrl', $http_referer) > 0; | ||||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Line(s) | |||||
/** | /** | ||||
* Overwrites GET events with POST events in case if they are set and not empty | * Overwrites GET events with POST events in case if they are set and not empty | ||||
* | * | ||||
* @return void | * @return void | ||||
* @access protected | * @access protected | ||||
*/ | */ | ||||
protected function convertPostEvents() | protected function convertPostEvents() | ||||
{ | { | ||||
/** @var Array $events */ | |||||
$events = $this->Get('events', Array ()); | $events = $this->Get('events', Array ()); | ||||
Lint: CodingStandard.Array.Array.SpaceAfterKeyword: There must be no space between the Array keyword and the opening parenthesis | |||||
PHP keywords must be lowercase; expected "array" but found "Array" Lint: Generic.PHP.LowerCaseKeyword.Found: PHP keywords must be lowercase; expected "array" but found "Array" | |||||
/* @var $events Array */ | |||||
if ( is_array($events) ) { | if ( is_array($events) ) { | ||||
$events = array_filter($events); | $events = array_filter($events); | ||||
foreach ($events as $prefix_special => $event_name) { | foreach ($events as $prefix_special => $event_name) { | ||||
$this->Set($prefix_special . '_event', $event_name); | $this->Set($prefix_special . '_event', $event_name); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 159 Lines • ▼ Show 20 Line(s) | |||||
function writeRequestLog($filename) | function writeRequestLog($filename) | ||||
{ | { | ||||
$log_file = (defined('RESTRICTED') ? RESTRICTED : FULL_PATH) . '/' . $filename; | $log_file = (defined('RESTRICTED') ? RESTRICTED : FULL_PATH) . '/' . $filename; | ||||
if ( is_writable(dirname($log_file)) ) { | if ( is_writable(dirname($log_file)) ) { | ||||
$fp = fopen($log_file, 'a'); | $fp = fopen($log_file, 'a'); | ||||
if ( $fp ) { | if ( $fp ) { | ||||
/** @var Session $session */ | |||||
$session = $this->Application->recallObject('Session'); | $session = $this->Application->recallObject('Session'); | ||||
/* @var $session Session */ | |||||
$user_id = $session->GetField('PortalUserId'); | $user_id = $session->GetField('PortalUserId'); | ||||
$admin_mark = $this->Application->isAdmin ? 'ADMIN' : 'FRONT'; | $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"; | $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 ) { | if ( $this->Get ) { | ||||
$data .= "_GET:\n" . print_r($this->Get, true); | $data .= "_GET:\n" . print_r($this->Get, true); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines |
There must be no space between the Array keyword and the opening parenthesis