Index: trunk/core/units/general/helpers/mod_rewrite_helper.php =================================================================== diff -u -N -r6093 -r6428 --- trunk/core/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 6093) +++ trunk/core/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 6428) @@ -34,7 +34,7 @@ $res = true; } - $this->Application->VerifyLanguageId(); +// $this->Application->VerifyLanguageId(); if (!$res) { array_unshift($url_parts, $url_part); } @@ -54,7 +54,7 @@ $vars['m_theme'] = $theme_id; $res = true; } - $this->Application->VerifyThemeId(); // verify anyway - will set default if not found!!! +// $this->Application->VerifyThemeId(); // verify anyway - will set default if not found!!! if (!$res) { array_unshift($url_parts, $url_part); } @@ -98,6 +98,20 @@ return $res; } + function ProcessPage(&$url_parts, &$vars) + { + if (!is_numeric($url_parts[0]) || count($url_parts) > 1) return false; + + // set module pages for all modules, since we don't know which module will need it + foreach ($this->Application->ModuleInfo as $module_name => $module_data) + { + $vars[ $module_data['Var'].'_id'] = 0; + $vars[ $module_data['Var'].'_Page'] = $url_parts[0]; + $vars[ $module_data['Var'].'_Reviews_Page'] = 0; + } + return true; + } + function ProcessModuleIndex(&$url_parts, &$vars) { if ( count($url_parts) > 1) return false; // if no more parts or only 1 part left @@ -107,14 +121,7 @@ if( $url_parts ) { // if parts are left, it can only be module page if (!is_numeric($url_parts[0])) return false; - - // set module pages for all modules, since we don't know which module will need it - foreach ($this->Application->ModuleInfo as $module_name => $module_data) - { - $vars[ $module_data['Var'].'_id'] = 0; - $vars[ $module_data['Var'].'_Page'] = $url_parts[0]; - $vars[ $module_data['Var'].'_Reviews_Page'] = 0; - } + $this->ProcessPage($url_parts, $vars); } // try to find CMS index page of the category @@ -279,7 +286,7 @@ */ function ProcessVirtualTemplate(&$url_parts, &$vars) { - if (!isset($url_parts[0]) || !$this->Application->isModuleEnabled('In-CMS')) return false; + if (!isset($url_parts[0]) || !$this->Application->isModuleEnabled('In-Edit')) return false; $template_path = implode('/', $url_parts); $sql = 'SELECT p.PageId, ci.CategoryId FROM '.TABLE_PREFIX.'Pages AS p @@ -326,15 +333,15 @@ { $this->HTTPQuery->Set($name,$value); } - if ($restored) { +// if ($restored) { $this->InitAll(); - } +// } $this->HTTPQuery->finalizeParsing($passed); } function InitAll() { - $this->Application->Phrases = new PhrasesCache(); +// $this->Application->Phrases = new PhrasesCache(); $this->Application->VerifyLanguageId(); $this->Application->Phrases->Init('phrases'); $this->Application->VerifyThemeId(); @@ -380,8 +387,6 @@ $this->ProcessCategory($url_parts, $vars); - - if ( $this->ProcessModuleIndex($url_parts, $vars) ) { foreach ($this->Application->ModuleInfo as $module_name => $info) { $passed[] = $info['Var']; @@ -423,11 +428,25 @@ } } + if ( $this->ProcessPage($url_parts, $vars) ) { + return $vars; + } + if ( $module_prefix = $this->ProcessModuleItem($url_parts, $vars, false) ) { $passed[] = $module_prefix; return $vars; } + if ( $this->Application->isModuleEnabled('In-Edit') && $this->Application->GetVar('admin') == 1) { + $adm_ses =& $this->Application->recallObject('Session.admin'); + $user = $adm_ses->RecallVar('user_id'); + $perm_helper =& $this->Application->recallObject('PermissionsHelper'); + if ($perm_helper->CheckUserPermission($user, 'PAGE.ADD', 0)) { + $vars['t'] = implode('/', $url_parts); + return $vars; + } + } + $not_found = $this->Application->ConfigValue('ErrorTemplate'); $vars['t'] = $not_found ? $not_found : 'error_notfound';