function KnowledgeBase()
 {
     $this->Entries = KnowledgeBase::GetEntries();
 }
 Server::InitDataBlock(array("INTERNAL", "GROUPS"));
 VisitorChat::ApplyDynamicGroup($externalUser->Browsers[0]);
 $externalUser->Browsers[0]->Load();
 if ($externalUser->Browsers[0]->Status == CHAT_STATUS_OPEN && IS_FILTERED && !FILTER_ALLOW_CHATS && !FILTER_ALLOW_TICKETS) {
     $error = buildLoginErrorField();
     $externalUser->AddFunctionCall("lz_chat_release(true,'" . $error . "');", false);
 } else {
     if ($_POST[POST_EXTERN_SERVER_ACTION] == "search_kb") {
         $query = Communication::ReadParameter("p_q", "");
         $color = ExternalChat::ReadTextColor();
         $catcount = 0;
         $main = $result = $navcats = "";
         if ($query == "%ALL%") {
             $matches = KnowledgeBase::GetEntries(Visitor::$BrowserLanguage);
             if (count($matches) == 0) {
                 $matches = KnowledgeBase::GetEntries();
             }
             if (count($matches) > 0) {
                 foreach ($matches as $match) {
                     $res = IOStruct::GetFile(PATH_TEMPLATES . "kb_result_category.tpl");
                     $res = str_replace("<!--title-->", htmlentities($match->Title, ENT_QUOTES, "UTF-8"), $res);
                     $res = str_replace("<!--id-->", $match->Id, $res);
                     $res = str_replace("<!--color-->", $color, $res);
                     $entries = "";
                     $childcount = 0;
                     if (!empty($match->ChildNodes)) {
                         foreach ($match->ChildNodes as $child) {
                             if ($child->Type != 0) {
                                 $entries .= $child->GetHTML($color);
                                 $childcount++;
                             }