[Easymod-cvs] easymod2/mods/easymod/em_includes em_ftp.php,1.3,1.4 em_modio.php,1.4,1.5
Status: Beta
Brought to you by:
wgeric
|
From: Eric F. <wg...@us...> - 2005-07-03 02:42:37
|
Update of /cvsroot/easymod/easymod2/mods/easymod/em_includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17389/mods/easymod/em_includes Modified Files: em_ftp.php em_modio.php Log Message: Made it so that FTP chmods folders to 755 and files to 644. I did this because some ftp servers may not chmod files automatically. Atleast mine on my local machine doesnt (I need to change the config so that it does). Index: em_modio.php =================================================================== RCS file: /cvsroot/easymod/easymod2/mods/easymod/em_includes/em_modio.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** em_modio.php 11 Jun 2005 23:05:53 -0000 1.4 --- em_modio.php 3 Jul 2005 02:42:19 -0000 1.5 *************** *** 542,545 **** --- 542,546 ---- if ( copy( $from, $to)) { + chmod($to, 0644); return '<b>' . $lang['EM_pp_complete'] . '</b>' ; } *************** *** 560,565 **** { // make the "to" file path relative to the phpBB root and the "from" relative to EM runtime ! $to = ( substr($to, 0, 9) == '../../../') ? substr($to, 9) : $script_path . '/' . $ipath . $to ; ! $from = ( substr($from, 0, 9) == '../../../') ? substr($from, 9) : $script_path . '/' . $ipath . $from ; ////////////////////// --- 561,566 ---- { // make the "to" file path relative to the phpBB root and the "from" relative to EM runtime ! $to = ( substr($to, 0, 9) == '../../../') ? substr($to, 9) : $script_path . $ipath . $to ; ! $from = ( substr($from, 0, 9) == '../../../') ? substr($from, 9) : $script_path . $ipath . $from ; ////////////////////// Index: em_ftp.php =================================================================== RCS file: /cvsroot/easymod/easymod2/mods/easymod/em_includes/em_ftp.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** em_ftp.php 11 Jun 2005 23:05:53 -0000 1.3 --- em_ftp.php 3 Jul 2005 02:42:19 -0000 1.4 *************** *** 760,763 **** --- 760,772 ---- ////////////////////////////// + function emftp_chmod($file, $perms) + { + $this->_putcmd('SITE CHMOD', substr($perms, 1) . ' ' . $file); + $response = $this->_ok(); + if (!$response) { + $this->_debug_print("Error : CHMOD command failed\n"); + } + return $response; + } function ftp_site($command) *************** *** 1034,1042 **** } function ftp_put( $remote_filename, $local_filename, $file_type) { if ($this->ftp_type == 'fsock') { ! return $this->ftp->ftp_put( $remote_filename, $local_filename, $file_type) ; } else --- 1043,1076 ---- } + function emftp_chmod($file, $perms) + { + if ( $this->ftp_type == 'fsock') + { + return $this->ftp->emftp_chmod($file, $perms); + } + else + { + if ( ftp_chmod($this->ftp_conn_id, $file, $perms) ) + { + return true; + } + else + { + $chmod_cmd = 'CHMOD ' . $perms . ' ' .$file; + return ftp_site($this->ftp_conn_id, $chmod_cmd); + } + } + } + function ftp_put( $remote_filename, $local_filename, $file_type) { if ($this->ftp_type == 'fsock') { ! $result = $this->ftp->ftp_put( $remote_filename, $local_filename, $file_type) ; ! if ( $result ) ! { ! $this->emftp_chmod($remote_filename, '0644'); ! } ! return $result; } else *************** *** 1048,1052 **** } ! return ftp_put( $this->ftp_conn_id, $remote_filename, $local_filename, ($file_type==1) ? FTP_BINARY : FTP_ASCII ) ; } } --- 1082,1091 ---- } ! $result = ftp_put( $this->ftp_conn_id, $remote_filename, $local_filename, ($file_type==1) ? FTP_BINARY : FTP_ASCII ) ; ! if ( $result ) ! { ! $this->emftp_chmod($remote_filename, '0644'); ! } ! return $result; } } *************** *** 1094,1097 **** --- 1133,1140 ---- // put the file and then cleanup the temp file $result = ftp_put( $this->ftp_conn_id, $to_file, $tmpfname, FTP_ASCII ) ; + if ( $result ) + { + $this->emftp_chmod($to_file, '0644'); + } unlink($tmpfname); *************** *** 1116,1124 **** if ($this->ftp_type == 'fsock') { ! return $this->ftp->ftp_mkdir( $dir_name) ; } else { $result = @ftp_mkdir( $this->ftp_conn_id, $dir_name) ; // return $result ; ///////////// --- 1159,1173 ---- if ($this->ftp_type == 'fsock') { ! $result = $this->ftp->ftp_mkdir( $dir_name) ; ! if ( $result ) ! { ! $this->emftp_chmod($dir_name, '0755'); ! } ! return $result; } else { $result = @ftp_mkdir( $this->ftp_conn_id, $dir_name) ; + $this->emftp_chmod($dir_name, '0755'); // return $result ; ///////////// |