| 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 |
*/ |
*/ |
| 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 |
|
|
| 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. |
| 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) { |