1<?php 2 3// ------------------------------------------------------------------------------- 4// | net2ftp: a web based FTP client | 5// | Copyright (c) 2003-2017 by David Gartner | 6// | | 7// | This program is free software; you can redistribute it and/or | 8// | modify it under the terms of the GNU General Public License | 9// | as published by the Free Software Foundation; either version 2 | 10// | of the License, or (at your option) any later version. | 11// | | 12// ------------------------------------------------------------------------------- 13 14 15 16 17 18// ************************************************************************************** 19// ************************************************************************************** 20// ** ** 21// ** ** 22 23function net2ftp_module_sendHttpHeaders() { 24 25// -------------- 26// This function sends HTTP headers 27// -------------- 28 29// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result; 30 31} // end net2ftp_sendHttpHeaders 32 33// ** ** 34// ** ** 35// ************************************************************************************** 36// ************************************************************************************** 37 38 39 40 41 42// ************************************************************************************** 43// ************************************************************************************** 44// ** ** 45// ** ** 46 47function net2ftp_module_printJavascript() { 48 49// -------------- 50// This function prints Javascript code and includes 51// -------------- 52 53// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result; 54 55// Code 56// echo "<script type=\"text/javascript\"><!--\n"; 57// echo "//--></script>\n"; 58 59// Include 60// echo "<script type=\"text/javascript\" src=\"". $net2ftp_globals["application_rootdir_url"] . "/modules/login/login.js\"></script>\n"; 61 62} // end net2ftp_printJavascript 63 64// ** ** 65// ** ** 66// ************************************************************************************** 67// ************************************************************************************** 68 69 70 71 72 73// ************************************************************************************** 74// ************************************************************************************** 75// ** ** 76// ** ** 77 78function net2ftp_module_printCss() { 79 80// -------------- 81// This function prints CSS code and includes 82// -------------- 83 84 global $net2ftp_settings, $net2ftp_globals; 85 86// Include 87// echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"". $net2ftp_globals["application_rootdir_url"] . "/skins/" . $net2ftp_globals["skin"] . "/css/main.css.php?ltr=" . __("ltr") . "&image_url=" . urlEncode2($net2ftp_globals["image_url"]) . "\" />\n"; 88 89} // end net2ftp_printCssInclude 90 91// ** ** 92// ** ** 93// ************************************************************************************** 94// ************************************************************************************** 95 96 97 98 99 100// ************************************************************************************** 101// ************************************************************************************** 102// ** ** 103// ** ** 104 105function net2ftp_module_printBodyOnload() { 106 107// -------------- 108// This function prints the <body onload="" actions 109// -------------- 110 111// global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result; 112// echo ""; 113 114} // end net2ftp_printBodyOnload 115 116// ** ** 117// ** ** 118// ************************************************************************************** 119// ************************************************************************************** 120 121 122 123 124 125// ************************************************************************************** 126// ************************************************************************************** 127// ** ** 128// ** ** 129 130function net2ftp_module_printBody() { 131 132// -------------- 133// This function prints the rename screen 134// -------------- 135 136// ------------------------------------------------------------------------- 137// Global variables 138// ------------------------------------------------------------------------- 139 global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output; 140 141 if (isset($_POST["list"]) == true) { $list = getSelectedEntries($_POST["list"]); } 142 else { $list = ""; } 143 if (isset($_POST["newNames"]) == true) { $newNames = validateEntry($_POST["newNames"]); } 144 else { $newNames = ""; } 145 146// ------------------------------------------------------------------------- 147// Variables for all screens 148// ------------------------------------------------------------------------- 149 150// Title 151 $title = __("Rename directories and files"); 152 153// Form name, back and forward buttons 154 $formname = "RenameForm"; 155 $back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();"; 156 $forward_onclick = "document.forms['" . $formname . "'].submit();"; 157 158// ------------------------------------------------------------------------- 159// Variables for screen 1 160// ------------------------------------------------------------------------- 161 if ($net2ftp_globals["screen"] == 1) { 162 163// Next screen 164 $nextscreen = 2; 165 166 } // end if 167 168 169// ------------------------------------------------------------------------- 170// Variables for screen 2 171// ------------------------------------------------------------------------- 172 elseif ($net2ftp_globals["screen"] == 2) { 173 174// Open connection 175 setStatus(2, 10, __("Connecting to the FTP server")); 176 $conn_id = ftp_openconnection(); 177 if ($net2ftp_result["success"] == false) { return false; } 178 179// Rename files 180 setStatus(4, 10, __("Processing the entries")); 181 182 for ($i=1; $i<=sizeof($list["all"]); $i++) { 183 if (strstr($list["all"][$i]["dirfilename"], "..") != false) { 184 $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 />"; 185 continue; 186 } 187 if (checkAuthorizedName($newNames[$i]) == false) { 188 $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 />"; 189 continue; 190 } 191 ftp_rename2($conn_id, $net2ftp_globals["directory"], $list["all"][$i]["dirfilename"], $newNames[$i]); 192 if ($net2ftp_result["success"] == false) { 193 setErrorVars(true, "", "", "", ""); 194 $net2ftp_output["rename"][] = __("<b>%1\$s</b> could not be renamed to <b>%2\$s</b>", htmlEncode2($list["all"][$i]["dirfilename"]), htmlEncode2($newNames[$i])); 195 continue; 196 } 197 else { 198 $net2ftp_output["rename"][] = __("<b>%1\$s</b> was successfully renamed to <b>%2\$s</b>", htmlEncode2($list["all"][$i]["dirfilename"]), htmlEncode2($newNames[$i])); 199 } 200 } // End for 201 202// Close connection 203 ftp_closeconnection($conn_id); 204 205 } // end elseif 206 207// ------------------------------------------------------------------------- 208// Print the output 209// ------------------------------------------------------------------------- 210 require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php"); 211 212} // End net2ftp_printBody 213 214// ** ** 215// ** ** 216// ************************************************************************************** 217// ************************************************************************************** 218 219?>