File: policy.php

package info (click to toggle)
moodle 1.6.3-2%2Betch3
  • links: PTS
  • area: main
  • in suites: etch
  • size: 37,172 kB
  • ctags: 51,688
  • sloc: php: 231,916; sql: 5,631; xml: 2,688; sh: 1,185; perl: 638; makefile: 48; pascal: 36
file content (51 lines) | stat: -rw-r--r-- 1,600 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php // $Id: policy.php,v 1.6 2005/04/02 09:42:53 moodler Exp $

    require_once("../config.php");

    $agree = optional_param('agree', 0, PARAM_INT);

    define('MESSAGE_WINDOW', true);  // This prevents the message window coming up


    if (!isset($USER->id)) {
        require_login();
    }

    if ($agree == 1 and confirm_sesskey()) {        // User has agreed
        if ($USER->username != 'guest') {           // Don't remember guests
            if (!set_field('user', 'policyagreed', 1, 'id', $USER->id)) {
                error('Could not save your agreement');
            }
        }
        $USER->policyagreed = 1;

        if (!empty($SESSION->wantsurl)) {
            $wantsurl = $SESSION->wantsurl;
            unset($SESSION->wantsurl);
            redirect($wantsurl);
        } else {
            redirect($CFG->wwwroot.'/');
        }
        exit;
    }

    $strpolicyagree = get_string('policyagree');
    $strpolicyagreement = get_string('policyagreement');
    $strpolicyagreementclick = get_string('policyagreementclick');

    print_header($strpolicyagreement, $SITE->fullname, $strpolicyagreement);

    print_heading($strpolicyagreement);

    echo '<center>';
    echo '<iframe width="90%" height="70%" src="'.$CFG->sitepolicy.'">';
    echo link_to_popup_window ($CFG->sitepolicy, 'agreement', $strpolicyagreementclick,
                               500, 500, 'Popup window', 'none', true);
    echo '</iframe>';
    echo '</center>';

    notice_yesno($strpolicyagree, "policy.php?agree=1&amp;sesskey=$USER->sesskey", $CFG->wwwroot);

    print_footer();

?>