Removed to match original MOODLE_16_STABLE ... not sure how this got in again.
[moodle.git] / user / policy.php
blobbcc1b9aa913417a8b690bd9b1f64cf316aadb7b0
1 <?php // $Id$
3 require_once("../config.php");
5 $agree = optional_param('agree', 0, PARAM_INT);
7 define('MESSAGE_WINDOW', true); // This prevents the message window coming up
10 if (!isset($USER->id)) {
11 require_login();
14 if ($agree == 1 and confirm_sesskey()) { // User has agreed
15 if ($USER->username != 'guest') { // Don't remember guests
16 if (!set_field('user', 'policyagreed', 1, 'id', $USER->id)) {
17 error('Could not save your agreement');
20 $USER->policyagreed = 1;
22 if (!empty($SESSION->wantsurl)) {
23 $wantsurl = $SESSION->wantsurl;
24 unset($SESSION->wantsurl);
25 redirect($wantsurl);
26 } else {
27 redirect($CFG->wwwroot.'/');
29 exit;
32 $strpolicyagree = get_string('policyagree');
33 $strpolicyagreement = get_string('policyagreement');
34 $strpolicyagreementclick = get_string('policyagreementclick');
36 print_header($strpolicyagreement, $SITE->fullname, $strpolicyagreement);
38 print_heading($strpolicyagreement);
40 echo '<center>';
41 echo '<iframe width="90%" height="70%" src="'.$CFG->sitepolicy.'">';
42 echo link_to_popup_window ($CFG->sitepolicy, 'agreement', $strpolicyagreementclick,
43 500, 500, 'Popup window', 'none', true);
44 echo '</iframe>';
45 echo '</center>';
47 notice_yesno($strpolicyagree, "policy.php?agree=1&amp;sesskey=$USER->sesskey", $CFG->wwwroot);
49 print_footer();