function f_Misc_GetFile(&$Res, &$File, $LastFile = '', $IncludePath = false, $Contents = true) { // Load the content of a file into the text variable. $Res = ''; $fd = clsTinyButStrong::f_Misc_TryFile($File, false); if ($fd === false) { if (is_array($IncludePath)) { foreach ($IncludePath as $d) { $fd = clsTinyButStrong::f_Misc_TryFile($File, $d); if ($fd !== false) { break; } } } if ($fd === false && $LastFile != '') { $fd = clsTinyButStrong::f_Misc_TryFile($File, dirname($LastFile)); } if ($fd === false) { return false; } } $fs = fstat($fd); if ($Contents) { // Return contents if (isset($fs['size'])) { if ($fs['size'] > 0) { $Res = fread($fd, $fs['size']); } } else { while (!feof($fd)) { $Res .= fread($fd, 4096); } } } else { // Return stats $Res = $fs; } fclose($fd); return true; }