Changeset 1014

Show
Ignore:
Timestamp:
04/26/08 13:28:23 (7 months ago)
Author:
_ck_
Message:

0.0.7 one more mime option for windows/no-shell-access users

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • bb-attachments/trunk/bb-attachments.php

    r996 r1014  
    66Author: _ck_ 
    77Author URI: http://bbShowcase.org 
    8 Version: 0.0.6 
     8Version: 0.0.7 
    99 
    1010License: CC-GNU-GPL http://creativecommons.org/licenses/GPL/2.0/ 
     
    241241                                         
    242242                                        $file=$dir."/".$id.".".$filename;                                        
     243                                         
     244                                        // file is commited here 
    243245                                                                 
    244                                         if (!$failed && $id>0 && @copy($_FILES['bb_attachments']['tmp_name'][$key], $file)) {          // file is commited here 
     246                                        if (!$failed && $id>0 && @is_uploaded_file($_FILES['bb_attachments']['tmp_name'][$key]) && @move_uploaded_file($_FILES['bb_attachments']['tmp_name'][$key], $file)) {     
    245247                                                chmod("$file",0777);                                             
    246248                                                $count++; $offset++;            // count how many successfully uploaded this time                                                        
    247249                                        } else {                         
    248                                                 $status=2;      // failed - not necessarily user's fault                                               
     250                                                $status=2;      // failed - not necessarily user's fault, could be filesystem  
    249251                                        } 
    250252                                         
     
    409411} 
    410412 
    411 if ( ! function_exists ( 'mime_content_type' ) ) {      // most newer PHP doesn't have this, so try shell  ? 
    412         function mime_content_type ( $f )  {return trim (@exec ('file -bi ' . escapeshellarg ( $f ) ) ) ;} 
     413if ( ! function_exists ( 'mime_content_type' ) ) {      // most newer PHP doesn't have this 
     414 
     415if (function_exists('finfo_open') && function_exists('finfo_file')) {   // try finfo 
     416 
     417        function mime_content_type( $f )  {$finfo=finfo_open(FILEINFO_MIME); return trim(finfo_file($finfo, $f));} 
     418 
     419} else {                //  so try shell  ?  - will fail on windows 100% of the time 
     420 
     421        function mime_content_type( $f )  {return trim (@exec ('file -bi ' . escapeshellarg ( $f ) ) ) ;} 
     422}        
    413423} 
    414424 
  • bb-attachments/trunk/readme.txt

    r996 r1014  
    4848* 0.0.5 first public beta release for review 
    4949* 0.0.6 advanced restrictions by file type & user role, upload form displays allowed file types 
     50* 0.0.7 one more mime option for windows/no-shell-access users 
    5051         
    5152== To Do ==