Index: content_access.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/content_access/Attic/content_access.admin.inc,v
retrieving revision 1.1.2.24
diff -u -r1.1.2.24 content_access.admin.inc
--- content_access.admin.inc	19 Jul 2010 11:40:11 -0000	1.1.2.24
+++ content_access.admin.inc	2 Sep 2010 14:30:41 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: content_access.admin.inc,v 1.1.2.24 2010/07/19 11:40:11 fago Exp $
+// $Id: content_access.admin.inc,v 1.1.2.23 2009/07/31 10:03:22 fago Exp $
 
 /**
  * @file Content access administration UI.
@@ -10,17 +10,42 @@
  */
 define('CONTENT_ACCESS_MASS_UPDATE_THRESHOLD', 1000);
 
+
+function expand_checkboxes($element) {
+  $value = is_array($element['#value']) ? $element['#value'] : array();
+  $element['#tree'] = TRUE;
+  if (count($element['#options']) > 0) {
+    if (!isset($element['#default_value']) || $element['#default_value'] == 0) {
+      $element['#default_value'] = array();
+    }
+    foreach ($element['#options'] as $key => $choice) {
+      if (!isset($element[$key])) {
+        $element[$key] = array(
+          '#type' => 'checkbox',
+          '#processed' => TRUE,
+          '#title' => $choice,
+          '#return_value' => $key,
+          '#default_value' => isset($value[$key]),
+          '#attributes' => $element['#attributes'],
+          '#ahah' => isset($element['#ahah']) ? $element['#ahah'] : NULL,
+        );
+      }
+    }
+  }
+  return $element;
+}
+
 /**
  * Per node settings page.
  */
-function content_access_page(&$form_state, $node) {
-  drupal_set_title(t('Access control for %title', array('%title' => $node->title)));
+function content_access_page($form, &$form_state, $node) {
+  drupal_set_title(t('Access control for "' ). $node->title.'"');
 
   foreach (_content_access_get_operations() as $op) {
     $defaults[$op] = content_access_per_node_setting($op, $node);
   }
 
-  $form = content_access_role_based_form($defaults);
+  $form = content_access_role_based_form( $form, $defaults);
   // Add a after_build handler that disables checkboxes, which are enforced by permissions.
   $form['per_role']['#after_build'] = array('content_access_force_permissions');
 
@@ -35,7 +60,7 @@
     );
     foreach (array('view', 'update', 'delete') as $op) {
       $acl_id = content_access_get_acl_id($node, $op);
-      acl_node_add_acl($node->nid, $acl_id, $op == 'view', $op == 'update', $op == 'delete', content_access_get_settings('priority', $node->type));
+      acl_node_add_acl($node->nid, $acl_id, (int)($op == 'view'), (int)($op == 'update'), (int)($op == 'delete'), content_access_get_settings('priority', $node->type));
       $form['acl'][$op] = acl_edit_form($acl_id, t('Grant !op access', array('!op' => $op)));
       $form['acl'][$op]['#collapsed'] = !isset($_POST['acl_'. $acl_id]) && !unserialize($form['acl'][$op]['user_list']['#default_value']);
     }
@@ -58,7 +83,7 @@
   if (!$node->status) {
     drupal_set_message(t("Warning: Your content is not published, so this settings are not taken into account as long as the content remains unpublished."), 'error');
   }
-
+  
   return $form;
 }
 
@@ -70,6 +95,7 @@
     // Set the settings so that further calls will return this settings.
     $settings[$op] = array_keys(array_filter($form_state['values'][$op]));
   }
+  
   // Save per-node settings.
   content_access_save_per_node_settings($node, $settings);
 
@@ -96,7 +122,9 @@
 /**
  * Per content type administration page form.
  */
