File: localpath.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 (55 lines) | stat: -rw-r--r-- 1,699 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
52
53
54
55
<?php    // $Id: localpath.php,v 1.1 2005/04/02 12:11:27 moodler Exp $

    require('../../../../config.php');
    require('../../lib.php');

    $pathname = optional_param('pathname', '');

    if ($pathname) {
        if (confirm_sesskey()) {
            set_user_preference('resource_localpath', $pathname);
        }
        ?>
        <script language="javascript" type="text/javascript">
        <!--
        window.close();
        -->
        </script>
        <?php
        exit;
    }

    print_header(get_string('localfilechoose', 'resource'));

    print_simple_box(get_string('localfilepath', 'resource', $CFG->wwwroot.'/user/edit.php?course='.SITEID), 'center');

    ?>
    <script language="javascript" type="text/javascript">
    <!--
    function set_value(txt) {
        if (txt.indexOf('/') > -1) {
            txt = txt.substring(0,txt.lastIndexOf('/'));
        } else if (txt.indexOf('\\') > -1) {
            txt = txt.substring(0,txt.lastIndexOf('\\'));
        }
        document.myform.pathname.value = txt;
        document.myform.submit();
    }
    -->
    </script>
    
    <br />
    <div align="center" class="form">
    <form name="myform" action="localpath.php" method="post">
    <input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>">
    <input type="hidden" name="pathname" value="">
    <input type="file" size="60" name="myfile"><br />
    <input type="button" value="<?php print_string('localfileselect','resource') ?>" 
           onClick="return set_value(document.myform.myfile.value)">
    <input type="button" value="<?php print_string('cancel') ?>" 
           onClick="window.close()">
    </form>
    </div>

    </body>
    </html>