[pLog-svn] r1054 - plog/trunk/class/dao

oscar at devel.plogworld.net oscar at devel.plogworld.net
Sun Feb 13 12:57:14 GMT 2005


Author: oscar
Date: 2005-02-13 12:57:14 +0000 (Sun, 13 Feb 2005)
New Revision: 1054

Modified:
   plog/trunk/class/dao/userpermissions.class.php
Log:
fixed an indentation issue and a couple of more touches

Modified: plog/trunk/class/dao/userpermissions.class.php
===================================================================
--- plog/trunk/class/dao/userpermissions.class.php	2005-02-13 12:54:03 UTC (rev 1053)
+++ plog/trunk/class/dao/userpermissions.class.php	2005-02-13 12:57:14 UTC (rev 1054)
@@ -93,7 +93,7 @@
             }
             else {
 
-        		$query = "SELECT * FROM ".$this->getPrefix()."users_permissions WHERE permission_id = 1 AND user_id = $userId;";
+        		$query = "SELECT * FROM ".$this->getPrefix()."users_permissions WHERE permission_id = 1 AND user_id = '".Db::qstr($userId)."'";
 
             	$result = $this->Execute( $query );
 
@@ -267,37 +267,37 @@
             return $result;
         }
 
-	/**
-	 * updates the list of users that have access to the blog. But this method works so
-	 * that it first removes all current permissions and then recreates them again
-	 * based on the given list of users
-	 *
-	 * @param blogId
-	 * @param userIdList An associative array with user ids
-	 * @return true if successful or false otherwise
-	 */
-	function updateBlogUserPermissions( $blogId, $userList )
-	{
-		// first of all, remove all the permissions
-		$this->revokeBlogPermissions( $blogId );
-
-		// make sure that we're dealing with an array
-		if( !is_array( $userList )) {
-			$this->log->debug("userList is not an array!!");
-			return false;
-		}
-
-		// loop through the array and recreate the permissions
-		foreach( $userList as $userId ) {
-			if( $userId > 0 ) {
-				$this->grantPermission( $userId, $blogId, PERMISSION_BLOG_USER );
-				$this->log->debug("recreating permission for user $userId in blog $blogId" );
+		/**
+		* updates the list of users that have access to the blog. But this method works so
+		 * that it first removes all current permissions and then recreates them again
+		 * based on the given list of users
+		 *
+		 * @param blogId
+		 * @param userIdList An associative array with user ids
+		 * @return true if successful or false otherwise
+		 */
+		function updateBlogUserPermissions( $blogId, $userList )
+		{
+			// first of all, remove all the permissions
+			$this->revokeBlogPermissions( $blogId );
+			
+			// make sure that we're dealing with an array
+			if( !is_array( $userList )) {
+				$this->log->debug("userList is not an array!!");
+				return false;
 			}
+			
+			// loop through the array and recreate the permissions
+			foreach( $userList as $userId ) {
+				if( $userId > 0 ) {
+					$this->grantPermission( $userId, $blogId, PERMISSION_BLOG_USER );
+					$this->log->debug("recreating permission for user $userId in blog $blogId" );
+				}
+			}
+			
+			return true;
 		}
 
-		return true;
-	}
-
         /**
          * revokes all the permissions that a user may have
          *
@@ -346,7 +346,7 @@
 		 */ 
 		function getBlogUsers( $blogId )
 		{
-			$query = "SELECT * FROM ".$this->getPrefix()."users_permissions WHERE blog_id = ".$blogId.";";
+			$query = "SELECT * FROM ".$this->getPrefix()."users_permissions WHERE blog_id = '".Db::qstr($blogId)."'";
             $result = $this->Execute( $query );
 
             if (!$result)




More information about the pLog-svn mailing list