1: <?php
2:
3: include '../config/config.php';
4: if(!$java_upload) die('forbidden');
5: if($_SESSION['RF']["verify"] !== "RESPONSIVEfilemanager") die('forbidden');
6:
7: //Let's load the 'interesting' stuff ... ;-)
8: include 'jupload.php';
9: include '../include/utils.php';
10:
11: $path=$current_path.$_GET['path'];
12: $cycle=true;
13: $max_cycles=50;
14: $i=0;
15: while($cycle && $i<$max_cycles){
16: $i++;
17: if($path==$current_path) $cycle=false;
18:
19: if(file_exists($path."config.php")){
20: require_once($path."config.php");
21: $cycle=false;
22: }
23: $path=fix_dirname($path)."/";
24: }
25:
26: $path="../".$current_path.$_GET['path'];
27:
28: if(strpos($_GET['path'],'../')!==FALSE || strpos($_GET['path'],'./')!==FALSE || strpos($_GET['path'],'/')===0) die ('path error');
29:
30: $path=str_replace(' ','~',$path);
31: ////////////////////////////////////////////////////////////////////////////////////////////////////////
32: /////////////// The user callback function, that can be called after upload ////////////////////////
33: ////////////////////////////////////////////////////////////////////////////////////////////////////////
34: /**
35: * This function will be called, once all files are uploaded, with the list of uploaded files as an argument.
36: *
37: * Condition to have this function called:
38: * - Have the applet parameter afterUploadURL unset in this file. This makes the applet use its default behavior, that is: afterUploadURL is
39: * the current web page, with the ?afterupload=1 parameter added.
40: * - Have the class parameter callbackAfterUploadManagement set to 'handle_uploaded_files', name of this callback. You can use any name you want,
41: * but the function must accept one unique parameter: the array that contains the file descriptions.
42: *
43: * @param $juploadPhpSupportClass The instance of the JUpload PHP class.
44: * @param $file The array wich contains info about all uploaded files.
45: */
46: function handle_uploaded_files($juploadPhpSupportClass, $files) {
47: return
48: "<P>We are in the 'handle_uploaded_files' callback function, in the index.php script. To avoid double coding, we "
49: . "just call the default behavior of the JUpload PHP class. Just replace this by your code...</P>"
50: . $juploadPhpSupportClass->defaultAfterUploadManagement();
51: ;
52:
53: }
54: ////////////////////////////////////////////////////////////////////////////////////////////////////////
55:
56:
57:
58: //First: the applet parameters
59: //
60: // Default value should work nice on most configuration. In this sample, we use some specific parameters, to show
61: // how to use this array.
62: // See comment for the parameters used on this demo page.
63: //
64: // You can use all applet parameters in this array.
65: // see all details http://jupload.sourceforge.net/howto-customization.html
66: //
67: $appletParameters = array(
68: //Default value is ... maximum size for a file on the current FS. 2G is problably too much already.
69: 'maxFileSize' => $JAVAMaxSizeUpload.'G',
70: //
71: //In the sourceforge project structure, the applet jar file is one folder below. Default
72: //configuration is ok, if wjhk.jupload.jar is in the same folder as the script containing this call.
73: 'archive' => 'wjhk.jupload.jar',
74: 'showLogWindow' => 'false',
75: 'width' => '100%',
76: 'height' =>'358px',
77: 'name' => 'No limit Uploader',
78: 'allowedFileExtensions' => implode('/',$ext),
79: //To manage, other jar files, like the ftp jar files if postURL is an FTP URL:
80: //'archive' => 'wjhk.jupload.jar,jakarta-commons-oro.jar,jakarta-commons-net.jar',
81: //
82: //Default afterUploadURL displays the list of uploaded files above the applet (in the <!--JUPLOAD_FILES--> markers, see below)
83: //You can use any page you want, to manage the uploaded files. Here is a sample, that also only shows the list of files.
84: 'afterUploadURL' => 'success.php?path='.$_GET['path'],
85: //
86: //This demo expects the md5sum to be sent by the applet. But the parameter is not mandatory
87: //This value should be set to false (or the line commented), for big files, as md5 calculation
88: //may be long (Note this must be string and *not* boolean true/false)
89: 'sendMD5Sum' => 'false',
90: //
91: 'debugLevel' => 0 // 100 disables redirect after upload, so we keep it below. This still gives a lot of information, in case of problem.
92: );
93:
94: // for htaccess protected folders
95: if((isset($_SERVER['PHP_AUTH_USER']) && $_SERVER['PHP_AUTH_USER'] != '') && $_SERVER['PHP_AUTH_USER'] != '' && $_SERVER['PHP_AUTH_USER'] != '')
96: {
97: $appletParameters['specificHeaders'] = 'Authorization: Basic '.base64_encode($_SERVER['PHP_AUTH_USER'].":".$_SERVER['PHP_AUTH_PW']);
98: }
99:
100: //
101: //Then: the jupload PHP class parameters
102: $classParameters = array(
103: //Files won't be stored on the server. Useful for first tests of the applet behavior ... and sourceforge demo site !
104: 'demo_mode' => false,
105: //
106: //Allow creation of subdirectories, when uploading several folders/files (drag and drop a folder on the applet to use it).
107: 'allow_subdirs' => true,
108: //
109: // The callbackAfterUploadManagement function will be called, once all files are uploaded, with the list
110: //of uploaded files as an argument. See the above sample, and change it according to your needs.
111: //'callbackAfterUploadManagement' => 'handle_uploaded_files',
112: //
113: //I work on windows. The default configuration is /var/tmp/jupload_test
114: 'destdir' => $path //Where to store the files on the web
115: //'errormail' => 'me@my.domain.org',
116: );
117:
118: ////////////////////////////////////////////////////////////////////////////////////////////////////////
119: // Instantiate and initialize JUpload : integration of the applet in your web site.
120: $juploadPhpSupportClass = new JUpload($appletParameters, $classParameters);
121: ////////////////////////////////////////////////////////////////////////////////////////////////////////
122:
123:
124:
125: //Then, a simple HTML page, for the demo
126: //
127: // "<!--JUPLOAD_FILES-->" is the tag where the list of uploaded files will be written.
128: // "<!--JUPLOAD_APPLET-->" is the place where the applet will be integrated, in the web page.
129: ?>
130: <html>
131: <head>
132: <!--JUPLOAD_JSCRIPT-->
133: <title>JUpload RESPONSIVE filemanager</title>
134: <style>
135: body{padding:0px; margin:0px;}
136: </style>
137: </head>
138: <body>
139: <div align="center"><!--JUPLOAD_FILES--></div>
140: <div align="center"><!--JUPLOAD_APPLET--></div>
141: </body>
142: </html>
143: