Ticket #222: view.patch
| File view.patch, 1.5 kB (added by armen, 14 months ago) |
|---|
-
system/config/view.php
1 <?php defined('SYSPATH') or die('No direct script access.'); 2 /* 3 * File: View 4 * 5 * Options: 6 * allowed_types 7 */ 8 $config = array 9 ( 10 'allowed_types' => array('gif', 'jpeg', 'css', 'js', 'tiff', 'tif', 'swf') 11 ); -
system/libraries/View.php
25 25 */ 26 26 public function __construct($name, $data = NULL) 27 27 { 28 if (preg_match('/\.(?:gif|jpe?g|png|css|js|tiff?|swf)$/Di', $name, $type)) 28 $type = substr(strrchr($name, '.'), 1); 29 30 if (in_array($type, Config::item('view.allowed_types'))) 29 31 { 30 $type = substr($type[0], 1);31 32 32 $this->kohana_filename = Kohana::find_file('views', $name, TRUE, $type); 33 33 $this->kohana_filetype = current(Config::item('mimes.'.$type)); 34 34 … … 37 37 } 38 38 else 39 39 { 40 $this->kohana_filename = Kohana::find_file('views', $name, TRUE );41 $this->kohana_filetype = EXT;40 $this->kohana_filename = Kohana::find_file('views', $name, TRUE, $type); 41 $this->kohana_filetype = ($type == FALSE) ? EXT : $type; 42 42 } 43 43 44 44 if (is_array($data) AND ! empty($data)) … … 178 178 return $output; 179 179 } 180 180 181 } // End View Class 182 No newline at end of file 181 } // End View Class
