Fix a possible race condition in the PaintWeb DML code.
[moodle/mihaisucan.git] / mod / data / js.php
blob6972acf6412a76503a0ac4d69f950d2e3534ebab
1 <?php
2 ///////////////////////////////////////////////////////////////////////////
3 // //
4 // NOTICE OF COPYRIGHT //
5 // //
6 // Moodle - Modular Object-Oriented Dynamic Learning Environment //
7 // http://moodle.org //
8 // //
9 // Copyright (C) 2005 Martin Dougiamas http://dougiamas.com //
10 // //
11 // This program is free software; you can redistribute it and/or modify //
12 // it under the terms of the GNU General Public License as published by //
13 // the Free Software Foundation; either version 2 of the License, or //
14 // (at your option) any later version. //
15 // //
16 // This program is distributed in the hope that it will be useful, //
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
19 // GNU General Public License for more details: //
20 // //
21 // http://www.gnu.org/copyleft/gpl.html //
22 // //
23 ///////////////////////////////////////////////////////////////////////////
25 $lifetime = 600; // Seconds to cache this stylesheet
26 $nomoodlecookie = true; // Cookies prevent caching, so don't use them
28 require_once('../../config.php');
30 $d = optional_param('d', 0, PARAM_INT); // database id
32 if ($data = get_record('data', 'id', $d)) {
33 header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
34 header('Expires: ' . gmdate("D, d M Y H:i:s", time() + $lifetime) . ' GMT');
35 header('Cache-control: max_age = '. $lifetime);
36 header('Pragma: ');
37 header('Content-type: text/css'); // Correct MIME type
39 echo $data->jstemplate;