[Fusionforge-commits] r17888 - in trunk/src/common: docman forum frs include

Marc-Etienne VARGENAU vargenau at fusionforge.org
Wed Sep 4 15:08:41 CEST 2013


Author: vargenau
Date: 2013-09-04 15:08:40 +0200 (Wed, 04 Sep 2013)
New Revision: 17888

Modified:
   trunk/src/common/docman/Parsedata.class.php
   trunk/src/common/forum/Forum.class.php
   trunk/src/common/forum/ForumHTML.class.php
   trunk/src/common/forum/ForumMessage.class.php
   trunk/src/common/forum/ForumsForUser.class.php
   trunk/src/common/frs/FRSRelease.class.php
   trunk/src/common/include/Codendi_Request.class.php
   trunk/src/common/include/Group.class.php
   trunk/src/common/include/account.php
Log:
Update PHP Doc; use tabs

Modified: trunk/src/common/docman/Parsedata.class.php
===================================================================
--- trunk/src/common/docman/Parsedata.class.php	2013-09-03 16:57:16 UTC (rev 17887)
+++ trunk/src/common/docman/Parsedata.class.php	2013-09-04 13:08:40 UTC (rev 17888)
@@ -44,12 +44,12 @@
 	/**
 	 * get_parse_data - analyse content and metadata
 	 *
-	 * @param	string	the path of the file to be analysed
-	 * @param	string	the file title
-	 * @param	string	the file description
-	 * @param	string	the file type
-	 * @param	string	the filename
-	 * @return	string	the analysed content
+	 * @param	string	$data			the path of the file to be analysed
+	 * @param	string	$title			the file title
+	 * @param	string	$description	the file description
+	 * @param	string	$filetype		the file type
+	 * @param	string	$filename		the filename
+	 * @return	string					the analysed content
 	 */
 	function get_parse_data($data, $title, $description, $filetype, $filename) {
 		$parser = "";
@@ -80,7 +80,7 @@
 	/**
 	 * get_parser_list - get the list of available parsers
 	 *
-	 * @param	string	the path where are located the parsers
+	 * @param	string	$parser_path	the path where are located the parsers
 	 * @return	array	available parsers
 	 */
 	function get_parser_list($parser_path) {

Modified: trunk/src/common/forum/Forum.class.php
===================================================================
--- trunk/src/common/forum/Forum.class.php	2013-09-03 16:57:16 UTC (rev 17887)
+++ trunk/src/common/forum/Forum.class.php	2013-09-04 13:08:40 UTC (rev 17888)
@@ -33,7 +33,7 @@
 /**
  * Gets a Forum object from its id
  *
- * @param	int	the Forum id
+ * @param	int	$forum_id	the Forum id
  * @return	object	the Forum object
  */
 function &forum_get_object($forum_id) {
@@ -84,7 +84,7 @@
 	 * @var	array	view_types.
 	 */
 	var $view_types;
-	
+
 	/**
 	 * flag : forum or news entry
 	 * @var int	is_news
@@ -119,7 +119,7 @@
 			//
 			$res = db_query_params('SELECT forum_id FROM news_bytes
 				WHERE forum_id=$1',
-			    array($group_forum_id));
+				array($group_forum_id));
 			$is_news = $res && db_numrows($res) >= 1;
 		}
 		if (!$is_news && !$Group->usesForum()) {
@@ -145,7 +145,7 @@
 			//	Make sure they can even access this object
 			//
 			if (!$is_news &&
-			    !forge_check_perm ('forum', $this->getID(), 'read')) {
+				!forge_check_perm ('forum', $this->getID(), 'read')) {
 				$this->setPermissionDeniedError();
 				$this->data_array = null;
 				return;
@@ -176,7 +176,7 @@
 			$this->setError(_('Forum description must be at least 10 characters.'));
 			return false;
 		}
-		if (!preg_match('/^([_\.0-9a-z-])*$/i',$forum_name)) {			
+		if (!preg_match('/^([_\.0-9a-z-])*$/i',$forum_name)) {
 			if (preg_match('/ /',$forum_name)){
 				$this->setError(_('Illegal characters in Forum name').' - '._('No space allowed.'));
 			}else{
@@ -467,7 +467,7 @@
 	 * stopMonitor - Remove the current user from the list of people monitoring the forum.
 	 *
 	 * @param $u
-	 * @return    boolean    success.
+	 * @return	boolean	success.
 	 */
 	function stopMonitor($u = -1) {
 		if ($u == -1) {
@@ -479,7 +479,7 @@
 		}
 		return db_query_params('DELETE FROM forum_monitored_forums WHERE user_id=$1 AND forum_id=$2',
 					array($u,
-					      $this->getID()));
+						  $this->getID()));
 	}
 
 	/**
@@ -590,7 +590,7 @@
 			$this->setError(_('Mailing List exists with same name.'));
 			return false;
 		}
-		
+
 		$res = db_query_params('UPDATE forum_group_list SET
 			forum_name=$1,
 			description=$2,
@@ -598,10 +598,10 @@
 			WHERE group_id=$4
 			AND group_forum_id=$5',
 					array(strtolower($forum_name),
-					      htmlspecialchars($description),
-					      $send_all_posts_to,
-					      $this->Group->getID(),
-					      $this->getID()));
+						  htmlspecialchars($description),
+						  $send_all_posts_to,
+						  $this->Group->getID(),
+						  $this->getID()));
 
 		if (!$res || db_affected_rows($res) < 1) {
 			$this->setError(_('Update failed')._(': ').db_error());

Modified: trunk/src/common/forum/ForumHTML.class.php
===================================================================
--- trunk/src/common/forum/ForumHTML.class.php	2013-09-03 16:57:16 UTC (rev 17887)
+++ trunk/src/common/forum/ForumHTML.class.php	2013-09-04 13:08:40 UTC (rev 17888)
@@ -137,13 +137,13 @@
 		if ($f) {
 			if ($f->isMonitoring()) {
 				echo util_make_link ('/forum/monitor.php?forum_id='.$forum_id.'&group_id='.$group_id.'&stop=1',
-							     html_image('ic/xmail16w.png').' '._('Stop Monitoring')).' | ';
+								 html_image('ic/xmail16w.png').' '._('Stop Monitoring')).' | ';
 			} else {
 				echo util_make_link ('/forum/monitor.php?forum_id='.$forum_id.'&group_id='.$group_id.'&start=1',
-						     html_image('ic/mail16w.png').' '._('Monitor Forum')).' | ';
+							 html_image('ic/mail16w.png').' '._('Monitor Forum')).' | ';
 			}
 			echo util_make_link ('/forum/save.php?forum_id='.$forum_id.'&group_id='.$group_id,
-					     html_image('ic/save.png') .' '._('Save Place')).' | ';
+						 html_image('ic/save.png') .' '._('Save Place')).' | ';
 		}
 	} elseif ($f) {
 		echo '<a href="/forum/monitor.php?forum_id='.$forum_id.'&group_id='.$group_id.'&start=1">' .
@@ -152,8 +152,8 @@
 
 	if ($f && $forum_id) {
 		echo util_make_link ('/forum/new.php?forum_id='.$forum_id.'&group_id='.$group_id,
-				     html_image('ic/write16w.png','20','20',array('alt'=>_('Start New Thread'))) .' '.
-				     _('Start New Thread'));
+					 html_image('ic/write16w.png','20','20',array('alt'=>_('Start New Thread'))) .' '.
+					 _('Start New Thread'));
 	}
 }
 
@@ -361,10 +361,14 @@
 		</table>
 
 		</fieldset>";
-
 	}
 
 
+	/**
+	 * @param string $msg_arr
+	 * @param string $msg_id
+	 * @return string
+	 */
 	function showNestedMessages ( &$msg_arr, $msg_id ) {
 		global $total_rows;
 
@@ -404,6 +408,12 @@
 		return $ret_val;
 	}
 
+	/**
+	 * @param $msg_arr
+	 * @param $msg_id
+	 * @param $level
+	 * @return string
+	 */
 	function showSubmessages(&$msg_arr, $msg_id, $level) {
 		/*
 			Recursive. Selects this message's id in this thread,

Modified: trunk/src/common/forum/ForumMessage.class.php
===================================================================
--- trunk/src/common/forum/ForumMessage.class.php	2013-09-03 16:57:16 UTC (rev 17887)
+++ trunk/src/common/forum/ForumMessage.class.php	2013-09-04 13:08:40 UTC (rev 17888)
@@ -45,7 +45,7 @@
 	 */
 	var $Forum;
 
-		/**
+	/**
 	 *  Constructor.
 	 *
 	 *	@param	$Forum  object	The Forum object to which this ForumMessage is associated.
@@ -248,7 +248,7 @@
 	 *	@param	int	The message_id of the parent message, if any.
 	 *	@param 	int	The id of the user that is posting the message
 	 *	@param  boolean	Whether the message has an attach associated. Defaults to false
-	 *	@param	int	The timestamp of the message to insert, defaults to 0. 
+	 *	@param	int	The timestamp of the message to insert, defaults to 0.
 	 *	@return	boolean success.
 	*/
 	function insertmsg($subject, $body, $thread_id='', $is_followup_to='',$user_id,$has_attach=false,$timestamp=0) {
@@ -401,8 +401,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())) ;
+					array($msg_id, $this->Forum->getID()));
 		if (!$res || db_numrows($res) < 1) {
 			$this->setError(_('Invalid Message Id'));
 			return false;
@@ -420,8 +419,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())) ;
+					array($msg_id, $this->Forum->getID()));
 		if (!$res || db_numrows($res) < 1) {
 			$this->setError(_('Invalid Message Id'));
 			return false;
@@ -623,7 +621,7 @@
 	/**
 	 *	sendNotice - contains the logic to send out email followups when a message is posted.
 	 *
-	 *	@param  boolean	Whether the message has an attach associated. Defaults to false
+	 *	@param  boolean	$has_attach Whether the message has an attach associated. Defaults to false
 	 *
 	 *	@return boolean success.
 	 */

Modified: trunk/src/common/forum/ForumsForUser.class.php
===================================================================
--- trunk/src/common/forum/ForumsForUser.class.php	2013-09-03 16:57:16 UTC (rev 17887)
+++ trunk/src/common/forum/ForumsForUser.class.php	2013-09-04 13:08:40 UTC (rev 17888)
@@ -38,7 +38,8 @@
 	/**
 	 *  Constructor.
 	 *
-	 *	@param	object	The Group object to which this forum is associated.
+	 *	@param	$user   object	The Group object to which this forum is associated.
+	 * @return bool
 	 */
 	function ForumsForUser(&$user) {
 		$this->User =& $user;

Modified: trunk/src/common/frs/FRSRelease.class.php
===================================================================
--- trunk/src/common/frs/FRSRelease.class.php	2013-09-03 16:57:16 UTC (rev 17887)
+++ trunk/src/common/frs/FRSRelease.class.php	2013-09-04 13:08:40 UTC (rev 17888)
@@ -28,8 +28,8 @@
 /**
  *	  Factory method which creates a FRSRelease from an release id
  *
- *	  @param int	  The release id
- *	  @param array	The result array, if it's passed in
+ *	  @param int	$release_id	The release id
+ *	  @param array	$data		  The result array, if it's passed in
  *	  @return object  FRSRelease object
  */
 function frsrelease_get_object($release_id, $data = false) {
@@ -109,11 +109,11 @@
 	/**
 	 *	create - create a new release in the database.
 	 *
-	 *	@param	string	The name of the release.
-	 *	@param	string	The release notes for the release.
-	 *	@param	string	The change log for the release.
-	 *	@param	int	Whether the notes/log are preformatted with \n chars (1) true (0) false.
-	 *	@param	int	The unix date of the release.
+	 *	@param	string	$name	The name of the release.
+	 *	@param	string	$notes	The release notes for the release.
+	 *	@param	string	$changes	The change log for the release.
+	 *	@param	int	$preformatted	Whether the notes/log are preformatted with \n chars (1) true (0) false.
+	 *	@param	int	$release_date	The unix date of the release.
 	 *	@return	boolean success.
 	 */
 	function create($name,$notes,$changes,$preformatted,$release_date=false) {
@@ -138,7 +138,7 @@
 		}
 		$res = db_query_params ('SELECT * FROM frs_release WHERE package_id=$1 AND name=$2',
 					array ($this->FRSPackage->getID(),
-					       htmlspecialchars($name))) ;
+						   htmlspecialchars($name))) ;
 		if (db_numrows($res)) {
 			$this->setError(_('Error Adding Release: Name Already Exists'));
 			return false;
@@ -182,7 +182,7 @@
 	function fetchData($release_id) {
 		$res = db_query_params ('SELECT * FROM frs_release WHERE release_id=$1 AND package_id=$2',
 					array ($release_id,
-					       $this->FRSPackage->getID())) ;
+						   $this->FRSPackage->getID())) ;
 		if (!$res || db_numrows($res) < 1) {
 			$this->setError(_('Invalid release_id'));
 			return false;
@@ -284,8 +284,8 @@
 		$date = date('Y-m-d H:i',time());
 
 		$subject = sprintf (_('[%1$s Release] %2$s'),
-				    $this->FRSPackage->Group->getUnixName(),
-				    $this->FRSPackage->getName());
+					$this->FRSPackage->Group->getUnixName(),
+					$this->FRSPackage->getName());
 		$text = stripcslashes(sprintf(_('Project %1$s (%2$s) has released a new version of package “%3$s”.'),
 										$this->FRSPackage->Group->getPublicName(),
 										$this->FRSPackage->Group->getUnixName(),
@@ -313,11 +313,11 @@
 			util_handle_message(array_unique($arr),$subject,$text);
 		}
 	}
-	
+
 	/**
 	 *	newFRSFile - generates a FRSFile (allows overloading by subclasses)
 	 *
-	 *  @param  string	FRS file identifier 
+	 *  @param  string	FRS file identifier
 	 *  @param  array	fetched data from the DB
 	 *	@return	FRSFile	new FRSFile object.
 	 */
@@ -414,7 +414,7 @@
 		if($this->getName() != htmlspecialchars($name)) {
 			$res = db_query_params ('SELECT * FROM frs_release WHERE package_id=$1 AND name=$2',
 						array ($this->FRSPackage->getID(),
-						       htmlspecialchars($name))) ;
+							   htmlspecialchars($name))) ;
 			if (db_numrows($res)) {
 				$this->setError(_('Error On Update: Name Already Exists'));
 				return false;
@@ -425,14 +425,14 @@
 			changes=$4,preformatted=$5,release_date=$6,released_by=$7
 			WHERE package_id=$8 AND release_id=$9',
 					array (htmlspecialchars($name),
-					       $status,
-					       htmlspecialchars($notes),
-					       htmlspecialchars($changes),
-					       $preformatted,
-					       $release_date,
-					       user_getid(),
-					       $this->FRSPackage->getID(),
-					       $this->getID())) ;
+						   $status,
+						   htmlspecialchars($notes),
+						   htmlspecialchars($changes),
+						   $preformatted,
+						   $release_date,
+						   user_getid(),
+						   $this->FRSPackage->getID(),
+						   $this->getID())) ;
 
 		if (!$res || db_affected_rows($res) < 1) {
 			$this->setError(_('Error On Update: ').db_error());

Modified: trunk/src/common/include/Codendi_Request.class.php
===================================================================
--- trunk/src/common/include/Codendi_Request.class.php	2013-09-03 16:57:16 UTC (rev 17887)
+++ trunk/src/common/include/Codendi_Request.class.php	2013-09-04 13:08:40 UTC (rev 17888)
@@ -73,7 +73,8 @@
 	 * @access private
 	 * @param string $variable Name of the parameter to get.
 	 * @param array $array Name of the parameter to get.
-	 */
+     * @return bool
+     */
 	function _get($variable, $array) {
 		if ($this->_exist($variable, $array)) {
 			return $array[$variable];
@@ -160,7 +161,8 @@
 	 * @param string $variable Name of the parameter to get.
 	 * @param mixed $validator Name of the validator (string, uint, email) or an instance of a validator
 	 * @param mixed $default_value Value return if the validator is not valid. Optional, default is null.
-	 */
+     * @return mixed
+     */
 	function getValidated($variable, $validator = 'string', $default_value = null) {
 		/*$is_valid = false;
 		  if ($v = ValidFactory::getInstance($validator, $variable)) {

Modified: trunk/src/common/include/Group.class.php
===================================================================
--- trunk/src/common/include/Group.class.php	2013-09-03 16:57:16 UTC (rev 17887)
+++ trunk/src/common/include/Group.class.php	2013-09-04 13:08:40 UTC (rev 17888)
@@ -160,7 +160,7 @@
 /**
  * get_public_active_projects_asc() - Get a list of rows for public active projects (initially in trove/full_list)
  *
- * @param	   int	 Opional Maximum number of rows to limit query length 
+ * @param	   int	 Opional Maximum number of rows to limit query length
  */
 function get_public_active_projects_asc($max_query_limit = -1) {
 
@@ -627,7 +627,7 @@
 
 		// Log the audit trail
 		$this->addHistory('Changed Public Info', '');
-		
+
 		if (!$this->fetchData($this->getID())) {
 			db_rollback();
 			return false;
@@ -2060,7 +2060,7 @@
 			db_rollback();
 			return false;
 		}
-		
+
 		//
 		//	reassign open artifacts to id=100
 		//
@@ -2330,7 +2330,7 @@
 				$r->addUser(user_get_object ($idadmin_group));
 			}
 		}
-		
+
 		// Temporarily switch to the submitter's identity
 		$saved_session = session_get_user();
 		session_set_internal($idadmin_group);
@@ -2582,7 +2582,6 @@
 		return true;
 	}
 
-
 	/**
 	 * sendRejectionEmail - Send project rejection email.
 	 *
@@ -2937,6 +2936,7 @@
  * group_getname() - get the group name
  *
  * @param	   int	 The group ID
+ * @return string
  * @deprecated
  *
  */
@@ -2953,6 +2953,7 @@
  * group_getunixname() - get the unixname for a group
  *
  * @param	   int	 The group ID
+ * @return string
  * @deprecated
  *
  */
@@ -2969,6 +2970,7 @@
  * group_get_result() - Get the group object result ID.
  *
  * @param	   int	 The group ID
+ * @return int
  * @deprecated
  *
  */

Modified: trunk/src/common/include/account.php
===================================================================
--- trunk/src/common/include/account.php	2013-09-03 16:57:16 UTC (rev 17887)
+++ trunk/src/common/include/account.php	2013-09-04 13:08:40 UTC (rev 17888)
@@ -25,8 +25,8 @@
 /**
  * account_pwvalid() - Validates a password
  *
- * @param		string	The plaintext password string
- * @returns		true on success/false on failure
+ * @param		string	$pw	The plaintext password string
+ * @return		bool	true on success/false on failure
  *
  */
 function account_pwvalid($pw) {
@@ -40,9 +40,9 @@
 /**
  * account_namevalid() - Validates a login username
  *
- * @param		string	The username string
- * @param		bool	Check for an unix username
- * @returns		true on success/false on failure
+ * @param		string	$name	The username string
+ * @param		bool	$unix	Check for an unix username
+ * @return		bool	true on success/false on failure
  *
  */
 function account_namevalid($name, $unix=0) {
@@ -105,8 +105,8 @@
 /**
  * account_groupnamevalid() - Validates an account group name
  *
- * @param		string	The group name string
- * @returns		true on success/false on failure
+ * @param		string	$name	The group name string
+ * @return		bool	true on success/false on failure
  *
  */
 function account_groupnamevalid($name) {
@@ -183,7 +183,7 @@
 /**
  * account_genunixpw() - Generate unix password
  *
- * @param	string	The plaintext password string
+ * @param	string	$plainpw	The plaintext password string
  * @return	string	The encrypted password
  *
  */
@@ -203,12 +203,12 @@
  *
  */
 function account_get_user_default_shell() {
-        $user_default_shell = forge_get_config('user_default_shell');
-        if (! isset($user_default_shell)) {
-           // same as in DB schema before that config var was introduced
-           $user_default_shell = '/bin/bash';
-        }
-        return $user_default_shell;
+	$user_default_shell = forge_get_config('user_default_shell');
+	if (! isset($user_default_shell)) {
+		// same as in DB schema before that config var was introduced
+		$user_default_shell = '/bin/bash';
+	}
+	return $user_default_shell;
 }
 
 /**
@@ -222,8 +222,8 @@
 	if(! file_exists($shells_file) ) {
 		// otherwise, fallback to /etc/shells
 		$shells_file = '/etc/shells';
-        }
-        $shells = file($shells_file);
+	}
+	$shells = file($shells_file);
 
 	$out_shells = array();
 	foreach ($shells as $s) {
@@ -256,28 +256,28 @@
 	$html = '';
 
 	$shells = account_getavailableshells();
-	
-        $found = false;
-        for ($i = 0; $i < count($shells); $i++) {
-                $this_shell = $shells[$i];
-		
-                if ($current == $this_shell) {
-                        $found = true;
-                        $html .= "<option selected=\"selected\" value=\"$this_shell\">$this_shell</option>\n";
-                } else {
+
+	$found = false;
+	for ($i = 0; $i < count($shells); $i++) {
+		$this_shell = $shells[$i];
+
+		if ($current == $this_shell) {
+			$found = true;
+			$html .= "<option selected=\"selected\" value=\"$this_shell\">$this_shell</option>\n";
+		} else {
 			// the last one is supposed to be the default, so select it if not found current shell to observe default settings
 			if ( ($i == (count($shells) - 1)) && (! $found)) {
 				$html .= "<option selected=\"selected\" value=\"$this_shell\">$this_shell</option>\n";
 			} else {
 				$html .= "<option value=\"$this_shell\">$this_shell</option>\n";
 			}
-                }
-        }
-        if(! $found) {
+		}
+	}
+	if (!$found) {
 		// add the current option but unselectable -> defaults to cvssh if no other option in /var/lib/gforge/chroot/etc/shells
 		$html .= "<option value=\"$current\" disabled=\"disabled\">$current</option>\n";
 	}
-        echo $html;
+	echo $html;
 }
 
 /**




More information about the Fusionforge-commits mailing list