[Fusionforge-commits] r10120 - in trunk/src: common/include www/include www/themes/css

Alain Peyrat aljeux at libremir.placard.fr.eu.org
Thu Jun 24 22:35:57 CEST 2010


Author: aljeux
Date: 2010-06-24 22:35:56 +0200 (Thu, 24 Jun 2010)
New Revision: 10120

Added:
   trunk/src/common/include/extras-debug.php
Modified:
   trunk/src/www/include/pre.php
   trunk/src/www/themes/css/fusionforge.css
Log:
Display all errors directly on the page for non development or integration env.

Added: trunk/src/common/include/extras-debug.php
===================================================================
--- trunk/src/common/include/extras-debug.php	                        (rev 0)
+++ trunk/src/common/include/extras-debug.php	2010-06-24 20:35:56 UTC (rev 10120)
@@ -0,0 +1,58 @@
+<?php
+
+// error handler function
+function ffErrorHandler($errno, $errstr, $errfile, $errline)
+{
+	global $ffErrors;
+
+	if (!isset($ffErrors))
+		$ffErrors = array();
+
+	$msg = "[$errno] $errstr ($errfile at $errline)";
+
+	// Display messages only once.
+	foreach ($ffErrors as $m) {
+		if ($m['message'] == $msg)
+			return true;
+	}
+
+	switch ($errno) {
+		case E_USER_ERROR:
+			$type = 'error';
+			break;
+
+		case E_USER_WARNING:
+			$type = 'warning';
+			break;
+
+		case E_USER_NOTICE:
+			$type = 'notice';
+			break;
+
+		default:
+			$type = 'unknown';
+			break;
+	}
+	
+	$ffErrors[] = array('type' => $type, 'message' => $msg);
+	/* Don't execute PHP internal error handler */
+	return true;
+}
+
+
+function ffErrorDisplay() {
+	global $ffErrors;
+
+	if (isset($ffErrors) && $ffErrors) {
+		echo '<div id="ffErrors">';
+		foreach ($ffErrors as $msg) {
+			echo '<div class="'.$msg['type'].'">'.$msg['message'].'</div>'."\n";
+		}
+		echo '</div>';
+	}
+}
+
+// set to the user defined error handler
+set_error_handler("ffErrorHandler");
+
+register_shutdown_function('ffErrorDisplay');

Modified: trunk/src/www/include/pre.php
===================================================================
--- trunk/src/www/include/pre.php	2010-06-24 19:54:39 UTC (rev 10119)
+++ trunk/src/www/include/pre.php	2010-06-24 20:35:56 UTC (rev 10120)
@@ -114,6 +114,11 @@
 	}
 }
 
+// Load extra func to add extras func like debug
+if ($sys_install_type == 'development' || $sys_install_type == 'integration') {
+	require $gfcommon.'include/extras-debug.php';
+}
+
 // Get constants used for flags or status
 require $gfcommon.'include/constants.php';
 

Modified: trunk/src/www/themes/css/fusionforge.css
===================================================================
--- trunk/src/www/themes/css/fusionforge.css	2010-06-24 19:54:39 UTC (rev 10119)
+++ trunk/src/www/themes/css/fusionforge.css	2010-06-24 20:35:56 UTC (rev 10120)
@@ -338,3 +338,25 @@
     background-image:url('../../images/widget/widget-preview-project_svn-stats.png');
 }
 /* }}} */
+
+#ffErrors {
+	z-index: 10;
+	position: absolute;
+	top: 10px;
+	left: 10px;
+	right: 10px;
+	opacity: 0.9;
+	color: black;
+    font-weight: bold;
+    border-width: 2px;
+    border-style: solid;
+    background-color: #ffc0cb; /* pink */
+    border-color: red;
+    padding: 0.5em;
+}
+
+#ffErrors .error {
+    border-width: 0px;
+    padding: 0px;
+	color: red;
+}




More information about the Fusionforge-commits mailing list