X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=Images.php;h=68cc36273600ee5f9ed3f4a5167066203c61ccff;hp=43348b1086ad3c24f361fdbdd819999cd702425f;hb=c711d090aa2e6f3dc7225ab3df62fd0f2a70217e;hpb=c387fb4aabb1bf1808dd302f42e4d72d9f28addf diff --git a/Images.php b/Images.php index 43348b10..68cc3627 100644 --- a/Images.php +++ b/Images.php @@ -176,8 +176,6 @@ class Pman_Core_Images extends Pman } - - $img = DB_DataObjecT::factory('Images'); if (!$id || !$img->get($id)) { @@ -196,15 +194,13 @@ class Pman_Core_Images extends Pman if ($comp->comptype != 'OWNER') { $this->imgErr("not-owner-company",$s); } + return $this->serve($img); - } - if(!$this->hasPermission($img)){ $this->imgErr("access to this image/file has been denied.",$s); - } $this->serve($img); @@ -278,7 +274,7 @@ class Pman_Core_Images extends Pman require_once 'File/Convert.php'; if (!file_exists($img->getStoreName())) { - print_r($img->getStoreName());exit; +// print_r($img);exit; header('Location: ' . $this->rootURL . '/Pman/templates/images/file-broken.png?reason=' . urlencode("Original file was missing : " . $img->getStoreName())); @@ -465,7 +461,8 @@ class Pman_Core_Images extends Pman $id = $umatch[2]; $hash = ''; if (!empty($umatch[3]) && strpos($umatch[3],'#')) { - $hash = '#'. array_pop(explode('#',$umatch[3])); + $hh = explode('#',$umatch[3]); + $hash = '#'. array_pop($hh); } @@ -525,7 +522,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 +534,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);