removed $SESSION->encoding now replaced by current_charset() and $CFG->unicodedb...
[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
11 if (isset($_SERVER['HTTP_REFERER'])) {
12 $referrer = $_SERVER['HTTP_REFERER'];
13 } else {
14 $referrer = $CFG->wwwroot;
15 }
16
17 //ensure that the logged in user is not using the guest account
18 if (isguest()) {
9154b440 19 error(get_string('noguestpost', 'blog'), $referrer);
4a173181 20 }
21
22 if (!blog_isLoggedIn() ) {
9154b440 23 error(get_string('noguestpost', 'blog'), $referrer);
4a173181 24 }
25 $userid = $USER->id;
26 $bloginfo =& new BlogInfo($userid);
27
28/// If data submitted, then process and store.
29
30 if ($post = data_submitted()) {
31 print_header();
4a173181 32
5c625033 33 set_user_preference('blogpagesize', optional_param('pagesize', 10, PARAM_INT));
4a173181 34
35 redirect($referrer, get_string('changessaved'), 1);
36 exit;
37 }
38
39 $site = get_site();
40 $pageMeta = '<script language="javascript" type="text/javascript" src="'. $CFG->wwwroot .'/blog/blog.js"></script>' . "\n";
41
25a78406 42 $strpreferences = get_string('preferences');
4a173181 43
44 $navigation = '<a href="'. $bloginfo->get_blog_url() .'">'. $bloginfo->get_blog_title() . '</a> -> '. $strpreferences;
45
46 print_header("$site->shortname: ". $bloginfo->get_blog_title() .": $strpreferences", $bloginfo->get_blog_title(), $navigation, '', $pageMeta, true, '', '');
47
48 print_heading($strpreferences);
49
50 print_simple_box_start('center', '', '');
51
52 include('./preferences.html');
53 print_simple_box_end();
54
55 print_footer();
56?>