Changeset 18030

Show
Ignore:
Timestamp:
10/08/08 10:46:04 (2 months ago)
Author:
bergie
Message:

Proper attachment read handlers, fixes #336 and #335

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midcom/midcom.core/midcom/baseclasses/database/attachment.php

    r17900 r18030  
    151151 
    152152                /* WARNING, read mode not supported by midgard_blob! */ 
    153                 /* FIXME */ 
    154                 if (!function_exists('mgd_open_attachment')) 
    155                 { 
    156                     // Legacy API disabled, use the modern method 
    157                     $handle = MidgardAttachment::open($this->id, $mode); 
    158                     break; 
    159                 } 
    160  
    161                 $handle = mgd_open_attachment($this->id, $mode); 
     153                try  
     154                { 
     155                    $att_obj = new midgard_attachment($this->id); 
     156                } 
     157                catch(midgard_error_exception $e)  
     158                { 
     159                    /* FIXME, throw error */ 
     160                } 
     161 
     162                $blob = new midgard_blob($att_obj); 
     163 
     164                if(!$blob) 
     165                { 
     166                    /* FIXME, throw error */ 
     167                } 
     168 
     169                $handle = fopen($blob->get_path(), 'r'); 
    162170                break; 
    163171 
  • trunk/midcom/org.routamc.photostream/photo.php

    r18004 r18030  
    323323     
    324324        $blob = new midgard_blob($att_obj); 
    325         $src = $blob->get_handler(); 
     325        $src = fread($blob->get_path(), 'r'); 
    326326 
    327327        if (!$src)