Only in taxonomy_access: CHANGELOG.txt.~1.1.2.6.~ diff -urp taxonomy_access/taxonomy_access.install taxonomy_access_new/taxonomy_access.install --- taxonomy_access/taxonomy_access.install 2010-02-27 14:43:41.000000000 -0600 +++ taxonomy_access_new/taxonomy_access.install 2010-03-03 13:32:43.000000000 -0600 @@ -68,10 +68,15 @@ function taxonomy_access_update_5() { $result = db_query('SELECT rid, grant_view, grant_update, grant_delete, grant_create, grant_list FROM {term_access} WHERE tid=0'); while ($row = db_fetch_array($result)) { if ($row['rid'] > 0) { // just in case we have a weird row with 0, 0 - db_query('INSERT INTO {term_access_defaults} (vid, rid, grant_view, grant_update, grant_delete, grant_create, grant_list) VALUES(0, %d, %d, %d, %d, %d, %d)', $row); + // Typecast each element to sanitize for use in update_sql. + foreach ($row as $key => $value) { + $row[$key] = (int) $value; + } + $row_ints = implode(", ", $row); + update_sql('INSERT INTO {term_access_defaults} (vid, rid, grant_view, grant_update, grant_delete, grant_create, grant_list) VALUES (0, $row_ints)'); } } - db_query('DELETE FROM {term_access} WHERE tid=0'); + update_sql('DELETE FROM {term_access} WHERE tid=0'); return array(); } /** diff -urp taxonomy_access/taxonomy_access_admin.inc taxonomy_access_new/taxonomy_access_admin.inc --- taxonomy_access/taxonomy_access_admin.inc 2010-03-03 13:04:32.000000000 -0600 +++ taxonomy_access_new/taxonomy_access_admin.inc 2010-03-03 13:23:55.000000000 -0600 @@ -412,29 +412,36 @@ function taxonomy_access_grant_update($t /** * Recursively updates permissions for a role for a term */ -function taxonomy_access_recursive_grant_update($tid, $rid = null, $grants = null) { - // run the original +function taxonomy_access_recursive_grant_update($tid, $rid = NULL, $grants = NULL) { + // First, process the original, taxonomy_access_grant_update($tid, $rid, $grants); - // process the children - $ran_tids = array(); // tids that have been processed - $run_tids = array($tid); // tids that are in the queue to be processed - while(count($run_tids) > 0) { // while there are tids to be processed, run the following - foreach($run_tids as $run_key => $run_tid) { - // some basic loop protection - if (array_search($run_tid, $ran_tids) == true) { - drupal_set_message("Loop detected for tid ".$run_tid.". Stopping."); - $run_tids = array(); // stop the execution - } else { - $result = db_query('SELECT th.tid FROM {term_hierarchy} th WHERE th.parent = %d', $run_tid); - // if this tid has children, update grants and queue the children up for processing - while ($row = db_fetch_array($result)) { - taxonomy_access_grant_update($row['tid'], $rid, $grants); - $run_tids[] = $row['tid']; - } - unset($run_tids[$run_key]); // remove this tid from queue - $ran_tids[] = $run_tid; // mark this tid as processed - } - } + + // Process the children. + $ran_tids = array(); // tids that have been processed. + $run_tids = array($tid); // tids that are in the queue to be processed. + while (count($run_tids) > 0) { + foreach ($run_tids as $run_key => $run_tid) { + // Some basic loop protection. + if (!(array_search($run_tid, $ran_tids) === FALSE)) { + drupal_set_message( + t("Loop detected for tid %run_tid.S topping.", + array('%run_tid' => $run_tid) + )); + $run_tids = array(); // stop the execution + } + else { + $result = db_query('SELECT th.tid FROM {term_hierarchy} th WHERE th.parent = %d', $run_tid); + // If this tid has children, update grants and queue the children + while ($row = db_fetch_array($result)) { + taxonomy_access_grant_update($row['tid'], $rid, $grants); + $run_tids[] = $row['tid']; + } + + // Remove this tid from the queue and mark as processed, + unset($run_tids[$run_key]); + $ran_tids[] = $run_tid; + } + } } } @@ -535,7 +542,7 @@ function _taxonomy_access_grant_help_tab $rows = array(); $rows[] = array( - array('header' => true, 'data' => t("View")), + array('header' => TRUE, 'data' => t("View")), "

" . t('Grants this role the ability to view nodes with the term. (Users must also have this permission to see nodes with the term listed in Views.)') . "

" @@ -548,7 +555,7 @@ function _taxonomy_access_grant_help_tab ); $rows[] = array( - array('header' => true, 'data' => t("Update") . ", " . t("Delete")), + array('header' => TRUE, 'data' => t("Update") . ", " . t("Delete")), "

" . t("Grants this role the ability to edit or delete nodes with the term, respectively.") . "

" @@ -562,7 +569,7 @@ function _taxonomy_access_grant_help_tab ); $rows[] = array( - array('header' => true, 'data' => t("Create")), + array('header' => TRUE, 'data' => t("Create")), "

" . t("Grants this role the ability to add the term to a node when creating or updating it.") . "

" @@ -576,7 +583,7 @@ function _taxonomy_access_grant_help_tab ); $rows[] = array( - array('header' => true, 'data' => t("List")), + array('header' => TRUE, 'data' => t("List")), "

" . t("Whether this role can see the term listed on node pages and in lists, and whether the user can view the %taxonomy-term-page page for the term.", array(