diff --git a/html/main.php b/html/main.php
index d1a76442770b90d23d7bf4c13f78856b745ff6a2..8743d378c3ce95928156212ba1c7d0ef2c08fd71 100644 (file)
--- a/html/main.php
+++ b/html/main.php
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* This will be removed... */
-function raiseError($errno, $errstr, $errfile, $errline)
-{
- gosa_log ("PHP error: $errstr ($errfile, line $errline)");
-}
-
-#set_error_handler('raiseError');
-/* This will be removed */
-
/* Basic setup, remove eventually registered sessions */
$timing= array();
require_once ("../include/php_setup.inc");
/* 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!"));
}
}
/* 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'));
$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"){
if (isset($_SESSION['errors'])){
$smarty->assign("errors", $_SESSION['errors']);
}
-$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 */
+ $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 "<table width=\"100%\" style='background-color:#E0E0E0;border-bottom:1px solid black'><tr><td><img alt=\"\" align=\"middle\" src='images/warning.png'> <font style='font-size:14px;font-weight:bold'>"._("Generating this page caused the W3C conformance checker to raise some errors!")."</font></td><td align=right><button onClick='toggle(\"w3cbox\")'>"._("Toggle information")."</button></td></tr></table><div id='w3cbox' style='width:100%; position:absolute; z-index:0; visibility: hidden; background-color:white; border-bottom:1px solid black;'>";
+
+ echo 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: