-
Notifications
You must be signed in to change notification settings - Fork 76
/
js_cacher.php
67 lines (50 loc) · 1.56 KB
/
js_cacher.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
// If the JavaScript doesn't need any input from PHP,
// this file should not be called.
define( '_ISVALID', true );
if( empty( $inc ) )
$inc = $_GET['inc'];
if( empty( $inc ) && ! empty( $_REQUEST['inc'] ) )
$inc = $_REQUEST['inc'];
$arinc = explode( '/', $inc );
// We only allow includes if they exist in our js or HTMLarea directories.
if( $arinc[0] != 'js' && $arinc[0] != 'htmlarea' )
return false;
if( is_dir( 'includes' ) )
$newinc = 'includes';
elseif( is_dir( '../includes' ) )
$newinc = '../includes';
// Get list of files in the js directory.
$myDirectory = opendir( "$newinc/$arinc[0]" );
while( $fileName = readdir( $myDirectory ) ) {
$fileList[] = $fileName;
}
closedir( $myDirectory );
require_once 'includes/translate.php';
require_once 'includes/config.php';
require_once 'includes/dbi4php.php';
require_once 'includes/formvars.php';
require_once 'includes/functions.php';
do_config();
require_once "includes/$user_inc";
require_once 'includes/access.php';
require_once 'includes/gradient.php';
require_once 'includes/validate.php';
header( 'Content-type: text/javascript' );
header( 'Cache-Control: Public' );
header( 'Pragma: Public' );
send_no_cache_header();
load_global_settings();
session_name(getSessionName());
@session_start();
$login = ( empty( $_SESSION['webcal_login'] )
? '__public__' : $_SESSION['webcal_login'] );
load_user_preferences();
foreach( $arinc as $a ) {
if( $a == 'true' || $a == 'false' )
break;
$newinc .= '/' . $a;
}
if( is_file( $newinc ) && in_array( $arinc[1], $fileList ) )
include_once $newinc;
?>