Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sat, Jul 19, 6:04 PM

in-portal

Index: branches/unlabeled/unlabeled-1.1.2/kernel/admin_templates/config/config_universal.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.1.2/kernel/admin_templates/config/config_universal.tpl (revision 4410)
+++ branches/unlabeled/unlabeled-1.1.2/kernel/admin_templates/config/config_universal.tpl (revision 4411)
@@ -1,72 +1,72 @@
<inp2:m_set nobody="yes"/>
<inp2:m_include t="incs/header"/>
<body topmargin="0" leftmargin="8" marginheight="0" marginwidth="8" bgcolor="#FFFFFF">
<inp2:m_ParseBlock prefix="conf" name="section_header" icon="icon46_settings_#section#" title="!la_tab_Config#section#!"/>
-<inp2:m_ParseBlock name="blue_bar" prefix="conf" title_preset="config_list_#section#" module="in-commerce" icon="icon46_settings_#section#"/>
+<inp2:m_ParseBlock name="blue_bar" prefix="conf" title_preset="config_list_#section#" icon="icon46_settings_#section#"/>
<!-- ToolBar --->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td>
<script type="text/javascript">
function ValidatePassFld(fieldId){
var passFld=document.getElementById(fieldId);
var passVerifyFld=document.getElementById('verify_'+fieldId);
if (passFld && passVerifyFld && passFld.value == passVerifyFld.value) {
return true;
}
else {
var passErrorCell=document.getElementById('error_'+fieldId);
if (passErrorCell){
passErrorCell.innerHTML='<inp2:m_phrase name="la_error_PasswordMatch" />';
}
return false;
}
}
function ValidatePassFields(){
var el=false;
var validated=true;
for (var i=0; i<document.forms.kernel_form.elements.length; i++){
el=document.forms.kernel_form.elements[i];
if (el.getAttribute('primarytype')=='password'){
if (!ValidatePassFld(el.id)){
validated=false;
}
}
}
return validated;
}
var a_toolbar = new ToolBar();
a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
if (ValidatePassFields()){
submit_event('conf','<inp2:conf_SaveEvent/>');
}
}
) );
a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
submit_event('conf','OnCancel');
}
) );
a_toolbar.Render();
</script>
</td>
</tr>
</tbody>
</table>
<inp2:m_include t="incs/config_blocks"/>
<inp2:conf_SaveWarning name="grid_save_warning"/>
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
<inp2:conf_PrintList block="config_block" per_page="-1" full_block="config_block" half_block1="config_block1" half_block2="config_block2"/>
</table>
<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.1.2/kernel/admin_templates/config/config_universal.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.1.2.1
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.1.2/kernel/admin_templates/incs/config_blocks.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.1.2/kernel/admin_templates/incs/config_blocks.tpl (revision 4410)
+++ branches/unlabeled/unlabeled-1.1.2/kernel/admin_templates/incs/config_blocks.tpl (revision 4411)
@@ -1,84 +1,86 @@
<inp2:m_DefineElement name="config_edit_text">
- <input type="text" name="<inp2:InputName field="$field"/>" value="<inp2:Field field="$field" />" />
+ <input type="text" tabindex="<inp2:m_get param="tab_index"/>" name="<inp2:InputName field="$field"/>" value="<inp2:Field field="$field" />" />
</inp2:m_DefineElement>
<inp2:m_DefineElement name="config_edit_password">
- <input type="password" primarytype="password" name="<inp2:InputName field="$field"/>" id="<inp2:InputName field="$field"/>" value="" />
+ <input type="password" tabindex="<inp2:m_get param="tab_index"/>" primarytype="password" name="<inp2:InputName field="$field"/>" id="<inp2:InputName field="$field"/>" value="" />
<input type="password" name="verify_<inp2:InputName field="$field"/>" id="verify_<inp2:InputName field="$field"/>" value="" />
&nbsp;<span class="error" id="error_<inp2:InputName field="$field"/>"></span>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="config_edit_option">
<option value="<inp2:m_param name="key"/>"<inp2:m_param name="selected"/>><inp2:m_param name="option"/></option>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="config_edit_select">
- <select name="<inp2:InputName field="$field"/>">
- <inp2:PredefinedOptions field="$field" tabindex="$pass_tabindex" block="config_edit_option" selected="selected"/>
+ <select name="<inp2:InputName field="$field"/>" tabindex="<inp2:m_get param="tab_index"/>">
+ <inp2:PredefinedOptions field="$field" block="config_edit_option" selected="selected"/>
</select>
</inp2:m_DefineElement>
-<inp2:m_DefineElement name="config_edit_checkbox">
+<inp2:m_DefineElement name="config_edit_checkbox" field_class="">
<input type="hidden" id="<inp2:InputName field="$field"/>" name="<inp2:InputName field="$field"/>" value="<inp2:Field field="$field" db="db"/>">
<input tabindex="<inp2:m_get param="tab_index"/>" type="checkbox" id="_cb_<inp2:m_param name="field"/>" name="_cb_<inp2:InputName field="$field"/>" <inp2:Field field="$field" checked="checked" db="db"/> class="<inp2:m_param name="field_class"/>" onclick="update_checkbox(this, document.getElementById('<inp2:InputName field="$field"/>'))">
</inp2:m_DefineElement>
<inp2:m_DefineElement name="config_edit_textarea">
- <textarea name="<inp2:InputName field="$field"/>" <inp2:m_param name="field_params" />><inp2:Field field="$field" /></textarea>
+ <textarea tabindex="<inp2:m_get param="tab_index"/>" name="<inp2:InputName field="$field"/>" <inp2:m_param name="field_params" />><inp2:Field field="$field" /></textarea>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="config_radio_item">
<input type="radio" <inp2:m_param name="checked"/> name="<inp2:InputName field="$field"/>" id="<inp2:InputName field="$field"/>_<inp2:m_param name="key"/>" value="<inp2:m_param name="key"/>"><label for="<inp2:InputName field="$field"/>_<inp2:m_param name="key"/>"><inp2:m_param name="option"/></label>&nbsp;
</inp2:m_DefineElement>
<inp2:m_DefineElement name="config_edit_radio">
- <inp2:PredefinedOptions field="$field" tabindex="$pass_tabindex" block="config_radio_item" selected="checked"/>
+ <inp2:PredefinedOptions field="$field" tabindex="$pass_tabindex" block="config_radio_item" selected="checked"/>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="config_block">
+ <inp2:m_inc param="tab_index" by="1"/>
<inp2:m_if check="m_ParamEquals" name="show_heading" value="1">
<tr class="subsectiontitle">
<td colspan="3">
<inp2:Field name="heading" as_label="1"/>
</td>
</tr>
</inp2:m_if>
<tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>" id="<inp2:m_param name="PrefixSpecial"/>_<inp2:field field="$IdField"/>">
<td>
<inp2:Field field="prompt" as_label="1" />
<inp2:m_if check="m_IsDebugMode">
<br><small>[<inp2:Field field="DisplayOrder"/>] <inp2:Field field="VariableName"/></small>
</inp2:m_if>
</td>
<td>
<inp2:ConfigFormElement PrefixSpecial="$PrefixSpecial" field="VariableValue" blocks_prefix="config_edit_" element_type_field="element_type" value_list_field="ValueList"/>
</td>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="config_block1">
+ <inp2:m_inc param="tab_index" by="1"/>
<inp2:m_if check="m_ParamEquals" name="show_heading" value="1">
<tr class="subsectiontitle">
<td colspan="3">
<inp2:Field name="heading" as_label="1"/>
</td>
</tr>
</inp2:m_if>
<tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>" id="<inp2:m_param name="PrefixSpecial"/>_<inp2:Field field="$IdField"/>">
<td>
<inp2:Field field="prompt" as_label="1" />
<inp2:m_if check="m_IsDebugMode">
<br><small>[<inp2:Field field="DisplayOrder"/>] <inp2:Field field="VariableName"/></small>
</inp2:m_if>
</td>
<td>
<nobr><inp2:ConfigFormElement PrefixSpecial="$PrefixSpecial" field="VariableValue" blocks_prefix="config_edit_" element_type_field="element_type" value_list_field="ValueList"/>&nbsp;&nbsp;
</inp2:m_DefineElement>
<inp2:m_DefineElement name="config_block2">
<inp2:ConfigFormElement PrefixSpecial="$PrefixSpecial" field="VariableValue" blocks_prefix="config_edit_" element_type_field="element_type" value_list_field="ValueList"/></nobr>
</td>
</tr>
</inp2:m_DefineElement>
Property changes on: branches/unlabeled/unlabeled-1.1.2/kernel/admin_templates/incs/config_blocks.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.1.2.1
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.5.2/kernel/units/config_general/config_general_tag_processor.php
===================================================================
--- branches/unlabeled/unlabeled-1.5.2/kernel/units/config_general/config_general_tag_processor.php (revision 4410)
+++ branches/unlabeled/unlabeled-1.5.2/kernel/units/config_general/config_general_tag_processor.php (revision 4411)
@@ -1,101 +1,103 @@
<?php
class ConfigGeneralTagProcessor extends kDBTagProcessor {
function PrintList($params)
{
$list =& $this->Application->recallObject( $this->getPrefixSpecial(), $this->Prefix.'_List',$params);
/* $prefix_special = $this->getPrefixSpecial();
if ( !($list->OriginalParams == $params) ) {
$this->Application->removeObject($prefix_special);
$list =& $this->Application->recallObject($prefix_special,$this->Prefix.'_List',$params);
}
*/
$id_field = $this->Application->getUnitOption($this->Prefix,'IDField');
$list->PerPage=-1;
$list->Query();
$o = '';
$list->GoFirst();
$block_params=$this->prepareTagParams($params);
$block_params['name']=$params['block'];
$block_params['pass_params']='true';
$block_params['IdField'] = $id_field;
while (!$list->EOL())
{
$stored_cat=$this->Application->RecallVar("StoredRootCatId", "");
if ($stored_cat!=""){
$list->Records[$list->CurrentIndex]["RootCat"]=$stored_cat;
}
$this->Application->SetVar( $this->getPrefixSpecial().'_id', $list->GetDBField($id_field) );
$o.= $this->Application->ParseBlock($block_params, 1);
$list->GoNext();
}
$this->Application->SetVar( $this->getPrefixSpecial().'_id', '');
$this->Application->RemoveVar("StoredRootCatId");
return $o;
}
function CategoryPath($params)
{
$object=&$this->Application->recallObject("confg");
$root_cat=$object->GetDBField("RootCat");
if (!isset($params['cat_id'])){
$stored_cat=$this->Application->RecallVar("StoredRootCatId", "");
if ($stored_cat){
$params['cat_id'] = $stored_cat;
}else{
$params['cat_id'] = $root_cat;
}
}
$block_params['current'] = 1;
$block_params['separator'] = $params['separator'];
if ($params['cat_id'] == 0) {
$block_params['name'] = $params['rootcatblock'];
return $this->Application->ParseBlock($block_params);
}
else {
$cat_object =& $this->Application->recallObject( $this->getPrefixSpecial(), $this->Prefix.'_List' );
$sql = 'SELECT CategoryId, ParentId, Name FROM '.TABLE_PREFIX.'Category WHERE CategoryId='.$params['cat_id'];
$res = $this->Conn->GetRow($sql);
if ($res === false) {
// in case if category is deleted
return '';
}
$block_params['name'] = $params['block'];
$block_params['cat_name'] = $res['Name'];
$block_params['separator'] = $params['separator'];
$block_params['cat_id'] = $res['CategoryId'];
$next_params['separator'] = $params['separator'];
$next_params['rootcatblock'] = $params['rootcatblock'];
$next_params['block'] = $params['block'];
$next_params['cat_id'] = $res['ParentId'];
return $this->CategoryPath($next_params).$this->Application->ParseBlock($block_params);
}
- }
- function SaveWarning($params){
+ }
+
+ function SaveWarning($params)
+ {
$object=&$this->Application->recallObject($this->getPrefixSpecial());
$root_cat=$object->GetDBField("RootCat");
$stored_cat=$this->Application->RecallVar("StoredRootCatId", "");
if ($stored_cat!="" && $stored_cat!=$root_cat){
return $this->Application->ParseBlock($params);
}
return "";
}
function AllowAffiliateRegistration($params)
{
return $this->Application->ConfigValue('Comm_RegisterAsAffiliate') ? 1 : 0;
}
}
?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.5.2/kernel/units/config_general/config_general_tag_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.5
\ No newline at end of property
+1.5.2.1
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.9.2/kernel/units/configuration/configuration_tag_processor.php
===================================================================
--- branches/unlabeled/unlabeled-1.9.2/kernel/units/configuration/configuration_tag_processor.php (revision 4410)
+++ branches/unlabeled/unlabeled-1.9.2/kernel/units/configuration/configuration_tag_processor.php (revision 4411)
@@ -1,132 +1,132 @@
<?php
class ConfigurationTagProcessor extends kDBTagProcessor {
/**
* Prints list content using block specified
*
* @param Array $params
* @return string
* @access public
*/
function PrintList($params)
{
$list =& $this->GetList($params);
$id_field = $this->Application->getUnitOption($this->Prefix,'IDField');
$list->Query();
$o = '';
$list->GoFirst();
$block_params=$this->prepareTagParams($params);
// $block_params['name'] = $this->SelectParam($params, 'render_as,block');
$block_params['pass_params'] = 'true';
$block_params['IdField'] = $list->IDField;
$prev_heading = '';
$next_block = $params['full_block'];
$this->groupRecords($list->Records, 'heading');
$field_values = $this->Application->GetVar($this->getPrefixSpecial(true));
while (!$list->EOL())
{
$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) {
$curr_block = $params['half_block1'];
$next_block = $params['half_block2'];
} else {
$curr_block = $next_block;
$next_block = $params['full_block'];
}
$block_params['name'] = $curr_block;
$block_params['show_heading'] = ($prev_heading != $list->GetDBField('heading') ) ? 1 : 0;
// set values from submit if any
if ($field_values) {
$list->SetDBField('VariableValue', $field_values[$list->GetDBField('VariableName')]['VariableValue']);
}
$o.= $this->Application->ParseBlock($block_params, 1);
$prev_heading = $list->GetDBField('heading');
$list->GoNext();
}
$this->Application->SetVar( $this->getPrefixSpecial().'_id', '');
return $o;
}
function getModuleItemName()
{
$module = $this->Application->GetVar('module');
$table = $this->Application->getUnitOption('confs', 'TableName');
$sql = 'SELECT ConfigHeader
FROM '.$table.'
WHERE ModuleName = '.$this->Conn->qstr($module);
return $this->Conn->GetOne($sql);
}
function PrintConfList($params)
{
$list =& $this->GetList($params);
$id_field = $this->Application->getUnitOption($this->Prefix, 'IDField');
$list->PerPage = -1;
$list->Query();
$o = '';
$list->GoFirst();
$tmp_row = Array();
while (!$list->EOL()) {
$rec = $list->getCurrentRecord();
$tmp_row[0][$rec['VariableName']] = $rec['VariableValue'];
$tmp_row[0][$rec['VariableName'].'_prompt'] = $rec['prompt'];
$list->GoNext();
}
$list->Records = $tmp_row;
$block_params = $this->prepareTagParams($params);
$block_params['name'] = $this->SelectParam($params, 'render_as,block');
$block_params['module_key'] = $this->Application->GetLinkedVar('module_key');
$block_params['module_item'] = $this->getModuleItemName();
$list->GoFirst();
return $this->Application->ParseBlock($block_params, 1);
}
function ConfigValue($params)
{
return $this->Application->ConfigValue($params['name']);
}
function Error($params)
{
$object =& $this->Application->recallObject( $this->getPrefixSpecial() );
$field = $object->GetDBField($params['id_field']);
$errors = $this->Application->GetVar('errormsgs');
$errors = $errors[$this->getPrefixSpecial()];
if (isset($errors[$field])) {
$msg = $this->Application->Phrase($errors[$field]);
}
else {
$msg = '';
}
return $msg;
}
}
?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.9.2/kernel/units/configuration/configuration_tag_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.9
\ No newline at end of property
+1.9.2.1
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.9.2/core/units/configuration/configuration_tag_processor.php
===================================================================
--- branches/unlabeled/unlabeled-1.9.2/core/units/configuration/configuration_tag_processor.php (revision 4410)
+++ branches/unlabeled/unlabeled-1.9.2/core/units/configuration/configuration_tag_processor.php (revision 4411)
@@ -1,132 +1,132 @@
<?php
class ConfigurationTagProcessor extends kDBTagProcessor {
/**
* Prints list content using block specified
*
* @param Array $params
* @return string
* @access public
*/
function PrintList($params)
{
$list =& $this->GetList($params);
$id_field = $this->Application->getUnitOption($this->Prefix,'IDField');
$list->Query();
$o = '';
$list->GoFirst();
$block_params=$this->prepareTagParams($params);
// $block_params['name'] = $this->SelectParam($params, 'render_as,block');
$block_params['pass_params'] = 'true';
$block_params['IdField'] = $list->IDField;
$prev_heading = '';
$next_block = $params['full_block'];
$this->groupRecords($list->Records, 'heading');
$field_values = $this->Application->GetVar($this->getPrefixSpecial(true));
while (!$list->EOL())
{
$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) {
$curr_block = $params['half_block1'];
$next_block = $params['half_block2'];
} else {
$curr_block = $next_block;
$next_block = $params['full_block'];
}
$block_params['name'] = $curr_block;
$block_params['show_heading'] = ($prev_heading != $list->GetDBField('heading') ) ? 1 : 0;
// set values from submit if any
if ($field_values) {
$list->SetDBField('VariableValue', $field_values[$list->GetDBField('VariableName')]['VariableValue']);
}
$o.= $this->Application->ParseBlock($block_params, 1);
$prev_heading = $list->GetDBField('heading');
$list->GoNext();
}
$this->Application->SetVar( $this->getPrefixSpecial().'_id', '');
return $o;
}
function getModuleItemName()
{
$module = $this->Application->GetVar('module');
$table = $this->Application->getUnitOption('confs', 'TableName');
$sql = 'SELECT ConfigHeader
FROM '.$table.'
WHERE ModuleName = '.$this->Conn->qstr($module);
return $this->Conn->GetOne($sql);
}
function PrintConfList($params)
{
$list =& $this->GetList($params);
$id_field = $this->Application->getUnitOption($this->Prefix, 'IDField');
$list->PerPage = -1;
$list->Query();
$o = '';
$list->GoFirst();
$tmp_row = Array();
while (!$list->EOL()) {
$rec = $list->getCurrentRecord();
$tmp_row[0][$rec['VariableName']] = $rec['VariableValue'];
$tmp_row[0][$rec['VariableName'].'_prompt'] = $rec['prompt'];
$list->GoNext();
}
$list->Records = $tmp_row;
$block_params = $this->prepareTagParams($params);
$block_params['name'] = $this->SelectParam($params, 'render_as,block');
$block_params['module_key'] = $this->Application->GetLinkedVar('module_key');
$block_params['module_item'] = $this->getModuleItemName();
$list->GoFirst();
return $this->Application->ParseBlock($block_params, 1);
}
function ConfigValue($params)
{
return $this->Application->ConfigValue($params['name']);
}
function Error($params)
{
$object =& $this->Application->recallObject( $this->getPrefixSpecial() );
$field = $object->GetDBField($params['id_field']);
$errors = $this->Application->GetVar('errormsgs');
$errors = $errors[$this->getPrefixSpecial()];
if (isset($errors[$field])) {
$msg = $this->Application->Phrase($errors[$field]);
}
else {
$msg = '';
}
return $msg;
}
}
?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.9.2/core/units/configuration/configuration_tag_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.9
\ No newline at end of property
+1.9.2.1
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.23.2/core/kernel/globals.php
===================================================================
--- branches/unlabeled/unlabeled-1.23.2/core/kernel/globals.php (revision 4410)
+++ branches/unlabeled/unlabeled-1.23.2/core/kernel/globals.php (revision 4411)
@@ -1,483 +1,484 @@
<?php
if( !function_exists('array_merge_recursive2') )
{
/**
* array_merge_recursive2()
*
* Similar to array_merge_recursive but keyed-valued are always overwritten.
* Priority goes to the 2nd array.
*
* @static yes
* @param $paArray1 array
* @param $paArray2 array
* @return array
* @access public
*/
function array_merge_recursive2($paArray1, $paArray2)
{
if (!is_array($paArray1) or !is_array($paArray2)) { return $paArray2; }
foreach ($paArray2 AS $sKey2 => $sValue2)
{
$paArray1[$sKey2] = array_merge_recursive2( getArrayValue($paArray1,$sKey2), $sValue2);
}
return $paArray1;
}
}
/**
* @return int
* @param $array array
* @param $value mixed
* @desc Prepend a reference to an element to the beginning of an array. Renumbers numeric keys, so $value is always inserted to $array[0]
*/
function array_unshift_ref(&$array, &$value)
{
$return = array_unshift($array,'');
$array[0] =& $value;
return $return;
}
/**
* Same as print_r, budet designed for viewing in web page
*
* @param Array $data
* @param string $label
*/
function print_pre($data, $label='')
{
$is_debug = false;
if (class_exists('kApplication')) {
$application =& kApplication::Instance();
$is_debug = $application->isDebugMode();
}
if ($is_debug) {
if ($label) $application->Debugger->appendHTML('<b>'.$label.'</b>');
$application->Debugger->dumpVars($data);
}
else
{
if ($label) echo '<b>', $label, '</b><br>';
echo '<pre>', print_r($data, true), '</pre>';
}
}
/**
* Returns array value if key exists
*
* @param Array $array searchable array
* @param int $key array key
* @return string
* @access public
*/
//
function getArrayValue(&$array, $key)
{
$ret = isset($array[$key]) ? $array[$key] : false;
if ($ret && func_num_args() > 2) {
for ($i = 2; $i < func_num_args(); $i++) {
$cur_key = func_get_arg($i);
$ret = getArrayValue( $ret, $cur_key );
if ($ret === false) break;
}
}
return $ret;
}
/**
* Rename key in associative array, maintaining keys order
*
* @param Array $array Associative Array
* @param mixed $old Old key name
* @param mixed $new New key name
* @access public
*/
function array_rename_key(&$array, $old, $new)
{
foreach ($array as $key => $val)
{
$new_array[ $key == $old ? $new : $key] = $val;
}
$array = $new_array;
}
/**
* Define constant if it was not already defined before
*
* @param string $const_name
* @param string $const_value
* @access public
*/
function safeDefine($const_name, $const_value)
{
if(!defined($const_name)) define($const_name,$const_value);
}
if( !function_exists('parse_portal_ini') )
{
function parse_portal_ini($file, $parse_section = false)
{
if (!file_exists($file)) return false;
if( file_exists($file) && !is_readable($file) ) die('Could Not Open Ini File');
$contents = file($file);
$retval = Array();
$section = '';
$ln = 1;
$resave = false;
foreach($contents as $line) {
if ($ln == 1 && $line != '<'.'?'.'php die() ?'.">\n") {
$resave = true;
}
$ln++;
$line = trim($line);
$line = eregi_replace(';[.]*','',$line);
if(strlen($line) > 0) {
//echo $line . " - ";
if(eregi('^[[a-z]+]$',str_replace(' ', '', $line))) {
//echo 'section';
$section = substr($line,1,(strlen($line)-2));
if ($parse_section) {
$retval[$section] = array();
}
continue;
} elseif(eregi('=',$line)) {
//echo 'main element';
list($key,$val) = explode(' = ',$line);
if (!$parse_section) {
$retval[trim($key)] = str_replace('"', '', $val);
}
else {
$retval[$section][trim($key)] = str_replace('"', '', $val);
}
} //end if
//echo '<br />';
} //end if
} //end foreach
if($resave)
{
$fp = fopen($file, 'w');
reset($contents);
fwrite($fp,'<'.'?'.'php die() ?'.">\n\n");
foreach($contents as $line) fwrite($fp,"$line");
fclose($fp);
}
return $retval;
}
}
if( !function_exists('getmicrotime') )
{
function getmicrotime()
{
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
}
if( !function_exists('k4_include_once') )
{
function k4_include_once($file)
{
if ( constOn('DEBUG_MODE') && isset($debugger) && constOn('DBG_PROFILE_INCLUDES') )
{
if ( in_array($file, get_required_files()) ) return;
global $debugger;
$debugger->IncludeLevel++;
$before_time = getmicrotime();
$before_mem = memory_get_usage();
include_once($file);
$used_time = getmicrotime() - $before_time;
$used_mem = memory_get_usage() - $before_mem;
$debugger->IncludeLevel--;
$debugger->IncludesData['file'][] = str_replace(FULL_PATH, '', $file);
$debugger->IncludesData['mem'][] = $used_mem;
$debugger->IncludesData['time'][] = $used_time;
$debugger->IncludesData['level'][] = $debugger->IncludeLevel;
}
else
{
include_once($file);
}
}
}
/**
* Checks if string passed is serialized array
*
* @param string $string
* @return bool
*/
function IsSerialized($string)
{
if( is_array($string) ) return false;
return preg_match('/a:([\d]+):{/', $string);
}
if (!function_exists('makepassword4')){
function makepassword4($length=10)
{
$pass_length=$length;
$p1=array('b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z');
$p2=array('a','e','i','o','u');
$p3=array('1','2','3','4','5','6','7','8','9');
$p4=array('(','&',')',';','%'); // if you need real strong stuff
// how much elements in the array
// can be done with a array count but counting once here is faster
$s1=21;// this is the count of $p1
$s2=5; // this is the count of $p2
$s3=9; // this is the count of $p3
$s4=5; // this is the count of $p4
// possible readable combinations
$c1='121'; // will be like 'bab'
$c2='212'; // will be like 'aba'
$c3='12'; // will be like 'ab'
$c4='3'; // will be just a number '1 to 9' if you dont like number delete the 3
// $c5='4'; // uncomment to active the strong stuff
$comb='4'; // the amount of combinations you made above (and did not comment out)
for ($p=0;$p<$pass_length;)
{
mt_srand((double)microtime()*1000000);
$strpart=mt_rand(1,$comb);
// checking if the stringpart is not the same as the previous one
if($strpart<>$previous)
{
$pass_structure.=${'c'.$strpart};
// shortcutting the loop a bit
$p=$p+strlen(${'c'.$strpart});
}
$previous=$strpart;
}
// generating the password from the structure defined in $pass_structure
for ($g=0;$g<strlen($pass_structure);$g++)
{
mt_srand((double)microtime()*1000000);
$sel=substr($pass_structure,$g,1);
$pass.=${'p'.$sel}[mt_rand(0,-1+${'s'.$sel})];
}
return $pass;
}
}
if( !function_exists('unhtmlentities') )
{
function unhtmlentities($string)
{
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip ($trans_tbl);
return strtr($string, $trans_tbl);
}
}
if( !function_exists('curl_post') )
{
/**
* submits $url with $post as POST
*
* @param string $url
* @param unknown_type $post
* @return unknown
*/
function curl_post($url, $post, $headers=null)
{
if( is_array($post) )
{
$params_str = '';
foreach($post as $key => $value) $params_str .= $key.'='.urlencode($value).'&';
$post = $params_str;
}
$ch = curl_init($url);
$dbg = false;
if (defined('DEBUG_MODE') && DEBUG_MODE && dbg_ConstOn('DBG_CURL')) {
$dbg = true;
safeDefine('DBG_CURL_LOGFILE', '/curl.log');
$log = fopen(FULL_PATH.DBG_CURL_LOGFILE, 'a');
curl_setopt($ch, CURLOPT_FILE, $log);
curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
curl_setopt($ch, CURLOPT_STDERR, $log);
//curl_setopt($ch, CURLOPT_WRITEHEADER, $log);
}
if (!is_null($headers)) {
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
}
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_REFERER, PROTOCOL.SERVER_NAME);
curl_setopt($ch,CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 90);
$ret = curl_exec($ch);
curl_close($ch);
if ($dbg) {
fwrite($log, "\n".$ret);
fclose($log);
}
return $ret;
}
}
if( !function_exists('memory_get_usage') )
{
function memory_get_usage(){ return -1; }
}
function &ref_call_user_func_array($callable, $args)
{
if( is_scalar($callable) )
{
// $callable is the name of a function
$call = $callable;
}
else
{
if( is_object($callable[0]) )
{
// $callable is an object and a method name
$call = "\$callable[0]->{$callable[1]}";
}
else
{
// $callable is a class name and a static method
$call = "{$callable[0]}::{$callable[1]}";
}
}
// Note because the keys in $args might be strings
// we do this in a slightly round about way.
$argumentString = Array();
$argumentKeys = array_keys($args);
foreach($argumentKeys as $argK)
{
$argumentString[] = "\$args[$argumentKeys[$argK]]";
}
$argumentString = implode($argumentString, ', ');
// Note also that eval doesn't return references, so we
// work around it in this way...
eval("\$result =& {$call}({$argumentString});");
return $result;
}
/**
* Checks if constant is defined and has positive value
*
* @param string $const_name
* @return bool
*/
function constOn($const_name)
{
return defined($const_name) && constant($const_name);
}
function Kg2Pounds($kg)
{
$major = floor( round($kg / POUND_TO_KG, 3) );
$minor = abs(round(($kg - $major * POUND_TO_KG) / POUND_TO_KG * 16, 2));
return array($major, $minor);
}
function Pounds2Kg($pounds, $ounces=0)
{
return round(($pounds + ($ounces / 16)) * POUND_TO_KG, 5);
}
/**
* Formats file/memory size in nice way
*
* @param int $bytes
* @return string
* @access public
*/
function formatSize($bytes)
{
if ($bytes >= 1099511627776) {
$return = round($bytes / 1024 / 1024 / 1024 / 1024, 2);
$suffix = "TB";
} elseif ($bytes >= 1073741824) {
$return = round($bytes / 1024 / 1024 / 1024, 2);
$suffix = "GB";
} elseif ($bytes >= 1048576) {
$return = round($bytes / 1024 / 1024, 2);
$suffix = "MB";
} elseif ($bytes >= 1024) {
$return = round($bytes / 1024, 2);
$suffix = "KB";
} else {
$return = $bytes;
$suffix = "Byte";
}
$return .= ' '.$suffix;
return $return;
}
/**
* Enter description here...
*
* @param resource $filePointer the file resource to write to
* @param Array $data the data to write out
* @param string $delimiter the field separator
* @param string $enclosure symbol to enclose field data to
* @param string $recordSeparator symbols to separate records with
*/
function fputcsv2($filePointer, $data, $delimiter = ',', $enclosure = '"', $recordSeparator = "\r\n")
{
foreach($data as $field_index => $field_value) {
// replaces an enclosure with two enclosures
$data[$field_index] = str_replace($enclosure, $enclosure.$enclosure, $field_value);
}
$line = $enclosure.implode($enclosure.$delimiter.$enclosure, $data).$enclosure.$recordSeparator;
fwrite($filePointer, $line);
}
/**
* Allows to replace #section# within any string with current section
*
* @param string $string
* @return string
*/
function replaceModuleSection($string)
{
$application =& kApplication::Instance();
$module_section = $application->RecallVar('section');
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;
}
?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.23.2/core/kernel/globals.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.23
\ No newline at end of property
+1.23.2.1
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.27.2/kernel/admin_templates/incs/form_blocks.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.27.2/kernel/admin_templates/incs/form_blocks.tpl (revision 4410)
+++ branches/unlabeled/unlabeled-1.27.2/kernel/admin_templates/incs/form_blocks.tpl (revision 4411)
@@ -1,287 +1,299 @@
<inp2:m_block name="section_header"/>
-
+ <inp2:m_if check="m_ParamEquals" name="prefix" value="" inverse="inverse">
+ <inp2:m_RenderElement name="section_header_new" pass_params="true"/>
+ <inp2:m_else />
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr class="section_header_bg">
<td valign="top" class="admintitle" align="left" style="padding-top: 2px; padding-bottom: 2px;">
- <img width="46" height="46" src="<inp2:m_if check="m_ParamEquals" name="prefix" value="" inverse="inverse"><inp2:ModulePath/></inp2:m_if>img/icons/<inp2:m_GetSectionIcon icon="$icon"/>.gif" align="absmiddle" title="<inp2:m_GetSectionTitle phrase="$title"/>">&nbsp;<inp2:m_GetSectionTitle phrase="$title"/>
-
+ <img width="46" height="46" src="img/icons/<inp2:m_GetSectionIcon icon="$icon"/>.gif" align="absmiddle" title="<inp2:m_GetSectionTitle phrase="$title"/>">&nbsp;<inp2:m_GetSectionTitle phrase="$title"/>
</td>
</tr>
</table>
+ </inp2:m_if>
<inp2:m_blockend/>
+<inp2:m_DefineElement name="section_header_new">
+ <table cellpadding="0" cellspacing="0" border="0" width="100%">
+ <tr style="background: url(<inp2:ModulePath module="#session#"/>img/logo_bg.gif) no-repeat top right;">
+ <td valign="top" class="admintitle" align="left" style="padding-top: 2px; padding-bottom: 2px;">
+ <img width="46" height="46" src="<inp2:ModulePath/>img/icons/<inp2:m_GetSectionIcon icon="$icon"/>.gif" align="absmiddle" title="<inp2:m_GetSectionTitle phrase="$title"/>">&nbsp;<inp2:m_GetSectionTitle phrase="$title"/>
+ </td>
+ </tr>
+ </table>
+</inp2:m_DefineElement>
+
<inp2:m_block name="blue_bar"/>
<table border="0" cellpadding="2" cellspacing="0" class="tableborder_full" width="100%" height="30">
<tr>
<td class="header_left_bg" nowrap width="80%" valign="middle">
- <span class="tablenav_link" id="blue_bar"><inp2:$prefix_SectionTitle title_preset="$title_preset" title="Invalid OR Missing title preset" cut_first="100"/></span>
+ <span class="tablenav_link" id="blue_bar"><inp2:$prefix_SectionTitle title_preset="$title_preset" title="Invalid OR Missing title preset [#preset_name#]" cut_first="100"/></span>
</td>
<td align="right" class="tablenav" width="20%" valign="middle">
<script>
var $help_url='<inp2:m_t t="help" h_prefix="$prefix" h_icon="$icon" h_module="$module" h_title_preset="$title_preset" pass="all,m,h" escape="escape"/>';
$help_url = $help_url.replace(/#/g, '%23');
set_window_title(document.getElementById('blue_bar').innerHTML);
</script>
<a href="javascript: OpenHelp($help_url);">
<img src="img/blue_bar_help.gif" border="0">
</a>
</td>
</tr>
</table>
<inp2:m_blockend/>
<inp2:m_block name="subsection"/>
<tr class="subsectiontitle">
<td colspan="5"><inp2:m_phrase label="$title"/></td>
</tr>
<inp2:m_blockend/>
<inp2:m_block name="inp_edit_field_caption" subfield="" NamePrefix=""/>
<inp2:m_inc param="tab_index" by="1"/>
<td class="text">
<label for="<inp2:m_param name="NamePrefix"/><inp2:$prefix_InputName field="$field" subfield="$subfield"/>">
<span class="<inp2:m_if prefix="$prefix" function="HasError" field="$field"/>error<inp2:m_endif/>">
<inp2:m_phrase label="$title"/></span><inp2:m_if prefix="$prefix" function="IsRequired" field="$field"/><span class="error"> *</span><inp2:m_endif/>:
</label>
</td>
<inp2:m_blockend/>
<inp2:m_block name="inp_label" is_last="" as_label="" currency="" is_last=""/>
<tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
<inp2:m_ParseBlock name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last"/>
<td valign="top"><span class="text"><inp2:$prefix_Field field="$field" as_label="$as_label" currency="$currency"/></span></td>
<td class="error"><inp2:$prefix_Error field="$field"/>&nbsp;</td>
</tr>
<inp2:m_blockend/>
<inp2:m_block name="inp_id_label"/>
<inp2:m_if prefix="$prefix" function="FieldEquals" field="$field" value="" inverse="inverse"/>
<inp2:m_ParseBlock name="inp_label" pass_params="true"/>
<inp2:m_endif/>
<inp2:m_blockend/>
<inp2:m_block name="inp_edit_box" subfield="" class="" is_last="" maxlength="" onblur="" size=""/>
<tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
<inp2:m_ParseBlock name="inp_edit_field_caption" prefix="$prefix" field="$field" subfield="$subfield" title="$title" is_last="$is_last"/>
<td>
<input type="text" name="<inp2:$prefix_InputName field="$field" subfield="$subfield"/>" id="<inp2:$prefix_InputName field="$field" subfield="$subfield"/>" value="<inp2:$prefix_Field field="$field" subfield="$subfield"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" maxlength="<inp2:m_param name="maxlength"/>" class="<inp2:m_param name="class"/>" onblur="<inp2:m_Param name="onblur"/>">
</td>
<td class="error"><inp2:$prefix_Error field="$field"/>&nbsp;</td>
</tr>
<inp2:m_blockend/>
<inp2:m_block name="inp_edit_upload" class="" is_last=""/>
<tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
<inp2:m_ParseBlock name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last"/>
<td>
<input type="file" name="<inp2:$prefix_InputName field="$field"/>" id="<inp2:$prefix_InputName field="$field"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" class="<inp2:m_param name="class"/>">
</td>
<td class="error"><inp2:$prefix_Error field="$field"/>&nbsp;</td>
</tr>
<inp2:m_blockend/>
<inp2:m_block name="inp_edit_box_ml" class="" size="" maxlength=""/>
<tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
<td class="text" valign="top">
<span class="<inp2:m_if prefix="$prefix" function="HasError" field="$field"/>error<inp2:m_endif/>">
<inp2:m_phrase label="$title"/><inp2:m_if prefix="$prefix" function="IsRequired" field="$field"/><span class="error"> *</span><inp2:m_endif/>:</span><br>
<a href="javascript:PreSaveAndOpenTranslator('<inp2:m_param name="prefix"/>', '<inp2:m_param name="field"/>', 'popups/translator');" title="<inp2:m_Phrase label="la_Translate"/>"><img src="img/icons/icon24_translate.gif" style="cursor:hand" border="0"></a>
</td>
<td>
<input type="text" name="<inp2:$prefix_InputName field="$field"/>" id="<inp2:$prefix_InputName field="$field"/>" value="<inp2:$prefix_Field field="$field" format="no_default"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" maxlength="<inp2:m_param name="maxlength"/>" class="<inp2:m_param name="class"/>" onblur="<inp2:m_Param name="onblur"/>">
</td>
<td class="error"><inp2:$prefix_Error field="$field"/>&nbsp;</td>
</tr>
<inp2:m_blockend/>
<inp2:m_block name="inp_edit_hidden" db=""/>
<input type="hidden" name="<inp2:$prefix_InputName field="$field"/>" id="<inp2:$prefix_InputName field="$field"/>" value="<inp2:$prefix_Field field="$field" db="$db"/>">
<inp2:m_blockend/>
<inp2:m_block name="inp_edit_date" class="" is_last=""/>
<inp2:m_if check="m_GetEquals" name="calendar_included" value="1" inverse="inverse">
<script type="text/javascript" src="incs/calendar.js"></script>
<inp2:m_set calendar_included="1"/>
</inp2:m_if>
<tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
<inp2:m_ParseBlock name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last"/>
<td>
<input type="text" name="<inp2:$prefix_InputName field="{$field}_date"/>" id="<inp2:$prefix_InputName field="{$field}_date"/>" value="<inp2:$prefix_Field field="{$field}_date" format="_regional_InputDateFormat"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:$prefix_Format field="{$field}_date" input_format="1" edit_size="edit_size"/>" class="<inp2:m_param name="class"/>" datepickerIcon="<inp2:m_ProjectBase/>admin/images/ddarrow.gif">&nbsp;<span class="small">(<inp2:$prefix_Format field="{$field}_date" input_format="1" human="true"/>)</span>
<script type="text/javascript">
initCalendar("<inp2:$prefix_InputName field="{$field}_date"/>", "<inp2:$prefix_Format field="{$field}_date" input_format="1"/>");
</script>
<input type="hidden" name="<inp2:$prefix_InputName field="{$field}_time"/>" id="<inp2:$prefix_InputName field="{$field}_time" input_format="1"/>" value="">
</td>
<td class="error"><inp2:$prefix_Error field="{$field}_date"/>&nbsp;</td>
</tr>
<inp2:m_blockend/>
<inp2:m_block name="inp_edit_date_time" class="" is_last=""/>
<inp2:m_if check="m_GetEquals" name="calendar_included" value="1" inverse="inverse">
<script type="text/javascript" src="incs/calendar.js"></script>
<inp2:m_set calendar_included="1"/>
</inp2:m_if>
<tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
<inp2:m_ParseBlock name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last"/>
<td>
<!-- <input type="hidden" id="<inp2:$prefix_InputName field="$field"/>" name="<inp2:$prefix_InputName field="$field"/>" value="<inp2:$prefix_Field field="$field" db="db"/>"> -->
<input type="text" name="<inp2:$prefix_InputName field="{$field}_date"/>" id="<inp2:$prefix_InputName field="{$field}_date"/>" value="<inp2:$prefix_Field field="{$field}_date" format="_regional_InputDateFormat"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:$prefix_Format field="{$field}_date" input_format="1" edit_size="edit_size"/>" class="<inp2:m_param name="class"/>" datepickerIcon="<inp2:m_ProjectBase/>admin/images/ddarrow.gif">
<span class="small">(<inp2:$prefix_Format field="{$field}_date" input_format="1" human="true"/>)</span>
<script type="text/javascript">
initCalendar("<inp2:$prefix_InputName field="{$field}_date"/>", "<inp2:$prefix_Format field="{$field}_date" input_format="1"/>");
</script>
&nbsp;<input type="text" name="<inp2:$prefix_InputName field="{$field}_time"/>" id="<inp2:$prefix_InputName field="{$field}_time"/>" value="<inp2:$prefix_Field field="{$field}_time" format="_regional_InputTimeFormat"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:$prefix_Format field="{$field}_time" input_format="1" edit_size="edit_size"/>" class="<inp2:m_param name="class"/>"><span class="small"> (<inp2:$prefix_Format field="{$field}_time" input_format="1" human="true"/>)</span>
</td>
<td class="error"><inp2:$prefix_Error field="$field"/>&nbsp;</td>
</tr>
<inp2:m_blockend/>
<inp2:m_block name="inp_edit_textarea" class="" allow_html="allow_html"/>
<tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
<td class="text" valign="top">
<span class="<inp2:m_if prefix="$prefix" function="HasError" field="$field"/>error<inp2:m_endif/>">
<inp2:m_phrase label="$title"/><inp2:m_if prefix="$prefix" function="IsRequired" field="$field"/><span class="error"> *</span><inp2:m_endif/>:</span><br>
<inp2:m_if check="m_ParamEquals" name="allow_html" value="allow_html">
<a href="javascript:OpenEditor('&section=in-link:editlink_general','kernel_form','<inp2:$prefix_InputName field="$field"/>');"><img src="img/icons/icon24_link_editor.gif" style="cursor:hand" border="0"></a>
</inp2:m_if>
</td>
<td>
<textarea tabindex="<inp2:m_get param="tab_index"/>" id="<inp2:$prefix_InputName field="$field"/>" name="<inp2:$prefix_InputName field="$field"/>" cols="<inp2:m_param name="cols"/>" rows="<inp2:m_param name="rows"/>" class="<inp2:m_param name="class"/>"><inp2:$prefix_Field field="$field"/></textarea>
</td>
<td class="error"><inp2:$prefix_Error field="$field"/>&nbsp;</td>
</tr>
<inp2:m_blockend/>
<inp2:m_block name="inp_edit_textarea_ml" class=""/>
<tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
<td class="text" valign="top">
<span class="<inp2:m_if prefix="$prefix" function="HasError" field="$field"/>error<inp2:m_endif/>">
<inp2:m_phrase label="$title"/><inp2:m_if prefix="$prefix" function="IsRequired" field="$field"/><span class="error"> *</span><inp2:m_endif/>:</span><br>
<a href="javascript:OpenEditor('&section=in-link:editlink_general','kernel_form','<inp2:$prefix_InputName field="$field"/>');"><img src="img/icons/icon24_link_editor.gif" style="cursor:hand" border="0"></a>
<a href="javascript:PreSaveAndOpenTranslator('<inp2:m_param name="prefix"/>', '<inp2:m_param name="field"/>', 'popups/translator', 1);" title="<inp2:m_Phrase label="la_Translate"/>"><img src="img/icons/icon24_translate.gif" style="cursor:hand" border="0"></a>
</td>
<td>
<textarea tabindex="<inp2:m_get param="tab_index"/>" id="<inp2:$prefix_InputName field="$field"/>" name="<inp2:$prefix_InputName field="$field"/>" cols="<inp2:m_param name="cols"/>" rows="<inp2:m_param name="rows"/>" class="<inp2:m_param name="class"/>"><inp2:$prefix_Field field="$field"/></textarea>
</td>
<td class="error"><inp2:$prefix_Error field="$field"/>&nbsp;</td>
</tr>
<inp2:m_blockend/>
<inp2:m_block name="inp_edit_user" class="" is_last=""/>
<tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
<inp2:m_ParseBlock name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last"/>
<td>
<input type="text" name="<inp2:$prefix_InputName field="$field"/>" id="<inp2:$prefix_InputName field="$field"/>" value="<inp2:$prefix_Field field="$field"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" class="<inp2:m_param name="class"/>">
<a href="#" onclick="return OpenUserSelector('','kernel_form','<inp2:$prefix_InputName field="$field"/>');">
<img src="img/icons/icon24_link_user.gif" style="cursor:hand;" border="0">
</a>
</td>
<td class="error"><inp2:$prefix_Error field="$field"/>&nbsp;</td>
</tr>
<inp2:m_blockend/>
<inp2:m_block name="inp_option_item"/>
<option value="<inp2:m_param name="key"/>"<inp2:m_param name="selected"/>><inp2:m_param name="option"/></option>
<inp2:m_blockend/>
<inp2:m_block name="inp_option_phrase"/>
<option value="<inp2:m_param name="key"/>"<inp2:m_param name="selected"/>><inp2:m_phrase label="$option"/></option>
<inp2:m_blockend/>
<inp2:m_block name="inp_edit_options" is_last="" has_empty="0" empty_value=""/>
<tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
<inp2:m_ParseBlock name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last"/>
<td>
<select tabindex="<inp2:m_get param="tab_index"/>" name="<inp2:$prefix_InputName field="$field"/>" id="<inp2:$prefix_InputName field="$field"/>" onchange="<inp2:m_Param name="onchange"/>">
<inp2:m_if prefix="m" function="ParamEquals" name="use_phrases" value="1"/>
<inp2:$prefix_PredefinedOptions field="$field" block="inp_option_phrase" selected="selected" has_empty="$has_empty" empty_value="$empty_value"/>
<inp2:m_else/>
<inp2:$prefix_PredefinedOptions field="$field" block="inp_option_item" selected="selected" has_empty="$has_empty" empty_value="$empty_value"/>
<inp2:m_endif/>
</select>
</td>
<td class="error"><inp2:$prefix_Error field="$field"/>&nbsp;</td>
</tr>
<inp2:m_blockend/>
<inp2:m_block name="inp_radio_item"/>
<input type="radio" <inp2:m_param name="checked"/> name="<inp2:$prefix_InputName field="$field"/>" id="<inp2:$prefix_InputName field="$field"/>_<inp2:m_param name="key"/>" value="<inp2:m_param name="key"/>" onclick="<inp2:m_param name="onclick"/>" onchange="<inp2:m_param name="onchange"/>"><label for="<inp2:$prefix_InputName field="$field"/>_<inp2:m_param name="key"/>"><inp2:m_param name="option"/></label>&nbsp;
<inp2:m_blockend/>
<inp2:m_block name="inp_radio_phrase"/>
<input type="radio" <inp2:m_param name="checked"/> name="<inp2:$prefix_InputName field="$field"/>" id="<inp2:$prefix_InputName field="$field"/>_<inp2:m_param name="key"/>" value="<inp2:m_param name="key"/>" onclick="<inp2:m_param name="onclick"/>" onchange="<inp2:m_param name="onchange"/>"><label for="<inp2:$prefix_InputName field="$field"/>_<inp2:m_param name="key"/>"><inp2:m_phrase label="$option"/></label>&nbsp;
<inp2:m_blockend/>
<inp2:m_block name="inp_edit_radio" is_last="" pass_tabindex="" onclick="" onchange="" use_phrases="1"/>
<tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
<inp2:m_ParseBlock name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last"/>
<td>
<inp2:m_if check="m_ParamEquals" name="use_phrases" value="1">
<inp2:$prefix_PredefinedOptions field="$field" tabindex="$pass_tabindex" block="inp_radio_phrase" selected="checked" onclick="$onclick" onchange="$onchange" />
<inp2:m_else />
<inp2:$prefix_PredefinedOptions field="$field" tabindex="$pass_tabindex" block="inp_radio_item" selected="checked" onclick="$onclick" onchange="$onchange" />
</inp2:m_if>
</td>
<td class="error"><inp2:$prefix_Error field="$field"/>&nbsp;</td>
</tr>
<inp2:m_blockend/>
<inp2:m_block name="inp_edit_checkbox" is_last="" field_class="" onchange=""/>
<tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
<inp2:m_ParseBlock name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last" NamePrefix="_cb_"/>
<td>
<input type="hidden" id="<inp2:$prefix_InputName field="$field"/>" name="<inp2:$prefix_InputName field="$field"/>" value="<inp2:$prefix_Field field="$field" db="db"/>">
<!--<input tabindex="<inp2:m_get param="tab_index"/>" type="checkbox" id="_cb_<inp2:$prefix_InputName field="$field"/>" name="_cb_<inp2:$prefix_InputName field="$field"/>" <inp2:$prefix_Field field="$field" checked="checked" db="db"/> class="<inp2:m_param name="field_class"/>" onclick="update_checkbox(this, document.getElementById('<inp2:$prefix_InputName field="$field"/>'));" onchange="<inp2:m_param name="onchange"/>">-->
<input tabindex="<inp2:m_get param="tab_index"/>" type="checkbox" id="_cb_<inp2:$prefix_InputName field="$field"/>" name="_cb_<inp2:$prefix_InputName field="$field"/>" <inp2:$prefix_Field field="$field" checked="checked" db="db"/> class="<inp2:m_param name="field_class"/>" onchange="update_checkbox(this, document.getElementById('<inp2:$prefix_InputName field="$field"/>'));<inp2:m_param name="onchange"/>">
<inp2:m_if check="{$prefix}_HasParam" name="hint_label"><inp2:m_phrase label="$hint_label"/></inp2:m_if>
</td>
<td class="error"><inp2:$prefix_Error field="$field"/>&nbsp;</td>
</tr>
<inp2:m_blockend/>
<inp2:m_block name="inp_checkbox_item"/>
<input type="checkbox" <inp2:m_param name="checked"/> id="<inp2:$prefix_InputName field="$field"/>_<inp2:m_param name="key"/>" value="<inp2:m_param name="key"/>" onclick="update_checkbox_options(/^<inp2:$prefix_InputName field="$field" as_preg="1"/>_([0-9A-Za-z-]+)/, '<inp2:$prefix_InputName field="$field"/>');"><label for="<inp2:$prefix_InputName field="$field"/>_<inp2:m_param name="key"/>"><inp2:m_param name="option"/></label>&nbsp;
<inp2:m_blockend/>
<inp2:m_block name="inp_checkbox_phrase"/>
<input type="checkbox" <inp2:m_param name="checked"/> id="<inp2:$prefix_InputName field="$field"/>_<inp2:m_param name="key"/>" value="<inp2:m_param name="key"/>" onclick="update_checkbox_options(/^<inp2:$prefix_InputName field="$field" as_preg="1"/>_([0-9A-Za-z-]+)/, '<inp2:$prefix_InputName field="$field"/>');"><label for="<inp2:$prefix_InputName field="$field"/>_<inp2:m_param name="key"/>"><inp2:m_phrase label="$option"/></label>&nbsp;
<inp2:m_blockend/>
<inp2:m_block name="inp_edit_checkboxes" is_last=""/>
<tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
<inp2:m_ParseBlock name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last"/>
<td>
<inp2:m_if check="m_ParamEquals" name="use_phrases" value="1">
<inp2:$prefix_PredefinedOptions field="$field" no_empty="$no_empty" tabindex="$pass_tabindex" hint_label="$hint_label" block="inp_checkbox_phrase" selected="checked"/>
<inp2:m_else/>
<inp2:$prefix_PredefinedOptions field="$field" no_empty="$no_empty" tabindex="$pass_tabindex" hint_label="$hint_label" block="inp_checkbox_item" selected="checked"/>
</inp2:m_if>
<inp2:m_ParseBlock prefix="$prefix" name="inp_edit_hidden" field="$field"/>
</td>
<td class="error"><inp2:$prefix_Error field="$field"/>&nbsp;</td>
</tr>
<inp2:m_blockend/>
<inp2:m_block name="inp_edit_weight" subfield="" class="" is_last=""/>
<tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
<inp2:m_ParseBlock name="inp_edit_field_caption" prefix="$prefix" field="$field" subfield="$subfield" title="$title" is_last="$is_last"/>
<td>
<inp2:m_if check="lang.current_FieldEquals" field="UnitSystem" value="1">
<input type="text" name="<inp2:$prefix_InputName field="$field" subfield="$subfield"/>" id="<inp2:$prefix_InputName field="$field" subfield="$subfield"/>" value="<inp2:$prefix_Field field="$field" subfield="$subfield"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" maxlength="<inp2:m_param name="maxlength"/>" class="<inp2:m_param name="class"/>" onblur="<inp2:m_Param name="onblur"/>">
<inp2:m_phrase label="la_kg" />
</inp2:m_if>
<inp2:m_if check="lang.current_FieldEquals" field="UnitSystem" value="2">
<input type="text" name="<inp2:$prefix_InputName field="{$field}_a" subfield="$subfield"/>" id="<inp2:$prefix_InputName field="{$field}_a" subfield="$subfield"/>" value="<inp2:$prefix_Field field="{$field}_a" subfield="$subfield"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" maxlength="<inp2:m_param name="maxlength"/>" class="<inp2:m_param name="class"/>" onblur="<inp2:m_Param name="onblur"/>">
<inp2:m_phrase label="la_lbs" />
<input type="text" name="<inp2:$prefix_InputName field="{$field}_b" subfield="$subfield"/>" id="<inp2:$prefix_InputName field="{$field}_b" subfield="$subfield"/>" value="<inp2:$prefix_Field field="{$field}_b" subfield="$subfield"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" maxlength="<inp2:m_param name="maxlength"/>" class="<inp2:m_param name="class"/>" onblur="<inp2:m_Param name="onblur"/>">
<inp2:m_phrase label="la_oz" />
</inp2:m_if>
</td>
<td class="error"><inp2:$prefix_Error field="$field"/>&nbsp;</td>
</tr>
<inp2:m_blockend />
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.27.2/kernel/admin_templates/incs/form_blocks.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.27
\ No newline at end of property
+1.27.2.1
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.19.2/kernel/admin/include/navmenu.php
===================================================================
--- branches/unlabeled/unlabeled-1.19.2/kernel/admin/include/navmenu.php (revision 4410)
+++ branches/unlabeled/unlabeled-1.19.2/kernel/admin/include/navmenu.php (revision 4411)
@@ -1,376 +1,377 @@
<?php
##############################################################
## In-portal :: Section & Navigation Structure Library ##
##############################################################
## In-portal ##
## Intechnic Corporation ##
## All Rights Reserved, 1998-2002 ##
## ##
## No portion of this code may be copied, reproduced or ##
## otherwise redistributed without proper written ##
## consent of Intechnic Corporation. Violation will ##
## result in revocation of the license and support ##
## privileges along maximum prosecution allowed by law.. ##
##############################################################
$module_images = 'kernel/admin_templates/img';
$objSections->AddSection("in-portal:install","la_tab_Install","la_title_Install",$admin."/", "",
$admin."/images/icon_install.gif","",
NULL,"in-portal:site",NULL,null,0,"",1,NULL,NULL,NULL,"");
// Catalog - browse data tree items
$objSections->AddSection("in-portal:browse","la_tab_Browse","la_title_Browse",$admin."/", "browse.php",
$admin."/icons/icon46_catalog.gif",$admin."/icons/icon24_catalog.gif",
NULL,"in-portal:site",NULL,"in-portal:advanced_view",0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_catalog.gif");
// Advanced View
$objSections->AddSection("in-portal:advanced_view","la_tab_AdvancedView","la_title_AdvancedView",$admin."/", "advanced_view.php",
$admin."/icons/icon46_advanced_view.gif",$admin."/icons/icon24_advanced_view.gif",
NULL,"in-portal:site",NULL,"in-portal:reviews",0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_advanced_view.gif");
// Pending Reviews
$objSections->AddSection("in-portal:reviews","la_tab_Reviews","la_title_Reviews",$admin."/", "reviews.php",
$admin."/icons/icon46_reviews.gif",$admin."/icons/icon24_reviews.gif",
NULL,"in-portal:site",NULL,"in-portal:configure_categories",0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_reviews.gif");
-$objSections->AddSection("in-portal:configure_categories", "la_tab_Settings", "la_tab_Settings", $admin."/config/",
- "edit_config.php?&module=In-Portal&section=in-portal:configure_categories",
+$objSections->AddSection("in-portal:configure_categories", "la_tab_Settings", "la_tab_Settings",
+ $admin."/config/", "edit_config.php?&module=In-Portal&section=in-portal:configure_categories",
+// $admin.'/index4.php?section=in-portal:configure_categories&module=In-Portal','kernel4:config/config_universal',
$admin."/icons/icon46_cat_settings.gif", $admin."/icons/icon24_cat_settings.gif",
NULL, "in-portal:site","in-portal:advanced_view", "in-portal:configuration_search",0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_cat_settings.gif","la_updating_config");
$objSections->AddSection("in-portal:configuration_search", "la_tab_ConfigSearch", "la_tab_ConfigSearch",
$admin.'/index4.php?module=In-Portal&section=in-portal:configuration_search&module_key=category','kernel4:config/config_search',
$admin."/icons/icon46_settings_search.gif",$admin."/icons/icon24_settings_search.gif",
NULL, "in-portal:site", "in-portal:configure_categories","in-portal:configuration_email",0,"",1,
NULL,NULL,NULL,$admin."/icons/icon46_list_settings_search.gif","la_updating_config");
$objSections->AddSection("in-portal:configuration_email", "la_tab_ConfigE-mail", "la_tab_ConfigE-mail", $admin."/config/",
"module_email.php?&module=In-Portal:Category&section=in-portal:configuration_email&lpn=1",
$admin."/icons/icon46_settings_email.gif",$admin."/icons/icon24_settings_email.gif",
NULL,"in-portal:site", "in-portal:configuration_search", "in-portal:configuration_custom",0,"",1,
NULL,NULL,NULL,$admin."/icons/icon46_list_settings_email.gif","la_updating_config");
$objSections->AddSection("in-portal:configuration_custom","la_tab_ConfigCustom","la_tab_ConfigCustom",$admin.'/index4.php',
'kernel4:custom_fields/custom_fields_list:cf----1-',
$admin."/icons/icon46_settings_custom.gif",$admin."/icons/icon24_settings_custom.gif",
NULL, "in-portal:site", "in-portal:configuration_email", NULL,0,"",1,NULL,NULL,NULL,$admin."/icons/icon46_list_settings_custom.gif","la_updating_config");
/* check datatype either 1 or 0 */
$objSections->AddSection("in-portal:tools","la_tab_Tools","la_title_Tools",$admin."/","subitems.php",
$admin."/icons/icon46_tools.gif",$admin."/icons/icon24_tools.gif",
"in-portal:backup","in-portal:root","in-portal:system","in-portal:help",0,"",1,
NULL,NULL,NULL,$admin."/icons/icon46_list_tools.gif","la_section_overview");
$objSections->AddSection("in-portal:backup","la_tab_Backup","la_tab_Backup",$admin."/backup/","backup1.php",
$admin."/icons/icon46_tool_backup.gif",$admin."/icons/icon24_tool_backup.gif",
NULL,"in-portal:tools",NULL,"in-portal:restore",0,"",1,
NULL,"in-portal:tools",NULL,$admin."/icons/icon46_list_tool_backup.gif","la_performing_backup");
$objSections->AddSection("in-portal:backup_toolbar","la_tab_Backup","la_tab_Backup",NULL,NULL,
$admin."/icons/icon46_tool_backup.gif",$admin."/icons/icon24_tool_backup.gif",
NULL,NULL,NULL,NULL,0,"",1,
NULL,NULL,NULL,NULL);
$objSections->AddSection("in-portal:restore_toolbar",NULL,NULL,NULL,NULL,
NULL,NULL,
NULL,NULL,NULL,NULL,0,"",1,
NULL,NULL,NULL,NULL);
$objSections->AddSection("in-portal:restore","la_tab_Restore","la_tab_Restore",$admin."/backup/","restore1.php",
$admin."/icons/icon46_tool_restore.gif",$admin."/icons/icon24_tool_restore.gif",
NULL,"in-portal:tools","in-portal:backup","in-portal:export",0,"",1,
NULL,"in-portal:tools",NULL,$admin."/icons/icon46_list_tool_restore.gif","la_performing_restore");
$objSections->AddSection("in-portal:export","la_tab_ExportData","la_tab_ExportData",$admin."/backup/","export1.php",
$admin."/icons/icon46_tool_export.gif",$admin."/icons/icon24_tool_export.gif",
NULL,"in-portal:tools","in-portal:restore","in-portal:main_import",0,"",1,
NULL,"in-portal:tools",NULL,$admin."/icons/icon46_list_tool_export.gif","la_performing_export");
$objSections->AddSection("in-portal:main_import","la_tab_ImportData","la_tab_ImportData",$admin."/import/","step1.php",
$admin."/icons/icon46_tool_import.gif",$admin."/icons/icon24_tool_import.gif",
NULL,"in-portal:tools","in-portal:export","in-portal:sql_query",1,"",1,
NULL,NULL,NULL,$admin."/icons/icon46_list_tool_import.gif","la_performing_import");
$objSections->AddSection("in-portal:sql_query","la_tab_QueryDB","la_tab_QueryDB",$admin."/tools/","sql_query.php",
$admin."/icons/icon46_tool_import.gif",$admin."/icons/icon24_tool_import.gif",
NULL,"in-portal:tools","in-portal:inlink_inport","in-portal:server_info",0,"",1,
NULL,"in-portal:tools",NULL,$admin."/icons/icon46_list_tool_import.gif","la_running_query");
$objSections->AddSection("in-portal:server_info","la_tab_ServerInfo","la_tab_ServerInfo",$admin."/tools/","server_info.php",
$admin."/icons/icon46_server_info.gif",$admin."/icons/icon24_server_info.gif",
NULL,"in-portal:tools","in-portal:sql_query",NULL,0,"",1,
NULL,"in-portal:tools",NULL,$admin."/icons/icon46_list_server_info.gif","la_tab_ServerInfo");
$objSections->AddSection("in-portal:system","la_tab_Sys_Config","la_title_Sys_Config",$admin."/","subitems.php",
$admin."/icons/icon46_conf.gif",$admin."/icons/icon24_conf.gif",NULL,
"in-portal:root","in-portal:reports","in-portal:tools",0,"",1,
NULL,NULL,NULL,$admin."/icons/icon46_list_conf.gif","la_section_overview");
$objSections->AddSection("in-portal:tag_library","la_tab_TagLibrary","la_tab_TagLibrary",$admin."/","tag_listing.php",
$admin."/icons/icon46_modules.gif",$admin."/icons/icon24_modules.gif",
NULL,NULL,NULL,NULL,0,"",1,
NULL,NULL,NULL,$admin."/icons/icon46_modules.gif","la_tag_library");
/* system configuration tree items */
$objSections->AddSection("in-portal:configure_general", "la_tab_General", "la_tab_General", $admin."/config/",
"edit_config.php?&module=In-Portal&section=in-portal:configure_general",
$admin."/icons/icon46_conf_general.gif", $admin."/icons/icon24_conf_general.gif",
NULL, "in-portal:system", NULL, "in-portal:configure_themes",0,"",1,
NULL,NULL,NULL,$admin."/icons/icon46_list_conf_general.gif","la_updating_config");
$objSections->AddSection("in-portal:configure_themes", "la_tab_Themes", "la_tab_Themes", $admin."/config/","config_theme.php",
$admin."/icons/icon46_conf_themes.gif", $admin."/icons/icon24_conf_themes.gif",
NULL, "in-portal:system", "in-portal:configure_general", "in-portal:configure_styles",0,"",1,
NULL,NULL,NULL,$admin."/icons/icon46_list_conf_themes.gif");
$objSections->AddSection( "in-portal:template_editor",
"la_tab_Themes",
"la_tab_Themes",
'',
'',
$admin."/icons/icon46_conf_themes.gif",
$admin."/icons/icon24_conf_themes.gif",
NULL, NULL, NULL, NULL, 1,'',1,
0,1,0,$admin."/icons/icon46_list_conf_themes.gif");
$objSections->AddSection("in-portal:configure_styles", "la_tab_Stylesheets", "la_tab_Stylesheets",
$admin.'/index4.php','kernel4:stylesheets/stylesheets_list.tpl',
$module_images.'/icons/icon46_style.gif', $module_images.'/icons/icon24_style.gif',
NULL, "in-portal:system", "in-portal:configure_themes", 'in-portal:configure_lang',0,"",1,
NULL,NULL,NULL,$module_images.'/icons/icon46_list_style.gif');
$objSections->AddSection("in-portal:configure_lang", "la_tab_Regional", "la_tab_Regional",
$admin.'/index4.php','kernel4:regional/languages_list.tpl',
$admin."/icons/icon46_conf_regional.gif", $admin."/icons/icon24_conf_regional.gif",
NULL, "in-portal:system", "in-portal:configure_lang", NULL,0,"",1,
NULL,NULL,NULL,$admin."/icons/icon46_list_conf_regional.gif");
/* theme tabs */
$objSections->AddSection("in-portal:theme_general", "la_tab_General", NULL, $admin."/config/",
"javascript:edit_submit('theme','ThemeEditStatus','".$admin."/config/addtheme.php',0);",
$admin."/icons/icon46_conf_themes.gif", $admin."/icons/icon24_conf_themes.gif",
NULL, "in-portal:configure_themes", NULL, "in-portal:theme_templates",-1);
$objSections->AddSection("in-portal:theme_templates", "la_tab_Templates", NULL, $admin."/config/",
"javascript:edit_submit('theme','ThemeEditStatus','".$admin."/config/addtheme_templates.php',0);",
$admin."/icons/icon46_conf_themes.gif", $admin."/icons/icon24_conf_themes.gif",
NULL, "in-portal:configure_themes", "in-portal:theme_general",NULL,-1);
/*Community Section tree items */
$objSections->AddSection("in-portal:user_list","la_tab_User_List","la_tab_User_List",$admin."/users/","user_list.php?resetpage=1",
$admin."/icons/icon46_users.gif",$admin."/icons/icon24_users.gif",
NULL, "in-portal:users", NULL, "in-portal:user_groups",0,"",1,
NULL,NULL,NULL,$admin."/icons/icon46_list_users.gif");
$objSections->AddSection("in-portal:user_groups","la_tab_User_Groups","la_tab_User_Groups", $admin."/users/", "user_groups.php?resetpage=1", $admin."/icons/icon46_usergroups.gif",$admin."/icons/icon24_usergroups.gif",
NULL, "in-portal:users", "in-portal:user_list","in-portal:configure_users",0,"",1,
NULL,NULL,NULL,$admin."/icons/icon46_list_usergroups.gif");
$objSections->AddSection("in-portal:configure_users", "la_tab_ConfigSettings", "la_tab_ConfigSettings", $admin."/config/",
"edit_config.php?&module=In-Portal:Users&section=in-portal:configure_users",
$admin."/icons/icon46_users_settings.gif", $admin."/icons/icon24_users_settings.gif",
NULL, "in-portal:users","in-portal:user_groups", "in-portal:user_email",0,"",1,
NULL,NULL,NULL,$admin."/icons/icon46_list_users_settings.gif","la_updating_config");
$objSections->AddSection("in-portal:user_email", "la_tab_ConfigE-mail", "la_tab_ConfigE-mail", $admin."/config/",
"module_email.php?&module=In-Portal:Users&section=in-portal:user_email&lpn=1",
$admin."/icons/icon46_settings_email.gif",$admin."/icons/icon24_settings_email.gif",
NULL,"in-link", "in-portal:configure_users", "in-portal:user_custom",0,"",1,
NULL,NULL,NULL,$admin."/icons/icon46_list_settings_email.gif","la_updating_config");
$objSections->AddSection("in-portal:user_custom","la_tab_ConfigCustom","la_tab_ConfigCustom",$admin.'/index4.php',
'kernel4:custom_fields/custom_fields_list:cf----6-',
$admin."/icons/icon46_settings_custom.gif",$admin."/icons/icon24_settings_custom.gif",
NULL, "in-portal:users", "in-portal:user_email", "in-portal:user_banlist",0,"",1,
NULL,NULL,NULL,$admin."/icons/icon46_list_settings_custom.gif","la_updating_config");
$objSections->AddSection("in-portal:user_banlist","la_tab_BanList","la_tab_UserBanList",$admin."/config/",
"edit_banlist.php?&section=in-portal:user_banlist&DataType=6",
$admin."/icons/icon46_banlist.gif",$admin."/icons/icon24_banlist.gif",
NULL, "in-portal:users", "in-portal:user_custom",NULL,0,"",1,
NULL,NULL,NULL,$admin."/icons/icon46_list_banlist.gif","la_updating_rules");
/*Edit Category Section*/
$objSections->AddSection("in-portal:editcategory_general","la_tab_General",NULL,$admin."/category/",
"javascript:edit_submit('category','CatEditStatus','".$admin."/category/addcategory.php',0);",
$admin."/icons/icon46_struct.gif", $admin."/icons/icon24_navigate.gif",
NULL, "in-portal:browse",NULL, "in-portal:editcategory_relations",-1);
$objSections->AddSection("in-portal:editcategory_relations","la_tab_Relations",NULL, $admin."/category/",
"javascript:edit_submit('category','CatEditStatus','".$admin."/category/addcategory_relations.php',0);",
$admin."/icons/icon46_struct.gif", $admin."/icons/icon24_navigate.gif",
NULL,"in-portal:browse","in-portal:editcategory_general","in-portal:editcategory_images",-1);
$objSections->AddSection("in-portal:editcategory_images","la_tab_Images", NULL,$admin."/category/",
"javascript:edit_submit('category','CatEditStatus','".$admin."/category/addcategory_images.php',0);",
$admin."/icons/icon46_struct.gif", $admin."/icons/icon24_navigate.gif",
NULL, "in-portal:browse", "in-portal:editcategory_relations", "in-portal:editcategory_permissions",-1);
$objSections->AddSection("in-portal:editcategory_permissions","la_tab_Permissions", NULL,$admin."/category/",
"javascript:edit_submit('category','CatEditStatus','".$admin."/category/addcategory_permissions.php',0);",
$admin."/icons/icon46_struct.gif", $admin."/icons/icon24_navigate.gif",
NULL, "in-portal:browse", "in-portal:editcategory_images","in-portal:editcategory_custom",-1);
$objSections->AddSection("in-portal:editcategory_custom", "la_tab_Custom", NULL, $admin."/category/",
"javascript:edit_submit('category','CatEditStatus','".$admin."/category/addcategory_custom.php',0);",
$admin."/icons/icon46_struct.gif", $admin."/icons/icon24_navigate.gif", NULL,
"in-portal:browse", "in-portal:editcategory_permissions", NULL,-1);
/* category edit subitems */
$objSections->AddSection("in-portal:cat_imageedit","la_tab_Images","la_title_edit_category",$admin."/category/",
"javascript:edit_submit('category','CatEditStatus','".$admin."/category/addimage.php',0);",
$admin."/icons/icon46_catalog.gif", $admin."/icons/icon24_catalog.gif",
NULL, NULL, NULL,NULL,-1);
$objSections->AddSection("in-portal:editcategory_relation","la_tab_Relations","la_title_edit_category",$admin."/category/",
"javascript:edit_submit('category','CatEditStatus','".$admin."/category/addrelation.php',0);",
$admin."/icons/icon46_catalog.gif", $admin."/icons/icon24_catalog.gif",
NULL, NULL, NULL,NULL,-1);
/* permission edit subtabs */
$objSections->AddSection("in-portal:catperm_modules","la_tab_Permissions","la_title_edit_category",$admin."/category/",
"javascript:edit_submit('category','CatEditStatus','".$admin."/category/addpermission_modules.php',0);",
$admin."/icons/icon46_catalog.gif", $admin."/icons/icon24_catalog.gif",
NULL, NULL, NULL,NULL,-1);
$objSections->AddSection("in-portal:catperm_setperm","la_tab_Permissions","la_title_edit_category",$admin."/category/",
"javascript:edit_submit('category','CatEditStatus','".$admin."/category/addpermission_modules.php',0);",
$admin."/icons/icon46_catalog.gif", $admin."/icons/icon24_catalog.gif",
NULL, NULL, NULL,NULL,-1);
/*user list toolbar - edit user*/
/*$objSections->AddSection("in-portal:user_rule_edit","la_tab_UserBan","la_title_edit_ban",$admin."/users/",
"javascript:edit_submit('rule','RuleEditStatus','".$admin."/config/edit_banlist.php',1,'$addSection&DataType=6');",
$admin."/icons/icon46_banlist.gif", $admin."/icons/icon24_banlist.gif",
NULL, NULL, NULL,NULL,-1);*/
$objSections->AddSection("in-portal:edituser_general", "la_tab_General", NULL, $admin."/users/",
"javascript:edit_submit('edituser','UserEditStatus','".$admin."/users/adduser.php',0);",
$admin."/icons/icon46_community.gif", $admin."/icons/icon24_users.gif",
NULL, "in-portal:user_list", NULL, 'in-portal:edituser_groups',-1);
$objSections->AddSection("in-portal:edituser_groups", "la_tab_Groups", NULL, $admin."/users/",
"javascript:edit_submit('edituser','UserEditStatus','".$admin."/users/adduser_groups.php',0);",
$admin."/icons/icon46_community.gif", $admin."/icons/icon24_users.gif",
NULL, "in-portal:user_list", "in-portal:edituser_general", "in-portal:edituser_images",-1);
$objSections->AddSection("in-portal:edituser_images", "la_tab_Images", NULL, $admin."/users/",
"javascript:edit_submit('edituser','UserEditStatus','".$admin."/users/adduser_images.php',0);",
$admin."/icons/icon46_community.gif", $admin."/icons/icon24_users.gif",
NULL, "in-portal:user_list", "in-portal:edituser_groups", "in-portal:edituser_permissions",-1);
$objSections->AddSection("in-portal:edituser_permissions", "la_tab_Permissions", NULL, $admin."/users/",
"javascript:edit_submit('edituser','UserEditStatus','".$admin."/users/adduser_permissions.php',0);",
$admin."/icons/icon46_community.gif", $admin."/icons/icon24_users.gif",
NULL, "in-portal:user_list", "in-portal:edituser_images", "in-portal:edituser_items",-1);
$objSections->AddSection("in-portal:edituser_items", "la_tab_Items", NULL, $admin."/users/",
"javascript:edit_submit('edituser','UserEditStatus','".$admin."/users/adduser_items.php',0);",
$admin."/icons/icon46_community.gif", $admin."/icons/icon24_users.gif",
NULL, "in-portal:user_list", "in-portal:edituser_permissions", "in-portal:edituser_custom",-1);
$objSections->AddSection("in-portal:edituser_custom","la_tab_Custom", NULL, $admin."/users/",
"javascript:edit_submit('edituser','UserEditStatus','".$admin."/users/adduser_custom.php',0);",
$admin."/icons/icon46_community.gif", $admin."/icons/icon24_users.gif",
NULL, "in-portal:user_list", "in-portal:edituser_permissions", NULL,-1);
/* user edit subitems */
$objSections->AddSection("in-portal:edituser_image","la_tab_Images","la_title_edit_user",$admin."/category/",
"javascript:edit_submit('edituser','UserEditStatus','".$admin."/users/user_addimage.php',0);",
$admin."/icons/icon46_community.gif", $admin."/icons/icon24_users.gif",
NULL, NULL, NULL,NULL,-1);
$objSections->AddSection("in-portal:edituser_group","la_tab_Images","la_title_edit_user",$admin."/category/",
"javascript:edit_submit('edituser','UserEditStatus','".$admin."/users/user_editgroup.php',0);",
$admin."/icons/icon46_community.gif", $admin."/icons/icon24_users.gif",
NULL, NULL, NULL,NULL,-1,'',1);
$objSections->AddSection("in-portal:edituser_permission","la_tab_Permissions","la_title_edit_user",$admin."/category/",
"javascript:edit_submit('edituser','UserEditStatus','".$admin."/users/user_addpermission.php',0);",
$admin."/icons/icon46_community.gif", $admin."/icons/icon24_users.gif",
NULL, NULL, NULL,NULL,-1);
/* group list toolbar - edit group */
$objSections->AddSection("in-portal:editgroup_general", "la_tab_General",NULL, $admin."/users/",
"javascript:edit_submit('editgroup','GroupEditStatus','".$admin."/users/addgroup.php',0);",
$admin."/icons/icon46_community.gif", $admin."/icons/icon24_usergroups.gif",
NULL, "in-portal:user_groups", NULL, "in-portal:editgroup_users",-1);
$objSections->AddSection("in-portal:editgroup_users", "la_tab_Users", NULL,$admin."/users/",
"javascript:edit_submit('editgroup','GroupEditStatus','".$admin."/users/addgroup_users.php',0)",
$admin."/icons/icon46_community.gif", $admin."/icons/icon24_usergroups.gif",
NULL, "in-portal:user_groups", "in-portal:editgroup_general","in-portal:editgroup_permissions",-1);
$objSections->AddSection("in-portal:editgroup_permissions", "la_tab_Permissions", NULL,$admin."/users/",
"javascript:edit_submit('editgroup','GroupEditStatus','".$admin."/users/addgroup_permissions.php',0)",
$admin."/icons/icon46_community.gif", $admin."/icons/icon24_usergroups.gif",
NULL, "in-portal:user_groups", "in-portal:editgroup_users",NULL,-1);
/* reports tree items */
/*
*/
//$notree=0,$onClick = "",$notabs=0,$nonavbar=0,$notitle=0,$toolbar=0
$objSections->AddSection("in-portal:editcategory_relationselect","la_tab_Category_RelationSelect",
"la_title_Category_RelationSelect", $admin."/","relation_select.php",$admin."/icons/icon46_navigate.gif",
$admin."/icons/icon24_navigate.gif",
NULL,NULL,NULL,NULL,-1,"",1,0,1,1);
$objSections->AddSection("in-portal:catselect","la_tab_Category_Select","la_title_Category_Select",
$admin."/","relation_select.php",$admin."/icons/icon46_navigate.gif",$admin."/icons/icon24_navigate.gif",
NULL,NULL,NULL,NULL,-1,"",1,0,1,1);
$objSections->AddSection("in-portal:groupselect","la_tab_GroupSelect","la_title_GroupSelect",
$admin."/users","group_select.php",
$admin."/icons/icon46_navigate.gif",$admin."/icons/icon24_usergroups.gif",
NULL,NULL,NULL,NULL,-1,"",1,0,1,1);
$objSections->AddSection("in-portal:userselect","la_tab_UserSelect","la_title_UserSelect",
$admin."/users","user_select.php",
$admin."/icons/icon46_community.gif",$admin."/icons/icon24_usergroups.gif",
NULL,NULL,NULL,NULL,-1,"",1,0,1,1);
$objSections->AddSection("in-portal:phrase_editor","la_tab_Label","la_title_Label",
$admin."/config","edit_label.php",
$admin."/icons/icon46_conf_regional.gif",$admin."/icons/icon24_conf_regional.gif",
NULL,NULL,NULL,NULL,-1,"",1,0,1,1);
$objSections->AddSection("in-portal:sendmail","la_tab_SendMail","la_title_SendMail",
$admin."/email","sendmail.php",
$admin."/icons/icon46_conf_regional.gif",$admin."/icons/icon24_conf_regional.gif",
NULL,NULL,NULL,NULL,-1,"",1,0,1,1);
$objSections->AddSection("in-portal:user_rule_edit","la_tab_UserBan","la_tab_UserBan",
$admin."/users","addrule.php",
$admin."/icons/icon46_community.gif", $admin."/icons/icon24_users.gif",
NULL,NULL,NULL,NULL,-1,"",1,0,0,1);
$objSections->AddSection("in-portal:banuser","la_Text_BanUserFields","la_Text_BanUserFields",
$admin."/users","banuser.php",
$admin."/icons/icon46_community.gif", $admin."/icons/icon24_users.gif",
NULL,NULL,NULL,NULL,-1,"",1,0,0,1);
$objSections->AddSection("in-portal:editreview_direct", "la_tab_Reviews", null,"",
"",
$admin."/icons/icon46_struct.gif", $admin."/icons/icon24_navigate.gif",
NULL, null, null, null, 1, '', 1, 0, 1);
$objSections->AddSection("in-portal:visits","la_tab_Visits","la_title_Visits",$admin."/index4.php","kernel4:visits/visits_list",
$module_images."/icons/icon46_visits.gif",$module_images."/icons/icon24_visits.gif",
NULL,"in-portal:reports",NULL,NULL,0,"",1,NULL,NULL,NULL,$module_images."/icons/icon46_list_visits.gif");
?>
Property changes on: branches/unlabeled/unlabeled-1.19.2/kernel/admin/include/navmenu.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.19
\ No newline at end of property
+1.19.2.1
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.49.2/core/kernel/db/db_tag_processor.php
===================================================================
--- branches/unlabeled/unlabeled-1.49.2/core/kernel/db/db_tag_processor.php (revision 4410)
+++ branches/unlabeled/unlabeled-1.49.2/core/kernel/db/db_tag_processor.php (revision 4411)
@@ -1,1512 +1,1516 @@
<?php
class kDBTagProcessor extends TagProcessor {
/**
* Description
*
* @var kDBConnection
* @access public
*/
var $Conn;
function kDBTagProcessor()
{
parent::kBase();
$this->Conn =& $this->Application->GetADODBConnection();
}
/**
* Returns true if "new" button was pressed in toolbar
*
* @param Array $params
* @return bool
*/
function IsNewMode($params)
{
$object =& $this->getObject($params);
return $object->GetID() <= 0;
}
/**
* Returns view menu name for current prefix
*
* @param Array $params
* @return string
*/
function GetItemName($params)
{
$item_name = $this->Application->getUnitOption($this->Prefix, 'ViewMenuPhrase');
return $this->Application->Phrase($item_name);
}
function ViewMenu($params)
{
$block_params = $params;
unset($block_params['block']);
$block_params['name'] = $params['block'];
$list =& $this->GetList($params);
$block_params['PrefixSpecial'] = $list->getPrefixSpecial();
return $this->Application->ParseBlock($block_params);
}
function SearchKeyword($params)
{
$list =& $this->GetList($params);
return $this->Application->RecallVar($list->getPrefixSpecial().'_search_keyword');
}
/**
* Draw filter menu content (for ViewMenu) based on filters defined in config
*
* @param Array $params
* @return string
*/
function DrawFilterMenu($params)
{
$block_params = $this->prepareTagParams($params);
$block_params['name'] = $params['spearator_block'];
$separator = $this->Application->ParseBlock($block_params);
$filter_menu = $this->Application->getUnitOption($this->Prefix,'FilterMenu');
if(!$filter_menu)
{
trigger_error('<span class="debug_error">no filters defined</span> for prefix <b>'.$this->Prefix.'</b>, but <b>DrawFilterMenu</b> tag used', E_USER_WARNING);
return '';
}
// Params: label, filter_action, filter_status
$block_params['name'] = $params['item_block'];
$view_filter = $this->Application->RecallVar($this->getPrefixSpecial().'_view_filter');
if($view_filter === false)
{
$event_params = Array('prefix'=>$this->Prefix,'special'=>$this->Special,'name'=>'OnRemoveFilters');
$this->Application->HandleEvent( new kEvent($event_params) );
$view_filter = $this->Application->RecallVar($this->getPrefixSpecial().'_view_filter');
}
$view_filter = unserialize($view_filter);
$filters = Array();
$prefix_special = $this->getPrefixSpecial();
foreach($filter_menu['Filters'] as $filter_key => $filter_params)
{
if(!$filter_params)
{
$filters[] = $separator;
continue;
}
$block_params['label'] = addslashes( $this->Application->Phrase($filter_params['label']) );
if( getArrayValue($view_filter,$filter_key) )
{
$submit = 0;
$status = 1;
}
else
{
$submit = 1;
$status = 0;
}
$block_params['filter_action'] = 'set_filter("'.$prefix_special.'","'.$filter_key.'","'.$submit.'");';
$block_params['filter_status'] = $status;
$filters[] = $this->Application->ParseBlock($block_params);
}
return implode('', $filters);
}
function IterateGridFields($params)
{
$mode = $params['mode'];
$def_block = $params['block'];
$grids = $this->Application->getUnitOption($this->Prefix,'Grids');
$grid_config = $grids[$params['grid']]['Fields'];
$std_params['pass_params']='true';
$std_params['PrefixSpecial']=$this->getPrefixSpecial();
$o = '';
foreach ($grid_config as $field => $options) {
$block_params = Array();
$block_params['name'] = isset($options[$mode.'_block']) ? $options[$mode.'_block'] : $def_block;
$block_params['field'] = $field;
$block_params['sort_field'] = isset($options['sort_field']) ? $options['sort_field'] : $field;
$block_params = array_merge($std_params, $block_params, $options);
$o.= $this->Application->ParseBlock($block_params, 1);
}
return $o;
}
/**
* Prints list content using block specified
*
* @param Array $params
* @return string
* @access public
*/
function PrintList($params)
{
$list =& $this->GetList($params);
$id_field = $this->Application->getUnitOption($this->Prefix,'IDField');
$list->Query();
$o = '';
$list->GoFirst();
$block_params=$this->prepareTagParams($params);
$block_params['name'] = $this->SelectParam($params, 'render_as,block');
$block_params['pass_params'] = 'true';
while (!$list->EOL())
{
$this->Application->SetVar( $this->getPrefixSpecial().'_id', $list->GetDBField($id_field) ); // for edit/delete links using GET
$o.= $this->Application->ParseBlock($block_params, 1);
$list->GoNext();
}
$this->Application->SetVar( $this->getPrefixSpecial().'_id', '');
return $o;
}
function InitList($params)
{
$list_name = $params['list_name'];
$names_mapping = $this->Application->GetVar('NamesToSpecialMapping');
if( !getArrayValue($names_mapping, $this->Prefix, $list_name) )
{
$list =& $this->GetList($params);
}
}
function BuildListSpecial($params)
{
return $this->Special;
}
/**
* Enter description here...
*
* @param Array $params
* @return kDBList
*/
function &GetList($params)
{
$list_name = $this->SelectParam($params, 'list_name,name');
if (!$list_name) {
$list_name = $this->Application->Parser->GetParam('list_name');
}
$requery = getArrayValue($params, 'requery');
if ($list_name && !$requery){
$names_mapping = $this->Application->GetVar('NamesToSpecialMapping');
$special = getArrayValue($names_mapping, $this->Prefix, $list_name);
if(!$special)
{
$special = $this->BuildListSpecial($params);
}
}
else
{
$special = $this->BuildListSpecial($params);
}
$prefix_special = rtrim($this->Prefix.'.'.$special, '.');
$params['skip_counting'] = true;
$list =& $this->Application->recallObject( $prefix_special, $this->Prefix.'_List', $params);
if ($requery) {
$this->Application->HandleEvent($an_event, $prefix_special.':OnListBuild', $params);
}
$list->Query($requery);
$this->Special = $special;
if ($list_name) {
$names_mapping[$this->Prefix][$list_name] = $special;
$this->Application->SetVar('NamesToSpecialMapping', $names_mapping);
}
return $list;
}
function ListMarker($params)
{
$list =& $this->GetList($params);
$ret = $list->getPrefixSpecial();
if( getArrayValue($params, 'as_preg') ) $ret = preg_quote($ret, '/');
return $ret;
}
function SubmitName($params)
{
$list =& $this->GetList($params);
$prefix_special = $list->getPrefixSpecial();
return 'events['.$prefix_special.']['.$params['event'].']';
}
function CombinedSortingDropDownName($params)
{
$list =& $this->GetList($params);
$prefix_special = $list->getPrefixSpecial();
return $prefix_special.'_CombinedSorting';
}
function SortingSelected($params)
{
$list =& $this->GetList($params);
$user_sorting_start = $this->getUserSortIndex();
$sorting = strtolower($list->GetOrderField($user_sorting_start).'|'.$list->GetOrderDirection($user_sorting_start));
if ($sorting == strtolower($params['sorting'])) return $params['selected'];
}
/**
* Prints list content using block specified
*
* @param Array $params
* @return string
* @access public
*/
function PrintList2($params)
{
$per_page = $this->SelectParam($params, 'per_page,max_items');
if ($per_page !== false) $params['per_page'] = $per_page;
$list =& $this->GetList($params);
$o = '';
$direction = (isset($params['direction']) && $params['direction']=="H")?"H":"V";
$columns = (isset($params['columns'])) ? $params['columns'] : 1;
$id_field = (isset($params['id_field'])) ? $params['id_field'] : $this->Application->getUnitOption($this->Prefix, 'IDField');
if ($columns>1 && $direction=="V") {
$list->Records = $this->LinearToVertical($list->Records, $columns, $list->GetPerPage());
$list->SelectedCount=count($list->Records);
ksort($list->Records);
}
$list->GoFirst();
$block_params=$this->prepareTagParams($params);
$block_params['name']=$this->SelectParam($params, 'render_as,block');
$block_params['pass_params']='true';
$block_start_row_params=$this->prepareTagParams($params);
$block_start_row_params['name'] = $this->SelectParam($params, 'row_start_render_as,block_row_start,row_start_block');
$block_end_row_params=$this->prepareTagParams($params);
$block_end_row_params['name'] = $this->SelectParam($params, 'row_end_render_as,block_row_end,row_end_block');
$block_empty_cell_params = $this->prepareTagParams($params);
$block_empty_cell_params['name'] = $this->SelectParam($params, 'empty_cell_render_as,block_empty_cell,empty_cell_block');
$i=0;
$backup_id=$this->Application->GetVar($this->Prefix."_id");
$displayed = array();
while (!$list->EOL())
{
$this->Application->SetVar( $this->getPrefixSpecial().'_id', $list->GetDBField($id_field) ); // for edit/delete links using GET
$this->Application->SetVar( $this->Prefix.'_id', $list->GetDBField($id_field) );
if ($i % $columns == 0) {
$o.= $block_start_row_params['name'] ? $this->Application->ParseBlock($block_start_row_params, 1) : '<tr>';
}
if (!$list->getCurrentRecord()){
$o.= $block_empty_cell_params['name'] ? $this->Application->ParseBlock($block_params, 1) : '<td>&nbsp;</td>';
}
else {
$o.= $this->Application->ParseBlock($block_params, 1);
array_push($displayed, $list->GetDBField($id_field));
}
if (($i+1) % $columns == 0) {
$o.= $block_end_row_params['name'] ? $this->Application->ParseBlock($block_end_row_params, 1) : '</tr>';
}
$list->GoNext();
$i++;
}
$cur_displayed = $this->Application->GetVar($this->Prefix.'_displayed_ids');
if (!$cur_displayed) {
$cur_displayed = Array();
}
else {
$cur_displayed = explode(',', $cur_displayed);
}
$displayed = array_unique(array_merge($displayed, $cur_displayed));
$this->Application->SetVar($this->Prefix.'_displayed_ids', implode(',',$displayed));
$this->Application->SetVar( $this->Prefix.'_id', $backup_id);
$this->Application->SetVar( $this->getPrefixSpecial().'_id', '');
if (isset($params['more_link_render_as'])) {
$block_params = $params;
$params['render_as'] = $params['more_link_render_as'];
$o .= $this->MoreLink($params);
}
return $o;
}
function MoreLink($params)
{
$per_page = $this->SelectParam($params, 'per_page,max_items');
if ($per_page !== false) $params['per_page'] = $per_page;
$list =& $this->GetList($params);
if ($list->PerPage < $list->RecordsCount) {
$block_params = array();
$block_params['name'] = $this->SelectParam($params, 'render_as,block');
return $this->Application->ParseBlock($block_params, 1);
}
}
function NotLastItem($params)
{
$object =& $this->getObject($params); // maybe we should use $this->GetList($params) instead
return ($object->CurrentIndex < min($object->PerPage, $object->RecordsCount) - 1);
}
function PageLink($params)
{
$t = isset($params['template']) ? $param['template'] : '';
if (!$t) $t = $this->Application->GetVar('t');
if (isset($params['page'])) {
$this->Application->SetVar($this->getPrefixSpecial().'_Page', $params['page']);
}
// $http_query =& $this->Application->recallObject('HTTPQuery');
// $get = $http_query->getRedirectParams();
$pass = Array('pass' => 'all,'.$this->getPrefixSpecial());
// $pass = array_merge($get, $pass);
return $this->Application->HREF($t, '', $pass);
}
function ColumnWidth($params)
{
$columns = $this->Application->Parser->GetParam('columns');
return round(100/$columns).'%';
}
/**
* Append prefix and special to tag
* params (get them from tagname) like
* they were really passed as params
*
* @param Array $tag_params
* @return Array
* @access protected
*/
function prepareTagParams($tag_params = Array())
{
/*if (isset($tag_params['list_name'])) {
$list =& $this->GetList($tag_params);
$this->Init($list->Prefix, $list->Special);
}*/
$ret = $tag_params;
$ret['Prefix'] = $this->Prefix;
$ret['Special'] = $this->Special;
$ret['PrefixSpecial'] = $this->getPrefixSpecial();
return $ret;
}
function GetISO($currency)
{
if ($currency == 'selected') {
$iso = $this->Application->RecallVar('curr_iso');
}
elseif ($currency == 'primary' || $currency == '') {
$iso = $this->Application->GetPrimaryCurrency();
}
else { //explicit currency
$iso = $currency;
}
return $iso;
}
function ConvertCurrency($value, $iso)
{
$converter =& $this->Application->recallObject('kCurrencyRates');
// convery primary currency to selected (if they are the same, converter will just return)
$value = $converter->Convert($value, 'PRIMARY', $iso);
return $value;
}
function AddCurrencySymbol($value, $iso)
{
$this->Application->setUnitOption('curr', 'AutoLoad', false);
$currency =& $this->Application->recallObject('curr.-'.$iso);
if( !$currency->isLoaded() ) $currency->Load($iso, 'ISO');
$symbol = $currency->GetDBField('Symbol');
if (!$symbol) $symbol = $currency->GetDBField('ISO').'&nbsp;';
if ($currency->GetDBField('SymbolPosition') == 0) {
$value = $symbol.$value;
}
if ($currency->GetDBField('SymbolPosition') == 1) {
$value = $value.$symbol;
}
return $value;
}
/**
* Get's requested field value
*
* @param Array $params
* @return string
* @access public
*/
function Field($params)
{
$field = $this->SelectParam($params, 'name,field');
if( !$this->Application->IsAdmin() ) $params['no_special'] = 'no_special';
$object =& $this->getObject($params);
if ( $this->HasParam($params, 'db') )
{
$value = $object->GetDBField($field);
}
else
{
if( $this->HasParam($params, 'currency') )
{
$iso = $this->GetISO($params['currency']);
$original = $object->GetDBField($field);
$value = $this->ConvertCurrency($original, $iso);
$object->SetDBField($field, $value);
$object->Fields[$field]['converted'] = true;
}
$format = getArrayValue($params, 'format');
if( !$format || $format == '$format' )
{
$format = null;
}
else
{
if(preg_match("/_regional_(.*)/", $format, $regs))
{
$lang =& $this->Application->recallObject('lang.current');
$format = $lang->GetDBField($regs[1]);
}
}
$value = $object->GetField($field, $format);
if( $this->SelectParam($params, 'negative') )
{
if(strpos($value, '-') === 0)
{
$value = substr($value, 1);
}
else
{
$value = '-'.$value;
}
}
if( $this->HasParam($params, 'currency') )
{
$value = $this->AddCurrencySymbol($value, $iso);
$params['no_special'] = 1;
}
}
if( getArrayValue($params,'nl2br' ) ) $value = nl2br($value);
if( !$this->HasParam($params, 'no_special') ) $value = htmlspecialchars($value);
if( getArrayValue($params,'checked' ) ) $value = ($value == 1) ? 'checked' : '';
if( getArrayValue($params,'as_label') ) $value = $this->Application->Phrase($value);
$first_chars = $this->SelectParam($params,'first_chars,cut_first');
if($first_chars)
{
$needs_cut = strlen($value) > $first_chars;
$value = substr($value,0,$first_chars);
if($needs_cut) $value .= ' ...';
}
if ($value != '') $this->Application->Parser->DataExists = true;
if( $this->HasParam($params, 'currency') )
{
//restoring value in original currency, for other Field tags to work properly
$object->SetDBField($field, $original);
}
return $value;
}
function SetField($params)
{
// <inp2:SetField field="Value" src=p:cust_{$custom_name}"/>
$object =& $this->getObject($params);
$dst_field = $this->SelectParam($params, 'name,field');
list($prefix_special, $src_field) = explode(':', $params['src']);
$src_object =& $this->Application->recallObject($prefix_special);
$object->SetDBField($dst_field, $src_object->GetDBField($src_field));
}
/**
* Checks if parameter is passed
* Note: works like Tag and line simple method too
*
* @param Array $params
* @param string $param_name
* @return bool
*/
function HasParam($params, $param_name = null)
{
if( !isset($param_name) )
{
$param_name = $this->SelectParam($params, 'name');
$params = $this->Application->Parser->Params;
}
$value = getArrayValue($params, $param_name);
return $value && ($value != '$'.$param_name);
}
function PhraseField($params)
{
$field_label = $this->Field($params);
$translation = $this->Application->Phrase( $field_label );
return $translation;
}
function Error($params)
{
$field = $params['field'];
$object =& $this->getObject($params);
$msg = $object->GetErrorMsg($field, false);
return $msg;
}
function HasError($params)
{
if ($params['field'] == 'any')
{
$object =& $this->getObject($params);
$skip_fields = getArrayValue($params, 'except');
$skip_fields = $skip_fields ? explode(',', $skip_fields) : Array();
return $object->HasErrors($skip_fields);
}
else
{
$fields = $this->SelectParam($params, 'field,fields');
$fields = explode(',', $fields);
$res = false;
foreach($fields as $field)
{
$params['field'] = $field;
$res = $res || ($this->Error($params) != '');
}
return $res;
}
}
function IsRequired($params)
{
$field = $params['field'];
$object =& $this->getObject($params);;
$options = $object->GetFieldOptions($field);
return getArrayValue($options,'required');
}
function PredefinedOptions($params)
{
$field = $params['field'];
$object =& $this->getObject($params);
$value = $object->GetDBField($field);
$options = $object->GetFieldOptions($field);
if( $this->HasParam($params,'has_empty') )
{
$empty_value = getArrayValue($params, 'empty_value');
if($empty_value === false) $empty_value = '';
$options['options'] = array_merge_recursive2( Array($empty_value => ''), $options['options'] );
}
$block_params = $this->prepareTagParams($params);
$block_params['name'] = $this->SelectParam($params, 'render_as,block');
$block_params['field'] = $params['field'];
$block_params['pass_params'] = 'true';
$block_params['field_name'] = $this->InputName($params);
$block_params['PrefixSpecial'] = $this->getPrefixSpecial();
$selected_param_name = getArrayValue($params,'selected_param');
if(!$selected_param_name) $selected_param_name = $params['selected'];
$selected = $params['selected'];
$o = '';
if( $this->HasParam($params,'no_empty') && !getArrayValue($options['options'],'') ) array_shift($options['options']);
if( strpos($value, '|') !== false )
{
// multiple selection checkboxes
$value = explode('|', substr($value, 1, -1) );
foreach ($options['options'] as $key => $val)
{
$block_params['key'] = $key;
$block_params['option'] = $val;
$block_params[$selected_param_name] = ( in_array($key, $value) ? ' '.$selected : '');
$o .= $this->Application->ParseBlock($block_params, 1);
}
}
else
{
// single selection radio or checkboxes
foreach ($options['options'] as $key => $val)
{
$block_params['key'] = $key;
$block_params['option'] = $val;
$block_params[$selected_param_name] = ( $key == $value ? ' '.$selected : '');
$o .= $this->Application->ParseBlock($block_params, 1);
}
}
return $o;
}
function PredefinedSearchOptions($params)
{
$object =& $this->getObject($params);
$field = $params['field'];
$saved_value = $object->GetDBField($field);
$custom_filters = $this->Application->RecallVar( $this->getPrefixSpecial().'_custom_filters');
if ($custom_filters) {
$custom_filters = unserialize($custom_filters);
$append = getArrayValue($params, 'type') ? '_'.$params['type'] : '';
$object->SetDBField($field, $custom_filters[$field.$append]);
}
else {
$object->SetDBField($field, '');
}
$ret = $this->PredefinedOptions($params);
$object->SetDBField($field, $saved_value);
return $ret;
}
function Format($params)
{
$field = $params['field'];
$object =& $this->getObject($params);
$options = $object->GetFieldOptions($field);
$format = $options[ $this->SelectParam($params, 'input_format') ? 'input_format' : 'format' ];
$formatter_class = getArrayValue($options,'formatter');
if($formatter_class)
{
$formatter =& $this->Application->recallObject($formatter_class);
$human_format = getArrayValue($params,'human');
$edit_size = getArrayValue($params,'edit_size');
$sample = getArrayValue($params,'sample');
if($sample)
{
return $formatter->GetSample($field, $options, $object);
}
elseif($human_format || $edit_size)
{
$format = $formatter->HumanFormat($format);
return $edit_size ? strlen($format) : $format;
}
}
return $format;
}
/**
* Print grid pagination using
* block names specified
*
* @param Array $params
* @return string
* @access public
*/
function PrintPages($params)
{
$list =& $this->GetList($params);
$prefix_special = $list->getPrefixSpecial();
$total_pages = $list->GetTotalPages();
if ($total_pages) $this->Application->Parser->DataExists = true;
if($total_pages == 0) $total_pages = 1; // display 1st page as selected in case if we have no pages at all
$o = '';
// what are these 2 lines for?
$this->Application->SetVar($prefix_special.'_event','');
$this->Application->SetVar($prefix_special.'_id','');
$current_page = $list->Page; // $this->Application->RecallVar($prefix_special.'_Page');
$block_params = $this->prepareTagParams($params);
$split = ( isset($params['split'] ) ? $params['split'] : 10 );
$split_start = $current_page - ceil($split/2);
if ($split_start < 1){
$split_start = 1;
}
$split_end = $split_start + $split-1;
if ($split_end > $total_pages) {
$split_end = $total_pages;
$split_start = max($split_end - $split + 1, 1);
}
if ($current_page > 1){
$prev_block_params = $this->prepareTagParams();
if ($total_pages > $split){
$prev_block_params['page'] = max($current_page-$split, 1);
$prev_block_params['name'] = $this->SelectParam($params, 'prev_page_split_render_as,prev_page_split_block');
if ($prev_block_params['name']){
$o .= $this->Application->ParseBlock($prev_block_params, 1);
}
}
$prev_block_params['name'] = 'page';
$prev_block_params['page'] = $current_page-1;
$prev_block_params['name'] = $this->SelectParam($params, 'prev_page_render_as,block_prev_page,prev_page_block');
if ($prev_block_params['name']) {
$this->Application->SetVar($this->getPrefixSpecial().'_Page', $current_page-1);
$o .= $this->Application->ParseBlock($prev_block_params, 1);
}
}
else {
if ( $no_prev_page_block = $this->SelectParam($params, 'no_prev_page_render_as,block_no_prev_page') ) {
$block_params['name'] = $no_prev_page_block;
$o .= $this->Application->ParseBlock($block_params, 1);
}
}
$separator_params['name'] = $this->SelectParam($params, 'separator_render_as,block_separator');
for ($i = $split_start; $i <= $split_end; $i++)
{
if ($i == $current_page) {
$block = $this->SelectParam($params, 'current_render_as,active_render_as,block_current,active_block');
}
else {
$block = $this->SelectParam($params, 'link_render_as,inactive_render_as,block_link,inactive_block');
}
$block_params['name'] = $block;
$block_params['page'] = $i;
$this->Application->SetVar($this->getPrefixSpecial().'_Page', $i);
$o .= $this->Application->ParseBlock($block_params, 1);
if ($this->SelectParam($params, 'separator_render_as,block_separator')
&& $i < $split_end)
{
$o .= $this->Application->ParseBlock($separator_params, 1);
}
}
if ($current_page < $total_pages){
$next_block_params = $this->prepareTagParams();
$next_block_params['page']=$current_page+1;
$next_block_params['name'] = $this->SelectParam($params, 'next_page_render_as,block_next_page,next_page_block');
if ($next_block_params['name']){
$this->Application->SetVar($this->getPrefixSpecial().'_Page', $current_page+1);
$o .= $this->Application->ParseBlock($next_block_params, 1);
}
if ($total_pages > $split){
$next_block_params['page']=min($current_page+$split, $total_pages);
$next_block_params['name'] = $this->SelectParam($params, 'next_page_split_render_as,next_page_split_block');
if ($next_block_params['name']){
$o .= $this->Application->ParseBlock($next_block_params, 1);
}
}
}
$this->Application->SetVar($this->getPrefixSpecial().'_Page', $current_page);
return $o;
}
/**
* Print grid pagination using
* block names specified
*
* @param Array $params
* @return string
* @access public
*/
function PaginationBar($params)
{
return $this->PrintPages($params);
}
/**
* Returns field name (processed by kMultiLanguage formatter
* if required) and item's id from it's IDField or field required
*
* @param Array $params
* @return Array (id,field)
* @access private
*/
function prepareInputName($params)
{
$field = $this->SelectParam($params, 'name,field');
$object =& $this->getObject($params);
$formatter_class = getArrayValue($object->Fields, $field, 'formatter');
if ($formatter_class == 'kMultiLanguage')
{
$formatter =& $this->Application->recallObject($formatter_class);
$field = $formatter->LangFieldName($field);
}
$id_field = getArrayValue($params, 'IdField');
$id = $id_field ? $object->GetDBField($id_field) : $object->GetID();
return Array($id, $field);
}
/**
* Returns input field name to
* be placed on form (for correct
* event processing)
*
* @param Array $params
* @return string
* @access public
*/
function InputName($params)
{
list($id, $field) = $this->prepareInputName($params);
$ret = $this->getPrefixSpecial().'['.$id.']['.$field.']';
if( getArrayValue($params, 'as_preg') ) $ret = preg_quote($ret, '/');
return $ret;
}
/**
* Allows to override various field options through hidden fields with specific names in submit.
* This tag generates this special names
*
* @param Array $params
* @return string
* @author Alex
*/
function FieldModifier($params)
{
list($id, $field) = $this->prepareInputName($params);
$ret = 'field_modifiers['.$this->getPrefixSpecial().']['.$field.']['.$params['type'].']';
if( getArrayValue($params, 'as_preg') ) $ret = preg_quote($ret, '/');
return $ret;
}
/**
* Returns index where 1st changable sorting field begins
*
* @return int
* @access private
*/
function getUserSortIndex()
{
$list_sortings = $this->Application->getUnitOption($this->Prefix, 'ListSortings');
$sorting_prefix = getArrayValue($list_sortings, $this->Special) ? $this->Special : '';
$user_sorting_start = 0;
if ( $forced_sorting = getArrayValue($list_sortings, $sorting_prefix, 'ForcedSorting') ) {
$user_sorting_start = count($forced_sorting);
}
return $user_sorting_start;
}
/**
* Returns order direction for given field
*
*
*
* @param Array $params
* @return string
* @access public
*/
function Order($params)
{
$field = $params['field'];
$user_sorting_start = $this->getUserSortIndex();
$list =& $this->GetList($params);
if ($list->GetOrderField($user_sorting_start) == $field)
{
return strtolower($list->GetOrderDirection($user_sorting_start));
}
elseif($list->GetOrderField($user_sorting_start+1) == $field)
{
return '2_'.strtolower($list->GetOrderDirection($user_sorting_start+1));
}
else
{
return 'no';
}
}
/**
* Get's information of sorting field at "pos" position,
* like sorting field name (type="field") or sorting direction (type="direction")
*
* @param Array $params
* @return mixed
*/
function OrderInfo($params)
{
$user_sorting_start = $this->getUserSortIndex() + --$params['pos'];
$list =& $this->GetList($params);
// $object =& $this->Application->recallObject( $this->getPrefixSpecial() );
if($params['type'] == 'field') return $list->GetOrderField($user_sorting_start);
if($params['type'] == 'direction') return $list->GetOrderDirection($user_sorting_start);
}
/**
* Checks if sorting field/direction matches passed field/direction parameter
*
* @param Array $params
* @return bool
*/
function IsOrder($params)
{
$params['type'] = isset($params['field']) ? 'field' : 'direction';
$value = $this->OrderInfo($params);
if( isset($params['field']) ) return $params['field'] == $value;
if( isset($params['direction']) ) return $params['direction'] == $value;
}
/**
* Returns list perpage
*
* @param Array $params
* @return int
*/
function PerPage($params)
{
$object =& $this->getObject($params);
return $object->PerPage;
}
/**
* Checks if list perpage matches value specified
*
* @param Array $params
* @return bool
*/
function PerPageEquals($params)
{
$object =& $this->getObject($params);
return $object->PerPage == $params['value'];
}
function SaveEvent($params)
{
// SaveEvent is set during OnItemBuild, but we may need it before any other tag calls OnItemBuild
$object =& $this->getObject($params);
return $this->Application->GetVar($this->getPrefixSpecial().'_SaveEvent');
}
function NextId($params)
{
$object =& $this->getObject($params);
$ids = explode(',', $this->Application->RecallVar($this->getPrefixSpecial().'_selected_ids'));
$cur_id = $object->GetID();
$i = array_search($cur_id, $ids);
if ($i !== false) {
return $i < count($ids) - 1 ? $ids[$i + 1] : '';
}
return '';
}
function PrevId($params)
{
$object =& $this->getObject($params);
$ids = explode(',', $this->Application->RecallVar($this->getPrefixSpecial().'_selected_ids'));
$cur_id = $object->GetID();
$i = array_search($cur_id, $ids);
if ($i !== false) {
return $i > 0 ? $ids[$i - 1] : '';
}
return '';
}
function IsSingle($params)
{
return ($this->NextId($params) === '' && $this->PrevId($params) === '');
}
function IsLast($params)
{
return ($this->NextId($params) === '');
}
function IsFirst($params)
{
return ($this->PrevId($params) === '');
}
/**
* Checks if field value is equal to proposed one
*
* @param Array $params
* @return bool
*/
function FieldEquals($params)
{
$object =& $this->getObject($params);
$ret = $object->GetDBField($this->SelectParam($params, 'name,field')) == $params['value'];
// if( getArrayValue($params,'inverse') ) $ret = !$ret;
return $ret;
}
function ItemIcon($params)
{
$object =& $this->getObject($params);
$grids = $this->Application->getUnitOption($this->Prefix,'Grids');
$icons =& $grids[ $params['grid'] ]['Icons'];
$key = '';
$status_fields = $this->Application->getUnitOption($this->Prefix,'StatusField');
if(!$status_fields) return $icons['default'];
foreach($status_fields as $status_field)
{
$key .= $object->GetDBField($status_field).'_';
}
$key = rtrim($key,'_');
$value = ($key !== false) ? $key : 'default';
return isset($icons[$value]) ? $icons[$value] : $icons['default'];
}
/**
* Generates bluebar title + initializes prefixes used on page
*
* @param Array $params
* @return string
*/
function SectionTitle($params)
{
$preset_name = replaceModuleSection($params['title_preset']);
$title_presets = $this->Application->getUnitOption($this->Prefix,'TitlePresets');
$title_info = getArrayValue($title_presets, $preset_name);
- if($title_info === false) return $params['title'];
+ if($title_info === false) return str_replace('#preset_name#', $preset_name, $params['title']);
if( getArrayValue($title_presets,'default') )
{
// use default labels + custom labels specified in preset used
$title_info = array_merge_recursive2($title_presets['default'], $title_info);
}
$title = $title_info['format'];
// 1. get objects in use for title construction
$objects = Array();
$object_status = Array();
$status_labels = Array();
$prefixes = getArrayValue($title_info,'prefixes');
$all_tag_params = getArrayValue($title_info,'tag_params');
if($prefixes)
{
$tag_params = Array();
foreach($prefixes as $prefix_special)
{
$prefix_data = $this->Application->processPrefix($prefix_special);
$prefix_data['prefix_special'] = rtrim($prefix_data['prefix_special'],'.');
if($all_tag_params)
{
$tag_params = getArrayValue($all_tag_params, $prefix_data['prefix_special']);
if(!$tag_params) $tag_params = Array();
}
$tag_params = array_merge_recursive2($params, $tag_params);
$objects[ $prefix_data['prefix_special'] ] =& $this->Application->recallObject($prefix_data['prefix_special'], $prefix_data['prefix'], $tag_params);
$object_status[ $prefix_data['prefix_special'] ] = $objects[ $prefix_data['prefix_special'] ]->GetID() ? 'edit' : 'new';
// a. set object's status field (adding item/editing item) for each object in title
if( getArrayValue($title_info[ $object_status[ $prefix_data['prefix_special'] ].'_status_labels' ],$prefix_data['prefix_special']) )
{
$status_labels[ $prefix_data['prefix_special'] ] = $title_info[ $object_status[ $prefix_data['prefix_special'] ].'_status_labels' ][ $prefix_data['prefix_special'] ];
$title = str_replace('#'.$prefix_data['prefix_special'].'_status#', $status_labels[ $prefix_data['prefix_special'] ], $title);
}
// b. setting object's titlefield value (in titlebar ONLY) to default in case if object beeing created with no titlefield filled in
if( $object_status[ $prefix_data['prefix_special'] ] == 'new' )
{
$new_value = $this->getInfo( $objects[ $prefix_data['prefix_special'] ], 'titlefield' );
if(!$new_value && getArrayValue($title_info['new_titlefield'],$prefix_data['prefix_special']) ) $new_value = $this->Application->Phrase($title_info['new_titlefield'][ $prefix_data['prefix_special'] ]);
$title = str_replace('#'.$prefix_data['prefix_special'].'_titlefield#', $new_value, $title);
}
}
}
// 2. replace phrases if any found in format string
$title = $this->Application->ReplaceLanguageTags($title,false);
// 3. find and replace any replacement vars
preg_match_all('/#(.*_.*)#/Uis',$title,$rets);
if($rets[1])
{
$replacement_vars = array_keys( array_flip($rets[1]) );
foreach($replacement_vars as $replacement_var)
{
$var_info = explode('_',$replacement_var,2);
$object =& $objects[ $var_info[0] ];
$new_value = $this->getInfo($object,$var_info[1]);
$title = str_replace('#'.$replacement_var.'#', $new_value, $title);
}
}
$cut_first = getArrayValue($params,'cut_first');
if( $cut_first && strlen($title) > $cut_first && !preg_match('/<a href="(.*)">(.*)<\/a>/',$title) ) $title = substr($title, 0, $cut_first).' ...';
return $title;
}
function getInfo(&$object, $info_type)
{
switch ($info_type)
{
case 'titlefield':
$field = $this->Application->getUnitOption($object->Prefix,'TitleField');
return $field !== false ? $object->GetField($field) : 'TitleField Missing';
break;
case 'recordcount':
$of_phrase = $this->Application->Phrase('la_of');
return $object->NoFilterCount != $object->RecordsCount ? $object->RecordsCount.' '.$of_phrase.' '.$object->NoFilterCount : $object->RecordsCount;
break;
default:
break;
}
}
/**
* Parses block depending on its element type.
* For radio and select elements values are taken from 'value_list_field' in key1=value1,key2=value2
* format. key=value can be substituted by <SQL>SELECT f1 AS OptionName, f2 AS OptionValue... FROM <PREFIX>TableName </SQL>
* where prefix is TABLE_PREFIX
*
* @param Array $params
* @return string
*/
function ConfigFormElement($params)
{
$object =& $this->getObject($params);
$field = $params['field'];
$helper =& $this->Application->recallObject('InpCustomFieldsHelper');
$element_type = $object->GetDBField($params['element_type_field']);
if($element_type == 'label') $element_type = 'text';
$params['name'] = $params['blocks_prefix'].$element_type;
switch($element_type)
{
case 'select':
case 'radio':
$field_options = $object->GetFieldOptions($field, 'options');
$field_options['options'] = $helper->GetValuesHash( $object->GetDBField($params['value_list_field']) );
$object->SetFieldOptions($field, $field_options);
break;
case 'textarea':
$params['field_params'] = $helper->ParseConfigSQL($object->GetDBField($params['value_list_field']));
break;
case 'password':
case 'text':
case 'checkbox':
default:
break;
}
return $this->Application->ParseBlock($params, 1);
}
/**
* Get's requested custom field value
*
* @param Array $params
* @return string
* @access public
*/
function CustomField($params)
{
$params['name'] = 'cust_'.$this->SelectParam($params, 'name,field');
return $this->Field($params);
}
function CustomFieldLabel($params)
{
$object =& $this->getObject($params);
$field = $this->SelectParam($params, 'name,field');
$sql = 'SELECT FieldLabel
FROM '.$this->Application->getUnitOption('cf', 'TableName').'
WHERE FieldName = '.$this->Conn->qstr($field);
return $this->Application->Phrase($this->Conn->GetOne($sql));
}
/**
* transposes 1-dimensional array elements for vertical alignment according to given columns and per_page parameters
*
* @param array $arr
* @param int $columns
* @param int $per_page
* @return array
*/
function LinearToVertical(&$arr, $columns, $per_page)
{
$rows=$columns;
$cols=min(ceil($per_page/$columns), ceil(sizeof($arr)/$columns));
$imatrix=array();
for ($row=0; $row<$rows; $row++) {
for ($col=0; $col<$cols; $col++){
$imatrix[$col*$rows+$row]=$arr[$row*$cols+$col];
}
}
ksort($imatrix);
reset($imatrix);
return $imatrix;
}
/**
* If data was modfied & is in TempTables mode, then parse block with name passed;
* remove modification mark if not in TempTables mode
*
* @param Array $params
* @return string
* @access public
* @author Alexey
*/
function SaveWarning($params)
{
$main_prefix = getArrayValue($params, 'main_prefix');
if ($main_prefix && $main_prefix != '$main_prefix') {
$top_prefix = $main_prefix;
}
else {
$top_prefix = $this->Application->GetTopmostPrefix($this->Prefix);
}
$temp_tables = $this->Application->GetVar($top_prefix.'_mode') == 't';
$modified = $this->Application->RecallVar($top_prefix.'_modified');
if ($temp_tables && $modified) {
$block_params = $this->prepareTagParams($params);
$block_params['name'] = $this->SelectParam($params, 'render_as,name');
$block_params['edit_mode'] = $temp_tables ? 1 : 0;
return $this->Application->ParseBlock($block_params);
}
$this->Application->RemoveVar($top_prefix.'_modified');
return '';
}
/**
* Returns list record count queries (on all pages)
*
* @param Array $params
* @return int
*/
function TotalRecords($params)
{
$list =& $this->GetList($params);
if (!$list->Counted) $list->CountRecs();
return $list->RecordsCount;
}
/**
* Range filter field name
*
* @param Array $params
* @return string
*/
function SearchInputName($params)
{
$field = $this->SelectParam($params, 'field,name');
$append = getArrayValue($params, 'type') ? '_'.$params['type'] : '';
return 'custom_filters['.$this->getPrefixSpecial().']['.$field.$append.']';
}
/**
* Return range filter field value
*
* @param Array $params
* @return string
*/
function SearchField($params) // RangeValue
{
$field = $this->SelectParam($params, 'field,name');
$custom_filters = $this->Application->RecallVar($this->getPrefixSpecial().'_custom_filters');
$custom_filters = $custom_filters ? unserialize($custom_filters) : Array();
$append = getArrayValue($params, 'type');
return getArrayValue($custom_filters, $field.( $append ? '_'.$append : '') );
}
function SearchFormat($params)
{
$field = $params['field'];
$object =& $this->GetList($params);
$options = $object->GetFieldOptions($field);
$format = $options[ $this->SelectParam($params, 'input_format') ? 'input_format' : 'format' ];
$formatter_class = getArrayValue($options,'formatter');
if($formatter_class)
{
$formatter =& $this->Application->recallObject($formatter_class);
$human_format = getArrayValue($params,'human');
$edit_size = getArrayValue($params,'edit_size');
$sample = getArrayValue($params,'sample');
if($sample)
{
return $formatter->GetSample($field, $options, $object);
}
elseif($human_format || $edit_size)
{
$format = $formatter->HumanFormat($format);
return $edit_size ? strlen($format) : $format;
}
}
return $format;
}
/**
* Returns error of range field
*
* @param unknown_type $params
* @return unknown
*/
function SearchError($params)
{
$field = $this->SelectParam($params, 'field,name');
$error_var_name = $this->getPrefixSpecial().'_'.$field.'_'.$params['type'].'_error';
$error_msg = $this->Application->RecallVar($error_var_name);
if($error_msg)
{
$this->Application->StoreVar($error_var_name, '');
}
$object =& $this->Application->recallObject($this->Prefix.'.'.$this->Special.'-item', null, Array('skip_autoload' => true));
return $object->ErrorMsgs[$error_msg];
}
/**
* Returns templates path for module, which is gathered from prefix module
*
* @param Array $params
* @return string
* @author Alex
*/
function ModulePath($params)
{
$force_module = getArrayValue($params, 'module');
- if($force_module)
- {
- $force_module = strtolower($force_module);
+ if ($force_module) {
+ if ($force_module == '#session#') {
+ $force_module = $this->Application->RecallVar('module');
+ }
+ else {
+ $force_module = strtolower($force_module);
+ }
+
$module_folder = trim( $this->Conn->GetOne('SELECT Path FROM '.TABLE_PREFIX.'Modules WHERE LOWER(Name) = '.$this->Conn->qstr($force_module) ), '/');
}
- else
- {
+ else {
$module_folder = $this->Application->getUnitOption($this->Prefix, 'ModuleFolder');
}
return '../../'.$module_folder.'/admin_templates/';
}
/**
* Returns object used in tag processor
*
* @access public
* @return kDBBase
*/
function &getObject($params = Array())
{
$object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix, $params);
return $object;
}
/**
* Checks if object propery value matches value passed
*
* @param Array $params
* @return bool
*/
function PropertyEquals($params)
{
$object =& $this->getObject($params);
$property_name = $this->SelectParam($params, 'name,var,property');
return $object->$property_name == $params['value'];
}
/**
* Group list records by header, saves internal order in group
*
* @param Array $records
* @param string $heading_field
*/
function groupRecords(&$records, $heading_field)
{
$sorted = Array();
$i = 0; $record_count = count($records);
while ($i < $record_count) {
$sorted[ $records[$i][$heading_field] ][] = $records[$i];
$i++;
}
$records = Array();
foreach ($sorted as $heading => $heading_records) {
$records = array_merge_recursive($records, $heading_records);
}
}
}
?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.49.2/core/kernel/db/db_tag_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.49.2.1
\ No newline at end of property
+1.49.2.2
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.8.2/kernel/units/configuration/configuration_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.8.2/kernel/units/configuration/configuration_config.php (revision 4410)
+++ branches/unlabeled/unlabeled-1.8.2/kernel/units/configuration/configuration_config.php (revision 4411)
@@ -1,61 +1,61 @@
<?php
$config = Array(
'Prefix' => 'conf',
'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
'EventHandlerClass' => Array('class'=>'ConfigurationEventHandler','file'=>'configuration_event_handler.php','build_event'=>'OnBuild'),
'TagProcessorClass' => Array('class'=>'ConfigurationTagProcessor','file'=>'configuration_tag_processor.php','build_event'=>'OnBuild'),
'AutoLoad' => true,
'Hooks' => Array(),
'QueryString' => Array(
1 => 'id',
2 => 'page',
3 => 'event',
),
'IDField' => 'VariableName',
'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!"),
),
'TableName' => TABLE_PREFIX.'ConfigurationValues',
'ListSQLs' => Array(''=>'SELECT * FROM '.TABLE_PREFIX.'ConfigurationAdmin LEFT JOIN '.TABLE_PREFIX.'ConfigurationValues Using(VariableName) '),
'ItemSQLs' => Array(''=>'SELECT * FROM '.TABLE_PREFIX.'ConfigurationAdmin LEFT JOIN '.TABLE_PREFIX.'ConfigurationValues Using(VariableName) '),
'ListSortings' => Array(
'' => Array(
'Sorting' => Array('DisplayOrder' => 'asc'),
)
),
'SubTables' => Array(),
'Fields' => Array(
'VariableName' => Array('type' => 'string','not_null' => '1','default' => ''),
'VariableValue' => array('type'=>'string', 'default'=>''),
'ModuleOwner' => array('type'=>'string', 'default'=>'In-Portal'),
'Section' => array('type'=>'string','not_null' => '1','default'=>''),
),
'VirtualFields' => Array(
'heading' => Array('type' => 'string','default' => ''),
'prompt' => Array('type' => 'string','default' => ''),
'element_type' => Array('type' => 'string','not_null' => '1','default' => ''),
'validation' => Array('type' => 'string','default' => ''),
'ValueList' => Array('type' => 'string','default' => ''),
'DisplayOrder' => Array('type' => 'int','not_null' => '1','default' => '0'),
'Install' => Array('type' => 'int','not_null' => '1','default' => '1'),
),
'Grids' => Array(),
);
?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.8.2/kernel/units/configuration/configuration_config.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.8
\ No newline at end of property
+1.8.2.1
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.8.2/core/units/configuration/configuration_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.8.2/core/units/configuration/configuration_config.php (revision 4410)
+++ branches/unlabeled/unlabeled-1.8.2/core/units/configuration/configuration_config.php (revision 4411)
@@ -1,61 +1,61 @@
<?php
$config = Array(
'Prefix' => 'conf',
'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
'EventHandlerClass' => Array('class'=>'ConfigurationEventHandler','file'=>'configuration_event_handler.php','build_event'=>'OnBuild'),
'TagProcessorClass' => Array('class'=>'ConfigurationTagProcessor','file'=>'configuration_tag_processor.php','build_event'=>'OnBuild'),
'AutoLoad' => true,
'Hooks' => Array(),
'QueryString' => Array(
1 => 'id',
2 => 'page',
3 => 'event',
),
'IDField' => 'VariableName',
'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!"),
),
'TableName' => TABLE_PREFIX.'ConfigurationValues',
'ListSQLs' => Array(''=>'SELECT * FROM '.TABLE_PREFIX.'ConfigurationAdmin LEFT JOIN '.TABLE_PREFIX.'ConfigurationValues Using(VariableName) '),
'ItemSQLs' => Array(''=>'SELECT * FROM '.TABLE_PREFIX.'ConfigurationAdmin LEFT JOIN '.TABLE_PREFIX.'ConfigurationValues Using(VariableName) '),
'ListSortings' => Array(
'' => Array(
'Sorting' => Array('DisplayOrder' => 'asc'),
)
),
'SubTables' => Array(),
'Fields' => Array(
'VariableName' => Array('type' => 'string','not_null' => '1','default' => ''),
'VariableValue' => array('type'=>'string', 'default'=>''),
'ModuleOwner' => array('type'=>'string', 'default'=>'In-Portal'),
'Section' => array('type'=>'string','not_null' => '1','default'=>''),
),
'VirtualFields' => Array(
'heading' => Array('type' => 'string','default' => ''),
'prompt' => Array('type' => 'string','default' => ''),
'element_type' => Array('type' => 'string','not_null' => '1','default' => ''),
'validation' => Array('type' => 'string','default' => ''),
'ValueList' => Array('type' => 'string','default' => ''),
'DisplayOrder' => Array('type' => 'int','not_null' => '1','default' => '0'),
'Install' => Array('type' => 'int','not_null' => '1','default' => '1'),
),
'Grids' => Array(),
);
?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.8.2/core/units/configuration/configuration_config.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.8
\ No newline at end of property
+1.8.2.1
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.37.2/core/kernel/processors/main_processor.php
===================================================================
--- branches/unlabeled/unlabeled-1.37.2/core/kernel/processors/main_processor.php (revision 4410)
+++ branches/unlabeled/unlabeled-1.37.2/core/kernel/processors/main_processor.php (revision 4411)
@@ -1,876 +1,876 @@
-<?php
-
-class kMainTagProcessor extends TagProcessor {
-
- function Init($prefix,$special)
- {
- parent::Init($prefix,$special);
-
- $actions =& $this->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 <base href ..> 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 '<base href="'.$url.'" />';
- }
-
- /**
- * 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<br>";
- }
- else
- echo "Object $name does not exist in the appliaction<br>";
- }*/
-
- /**
- * 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)
- {
- // <inp2:m_SetParam param="custom_name" src="cf:FieldName"/>
- 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]<br>";
- $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 .= "<input type='hidden' name='$name' id='$name' value='$val'>\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 .= "<input type='hidden' name='sid' id='sid' value='$sid'>\n";
- }
- }
- else {
- $o .= "<input type='hidden' name='env' id='env' value='$env'>\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('\'', '&#39;', $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 '<script type="text/javascript" src="'.PROTOCOL.SERVER_NAME.BASE_PATH.'/kernel3/js/grid.js"></script>';
- }*/
-
-
- /*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 = \'<tr>\';
- $o.= \'<td>a\'.$params[\'param1\'].\'</td>\';
- $o.= \'<td>a\'.$params[\'param2\'].\'</td>\';
- $o.= \'<td>a\'.$params[\'param3\'].\'</td>\';
- $o.= \'<td>a\'.$params[\'param4\'].\'</td>\';
- $o.= \'</tr>\';
- 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 '<script type="text/javascript">'.$after_script.'</script>';
- }
- 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');
- }
-}
-
-
-?>
+<?php
+
+class kMainTagProcessor extends TagProcessor {
+
+ function Init($prefix,$special)
+ {
+ parent::Init($prefix,$special);
+
+ $actions =& $this->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 <base href ..> 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 '<base href="'.$url.'" />';
+ }
+
+ /**
+ * 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<br>";
+ }
+ else
+ echo "Object $name does not exist in the appliaction<br>";
+ }*/
+
+ /**
+ * 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)
+ {
+ // <inp2:m_SetParam param="custom_name" src="cf:FieldName"/>
+ 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]<br>";
+ $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 .= "<input type='hidden' name='$name' id='$name' value='$val'>\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 .= "<input type='hidden' name='sid' id='sid' value='$sid'>\n";
+ }
+ }
+ else {
+ $o .= "<input type='hidden' name='env' id='env' value='$env'>\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('\'', '&#39;', $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 '<script type="text/javascript" src="'.PROTOCOL.SERVER_NAME.BASE_PATH.'/kernel3/js/grid.js"></script>';
+ }*/
+
+
+ /*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 = \'<tr>\';
+ $o.= \'<td>a\'.$params[\'param1\'].\'</td>\';
+ $o.= \'<td>a\'.$params[\'param2\'].\'</td>\';
+ $o.= \'<td>a\'.$params[\'param3\'].\'</td>\';
+ $o.= \'<td>a\'.$params[\'param4\'].\'</td>\';
+ $o.= \'</tr>\';
+ 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 '<script type="text/javascript">'.$after_script.'</script>';
+ }
+ 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');
+ }
+}
+
+
+?>
Property changes on: branches/unlabeled/unlabeled-1.37.2/core/kernel/processors/main_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.37.2.1
\ No newline at end of property
+1.37.2.2
\ No newline at end of property

Event Timeline