mirror of
https://github.com/moodle/moodle.git
synced 2025-04-25 10:26:17 +02:00
Removed files/mimetype.php and put it into lib/filelib.php instead
where it always should have been.
This commit is contained in:
parent
4aaaf2091e
commit
f1e0649c1c
@ -7,8 +7,8 @@
|
||||
// Must define: USER, basedir, baseweb, html_header and html_footer
|
||||
// USER is a persistent variable using sessions
|
||||
|
||||
require("../config.php");
|
||||
require("mimetypes.php");
|
||||
require('../config.php');
|
||||
require($CFG->libdir.'/filelib.php');
|
||||
|
||||
$id = required_param('id', PARAM_INT);
|
||||
$file = optional_param('file', '', PARAM_PATH);
|
||||
|
@ -1,162 +0,0 @@
|
||||
<?php // $Id$
|
||||
|
||||
function mimeinfo($element, $filename) {
|
||||
$mimeinfo = array (
|
||||
"xxx" => array ("type"=>"document/unknown", "icon"=>"unknown.gif"),
|
||||
"3gp" => array ("type"=>"video/quicktime", "icon"=>"video.gif"),
|
||||
"ai" => array ("type"=>"application/postscript", "icon"=>"image.gif"),
|
||||
"aif" => array ("type"=>"audio/x-aiff", "icon"=>"audio.gif"),
|
||||
"aiff" => array ("type"=>"audio/x-aiff", "icon"=>"audio.gif"),
|
||||
"aifc" => array ("type"=>"audio/x-aiff", "icon"=>"audio.gif"),
|
||||
"applescript" => array ("type"=>"text/plain", "icon"=>"text.gif"),
|
||||
"asc" => array ("type"=>"text/plain", "icon"=>"text.gif"),
|
||||
"au" => array ("type"=>"audio/au", "icon"=>"audio.gif"),
|
||||
"avi" => array ("type"=>"video/x-ms-wm", "icon"=>"avi.gif"),
|
||||
"bmp" => array ("type"=>"image/bmp", "icon"=>"image.gif"),
|
||||
"cs" => array ("type"=>"application/x-csh", "icon"=>"text.gif"),
|
||||
"css" => array ("type"=>"text/css", "icon"=>"text.gif"),
|
||||
"dv" => array ("type"=>"video/x-dv", "icon"=>"video.gif"),
|
||||
"doc" => array ("type"=>"application/msword", "icon"=>"word.gif"),
|
||||
"dif" => array ("type"=>"video/x-dv", "icon"=>"video.gif"),
|
||||
"eps" => array ("type"=>"application/postscript", "icon"=>"pdf.gif"),
|
||||
"gif" => array ("type"=>"image/gif", "icon"=>"image.gif"),
|
||||
"gtar" => array ("type"=>"application/x-gtar", "icon"=>"zip.gif"),
|
||||
"gz" => array ("type"=>"application/g-zip", "icon"=>"zip.gif"),
|
||||
"gzip" => array ("type"=>"application/g-zip", "icon"=>"zip.gif"),
|
||||
"h" => array ("type"=>"text/plain", "icon"=>"text.gif"),
|
||||
"hqx" => array ("type"=>"application/mac-binhex40", "icon"=>"zip.gif"),
|
||||
"html" => array ("type"=>"text/html", "icon"=>"html.gif"),
|
||||
"htm" => array ("type"=>"text/html", "icon"=>"html.gif"),
|
||||
"jpe" => array ("type"=>"image/jpeg", "icon"=>"image.gif"),
|
||||
"jpeg" => array ("type"=>"image/jpeg", "icon"=>"image.gif"),
|
||||
"jpg" => array ("type"=>"image/jpeg", "icon"=>"image.gif"),
|
||||
"js" => array ("type"=>"application/x-javascript", "icon"=>"text.gif"),
|
||||
"latex"=> array ("type"=>"application/x-latex", "icon"=>"text.gif"),
|
||||
"m" => array ("type"=>"text/plain", "icon"=>"text.gif"),
|
||||
"mov" => array ("type"=>"video/quicktime", "icon"=>"video.gif"),
|
||||
"movie"=> array ("type"=>"video/x-sgi-movie", "icon"=>"video.gif"),
|
||||
"m3u" => array ("type"=>"audio/x-mpegurl", "icon"=>"audio.gif"),
|
||||
"mp3" => array ("type"=>"audio/mp3", "icon"=>"audio.gif"),
|
||||
"mp4" => array ("type"=>"video/mp4", "icon"=>"video.gif"),
|
||||
"mpeg" => array ("type"=>"video/mpeg", "icon"=>"video.gif"),
|
||||
"mpe" => array ("type"=>"video/mpeg", "icon"=>"video.gif"),
|
||||
"mpg" => array ("type"=>"video/mpeg", "icon"=>"video.gif"),
|
||||
"pct" => array ("type"=>"image/pict", "icon"=>"image.gif"),
|
||||
"pdf" => array ("type"=>"application/pdf", "icon"=>"pdf.gif"),
|
||||
"php" => array ("type"=>"text/plain", "icon"=>"text.gif"),
|
||||
"pic" => array ("type"=>"image/pict", "icon"=>"image.gif"),
|
||||
"pict" => array ("type"=>"image/pict", "icon"=>"image.gif"),
|
||||
"png" => array ("type"=>"image/png", "icon"=>"image.gif"),
|
||||
"pps" => array ("type"=>"application/vnd.ms-powerpoint", "icon"=>"powerpoint.gif"),
|
||||
"ppt" => array ("type"=>"application/vnd.ms-powerpoint", "icon"=>"powerpoint.gif"),
|
||||
"ps" => array ("type"=>"application/postscript", "icon"=>"pdf.gif"),
|
||||
"qt" => array ("type"=>"video/quicktime", "icon"=>"video.gif"),
|
||||
"ra" => array ("type"=>"audio/x-realaudio", "icon"=>"audio.gif"),
|
||||
"ram" => array ("type"=>"audio/x-pn-realaudio", "icon"=>"audio.gif"),
|
||||
"rm" => array ("type"=>"audio/x-pn-realaudio", "icon"=>"audio.gif"),
|
||||
"rtf" => array ("type"=>"text/rtf", "icon"=>"text.gif"),
|
||||
"rtx" => array ("type"=>"text/richtext", "icon"=>"text.gif"),
|
||||
"sh" => array ("type"=>"application/x-sh", "icon"=>"text.gif"),
|
||||
"sit" => array ("type"=>"application/x-stuffit", "icon"=>"zip.gif"),
|
||||
"smi" => array ("type"=>"application/smil", "icon"=>"text.gif"),
|
||||
"smil" => array ("type"=>"application/smil", "icon"=>"text.gif"),
|
||||
"swf" => array ("type"=>"application/x-shockwave-flash", "icon"=>"flash.gif"),
|
||||
"tar" => array ("type"=>"application/x-tar", "icon"=>"zip.gif"),
|
||||
"tif" => array ("type"=>"image/tiff", "icon"=>"image.gif"),
|
||||
"tiff" => array ("type"=>"image/tiff", "icon"=>"image.gif"),
|
||||
"tex" => array ("type"=>"application/x-tex", "icon"=>"text.gif"),
|
||||
"texi" => array ("type"=>"application/x-texinfo", "icon"=>"text.gif"),
|
||||
"texinfo" => array ("type"=>"application/x-texinfo", "icon"=>"text.gif"),
|
||||
"tsv" => array ("type"=>"text/tab-separated-values", "icon"=>"text.gif"),
|
||||
"txt" => array ("type"=>"text/plain", "icon"=>"text.gif"),
|
||||
"wav" => array ("type"=>"audio/wav", "icon"=>"audio.gif"),
|
||||
"wmv" => array ("type"=>"video/x-ms-wmv", "icon"=>"avi.gif"),
|
||||
"asf" => array ("type"=>"video/x-ms-asf", "icon"=>"avi.gif"),
|
||||
"xls" => array ("type"=>"application/vnd.ms-excel", "icon"=>"excel.gif"),
|
||||
"xml" => array ("type"=>"application/xml", "icon"=>"xml.gif"),
|
||||
"xsl" => array ("type"=>"text/xml", "icon"=>"xml.gif"),
|
||||
"zip" => array ("type"=>"application/zip", "icon"=>"zip.gif")
|
||||
);
|
||||
|
||||
if (eregi("\.([a-z0-9]+)$", $filename, $match)) {
|
||||
if (isset($mimeinfo[strtolower($match[1])][$element])) {
|
||||
return $mimeinfo[strtolower($match[1])][$element];
|
||||
} else {
|
||||
return $mimeinfo["xxx"][$element]; // By default
|
||||
}
|
||||
} else {
|
||||
return $mimeinfo["xxx"][$element]; // By default
|
||||
}
|
||||
}
|
||||
|
||||
function send_file($path, $filename, $lifetime=86400 , $filter=false, $pathisstring=false) {
|
||||
|
||||
$mimetype = mimeinfo('type', $filename);
|
||||
$lastmodified = $pathisstring ? time() : filemtime($path);
|
||||
$filesize = $pathisstring ? strlen($path) : filesize($path);
|
||||
|
||||
@header('Last-Modified: '. gmdate("D, d M Y H:i:s", $lastmodified) .' GMT');
|
||||
if ($lifetime > 0) {
|
||||
@header('Cache-control: max-age='.$lifetime);
|
||||
@header('Expires: '. gmdate("D, d M Y H:i:s", time() + $lifetime) .'GMT');
|
||||
@header('Pragma: ');
|
||||
} else {
|
||||
// this part is tricky, displaying of MS Office documents in IE needs
|
||||
// to store the file on disk, but no-cache may prevent it
|
||||
@header('Cache-Control: private, must-revalidate, pre-check=0, post-check=0, max-age=10');
|
||||
@header('Expires: '. gmdate("D, d M Y H:i:s", 0) .'GMT');
|
||||
@header('Pragma: no-cache');
|
||||
}
|
||||
@header('Accept-Ranges: none'); // PDF compatibility
|
||||
@header('Content-disposition: inline; filename='.$filename);
|
||||
|
||||
if (!$filter) {
|
||||
@header('Content-length: '.$filesize);
|
||||
if ($mimetype == 'text/plain') {
|
||||
@header('Content-type: text/plain; charset='.get_string('thischarset')); //add encoding
|
||||
} else {
|
||||
@header('Content-type: '.$mimetype);
|
||||
}
|
||||
if ($pathisstring) {
|
||||
echo $path;
|
||||
}else {
|
||||
readfile($path);
|
||||
}
|
||||
} else { // Try to put the file through filters
|
||||
global $course;
|
||||
if (!empty($course->id)) {
|
||||
$courseid = $course->id;
|
||||
} else {
|
||||
$courseid = SITEID;
|
||||
}
|
||||
if ($mimetype == 'text/html') {
|
||||
$options->noclean = true;
|
||||
$text = $pathisstring ? $path : implode('', file($path));
|
||||
$output = format_text($text, FORMAT_HTML, $options, $courseid);
|
||||
|
||||
@header('Content-length: '.strlen($output));
|
||||
@header('Content-type: text/html');
|
||||
echo $output;
|
||||
} else if ($mimetype == 'text/plain') {
|
||||
$options->newlines = false;
|
||||
$options->noclean = true;
|
||||
$text = htmlentities($pathisstring ? $path : implode('', file($path)));
|
||||
$output = '<pre>'. format_text($text, FORMAT_MOODLE, $options, $courseid) .'</pre>';
|
||||
|
||||
@header('Content-length: '.strlen($output));
|
||||
@header('Content-type: text/html; charset='. get_string('thischarset')); //add encoding
|
||||
echo $output;
|
||||
} else { // Just send it out raw
|
||||
@header('Content-length: '.$filesize);
|
||||
@header('Content-type: '.$mimetype);
|
||||
if ($pathisstring) {
|
||||
echo $path;
|
||||
}else {
|
||||
readfile($path);
|
||||
}
|
||||
}
|
||||
}
|
||||
die; //no more chars to output!!!
|
||||
}
|
||||
|
||||
?>
|
@ -6,7 +6,7 @@
|
||||
$nomoodlecookie = true; // Because it interferes with caching
|
||||
|
||||
require_once('../../config.php');
|
||||
require_once('../../files/mimetypes.php');
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
|
||||
$CFG->texfilterdir = 'filter/tex';
|
||||
$CFG->algebrafilterdir = 'filter/algebra';
|
||||
|
@ -6,7 +6,7 @@
|
||||
$nomoodlecookie = true; // Because it interferes with caching
|
||||
|
||||
require_once('../../config.php');
|
||||
require_once('../../files/mimetypes.php');
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
|
||||
$CFG->texfilterdir = 'filter/tex';
|
||||
$CFG->teximagedir = 'filter/tex';
|
||||
|
@ -12,7 +12,7 @@
|
||||
// USER is a persistent variable using sessions
|
||||
|
||||
require("../../config.php");
|
||||
require("../../files/mimetypes.php");
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
|
||||
$id = required_param('id', PARAM_INT);
|
||||
$file = optional_param('file', '', PARAM_PATH);
|
||||
|
159
lib/filelib.php
159
lib/filelib.php
@ -1,5 +1,164 @@
|
||||
<?php //$Id$
|
||||
|
||||
function mimeinfo($element, $filename) {
|
||||
$mimeinfo = array (
|
||||
"xxx" => array ("type"=>"document/unknown", "icon"=>"unknown.gif"),
|
||||
"3gp" => array ("type"=>"video/quicktime", "icon"=>"video.gif"),
|
||||
"ai" => array ("type"=>"application/postscript", "icon"=>"image.gif"),
|
||||
"aif" => array ("type"=>"audio/x-aiff", "icon"=>"audio.gif"),
|
||||
"aiff" => array ("type"=>"audio/x-aiff", "icon"=>"audio.gif"),
|
||||
"aifc" => array ("type"=>"audio/x-aiff", "icon"=>"audio.gif"),
|
||||
"applescript" => array ("type"=>"text/plain", "icon"=>"text.gif"),
|
||||
"asc" => array ("type"=>"text/plain", "icon"=>"text.gif"),
|
||||
"au" => array ("type"=>"audio/au", "icon"=>"audio.gif"),
|
||||
"avi" => array ("type"=>"video/x-ms-wm", "icon"=>"avi.gif"),
|
||||
"bmp" => array ("type"=>"image/bmp", "icon"=>"image.gif"),
|
||||
"cs" => array ("type"=>"application/x-csh", "icon"=>"text.gif"),
|
||||
"css" => array ("type"=>"text/css", "icon"=>"text.gif"),
|
||||
"dv" => array ("type"=>"video/x-dv", "icon"=>"video.gif"),
|
||||
"doc" => array ("type"=>"application/msword", "icon"=>"word.gif"),
|
||||
"dif" => array ("type"=>"video/x-dv", "icon"=>"video.gif"),
|
||||
"eps" => array ("type"=>"application/postscript", "icon"=>"pdf.gif"),
|
||||
"gif" => array ("type"=>"image/gif", "icon"=>"image.gif"),
|
||||
"gtar" => array ("type"=>"application/x-gtar", "icon"=>"zip.gif"),
|
||||
"gz" => array ("type"=>"application/g-zip", "icon"=>"zip.gif"),
|
||||
"gzip" => array ("type"=>"application/g-zip", "icon"=>"zip.gif"),
|
||||
"h" => array ("type"=>"text/plain", "icon"=>"text.gif"),
|
||||
"hqx" => array ("type"=>"application/mac-binhex40", "icon"=>"zip.gif"),
|
||||
"html" => array ("type"=>"text/html", "icon"=>"html.gif"),
|
||||
"htm" => array ("type"=>"text/html", "icon"=>"html.gif"),
|
||||
"jpe" => array ("type"=>"image/jpeg", "icon"=>"image.gif"),
|
||||
"jpeg" => array ("type"=>"image/jpeg", "icon"=>"image.gif"),
|
||||
"jpg" => array ("type"=>"image/jpeg", "icon"=>"image.gif"),
|
||||
"js" => array ("type"=>"application/x-javascript", "icon"=>"text.gif"),
|
||||
"latex"=> array ("type"=>"application/x-latex", "icon"=>"text.gif"),
|
||||
"m" => array ("type"=>"text/plain", "icon"=>"text.gif"),
|
||||
"mov" => array ("type"=>"video/quicktime", "icon"=>"video.gif"),
|
||||
"movie"=> array ("type"=>"video/x-sgi-movie", "icon"=>"video.gif"),
|
||||
"m3u" => array ("type"=>"audio/x-mpegurl", "icon"=>"audio.gif"),
|
||||
"mp3" => array ("type"=>"audio/mp3", "icon"=>"audio.gif"),
|
||||
"mp4" => array ("type"=>"video/mp4", "icon"=>"video.gif"),
|
||||
"mpeg" => array ("type"=>"video/mpeg", "icon"=>"video.gif"),
|
||||
"mpe" => array ("type"=>"video/mpeg", "icon"=>"video.gif"),
|
||||
"mpg" => array ("type"=>"video/mpeg", "icon"=>"video.gif"),
|
||||
"pct" => array ("type"=>"image/pict", "icon"=>"image.gif"),
|
||||
"pdf" => array ("type"=>"application/pdf", "icon"=>"pdf.gif"),
|
||||
"php" => array ("type"=>"text/plain", "icon"=>"text.gif"),
|
||||
"pic" => array ("type"=>"image/pict", "icon"=>"image.gif"),
|
||||
"pict" => array ("type"=>"image/pict", "icon"=>"image.gif"),
|
||||
"png" => array ("type"=>"image/png", "icon"=>"image.gif"),
|
||||
"pps" => array ("type"=>"application/vnd.ms-powerpoint", "icon"=>"powerpoint.gif"),
|
||||
"ppt" => array ("type"=>"application/vnd.ms-powerpoint", "icon"=>"powerpoint.gif"),
|
||||
"ps" => array ("type"=>"application/postscript", "icon"=>"pdf.gif"),
|
||||
"qt" => array ("type"=>"video/quicktime", "icon"=>"video.gif"),
|
||||
"ra" => array ("type"=>"audio/x-realaudio", "icon"=>"audio.gif"),
|
||||
"ram" => array ("type"=>"audio/x-pn-realaudio", "icon"=>"audio.gif"),
|
||||
"rm" => array ("type"=>"audio/x-pn-realaudio", "icon"=>"audio.gif"),
|
||||
"rtf" => array ("type"=>"text/rtf", "icon"=>"text.gif"),
|
||||
"rtx" => array ("type"=>"text/richtext", "icon"=>"text.gif"),
|
||||
"sh" => array ("type"=>"application/x-sh", "icon"=>"text.gif"),
|
||||
"sit" => array ("type"=>"application/x-stuffit", "icon"=>"zip.gif"),
|
||||
"smi" => array ("type"=>"application/smil", "icon"=>"text.gif"),
|
||||
"smil" => array ("type"=>"application/smil", "icon"=>"text.gif"),
|
||||
"swf" => array ("type"=>"application/x-shockwave-flash", "icon"=>"flash.gif"),
|
||||
"tar" => array ("type"=>"application/x-tar", "icon"=>"zip.gif"),
|
||||
"tif" => array ("type"=>"image/tiff", "icon"=>"image.gif"),
|
||||
"tiff" => array ("type"=>"image/tiff", "icon"=>"image.gif"),
|
||||
"tex" => array ("type"=>"application/x-tex", "icon"=>"text.gif"),
|
||||
"texi" => array ("type"=>"application/x-texinfo", "icon"=>"text.gif"),
|
||||
"texinfo" => array ("type"=>"application/x-texinfo", "icon"=>"text.gif"),
|
||||
"tsv" => array ("type"=>"text/tab-separated-values", "icon"=>"text.gif"),
|
||||
"txt" => array ("type"=>"text/plain", "icon"=>"text.gif"),
|
||||
"wav" => array ("type"=>"audio/wav", "icon"=>"audio.gif"),
|
||||
"wmv" => array ("type"=>"video/x-ms-wmv", "icon"=>"avi.gif"),
|
||||
"asf" => array ("type"=>"video/x-ms-asf", "icon"=>"avi.gif"),
|
||||
"xls" => array ("type"=>"application/vnd.ms-excel", "icon"=>"excel.gif"),
|
||||
"xml" => array ("type"=>"application/xml", "icon"=>"xml.gif"),
|
||||
"xsl" => array ("type"=>"text/xml", "icon"=>"xml.gif"),
|
||||
"zip" => array ("type"=>"application/zip", "icon"=>"zip.gif")
|
||||
);
|
||||
|
||||
if (eregi("\.([a-z0-9]+)$", $filename, $match)) {
|
||||
if (isset($mimeinfo[strtolower($match[1])][$element])) {
|
||||
return $mimeinfo[strtolower($match[1])][$element];
|
||||
} else {
|
||||
return $mimeinfo["xxx"][$element]; // By default
|
||||
}
|
||||
} else {
|
||||
return $mimeinfo["xxx"][$element]; // By default
|
||||
}
|
||||
}
|
||||
|
||||
function send_file($path, $filename, $lifetime=86400 , $filter=false, $pathisstring=false) {
|
||||
|
||||
$mimetype = mimeinfo('type', $filename);
|
||||
$lastmodified = $pathisstring ? time() : filemtime($path);
|
||||
$filesize = $pathisstring ? strlen($path) : filesize($path);
|
||||
|
||||
@header('Last-Modified: '. gmdate("D, d M Y H:i:s", $lastmodified) .' GMT');
|
||||
if ($lifetime > 0) {
|
||||
@header('Cache-control: max-age='.$lifetime);
|
||||
@header('Expires: '. gmdate("D, d M Y H:i:s", time() + $lifetime) .'GMT');
|
||||
@header('Pragma: ');
|
||||
} else {
|
||||
// this part is tricky, displaying of MS Office documents in IE needs
|
||||
// to store the file on disk, but no-cache may prevent it
|
||||
@header('Cache-Control: private, must-revalidate, pre-check=0, post-check=0, max-age=10');
|
||||
@header('Expires: '. gmdate("D, d M Y H:i:s", 0) .'GMT');
|
||||
@header('Pragma: no-cache');
|
||||
}
|
||||
@header('Accept-Ranges: none'); // PDF compatibility
|
||||
@header('Content-disposition: inline; filename='.$filename);
|
||||
|
||||
if (!$filter) {
|
||||
@header('Content-length: '.$filesize);
|
||||
if ($mimetype == 'text/plain') {
|
||||
@header('Content-type: text/plain; charset='.get_string('thischarset')); //add encoding
|
||||
} else {
|
||||
@header('Content-type: '.$mimetype);
|
||||
}
|
||||
if ($pathisstring) {
|
||||
echo $path;
|
||||
}else {
|
||||
readfile($path);
|
||||
}
|
||||
} else { // Try to put the file through filters
|
||||
global $course;
|
||||
if (!empty($course->id)) {
|
||||
$courseid = $course->id;
|
||||
} else {
|
||||
$courseid = SITEID;
|
||||
}
|
||||
if ($mimetype == 'text/html') {
|
||||
$options->noclean = true;
|
||||
$text = $pathisstring ? $path : implode('', file($path));
|
||||
$output = format_text($text, FORMAT_HTML, $options, $courseid);
|
||||
|
||||
@header('Content-length: '.strlen($output));
|
||||
@header('Content-type: text/html');
|
||||
echo $output;
|
||||
} else if ($mimetype == 'text/plain') {
|
||||
$options->newlines = false;
|
||||
$options->noclean = true;
|
||||
$text = htmlentities($pathisstring ? $path : implode('', file($path)));
|
||||
$output = '<pre>'. format_text($text, FORMAT_MOODLE, $options, $courseid) .'</pre>';
|
||||
|
||||
@header('Content-length: '.strlen($output));
|
||||
@header('Content-type: text/html; charset='. get_string('thischarset')); //add encoding
|
||||
echo $output;
|
||||
} else { // Just send it out raw
|
||||
@header('Content-length: '.$filesize);
|
||||
@header('Content-type: '.$mimetype);
|
||||
if ($pathisstring) {
|
||||
echo $path;
|
||||
}else {
|
||||
readfile($path);
|
||||
}
|
||||
}
|
||||
}
|
||||
die; //no more chars to output!!!
|
||||
}
|
||||
|
||||
function get_records_csv($file, $table) {
|
||||
global $CFG, $db;
|
||||
|
||||
|
@ -3151,7 +3151,7 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml='', $a
|
||||
$mail->AddAddress($adminuser->email, fullname($adminuser) );
|
||||
$mail->AddStringAttachment('Error in attachment. User attempted to attach a filename with a unsafe name.', 'error.txt', '8bit', 'text/plain');
|
||||
} else {
|
||||
include_once($CFG->dirroot .'/files/mimetypes.php');
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
$mimetype = mimeinfo('type', $attachname);
|
||||
$mail->AddAttachment($CFG->dataroot .'/'. $attachment, $attachname, 'base64', $mimetype);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php // $Id$
|
||||
|
||||
require_once("$CFG->dirroot/files/mimetypes.php");
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
|
||||
define("OFFLINE", "0");
|
||||
define("UPLOADSINGLE", "1");
|
||||
|
@ -3,7 +3,7 @@
|
||||
// exercise constants and standard moodle functions plus those functions called directly
|
||||
// see locallib.php for other non-standard exercise functions
|
||||
|
||||
include_once("$CFG->dirroot/files/mimetypes.php");
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
|
||||
/*** Constants **********************************/
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php // $Id$
|
||||
|
||||
require_once($CFG->dirroot.'/files/mimetypes.php');
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
|
||||
/// CONSTANTS ///////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
/// Library of functions and constants for module glossary
|
||||
/// (replace glossary with the name of your module and delete this line)
|
||||
|
||||
require_once("$CFG->dirroot/files/mimetypes.php");
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
|
||||
define("GLOSSARY_SHOW_ALL_CATEGORIES", 0);
|
||||
define("GLOSSARY_SHOW_NOT_CATEGORISED", -1);
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once("locallib.php");
|
||||
require_once("../../files/mimetypes.php");
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
|
||||
$id = optional_param('id'); // question id
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
// It is supposed to be used by the quiz module only
|
||||
|
||||
require_once('../../config.php');
|
||||
require_once('../../files/mimetypes.php');
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
require_once('locallib.php');
|
||||
|
||||
if (empty($CFG->filelifetime)) {
|
||||
|
@ -366,7 +366,7 @@ function resource_get_coursemodule_info($coursemodule) {
|
||||
"','resource$resource->id','$resource->popup');\"");
|
||||
}
|
||||
|
||||
require_once("$CFG->dirroot/files/mimetypes.php");
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
|
||||
if ($resource->type == 'file') {
|
||||
$icon = mimeinfo("icon", $resource->reference);
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// see also locallib.php for other non-standard workshop functions
|
||||
|
||||
include_once("$CFG->dirroot/files/mimetypes.php");
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
|
||||
/*** Constants **********************************/
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user