2001-03-24 16:37:44 +00:00
< ? php
2001-10-20 18:57:10 +00:00
// $Id$
2001-03-24 16:37:44 +00:00
2001-04-29 13:41:18 +00:00
include_once " includes/common.inc " ;
2001-03-24 16:37:44 +00:00
2001-05-20 13:51:40 +00:00
page_header ();
2001-04-15 17:01:32 +00:00
2001-04-16 18:21:22 +00:00
function node_render ( $node ) {
2001-06-29 22:08:57 +00:00
global $id , $cid , $op , $moderate , $pid , $edit , $theme , $mode , $order , $threshold , $PHP_SELF ;
2001-04-16 18:21:22 +00:00
2001-06-29 22:08:57 +00:00
if ( user_access ( " access content " )) {
2001-06-20 20:00:40 +00:00
2001-12-30 16:16:38 +00:00
$theme -> header ( check_output ( $node -> title ));
node_view ( $node );
2001-06-20 20:00:40 +00:00
if ( $node -> comment ) {
2001-12-30 16:16:38 +00:00
comment_render ( $id , $cid );
2001-04-16 18:21:22 +00:00
}
2001-12-30 16:16:38 +00:00
$theme -> footer ();
2001-04-16 18:21:22 +00:00
}
else {
$theme -> header ();
2001-06-20 20:00:40 +00:00
$theme -> box ( t ( " Access denied " ), message_access ());
2001-04-16 18:21:22 +00:00
$theme -> footer ();
}
}
2001-03-29 19:50:31 +00:00
function node_failure () {
global $theme ;
$theme -> header ();
2001-11-01 17:04:20 +00:00
$theme -> box ( t ( " Not found " ), t ( " The node you are looking for does no longer exist or is not accessible without the proper access rights. " ) . " \n " );
2001-03-29 19:50:31 +00:00
$theme -> footer ();
}
2001-11-01 11:00:51 +00:00
$number = ( $title ? db_num_rows ( db_query ( " SELECT nid FROM node WHERE title = ' $title ' AND status = 1 " )) : 1 );
2001-03-24 16:37:44 +00:00
2001-03-29 19:50:31 +00:00
if ( $number > 1 ) {
2001-11-01 11:00:51 +00:00
$result = db_query ( " SELECT n.*, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.title = ' $title ' AND n.status = 1 ORDER BY created DESC " );
2001-03-29 19:50:31 +00:00
while ( $node = db_fetch_object ( $result )) {
2001-11-01 17:04:20 +00:00
if ( node_access ( " view " , $node )) {
2002-04-22 09:05:36 +00:00
$output .= " <p><b> " . l ( check_output ( $node -> title ), array ( " id " => $node -> nid )) . " </b><br /><small> $node->type - " . format_name ( $node ) . " - " . format_date ( $node -> ccreated , " small " ) . " </small></p> " ;
2001-03-29 19:50:31 +00:00
}
2001-03-24 16:37:44 +00:00
}
2001-03-29 19:50:31 +00:00
2001-03-24 16:37:44 +00:00
$theme -> header ();
2001-03-29 19:50:31 +00:00
$theme -> box ( t ( " Result " ), $output );
2001-03-24 16:37:44 +00:00
$theme -> footer ();
}
2001-03-29 19:50:31 +00:00
elseif ( $number ) {
2002-04-22 09:05:36 +00:00
$node = ( $title ? node_load ( array ( " title " => $title , " status " => 1 )) : node_load ( array ( " nid " => ( $edit [ " id " ] ? $edit [ " id " ] : $id ))));
2001-11-03 18:38:30 +00:00
2001-11-01 17:04:20 +00:00
if ( node_access ( " view " , $node )) {
2001-11-03 18:38:30 +00:00
if ( isset ( $revision )) {
2001-11-04 15:57:43 +00:00
$node = $node -> revisions [ $revision ][ " node " ];
2001-11-03 18:38:30 +00:00
}
2001-11-04 15:57:43 +00:00
node_render ( $node );
2001-03-29 19:50:31 +00:00
}
2001-04-04 21:09:24 +00:00
else {
node_failure ();
}
2001-11-03 18:38:30 +00:00
2001-04-04 21:09:24 +00:00
}
else {
node_failure ();
2001-03-29 19:50:31 +00:00
}
2001-03-24 16:37:44 +00:00
2001-05-20 13:51:40 +00:00
page_footer ();
2001-11-01 11:00:51 +00:00
2001-03-24 16:37:44 +00:00
?>