| 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 |
| 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 |
} |
} |