"MDL-15592, change js function name toggle() to menu_toggle(), to be friendly with...
[moodle-linuxchix.git] / admin / filter.php
blobce75068ef8385ae9a558a1b176cde0f48c373170
1 <?php // $Id$
2 // filter.php
3 // Edit text filter settings
5 require_once('../config.php');
6 require_once($CFG->libdir.'/adminlib.php');
7 require_once($CFG->libdir.'/tablelib.php');
9 $filterfull = required_param('filter', PARAM_PATH);
10 $forcereset = optional_param('reset', 0, PARAM_BOOL);
12 $filtername = substr($filterfull, strpos( $filterfull, '/' )+1 ) ;
14 admin_externalpage_setup('filtersetting'.str_replace('/', '', $filterfull));
16 $returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=managefilters";
19 // get translated strings for use on page
20 $txt = new Object;
21 $txt->managefilters = get_string( 'managefilters' );
22 $txt->administration = get_string( 'administration' );
23 $txt->configuration = get_string( 'configuration' );
25 //======================
26 // Process Actions
27 //======================
29 // if reset pressed let filter config page handle it
30 if ($config = data_submitted() and !$forcereset) {
32 // check session key
33 if (!confirm_sesskey()) {
34 error( get_string('confirmsesskeybad', 'error' ) );
37 $configpath = $CFG->dirroot.'/filter/'.$filtername.'/filterconfig.php';
38 if (file_exists($configpath)) {
39 require_once($configpath);
40 $functionname = $filtername.'_process_config';
41 if (function_exists($functionname)) {
42 $functionname($config);
43 $saved = true;
47 if (empty($saved)) {
48 // run through submitted data
49 // reject if does not start with filter_
50 foreach ($config as $name => $value) {
51 set_config($name, stripslashes($value));
55 reset_text_filters_cache();
57 redirect($returnurl);
58 exit;
61 //==============================
62 // Display logic
63 //==============================
65 $filtername = ucfirst($filtername);
66 admin_externalpage_print_header();
67 print_heading( $filtername );
69 print_simple_box(get_string("configwarning", "admin"), "center", "50%");
70 echo "<br />";
72 print_simple_box_start("center",'');
75 <form action="filter.php?filter=<?php echo urlencode($filterfull); ?>" method="post">
76 <div style="text-align: center">
77 <input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
79 <?php include "$CFG->dirroot/$filterfull/filterconfig.html"; ?>
81 <input type="submit" name="submit" value="<?php print_string('savechanges'); ?>" />
82 <input type="submit" name="reset" value="<?php echo print_string('resettodefaults'); ?>" />
83 </div>
84 </form>
86 <?php
87 print_simple_box_end();
89 admin_externalpage_print_footer();