[Fusionforge-commits] r17847 - in trunk/src/common: forum include include/system

Marc-Etienne VARGENAU vargenau at fusionforge.org
Thu Aug 29 18:45:46 CEST 2013


Author: vargenau
Date: 2013-08-29 18:45:46 +0200 (Thu, 29 Aug 2013)
New Revision: 17847

Modified:
   trunk/src/common/forum/ForumMessage.class.php
   trunk/src/common/include/Error.class.php
   trunk/src/common/include/Group.class.php
   trunk/src/common/include/env.inc.php
   trunk/src/common/include/system/LDAP.class.php
   trunk/src/common/include/system/NSSPGSQL.class.php
   trunk/src/common/include/system/UNIX.class.php
   trunk/src/common/include/system/pgsql.class.php
Log:
Use tabs

Modified: trunk/src/common/forum/ForumMessage.class.php
===================================================================
--- trunk/src/common/forum/ForumMessage.class.php	2013-08-29 16:44:45 UTC (rev 17846)
+++ trunk/src/common/forum/ForumMessage.class.php	2013-08-29 16:45:46 UTC (rev 17847)
@@ -48,10 +48,10 @@
 		/**
 	 *  Constructor.
 	 *
-	 *	@param	object	The Forum object to which this ForumMessage is associated.
-	 *  @param  int	 The message_id.
-	 *  @param  array   The associative array of data.
-	 *	@param 	boolean	Whether the message is a pending one.
+	 *	@param	$Forum  object	The Forum object to which this ForumMessage is associated.
+	 *  @param  $msg_id int	 The message_id.
+	 *  @param  $arr	array   The associative array of data.
+	 *	@param 	$pending	boolean	Whether the message is a pending one.
 	 *	@return	boolean	success.
 	 */
 	function ForumMessage(&$Forum, $msg_id=false, $arr=false, $pending=false) {
@@ -97,11 +97,11 @@
 
 /**
 	*	insertmoderated - inserts the message into the table for moderation (forum_pending_messages)
-	 *	@param	string	The subject of the message.
-	 *	@param	string	The body of the message.
-	 *	@param	int	The thread_id of the message, if known.
-	 *	@param	int	The message_id of the parent message, if any.
-	 *	@param 	int	The id of the user that is posting the message
+	 *	@param	$subject		string	The subject of the message.
+	 *	@param	$body			string	The body of the message.
+	 *	@param	$thread_id		int	The thread_id of the message, if known.
+	 *	@param	$is_followup_to int	The message_id of the parent message, if any.
+	 *	@param 	$user_id		int	The id of the user that is posting the message
 	 *	@return	boolean success.
 	*/
 
@@ -402,7 +402,7 @@
 	function fetchData($msg_id) {
 		$res = db_query_params ('SELECT * FROM forum_user_vw WHERE msg_id=$1 AND group_forum_id=$2',
 					array ($msg_id,
-					       $this->Forum->getID())) ;
+						$this->Forum->getID())) ;
 		if (!$res || db_numrows($res) < 1) {
 			$this->setError(_('Invalid Message Id'));
 			return false;
@@ -421,7 +421,7 @@
 	function fetchModeratedData($msg_id) {
 		$res = db_query_params ('SELECT * FROM forum_pending_user_vw WHERE msg_id=$1 AND group_forum_id=$2',
 					array ($msg_id,
-					       $this->Forum->getID())) ;
+						$this->Forum->getID())) ;
 		if (!$res || db_numrows($res) < 1) {
 			$this->setError(_('Invalid Message Id'));
 			return false;
@@ -686,7 +686,7 @@
 				$text,
 				forge_get_config ('forge_name'),
 				util_make_url('/forum/monitor.php?forum_id='.$this->Forum->getID().
-					      '&group_id='.$this->Forum->Group->getID().'&stop=1')
+						'&group_id='.$this->Forum->Group->getID().'&stop=1')
 				);
 
 			$extra_headers = "Return-Path: <noreply@".forge_get_config('web_host').">\n";
