Index: branches/unlabeled/unlabeled-1.42.2/core/kernel/utility/http_query.php =================================================================== diff -u -N -r4388 -r4426 --- branches/unlabeled/unlabeled-1.42.2/core/kernel/utility/http_query.php (.../http_query.php) (revision 4388) +++ branches/unlabeled/unlabeled-1.42.2/core/kernel/utility/http_query.php (.../http_query.php) (revision 4426) @@ -306,6 +306,7 @@ $url_parts = $url ? explode('/', $url) : Array(); + $process_module = true; if($this->Get('rewrite') == 'on' || !$url_parts) { // set default values @@ -409,6 +410,7 @@ if (!$url_part) { // no more parts left in url + $process_module = false; $sql = 'SELECT CachedCategoryTemplate FROM '.TABLE_PREFIX.'Category WHERE CategoryId = '.$category_id; @@ -422,9 +424,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); @@ -433,17 +436,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'; + } + } } } @@ -552,7 +568,9 @@ if ( isset($module_prefix) ) { $passed[] = $module_prefix; $module_event = new kEvent($module_prefix.':ParseEnv', Array('url_parts' => $url_parts) ); + 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' ); Index: branches/unlabeled/unlabeled-1.22.2/core/kernel/event_handler.php =================================================================== diff -u -N -r4150 -r4426 --- branches/unlabeled/unlabeled-1.22.2/core/kernel/event_handler.php (.../event_handler.php) (revision 4150) +++ branches/unlabeled/unlabeled-1.22.2/core/kernel/event_handler.php (.../event_handler.php) (revision 4426) @@ -234,7 +234,10 @@ { $this->Application->SetVar($event->getPrefixSpecial().'_'.$var_name, $var_value); } - if (!$url_parts) return false; + if (!$url_parts) { +// $event->status = erFAIL; + return false; + } $ret = ''; $url_part = array_shift($url_parts); @@ -246,7 +249,11 @@ $url_part = $url_parts ? array_shift($url_parts) : ''; } - if(!$url_part) return true; + if (!$url_part) { + $event->setEventParam('url_parts', $url_parts); +// $event->status = erFAIL; + return true; + } // match module reviews page if( preg_match('/(.*)_([\d]+)$/', $url_part, $rets) ) @@ -273,6 +280,7 @@ array_unshift($url_parts, $url_part); $event->status = erFAIL; } + $event->setEventParam('url_parts', $url_parts); } }