[Fusionforge-commits] FusionForge branch master updated. 12d0102 small clean-up after sonar analysis

Franck Villaume nerville at libremir.placard.fr.eu.org
Sun Jun 14 12:03:19 CEST 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  12d0102cf37523f8f11e364e2e8c16bc5e02da05 (commit)
      from  fc64f4230f1217d59ef59d431aa849175cc04280 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 12d0102cf37523f8f11e364e2e8c16bc5e02da05
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Jun 14 12:03:09 2015 +0200

    small clean-up after sonar analysis

diff --git a/src/common/docman/Document.class.php b/src/common/docman/Document.class.php
index 837a3b0..0422acf 100644
--- a/src/common/docman/Document.class.php
+++ b/src/common/docman/Document.class.php
@@ -939,7 +939,7 @@ class Document extends Error {
 
 		$groupUsers = $this->Group->getUsers();
 		$rbacEngine = RBACEngine::getInstance();
-		foreach ($groupUsers as $key => $groupUser) {
+		foreach ($groupUsers as $groupUser) {
 			if ($rbacEngine->isActionAllowedForUser($groupUser, 'docman', $group_id, 'approve')) {
 				$bcc .= $groupUser->getEmail().',';
 			}
diff --git a/src/common/docman/DocumentManager.class.php b/src/common/docman/DocumentManager.class.php
index a6d95ac..afe2a47 100644
--- a/src/common/docman/DocumentManager.class.php
+++ b/src/common/docman/DocumentManager.class.php
@@ -243,7 +243,6 @@ class DocumentManager extends Error {
 				}
 				$returnString .= '}';
 				return $returnString;
-				break;
 			}
 			default: {
 				return $stateQuery;
@@ -269,8 +268,8 @@ class DocumentManager extends Error {
 		switch ($format) {
 			case 'json': {
 				$returnString = '[';
-				for ($i=0; $i<$rows; $i++) {
-                    $returnString .= '['.$id_array[$i].',\''.util_html_secure(addslashes($text_array[$i])).'\'],';
+				for ($i = 0; $i < $rows; $i++) {
+					$returnString .= '['.$id_array[$i].',\''.util_html_secure(addslashes($text_array[$i])).'\'],';
 				}
 				$returnString .= ']';
 				break;
diff --git a/src/common/forum/ForumHTML.class.php b/src/common/forum/ForumHTML.class.php
index c7d02fb..8840c85 100644
--- a/src/common/forum/ForumHTML.class.php
+++ b/src/common/forum/ForumHTML.class.php
@@ -116,7 +116,6 @@ function forum_header($params) {
 				$menu_links[]='/forum/admin/?group_id='.$group_id;
 			}
 		} else {
-			$gg = group_get_object($group_id);
 			if (forge_check_perm ('forum_admin', $group_id)) {
 				$menu_text[]=_('Administration');
 				$menu_links[]='/forum/admin/?group_id='.$group_id;
@@ -173,7 +172,7 @@ class ForumHTML extends Error {
 	 */
 	var $Forum;
 
-	function ForumHTML(&$Forum) {
+	function __construct(&$Forum) {
 		$this->Error();
 		if (!$Forum || !is_object($Forum)) {
 			$this->setError(_('Invalid Forum Object'));
@@ -337,8 +336,6 @@ class ForumHTML extends Error {
 	 * LinkAttachForm - echoes the link to the attach form
 	 */
 	function LinkAttachForm() {
-		$poststarttime = time();
-		$posthash = md5($poststarttime . user_getid() );
 		echo '
 		<fieldset class="fieldset">
 		<legend>' . _('Attachments') . "</legend>
@@ -359,7 +356,7 @@ class ForumHTML extends Error {
 	 * @param	string	$msg_id
 	 * @return	string
 	 */
-	function showNestedMessages ( &$msg_arr, $msg_id ) {
+	function showNestedMessages(&$msg_arr, $msg_id) {
 		global $total_rows;
 
 		$rows=count($msg_arr["$msg_id"]);
@@ -370,13 +367,9 @@ class ForumHTML extends Error {
 			<ul><li style="list-style: none">';
 
 			/*
-
 			iterate and show the messages in this result
-
 			for each message, recurse to show any submessages
-
 			*/
-			$am = new AttachManager();
 			for ($i=($rows-1); $i >= 0; $i--) {
 				//	  increment the global total count
 				$total_rows++;
@@ -559,17 +552,14 @@ class ForumHTML extends Error {
 
 		$rl = RoleLoggedIn::getInstance() ;
 		if (forge_check_perm ('forum', $this->Forum->getID(), 'post')) {
-			if ($subject) {
-				//if this is a followup, put a RE: before it if needed
-				if (!preg_match('/RE:/i',$subject,$test)) {
-					$subject ='RE: '.$subject;
-				}
+			//if this is a followup, put a RE: before it if needed
+			if ($subject && !preg_match('/RE:/i',$subject,$test)) {
+				$subject ='RE: '.$subject;
 			}
 			echo notepad_func();
 			?>
 			<div class="align-center">
 			<form id="ForumPostForm" enctype="multipart/form-data" action="<?php echo util_make_url ('/forum/forum.php?forum_id='.$this->Forum->getID().'&group_id='.$group_id); ?>" method="post">
-			<?php $objid = $this->Forum->getID();?>
 			<input type="hidden" name="post_message" value="y" />
 			<input type="hidden" name="thread_id" value="<?php echo $thread_id; ?>" />
 			<input type="hidden" name="msg_id" value="<?php echo $is_followup_to; ?>" />

-----------------------------------------------------------------------

Summary of changes:
 src/common/docman/Document.class.php        |  2 +-
 src/common/docman/DocumentManager.class.php |  5 ++---
 src/common/forum/ForumHTML.class.php        | 20 +++++---------------
 3 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/src/common/docman/Document.class.php b/src/common/docman/Document.class.php
index 837a3b0..0422acf 100644
--- a/src/common/docman/Document.class.php
+++ b/src/common/docman/Document.class.php
@@ -939,7 +939,7 @@ class Document extends Error {
 
 		$groupUsers = $this->Group->getUsers();
 		$rbacEngine = RBACEngine::getInstance();
-		foreach ($groupUsers as $key => $groupUser) {
+		foreach ($groupUsers as $groupUser) {
 			if ($rbacEngine->isActionAllowedForUser($groupUser, 'docman', $group_id, 'approve')) {
 				$bcc .= $groupUser->getEmail().',';
 			}
diff --git a/src/common/docman/DocumentManager.class.php b/src/common/docman/DocumentManager.class.php
index a6d95ac..afe2a47 100644
--- a/src/common/docman/DocumentManager.class.php
+++ b/src/common/docman/DocumentManager.class.php
@@ -243,7 +243,6 @@ class DocumentManager extends Error {
 				}
 				$returnString .= '}';
 				return $returnString;
-				break;
 			}
 			default: {
 				return $stateQuery;
@@ -269,8 +268,8 @@ class DocumentManager extends Error {
 		switch ($format) {
 			case 'json': {
 				$returnString = '[';
-				for ($i=0; $i<$rows; $i++) {
-                    $returnString .= '['.$id_array[$i].',\''.util_html_secure(addslashes($text_array[$i])).'\'],';
+				for ($i = 0; $i < $rows; $i++) {
+					$returnString .= '['.$id_array[$i].',\''.util_html_secure(addslashes($text_array[$i])).'\'],';
 				}
 				$returnString .= ']';
 				break;
diff --git a/src/common/forum/ForumHTML.class.php b/src/common/forum/ForumHTML.class.php
index c7d02fb..8840c85 100644
--- a/src/common/forum/ForumHTML.class.php
+++ b/src/common/forum/ForumHTML.class.php
@@ -116,7 +116,6 @@ function forum_header($params) {
 				$menu_links[]='/forum/admin/?group_id='.$group_id;
 			}
 		} else {
-			$gg = group_get_object($group_id);
 			if (forge_check_perm ('forum_admin', $group_id)) {
 				$menu_text[]=_('Administration');
 				$menu_links[]='/forum/admin/?group_id='.$group_id;
@@ -173,7 +172,7 @@ class ForumHTML extends Error {
 	 */
 	var $Forum;
 
-	function ForumHTML(&$Forum) {
+	function __construct(&$Forum) {
 		$this->Error();
 		if (!$Forum || !is_object($Forum)) {
 			$this->setError(_('Invalid Forum Object'));
@@ -337,8 +336,6 @@ class ForumHTML extends Error {
 	 * LinkAttachForm - echoes the link to the attach form
 	 */
 	function LinkAttachForm() {
-		$poststarttime = time();
-		$posthash = md5($poststarttime . user_getid() );
 		echo '
 		<fieldset class="fieldset">
 		<legend>' . _('Attachments') . "</legend>
@@ -359,7 +356,7 @@ class ForumHTML extends Error {
 	 * @param	string	$msg_id
 	 * @return	string
 	 */
-	function showNestedMessages ( &$msg_arr, $msg_id ) {
+	function showNestedMessages(&$msg_arr, $msg_id) {
 		global $total_rows;
 
 		$rows=count($msg_arr["$msg_id"]);
@@ -370,13 +367,9 @@ class ForumHTML extends Error {
 			<ul><li style="list-style: none">';
 
 			/*
-
 			iterate and show the messages in this result
-
 			for each message, recurse to show any submessages
-
 			*/
-			$am = new AttachManager();
 			for ($i=($rows-1); $i >= 0; $i--) {
 				//	  increment the global total count
 				$total_rows++;
@@ -559,17 +552,14 @@ class ForumHTML extends Error {
 
 		$rl = RoleLoggedIn::getInstance() ;
 		if (forge_check_perm ('forum', $this->Forum->getID(), 'post')) {
-			if ($subject) {
-				//if this is a followup, put a RE: before it if needed
-				if (!preg_match('/RE:/i',$subject,$test)) {
-					$subject ='RE: '.$subject;
-				}
+			//if this is a followup, put a RE: before it if needed
+			if ($subject && !preg_match('/RE:/i',$subject,$test)) {
+				$subject ='RE: '.$subject;
 			}
 			echo notepad_func();
 			?>
 			<div class="align-center">
 			<form id="ForumPostForm" enctype="multipart/form-data" action="<?php echo util_make_url ('/forum/forum.php?forum_id='.$this->Forum->getID().'&group_id='.$group_id); ?>" method="post">
-			<?php $objid = $this->Forum->getID();?>
 			<input type="hidden" name="post_message" value="y" />
 			<input type="hidden" name="thread_id" value="<?php echo $thread_id; ?>" />
 			<input type="hidden" name="msg_id" value="<?php echo $is_followup_to; ?>" />


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list