MDL-16457 Remove support for old-style filterconfig.html files
This commit is contained in:
@@ -1,90 +0,0 @@
|
||||
<?php // $Id$
|
||||
// filter.php
|
||||
// Edit text filter settings
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/tablelib.php');
|
||||
|
||||
$filterfull = required_param('filter', PARAM_PATH);
|
||||
$forcereset = optional_param('reset', 0, PARAM_BOOL);
|
||||
|
||||
$filtername = substr($filterfull, strpos( $filterfull, '/' )+1 ) ;
|
||||
|
||||
admin_externalpage_setup('filtersetting'.str_replace('/', '', $filterfull));
|
||||
|
||||
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=managefilters";
|
||||
|
||||
|
||||
// get translated strings for use on page
|
||||
$txt = new object();
|
||||
$txt->managefilters = get_string( 'managefilters' );
|
||||
$txt->administration = get_string( 'administration' );
|
||||
$txt->configuration = get_string( 'configuration' );
|
||||
|
||||
//======================
|
||||
// Process Actions
|
||||
//======================
|
||||
|
||||
// if reset pressed let filter config page handle it
|
||||
if ($config = data_submitted() and !$forcereset) {
|
||||
|
||||
// check session key
|
||||
if (!confirm_sesskey()) {
|
||||
print_error('confirmsesskeybad', 'error');
|
||||
}
|
||||
|
||||
$configpath = $CFG->dirroot.'/filter/'.$filtername.'/filterconfig.php';
|
||||
if (file_exists($configpath)) {
|
||||
require_once($configpath);
|
||||
$functionname = $filtername.'_process_config';
|
||||
if (function_exists($functionname)) {
|
||||
$functionname($config);
|
||||
$saved = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($saved)) {
|
||||
// run through submitted data
|
||||
// reject if does not start with filter_
|
||||
foreach ($config as $name => $value) {
|
||||
set_config($name, $value);
|
||||
}
|
||||
}
|
||||
|
||||
reset_text_filters_cache();
|
||||
|
||||
redirect($returnurl);
|
||||
exit;
|
||||
}
|
||||
|
||||
//==============================
|
||||
// Display logic
|
||||
//==============================
|
||||
|
||||
$filtername = ucfirst($filtername);
|
||||
admin_externalpage_print_header();
|
||||
print_heading( $filtername );
|
||||
|
||||
print_simple_box(get_string("configwarning", "admin"), "center", "50%");
|
||||
echo "<br />";
|
||||
|
||||
print_simple_box_start("center",'');
|
||||
|
||||
?>
|
||||
<form action="filter.php?filter=<?php echo urlencode($filterfull); ?>" method="post">
|
||||
<div style="text-align: center">
|
||||
<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
|
||||
|
||||
<?php include "$CFG->dirroot/$filterfull/filterconfig.html"; ?>
|
||||
|
||||
<input type="submit" name="submit" value="<?php print_string('savechanges'); ?>" />
|
||||
<input type="submit" name="reset" value="<?php echo print_string('resettodefaults'); ?>" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
print_simple_box_end();
|
||||
|
||||
admin_externalpage_print_footer();
|
||||
?>
|
||||
@@ -137,9 +137,6 @@ if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext))
|
||||
include("$CFG->dirroot/$filterfull/filtersettings.php");
|
||||
}
|
||||
$ADMIN->add('filtersettings', $settings);
|
||||
|
||||
} else if (file_exists("$CFG->dirroot/$filterfull/filterconfig.html")) {
|
||||
$ADMIN->add('filtersettings', new admin_externalpage('filtersetting'.str_replace('/', '', $filterfull), $strfiltername, "$CFG->wwwroot/$CFG->admin/filter.php?filter=$filterfull", !in_array($filterfull, $activefilters)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4564,14 +4564,12 @@ class admin_setting_managefilters extends admin_setting {
|
||||
// associated modules
|
||||
$installedfilters = array();
|
||||
$filtersettings_new = array();
|
||||
$filtersettings_old = array();
|
||||
$filterlocations = array('mod','filter');
|
||||
foreach ($filterlocations as $filterlocation) {
|
||||
$plugins = get_list_of_plugins($filterlocation);
|
||||
foreach ($plugins as $plugin) {
|
||||
$pluginpath = "$CFG->dirroot/$filterlocation/$plugin/filter.php";
|
||||
$settingspath_new = "$CFG->dirroot/$filterlocation/$plugin/filtersettings.php";
|
||||
$settingspath_old = "$CFG->dirroot/$filterlocation/$plugin/filterconfig.html";
|
||||
if (is_readable($pluginpath)) {
|
||||
$name = trim(get_string("filtername", $plugin));
|
||||
if (empty($name) or ($name == '[[filtername]]')) {
|
||||
@@ -4581,8 +4579,6 @@ class admin_setting_managefilters extends admin_setting {
|
||||
$installedfilters["$filterlocation/$plugin"] = $name;
|
||||
if (is_readable($settingspath_new)) {
|
||||
$filtersettings_new[] = "$filterlocation/$plugin";
|
||||
} else if (is_readable($settingspath_old)) {
|
||||
$filtersettings_old[] = "$filterlocation/$plugin";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4672,8 +4668,6 @@ class admin_setting_managefilters extends admin_setting {
|
||||
$settings = '';
|
||||
if (in_array($path, $filtersettings_new)) {
|
||||
$settings = "<a href=\"settings.php?section=filtersetting".str_replace('/', '',$path)."\">$strsettings</a>";
|
||||
} else if (in_array($path, $filtersettings_old)) {
|
||||
$settings = "<a href=\"filter.php?filter=".urlencode($path)."\">$strsettings</a>";
|
||||
}
|
||||
|
||||
// write data into the table object
|
||||
|
||||
Reference in New Issue
Block a user