Dotclear

Changeset 1718:5bbbd8bb73fb for inc/core


Ignore:
Timestamp:
09/04/13 14:28:18 (12 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Children:
1719:b8c48f380463, 1720:f23f530dfb4a
Parents:
1717:9df047961e9c (diff), 1710:f6287a0366e3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge 2.5 branch into default

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • inc/core/class.dc.media.php

    r1708 r1718  
    516516     @param    post_id   <b>integer</b>      Post ID 
    517517     @param    media_id  <b>integer</b>      Optionnal media ID 
    518      @param    return_rs <b>boolean</b>      Whether to return a resultset (true) or an array (false, default value). 
    519      @return   <b>array</b> Array or ResultSet of fileItems 
    520      */ 
    521      public function getPostMedia($post_id,$media_id=null,$return_rs=false) 
     518     @return   <b>array</b> Array of fileItems 
     519     */ 
     520     public function getPostMedia($post_id,$media_id=null) 
    522521     { 
    523522          $params = array( 
     
    535534               $f = $this->fileRecord($rs); 
    536535               if ($f !== null) { 
    537                     $res[] = $return_rs ? new ArrayObject($f) : $f; 
    538                } 
    539           } 
    540            
    541           return $return_rs ? staticRecord::newFromArray($res) : $res; 
     536                    $res[] = $f; 
     537               } 
     538          } 
     539           
     540          return $res; 
    542541     } 
    543542      
  • inc/core/class.dc.media.php

    r1468 r1718  
    7474           
    7575          if (!is_dir($root)) { 
    76                throw new Exception(sprintf(__('Directory %s does not exist.'),$root)); 
     76               # Check public directory 
     77               if ( $core->auth->isSuperAdmin() ) { 
     78                    throw new Exception(__("There is no writable directory /public/ at the location set in about:config \"public_path\". You must create this directory with sufficient rights (or change this setting).")); 
     79               } else { 
     80                    throw new Exception(__("There is no writable root directory for the media manager. You should contact your administrator.")); 
     81               } 
    7782          } 
    7883           
     
    299304               $f->media_thumb = array(); 
    300305               $p = path::info($f->relname); 
     306 
    301307               $alpha = ($p['extension'] == 'png') || ($p['extension'] == 'PNG'); 
     308 
    302309               $thumb = sprintf(($alpha ? $this->thumb_tp_alpha : $this->thumb_tp),$this->root.'/'.$p['dirname'],$p['base'],'%s'); 
    303310               $thumb_url = sprintf(($alpha ? $this->thumb_tp_alpha : $this->thumb_tp),$this->root_url.$p['dirname'],$p['base'],'%s'); 
     
    306313               $thumb_url = preg_replace('#\./#','/',$thumb_url); 
    307314               $thumb_url = preg_replace('#(?<!:)/+#','/',$thumb_url); 
     315 
     316               if ($alpha) { 
     317                    $thumb_alt = sprintf($this->thumb_tp,$this->root.'/'.$p['dirname'],$p['base'],'%s'); 
     318                    $thumb_url_alt = sprintf($this->thumb_tp,$this->root_url.$p['dirname'],$p['base'],'%s'); 
     319                    # Cleaner URLs 
     320                    $thumb_url_alt = preg_replace('#\./#','/',$thumb_url_alt); 
     321                    $thumb_url_alt = preg_replace('#(?<!:)/+#','/',$thumb_url_alt); 
     322               } 
    308323                
    309324               foreach ($this->thumb_sizes as $suffix => $s) { 
    310325                    if (file_exists(sprintf($thumb,$suffix))) { 
    311326                         $f->media_thumb[$suffix] = sprintf($thumb_url,$suffix); 
     327                    } elseif ($alpha && file_exists(sprintf($thumb_alt,$suffix))) { 
     328                         $f->media_thumb[$suffix] = sprintf($thumb_url_alt,$suffix); 
    312329                    } 
    313330               } 
Note: See TracChangeset for help on using the changeset viewer.

Sites map