/program/main_index.php - workhorse for visitor interface
This file deals with the visitor interface. It is included and called from /index.php.
The work is done in main_index().
Parameters are passed like index.php?parm=val. Here is an overview of recognised global parameters that are handled here (and not in a module).
try to retrieve a valid area record based on values of requested area and requested node
this determines which area to use. If the user specifies nothing (no area, no node), we simply go for the default area or the first available area. If the user does specify an area and/or a node, we use that information to get to the area. Note that if the user specifies both area and node, the two should match. That is: you cannot specify a node from area X and also request area Y: that yields no results. If only a node is specified, the area is calculated from the area to which the node belongs.
We let the database do most of the work by constructing and executing an appropriate SQL-statement.
try to find a default page within a subtree of pages and sections
this walks the tree $tree starting at $subtree_id looking for a default page. We give it three tries. First we look for a default node in the section of which $subtree_id is the first node. If we find a page, we're done, if we find a section we descend into that subsubtree. If there still is no default page, we go look for any page in the initial set of nodes. If that too doesn't yield a page, we descend into the subsubtrees. If THAT doesn't yield a page we give up and return FALSE, indicating no page to be found.
calculate and validate the node_id to display
this tries to determine a valid node to display based on the node the user requested and the area that the user may or may not have requested.
Basic assumption is that the visitor has indeed view access to area $area_id. This means that the user is allowed to see the nodes in this area that are not under embargo (and not expired). We do have a complete overview of all nodes in this area in the array $tree. (See tree_build() for more information about the tree structure)
The parameter $requested_node is either an integer, indicating the user explicitly specified a node number in the page request, or null, indicating that the user did not explicitly specify a node. In the latter case the user may or may not have explicitly requested an area.
There are several cases we need to handle - if no node is explicitly requested, we need to identify the default page in the area - if the node is under embargo the node does not exist (from the POV of the user) - if the requested node is a section, we need to identify the default page in that section
main program for visitors
this routine is called from /index.php. It is the main program for visitors.
load the visitor/view interface of a module in core
this includes the 'view'-part of a module via 'require_once()'. This routine first figures out if the view-script file actually exists before the file is included. Also, we look at a very specific location, namely: /program/modules/<modulename>/<module_view_script> where <modulename> is retrieved from the modules table in the database.
Note that if modulename would somehow be something like "../../../../../../etc/passwd\x00", we could be in trouble...
call the routine that generates the view (content) of module $module_id
this loads the file containing the visitor interface for module $module_id in core and subsequently calls the routine responsible for displaying the content (function modulename_view()). The routine module_view() is supposed to deposit any output into the $theme via the appropriate methods such as $theme->add_content().
update all statistics for the view of page $node_id
this is a place for future extension. This routine is called once for every page view. It can be used to record relevant data in a table, for future reference, e.g.
update the view count for page $node_id
Documentation generated on Tue, 28 Jun 2016 19:10:29 +0200 by phpDocumentor 1.4.0