Code

added summary tag and fixed empty href for helplink
[gosa.git] / html / main.php
index cd8cfa3da08fdbebd57bc0a7325de51078273138..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");
 
@@ -83,9 +79,6 @@ setlocale(LC_ALL, $lang);
 $GLOBALS['t_language']= $lang;
 $GLOBALS['t_gettext_message_dir'] = $BASE_DIR.'/locale/';
 
-/* Dummy */
-trigger_error("I'm a fake error. Please ignore me.", E_USER_NOTICE);
-
 /* Set the text domain as 'messages' */
 $domain = 'messages';
 bindtextdomain($domain, "$BASE_DIR/locale");
@@ -142,7 +135,7 @@ eval_sizelimit();
 
 /* Check for memory */
 if (function_exists("memory_get_usage")){
-  if (memory_get_usage() > (to_byte(ini_get('memory_limit')) - 1024000 )){
+  if (memory_get_usage() > (to_byte(ini_get('memory_limit')) - 2048000 )){
     print_red(_("Warning: memory is getting low - please increase the memory_limit!"));
   }
 }
@@ -205,11 +198,19 @@ if(isset($_SESSION['POST'])){
 /* show web frontend */
 $smarty->assign ("date", date("l, dS F Y H:i:s O"));
 $smarty->assign ("must", "<font class=\"must\">*</font>");
+if (isset($plug)){
+  $plug= "?plug=$plug";
+} else {
+  $plug= "";
+}
 if ($_SESSION['js']==FALSE){
   $smarty->assign("javascript", "false");
+  $smarty->assign("help_method", "href='helpviewer.php$plug' target='_new'");
 } else {
   $smarty->assign("javascript", "true");
+  $smarty->assign("help_method"," onclick=\"return popup('helpviewer.php$plug','GOsa help');\"");
 }
+
 $smarty->assign ("username", $ui->username);
 $smarty->assign ("go_logo", get_template_path('images/go_logo.png'));
 $smarty->assign ("go_base", get_template_path('images/dtree.png'));
@@ -221,12 +222,10 @@ $smarty->assign ("go_left", get_template_path('images/go_left.png'));
 $smarty->assign ("go_help", get_template_path('images/help.png'));
 $plist->gen_menu();
 $smarty->assign ("menu", $plist->menu);
-if (isset($plug)){
-  $smarty->assign ("plug", "?plug=$plug");
-} else {
-  $smarty->assign ("plug", "");
-}
-$smarty->display(get_template_path('headers.tpl'));
+$smarty->assign ("plug", "$plug");
+
+$header= "<!-- headers.tpl-->".$smarty->fetch(get_template_path('headers.tpl'));
+
 
 /* React on clicks */
 if ($_SERVER["REQUEST_METHOD"] == "POST"){
@@ -271,8 +270,36 @@ $smarty->assign("contents", $display);
 if (isset($_SESSION['errors'])){
   $smarty->assign("errors", $_SESSION['errors']);
 }
-$smarty->assign("php_errors", $error_collector);
-$smarty->display(get_template_path('framework.tpl'));
+if ($error_collector != ""){
+  $smarty->assign("php_errors", $error_collector."</div>");
+} else {
+  $smarty->assign("php_errors", "");
+}
+$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']) && 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... */
+echo $display;
+
+/* Save plist */
 $_SESSION['plist']= $plist;
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: