Changeset 876:83427286bd34 for inc/public
- Timestamp:
- 08/16/12 13:43:56 (13 years ago)
- Branch:
- sexy
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/public/lib.urlhandlers.php
r851 r876 518 518 $server->serve(); 519 519 } 520 521 public static function pluginInclude($args) 522 { 523 preg_match('#^([^/]+)/(.+)$#',$args,$m); 524 if (count($m) < 3) { 525 self::p404(); 526 exit; 527 } 528 $p = $m[1]; 529 $file = $m[2]; 530 $allow_types = array('png','jpg','jpeg','gif','css','js','swf'); 531 $pf = DC_PLUGINS_ROOT.'/'.path::clean($p.'/public/'.$file); 532 if (!$GLOBALS['core']->plugins->moduleExists($p) || 533 $pf === false || !is_file($pf) || !is_readable($pf)) { 534 self::p404(); 535 exit; 536 } 537 538 if (!in_array(files::getExtension($pf),$allow_types)) { 539 header('Content-Type: text/plain'); 540 http::head(404,'Not Found'); 541 exit; 542 } 543 544 http::$cache_max_age = 7200; 545 http::cache(array_merge(array($pf),get_included_files())); 546 547 header('Content-Type: '.files::getMimeType($pf)); 548 header('Content-Length: '.filesize($pf)); 549 readfile($pf); 550 exit; 551 552 } 520 553 } 521 554 ?>
Note: See TracChangeset
for help on using the changeset viewer.