-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlocalfile.php
executable file
·50 lines (41 loc) · 1.45 KB
/
localfile.php
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
<?php // $Id: localfile.php,v 1.6.4.3 2008/12/10 06:30:25 dongsheng Exp $
require('../../../../config.php');
require('../../lib.php');
$choose = required_param('choose', PARAM_FILE);
require_login();
if (!$CFG->resource_allowlocalfiles) {
error('You cannot access this script');
}
print_header(get_string('localfilechoose', 'resource'));
print_simple_box(get_string('localfileinfo', 'resource'), 'center');
?>
<script type="text/javascript">
//<![CDATA[
function set_value(txt) {
if (txt.indexOf('/') > -1) {
path = txt.substring(txt.indexOf('/'),txt.length);
} else if (txt.indexOf('\\') > -1) {
path = txt.substring(txt.indexOf('\\'),txt.length);
} else {
window.close();
}
opener.document.getElementById('<?php echo $choose ?>').value = '<?php p(RESOURCE_LOCALPATH) ?>'+path;
window.close();
}
//]]>
</script>
<br />
<div class="form mdl-align">
<form id="myform">
<fieldset class="invisiblefieldset">
<input type="file" size="60" name="myfile" /><br />
<input type="button" value="<?php print_string('localfileselect','resource') ?>"
onClick="return set_value(getElementById('myform').myfile.value)">
<input type="button" value="<?php print_string('cancel') ?>"
onClick="window.close()">
</fieldset>
</form>
</div>
<?php
print_footer('empty');
?>