hallo!
ich suche ein Plugin oder Modul welche mir erlaubt den Downloadordner zu scannen und die dateien in massen zu aktivieren?
denn jede datei einzeln zu uppen ist zu aufwendig.
verwendete ilchClan Version: 1.1
Hier kann eine Notiz zum Merk-Eintrag hinzugefügt werden (optional)
Geschlossen |
<?php /** * TWG Flash uploader 2.7.3 * * Copyright (c) 2004-2008 TinyWebGallery * written by Michael Dempfle * * * This file does the following: * - Returns the file list to the flash. * - Create dirs * - Rename dirs * - Delete dirs * - Change dirs * - Check what is possible in the current directory (permissions ...) * * All files from a directory are read and added to the return parameter * &files. The first parameter is the size of the listing! The format is up to you * The current format is e.g. "3 files (234k)" The dirtext parameter is added to * the title bar of the flash * * Authentification is done by the session $_SESSION["TFU_LOGIN"]. You can set * this in the tfu_config.php or implement your own way! */ define('_VALID_TWG', '42'); if (isset($_GET['TFUSESSID'])) { // this is a workaround if you set php_flag session.use_trans_sid=off + a workaround for some servers that don't handle sessions correctly if you open 2 instances of TFU session_id($_GET['TFUSESSID']); } session_start(); include 'tfu_helper.php'; restore_temp_session(); if (isset($_SESSION['TFU_LOGIN']) && isset($_SESSION['TFU_RN']) && isset($_GET['tfu_rn']) && $_SESSION['TFU_RN'] == parseInputParameter($_GET['tfu_rn'])) { $dir = getCurrentDir(); $status = ""; // this is the status flag I use to check if the actions where sucessfull! if (isset($_GET['getTreeXML'])) { echo get_tree_xml(); return; } if (isset($_GET['createdir'])) { // creates a directory if ($_SESSION['TFU_CREATE_FOLDER'] != 'true') { echo 'This action is not enabled!'; exit(0); } $newdir = parseInputParameterFile(trim(basename(' ' .$_GET['newdir']))); $createdir = $dir . "/" . $newdir; if (file_exists($createdir)) { $status = '&create_dir=exists'; } else { if ($fix_utf8 == "") { $result = mkdir ($dir . "/" . utf8_decode($newdir)); } else { $result = mkdir ($dir . "/" . $newdir); } $status = ($result) ? '&create_dir=true':'&create_dir=false'; } } if (isset($_GET['renamedir'])) { // Rename a directory if ($_SESSION['TFU_ENABLE_FOLDER_RENAME'] != 'true') { echo 'This action is not enabled!'; exit(0); } $upperdir = substr($dir, 0, strrpos ($dir, "/")); $newdir = parseInputParameterFile(trim(basename(' ' . $_GET['newdir']))); if ($dir == $_SESSION["TFU_ROOT_DIR"]) { $status = "&rename_dir=main"; } else { $createdir = $upperdir . "/" . $newdir; if (file_exists($createdir)) { $status = "&rename_dir=exists"; } else { if ($fix_utf8 == "") { $result = rename ($dir, $upperdir . "/" . utf8_decode($newdir)); } else { $result = rename ($dir, $upperdir . "/" . $newdir); } if ($result) { $dir = ($fix_utf8 =="") ? utf8_decode($createdir) : $createdir; $_SESSION["TFU_DIR"] = $dir; $status = "&rename_dir=true"; } else { $status = "&rename_dir=false"; } } } } if (isset($_GET['deletedir'])) { // the check if the file can be deleted is done before - if it is not possible we never get here! if ($_SESSION['TFU_DELETE_FOLDER'] != 'true') { echo 'This action is not enabled!'; exit(0); } $upperdir = substr($dir, 0, strrpos ($dir, "/")); $result = remove($dir); if ($result) { $status = "&delete_dir=true"; $dir = $upperdir; $_SESSION["TFU_DIR"] = $dir; } else { $status = "&delete_dir=false"; } } // needed for browsing - we check if a [..] is possible - it is never allowed to go higher as the defined root! $show_root = (isset($_SESSION["TFU_ROOT_DIR"])) ? ($dir != $_SESSION["TFU_ROOT_DIR"]) : false; if (isset($_GET['changedir'])) { // Change a directory if ($_SESSION['TFU_BROWSE_FOLDER'] != 'true') { echo 'This action is not enabled!'; exit(0); } $index = parseInputParameter($_GET['index']); if ($index == 0 && $show_root) { // we go up! $dir = substr($_SESSION["TFU_DIR"], 0, strrpos ($_SESSION["TFU_DIR"], "/")); } else { // we go deeper if ($show_root) { $index--; } $dirhandle = opendir($dir); $myDirs = array(); while (false !== ($filed = readdir($dirhandle))) { if ($filed != "." && $filed != ".." && !in_array($filed, $exclude_directories)) { if (is_dir($dir . '/' . $filed) ) { array_push($myDirs, $filed); } } } usort ($myDirs, "mycmp"); $dir = $dir . "/" . $myDirs[$index]; } $_SESSION["TFU_DIR"] = $dir; } // needed for browsing - we check again because folder could have changed! $show_root = (isset($_SESSION["TFU_ROOT_DIR"])) ? ($dir != $_SESSION["TFU_ROOT_DIR"]) : false; // All files are sored in the array $myFiles $sort_by_date = $_SESSION["TFU_SORT_FILES_BY_DATE"]; $dirhandle = opendir($dir); $myFiles = array(); $myDirs = array(); $size = 0; while (false !== ($file = readdir($dirhandle))) { if ($file != "." && $file != ".." && !in_array($file, $exclude_directories)) { $filepath = $dir . '/' . $file; if (is_dir($filepath)) { if ($fix_utf8 == "") { array_push($myDirs, "" . urlencode(utf8_encode($file)) . ""); } else { array_push($myDirs, "" . urlencode(iconv($fix_utf8, "UTF-8", $file)) . ""); } } else if (check_view_extension($file)) { set_error_handler("on_error_no_output"); $current_size = @filesize($dir . '/' . $file); $file = $file . "**" . $current_size; $size += $current_size; if ($sort_by_date) { $file = filemtime(($filepath)) . $file; } set_error_handler("on_error"); if ($fix_utf8 == "") { array_push($myFiles, urlencode(utf8_encode($file))); } else { array_push($myFiles, urlencode(iconv($fix_utf8, "UTF-8", $file))); } } } } closedir ($dirhandle); if ($sort_by_date) { usort ($myFiles, "cmp_date_dec"); $i = 0; foreach ($myFiles as $fieldName) { $myFiles[$i] = substr($myFiles[$i], 10); $i++; } } else { usort ($myFiles, "cmp_dec"); } reset($myFiles); usort ($myDirs, "cmp_dir_dec"); if ($show_root) { array_unshift($myDirs, ".."); } // now we check if we can delete the current folder - root folder cannot be deleted! $status .= (is_tfu_deletable($dir) && $show_root) ? "&dir_delete=true" : "&dir_delete=false"; // new we check if we can create folders - we have to check safemode too! set_error_handler("on_error_no_output"); $sm_prob = has_safemode_problem_global() && runsNotAsCgi(); if (is_writeable($dir)){ $status .= ($sm_prob) ? "&dir_create=subdir" : "&dir_create=true"; }else{ $status .= ($sm_prob) ? "&dir_create=safemode" : "&dir_create=false"; } set_error_handler("on_error"); $nrFiles = count($myFiles); // now we check if can delete files - we only check the 1st file! if ($nrFiles > 0) { if ($fix_utf8 == "") { $delfile = utf8_decode(urldecode($myFiles[0])); } else { $delfile = iconv("UTF-8", $fix_utf8, urlencode($file)); } // we have to remove the ** before checking $delfile = substr($delfile, 0, strpos($delfile,"**")); $status .= (is_tfu_deletable($dir . "/" . $delfile)) ? "&file_delete=true" : "&file_delete=false"; } // we check if we have an error in the upload! if (isset($_SESSION["upload_memory_limit"]) && isset($_GET['check_upload'])) { $mem_errors = "&upload_mem_errors=" . $_SESSION["upload_memory_limit"]; unset($_SESSION["upload_memory_limit"]); } else { $mem_errors = ""; } if (isset($_SESSION["TFU_LAST_UPLOADS"])) { $upload_ok = "&upload_ok=" . count($_SESSION["TFU_LAST_UPLOADS"]); } else { $upload_ok = "&upload_ok=0"; // normal when no check is done! } $files = implode("|", $myFiles); $dirs = ($_SESSION["TFU_BROWSE_FOLDER"] == "true") ? implode("|", $myDirs) : ""; if ($_SESSION["TFU_HIDE_DIRECTORY_IN_TITLE"] == "true") { $dirsub = ""; } else { // we only show the path - relative path is not shown! Therefore I replace some things. $dirsub = ($fix_utf8 == "") ? utf8_encode(str_replace("../", "", $dir)) : str_replace("../", "", $dir); $dirsub = str_replace("..", "", str_replace("//", "/", $dirsub)); // display fixes $dirsub = " - Upload Folder: " . $dirsub; } if ($fix_utf8 == "") { $baseurl = utf8_encode("&baseurl=" . getRootUrl() . $dir . "/"); // the baseurl }else { $baseurl = "&baseurl=" . getRootUrl() . $dir . "/"; // the baseurl } store_temp_session(); $size = $nrFiles . " files (" . ceil($size / 1024) . "k)"; // formating of the display can be done here! echo "&files=" . $size . "|" . $files . "&dirs=" . $dirs . $status . "&dirtext=" . $dirsub . $mem_errors . $upload_ok . $baseurl; } else if (isset($_GET['tfu_rn']) && isset($_GET['tfu_ut']) && $_GET['tfu_ut'] == "-1" ) { checkSessionTempDir(); } else { echo "Not logged in!"; } ?>wenn ja wie kann ich das so coden das es bei mir funktioniert? den ich bin nicht so fit in dem gebiet.
Geschlossen | ||
Zurück zu Module und Modifikationen |