[evolvis-commits] r14139: update the suspended forum possiblity for admin project

mirabilos at evolvis.org mirabilos at evolvis.org
Mon Feb 28 03:52:56 CET 2011


Author: mirabilos
Date: 2011-02-28 03:52:56 +0100 (Mon, 28 Feb 2011)
New Revision: 14139

Modified:
   trunk/gforge_base/evolvisforge-5.1/gforge/common/forum/ForumFactory.class.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/forum/admin/index.php
Log:
update the suspended forum possiblity for admin project

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/common/forum/ForumFactory.class.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/forum/ForumFactory.class.php	2011-02-28 02:52:53 UTC (rev 14138)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/forum/ForumFactory.class.php	2011-02-28 02:52:56 UTC (rev 14139)
@@ -192,6 +192,89 @@
 			return $this->forums;
 		}
 	}
+	
+	
+	/**
+	 *	getForumsAdmin - get an array of all (public, private and suspended) Forum objects for this Group.
+	 *
+	 *	@return	array	The array of Forum objects.
+	 */
+	function &getForumsAdmin() {
+		global $sys_database_type;
+
+		if ($this->forums) {
+			return $this->forums;
+		}
+
+		
+		if ($sys_database_type == "mysql") {
+			if (session_loggedin()) {
+				$perm =& $this->Group->getPermission( session_get_user() );
+				if (!$perm || !is_object($perm) || !$perm->isForumAdmin()) {
+					$this->setError(_("You don't have a permission to access this page"));
+					$this->forums = false;
+				} else {
+					$sql="SELECT fgl.*,
+							(SELECT count(*) AS `count`
+							FROM (
+								SELECT DISTINCT group_forum_id, thread_id FROM forum
+								) AS tmp
+							WHERE tmp.group_forum_id = fgl.group_forum_id
+							) AS threads 
+						FROM forum_group_list_vw AS fgl
+						WHERE group_id='". $this->Group->getID() . "'
+						ORDER BY group_forum_id;";
+					
+					$result = db_query_mysql ($sql);
+			
+					$rows = db_numrows($result);
+					
+					if (!$result) {
+						$this->setError(_('Forum not found').' : '.db_error());
+						$this->forums = false;
+					} else {
+						while ($arr = db_fetch_array($result)) {
+							$this->forums[] = new Forum($this->Group, $arr['group_forum_id'], $arr);
+						}
+					}
+				}
+			} else {
+				$this->setError(_("You don't have a permission to access this page"));
+				$this->forums = false;
+			}
+			
+			return $this->forums;
+
+		} else {	// Not MySQL
+			if (session_loggedin()) {
+				$perm =& $this->Group->getPermission( session_get_user() );
+				if (!$perm || !is_object($perm) || !$perm->isForumAdmin()) {
+					$this->setError(_("You don't have a permission to access this page"));
+					$this->forums = false;
+				} else {
+					$result = db_query_params ('SELECT * FROM forum_group_list_vw
+WHERE group_id=$1
+ORDER BY group_forum_id',
+									   array ($this->Group->getID())) ;
+				}
+			} else {
+				$this->setError(_("You don't have a permission to access this page"));
+				$this->forums = false;
+			}
+
+			$rows = db_numrows($result);
+
+			if (!$result) {
+				$this->setError(_('Forum not found').' : '.db_error());
+				$this->forums = false;
+			} else {
+				while ($arr = db_fetch_array($result)) {
+					$this->forums[] = new Forum($this->Group, $arr['group_forum_id'], $arr);
+				}
+			}
+			return $this->forums;
+		}
+	}
 }
 
 // Local Variables:

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/www/forum/admin/index.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/forum/admin/index.php	2011-02-28 02:52:53 UTC (rev 14138)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/forum/admin/index.php	2011-02-28 02:52:56 UTC (rev 14139)
@@ -150,7 +150,7 @@
 				<strong>'._('Is Public?').'</strong><br />
 				<input type="radio" name="is_public" value="1"'.(($f->isPublic() == 1)?' checked="checked"':'').' /> '._('Yes').'<br />
 				<input type="radio" name="is_public" value="0"'.(($f->isPublic() == 0)?' checked="checked"':'').' /> '._('No').'<br />
-				<input type="radio" name="is_public" value="9"'.(($f->isPublic() == 9)?' checked="checked"':'').' />'._('Deleted').'<br />
+				<input type="radio" name="is_public" value="9"'.(($f->isPublic() == 9)?' checked="checked"':'').' />'._('Suspended').'<br />
 				<p>' .
 					html_build_select_box_from_assoc(array("0" => _('No Moderation') ,"1" => _('Moderated Level 1'),"2" => _('Moderated Level 2') ),"moderation_level",$f->getModerationLevel()) . '
 				<br />' . _('Moderated Level 1') . ': ' . _('To moderate anonymous posts (if allowed in public forum) and posts from non-member users.') . '<br />' . _('Moderated Level 2') . ': ' . _('To moderate ALL posts.') . '<p>
@@ -357,7 +357,7 @@
 			exit_error(_('Error'),$ff->getErrorMessage());
 		}
 
-		$farr =& $ff->getForums();
+		$farr =& $ff->getForumsAdmin();
 
 		if ($ff->isError()) {
 			echo '<h1>'.sprintf(_('No Forums Found For %1$s'), $g->getPublicName()) .'</h1>';



More information about the evolvis-commits mailing list