| 1: | <?php | 
| 2: |  | 
| 3: |  | 
| 4: |  | 
| 5: |  | 
| 6: |  | 
| 7: |  | 
| 8: |  | 
| 9: |  | 
| 10: |  | 
| 11: |  | 
| 12: |  | 
| 13: |  | 
| 14: |  | 
| 15: |  | 
| 16: |  | 
| 17: |  | 
| 18: |  | 
| 19: |  | 
| 20: | class Smarty_Internal_Resource_Stream extends Smarty_Resource_Recompiled | 
| 21: | { | 
| 22: |  | 
| 23: |  | 
| 24: |  | 
| 25: |  | 
| 26: |  | 
| 27: |  | 
| 28: |  | 
| 29: |  | 
| 30: | public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) | 
| 31: | { | 
| 32: | if (strpos($source->resource, '://') !== false) { | 
| 33: | $source->filepath = $source->resource; | 
| 34: | } else { | 
| 35: | $source->filepath = str_replace(':', '://', $source->resource); | 
| 36: | } | 
| 37: | $source->uid = false; | 
| 38: | $source->content = $this->getContent($source); | 
| 39: | $source->timestamp = $source->exists = !!$source->content; | 
| 40: | } | 
| 41: |  | 
| 42: |  | 
| 43: |  | 
| 44: |  | 
| 45: |  | 
| 46: |  | 
| 47: |  | 
| 48: |  | 
| 49: | public function getContent(Smarty_Template_Source $source) | 
| 50: | { | 
| 51: | $t = ''; | 
| 52: |  | 
| 53: | $fp = fopen($source->filepath, 'r+'); | 
| 54: | if ($fp) { | 
| 55: | while (!feof($fp) && ($current_line = fgets($fp)) !== false) { | 
| 56: | $t .= $current_line; | 
| 57: | } | 
| 58: | fclose($fp); | 
| 59: | return $t; | 
| 60: | } else { | 
| 61: | return false; | 
| 62: | } | 
| 63: | } | 
| 64: |  | 
| 65: |  | 
| 66: |  | 
| 67: |  | 
| 68: |  | 
| 69: |  | 
| 70: |  | 
| 71: |  | 
| 72: |  | 
| 73: |  | 
| 74: | public function buildUniqueResourceName(Smarty $smarty, $resource_name, $isConfig = false) | 
| 75: | { | 
| 76: | return get_class($this) . '#' . $resource_name; | 
| 77: | } | 
| 78: | } | 
| 79: |  |