VPN-Management-GUI 2.0.3 porting start
This commit is contained in:
1
Modules/Downloads/include/.htaccess
Executable file
1
Modules/Downloads/include/.htaccess
Executable file
@@ -0,0 +1 @@
|
||||
deny from all
|
51
Modules/Downloads/include/error.php
Executable file
51
Modules/Downloads/include/error.php
Executable file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/*------------------------------------------------------------------------------
|
||||
The contents of this file are subject to the Mozilla Public License
|
||||
Version 1.1 (the "License"); you may not use this file except in
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is error.php, released on 2003-02-21.
|
||||
|
||||
The Initial Developer of the Original Code is The QuiX project.
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms
|
||||
of the GNU General Public License Version 2 or later (the "GPL"), in
|
||||
which case the provisions of the GPL are applicable instead of
|
||||
those above. If you wish to allow use of your version of this file only
|
||||
under the terms of the GPL and not to allow others to use
|
||||
your version of this file under the MPL, indicate your decision by
|
||||
deleting the provisions above and replace them with the notice and
|
||||
other provisions required by the GPL. If you do not delete
|
||||
the provisions above, a recipient may use your version of this file
|
||||
under either the MPL or the GPL."
|
||||
------------------------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------------------------
|
||||
Author: The QuiX project
|
||||
quix@free.fr
|
||||
http://www.quix.tk
|
||||
http://quixplorer.sourceforge.net
|
||||
|
||||
Comment:
|
||||
QuiXplorer Version 2.3
|
||||
Error Reporting File
|
||||
|
||||
Have Fun...
|
||||
------------------------------------------------------------------------------*/
|
||||
//------------------------------------------------------------------------------
|
||||
function show_error($error,$extra=NULL) { // show error-message
|
||||
show_header($GLOBALS["error_msg"]["error"]);
|
||||
echo "<CENTER><BR>".$GLOBALS["error_msg"]["error"].":"."<BR><BR>\n";
|
||||
echo $error."\n<BR><BR><A HREF=\"javascript:window.history.back()\">";
|
||||
echo $GLOBALS["error_msg"]["back"]."</A>";
|
||||
if($extra!=NULL) echo " - ".$extra;
|
||||
echo "<BR><BR></CENTER>\n";
|
||||
exit;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
?>
|
32
Modules/Downloads/include/fun_down.php
Executable file
32
Modules/Downloads/include/fun_down.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
//------------------------------------------------------------------------------
|
||||
function download_item($dir, $item) { // download file
|
||||
// Security Fix:
|
||||
$item=basename($item);
|
||||
|
||||
if(($GLOBALS["permissions"]&01)!=01) show_error($GLOBALS["error_msg"]["accessfunc"]);
|
||||
if(!get_is_file($dir,$item)) show_error($item.": ".$GLOBALS["error_msg"]["fileexist"]);
|
||||
if(!get_show_item($dir, $item)) show_error($item.": ".$GLOBALS["error_msg"]["accessfile"]);
|
||||
|
||||
$abs_item = get_abs_item($dir,$item);
|
||||
$browser=id_browser();
|
||||
header('Content-Type: '.(($browser=='IE' || $browser=='OPERA')?
|
||||
'application/octetstream':'application/octet-stream'));
|
||||
header('Expires: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
header('Content-Length: '.filesize($abs_item));
|
||||
if($browser=='IE') {
|
||||
header('Content-Disposition: attachment; filename="'.$item.'"');
|
||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
header('Pragma: public');
|
||||
} else {
|
||||
header('Content-Disposition: attachment; filename="'.$item.'"');
|
||||
header('Cache-Control: no-cache, must-revalidate');
|
||||
header('Pragma: no-cache');
|
||||
}
|
||||
|
||||
@readfile($abs_item);
|
||||
exit;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
?>
|
259
Modules/Downloads/include/fun_extra.php
Executable file
259
Modules/Downloads/include/fun_extra.php
Executable file
@@ -0,0 +1,259 @@
|
||||
<?php
|
||||
//------------------------------------------------------------------------------
|
||||
// THESE ARE NUMEROUS HELPER FUNCTIONS FOR THE OTHER INCLUDE FILES
|
||||
//------------------------------------------------------------------------------
|
||||
function make_link($_action,$_dir,$_item=NULL,$_order=NULL,$_srt=NULL,$_lang=NULL) {
|
||||
// make link to next page
|
||||
if($_action=="" || $_action==NULL) $_action="list";
|
||||
if($_dir=="") $_dir=NULL;
|
||||
if($_item=="") $_item=NULL;
|
||||
if($_order==NULL) $_order=$GLOBALS["order"];
|
||||
if($_srt==NULL) $_srt=$GLOBALS["srt"];
|
||||
if($_lang==NULL) $_lang=(isset($GLOBALS["lang"])?$GLOBALS["lang"]:NULL);
|
||||
|
||||
if($_action != "download")
|
||||
{
|
||||
$link=$GLOBALS["script_name"]."&uebergabe=".$_action;
|
||||
}
|
||||
else
|
||||
{
|
||||
$link="/Modules/Downloads/getdown.php?action=".$_action;
|
||||
}
|
||||
if($_dir!=NULL) $link.="&dir=".urlencode($_dir);
|
||||
if($_item!=NULL) $link.="&item=".urlencode($_item);
|
||||
if($_order!=NULL) $link.="&order=".$_order;
|
||||
if($_srt!=NULL) $link.="&srt=".$_srt;
|
||||
if($_lang!=NULL) $link.="&lang=".$_lang;
|
||||
|
||||
return $link;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
function get_abs_dir($dir) { // get absolute path
|
||||
$abs_dir=$GLOBALS["home_dir"];
|
||||
if($dir!="") $abs_dir.="/".$dir;
|
||||
return $abs_dir;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
function get_abs_item($dir, $item) { // get absolute file+path
|
||||
return get_abs_dir($dir)."/".$item;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
function get_rel_item($dir,$item) { // get file relative from home
|
||||
if($dir!="") return $dir."/".$item;
|
||||
else return $item;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
function get_is_file($dir, $item) { // can this file be edited?
|
||||
return @is_file(get_abs_item($dir,$item));
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
function get_is_dir($dir, $item) { // is this a directory?
|
||||
return @is_dir(get_abs_item($dir,$item));
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
function parse_file_type($dir,$item) { // parsed file type (d / l / -)
|
||||
$abs_item = get_abs_item($dir, $item);
|
||||
if(@is_dir($abs_item)) return "d";
|
||||
if(@is_link($abs_item)) return "l";
|
||||
return "-";
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
function get_file_perms($dir,$item) { // file permissions
|
||||
return @decoct(@fileperms(get_abs_item($dir,$item)) & 0777);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
function parse_file_perms($mode) { // parsed file permisions
|
||||
if(strlen($mode)<3) return "---------";
|
||||
$parsed_mode="";
|
||||
for($i=0;$i<3;$i++) {
|
||||
// read
|
||||
if(($mode{$i} & 04)) $parsed_mode .= "r";
|
||||
else $parsed_mode .= "-";
|
||||
// write
|
||||
if(($mode{$i} & 02)) $parsed_mode .= "w";
|
||||
else $parsed_mode .= "-";
|
||||
// execute
|
||||
if(($mode{$i} & 01)) $parsed_mode .= "x";
|
||||
else $parsed_mode .= "-";
|
||||
}
|
||||
return $parsed_mode;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
function get_file_size($dir, $item) { // file size
|
||||
return @filesize(get_abs_item($dir, $item));
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
function parse_file_size($size) { // parsed file size
|
||||
if($size >= 1073741824) {
|
||||
$size = round($size / 1073741824 * 100) / 100 . " GB";
|
||||
} elseif($size >= 1048576) {
|
||||
$size = round($size / 1048576 * 100) / 100 . " MB";
|
||||
} elseif($size >= 1024) {
|
||||
$size = round($size / 1024 * 100) / 100 . " KB";
|
||||
} else $size = $size . " Bytes";
|
||||
if($size==0) $size="-";
|
||||
|
||||
return $size;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
function get_file_date($dir, $item) { // file date
|
||||
return @filemtime(get_abs_item($dir, $item));
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
function parse_file_date($date) { // parsed file date
|
||||
return @date($GLOBALS["date_fmt"],$date);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
function get_is_image($dir, $item) { // is this file an image?
|
||||
if(!get_is_file($dir, $item)) return false;
|
||||
return @eregi($GLOBALS["images_ext"], $item);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
function get_is_editable($dir, $item) { // is this file editable?
|
||||
if(!get_is_file($dir, $item)) return false;
|
||||
foreach($GLOBALS["editable_ext"] as $pat) if(@eregi($pat,$item)) return true;
|
||||
return false;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
function get_mime_type($dir, $item, $query) { // get file's mimetype
|
||||
if(get_is_dir($dir, $item)) { // directory
|
||||
$mime_type = $GLOBALS["super_mimes"]["dir"][0];
|
||||
$image = $GLOBALS["super_mimes"]["dir"][1];
|
||||
|
||||
if($query=="img") return $image;
|
||||
else return $mime_type;
|
||||
}
|
||||
// mime_type
|
||||
foreach($GLOBALS["used_mime_types"] as $mime) {
|
||||
list($desc,$img,$ext) = $mime;
|
||||
if(@eregi($ext,$item)) {
|
||||
$mime_type = $desc;
|
||||
$image = $img;
|
||||
if($query=="img") return $image;
|
||||
else return $mime_type;
|
||||
}
|
||||
}
|
||||
|
||||
if((function_exists("is_executable") &&
|
||||
@is_executable(get_abs_item($dir,$item))) ||
|
||||
@eregi($GLOBALS["super_mimes"]["exe"][2],$item))
|
||||
{ // executable
|
||||
$mime_type = $GLOBALS["super_mimes"]["exe"][0];
|
||||
$image = $GLOBALS["super_mimes"]["exe"][1];
|
||||
} else { // unknown file
|
||||
$mime_type = $GLOBALS["super_mimes"]["file"][0];
|
||||
$image = $GLOBALS["super_mimes"]["file"][1];
|
||||
}
|
||||
|
||||
if($query=="img") return $image;
|
||||
else return $mime_type;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
function get_show_item($dir, $item) { // show this file?
|
||||
if($item == "." || $item == ".." ||
|
||||
(substr($item,0,1)=="." && $GLOBALS["show_hidden"]==false)) return false;
|
||||
|
||||
if($GLOBALS["no_access"]!="" && @eregi($GLOBALS["no_access"],$item)) return false;
|
||||
|
||||
if($GLOBALS["show_hidden"]==false) {
|
||||
$dirs=explode("/",$dir);
|
||||
foreach($dirs as $i) if(substr($i,0,1)==".") return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
function copy_dir($source,$dest) { // copy dir
|
||||
$ok = true;
|
||||
|
||||
if(!@mkdir($dest,0777)) return false;
|
||||
if(($handle=@opendir($source))===false) show_error(basename($source).": ".$GLOBALS["error_msg"]["opendir"]);
|
||||
|
||||
while(($file=readdir($handle))!==false) {
|
||||
if(($file==".." || $file==".")) continue;
|
||||
|
||||
$new_source = $source."/".$file;
|
||||
$new_dest = $dest."/".$file;
|
||||
if(@is_dir($new_source)) {
|
||||
$ok=copy_dir($new_source,$new_dest);
|
||||
} else {
|
||||
$ok=@copy($new_source,$new_dest);
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
return $ok;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
function remove($item) { // remove file / dir
|
||||
$ok = true;
|
||||
if(@is_link($item) || @is_file($item)) $ok=@unlink($item);
|
||||
elseif(@is_dir($item)) {
|
||||
if(($handle=@opendir($item))===false) show_error(basename($item).": ".$GLOBALS["error_msg"]["opendir"]);
|
||||
|
||||
while(($file=readdir($handle))!==false) {
|
||||
if(($file==".." || $file==".")) continue;
|
||||
|
||||
$new_item = $item."/".$file;
|
||||
if(!@file_exists($new_item)) show_error(basename($item).": ".$GLOBALS["error_msg"]["readdir"]);
|
||||
//if(!get_show_item($item, $new_item)) continue;
|
||||
|
||||
if(@is_dir($new_item)) {
|
||||
$ok=remove($new_item);
|
||||
} else {
|
||||
$ok=@unlink($new_item);
|
||||
}
|
||||
}
|
||||
|
||||
closedir($handle);
|
||||
$ok=@rmdir($item);
|
||||
}
|
||||
return $ok;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
function get_max_file_size() { // get php max_upload_file_size
|
||||
$max = get_cfg_var("upload_max_filesize");
|
||||
if(@eregi("G$",$max)) {
|
||||
$max = substr($max,0,-1);
|
||||
$max = round($max*1073741824);
|
||||
} elseif(@eregi("M$",$max)) {
|
||||
$max = substr($max,0,-1);
|
||||
$max = round($max*1048576);
|
||||
} elseif(@eregi("K$",$max)) {
|
||||
$max = substr($max,0,-1);
|
||||
$max = round($max*1024);
|
||||
}
|
||||
|
||||
return $max;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
function down_home($abs_dir) { // dir deeper than home?
|
||||
$real_home = @realpath($GLOBALS["home_dir"]);
|
||||
$real_dir = @realpath($abs_dir);
|
||||
|
||||
if($real_home===false || $real_dir===false) {
|
||||
if(@eregi("\\.\\.",$abs_dir)) return false;
|
||||
} else if(strcmp($real_home,@substr($real_dir,0,strlen($real_home)))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
function id_browser() {
|
||||
$browser=$GLOBALS['__SERVER']['HTTP_USER_AGENT'];
|
||||
|
||||
if(ereg('Opera(/| )([0-9].[0-9]{1,2})', $browser)) {
|
||||
return 'OPERA';
|
||||
} else if(ereg('MSIE ([0-9].[0-9]{1,2})', $browser)) {
|
||||
return 'IE';
|
||||
} else if(ereg('OmniWeb/([0-9].[0-9]{1,2})', $browser)) {
|
||||
return 'OMNIWEB';
|
||||
} else if(ereg('(Konqueror/)(.*)', $browser)) {
|
||||
return 'KONQUEROR';
|
||||
} else if(ereg('Mozilla/([0-9].[0-9]{1,2})', $browser)) {
|
||||
return 'MOZILLA';
|
||||
} else {
|
||||
return 'OTHER';
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
?>
|
241
Modules/Downloads/include/fun_list.php
Executable file
241
Modules/Downloads/include/fun_list.php
Executable file
@@ -0,0 +1,241 @@
|
||||
<?php
|
||||
|
||||
// HELPER FUNCTIONS (USED BY MAIN FUNCTION 'list_dir', SEE BOTTOM)
|
||||
function make_list($_list1, $_list2) { // make list of files
|
||||
$list = array();
|
||||
|
||||
if($GLOBALS["srt"]=="yes") {
|
||||
$list1 = $_list1;
|
||||
$list2 = $_list2;
|
||||
} else {
|
||||
$list1 = $_list2;
|
||||
$list2 = $_list1;
|
||||
}
|
||||
|
||||
if(is_array($list1)) {
|
||||
while (list($key, $val) = each($list1)) {
|
||||
$list[$key] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
if(is_array($list2)) {
|
||||
while (list($key, $val) = each($list2)) {
|
||||
$list[$key] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
function make_tables($dir, &$dir_list, &$file_list, &$tot_file_size, &$num_items)
|
||||
{ // make table of files in dir
|
||||
// make tables & place results in reference-variables passed to function
|
||||
// also 'return' total filesize & total number of items
|
||||
|
||||
$tot_file_size = $num_items = 0;
|
||||
|
||||
// Open directory
|
||||
$handle = @opendir(get_abs_dir($dir));
|
||||
if($handle===false) show_error($dir.": ".$GLOBALS["error_msg"]["opendir"]);
|
||||
|
||||
// Read directory
|
||||
while(($new_item = readdir($handle))!==false) {
|
||||
$abs_new_item = get_abs_item($dir, $new_item);
|
||||
|
||||
if(!@file_exists($abs_new_item)) show_error($dir.": ".$GLOBALS["error_msg"]["readdir"]);
|
||||
if(!get_show_item($dir, $new_item)) continue;
|
||||
|
||||
$new_file_size = filesize($abs_new_item);
|
||||
$tot_file_size += $new_file_size;
|
||||
$num_items++;
|
||||
|
||||
if(get_is_dir($dir, $new_item)) {
|
||||
if($GLOBALS["order"]=="mod") {
|
||||
$dir_list[$new_item] =
|
||||
@filemtime($abs_new_item);
|
||||
} else { // order == "size", "type" or "name"
|
||||
$dir_list[$new_item] = $new_item;
|
||||
}
|
||||
} else {
|
||||
if($GLOBALS["order"]=="size") {
|
||||
$file_list[$new_item] = $new_file_size;
|
||||
} elseif($GLOBALS["order"]=="mod") {
|
||||
$file_list[$new_item] =
|
||||
@filemtime($abs_new_item);
|
||||
} elseif($GLOBALS["order"]=="type") {
|
||||
$file_list[$new_item] =
|
||||
get_mime_type($dir, $new_item, "type");
|
||||
} else { // order == "name"
|
||||
$file_list[$new_item] = $new_item;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
|
||||
|
||||
// sort
|
||||
if(is_array($dir_list)) {
|
||||
if($GLOBALS["order"]=="mod") {
|
||||
if($GLOBALS["srt"]=="yes") arsort($dir_list);
|
||||
else asort($dir_list);
|
||||
} else { // order == "size", "type" or "name"
|
||||
if($GLOBALS["srt"]=="yes") ksort($dir_list);
|
||||
else krsort($dir_list);
|
||||
}
|
||||
}
|
||||
|
||||
// sort
|
||||
if(is_array($file_list)) {
|
||||
if($GLOBALS["order"]=="mod") {
|
||||
if($GLOBALS["srt"]=="yes") arsort($file_list);
|
||||
else asort($file_list);
|
||||
} elseif($GLOBALS["order"]=="size" || $GLOBALS["order"]=="type") {
|
||||
if($GLOBALS["srt"]=="yes") asort($file_list);
|
||||
else arsort($file_list);
|
||||
} else { // order == "name"
|
||||
if($GLOBALS["srt"]=="yes") ksort($file_list);
|
||||
else krsort($file_list);
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
function print_table($dir, $list, $allow) { // print table of files
|
||||
if(!is_array($list)) return;
|
||||
|
||||
while(list($item,) = each($list)){
|
||||
// link to dir / file
|
||||
$abs_item=get_abs_item($dir,$item);
|
||||
$target="";
|
||||
//$extra="";
|
||||
//if(is_link($abs_item)) $extra=" -> ".@readlink($abs_item);
|
||||
if(is_dir($abs_item)) {
|
||||
$link = make_link("list",get_rel_item($dir, $item),NULL);
|
||||
} else { //if(get_is_editable($dir,$item) || get_is_image($dir,$item)) {
|
||||
$link = make_link("download",$dir,$item);
|
||||
$target = "_blank";
|
||||
} //else $link = "";
|
||||
|
||||
echo "<TR class=\"rowdata\">\n";
|
||||
// Icon + Link
|
||||
echo "<TD nowrap>";
|
||||
/*if($link!="") */ echo"<A HREF=\"".$link."\">";
|
||||
//else echo "<A>";
|
||||
echo "<IMG border=\"0\" width=\"16\" height=\"16\" ";
|
||||
echo "align=\"ABSMIDDLE\" src=\"/Modules/Downloads/img/".get_mime_type($dir, $item, "img")."\" ALT=\"\"> ";
|
||||
$s_item=$item; if(strlen($s_item)>50) $s_item=substr($s_item,0,47)."...";
|
||||
echo htmlspecialchars($s_item)."</A></TD>\n"; // ...$extra...
|
||||
// Size
|
||||
echo "<TD>".parse_file_size(get_file_size($dir,$item))."</TD>\n";
|
||||
// Type
|
||||
echo "<TD>".get_mime_type($dir, $item, "type")."</TD>\n";
|
||||
// Modified
|
||||
echo "<TD>".parse_file_date(get_file_date($dir,$item))."</TD>\n";
|
||||
// Permissions
|
||||
// echo "<TD>";
|
||||
|
||||
// echo parse_file_type($dir,$item).parse_file_perms(get_file_perms($dir,$item));
|
||||
// if($allow) echo "</A>";
|
||||
// echo "</TD>\n";
|
||||
// Actions
|
||||
echo "<TD>\n<TABLE>\n";
|
||||
// DOWNLOAD
|
||||
if(get_is_file($dir,$item)) {
|
||||
if($allow) {
|
||||
echo "<TD><A HREF=\"".make_link("download",$dir,$item)."\">";
|
||||
echo "<IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" ";
|
||||
echo "src=\"/Modules/Downloads/img/_download.gif\" ALT=\"".$GLOBALS["messages"]["downlink"];
|
||||
echo "\" TITLE=\"".$GLOBALS["messages"]["downlink"]."\"></A></TD>\n";
|
||||
} else if(!$allow) {
|
||||
echo "<TD><IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" ";
|
||||
echo "src=\"/Modules/Downloads/img/_download_.gif\" ALT=\"".$GLOBALS["messages"]["downlink"];
|
||||
echo "\" TITLE=\"".$GLOBALS["messages"]["downlink"]."\"></TD>\n";
|
||||
}
|
||||
} else {
|
||||
echo "<TD><IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" ";
|
||||
echo "src=\"/Modules/Downloads/img/_.gif\" ALT=\"\"></TD>\n";
|
||||
}
|
||||
echo "</TABLE>\n</TD></TR>\n";
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// MAIN FUNCTION
|
||||
function list_dir($dir) { // list directory contents
|
||||
$allow=($GLOBALS["permissions"]&01)==01;
|
||||
$admin=((($GLOBALS["permissions"]&04)==04) || (($GLOBALS["permissions"]&02)==02));
|
||||
|
||||
$dir_up = dirname($dir);
|
||||
if($dir_up==".") $dir_up = "";
|
||||
|
||||
if(!get_show_item($dir_up,basename($dir))) show_error($dir." : ".$GLOBALS["error_msg"]["accessdir"]);
|
||||
|
||||
// make file & dir tables, & get total filesize & number of items
|
||||
make_tables($dir, $dir_list, $file_list, $tot_file_size, $num_items);
|
||||
|
||||
$s_dir=$dir; if(strlen($s_dir)>50) $s_dir="...".substr($s_dir,-47);
|
||||
echo "Directory: /".get_rel_item("",$s_dir);
|
||||
|
||||
// Javascript functions:
|
||||
include $_SERVER["DOCUMENT_ROOT"]."/Modules/Downloads/include/javascript.php";
|
||||
|
||||
|
||||
// Toolbar
|
||||
echo "<BR><TABLE width=\"95%\"><TR><TD><TABLE><TR>\n";
|
||||
|
||||
// PARENT DIR
|
||||
echo "<TD><A HREF=\"".make_link("list",$dir_up,NULL)."\">";
|
||||
echo "<IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" src=\"/Modules/Downloads/img/_up.gif\" ";
|
||||
echo "ALT=\"".$GLOBALS["messages"]["uplink"]."\" TITLE=\"".$GLOBALS["messages"]["uplink"]."\"></A></TD>\n";
|
||||
// HOME DIR
|
||||
echo "<TD><A HREF=\"".make_link("list",NULL,NULL)."\">";
|
||||
echo "<IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" src=\"/Modules/Downloads/img/_home.gif\" ";
|
||||
echo "ALT=\"".$GLOBALS["messages"]["homelink"]."\" TITLE=\"".$GLOBALS["messages"]["homelink"]."\"></A></TD>\n";
|
||||
// RELOAD
|
||||
echo "<TD><A HREF=\"javascript:location.reload();\"><IMG border=\"0\" width=\"16\" height=\"16\" ";
|
||||
echo "align=\"ABSMIDDLE\" src=\"/Modules/Downloads/img/_refresh.gif\" ALT=\"".$GLOBALS["messages"]["reloadlink"];
|
||||
echo "\" TITLE=\"".$GLOBALS["messages"]["reloadlink"]."\"></A></TD>\n";
|
||||
|
||||
echo "</TR></TABLE></TD>\n";
|
||||
|
||||
echo "</TR></TABLE>\n";
|
||||
|
||||
// End Toolbar
|
||||
|
||||
|
||||
// Begin Table + Form for checkboxes
|
||||
echo"<TABLE WIDTH=\"95%\"><FORM name=\"selform\" method=\"POST\" action=\"".make_link("post",$dir,NULL)."\">\n";
|
||||
|
||||
// Table Header
|
||||
echo "<TR><TD colspan=\"5\"><HR></TD></TR><TR>\n";
|
||||
echo "<TD WIDTH=\"70%\" class=\"header\"><B>\n";
|
||||
echo $GLOBALS["messages"]["nameheader"];
|
||||
echo "</B></TD>\n<TD WIDTH=\"10%\" class=\"header\"><B>";
|
||||
echo $GLOBALS["messages"]["sizeheader"];
|
||||
echo "</B></TD>\n<TD WIDTH=\"10%\" class=\"header\"><B>";
|
||||
echo $GLOBALS["messages"]["typeheader"];
|
||||
echo "</B></TD>\n<TD WIDTH=\"10%\" class=\"header\"><B>";
|
||||
echo $GLOBALS["messages"]["modifheader"];
|
||||
echo "</B></TD>\n";
|
||||
echo "<TD ALIGN=\"right\" WIDTH=\"6%\" class=\"header\"><B>".$GLOBALS["messages"]["actionheader"]."</B></TD></TR>\n";
|
||||
echo "<TR><TD colspan=\"5\"><HR></TD></TR>\n";
|
||||
|
||||
// make & print Table using lists
|
||||
print_table($dir, make_list($dir_list, $file_list), $allow);
|
||||
|
||||
// print number of items & total filesize
|
||||
echo "<TR><TD colspan=\"5\"><HR></TD></TR><TR>\n";
|
||||
echo "<TD WIDTH=\"70%\" class=\"header\">".$num_items." ".$GLOBALS["messages"]["miscitems"]." (";
|
||||
if(function_exists("disk_free_space")) {
|
||||
$free=parse_file_size(disk_free_space(get_abs_dir($dir)));
|
||||
} elseif(function_exists("diskfreespace")) {
|
||||
$free=parse_file_size(diskfreespace(get_abs_dir($dir)));
|
||||
} else $free="?";
|
||||
// echo "Total: ".parse_file_size(disk_total_space(get_abs_dir($dir))).", ";
|
||||
echo $GLOBALS["messages"]["miscfree"].": ".$free.")</TD>\n";
|
||||
echo "<TD WIDTH=\"30%\" class=\"header\">".parse_file_size($tot_file_size)."</TD>\n";
|
||||
for($i=0;$i<3;++$i) echo"<TD class=\"header\"></TD>";
|
||||
echo "</TR>\n<TR><TD colspan=\"5\"><HR></TD></TR></FORM></TABLE>\n";
|
||||
|
||||
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
?>
|
67
Modules/Downloads/include/init.php
Executable file
67
Modules/Downloads/include/init.php
Executable file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
//------------------------------------------------------------------------------
|
||||
// Vars
|
||||
if(isset($_SERVER)) {
|
||||
$GLOBALS['__GET'] =&$_GET;
|
||||
$GLOBALS['__POST'] =&$_POST;
|
||||
$GLOBALS['__SERVER'] =&$_SERVER;
|
||||
$GLOBALS['__FILES'] =&$_FILES;
|
||||
} elseif(isset($HTTP_SERVER_VARS)) {
|
||||
$GLOBALS['__GET'] =&$HTTP_GET_VARS;
|
||||
$GLOBALS['__POST'] =&$HTTP_POST_VARS;
|
||||
$GLOBALS['__SERVER'] =&$HTTP_SERVER_VARS;
|
||||
$GLOBALS['__FILES'] =&$HTTP_POST_FILES;
|
||||
} else {
|
||||
die("<B>ERROR: Your PHP version is too old</B><BR>".
|
||||
"You need at least PHP 4.0.0, preferably PHP 4.3.1 or higher.");
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// Get Action
|
||||
$GLOBALS['__GET']["action"] = $GLOBALS['__GET']["uebergabe"];
|
||||
|
||||
if(isset($GLOBALS['__GET']["action"])) $GLOBALS["action"]=$GLOBALS['__GET']["action"];
|
||||
else $GLOBALS["action"]="list";
|
||||
if($GLOBALS["action"]=="post" && isset($GLOBALS['__POST']["do_action"])) {
|
||||
$GLOBALS["action"]=$GLOBALS['__POST']["do_action"];
|
||||
}
|
||||
if($GLOBALS["action"]=="") $GLOBALS["action"]="list";
|
||||
$GLOBALS["action"]=stripslashes($GLOBALS["action"]);
|
||||
// Default Dir
|
||||
if(isset($GLOBALS['__GET']["dir"])) $GLOBALS["dir"]=stripslashes($GLOBALS['__GET']["dir"]);
|
||||
else $GLOBALS["dir"]="";
|
||||
if($GLOBALS["dir"]==".") $GLOBALS["dir"]=="";
|
||||
// Get Item
|
||||
if(isset($GLOBALS['__GET']["item"])) $GLOBALS["item"]=stripslashes($GLOBALS['__GET']["item"]);
|
||||
else $GLOBALS["item"]="";
|
||||
// Get Sort
|
||||
if(isset($GLOBALS['__GET']["order"])) $GLOBALS["order"]=stripslashes($GLOBALS['__GET']["order"]);
|
||||
else $GLOBALS["order"]="name";
|
||||
if($GLOBALS["order"]=="") $GLOBALS["order"]=="name";
|
||||
// Get Sortorder (yes==up)
|
||||
if(isset($GLOBALS['__GET']["srt"])) $GLOBALS["srt"]=stripslashes($GLOBALS['__GET']["srt"]);
|
||||
else $GLOBALS["srt"]="yes";
|
||||
if($GLOBALS["srt"]=="") $GLOBALS["srt"]=="yes";
|
||||
// Get Language
|
||||
if(isset($GLOBALS['__GET']["lang"])) $GLOBALS["lang"]=$GLOBALS['__GET']["lang"];
|
||||
elseif(isset($GLOBALS['__POST']["lang"])) $GLOBALS["lang"]=$GLOBALS['__POST']["lang"];
|
||||
//------------------------------------------------------------------------------
|
||||
// Necessary files
|
||||
ob_start(); // prevent unwanted output
|
||||
require $_SERVER["DOCUMENT_ROOT"]."/Modules/Downloads/config/conf.php";
|
||||
if(isset($GLOBALS["lang"])) $GLOBALS["language"]=$GLOBALS["lang"];
|
||||
require $_SERVER["DOCUMENT_ROOT"]."/Modules/Downloads/lang/".$GLOBALS["language"].".php";
|
||||
require $_SERVER["DOCUMENT_ROOT"]."/Modules/Downloads/lang/".$GLOBALS["language"]."_mimes.php";
|
||||
require $_SERVER["DOCUMENT_ROOT"]."/Modules/Downloads/config/mimes.php";
|
||||
require $_SERVER["DOCUMENT_ROOT"]."/Modules/Downloads/include/fun_extra.php";
|
||||
require $_SERVER["DOCUMENT_ROOT"]."/Modules/Downloads/include/error.php";
|
||||
ob_end_clean(); // get rid of cached unwanted output
|
||||
//------------------------------------------------------------------------------
|
||||
$abs_dir=get_abs_dir($GLOBALS["dir"]);
|
||||
if(!@file_exists($GLOBALS["home_dir"])) {
|
||||
$extra=NULL;
|
||||
show_error($GLOBALS["error_msg"]["home"],$extra);
|
||||
}
|
||||
if(!down_home($abs_dir)) show_error($GLOBALS["dir"]." : ".$GLOBALS["error_msg"]["abovehome"]);
|
||||
if(!is_dir($abs_dir)) show_error($GLOBALS["dir"]." : ".$GLOBALS["error_msg"]["direxist"]);
|
||||
//------------------------------------------------------------------------------
|
||||
?>
|
137
Modules/Downloads/include/javascript.php
Executable file
137
Modules/Downloads/include/javascript.php
Executable file
@@ -0,0 +1,137 @@
|
||||
<script language="JavaScript1.2" type="text/javascript">
|
||||
<!--
|
||||
// Checkboxes
|
||||
function Toggle(e) {
|
||||
if(e.checked) {
|
||||
Highlight(e);
|
||||
document.selform.toggleAllC.checked = AllChecked();
|
||||
} else {
|
||||
UnHighlight(e);
|
||||
document.selform.toggleAllC.checked = false;
|
||||
}
|
||||
}
|
||||
|
||||
function ToggleAll(e) {
|
||||
if(e.checked) CheckAll();
|
||||
else ClearAll();
|
||||
}
|
||||
|
||||
function CheckAll() {
|
||||
var ml = document.selform;
|
||||
var len = ml.elements.length;
|
||||
for(var i=0; i<len; ++i) {
|
||||
var e = ml.elements[i];
|
||||
if(e.name == "selitems[]") {
|
||||
e.checked = true;
|
||||
Highlight(e);
|
||||
}
|
||||
}
|
||||
ml.toggleAllC.checked = true;
|
||||
}
|
||||
|
||||
function ClearAll() {
|
||||
var ml = document.selform;
|
||||
var len = ml.elements.length;
|
||||
for (var i=0; i<len; ++i) {
|
||||
var e = ml.elements[i];
|
||||
if(e.name == "selitems[]") {
|
||||
e.checked = false;
|
||||
UnHighlight(e);
|
||||
}
|
||||
}
|
||||
ml.toggleAllC.checked = false;
|
||||
}
|
||||
|
||||
function AllChecked() {
|
||||
ml = document.selform;
|
||||
len = ml.elements.length;
|
||||
for(var i=0; i<len; ++i) {
|
||||
if(ml.elements[i].name == "selitems[]" && !ml.elements[i].checked) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function NumChecked() {
|
||||
ml = document.selform;
|
||||
len = ml.elements.length;
|
||||
num = 0;
|
||||
for(var i=0; i<len; ++i) {
|
||||
if(ml.elements[i].name == "selitems[]" && ml.elements[i].checked) ++num;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
|
||||
// Row highlight
|
||||
|
||||
function Highlight(e) {
|
||||
var r = null;
|
||||
if(e.parentNode && e.parentNode.parentNode) {
|
||||
r = e.parentNode.parentNode;
|
||||
} else if(e.parentElement && e.parentElement.parentElement) {
|
||||
r = e.parentElement.parentElement;
|
||||
}
|
||||
if(r && r.className=="rowdata") {
|
||||
r.className = "rowdatasel";
|
||||
}
|
||||
}
|
||||
|
||||
function UnHighlight(e) {
|
||||
var r = null;
|
||||
if(e.parentNode && e.parentNode.parentNode) {
|
||||
r = e.parentNode.parentNode;
|
||||
} else if (e.parentElement && e.parentElement.parentElement) {
|
||||
r = e.parentElement.parentElement;
|
||||
}
|
||||
if(r && r.className=="rowdatasel") {
|
||||
r.className = "rowdata";
|
||||
}
|
||||
}
|
||||
|
||||
<?php if($allow) { ?>
|
||||
|
||||
// Copy / Move / Delete
|
||||
|
||||
function Copy() {
|
||||
if(NumChecked()==0) {
|
||||
alert("<?php echo $GLOBALS["error_msg"]["miscselitems"]; ?>");
|
||||
return;
|
||||
}
|
||||
document.selform.do_action.value = "copy";
|
||||
document.selform.submit();
|
||||
}
|
||||
|
||||
function Move() {
|
||||
if(NumChecked()==0) {
|
||||
alert("<?php echo $GLOBALS["error_msg"]["miscselitems"]; ?>");
|
||||
return;
|
||||
}
|
||||
document.selform.do_action.value = "move";
|
||||
document.selform.submit();
|
||||
}
|
||||
|
||||
function Delete() {
|
||||
num=NumChecked();
|
||||
if(num==0) {
|
||||
alert("<?php echo $GLOBALS["error_msg"]["miscselitems"]; ?>");
|
||||
return;
|
||||
}
|
||||
if(confirm("<?php echo $GLOBALS["error_msg"]["miscdelitems"]; ?>")) {
|
||||
document.selform.do_action.value = "delete";
|
||||
document.selform.submit();
|
||||
}
|
||||
}
|
||||
|
||||
function Archive() {
|
||||
if(NumChecked()==0) {
|
||||
alert("<?php echo $GLOBALS["error_msg"]["miscselitems"]; ?>");
|
||||
return;
|
||||
}
|
||||
document.selform.do_action.value = "arch";
|
||||
document.selform.submit();
|
||||
}
|
||||
|
||||
<?php } ?>
|
||||
|
||||
// -->
|
||||
</script>
|
Reference in New Issue
Block a user