Source for file menu.php
Documentation is available at menu.php
* Main menu for admin and normal users
* @author Stuart Prescott
* @copyright Copyright Stuart Prescott
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
/** Load ancillary functions */
require_once 'inc/typeinfo.php';
require_once 'inc/permissions.php';
* Main menu for admin and normal users
* @todo //TODO: combine the data storage with action.php for cleaner implementation
* list of available actions
* text output before start of menu block
* text output after end of menu block
* html id for the enclosing DIV
* html start-tag for the menu section
* html menu entry (complete!) for the link to the online help
* html stop-tag for the menu section
* html start-tag for each menu entry
* html stop-tag for each menu entry
* html id for div that alerts to current Masquerade setting
* html start-tag for each menu section
* html stop-tag for each menu section
* text to include at start of main menu section
* text to include at start of admin menu section
* tag to use for the masq alert style (be careful of using div in an ul!)
* logged in user's credentials
* currently selected action
* @param BumblebeeAuth $auth user's credentials
* @param string $verb current action
$this->menuHelp =
'<li class="last"><a href="http://bumblebeeman.sf.net/docs?section=__section__&version=__version__">' .
T_('Help') .
'</a></li>';
* Generates an html representation of the menu
* @return string menu in html format
* Generates an html representation of the menu according to the current user's permissions
* @return string menu in html format
#preDump($this->actionListing->actions);
#print $action->name()."<br />\n";
#print $action->name(). " requires " . $action->permissions() . " have " .$this->_auth->system_permissions."<br />\n";
if ($action->menu_visible() &&
$this->_auth->permitted($action->permissions())) {
if ($first_admin &&
$action->requires_admin()) {
.
'<a href="'.
makeURL($action->name()).
'">'.
$action->menu().
'</a>'
* Generates an html div to alert the user that masquerading is in action
* @return string menu in html format
.
' (<a href="'.
makeURL('masquerade', array('id'=>-
1)).
'">end</a>)'
* Generates an html snippet to for the link to the online help
* @return string menu in html format
* @global string version of the Bumblebee installation (can serve different versions if necessary)
$help =
preg_replace(array('/__version__/', '/__section__/'),
array($BUMBLEBEEVERSION, $this->_verb),
* create a URL for an anchor
* @param string $action action to be performed
* @param array $list (optional) key => value data to be added to the URL
* @param boolean $escape use & rather than & in the URL
function makeURL($action=
NULL, $list=
NULL, $escape=
true) {
$list =
is_array($list) ?
$list :
array();
if ($action !==
NULL) $list['action'] =
$action;
foreach ($list as $field =>
$value) {
$delim =
$escape ?
'&' :
'&';
if (count($args) >
0) return $conf->BaseURL.
'?'.
join($delim, $args);
* Create an absolute URL for an anchor (include protocol and port)
* @param array $list (optional) key => value data to be added to the URL
* @param boolean $escape use & rather than & in the URL
* @return string Absolute URL
if (isset
($_SERVER['HTTPS']) &&
!strcasecmp($_SERVER['HTTPS'], 'on')) {
$port = isset
($_SERVER['SERVER_PORT']) ?
$_SERVER['SERVER_PORT'] :
80;
// filter out well known ports from the URL
if (($protocol ==
'http' &&
$port ==
80) ||
($protocol ==
'https' &&
$port ==
443)) {
$host =
$_SERVER['SERVER_NAME'];
list
($host) =
explode(':', $_SERVER['HTTP_HOST']);
$serverPart =
$protocol .
'://'.
$host .
(isset
($port) ?
':'.
$port :
'');
if (is_array($target) ||
$target ===
NULL) {
$pathPart =
makeURL($target[0], $target[1], $escape);
$pathPart =
$conf->BasePath .
$target;
return $serverPart .
$pathPart;
* Bounces the user to an alternative location, terminating execution of this script
* @param string $location URL that the user should be redirected to
header("Location: ".
$location);
Documentation generated on Tue, 06 Mar 2007 10:01:46 +0000 by phpDocumentor 1.3.0