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

Diff of /contributions/modules/url_access/url_access.module

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

revision 1.1, Wed Aug 29 15:05:26 2007 UTC revision 1.1.2.1, Mon Dec 10 20:04:10 2007 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id:$  // $Id: url_access.module,v 1.1 2007/08/29 15:05:26 deviantintegral Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 17  function url_access_init() { Line 17  function url_access_init() {
17    
18    // If we aren't on a node, return    // If we aren't on a node, return
19    if (arg(0) != 'node') return;    if (arg(0) != 'node') return;
20    
21    $node = node_load(arg(1));    $nid= arg(1);
22      if( ! is_numeric( $nid)) return;
23    
24      $node_info = db_fetch_array(db_query("SELECT n.uid, u.uuid FROM {url_access} u INNER JOIN {node} n ON n.nid=u.nid WHERE u.nid=%d", $nid));
25    
26    // Let the author have access    // Let the author have access
27    if($user->name == $node->name) return;    if($user->uid == $node_info['uid']) return;
28    
29    // There's no UUID in the database, so there's nothing to block    // There's no UUID in the database, so there's nothing to block
30    if (!$node->url_access) return;    if (!$node_info['uuid']) return;
31    
32    $url = explode('/', trim($_SERVER['REQUEST_URI'], '/'));    $url = explode('/', trim(request_uri(), '/'));
33      $url[0]= str_replace( '?q=', '', $url[0]);
34    
35    if($url[0] == 'protected') {    if($url[0] == 'protected') {
36      $url_uuid = $url[1];      $url_uuid = $url[1];
37      if($url_uuid == $node->url_access) {      if($url_uuid == $node_info['uuid']) {
38        return;        return;
39      }      }
40    }    }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.2.1

  ViewVC Help
Powered by ViewVC 1.1.2