Index: branches/5.2.x/core/kernel/session/session_storage.php =================================================================== diff -u -N -r14699 -r14714 --- branches/5.2.x/core/kernel/session/session_storage.php (.../session_storage.php) (revision 14699) +++ branches/5.2.x/core/kernel/session/session_storage.php (.../session_storage.php) (revision 14714) @@ -1,7 +1,7 @@ $field_value) { $this->SetField($field_name, $field_value); } + + // ensure user groups are stored in a way, that kPermissionsHelper::CheckUserPermission can understand + $this->Session->StoreVar('UserGroups', $this->GetField('GroupList'), true); // true for optional } function DeleteSession() Index: branches/5.2.x/core/units/helpers/mod_rewrite_helper.php =================================================================== diff -u -N -r14699 -r14714 --- branches/5.2.x/core/units/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 14699) +++ branches/5.2.x/core/units/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 14714) @@ -1,6 +1,6 @@ HTTPQuery =& $this->Application->recallObject('HTTPQuery'); - - // domain based primary language - $this->primaryLanguageId = $this->Application->siteDomainField('PrimaryLanguageId'); - - // domain based primary theme - $this->primaryThemeId = $this->Application->siteDomainField('PrimaryThemeId'); - } - - function processRewriteURL() - { - $passed = Array (); - $url = $this->HTTPQuery->Get('_mod_rw_url_'); - - if ($url) { - foreach ($this->_urlEndings as $url_ending) { - if (substr($url, strlen($url) - strlen($url_ending)) == $url_ending) { - $url = substr($url, 0, strlen($url) - strlen($url_ending)); - $default_ending = $this->Application->ConfigValue('ModRewriteUrlEnding'); - - // user manually typed url with different url ending -> redirect to same url with default url ending - if (($url_ending != $default_ending) && $this->Application->ConfigValue('ForceModRewriteUrlEnding')) { - $target_url = $this->Application->BaseURL() . $url . $default_ending; - $this->Application->Redirect('external:' . $target_url, Array ('response_code' => 301)); - } - - break; - } - } - } - - $restored = false; - - $cached = $this->_getCachedUrl($url); - - if ($cached !== false) { - $vars = $cached['vars']; - $passed = $cached['passed']; - $restored = true; - } - else { - $vars = $this->parseRewriteURL($url); - $passed = $vars['pass']; // also used in bottom of this method - unset($vars['pass']); - - $this->_setCachedUrl($url, Array ('vars' => $vars, 'passed' => $passed)); - - if (array_key_exists('t', $this->HTTPQuery->Post) && $this->HTTPQuery->Post['t']) { - // template from POST overrides template from URL. - $vars['t'] = $this->HTTPQuery->Post['t']; - if (isset($vars['is_virtual']) && $vars['is_virtual']) { - $vars['m_cat_id'] = 0; // this is virtual template category (for Proj-CMS) - } - } - - unset($vars['is_virtual']); - } - - foreach ($vars as $name => $value) { - $this->HTTPQuery->Set($name, $value); - } - - $this->InitAll(); // also will use parsed language to load phrases from it - - $this->HTTPQuery->finalizeParsing($passed); - } - - function _getCachedUrl($url) - { - if (!$url) { - return false; - } - - $sql = 'SELECT * - FROM ' . TABLE_PREFIX . 'CachedUrls - WHERE Hash = ' . crc32($url) . ' AND DomainId = ' . (int)$this->Application->siteDomainField('DomainId'); - $data = $this->Conn->GetRow($sql); - - if ($data) { - $lifetime = (int)$data['LifeTime']; // in seconds - if (($lifetime > 0) && ($data['Cached'] + $lifetime < adodb_mktime())) { - // delete expired - $sql = 'DELETE FROM ' . TABLE_PREFIX . 'CachedUrls - WHERE UrlId = ' . $data['UrlId']; - $this->Conn->Query($sql); - - return false; - } - - return unserialize($data['ParsedVars']); - } - - return false; - } - - function _setCachedUrl($url, $data) - { - if (!$url) { - return ; - } - - $vars = $data['vars']; - $passed = $data['passed']; - sort($passed); - - // get expiration - if ($vars['m_cat_id'] > 0) { - $sql = 'SELECT PageExpiration - FROM ' . TABLE_PREFIX . 'Category - WHERE CategoryId = ' . $vars['m_cat_id']; - $expiration = $this->Conn->GetOne($sql); - } - - // get prefixes - $prefixes = Array (); - $m_index = array_search('m', $passed); - - if ($m_index !== false) { - unset($passed[$m_index]); - - if ($vars['m_cat_id'] > 0) { - $prefixes[] = 'c:' . $vars['m_cat_id']; - } - - $prefixes[] = 'lang:' . $vars['m_lang']; - $prefixes[] = 'theme:' . $vars['m_theme']; - } - - foreach ($passed as $prefix) { - if (array_key_exists($prefix . '_id', $vars) && is_numeric($vars[$prefix . '_id'])) { - $prefixes[] = $prefix . ':' . $vars[$prefix . '_id']; - } - else { - $prefixes[] = $prefix; - } - } - - $fields_hash = Array ( - 'Url' => $url, - 'Hash' => crc32($url), - 'DomainId' => (int)$this->Application->siteDomainField('DomainId'), - 'Prefixes' => $prefixes ? '|' . implode('|', $prefixes) . '|' : '', - 'ParsedVars' => serialize($data), - 'Cached' => adodb_mktime(), - 'LifeTime' => isset($expiration) && is_numeric($expiration) ? $expiration : -1 - ); - - $this->Conn->doInsert($fields_hash, TABLE_PREFIX . 'CachedUrls'); - } - - function parseRewriteURL($url) - { - $vars = Array ('pass' => Array ('m')); - $url_parts = $url ? explode('/', trim(mb_strtolower($url, 'UTF-8'), '/')) : Array (); - - $this->_partsToParse = $url_parts; - - if ( ($this->HTTPQuery->Get('rewrite') == 'on') || !$url_parts ) { - $this->_setDefaultValues($vars); - } - - if ( !$url_parts ) { - $this->InitAll(); - $vars['t'] = $this->HTTPQuery->getDefaultTemplate(''); - - return $vars; - } - else { - $vars['t'] = ''; - } - - $this->_parseLanguage($url_parts, $vars); - $this->_parseTheme($url_parts, $vars); - - // http://site-url///[_]/