some cleaning, removed config.html for admin
[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();
42 $pageMeta = '<script language="javascript" type="text/javascript" src="'. $CFG->wwwroot .'/blog/blog.js"></script>' . "\n";
43
25a78406 44 $strpreferences = get_string('preferences');
4a173181 45
46 $navigation = '<a href="'. $bloginfo->get_blog_url() .'">'. $bloginfo->get_blog_title() . '</a> -> '. $strpreferences;
47
48 print_header("$site->shortname: ". $bloginfo->get_blog_title() .": $strpreferences", $bloginfo->get_blog_title(), $navigation, '', $pageMeta, true, '', '');
49
50 print_heading($strpreferences);
51
52 print_simple_box_start('center', '', '');
53
54 include('./preferences.html');
55 print_simple_box_end();
56
57 print_footer();
58?>