Exemplo n.º 1
0
function net2ftp_module_printBody()
{
    // --------------
    // This function prints the login screen
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
    // The 2 go_to_state variables come from the bookmark, or from registerglobals.inc.php
    if (isset($_GET["go_to_state"]) == true) {
        $go_to_state = validateGenericInput($_GET["go_to_state"]);
    } else {
        $go_to_state = $net2ftp_globals["go_to_state"];
    }
    if (isset($_GET["go_to_state2"]) == true) {
        $go_to_state2 = validateGenericInput($_GET["go_to_state2"]);
    } else {
        $go_to_state2 = $net2ftp_globals["go_to_state2"];
    }
    if (isset($_GET["errormessage"]) == true) {
        $errormessage = validateGenericInput($_GET["errormessage"]);
    }
    // Most actions
    if (isset($_POST["list"]) == true) {
        $list = getSelectedEntries($_POST["list"]);
    } else {
        $list = "";
    }
    // Bookmark
    if (isset($_POST["url"]) == true) {
        $url = validateGenericInput($_POST["url"]);
    } else {
        $url = "";
    }
    if (isset($_POST["text"]) == true) {
        $text = validateGenericInput($_POST["text"]);
    } else {
        $text = "";
    }
    // Copy, move, delete
    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"] = "";
    }
    // Edit
    if (isset($_POST["textareaType"]) == true) {
        $textareaType = validateTextareaType($_POST["textareaType"]);
    } else {
        $textareaType = "";
    }
    if (isset($_POST["text"]) == true) {
        $text = $_POST["text"];
    } else {
        $text = "";
    }
    if (isset($_POST["text_splitted"]) == true) {
        $text_splitted = $_POST["text_splitted"];
    } else {
        $text_splitted = "";
    }
    // Find string
    if (isset($_POST["searchoptions"]) == true) {
        $searchoptions = $_POST["searchoptions"];
    }
    // New directory
    // Rename
    if (isset($_POST["newNames"]) == true) {
        $newNames = validateEntry($_POST["newNames"]);
    } else {
        $newNames = "";
    }
    // Raw FTP command
    if (isset($_POST["command"]) == true) {
        $command = $_POST["command"];
    } else {
        $command = "CWD {$directory_html}\nPWD\n";
    }
    // Zip
    if (isset($_POST["zipactions"]) == true) {
        $zipactions = $_POST["zipactions"];
    } else {
        $zipactions = "";
    }
    // -------------------------------------------------------------------------
    // Variables for all screens
    // -------------------------------------------------------------------------
    $formname = "LoginForm";
    $enctype = "";
    if ($net2ftp_globals["state2"] == "admin") {
        $message = __("Please enter your Administrator username and password.");
        $button_text = __("Login");
        $username_fieldname = "input_admin_username";
        $password_fieldname = "input_admin_password";
        $username_value = "";
        $password_value = "";
        $focus = $username_fieldname;
    } elseif ($net2ftp_globals["state2"] == "bookmark") {
        $message = __("Please enter your username and password for FTP server <b>%1\$s</b>.", htmlEncode2($net2ftp_globals["ftpserver"]));
        $button_text = __("Login");
        $username_fieldname = "username";
        $password_fieldname = "password";
        if (isset($net2ftp_globals["username"]) == true) {
            $username_value = htmlEncode2($net2ftp_globals["username"]);
            $focus = $password_fieldname;
        } else {
            $username_value = "";
            $focus = $username_fieldname;
        }
        $password_value = "";
    } elseif ($net2ftp_globals["state2"] == "session_expired") {
        $message = __("Your session has expired; please enter your password for FTP server <b>%1\$s</b> to continue.", htmlEncode2($net2ftp_globals["ftpserver"]));
        $button_text = __("Continue");
        $username_fieldname = "username";
        $password_fieldname = "password";
        if (isset($net2ftp_globals["username"]) == true) {
            $username_value = htmlEncode2($net2ftp_globals["username"]);
            $focus = $password_fieldname;
        } else {
            $username_value = "";
            $focus = $username_fieldname;
        }
        $password_value = "";
    } elseif ($net2ftp_globals["state2"] == "session_ipchange") {
        $message = __("Your IP address has changed; please enter your password for FTP server <b>%1\$s</b> to continue.", htmlEncode2($net2ftp_globals["ftpserver"]));
        $button_text = __("Continue");
        $username_fieldname = "username";
        $password_fieldname = "password";
        if (isset($net2ftp_globals["username"]) == true) {
            $username_value = htmlEncode2($net2ftp_globals["username"]);
            $focus = $password_fieldname;
        } else {
            $username_value = "";
            $focus = $username_fieldname;
        }
        $password_value = "";
    }
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/login_small.template.php";
}
Exemplo n.º 2
0
function net2ftp_module_sendHttpHeaders()
{
    // --------------
    // This function sends HTTP headers
    // --------------
    global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
    // ------------------------------------
    // 1. Register the global variables
    // ------------------------------------
    if ($net2ftp_globals["screen"] == 2) {
        // Code for old file jupload applet (jupload version 0.86)
        //		$file_counter = 0;
        //		foreach($_FILES as $tagname=>$object) {
        //			if ($object['name'] != "") {
        //				$file_counter = $file_counter + 1;
        //				$uploadedFilesArray["$file_counter"]["name"]               = $object['name'];
        //				$uploadedFilesArray["$file_counter"]["tmp_name"]           = $object['tmp_name'];
        //				$uploadedFilesArray["$file_counter"]["size"]               = $object['size'];
        //				$uploadedFilesArray["$file_counter"]["error"]              = $object['error'];
        //				// Look for special encoded jupload files
        //				$contentType = $object['type'];
        //				if (substr($contentType,0,7) == "jupload") {
        //					$base64_encoded_path = substr($contentType,8);
        //					$base64_decoded_path = base64_decode($base64_encoded_path);
        //					$uploadedFilesArray["$file_counter"]["absolute_directory"] = $base64_decoded_path;
        //				} // end if
        //			} // end if
        //		} // end foreach
        // Code for new file jupload applet (jupload version 5.0.8)
        $file_counter = 0;
        foreach ($_FILES as $tagname => $object) {
            if ($object['name'] != "") {
                $file_counter = $file_counter + 1;
                $uploadedFilesArray["{$file_counter}"]["name"] = $object['name'];
                $uploadedFilesArray["{$file_counter}"]["type"] = $object['type'];
                $uploadedFilesArray["{$file_counter}"]["tmp_name"] = $object['tmp_name'];
                $uploadedFilesArray["{$file_counter}"]["error"] = $object['error'];
                $uploadedFilesArray["{$file_counter}"]["size"] = $object['size'];
                $uploadedFilesArray["{$file_counter}"]["mime"] = validateEntry($_POST["mimetype" . $file_counter]);
                $uploadedFilesArray["{$file_counter}"]["relative_directory"] = validateDirectory($_POST["relpathinfo" . $file_counter]);
                $uploadedFilesArray["{$file_counter}"]["mtime"] = validateEntry($_POST["filemodificationdate" . $file_counter]);
            }
            // end if
        }
        // end foreach
        echo "Please wait, the files are being transferred to the FTP server...<br />\n";
        flush();
        // ------------------------------------
        // 2. POST METHOD: Move files from the *webserver's* temporary directory to *net2ftp's*
        // temporary directory (move_uploaded_files).
        // ------------------------------------
        if ($_SERVER["REQUEST_METHOD"] == "POST" && sizeof($uploadedFilesArray) > 0) {
            $moved_counter = 0;
            for ($j = 1; $j <= sizeof($uploadedFilesArray); $j++) {
                $file_name = $uploadedFilesArray["{$j}"]["name"];
                $file_tmp_name = $uploadedFilesArray["{$j}"]["tmp_name"];
                $file_size = $uploadedFilesArray["{$j}"]["size"];
                $file_error = $uploadedFilesArray["{$j}"]["error"];
                $file_relative_directory = $uploadedFilesArray["{$j}"]["relative_directory"];
                if ($file_name != "" && $file_tmp_name == "" || $file_size > $net2ftp_settings["max_filesize"]) {
                    // The case ($file_name != "" && $file_tmp_name == "") occurs when the file is bigger than the directives set in php.ini
                    // In that case, only $uploadedFilesArray["$j"]["name"] is filled in.
                    echo "WARNING: File <b>{$file_name}</b> skipped: this file is too big.<br />\n";
                    @unlink($file_tmp_name);
                    continue;
                } elseif (checkAuthorizedName($file_name) == false || checkAuthorizedName($file_relative_directory) == false) {
                    echo "WARNING: File <b>{$file_relative_directory}</b> skipped: it contains a banned keyword.<br />\n";
                    $skipped = $skipped + 1;
                    @unlink($file_tmp_name);
                    continue;
                }
                // Create the temporary filename as follows: (from left to right)
                // - Use prefix "upload__", to be able to identify from where this temporary file comes from
                // - Create a random filename
                // - Add the original filename extension, to be able to identify the filetype
                // - Add suffix ".txt" to avoid that the file would be executed on the webserver
                $extension = get_filename_extension($file_name);
                if (substr($file_name, -6) == "tar.gz") {
                    $extension = "tar.gz";
                }
                $tempfilename = tempnam2($net2ftp_globals["application_tempdir"], "upload__", "." . $extension . ".txt");
                if ($tempfilename == false) {
                    // If you get this warning message, you've probably forgotten to chmod 777 the /temp directory
                    echo "WARNING: File <b>{$file_name}</b> skipped: unable to create a temporary file on the webserver.<br />\n";
                    @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]);
                    // Check if the subdirectories exist
                    if ($targetdirectory != "") {
                        $result = @ftp_chdir($conn_id, $targetdirectory);
                        if ($result == false) {
                            $ftp_mkdir_result = ftp_mkdir($conn_id, $targetdirectory);
                            if ($ftp_mkdir_result == false) {
                                echo "WARNING: Unable to create the directory <b>{$targetdirectory}</b>. The script will try to continue...<br />\n";
                                continue;
                            }
                            echo "Directory {$targetdirectory} created.<br />\n";
                        }
                        // end if
                        flush();
                    }
                    // end if
                }
                // end for m
                // Store the $targetdirectory in the $acceptedFilesArray
                if ($targetdirectory != "" && $targetdirectory != "/") {
                    $acceptedFilesArray["{$k}"]["targetdirectory"] = $targetdirectory;
                }
                // ------------------------------
                // 3.3 Within the for loop: put local file to remote file
                // ------------------------------
                ftp_putfile($conn_id, "", $acceptedFilesArray["{$k}"]["tmp_name"], $acceptedFilesArray["{$k}"]["targetdirectory"], $acceptedFilesArray["{$k}"]["name"], $ftpmode, "move");
                if ($net2ftp_result["success"] == false) {
                    echo "ERROR: File <b>{$file_name}</b> skipped. Message: " . $net2ftp_result["errormessage"] . "<br />\n";
                    setErrorVars(true, "", "", "", "");
                    continue;
                } else {
                    echo "The file <b>{$file_name}</b> was transferred to the FTP server successfully. <br />\n";
                }
                flush();
            }
            // End for k
            // Note: the java applet is looking for the word "SUCCESS" to determine if the upload result is OK or not (see applet parameter stringUploadSuccess)
            // The applet doesn't seem to recognize the words "SUCCESS", "WARNING" or "ERROR" when they are issued by the code above
            echo "SUCCESS";
            // ------------------------------
            // 3.4 Close connection
            // ------------------------------
            ftp_quit($conn_id);
        }
        // end if
    }
    // end if $screen == 2
}
Exemplo n.º 3
0
?>


