Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
128 lines (99 sloc) 5.17 KB
$start = time();
// 3/12/2002 - Tim Gallagher<> added the version checking
// included below to deal with the different ways php sends variables into scripts.
// see the file for more information.
include ("versionSanity.php");
// WARNING: long runtimes! Make modifications
// to the php[3].ini if neccessary. A P3-500
// needs slightly more than 30 seconds to
// document phpdoc itself.
// 3/8/2002 Tim Gallagher - cleaned up the code on this page
// by making the html on this page a function call.
// this makes the indenting much cleaner.
// new functions can be found at the bottom of prepend.php
//SERVER_DOC_ROOT is defined in versionSanity.php
// Directory with include files
// Html tags allowed to be used in doc tags
define("PHPDOC_ALLOWEDHTMLTAGS", "<a>,<i>,<b>,<pre>,<ul>,<li>,<br>,<code>");
// main PHPDoc Include File
// look at the bottom of prepend.php for this function
// this function also includes front-end.php
// output buffering used to format the previously <pre>ed text on this page prettier.
$doc = new Phpdoc;
// Sets the name of your application.
// The name of the application gets used in many default templates.
// directory where your source files reside:
$doc->setSourceDirectory(SERVER_DOC_ROOT . $_REQUEST['PHPDOC_sourcedir']);
// save the generated docs here:
$doc->setTarget(SERVER_DOC_ROOT . $_REQUEST['PHPDOC_targetdir']);
$templateName = $_REQUEST['PHPDOC_selectedTemplate'];
// use these templates:
// this is the data sent in from the html form.
// source files have one of these suffixes:
$doc->setSourceFileSuffix( array ("php", "inc") );
/* ------------------------------------------------------------------
// 3/2/2002 - Tim Gallagher<> changed this section to allow
// for deleting files in the existing targetdir location
// this should be considered a HUGE security risk... we're not
// checking any file permissions to see what we're deleting.
if ($_REQUEST['PHPDOC_deleteFilesOption'] =="ON") {
// uncomment the line below to turn file deleting on.
// if you do, you MUST be sure that only trusted people have access to the PHPDoc directory
// because a malicious user could send bogus data to the script and delete EVERYTHING on your webserver.
//include ("delete_files.php");
}; // end if
// parse and generate the xml files
/* ------------------------------------------------------------------
3/1/2002 - Tim Gallagher<> changed this section (added it really) to
automatically copy the phpdoc.css file (and others) to the destination
directory automatically so it's always there.
also added an auto copy for the frameset, dtd, and empty.html files.
/* ------------------------------------------------------------------
3/11/2002 - Tim Gallagher<> changed this section
to use the template array as defined in /renderer/templates.php
for the path in the following section
// 3/11/2002 - Tim Gallagher<> added this note:
// we do a str_replace here to keep all paths using the forward slash (which is compatible under
// linux, unix, and windows - make sure apache is set up correctly under win32 - in other words
// make sure apache is using forward slashes in the virtual directive (or in the document root directive)
$fileToCopySrc = str_replace("\\","/", realpath($PHPDOC_templates[$templateName]['static_files_path']) . "/");
$fileToCopyDst = str_replace("\\","/", realpath(SERVER_DOC_ROOT. $_REQUEST['PHPDOC_targetdir']) . "/");
// 3/11/2002 - Tim Gallagher<> added this note:
// we've already scanned the static file path in templates.php located in PHPDOC/renderer/
// so we can simply set our $filesToCopy to the array defined in the $PHPDOC_templates variable
$filesToCopy = $PHPDOC_templates[$templateName]['files'];
echo "Copying files now...\n";
for ($a = 0; $a < count($filesToCopy) ; $a++) {
//echo "Copying $fileToCopySrc$filesToCopy[$a].\n";
if (! (copy ($fileToCopySrc . $filesToCopy[$a], $fileToCopyDst . $filesToCopy[$a])) ) {
echo "An error occured trying to copy $fileToCopySrc$filesToCopy[$a].\n\n";
}; // end if
}; // end for loop
// ------------------------------------------------------------------
// 3/11/2002 - Tim Gallagher<> moved the render method call
// and put it below the file copy section
// so we can copy a dummy warnings html file to the destination, but have it overwritten
// by the render method if warnings do exist. I got really tired of having a 404 error on all my pages
// when clicking on the "Report" link.
// turn xml into html using templates
echo time() - $start . " seconds needed.";
$out = ob_get_contents();
// display a link to view the documentation with.
echo '<a href="' . $_REQUEST['PHPDOC_targetdir'] . '/">View your generated documentation here.</a><br>';
echo nl2br($out);
// look at the bottom of prepend.php for this function
Something went wrong with that request. Please try again.