<?php
/**
*******************************************************************************
FiForms -- A collection of PHP classes designed
to facilitate rapid development of web-database software
Copyright (C) 2003-2008 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
*******************************************************************************
FiForms_info.inc.php
Main Information/Diagnostics
*******************************************************************************
**/
require_once("FiForms_FiForm.inc.php");
/* ?><code><?php */
class FiFormInfo
{
var $frm; // reference to a FiForm
public function FiFormsInfo($frm = FALSE)
{
$this->frm = $frm;
}
private function putline($name,$value)
{
echo "<tr><td class=\"e\"> ";
echo $name;
echo "</td><td class=\"v\">";
if($value === TRUE)
{
echo "<i>TRUE</i>";
}
else if ($value === FALSE)
{
echo "<i>FALSE</i>";
}
else
{
print_r( $value);
}
echo "</td></tr>";
} // function putline
private function dumpArray($arr)
{
$str = "";
foreach($arr as $ln)
{
$str .= $ln."<br />";
}
return $str;
}
public function dumpInfo()
{
echo <<<EOD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html><head>
<style type="text/css">
body {background-color: #ffffff; color: #000000;}
body, td, th, h1, h2 {font-family: sans-serif;}
pre {margin: 0px; font-family: monospace;}
a:link {color: #000099; text-decoration: none; background-color: #ffffff;}
a:hover {text-decoration: underline;}
table {border-collapse: collapse;}
.center {text-align: center;}
.center table { margin-left: auto; margin-right: auto; text-align: left;}
.center th { text-align: center !important; }
td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;}
h1 {font-size: 150%;}
h2 {font-size: 125%;}
.p {text-align: left;}
.e {background-color: #ccccff; font-weight: bold; color: #000000;}
.h {background-color: #9999cc; font-weight: bold; color: #000000;}
.v {background-color: #cccccc; color: #000000;}
.vr {background-color: #cccccc; text-align: right; color: #000000;}
img {float: right; border: 0px;}
hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #000000;}
</style>
<title>FiForms Info</title></head>
<body><div class="center">
<table border="0" cellpadding="3" width="600">
<tr class="h"><td>
<h1 class="p">FiForms Version
EOD;
echo $GLOBALS['FIFORMS_CONFIG']['VERSION'];
echo <<<EOD
</h1>
</td></tr>
</table><br />
<table border="0" cellpadding="3" width="600">
EOD;
foreach($GLOBALS['FIFORMS_CONFIG'] as $cfgname => $cfg)
{
$this->putline("<a href=\"http://wiki.fiforms.org/index.php/Configuration#$cfgname\">$cfgname</a>",$cfg);
switch($cfgname)
{
case "SCRIPT_PATH":
$this->putline("<i>SCRIPT_PATH Writable?</i>",is_writable($cfg) ? "<b>YES</b>":"<b><span style=\"color: red;\">NO</span></b>");
break;
case "APP_BASE":
$this->putline("<i>APP_BASE Writable?</i>",is_writable($cfg) ? "<b>YES</b>":"<b><span style=\"color: red;\">NO</span></b>");
break;
case "TEMP_PATH":
$this->putline("<i>TEMP_PATH Writable?</i>",is_writable($cfg) ? "<b>YES</b>":"<b><span style=\"color: red;\">NO</span></b>");
break;
case "XSLTPROC":
$output = array();
exec($cfg." --version",$output,$return);
$this->putline("<i>XSLT_PROC Runs?</i>",($return == 0) ? "<b>YES</b>":"<b><span style=\"color: red;\">NO</span></b>");
$this->putline("<i>XSLT_PROC Version</i>",$this->dumparray($output));
break;
case "UNZIP":
$output = array();
exec($cfg,$output,$return);
$this->putline("<i>UNZIP Runs?</i>",($return == 0) ? "<b>YES</b>":"<b><span style=\"color: red;\">NO</span></b>");
//putline("<i>UNZIP Version</i>",dumparray($output));
break;
case "MYSQLDUMP":
$output = array();
exec($cfg." --version",$output,$return);
$this->putline("<i>MYSQLDUMP Runs?</i>",($return == 0) ? "<b>YES</b>":"<b><span style=\"color: red;\">NO</span></b>");
$this->putline("<i>MYSQLDUMP Version</i>",$this->dumparray($output));
break;
}
}
echo "</table>
</div><br /><br />";
if($this->frm)
{
echo "<h2>FiForm Setup</h2><table border=\"0\" cellpadding=\"3\" width=\"600\">";
foreach($this->frm->inputs as $input)
{
$this->putline($input->name,$input->dbField);
}
echo "</table>";
}
phpinfo();
}
} // class FiFormInfo
/* ?></code><?php */
?>