Code

added summary tag and fixed empty href for helplink
[gosa.git] / html / main.php
index c73b24a8f39cc44f7f30cc39d091f35db7f4b008..492b3478c2af0ac3009f5d85b54f751ea0391eda 100644 (file)
@@ -24,10 +24,6 @@ require_once ("../include/php_setup.inc");
 require_once ("functions.inc");
 header("Content-type: text/html; charset=UTF-8");
 
-/* Reset error handler */
-$error_collector= "";
-set_error_handler('gosaRaiseError');
-
 /* Find all class files and include them */
 get_dir_list("$BASE_DIR/plugins");
 
@@ -212,7 +208,7 @@ if ($_SESSION['js']==FALSE){
   $smarty->assign("help_method", "href='helpviewer.php$plug' target='_new'");
 } else {
   $smarty->assign("javascript", "true");
-  $smarty->assign("help_method","href='' onclick=\"return popup('helpviewer.php$plug','GOsa help');\"");
+  $smarty->assign("help_method"," onclick=\"return popup('helpviewer.php$plug','GOsa help');\"");
 }
 
 $smarty->assign ("username", $ui->username);
@@ -279,23 +275,25 @@ if ($error_collector != ""){
 } else {
   $smarty->assign("php_errors", "");
 }
-$smarty->assign("w3c", "");
 $display= $header.$smarty->fetch(get_template_path('framework.tpl'));
 
 /* For development, perform a W3C conformance check if specified in gosa.conf */
-if (isset($config->data['MAIN']['W3CTEST'])) {
-  $fp = fopen("/tmp/gosa.html","w+");
-  fwrite($fp, $display, strlen($display));
-  $url= $config->data['MAIN']['W3CTEST'];
-  $str = shell_exec( "curl -F uploaded_file=@/tmp/gosa.html $url/check");
-  if(!preg_match("/This Page Is Valid/i",$str )){
-    /* Show errors */
-    echo $str;
-  } else {
-    /* Re-render page with W3C logo */
-    $smarty->assign("w3c", "<a href=\"$url/check?uri=referer\"><img alt=\"\" border=\"0\" src=\"$url/images/vh401.png\" alt=\"Valid HTML 4.01!\" height=\"31\" width=\"88\"></a>");
-    $display= $header.$smarty->fetch(get_template_path('framework.tpl'));
+if (isset($config->data['MAIN']['W3CTEST']) && preg_match('/true/i', $config->data['MAIN']['W3CTEST'])) {
+
+  /* Use PHP tidy for debugging */
+  // Specify configuration
+
+  $tidy = new tidy();
+  $config = array('indent' => TRUE,
+               'output-xhtml' => TRUE,
+               'wrap' => 200);
+  $display = tidy_parse_string($display, $config, 'UTF8');
+  tidy_clean_repair($display);
+  $cnt =  (tidy_error_count($display))+(tidy_warning_count($display));
+  if($cnt != 0){
+    echo "<div style='background:#FFFFFF;'>".nl2br(htmlentities($display->errorBuffer))."</div>";
   }
+  tidy_clean_repair($display);
 }
 
 /* Show page... */