-function content_access_admin_settings(&$form_state, $type) {
+function content_access_admin_settings( $form, &$form_state, $typeObject ) {
+  $type = $typeObject->type;
+
   $form_state['type'] = $type;
 
   // Add role based per content type settings
@@ -104,14 +132,15 @@
   foreach (_content_access_get_operations() as $op) {
     $defaults[$op] = content_access_get_settings($op, $type);
   }
-  $form = content_access_role_based_form($defaults);
+  $form = content_access_role_based_form( $form, $defaults);
+//  $form['per_role']['#after_build'] = array('content_access_force_permissions');
 
   // Per node:
   $form['node'] = array(
     '#type' => 'fieldset',
     '#title' => t('Per content node access control settings'),
     '#collapsible' => TRUE,
-    '#description' => t('Optionally you can enable per content node access control settings. If enabled, a new tab for the content access settings appears when viewing content. You have to configure permission to access these settings at the !permissions page.', array('!permissions' => l(t('permissions'), 'admin/user/permissions'))),
+    '#description' => t('Optionally you can enable per content node access control settings. If enabled, a new tab for the content access settings appears when viewing content. You have to configure permission to access these settings at the !permissions page.', array('!permissions' => l(t('permissions'), 'admin/people/permissions'))),
   );
   $form['node']['per_node'] = array(
     '#type' => 'checkbox',
@@ -142,13 +171,22 @@
 function content_access_admin_settings_submit($form, &$form_state) {
   // Where possible let the drupal permissions system handle access control.
   $permissions = content_access_get_permissions_by_role();
+  
+  $roles = user_roles();
+  
   foreach (array('update', 'update_own', 'delete', 'delete_own') as $op) {
     foreach ($form_state['values'][$op] as $rid => $value) {
-      $permissions[$rid][ content_access_get_permission_by_op($op, $form_state['type']) ] = $value;
+    	$permission = content_access_get_permission_by_op($op, $form_state['type']);
+		if( $value ) {
+			$permissions[$rid][] = $permission;
+		} else {
+			$permissions[$rid] = array_diff( $permissions[$rid], array( $permission ));
+		}
     }
     // Don't save the setting, so its default value (get permission) is applied always.
     unset($form_state['values'][$op]);
   }
+  
   content_access_save_permissions($permissions);
 
   // Update content access settings
@@ -176,7 +214,9 @@
     }
 
     if (content_access_mass_update(array($type))) {
-      drupal_set_message(t('Permissions have been successfully rebuilt for the content type @types.', array('@types' => node_get_types('name', $type))));
+      drupal_set_message(
+      	t('Permissions have been successfully rebuilt for the content type @types.', 
+      		array('@types' => node_type_get_name( $type))));
     }
   }
 
@@ -191,15 +231,20 @@
  *   Whether the operation has been processed successfully (TRUE) or postponed (FALSE).
  */
 function content_access_mass_update($types) {
-  $count = db_result(db_query("SELECT COUNT(DISTINCT nid) FROM {node} WHERE type IN (". db_placeholders($types, 'text') .")", $types));
+  $q = db_select( "node", 'n' )
+  	->fields( 'n', array( 'nid' ))
+  	->condition( 'n.type', $types, 'IN' );
+  	
+  $count = $q->countQuery()->execute()->fetchField();
+    
   node_access_needs_rebuild(TRUE);
 
   // If there not too much nodes affected, try to do it.
-  if ($count <= CONTENT_ACCESS_MASS_UPDATE_THRESHOLD) {
-    $result = db_query("SELECT nid FROM {node} WHERE type IN (". db_placeholders($types, 'text') .")", $types);
-    while ($node = db_fetch_object($result)) {
-      node_access_acquire_grants(node_load($node->nid));
-    }
+  if ( $count <= CONTENT_ACCESS_MASS_UPDATE_THRESHOLD) {
+  		$records = $q->execute();
+		foreach( $records as $node ) {
+		      node_access_acquire_grants(node_load($node->nid));
+    	}	
 
     cache_clear_all();
     node_access_needs_rebuild(FALSE);
@@ -212,12 +257,18 @@
  * Gets the permissions for the role of the given id.
  */
 function content_access_get_permissions_by_role() {
-  $result = db_query('SELECT r.rid, p.perm FROM {role} r LEFT JOIN {permission} p ON r.rid = p.rid');
   $permissions = array();
-  while ($role = db_fetch_object($result)) {
-    $permissions[$role->rid] = array_filter(drupal_map_assoc(explode(', ', $role->perm)));
+  $result = db_query('SELECT r.rid, p.permission FROM {role} r LEFT JOIN {role_permission} p ON r.rid = p.rid');
+  foreach( $result as $rolePermission ) {
+  	if( !  isset( $permissions[ $rolePermission->rid ] )) {
+  		$permissions[ $rolePermission->rid ]  = array();
+  	}
+  	
+  	$permissions[ $rolePermission->rid ][] = $rolePermission->permission;
+  	
   }
-  return $permissions;
+
+  	return $permissions;
 }
 
 /**
@@ -225,10 +276,17 @@
  */
 function content_access_save_permissions($permissions) {
   foreach ($permissions as $rid => $perms) {
-    $perms = array_filter($perms);
-    db_query('DELETE FROM {permission} WHERE rid = %d', $rid);
-    if (count($perms)) {
-      db_query("INSERT INTO {permission} (rid, perm) VALUES (%d, '%s')", $rid, implode(', ', array_keys($perms)));
+    $perms = array_unique( array_filter($perms));
+    db_query('DELETE FROM {role_permission} WHERE rid = :rid', array( 'rid' => $rid ));
+    foreach( $perms as $permission ) {
+    	if( ! is_numeric( $permission )) { // Not sure if it is ever could be true now.  Used to happen.
+			db_insert( 'role_permission' )
+				->fields( array(
+					'rid' => $rid,
+					'permission' => $permission
+				))
+				->execute();
+    	}
     }
   }
   // Make sure new permissions are applied immediately.
@@ -241,7 +299,7 @@
  * @param $defaults
  *   Array of defaults for all operations.
  */
-function content_access_role_based_form($defaults = array()) {
+function content_access_role_based_form($form, $defaults = array()) {
 
   // Make sure defaults are set properly
   foreach (_content_access_get_operations() as $op) {
@@ -282,11 +340,8 @@
     '#default_value' => $defaults['delete'],
     '#process' => array('expand_checkboxes', 'content_access_disable_checkboxes'),
   );
-  $form['per_role']['clearer'] = array(
-    '#value' => '<br clear="all" />',
-  );
   $form['per_role']['view_own'] = array('#type' => 'checkboxes',
-    '#prefix' => '<div class="content_access-div">',
+    '#prefix' => '<div class="content_access-div new-row">',
     '#suffix' => '</div>',
     '#options' => $roles,
     '#title' => t('View own content'),
@@ -345,8 +400,14 @@
  * Formapi #after_build callback, that disables checkboxes for roles without access to content.
  */
 function content_access_force_permissions($element, &$form_state) {
+	$type = isset( $form_state['node']  ) ? $form_state['node']->type : $form_state['type'] ;
   foreach (array('update', 'update_own', 'delete', 'delete_own') as $op) {
-    foreach (content_access_get_settings($op, $form_state['node']->type) as $rid) {
+    foreach (content_access_get_settings($op, $type) as $rid) {
+    
+//     debug( content_access_get_permission_access(content_access_get_permission_by_op($op, $type)), $op . ' - ' . $type . ' = '. content_access_get_permission_by_op($op, $type));
+    
+//     foreach( content_access_get_permission_access(content_access_get_permission_by_op($op, $type)) as $rid ) {
+     
       $element[$op][$rid]['#disabled'] = TRUE;
       $element[$op][$rid]['#attributes']['disabled'] = 'disabled';
       $element[$op][$rid]['#value'] = TRUE;
@@ -392,11 +453,23 @@
 }
 
 /**
+ * Gets the content access acl id of the node.
+ */
+function content_access_get_acl_id($node, $op) {
+  $acl_id = acl_get_id_by_name('content_access', $op .'_'. $node->nid);
+  if (!$acl_id) {
+    // Create one:
+    $acl_id = acl_create_new_acl('content_access', $op .'_'. $node->nid);
+  }
+  return $acl_id;
+}
+
+/**
  * Detaches all our ACLs for the nodes of the given type.
  */
 function _content_access_remove_acls($type) {
-  $result = db_query("SELECT n.nid FROM {node} n WHERE type = '%s'", $type);
-  while ($node = db_fetch_object($result)) {
+  $result = db_query("SELECT n.nid FROM {node} n WHERE type = ':type'", array( 'type' => $type));
+  foreach( $result as $node ) {
     acl_node_clear_acls($node->nid, 'content_access');
   }
 }
Index: content_access.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/content_access/Attic/content_access.css,v
retrieving revision 1.1
diff -u -r1.1 content_access.css
--- content_access.css	17 May 2007 20:32:07 -0000	1.1
+++ content_access.css	2 Sep 2010 14:30:41 -0000
@@ -5,3 +5,7 @@
   float: left;
   overflow: hide;
 }
+
+.content_access-div.new-row {
+	clear: left;
+}
Index: content_access.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/content_access/Attic/content_access.info,v
retrieving revision 1.1.4.1
diff -u -r1.1.4.1 content_access.info
--- content_access.info	30 Jun 2008 08:56:27 -0000	1.1.4.1
+++ content_access.info	2 Sep 2010 14:30:41 -0000
@@ -2,4 +2,9 @@
 name = Content Access
 description = Provides flexible content access control
 package = Access control
-core = "6.x"
\ No newline at end of file
+core = "7.x"
+
+files[] = content_access.module
+files[] = content_access.install
+files[] = content_access.admin.inc
+files[] = content_access.rules.inc
Index: content_access.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/content_access/Attic/content_access.install,v
retrieving revision 1.1.4.3
diff -u -r1.1.4.3 content_access.install
--- content_access.install	28 Oct 2008 13:36:17 -0000	1.1.4.3
+++ content_access.install	2 Sep 2010 14:30:41 -0000
@@ -6,7 +6,8 @@
  */
 function content_access_install() {
   // Create tables.
-  drupal_install_schema('content_access');
+  // happen automatically in D7
+  // drupal_install_schema('content_access');
 }
 
 /**
@@ -15,7 +16,8 @@
 function content_access_uninstall() {
   variable_del('content_access_settings');
   // Remove tables.
-  drupal_uninstall_schema('content_access');
+  // happen automatically in D7
+  // drupal_uninstall_schema('content_access');
 }
 
 /**
Index: content_access.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/content_access/Attic/content_access.module,v
retrieving revision 1.1.2.9.2.22
diff -u -r1.1.2.9.2.22 content_access.module
--- content_access.module	2 Sep 2010 13:13:33 -0000	1.1.2.9.2.22
+++ content_access.module	2 Sep 2010 14:30:41 -0000
@@ -1,10 +1,36 @@
 <?php
-// $Id: content_access.module,v 1.1.2.9.2.22 2010/09/02 13:13:33 fago Exp $
+// $Id: content_access.module,v 1.1.2.9.2.19 2009/07/31 09:46:36 fago Exp $
 
 /**
  * @file Content access module file.
  */
 
+/**
+ * Implementation of hook_init().
+ *
+ * Make node access settings page use admin theme if appropriate.
+ *
+ * @see system_init()
+ */
+function content_access_init() {
+  // Use the administrative theme if the user is looking at a page at node/%/access
+  if (variable_get('node_admin_theme', '0') && arg(0) == 'node' && arg(2) == 'access') {
+    global $custom_theme;
+    $custom_theme = variable_get('admin_theme', '0');
+    drupal_add_css(drupal_get_path('module', 'system') .'/admin.css', 'module');
+  }
+}
+
+/**
+ * Implements hook_admin_paths().
+ */
+function content_access_admin_paths() {
+  $paths = array(
+    'node/*/access' => TRUE,
+  );
+  return $paths;
+}
+
 
 /**
  * Implementation of hook_menu().
@@ -13,21 +39,23 @@
   $items = array();
 
   $items['node/%node/access'] = array(
-    'title' => 'Access control',
+    'title' => 'Access Control',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('content_access_page', 1),
     'access callback' => 'content_access_node_page_access',
     'access arguments' => array(1),
     'file' => 'content_access.admin.inc',
+     'theme callback' => '_node_custom_theme',
     'weight' => 3,
     'type' => MENU_LOCAL_TASK
   );
 
-  foreach (node_get_types('types', NULL, TRUE) as $type) {
+/*
+  foreach (node_type_get_types() as $type) {
     $type_url_str = str_replace('_', '-', $type->type);
-    $items['admin/content/node-type/'. $type_url_str .'/access'] = array(
-      'title' => 'Access control',
-      'description' => 'Configure content access control.',
+    $items['admin/structure/types/manage/'. $type_url_str .'/access'] = array(
+      'title' => t('Access:'.$type->type),
+      'description' => t('Configure content access control.'),
       'page callback' => 'drupal_get_form',
       'page arguments' => array('content_access_admin_settings', $type->type),
       'access callback' => 'content_access_admin_settings_access',
@@ -37,28 +65,26 @@
       'weight' => 1,
     );
   }
+  */
+    $items['admin/structure/types/manage/%node_type/access'] = array(
+      'title' => t('Access Control'),
+      'description' => t('Configure content access control.'),
+      'page callback' => 'drupal_get_form',
+      'page arguments' => array('content_access_admin_settings', 4 ),
+      'access callback' => 'content_access_admin_settings_access',
+      'access arguments' => array(),
+      'type' => MENU_LOCAL_TASK,
+      'file' => 'content_access.admin.inc',
+       'theme callback' => '_node_custom_theme',
+      'weight' => 1,
+    );
   return $items;
 }
 
-/**
- * Implementation of hook_init().
- *
- * Make node access settings page use admin theme if appropriate.
- *
- * @see system_init()
- */
-function content_access_init() {
-  // Use the administrative theme if the user is looking at a page at node/%/access
-  if (variable_get('node_admin_theme', '0') && arg(0) == 'node' && arg(2) == 'access') {
-    global $custom_theme;
-    $custom_theme = variable_get('admin_theme', '0');
-    drupal_add_css(drupal_get_path('module', 'system') .'/admin.css', 'module');
-  }
-}
-
 function content_access_node_page_access($node) {
   global $user;
-  return content_access_get_settings('per_node', $node->type) && user_access('grant content access') || content_access_get_settings('per_node', $node->type) && (user_access('grant own content access') && ($user->uid == $node->uid));
+  return content_access_get_settings('per_node', $node->type) && user_access('grant content access') || 
+    content_access_get_settings('per_node', $node->type) && (user_access('grant own content access') && ($user->uid == $node->uid));
 }
 
 function content_access_admin_settings_access() {
@@ -68,8 +94,11 @@
 /**
  * Implementation of hook_perm().
  */
-function content_access_perm() {
-  return array('grant content access', 'grant own content access');
+function content_access_permission() {
+  return array( 
+  		'grant content access' => array( 'title' => 'Grant Content Access', 'description' => 'View and modify content access for any nodes' ), 
+  		'grant own content access' => array( 'title' =>'Grant Own Content Access', 'description' => 'View and modify content access for own nodes' )
+  	);
 }
 
 /**
@@ -101,11 +130,13 @@
     foreach ($grants as $rid => $grant) {
       $grants[$rid] = content_access_proccess_grant($grant, $rid, $node);
     }
+    
     // Care for the author grant.
     $grant = array();
     foreach (array('view', 'update', 'delete') as $op) {
       // Get all roles that have access to use $op on this node.
       $any_roles = drupal_map_assoc(content_access_per_node_setting($op, $node));
+      $any_roles = $any_roles ? $any_roles : array();
       $any_roles += ($op != 'view') ? content_access_get_settings($op, $node->type) : array();
       $grant['grant_'. $op] = content_access_own_op($node, $any_roles, content_access_get_rids_per_node_op($op .'_own', $node));
     }
@@ -127,6 +158,7 @@
   else {
     content_access_optimize_grants($grants, $node);
   }
+    
   return $grants;
 }
 
@@ -183,6 +215,7 @@
   }
   if (!isset($type)) {
     $settings = content_access_get_settings();
+
     return isset($settings[$return]) ? $settings[$return] : array();
   }
   return array();
@@ -216,12 +249,14 @@
  * Defines default values for settings.
  */
 function content_access_get_setting_defaults($setting, $type) {
+	global $user;
+    
   switch ($setting) {
     default:
       return array();
     case 'view':
     case 'view_own':
-      return array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID);
+      return content_access_get_permission_access(content_access_get_permission_by_op($setting, $type));
     case 'update':
     case 'update_own':
     case 'delete':
@@ -229,6 +264,8 @@
       return content_access_get_permission_access(content_access_get_permission_by_op($setting, $type));
     case 'priority':
       return 0;
+     case 'per_node' :
+     	return array();
   }
 }
 
@@ -254,6 +291,10 @@
   switch ($op) {
     default:
       return FALSE;
+    case 'view':
+      return 'view any '. $type .' content';
+    case 'view_own':
+      return 'view own '. $type .' content';
     case 'update':
       return 'edit any '. $type .' content';
     case 'update_own':
@@ -317,8 +358,9 @@
 
   if (!isset($roles[$node->uid])) {
     $roles[$node->uid] = $node->uid ? array(DRUPAL_AUTHENTICATED_RID) : array(DRUPAL_ANONYMOUS_RID);
-    $result = db_query('SELECT rid FROM {users_roles} WHERE uid = %d', $node->uid);
-    while ($role = db_fetch_object($result)) {
+    $result = db_query('SELECT rid FROM {users_roles} WHERE uid = ?', array($node->uid));        
+//    while ($role = db_fetch_object($result)) {
+	foreach( $result as $role ) {
       $roles[$node->uid][] = $role->rid;
     }
   }
@@ -343,9 +385,12 @@
  */
 function content_access_get_rids_per_node_op($op, $node) {
   $rids = content_access_per_node_setting($op, $node);
+  
   if ($permission = content_access_get_permission_by_op($op, $node->type)) {
     $perm_roles = content_access_get_permission_access($permission);
+  
     $rids = array_diff($rids, $perm_roles);
+    
     if (in_array(DRUPAL_AUTHENTICATED_RID, $perm_roles)) {
       return in_array(DRUPAL_ANONYMOUS_RID, $rids) ? array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID) : array(DRUPAL_AUTHENTICATED_RID);
     }
@@ -386,10 +431,23 @@
  * Saves custom per node settings in the own content_access table.
  */
 function content_access_save_per_node_settings($node, $settings) {
-  db_query("UPDATE {content_access} SET settings = '%s' WHERE nid = %d", serialize($settings), $node->nid);
-  if (!db_affected_rows()) {
-    db_query("INSERT INTO {content_access} (nid, settings) VALUES(%d, '%s')", $node->nid, serialize($settings));
-  }
+//  db_query("UPDATE {content_access} SET settings = '?' WHERE nid = ?", array(serialize($settings), $node->nid));
+  
+  	
+  $result = FALSE;
+  foreach( db_query('select nid as count from {content_access} where nid = :nid ', array( 'nid' => $node->nid )) as $record ) {
+  	$result = TRUE;
+	db_update( 'content_access' )
+  		->condition( 'nid', $node->nid )
+	  	->fields(array( 'settings' => serialize($settings)))
+  		->execute();
+  } 	
+  	
+  if ($result === FALSE ) {
+	db_insert( 'content_access' )
+		->fields( array( 'nid' => $node->nid, 'settings' => serialize( $settings )))
+		->execute();
+  } 
   // Make content_access_per_node_setting() use the new settings
   content_access_per_node_setting(NULL, $node, $settings);
 }
@@ -398,7 +456,7 @@
  * Deletes all custom per node settings, so that content type defaults are used again.
  */
 function content_access_delete_per_node_settings($node) {
-  db_query("DELETE FROM {content_access} WHERE nid = %d", $node->nid);
+  db_query("DELETE FROM {content_access} WHERE nid = :nid", array( 'nid' => $node->nid));
   // Clear the cache.
   content_access_per_node_setting(NULL, $node, FALSE);
   // Delete possible acl settings
@@ -411,18 +469,6 @@
 }
 
 /**
- * Gets the content access acl id of the node.
- */
-function content_access_get_acl_id($node, $op) {
-  $acl_id = acl_get_id_by_name('content_access', $op .'_'. $node->nid);
-  if (!$acl_id) {
-    // Create one:
-    $acl_id = acl_create_new_acl('content_access', $op .'_'. $node->nid);
-  }
-  return $acl_id;
-}
-
-/**
  * Gets the per node settings of a node.
  *
  * @note
@@ -430,11 +476,13 @@
  *   it will return an empty array.
  */
 function content_access_get_per_node_settings($node) {
-  $settings = db_result(db_query("SELECT settings FROM {content_access} WHERE nid = %d", $node->nid));
-  if (!$settings) {
-    return array();
+foreach( db_query("SELECT settings FROM {content_access} WHERE nid = ?", array( $node->nid)) as $record ) {
+	$settings = $record->settings;
+	  if (!$settings) {
+		return array();
+	  }
+	  return unserialize($settings);
   }
-  return unserialize($settings);
 }
 
 /**
@@ -486,7 +534,15 @@
  * Implementation of hook_node_type():
  * Update settings on node type name change.
  */
+ function content_access_node_type_delete( $info) {
+ 	content_access_node_type( 'delete', $info );	
+ }
+ function content_access_node_type_update( $info) {
+ 	content_access_node_type( 'update', $info );	
+ }
+ 
 function content_access_node_type($op, $info) {
+
   switch ($op) {
     case 'delete':
       $settings = content_access_get_settings();
@@ -543,4 +599,4 @@
  */
 function _content_access_get_operations() {
   return array('view', 'view_own', 'update', 'update_own', 'delete', 'delete_own');
-}
\ No newline at end of file
+}
Index: content_access.rules.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/content_access/Attic/content_access.rules.inc,v
retrieving revision 1.1.2.6
diff -u -r1.1.2.6 content_access.rules.inc
--- content_access.rules.inc	31 Jul 2009 09:09:46 -0000	1.1.2.6
+++ content_access.rules.inc	2 Sep 2010 14:30:41 -0000
@@ -42,44 +42,49 @@
 function content_access_rules_action_info() {
   $items = array(
     'content_access_action_grant_node_permissions' => array(
-      'label' => t('Grant content permissions by role'),
-      'arguments' => array(
+      'label' => t('Grant content permissions by role'),      
+      'parameter' => array(
         'node' => array('type' => 'node', 'label' => t('Content')),
       ),
-      'module' => 'Content access',
+      'group' => 'Content access',
+      'base' => 'content_access_action_grant_node_permissions'
     ),
     'content_access_action_revoke_node_permissions' => array(
       'label' => t('Revoke content permissions by role'),
-      'arguments' => array(
+      'parameter' => array(
         'node' => array('type' => 'node', 'label' => t('Content')),
       ),
-      'module' => 'Content access',
+      'group' => 'Content access',
+      'base' => 'content_access_action_revoke_node_permissions'
     ),
     'content_access_action_reset_node_permissions' => array(
       'label' => t('Reset content permissions'),
-      'arguments' => array(
+      'parameter' => array(
         'node' => array('type' => 'node', 'label' => t('Content')),
       ),
-      'module' => 'Content access',
+      'group' => 'Content access',
+      'base' => 'content_access_action_reset_node_permissions'
     ),
   );
   if (module_exists('acl')) {
     $items += array(
       'content_access_action_acl_grant_access' => array(
         'label' => t('Grant access for a user'),
-        'arguments' => array(
+        'parameter' => array(
           'node' => array('type' => 'node', 'label' => t('Content')),
           'user' => array('type' => 'user', 'label' => t('User')),
         ),
-        'module' => 'Content access',
+        'group' => 'Content access',
+      	'base' => 'content_access_action_acl_grant_access'
       ),
       'content_access_action_acl_revoke_access' => array(
         'label' => t('Revoke access for a user'),
-        'arguments' => array(
+        'parameter' => array(
           'node' => array('type' => 'node', 'label' => t('Content')),
           'user' => array('type' => 'user', 'label' => t('User')),
         ),
-        'module' => 'Content access',
+        'group' => 'Content access',
+      	'base' => 'content_access_action_acl_revoke_access'
       ),
     );
   }
