Index: trunk/globals.php =================================================================== diff -u -r289 -r302 --- trunk/globals.php (.../globals.php) (revision 289) +++ trunk/globals.php (.../globals.php) (revision 302) @@ -884,23 +884,19 @@ { global $objCountCache, $objItemTypes; - if(is_numeric($ItemName)) - { - $item = $objItemTypes->GetItem($ItemName); - } - else - $item = $objItemTypes->GetTypeByName($ItemName); - if(is_object($item)) - { - $ItemType = $item->Get("ItemType"); + if(is_numeric($ItemTypeName)) + $item = $objItemTypes->GetItem($ItemTypeName); + else + $item = $objItemTypes->GetTypeByName($ItemTypeName); + + if(is_object($item)) + { + $ItemType = $item->Get("ItemType"); - $sql = "DELETE FROM ".$objCountCache->SourceTable." WHERE ItemType=$ItemType"; - if(is_numeric($ListType)) - { - $sql .= " AND ListType=$ListType"; - } - $objCountCache->adodbConnection->Execute($sql); - } + $sql = "DELETE FROM ".$objCountCache->SourceTable." WHERE ItemType=$ItemType"; + if( is_numeric($ListType) ) $sql .= " AND ListType=$ListType"; + $objCountCache->adodbConnection->Execute($sql); + } } function UpdateModifiedCategoryCount($ItemTypeName,$CatId=NULL,$Modifier=0,$ExtraId=NULL) @@ -1362,4 +1358,41 @@ } +// functions for dealign with enviroment variable construction +function GenerateModuleEnv($prefix, $var_list) +{ + // globalize module varible arrays + $main =& $GLOBALS[$prefix.'_var_list']; + $update =& $GLOBALS[$prefix.'_var_list_update']; + + //echo "VAR: [$main]; VAR_UPDATE: [$update]
"; + + // enshure that we have no empty values in enviroment variable + foreach($update as $vl_key => $vl_value) + if(!$vl_value) $update[$vl_key] = '0'; // unset($update[$vl_key]); + + // if update var count is zero, then do nothing + if(count($update) == 0) return ''; + + foreach($main as $vl_key => $vl_value) + if(!$vl_value) $main[$vl_key] = '0'; // unset($main[$vl_key]); + + $ret = Array(); + foreach($var_list as $var_name) + $ret[] = GetEnvVar($prefix, $var_name); + + return ':'.$prefix.implode('-',$ret); +} + +function GetEnvVar($prefix, $name) +{ + // get variable from template variable's list + // (used in module parsers to build env string) + $main =& $GLOBALS[$prefix.'_var_list']; + $update =& $GLOBALS[$prefix.'_var_list_update']; + return isset($update[$name]) ? $update[$name] : ( isset($main[$name]) ? $main[$name] : ''); +} + + + ?>