/[drupal]/contributions/modules/node_expire/node_expire.nodeapi.inc
ViewVC logotype

Diff of /contributions/modules/node_expire/node_expire.nodeapi.inc

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

revision 1.3, Sat Jan 31 00:22:15 2009 UTC revision 1.4, Sat Jan 31 01:26:53 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: node_expire.nodeapi.inc,v 1.2 2009/01/29 21:01:33 brmassa Exp $  // $Id: node_expire.nodeapi.inc,v 1.3 2009/01/31 00:22:15 brmassa Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 30  function _node_expire_nodeapi(&$ntypes, Line 30  function _node_expire_nodeapi(&$ntypes,
30    
31      case 'validate':      case 'validate':
32        // The only restriction we have is that the node can't expire in the past.        // The only restriction we have is that the node can't expire in the past.
33        if ($node->expire <= 0) {        if ($node->expire == '') {
34            if (!empty($ntypes['required'])) {
35              form_set_error('expire_date', t('You must choose an expiration date.'));
36            }
37          }
38          elseif (!$expire = strtotime($node->expire) or $expire <= 0) {
39          form_set_error('expire_date', t('You have to specify a valid date.'));          form_set_error('expire_date', t('You have to specify a valid date.'));
40        }        }
41        elseif (strtotime($node->expire) <= time()) {        elseif ($expire <= time()) {
42          form_set_error('expire_date', t("You can't expire a node in the past!"));          form_set_error('expire_date', t("You can't expire a node in the past!"));
43        }        }
44        elseif (!empty($ntypes['max']) and strtotime($node->expire) > strtotime($ntypes['max'], $node->created)) {        elseif (!empty($ntypes['max']) and $expire > strtotime($ntypes['max'], $node->created)) {
45          form_set_error('expire_date', t('It must expire before %date.',          form_set_error('expire_date', t('It must expire before %date.',
46          array('%date' => format_date(strtotime($ntypes['max']), 'custom', NODE_EXPIRE_FORMAT))));          array('%date' => format_date(strtotime($ntypes['max'], $node->created), 'custom', NODE_EXPIRE_FORMAT))));
47        }        }
48        break;        break;
49    
# Line 75  function _node_expire_form_alter_nodefor Line 80  function _node_expire_form_alter_nodefor
80          array('%time' => format_date(time(), 'custom', NODE_EXPIRE_FORMAT))),          array('%time' => format_date(time(), 'custom', NODE_EXPIRE_FORMAT))),
81        '#type'          => 'textfield',        '#type'          => 'textfield',
82        '#maxlength'     => 25,        '#maxlength'     => 25,
83          '#required'      => $ntypes['required'],
84        '#default_value' => $node->expire,        '#default_value' => $node->expire,
85      );      );
86    

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.2