Code

Added error handler
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 10 Jun 2005 07:38:00 +0000 (07:38 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 10 Jun 2005 07:38:00 +0000 (07:38 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@645 594d385d-05f5-0310-b6e9-bd551577e9d8

html/helpviewer.php
ihtml/themes/default/help.tpl

index a9a26825ae6019ab772c90d81d645e91b24a4890..741ce53a6120e0be33071bac6c67dbabbe1c6d9f 100644 (file)
@@ -70,7 +70,6 @@ My PART ^^
 ##################
  */
 
-set_error_handler("myone");
 $helpdir                      = HELP_BASEDIR."/en/manual_gosa_en/"; // Folder to use for help files
 $defaultpage                  = "index.html";                       // alternative file, shown on error, or on first call
 $prefix                       = "node";                             // Prefix of the generated help files 
@@ -81,31 +80,27 @@ $allowed_chars_in_searchword  = "'[^a-z0-9 %_-]'i";                 // Remove al
 $pre_mark                     = "<b><u><i>" ;                       // Sign words with this
 $suf_mark                     = "</i></u></b>";                     //  and this
 
-// Only for testing delete this if everything works fine
-function myone($par1,$par2,$par3,$par3)
-{
-  print "<br>Seite : ".$par1."<br>Name : ".$par2."<br>Seite : ".$par3."<br>Zeile : ".$par3;
-}
-
+$error_collector= "";
+set_error_handler('gosaRaiseError');
 
 /* Define which tags musst be delete, header, navigation, banner */
 $replacements=array();
 $replacements['from']=array("@<!DOC.*<BODY >@si",
-                            "@<DIV[^>]*?>.*?DIV>@si",
-                            "'<code.*code>'",
-                            "/<HR>/",
-                            "@<ADDRESS[^>]*?>.*?ADDRESS>@si",
-                            "@<\/BODY[^>]*?>.*?HTML>@si",
-                            "'<TABLE.*>'",
-                            "/<H1 ALIGN=\"CENTER\">/");
+    "@<DIV[^>]*?>.*?DIV>@si",
+    "'<code.*code>'",
+    "/<HR>/",
+    "@<ADDRESS[^>]*?>.*?ADDRESS>@si",
+    "@<\/BODY[^>]*?>.*?HTML>@si",
+    "'<TABLE.*>'",
+    "/<H1 ALIGN=\"CENTER\">/");
 $replacements['to']=array("",
-                          "",
-                          "",
-                          "",
-                          "",
-                          "",
-                          "<table border=1 cellspacing=0 bgcolor=\"#E0E0E0\" width=\"95%\" align=\"center\" cellpadding=\"3\">",
-                          "<H1>");
+    "",
+    "",
+    "",
+    "",
+    "",
+    "<table border=1 cellspacing=0 bgcolor=\"#E0E0E0\" width=\"95%\" align=\"center\" cellpadding=\"3\">",
+    "<H1>");
 
 
 /* Default pages */
@@ -124,15 +119,14 @@ if(!file_exists(HELP_BASEDIR."/en/manual_gosa_en/")){
   $smarty->assign("forward" ,"");
   $smarty->assign("search_string","");
   $smarty->assign("help_contents","<br>".sprintf(_("Can't read any helpfiles from ' %s ', possibly there is no help available."),HELP_BASEDIR."/en/manual_gosa_en/"));
-  
+
   /* Output html ...*/
   $header= "<!-- headers.tpl-->".$smarty->fetch(get_template_path('headers.tpl'));
   $display= $header.$smarty->fetch(get_template_path('help.tpl'));
   echo $display;
 
-
 }else{  
-    
+
   /* We prepare to search, all Document for the given keyword */
   if(isset($_POST['search'])){
 
@@ -164,6 +158,16 @@ if(!file_exists(HELP_BASEDIR."/en/manual_gosa_en/")){
     /* Create result list */
     $smarty->assign("help_contents",searchlist($arr,$res,$maxresults));
 
+    /* show some errors */
+    if (isset($_SESSION['errors'])){
+      $smarty->assign("errors", $_SESSION['errors']);
+    }
+    if ($error_collector != ""){
+      $smarty->assign("php_errors", $error_collector."</div>");
+    } else {
+      $smarty->assign("php_errors", "");
+    }
+
     /* Output html ...*/
     $header= "<!-- headers.tpl-->".$smarty->fetch(get_template_path('headers.tpl'));
     $display= $header.$smarty->fetch(get_template_path('help.tpl'));
@@ -178,7 +182,7 @@ if(!file_exists(HELP_BASEDIR."/en/manual_gosa_en/")){
     if(!isset($_SESSION['search_string'])){
       $_SESSION['search_string']="";
     }
-      
+
 
     $smarty->assign("search_string",$_SESSION['search_string']);
 
@@ -238,6 +242,16 @@ if(!file_exists(HELP_BASEDIR."/en/manual_gosa_en/")){
     $smarty->assign("index"   ,$index);
     $smarty->assign("forward" ,$forward);
 
+    /* show some errors */
+    if (isset($_SESSION['errors'])){
+      $smarty->assign("errors", $_SESSION['errors']);
+    }
+    if ($error_collector != ""){
+      $smarty->assign("php_errors", $error_collector."</div>");
+    } else {
+      $smarty->assign("php_errors", "");
+    }
+
     /* Fill page */
     $header= "<!-- headers.tpl-->".$smarty->fetch(get_template_path('headers.tpl'));
     $display= $header.$smarty->fetch(get_template_path('help.tpl'));
index f009f8e1b831f863c89526a69842bd3491609397..f1c188fefa1a7b0ebefea904b64a14bd1c3543dc 100644 (file)
@@ -1,4 +1,5 @@
 <body style='background-color:white;background-image:none'>
+{$php_errors}
 <form action='helpviewer.php' name='mainform' method='post' enctype='multipart/form-data'>
 <div style='background-color:#CDF6BD;width:100%;border-bottom:1px solid #909090'>
   <table width="99%">