[Fusionforge-commits] r14451 - trunk/src/www/admin

Alain Peyrat aljeux at fusionforge.org
Tue Sep 20 18:37:46 CEST 2011


Author: aljeux
Date: 2011-09-20 18:37:46 +0200 (Tue, 20 Sep 2011)
New Revision: 14451

Modified:
   trunk/src/www/admin/admin_utils.php
Log:
More live checks on admin pages.

Modified: trunk/src/www/admin/admin_utils.php
===================================================================
--- trunk/src/www/admin/admin_utils.php	2011-09-20 16:37:43 UTC (rev 14450)
+++ trunk/src/www/admin/admin_utils.php	2011-09-20 16:37:46 UTC (rev 14451)
@@ -20,18 +20,36 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-function site_admin_header($params, $required_perm = 'forge_admin') {
-	session_require_global_perm ($required_perm);
+function check_system() {
+	$result = array();
 
 	if (version_compare(PHP_VERSION, '5.1.0', '<')) {
-		$GLOBALS['warning_msg'] = 'WARNING: Your php version must not be lower than 5.1.0, please upgrade';
+		$result[] = 'WARNING: Your php version must not be lower than 5.1.0, please upgrade';
 	}
 	if (get_magic_quotes_gpc()) {
-		$GLOBALS['warning_msg'] = 'WARNING: Your installation is running with php magic_quotes_gpc ON, please change to OFF';
+		$result[] = 'ERROR: Your installation is running with PHP magic_quotes_gpc ON, please change to OFF';
 	}
 	if (ini_get('register_globals')) {
-		$GLOBALS['warning_msg'] = 'WARNING: Your installation is running with php register_globals ON, this is very unsecure, please change to OFF';
+		$result[] = 'ERROR: Your installation is running with PHP register_globals ON, this is very unsecure, please change to OFF';
 	}
+	if (util_ini_get_bytes('post_max_size') < 8*1024*1024) {
+		$result[] = 'WARNING: PHP value "post_max_size" is low, recommended is at least 8M';
+	}
+	if (util_ini_get_bytes('upload_max_filesize') < 8*1024*1024) {
+		$result[] = 'WARNING: PHP value "upload_max_filesize" is low, recommended is at least 8M';
+	}
+	if (!function_exists("pg_pconnect")) {
+		$result[] = 'ERROR: Missing Postgresql support in PHP, please install/compile php-pg.';
+	}
+	return $result;
+}
+
+function site_admin_header($params, $required_perm = 'forge_admin') {
+	session_require_global_perm ($required_perm);
+
+	if ($msg = check_system()) {
+		$GLOBALS['warning_msg'] = join('<br/> ', $msg);
+	}
 	site_header($params);
 }
 




More information about the Fusionforge-commits mailing list