--- url_access_orig/url_access/url_access.module 2007-08-29 17:05:26.000000000 +0200 +++ /home/clemens/www/drupalink/url_access-5.x-1.0/url_access.module 2007-12-10 13:56:13.000000000 +0100 @@ -17,20 +17,24 @@ function url_access_init() { // If we aren't on a node, return if (arg(0) != 'node') return; - - $node = node_load(arg(1)); - + + $nid= arg(1); + if( ! is_numeric( $nid)) return; + + $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)); + // Let the author have access - if($user->name == $node->name) return; - + if($user->uid == $node_info['uid']) return; + // There's no UUID in the database, so there's nothing to block - if (!$node->url_access) return; - - $url = explode('/', trim($_SERVER['REQUEST_URI'], '/')); + if (!$node_info['uuid']) return; + + $url = explode('/', trim(request_uri(), '/')); + $url[0]= str_replace( '?q=', '', $url[0]); if($url[0] == 'protected') { $url_uuid = $url[1]; - if($url_uuid == $node->url_access) { + if($url_uuid == $node_info['uuid']) { return; } } @@ -143,4 +147,4 @@ function _url_access_uuid() { $result = db_query($query); $uuid = db_result($result); return $uuid; -} \ No newline at end of file +}