Index: trunk/core/kernel/utility/http_query.php =================================================================== diff -u -N -r4149 -r4418 --- trunk/core/kernel/utility/http_query.php (.../http_query.php) (revision 4149) +++ trunk/core/kernel/utility/http_query.php (.../http_query.php) (revision 4418) @@ -303,6 +303,7 @@ $url_parts = $url ? explode('/', $url) : Array(); + $process_module = true; if($this->Get('rewrite') == 'on' || !$url_parts) { // set default values @@ -406,6 +407,7 @@ if (!$url_part) { // no more parts left in url + $process_module = false; $sql = 'SELECT CachedCategoryTemplate FROM '.TABLE_PREFIX.'Category WHERE CategoryId = '.$category_id; @@ -419,9 +421,10 @@ $url_part = 'index'; } } - elseif ($url_part && count($url_parts) == 0 && $category_id) { + elseif ($url_part && count($url_parts) <= 1 && $category_id) { // only filename left, no other parts - $sql = 'SELECT ParentPath, CachedItemTemplate + $process_module = false; + $sql = 'SELECT ParentPath, CachedItemTemplate, CachedCategoryTemplate FROM '.TABLE_PREFIX.'Category WHERE CategoryId = '.$category_id; $category_data = $this->Conn->GetRow($sql); @@ -430,17 +433,30 @@ $module_info = $this->Application->findModule('RootCat', $root_category_id); if ($module_info) { $module_prefix = $module_info['Var']; - $module_event = new kEvent($module_prefix.':ParseEnv', Array('url_parts' => Array($url_part)) ); + $module_event = new kEvent($module_prefix.':ParseEnv', Array('url_parts' => array_merge(Array($url_part), $url_parts)) ); $this->Application->HandleEvent($module_event); - - if ($module_event->status == erSUCCESS) { + + if ($module_event->status == erSUCCESS && $this->Get($module_prefix.'_id')) { $item_template = $category_data['CachedItemTemplate']; if ($item_template) { $url_parts = explode('/', $item_template); array_push($url_parts, $url_part); // save item's filename as not processed $url_part = array_shift($url_parts); } } + elseif (!$module_event->getEventParam('url_parts')) { + // parseEnv has processed that param + $url_part = ''; + $category_template = $category_data['CachedCategoryTemplate']; + if ($category_template) { + $category_template = explode('/', $category_template); + $url_part = array_shift($category_template); + $url_parts = $category_template; + } + else { + $url_part = 'index'; + } + } } } @@ -549,7 +565,9 @@ if ( isset($module_prefix) ) { $passed[] = $module_prefix; $module_event = new kEvent($module_prefix.':ParseEnv', Array('url_parts' => $url_parts) ); - $this->Application->HandleEvent($module_event); + if ($process_module) { + $this->Application->HandleEvent($module_event); + } $item_id = $this->Get($module_prefix.'_id'); $module_params = Array($module_prefix.'_id' => $item_id ? $item_id : '0' );