Index: trunk/core/units/general/main_event_handler.php =================================================================== diff -u -N --- trunk/core/units/general/main_event_handler.php (revision 8478) +++ trunk/core/units/general/main_event_handler.php (revision 0) @@ -1,139 +0,0 @@ -Conn =& $this->Application->GetADODBConnection(); - } - - /** - * Created url part for this module - * - * @param kEvent $event - */ - function BuildEnv(&$event) - { - $prefix_special = $event->getPrefixSpecial(); - $url_params = $event->getEventParam('url_params'); - - $query_vars = $this->Application->getUnitOption($event->Prefix, 'QueryString'); - - //if pass events is off and event is not implicity passed - if ( !$event->getEventParam('pass_events') && !isset($url_params[$prefix_special.'_event']) ) - { - $url_params[$prefix_special.'_event'] = ''; // remove event from url if requested - //otherwise it will use value from get_var - } - - if(!$query_vars) return true; - - $processed_params = Array(); - foreach($query_vars as $index => $var_name) - { - //if value passed in params use it, otherwise use current from application - $var_name = $prefix_special.'_'.$var_name; - $processed_params[$var_name] = isset( $url_params[$var_name] ) ? $url_params[$var_name] : $this->Application->GetVar($var_name); - if ( isset($url_params[$var_name]) ) unset( $url_params[$var_name] ); - } - - $ret = ''; - $default_language_id = $this->Application->GetDefaultLanguageId(); - if( $processed_params['m_lang'] && ($processed_params['m_lang'] != $default_language_id) ) - { - $language_name = $this->Application->getCache('language_names', $processed_params['m_lang']); - if ($language_name === false) { - $sql = 'SELECT PackName - FROM '.TABLE_PREFIX.'Language - WHERE LanguageId = '.$processed_params['m_lang']; - $language_name = $this->Conn->GetOne($sql); - $this->Application->setCache('language_names', $processed_params['m_lang'], $language_name); - } - $ret .= $language_name.'/'; - } - - $default_theme_id = $this->Application->GetDefaultThemeId(); - if( $processed_params['m_theme'] && ($processed_params['m_theme'] != $default_theme_id) ) - { - $theme_name = $this->Application->getCache('theme_names', $processed_params['m_theme']); - if ($theme_name === false) { - $sql = 'SELECT Name - FROM '.TABLE_PREFIX.'Theme - WHERE ThemeId = '.$processed_params['m_theme']; - $theme_name = $this->Conn->GetOne($sql); - $this->Application->setCache('theme_names', $processed_params['m_theme'], $theme_name); - - } - $ret .= $theme_name.'/'; - } - - if ($processed_params['m_cat_id'] > 0 && isset($url_params['pass_category']) && $url_params['pass_category']) { - $category_filename = $this->Application->getFilename('c', $processed_params['m_cat_id']); - $t = isset($url_params['t']) && $url_params['t'] ? $url_params['t'] : false; - // category name doesn't match template name -> Proj-CMS/In-Edit tricks - if (!preg_match('/Content\/'.preg_quote($t, '/').'/i', $category_filename)) { - $ret .= $category_filename.'/'; - } - $url_params['category_processed'] = true; - } - else { -// $url_params['no_category'] = 1; // for debugging - } - unset($url_params['pass_category']); // unset it just in case - - $force_page_adding = false; - if (getArrayValue($url_params, 'reset')) - { - unset($url_params['reset']); - if ($processed_params['m_cat_id']) - { - $processed_params['m_cat_page'] = 1; - $force_page_adding = true; - } - } - - if( $processed_params['m_cat_page'] > 1 || $force_page_adding ) - { - $ret = preg_replace('/(.*)\//', '\\1', $ret).'_'.$processed_params['m_cat_page'].'/'; - } - - $template = getArrayValue($url_params, 't'); - $category_template = $processed_params['m_cat_id'] ? $this->Application->getCache('category_templates', $processed_params['m_cat_id']) : ''; - - if ((strtolower($template) == '__default__') && ($processed_params['m_cat_id'] == 0)) { - // for "Home" category set template to index when not set - $template = 'index'; - } - - // remove template from url if it is category index cached template - if ($template == $category_template || strtolower($template) == '__default__') { - $template = ''; - } - - if ($template) { - $ret .= $template.'/'; - } - unset($url_params['t']); - - $event->setEventParam('url_params', $url_params); - $event->setEventParam('env_string', strtolower($ret) ); - } - } - -?> \ No newline at end of file