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

Franck VILLAUME nerville at libremir.placard.fr.eu.org
Mon Sep 20 15:03:02 CEST 2010


Author: nerville
Date: 2010-09-20 15:03:02 +0200 (Mon, 20 Sep 2010)
New Revision: 10556

Modified:
   trunk/src/www/admin/approve-pending.php
   trunk/src/www/admin/database.php
   trunk/src/www/admin/groupdelete.php
   trunk/src/www/admin/groupedit.php
   trunk/src/www/admin/massmail.php
Log:
exit functions migration

Modified: trunk/src/www/admin/approve-pending.php
===================================================================
--- trunk/src/www/admin/approve-pending.php	2010-09-20 10:04:48 UTC (rev 10555)
+++ trunk/src/www/admin/approve-pending.php	2010-09-20 13:03:02 UTC (rev 10556)
@@ -3,21 +3,22 @@
  * Site Admin page for approving/rejecting new projects
  *
  * Copyright 1999-2001 (c) VA Linux Systems
+ * Copyright 2010 (c) Franck Villaume - Capgemini
  *
- * This file is part of GForge.
+ * This file is part of FusionForge.
  *
- * GForge is free software; you can redistribute it and/or modify
+ * FusionForge is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * GForge is distributed in the hope that it will be useful,
+ * FusionForge is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with GForge; if not, write to the Free Software
+ * along with FusionForge; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
@@ -39,23 +40,24 @@
 
 function activate_group($group_id) {
 	global $feedback;
+	global $error_msg;
 
 	$group =& group_get_object($group_id);
 
 	if (!$group || !is_object($group)) {
-		$feedback .= _('Error creating group object').'<br />';
+		$error_msg .= _('Error creating group object');
 		return false;
 	} else if ($group->isError()) {
-		$feedback .= $group->getErrorMessage().'<br />';
+		$error_msg .= $group->getErrorMessage();
 		return false;
 	}
 
 
 	if ($group->approve(session_get_user())) {
-		$feedback .= sprintf(_('Approving Project: %1$s'), $group->getUnixName()).'<br />';
+		$feedback .= sprintf(_('Approving Project: %1$s'), $group->getUnixName());
 	} else {
-		$feedback .= sprintf(_('Error when approving Project: %1$s'), $group->getUnixName()).'<br />';
-		$feedback .= $group->getErrorMessage().'<br />';
+		$error_msg .= sprintf(_('Error when approving Project: %1$s'), $group->getUnixName()).'<br />';
+		$error_msg .= $group->getErrorMessage();
 		return false;
 	}
 
@@ -95,14 +97,11 @@
 	if (!$group || !is_object($group)) {
 		exit_no_group();
 	} elseif ($group->isError()) {
-		exit_error('Error',$group->getErrorMessage());
+		exit_error($group->getErrorMessage(),'admin');
 	}
 
 	if (!$group->setStatus(session_get_user(), 'D')) {
-		exit_error(
-			_('Error during group rejection'),
-			$this->getErrorMessage()
-		);
+		exit_error(_('Error during group rejection: ').$this->getErrorMessage(),'admin');
 	}
 
 	$group->addHistory('rejected', 'x');

Modified: trunk/src/www/admin/database.php
===================================================================
--- trunk/src/www/admin/database.php	2010-09-20 10:04:48 UTC (rev 10555)
+++ trunk/src/www/admin/database.php	2010-09-20 13:03:02 UTC (rev 10556)
@@ -10,21 +10,22 @@
  *   - register existing database in system
  *
  * Copyright 1999-2001 (c) VA Linux Systems
+ * Copyright 2010 (c) Franck Villaume - Capgemini
  *
- * This file is part of GForge.
+ * This file is part of FusionForge.
  *
- * GForge is free software; you can redistribute it and/or modify
+ * FusionForge is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * GForge is distributed in the hope that it will be useful,
+ * FusionForge is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with GForge; if not, write to the Free Software
+ * along with FusionForge; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
@@ -34,7 +35,7 @@
 require_once $gfwww.'admin/admin_utils.php';
 
 if (!forge_get_config('use_project_database')) {
-	exit_disabled();
+	exit_disabled('home');
 }
 
 session_require_global_perm ('forge_admin');
@@ -50,16 +51,16 @@
 		if (!$group || !is_object($group)) {
             exit_no_group();
 		} elseif ($group->isError()) {
-			exit_error('Error',$group->getErrorMessage());
+			exit_error($group->getErrorMessage(),'home');
 		}
 		
 		$group_id = $group->getID();
 
 		$user =& session_get_user();
 		if (!$user || !is_object($user)) {
-			exit_error('Error','Could Not Get User');
+			exit_error(_('Could Not Get User'),'home');
 		} elseif ($user->isError()) {
-			exit_error('Error',$u->getErrorMessage());
+			exit_error($u->getErrorMessage(),'home');
 		}
 
 
@@ -74,17 +75,13 @@
 				$user->getID()));
 
 		if (!$res || db_affected_rows($res) < 1) {
-			$feedback .= _('Error Adding Database') .db_error();
+			$error_msg .= _('Error Adding Database: ') .db_error();
 		} else {
 			$feedback .= _('Project'). " <em>".$group->getUnixName()."</em>" ._('added already active database');
 		}
