- Timestamp:
- 06/04/08 01:37:02
(6 months ago)
- Author:
- rats
- Message:
* Updated net2ftp to version 0.97
* Updated SquirrelMail to version 1.4.15
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r928 |
r1198 |
|
| 3 | 3 | // ------------------------------------------------------------------------------- |
|---|
| 4 | 4 | // | net2ftp: a web based FTP client | |
|---|
| 5 | | // | Copyright (c) 2003-2007 by David Gartner | |
|---|
| | 5 | // | Copyright (c) 2003-2008 by David Gartner | |
|---|
| 6 | 6 | // | | |
|---|
| 7 | 7 | // | This program is free software; you can redistribute it and/or | |
|---|
| … | … | |
| 30 | 30 | |
|---|
| 31 | 31 | // Check if the FTP module of PHP is installed |
|---|
| 32 | | if (function_exists("ftp_connect") == false) { |
|---|
| | 32 | if (function_exists("ftp_connect") == false) { |
|---|
| 33 | 33 | $errormessage = __("The <a href=\"http://www.php.net/manual/en/ref.ftp.php\" target=\"_blank\">FTP module of PHP</a> is not installed.<br /><br /> The administrator of this website should install this FTP module. Installation instructions are given on <a href=\"http://www.php.net/manual/en/ref.ftp.php\" target=\"_blank\">php.net</a><br />"); |
|---|
| 34 | 34 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| … | … | |
| 37 | 37 | |
|---|
| 38 | 38 | // Decrypt password |
|---|
| 39 | | if (isset($_SESSION["net2ftp_password_encrypted_" . $net2ftp_globals["ftpserver"] . $net2ftp_globals["username"]]) == true) { |
|---|
| 40 | | $net2ftp_password = decryptPassword($_SESSION["net2ftp_password_encrypted_" . $net2ftp_globals["ftpserver"] . $net2ftp_globals["username"]]); |
|---|
| 41 | | } |
|---|
| 42 | | else { |
|---|
| 43 | | $net2ftp_password = decryptPassword($net2ftp_globals["password_encrypted"]); |
|---|
| | 39 | if (isset($_SESSION["net2ftp_password_encrypted_" . $net2ftp_globals["ftpserver"] . $net2ftp_globals["username"]]) == true) { |
|---|
| | 40 | $net2ftp_password = decryptPassword($_SESSION["net2ftp_password_encrypted_" . $net2ftp_globals["ftpserver"] . $net2ftp_globals["username"]]); |
|---|
| | 41 | } |
|---|
| | 42 | else { |
|---|
| | 43 | $net2ftp_password = decryptPassword($net2ftp_globals["password_encrypted"]); |
|---|
| 44 | 44 | } |
|---|
| 45 | 45 | |
|---|
| … | … | |
| 51 | 51 | if ($net2ftp_globals["sslconnect"] == "yes" && function_exists("ftp_ssl_connect")) { $ftp_connect = "ftp_ssl_connect"; } |
|---|
| 52 | 52 | |
|---|
| 53 | | $conn_id = ftp_connect($net2ftp_globals["ftpserver"], $net2ftp_globals["ftpserverport"]); |
|---|
| | 53 | $conn_id = $ftp_connect($net2ftp_globals["ftpserver"], $net2ftp_globals["ftpserverport"]); |
|---|
| 54 | 54 | if ($conn_id == false) { |
|---|
| 55 | | $errormessage = __("Unable to connect to FTP server <b>%1\$s</b> on port <b>%2\$s</b>.<br /><br />Are you sure this is the address of the FTP server? This is often different from that of the HTTP (web) server. Please contact your ISP helpdesk or system administrator for help.<br />", $net2ftp_globals["ftpserver"], $net2ftp_globals["ftpserverport"]); |
|---|
| | 55 | $errormessage = __("Unable to connect to FTP server <b>%1\$s</b> on port <b>%2\$s</b>.<br /><br />Are you sure this is the address of the FTP server? This is often different from that of the HTTP (web) server. Please contact your ISP helpdesk or system administrator for help.<br />", $net2ftp_globals["ftpserver"], $net2ftp_globals["ftpserverport"]); |
|---|
| 56 | 56 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| 57 | 57 | return false; |
|---|
| … | … | |
| 60 | 60 | // Login with username and password |
|---|
| 61 | 61 | $login_result = ftp_login($conn_id, $net2ftp_globals["username"], $net2ftp_password); |
|---|
| 62 | | if ($login_result == false) { |
|---|
| | 62 | if ($login_result == false) { |
|---|
| 63 | 63 | $errormessage = __("Unable to login to FTP server <b>%1\$s</b> with username <b>%2\$s</b>.<br /><br />Are you sure your username and password are correct? Please contact your ISP helpdesk or system administrator for help.<br />", $net2ftp_globals["ftpserver"], $net2ftp_globals["username"]); |
|---|
| 64 | 64 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| … | … | |
| 67 | 67 | |
|---|
| 68 | 68 | // Set passive mode |
|---|
| 69 | | if ($net2ftp_globals["passivemode"] == "yes") { |
|---|
| 70 | | $success = ftp_pasv($conn_id, TRUE); |
|---|
| 71 | | if ($success == false) { |
|---|
| | 69 | if ($net2ftp_globals["passivemode"] == "yes") { |
|---|
| | 70 | $success = ftp_pasv($conn_id, TRUE); |
|---|
| | 71 | if ($success == false) { |
|---|
| 72 | 72 | $errormessage = __("Unable to switch to the passive mode on FTP server <b>%1\$s</b>.", $net2ftp_globals["ftpserver"]); |
|---|
| 73 | 73 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| … | … | |
| 109 | 109 | |
|---|
| 110 | 110 | // Check if the FTP module of PHP is installed |
|---|
| 111 | | if (function_exists("ftp_connect") == false) { |
|---|
| | 111 | if (function_exists("ftp_connect") == false) { |
|---|
| 112 | 112 | $errormessage = __("The <a href=\"http://www.php.net/manual/en/ref.ftp.php\" target=\"_blank\">FTP module of PHP</a> is not installed.<br /><br /> The administrator of this website should install this FTP module. Installation instructions are given on <a href=\"http://www.php.net/manual/en/ref.ftp.php\" target=\"_blank\">php.net</a><br />"); |
|---|
| 113 | 113 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| … | … | |
| 120 | 120 | // Set up basic connection |
|---|
| 121 | 121 | $conn_id = ftp_connect($net2ftp_globals["ftpserver2"], $net2ftp_globals["ftpserverport2"]); |
|---|
| 122 | | if ($conn_id == false) { |
|---|
| | 122 | if ($conn_id == false) { |
|---|
| 123 | 123 | $errormessage = __("Unable to connect to the second (target) FTP server <b>%1\$s</b> on port <b>%2\$s</b>.<br /><br />Are you sure this is the address of the second (target) FTP server? This is often different from that of the HTTP (web) server. Please contact your ISP helpdesk or system administrator for help.<br />", $net2ftp_globals["ftpserver2"], $net2ftp_globals["ftpserverport2"]); |
|---|
| 124 | 124 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| … | … | |
| 128 | 128 | // Login with username and password |
|---|
| 129 | 129 | $login_result = ftp_login($conn_id, $net2ftp_globals["username2"], $net2ftp_globals["password2"]); |
|---|
| 130 | | if ($login_result == false) { |
|---|
| | 130 | if ($login_result == false) { |
|---|
| 131 | 131 | $errormessage = __("Unable to login to the second (target) FTP server <b>%1\$s</b> with username <b>%2\$s</b>.<br /><br />Are you sure your username and password are correct? Please contact your ISP helpdesk or system administrator for help.<br />", $net2ftp_globals["ftpserver2"], $net2ftp_globals["username2"]); |
|---|
| 132 | 132 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| … | … | |
| 135 | 135 | |
|---|
| 136 | 136 | // Set passive mode |
|---|
| 137 | | if ($net2ftp_globals["passivemode"] == "yes") { |
|---|
| 138 | | $success = ftp_pasv($conn_id, TRUE); |
|---|
| 139 | | if ($success == false) { |
|---|
| 140 | | $errormessage = __("Unable to switch to the passive mode on the second (target) FTP server <b>%1\$s</b>.", $net2ftp_globals["ftpserver2"]); |
|---|
| | 137 | if ($net2ftp_globals["passivemode"] == "yes") { |
|---|
| | 138 | $success = ftp_pasv($conn_id, TRUE); |
|---|
| | 139 | if ($success == false) { |
|---|
| | 140 | $errormessage = __("Unable to switch to the passive mode on the second (target) FTP server <b>%1\$s</b>.", $net2ftp_globals["ftpserver2"]); |
|---|
| 141 | 141 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| 142 | 142 | return false; |
|---|
| … | … | |
| 201 | 201 | |
|---|
| 202 | 202 | $ftp_rename_result = ftp_rename($conn_id, $old, $new); |
|---|
| 203 | | if ($ftp_rename_result == false) { |
|---|
| | 203 | if ($ftp_rename_result == false) { |
|---|
| 204 | 204 | $errormessage = __("Unable to rename directory or file <b>%1\$s</b> into <b>%2\$s</b>", $old, $new); |
|---|
| 205 | 205 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| … | … | |
| 232 | 232 | // $list[$i]["dirorfile"] contains d or - which indicates if the entry is a directory or a file |
|---|
| 233 | 233 | // $list[$i]["dirfilename"] contains the name of the entry |
|---|
| 234 | | // $list[$i]["chmodoctal"] contains the 3-digit nr |
|---|
| | 234 | // $list[$i]["chmodoctal"] contains the 3-digit nr |
|---|
| 235 | 235 | // |
|---|
| 236 | | // If the entry is a directory, $list[$i]["chmod_subdirectories"] and $list[$i]["chmod_subfiles"] are "yes" if |
|---|
| | 236 | // If the entry is a directory, $list[$i]["chmod_subdirectories"] and $list[$i]["chmod_subfiles"] are "yes" if |
|---|
| 237 | 237 | // the subdirectories and files within the chmodded directory should also be chmodded |
|---|
| 238 | 238 | // -------------- |
|---|
| … | … | |
| 246 | 246 | // Initialization |
|---|
| 247 | 247 | // ------------------------------------------------------------------------- |
|---|
| 248 | | if ($divelevel == 0) { |
|---|
| | 248 | if ($divelevel == 0) { |
|---|
| 249 | 249 | $net2ftp_output["ftp_chmod2"][] = "<ul>"; |
|---|
| 250 | 250 | } |
|---|
| … | … | |
| 259 | 259 | |
|---|
| 260 | 260 | // ------------------------------------ |
|---|
| 261 | | // Determine if the directory must first be chmodded (if chmodded to 5 or 7), |
|---|
| | 261 | // Determine if the directory must first be chmodded (if chmodded to 5 or 7), |
|---|
| 262 | 262 | // or first be traversed (if chmodded to other values) |
|---|
| 263 | 263 | // A problem is that we don't know if the FTP user is the owner/group/other of the file... |
|---|
| 264 | 264 | // ------------------------------------ |
|---|
| 265 | | if ($list["directories"][$i]["chmodoctal"] == 555 || |
|---|
| | 265 | if ($list["directories"][$i]["chmodoctal"] == 555 || |
|---|
| 266 | 266 | $list["directories"][$i]["chmodoctal"] == 557 || |
|---|
| 267 | 267 | $list["directories"][$i]["chmodoctal"] == 575 || |
|---|
| … | … | |
| 285 | 285 | $sitecommand = "chmod 0" . $list["directories"][$i]["chmodoctal"] . " $currentdirectory"; |
|---|
| 286 | 286 | $success1 = ftp_site($conn_id, $sitecommand); |
|---|
| 287 | | if ($success1 == false) { |
|---|
| 288 | | $errormessage = __("Unable to execute site command <b>%1\$s</b>. Note that the CHMOD command is only available on Unix FTP servers, not on Windows FTP servers.", $sitecommand); |
|---|
| | 287 | if ($success1 == false) { |
|---|
| | 288 | $errormessage = __("Unable to execute site command <b>%1\$s</b>. Note that the CHMOD command is only available on Unix FTP servers, not on Windows FTP servers.", $sitecommand); |
|---|
| 289 | 289 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| 290 | | return false; |
|---|
| | 290 | return false; |
|---|
| 291 | 291 | } |
|---|
| 292 | | elseif ($success1 == true) { |
|---|
| 293 | | $net2ftp_output["ftp_chmod2"][] = __("Directory <b>%1\$s</b> successfully chmodded to <b>%2\$s</b>", $currentdirectory, $list["directories"][$i]["chmodoctal"]); |
|---|
| | 292 | elseif ($success1 == true) { |
|---|
| | 293 | $net2ftp_output["ftp_chmod2"][] = __("Directory <b>%1\$s</b> successfully chmodded to <b>%2\$s</b>", $currentdirectory, $list["directories"][$i]["chmodoctal"]); |
|---|
| 294 | 294 | } |
|---|
| 295 | 295 | } |
|---|
| … | … | |
| 324 | 324 | |
|---|
| 325 | 325 | $net2ftp_output["ftp_chmod2"][] = "</ul>"; |
|---|
| 326 | | |
|---|
| | 326 | |
|---|
| 327 | 327 | } // end if subdirectories and files |
|---|
| 328 | 328 | |
|---|
| … | … | |
| 335 | 335 | $sitecommand = "chmod 0" . $list["directories"][$i]["chmodoctal"] . " $currentdirectory"; |
|---|
| 336 | 336 | $success1 = ftp_site($conn_id, $sitecommand); |
|---|
| 337 | | if ($success1 == false) { |
|---|
| 338 | | $errormessage = __("Unable to execute site command <b>%1\$s</b>. Note that the CHMOD command is only available on Unix FTP servers, not on Windows FTP servers.", $sitecommand); |
|---|
| | 337 | if ($success1 == false) { |
|---|
| | 338 | $errormessage = __("Unable to execute site command <b>%1\$s</b>. Note that the CHMOD command is only available on Unix FTP servers, not on Windows FTP servers.", $sitecommand); |
|---|
| 339 | 339 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| 340 | | return false; |
|---|
| | 340 | return false; |
|---|
| 341 | 341 | } |
|---|
| 342 | | elseif ($success1 == true) { |
|---|
| 343 | | $net2ftp_output["ftp_chmod2"][] = __("Directory <b>%1\$s</b> successfully chmodded to <b>%2\$s</b>", $currentdirectory, $list["directories"][$i]["chmodoctal"]); |
|---|
| | 342 | elseif ($success1 == true) { |
|---|
| | 343 | $net2ftp_output["ftp_chmod2"][] = __("Directory <b>%1\$s</b> successfully chmodded to <b>%2\$s</b>", $currentdirectory, $list["directories"][$i]["chmodoctal"]); |
|---|
| 344 | 344 | } |
|---|
| 345 | 345 | } |
|---|
| … | … | |
| 361 | 361 | $sitecommand = "chmod 0" . $list["files"][$i]["chmodoctal"] . " $currentfile"; |
|---|
| 362 | 362 | $success2 = ftp_site($conn_id, $sitecommand); |
|---|
| 363 | | if ($success2 == false) { |
|---|
| 364 | | $errormessage = __("Unable to execute site command <b>%1\$s</b>. Note that the CHMOD command is only available on Unix FTP servers, not on Windows FTP servers.", $sitecommand); |
|---|
| | 363 | if ($success2 == false) { |
|---|
| | 364 | $errormessage = __("Unable to execute site command <b>%1\$s</b>. Note that the CHMOD command is only available on Unix FTP servers, not on Windows FTP servers.", $sitecommand); |
|---|
| 365 | 365 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| 366 | | return false; |
|---|
| | 366 | return false; |
|---|
| 367 | 367 | } |
|---|
| 368 | | elseif ($success2 == true) { |
|---|
| | 368 | elseif ($success2 == true) { |
|---|
| 369 | 369 | $net2ftp_output["ftp_chmod2"][] = __("File <b>%1\$s</b> was successfully chmodded to <b>%2\$s</b>", $currentfile, $list["files"][$i]["chmodoctal"]); |
|---|
| 370 | 370 | } |
|---|
| … | … | |
| 417 | 417 | $lastpartnr = sizeof($parts)-1; |
|---|
| 418 | 418 | $success2 = ftp_rmdir($conn_id, $parts[$lastpartnr]); |
|---|
| 419 | | if ($success2 == false) { |
|---|
| 420 | | $errormessage = __("Unable to delete the directory <b>%1\$s</b>", $directory); |
|---|
| | 419 | if ($success2 == false) { |
|---|
| | 420 | $errormessage = __("Unable to delete the directory <b>%1\$s</b>", $directory); |
|---|
| 421 | 421 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| 422 | 422 | return false; |
|---|
| … | … | |
| 462 | 462 | $lastpartnr = sizeof($parts)-1; |
|---|
| 463 | 463 | $success2 = ftp_delete($conn_id, $parts[$lastpartnr]); |
|---|
| 464 | | if ($success2 == false) { |
|---|
| 465 | | $errormessage = __("Unable to delete the file <b>%1\$s</b>", $file); |
|---|
| | 464 | if ($success2 == false) { |
|---|
| | 465 | $errormessage = __("Unable to delete the file <b>%1\$s</b>", $file); |
|---|
| 466 | 466 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| 467 | 467 | return false; |
|---|
| … | … | |
| 492 | 492 | |
|---|
| 493 | 493 | $success1 = ftp_mkdir($conn_id, $directory); |
|---|
| 494 | | if ($success1 == false) { |
|---|
| | 494 | if ($success1 == false) { |
|---|
| 495 | 495 | $errormessage = __("Unable to create the directory <b>%1\$s</b>", $directory); |
|---|
| 496 | 496 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| … | … | |
| 531 | 531 | // Step 1/4: Create a temporary filename |
|---|
| 532 | 532 | $tempfilename = tempnam($net2ftp_globals["application_tempdir"], "read__"); |
|---|
| 533 | | if ($tempfilename == false) { |
|---|
| 534 | | @unlink($tempfilename); |
|---|
| | 533 | if ($tempfilename == false) { |
|---|
| | 534 | @unlink($tempfilename); |
|---|
| 535 | 535 | $errormessage = __("Unable to create the temporary file. Check the permissions of the %1\$s directory.", $net2ftp_globals["application_tempdir"]); |
|---|
| 536 | 536 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| … | … | |
| 543 | 543 | if ($conn_id == "") { |
|---|
| 544 | 544 | $conn_id = ftp_openconnection(); |
|---|
| 545 | | if ($net2ftp_result["success"] == false) { |
|---|
| 546 | | @unlink($tempfilename); |
|---|
| | 545 | if ($net2ftp_result["success"] == false) { |
|---|
| | 546 | @unlink($tempfilename); |
|---|
| 547 | 547 | return false; |
|---|
| 548 | 548 | } |
|---|
| … | … | |
| 564 | 564 | |
|---|
| 565 | 565 | $ftp_get_result = ftp_get($conn_id, "$tempfilename", "$source", $ftpmode); |
|---|
| 566 | | if ($ftp_get_result == false) { |
|---|
| 567 | | @unlink($tempfilename); |
|---|
| | 566 | if ($ftp_get_result == false) { |
|---|
| | 567 | @unlink($tempfilename); |
|---|
| 568 | 568 | $errormessage = __("Unable to get the file <b>%1\$s</b> from the FTP server and to save it as temporary file <b>%2\$s</b>.<br />Check the permissions of the %3\$s directory.<br />", $source, $tempfilename, $net2ftp_globals["application_tempdir"]); |
|---|
| 569 | 569 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| … | … | |
| 583 | 583 | // Step 4/4: Delete temporary file |
|---|
| 584 | 584 | $unlink_result = @unlink($tempfilename); |
|---|
| 585 | | if ($unlink_result == false) { |
|---|
| 586 | | $errormessage = __("Unable to delete the temporary file"); |
|---|
| | 585 | if ($unlink_result == false) { |
|---|
| | 586 | $errormessage = __("Unable to delete the temporary file"); |
|---|
| 587 | 587 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| 588 | 588 | return false; |
|---|
| 589 | | } |
|---|
| | 589 | } |
|---|
| 590 | 590 | registerTempfile("unregister", $tempfilename); |
|---|
| 591 | 591 | |
|---|
| … | … | |
| 641 | 641 | // Step 1/4: Create a temporary filename |
|---|
| 642 | 642 | $tempfilename = tempnam($net2ftp_globals["application_tempdir"], "write__"); |
|---|
| 643 | | if ($tempfilename == false) { |
|---|
| 644 | | @unlink($tempfilename); |
|---|
| 645 | | $errormessage = __("Unable to create the temporary file. Check the permissions of the %1\$s directory.", $net2ftp_globals["application_tempdir"]); |
|---|
| | 643 | if ($tempfilename == false) { |
|---|
| | 644 | @unlink($tempfilename); |
|---|
| | 645 | $errormessage = __("Unable to create the temporary file. Check the permissions of the %1\$s directory.", $net2ftp_globals["application_tempdir"]); |
|---|
| 646 | 646 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| 647 | 647 | return false; |
|---|
| … | … | |
| 683 | 683 | |
|---|
| 684 | 684 | $success3 = ftp_put($conn_id, $target, $tempfilename, $ftpmode); |
|---|
| 685 | | if ($success3 == false) { |
|---|
| 686 | | @unlink($tempfilename); |
|---|
| | 685 | if ($success3 == false) { |
|---|
| | 686 | @unlink($tempfilename); |
|---|
| 687 | 687 | $errormessage = __("Unable to put the file <b>%1\$s</b> on the FTP server.<br />You may not have write permissions on the directory.", $target); |
|---|
| 688 | 688 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| … | … | |
| 695 | 695 | // Step 4/4: Delete temporary file |
|---|
| 696 | 696 | $success4 = @unlink($tempfilename); |
|---|
| 697 | | if ($success4 == false) { |
|---|
| 698 | | $errormessage = __("Unable to delete the temporary file"); |
|---|
| | 697 | if ($success4 == false) { |
|---|
| | 698 | $errormessage = __("Unable to delete the temporary file"); |
|---|
| 699 | 699 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| 700 | 700 | return false; |
|---|
| 701 | | } |
|---|
| | 701 | } |
|---|
| 702 | 702 | registerTempfile("unregister", $tempfilename); |
|---|
| 703 | 703 | |
|---|
| … | … | |
| 722 | 722 | // -------------- |
|---|
| 723 | 723 | // This function copies/moves/deletes directories and files from an FTP server to the same |
|---|
| 724 | | // or another FTP server. Files are first transferred from the source FTP server to the webserver, |
|---|
| | 724 | // or another FTP server. Files are first transferred from the source FTP server to the webserver, |
|---|
| 725 | 725 | // and then transferred to the target FTP server. |
|---|
| 726 | 726 | // |
|---|
| … | … | |
| 760 | 760 | if ($copymovedelete == "copy" || $copymovedelete == "move") { |
|---|
| 761 | 761 | if ($divelevel > 0) { $target = glueDirectories($list["directories"][$i]["targetdirectory"], $list["directories"][$i]["dirfilename"]); } // Subdirectories keep their original names |
|---|
| 762 | | else { $target = glueDirectories($list["directories"][$i]["targetdirectory"], $list["directories"][$i]["newname"]); } // First-level user-selected directories can have been renamed |
|---|
| | 762 | else { $target = glueDirectories($list["directories"][$i]["targetdirectory"], $list["directories"][$i]["newname"]); } // First-level user-selected directories can have been renamed |
|---|
| 763 | 763 | } |
|---|
| 764 | 764 | else { |
|---|
| … | … | |
| 772 | 772 | |
|---|
| 773 | 773 | // Check that the targetdirectory is not a subdirectory of the sourcedirectory |
|---|
| 774 | | if (($conn_id_source == $conn_id_target) && ($copymovedelete != "delete") && (isSubdirectory($source, $target) == true)) { |
|---|
| 775 | | $net2ftp_output["ftp_copymovedelete"][] = __("The target directory <b>%1\$s</b> is the same as or a subdirectory of the source directory <b>%2\$s</b>, so this directory will be skipped", $target, $source); |
|---|
| | 774 | if (($conn_id_source == $conn_id_target) && ($copymovedelete != "delete") && (isSubdirectory($source, $target) == true)) { |
|---|
| | 775 | $net2ftp_output["ftp_copymovedelete"][] = __("The target directory <b>%1\$s</b> is the same as or a subdirectory of the source directory <b>%2\$s</b>, so this directory will be skipped", $target, $source); |
|---|
| 776 | 776 | $net2ftp_output["ftp_copymovedelete"][] = "</ul>"; |
|---|
| 777 | | continue; |
|---|
| | 777 | continue; |
|---|
| 778 | 778 | } |
|---|
| 779 | 779 | |
|---|
| … | … | |
| 781 | 781 | // If banned keyword - copy: continue |
|---|
| 782 | 782 | // If banned keyword - move: abort |
|---|
| 783 | | if ($list["directories"][$i]["selectable"] == "banned_keyword") { |
|---|
| | 783 | if ($list["directories"][$i]["selectable"] == "banned_keyword") { |
|---|
| 784 | 784 | if ($copymovedelete == "copy") { |
|---|
| 785 | 785 | $net2ftp_output["ftp_copymovedelete"][] = __("The directory <b>%1\$s</b> contains a banned keyword, so this directory will be skipped", $source); |
|---|
| … | … | |
| 804 | 804 | // Get a new list |
|---|
| 805 | 805 | $newlist = ftp_getlist($conn_id_source, $source); |
|---|
| 806 | | if ($net2ftp_result["success"] == false) { |
|---|
| | 806 | if ($net2ftp_result["success"] == false) { |
|---|
| 807 | 807 | $net2ftp_output["ftp_copymovedelete"][] = __("The directory <b>%1\$s</b> could not be selected, so this directory will be skipped", $source); |
|---|
| 808 | 808 | $net2ftp_output["ftp_copymovedelete"][] = "</ul>"; |
|---|
| 809 | | setErrorVars(true, "", "", "", ""); |
|---|
| | 809 | setErrorVars(true, "", "", "", ""); |
|---|
| 810 | 810 | continue; |
|---|
| 811 | 811 | } |
|---|
| … | … | |
| 827 | 827 | // Delete the source directory |
|---|
| 828 | 828 | // (Only if there were no problems in the recursive call to ftp_copymovedelete() above) |
|---|
| 829 | | if ($ftp_copymovedelete_result == true && ($copymovedelete == "move" || $copymovedelete == "delete")) { |
|---|
| | 829 | if ($ftp_copymovedelete_result == true && ($copymovedelete == "move" || $copymovedelete == "delete")) { |
|---|
| 830 | 830 | ftp_rmdir2($conn_id_source, $source); |
|---|
| 831 | | if ($net2ftp_result["success"] == false) { |
|---|
| 832 | | setErrorVars(true, "", "", "", ""); |
|---|
| 833 | | $net2ftp_output["ftp_copymovedelete"][] = __("Unable to delete the subdirectory <b>%1\$s</b> - it may not be empty", $source); |
|---|
| | 831 | if ($net2ftp_result["success"] == false) { |
|---|
| | 832 | setErrorVars(true, "", "", "", ""); |
|---|
| | 833 | $net2ftp_output["ftp_copymovedelete"][] = __("Unable to delete the subdirectory <b>%1\$s</b> - it may not be empty", $source); |
|---|
| 834 | 834 | } |
|---|
| 835 | | else { |
|---|
| | 835 | else { |
|---|
| 836 | 836 | $net2ftp_output["ftp_copymovedelete"][] = __("Deleted subdirectory <b>%1\$s</b>", $source); |
|---|
| 837 | 837 | } |
|---|
| … | … | |
| 865 | 865 | |
|---|
| 866 | 866 | // Check that the target is not the same as the source file |
|---|
| 867 | | if (($conn_id_source == $conn_id_target) && ($target == $source)) { |
|---|
| | 867 | if (($conn_id_source == $conn_id_target) && ($target == $source)) { |
|---|
| 868 | 868 | $net2ftp_output["ftp_copymovedelete"][] = __("The target for file <b>%1\$s</b> is the same as the source, so this file will be skipped", $source); |
|---|
| 869 | 869 | continue; |
|---|
| … | … | |
| 873 | 873 | // If banned keyword or too big - copy: continue with the other files |
|---|
| 874 | 874 | // If banned keyword or too big - move: abort |
|---|
| 875 | | if ($list["files"][$i]["selectable"] == "banned_keyword") { |
|---|
| | 875 | if ($list["files"][$i]["selectable"] == "banned_keyword") { |
|---|
| 876 | 876 | if ($copymovedelete == "copy") { |
|---|
| 877 | 877 | $net2ftp_output["ftp_copymovedelete"][] = __("The file <b>%1\$s</b> contains a banned keyword, so this file will be skipped", $source); |
|---|
| … | … | |
| 883 | 883 | } |
|---|
| 884 | 884 | } |
|---|
| 885 | | elseif ($list["files"][$i]["selectable"] == "too_big") { |
|---|
| | 885 | elseif ($list["files"][$i]["selectable"] == "too_big") { |
|---|
| 886 | 886 | if ($copymovedelete == "copy") { |
|---|
| 887 | 887 | $net2ftp_output["ftp_copymovedelete"][] = __("The file <b>%1\$s</b> is too big to be copied, so this file will be skipped", $source); |
|---|
| … | … | |
| 904 | 904 | |
|---|
| 905 | 905 | ftp_getfile($conn_id_source, $localtargetdir, $localtargetfile, $remotesourcedir, $remotesourcefile, $ftpmode, $copymove); |
|---|
| 906 | | if ($net2ftp_result["success"] == false) { |
|---|
| | 906 | if ($net2ftp_result["success"] == false) { |
|---|
| 907 | 907 | setErrorVars(true, "", "", "", ""); |
|---|
| 908 | | if ($copymovedelete == "copy") { |
|---|
| 909 | | $net2ftp_output["ftp_copymovedelete"][] = __("Unable to copy the file <b>%1\$s</b>", $list["files"][$i]["dirfilename"]); |
|---|
| 910 | | continue; |
|---|
| | 908 | if ($copymovedelete == "copy") { |
|---|
| | 909 | $net2ftp_output["ftp_copymovedelete"][] = __("Unable to copy the file <b>%1\$s</b>", $list["files"][$i]["dirfilename"]); |
|---|
| | 910 | continue; |
|---|
| 911 | 911 | } |
|---|
| 912 | | elseif ($copymovedelete == "move") { |
|---|
| 913 | | $net2ftp_output["ftp_copymovedelete"][] = __("Unable to move the file <b>%1\$s</b>, aborting the move", $list["files"][$i]["dirfilename"]); |
|---|
| | 912 | elseif ($copymovedelete == "move") { |
|---|
| | 913 | $net2ftp_output["ftp_copymovedelete"][] = __("Unable to move the file <b>%1\$s</b>, aborting the move", $list["files"][$i]["dirfilename"]); |
|---|
| 914 | 914 | return false; |
|---|
| 915 | 915 | } |
|---|
| … | … | |
| 926 | 926 | |
|---|
| 927 | 927 | ftp_putfile($conn_id_target, $localsourcedir, $localsourcefile, $remotetargetdir, $remotetargetfile, $ftpmode, $copymove); |
|---|
| 928 | | if ($net2ftp_result["success"] == false) { |
|---|
| | 928 | if ($net2ftp_result["success"] == false) { |
|---|
| 929 | 929 | setErrorVars(true, "", "", "", ""); |
|---|
| 930 | | if ($copymovedelete == "copy") { |
|---|
| 931 | | $net2ftp_output["ftp_copymovedelete"][] = __("Unable to copy the file <b>%1\$s</b>", $list["files"][$i]["dirfilename"]); |
|---|
| 932 | | continue; |
|---|
| | 930 | if ($copymovedelete == "copy") { |
|---|
| | 931 | $net2ftp_output["ftp_copymovedelete"][] = __("Unable to copy the file <b>%1\$s</b>", $list["files"][$i]["dirfilename"]); |
|---|
| | 932 | continue; |
|---|
| 933 | 933 | } |
|---|
| 934 | | elseif ($copymovedelete == "move") { |
|---|
| 935 | | $net2ftp_output["ftp_copymovedelete"][] = __("Unable to move the file <b>%1\$s</b>, aborting the move", $list["files"][$i]["dirfilename"]); |
|---|
| | 934 | elseif ($copymovedelete == "move") { |
|---|
| | 935 | $net2ftp_output["ftp_copymovedelete"][] = __("Unable to move the file <b>%1\$s</b>, aborting the move", $list["files"][$i]["dirfilename"]); |
|---|
| 936 | 936 | return false; |
|---|
| 937 | 937 | } |
|---|
| … | … | |
| 939 | 939 | |
|---|
| 940 | 940 | // Copy: if the operation is successful, print a message |
|---|
| 941 | | elseif ($net2ftp_result["success"] == true && $copymovedelete == "copy") { |
|---|
| 942 | | $net2ftp_output["ftp_copymovedelete"][] = __("Copied file <b>%1\$s</b>", $list["files"][$i]["dirfilename"]); |
|---|
| | 941 | elseif ($net2ftp_result["success"] == true && $copymovedelete == "copy") { |
|---|
| | 942 | $net2ftp_output["ftp_copymovedelete"][] = __("Copied file <b>%1\$s</b>", $list["files"][$i]["dirfilename"]); |
|---|
| 943 | 943 | } |
|---|
| 944 | 944 | |
|---|
| 945 | 945 | // Move: only if the operation is successful, delete the source file |
|---|
| 946 | | elseif ($copymovedelete == "move") { |
|---|
| | 946 | elseif ($copymovedelete == "move") { |
|---|
| 947 | 947 | $remotesource = glueDirectories($list["files"][$i]["sourcedirectory"], $list["files"][$i]["dirfilename"]); |
|---|
| 948 | 948 | |
|---|
| 949 | 949 | ftp_delete2($conn_id_source, $remotesource); |
|---|
| 950 | | if ($net2ftp_result["success"] == false) { |
|---|
| 951 | | setErrorVars(true, "", "", "", ""); |
|---|
| | 950 | if ($net2ftp_result["success"] == false) { |
|---|
| | 951 | setErrorVars(true, "", "", "", ""); |
|---|
| 952 | 952 | $net2ftp_output["ftp_copymovedelete"][] = __("Unable to move the file <b>%1\$s</b>", $list["files"][$i]["dirfilename"]); |
|---|
| 953 | 953 | } |
|---|
| 954 | | else { |
|---|
| 955 | | $net2ftp_output["ftp_copymovedelete"][] = __("Moved file <b>%1\$s</b>", $list["files"][$i]["dirfilename"]); |
|---|
| | 954 | else { |
|---|
| | 955 | $net2ftp_output["ftp_copymovedelete"][] = __("Moved file <b>%1\$s</b>", $list["files"][$i]["dirfilename"]); |
|---|
| 956 | 956 | } |
|---|
| 957 | 957 | } |
|---|
| … | … | |
| 966 | 966 | |
|---|
| 967 | 967 | ftp_delete2($conn_id_source, $remotesource); |
|---|
| 968 | | if ($net2ftp_result["success"] == false) { |
|---|
| 969 | | setErrorVars(true, "", "", "", ""); |
|---|
| 970 | | $net2ftp_output["ftp_copymovedelete"][] = __("Unable to delete the file <b>%1\$s</b>", $list["files"][$i]["dirfilename"]); |
|---|
| | 968 | if ($net2ftp_result["success"] == false) { |
|---|
| | 969 | setErrorVars(true, "", "", "", ""); |
|---|
| | 970 | $net2ftp_output["ftp_copymovedelete"][] = __("Unable to delete the file <b>%1\$s</b>", $list["files"][$i]["dirfilename"]); |
|---|
| 971 | 971 | continue; |
|---|
| 972 | 972 | } |
|---|
| 973 | | else { |
|---|
| 974 | | $net2ftp_output["ftp_copymovedelete"][] = __("Deleted file <b>%1\$s</b>", $list["files"][$i]["dirfilename"]); |
|---|
| | 973 | else { |
|---|
| | 974 | $net2ftp_output["ftp_copymovedelete"][] = __("Deleted file <b>%1\$s</b>", $list["files"][$i]["dirfilename"]); |
|---|
| 975 | 975 | } |
|---|
| 976 | 976 | |
|---|
| … | … | |
| 1006 | 1006 | // -------------- |
|---|
| 1007 | 1007 | // This function does something with files (get size, find string, ...) |
|---|
| 1008 | | // The $list contains both directories and files. The files are simply processed; the |
|---|
| | 1008 | // The $list contains both directories and files. The files are simply processed; the |
|---|
| 1009 | 1009 | // directories are parsed recursively. |
|---|
| 1010 | 1010 | // |
|---|
| … | … | |
| 1012 | 1012 | // $list[$i]["dirfilename"] contains the name of the entry |
|---|
| 1013 | 1013 | // $list[$i]["size"] contains the size of the entry |
|---|
| 1014 | | // |
|---|
| | 1014 | // |
|---|
| 1015 | 1015 | // OPTIONS: |
|---|
| 1016 | 1016 | // if ($dowhat == "calculatesize") then |
|---|
| … | … | |
| 1030 | 1030 | // $result[$k]["directory"] contains the directory |
|---|
| 1031 | 1031 | // $result[$k]["dirfilename"] contains the filename |
|---|
| 1032 | | // $result[$k]["line"] contains the line nr |
|---|
| | 1032 | // $result[$k]["line"] contains the line nr |
|---|
| 1033 | 1033 | // |
|---|
| 1034 | 1034 | // -------------- |
|---|
| … | … | |
| 1042 | 1042 | // Initialization |
|---|
| 1043 | 1043 | // ------------------------------------------------------------------------- |
|---|
| 1044 | | if ($divelevel == 0) { |
|---|
| | 1044 | if ($divelevel == 0) { |
|---|
| 1045 | 1045 | |
|---|
| 1046 | 1046 | } |
|---|
| … | … | |
| 1089 | 1089 | |
|---|
| 1090 | 1090 | // Check that the file is smaller than the maximum file size that can be processed with net2ftp |
|---|
| 1091 | | if ($list["files"][$i]["selectable"] != "ok") { |
|---|
| | 1091 | if ($list["files"][$i]["selectable"] != "ok") { |
|---|
| 1092 | 1092 | continue; |
|---|
| 1093 | 1093 | } |
|---|
| 1094 | 1094 | |
|---|
| 1095 | 1095 | // Check that the file is within the limits indicated on the selection screen |
|---|
| 1096 | | if ($list["files"][$i]["size"] < $options["size_from"] || $list["files"][$i]["size"] > $options["size_to"]) { |
|---|
| | 1096 | if ($list["files"][$i]["size"] < $options["size_from"] || $list["files"][$i]["size"] > $options["size_to"]) { |
|---|
| 1097 | 1097 | // echo "File $i skipped"; |
|---|
| 1098 | 1098 | continue; |
|---|
| … | … | |
| 1136 | 1136 | } |
|---|
| 1137 | 1137 | |
|---|
| 1138 | | } // end for |
|---|
| | 1138 | } // end for |
|---|
| 1139 | 1139 | |
|---|
| 1140 | 1140 | } // end if findstring |
|---|
| … | … | |
| 1184 | 1184 | // Check if the filesize is smaller than the allowed filesize |
|---|
| 1185 | 1185 | // $ftp_size_result = ftp_size($conn_id, $remotesource); |
|---|
| 1186 | | // if ($ftp_size_result > $net2ftp_settings["max_filesize"]) { |
|---|
| | 1186 | // if ($ftp_size_result > $net2ftp_settings["max_filesize"]) { |
|---|
| 1187 | 1187 | // $errormessage = __("The file is too big to be transferred"); |
|---|
| 1188 | 1188 | // setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| … | … | |
| 1199 | 1199 | // Get file |
|---|
| 1200 | 1200 | $success1 = ftp_get($conn_id, $localtarget, $remotesource, $ftpmode); |
|---|
| 1201 | | if ($success1 == false) { |
|---|
| 1202 | | $errormessage = __("Unable to copy the remote file <b>%1\$s</b> to the local file using FTP mode <b>%2\$s</b>", $remotesource, $printftpmode); |
|---|
| | 1201 | if ($success1 == false) { |
|---|
| | 1202 | $errormessage = __("Unable to copy the remote file <b>%1\$s</b> to the local file using FTP mode <b>%2\$s</b>", $remotesource, $printftpmode); |
|---|
| 1203 | 1203 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| 1204 | 1204 | return false; |
|---|
| … | … | |
| 1213 | 1213 | if ($copymove != "copy") { |
|---|
| 1214 | 1214 | $success2 = ftp_delete2($conn_id, $remotesource); |
|---|
| 1215 | | if ($success2 == false) { |
|---|
| | 1215 | if ($success2 == false) { |
|---|
| 1216 | 1216 | $errormessage = __("Unable to delete file <b>%1\$s</b>", $remotesource); |
|---|
| 1217 | 1217 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| … | … | |
| 1256 | 1256 | // In the function ftp_put, use FTP_BINARY without the double quotes, otherwhise ftp_put assumes FTP_ASCII |
|---|
| 1257 | 1257 | // DO NOT REMOVE THIS OR THE BINARY FILES WILL BE CORRUPTED (when copying, moving, uploading,...) |
|---|
| 1258 | | if ($ftpmode == "FTP_BINARY") { $ftpmode = FTP_BINARY; } |
|---|
| | 1258 | if ($ftpmode == "FTP_BINARY") { $ftpmode = FTP_BINARY; } |
|---|
| 1259 | 1259 | |
|---|
| 1260 | 1260 | if ($ftpmode == FTP_ASCII) { $printftpmode = "FTP_ASCII"; } |
|---|
| … | … | |
| 1262 | 1262 | |
|---|
| 1263 | 1263 | // Check if the filesize is smaller than the allowed filesize |
|---|
| 1264 | | if (filesize($localsource) > $net2ftp_settings["max_filesize"]) { |
|---|
| | 1264 | if (filesize($localsource) > $net2ftp_settings["max_filesize"]) { |
|---|
| 1265 | 1265 | $errormessage = __("The file is too big to be transferred"); |
|---|
| 1266 | 1266 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| … | … | |
| 1282 | 1282 | // int ftp_put (int ftp_stream, string remote_file, string local_file, int mode) |
|---|
| 1283 | 1283 | $success1 = ftp_put($conn_id, $remotetarget, $localsource, $ftpmode); |
|---|
| 1284 | | if ($success1 == false) { |
|---|
| 1285 | | $errormessage = __("Unable to copy the local file to the remote file <b>%1\$s</b> using FTP mode <b>%2\$s</b>", $remotetarget, $printftpmode); |
|---|
| | 1284 | if ($success1 == false) { |
|---|
| | 1285 | $errormessage = __("Unable to copy the local file to the remote file <b>%1\$s</b> using FTP mode <b>%2\$s</b>", $remotetarget, $printftpmode); |
|---|
| 1286 | 1286 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| 1287 | 1287 | return false; |
|---|
| … | … | |
| 1296 | 1296 | if ($copymove != "copy") { |
|---|
| 1297 | 1297 | $success2 = unlink($localsource); |
|---|
| 1298 | | if ($success2 == false) { |
|---|
| 1299 | | $errormessage = __("Unable to delete the local file"); |
|---|
| | 1298 | if ($success2 == false) { |
|---|
| | 1299 | $errormessage = __("Unable to delete the local file"); |
|---|
| 1300 | 1300 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| 1301 | 1301 | return false; |
|---|
| … | … | |
| 1349 | 1349 | elseif (strpos($entry, ".mpp") !== false) { $content_type = "application/vnd.ms-project"; } |
|---|
| 1350 | 1350 | } |
|---|
| 1351 | | |
|---|
| | 1351 | |
|---|
| 1352 | 1352 | return $content_type; |
|---|
| 1353 | 1353 | } |
|---|
| … | … | |
| 1384 | 1384 | // Check if the filesize is smaller than the allowed filesize |
|---|
| 1385 | 1385 | // $ftp_size_result = ftp_size($conn_id, "$directory/$entry"); |
|---|
| 1386 | | // if ($ftp_size_result > $net2ftp_settings["max_filesize"]) { |
|---|
| | 1386 | // if ($ftp_size_result > $net2ftp_settings["max_filesize"]) { |
|---|
| 1387 | 1387 | // $errormessage = __("The file is too big to be transferred"); |
|---|
| 1388 | 1388 | // setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| … | … | |
| 1395 | 1395 | // Temporary filename |
|---|
| 1396 | 1396 | $tempfilename = tempnam($net2ftp_globals["application_tempdir"], "downl__"); |
|---|
| 1397 | | if ($tempfilename == false) { |
|---|
| 1398 | | @unlink($tempfilename); |
|---|
| | 1397 | if ($tempfilename == false) { |
|---|
| | 1398 | @unlink($tempfilename); |
|---|
| 1399 | 1399 | $errormessage = __("Unable to create the temporary file. Check the permissions of the %1\$s directory.", $net2ftp_globals["application_tempdir"]); |
|---|
| 1400 | 1400 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| … | … | |
| 1406 | 1406 | // ftp_getfile($conn_id, $localtargetdir, $localtargetfile, $remotesourcedir, $remotesourcefile, $ftpmode, $copymove) |
|---|
| 1407 | 1407 | ftp_getfile($conn_id, "", $tempfilename, $directory, $entry, $ftpmode, "copy"); |
|---|
| 1408 | | if ($net2ftp_result["success"] == false) { |
|---|
| 1409 | | @unlink($tempfilename); |
|---|
| 1410 | | $errormessage = __("Unable to get the file <b>%1\$s</b> from the FTP server and to save it as temporary file <b>%2\$s</b>.<br />Check the permissions of the %3\$s directory.<br />", $entry, $tempfilename, $net2ftp_globals["application_tempdir"]); |
|---|
| | 1408 | if ($net2ftp_result["success"] == false) { |
|---|
| | 1409 | @unlink($tempfilename); |
|---|
| | 1410 | $errormessage = __("Unable to get the file <b>%1\$s</b> from the FTP server and to save it as temporary file <b>%2\$s</b>.<br />Check the permissions of the %3\$s directory.<br />", $entry, $tempfilename, $net2ftp_globals["application_tempdir"]); |
|---|
| 1411 | 1411 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| 1412 | 1412 | return false; |
|---|
| … | … | |
| 1427 | 1427 | // -------------------- |
|---|
| 1428 | 1428 | // From the PHP manual: |
|---|
| 1429 | | // Note: The mode may contain the letter 'b'. |
|---|
| 1430 | | // This is useful only on systems which differentiate between binary and text |
|---|
| 1431 | | // files (i.e. Windows. It's useless on Unix). If not needed, this will be |
|---|
| 1432 | | // ignored. You are encouraged to include the 'b' flag in order to make your scripts |
|---|
| | 1429 | // Note: The mode may contain the letter 'b'. |
|---|
| | 1430 | // This is useful only on systems which differentiate between binary and text |
|---|
| | 1431 | // files (i.e. Windows. It's useless on Unix). If not needed, this will be |
|---|
| | 1432 | // ignored. You are encouraged to include the 'b' flag in order to make your scripts |
|---|
| 1433 | 1433 | // more portable. |
|---|
| 1434 | 1434 | // Thanks to Malte for bringing this to my attention ! |
|---|
| 1435 | 1435 | registerTempfile("register", $tempfilename); |
|---|
| 1436 | | $handle = fopen($tempfilename , "rb"); |
|---|
| | 1436 | $handle = fopen($tempfilename , "rb"); |
|---|
| 1437 | 1437 | if ($handle == false) { |
|---|
| 1438 | | @unlink($tempfilename); |
|---|
| 1439 | | $errormessage = __("Unable to open the temporary file. Check the permissions of the %1\$s directory.", $net2ftp_globals["application_tempdir"]); |
|---|
| | 1438 | @unlink($tempfilename); |
|---|
| | 1439 | $errormessage = __("Unable to open the temporary file. Check the permissions of the %1\$s directory.", $net2ftp_globals["application_tempdir"]); |
|---|
| 1440 | 1440 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| 1441 | 1441 | return false; |
|---|
| … | … | |
| 1450 | 1450 | // if ($success1 == false) { |
|---|
| 1451 | 1451 | // @fclose($handle); |
|---|
| 1452 | | // @unlink($tempfilename); |
|---|
| 1453 | | // $errormessage = __("Unable to send the file to the browser"); |
|---|
| | 1452 | // @unlink($tempfilename); |
|---|
| | 1453 | // $errormessage = __("Unable to send the file to the browser"); |
|---|
| 1454 | 1454 | // setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| 1455 | 1455 | // return false; |
|---|
| … | … | |
| 1471 | 1471 | // -------------------- |
|---|
| 1472 | 1472 | $success3 = @unlink($tempfilename); |
|---|
| 1473 | | if ($success3 == false) { |
|---|
| 1474 | | $errormessage = __("Unable to delete the temporary file"); |
|---|
| | 1473 | if ($success3 == false) { |
|---|
| | 1474 | $errormessage = __("Unable to delete the temporary file"); |
|---|
| 1475 | 1475 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| 1476 | 1476 | return false; |
|---|
| 1477 | | } |
|---|
| | 1477 | } |
|---|
| 1478 | 1478 | registerTempfile("unregister", $tempfilename); |
|---|
| 1479 | 1479 | |
|---|
| … | … | |
| 1522 | 1522 | |
|---|
| 1523 | 1523 | } |
|---|
| 1524 | | |
|---|
| 1525 | 1524 | |
|---|
| 1526 | 1525 | // ------------------------------------------------------------------------- |
|---|
| … | … | |
| 1580 | 1579 | if ($zipactions["download"] == "yes") { |
|---|
| 1581 | 1580 | $timenow = time(); |
|---|
| 1582 | | |
|---|
| | 1581 | |
|---|
| 1583 | 1582 | $filenameToSend = "net2ftp-" . $timenow . ".zip"; |
|---|
| 1584 | 1583 | $filesizeToSend = strlen($net2ftp_globals["zipfile"]->file()); |
|---|
| … | … | |
| 1596 | 1595 | |
|---|
| 1597 | 1596 | $tempfilename = tempnam($net2ftp_globals["application_tempdir"], "zip__"); |
|---|
| 1598 | | if ($tempfilename == false) { |
|---|
| 1599 | | @unlink($tempfilename); |
|---|
| 1600 | | $errormessage = __("Unable to create the temporary file. Check the permissions of the %1\$s directory.", $net2ftp_globals["application_tempdir"]); |
|---|
| | 1597 | if ($tempfilename == false) { |
|---|
| | 1598 | @unlink($tempfilename); |
|---|
| | 1599 | $errormessage = __("Unable to create the temporary file. Check the permissions of the %1\$s directory.", $net2ftp_globals["application_tempdir"]); |
|---|
| 1601 | 1600 | setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); |
|---|
| 1602 | 1601 | &nbs |
|---|
|