<?php
/* This file is part of the FiForms Framework
Copyright (C) 2003-2008 by Daniel McFeeters,
Licensed under the GNU GPL.
See LICENSE.txt for details.
*/
Project Started May 4, 2003
*******************************************************************************
callmenu.php
Script to generate an HTML menu page from and XML menu definition.
*******************************************************************************
*/
if(!include_once('FiForms_global.inc.php'))
{
die('Could not find FiForms includes in your PHP path. This is probably due to the fact that you webserver is ignoring .htaccess files and you have not placed FiForms-includes in your PHP path. Please correct this problem before continuing. If you are using Apache, be sure that your configuration file includes the line <i>AllowOverride All</i>');
}
if(!defined('FIFORMS_MENU_PATH'))
die('No Application Specified or Application Disabled.');
if(!defined('FIFORMS_AUTH_MODULE'))
die('Authentication Module not defined in FiForms_global.inc.php');
require_once(FIFORMS_AUTH_MODULE);
function callMenu($index,$complete = 'COMPLETE')
{
$filename = str_replace(array("..","/","\\","%","*","$","(",")","\"","'",";","`"," ","="),"",$index);
chdir(FIFORMS_MENU_PATH);
$auth = new FiFormsAuth();
if(!@mysql_connect(FIFORMS_DEFAULT_SERVER,$auth->username,$auth->passwd))
{
$auth->connectFailure();
die();
}
mysql_close();
if(($filename !== $index) || !file_exists($filename))
{
die('Invalid File Name');
}
$recursive = isset($_GET['recursive']) ? 'RECURSIVE' : 'NONE';
if(FIFORMS_PHP_XSLT == TRUE)
{
$sheet = new DOMDocument();
$sheet->resolveExternals = false;
$sheet->load(FIFORMS_SCRIPT_PATH."reportList.xsl");
$xsl = new XSLTProcessor();
$xsl->importStyleSheet($sheet);
$xsl->setParameter('', 'complete', $complete);
$xsl->setParameter('', 'recursive', $recursive);
$xsl->setParameter('', 'xml_path', FIFORMS_XML_PATH);
$xsl->setParameter('', 'rpt_path', FIFORMS_RPT_PATH);
$xsl->setParameter('', 'app', $_GET['app']);
$xsl->setParameter('', 'stylesheet', FIFORMS_URI."/themes/".ICON_SET."/fiform_style.css");
$doc = new DOMDocument();
$doc->resolveExternals = false;
$doc->load($filename);
echo $xsl->transformToXML($doc);
}
else
{
$output = shell_exec(FIFORMS_XSLTPROC." ".FIFORMS_SCRIPT_PATH."reportList.xsl $filename --nonet --stringparam complete $complete --stringparam recursive $recursive --stringparam xml_path ".FIFORMS_XML_PATH." --stringparam rpt_path ".FIFORMS_RPT_PATH." --stringparam app ".$_GET['app']." --stringparam stylesheet ".FIFORMS_URI."/themes/".ICON_SET."/fiform_style.css");
if($output)
echo $output;
else
die("Error Executing ".FIFORMS_XSLTPROC.". Please see FiForms_global.inc.php.");
}
}
?>