[Fusionforge-commits] r11666 - in branches/Branch_5_1/src: common/include www/register

Roland Mas lolando at libremir.placard.fr.eu.org
Mon Nov 29 15:21:05 CET 2010


Author: lolando
Date: 2010-11-29 15:21:05 +0100 (Mon, 29 Nov 2010)
New Revision: 11666

Modified:
   branches/Branch_5_1/src/common/include/config-vars.php
   branches/Branch_5_1/src/www/register/index.php
Log:
Convert project auto-approval to config API, and don't try to send mail when auto-approval is on

Modified: branches/Branch_5_1/src/common/include/config-vars.php
===================================================================
--- branches/Branch_5_1/src/common/include/config-vars.php	2010-11-29 13:56:36 UTC (rev 11665)
+++ branches/Branch_5_1/src/common/include/config-vars.php	2010-11-29 14:21:05 UTC (rev 11666)
@@ -29,6 +29,9 @@
 forge_set_config_item_bool ('user_registration_restricted', 'core') ;
 forge_define_config_item ('project_registration_restricted', 'core', $GLOBALS['sys_project_reg_restricted']) ;
 forge_set_config_item_bool ('project_registration_restricted', 'core') ;
+forge_define_config_item ('project_auto_approval', 'core', false) ;
+forge_set_config_item_bool ('project_auto_approval', 'core') ;
+forge_define_config_item ('project_auto_approval_user', 'core', 'admin') ;
 forge_define_config_item ('web_host', 'core', $GLOBALS['sys_default_domain']) ;
 forge_define_config_item ('apache_user', 'core', $GLOBALS['sys_apache_user']) ;
 forge_define_config_item ('apache_group', 'core', $GLOBALS['sys_apache_group']) ;

Modified: branches/Branch_5_1/src/www/register/index.php
===================================================================
--- branches/Branch_5_1/src/www/register/index.php	2010-11-29 13:56:36 UTC (rev 11665)
+++ branches/Branch_5_1/src/www/register/index.php	2010-11-29 14:21:05 UTC (rev 11666)
@@ -79,10 +79,12 @@
 			}
 		}
 
-		if ( !$purpose && ($sys_project_reg_autoapprove == true) ) {
+		if ( !$purpose && forge_get_config ('project_auto_approval') ) {
 			$purpose = 'No purpose given, autoapprove was on';
 		}
 
+		$send_mail = ! forge_get_config ('project_auto_approval') ;
+
 		$group = new Group();
 		$u =& session_get_user();
 		$res = $group->create(
@@ -93,7 +95,8 @@
 			$purpose,
 			'shell1',
 			$scm_host,
-			$is_public
+			$is_public,
+			$send_mail
 		);
 		if ($res && forge_get_config('use_scm') && $plugin) {
 			$group->setUsesSCM (true) ;
@@ -108,14 +111,14 @@
 		} else {
 			$HTML->header(array('title'=>_('Registration complete')));
 
-			if ( $sys_project_reg_autoapprove != true ) {
+			if ( ! forge_get_config ('project_auto_approval') ) {
 				printf(_('<p>Your project has been submitted to the %1$s administrators. Within 72 hours, you will receive notification of their decision and further instructions.<p/>Thank you for choosing %1$s</p>'), forge_get_config ('forge_name'));
 			} else if ($group->isError()) {
 				printf(_('<div class="error">ERROR: %1$s</div>'), $group->getErrorMessage() );
 			} else {
 				printf(_('Approving Project: %1$s'), $group->getUnixName()).'<br />';
 
-				if (!$group->approve( user_get_object_by_name ( $sys_project_reg_autoapprove_user ) ) ) {
+				if (!$group->approve( user_get_object_by_name ( forge_get_config ('project_auto_approval_user') ) ) ) {
 					printf(_('<div class="error">Approval ERROR: %1$s</div>'), $group->getErrorMessage() );
 				} else {
 					printf(_('<p>Your project has been automatically approved.  You should receive an email containing further information shortly.<p/>Thank you for choosing %1$s</p>'), forge_get_config ('forge_name'));
@@ -156,7 +159,7 @@
 
 <?php
 // Don't display Project purpose if auto approval is on, because it won't be used.
-if ( $sys_project_reg_autoapprove != true ) {
+if ( !forge_get_config ('project_auto_approval') ) {
 	$index++;
 	echo '<h3>'.$index.'. '._('Project Purpose And Summarization').'</h3>';
 	echo '<p>';




More information about the Fusionforge-commits mailing list