Code

Phonequeues won't detect themselfes as used phonenumber
[gosa.git] / html / helpviewer.php
index 74f0af861a08d0bc4b38dc874b385868c7be8d84..308500d0aa1da9fe7d56d1980ffc71a401a197a9 100644 (file)
 require_once ("../include/php_setup.inc");
 require_once ("functions.inc");
 require_once ("functions_helpviewer.inc");
+header("Content-type: text/html; charset=UTF-8");
 
 session_start ();
 error_reporting(E_ALL);
 
-/* Logged in? Simple security check */
-if (!isset($_SESSION['ui'])){
-  gosa_log ("Error: helpviewer.php called without session");
-  echo "<b>"._("Help is not available if you are not logged in.")."</b>";
-  exit;
-}
-
-/* Set template compile directory */
-$config= $_SESSION['config'];
-if (isset ($config->data['MAIN']['COMPILE'])){
-  $smarty->compile_dir= $config->data['MAIN']['COMPILE'];
-} else {
-  $smarty->compile_dir= '/var/spool/gosa/';
-}
-
 /* Language setup */
 if ($config->data['MAIN']['LANG'] == ""){
   $lang= get_browser_language();
@@ -61,6 +47,22 @@ bindtextdomain($domain, "$BASE_DIR/locale");
 textdomain($domain);
 @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $lang, "Setting language to");
 
+
+/* Logged in? Simple security check */
+if (!isset($_SESSION['ui'])){
+  gosa_log ("Error: helpviewer.php called without session");
+  echo "<b>"._("Help is not available if you are not logged in.")."</b>";
+  exit;
+}
+
+/* Set template compile directory */
+$config= $_SESSION['config'];
+if (isset ($config->data['MAIN']['COMPILE'])){
+  $smarty->compile_dir= $config->data['MAIN']['COMPILE'];
+} else {
+  $smarty->compile_dir= '/var/spool/gosa/';
+}
+
 /* Get plugin list */
 $plist= $_SESSION['plist'];
 
@@ -77,32 +79,48 @@ $suffix                       = ".html";                            // Suffix of
 $maxresults                   = 10;                                 // max number of results shown in result list
 $minwordlength                = 3;                                  // Word less than 3 chars will be dropped in search
 $allowed_chars_in_searchword  = "'[^a-z0-9 %_-]'i";                 // Remove all chars that would disturb our search like < or > ...
-$pre_mark                     = "<b><u><i>" ;                       // Sign words with this
-$suf_mark                     = "</i></u></b>";                     //  and this
+$pre_mark                     = "<span style=\"background-color: #FFFC35;\">" ;                       // Sign words with this
+$suf_mark                     = "</span>";                          //  and this
+$backwardlink                 = "<a href=\"?pg=%s\"  class=\"maintitlebar\">
+                                  <img src='images/back.png' align=\"middle\" alt=\""._("previous")."\" border=\"0\">
+                                 </a>";
 
-$error_collector= "";
-set_error_handler('gosaRaiseError');
+$forwardlink                 = "<a href=\"?pg=%s\"  class=\"maintitlebar\">
+                                  <img src='images/forward.png' align=\"middle\" alt=\""._("next")."\" border=\"0\">
+                                 </a>";
 
 /* Define which tags musst be delete, header, navigation, banner */
 $replacements=array();
 $replacements['from']=array("@<!DOC.*<BODY >@si",
-    "@<DIV[^>]*?>.*?DIV>@si",
+    "/border=\".*\"/i",
     "'<code.*code>'",
+//    "/alt=\".*\"/i",
     "/<HR>/",
     "@<ADDRESS[^>]*?>.*?ADDRESS>@si",
     "@<\/BODY[^>]*?>.*?HTML>@si",
     "'<TABLE.*>'",
     "/src.*icons/i",
-    "/<H1 ALIGN=\"CENTER\">/");
+    "/src=\"/i",
+    "/<H1 ALIGN=\"CENTER\">/",
+ /* picture replacements */
+ //  "",
+    );
+
+
 $replacements['to']=array("",
+    " border=\"0\" ",
     "",
+  //  "",
     "",
     "",
     "",
-    "",
-    "<table border=1 cellspacing=0 bgcolor=\"#E0E0E0\" width=\"95%\" align=\"center\" cellpadding=\"3\">",
-    "src=\"images",
-    "<H1>");
+    "<table border=1 cellspacing=0 bgcolor=\"#E0E0E0\" width=\"95%\" align=\"center\" cellpadding=\"3\" summary=\"\">",
+    "src=\"",
+    "src=\"images/",
+    "<H1>",
+ /* picture replacements */
+//    "",
+  );
 
 
 /* Default pages */
@@ -150,9 +168,9 @@ if(!file_exists(HELP_BASEDIR."/en/manual_gosa_en/")){
     $res = search($arr,$keyword); 
 
     /* Tell smarty which pages to use for backward forwa.. */
-    $smarty->assign("backward",$backward);
+    $smarty->assign("backward","");
     $smarty->assign("index"   ,$index);
-    $smarty->assign("forward" ,$forward);
+    $smarty->assign("forward" ,"");
 
     /* Tell smarty the Keyword, to show it in the input field again */
     $smarty->assign("search_string",$keyword);
@@ -197,7 +215,7 @@ if(!file_exists(HELP_BASEDIR."/en/manual_gosa_en/")){
     }else{
       $page = $defaultpage;
     }
-
+    
     /* test if this page exists, in our array of files */
     if((!isset($helppages[$page]))&&($page!=$defaultpage))
     {
@@ -220,10 +238,7 @@ if(!file_exists(HELP_BASEDIR."/en/manual_gosa_en/")){
         $backward = $bck;
       }
 
-      /* forward exists ?*/
-      if((isset($helppages[$fck])))  {
-        $forward  = $fck;
-      }
+      $forward  = $fck;
     }
 
     $help_contents=readfiles($helpdir,$prefix,$suffix,false,$page);
@@ -232,17 +247,26 @@ if(!file_exists(HELP_BASEDIR."/en/manual_gosa_en/")){
     if(isset($_GET['mark'])){
       $marks = ($_SESSION['lastresults']) ; 
       $help_contents = markup_page($help_contents[$page]['content'],$marks[$page]);
-      $help_contents=remove_unwanted_tags($help_contents,$replacements);  
+      $help_contents=$help_contents;  
     }else{
-      $help_contents=remove_unwanted_tags($help_contents[$page]['content'],$replacements);
+      $help_contents=$help_contents[$page]['content'];
     }
 
     $smarty->assign("help_contents",$help_contents);
 
     /* Define our own navigation pages */
-    $smarty->assign("backward",$backward);
+    if($page == $defaultpage){
+      $smarty->assign("backward","");
+    }else{
+      $smarty->assign("backward",sprintf($backwardlink,$backward));
+    }
     $smarty->assign("index"   ,$index);
-    $smarty->assign("forward" ,$forward);
+  
+    if(!(isset($helppages[$forward]))){
+      $smarty->assign("forward","");
+    }else{
+      $smarty->assign("forward",sprintf($forwardlink,$forward));
+    }
 
     /* show some errors */
     if (isset($_SESSION['errors'])){