Search moodle.org's
Developer Documentation


  • Bug fixes for general core bugs in 2.8.x ended 9 November 2015 (12 months).
  • Bug fixes for security issues in 2.8.x ended 9 May 2016 (18 months).
  • minimum PHP 5.4.4 (always use latest PHP 5.4.x or 5.5.x on Windows - http://windows.php.net/download/), PHP 7 is NOT supported
  • /tag/ -> user.php (source)

    Differences Between: [Versions 28 and 31] [Versions 28 and 32] [Versions 28 and 33] [Versions 28 and 34] [Versions 28 and 35] [Versions 28 and 36] [Versions 28 and 37]

       1  <?php
       2  
       3  require_once('../config.php');
       4  require_once ('lib.php');
       5  
       6  $action = optional_param('action', '', PARAM_ALPHA);
       7  $id = optional_param('id', 0, PARAM_INT);
       8  $tag = optional_param('tag', '', PARAM_TAG);
       9  
      10  require_login();
      11  
      12  if (empty($CFG->usetags)) {
      13      print_error('tagdisabled');
      14  }
      15  
      16  if (isguestuser()) {
      17      print_error('noguest');
      18  }
      19  
      20  if (!confirm_sesskey()) {
      21      print_error('sesskey');
      22  }
      23  
      24  $usercontext = context_user::instance($USER->id);
      25  
      26  switch ($action) {
      27      case 'addinterest':
      28          if (empty($tag) && $id) { // for backward-compatibility (people saving bookmarks, mostly..)
      29              $tag = tag_get_name($id);
      30          }
      31  
      32          tag_set_add('user', $USER->id, $tag, 'core', $usercontext->id);
      33  
      34          redirect($CFG->wwwroot.'/tag/index.php?tag='. rawurlencode($tag));
      35          break;
      36  
      37      case 'removeinterest':
      38          if (empty($tag) && $id) { // for backward-compatibility (people saving bookmarks, mostly..)
      39              $tag = tag_get_name($id);
      40          }
      41  
      42          tag_set_delete('user', $USER->id, $tag, 'core', $usercontext->id);
      43  
      44          redirect($CFG->wwwroot.'/tag/index.php?tag='. rawurlencode($tag));
      45          break;
      46  
      47      case 'flaginappropriate':
      48          require_capability('moodle/tag:flag', context_system::instance());
      49          $tagid = tag_get_id($tag);
      50  
      51          tag_set_flag($tagid);
      52  
      53          redirect($CFG->wwwroot.'/tag/index.php?tag='. rawurlencode($tag), get_string('responsiblewillbenotified', 'tag'));
      54          break;
      55  
      56      default:
      57          print_error('unknowaction');
      58          break;
      59  }
    

    Search This Site: