/[drupal]/contributions/modules/premium/premium.module
ViewVC logotype

Diff of /contributions/modules/premium/premium.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.13, Sun Aug 3 04:05:25 2008 UTC revision 1.14, Sun Aug 3 04:28:04 2008 UTC
# Line 1  Line 1 
1  <?php /* $Id: premium.module,v 1.12 2008/08/03 03:22:51 vauxia Exp $ */  <?php /* $Id: premium.module,v 1.13 2008/08/03 04:05:25 vauxia Exp $ */
2  /**  /**
3   * @file Restrict access to the full body of premium content   * @file Restrict access to the full body of premium content
4   */   */
# Line 288  function _premium_node($node) { Line 288  function _premium_node($node) {
288  function _premium_access($node, $teaser) {  function _premium_access($node, $teaser) {
289    if (isset($node->premium_access)) return $node->premium_access;    if (isset($node->premium_access)) return $node->premium_access;
290    
291    // Not viewing the body, or it's not premium, or user has privileges.    // Access is granted or revoked explicitly.
   if ($teaser || !$node->premium || user_access('access premium content')) {  
     return TRUE;  
   }  
   
   // Access is granted explicitly.  
292    foreach (module_implements('premium_access') as $name) {    foreach (module_implements('premium_access') as $name) {
293      $function = $name .'_premium_access';      $function = $name .'_premium_access';
294      if (is_bool($access = $function($user, $node))) {      if (is_bool($access = $function($user, $node))) {
# Line 301  function _premium_access($node, $teaser) Line 296  function _premium_access($node, $teaser)
296      }      }
297    }    }
298    
299      // Not viewing the body, or it's not premium, or user has privileges.
300      if ($teaser || !$node->premium || user_access('access premium content')) {
301        return TRUE;
302      }
303    
304    // Nobody said we could access the node.    // Nobody said we could access the node.
305    return FALSE;    return FALSE;
306  }  }

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.2