can not see links if not logged in
[moodle.git] / blog / preferences.php
... / ...
CommitLineData
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
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 }
18 }
19
20 //ensure that the logged in user is not using the guest account
21 if (isguest()) {
22 error(get_string('noguestpost', 'blog'), $referrer);
23 }
24
25 if (!blog_isLoggedIn() ) {
26 error(get_string('noguestpost', 'blog'), $referrer);
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();
35
36 set_user_preference('blogpagesize', optional_param('pagesize', 10, PARAM_INT));
37 redirect($referrer, get_string('changessaved'), 1);
38 exit;
39 }
40
41 $site = get_site();
42 $pageMeta = '' . "\n";
43
44 $strpreferences = get_string('preferences');
45 $strblogs = get_string('blogs', 'blog');
46
47 $navigation = "<a href='".$CFG->wwwroot."/blog/'>$strblogs</a> -> $strpreferences";
48
49 print_header("$site->shortname: $strblogs : $strpreferences", $strblogs, $navigation, '', $pageMeta, true, '', '');
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?>