Example #1
0
 function debug_find_source($mode = '')
 {
     foreach (debug_backtrace() as $trace) {
         if ($trace['file'] !== __FILE__) {
             switch ($mode) {
                 case 'file':
                     return $trace['file'];
                 case 'line':
                     return $trace['line'];
                 default:
                     return hide_bb_path($trace['file']) . '(' . $trace['line'] . ')';
             }
         }
     }
     return 'src not found';
 }
Example #2
0
 /**
  * Assigns template filename for handle.
  */
 function set_filename($handle, $filename, $xs_include = false, $quiet = false)
 {
     $can_cache = $this->use_cache;
     $this->files[$handle] = $this->make_filename($filename, $xs_include);
     $this->files_cache[$handle] = '';
     $this->files_cache2[$handle] = '';
     // checking if we have valid filename
     if (!$this->files[$handle]) {
         if ($xs_include || $quiet) {
             return false;
         } else {
             die("Template->make_filename(): Error - invalid template {$filename}");
         }
     }
     // creating cache filename
     if ($can_cache) {
         $this->files_cache2[$handle] = $this->make_filename_cache($this->files[$handle]);
         if (@file_exists($this->files_cache2[$handle])) {
             $this->files_cache[$handle] = $this->files_cache2[$handle];
         }
     }
     // checking if tpl and/or php file exists
     if (empty($this->files_cache[$handle]) && !@file_exists($this->files[$handle])) {
         if ($quiet) {
             return false;
         }
         die('Template->make_filename(): Error - template file not found: <br /><br />' . hide_bb_path($this->files[$handle]));
     }
     // checking if we should recompile cache
     if (!empty($this->files_cache[$handle])) {
         $cache_time = @filemtime($this->files_cache[$handle]);
         if (@filemtime($this->files[$handle]) > $cache_time) {
             // file was changed. don't use cache file (will be recompled if configuration allowes it)
             $this->files_cache[$handle] = '';
         }
     }
     return true;
 }