<?php 
require 'scraperwiki.php';
$endtime = time() + 60 * 60 * 23;
//23h
for ($id = 300001; $id <= 600000; $id++) {
    if ($endtime <= time()) {
        exit;
    }
    $i = 1;
    $delay = 250000;
    if (!validateEntry($id)) {
        print $id;
        while (!validateEntry($id)) {
            print ".";
            $delay = $delay + $i * 250000;
            //limit to 5 secs
            if ($delay > 5000000) {
                $delay = 5000000;
            }
            if ($i % 20 == 0) {
                $delay = 60000000;
            }
            if ($i == 61) {
                exit;
            }
            usleep($delay);
            ripById($id);
            $i++;
Exemplo n.º 4
0
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";
}
$net2ftp_globals["directory_html"] = htmlEncode2($net2ftp_globals["directory"]);
$net2ftp_globals["directory_url"] = urlEncode2($net2ftp_globals["directory"]);
$net2ftp_globals["directory_js"] = javascriptEncode2($net2ftp_globals["directory"]);
// printdirectory
if ($net2ftp_globals["directory"] != "" && $net2ftp_globals["directory"] != "/") {
    $net2ftp_globals["printdirectory"] = $net2ftp_globals["directory"];
} else {
    $net2ftp_globals["printdirectory"] = "/";
}
// ----------------------------------------------
// Entry
// ----------------------------------------------
if (isset($_POST["entry"]) == true) {
    $net2ftp_globals["entry"] = validateEntry($_POST["entry"]);
} elseif (isset($_GET["entry"]) == true) {
    $net2ftp_globals["entry"] = validateEntry($_GET["entry"]);
} else {
    $net2ftp_globals["entry"] = "";
}
$net2ftp_globals["entry_html"] = htmlEncode2($net2ftp_globals["entry"]);
$net2ftp_globals["entry_url"] = urlEncode2($net2ftp_globals["entry"]);
$net2ftp_globals["entry_js"] = javascriptEncode2($net2ftp_globals["entry"]);
// ----------------------------------------------
// Screen
// ----------------------------------------------
if (isset($_POST["screen"]) == true) {
    $net2ftp_globals["screen"] = validateScreen($_POST["screen"]);
} elseif (isset($_GET["screen"]) == true) {
    $net2ftp_globals["screen"] = validateScreen($_GET["screen"]);
} else {
    $net2ftp_globals["screen"] = validateScreen("");
function createOutput($domain_info, $record_type, $data_array, $type, $header_array)
{
    global $__FM_CONFIG;
    $html = null;
    extract($domain_info, EXTR_PREFIX_ALL, 'domain');
    /** Skips only allowed with clone zones and imports */
    $skips_allowed = $type == 'update' && ($domain_clone_of || $domain_template_id) ? true : false;
    foreach ($data_array as $id => $data) {
        if (!is_array($data)) {
            continue;
        }
        if (isset($data['Delete'])) {
            $action = __('Delete');
            $html .= buildInputReturn('update', $id, 'record_status', 'deleted');
            $value[$id] = $data;
        } elseif (array_key_exists('record_skipped', $data) && $skips_allowed) {
            if ($data['record_skipped'] == 'on') {
                $action = __('Skip Import');
                $html .= buildInputReturn('skip', $id, 'record_status', 'active');
            } else {
                $action = __('Include');
                $html .= buildInputReturn('skip', $id, 'record_status', 'deleted');
            }
            $value[$id] = $data;
        } else {
            $action = ucfirst($type);
            list($valid_data, $valid_html, $input_error[$id]) = validateEntry($type, $id, $data, $record_type);
            if (!isset($input_error[$id])) {
                unset($input_error[$id]);
            }
            $html .= $valid_html;
            if (is_array($valid_data)) {
                $value[$id] = $valid_data;
            }
        }
        if (is_array($value[$id])) {
            $value[$id]['action'] = $action;
        }
    }
    if (array_key_exists('soa_template_chosen', $value)) {
        unset($value['soa_template_chosen']);
    }
    foreach ($value as $id => $array) {
        if (count($input_error[$id]['errors'])) {
            $img = $__FM_CONFIG['icons']['fail'];
            $action = __('None');
        } else {
            $img = $__FM_CONFIG['icons']['ok'];
        }
        $html .= '<tr><td class="center">' . $img . '</td>';
        $html .= "<td>{$array['action']}</td>";
        foreach ($header_array as $head_id => $head_array) {
            if (!is_array($head_array) || !array_key_exists('rel', $head_array)) {
                continue;
            }
            $html .= '<td';
            if (in_array($head_array['rel'], array('record_append', 'soa_append'))) {
                $html .= ' class="center"';
            }
            if (empty($array[$head_array['rel']])) {
                $array[$head_array['rel']] = sprintf('<i>%s</i>', __('empty'));
            }
            $html .= '>' . $array[$head_array['rel']];
            if ($head_array['rel'] == 'record_value' && $array['record_append'] == 'yes' || in_array($head_array['rel'], array('soa_master_server', 'soa_email_address')) && $array['soa_append'] == 'yes') {
                $html .= '<span class="grey">.' . $domain_info['name'] . '</span>';
            }
            if (isset($input_error[$id]['errors'][$head_array['rel']])) {
                $html .= ' <span class="valid_error">' . $input_error[$id]['errors'][$head_array['rel']] . '</span>';
            }
            if (isset($input_error[$id]['info'][$head_array['rel']])) {
                $html .= ' <span class="valid_message">' . $input_error[$id]['info'][$head_array['rel']] . '</span>';
            }
            $html .= '</td>';
        }
        $html .= "</tr>\n";
    }
    return $html;
}
Exemplo n.º 7
0
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";
}
Exemplo n.º 8
0
function net2ftp_module_printBody()
{
    // --------------
    // This function prints the upload screen
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
    $file_counter = 0;
    $archive_counter = 0;
    // Normal upload
    if (isset($_FILES["file"]) == true && is_array($_FILES["file"]) == true) {
        foreach ($_FILES["file"]["name"] as $key => $val) {
            if ($val != "") {
                $file_counter = $file_counter + 1;
                $uploadedFilesArray["{$file_counter}"]["name"] = validateEntry($val);
                $uploadedFilesArray["{$file_counter}"]["tmp_name"] = $_FILES["file"]["tmp_name"][$key];
                $uploadedFilesArray["{$file_counter}"]["size"] = $_FILES["file"]["size"][$key];
            }
            // end if
        }
        // end foreach
    }
    if (isset($_FILES["archive"]) == true && is_array($_FILES["archive"]) == true) {
        foreach ($_FILES["archive"]["name"] as $key => $val) {
            if ($val != "") {
                $archive_counter = $archive_counter + 1;
                $uploadedArchivesArray["{$archive_counter}"]["name"] = validateEntry($val);
                $uploadedArchivesArray["{$archive_counter}"]["tmp_name"] = $_FILES["archive"]["tmp_name"][$key];
                $uploadedArchivesArray["{$archive_counter}"]["size"] = $_FILES["archive"]["size"][$key];
            }
            // end if
        }
        // end foreach
    }
    // Upload via SWFUpload Flash applet or using the OpenLaszlo skin
    if (isset($_FILES["Filedata"]) == true && is_array($_FILES["Filedata"]) == true) {
        $file_counter = $file_counter + 1;
        $uploadedFilesArray["{$file_counter}"]["name"] = $_FILES["Filedata"]["name"];
        $uploadedFilesArray["{$file_counter}"]["tmp_name"] = $_FILES["Filedata"]["tmp_name"];
        $uploadedFilesArray["{$file_counter}"]["size"] = $_FILES["Filedata"]["size"];
    }
    // -------------------------------------------------------------------------
    // Variables for all screens
    // -------------------------------------------------------------------------
    // Title
    // The title is different for screen 1 and screen 2 - see below
    // Form name, back and forward buttons
    $formname = "UploadForm";
    $back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
    $forward_onclick = "document.forms['" . $formname . "'].submit();";
    // Encoding type
    $enctype = "enctype=\"multipart/form-data\"";
    // Next screen
    $nextscreen = 2;
    // Maxima
    $max_filesize = $net2ftp_settings["max_filesize"];
    $max_filesize_net2ftp = $max_filesize / 1024;
    $max_upload_filesize_php = @ini_get("upload_max_filesize");
    $max_execution_time = @ini_get("max_execution_time");
    // -------------------------------------------------------------------------
    // Variables for screen 1
    // -------------------------------------------------------------------------
    if ($net2ftp_globals["screen"] == 1) {
        // Title
        $title = __("Upload files and archives");
    } elseif ($net2ftp_globals["screen"] == 2) {
        // Title
        $title = __("Upload more files and archives");
        // ---------------------------------------
        // Check the files and move them to the net2ftp temp directory
        // The .txt extension is added
        // ---------------------------------------
        if (sizeof($uploadedFilesArray) > 0 || sizeof($uploadedArchivesArray) > 0) {
            setStatus(1, 10, __("Checking files"));
            if (isset($uploadedFilesArray) == true) {
                $acceptedFilesArray = acceptFiles($uploadedFilesArray);
                if ($net2ftp_result["success"] == false) {
                    return false;
                }
            }
            if (isset($uploadedArchivesArray) == true) {
                $acceptedArchivesArray = acceptFiles($uploadedArchivesArray);
                if ($net2ftp_result["success"] == false) {
                    return false;
                }
            }
        }
        // ---------------------------------------
        // Transfer files
        // ---------------------------------------
        if (isset($acceptedFilesArray) == true && $acceptedFilesArray != "all_uploaded_files_are_too_big" && sizeof($acceptedFilesArray) > 0) {
            setStatus(0, 10, __("Transferring files to the FTP server"));
            ftp_transferfiles($acceptedFilesArray, $net2ftp_globals["directory"]);
            if ($net2ftp_result["success"] == false) {
                return false;
            }
        }
        // ---------------------------------------
        // Unzip archives and transfer the files (create subdirectories if needed)
        // ---------------------------------------
        if (isset($acceptedArchivesArray) == true && $acceptedArchivesArray != "all_uploaded_files_are_too_big" && sizeof($acceptedArchivesArray) > 0) {
            // Set the status
            setStatus(0, 10, __("Decompressing archives and transferring files"));
            // Add information to $acceptedArchivesArray
            for ($i = 1; $i <= sizeof($acceptedArchivesArray); $i = $i + 1) {
                $acceptedArchivesArray[$i]["targetdirectory"] = $net2ftp_globals["directory"];
            }
            // Unzip the archive and transfer the files
            ftp_unziptransferfiles($acceptedArchivesArray);
            if ($net2ftp_result["success"] == false) {
                return false;
            }
        }
    }
    // end elseif
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    if ($net2ftp_globals["skin"] == "openlaszlo") {
        require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.html.template.php";
    } else {
        require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php";
    }
}
Exemplo n.º 9
0
     }
     if ($categories) {
         $cats = explode(",", $categories);
         foreach ($cats as $cat) {
             if ($cat and !empty($cat)) {
                 $itemValue .= $categoryOpen . makeRssText($cat) . $categoryClose;
             }
         }
     }
     $itemTag .= $itemValue;
     $itemTag .= $itemClose;
     return $itemTag;
 }
 // function makeItemTag
 foreach ($pageList as $pageLine) {
     $processPage = validateEntry($pageLine);
     $page = explode("|", $pageLine);
     $rssLink = $rootUrl . trim($page[0]);
     $rssPubDate = trim($page[1]);
     $rssTitle = trim($page[5]);
     $rssDesc = trim($page[6]);
     $rssCats = trim($page[7]);
     if (empty($rssDesc)) {
         $rssDesc = $rssTitle;
     }
     if (empty($rssDesc)) {
         $processPage = FALSE;
     }
     if ($numItems > $maxItems) {
         $processPage = FALSE;
     }