• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP ftp_openconnection函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中ftp_openconnection函数的典型用法代码示例。如果您正苦于以下问题:PHP ftp_openconnection函数的具体用法?PHP ftp_openconnection怎么用?PHP ftp_openconnection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ftp_openconnection函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: net2ftp_module_sendHttpHeaders


//.........这里部分代码省略.........
                    @unlink($file_tmp_name);
                    continue;
                }
                // Move the uploaded file
                $move_uploaded_file_result = move_uploaded_file($uploadedFilesArray["{$j}"]["tmp_name"], $tempfilename);
                if ($move_uploaded_file_result == false) {
                    echo "WARNING: File <b>{$file_name}</b> skipped: unable to move the uploaded file to the webserver's temporary directory.<br />\n";
                    @unlink($file_tmp_name);
                    @unlink($tempfilename);
                    continue;
                } else {
                    $moved_counter = $moved_counter + 1;
                    $acceptedFilesArray["{$moved_counter}"] = $uploadedFilesArray["{$j}"];
                    // Copy all parameters for this file from the $uploadedFilesArray to the $acceptedFilesArray
                    $acceptedFilesArray["{$moved_counter}"]["tmp_name"] = $tempfilename;
                    // Overwrite the old temporary name by the new one
                }
            }
            // end for j
            flush();
        }
        // end if elseif
        // ------------------------------------
        // 3. Move the files from net2ftp's temporary directory to the FTP server.
        // ------------------------------------
        if (sizeof($acceptedFilesArray) == 0 && sizeof($uploadedFilesArray) != 0) {
            echo "WARNING: No files were accepted (see messages above), so nothing will be transferred to the FTP server.<br />\n";
        } elseif (sizeof($acceptedFilesArray) > 0) {
            // ------------------------------
            // 3.1 Open connection
            // ------------------------------
            // Open connection
            echo __("Connecting to the FTP server") . "<br />\n";
            $conn_id = ftp_openconnection();
            if ($net2ftp_result["success"] == false) {
                echo "ERROR: " . $net2ftp_result["errormessage"] . "<br />\n";
                return false;
            }
            // ------------------------------
            // For loop (loop over all the files)
            // ------------------------------
            for ($k = 1; $k <= sizeof($acceptedFilesArray); $k++) {
                $file_name = $acceptedFilesArray["{$k}"]["name"];
                $file_tmp_name = $acceptedFilesArray["{$k}"]["tmp_name"];
                $file_size = $acceptedFilesArray["{$k}"]["size"];
                $file_error = $acceptedFilesArray["{$k}"]["error"];
                $file_relative_directory = $acceptedFilesArray["{$k}"]["relative_directory"];
                $ftpmode = ftpAsciiBinary($file_name);
                if ($ftpmode == FTP_ASCII) {
                    $printftpmode = "FTP_ASCII";
                } elseif ($ftpmode == FTP_BINARY) {
                    $printftpmode = "FTP_BINARY";
                }
                // ------------------------------
                // 3.2 Within the for loop: create the subdirectory if needed
                // ------------------------------
                // Replace Windows-style backslashes \ by Unix-style slashes /
                $file_relative_directory = str_replace("\\", "/", trim($file_relative_directory));
                // Get the names of the subdirectories by splitting the string using slashes /
                $file_subdirectories = explode("/", $file_relative_directory);
                // $targetdirectory contains the successive directories to be created
                $targetdirectory = $net2ftp_globals["directory"];
                // Loop over sizeof()-1 because the last part is the filename itself:
                for ($m = 0; $m < sizeof($file_subdirectories) - 1; $m++) {
                    // Create the targetdirectory string
                    $targetdirectory = glueDirectories($targetdirectory, $file_subdirectories[$m]);
开发者ID:GTAWWEKID,项目名称:tsiserver.us,代码行数:67,代码来源:jupload.inc.php


示例2: ftp_unziptransferfiles

function ftp_unziptransferfiles($archivesArray)
{
    // --------------
    // Extract the directories and files from the archive to a temporary directory on the web server, and
    // then create the directories and put the files on the FTP server
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_globals, $net2ftp_result, $net2ftp_output;
    // -------------------------------------------------------------------------
    // Open connection
    // -------------------------------------------------------------------------
    $conn_id = ftp_openconnection();
    if ($net2ftp_result["success"] == false) {
        for ($archive_nr = 1; $archive_nr <= sizeof($archivesArray); $archive_nr++) {
            @unlink($archivesArray[$archive_nr]["tmp_name"]);
        }
        return false;
    }
    // -------------------------------------------------------------------------
    // For each archive...
    // -------------------------------------------------------------------------
    for ($archive_nr = 1; $archive_nr <= sizeof($archivesArray); $archive_nr++) {
        // Set status
        setStatus($archive_nr, sizeof($archivesArray), __("Decompressing archives and transferring files"));
        // -------------------------------------------------------------------------
        // Determine the type of archive depending on the filename extension
        // -------------------------------------------------------------------------
        $archive_name = $archivesArray[$archive_nr]["name"];
        $archive_file = $archivesArray[$archive_nr]["tmp_name"];
        $archivename_without_dottext = substr($archivesArray[$archive_nr]["tmp_name"], 0, strlen($archive) - 4);
        $archive_type = get_filename_extension($archivename_without_dottext);
        $net2ftp_output["ftp_unziptransferfiles"][] = __("Processing archive nr %1\$s: <b>%2\$s</b>", $archive_nr, $archive_name);
        $net2ftp_output["ftp_unziptransferfiles"][] = "<ul>";
        if ($archive_type != "zip" && $archive_type != "tar" && $archive_type != "tgz" && $archive_type != "gz") {
            $net2ftp_output["ftp_unziptransferfiles"][] = __("Archive <b>%1\$s</b> was not processed because its filename extension was not recognized. Only zip, tar, tgz and gz archives are supported at the moment.", $archive_name);
            continue;
        }
        // -------------------------------------------------------------------------
        // Extract directories and files
        // -------------------------------------------------------------------------
        // ------------------------------
        // Check list of files to see if there are any malicious filenames
        // ------------------------------
        if ($archive_type == "zip") {
            $zip = new PclZip($archive_file);
            $list_to_check = $zip->listContent();
        } elseif ($archive_type == "tar" || $archive_type == "tgz" || $archive_type == "gz") {
            $list_to_check = PclTarList($archive_file);
        }
        if ($list_to_check <= 0) {
            $net2ftp_output["ftp_unziptransferfiles"][] = __("Unable to extract the files and directories from the archive");
            continue;
        }
        for ($i = 0; $i < sizeof($list_to_check); $i++) {
            $source = trim($list_to_check[$i]["filename"]);
            if (strpos($source, "../") !== false || strpos($source, "..\\") !== false) {
                $errormessage = __("Archive contains filenames with ../ or ..\\ - aborting the extraction");
                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
                return false;
            }
        }
        // ------------------------------
        // Generate random directory
        // ------------------------------
        $tempdir = tempdir2($net2ftp_globals["application_tempdir"], "unzip__", "");
        if ($net2ftp_result["success"] == false) {
            return false;
        }
        registerTempfile("register", "{$tempdir}");
        // ------------------------------
        // Extract
        // ------------------------------
        if ($archive_type == "zip") {
            $zip = new PclZip($archive_file);
            $list = $zip->extract($p_path = $tempdir);
        } elseif ($archive_type == "tar" || $archive_type == "tgz" || $archive_type == "gz") {
            $list = PclTarExtract($archive_file, $tempdir);
        }
        // This code is not needed any more - see above: if ($list_to_check <= 0)
        if ($list <= 0) {
            //			$net2ftp_output["ftp_unziptransferfiles"][] = __("Unable to extract the files and directories from the archive");
            continue;
        }
        // ------------------------------
        // Create the directories and put the files on the FTP server
        // ------------------------------
        for ($i = 0; $i < sizeof($list); $i++) {
            $source = trim($list[$i]["filename"]);
            $unzip_status = trim($list[$i]["status"]);
            $target_relative = substr($source, strlen($tempdir));
            $target = $net2ftp_globals["directory"] . $target_relative;
            $ftpmode = ftpAsciiBinary($source);
            if ($unzip_status != "ok") {
                $net2ftp_output["ftp_unziptransferfiles"][] = __("Could not unzip entry %1\$s (error code %2\$s)", $target_relative, $unzip_status);
                setErrorVars(true, "", "", "", "");
                continue;
            }
            // Directory entry in the archive: create the directory
//.........这里部分代码省略.........
开发者ID:GTAWWEKID,项目名称:tsiserver.us,代码行数:101,代码来源:filesystem.inc.php


示例3: net2ftp_module_printBody

function net2ftp_module_printBody()
{
    // --------------
    // This function prints the rename screen
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
    if (isset($_POST["list"]) == true) {
        $list = getSelectedEntries($_POST["list"]);
    } else {
        $list = "";
    }
    if (isset($_POST["newNames"]) == true) {
        $newNames = validateEntry($_POST["newNames"]);
    } else {
        $newNames = "";
    }
    // -------------------------------------------------------------------------
    // Variables for all screens
    // -------------------------------------------------------------------------
    // Title
    $title = __("Rename directories and files");
    // Form name, back and forward buttons
    $formname = "RenameForm";
    $back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
    $forward_onclick = "document.forms['" . $formname . "'].submit();";
    // -------------------------------------------------------------------------
    // Variables for screen 1
    // -------------------------------------------------------------------------
    if ($net2ftp_globals["screen"] == 1) {
        // Next screen
        $nextscreen = 2;
    } elseif ($net2ftp_globals["screen"] == 2) {
        // Open connection
        setStatus(2, 10, __("Connecting to the FTP server"));
        $conn_id = ftp_openconnection();
        if ($net2ftp_result["success"] == false) {
            return false;
        }
        // Rename files
        setStatus(4, 10, __("Processing the entries"));
        for ($i = 1; $i <= sizeof($list["all"]); $i++) {
            if (strstr($list["all"][$i]["dirfilename"], "..") != false) {
                $net2ftp_output["rename"][] = __("The new name may not contain any dots. This entry was not renamed to <b>%1\$s</b>", htmlEncode2($newNames[$i])) . "<br />";
                continue;
            }
            if (checkAuthorizedName($newNames[$i]) == false) {
                $net2ftp_output["rename"][] = __("The new name may not contain any banned keywords. This entry was not renamed to <b>%1\$s</b>", htmlEncode2($newNames[$i])) . "<br />";
                continue;
            }
            ftp_rename2($conn_id, $net2ftp_globals["directory"], $list["all"][$i]["dirfilename"], $newNames[$i]);
            if ($net2ftp_result["success"] == false) {
                setErrorVars(true, "", "", "", "");
                $net2ftp_output["rename"][] = __("<b>%1\$s</b> could not be renamed to <b>%2\$s</b>", htmlEncode2($list["all"][$i]["dirfilename"]), htmlEncode2($newNames[$i]));
                continue;
            } else {
                $net2ftp_output["rename"][] = __("<b>%1\$s</b> was successfully renamed to <b>%2\$s</b>", htmlEncode2($list["all"][$i]["dirfilename"]), htmlEncode2($newNames[$i]));
            }
        }
        // End for
        // Close connection
        ftp_closeconnection($conn_id);
    }
    // end elseif
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php";
}
开发者ID:Jmainguy,项目名称:multicraft_install,代码行数:71,代码来源:rename.inc.php


示例4: net2ftp_module_printBody

function net2ftp_module_printBody()
{
    // --------------
    // This function prints the browse screen ($state2=="main") or the directory popup screen ($state2=="popup")
    // For the browse screen ($state2=="main"), 2 template files are called
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
    // -------------------------------------------------------------------------
    // Check if the directory name contains \' and if it does, print an error message
    // Note: these directories cannot be browsed, but can be deleted
    // -------------------------------------------------------------------------
    //	if (strstr($directory, "\'") != false) {
    //		$errormessage = __("Directories with names containing \' cannot be displayed correctly. They can only be deleted. Please go back and select another subdirectory.");
    //		setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
    //		return false;
    //	}
    // -------------------------------------------------------------------------
    // Variables
    // With status update if $state2=="main"
    // -------------------------------------------------------------------------
    // ------------------------------------
    // Open connection
    // ------------------------------------
    if ($net2ftp_globals["state2"] == "main") {
        setStatus(2, 10, __("Connecting to the FTP server"));
    }
    $conn_id = ftp_openconnection();
    if ($net2ftp_result["success"] == false) {
        return false;
    }
    // ------------------------------------
    // Get raw list of directories and files; parse the raw list and return a nice list
    // This function may change the current $directory; a warning message is returned in that case
    // ------------------------------------
    if ($net2ftp_globals["state2"] == "main") {
        setStatus(4, 10, __("Getting the list of directories and files"));
    }
    $list = ftp_getlist($conn_id, $net2ftp_globals["directory"]);
    if ($net2ftp_result["success"] == false) {
        return false;
    }
    // ------------------------------------
    // Close connection
    // ------------------------------------
    ftp_closeconnection($conn_id);
    // ------------------------------------
    // Sort the list
    // ------------------------------------
    $list_directories = sort_list($list["directories"]);
    $list_files = sort_list($list["files"]);
    $list_symlinks = sort_list($list["symlinks"]);
    $list_unrecognized = sort_list($list["unrecognized"]);
    $warning_directory = $list["stats"]["warnings"];
    $directory = $list["stats"]["newdirectory"];
    $directory_html = htmlEncode2($directory);
    $directory_url = urlEncode2($directory);
    $directory_js = javascriptEncode2($directory);
    $updirectory = upDir($directory);
    $updirectory_html = htmlEncode2($updirectory);
    $updirectory_url = urlEncode2($updirectory);
    $updirectory_js = javascriptEncode2($updirectory);
    // ------------------------------------
    // Calculate the list of HTTP URLs
    // ------------------------------------
    if ($net2ftp_globals["state2"] == "main") {
        $list_links_js = ftp2http($net2ftp_globals["directory"], $list_files, "no");
        $list_links_url = ftp2http($net2ftp_globals["directory"], $list_files, "yes");
    }
    // ------------------------------------
    // Consumption message
    // ------------------------------------
    $warning_consumption = "";
    if (checkConsumption() == false) {
        $warning_consumption .= "<b>" . __("Daily limit reached: you will not be able to transfer data") . "</b><br /><br />\n";
        $warning_consumption .= __("In order to guarantee the fair use of the web server for everyone, the data transfer volume and script execution time are limited per user, and per day. Once this limit is reached, you can still browse the FTP server but not transfer data to/from it.") . "<br /><br />\n";
        $warning_consumption .= __("If you need unlimited usage, please install net2ftp on your own web server.") . "<br />\n";
    }
    // ------------------------------------
    // Browse message
    // ------------------------------------
    if ($net2ftp_settings["message_browse"] != "" && $net2ftp_settings["message_browse"] != "Setting message_browse does not exist") {
        $warning_message = $net2ftp_settings["message_browse"];
    }
    // ------------------------------------
    // Directory tree
    // ------------------------------------
    $directory_exploded = explode("/", stripDirectory($directory));
    if ($directory != "/" && checkAuthorizedDirectory("/") == true) {
        $directory_tree = "<a href=\"javascript:submitBrowseForm('/','','browse','main');\">root</a> ";
    } else {
        $directory_tree = "root ";
    }
    $directory_goto = "";
    for ($i = 0; $i < sizeof($directory_exploded) - 1; $i++) {
        $directory_goto = glueDirectories($directory_goto, $directory_exploded[$i]);
        $directory_goto_url = urlEncode2($directory_goto);
        if (checkAuthorizedDirectory($directory_goto) == true) {
//.........这里部分代码省略.........
开发者ID:NN-Dev-Team,项目名称:Nordic-Network,代码行数:101,代码来源:browse.inc.php


示例5: net2ftp_module_printBody

function net2ftp_module_printBody()
{
    // --------------
    // This function prints the login screen
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
    if (isset($_POST["list"]) == true) {
        $list = getSelectedEntries($_POST["list"]);
    } else {
        $list = "";
    }
    // -------------------------------------------------------------------------
    // Variables
    // -------------------------------------------------------------------------
    // Title
    $title = __("Size of selected directories and files");
    // Form name, back and forward buttons
    $formname = "CalculateSizeForm";
    $back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
    // Open connection
    setStatus(2, 10, __("Connecting to the FTP server"));
    $conn_id = ftp_openconnection();
    if ($net2ftp_result["success"] == false) {
        return false;
    }
    // Calculate the size
    $options = array();
    $result['size'] = 0;
    $result['skipped'] = 0;
    $result = ftp_processfiles("calculatesize", $conn_id, $net2ftp_globals["directory"], $list, $options, $result, 0);
    // Close connection
    ftp_closeconnection($conn_id);
    // Print message
    $net2ftp_output["calculatesize"][] = __("The total size taken by the selected directories and files is:") . " <b>" . formatFilesize($result['size']) . "</b> (" . $result['size'] . " Bytes)";
    if ($result['skipped'] > 0) {
        $net2ftp_output["calculatesize"][] = __("The number of files which were skipped is:") . " <b>" . $result['skipped'] . "</b>";
    }
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php";
}
开发者ID:Gemorroj,项目名称:net2ftp,代码行数:45,代码来源:calculatesize.inc.php


示例6: net2ftp_module_printBody


//.........这里部分代码省略.........
            clearstatcache();
            // for filesize
            $packagelist_local = @fread($handle_local, filesize($packagelistfile_local));
            @fclose($handle_local);
        }
        // Issue an error message if no list could be read
        if ($packagelist_net2ftp != "") {
            $packagelist = $packagelist_net2ftp;
        } elseif ($packagelist_local != "") {
            $packagelist = $packagelist_local;
        } else {
            $errormessage = __("Unable to get the list of packages");
            setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
            return false;
        }
        // ----------------------------------------------
        // Security code
        // Random key generator by goochivasquez -at- gmail (15-Apr-2005 11:53)
        // ----------------------------------------------
        // Random key generator
        $keychars = "abcdefghijklmnopqrstuvwxyz0123456789";
        $length = 20;
        $security_code = "";
        for ($i = 0; $i < $length; $i++) {
            $security_code .= substr($keychars, rand(1, strlen($keychars)), 1);
        }
        // Random key generator
        $keychars = "abcdefghijklmnopqrstuvwxyz0123456789";
        $length = 5;
        $tempdir_extension = "";
        for ($i = 0; $i < $length; $i++) {
            $tempdir_extension .= substr($keychars, rand(1, strlen($keychars)), 1);
        }
        $tempdir_ftp = glueDirectories($net2ftp_globals["directory"], "net2ftp_temp_") . $tempdir_extension;
        // ----------------------------------------------
        // Replace certain values
        // ----------------------------------------------
        $text = str_replace("NET2FTP_SECURITY_CODE", $security_code, $text);
        $text = str_replace("NET2FTP_TEMPDIR_EXTENSION", $tempdir_extension, $text);
        $text = str_replace("NET2FTP_PACKAGELIST", $packagelist, $text);
        $text = str_replace("NET2FTP_FTP_SERVER", $net2ftp_globals["ftpserver"], $text);
        $text = str_replace("NET2FTP_FTPSERVER_PORT", $net2ftp_globals["ftpserverport"], $text);
        $text = str_replace("NET2FTP_USERNAME", $net2ftp_globals["username"], $text);
        $text = str_replace("NET2FTP_DIRECTORY", $net2ftp_globals["directory"], $text);
        // ----------------------------------------------
        // Open connection
        // ----------------------------------------------
        setStatus(2, 10, __("Connecting to the FTP server"));
        $conn_id = ftp_openconnection();
        if ($conn_id == false) {
            return false;
        }
        // ----------------------------------------------
        // Create temporary /net2ftp_temp directory
        // ----------------------------------------------
        setStatus(4, 10, __("Creating a temporary directory on the FTP server"));
        ftp_newdirectory($conn_id, $tempdir_ftp);
        if ($net2ftp_result["success"] == false) {
            setErrorVars(true, "", "", "", "");
        }
        // ----------------------------------------------
        // Chmodding the temporary /net2ftp_temp directory to 777
        // ----------------------------------------------
        setStatus(6, 10, __("Setting the permissions of the temporary directory"));
        $sitecommand = "chmod 0777 " . $tempdir_ftp;
        $ftp_site_result = @ftp_site($conn_id, $sitecommand);
        // ----------------------------------------------
        // Put a .htaccess in the /net2ftp_temp directory to avoid anyone else reading the contents it
        // (Works only for Apache web servers...)
        // ----------------------------------------------
        ftp_writefile($conn_id, $tempdir_ftp, ".htaccess", "deny from all");
        if ($net2ftp_result["success"] == false) {
            setErrorVars(true, "", "", "", "");
        }
        // ----------------------------------------------
        // Write the net2ftp installer script to the FTP server
        // ----------------------------------------------
        setStatus(8, 10, __("Copying the net2ftp installer script to the FTP server"));
        ftp_writefile($conn_id, $net2ftp_globals["directory"], "net2ftp_installer.php", $text);
        if ($net2ftp_result["success"] == false) {
            return false;
        }
        // ----------------------------------------------
        // Close connection
        // ----------------------------------------------
        ftp_closeconnection($conn_id);
        // ----------------------------------------------
        // Variables for screen 1
        // ----------------------------------------------
        // URL to the installer script
        $list_files[1]["dirfilename_js"] = "net2ftp_installer.php?security_code=" . $security_code;
        $ftp2http_result = ftp2http($net2ftp_globals["directory"], $list_files, "no");
        $net2ftp_installer_url = $ftp2http_result[1];
    }
    // end if
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php";
}
开发者ID:GTAWWEKID,项目名称:tsiserver.us,代码行数:101,代码来源:install.inc.php


示例7: net2ftp_module_printBody

function net2ftp_module_printBody()
{
    // --------------
    // This function prints the new directory screen
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
    if (isset($_POST["newNames"]) == true) {
        $newNames = validateEntry($_POST["newNames"]);
    } else {
        $newNames = "";
    }
    // -------------------------------------------------------------------------
    // Variables for all screens
    // -------------------------------------------------------------------------
    // Title
    $title = __("Create new directories");
    // Form name, back and forward buttons
    $formname = "NewDirForm";
    $back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
    $forward_onclick = "document.forms['" . $formname . "'].submit();";
    // -------------------------------------------------------------------------
    // Variables for screen 1
    // -------------------------------------------------------------------------
    if ($net2ftp_globals["screen"] == 1) {
        // Next screen
        $nextscreen = 2;
    } elseif ($net2ftp_globals["screen"] == 2) {
        // Open connection
        setStatus(2, 10, __("Connecting to the FTP server"));
        $conn_id = ftp_openconnection();
        if ($net2ftp_result["success"] == false) {
            return false;
        }
        // Create new directories
        setStatus(4, 10, __("Processing the entries"));
        for ($k = 1; $k <= sizeof($newNames); $k++) {
            if (strlen($newNames[$k]) > 0) {
                $newsubdir = glueDirectories($net2ftp_globals["directory"], $newNames[$k]);
                ftp_newdirectory($conn_id, $newsubdir);
                if ($net2ftp_result["success"] == false) {
                    setErrorVars(true, "", "", "", "");
                    // Continue anyway
                    $net2ftp_output["newdir"][] = __("Directory <b>%1\$s</b> could not be created.", htmlEncode2($newNames[$k]));
                } else {
                    $net2ftp_output["newdir"][] = __("Directory <b>%1\$s</b> was successfully created.", htmlEncode2($newNames[$k]));
                }
            }
            // End if
        }
        // End for
        // Close connection
        ftp_closeconnection($conn_id);
    }
    // end elseif
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php";
}
开发者ID:NN-Dev-Team,项目名称:Nordic-Network,代码行数:62,代码来源:newdir.inc.php


示例8: net2ftp_module_printBody

function net2ftp_module_printBody()
{
    // --------------
    // This function prints the raw FTP command screen
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
    if (isset($_POST["command"]) == true) {
        $command = $_POST["command"];
    } else {
        $command = "CWD {$directory_html}\nPWD\n";
    }
    // -------------------------------------------------------------------------
    // Variables
    // -------------------------------------------------------------------------
    // Title
    $title = __("Send arbitrary FTP commands");
    // Form name, back and forward buttons
    $formname = "RawForm";
    $back_onclick = "document.forms['" . $formname . "'].state.value='advanced';document.forms['" . $formname . "'].screen.value='1';document.forms['" . $formname . "'].submit();";
    $forward_onclick = "document.forms['" . $formname . "'].submit();";
    // Open connection
    setStatus(2, 10, __("Connecting to the FTP server"));
    $conn_id = ftp_openconnection();
    if ($net2ftp_result["success"] == false) {
        return false;
    }
    // Explode list of commands to an array
    $command_exploded = explode("\n", $command);
    // Remove the empty lines
    $new_command_nr = 0;
    for ($command_nr = 0; $command_nr < sizeof($command_exploded); $command_nr++) {
        if (trim($command_exploded[$command_nr]) != "") {
            $command_exploded_trimmed[$new_command_nr] = trim($command_exploded[$command_nr]);
            $new_command_nr++;
        }
    }
    // Send arbitrary FTP command
    $command_total = sizeof($command_exploded_trimmed);
    for ($command_nr = 0; $command_nr < $command_total; $command_nr++) {
        setStatus($command_nr + 1, $command_total, __("Sending FTP command %1\$s of %2\$s", $command_nr + 1, $command_total));
        $ftp_raw_result[$command_nr] = ftp_raw($conn_id, trim($command_exploded_trimmed[$command_nr]));
    }
    // Close connection
    ftp_closeconnection($conn_id);
    // Get the messages
    for ($command_nr = 0; $command_nr < sizeof($command_exploded_trimmed); $command_nr++) {
        for ($line_nr = 0; $line_nr < sizeof($ftp_raw_result[$command_nr]); $line_nr++) {
            $net2ftp_output["ftp_raw"][] = $ftp_raw_result[$command_nr][$line_nr] . "\n";
        }
    }
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php";
}
开发者ID:jamiebatch452,项目名称:Open-Game-Panel,代码行数:58,代码来源:raw.inc.php


示例9: net2ftp_module_printBody


//.........这里部分代码省略.........
        $searchoptions["modified_from"] = "";
    }
    if (isset($searchoptions["modified_to"]) == false) {
        $searchoptions["modified_to"] = "";
    }
    // -------------------------------------------------------------------------
    // Variables for all screens
    // -------------------------------------------------------------------------
    // Title
    // See below
    // Form name, back and forward buttons
    $formname = "FindstringForm";
    $back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
    $forward_onclick = "document.forms['" . $formname . "'].submit();";
    // Next screen
    $nextscreen = 2;
    // -------------------------------------------------------------------------
    // Variables for screen 1
    // -------------------------------------------------------------------------
    if ($net2ftp_globals["screen"] == 1) {
        // Title
        $title = __("Search directories and files");
        // From and to dates
        $tomorrow = date("Y-m-d", time() + 3600 * 24);
        $oneweekago = date("Y-m-d", time() - 3600 * 24 * 7);
        $modified_from = $oneweekago;
        $modified_to = $tomorrow;
    } elseif ($net2ftp_globals["screen"] == 2) {
        // Title
        $title = __("Search results");
        // Check if $searchoptions["string"] is a valid string
        if (is_string($searchoptions["string"]) == false) {
            $errormessage = __("Please enter a valid search word or phrase.");
            setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
            return false;
        }
        // Check if $searchoptions["filename"] is a valid filename with a possible wildcard character *
        if ($searchoptions["filename"] != "" && preg_match("/^[a-zA-Z0-9_ *\\.-]*\$/", $searchoptions["filename"]) == 0) {
            $errormessage = __("Please enter a valid filename.");
            setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
            return false;
        }
        // Check if $searchoptions["size_from"] and $searchoptions["size_to"] are valid numbers
        if ($searchoptions["size_from"] != "" && is_numeric($searchoptions["size_from"]) == false) {
            $errormessage = __("Please enter a valid file size in the \"from\" textbox, for example 0.");
            setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
            return false;
        }
        if ($searchoptions["size_to"] != "" && is_numeric($searchoptions["size_to"]) == false) {
            $errormessage = __("Please enter a valid file size in the \"to\" textbox, for example 500000.");
            setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
            return false;
        }
        // Check if $searchoptions["modified_from"] and $searchoptions["modified_to"] are valid dates
        if ($searchoptions["modified_from"] != "" && preg_match("/^[0-9-]*\$/", $searchoptions["modified_from"]) == 0) {
            $errormessage = __("Please enter a valid date in Y-m-d format in the \"from\" textbox.");
            setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
            return false;
        }
        if ($searchoptions["modified_to"] != "" && preg_match("/^[0-9-]*\$/", $searchoptions["modified_to"]) == 0) {
            $errormessage = __("Please enter a valid date in Y-m-d format in the \"to\" textbox.");
            setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
            return false;
        }
        // ------------
        // CONVERSIONS
        // ------------
        // Convert the wildcard character * in the filename by the wildcard .* that can be read by preg_match
        // So this *.* becomes this .*..*
        $searchoptions["filename"] = str_replace("*", ".*", $searchoptions["filename"]);
        // Convert the mtime to a unix timestamp
        $searchoptions["modified_from"] = strtotime($searchoptions["modified_from"]);
        $searchoptions["modified_to"] = strtotime($searchoptions["modified_to"]);
        // Open connection
        setStatus(2, 10, __("Connecting to the FTP server"));
        $conn_id = ftp_openconnection();
        if ($net2ftp_result["success"] == false) {
            return false;
        }
        // Find the files
        $result = array();
        setStatus(4, 10, __("Searching the files..."));
        $result = ftp_processfiles("findstring", $conn_id, $net2ftp_globals["directory"], $list, $searchoptions, $result, 0);
        if ($net2ftp_result["success"] == false) {
            return false;
        }
        // Close connection
        ftp_closeconnection($conn_id);
        if (sizeof($result) == 0) {
            $net2ftp_output["findstring"][] = __("The word <b>%1\$s</b> was not found in the selected directories and files.", $searchoptions["string"]);
        } else {
            $net2ftp_output["findstring"][] = __("The word <b>%1\$s</b> was found in the following files:", $searchoptions["string"]);
        }
    }
    // end if
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php";
}
开发者ID:klr2003,项目名称:sourceread,代码行数:101,代码来源:findstring.inc.php


示例10: net2ftp_module_printBody

function net2ftp_module_printBody()
{
    // --------------
    // This function prints the copy/move/delete screen
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
    if (isset($_POST["list"]) == true) {
        $list = getSelectedEntries($_POST["list"]);
    } else {
        $list = "";
    }
    if (isset($_POST["ftpserver2"]) == true) {
        $net2ftp_globals["ftpserver2"] = validateFtpserver($_POST["ftpserver2"]);
    } else {
        $net2ftp_globals["ftpserver2"] = "";
    }
    if (isset($_POST["ftpserverport2"]) == true) {
        $net2ftp_globals["ftpserverport2"] = validateFtpserverport($_POST["ftpserverport2"]);
    } else {
        $net2ftp_globals["ftpserverport2"] = "";
    }
    if (isset($_POST["username2"]) == true) {
        $net2ftp_globals["username2"] = validateUsername($_POST["username2"]);
    } else {
        $net2ftp_globals["username2"] = "";
    }
    if (isset($_POST["password2"]) == true) {
        $net2ftp_globals["password2"] = validatePassword($_POST["password2"]);
    } else {
        $net2ftp_globals["password2"] = "";
    }
    // -------------------------------------------------------------------------
    // Variables for all screens
    // -------------------------------------------------------------------------
    // Title
    if ($net2ftp_globals["state2"] == "copy") {
        $title = __("Copy directories and files");
    } elseif ($net2ftp_globals["state2"] == "move") {
        $title = __("Move directories and files");
    } elseif ($net2ftp_globals["state2"] == "delete") {
        $title = __("Delete directories and files");
    }
    // Form name, back and forward buttons
    $formname = "CopyMoveDeleteForm";
    $back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
    $forward_onclick = "document.forms['" . $formname . "'].submit();";
    // -------------------------------------------------------------------------
    // Variables for screen 1
    // -------------------------------------------------------------------------
    if ($net2ftp_globals["screen"] == 1) {
        // Next screen
        $nextscreen = 2;
    } elseif ($net2ftp_globals["screen"] == 2) {
        // ---------------------------------------
        // Open connection to the source server
        // ---------------------------------------
        setStatus(2, 10, __("Connecting to the FTP server"));
        $conn_id_source = ftp_openconnection();
        if ($net2ftp_result["success"] == false) {
            return false;
        }
        // ---------------------------------------
        // Open connection to the target server, if it is different from the source server, or if the username
        // is different (different users may have different authorizations on the same FTP server)
        // ---------------------------------------
        if (($net2ftp_globals["ftpserver2"] != "" || $net2ftp_globals["username2"] != "") && ($net2ftp_globals["ftpserver2"] != $net2ftp_globals["ftpserver"] || $net2ftp_globals["username2"] != $net2ftp_globals["username"])) {
            $conn_id_target = ftp_openconnection2();
            // Note: ftp_openconnection2 cleans the input values
            if ($net2ftp_result["success"] == false) {
                return false;
            }
        } else {
            $conn_id_target = $conn_id_source;
        }
        // ---------------------------------------
        // Copy, move or delete the files and directories
        // ---------------------------------------
        ftp_copymovedelete($conn_id_source, $conn_id_target, $list, $net2ftp_globals["state2"], 0);
        // ---------------------------------------
        // Close the connection to the source server
        // ---------------------------------------
        ftp_closeconnection($conn_id_source);
        // ---------------------------------------
        // Close the connection to the target server, if it is different from the source server
        // ---------------------------------------
        if ($conn_id_source != $conn_id_target) {
            ftp_closeconnection($conn_id_target);
        }
    }
    // end elseif
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php";
}
开发者ID:rohdoor,项目名称:Zpanel-net2ftp,代码行数:98,代码来源:copymovedelete.inc.php


示例11: net2ftp_module_printBody

function net2ftp_module_printBody()
{
    // --------------
    // This function prints the unzip screen
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
    if (isset($_POST["list"]) == true) {
        $list = getSelectedEntries($_POST["list"]);
    } else {
        $list = "";
    }
    // -------------------------------------------------------------------------
    // Variables for all screens
    // -------------------------------------------------------------------------
    // Title
    $title = __("Unzip archives");
    // Form name, back and forward buttons
    $formname = "UnzipForm";
    $back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
    $forward_onclick = "document.forms['" . $formname . "'].submit();";
    // -------------------------------------------------------------------------
    // Variables for screen 1
    // -------------------------------------------------------------------------
    if ($net2ftp_globals["screen&qu 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ftp_pasv函数代码示例发布时间:2022-05-15
下一篇:
PHP ftp_nlist函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap