[Easymod-cvs] easymod2/mods/easymod/em_includes em_ftp.php,1.13,1.14
Status: Beta
Brought to you by:
wgeric
From: Markus P. <mar...@us...> - 2005-11-06 15:19:42
|
Update of /cvsroot/easymod/easymod2/mods/easymod/em_includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15737/mods/easymod/em_includes Modified Files: em_ftp.php Log Message: Implemented FTP Debug option in EM settings panel. Index: em_ftp.php =================================================================== RCS file: /cvsroot/easymod/easymod2/mods/easymod/em_includes/em_ftp.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** em_ftp.php 6 Nov 2005 13:30:52 -0000 1.13 --- em_ftp.php 6 Nov 2005 15:19:30 -0000 1.14 *************** *** 32,42 **** // used in step 2 of the installer to test the connection and also used in the debug feature; also // used in the main proggie to check settings ! function test_ftp($ftp_user, $ftp_pass, $ftp_dir, $ftp_host, $ftp_port, $ftp_debug, $ftp_type, $ftp_cache, &$test_report) { global $lang, $phpbb_root_path, $easymod_install_version; ! $test_report = array(); ! ! $test_report[] = '<h3>' . $lang['EM_ftp_testing'] . '</h3>'; // create the emftp which will use either fsockopen or the PHP FTP extension --- 32,48 ---- // used in step 2 of the installer to test the connection and also used in the debug feature; also // used in the main proggie to check settings ! function capture_test_ftp($ftp_user, $ftp_pass, $ftp_dir, $ftp_host, $ftp_port, $ftp_debug, $ftp_type, $ftp_cache, &$test_report) ! { ! ob_start(); ! $result = test_ftp($ftp_user, $ftp_pass, $ftp_dir, $ftp_host, $ftp_port, $ftp_debug, $ftp_type, $ftp_cache); ! $test_report = ob_get_contents(); ! ob_end_clean(); ! return $result; ! } ! function test_ftp($ftp_user, $ftp_pass, $ftp_dir, $ftp_host, $ftp_port, $ftp_debug, $ftp_type, $ftp_cache) { global $lang, $phpbb_root_path, $easymod_install_version; ! echo '<h3>' . $lang['EM_ftp_testing'] . '</h3>' . "\n"; // create the emftp which will use either fsockopen or the PHP FTP extension *************** *** 47,57 **** { // failed to connect! ! $test_report[] = '<br />'; ! $test_report[] = '<b>' . sprintf($lang['EM_ftp_fail_conn'], $ftp_host, $ftp_port) . '</b><br />'; // they may need to specify the host if( $ftp_host == 'localhost' ) { ! $test_report[] = $lang['EM_ftp_fail_conn_lh'] . '<br />'; } --- 53,63 ---- { // failed to connect! ! echo '<br />' . "\n"; ! echo '<b>' . sprintf($lang['EM_ftp_fail_conn'], $ftp_host, $ftp_port) . '</b><br />' . "\n"; // they may need to specify the host if( $ftp_host == 'localhost' ) { ! echo $lang['EM_ftp_fail_conn_lh'] . '<br />' . "\n"; } *************** *** 59,63 **** elseif( $ftp_port == 21 ) { ! $test_report[] = $lang['EM_ftp_fail_conn_21'] . '<br />'; } --- 65,69 ---- elseif( $ftp_port == 21 ) { ! echo $lang['EM_ftp_fail_conn_21'] . '<br />' . "\n"; } *************** *** 68,73 **** if( (strstr($ftp_host, '/')) || (strstr($ftp_host, '\\')) || (strstr($ftp_host, ':')) ) { ! $test_report[] = $lang['EM_ftp_fail_conn_invalid'] . '<br />'; ! $test_report[] = '<br />'; } --- 74,79 ---- if( (strstr($ftp_host, '/')) || (strstr($ftp_host, '\\')) || (strstr($ftp_host, ':')) ) { ! echo $lang['EM_ftp_fail_conn_invalid'] . '<br />' . "\n"; ! echo '<br />' . "\n"; } *************** *** 75,89 **** elseif( intval($ftp_port) == $ftp_port ) { ! $test_report[] = $lang['EM_ftp_fail_conn_invalid2'] . '<br />'; ! $test_report[] = '<br />'; } // give them options ! $test_report[] = $lang['EM_fail_conn_info'] . '<br /><ol>'; ! $test_report[] = '<li>' . $lang['EM_fail_conn_op1'] . '</li>'; ! $test_report[] = '<li>' . $lang['EM_fail_conn_op2'] . '</li>'; ! $test_report[] = '<li>' . $lang['EM_fail_conn_op3'] . '</li>'; ! $test_report[] = '<li>' . $lang['EM_fail_conn_op4'] . '</li>'; ! $test_report[] = '</ol>'; } --- 81,95 ---- elseif( intval($ftp_port) == $ftp_port ) { ! echo $lang['EM_ftp_fail_conn_invalid2'] . '<br />' . "\n"; ! echo '<br />' . "\n"; } // give them options ! echo $lang['EM_fail_conn_info'] . '<br /><ol>' . "\n"; ! echo '<li>' . $lang['EM_fail_conn_op1'] . '</li>' . "\n"; ! echo '<li>' . $lang['EM_fail_conn_op2'] . '</li>' . "\n"; ! echo '<li>' . $lang['EM_fail_conn_op3'] . '</li>' . "\n"; ! echo '<li>' . $lang['EM_fail_conn_op4'] . '</li>' . "\n"; ! echo '</ol>' . "\n"; } *************** *** 97,124 **** $emftp->ftp_quit(); ! $test_report[] = '<br />'; ! $test_report[] = '<b>' . $lang['EM_fail_login'] . '</b><br />'; // give them options ! $test_report[] = $lang['EM_fail_login_info'] . '<br /><ol>'; // check user/pass ! $test_report[] = '<li>' . $lang['EM_fail_login_op1'] . '</li>'; if( $ftp_host == 'localhost' || $ftp_port == 21 ) { // change from localhost ! $test_report[] = '<li>' . $lang['EM_fail_login_op2a'] . '</li>'; } else { // change to localhost or something else ! $test_report[] = '<li>' . $lang['EM_fail_login_op2b'] . '</li>'; } ! $test_report[] = '</ol>'; return false; } ! $test_report[] = $lang['EM_test_ftp1']. '<br />'; --- 103,130 ---- $emftp->ftp_quit(); ! echo '<br />' . "\n"; ! echo '<b>' . $lang['EM_fail_login'] . '</b><br />' . "\n"; // give them options ! echo $lang['EM_fail_login_info'] . '<br /><ol>' . "\n"; // check user/pass ! echo '<li>' . $lang['EM_fail_login_op1'] . '</li>' . "\n"; if( $ftp_host == 'localhost' || $ftp_port == 21 ) { // change from localhost ! echo '<li>' . $lang['EM_fail_login_op2a'] . '</li>' . "\n"; } else { // change to localhost or something else ! echo '<li>' . $lang['EM_fail_login_op2b'] . '</li>' . "\n"; } ! echo '</ol>' . "\n"; return false; } ! echo $lang['EM_test_ftp1']. '<br />' . "\n"; *************** *** 126,130 **** if( $ftp_debug ) { ! $test_report[] = '<b>' . $lang['EM_dir_current'] . ':</b> ' . $emftp->ftp_pwd() . '<br />'; ////// --- 132,136 ---- if( $ftp_debug ) { ! echo '<b>' . $lang['EM_dir_current'] . ':</b> ' . $emftp->ftp_pwd() . '<br />' . "\n"; ////// *************** *** 133,140 **** $list = $emftp->ftp_nlist(); ! $test_report[] = sprintf($lang['EM_dir_nlist'], count($list)) . '<br />'; for( $i = 0; $i < count($list); $i++ ) { ! $test_report[] = '[' . $list[$i] . ']<br />'; } } --- 139,146 ---- $list = $emftp->ftp_nlist(); ! echo sprintf($lang['EM_dir_nlist'], count($list)) . '<br />' . "\n"; for( $i = 0; $i < count($list); $i++ ) { ! echo '[' . $list[$i] . ']<br />' . "\n"; } } *************** *** 143,155 **** if( !($pwd = $emftp->ftp_chdir($ftp_dir . '/admin/mods/easymod')) ) { ! $test_report[] = '<br />'; ! $test_report[] = '<b>' . sprintf($lang['EM_fail_cd'], $ftp_dir) . '</b><br />'; ! $test_report[] = $lang['EM_fail_cd_info'] . '<br /><ol><br />'; // some dopes put the ftp server in the paths if( (strstr($ftp_dir, '.com')) || (strstr($ftp_dir, '.net')) || (strstr($ftp_dir, '.org')) ) { ! $test_report[] = '<li>' . $lang['EM_fail_cd_op1'] . '</li>'; } --- 149,161 ---- if( !($pwd = $emftp->ftp_chdir($ftp_dir . '/admin/mods/easymod')) ) { ! echo '<br />' . "\n"; ! echo '<b>' . sprintf($lang['EM_fail_cd'], $ftp_dir) . '</b><br />' . "\n"; ! echo $lang['EM_fail_cd_info'] . '<br /><ol><br />' . "\n"; // some dopes put the ftp server in the paths if( (strstr($ftp_dir, '.com')) || (strstr($ftp_dir, '.net')) || (strstr($ftp_dir, '.org')) ) { ! echo '<li>' . $lang['EM_fail_cd_op1'] . '</li>' . "\n"; } *************** *** 157,191 **** if( substr($ftp_dir, strlen($ftp_dir)-1) == '/' ) { ! $test_report[] = '<li>' . $lang['EM_fail_cd_op2'] . '</li>'; } // everything else ! $test_report[] = '<li>' . $lang['EM_fail_cd_op3'] . '</li>'; ! $test_report[] = '<li>' . $lang['EM_fail_cd_op4'] . '</li>'; if( $ftp_host == 'localhost' || $ftp_port == 21 ) { ! $test_report[] = '<li>' . $lang['EM_fail_cd_op5'] . '</li>'; } ! $test_report[] = '<li>' . $lang['EM_fail_cd_op6'] . '</li>'; ! $test_report[] = '</ol>'; // print the working dir $emftp->set_debug(false); ! $test_report[] = '<br />'; ! $test_report[] = '<b>' . $lang['EM_ftp_root'] . '</b><br />'; // if pwd fails then we know it is probably a passive mode problem if( !$emftp->ftp_pwd() ) { ! $test_report[] = $lang['EM_fail_cd_pwd'] . '<br />'; } else { ! $test_report[] = $emftp->ftp_pwd() . '<br />'; } // print directory listing ! $test_report[] = '<br /><br />' . $lang['EM_dir_list'] . '<br />'; $list = $emftp->ftp_nlist(); --- 163,197 ---- if( substr($ftp_dir, strlen($ftp_dir)-1) == '/' ) { ! echo '<li>' . $lang['EM_fail_cd_op2'] . '</li>' . "\n"; } // everything else ! echo '<li>' . $lang['EM_fail_cd_op3'] . '</li>' . "\n"; ! echo '<li>' . $lang['EM_fail_cd_op4'] . '</li>' . "\n"; if( $ftp_host == 'localhost' || $ftp_port == 21 ) { ! echo '<li>' . $lang['EM_fail_cd_op5'] . '</li>' . "\n"; } ! echo '<li>' . $lang['EM_fail_cd_op6'] . '</li>' . "\n"; ! echo '</ol>' . "\n"; // print the working dir $emftp->set_debug(false); ! echo '<br />' . "\n"; ! echo '<b>' . $lang['EM_ftp_root'] . '</b><br />' . "\n"; // if pwd fails then we know it is probably a passive mode problem if( !$emftp->ftp_pwd() ) { ! echo $lang['EM_fail_cd_pwd'] . '<br />' . "\n"; } else { ! echo $emftp->ftp_pwd() . '<br />' . "\n"; } // print directory listing ! echo '<br /><br />' . $lang['EM_dir_list'] . '<br />' . "\n"; $list = $emftp->ftp_nlist(); *************** *** 193,202 **** if( !$list ) { ! $test_report[] = $lang['EM_fail_cd_nlist'] . '<br />'; } // if there are no files then indicate there are none to print elseif( count($list) == 0 ) { ! $test_report[] = '--' . $lang['EM_fail_cd_nlist_no'] . '--<br />'; } else --- 199,208 ---- if( !$list ) { ! echo $lang['EM_fail_cd_nlist'] . '<br />' . "\n"; } // if there are no files then indicate there are none to print elseif( count($list) == 0 ) { ! echo '--' . $lang['EM_fail_cd_nlist_no'] . '--<br />' . "\n"; } else *************** *** 204,208 **** for( $i = 0; $i < count($list); $i++ ) { ! $test_report[] = $list[$i] . '<br />'; } } --- 210,214 ---- for( $i = 0; $i < count($list); $i++ ) { ! echo $list[$i] . '<br />' . "\n"; } } *************** *** 215,223 **** { $emftp->ftp_quit(); ! $test_report[] = $lang['EM_fail_pwd'] . '<br />'; return false; } ! $test_report[] = $lang['EM_test_ftp2'] . '<br />'; --- 221,229 ---- { $emftp->ftp_quit(); ! echo $lang['EM_fail_pwd'] . '<br />' . "\n"; return false; } ! echo $lang['EM_test_ftp2'] . '<br />' . "\n"; *************** *** 238,252 **** $emftp->ftp_quit(); ! $test_report[] = '<br />'; ! $test_report[] = '<b>' . $lang[$langkey] . '</b><br />'; ! $test_report[] = sprintf($lang['EM_fail_put_info'], $ftp_user) . '<br />'; ! $test_report[] = '<br />'; ! $test_report[] = '<b>' . $lang['EM_ftp_phpbb_root'] . '</b><br />'; if( $dh = opendir($phpbb_root_path) ) { while( ($file = readdir($dh)) !== false ) { ! $test_report[] = mfunGetPerms(fileperms($phpbb_root_path . $file)) . " $file <br />"; } closedir($dh); --- 244,258 ---- $emftp->ftp_quit(); ! echo '<br />' . "\n"; ! echo '<b>' . $lang[$langkey] . '</b><br />' . "\n"; ! echo sprintf($lang['EM_fail_put_info'], $ftp_user) . '<br />' . "\n"; ! echo '<br />' . "\n"; ! echo '<b>' . $lang['EM_ftp_phpbb_root'] . '</b><br />' . "\n"; if( $dh = opendir($phpbb_root_path) ) { while( ($file = readdir($dh)) !== false ) { ! echo mfunGetPerms(fileperms($phpbb_root_path . $file)) . " $file <br />" . "\n"; } closedir($dh); *************** *** 260,267 **** if( !$emftp->ftp_delete($remote_filename) ) { ! $test_report[] = $lang['EM_fail_delete'] . '<br />'; } ! $test_report[] = $lang['EM_test_ftp3']. '<br />'; --- 266,273 ---- if( !$emftp->ftp_delete($remote_filename) ) { ! echo $lang['EM_fail_delete'] . '<br />' . "\n"; } ! echo $lang['EM_test_ftp3']. '<br />' . "\n"; *************** *** 283,287 **** { $emftp->ftp_quit(); ! $test_report[] = sprintf($lang['EM_fail_make_cache'], 'admin/em_includes/cache') . '<br />'; return false; } --- 289,293 ---- { $emftp->ftp_quit(); ! echo sprintf($lang['EM_fail_make_cache'], 'admin/em_includes/cache') . '<br />' . "\n"; return false; } *************** *** 310,318 **** { $emftp->ftp_quit(); ! $test_report[] = sprintf($lang['EM_fail_tmp'], $tmpfname) . '<br />'; return false; } ! $test_report[] = $lang['EM_test_ftp4']. '<br />'; } --- 316,324 ---- { $emftp->ftp_quit(); ! echo sprintf($lang['EM_fail_tmp'], $tmpfname) . '<br />' . "\n"; return false; } ! echo $lang['EM_test_ftp4']. '<br />' . "\n"; } |