Index: trunk/core/kernel/processors/main_processor.php
===================================================================
diff -u -N -r5289 -r6093
--- trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 5289)
+++ trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 6093)
@@ -121,7 +121,7 @@
function FormAction($params)
{
- return $this->Application->ProcessParsedTag('m', 't', Array( 'pass'=>'all,m' ) );
+ return $this->Application->ProcessParsedTag('m', 't', array_merge($params, Array('pass'=>'all,m' )) );
}
/*// NEEDS TEST
@@ -512,21 +512,23 @@
function MyInclude($params)
{
$BlockParser =& $this->Application->makeClass('TemplateParser');
- $BlockParser->SetParams($params);
+// $BlockParser->SetParams($params);
$parser =& $this->Application->Parser;
$this->Application->Parser =& $BlockParser;
$t = $this->SelectParam($params, 't,template,block,name');
$t = eregi_replace("\.tpl$", '', $t);
- $templates_cache =& $this->Application->recallObject('TemplatesCache');
- $res = $BlockParser->Parse( $templates_cache->GetTemplateBody($t, getArrayValue($params, 'is_silent')), $t );
+ if (!$t) {
+ trigger_error('Template name not specified in <inp2:m_include .../> tag', E_USER_ERROR);
+ }
+
+ $res = $BlockParser->ParseTemplate( $t, 1, $params, isset($params['is_silent']) ? 1 : 0 );
-
if ( !$BlockParser->DataExists && (isset($params['data_exists']) || isset($params['block_no_data'])) ) {
if ($block_no_data = getArrayValue($params, 'block_no_data')) {
$res = $BlockParser->Parse(
- $templates_cache->GetTemplateBody($block_no_data, getArrayValue($params, 'is_silent') ),
+ $this->Application->TemplatesCache->GetTemplateBody($block_no_data, getArrayValue($params, 'is_silent') ),
$t
);
}
@@ -538,11 +540,13 @@
$this->Application->Parser->DataExists = $this->Application->Parser->DataExists || $BlockParser->DataExists;
return $res;
}
+
function ModuleInclude($params)
{
$ret = '';
$block_params = array_merge($params, Array('is_silent' => 2)); // don't make fatal errors in case if template is missing
$current_template = $this->Application->GetVar('t');
+ $skip_prefixes = isset($params['skip_prefixes']) ? explode(',', $params['skip_prefixes']) : Array();
foreach ($this->Application->ModuleInfo as $module_name => $module_data) {
$module_key = strtolower($module_name);
@@ -554,7 +558,7 @@
}
$block_params['t'] = $module_prefix.$this->SelectParam($params, $module_key.'_template,'.$module_key.'_t,template,t');
- if ($block_params['t'] == $current_template) continue;
+ if ($block_params['t'] == $current_template || in_array($module_data['Var'], $skip_prefixes)) continue;
$no_data = $this->SelectParam($params, $module_key.'_block_no_data,block_no_data');
if ($no_data) {
@@ -564,6 +568,12 @@
}
return $ret;
}
+
+ function ModuleEnabled($params)
+ {
+ return $this->Application->isModuleEnabled( $params['module'] );
+ }
+
/*function Kernel_Scripts($params)
{
return '';
@@ -642,6 +652,33 @@
return $this->ParseBlock($params);
}
+ function RenderElements($params)
+ {
+ if (!isset($params['elements']) || !$params['elements']) return;
+ $elements = explode(',',$params['elements']);
+ if (isset($params['skip']) && $params['skip']) {
+ $tmp_skip = explode(',',$params['skip']);
+ foreach ($tmp_skip as $elem) {
+ $skip[] = trim($elem);
+ }
+ }
+ else {
+ $skip = array();
+ }
+ unset($params['elements']);
+ $o = '';
+ foreach ($elements as $an_element)
+ {
+ $cur = trim($an_element);
+ if (in_array($cur,$skip)) continue;
+ $pass_params = $params;
+ $pass_params['name'] = $cur;
+ $o .= $this->ParseBlock($pass_params);
+ }
+ return $o;
+
+ }
+
/**
* Checks if debug mode is on
*
@@ -725,7 +762,10 @@
}
// check by permissions: begin
- if ((isset($params['perm_event']) && $params['perm_event']) || (isset($params['permissions']) && $params['permissions'])) {
+ if ((isset($params['perm_event']) && $params['perm_event']) ||
+ (isset($params['perm_prefix']) && $params['perm_prefix']) ||
+ (isset($params['permissions']) && $params['permissions'])) {
+
$perm_helper =& $this->Application->recallObject('PermissionsHelper');
$perm_status = $perm_helper->TagPermissionCheck($params, 'm_RequireLogin');
if (!$perm_status) {
@@ -808,7 +848,7 @@
$require = false;
- if ($params['mode'] == 'required') {
+ if (isset($params['mode']) && $params['mode'] == 'required') {
$require = true;
if (isset($params['for_logged_in_only']) && $params['for_logged_in_only'] && !$this->Application->LoggedIn()) {
$require = false;
@@ -834,6 +874,7 @@
else {
if (PROTOCOL == 'https://' && $this->Application->ConfigValue('Force_HTTP_When_SSL_Not_Required')) {
if ($this->Application->GetVar('__KEEP_SSL__')) return;
+ $pass = array('pass'=>'m', 'm_cat_id'=>0);
$this->Application->Redirect('', array_merge_recursive2($pass, Array('__SSL__' => 0)));
}
}
@@ -858,7 +899,19 @@
$lang =& $this->Application->recallObject('lang.current');
header('Content-type: text/xml; charset='.$lang->GetDBField('Charset'));
}
-}
+ function RootCategoryName($params)
+ {
+ $root_phrase = $this->Application->ConfigValue('Root_Name');
+ return $this->Application->Phrase($root_phrase);
+ }
-?>
+ function AttachFile($params)
+ {
+ $email_object =& $this->Application->recallObject('kEmailMessage');
+ $path = FULL_PATH.'/'.$params['path'];
+ if (file_exists($path)) {
+ $email_object->attachFile($path);
+ }
+ }
+}