Index: protected_node.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/protected_node/protected_node.module,v retrieving revision 1.18 diff -r1.18 protected_node.module 142a143,146 > if (!$node->show_title and $node->promote and $node->is_protected) { > $node->promote = 0; > drupal_set_message("If the title is protected, node cannot be shown on start page.","status",false); > } 172a177,182 > > if (!$node->show_title and $node->promote and $node->is_protected) { > $node->promote = 0; > drupal_set_message("If the title is protected, node cannot be shown on start page.","status",false); > } > 175,203c185,188 < if ($node->is_protected && !user_access('bypass password protection')) { < // If we have been accessed from cron.php (f.e. search indexing) < if (variable_get( 'cron_semaphore', FALSE )) { < $node->title = ''; < $node->teaser = ''; < $node->body = ''; < $node->content = array(); < } < else { < if (!$user->uid && variable_get( 'cache', 0 )) { < $GLOBALS['conf']['cache'] = FALSE; < } < < if ($node->uid !== $user->uid) { < // If node is protected and not teaser nor page view and not owner of node < if (!isset( $_SESSION['_protected_node']['passwords'][$node->nid] )) { < if (!$arg) { < $_SESSION['_protected_node']['current'] = $node->nid; < $destination = drupal_get_destination(); < drupal_goto( 'protected-node', $destination ); < } < else { < $node->teaser = ''; < $node->body = ''; < $node->content = array(); < } < } < } < } --- > if (!protected_node_grant_access($node) AND $page){ > $_SESSION['_protected_node']['current'] = $node->nid; > $destination = drupal_get_destination(); > drupal_goto( 'protected-node', $destination ); 205a191,197 > case 'alter': > if (!protected_node_grant_access($node)) { > $out = array('nid','tid','status','created','changed','type','title','is_protected','was_protected','links'); > if(variable_get('protected_node-'. $node->nid .'-show_title',false)) $out = array('nid','tid','status','type','is_protected','was_protected'); > foreach ($node as $key => $value) if(!in_array($key,$out)) unset($node->$key); > } > break; 258a251,262 > /** > * Implementation of hook_webfm_file_access_alter(). Allows modules to deny access > * to a node without using node_access. > * @param boolean $access The node access grant calculated by webfm. > * @param object $node The node the file is attached to. > * @param int $fid Webfms file id. > * @return boolean TRUE if page is accessible without entering a password, FALSE otherwise. > */ > function protected_node_webfm_file_access_alter(&$access, $node, $fid) { > $access = protected_node_grant_access($node); > } > 263a268,306 > * Checks if a node can be access without entering a password. If the password > * was entered before and is cached access is granted. > * @param object $node The node to be accessed. > * @return boolean TRUE if node is accessible without entering password. > */ > function protected_node_grant_access($node) { > global $user; > if ($node->is_protected && !user_access('bypass password protection')) { > // If we have been accessed from cron.php (f.e. search indexing) > if (variable_get( 'cron_semaphore', FALSE )) { > $node->title = ''; > $node->teaser = ''; > $node->body = ''; > $node->content = array(); > } > else { > if (!$user->uid && variable_get( 'cache', 0 )) { > $GLOBALS['conf']['cache'] = FALSE; > } > > if ($node->uid !== $user->uid) { > // If node is protected and not teaser nor page view and not owner of node > if (!isset( $_SESSION['_protected_node']['passwords'][$node->nid] )) { > if (!$arg) { > return FALSE; > } > else { > $node->teaser = ''; > $node->body = ''; > $node->content = array(); > } > } > } > } > } > return TRUE; > } > > /**