Index: branches/unlabeled/unlabeled-1.8.2/core/units/configuration/configuration_config.php
===================================================================
diff -u -r4044 -r4411
--- branches/unlabeled/unlabeled-1.8.2/core/units/configuration/configuration_config.php (.../configuration_config.php) (revision 4044)
+++ branches/unlabeled/unlabeled-1.8.2/core/units/configuration/configuration_config.php (.../configuration_config.php) (revision 4411)
@@ -18,7 +18,7 @@
'TitlePresets' => Array(
'default' => Array('tag_params' => Array('conf' => Array('per_page' => -1))),
-
+
'config_list_general' => Array('prefixes' => Array('conf_List','confg_List'), 'format' => "!la_updating_config!"),
'config_list_output' => Array('prefixes' => Array('conf_List','confg_List'), 'format' => "!la_updating_config!"),
'config_list_contacts' => Array('prefixes' => Array('conf_List','confg_List'), 'format' => "!la_updating_config!"),
Index: branches/unlabeled/unlabeled-1.9.2/core/units/configuration/configuration_tag_processor.php
===================================================================
diff -u -r4227 -r4411
--- branches/unlabeled/unlabeled-1.9.2/core/units/configuration/configuration_tag_processor.php (.../configuration_tag_processor.php) (revision 4227)
+++ branches/unlabeled/unlabeled-1.9.2/core/units/configuration/configuration_tag_processor.php (.../configuration_tag_processor.php) (revision 4411)
@@ -34,7 +34,7 @@
$this->Application->SetVar( $this->getPrefixSpecial().'_id', $list->GetDBField($id_field) ); // for edit/delete links using GET
// using 2 blocks for drawing o row in case if current & next record titles match
- $next_item_prompt = $list->Records[$list->CurrentIndex + 1]['prompt'];
+ $next_item_prompt = $list->CurrentIndex + 1 < $list->RecordsCount ? $list->Records[$list->CurrentIndex + 1]['prompt'] : '';
$this_item_prompt = $list->GetDBField('prompt');
if ($next_item_prompt == $this_item_prompt) {
Index: branches/unlabeled/unlabeled-1.8.2/kernel/units/configuration/configuration_config.php
===================================================================
diff -u -r4044 -r4411
--- branches/unlabeled/unlabeled-1.8.2/kernel/units/configuration/configuration_config.php (.../configuration_config.php) (revision 4044)
+++ branches/unlabeled/unlabeled-1.8.2/kernel/units/configuration/configuration_config.php (.../configuration_config.php) (revision 4411)
@@ -18,7 +18,7 @@
'TitlePresets' => Array(
'default' => Array('tag_params' => Array('conf' => Array('per_page' => -1))),
-
+
'config_list_general' => Array('prefixes' => Array('conf_List','confg_List'), 'format' => "!la_updating_config!"),
'config_list_output' => Array('prefixes' => Array('conf_List','confg_List'), 'format' => "!la_updating_config!"),
'config_list_contacts' => Array('prefixes' => Array('conf_List','confg_List'), 'format' => "!la_updating_config!"),
Index: branches/unlabeled/unlabeled-1.27.2/kernel/admin_templates/incs/form_blocks.tpl
===================================================================
diff -u -r4218 -r4411
--- branches/unlabeled/unlabeled-1.27.2/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 4218)
+++ branches/unlabeled/unlabeled-1.27.2/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 4411)
@@ -1,20 +1,32 @@
-
+
+
+
+
+
+
+
img/logo_bg.gif) no-repeat top right;">
+
+ .gif" align="absmiddle" title="">
+ |
+
+
+
+
';
- }*/
-
-
- /*function GetUserPermission($params)
- {
- // echo"GetUserPermission $params[name]";
- if ($this->Application->RecallVar('user_type') == 1)
- return 1;
- else {
- $perm_name = $params[name];
- $aPermissions = unserialize($this->Application->RecallVar('user_permissions'));
- if ($aPermissions)
- return $aPermissions[$perm_name];
- }
- }*/
-
-
- /**
- * Set's parser block param value
- *
- * @param Array $params
- * @access public
- */
- function AddParam($params)
- {
- $parser =& $this->Application->Parser; // recallObject('TemplateParser');
- foreach ($params as $param => $value) {
- $this->Application->SetVar($param, $value);
- $parser->SetParam($param, $value);
- $parser->AddParam('/\$'.$param.'/', $value);
- }
- }
-
- /*function ParseToVar($params)
- {
- $var = $params['var'];
- $tagdata = $params['tag'];
- $parser =& $this->Application->Parser; //recallObject('TemplateParser');
- $res = $this->Application->ProcessTag($tagdata);
-
- $parser->SetParam($var, $res);
- $parser->AddParam('/\$'.$var.'/', $res);
- return '';
- }*/
-
- /*function TagNotEmpty($params)
- {
- $tagdata = $params['tag'];
- $res = $this->Application->ProcessTag($tagdata);
- return $res != '';
- }*/
-
- /*function TagEmpty($params)
- {
- return !$this->TagNotEmpty($params);
- }*/
-
- /**
- * Parses block and returns result
- *
- * @param Array $params
- * @return string
- * @access public
- */
- function ParseBlock($params)
- {
- $parser =& $this->Application->Parser; // recallObject('TemplateParser');
- return $parser->ParseBlock($params);
- }
-
- function RenderElement($params)
- {
- return $this->ParseBlock($params);
- }
-
- /**
- * Checks if debug mode is on
- *
- * @return bool
- * @access public
- */
- function IsDebugMode()
- {
- return $this->Application->isDebugMode();
- }
-
- function MassParse($params)
- {
- $qty = $params['qty'];
- $block = $params['block'];
- $mode = $params['mode'];
-
- $o = '';
- if ($mode == 'func') {
- $func = create_function('$params', '
- $o = \' |
\';
- $o.= \'a\'.$params[\'param1\'].\' | \';
- $o.= \'a\'.$params[\'param2\'].\' | \';
- $o.= \'a\'.$params[\'param3\'].\' | \';
- $o.= \'a\'.$params[\'param4\'].\' | \';
- $o.= \'
\';
- return $o;
- ');
- for ($i=1; $i<$qty; $i++) {
- $block_params['param1'] = rand(1, 10000);
- $block_params['param2'] = rand(1, 10000);
- $block_params['param3'] = rand(1, 10000);
- $block_params['param4'] = rand(1, 10000);
- $o .= $func($block_params);
- }
- return $o;
- }
-
- $block_params['name'] = $block;
-
- for ($i=0; $i<$qty; $i++) {
- $block_params['param1'] = rand(1, 10000);
- $block_params['param2'] = rand(1, 10000);
- $block_params['param3'] = rand(1, 10000);
- $block_params['param4'] = rand(1, 10000);
- $block_params['passed'] = $params['passed'];
- $block_params['prefix'] = 'm';
-
- $o.= $this->Application->ParseBlock($block_params, 1);
- }
- return $o;
- }
-
- function AfterScript($params)
- {
- $after_script = $this->Application->GetVar('after_script');
- if ( $after_script ) {
- return '';
- }
- return '';
- }
-
- function LoggedIn($params)
- {
- return $this->Application->LoggedIn();
- }
-
- /**
- * Checks if user is logged in and if not redirects it to template passed
- *
- * @param Array $params
- */
- function RequireLogin($params)
- {
- $t = $this->Application->GetVar('t');
- if ($next_t = getArrayValue($params, 'next_template')) {
- $t = $next_t;
- }
-
- if($permission_groups = getArrayValue($params, 'permissions'))
- {
- $permission_groups = explode('|', $permission_groups);
- $group_has_permission = false;
- foreach($permission_groups as $permission_group)
- {
- $permissions = explode(',', $permission_group);
- $has_permission = true;
- foreach($permissions as $permission)
- {
- $has_permission = $has_permission && $this->Application->CheckPermission($permission);
- }
- $group_has_permission = $group_has_permission || $has_permission;
-
- if($group_has_permission)
- {
- return;
- }
- }
-
- if( !$this->Application->LoggedIn() )
- {
- $this->Application->Redirect( $params['login_template'], Array('next_template'=>$t) );
- }
- else
- {
- $this->Application->Redirect( $params['no_permissions_template'] );
- }
- }
-
- $condition = getArrayValue($params,'condition');
- if(!$condition)
- {
- $condition = true;
- }
- else
- {
- if( substr($condition,0,1) == '!' )
- {
- $condition = !$this->Application->ConfigValue( substr($condition,1) );
- }
- else
- {
- $condition = $this->Application->ConfigValue($condition);
- }
- }
-
- $group = $this->SelectParam($params, 'group');
- $group_access = true;
- if ($group) {
- $conn =& $this->Application->DB;
- $group_id = $conn->GetOne('SELECT GroupId FROM '.TABLE_PREFIX.'PortalGroup WHERE Name = '.$conn->qstr($group));
- if ($group_id) {
- $groups = explode(',', $this->Application->RecallVar('UserGroups'));
- $group_access = in_array($group_id, $groups);
- }
- }
-
- if( (!$this->Application->LoggedIn() || !$group_access) && $condition )
- {
- if ( $this->Application->LoggedIn() && !$group_access) {
- $this->Application->Redirect( $params['no_group_perm_template'], Array('next_template'=>$t) );
- }
- $this->Application->Redirect( $params['login_template'], Array('next_template'=>$t) );
- }
- }
-
- /**
- * Checks if SSL is on and redirects to SSL URL if needed
- * If SSL_URL is not defined in config - the tag does not do anything
- * If for_logged_in_only="1" exits if user is not logged in.
- * If called without params forces https right away. If called with by_config="1" checks the
- * Require SSL setting from General Config and if it is ON forces https
- *
- * @param unknown_type $params
- */
- function CheckSSL($params)
- {
- $ssl = $this->Application->ConfigValue('SSL_URL');
- if (!$ssl) return; //SSL URL is not set - no way to require SSL
-
- $require = false;
-
- if ($params['mode'] == 'required') {
- $require = true;
- if (isset($params['for_logged_in_only']) && $params['for_logged_in_only'] && !$this->Application->LoggedIn()) {
- $require = false;
- }
-
- if (isset($params['condition'])) {
- if (!$this->Application->ConfigValue($params['condition'])) {
- $require = false;
- }
- }
- }
-
- $http_query =& $this->Application->recallObject('HTTPQuery');
- $pass = $http_query->getRedirectParams();
-
- if ($require) {
- if (PROTOCOL == 'https://') {
- $this->Application->SetVar('__KEEP_SSL__', 1);
- return;
- }
- $this->Application->Redirect('', array_merge_recursive2($pass, Array('__SSL__' => 1)));
- }
- else {
- if (PROTOCOL == 'https://' && $this->Application->ConfigValue('Force_HTTP_When_SSL_Not_Required')) {
- if ($this->Application->GetVar('__KEEP_SSL__')) return;
- $this->Application->Redirect('', array_merge_recursive2($pass, Array('__SSL__' => 0)));
- }
- }
- }
-
- function SaveReturnScript($params)
- {
- // admin/save_redirect.php?do=
- $url = str_replace($this->Application->BaseURL(), '', $this->T($params) );
- $url = explode('?', $url, 2);
- $url = 'save_redirect.php?'.$url[1].'&do='.$url[0];
-
- $this->Application->StoreVar('ReturnScript', $url);
- }
-
- function ConstOn($params)
- {
- $name = $this->SelectParam($params,'name,const');
- return $this->Application->isDebugMode() && dbg_ConstOn($name);
- }
-
- function SetDefaultCategory($params)
- {
- $module_name = $params['module'];
- $module =& $this->Application->recallObject('mod.'.$module_name);
- $this->Application->SetVar('m_cat_id', $module->GetDBField('RootCat') );
- }
-
- function ImportRedirect($params)
- {
- $import_id = $this->Application->GetVar('import_id');
- if ($import_id) {
- // redirect forward to step3 (import parameters coosing)
- $this->Application->StoreVar('ImportScriptID', $import_id);
-
- $sql = 'SELECT *
- FROM '.TABLE_PREFIX.'ImportScripts
- WHERE is_id = '.$import_id;
-
- $db =& $this->Application->GetADODBConnection();
- $is_params = $db->GetRow($sql);
-
- if ($is_params['is_type'] == 'db') {
- $this->Application->Redirect('', null, '', 'import/step3.php');
- }
- elseif ($is_params['is_type'] == 'csv') {
- $module = strtolower($is_params['is_Module']);
- $template = $module.'/import';
- $sql = 'SELECT Var
- FROM '.TABLE_PREFIX.'Modules
- WHERE LOWER(Name) = '.$db->qstr($module);
- $item_prefix = $db->GetOne($sql);
- $pass_params = Array('m_opener' => 'd', $item_prefix.'.import_id' => 0, $item_prefix.'.import_event' => 'OnNew', 'pass' => 'm,'.$item_prefix.'.import');
- $this->Application->Redirect($template, $pass_params);
- }
- }
- else {
- // redirect back to step2 (import type choosing)
- $this->Application->Redirect('', null, '', 'import/step2.php');
- }
- }
-
- function GetSectionTitle($params)
- {
- $params['name'] = replaceModuleSection($params['phrase']);
- return $this->Phrase($params);
- }
-
- function GetSectionIcon($params)
- {
- return replaceModuleSection($params['icon']);
- }
-
- function StoreSystemVars($params)
- {
- // save theese variables to session, because they are useful for most configuration templates
- $this->Application->LinkVar('module');
- $this->Application->LinkVar('section');
- }
-
- function XMLTemplate($params)
- {
- define('DBG_SKIP_REPORTING', 1);
- header('Content-type: text/xml');
- }
-}
-
-
-?>
+Application->recallObject('kActions');
+ $actions->Set('t', $this->Application->GetVar('t'));
+ $actions->Set('sid', $this->Application->GetSID());
+ $actions->Set('m_opener', $this->Application->GetVar('m_opener') );
+
+ }
+
+ /**
+ * Used to handle calls where tag name
+ * match with existing php function name
+ *
+ * @param Tag $tag
+ * @return string
+ */
+ function ProcessTag(&$tag)
+ {
+ if ($tag->Tag=='include') $tag->Tag='MyInclude';
+ return parent::ProcessTag($tag);
+ }
+
+ /**
+ * Creates HTML tag for all templates
+ * affects future css, js files and href params of links
+ *
+ * @return string
+ * @access public
+ */
+ function Base_Ref()
+ {
+ $url = $this->Application->BaseURL().substr(THEMES_PATH,1).'/';
+ return '';
+ }
+
+ /**
+ * Returns base url for web-site
+ *
+ * @return string
+ * @access public
+ */
+ function BaseURL()
+ {
+ return $this->Application->BaseURL();
+ }
+
+ function TemplatesBase($params)
+ {
+ return $this->Application->BaseURL().THEMES_PATH;
+ }
+
+ function ProjectBase($params)
+ {
+ return $this->Application->BaseURL();
+ }
+
+ /*function Base($params)
+ {
+ return $this->Application->BaseURL().$params['add'];
+ }*/
+
+ /**
+ * Used to create link to any template.
+ * use "pass" paramter if "t" tag to specify
+ * prefix & special of object to be represented
+ * in resulting url
+ *
+ * @param Array $params
+ * @return string
+ * @access public
+ */
+ function T($params)
+ {
+ //by default link to current template
+ $t = $this->SelectParam($params, 't,template');
+ unset($params['t']);
+ unset($params['template']);
+ $prefix=isset($params['prefix']) ? $params['prefix'] : ''; unset($params['prefix']);
+ $index_file = isset($params['index_file']) ? $params['index_file'] : null; unset($params['index_file']);
+
+ return $this->Application->HREF($t, $prefix, $params, $index_file);
+ }
+
+ function Link($params)
+ {
+ if (isset($params['template'])) {
+ $params['t'] = $params['template'];
+ unset($params['template']);
+ }
+ if (!isset($params['pass']) && !isset($params['no_pass'])) $params['pass'] = 'm';
+ if (isset($params['no_pass'])) unset($params['no_pass']);
+
+ if( $this->Application->GetVar('admin') ) $params['admin'] = 1;
+
+ return $this->T($params);
+ }
+
+ function Env($params)
+ {
+ $t = $params['template'];
+ unset($params['template']);
+ return $this->Application->BuildEnv($t, $params, 'm', null, false);
+ }
+
+ function FormAction($params)
+ {
+ return $this->Application->ProcessParsedTag('m', 't', Array( 'pass'=>'all,m' ) );
+ }
+
+ /*// NEEDS TEST
+ function Config($params)
+ {
+ return $this->Application->ConfigOption($params['var']);
+ }
+
+ function Object($params)
+ {
+ $name = $params['name'];
+ $method = $params['method'];
+
+ $tmp =& $this->Application->recallObject($name);
+ if ($tmp != null) {
+ if (method_exists($tmp, $method))
+ return $tmp->$method($params);
+ else
+ echo "Method $method does not exist in object ".get_class($tmp)." named $name
";
+ }
+ else
+ echo "Object $name does not exist in the appliaction
";
+ }*/
+
+ /**
+ * Tag, that always returns true.
+ * For parser testing purposes
+ *
+ * @param Array $params
+ * @return bool
+ * @access public
+ */
+ function True($params)
+ {
+ return true;
+ }
+
+ /**
+ * Tag, that always returns false.
+ * For parser testing purposes
+ *
+ * @param Array $params
+ * @return bool
+ * @access public
+ */
+ function False($params)
+ {
+ return false;
+ }
+
+ /**
+ * Returns block parameter by name
+ *
+ * @param Array $params
+ * @return stirng
+ * @access public
+ */
+ function Param($params)
+ {
+ //$parser =& $this->Application->recallObject('TemplateParser');
+ $res = $this->Application->Parser->GetParam($params['name']);
+ if ($res === false) $res = '';
+ if (isset($params['plus']))
+ $res += $params['plus'];
+ return $res;
+ }
+
+ /**
+ * Gets value of specified field from specified prefix_special and set it as parser param
+ *
+ * @param Array $params
+ */
+ /*function SetParam($params)
+ {
+ //
+ list($prefix_special, $field_name) = explode(':', $params['src']);
+
+ $object =& $this->Application->recallObject($prefix_special);
+ $name = $this->SelectParam($params, 'param,name,var');
+
+ $this->Application->Parser->SetParam($name, $object->GetField($field_name) );
+ }*/
+
+ /**
+ * Compares block parameter with value specified
+ *
+ * @param Array $params
+ * @return bool
+ * @access public
+ */
+ function ParamEquals($params)
+ {
+ //$parser =& $this->Application->recallObject('TemplateParser');
+ $name = $this->SelectParam($params, 'name,var,param');
+ $value = $params['value'];
+ return ($this->Application->Parser->GetParam($name) == $value);
+ }
+
+ /*function PHP_Self($params)
+ {
+ return $HTTP_SERVER_VARS['PHP_SELF'];
+ }
+ */
+
+ /**
+ * Returns session variable value by name
+ *
+ * @param Array $params
+ * @return string
+ * @access public
+ */
+ function Recall($params)
+ {
+ $ret = $this->Application->RecallVar( $this->SelectParam($params,'name,var,param') );
+ $ret = ($ret === false && isset($params['no_null'])) ? '' : $ret;
+ if( getArrayValue($params,'special') || getArrayValue($params,'htmlchars')) $ret = htmlspecialchars($ret);
+
+ if ( getArrayValue($params, 'urlencode') ) $ret = urlencode($ret);
+
+ return $ret;
+ }
+
+ // bad style to store something from template to session !!! (by Alex)
+ // Used here only to test how session works, nothing more
+ function Store($params)
+ {
+ //echo"Store $params[name]
";
+ $name = $params['name'];
+ $value = $params['value'];
+ $this->Application->StoreVar($name,$value);
+ }
+
+ /**
+ * Sets application variable value(-s)
+ *
+ * @param Array $params
+ * @access public
+ */
+ function Set($params)
+ {
+ foreach ($params as $param => $value) {
+ $this->Application->SetVar($param, $value);
+ }
+ }
+
+ /**
+ * Increment application variable
+ * specified by number specified
+ *
+ * @param Array $params
+ * @access public
+ */
+ function Inc($params)
+ {
+ $this->Application->SetVar($params['param'], $this->Application->GetVar($params['param']) + $params['by']);
+ }
+
+ /**
+ * Retrieves application variable
+ * value by name
+ *
+ * @param Array $params
+ * @return string
+ * @access public
+ */
+ function Get($params)
+ {
+ $ret = $this->Application->GetVar($this->SelectParam($params, 'name,var,param'), '');
+ return getArrayValue($params, 'htmlchars') ? htmlspecialchars($ret) : $ret;
+ }
+
+ /**
+ * Retrieves application constant
+ * value by name
+ *
+ * @param Array $params
+ * @return string
+ * @access public
+ */
+ function GetConst($params)
+ {
+ return defined($this->SelectParam($params, 'name,const')) ? constant($this->SelectParam($params, 'name,const,param')) : '';
+ }
+
+ /**
+ * Retrieves configuration variable value by name
+ *
+ * @param Array $params
+ * @return string
+ * @access public
+ */
+ function GetConfig($params)
+ {
+ $config_name = $this->SelectParam($params, 'name,var');
+ $ret = $this->Application->ConfigValue($config_name);
+ if( getArrayValue($params, 'escape') ) $ret = addslashes($ret);
+ return $ret;
+ }
+
+ function ConfigEquals($params)
+ {
+ $option = $this->SelectParam($params, 'name,option,var');
+ return $this->Application->ConfigValue($option) == getArrayValue($params, 'value');
+ }
+
+ /**
+ * Creates all hidden fields
+ * needed for kernel_form
+ *
+ * @param Array $params
+ * @return string
+ * @access public
+ */
+ function DumpSystemInfo($params)
+ {
+ $actions =& $this->Application->recallObject('kActions');
+ $actions->Set('t', $this->Application->GetVar('t') );
+
+ $params = $actions->GetParams();
+ $o='';
+ foreach ($params AS $name => $val)
+ {
+ $o .= "\n";
+ }
+ return $o;
+ }
+
+ function GetFormHiddens($params)
+ {
+ $sid = $this->Application->GetSID();
+ $t = $this->SelectParam($params, 'template,t');
+ unset($params['template']);
+ $env = $this->Application->BuildEnv($t, $params, 'm', null, false);
+ $o = '';
+ if ( $this->Application->RewriteURLs() )
+ {
+ $session =& $this->Application->recallObject('Session');
+ if ($session->NeedQueryString()) {
+ $o .= "\n";
+ }
+ }
+ else {
+ $o .= "\n";
+ }
+ return $o;
+ }
+
+ function Odd_Even($params)
+ {
+ $odd = $params['odd'];
+ $even = $params['even'];
+ if (!isset($params['var'])) {
+ $var = 'odd_even';
+ }
+ else {
+ $var = $params['var'];
+ }
+
+ if ($this->Application->GetVar($var) == 'even') {
+ if (!isset($params['readonly']) || !$params['readonly']) {
+ $this->Application->SetVar($var, 'odd');
+ }
+ return $even;
+ }
+ else {
+ if (!isset($params['readonly']) || !$params['readonly']) {
+ $this->Application->SetVar($var, 'even');
+ }
+ return $odd;
+ }
+ }
+
+ /**
+ * Returns phrase translation by name
+ *
+ * @param Array $params
+ * @return string
+ * @access public
+ */
+ function Phrase($params)
+ {
+ // m:phrase name="phrase_name" default="Tr-alala" updated="2004-01-29 12:49"
+ if (array_key_exists('default', $params)) return $params['default']; //backward compatibility
+ $translation = $this->Application->Phrase($this->SelectParam($params, 'label,name,title'));
+ if (getArrayValue($params, 'escape')) {
+ $translation = htmlspecialchars($translation);
+ $translation = str_replace('\'', ''', $translation);
+ $translation = addslashes($translation);
+ }
+ return $translation;
+ }
+
+ // for tabs
+ function is_active($params)
+ {
+ $test_templ = $this->SelectParam($params, 'templ,template,t');
+ if ( !getArrayValue($params,'allow_empty') )
+ {
+ $if_true=getArrayValue($params,'true') ? $params['true'] : 1;
+ $if_false=getArrayValue($params,'false') ? $params['false'] : 0;
+ }
+ else
+ {
+ $if_true=$params['true'];
+ $if_false=$params['false'];
+ }
+
+ if ( preg_match("/^".str_replace('/', '\/', $test_templ)."/", $this->Application->GetVar('t'))) {
+ return $if_true;
+ }
+ else {
+ return $if_false;
+ }
+ }
+
+ function IsNotActive($params)
+ {
+ return !$this->is_active($params);
+ }
+
+ function IsActive($params)
+ {
+ return $this->is_active($params);
+ }
+
+ function is_t_active($params)
+ {
+ return $this->is_active($params);
+ }
+
+ function CurrentTemplate($params)
+ {
+ return $this->is_active($params);
+ }
+
+ /**
+ * Checks if session variable
+ * specified by name value match
+ * value passed as parameter
+ *
+ * @param Array $params
+ * @return string
+ * @access public
+ */
+ function RecallEquals($params)
+ {
+ $name = $params['var'];
+ $value = $params['value'];
+ return ($this->Application->RecallVar($name) == $value);
+ }
+
+ /**
+ * Checks if application variable
+ * specified by name value match
+ * value passed as parameter
+ *
+ * @param Array $params
+ * @return bool
+ * @access public
+ */
+ function GetEquals($params)
+ {
+ $name = $this->SelectParam($params, 'var,name,param');
+ $value = $params['value'];
+ if ($this->Application->GetVar($name) == $value) {
+ return 1;
+ }
+ }
+
+ /**
+ * Includes template
+ * and returns it's
+ * parsed version
+ *
+ * @param Array $params
+ * @return string
+ * @access public
+ */
+ function MyInclude($params)
+ {
+ $BlockParser =& $this->Application->makeClass('TemplateParser');
+ $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), $t );
+
+ 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, $silent),
+ $t
+ );
+ }
+ else {
+ $res = '';
+ }
+ }
+ $this->Application->Parser =& $parser;
+ $this->Application->Parser->DataExists = $this->Application->Parser->DataExists || $BlockParser->DataExists;
+ return $res;
+ }
+
+ /*function Kernel_Scripts($params)
+ {
+ return '';
+ }*/
+
+
+ /*function GetUserPermission($params)
+ {
+ // echo"GetUserPermission $params[name]";
+ if ($this->Application->RecallVar('user_type') == 1)
+ return 1;
+ else {
+ $perm_name = $params[name];
+ $aPermissions = unserialize($this->Application->RecallVar('user_permissions'));
+ if ($aPermissions)
+ return $aPermissions[$perm_name];
+ }
+ }*/
+
+
+ /**
+ * Set's parser block param value
+ *
+ * @param Array $params
+ * @access public
+ */
+ function AddParam($params)
+ {
+ $parser =& $this->Application->Parser; // recallObject('TemplateParser');
+ foreach ($params as $param => $value) {
+ $this->Application->SetVar($param, $value);
+ $parser->SetParam($param, $value);
+ $parser->AddParam('/\$'.$param.'/', $value);
+ }
+ }
+
+ /*function ParseToVar($params)
+ {
+ $var = $params['var'];
+ $tagdata = $params['tag'];
+ $parser =& $this->Application->Parser; //recallObject('TemplateParser');
+ $res = $this->Application->ProcessTag($tagdata);
+
+ $parser->SetParam($var, $res);
+ $parser->AddParam('/\$'.$var.'/', $res);
+ return '';
+ }*/
+
+ /*function TagNotEmpty($params)
+ {
+ $tagdata = $params['tag'];
+ $res = $this->Application->ProcessTag($tagdata);
+ return $res != '';
+ }*/
+
+ /*function TagEmpty($params)
+ {
+ return !$this->TagNotEmpty($params);
+ }*/
+
+ /**
+ * Parses block and returns result
+ *
+ * @param Array $params
+ * @return string
+ * @access public
+ */
+ function ParseBlock($params)
+ {
+ $parser =& $this->Application->Parser; // recallObject('TemplateParser');
+ return $parser->ParseBlock($params);
+ }
+
+ function RenderElement($params)
+ {
+ return $this->ParseBlock($params);
+ }
+
+ /**
+ * Checks if debug mode is on
+ *
+ * @return bool
+ * @access public
+ */
+ function IsDebugMode()
+ {
+ return $this->Application->isDebugMode();
+ }
+
+ function MassParse($params)
+ {
+ $qty = $params['qty'];
+ $block = $params['block'];
+ $mode = $params['mode'];
+
+ $o = '';
+ if ($mode == 'func') {
+ $func = create_function('$params', '
+ $o = \'\';
+ $o.= \'a\'.$params[\'param1\'].\' | \';
+ $o.= \'a\'.$params[\'param2\'].\' | \';
+ $o.= \'a\'.$params[\'param3\'].\' | \';
+ $o.= \'a\'.$params[\'param4\'].\' | \';
+ $o.= \'
\';
+ return $o;
+ ');
+ for ($i=1; $i<$qty; $i++) {
+ $block_params['param1'] = rand(1, 10000);
+ $block_params['param2'] = rand(1, 10000);
+ $block_params['param3'] = rand(1, 10000);
+ $block_params['param4'] = rand(1, 10000);
+ $o .= $func($block_params);
+ }
+ return $o;
+ }
+
+ $block_params['name'] = $block;
+
+ for ($i=0; $i<$qty; $i++) {
+ $block_params['param1'] = rand(1, 10000);
+ $block_params['param2'] = rand(1, 10000);
+ $block_params['param3'] = rand(1, 10000);
+ $block_params['param4'] = rand(1, 10000);
+ $block_params['passed'] = $params['passed'];
+ $block_params['prefix'] = 'm';
+
+ $o.= $this->Application->ParseBlock($block_params, 1);
+ }
+ return $o;
+ }
+
+ function AfterScript($params)
+ {
+ $after_script = $this->Application->GetVar('after_script');
+ if ( $after_script ) {
+ return '';
+ }
+ return '';
+ }
+
+ function LoggedIn($params)
+ {
+ return $this->Application->LoggedIn();
+ }
+
+ /**
+ * Checks if user is logged in and if not redirects it to template passed
+ *
+ * @param Array $params
+ */
+ function RequireLogin($params)
+ {
+ $t = $this->Application->GetVar('t');
+ if ($next_t = getArrayValue($params, 'next_template')) {
+ $t = $next_t;
+ }
+
+ if($permission_groups = getArrayValue($params, 'permissions'))
+ {
+ $permission_groups = explode('|', $permission_groups);
+ $group_has_permission = false;
+ foreach($permission_groups as $permission_group)
+ {
+ $permissions = explode(',', $permission_group);
+ $has_permission = true;
+ foreach($permissions as $permission)
+ {
+ $has_permission = $has_permission && $this->Application->CheckPermission($permission);
+ }
+ $group_has_permission = $group_has_permission || $has_permission;
+
+ if($group_has_permission)
+ {
+ return;
+ }
+ }
+
+ if( !$this->Application->LoggedIn() )
+ {
+ $this->Application->Redirect( $params['login_template'], Array('next_template'=>$t) );
+ }
+ else
+ {
+ $this->Application->Redirect( $params['no_permissions_template'] );
+ }
+ }
+
+ $condition = getArrayValue($params,'condition');
+ if(!$condition)
+ {
+ $condition = true;
+ }
+ else
+ {
+ if( substr($condition,0,1) == '!' )
+ {
+ $condition = !$this->Application->ConfigValue( substr($condition,1) );
+ }
+ else
+ {
+ $condition = $this->Application->ConfigValue($condition);
+ }
+ }
+
+ $group = $this->SelectParam($params, 'group');
+ $group_access = true;
+ if ($group) {
+ $conn =& $this->Application->DB;
+ $group_id = $conn->GetOne('SELECT GroupId FROM '.TABLE_PREFIX.'PortalGroup WHERE Name = '.$conn->qstr($group));
+ if ($group_id) {
+ $groups = explode(',', $this->Application->RecallVar('UserGroups'));
+ $group_access = in_array($group_id, $groups);
+ }
+ }
+
+ if( (!$this->Application->LoggedIn() || !$group_access) && $condition )
+ {
+ if ( $this->Application->LoggedIn() && !$group_access) {
+ $this->Application->Redirect( $params['no_group_perm_template'], Array('next_template'=>$t) );
+ }
+ $this->Application->Redirect( $params['login_template'], Array('next_template'=>$t) );
+ }
+ }
+
+ /**
+ * Checks if SSL is on and redirects to SSL URL if needed
+ * If SSL_URL is not defined in config - the tag does not do anything
+ * If for_logged_in_only="1" exits if user is not logged in.
+ * If called without params forces https right away. If called with by_config="1" checks the
+ * Require SSL setting from General Config and if it is ON forces https
+ *
+ * @param unknown_type $params
+ */
+ function CheckSSL($params)
+ {
+ $ssl = $this->Application->ConfigValue('SSL_URL');
+ if (!$ssl) return; //SSL URL is not set - no way to require SSL
+
+ $require = false;
+
+ if ($params['mode'] == 'required') {
+ $require = true;
+ if (isset($params['for_logged_in_only']) && $params['for_logged_in_only'] && !$this->Application->LoggedIn()) {
+ $require = false;
+ }
+
+ if (isset($params['condition'])) {
+ if (!$this->Application->ConfigValue($params['condition'])) {
+ $require = false;
+ }
+ }
+ }
+
+ $http_query =& $this->Application->recallObject('HTTPQuery');
+ $pass = $http_query->getRedirectParams();
+
+ if ($require) {
+ if (PROTOCOL == 'https://') {
+ $this->Application->SetVar('__KEEP_SSL__', 1);
+ return;
+ }
+ $this->Application->Redirect('', array_merge_recursive2($pass, Array('__SSL__' => 1)));
+ }
+ else {
+ if (PROTOCOL == 'https://' && $this->Application->ConfigValue('Force_HTTP_When_SSL_Not_Required')) {
+ if ($this->Application->GetVar('__KEEP_SSL__')) return;
+ $this->Application->Redirect('', array_merge_recursive2($pass, Array('__SSL__' => 0)));
+ }
+ }
+ }
+
+ function SaveReturnScript($params)
+ {
+ // admin/save_redirect.php?do=
+ $url = str_replace($this->Application->BaseURL(), '', $this->T($params) );
+ $url = explode('?', $url, 2);
+ $url = 'save_redirect.php?'.$url[1].'&do='.$url[0];
+
+ $this->Application->StoreVar('ReturnScript', $url);
+ }
+
+ function ConstOn($params)
+ {
+ $name = $this->SelectParam($params,'name,const');
+ return $this->Application->isDebugMode() && dbg_ConstOn($name);
+ }
+
+ function SetDefaultCategory($params)
+ {
+ $module_name = $params['module'];
+ $module =& $this->Application->recallObject('mod.'.$module_name);
+ $this->Application->SetVar('m_cat_id', $module->GetDBField('RootCat') );
+ }
+
+ function ImportRedirect($params)
+ {
+ $import_id = $this->Application->GetVar('import_id');
+ if ($import_id) {
+ // redirect forward to step3 (import parameters coosing)
+ $this->Application->StoreVar('ImportScriptID', $import_id);
+
+ $sql = 'SELECT *
+ FROM '.TABLE_PREFIX.'ImportScripts
+ WHERE is_id = '.$import_id;
+
+ $db =& $this->Application->GetADODBConnection();
+ $is_params = $db->GetRow($sql);
+
+ if ($is_params['is_type'] == 'db') {
+ $this->Application->Redirect('', null, '', 'import/step3.php');
+ }
+ elseif ($is_params['is_type'] == 'csv') {
+ $module = strtolower($is_params['is_Module']);
+ $template = $module.'/import';
+ $sql = 'SELECT Var
+ FROM '.TABLE_PREFIX.'Modules
+ WHERE LOWER(Name) = '.$db->qstr($module);
+ $item_prefix = $db->GetOne($sql);
+ $pass_params = Array('m_opener' => 'd', $item_prefix.'.import_id' => 0, $item_prefix.'.import_event' => 'OnNew', 'pass' => 'm,'.$item_prefix.'.import');
+ $this->Application->Redirect($template, $pass_params);
+ }
+ }
+ else {
+ // redirect back to step2 (import type choosing)
+ $this->Application->Redirect('', null, '', 'import/step2.php');
+ }
+ }
+
+ function GetSectionTitle($params)
+ {
+ $params['name'] = replaceModuleSection($params['phrase']);
+ return $this->Phrase($params);
+ }
+
+ function GetSectionIcon($params)
+ {
+ return replaceModuleSection($params['icon']);
+ }
+
+ function StoreSystemVars($params)
+ {
+ // save theese variables to session, because they are useful for most configuration templates
+ $this->Application->LinkVar('module');
+ $this->Application->LinkVar('section');
+ }
+
+ function XMLTemplate($params)
+ {
+ define('DBG_SKIP_REPORTING', 1);
+ header('Content-type: text/xml');
+ }
+}
+
+
+?>
Index: branches/unlabeled/unlabeled-1.23.2/core/kernel/globals.php
===================================================================
diff -u -r4250 -r4411
--- branches/unlabeled/unlabeled-1.23.2/core/kernel/globals.php (.../globals.php) (revision 4250)
+++ branches/unlabeled/unlabeled-1.23.2/core/kernel/globals.php (.../globals.php) (revision 4411)
@@ -475,7 +475,8 @@
if ($module_section) {
// substitute section instead of #section# parameter in title preset name
$module_section = explode(':', $module_section);
- $string = str_replace('#section#', strtolower($module_section[1]), $string);
+ $section = preg_replace('/configuration_(.*)/i', '\\1', $module_section[1]);
+ $string = str_replace('#section#', strtolower($section), $string);
}
return $string;
}
Index: branches/unlabeled/unlabeled-1.1.2/kernel/admin_templates/config/config_universal.tpl
===================================================================
diff -u -r4267 -r4411
--- branches/unlabeled/unlabeled-1.1.2/kernel/admin_templates/config/config_universal.tpl (.../config_universal.tpl) (revision 4267)
+++ branches/unlabeled/unlabeled-1.1.2/kernel/admin_templates/config/config_universal.tpl (.../config_universal.tpl) (revision 4411)
@@ -5,7 +5,7 @@
-
+