Added an option on the filters page to control whether uploaded

files are parsed by filters.    bug 1128
This commit is contained in:
moodler
2004-03-11 02:14:15 +00:00
parent d64f6001e6
commit 3cf4ab978b
6 changed files with 38 additions and 12 deletions
+15
View File
@@ -113,6 +113,21 @@
<?php p($strconfigcachetext) ?>
</td>
</tr>
<tr valign=top>
<td nowrap="nowrap" align="right"><?php p($strfilteruploadedfiles) ?>:</td>
<td>
<?php
unset($options);
$options[0] = get_string('no');
$options[1] = get_string('yes');
choose_from_menu ($options, "filteruploadedfiles", $CFG->filteruploadedfiles, "", "", "");
?>
</td>
<td>
<?php p($strconfigfilteruploadedfiles) ?>
</td>
</tr>
<tr valign=top>
<td>&nbsp;</td>
<td><input type="submit" value="<?php print_string("savechanges") ?>"></td>
+2
View File
@@ -32,6 +32,8 @@
$strinactive = get_string("inactive");
$strcachetext = get_string("cachetext", "admin");
$strconfigcachetext = get_string("configcachetext");
$strfilteruploadedfiles = get_string("filteruploadedfiles", "admin");
$strconfigfilteruploadedfiles = get_string("configfilteruploadedfiles");
print_header("$site->shortname: $strmanagefilters", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> ".
+18 -12
View File
@@ -49,20 +49,26 @@
header("Content-length: ".filesize($pathname));
if ($mimetype == "text/html") {
header("Content-type: text/html");
echo format_text(implode('', file($pathname)), FORMAT_HTML, NULL, $courseid); // Filter HTML files
} else if ($mimetype == "text/plain") {
header("Content-type: text/html");
$options->newlines = false;
echo "<pre>";
echo format_text(implode('', file($pathname)), FORMAT_MOODLE, $options, $courseid); // Filter TEXT files
echo "</pre>";
} else {
if (empty($CFG->filteruploadedfiles)) {
header("Content-type: $mimetype");
readfile($pathname);
} else { /// Try and put the file through filters
if ($mimetype == "text/html") {
header("Content-type: text/html");
echo format_text(implode('', file($pathname)), FORMAT_HTML, NULL, $courseid);
} else if ($mimetype == "text/plain") {
header("Content-type: text/html");
$options->newlines = false;
echo "<pre>";
echo format_text(implode('', file($pathname)), FORMAT_MOODLE, $options, $courseid);
echo "</pre>";
} else { /// Just send it out raw
header("Content-type: $mimetype");
readfile($pathname);
}
}
} else {
error("Sorry, but the file you are looking for was not found ($pathname)", "course/view.php?id=$courseid");
+1
View File
@@ -3,6 +3,7 @@
$string['cachetext'] = 'Text cache lifetime';
$string['filteruploadedfiles'] = 'Filter uploaded files';
$string['upgradelogs'] = 'For full functionality, your old logs need to be upgraded. <a href=\"$a\">More information</a>';
$string['upgradelogsinfo'] = 'Some changes have way some logs are stored. To be able to view all of your old logs on a per-activity basis, your old logs need to be upgraded. Depending on your site this can take a long time (eg several hours) and can be quite taxing on the database for large sites. Once you start this process you should let it finish (by keeping the browser window open). Don\'t worry - your site will work fine for other people while the logs are being upgraded.<br /><br />Do you want to upgrade your logs now?';
+1
View File
@@ -131,6 +131,7 @@ $string['configcachetext'] = 'For larger sites or sites that use text filters, t
$string['configcountry'] = 'If you set a country here, then this country will be selected by default on new user accounts. To force users to choose a country, just leave this unset.';
$string['configdebug'] = 'If you turn this on, then PHP\'s error_reporting will be increased so that more warnings are printed. This is only useful for developers.';
$string['configerrorlevel'] = 'Choose the amount of PHP warnings that you want to be displayed. Normal is usually the best choice.';
$string['configfilteruploadedfiles'] = 'Enabling this setting will cause Moodle to process all uploaded HTML and text files with the filters before displaying them.';
$string['configforcelogin'] = 'Normally, the front page of the site and the course listings (but not courses) can be read by people without logging in to the site. If you want to force people to log in before they do ANYTHING on the site, then you should enable this setting.';
$string['configframename'] = 'If you are embedding Moodle within a web frame, then put the name of this frame here. Otherwise this value should remain as \'_top\'';
$string['configfullnamedisplay'] = 'This defines how names are shown when they are displayed in full. For most mono-lingual sites the most efficient setting is the default \"Given names + Surname\", but you may choose to hide surnames altogether, or to leave it up to the current language pack to decide (some languages have different conventions).';
+1
View File
@@ -10,6 +10,7 @@
"changepassword" => true,
"country" => "",
"debug" => 7,
"filteruploadedfiles" => true,
"forcelogin" => false,
"fullnamedisplay" => "firstname lastname",
"framename" => "_top",