Mailer.php
[Pman.Core] / Images.php
index d1f1146..3a4b741 100644 (file)
@@ -44,6 +44,8 @@ class Pman_Core_Images extends Pman
     // tables that do not need authentication checks before serving.
     var $public_image_tables = array();
     
+    var $is_email = false;
+    
     var  $sizes = array(
                 '100', 
                 '100x100', 
@@ -83,6 +85,10 @@ class Pman_Core_Images extends Pman
         //   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'];
@@ -176,8 +182,6 @@ class Pman_Core_Images extends Pman
             
         }
         
-        
-       
         $img = DB_DataObjecT::factory('Images');
          
         if (!$id || !$img->get($id)) {
@@ -186,6 +190,10 @@ class Pman_Core_Images extends Pman
         
         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);
             }
@@ -196,15 +204,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);
@@ -465,7 +471,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);
         }
         
         
@@ -551,16 +558,8 @@ class Pman_Core_Images extends Pman
                 continue;
             }
 
-            $src = false;
+            $src = $file = $ev->logDir() . date('/Y/m/d/', strtotime($ev->event_when)).  $f->tmp_name ;
             
-            if (!empty($ff->Pman['storedir'])) {
-                $src = $ff->Pman['storedir']. '/Events/'. $user. date('/Y/m/d/', strtotime($ev->event_when)).  $f->tmp_name ;
-            }
-            // DEPRICATED... 
-            if (!empty($ff->Pman['event_log_dir'])) {
-                $src = $ff->Pman['event_log_dir']. '/'. $user. date('/Y/m/d/', strtotime($ev->event_when)).  $f->tmp_name ;
-            }
-
             if (!$src || !file_exists($src)) {
                 die("file was not saved");
             }