2006-03-10 06:53:01 +00:00
|
|
|
<?php // $Id$
|
|
|
|
// preferences.php - user prefs for blog modeled on calendar
|
|
|
|
|
|
|
|
require_once('../config.php');
|
|
|
|
require_once($CFG->dirroot.'/blog/lib.php');
|
|
|
|
|
|
|
|
require_login();
|
|
|
|
global $USER;
|
|
|
|
|
|
|
|
// detemine where the user is coming from in case we need to send them back there
|
2006-03-14 02:26:44 +00:00
|
|
|
|
|
|
|
if (!$referrer = optional_param('referrer','', PARAM_NOTAGS)) {
|
|
|
|
if (isset($_SERVER['HTTP_REFERER'])) {
|
|
|
|
$referrer = $_SERVER['HTTP_REFERER'];
|
|
|
|
} else {
|
|
|
|
$referrer = $CFG->wwwroot;
|
|
|
|
}
|
2006-03-10 06:53:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//ensure that the logged in user is not using the guest account
|
|
|
|
if (isguest()) {
|
2006-03-13 06:05:44 +00:00
|
|
|
error(get_string('noguestpost', 'blog'), $referrer);
|
2006-03-10 06:53:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!blog_isLoggedIn() ) {
|
2006-03-13 06:05:44 +00:00
|
|
|
error(get_string('noguestpost', 'blog'), $referrer);
|
2006-03-10 06:53:01 +00:00
|
|
|
}
|
|
|
|
$userid = $USER->id;
|
|
|
|
$bloginfo =& new BlogInfo($userid);
|
|
|
|
|
|
|
|
/// If data submitted, then process and store.
|
|
|
|
|
|
|
|
if ($post = data_submitted()) {
|
|
|
|
print_header();
|
|
|
|
|
2006-03-13 08:46:13 +00:00
|
|
|
set_user_preference('blogpagesize', optional_param('pagesize', 10, PARAM_INT));
|
2006-03-10 06:53:01 +00:00
|
|
|
redirect($referrer, get_string('changessaved'), 1);
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
$site = get_site();
|
|
|
|
$pageMeta = '<script language="javascript" type="text/javascript" src="'. $CFG->wwwroot .'/blog/blog.js"></script>' . "\n";
|
|
|
|
|
2006-03-13 07:54:44 +00:00
|
|
|
$strpreferences = get_string('preferences');
|
2006-03-10 06:53:01 +00:00
|
|
|
|
|
|
|
$navigation = '<a href="'. $bloginfo->get_blog_url() .'">'. $bloginfo->get_blog_title() . '</a> -> '. $strpreferences;
|
|
|
|
|
|
|
|
print_header("$site->shortname: ". $bloginfo->get_blog_title() .": $strpreferences", $bloginfo->get_blog_title(), $navigation, '', $pageMeta, true, '', '');
|
|
|
|
|
|
|
|
print_heading($strpreferences);
|
|
|
|
|
|
|
|
print_simple_box_start('center', '', '');
|
|
|
|
|
|
|
|
include('./preferences.html');
|
|
|
|
print_simple_box_end();
|
|
|
|
|
|
|
|
print_footer();
|
|
|
|
?>
|