/program/lib/node.class.php - taking care of nodes
This file defines a class for dealing with nodes.
Located in /program/lib/node.class.php (line 30)
determine which node should be displayed based on user's request
In total there are 4 cases for node n and area a:
3. n undefined, a defined return the default n in the specified a if a is active or FALSE if not found
4. n undefined, a undefined return the default n in the default a or FALSE if no active default area exists
Cases 1 and 2 might lead to a node that is not available (ie expired or under embargo). In order to not 'give away' information about the possible existence of the requested node, we simply return FALSE, indicating that the node was not found.
There is a potential problem with a request for a node that is of type 'section' (i.e. not a page that eventually yields actual content). The problem is that in that case we should look for a valid page-type node in that section-type node. The question is whether we should look for a default page in a (default) subsection or not (nested default). Currently the strategy is to look for the first suitable page if available, and otherwise descend into the first suitable subsection and try again repeatedly until we find a page or we reach the end of the tree.
Note: As a side effect of this function, the path from the area root to the final page is calculated. This navigation path is returned in the variable reference $node_path.
Calculation of this navigation path is necessary in order to determine the visibility of a node; if a section-type node higher in the tree is not available, all underlying nodes should also not be available. IOW: not anly do we have to check the actual node, we need to check all parent nodes too.
The array returned in $node_path is keyed with the node_id, i.e. the array element $node_path[$node_id] yields the database record for node $node_id.
Note that we check the node embargo date and the expiry date in two separate expressions rather than using the 'BETWEEN low AND high' because you never can be sure if it is inclusive low/high or not and the database might assume the low is always smaller than high.
Documentation generated on Wed, 11 May 2011 23:45:31 +0200 by phpDocumentor 1.4.0