@@ -810,14 +810,14 @@
 			thread_id=$7, most_recent_date=$8
 			WHERE msg_id=$9',
 					array ($group_forum_id,
-					       $posted_by,
-					       $subject,
-					       $body,
-					       $post_date,
-					       $is_followup_to,
-					       $thread_id,
-					       $most_recent_date,
-					       $msg_id)) ;
+						$posted_by,
+						$subject,
+						$body,
+						$post_date,
+						$is_followup_to,
+						$thread_id,
+						$most_recent_date,
+						$msg_id)) ;
 		if (!$res) {
 			$this->setError(db_error());
 			return false;

Modified: trunk/src/common/include/Error.class.php
===================================================================
--- trunk/src/common/include/Error.class.php	2013-08-29 16:44:45 UTC (rev 17846)
+++ trunk/src/common/include/Error.class.php	2013-08-29 16:45:46 UTC (rev 17847)
@@ -72,8 +72,9 @@
 	 * Set the error string $error_message to the value of $string
 	 * and enable the $error_state flag.
 	 *
-	 * @param	string  The error string to set.
-	 * @param	int	The error code
+	 * @param	string  $string	The error string to set.
+	 * @param	int	$code	The error code
+	 * @return	bool
 	 */
 	function setError($string, $code=ERROR__UNCLASSIFIED_ERROR) {
 		$this->error_state=true;
@@ -85,7 +86,6 @@
 	/**
 	 * clearError() - Clear the current error.
 	 * Clear the current error string and disable the $error_state flag.
-	 *
 	 */
 	function clearError() {
 		$this->error_state=false;
@@ -97,8 +97,7 @@
 	 * getErrorMessage() - Retrieve the error message string.
 	 * Returns the value of $error_message.
 	 *
-	 * @return    $error_message The current error message string.
-	 *
+	 * @return string The current error message string.
 	 */
 	function getErrorMessage() {
 		if ($this->error_state)	{
@@ -112,8 +111,7 @@
 	 * isError() - Determines the current error state.
 	 * This function returns the current value of $error_state.
 	 *
-	 * @return    $error_state     The boolean error status.
-	 *
+	 * @return bool The boolean error status.
 	 */
 	function isError() {
 		return $this->error_state;
@@ -123,8 +121,6 @@
 	/**
 	 * setPermissionDeniedError() - sets a Permission Denied error
 	 *  retrieves the localized error string for Permission Denied and calls exit_error()
-	 *
-	 *
 	 */
 	function setPermissionDeniedError(){
 		$this->setError(_('Permission denied.'), ERROR__PERMISSION_DENIED_ERROR);
@@ -165,7 +161,7 @@
 	 * setOnUpdateError() - sets an On Update Error
 	 *  retrieves the localized error string for On Update
 	 *
-	 * @param	string  The db result to be written.
+	 * @param	string  $result	The db result to be written.
 	 *
 	 */
 	function setOnUpdateError($result=""){
@@ -201,16 +197,16 @@
 
 	/**
 	 * setMissingParamsError() - sets an Group ID Error
-	 *  retrieves the localized error string for missing pparams
+	 *  retrieves the localized error string for missing params
 	 *
-	 * @param	string  The name of the missing parameter
+	 * @param	string  $param	The name of the missing parameter
 	 *
 	 */
 	function setMissingParamsError($param=''){
 		if ($param) {
-			$param = ': ' . $param;
+			$param = _(': ') . $param;
 		}
-		$this->setError(_('Missing Parameters').$param, ERROR__MISSING_PARAMS_ERROR);
+		$this->setError(_('Missing Required Parameters').$param, ERROR__MISSING_PARAMS_ERROR);
 	}
 
 	/**

Modified: trunk/src/common/include/Group.class.php
===================================================================
--- trunk/src/common/include/Group.class.php	2013-08-29 16:44:45 UTC (rev 17846)
+++ trunk/src/common/include/Group.class.php	2013-08-29 16:45:46 UTC (rev 17847)
@@ -57,8 +57,8 @@
  * IMPORTANT! That db result must contain all fields
  * from groups table or you will have problems
  *
- * @param int      $group_id Required
- * @param int|bool $res      Result set handle ("SELECT * FROM groups WHERE group_id=xx")
+ * @param int	$group_id Required
+ * @param int|bool $res	Result set handle ("SELECT * FROM groups WHERE group_id=xx")
  * @return Group|bool A group object or false on failure
  */
 function &group_get_object($group_id, $res = false) {
@@ -110,7 +110,7 @@
 	}
 	if (count($fetch) > 0) {
 		$res=db_query_params('SELECT * FROM groups WHERE group_id = ANY ($1)',
-				      array(db_int_array_to_any_clause($fetch)));
+					array(db_int_array_to_any_clause($fetch)));
 		while ($arr = db_fetch_array($res)) {
 			$GROUP_OBJ["_".$arr['group_id']."_"] = new Group($arr['group_id'],$arr);
 		}
@@ -123,19 +123,19 @@
 
 function &group_get_active_projects() {
 	$res = db_query_params('SELECT group_id FROM groups WHERE status=$1',
-			      array('A'));
+				array('A'));
 	return group_get_objects(util_result_column_to_array($res,0));
 }
 
 function &group_get_all_projects() {
 	$res = db_query_params ('SELECT group_id FROM groups',
-			      array ());
+				array ());
 	return group_get_objects(util_result_column_to_array($res,0)) ;
 }
 
 function &group_get_template_projects() {
 	$res = db_query_params('SELECT group_id FROM groups WHERE is_template=1 AND status != $1',
-			      array ('D'));
+				array ('D'));
 	return group_get_objects(util_result_column_to_array($res,0)) ;
 }
 
@@ -146,14 +146,14 @@
 
 function &group_get_objects_by_name($groupname_arr) {
 	$res = db_query_params('SELECT group_id FROM groups WHERE unix_group_name = ANY ($1)',
-			      array(db_string_array_to_any_clause($groupname_arr)));
+				array(db_string_array_to_any_clause($groupname_arr)));
 	$arr =& util_result_column_to_array($res,0);
 	return group_get_objects($arr);
 }
 
 function group_get_object_by_publicname($groupname) {
 	$res = db_query_params('SELECT * FROM groups WHERE lower(group_name) LIKE $1',
-			      array(htmlspecialchars(strtolower($groupname))));
+				array(htmlspecialchars(strtolower($groupname))));
 	return group_get_object(db_result($res, 0, 'group_id'), $res);
 }
 
@@ -315,7 +315,7 @@
 			$this->setError(_('Unix name already taken'));
 			return false;
 		} elseif (db_numrows(db_query_params('SELECT group_id FROM groups WHERE unix_group_name=$1',
-						      array($unix_name))) > 0) {
+							array($unix_name))) > 0) {
 			$this->setError(_('Unix name already taken'));
 			return false;
 		} elseif (strlen($purpose)<10) {
@@ -355,17 +355,17 @@
 				)
 				VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)',
 						array (htmlspecialchars ($group_name),
-						       $unix_name,
-						       htmlspecialchars($description),
-						       $homepage,
-						       $homepage,
-						       'P',
-						       $unix_box,
-						       $scm_box,
-						       htmlspecialchars($purpose),
-						       time(),
-						       md5(util_randbytes()),
-						       $built_from_template));
+							$unix_name,
+							htmlspecialchars($description),
+							$homepage,
+							$homepage,
+							'P',
+							$unix_box,
+							$scm_box,
+							htmlspecialchars($purpose),
+							time(),
+							md5(util_randbytes()),
+							$built_from_template));
 			if (!$res || db_affected_rows($res) < 1) {
 				$this->setError(sprintf(_('Error: Cannot create group: %s'),db_error()));
 				db_rollback();
@@ -386,8 +386,8 @@
 
 			$gjr = new GroupJoinRequest($this);
 			$gjr->create($user->getID(),
-				     'Fake GroupJoinRequest to store the creator of a project',
-				     false);
+					'Fake GroupJoinRequest to store the creator of a project',
+					false);
 
 			$hook_params = array();
 			$hook_params['group'] = $this;
