Index: trunk/kernel/parser.php =================================================================== diff -u -r898 -r904 --- trunk/kernel/parser.php (.../parser.php) (revision 898) +++ trunk/kernel/parser.php (.../parser.php) (revision 904) @@ -366,13 +366,13 @@ $form = $attribs["_form"]; $field = strtolower($attribs["_field"]); // $field = $attribs["_field"]; - - if(isset($_POST[$field]) && $attribs['_forgetvalue'] != 1) + $value=''; + if(isset($_POST[$field]) && getArrayValue($attribs,'_forgetvalue') != 1) { $value = inp_htmlize($_POST[$field],1); } else { - if ($attribs['_forgetvalue'] != 1) { + if (getArrayValue($attribs,'_forgetvalue') != 1 && getArrayValue($FormValues[$form],$field) ) { $value = inp_htmlize($FormValues[$form][$field]); } } @@ -386,7 +386,7 @@ $ret = ""; if($attribs["_required"]) $ret .= ""; - if($attribs["_custom"]) + if(getArrayValue($attribs,'_custom')) $ret .= ""; } return $ret; @@ -561,7 +561,7 @@ { $ret .= ""; } - if($attribs["_custom"]) + if(getArrayValue($attribs,'_custom')) { $ret .= ""; } @@ -583,10 +583,10 @@ $html_attribs = ExtraAttributes($attribs); $field = $attribs["_field"]; $form = $attribs["_form"]; - $TypesAllowed = $attribs["_imagetypes"]; - $isthumb = (int)$attribs["_thumbnail"]; - $imgname = $attribs["_imagename"]; - $maxsize = $attribs["_maxsize"]; + $TypesAllowed = getArrayValue($attribs,'_imagetypes'); + $isthumb = (int)getArrayValue($attribs,'_thumbnail'); + $imgname = getArrayValue($attribs,'_imagename'); + $maxsize = getArrayValue($attribs,'_maxsize'); $ret = ""; $ret .= ""; @@ -653,7 +653,7 @@ //echo $f."
"; //echo $t."
"; // echo "
"; print_r($FormError); echo "
"; - if(is_array($FormError[$f])) + if( getArrayValue($FormError,$f) && is_array($FormError[$f])) { foreach($FormError[$f] as $e) { @@ -771,7 +771,7 @@ { global $var_list, $var_list_update, $m_var_list_update, $objSession, $objConfig, $objCatList; - $target_template = $attribs["_template"]; + $target_template = getArrayValue($attribs,'_template'); if(strlen($target_template)) { $var_list_update["t"] = $target_template; @@ -792,12 +792,12 @@ else { $ret = GetIndexURL(2)."?env=" . BuildEnv()."&Action=m_login"; - if($attribs["_successtemplate"]) + if(getArrayValue($attribs,'_successtemplate')) { $ret .= "&dest=".$attribs["_successtemplate"]; } else - if(strlen($var_list["dest"])) + if(getArrayValue($var_list,'dest')) $ret .= "&dest=".$var_list["dest"]; } break; @@ -1181,7 +1181,7 @@ $CurrentTheme = $objThemes->GetItem($m_var_list["theme"]); $theme_url = "http://". ThisDomain().$objConfig->Get("Site_Path")."themes/".$CurrentTheme->Get("Name")."/"; - if($attribs["_page"]) + if(getArrayValue($attribs,'_page')) { if ($attribs["_page"] != 'current') { @@ -1218,7 +1218,7 @@ global $objConfig, $objCatList; $ret = $objConfig->Get("Site_Name"); - if($attribs["_fullpath"] || $attribs["_currentcategory"]) + if(getArrayValue($attribs,'_fullpath') || getArrayValue($attribs,'_currentcategory')) { $CurrentCat = $objCatList->CurrentCategoryID(); if((int)$CurrentCat>0) @@ -1336,7 +1336,7 @@ $sql = "SELECT * FROM ".GetTablePrefix()."Language WHERE Enabled=1"; $objLanguages->Clear(); $objLanguages->Query_Item($sql); - + $o=''; if($objLanguages->NumItems()>0) { foreach($objLanguages->Items as $l) @@ -1382,7 +1382,7 @@ if(!strlen($attribs["_field"])) return ""; - $lang = $attribs["_lang"]; + $lang = getArrayValue($attribs,'_lang'); if(!strlen($lang)) { $LangId = $objSession->Get("Language"); @@ -1474,11 +1474,11 @@ $cols = $attribs["_columns"]; if($cols<1) $cols =1; - $CategoryId = $attribs["_catid"]; + $CategoryId = getArrayValue($attribs,'_catid'); if(!is_numeric($CategoryId)) $CategoryId = $objCatList->CurrentCategoryID(); - $cat_count = (int)$attribs["_maxlistcount"]; + $cat_count = (int)getArrayValue($attribs,'_maxlistcount'); /* validation */ if(strlen($attribs["_itemtemplate"])==0) { @@ -2043,7 +2043,7 @@ { global $objCatList, $objSession; - $permission = $attribs["_perm"]; + $permission = getArrayValue($attribs,'_perm'); $o = ""; $tpath = GetModuleArray("template"); if(strlen($permission)) @@ -2090,10 +2090,10 @@ $o = " "; - $text = $attribs["_text"]; + $text = getArrayValue($attribs,'_text'); if(!strlen($text)) { - $text = $attribs["_plaintext"]; + $text = getArrayValue($attribs,'_plaintext'); if(!strlen($text)) { if(strlen($attribs["_image"])) @@ -2222,14 +2222,14 @@ { global $var_list, $var_list_update, $m_var_list_update, $objCatList; - $template = $attribs["_template"]; + $template = getArrayValue($attribs,'_template'); - $query = trim($attribs["_query"]); + $query = trim( getArrayValue($attribs,'_query') ); $query = !ereg("^&", $query)? "&$query" : $query; if(!strlen($template)) $template = $var_list["t"]; - $cat = $attribs["_category"]; + $cat = getArrayValue($attribs,'_category'); $var_list_update["t"] = $template; if(strlen($cat)) @@ -2247,7 +2247,7 @@ $link_type = getArrayValue($attribs,'_relative') ? 0 : 2; $ret = GetIndexURL($link_type)."?env=".BuildEnv().$query; - if(strlen($attribs["_anchor"])) + if(strlen(getArrayValue($attribs,'_anchor'))) $ret .= "#".$attribs["_anchor"]; unset($var_list_update["t"]); if(strlen($cat)) @@ -2272,7 +2272,7 @@ { global $var_list, $var_list_update, $m_var_list_update, $objCatList, $objSession; - $cat = $attribs["_category"]; + $cat = getArrayValue($attribs,'_category'); if(strlen($cat)) { if($cat=="NULL") @@ -2340,7 +2340,7 @@ $ret = GetIndexURL(2)."?env=".BuildEnv(); unset($var_list_update["t"]); - if(strlen($dest)) + if(isset($dest)&&$dest) $ret .= "&dest=$dest"; return $ret; } @@ -2559,7 +2559,7 @@ global $objCatList; $ret = ""; - $catid = (int)$attribs["_catid"]; + $catid = (int)getArrayValue($attribs,'_catid'); $field = $attribs["_field"]; if(!$catid) $catid = $objCatList->CurrentCategoryID(); @@ -2575,7 +2575,7 @@ $ret = $cat->ParseObject($element); } } - if($attribs["_striphtml"]) + if(getArrayValue($attribs,'_striphtml')) $ret = strip_tags($ret); return $ret; } @@ -2592,7 +2592,7 @@ $ado = &GetADODBConnection(); - if($attribs["_local"] && $objCatList->CurrentCategoryID() != 0) + if(getArrayValue($attribs,'_local') && $objCatList->CurrentCategoryID() != 0) { $c =& $objCatList->GetItem($objCatList->CurrentCategoryID()); $catlist = $c->GetSubCatIds(); @@ -2610,7 +2610,7 @@ $mod = $rs->fields["ModDate"]; if($mod) { - $part = strtolower($attribs["_part"]); + $part = strtolower(getArrayValue($attribs,'_part')); if(strlen($part)) { $ret = ExtractDatePart($part,$mod); @@ -2637,10 +2637,11 @@ $IncludeList = explode(",",trim($attribs["_modules"])); $tpath = GetModuleArray("template"); + $ret=''; for($inc=0;$incCurrentCategoryID(); @@ -2762,10 +2761,9 @@ */ function m_related_count($attribs) { - global $objItemTypes, $objCatList, $content_set; + global $objItemTypes, $objCatList, $content_set, $CatRelations; + $cat = getArrayValue($attribs,'_catid'); - $cat = $attribs["_catid"]; - if(!is_numeric($cat)) { $cat = $objCatList->CurrentCategoryID(); @@ -2782,7 +2780,7 @@ LoadRelatedItems($Related, $CatRelations, $c->Get("ResourceId")); } - $item_type = $attribs["_itemtype"]; + $item_type = getArrayValue($attribs,'_itemtype'); if(strlen($item_type)) { $objType = $objItemTypes->GetTypeByName($item_type); @@ -2793,7 +2791,7 @@ else $TargetType=""; } - + $count=0; if($CatRelations->NumItems()>0) { for($x=0;$x<$CatRelations->NumItems();$x++) @@ -2880,14 +2878,14 @@ $Bit_Global = 4; $Bit_SubCats=8; - if($attribs["_categorycount"]) + if(getArrayValue($attribs,'_categorycount')) { $evar = m_BuildEnv(); } else $evar = ""; - $cat = $attribs["_catid"]; + $cat = getArrayValue($attribs,'_catid'); if(!is_numeric($cat)) { $cat = $objCatList->CurrentCategoryID(); @@ -3444,4 +3442,13 @@ return GetRegionalOption($attribs['_name']); } +/*function m_object($attribs=Array()) +{ + $element = new clsHtmlTag(); + $element->name=$attribs['_prefix']; + $element->attributes = $attribs; + $ret = $cat->ParseObject($element); +}*/ + + ?>