Fixes to the PaintWeb cron task.
[moodle/mihaisucan.git] / tag / user.php
blobb683b889d70c8cbda5e5bde92a7f42e36a62b92d
1 <?php // $Id$
3 require_once('../config.php');
4 require_once('lib.php');
6 $action = optional_param('action', '', PARAM_ALPHA);
7 $id = optional_param('id', 0, PARAM_INT);
8 $tag = optional_param('tag', '', PARAM_TAG);
10 require_login();
12 if (empty($CFG->usetags)) {
13 error('Tags are disabled!');
16 if (isguestuser()) {
17 print_error('noguest');
20 if (!confirm_sesskey()) {
21 print_error('sesskey');
25 switch ($action) {
26 case 'addinterest':
27 if (empty($tag) && $id) { // for backward-compatibility (people saving bookmarks, mostly..)
28 $tag = tag_get_name($id);
31 tag_set_add('user', $USER->id, $tag);
33 redirect($CFG->wwwroot.'/tag/index.php?tag='. rawurlencode($tag));
34 break;
36 case 'removeinterest':
37 if (empty($tag) && $id) { // for backward-compatibility (people saving bookmarks, mostly..)
38 $tag = tag_get_name($id);
41 tag_set_delete('user', $USER->id, $tag);
43 redirect($CFG->wwwroot.'/tag/index.php?tag='. rawurlencode($tag));
44 break;
46 case 'flaginappropriate':
48 tag_set_flag(tag_get_id($tag));
50 redirect($CFG->wwwroot.'/tag/index.php?tag='. rawurlencode($tag), get_string('responsiblewillbenotified', 'tag'));
51 break;
53 default:
54 error('No action was specified');
55 break;