33 lines
739 B
PHP
33 lines
739 B
PHP
|
<?php
|
||
|
require_once("../../config.php");
|
||
|
|
||
|
require_once($CFG->libdir.'/weblib.php');
|
||
|
|
||
|
$systemcontext = context_system::instance();
|
||
|
|
||
|
$PAGE->set_url("/local/treestudyplan/doc.php",array());
|
||
|
$PAGE->set_pagelayout('base');
|
||
|
$PAGE->set_context($systemcontext);
|
||
|
require_login();
|
||
|
|
||
|
$pi = $_SERVER['PATH_INFO'];
|
||
|
$file = $CFG->dirroot."/local/treestudyplan/doc".$pi;
|
||
|
|
||
|
// Fallback to index
|
||
|
if(!file_exists($file)){
|
||
|
$file = $CFG->dirroot."/local/treestudyplan/doc/index.htm";
|
||
|
}
|
||
|
|
||
|
$mime = mime_content_type($file);
|
||
|
$text_types = ["text/html","text/plain"];
|
||
|
|
||
|
if( in_array($mime,$text_types))
|
||
|
{
|
||
|
print $OUTPUT->header();
|
||
|
print file_get_contents($file);
|
||
|
print $OUTPUT->footer();
|
||
|
}
|
||
|
else {
|
||
|
header("Content-type: {$mime}");
|
||
|
print file_get_contents($file);
|
||
|
}
|