/[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.14, Sun Aug 3 04:28:04 2008 UTC revision 1.15, Sun Aug 3 05:40:51 2008 UTC
# Line 1  Line 1 
1  <?php /* $Id: premium.module,v 1.13 2008/08/03 04:05:25 vauxia Exp $ */  <?php /* $Id: premium.module,v 1.14 2008/08/03 04:28:04 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 253  function _premium_offset($timestamp, &$s Line 253  function _premium_offset($timestamp, &$s
253    // If we faked a timestamp, remove it.    // If we faked a timestamp, remove it.
254    if ($ts != $timestamp) $offset -= $ts;    if ($ts != $timestamp) $offset -= $ts;
255    
256    if ($mode == 'archive') $start_ts = $offset;    if ($mode == 'archive') $end_ts = $offset;
257    if ($mode == 'latest') $end_ts = $offset;    if ($mode == 'latest') $start_ts = $offset;
258    return;    return;
259  }  }
260    
# Line 273  function _premium_node($node) { Line 273  function _premium_node($node) {
273    if ($node->nid) {    if ($node->nid) {
274      // Attempt to find the value from the premium table.      // Attempt to find the value from the premium table.
275      return (int) db_result(db_query("SELECT 1 FROM {premium}  WHERE nid = %d      return (int) db_result(db_query("SELECT 1 FROM {premium}  WHERE nid = %d
276        AND ( start_ts = 0 and end_ts > %d)        AND (( start_ts = 0 and end_ts > %d)
277        OR ( start_ts < %d AND end_ts = 0)        OR ( start_ts < %d AND end_ts = 0)
278        OR ( start_ts = 0 AND end_ts = 0)", $node->nid, time(), time()));        OR ( start_ts = 0 AND end_ts = 0))", $node->nid, time(), time()));
279    }    }
280    
281    // Use default settings for this node type.    // Use default settings for this node type.
# Line 286  function _premium_node($node) { Line 286  function _premium_node($node) {
286   * Establish premium visibility settings for a node   * Establish premium visibility settings for a node
287   */   */
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    // Access is granted or revoked explicitly.    // Access is granted or revoked explicitly.
292    foreach (module_implements('premium_access') as $name) {    foreach (module_implements('premium_access') as $name) {

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

  ViewVC Help
Powered by ViewVC 1.1.2