X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Images.php;h=54984b97edb54da70753c1d383f62d6f23fe5728;hb=ce7e739df25d4ed828d5818b57981eda60c5a351;hp=d66ea3d44d81dc4b35c501c4f28b7419686988b8;hpb=176a39f54bdba5e55f2eba7cc39c3ffc710ad8a4;p=Pman.Core diff --git a/Images.php b/Images.php index d66ea3d4..54984b97 100644 --- a/Images.php +++ b/Images.php @@ -154,7 +154,7 @@ class Pman_Core_Images extends Pman } $id = (int) $id; - print_r($id);exit; + // depreciated - should use ontable:onid:type here... if (!empty($_REQUEST['ontable'])) { @@ -181,7 +181,7 @@ class Pman_Core_Images extends Pman $img = DB_DataObjecT::factory('Images'); if (!$id || !$img->get($id)) { - $this->imgErr("image has been removed or deleted.",$s); + $this->imgErr("image has been removed or deleted.",$s); } if (!$this->authUser && !in_array($img->ontable,$this->public_image_tables)) { @@ -525,7 +525,6 @@ class Pman_Core_Images extends Pman function downloadEvent($bits) { - $popts = PEAR::getStaticProperty('Pman','options'); $ev = DB_DAtaObject::Factory('events'); if (!$ev->get($bits[1])) { die("could not find event id"); @@ -538,18 +537,23 @@ class Pman_Core_Images extends Pman $user = getenv('USERNAME'); // windows. } $ff = HTML_FlexyFramework::get(); - $file = $ff->Pman['event_log_dir']. '/'. $user. date('/Y/m/d/',strtotime($ev->event_when)). $ev->id . ".json"; + + $file = $ev->logDir() . date('/Y/m/d/',strtotime($ev->event_when)). $ev->id . ".json"; + + if(!$file || !file_exists($file)){ + die("file was not saved"); + } + $filesJ = json_decode(file_get_contents($file)); - //print_r($filesJ); - foreach($filesJ->FILES as $k=>$f){ if ($f->tmp_name != $bits[2]) { continue; } - $src = $ff->Pman['event_log_dir']. '/'. $user. date('/Y/m/d/', strtotime($ev->event_when)). $f->tmp_name ; - if (!file_exists($src)) { + $src = $file = $ev->logDir() . date('/Y/m/d/', strtotime($ev->event_when)). $f->tmp_name ; + + if (!$src || !file_exists($src)) { die("file was not saved"); } header ('Content-Type: ' . $f->type);