comparison modules/node/node.module @ 19:3edae6ecd6c6 6.9

Drupal 6.9
author Franck Deroche <franck@defr.org>
date Thu, 15 Jan 2009 10:15:56 +0100
parents fff6d4c8c043
children
comparison
equal deleted inserted replaced
18:f5131a9cd9e5 19:3edae6ecd6c6
1 <?php 1 <?php
2 // $Id: node.module,v 1.947.2.11 2008/06/25 08:59:57 goba Exp $ 2 // $Id: node.module,v 1.947.2.13 2009/01/14 23:34:07 goba Exp $
3 3
4 /** 4 /**
5 * @file 5 * @file
6 * The core that allows content to be submitted to the site. Modules and scripts may 6 * The core that allows content to be submitted to the site. Modules and scripts may
7 * programmatically submit nodes using the usual form API pattern. 7 * programmatically submit nodes using the usual form API pattern.
901 // The changed timestamp is always updated for bookkeeping purposes (revisions, searching, ...) 901 // The changed timestamp is always updated for bookkeeping purposes (revisions, searching, ...)
902 $node->changed = time(); 902 $node->changed = time();
903 903
904 $node->timestamp = time(); 904 $node->timestamp = time();
905 $node->format = isset($node->format) ? $node->format : FILTER_FORMAT_DEFAULT; 905 $node->format = isset($node->format) ? $node->format : FILTER_FORMAT_DEFAULT;
906 $update_node = TRUE;
907 906
908 // Generate the node table query and the node_revisions table query. 907 // Generate the node table query and the node_revisions table query.
909 if ($node->is_new) { 908 if ($node->is_new) {
910 _node_save_revision($node, $user->uid); 909 _node_save_revision($node, $user->uid);
911 drupal_write_record('node', $node); 910 drupal_write_record('node', $node);
918 _node_save_revision($node, $user->uid); 917 _node_save_revision($node, $user->uid);
919 db_query('UPDATE {node} SET vid = %d WHERE nid = %d', $node->vid, $node->nid); 918 db_query('UPDATE {node} SET vid = %d WHERE nid = %d', $node->vid, $node->nid);
920 } 919 }
921 else { 920 else {
922 _node_save_revision($node, $user->uid, 'vid'); 921 _node_save_revision($node, $user->uid, 'vid');
923 $update_node = FALSE;
924 } 922 }
925 $op = 'update'; 923 $op = 'update';
926 } 924 }
927 925
928 // Call the node specific callback (if any). 926 // Call the node specific callback (if any).
1977 * TRUE if the operation may be performed. 1975 * TRUE if the operation may be performed.
1978 */ 1976 */
1979 function node_access($op, $node, $account = NULL) { 1977 function node_access($op, $node, $account = NULL) {
1980 global $user; 1978 global $user;
1981 1979
1982 if (!$node) { 1980 if (!$node || !in_array($op, array('view', 'update', 'delete', 'create'), TRUE)) {
1981 // If there was no node to check against, or the $op was not one of the
1982 // supported ones, we return access denied.
1983 return FALSE; 1983 return FALSE;
1984 } 1984 }
1985 // Convert the node to an object if necessary: 1985 // Convert the node to an object if necessary:
1986 if ($op != 'create') { 1986 if ($op != 'create') {
1987 $node = (object)$node; 1987 $node = (object)$node;