-
 	} else {
-
-		$feedback .=	"<strong>" ._('Unable to insert already active database.'). "</strong>";
-
+		$error_msg .= _('Unable to insert already active database.');
 	}
-
 }
 
 site_admin_header(array('title'=>_('Site Admin: Groups\' DB Maintenance')));

Modified: trunk/src/www/admin/groupdelete.php
===================================================================
--- trunk/src/www/admin/groupdelete.php	2010-09-20 10:04:48 UTC (rev 10555)
+++ trunk/src/www/admin/groupdelete.php	2010-09-20 13:03:02 UTC (rev 10556)
@@ -3,21 +3,22 @@
  * Site Admin group properties editing page
  *
  * Copyright 1999-2001 (c) VA Linux Systems
+ * Copyright 2010 (c) Franck Villaume - Capgemini
  *
- * This file is part of GForge.
+ * This file is part of FusionForge.
  *
- * GForge is free software; you can redistribute it and/or modify
+ * FusionForge is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * GForge is distributed in the hope that it will be useful,
+ * FusionForge is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with GForge; if not, write to the Free Software
+ * along with FusionForge; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
@@ -34,7 +35,7 @@
 if (!$group || !is_object($group)) {
     exit_no_group();
 } elseif ($group->isError()) {
-	exit_error('Error',$group->getErrorMessage());
+	exit_error($group->getErrorMessage(),'admin');
 }
 
 if (getStringFromPost('submit')) {
@@ -42,10 +43,11 @@
 	$reallysure = getIntFromPost('reallysure');
 	$reallyreallysure = getIntFromPost('reallyreallysure');
 	if (!$group->delete($sure, $reallysure, $reallyreallysure)) {
-		exit_error('Error',$group->getErrorMessage());
+		exit_error($group->getErrorMessage(),'admin');
 	} else {
 		plugin_hook('delete_link',$_GET['group_id']) ;
-		header("Location: ".util_make_url("/admin/?feedback=Project+successfully+deleted"));
+        $feedback = _('Project successfully deleted');
+        session_redirect('/admin/?feedback='.urlencode($feedback));
 	}
 }
 

Modified: trunk/src/www/admin/groupedit.php
===================================================================
--- trunk/src/www/admin/groupedit.php	2010-09-20 10:04:48 UTC (rev 10555)
+++ trunk/src/www/admin/groupedit.php	2010-09-20 13:03:02 UTC (rev 10556)
@@ -3,21 +3,22 @@
  * Site Admin group properties editing page
  *
  * Copyright 1999-2001 (c) VA Linux Systems
+ * Copyright 2010 (c) Franck Villaume - Capgemini
  *
- * This file is part of GForge.
+ * This file is part of FusionForge.
  *
- * GForge is free software; you can redistribute it and/or modify
+ * FusionForge is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * GForge is distributed in the hope that it will be useful,
+ * FusionForge is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with GForge; if not, write to the Free Software
+ * along with FusionForge; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
@@ -33,36 +34,36 @@
 if (!$group || !is_object($group)) {
     exit_no_group();
 } elseif ($group->isError()) {
-	exit_error('Error',$group->getErrorMessage());
+	exit_error($group->getErrorMessage(),'admin');
 }
 
 // This function performs very update
