[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/admin/ -> filter.php (source)

   1  <?php // $Id: filter.php,v 1.18.4.3 2007/12/25 10:03:17 skodak Exp $
   2      // filter.php
   3      // Edit text filter settings
   4  
   5      require_once ('../config.php');
   6      require_once($CFG->libdir.'/adminlib.php');
   7      require_once($CFG->libdir.'/tablelib.php');
   8  
   9      $filterfull = required_param('filter', PARAM_PATH);
  10      $forcereset  = optional_param('reset', 0, PARAM_BOOL);
  11  
  12      $filtername =  substr($filterfull, strpos( $filterfull, '/' )+1 ) ;
  13  
  14      admin_externalpage_setup('filtersetting'.str_replace('/', '', $filterfull));
  15  
  16      $returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=managefilters";
  17  
  18  
  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' );
  24  
  25      //======================
  26      // Process Actions
  27      //======================
  28  
  29      // if reset pressed let filter config page handle it
  30      if ($config = data_submitted() and !$forcereset) {
  31  
  32          // check session key
  33          if (!confirm_sesskey()) {
  34               error( get_string('confirmsesskeybad', 'error' ) );
  35          }
  36  
  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;
  44              }
  45          }
  46  
  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));
  52              }
  53          }
  54  
  55          reset_text_filters_cache();
  56  
  57          redirect($returnurl);
  58          exit;
  59      }
  60  
  61      //==============================
  62      // Display logic
  63      //==============================
  64  
  65      $filtername = ucfirst($filtername);
  66      admin_externalpage_print_header();
  67      print_heading( $filtername );
  68  
  69      print_simple_box(get_string("configwarning", "admin"), "center", "50%");
  70      echo "<br />";
  71  
  72      print_simple_box_start("center",'');
  73  
  74      ?>
  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(); ?>" />
  78  
  79      <?php include "$CFG->dirroot/$filterfull/filterconfig.html"; ?>
  80  
  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>
  85  
  86      <?php
  87      print_simple_box_end();
  88  
  89      admin_externalpage_print_footer();
  90  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7