@@ -437,9 +437,9 @@
 			SET type_id=$1, unix_box=$2, http_domain=$3
 			WHERE group_id=$4',
 					array($type_id,
-					      $unix_box,
-					      $http_domain,
-					      $this->getID()));
+						$unix_box,
+						$http_domain,
+						$this->getID()));
 
 		if (!$res || db_affected_rows($res) < 1) {
 			$this->setError(_('Error: Cannot change group properties: %s'),db_error());
@@ -589,24 +589,24 @@
 				use_stats=$16,
 				use_activity=$17
 			WHERE group_id=$18',
-				       array(htmlspecialchars($group_name),
-					     $homepage,
-					     htmlspecialchars($short_description),
-					     $use_mail,
-					     $use_survey,
-					     $use_forum,
-					     $use_pm,
-					     $use_pm_depend_box,
-					     $use_scm,
-					     $use_news,
-					     $new_doc_address,
-					     $send_all_docs,
-					     $use_ftp,
-					     $use_tracker,
-					     $use_frs,
-					     $use_stats,
-						 $use_activity,
-					     $this->getID()));
+					array(htmlspecialchars($group_name),
+						$homepage,
+						htmlspecialchars($short_description),
+						$use_mail,
+						$use_survey,
+						$use_forum,
+						$use_pm,
+						$use_pm_depend_box,
+						$use_scm,
+						$use_news,
+						$new_doc_address,
+						$send_all_docs,
+						$use_ftp,
+						$use_tracker,
+						$use_frs,
+						$use_stats,
+						$use_activity,
+						$this->getID()));
 
 		if (!$res || db_affected_rows($res) < 1) {
 			$this->setError(sprintf(_('Error updating project information: %s'), db_error()));
@@ -827,6 +827,7 @@
 	 *	setAsTemplate - Set the template status of a project
 	 *
 	 *	@param	boolean	is_template.
+	 * @return bool
 	 */
 	function setAsTemplate($booleanparam) {
 		db_begin();
@@ -927,6 +928,7 @@
 	 * setSCMBox - the hostname of the scm box where this project is located.
 	 *
 	 * @param	string	The name of the new SCM_BOX
+	 * @return bool
 	 */
 	function setSCMBox($scm_box) {
 
@@ -986,7 +988,7 @@
 				continue;
 			}
 			if ($role->getHomeProject() == NULL
-			    || $role->getHomeProject()->getID() != $this->getID()) {
+				|| $role->getHomeProject()->getID() != $this->getID()) {
 				continue;
 			}
 
@@ -1063,6 +1065,7 @@
 	 *	setUseSCM - Set the SCM usage
 	 *
 	 *	@param	boolean	enabled/disabled
+	 * @return bool
 	 */
 	function setUseSCM($booleanparam) {
 		db_begin();
@@ -1104,6 +1107,7 @@
 	 *	setUseMail - Set the mailing-list usage
 	 *
 	 *	@param	boolean	enabled/disabled
+	 * @return bool
 	 */
 	function setUseMail($booleanparam) {
 		db_begin();
@@ -1163,6 +1167,7 @@
 	 *	setUseForum - Set the forum usage
 	 *
 	 *	@param	boolean	enabled/disabled
+	 * @return bool
 	 */
 	function setUseForum($booleanparam) {
 		db_begin();
@@ -1205,6 +1210,7 @@
 	 *	setUseFRS - Set the FRS usage
 	 *
 	 *	@param	boolean	enabled/disabled
+	 * @return bool
 	 */
 	function setUseFRS($booleanparam) {
 		db_begin();
@@ -1238,6 +1244,7 @@
 	 *	setUseTracker - Set the tracker usage
 	 *
 	 *	@param	boolean	enabled/disabled
+	 * @return bool
 	 */
 	function setUseTracker ($booleanparam) {
 		db_begin () ;
@@ -1284,6 +1291,7 @@
 	 *	setUseDocman - Set the docman usage
 	 *
 	 *	@param	boolean	enabled/disabled
+	 * @return bool
 	 */
 	function setUseDocman($booleanparam) {
 		db_begin();
@@ -1380,6 +1388,7 @@
 	 *	setUsePM - Set the PM usage
 	 *
 	 *	@param	boolean	enabled/disabled
+	 * @return bool
 	 */
 	function setUsePM($booleanparam) {
 		db_begin();
@@ -1480,12 +1489,12 @@
 		if ($val) {
 			$res = db_query_params('INSERT INTO group_plugin (group_id, plugin_id) VALUES ($1, $2)',
 						array($this->getID(),
-						      $plugin_id));
+							$plugin_id));
 			return $res;
 		} else {
 			$res = db_query_params('DELETE FROM group_plugin WHERE group_id=$1 AND plugin_id=$2',
 						array($this->getID(),
-						      $plugin_id));
+							$plugin_id));
 			return $res;
 		}
 		$this->normalizeAllRoles () ;
@@ -1517,9 +1526,9 @@
 	 */
 	function getHomePage() {
 		if (!preg_match("/^[a-zA-Z][a-zA-Z0-9+.-]*:/",
-		    $this->data_array['homepage'])) {
+			$this->data_array['homepage'])) {
 			$this->data_array['homepage'] = util_url_prefix() .
-			    $this->data_array['homepage'];
+				$this->data_array['homepage'];
 		}
 		return $this->data_array['homepage'];
 	}
@@ -1565,7 +1574,7 @@
 			$res = db_query_params($sql, array($this->getID(), $tag));
 			if (!$res) {
 				$this->setError(_('Setting tags:') . ' ' .
-				    db_error());
+					db_error());
 				db_rollback();
 				return false;
 			}
@@ -1624,7 +1633,7 @@
 		// unlink roles from this project
 		foreach ($this->getRoles() as $r) {
 			if ($r->getHomeProject() == NULL
-			    || $r->getHomeProject()->getID() != $this->getID()) {
+				|| $r->getHomeProject()->getID() != $this->getID()) {
 				$r->unlinkProject($this);
 			}
 		}
@@ -1868,8 +1877,8 @@
 
 		$res = db_query_params('INSERT INTO deleted_groups (unix_group_name, delete_date, isdeleted) VALUES ($1, $2, $3)',
 					array($this->getUnixName(),
-					      time(),
-					      0));
+						time(),
+						0));
 		if (!$res) {
 			$this->setError(_('Error Deleting Project:').' '.db_error());
 			db_rollback();
@@ -2024,7 +2033,7 @@
 		global $SYS;
 
 		if ($user_id != user_getid()
-		    && !forge_check_perm('project_admin', $this->getID())) {
+			&& !forge_check_perm('project_admin', $this->getID())) {
 			$this->setPermissionDeniedError();
 			return false;
 		}
@@ -2061,7 +2070,7 @@
 				FROM artifact_group_list
 				WHERE group_id=$1 AND status_id=1 AND assigned_to=$2)',
 						array($this->getID(),
-						      $user_id));
+							$user_id));
 		if (!$res) {
 			$this->setError(_('Error: artifact:').' '.db_error());
 			db_rollback();
@@ -2082,7 +2091,7 @@
 					AND pat.assigned_to_id=$2)
 					AND assigned_to_id=100',
 						array($this->getID(),
-						      $user_id));
+							$user_id));
 		if (!$res) {
 			$this->setError(sprintf(_('Error: project_assigned_to %d: %s'), 1, db_error()));
 			db_rollback();
@@ -2095,7 +2104,7 @@
 					AND pt.status_id=1 AND pgl.group_id=$1)
 					AND assigned_to_id=$2',
 						array($this->getID(),
-						      $user_id));
+							$user_id));
 		if (!$res) {
 			$this->setError(sprintf(_('Error: project_assigned_to %d: %s'), 2, db_error()));
 			db_rollback();
@@ -2183,10 +2192,10 @@
 		return db_query_params ('INSERT INTO group_history(group_id,field_name,old_value,mod_by,adddate)
 			VALUES ($1,$2,$3,$4,$5)',
 					array ($this->getID(),
-					       $field_name,
-					       $old_value,
-					       user_getid(),
-					       time()));
+						$field_name,
+						$old_value,
+						user_getid(),
+						time()));
 	}
 
 	/**
@@ -2247,7 +2256,8 @@
 	/**
 	 *	approve - Approve pending project.
 	 *
-	 *	@param	object	The User object who is doing the updating.
+	 *	@param	User	$user The User object who is doing the updating.
+	 *	@return bool
 	 *	@access public
 	 */
 	function approve(&$user) {
@@ -2418,16 +2428,16 @@
 				$this->setUseSCM($template->usesSCM());
 
 				foreach ($template->getPlugins() as
-				    $plugin_id => $plugin_name) {
+					$plugin_id => $plugin_name) {
 					$this->setPluginUse($plugin_name);
 				}
 			} else {
 				/* use SCM choice from registration page */
 
 				foreach ($template->getPlugins() as
-				    $plugin_id => $plugin_name) {
+					$plugin_id => $plugin_name) {
 					if (substr($plugin_name, 3) == 'scm' &&
-					    $plugin_name != 'scmhook') {
+						$plugin_name != 'scmhook') {
 						/* skip copying scm plugins */
 						continue;
 					}
@@ -2439,7 +2449,7 @@
 			foreach ($template->getRoles() as $oldrole) {
 				$newrole = RBACEngine::getInstance()->getRoleById ($id_mappings['role'][$oldrole->getID()]) ;
 				if ($oldrole->getHomeProject() != NULL
-				    && $oldrole->getHomeProject()->getID() == $template->getID()) {
+					&& $oldrole->getHomeProject()->getID() == $template->getID()) {
 					$newrole->setPublic ($oldrole->isPublic()) ;
 				}
 				$oldsettings = $oldrole->getSettingsForProject ($template) ;
@@ -2456,8 +2466,8 @@
 							// Only copy perms for tools that have been copied
 							if (isset ($id_mappings[$section][$k])) {
 								$newrole->setSetting ($section,
-										      $id_mappings[$section][$k],
-										      $v) ;
+											$id_mappings[$section][$k],
+											$v) ;
 							}
 						}
 					}