-function do_update(&$group, $is_public, $status,
-		   $group_type, $unix_box, $http_domain, $scm_box='') {
+function do_update(&$group, $is_public, $status, $group_type, $unix_box, $http_domain, $scm_box='') {
 	global $feedback;
+    global $error_msg;
 
 	db_begin();
 
 	if (!$group->setStatus(session_get_user(), $status)) {
-		$feedback .= $group->getErrorMessage();
+		$error_msg .= $group->getErrorMessage();
 		db_rollback();
 		return false;
 	}
 
 	if (!$group->updateAdmin(session_get_user(), $is_public, $group_type, $unix_box, $http_domain)) {
-		$feedback .= $group->getErrorMessage();
+		$error_msg .= $group->getErrorMessage();
 		db_rollback();
 		return false;
 	}
 
 	if($group->usesSCM() && !$group->setSCMBox($scm_box)) {
-		$feedback .= $group->getErrorMessage();
+		$error_msg .= $group->getErrorMessage();
 		db_rollback();
 		return false;
 	}
 	db_commit();
 
-	$feedback .= _('Updated').'<br /> ';
+	$feedback .= _('Updated');
 
 	return true;
 }
@@ -75,13 +76,12 @@
 	$form_domain = getStringFromRequest('form_domain');
 	$form_scm_box = getStringFromRequest('form_scm_box');
 
-	do_update($group, $form_public, $form_status, 
-		  1, $form_box, $form_domain, $form_scm_box);
+	do_update($group, $form_public, $form_status, 1, $form_box, $form_domain, $form_scm_box);
 
 } else if (getStringFromRequest('resend')) {
 
 	$group->sendApprovalEmail();
-	$feedback .= _('Instruction email sent').'<br /> ';
+	$feedback .= _('Instruction email sent');
 
 }
 

Modified: trunk/src/www/admin/massmail.php
===================================================================
--- trunk/src/www/admin/massmail.php	2010-09-20 10:04:48 UTC (rev 10555)
+++ trunk/src/www/admin/massmail.php	2010-09-20 13:03:02 UTC (rev 10556)
@@ -7,21 +7,22 @@
  * delivery is performed via cronjob.
  *
  * Copyright 1999-2001 (c) VA Linux Systems
+ * Copyright 2010 (c) Franck Villaume - Capgemini
  *
- * This file is part of GForge.
+ * This file is part of FusionForge.
  *
- * GForge is free software; you can redistribute it and/or modify
+ * FusionForge is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * GForge is distributed in the hope that it will be useful,
+ * FusionForge is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with GForge; if not, write to the Free Software
+ * along with FusionForge; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
@@ -33,7 +34,7 @@
 
 if (getStringFromRequest('submit')) {
 	if (!form_key_is_valid(getStringFromRequest('form_key'))) {
-		exit_form_double_submit();
+		exit_form_double_submit('admin');
 	}
 	$mail_type = getStringFromRequest('mail_type');
 	$mail_message = getStringFromRequest('mail_message');
@@ -41,23 +42,17 @@
 
 	if (!$mail_type) {
 		form_release_key(getStringFromRequest('form_key'));
-		exit_error(
-			_('Missing parameter, You must select target audience for mailing')
-		);
+		exit_missing_param('',array(_('Target Audience')),'admin');
 	}
 
 	if (!trim($mail_message)) {
 		form_release_key(getStringFromRequest('form_key'));
-		exit_error(
-			_('Missing parameter, You are trying to send empty message')
-		);
+		exit_missing_param('',array(_('No Message')),'admin');
 	}
 
 	if (trim($mail_subject) == '['.forge_get_config ('forge_name').']') {
 		form_release_key(getStringFromRequest('form_key'));
-		exit_error(
-			_('Missing parameter, You must give proper subject to the mailing')
-		);
+		exit_missing_param('',array(_('No Subject')),'admin');
 	}
 
 	$res = db_query_params ('
@@ -71,9 +66,7 @@
 
 	if (!$res || db_affected_rows($res)<1) {
 		form_release_key(getStringFromRequest('form_key'));
-		exit_error(
-			_('Error Scheduling Mailing, Could not schedule mailing, database error:') .db_error()
-		);
+		exit_error(_('Scheduling Mailing, Could not schedule mailing, database error: ').db_error(),'admin');
 	}
 
 	site_admin_header(array('title'=>_('Massmail admin')));




More information about the Fusionforge-commits mailing list