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

Diff of /contributions/modules/type_local_nids/type_local_nids.module

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

revision 1.1.2.3, Sat Apr 25 21:21:50 2009 UTC revision 1.1.2.4, Tue Sep 22 17:28:00 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: type_local_nids.module,v 1.1.2.2 2008/03/30 16:06:15 jbrown Exp $  // $Id: type_local_nids.module,v 1.1.2.3 2009/04/25 21:21:50 jbrown Exp $
3    
4    
5  function _type_local_nids_generate_lnid(&$node) {  function _type_local_nids_get_lnid(&$node) {
6    
7            $node->lnid = db_result(db_query("
8                    SELECT lnid
9                    FROM {node_lnid}
10                    WHERE nid = %d
11            ",
12                    $node->nid
13            ));
14    
15            if($node->lnid)
16              return;
17    
18          $node->lnid = db_result(db_query("          $node->lnid = db_result(db_query("
19                  SELECT next_lnid                  SELECT next_lnid
# Line 26  function _type_local_nids_generate_lnid( Line 37  function _type_local_nids_generate_lnid(
37                  db_query("                  db_query("
38                          INSERT INTO {node_lnid_next}                          INSERT INTO {node_lnid_next}
39                          SET type = '%s',                          SET type = '%s',
40                          next_lnid = 2                          next_lnid = 2
41                  ",                  ",
42                          $node->type                          $node->type
43                  );                  );
# Line 49  function type_local_nids_nodeapi(&$node, Line 60  function type_local_nids_nodeapi(&$node,
60    
61          switch ($op) {          switch ($op) {
62    
                 case 'load':  
                 case 'update':  
   
                         $node->lnid = db_result(db_query("  
                                 SELECT lnid  
                                 FROM {node_lnid}  
                                 WHERE nid = %d  
                         ",  
                                 $node->nid  
                         ));  
   
63                  case 'insert':                  case 'insert':
64                    case 'update':
65                    case 'load':
66    
67                          if(!$node->lnid)                          _type_local_nids_get_lnid($node);
                                 _type_local_nids_generate_lnid($node);  
68    
69                          return array('lnid' => $node->lnid);                          return array('lnid' => $node->lnid);
70    

Legend:
Removed from v.1.1.2.3  
changed lines
  Added in v.1.1.2.4

  ViewVC Help
Powered by ViewVC 1.1.2