@@ -2559,10 +2569,10 @@
 if there is anything we can do to help you.
 
 -- the %4$s crew'),
-						       htmlspecialchars_decode($this->getPublicName()),
-						       $this->getUnixName(),
-						       util_make_url ('/project/admin/?group_id='.$this->getID()),
-						       forge_get_config ('forge_name'));
+							htmlspecialchars_decode($this->getPublicName()),
+							$this->getUnixName(),
+							util_make_url ('/project/admin/?group_id='.$this->getID()),
+							forge_get_config ('forge_name'));
 
 			util_send_message($admin->getEmail(), sprintf(_('%1$s Project Approved'), forge_get_config ('forge_name')), $message);
 
@@ -2668,14 +2678,14 @@
 			foreach ($submitters as $submitter) {
 				$message .= sprintf(_('Submitter: %1$s (%2$s)
 '),
-						    $submitter->getRealName(),
-						    $submitter->getUnixName());
+							$submitter->getRealName(),
+							$submitter->getUnixName());
 			}
 
 			$message .= sprintf (_('
 Please visit the following URL to approve or reject this project:
 %1$s'),
-					    util_make_url ('/admin/approve-pending.php')) ;
+						util_make_url ('/admin/approve-pending.php')) ;
 			util_send_message($admin_email, sprintf(_('New %1$s Project Submitted'), forge_get_config ('forge_name')), $message);
 			setup_gettext_from_context();
 		}
@@ -2697,15 +2707,12 @@
 		return true;
 	}
 
-
-
-
 	/**
 	 * validateGroupName - Validate the group name
 	 *
 	 * @param	string	Group name.
 	 *
-	 * @return	boolean	an error false and set an error is the group name is invalide otherwise return true
+	 * @return	boolean	an error false and set an error is the group name is invalid otherwise return true
 	 */
 	function validateGroupName($group_name) {
 		if (strlen($group_name)<3) {
@@ -2731,12 +2738,12 @@
 		$role_ids = array();
 
 		$res = db_query_params('SELECT role_id FROM pfo_role WHERE home_group_id=$1',
-				       array($this->getID()));
+					array($this->getID()));
 		while ($arr = db_fetch_array($res)) {
 			$role_ids[] = $arr['role_id'];
 		}
 		$res = db_query_params('SELECT role_id FROM role_project_refs WHERE group_id=$1',
-				       array($this->getID()));
+					array($this->getID()));
 		while ($arr = db_fetch_array($res)) {
 			$role_ids[] = $arr['role_id'];
 		}
