[Fusionforge-commits] r17945 - in trunk/src/common: forum frs include search survey

Marc-Etienne VARGENAU vargenau at fusionforge.org
Thu Sep 12 19:41:31 CEST 2013


Author: vargenau
Date: 2013-09-12 19:41:31 +0200 (Thu, 12 Sep 2013)
New Revision: 17945

Modified:
   trunk/src/common/forum/ForumAdmin.class.php
   trunk/src/common/forum/ForumMessage.class.php
   trunk/src/common/forum/ForumMessageFactory.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/Plugin.class.php
   trunk/src/common/include/System.class.php
   trunk/src/common/search/DocsAllSearchQuery.class.php
   trunk/src/common/survey/SurveyResponseFactory.class.php
Log:
Update PHP Doc

Modified: trunk/src/common/forum/ForumAdmin.class.php
===================================================================
--- trunk/src/common/forum/ForumAdmin.class.php	2013-09-12 15:32:42 UTC (rev 17944)
+++ trunk/src/common/forum/ForumAdmin.class.php	2013-09-12 17:41:31 UTC (rev 17945)
@@ -47,10 +47,11 @@
 	/**
 	 *  PrintAdminMessageOptions - prints the different administrator options for a message
 	 *
-	 *	@param   integer	The Message ID
-	 *	@param   integer	The Project ID
-	 *	@param   integer	The Thread ID : to return to the message if the user cancels (forumhtml only, not message.php)
-	 *	@param   integer	The Forum ID : to return to the message if the user cancels (forumhtml only, not message.php)
+	 *	@param   int	$msg_id		The Message ID
+	 *	@param   int	$group_id	The Project ID
+	 *	@param   int	$thread_id	The Thread ID : to return to the message if the user cancels (forumhtml only, not message.php)
+	 *	@param   int	$forum_id	The Forum ID : to return to the message if the user cancels (forumhtml only, not message.php)
+	 *	@param	 int	$return_to_message
 	 *	@return  The HTML output
 	 */
 
@@ -127,8 +128,8 @@
 	 *  Authorized - authorizes and returns true if the user is authorized for the group, or false.
 	 *
 	 *  @param  string	 The group id.
