public static function setup() { // set path to logs self::$LOG_PATH = get_log_path(); // set max filesize of logs self::$LOG_FILESIZE = get_log_filesize(); // self::$error_handler = set_error_handler(); // set default error handling to screen to logs self::set_error_level(); }
function view_log($log_file) { $log_path = get_log_path(); // dont view files outside of logdir $file_exists = file_exists($log_path . $log_file); $file_outside = strpos(realpath($log_path . $log_file), $log_path) !== 0; // @TODO handle this better if (!$file_exists || $file_outside) { return; } $vars = (object) array('log_content' => file_get_contents($log_path . $log_file), 'log_file' => $log_file); echo render('admin/log_viewer.php', $vars); }