Index: branches/5.2.x/core/kernel/processors/main_processor.php
===================================================================
diff -u -N -r14585 -r14603
--- branches/5.2.x/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 14585)
+++ branches/5.2.x/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 14603)
@@ -1,6 +1,6 @@
Application->BuildEnv($t, $params, 'm', null, false);
+ return $this->Application->BuildEnv($t, $params, 'm', false, false);
}
function FormAction($params)
@@ -325,6 +325,38 @@
}
/**
+ * Links variable from request with variable from session
+ *
+ * @param Array $params
+ * @return string
+ * @access protected
+ */
+ protected function LinkVar($params)
+ {
+ $var_name = $params['name'];
+ $session_var_name = isset($params['session_name']) ? $params['session_name'] : $var_name;
+ $default_value = isset($params['default']) ? $params['default'] : '';
+
+ $this->Application->LinkVar($var_name, $session_var_name, $default_value);
+
+ return '';
+ }
+
+ /**
+ * Links variable from request with variable from session and returns it's value
+ *
+ * @param Array $params
+ * @return string
+ * @access protected
+ */
+ protected function GetLinkedVar($params)
+ {
+ $this->LinkVar($params);
+
+ return $this->Application->GetVar( $params['name'] );
+ }
+
+ /**
* Sets application variable value(-s)
*
* @param Array $params
@@ -415,14 +447,17 @@
function DumpSystemInfo($params)
{
$actions =& $this->Application->recallObject('kActions');
- $actions->Set('t', $this->Application->GetVar('t') );
+ /* @var $actions Params */
+ $actions->Set('t', $this->Application->GetVar('t'));
+
+ $o = '';
$params = $actions->GetParams();
- $o='';
- foreach ($params AS $name => $val)
- {
+
+ foreach ($params AS $name => $val) {
$o .= "\n";
}
+
return $o;
}
@@ -439,22 +474,24 @@
unset($params['template']);
$form_fields = Array ();
- if ($this->Application->RewriteURLs()) {
+ if ( $this->Application->RewriteURLs() ) {
$session =& $this->Application->recallObject('Session');
- if ($session->NeedQueryString()) {
+ /* @var $session Session */
+
+ if ( $session->NeedQueryString() ) {
$form_fields['sid'] = $this->Application->GetSID();
}
}
else {
- $form_fields['env'] = $this->Application->BuildEnv($t, $params, 'm', null, false);
+ $form_fields['env'] = $this->Application->BuildEnv($t, $params, 'm', false, false);
}
- if ($this->Application->GetVar('admin') == 1) {
+ if ( $this->Application->GetVar('admin') == 1 ) {
$form_fields['admin'] = 1;
}
$ret = '';
- $field_tpl = ''."\n";
+ $field_tpl = '' . "\n";
foreach ($form_fields as $form_field => $field_value) {
$ret .= sprintf($field_tpl, $form_field, $field_value);
}
@@ -572,22 +609,18 @@
}
/**
- * Checks if application variable
- * specified by name value match
- * value passed as parameter
+ * Checks if application variable specified by name value match value passed as parameter
*
* @param Array $params
* @return bool
- * @access public
+ * @access protected
+ * @deprecated
*/
- function GetEquals($params)
+ protected function GetEquals($params)
{
$name = $this->SelectParam($params, 'var,name,param');
- $value = $params['value'];
- if ($this->Application->GetVar($name) == $value) {
- return 1;
- }
+ return $this->Application->GetVar($name) == $params['value'];
}
function ModuleInclude($params)
@@ -722,6 +755,8 @@
function CheckPermission($params)
{
$perm_helper =& $this->Application->recallObject('PermissionsHelper');
+ /* @var $perm_helper kPermissionsHelper */
+
return $perm_helper->TagPermissionCheck($params);
}
@@ -842,44 +877,46 @@
{
$ssl = $this->Application->isAdmin ? $this->Application->ConfigValue('AdminSSL_URL') : false;
- if (!$ssl) {
+ if ( !$ssl ) {
// not in admin or admin ssl url is empty
$ssl_url = $this->Application->siteDomainField('SSLUrl');
$ssl = $ssl_url !== false ? $ssl_url : $this->Application->ConfigValue('SSL_URL');
}
- if (!$ssl || ($this->Application->TemplatesCache->forceThemeName !== false)) {
+ if ( !$ssl || ($this->Application->TemplatesCache->forceThemeName !== false) ) {
// SSL URL is not set - no way to require SSL
// internal parsing (e.g. "TemplateParser::_parseTemplate") -> don't redirect
- return ;
+ return;
}
$require = false;
- if (isset($params['mode']) && $params['mode'] == 'required') {
+ if ( isset($params['mode']) && $params['mode'] == 'required' ) {
$require = true;
- if (isset($params['for_logged_in_only']) && $params['for_logged_in_only'] && !$this->Application->LoggedIn()) {
+ if ( isset($params['for_logged_in_only']) && $params['for_logged_in_only'] && !$this->Application->LoggedIn() ) {
$require = false;
}
- if (isset($params['condition'])) {
- if (!$this->Application->ConfigValue($params['condition'])) {
+ if ( isset($params['condition']) ) {
+ if ( !$this->Application->ConfigValue($params['condition']) ) {
$require = false;
}
}
}
- if (EDITING_MODE) {
+ if ( EDITING_MODE ) {
// match SSL mode on front-end to one in administrative console, when browse modes are used
$require = $this->Application->ConfigValue('Require_AdminSSL');
}
$http_query =& $this->Application->recallObject('HTTPQuery');
+ /* @var $http_query kHTTPQuery */
+
$pass = $http_query->getRedirectParams();
$pass['pass_events'] = 1; // to make sure all events are passed when redirect happens
- if ($require) {
- if (PROTOCOL == 'https://') {
+ if ( $require ) {
+ if ( PROTOCOL == 'https://' ) {
$this->Application->SetVar('__KEEP_SSL__', 1);
return;
}
@@ -888,8 +925,11 @@
$this->Application->Redirect('', $pass);
}
else {
- if (PROTOCOL == 'https://' && $this->Application->ConfigValue('Force_HTTP_When_SSL_Not_Required')) {
- if ($this->Application->GetVar('__KEEP_SSL__')) return;
+ 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);
$pass['__SSL__'] = 0;
$this->Application->Redirect('', $pass); // $pass_more
@@ -913,29 +953,30 @@
{
$this->NoDebug($params);
- if (isset($params['cache']) && $params['cache']) {
+ if ( isset($params['cache']) && $params['cache'] ) {
$nextyear = intval(date('Y') + 1);
$format = "D, d M Y H:i:s";
- $expiration = gmdate($format, mktime() + $params['cache']).' GMT';
+ $expiration = gmdate($format, mktime() + $params['cache']) . ' GMT';
$last_modified = mktime();
- header ('Cache-Control: public, cache, max-age='.$params['cache']);
- header ("Expires: $expiration");
- header ('Pragma: public');
+ header('Cache-Control: public, cache, max-age=' . $params['cache']);
+ header("Expires: $expiration");
+ header('Pragma: public');
// Getting headers sent by the client.
$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'])) {
- // 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();
- } else {
- // Image not cached or cache outdated, we respond '200 OK' and output the image.
- header('Last-Modified: '.gmdate($format, $last_modified).' GMT', true, 200);
+ 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;
}
+ else {
+ // Image not cached or cache outdated, we respond '200 OK' and output the image.
+ header('Last-Modified: ' . gmdate($format, $last_modified) . ' GMT', true, 200);
+ }
}
// xml documents are usually long
@@ -947,6 +988,8 @@
}
$lang =& $this->Application->recallObject('lang.current');
+ /* @var $lang LanguagesItem */
+
header('Content-type: text/html; charset=' . $lang->GetDBField('Charset'));
return '';