-     *	@return bool
-     */
+	 *	@return bool
+	 */
 
 	function Authorized($group_id) {
 		if (!$group_id) {
@@ -157,8 +158,8 @@
 	 *  ExecuteAction - Executes the action passed as parameter
 	 *
 	 *  @param  string	 action to execute.
-     *	@return string
-     */
+	 *	@return string
+	 */
 	function ExecuteAction ($action) {
 		global $HTML;
 

Modified: trunk/src/common/forum/ForumMessage.class.php
===================================================================
--- trunk/src/common/forum/ForumMessage.class.php	2013-09-12 15:32:42 UTC (rev 17944)
+++ trunk/src/common/forum/ForumMessage.class.php	2013-09-12 17:41:31 UTC (rev 17945)
@@ -48,11 +48,11 @@
 	/**
 	 *  Constructor.
 	 *
-	 *	@param	object	$Forum 		The Forum object to which this ForumMessage is associated.
-	 *  @param  int		$msg_id 	The message_id.
-	 *  @param  array	$arr		The associative array of data.
-	 *	@param 	bool	$pending	Whether the message is a pending one.
-	 *	@return	bool	success.
+	 * @param	object		$Forum		The Forum object to which this ForumMessage is associated.
+	 * @param	bool|int	$msg_id		The message_id.
+	 * @param	array		$arr		The associative array of data.
+	 * @param	bool		$pending	Whether the message is a pending one.
+	 * @return	bool		success.
 	 */
 	function ForumMessage(&$Forum, $msg_id=false, $arr=array(), $pending=false) {
 		$this->Error();
@@ -97,15 +97,15 @@
 
 /**
 	*	insertmoderated - inserts the message into the table for moderation (forum_pending_messages)
-	 *	@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
+	 *	@param	string	$subject			The subject of the message.
+	 *	@param	string	$body				The body of the message.
+	 *	@param	int		$thread_id			The thread_id of the message, if known.
+	 *	@param	int		$is_followup_to 	The message_id of the parent message, if any.
+	 *	@param 	int		$user_id		The id of the user that is posting the message
 	 *	@return	boolean success.
 	*/
 
-	function insertmoderated($subject, $body, $thread_id='', $is_followup_to='',$user_id) {
+	function insertmoderated($subject, $body, $thread_id=0, $is_followup_to=0,$user_id) {
 		if (!$thread_id) {
 			$thread_id=$this->Forum->getNextThreadID();
 			$is_followup_to=0;
@@ -344,12 +344,12 @@
 	/**
 	 *	create - use this function to create a new message in the database.
 	 *
-	 *	@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  boolean	Whether the message has an attach associated. Defaults to false
-	 *	@param	int	The timestamp of the message to create. Defaults to 0, meaning the timestamp used for this message will be "time()"
+	 *	@param	string	$subject		The subject of the message.
+	 *	@param	string	$body			The body of the message.
+	 *	@param	int		$thread_id		The thread_id of the message, if known.
+	 *	@param	int		$is_followup_to	The message_id of the parent message, if any.
+	 *	@param  bool	$has_attach		Whether the message has an attach associated. Defaults to false
+	 *	@param	int		$timestamp		The timestamp of the message to create. Defaults to 0, meaning the timestamp used for this message will be "time()"
 	 *	@return	boolean success.
 	 */
 	function create($subject, $body, $thread_id='', $is_followup_to='',$has_attach=false, $timestamp = 0) {

Modified: trunk/src/common/forum/ForumMessageFactory.class.php
===================================================================
--- trunk/src/common/forum/ForumMessageFactory.class.php	2013-09-12 15:32:42 UTC (rev 17944)
+++ trunk/src/common/forum/ForumMessageFactory.class.php	2013-09-12 17:41:31 UTC (rev 17945)
@@ -136,9 +136,10 @@
 	}
 
 	/**
-	 *	nestArray - take an array of Forum Messages and building a multi-dimensional associative array for followups.
+	 * nestArray - take an array of Forum Messages and building a multi-dimensional associative array for followups.
 	 *
-	 *	@return	array	The nested multi-dimensional associative array.
+	 * @param	array	$row
+	 * @return	array	The nested multi-dimensional associative array.
 	 */
 	function &nestArray($row) {
 		$cnt=count($row);
@@ -151,9 +152,10 @@
 	}
 
 	/**
-	 *	getNested - Return an array of ForumMessage objects arranged for nested forum views.
+	 * getNested - Return an array of ForumMessage objects arranged for nested forum views.
 	 *
-	 *	@return	array	The array of ForumMessages.
+	 * @param	bool	$thread_id
+	 * @return	array   The array of ForumMessages.
 	 */
 	function &getNested($thread_id=false) {
 		if ($this->forum_messages) {
@@ -192,9 +194,10 @@
 	}
 
 	/**
-	 *	getThreaded - Return an array of ForumMessage objects arranged for threaded forum views.
+	 *    getThreaded - Return an array of ForumMessage objects arranged for threaded forum views.
 	 *
-	 *	@return	array	The array of ForumMessages.
+	 * @param	bool	$thread_id
+	 * @return	array	The array of ForumMessages.
 	 */
 	function &getThreaded($thread_id=false) {
 		if ($this->forum_messages) {

Modified: trunk/src/common/frs/FRSRelease.class.php
===================================================================
--- trunk/src/common/frs/FRSRelease.class.php	2013-09-12 15:32:42 UTC (rev 17944)
+++ trunk/src/common/frs/FRSRelease.class.php	2013-09-12 17:41:31 UTC (rev 17945)
@@ -32,7 +32,7 @@
  *	  @param array	$data		  The result array, if it's passed in
  *	  @return object  FRSRelease object
  */
-function frsrelease_get_object($release_id, $data = false) {
+function frsrelease_get_object($release_id, $data = array()) {
 	global $FRSRELEASE_OBJ;
 	if (!isset($FRSRELEASE_OBJ['_'.$release_id.'_'])) {
 		if ($data) {

Modified: trunk/src/common/include/Codendi_Request.class.php
===================================================================
--- trunk/src/common/include/Codendi_Request.class.php	2013-09-12 15:32:42 UTC (rev 17944)
+++ trunk/src/common/include/Codendi_Request.class.php	2013-09-12 17:41:31 UTC (rev 17945)
@@ -40,12 +40,11 @@
 	 * Constructor
 	 */
 	function Codendi_Request($params) {
-		$this->params                = $params;
-		$this->_validated_input      = array();
+		$this->params = $params;
+		$this->_validated_input = array();
 		$this->_last_access_to_input = array();
 	}
 
-
 	/**
 	 * Get the value of $variable in $this->params (user submitted values).
 	 *
@@ -73,8 +72,8 @@
 	 * @access private
 	 * @param string $variable Name of the parameter to get.
 	 * @param array $array Name of the parameter to get.
-     * @return bool
-     */
+	 * @return bool
+	 */
 	function _get($variable, $array) {
 		if ($this->_exist($variable, $array)) {
 			return $array[$variable];
@@ -83,20 +82,20 @@
 		}
 	}
 
-/**
-     * Returns from where the variable is accessed.
-     *
-     * @return string
-     */
-    function _getCallTrace() {
-        $backtrace = debug_backtrace();
-        $files = explode('/', $backtrace[1]['file']);
-        return $files[count($files) - 4] . '/'.
-            $files[count($files) - 3] . '/'.
-            $files[count($files) - 2] . '/'.
-            $files[count($files) - 1] . ' Line: '.
-            $backtrace[1]['line'];
-    }
+	/**
+	 * Returns from where the variable is accessed.
+	 *
+	 * @return string
+	 */
+	function _getCallTrace() {
+		$backtrace = debug_backtrace();
+		$files = explode('/', $backtrace[1]['file']);
+		return $files[count($files) - 4] . '/'.
+			$files[count($files) - 3] . '/'.
+			$files[count($files) - 2] . '/'.
+			$files[count($files) - 1] . ' Line: '.
+			$backtrace[1]['line'];
+	}
 
 
 	/**
@@ -114,6 +113,7 @@
 	 *
 	 * @access private
 	 * @param string $variable Name of the parameter.
+	 * @param array	$array
 	 * @return boolean
 	 */
 	function _exist($variable, $array) {
@@ -161,8 +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
-     */
+	 * @return mixed
+	 */
 	function getValidated($variable, $validator = 'string', $default_value = null) {
 		/*$is_valid = false;
 		  if ($v = ValidFactory::getInstance($validator, $variable)) {
@@ -173,37 +173,35 @@
 		  return $is_valid ? $this->get($variable) : $default_value;*/
 		return $this->get($variable);
 	}
- /**
-     * Apply validator on submitted user array.
-     *
-     * @param string Index in the user submitted values where the array stands.
-     * @param Valid  Validator to apply
-     * @return boolean
-     */
-    function validInArray($index, &$validator) {
-        $this->_validated_input[$index][$validator->getKey()] = true;
-        return $validator->validate($this->getInArray($index, $validator->getKey()));
-    }
- /**
-     * Get value of $idx[$variable] in $this->params (user submitted values).
-     *
-     * @param string The index of the variable array in $this->params.
-     * @param string Name of the parameter to get.
-     * @return mixed If the variable exist, the value is returned (string)
-     * otherwise return false;
-     */
-    function getInArray($idx, $variable) {
-        $this->_last_access_to_input[$idx][$variable] = $this->_getCallTrace();
-        if(is_array($this->params[$idx])) {
-            return $this->_get($variable, $this->params[$idx]);
-        } else {
-            return false;
-        }
-    }
-function isAjax() {
-        return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtoupper($_SERVER['HTTP_X_REQUESTED_WITH']) == 'XMLHTTPREQUEST';
-    }
+	/**
+	 * Apply validator on submitted user array.
+	 *
+	 * @param string Index in the user submitted values where the array stands.
+	 * @param Valid  Validator to apply
+	 * @return boolean
+	 */
+	function validInArray($index, &$validator) {
+		$this->_validated_input[$index][$validator->getKey()] = true;
+		return $validator->validate($this->getInArray($index, $validator->getKey()));
+	}
+	/**
+	 * Get value of $idx[$variable] in $this->params (user submitted values).
+	 *
+	 * @param string $idx		The index of the variable array in $this->params.
+	 * @param string $variable	Name of the parameter to get.
+	 * @return mixed If the variable exist, the value is returned (string)
+	 * otherwise return false;
+	 */
+	function getInArray($idx, $variable) {
+		$this->_last_access_to_input[$idx][$variable] = $this->_getCallTrace();
+		if(is_array($this->params[$idx])) {
+			return $this->_get($variable, $this->params[$idx]);
+		} else {
+			return false;
+		}
+	}
 
-
-
+	function isAjax() {
+		return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtoupper($_SERVER['HTTP_X_REQUESTED_WITH']) == 'XMLHTTPREQUEST';
+	}
 }

Modified: trunk/src/common/include/Group.class.php
===================================================================
--- trunk/src/common/include/Group.class.php	2013-09-12 15:32:42 UTC (rev 17944)
+++ trunk/src/common/include/Group.class.php	2013-09-12 17:41:31 UTC (rev 17945)
@@ -232,7 +232,7 @@
 	 *
 	 * @param int|bool $id  Required - Id of the group you want to instantiate.
 	 * @param int|bool $res Database result from select query OR associative array of all columns.
-	 * @return boolean Success or not
+	 * @return bool Success or not
 	 */
 	function __construct($id = false, $res = false) {
 		$this->Error();

Modified: trunk/src/common/include/Plugin.class.php
===================================================================
--- trunk/src/common/include/Plugin.class.php	2013-09-12 15:32:42 UTC (rev 17944)
+++ trunk/src/common/include/Plugin.class.php	2013-09-12 17:41:31 UTC (rev 17945)
@@ -37,7 +37,7 @@
 	/**
 	 * Plugin() - constructor
 	 *
-	 * @param	int	id
+	 * @param	int	$id
 	 */
 	function Plugin($id=0) {
 		$this->Error();
@@ -56,6 +56,7 @@
 	/**
 	 * _addHooks() - add a hook to the list of hooks.
 	 *
+	 * @param	string	$name
 	 * @return	string	name of the added hook
 	 */
 	function _addHook($name) {
@@ -86,6 +87,7 @@
 	/**
 	 * provide() - return true if plugin provides the feature.
 	 *
+	 * @param	string	$feature
 	 * @return	bool	if feature is provided or not.
 	 */
 	function provide($feature) {

Modified: trunk/src/common/include/System.class.php
===================================================================
--- trunk/src/common/include/System.class.php	2013-09-12 15:32:42 UTC (rev 17944)
+++ trunk/src/common/include/System.class.php	2013-09-12 17:41:31 UTC (rev 17945)
@@ -24,7 +24,7 @@
 
 class System extends Error {
 	/**
-	 *    System()
+	 * System()
 	 *
 	 */
 	function System() {
@@ -115,9 +115,9 @@
 	/**
 	 * sysUserSetAttribute() - Set an attribute for a user
 	 *
-	 * @param  int    $user_id  The user ID
-	 * @param  string $attr     The attribute to set
-	 * @param  string $value    The new value of the attribute
+	 * @param  int		$user_id	The user ID
+	 * @param  string	$attr		The attribute to set
+	 * @param  string	$value		The new value of the attribute
 	 * @return bool true on success/false on error
 	 *
 	 */
@@ -132,7 +132,7 @@
 	/**
 	 * sysCheckGroup() - Check for the existence of a group
 	 *
-	 * @param        int        The ID of the group to check
+	 * @param  int	 The ID of the group to check
 	 * @return bool True on success/false on error
 	 *
 	 */
@@ -144,7 +144,7 @@
 	 * sysCreateGroup() - Create a group
 	 *
 	 * @param	int		The ID of the group to create
-     * @return	bool	true on success/false on error
+	 * @return	bool	true on success/false on error
 	 *
 	 */
 	function sysCreateGroup($group_id) {
@@ -155,7 +155,7 @@
 	 * sysRemoveGroup() - Remove a group
 	 *
 	 * @param	int		The ID of the group to remove
-     * @return	bool	true on success/false on error
+	 * @return	bool	true on success/false on error
 	 *
 	 */
 	function sysRemoveGroup($group_id) {
@@ -167,7 +167,7 @@
 	 *
 	 * @param	int		The ID of the group two which the user will be added
 	 * @param	int		The ID of the user to add
-     * @return	bool	true on success/false on error
+	 * @return	bool	true on success/false on error
 	 *
 	 */
 	function sysGroupCheckUser($group_id, $user_id) {
@@ -180,7 +180,7 @@
 	 * @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
-     * @return	bool	true on success/false on error
+	 * @return	bool	true on success/false on error
 	 *
 	 */
 	function sysGroupAddUser($group_id, $user_id, $cvs_only = 0) {
@@ -190,26 +190,26 @@
 	/**
 	 * sysGroupRemoveUser() - Remove a user from a group
 	 *
-	 * @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
+	 * @param	int		$group_id	The ID of the group from which to remove the user
+	 * @param	int		$user_id	The ID of the user to remove
+	 * @param	bool	$cvs_only	Only remove user from CVS group
 	 * @return	bool	true on success/false on error
 	 *
 	 */
-	function sysGroupRemoveUser($group_id, $user_id, $cvs_only = 0) {
+	function sysGroupRemoveUser($group_id, $user_id, $cvs_only = false) {
 		return true;
 	}
 
 	/**
 	 * sysGroupUpdateUser() - Remove a user from a group
 	 *
-	 * @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
+	 * @param	int		$group_id	The ID of the group from which to remove the user
+	 * @param	int		$user_id	The ID of the user to remove
+	 * @param	bool	$cvs_only	Only remove user from CVS group
 	 * @return	bool	true on success/false on error
 	 *
 	 */
-	function sysGroupUpdateUser($group_id, $user_id, $cvs_only = 0) {
+	function sysGroupUpdateUser($group_id, $user_id, $cvs_only = false) {
 		$this->sysGroupRemoveUser($group_id, $user_id, $cvs_only);
 		$this->sysGroupAddUser($group_id, $user_id, $cvs_only);
 		return true;

Modified: trunk/src/common/search/DocsAllSearchQuery.class.php
===================================================================
--- trunk/src/common/search/DocsAllSearchQuery.class.php	2013-09-12 15:32:42 UTC (rev 17944)
+++ trunk/src/common/search/DocsAllSearchQuery.class.php	2013-09-12 17:41:31 UTC (rev 17945)
@@ -38,11 +38,12 @@
 	/**
 	 * Constructor
 	 *
-	 * @param	string	$words words we are searching for
-	 * @param	int	$offset offset
-	 * @param	boolean	$isExact if we want to search for all the words or if only one matching the query is sufficient
-	 * @param	array	$sections sections to search in
-	 * @param	boolean	$showNonPublic flag if private sections are searched too
+	 * @param    string $words words we are searching for
+	 * @param    int $offset offset
+	 * @param    bool $isExact if we want to search for all the words or if only one matching the query is sufficient
+	 * @param int|string $sections sections to search in
+	 * @param    array $parametersValues
+	 * @param    bool $showNonPublic flag if private sections are searched too
 	 */
 	function __construct($words, $offset, $isExact = true, $sections=SEARCH__ALL_SECTIONS, $parametersValues, $showNonPublic = false) {
 		$this->parametersValues = $parametersValues;

Modified: trunk/src/common/survey/SurveyResponseFactory.class.php
===================================================================
--- trunk/src/common/survey/SurveyResponseFactory.class.php	2013-09-12 15:32:42 UTC (rev 17944)
+++ trunk/src/common/survey/SurveyResponseFactory.class.php	2013-09-12 17:41:31 UTC (rev 17945)
@@ -28,18 +28,18 @@
 
 class SurveyResponseFactory extends Error {
 
-       /**
-        * The Survey object.
-        *
-        * @var	 object  $Survey.
-        */
+	/**
+	* The Survey object.
+	*
+	* @var	 object  $Survey.
+	*/
 	var $Survey;
 
-       /**
-        * The Question object.
-        *
-        * @var	 object  $Question.
-        */
+	/**
+	* The Question object.
+	*
+	* @var	 object  $Question.
+	*/
 	var $Question;
 
 	/**
@@ -69,28 +69,28 @@
 	 *	@param	object	$survey		The Survey object
 	 *	@param	object	$question	The Question object to which this survey Response is associated.
 	 */
-	function __construct(&$Survey, &$Question ) {
+	function __construct(&$survey, &$question ) {
 		$this->Error();
 
-		if (!$Survey || !is_object($Survey)) {
+		if (!$survey || !is_object($survey)) {
 			$this->setError(_('No valid Survey Object'));
 			return;
 		}
-		if ($Survey->isError()) {
-			$this->setError(_('Survey').':: '.$Survey->getErrorMessage());
+		if ($survey->isError()) {
+			$this->setError(_('Survey').':: '.$survey->getErrorMessage());
 			return;
 		}
-		if (!$Question || !is_object($Question)) {
+		if (!$question || !is_object($question)) {
 			$this->setError(_('No valid Question Object'));
 			return;
 		}
-		if ($Question->isError()) {
-			$this->setError(_('Survey').':: '.$Question->getErrorMessage());
+		if ($question->isError()) {
+			$this->setError(_('Survey').':: '.$question->getErrorMessage());
 			return;
 		}
 
-		$this->Survey = &$Survey;
-		$this->Question = &$Question;
+		$this->Survey = &$survey;
+		$this->Question = &$question;
 	}
 
 	/**
@@ -103,7 +103,7 @@
 		return $Survey->Group;
 	}
 
-        /**
+	/**
 	 *	getSurvey - get the Survey object this SurveyResponse is associated with.
 	 *
 	 *	@return object	The Survey object.
@@ -112,7 +112,7 @@
 		return $this->Survey;
 	}
 
-        /**
+	/**
 	 *	getQuestion - get the Question object this SurveyResponse is associated with.
 	 *
 	 *	@return object	The Question object.
@@ -123,7 +123,7 @@
 
 	/**
 	 *	getSurveyResponses - get an array of Survey Response objects
-         *                           for the Survey and Question
+	 *                           for the Survey and Question
 	 *
  	 *	@return	array	The array of Survey Response objects.
 	 */




More information about the Fusionforge-commits mailing list