XOOPS  2.6.0
index.php
Go to the documentation of this file.
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;
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);
34 
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 }
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 //
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
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 
119 // Instantiate and initialize JUpload : integration of the applet in your web site.
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>
$current_path
Definition: config.php:3
$_SESSION['RF']["verify"]
Definition: dialog.php:4
$_SERVER['REQUEST_URI']
$path
Definition: index.php:11
$i
Definition: index.php:14
$juploadPhpSupportClass
Definition: index.php:120
$max_cycles
Definition: index.php:13
$files
Definition: index.php:35
handle_uploaded_files($juploadPhpSupportClass, $files)
Definition: index.php:46
$ext
Definition: browse.php:87
$cycle
Definition: index.php:12
$java_upload
Definition: config.php:200
$appletParameters
Definition: index.php:67
fix_dirname($str)
Definition: utils.php:191
if((isset($_SERVER['PHP_AUTH_USER'])&&$_SERVER['PHP_AUTH_USER']!= '')&&$_SERVER['PHP_AUTH_USER']!= ''&&$_SERVER['PHP_AUTH_USER']!= '') $classParameters
Definition: index.php:102
$JAVAMaxSizeUpload
Definition: config.php:201