Index: branches/5.1.x/core/units/helpers/mod_rewrite_helper.php =================================================================== diff -u -r13086 -r13159 --- branches/5.1.x/core/units/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 13086) +++ branches/5.1.x/core/units/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 13159) @@ -1,6 +1,6 @@ $value) { - $this->HTTPQuery->Set($name,$value); + $this->HTTPQuery->Set($name, $value); } -// if ($restored) { - $this->InitAll(); -// } + $this->InitAll(); // also will use parsed language to load phrases from it $this->HTTPQuery->finalizeParsing($passed); } @@ -162,10 +160,10 @@ if (($this->_modulePrefix === false) && in_array('parseCategory', $this->_partsFound)) { // no item found, but category found -> module index page - foreach ($this->Application->RewriteListeners as $prefix => $listener) { + /*foreach ($this->Application->RewriteListeners as $prefix => $listener) { // no idea what module we are talking about, so pass info form all modules $vars['pass'][] = $prefix; - } + }*/ return $vars; } @@ -211,7 +209,7 @@ foreach ($this->Application->RewriteListeners as $prefix => $listener) { // set default page - $vars[$prefix . '_Page'] = 1; // will override page in session in case, when none is given in url + // $vars[$prefix . '_Page'] = 1; // will override page in session in case, when none is given in url if ($page_number) { // page given in url - use it @@ -248,7 +246,7 @@ $physical_template = array_search($template_path, $this->Application->structureTemplateMapping); - if ($physical_template !== false) { + if (($physical_template !== false) && (substr($physical_template, 0, 3) != 'id:')) { // replace menu template name with it's actual template name on disk list ($template_path) = explode(':', $physical_template, 2); } @@ -443,7 +441,6 @@ WHERE Enabled = 1 ORDER BY SortKey DESC'; $language_info = $this->Conn->GetRow($sql); - $this->Application->Phrases = new PhrasesCache(); if ($language_info && $language_info['LanguageId'] && $language_info['SortKey']) { // primary language will be selected in case, when $url_part doesn't match to other's language pack name @@ -565,9 +562,9 @@ */ function removePages() { - foreach ($this->Application->RewriteListeners as $prefix => $listener) { + /*foreach ($this->Application->RewriteListeners as $prefix => $listener) { $this->Application->DeleteVar($prefix . '_Page'); - } + }*/ } /** @@ -681,6 +678,8 @@ */ function _buildCategoryItemUrl($prefix_special, &$params, $keep_events) { + static $default_per_page = Array (); + $ret = ''; list ($prefix) = explode('.', $prefix_special); $processed_params = $this->getProcessedParams($prefix_special, $params, $keep_events); @@ -689,6 +688,13 @@ return ''; } + if (!array_key_exists($prefix, $default_per_page)) { + $list_helper =& $this->Application->recallObject('ListHelper'); + /* @var $list_helper ListHelper */ + + $default_per_page[$prefix] = $list_helper->getDefaultPerPage($prefix); + } + if ($processed_params[$prefix_special . '_id']) { // this allows to fill 3 cache records with one query (see this method for details) $category_id = array_key_exists('m_cat_id', $params) ? $params['m_cat_id'] : $this->Application->GetVar('m_cat_id'); @@ -720,9 +726,16 @@ // category item prefix and $params['pass_category'] will not be added automatically $params['pass_category'] = true; } - else { - $ret .= $processed_params[$prefix_special . '_Page'] . '/'; + elseif ($processed_params[$prefix_special . '_Page'] > 1) { + // $ret .= $processed_params[$prefix_special . '_Page'] . '/'; + $params['page'] = $processed_params[$prefix_special . '_Page']; } + + $per_page = $processed_params[$prefix_special . '_PerPage']; + + if ($per_page && ($per_page != $default_per_page[$prefix])) { + $params['per_page'] = $processed_params[$prefix_special . '_PerPage']; + } } return mb_strtolower( rtrim($ret, '/') );