## $Id$
## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES.
+
/*********************Function Declarations***************************/
function criticalFileFailRedirect($functionName, $doctype, $action,
$returnTo)
{
/*******************************************************************
This function simply redirects
the browser to the func.php page. It is called when the file
cannot be opened for reading/writing.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
ca8nro@yahoo.co.uk
Created: 01/02/2001
Last Modified: 06/02/2001
*******************************************************************/
# Make the functionality to send the page back home...
print("\n\n");
} // END function criticalFileFailRedirect()
//**************
- function doBusiness($file, $functionName, $doctype, $action, $returnTo)
+ function doBusiness($uploadTplPath, $file, $functionName, $doctype, $action, $returnTo)
{
/*******************************************************************
This function has the task of reading from the file, and with
this data, producing the page.
Author: Nicholas Robinson
Email: Nicholas.Robinson@cern.ch
ca8nro@yahoo.co.uk
Created: 01/02/2001
Last Modified: 01/02/2001
*******************************************************************/
# Test to see if the file already exists.
- if(!is_file($file))
+ if(!is_file("$uploadTplPath/$file"))
{
- # The file does not exist. We had better create it...
- if(!$filePtr = fopen($file, "w"))
+ # The file does not exist. Create it.
+ if(!$filePtr = fopen("$uploadTplPath/$file", "w"))
{
# Unable to make the file
-
- print("\n");
-
- # Set an error flag to indicate the failure of this file
- # creation.
-
+ # Set an error flag to indicate the failure of this file creation.
$file_there = false;
} // END if
else
{
- # ok, set file there equal to true, as we have managed to
- # create it.
+ fclose($filePtr);
$file_there = true;
} // END else
} // END if
else
{
# File already exists, so we can set the flag to say so...
$file_there = true;
} // END else
# Now we can see if the file exists or not. If so, we can output
# our form, with its details. If not, we can simply present the
# user with an error message, and redirect the page back to
# "func.php".
if($file_there)
{
- # Cool. Our file lives.
-
- # Cool. Now we must open our file (Possibly again if it
- # hadn't already existed!), and read its contents...
-
- if(!$fPtr = fopen($file, "r"))
+ # read file contents
+ if(!$fPtr = fopen("$uploadTplPath/$file", "r"))
{
- # Great, the damn file did not open...
-
- print("\n");
-
print("Unable To Open File."
. "
\n");
-
criticalFileFailRedirect($functionName, $doctype, $action,
$returnTo);
} // END if
else
{
- # Cool. We have opened it just nicely...
-
print("Contents of "
. "$file\n");
-
#Separate our page out....
drawSeparator();
# Make our text area with all of the files data in it...
print("