// tables that do not need authentication checks before serving.
var $public_image_tables = array();
+ var $is_email = false;
+
var $sizes = array(
'100',
'100x100',
// return $this->post();
//}
+ if(!empty($_REQUEST['is_email'])) {
+ $this->is_email = true;
+ }
+
$this->as_mimetype = empty($_REQUEST['as']) ? '' : $_REQUEST['as'];
$this->page = empty($_REQUEST['page']) ? false : (int) $_REQUEST['page'];
}
-
-
$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);
}
- print_R($this->authUser);exit;
+
if (!$this->authUser && !in_array($img->ontable,$this->public_image_tables)) {
+ if($this->is_email) {
+ return $this->serve($img);
+ }
+
if ($img->ontable != 'core_company') {
$this->imgErr("not-authenticated {$img->ontable}",$s);
}
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);
$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);
}
function downloadEvent($bits)
{
- $popts = PEAR::getStaticProperty('Pman','options');
$ev = DB_DAtaObject::Factory('events');
if (!$ev->get($bits[1])) {
die("could not find event id");
$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);