File["gl_knbr"]) { $rresult = $entry->GetRateResult(); if(($rate=Communication::ReadParameter("h",-1))!= -1) { $html = str_replace("","
".$LZLANG["client_feedback_success"]."
",$html); $entry->SaveRateResult($rate); } else { $entry->RegisterView(); $bhtml = "&h=MQ__\"> &h=MA__\">"; $fhtml = ($rresult[0] > 0) ? str_replace("",$rresult[0],str_replace("",$rresult[1],$LZLANG["client_found_helpful"]))." " : ""; $html = str_replace("","

" . $fhtml . $LZLANG["client_was_helpful"]." ".$bhtml." 
",$html); } } else $html = str_replace("","",$html); if($entry->Type == 1) $html = str_replace("",$entry->Value,$html); else if($entry->Type == 2) $html = str_replace("","",$html); else if($entry->Type == 3) { $url = LIVEZILLA_URL . "getfile.php?id=" . $entry->Id . "&file=" . $entry->Title; header("Location: " . $url); die(); } $html = str_replace("",$color,$html); $html = str_replace(array("",""),$entry->Title,$html); $html = str_replace("",$_GET["id"],$html); } } else { $html = IOStruct::GetFile(PATH_TEMPLATES . "kb_main.tpl"); if(!isset($_GET["no-logo"])) { $html = str_replace("",base64_decode(Server::$Configuration->File["gl_kbth"]),$html); $html = str_replace("",base64_decode(Server::$Configuration->File["gl_kbtf"]),$html); } else { $html = str_replace("",IOStruct::GetFile(PATH_TEMPLATES . "kb_header.tpl"),$html); $html = str_replace("",IOStruct::GetFile(PATH_TEMPLATES . "kb_footer.tpl"),$html); } if(!isset($_GET["search-for"])) $_GET["search-for"] = ""; $eq = Communication::ReadParameter("eq",""); if(empty($_GET["search-for"]) && !empty($eq)) $_GET["search-for"] = $eq; $html = str_replace("",htmlentities($_GET["search-for"],ENT_QUOTES,"UTF-8"),$html); if(!isset($_GET["no-logo"])) $html = str_replace("","File["gl_cali"]."\" border=\"0\">",$html); if(empty($_GET["article"])) { $html = str_replace("",getSearchContent(),$html); $html = str_replace("",getNavigation(null),$html); } else { $entry = KnowledgeBaseEntry::GetById(Communication::ReadParameter("article",""),true); if($entry == null) $entry = KnowledgeBaseEntry::GetById($_GET["article"],true); $html = str_replace("",getArticleContent($entry),$html); $html = str_replace("",getNavigation($entry),$html); } $html = str_replace("",$color,$html); $html = str_replace("",KnowledgeBase::GetAllowedParameters("form",array(0=>"search-for")),$html); } exit(Server::Replace($html)); function getLink($_getParams,$_title,$_exclude=null) { $params = KnowledgeBase::GetAllowedParameters("get",$_exclude); $url = "knowledgebase.php?s=MQ__"; if(!empty($params)) $url .= "&" . $params; if(!empty($_getParams)) $url .= $_getParams; $link = ";\" href=\"".$url."\">".$_title.""; return $link; } function getNavigation($entry){ $content =""; if(isset($_GET["tops"]) && $entry !=null) { $content = getLink("",LocalizationManager::$TranslationStrings["client_most_popular"],array(0=>"search-for")); $content .= ""no-logo",1=>"tops"))."\">" . LocalizationManager::$TranslationStrings["client_kb_browse_all"] . ""; } else if($entry!=null) { $link = getLink("&article=","",array(0=>"search-for")); $navline = ""; $currentNode = $entry; if($entry->IsPublic && $entry->Type == 0) $navline .= $entry->Title; while($currentNode->ParentId != "" && $currentNode->ParentId != 1) { $parent = new KnowledgeBaseEntry(); $parent->Load($currentNode->ParentId); if($parent->IsPublic && $parent->Type == 0) $navline = str_replace("",Encoding::Base64UrlEncode($parent->Id),str_replace("",$parent->Title,$link)) . (!empty($navline) ? " / " : "") . $navline; $currentNode = $parent; } $content = getLink("","",array(0=>"search-for")) . ((!empty($navline)) ? " / " . $navline : ""); } return "
" . $content . "
"; } function getArticleContent($entry){ $html = ""; if(!empty($entry)) { if($entry->Type != 0) { $html = IOStruct::GetFile(PATH_TEMPLATES . "kb_entry_v2.tpl"); if(Server::$Configuration->File["gl_knbr"]) $html = str_replace("",getFooterBox($entry),$html); else $html = str_replace("","",$html); if($entry->Type == 1) $html = str_replace("",$entry->Value,$html); else if($entry->Type == 2) $html = str_replace("","",$html); else if($entry->Type == 3) { $url = LIVEZILLA_URL . "getfile.php?id=" . $entry->Id . "&file=" . $entry->Title; header("Location: " . $url); die(); } } else { $html = getFolderContent($entry->Id,false); } $html = str_replace(array("",""),$entry->Title,$html); $html = str_replace("",$_GET["article"],$html); } return $html; } function getFolderContent($root,$_fullView){ $result=$content =""; $matches=array(); $tops=false; if($_fullView) { if(isset($_GET["tops"])) { $matches = KnowledgeBase::GetTOPEntries($root,Visitor::$BrowserLanguage); $tops = count($matches)>0; } if(count($matches)==0) $matches = KnowledgeBase::GetEntries($root,Visitor::$BrowserLanguage); if(count($matches)==0) $matches = KnowledgeBase::GetEntries($root); if(count($matches)>0) { foreach($matches as $match) { $res = IOStruct::GetFile(PATH_TEMPLATES . "kb_result_category_v2.tpl"); if($match->Id == 1) $title = htmlentities($match->Title,ENT_NOQUOTES,"UTF-8"); else { $title = getLink("&article=" . Encoding::Base64UrlEncode($match->Id),htmlentities($match->Title,ENT_NOQUOTES,"UTF-8"),array(0=>"search-for")); $title = str_replace("","",$title); } if($tops) $title .= ""no-logo",1=>"tops"))."\">" . LocalizationManager::$TranslationStrings["client_kb_browse_all"] . ""; $res = str_replace("",$title,$res); $res = str_replace("",$match->Id,$res); $entries = ""; $childcount = 0; if(!empty($match->ChildNodes)) { foreach($match->ChildNodes as $child) { $entries .= $child->GetHTML(null,false,true,"v2"); $childcount++; } } $res = str_replace("","false",$res); $res = str_replace("",$entries,$res); if($childcount>0) $result .= $res; } $main = $result; } } else { $rootEntry = new KnowledgeBaseEntry(); $rootEntry->Load($root); $rootEntry->LoadChildNodes("",true,Visitor::$BrowserLanguage); if(count($rootEntry->ChildNodes)==0) $rootEntry->LoadChildNodes("",true); $matches = $rootEntry->ChildNodes; $main = IOStruct::GetFile(PATH_TEMPLATES . "kb_result_category_v2.tpl"); $main = str_replace("",$rootEntry->Id,$main); $main = str_replace("",htmlentities($rootEntry->Title,ENT_NOQUOTES,"UTF-8"),$main); $entries = ""; if(count($matches)>0) foreach($matches as $match) $entries .= $match->GetHTML(null,false,true,"v2"); $main = str_replace("","false",$main); $main = str_replace("",$entries,$main); } if(!empty($main)) $content .= Server::Replace($main,true,false,false,false); else $content .= "
".LocalizationManager::$TranslationStrings["client_kb_no_entries"]."
" . $result; return $content; } function doOpenExternal() { $kbonly = isset($_REQUEST["p_kbo"]); return !empty(Server::$Configuration->File["gl_kbin"]) && !$kbonly; } function getSearchContent(){ $query = !empty($_GET["search-for"]) ? $_GET["search-for"] : '%ALL%'; $root = Communication::ReadParameter("ckf",""); $content = ""; $result = $navcats = ""; if($query == "%ALL%") { $content = getFolderContent($root,true); } else if(strlen($query)>=Server::$Configuration->File["gl_kbml"]) { $matches = KnowledgeBase::GetMatches($root,$query,Visitor::$BrowserLanguage,false,true); KnowledgeBase::ReqisterQuery($query,new VisitorBrowser("","")); if(count($matches)>0) { foreach($matches as $match) $result .= $match->GetHTML(null,false,true,"v2"); $res = IOStruct::GetFile(PATH_TEMPLATES . "kb_result_category_v2.tpl"); $res = str_replace("","\"".Str::Cut(htmlentities($query,ENT_NOQUOTES,"UTF-8"),50,true)."\"",$res); $res = str_replace("",$result,$res); $res = str_replace("","true",$res); $res = str_replace("","sr",$res); $content .= "
".str_replace("",count($matches),LocalizationManager::$TranslationStrings["client_kb_results_found"]) . "
" . $res; } else $content .= "
".LocalizationManager::$TranslationStrings["client_search_no_result"]."
"; } else $content .= "
".LocalizationManager::$TranslationStrings["client_search_no_result"]."
"; $content = str_replace("_chat_","_",$content); return $content; } function getFooterBox($_entry) { global $LZLANG; Server::InitDataBlock(array("INTERNAL","GROUPS")); if(($rate=Communication::ReadParameter("h",-1))!= -1) { $bhtml = "
".$LZLANG["client_feedback_success"]."
"; $_entry->SaveRateResult($rate); } else { $bhtml = "
" . getLink("&article=&h=MQ__#bottom","") . getLink("&article=&h=MA__#bottom","") ."
"; $_entry->RegisterView(); } $result = $_entry->GetRateResult(); $html = IOStruct::GetFile(PATH_TEMPLATES . "kb_entry_footer.tpl"); if(isset(Server::$Operators[$_entry->EditorId])) $html = str_replace("",Server::$Operators[$_entry->EditorId]->Fullname,$html); else $html = str_replace("","
",$html); $html = str_replace("",urlencode($_entry->EditorId),$html); $html = str_replace("",$_entry->Edited,$html); $html = str_replace("",(isset(Server::$Configuration->File["gl_knsa"]) && empty(Server::$Configuration->File["gl_knsa"])) ? "hidden" : "visible",$html); $fhtml = ($result[0] > 0) ? str_replace("",$result[0],str_replace("",$result[1],$LZLANG["client_found_helpful"]))." " : ""; $html = str_replace("",$fhtml . $bhtml."",$html); return $html; } ?>