Index: branches/5.1.x/core/kernel/processors/main_processor.php =================================================================== diff -u -N -r12657 -r13086 --- branches/5.1.x/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 12657) +++ branches/5.1.x/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 13086) @@ -1,6 +1,6 @@ Application->IsAdmin() || $force_admin) { + if ($this->Application->isAdmin || $force_admin) { if ($module == 'in-portal') { $module = 'kernel'; } @@ -214,7 +214,7 @@ } /** - * Returns block parameter by name (used only as "check" parameter value for "m_if" tag !) + * Returns block parameter by name (used only as "check" parameter value for "m_if" tag!) * * @param Array $params * @return stirng @@ -224,17 +224,20 @@ { $name = $params['name']; - /*if (isset($this->Application->LateParsed[$name])) { - $f = $this->Application->PreParsedBlocks['capture_'.$name.$this->Application->LateParsed[$name]]; - $this->Application->Parser->SetParam($name, $f(array())); - }*/ + if (array_key_exists($name, $this->Application->Parser->Captures)) { + $capture_params = $params; + $capture_params['name'] = '__capture_' . $name; - $res = $this->Application->Parser->GetParam($params['name']); + $this->Application->Parser->SetParam($name, $this->Application->ParseBlock($capture_params)); + } + + $res = $this->Application->Parser->GetParam($name); + if ($res === false) { $res = ''; } - if (isset($params['plus'])) { + if (array_key_exists('plus', $params)) { $res += $params['plus']; } @@ -474,15 +477,7 @@ */ function Phrase($params) { - // m:phrase name="phrase_name" default="Tr-alala" updated="2004-01-29 12:49" $phrase_name = $this->SelectParam($params, 'label,name,title'); - if (isset($params['source']) && $params['source']) { - $phrase_name = $this->Application->GetVar($phrase_name); - if (array_key_exists('default', $params) && !$phrase_name) { - $phrase_name = $params['default']; - } - } - $no_editing = array_key_exists('no_editing', $params) && $params['no_editing']; $translation = $this->Application->Phrase($phrase_name, !$no_editing); @@ -586,22 +581,32 @@ $skip_prefixes = isset($params['skip_prefixes']) ? explode(',', $params['skip_prefixes']) : Array(); $cms_mode = $this->Application->GetVar('admin'); + $included = Array (); + foreach ($this->Application->ModuleInfo as $module_name => $module_data) { $module_key = mb_strtolower($module_name); if ($module_name == 'In-Portal') { - if (!$cms_mode && $this->Application->IsAdmin()) { + if (!$cms_mode && $this->Application->isAdmin) { // don't process In-Portal templates in admin continue; } // Front-End still relies on In-Portal module $module_prefix = $module_data['TemplatePath']; } + elseif ($this->Application->isAdmin) { + $module_prefix = $module_data['Path']; // was $module_key . '/'; + } else { - $module_prefix = $this->Application->IsAdmin() ? $module_key.'/' : rtrim($module_data['TemplatePath'], '/').'/'; + $module_prefix = $module_data['TemplatePath']; // always have trailing "/" } + if (in_array($module_prefix, $included)) { + // template by this path was already included by other module (e.g. in-portal used core's template) + continue; + } + $block_params['t'] = $module_prefix.$this->SelectParam($params, $module_key.'_template,'.$module_key.'_t,template,t'); $check_prefix = $module_data['Var']; @@ -619,7 +624,8 @@ $block_params['block_no_data'] = $module_prefix.'/'.$no_data; } - $ret .= $this->Application->Parser->IncludeTemplate($block_params, isset($block_params['is_silent']) ? 1 : 0); + $ret .= $this->Application->IncludeTemplate($block_params); + $included[] = $module_prefix; } return $ret; @@ -762,14 +768,24 @@ if ((!$this->Application->LoggedIn() || !$group_access) && $condition) { $redirect_params = $this->Application->HttpQuery->getRedirectParams(true); - $redirect_params['next_template'] = $t; if (array_key_exists('pass_category', $params)) { $redirect_params['pass_category'] = $params['pass_category']; } + if (MOD_REWRITE) { + // TODO: $next_t variable is ignored !!! (is anyone using m_RequireLogin tag with "next_template" parameter?) + $redirect_params = Array ( + 'm_cat_id' => 0, + 'next_template' => urlencode('external:' . $_SERVER['REQUEST_URI']), + ); + } + else { + $redirect_params['next_template'] = $t; + } + if ( $this->Application->LoggedIn() && !$group_access) { - $this->Application->Redirect( $params['no_group_perm_template'], $redirect_params); + $this->Application->Redirect($params['no_group_perm_template'], $redirect_params); } $this->Application->Redirect($params['login_template'], $redirect_params); @@ -799,7 +815,7 @@ */ function CheckSSL($params) { - $ssl = $this->Application->IsAdmin() ? $this->Application->ConfigValue('AdminSSL_URL') : false; + $ssl = $this->Application->isAdmin ? $this->Application->ConfigValue('AdminSSL_URL') : false; if (!$ssl) { // not in admin or admin ssl url is empty