<?
class ActionPerformer {
function ActionPerformer() {}
function &add() { // STATIC VOID METHOD
// ADD METADATA TO IMAGE
global $section, $action, $redjrectArray, ${$section . 'LocationPath'}, $thumbLocationPath;
foreach ($_POST as $key => $val) if (!isset(${$key})) ${$key} = $val;
$locationPath = ($album) ? "${$section . 'LocationPath'}/$album" : ${$section . 'LocationPath'};
$origLocationPath = ($origAlbum) ? "${$section . 'LocationPath'}/$origAlbum" : ${$section . 'LocationPath'};
$thumbLoc = ($album) ? "$thumbLocationPath/$album" : $thumbLocationPath;
$origThumbLoc = ($origAlbum) ? "$thumbLocationPath/$origAlbum" : $thumbLocationPath;
$this->setFileName();
if ($_FILES[$section]['tmp_name']) {
$this->upload(); // UPLOAD WILL TAKE OVER FROM HERE - UPLOAD AND THEN SAVE METADATA
} elseif (@is_file(actual_path("$origLocationPath/" . ${'orig' . ucfirst($section) . 'Name'})) && $send &&
strcmp(actual_path("$origLocationPath/" . ${'orig' . ucfirst($section) . 'Name'}), actual_path("$locationPath/" . $this->fileName)) != 0
) {
if (@!rename_win(actual_path(realpath("$origLocationPath/" . ${'orig' . ucfirst($section) . 'Name'})),
actual_path("$locationPath/" . $this->fileName))
) { // YOU CAN USE rename_win() FOR BOTH WINDOWS AND UNIX
$this->isSuccessful = false;
$this->setErrorArray(array("${section}_name" => "Could not move \"${'orig' . ucfirst($section) . 'Name'}\" to \"$locationPath/$this->fileName\": " . nl2br(htmlspecialchars($msg))));
}
$hasMovedThumb = @rename_win(actual_path("$origThumbLoc/" . ${'orig' . ucfirst($section) . 'Name'}), actual_path("$thumbLoc/" . $this->fileName));
// MOVE THUMBNAILS IF FOUND
if ($this->isSuccessful && !$hasMovedThumb) {
$this->isSuccessful = false;
$this->setErrorArray(array("${section}_name" => "Could not move thumbnail of \"${'orig' . ucfirst($section) . 'Name'}\" to \"$locationPath/$this->fileName\": " . nl2br(htmlspecialchars($msg))));
}
}
$GLOBALS["${section}_name"] = $this->fileName; // NEW 10/5/2006: MAKE SURE THIS VALUE IS GLOBAL FOR INHERITED getSuccessMsg() METHOD
if ($this->isSuccessful && $redirectArray[$section]['add']) {
print_r("redirectArray = "); print_r($redirectArray); print_r("<P>"); die('');
//echo $this->getHTMLRedirect('add', 'id=' . $this->id . '&willFlushResult=1&chooseAlbum=1&album=' . urlencode($album) . "&willDisplayPanel=$willDisplayPanel");
}
}
}
?>
The method "add" works just fine except for the fact that $redirectArray, which is set in /globals/project_globals.inc.php and is included prior to even including the class library that contains ActionPerformer - further verified by being able to echo the values of $section and $action and ${$section . 'LocationPath'} as well
However, $redirectArray does not seem to exist within the method scope though I've done everything to insure that it does exist. What else must I do?
This only breaks in PHP 5.2.0 in WinXP; it works beautifully everywhere else literally, from PHP 4.1.2 to PHP 5.0.4 and Windows/Unix.
Thanx
Phil