can not see links if not logged in
[moodle.git] / blog / preferences.php
CommitLineData
4a173181 1<?php // $Id$
2 // preferences.php - user prefs for blog modeled on calendar
3
4 require_once('../config.php');
5 require_once($CFG->dirroot.'/blog/lib.php');
6
7 require_login();
8 global $USER;
9
10 // detemine where the user is coming from in case we need to send them back there
752c0c4d 11
12 if (!$referrer = optional_param('referrer','', PARAM_NOTAGS)) {
13 if (isset($_SERVER['HTTP_REFERER'])) {
14 $referrer = $_SERVER['HTTP_REFERER'];
15 } else {
16 $referrer = $CFG->wwwroot;
17 }
4a173181 18 }
19
20 //ensure that the logged in user is not using the guest account
21 if (isguest()) {
9154b440 22 error(get_string('noguestpost', 'blog'), $referrer);
4a173181 23 }
24
25 if (!blog_isLoggedIn() ) {
9154b440 26 error(get_string('noguestpost', 'blog'), $referrer);
4a173181 27 }
28 $userid = $USER->id;
29 $bloginfo =& new BlogInfo($userid);
30
31/// If data submitted, then process and store.
32
33 if ($post = data_submitted()) {
34 print_header();
4a173181 35
5c625033 36 set_user_preference('blogpagesize', optional_param('pagesize', 10, PARAM_INT));
4a173181 37 redirect($referrer, get_string('changessaved'), 1);
38 exit;
39 }
40
41 $site = get_site();
954cfa1b 42 $pageMeta = '' . "\n";
4a173181 43
25a78406 44 $strpreferences = get_string('preferences');
e17426ca 45 $strblogs = get_string('blogs', 'blog');
4a173181 46
e17426ca 47 $navigation = "<a href='".$CFG->wwwroot."/blog/'>$strblogs</a> -> $strpreferences";
4a173181 48
e17426ca 49 print_header("$site->shortname: $strblogs : $strpreferences", $strblogs, $navigation, '', $pageMeta, true, '', '');
4a173181 50
51 print_heading($strpreferences);
52
53 print_simple_box_start('center', '', '');
54
55 include('./preferences.html');
56 print_simple_box_end();
57
58 print_footer();
59?>