Location: PHPKode > projects > FiForms Framework > FiForms/scripts/view.php
<?php
/*
*******************************************************************************

    FiForms -- A collection of PHP classes designed 
    to facilitate rapid development of web-database software

    Copyright (C) 2003 - 2005 Daniel McFeeters

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    General Public License for more details.

    You should have received a copy of the GNU General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


    The original author of this library can be contacted at the following 
    address:

    Daniel McFeeters
    182 Baker Rd.
    Faubush, KY 42544-6526
    email:databases [at] fiforms [dot] org
    http://www.fiforms.org/


Project Started May 4, 2003
*******************************************************************************
view.php

Script to view the parameter entry screen for a FiReport.

*******************************************************************************
*/

    require_once('localconfig.php');
    if($FIFORMS_CONFIG['USE_COMBINED'])
    {
        include_once(dirname(__FILE__).'/FiForms_combined.inc.php');
    }
    else
    {
        include_once($FIFORMS_CONFIG['INCLUDE_PATH'].'FiForms_genericIcons.inc.php');
        include_once($FIFORMS_CONFIG['INCLUDE_PATH'].'FiForms_global.inc.php');
        include_once($FIFORMS_CONFIG['INCLUDE_PATH'].'FiForms_FiForm.inc.php');
        include_once($FIFORMS_CONFIG['INCLUDE_PATH'].'FiReports_xsltWrapper.inc.php');
    }
    if(!isset($FIFORMS_CONFIG['RPT_PATH']))
        die("No Application Specified or Application Disabled.");
    if(!isset($FIFORMS_CONFIG['AUTH_MODULE']))
        die('Authentication Module not defined in FiForms_global.inc.php');
    require_once($FIFORMS_CONFIG['AUTH_MODULE']);

    $auth = new FiFormsAuth();
    if(!@mysql_connect($FIFORMS_CONFIG['DEFAULT_SERVER'],$auth->username,$auth->passwd))
    {
        $auth->connectFailure();
        die('Connection Error');
    }
    mysql_close();

    $report = str_replace(array("..","\\","%","*","$","(",")","\"","'",";","`"," ","="),"",$_GET['report']);
    if(($report !== $_GET['report']) || !file_exists($FIFORMS_CONFIG['RPT_PATH'].$report))
    {
       die('Invalid File Name');
    }
    chdir($FIFORMS_CONFIG['RPT_PATH']);
    $user = $_SERVER['PHP_AUTH_USER'];
    if(!$user)
        $user = "DEFAULT";
    $FIFORMS_CONFIG['APP_NAME'] = $FIFORMS_CONFIG['APP_NAME'] ? $FIFORMS_CONFIG['APP_NAME'] : "default";
    include_once($FIFORMS_CONFIG['SCRIPT_PATH'].'themes/'.$FIFORMS_CONFIG['ICON_SET'].'/iconset.php');
    $ico = new iconset();
    $xslt = new xsltWrapper();
    $xslt->params = array('filename' => $report,
                         'currentdate' => date('Y-m-d'),
                         'user' => $user,
                         'dropdownicon' => $ico->downURI,
                         'refreshicon' => $ico->refreshURI,
                         'app' => $FIFORMS_CONFIG['APP_NAME'],
                         'stylesheet' => $FIFORMS_CONFIG['URI']."/themes/".$FIFORMS_CONFIG['ICON_SET']."/fiform_style.css",
                         'debug' => ($GLOBALS['FIFORMS_CONFIG']['SHOW_DEFINITION'] && $GLOBALS['FIFORMS_CONFIG']['QUERY_DEBUGGING'] ? 'YES' : 'NO'));
    $result = $xslt->transformFileByFile($report,$FIFORMS_CONFIG['SCRIPT_PATH']."reportDef.serverside.xsl");
    if($result)
    {
      echo $result;
    }
    else
    {
      echo "<pre>".$xslt->errorMsg;
    }
    /*
    if($FIFORMS_CONFIG['PHP_XSLT'] == TRUE)
    {
        
        $sheet = new DOMDocument();
        $sheet->resolveExternals = false;
        $sheet->load($FIFORMS_CONFIG['SCRIPT_PATH']."reportDef.serverside.xsl");
        $xsl = new XSLTProcessor();
        $xsl->importStyleSheet($sheet);
        $xsl->setParameter('', 'filename', $report);
        $xsl->setParameter('', 'currentdate', date('Y-m-d'));
        $xsl->setParameter('', 'user', $user);
        $xsl->setParameter('', 'dropdownicon', $ico->downURI);
        $xsl->setParameter('', 'app', $FIFORMS_CONFIG['APP_NAME']);
        $xsl->setParameter('', 'stylesheet', $FIFORMS_CONFIG['URI']."/themes/".$FIFORMS_CONFIG['ICON_SET']."/fiform_style.css");
        $doc = new DOMDocument();
        $doc->resolveExternals = false;
        $doc->load($report);
        echo $xsl->transformToXML($doc);
    }
    else
    {
        passthru($FIFORMS_CONFIG['XSLTPROC']." --nonet --stringparam filename $report --stringparam currentdate ".date('Y-m-d')." --stringparam user $user --stringparam dropdownicon ".$ico->downURI." --stringparam stylesheet ".$FIFORMS_CONFIG['URI']."/themes/".$FIFORMS_CONFIG['ICON_SET']."/fiform_style.css --stringparam app ".$FIFORMS_CONFIG['APP_NAME']." ".$FIFORMS_CONFIG['SCRIPT_PATH']."reportDef.serverside.xsl $report");
    }
    */

?>
Return current item: FiForms Framework