@@ -2794,7 +2801,7 @@
 		db_begin();
 		$res = db_query_params ('UPDATE groups SET unix_status=$1 WHERE group_id=$2',
 					array ($status,
-					       $this->getID())) ;
+						$this->getID())) ;
 
 		if (!$res) {
 			$this->setError(sprintf(_('Error: Cannot Update Group Unix Status: %s'),db_error()));
@@ -2835,7 +2842,7 @@
 			$ids = array () ;
 			foreach ($this->getRoles() as $role) {
 				if ($onlylocal
-				    && ($role->getHomeProject() == NULL || $role->getHomeProject()->getID() != $this->getID())) {
+					&& ($role->getHomeProject() == NULL || $role->getHomeProject()->getID() != $this->getID())) {
 					continue ;
 				}
 				foreach ($role->getUsers() as $user) {
@@ -2875,7 +2882,7 @@
 		/* if we activate search engine, we probably want to reindex */
 		$res = db_query_params('UPDATE groups SET use_webdav=$1 WHERE group_id=$2',
 					array($status,
-					       $this->getID()));
+						$this->getID()));
 
 		if (!$res) {
 			$this->setError(sprintf(_('Error: Cannot Update Group UseWebdab Status: %s'),db_error()));
@@ -2893,7 +2900,7 @@
 		/* if we activate search engine, we probably want to reindex */
 		$res = db_query_params('UPDATE groups SET use_docman_search=$1, force_docman_reindex=$1 WHERE group_id=$2',
 					array($status,
-					       $this->getID()));
+						$this->getID()));
 
 		if (!$res) {
 			$this->setError(sprintf(_('Error: Cannot Update Group UseDocmanSearch Status: %s'),db_error()));
@@ -2911,7 +2918,7 @@
 		/* if we activate search engine, we probably want to reindex */
 		$res = db_query_params('UPDATE groups SET force_docman_reindex=$1 WHERE group_id=$2',
 					array($status,
-					       $this->getID()));
+						$this->getID()));
 
 		if (!$res) {
 			$this->setError(sprintf(_('Error: Cannot Update Group force_docman_reindex %s'),db_error()));
@@ -2976,7 +2983,7 @@
 
 function getAllProjectTags($onlyvisible = true) {
 	$res = db_query_params('SELECT project_tags.name, groups.group_id FROM groups, project_tags WHERE groups.group_id = project_tags.group_id AND groups.status = $1 ORDER BY project_tags.name, groups.group_id',
-			       array('A'));
+				array('A'));
 
 	if (!$res || db_numrows($res) == 0) {
 		return false;

Modified: trunk/src/common/include/env.inc.php
===================================================================
--- trunk/src/common/include/env.inc.php	2013-08-29 16:44:45 UTC (rev 17846)
+++ trunk/src/common/include/env.inc.php	2013-08-29 16:45:46 UTC (rev 17847)
@@ -38,14 +38,14 @@
 // Attempt to set up the include path, to fix problems with relative includes
 $fusionforge_basedir = dirname(dirname(dirname( __FILE__ )));
 
-// By default, the include_path is changed to include path needed by Gforge.
+// By default, the include_path is changed to include path needed by FusionForge.
 // If this does not work, then set defines to real path directly.
 //
 // In case of failure, the following defines are set:
-//    $gfconfig : Directory where are the configuration files (/etc/gforge).
-//    $gfcommon : Directory common of gforge (for common php classes).
-//    $gfwww    : Directory www of gforge (publicly accessible files).
-//    $gfplugins: Directory for plugins.
+//	$gfconfig: Directory where are the configuration files (/etc/gforge).
+//	$gfcommon: Directory common of gforge (for common php classes).
+//	$gfwww: Directory www of gforge (publicly accessible files).
+//	$gfplugins: Directory for plugins.
 //
 
 // Easyforge config, allow several instances of gforge based on server name.

Modified: trunk/src/common/include/system/LDAP.class.php
===================================================================
--- trunk/src/common/include/system/LDAP.class.php	2013-08-29 16:44:45 UTC (rev 17846)
+++ trunk/src/common/include/system/LDAP.class.php	2013-08-29 16:45:46 UTC (rev 17847)
@@ -92,6 +92,7 @@
 	 * @param		string	dn
 	 * @param		string	entry
 	 *
+	 * @return bool
 	 */
 	function gfLdapAdd($dn, $entry) {
 		global $ldap_conn;
@@ -103,6 +104,7 @@
 	 *
 	 * @param		string	dn
 	 *
+	 * @return bool
 	 */
 	function gfLdapDelete($dn) {
 		global $ldap_conn;
@@ -115,6 +117,7 @@
 	 * @param		string	dn
 	 * @param		string	entry
 	 *
+	 * @return bool
 	 */
 	function gfLdapModify($dn,$entry) {
 		global $ldap_conn;
@@ -128,19 +131,20 @@
 	 * @param		string	dn
 	 * @param		string	entry
 	 *
+	 * @return bool
 	 */
 	function gfLdapModifyIfExists($dn,$entry) {
-        	$res = $this->gfLdapModify($dn,$entry);
-        	if ($res) {
-                	return true ;
-        	} else {
-                	$err = ldap_errno ($ldap_conn) ;
-                	if ($err == 32) {
-                        	return true ;
-                	} else {
-                        	return false ;
-                	}
-        	}
+			$res = $this->gfLdapModify($dn,$entry);
+			if ($res) {
+					return true ;
+			} else {
+					$err = ldap_errno ($ldap_conn) ;
+					if ($err == 32) {
+							return true ;
+					} else {
+							return false ;
+					}
+			}
 	}
 
 	/**
@@ -149,6 +153,7 @@
 	 * @param		string	dn
 	 * @param		string	entry
 	 *
+	 * @return bool
 	 */
 	function gfLdapModAdd($dn,$entry) {
 		global $ldap_conn;
@@ -161,6 +166,7 @@
 	 * @param		string	dn
 	 * @param		string	entry
 	 *
+	 * @return bool
 	 */
 	function gfLdapModDel($dn,$entry) {
 		global $ldap_conn;
@@ -174,6 +180,7 @@
 	 * @param		string	filter
 	 * @param		int		attrs
 	 *
+	 * @return resource
 	 */
 	function gfLdapRead($dn,$filter,$attrs=0) {
 		global $ldap_conn;
@@ -226,7 +233,7 @@
 	 * sysCheckUser() - Check for the existence of a user
 	 *
 	 * @param		int		The user ID of the user to check
-	 * @returns true on success/false on error
+	 * @return bool	true on success/false on error
 	 *
 	 */
 	function sysCheckUser($user_id) {
@@ -241,7 +248,7 @@
 	 * gfLdapcheck_user_by_name() - Check for a user by the username
 	 *
 	 * @param		string	The username
-	 * @returns true on success/false on error
+	 * @return bool	true on success/false on error
 	 *
 	 */
 	function gfLdapcheck_user_by_name($user_name) {
@@ -266,7 +273,7 @@
 	 * sysCreateUser() - Create a user
 	 *
 	 * @param		int	The user ID of the user to create
-	 * @returns The return status of gfLdapcreate_user_from_object()
+	 * @return	bool	 The return status of gfLdapcreate_user_from_object()
 	 *
 	 */
 	function sysCreateUser($user_id) {
@@ -283,7 +290,7 @@
 	 * sysCheckCreateUser() - Check that a user has been created
 	 *
 	 * @param		int		The ID of the user to check
-	 * @returns true on success/false on error
+	 * @return bool	true on success/false on error
 	 *
 	 */
 	function sysCheckCreateUser($user_id) {
@@ -298,7 +305,7 @@
 	 * gfLdapcreate_user_from_object() - Create a user from information contained within an object
 	 *
 	 * @param		object	The user object
-	 * @returns true on success/false on error
+	 * @return bool	true on success/false on error
 	 *
 	 */
 	function gfLdapcreate_user_from_object(&$user) {
@@ -340,7 +347,7 @@
 	 * @param		string	The username
 	 * @param		string	????
 	 * @param		string	The encrypted password
-	 * @returns true on success/false on error
+	 * @return bool	true on success/false on error
 	 *
 	 */
 	function gfLdapCreateUserFromProps($username, $cn, $crypt_pw,
@@ -381,7 +388,7 @@
 	 * sysRemoveUser() - Remove an LDAP user
 	 *
 	 * @param		int		The user ID of the user to remove
-	 * @returns true on success/false on failure
+	 * @return bool	true on success/false on error
 	 *
 	 */
 	function sysRemoveUser($user_id) {
@@ -394,9 +401,9 @@
 		$dn = 'uid='.$user->getUnixName().',ou=People,'.forge_get_config('ldap_base_dn');
 
 		if (!$this->gfLdapDelete($dn)) {
-		    $this->setError("Error: cannot delete LDAP user entry '".
+			$this->setError("Error: cannot delete LDAP user entry '".
 				 $user->getUnixName()."': ".$this->gfLdapError()."<br />");
-		    return false;
+			return false;
 		}
 		return true;
 	}
@@ -407,7 +414,7 @@
 	 * @param		int		The user ID
 	 * @param		string	The attribute to set
 	 * @param		string	The new value of the attribute
-	 * @returns true on success/false on error
+	 * @return bool	true on success/false on error
 	 *
 	 */
 	function sysUserSetAttribute($user_id,$attr,$value) {
@@ -421,9 +428,9 @@
 		$entry[$attr]=$value;
 
 		if (!$this->gfLdapModifyIfExists($dn, $entry)) {
-		    $this->setError("Error: cannot change LDAP attribute '$attr' for user '".
+			$this->setError("Error: cannot change LDAP attribute '$attr' for user '".
 				 $user->getUnixName()."': ".$this->gfLdapError()."<br />");
-		    return false;
+			return false;
 		}
 		return true;
 	}
@@ -436,13 +443,12 @@
 	 * sysCheckGroup() - Check for the existence of a group
 	 *
 	 * @param		int		The ID of the group to check
-	 * @returns true on success/false on error
+	 * @return bool	true on success/false on error
 	 *
 	 */
 	function sysCheckGroup($group_id) {
 		global $ldap_conn;
 
-
 		$group = group_get_object($group_id);
 		if (!$group) {
 			$this->setError("Error: Cannot find group [$group_id]<br />");
@@ -464,12 +470,11 @@
 	 * sysCreateGroup() - Create a group
 	 *
 	 * @param		int		The ID of the group to create
-	 * @returns true on success/false on error
+	 * @return bool	true on success/false on error
 	 *
 	 */
 	function sysCreateGroup($group_id) {
 
-
 		$group = group_get_object($group_id);
 		if (!$this->gfLdapConnect()) {
 			return false;
@@ -486,10 +491,10 @@
 		$ret_val=true;
 
 		if (!$this->gfLdapAdd($dn,$entry)) {
-		    $this->setError("Error: cannot add LDAP group entry '".
+			$this->setError("Error: cannot add LDAP group entry '".
 				 $group->getUnixName()."': ".$this->gfLdapError()."<br />");
-		    // If there's error, that's bad. But don't stop.
-		    $ret_val=false;
+			// If there's error, that's bad. But don't stop.
+			$ret_val=false;
 		}
 
 		//
@@ -517,8 +522,8 @@
 		// Finally, setup AnonCVS virtual user
 		//
 
-	        if (!$this->gfLdapcheck_user_by_name('anoncvs_'.$group->getUnixName())
-		    && !$this->gfLdapCreateUserFromProps('scm_'.$group->getUnixName(),
+			if (!$this->gfLdapcheck_user_by_name('anoncvs_'.$group->getUnixName())
+			&& !$this->gfLdapCreateUserFromProps('scm_'.$group->getUnixName(),
 							'anoncvs', 'x',
 							'/bin/false', '/bin/false',
 							$this->getSCMGID(),
@@ -535,12 +540,11 @@
 	 * sysRemoveGroup() - Remove a group
 	 *
 	 * @param		int		The ID of the group to remove
-	 * @returns true on success/false on error
+	 * @return bool	true on success/false on error
 	 *
 	 */
 	function sysRemoveGroup($group_id) {
 
-
 		$group = group_get_object($group_id);
 		if (!$this->gfLdapConnect()) {
 			return false;
@@ -554,9 +558,9 @@
 		$dn = 'cn='.$group->getUnixName().',ou=Group,'.forge_get_config('ldap_base_dn');
 
 		if (!$this->gfLdapDelete($dn)) {
-		    $this->setError("Error: cannot delete LDAP group entry '".
+			$this->setError("Error: cannot delete LDAP group entry '".
 				 $group->getUnixName()."': ".$this->gfLdapError()."<br />");
-		    $ret_val = false;
+			$ret_val = false;
 		}
 
 		//
@@ -566,9 +570,9 @@
 		$dn = 'cn='.$group->getUnixName().',ou=cvsGroup,'.forge_get_config('ldap_base_dn');
 
 		if (!$this->gfLdapDelete($dn)) {
-		    $this->setError("Error: cannot delete LDAP CVS group entry '".
+			$this->setError("Error: cannot delete LDAP CVS group entry '".
 				 $group->getUnixName()."': ".$this->gfLdapError()."<br />");
-		    $ret_val = false;
+			$ret_val = false;
 		}
 
 		//
@@ -577,9 +581,9 @@
 
 		$dn = 'uid=anoncvs_'.$group->getUnixName().',ou=People,'.forge_get_config('ldap_base_dn');
 		if (!$this->gfLdapDelete($dn)) {
-		    $this->setError("Error: cannot delete LDAP AnonCVS user entry '".
+			$this->setError("Error: cannot delete LDAP AnonCVS user entry '".
 				 $group->getUnixName()."': ".$this->gfLdapError()."<br />");
-		    $ret_val = false;
+			$ret_val = false;
 		}
 
 		return $ret_val;
@@ -617,13 +621,12 @@
 	 * @param		int		The ID of the group two which the user will be added
 	 * @param		int		The ID of the user to add
 	 * @param		bool	Only add this user to CVS
-	 * @returns true on success/false on error
+	 * @return bool	true on success/false on error
 	 *
 	 */
 	function sysGroupAddUser($group_id,$user_id,$cvs_only=0) {
 		global $ldap_conn;
 
-
 		$group = group_get_object($group_id);
 		$user  = &user_get_object($user_id);
 		if (!$this->gfLdapConnect()) {
@@ -688,12 +691,11 @@
 	 * @param		int		The ID of the group from which to remove the user
 	 * @param		int		The ID of the user to remove
 	 * @param		bool	Only remove user from CVS group
-	 * @returns true on success/false on error
+	 * @return bool	true on success/false on error
 	 *
 	 */
 	function sysGroupRemoveUser($group_id,$user_id,$cvs_only=0) {
 
-
 		$group = group_get_object($group_id);
 		$user  = &user_get_object($user_id);
 		if (!$this->gfLdapConnect()) {

Modified: trunk/src/common/include/system/NSSPGSQL.class.php
===================================================================
--- trunk/src/common/include/system/NSSPGSQL.class.php	2013-08-29 16:44:45 UTC (rev 17846)
+++ trunk/src/common/include/system/NSSPGSQL.class.php	2013-08-29 16:45:46 UTC (rev 17847)
@@ -24,9 +24,9 @@
 
 class NSSPGSQL extends System {
 	/**
-        * Value to add to unix_uid to get unix uid
+	* Value to add to unix_uid to get unix uid
 	*
-	* @var  constant                $UID_ADD
+	* @var  constant	$UID_ADD
 	*/
 	var $UID_ADD = 20000;
 
@@ -41,8 +41,8 @@
 	/**
  	* sysCreateUser() - Create a user
  	*
- 	* @param		int	The user ID of the user to create
- 	* @returns The return status
+ 	* @param		int		The user ID of the user to create
+	* @return		bool	The return status
  	*
  	*/
 	function sysCreateUser($user_id) {
@@ -53,7 +53,7 @@
  	* sysRemoveUser() - Remove a user
  	*
  	* @param		int		The user ID of the user to remove
- 	* @returns true on success/false on failure
+	* @return		bool	true on success/false on failure
  	*
  	*/
 	function sysRemoveUser($user_id) {
@@ -68,7 +68,7 @@
  	* sysCheckGroup() - Check for the existence of a group
  	*
  	* @param		int		The ID of the group to check
- 	* @returns true on success/false on error
+	* @return		bool	true on success/false on failure
  	*
  	*/
 	function sysCheckGroup($group_id) {
@@ -83,7 +83,7 @@
  	* sysCreateGroup() - Create a group
  	*
  	* @param		int		The ID of the group to create
- 	* @returns true on success/false on error
+	* @return		bool	true on success/false on failure
  	*
  	*/
 	function sysCreateGroup($group_id) {

Modified: trunk/src/common/include/system/UNIX.class.php
===================================================================
--- trunk/src/common/include/system/UNIX.class.php	2013-08-29 16:44:45 UTC (rev 17846)
+++ trunk/src/common/include/system/UNIX.class.php	2013-08-29 16:45:46 UTC (rev 17847)
@@ -24,9 +24,9 @@
 
 class UNIX extends System {
 	/**
-        * Value to add to unix_uid to get unix uid
+	* Value to add to unix_uid to get unix uid
 	*
-	* @var  constant                $UID_ADD
+	* @var  constant				$UID_ADD
 	*/
 	var $UID_ADD = 20000;
 
@@ -42,7 +42,7 @@
  	* sysCreateUser() - Create a user
  	*
  	* @param		int	The user ID of the user to create
- 	* @returns The return status
+ 	* @return bool	 The return status
  	*
  	*/
 	function sysCreateUser($user_id) {
@@ -56,12 +56,12 @@
 			unix_status=$3
 			WHERE user_id=$4',
 						array ($this->UID_ADD,
-						       $this->UID_ADD,
-						       'A',
-						       $user_id)) ;
-	                if (!$res) {
-	                        $this->setError('Error: Cannot Update User UID/GID: '.db_error());
-	                        return false;
+							   $this->UID_ADD,
+							   'A',
+							   $user_id)) ;
+					if (!$res) {
+							$this->setError('Error: Cannot Update User UID/GID: '.db_error());
+							return false;
 			}
 			return true;
 		}
@@ -71,13 +71,13 @@
  	* sysRemoveUser() - Remove a user
  	*
  	* @param		int		The user ID of the user to remove
- 	* @returns true on success/false on failure
+	* @return bool	true on success/false on failure
  	*
  	*/
 	function sysRemoveUser($user_id) {
 		$res = db_query_params ('UPDATE users SET unix_status=$1 WHERE user_id=$2',
 					array ('N',
-					       $user_id));
+						   $user_id));
 		if (!$res) {
 			$this->setError('Error: Cannot Update User Unix Status: '.db_error());
 			return false;
@@ -93,7 +93,7 @@
  	* sysCheckGroup() - Check for the existence of a group
  	*
  	* @param		int		The ID of the group to check
- 	* @returns true on success/false on error
+ 	* @return	bool	true on success/false on error
  	*
  	*/
 	function sysCheckGroup($group_id) {
@@ -108,7 +108,7 @@
  	* sysCreateGroup() - Create a group
  	*
  	* @param		int		The ID of the group to create
- 	* @returns true on success/false on error
+ 	* @return	bool	true on success/false on error
  	*
  	*/
 	function sysCreateGroup($group_id) {

Modified: trunk/src/common/include/system/pgsql.class.php
===================================================================
--- trunk/src/common/include/system/pgsql.class.php	2013-08-29 16:44:45 UTC (rev 17846)
+++ trunk/src/common/include/system/pgsql.class.php	2013-08-29 16:45:46 UTC (rev 17847)
@@ -66,9 +66,9 @@
 	*/
 	function sysUseUnixName($unix_name) {
 		$res1 = db_query_params('SELECT user_id FROM users
-		                         WHERE user_name=$1',array($unix_name));
+								 WHERE user_name=$1',array($unix_name));
 		$res2 = db_query_params('SELECT group_id FROM groups
-		                         WHERE unix_group_name=$1',array($unix_name));
+								 WHERE unix_group_name=$1',array($unix_name));
 		if ( db_numrows($res1) == 0 && db_numrows($res2) == 0 ){
 			return true;
 		}
@@ -112,12 +112,12 @@
 			unix_status=$3
 			WHERE user_id=$4',
 						array ($this->UID_ADD,
-						       $this->UID_ADD,
-						       'A',
-						       $user_id)) ;
-	                if (!$res) {
-	                        $this->setError('Error: Cannot Update User UID/GID: '.db_error());
-	                        return false;
+							   $this->UID_ADD,
+							   'A',
+							   $user_id)) ;
+					if (!$res) {
+							$this->setError('Error: Cannot Update User UID/GID: '.db_error());
+							return false;
 			}
 			$res1 = db_query_params ('DELETE FROM nss_usergroups WHERE user_id=$1',
 						 array ($user_id)) ;
@@ -193,7 +193,7 @@
 	function sysRemoveUser($user_id) {
 		$res = db_query_params('UPDATE users SET unix_status=$1 WHERE user_id=$2',
 					array ('D',
-					       $user_id));
+						   $user_id));
 		if (!$res) {
 			$this->setError('Error: Cannot Update User Unix Status: '.db_error());
 			return false;
@@ -259,7 +259,7 @@
  	* sysCreateGroup() - Create a group
  	*
  	* @param		int		The ID of the group to create
- 	* @returns true on success/false on error
+	* @return bool	true on success/false on error
  	*
  	*/
 	function sysCreateGroup($group_id) {
@@ -282,7 +282,7 @@
 		}
 		$res4 = db_query_params ('INSERT INTO nss_groups
 					(user_id, group_id, name, gid)
-        				SELECT 0, group_id, unix_group_name, group_id + $1
+						SELECT 0, group_id, unix_group_name, group_id + $1
 					FROM groups
 					WHERE group_id=$2',
 					 array ($this->GID_ADD,
@@ -293,7 +293,7 @@
 		}
 		$res5 = db_query_params ('INSERT INTO nss_groups
 					(user_id, group_id, name, gid)
-        				SELECT 0, group_id, $1 || unix_group_name, group_id + $2
+						SELECT 0, group_id, $1 || unix_group_name, group_id + $2
 					FROM groups
 					WHERE group_id=$3',
 					 array ('scm_',
@@ -316,7 +316,7 @@
  	* sysRemoveGroup() - Remove a group
  	*
  	* @param		int		The ID of the group to remove
- 	* @returns true on success/false on error
+	* @return bool	true on success/false on error
  	*
  	*/
 	function sysRemoveGroup($group_id) {
@@ -366,11 +366,11 @@
 		if (forge_check_perm_for_user($u,'scm',$group_id,'write')) {
 			$res = db_query_params ('INSERT INTO nss_usergroups (
 SELECT users.unix_uid AS uid,
-       groups.group_id + $1 AS gid,
-       users.user_id AS user_id,
-       groups.group_id AS group_id,
-       users.user_name AS user_name,
-       $2 || groups.unix_group_name AS unix_group_name
+	   groups.group_id + $1 AS gid,
+	   users.user_id AS user_id,
+	   groups.group_id AS group_id,
+	   users.user_name AS user_name,
+	   $2 || groups.unix_group_name AS unix_group_name
 FROM users,groups
 WHERE users.user_id=$3
   AND users.status=$4
@@ -378,10 +378,10 @@
   AND groups.status=$6
   AND groups.group_id=$7)',
 						array($this->SCM_UID_ADD,
-						      'scm_',
-						      $user_id,
-						      'A', 'A', 'A',
-						      $group_id));
+							  'scm_',
+							  $user_id,
+							  'A', 'A', 'A',
+							  $group_id));
 			if (!$res) {
 				db_rollback();
 				$this->setError('Error: Cannot Update Group Member(s): '.db_error());
@@ -392,11 +392,11 @@
 		if ($u->isMember($p)) {
 			$res = db_query_params ('INSERT INTO nss_usergroups (
 SELECT users.unix_uid AS uid,
-       groups.group_id + $1 AS gid,
-       users.user_id AS user_id,
-       groups.group_id AS group_id,
-       users.user_name AS user_name,
-       groups.unix_group_name AS unix_group_name
+	   groups.group_id + $1 AS gid,
+	   users.user_id AS user_id,
+	   groups.group_id AS group_id,
+	   users.user_name AS user_name,
+	   groups.unix_group_name AS unix_group_name
 FROM users,groups
 WHERE users.user_id=$2
   AND users.status=$3
@@ -404,9 +404,9 @@
   AND groups.status=$5
   AND groups.group_id=$6)',
 						array ($this->GID_ADD,
-						       $user_id,
-						       'A', 'A', 'A',
-						       $group_id)) ;
+							   $user_id,
+							   'A', 'A', 'A',
+							   $group_id)) ;
 			if (!$res) {
 				$this->setError('Error: Cannot Update Group Member(s): '.db_error());
 				db_rollback () ;




More information about the Fusionforge-commits mailing list