| [ Index ] |
PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008] |
[Summary view] [Print] [Text view]
1 <?php // $Id: policy.php,v 1.13 2007/08/17 19:09:27 nicolasconnault Exp $ 2 3 require_once ('../config.php'); 4 require_once($CFG->libdir.'/filelib.php'); 5 6 $agree = optional_param('agree', 0, PARAM_BOOL); 7 8 define('MESSAGE_WINDOW', true); // This prevents the message window coming up 9 10 if (!isloggedin()) { 11 require_login(); 12 } 13 14 if ($agree and confirm_sesskey()) { // User has agreed 15 if (!isguestuser()) { // Don't remember guests 16 if (!set_field('user', 'policyagreed', 1, 'id', $USER->id)) { 17 error('Could not save your agreement'); 18 } 19 } 20 $USER->policyagreed = 1; 21 22 if (!empty($SESSION->wantsurl)) { 23 $wantsurl = $SESSION->wantsurl; 24 unset($SESSION->wantsurl); 25 redirect($wantsurl); 26 } else { 27 redirect($CFG->wwwroot.'/'); 28 } 29 exit; 30 } 31 32 $strpolicyagree = get_string('policyagree'); 33 $strpolicyagreement = get_string('policyagreement'); 34 $strpolicyagreementclick = get_string('policyagreementclick'); 35 36 print_header($strpolicyagreement, $SITE->fullname, build_navigation(array(array('name'=>$strpolicyagreement, 'link'=>null, 'type'=>'misc')))); 37 38 print_heading($strpolicyagreement); 39 40 $mimetype = mimeinfo('type', $CFG->sitepolicy); 41 if ($mimetype == 'document/unknown') { 42 //fallback for missing index.php, index.html 43 $mimetype = 'text/html'; 44 } 45 46 echo '<div class="noticebox">'; 47 echo '<object id="policyframe" data="'.$CFG->sitepolicy.'" type="'.$mimetype.'">'; 48 // we can not use our popups here, because the url may be arbitrary, see MDL-9823 49 echo '<a href="'.$CFG->sitepolicy.'" onclick="this.target=\'_blank\'">'.$strpolicyagreementclick.'</a>'; 50 echo '</object></div>'; 51 52 $linkyes = 'policy.php'; 53 $optionsyes = array('agree'=>1, 'sesskey'=>sesskey()); 54 $linkno = $CFG->wwwroot.'/login/logout.php'; 55 $optionsno = array('sesskey'=>sesskey()); 56 notice_yesno($strpolicyagree, $linkyes, $linkno, $optionsyes, $optionsno); 57 58 print_footer(); 59 60 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Jan 14 11:33:29 2009 | Cross-referenced by PHPXref 0.7 |