Changeset 1718:5bbbd8bb73fb for inc/core
- Timestamp:
- 09/04/13 14:28:18 (12 years ago)
- 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. - Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/core/class.dc.media.php
r1708 r1718 516 516 @param post_id <b>integer</b> Post ID 517 517 @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) 522 521 { 523 522 $params = array( … … 535 534 $f = $this->fileRecord($rs); 536 535 if ($f !== null) { 537 $res[] = $ return_rs ? new ArrayObject($f) : $f;538 } 539 } 540 541 return $re turn_rs ? staticRecord::newFromArray($res) : $res;536 $res[] = $f; 537 } 538 } 539 540 return $res; 542 541 } 543 542 -
inc/core/class.dc.media.php
r1468 r1718 74 74 75 75 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 } 77 82 } 78 83 … … 299 304 $f->media_thumb = array(); 300 305 $p = path::info($f->relname); 306 301 307 $alpha = ($p['extension'] == 'png') || ($p['extension'] == 'PNG'); 308 302 309 $thumb = sprintf(($alpha ? $this->thumb_tp_alpha : $this->thumb_tp),$this->root.'/'.$p['dirname'],$p['base'],'%s'); 303 310 $thumb_url = sprintf(($alpha ? $this->thumb_tp_alpha : $this->thumb_tp),$this->root_url.$p['dirname'],$p['base'],'%s'); … … 306 313 $thumb_url = preg_replace('#\./#','/',$thumb_url); 307 314 $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 } 308 323 309 324 foreach ($this->thumb_sizes as $suffix => $s) { 310 325 if (file_exists(sprintf($thumb,$suffix))) { 311 326 $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); 312 329 } 313 330 }
Note: See TracChangeset
for help on using the changeset viewer.