2004-11-29 05:30:36 +00:00
|
|
|
<?php // $Id$
|
|
|
|
|
2007-04-03 09:51:53 +00:00
|
|
|
require_once('../config.php');
|
|
|
|
require_once($CFG->libdir.'/filelib.php');
|
2004-11-29 05:30:36 +00:00
|
|
|
|
2007-04-03 09:51:53 +00:00
|
|
|
$agree = optional_param('agree', 0, PARAM_BOOL);
|
2004-11-29 05:30:36 +00:00
|
|
|
|
2005-01-30 04:52:13 +00:00
|
|
|
define('MESSAGE_WINDOW', true); // This prevents the message window coming up
|
|
|
|
|
2007-04-03 09:51:53 +00:00
|
|
|
if (!isloggedin()) {
|
2004-11-29 05:30:36 +00:00
|
|
|
require_login();
|
|
|
|
}
|
|
|
|
|
2007-04-03 09:51:53 +00:00
|
|
|
if ($agree and confirm_sesskey()) { // User has agreed
|
|
|
|
if (!isguestuser()) { // Don't remember guests
|
2004-11-29 06:22:12 +00:00
|
|
|
if (!set_field('user', 'policyagreed', 1, 'id', $USER->id)) {
|
|
|
|
error('Could not save your agreement');
|
|
|
|
}
|
2004-11-29 05:30:36 +00:00
|
|
|
}
|
|
|
|
$USER->policyagreed = 1;
|
2004-11-29 06:22:12 +00:00
|
|
|
|
|
|
|
if (!empty($SESSION->wantsurl)) {
|
|
|
|
$wantsurl = $SESSION->wantsurl;
|
|
|
|
unset($SESSION->wantsurl);
|
|
|
|
redirect($wantsurl);
|
|
|
|
} else {
|
|
|
|
redirect($CFG->wwwroot.'/');
|
|
|
|
}
|
2004-11-29 05:30:36 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
$strpolicyagree = get_string('policyagree');
|
|
|
|
$strpolicyagreement = get_string('policyagreement');
|
|
|
|
$strpolicyagreementclick = get_string('policyagreementclick');
|
|
|
|
|
|
|
|
print_header($strpolicyagreement, $SITE->fullname, $strpolicyagreement);
|
|
|
|
|
|
|
|
print_heading($strpolicyagreement);
|
|
|
|
|
2007-04-03 09:51:53 +00:00
|
|
|
$mimetype = mimeinfo('type', $CFG->sitepolicy);
|
2007-05-15 08:41:55 +00:00
|
|
|
if ($mimetype == 'document/unknown') {
|
|
|
|
//fallback for missing index.php, index.html
|
|
|
|
$mimetype = 'text/html';
|
|
|
|
}
|
|
|
|
|
2007-04-03 09:51:53 +00:00
|
|
|
echo '<div class="noticebox">';
|
|
|
|
echo '<object id="policyframe" data="'.$CFG->sitepolicy.'" type="'.$mimetype.'">';
|
2004-11-29 05:30:36 +00:00
|
|
|
echo link_to_popup_window ($CFG->sitepolicy, 'agreement', $strpolicyagreementclick,
|
|
|
|
500, 500, 'Popup window', 'none', true);
|
2007-04-03 09:51:53 +00:00
|
|
|
echo '</object></div>';
|
2004-11-29 05:30:36 +00:00
|
|
|
|
2007-05-15 08:33:22 +00:00
|
|
|
// see MDL-9798
|
|
|
|
/* $linkyes = 'policy.php';
|
2007-04-03 09:51:53 +00:00
|
|
|
$optionsyes = array('agree'=>1, 'sesskey'=>sesskey());
|
|
|
|
$linkno = $CFG->wwwroot.'/login/logout.php';
|
|
|
|
$optionsno = array('sesskey'=>sesskey());
|
2007-05-15 08:33:22 +00:00
|
|
|
notice_yesno($strpolicyagree, $linkyes, $linkno, $optionsyes, $optionsno);*/
|
|
|
|
|
|
|
|
print_box_start('generalbox', 'notice');
|
|
|
|
echo '<p>'. $strpolicyagree .'</p>';
|
|
|
|
echo '<div class="buttons">';
|
|
|
|
echo '<div class="singlebutton"><a href="policy.php?agree=1&sesskey='.sesskey().'">'.get_string('yes').'</a></div>';
|
|
|
|
echo '<div class="singlebutton"><a href="../login/logout.php?sesskey='.sesskey().'">'.get_string('no').'</a></div>';
|
|
|
|
echo '</div>';
|
|
|
|
print_box_end();
|
2004-11-29 05:30:36 +00:00
|
|
|
|
|
|
|
print_footer();
|
|
|
|
|
|
|
|
?>
|