Show
Ignore:
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
  • trunk/gui/tools/filemanager/includes/filesystem.inc.php

    r928 r1198  
    33//   ------------------------------------------------------------------------------- 
    44//  |                  net2ftp: a web based FTP client                              | 
    5 //  |              Copyright (c) 2003-2007 by David Gartner                         | 
     5//  |              Copyright (c) 2003-2008 by David Gartner                         | 
    66//  |                                                                               | 
    77//  | This program is free software; you can redistribute it and/or                 | 
     
    3030 
    3131// Check if the FTP module of PHP is installed 
    32         if (function_exists("ftp_connect") == false) { 
     32        if (function_exists("ftp_connect") == false) {  
    3333                $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 />"); 
    3434                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
     
    3737 
    3838// 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"]);  
    4444        } 
    4545 
     
    5151        if ($net2ftp_globals["sslconnect"] == "yes" && function_exists("ftp_ssl_connect")) { $ftp_connect = "ftp_ssl_connect"; } 
    5252 
    53         $conn_id = ftp_connect($net2ftp_globals["ftpserver"], $net2ftp_globals["ftpserverport"]); 
     53        $conn_id = $ftp_connect($net2ftp_globals["ftpserver"], $net2ftp_globals["ftpserverport"]); 
    5454        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"]);  
    5656                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
    5757                return false; 
     
    6060// Login with username and password 
    6161        $login_result = ftp_login($conn_id, $net2ftp_globals["username"], $net2ftp_password); 
    62         if ($login_result == false) { 
     62        if ($login_result == false) {  
    6363                $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"]); 
    6464                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
     
    6767 
    6868// 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) {  
    7272                        $errormessage = __("Unable to switch to the passive mode on FTP server <b>%1\$s</b>.", $net2ftp_globals["ftpserver"]); 
    7373                        setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
     
    109109 
    110110// Check if the FTP module of PHP is installed 
    111         if (function_exists("ftp_connect") == false) { 
     111        if (function_exists("ftp_connect") == false) {  
    112112                $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 />"); 
    113113                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
     
    120120// Set up basic connection 
    121121        $conn_id = ftp_connect($net2ftp_globals["ftpserver2"], $net2ftp_globals["ftpserverport2"]); 
    122         if ($conn_id == false) { 
     122        if ($conn_id == false) {  
    123123                $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"]); 
    124124                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
     
    128128// Login with username and password 
    129129        $login_result = ftp_login($conn_id, $net2ftp_globals["username2"], $net2ftp_globals["password2"]); 
    130         if ($login_result == false) { 
     130        if ($login_result == false) {  
    131131                $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"]); 
    132132                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
     
    135135 
    136136// 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"]);  
    141141                        setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
    142142                        return false; 
     
    201201 
    202202        $ftp_rename_result = ftp_rename($conn_id, $old, $new); 
    203         if ($ftp_rename_result == false) { 
     203        if ($ftp_rename_result == false) {  
    204204                $errormessage = __("Unable to rename directory or file <b>%1\$s</b> into <b>%2\$s</b>", $old, $new); 
    205205                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
     
    232232// $list[$i]["dirorfile"] contains d or - which indicates if the entry is a directory or a file 
    233233// $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  
    235235// 
    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  
    237237// the subdirectories and files within the chmodded directory should also be chmodded 
    238238// -------------- 
     
    246246// Initialization 
    247247// ------------------------------------------------------------------------- 
    248         if ($divelevel == 0) { 
     248        if ($divelevel == 0) {  
    249249                $net2ftp_output["ftp_chmod2"][] = "<ul>"; 
    250250        } 
     
    259259 
    260260// ------------------------------------ 
    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),  
    262262// or first be traversed (if chmodded to other values) 
    263263// A problem is that we don't know if the FTP user is the owner/group/other of the file... 
    264264// ------------------------------------ 
    265                 if ($list["directories"][$i]["chmodoctal"] == 555 || 
     265                if ($list["directories"][$i]["chmodoctal"] == 555 ||  
    266266                $list["directories"][$i]["chmodoctal"] == 557 || 
    267267                $list["directories"][$i]["chmodoctal"] == 575 || 
     
    285285                        $sitecommand = "chmod 0" . $list["directories"][$i]["chmodoctal"] . " $currentdirectory"; 
    286286                        $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);  
    289289                                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
    290                                 return false; 
     290                                return false;  
    291291                        } 
    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"]);  
    294294                        } 
    295295                } 
     
    324324 
    325325                        $net2ftp_output["ftp_chmod2"][] = "</ul>"; 
    326  
     326                         
    327327                } // end if subdirectories and files 
    328328 
     
    335335                        $sitecommand = "chmod 0" . $list["directories"][$i]["chmodoctal"] . " $currentdirectory"; 
    336336                        $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);  
    339339                                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
    340                                 return false; 
     340                                return false;  
    341341                        } 
    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"]);  
    344344                        } 
    345345                } 
     
    361361                        $sitecommand = "chmod 0" . $list["files"][$i]["chmodoctal"] . " $currentfile"; 
    362362                        $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);  
    365365                                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
    366                                 return false; 
     366                                return false;  
    367367                        } 
    368                         elseif ($success2 == true)  { 
     368                        elseif ($success2 == true)  {  
    369369                                $net2ftp_output["ftp_chmod2"][] = __("File <b>%1\$s</b> was successfully chmodded to <b>%2\$s</b>", $currentfile, $list["files"][$i]["chmodoctal"]); 
    370370                        } 
     
    417417                $lastpartnr = sizeof($parts)-1; 
    418418                $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);  
    421421                        setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
    422422                        return false; 
     
    462462                $lastpartnr = sizeof($parts)-1; 
    463463                $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);  
    466466                        setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
    467467                        return false; 
     
    492492 
    493493        $success1 = ftp_mkdir($conn_id, $directory); 
    494         if ($success1 == false) { 
     494        if ($success1 == false) {  
    495495                $errormessage = __("Unable to create the directory <b>%1\$s</b>", $directory); 
    496496                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
     
    531531// Step 1/4: Create a temporary filename 
    532532        $tempfilename = tempnam($net2ftp_globals["application_tempdir"], "read__"); 
    533         if ($tempfilename == false)  { 
    534                 @unlink($tempfilename); 
     533        if ($tempfilename == false)  {  
     534                @unlink($tempfilename);  
    535535                $errormessage = __("Unable to create the temporary file. Check the permissions of the %1\$s directory.", $net2ftp_globals["application_tempdir"]); 
    536536                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
     
    543543        if ($conn_id == "") { 
    544544                $conn_id = ftp_openconnection(); 
    545                 if ($net2ftp_result["success"] == false)  { 
    546                         @unlink($tempfilename); 
     545                if ($net2ftp_result["success"] == false)  {  
     546                        @unlink($tempfilename);  
    547547                        return false; 
    548548                } 
     
    564564 
    565565        $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);  
    568568                $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"]); 
    569569                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
     
    583583// Step 4/4: Delete temporary file 
    584584        $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");  
    587587                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
    588588                return false; 
    589         } 
     589        }  
    590590        registerTempfile("unregister", $tempfilename); 
    591591 
     
    641641// Step 1/4: Create a temporary filename 
    642642        $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"]);  
    646646                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
    647647                return false; 
     
    683683 
    684684        $success3 = ftp_put($conn_id, $target, $tempfilename, $ftpmode); 
    685         if ($success3 == false) { 
    686                 @unlink($tempfilename); 
     685        if ($success3 == false) {  
     686                @unlink($tempfilename);  
    687687                $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); 
    688688                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
     
    695695// Step 4/4: Delete temporary file 
    696696        $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");  
    699699                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
    700700                return false; 
    701         } 
     701        }  
    702702        registerTempfile("unregister", $tempfilename); 
    703703 
     
    722722// -------------- 
    723723// 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,  
    725725// and then transferred to the target FTP server. 
    726726// 
     
    760760                if ($copymovedelete == "copy" || $copymovedelete == "move") { 
    761761                        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  
    763763                } 
    764764                else { 
     
    772772 
    773773// 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);  
    776776                        $net2ftp_output["ftp_copymovedelete"][] = "</ul>"; 
    777                         continue; 
     777                        continue;                       
    778778                } 
    779779 
     
    781781// If banned keyword - copy: continue 
    782782// If banned keyword - move: abort 
    783                 if ($list["directories"][$i]["selectable"] == "banned_keyword") { 
     783                if ($list["directories"][$i]["selectable"] == "banned_keyword") {  
    784784                        if ($copymovedelete == "copy") { 
    785785                                $net2ftp_output["ftp_copymovedelete"][] = __("The directory <b>%1\$s</b> contains a banned keyword, so this directory will be skipped", $source); 
     
    804804// Get a new list 
    805805                $newlist = ftp_getlist($conn_id_source, $source); 
    806                 if ($net2ftp_result["success"] == false) { 
     806                if ($net2ftp_result["success"] == false) {  
    807807                        $net2ftp_output["ftp_copymovedelete"][] = __("The directory <b>%1\$s</b> could not be selected, so this directory will be skipped", $source); 
    808808                        $net2ftp_output["ftp_copymovedelete"][] = "</ul>"; 
    809                         setErrorVars(true, "", "", "", ""); 
     809                        setErrorVars(true, "", "", "", "");  
    810810                        continue; 
    811811                } 
     
    827827// Delete the source directory 
    828828// (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")) {  
    830830                        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);  
    834834                        } 
    835                         else { 
     835                        else {  
    836836                                $net2ftp_output["ftp_copymovedelete"][] = __("Deleted subdirectory <b>%1\$s</b>", $source); 
    837837                        } 
     
    865865 
    866866// 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)) {  
    868868                                $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); 
    869869                                continue; 
     
    873873// If banned keyword or too big - copy: continue with the other files 
    874874// If banned keyword or too big - move: abort 
    875                         if ($list["files"][$i]["selectable"] == "banned_keyword") { 
     875                        if ($list["files"][$i]["selectable"] == "banned_keyword") {  
    876876                                if ($copymovedelete == "copy") { 
    877877                                        $net2ftp_output["ftp_copymovedelete"][] = __("The file <b>%1\$s</b> contains a banned keyword, so this file will be skipped", $source); 
     
    883883                                } 
    884884                        } 
    885                         elseif ($list["files"][$i]["selectable"] == "too_big") { 
     885                        elseif ($list["files"][$i]["selectable"] == "too_big") {  
    886886                                if ($copymovedelete == "copy") { 
    887887                                        $net2ftp_output["ftp_copymovedelete"][] = __("The file <b>%1\$s</b> is too big to be copied, so this file will be skipped", $source); 
     
    904904 
    905905                        ftp_getfile($conn_id_source, $localtargetdir, $localtargetfile, $remotesourcedir, $remotesourcefile, $ftpmode, $copymove); 
    906                         if ($net2ftp_result["success"] == false) { 
     906                        if ($net2ftp_result["success"] == false) {  
    907907                                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;  
    911911                                } 
    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"]);  
    914914                                        return false; 
    915915                                } 
     
    926926 
    927927                        ftp_putfile($conn_id_target, $localsourcedir, $localsourcefile, $remotetargetdir, $remotetargetfile, $ftpmode, $copymove); 
    928                         if ($net2ftp_result["success"] == false) { 
     928                        if ($net2ftp_result["success"] == false) {  
    929929                                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;  
    933933                                } 
    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"]);  
    936936                                        return false; 
    937937                                } 
     
    939939 
    940940// 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"]);  
    943943                        } 
    944944 
    945945// Move: only if the operation is successful, delete the source file 
    946                         elseif ($copymovedelete == "move") { 
     946                        elseif ($copymovedelete == "move") {  
    947947                                $remotesource = glueDirectories($list["files"][$i]["sourcedirectory"], $list["files"][$i]["dirfilename"]); 
    948948 
    949949                                ftp_delete2($conn_id_source, $remotesource); 
    950                                 if ($net2ftp_result["success"] == false) { 
    951                                         setErrorVars(true, "", "", "", ""); 
     950                                if ($net2ftp_result["success"] == false) {  
     951                                        setErrorVars(true, "", "", "", "");  
    952952                                        $net2ftp_output["ftp_copymovedelete"][] = __("Unable to move the file <b>%1\$s</b>", $list["files"][$i]["dirfilename"]); 
    953953                                } 
    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"]);  
    956956                                } 
    957957                        } 
     
    966966 
    967967                        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"]);  
    971971                                continue; 
    972972                        } 
    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"]);  
    975975                        } 
    976976 
     
    10061006// -------------- 
    10071007// 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  
    10091009// directories are parsed recursively. 
    10101010// 
     
    10121012// $list[$i]["dirfilename"] contains the name of the entry 
    10131013// $list[$i]["size"] contains the size of the entry 
    1014 // 
     1014//  
    10151015// OPTIONS: 
    10161016// if ($dowhat == "calculatesize") then 
     
    10301030//      $result[$k]["directory"] contains the directory 
    10311031//      $result[$k]["dirfilename"] contains the filename 
    1032 //      $result[$k]["line"] contains the line nr 
     1032//      $result[$k]["line"] contains the line nr  
    10331033// 
    10341034// -------------- 
     
    10421042// Initialization 
    10431043// ------------------------------------------------------------------------- 
    1044         if ($divelevel == 0) { 
     1044        if ($divelevel == 0) {  
    10451045 
    10461046        } 
     
    10891089 
    10901090// 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") {  
    10921092                                continue; 
    10931093                        } 
    10941094 
    10951095// 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"]) {  
    10971097//                              echo "File $i skipped"; 
    10981098                                continue; 
     
    11361136                                } 
    11371137 
    1138                         } // end for 
     1138                        } // end for  
    11391139 
    11401140                } // end if findstring 
     
    11841184// Check if the filesize is smaller than the allowed filesize 
    11851185//      $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"]) {  
    11871187//              $errormessage = __("The file is too big to be transferred"); 
    11881188//              setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
     
    11991199// Get file 
    12001200        $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);  
    12031203                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
    12041204                return false; 
     
    12131213        if ($copymove != "copy") { 
    12141214                $success2 = ftp_delete2($conn_id, $remotesource); 
    1215                 if ($success2 == false) { 
     1215                if ($success2 == false) {  
    12161216                        $errormessage = __("Unable to delete file <b>%1\$s</b>", $remotesource); 
    12171217                        setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
     
    12561256// In the function ftp_put, use FTP_BINARY without the double quotes, otherwhise ftp_put assumes FTP_ASCII 
    12571257// 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; }  
    12591259 
    12601260        if ($ftpmode == FTP_ASCII) { $printftpmode = "FTP_ASCII"; } 
     
    12621262 
    12631263// 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"]) {  
    12651265                $errormessage = __("The file is too big to be transferred"); 
    12661266                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
     
    12821282// int ftp_put (int ftp_stream, string remote_file, string local_file, int mode) 
    12831283        $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);  
    12861286                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
    12871287                return false; 
     
    12961296        if ($copymove != "copy") { 
    12971297                $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");  
    13001300                        setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
    13011301                        return false; 
     
    13491349                elseif (strpos($entry, ".mpp") !== false) { $content_type = "application/vnd.ms-project"; } 
    13501350        } 
    1351  
     1351         
    13521352        return $content_type; 
    13531353} 
     
    13841384// Check if the filesize is smaller than the allowed filesize 
    13851385//      $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"]) {  
    13871387//              $errormessage = __("The file is too big to be transferred"); 
    13881388//              setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
     
    13951395// Temporary filename 
    13961396        $tempfilename = tempnam($net2ftp_globals["application_tempdir"], "downl__"); 
    1397         if ($tempfilename == false)  { 
    1398                 @unlink($tempfilename); 
     1397        if ($tempfilename == false)  {  
     1398                @unlink($tempfilename);  
    13991399                $errormessage = __("Unable to create the temporary file. Check the permissions of the %1\$s directory.", $net2ftp_globals["application_tempdir"]); 
    14001400                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
     
    14061406//          ftp_getfile($conn_id, $localtargetdir, $localtargetfile, $remotesourcedir, $remotesourcefile, $ftpmode, $copymove) 
    14071407                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"]);  
    14111411                        setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
    14121412                        return false; 
     
    14271427// -------------------- 
    14281428// 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  
    14331433// more portable. 
    14341434// Thanks to Malte for bringing this to my attention ! 
    14351435        registerTempfile("register", $tempfilename); 
    1436         $handle = fopen($tempfilename , "rb"); 
     1436        $handle = fopen($tempfilename , "rb");  
    14371437        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"]);  
    14401440                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
    14411441                return false; 
     
    14501450//      if ($success1 == false) { 
    14511451//              @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");  
    14541454//              setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
    14551455//              return false; 
     
    14711471// -------------------- 
    14721472        $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");  
    14751475                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
    14761476                return false; 
    1477         } 
     1477        }  
    14781478        registerTempfile("unregister", $tempfilename); 
    14791479 
     
    15221522 
    15231523        } 
    1524  
    15251524 
    15261525// ------------------------------------------------------------------------- 
     
    15801579                if ($zipactions["download"] == "yes") { 
    15811580                        $timenow = time(); 
    1582  
     1581                         
    15831582                        $filenameToSend = "net2ftp-" . $timenow . ".zip"; 
    15841583                        $filesizeToSend = strlen($net2ftp_globals["zipfile"]->file()); 
     
    15961595 
    15971596                        $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"]);  
    16011600                                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__); 
    16021601            &nbs