Index: branches/5.2.x/core/kernel/processors/main_processor.php =================================================================== diff -u -N -r13840 -r14095 --- branches/5.2.x/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 13840) +++ branches/5.2.x/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 14095) @@ -1,6 +1,6 @@ Application->recallObject('kActions'); + /* @var $actions Params */ + $actions->Set('t', $this->Application->GetVar('t')); $actions->Set('sid', $this->Application->GetSID()); $actions->Set('m_opener', $this->Application->GetVar('m_opener') ); @@ -361,7 +363,7 @@ $ret = $this->Application->GetVar($name, ''); if (array_key_exists('no_html_escape', $params) && $params['no_html_escape']) { - return unhtmlentities($ret); + return kUtil::unhtmlentities($ret); } return $ret; @@ -773,8 +775,11 @@ $group = $this->SelectParam($params, 'group'); $group_access = true; if ($group) { - $conn =& $this->Application->GetADODBConnection(); - $group_id = $conn->GetOne('SELECT GroupId FROM '.TABLE_PREFIX.'PortalGroup WHERE Name = '.$conn->qstr($group)); + $sql = 'SELECT GroupId + FROM '.TABLE_PREFIX.'PortalGroup + WHERE Name = '.$this->Conn->qstr($group); + $group_id = $this->Conn->GetOne($sql); + if ($group_id) { $groups = explode(',', $this->Application->RecallVar('UserGroups')); $group_access = in_array($group_id, $groups); @@ -811,8 +816,12 @@ function IsMember($params) { $group = getArrayValue($params, 'group'); - $conn =& $this->Application->DB; - $group_id = $conn->GetOne('SELECT GroupId FROM '.TABLE_PREFIX.'PortalGroup WHERE Name = '.$conn->qstr($group)); + + $sql = 'SELECT GroupId + FROM '.TABLE_PREFIX.'PortalGroup + WHERE Name = '.$this->Conn->qstr($group); + $group_id = $this->Conn->GetOne($sql); + if ($group_id) { $groups = explode(',', $this->Application->RecallVar('UserGroups')); $group_access = in_array($group_id, $groups); @@ -874,21 +883,24 @@ $this->Application->SetVar('__KEEP_SSL__', 1); return; } - $this->Application->Redirect('', array_merge_recursive2($pass, Array('__SSL__' => 1))); + + $pass['__SSL__'] = 1; + $this->Application->Redirect('', $pass); } else { if (PROTOCOL == 'https://' && $this->Application->ConfigValue('Force_HTTP_When_SSL_Not_Required')) { if ($this->Application->GetVar('__KEEP_SSL__')) return; // $pass_more = Array ('pass' => 'm', 'm_cat_id' => 0, '__SSL__' => 0); - $this->Application->Redirect('', array_merge_recursive2($pass, Array('__SSL__' => 0))); // $pass_more + $pass['__SSL__'] = 0; + $this->Application->Redirect('', $pass); // $pass_more } } } function ConstOn($params) { $name = $this->SelectParam($params,'name,const'); - return constOn($name); + return kUtil::constOn($name); } function SetDefaultCategory($params) @@ -899,7 +911,7 @@ function XMLTemplate($params) { - safeDefine('DBG_SKIP_REPORTING', 1); + kUtil::safeDefine('DBG_SKIP_REPORTING', 1); if (isset($params['cache']) && $params['cache']) { $nextyear = intval(date('Y') + 1); @@ -913,10 +925,10 @@ header ('Pragma: public'); // Getting headers sent by the client. - $headers = request_headers(); + $headers = $this->_requestHeaders(); // 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'])) { + if (isset($headers['If-Modified-Since']) && (strtotime($headers['If-Modified-Since']) > $last_modified - $params['cache'])) { // Client's cache IS current, so we just respond '304 Not Modified'. header('Last-Modified: '.date($format, strtotime($headers['If-Modified-Since'])).' GMT', true, 304); exit(); @@ -933,6 +945,29 @@ return $this->Application->XMLHeader(getArrayValue($params, 'xml_version')); } + 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']); @@ -1041,18 +1076,16 @@ function RegisterPageHit($params) { if ($this->Application->ConfigValue('UsePageHitCounter')) { - $db =& $this->Application->GetADODBConnection(); - // get current counte $sql = 'SELECT VariableValue FROM '.TABLE_PREFIX.'ConfigurationValues WHERE VariableName = "PageHitCounter"'; - $page_counter = (int)$db->GetOne($sql); + $page_counter = (int)$this->Conn->GetOne($sql); $sql = 'UPDATE LOW_PRIORITY '.TABLE_PREFIX.'ConfigurationValues SET VariableValue = '.($page_counter + 1).' WHERE VariableName = "PageHitCounter"'; - $db->Query($sql); + $this->Conn->Query($sql); } }