Plugin Directory

Changeset 587313


Ignore:
Timestamp:
08/19/2012 05:34:45 AM (14 years ago)
Author:
6Scan
Message:
  • No longer allows users to submit empty support tickets
  • Fixed pathing matters with wp_filesystem() access
Location:
6scan-backup/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • 6scan-backup/trunk/6scan.php

    r579277 r587313  
    55Description: 6Scan Backup goes beyond existing backup plugins, easily and automatically creating backups of your site and securely storing them in the cloud.
    66Author: 6Scan
    7 Version: 2.2.7
     7Version: 2.2.8
    88Author URI: http://www.6scan.com
    99*/
     
    2424define( 'SIXSCAN_PLUGIN_DIR',   trailingslashit( dirname(__FILE__) ) );
    2525define( 'SIXSCAN_PLUGIN_URL',   trailingslashit( plugins_url( basename (dirname (__FILE__) ) ) ) );
     26define( 'SIXSCAN_PLUGIN_DIRNAME' ,      basename( dirname ( __FILE__ ) ) );
    2627
    2728/* Platform type */
  • 6scan-backup/trunk/admin/includes/6scan-menu.php

    r579277 r587313  
    128128    else
    129129        $result_html .= $custom_form_message;
    130     $result_html .= "<form action=\"" . SIXSCAN_BODYGUARD_ERROR_REPORT_FORM_URL . "\" method=POST>\n";
     130    $result_html .= "<script language='Javascript'> function sanity_error_report(){ if  (document.getElementById('admin_comments').value ==''){ alert('Please add the error desription into comments field'); return false;} else {return true;} }</script>\n";
     131    $result_html .= "<form action=\"" . SIXSCAN_BODYGUARD_ERROR_REPORT_FORM_URL . "\" method=POST onsubmit='return sanity_error_report();'>\n";
    131132    $result_html .= "<input type=hidden name=root_url value=\"" . get_option( 'siteurl' ) . "\">\n";
    132133    $result_html .= "<input type=hidden name=wordpress_version value=\"" . get_bloginfo('version') . "\">\n";
     
    135136    $result_html .= "<table>\n";
    136137    $result_html .= "<tr><td width='80'>Email:</td><td><input type=text name=admin_email value=\"" . get_option( "admin_email" ) . "\"></td></tr>\n";
    137     $result_html .= "<tr><td width='80'>Comments(*):</td><td><textarea name=admin_comments cols=60 rows=3></textarea></td></tr>\n";
     138    $result_html .= "<tr><td width='80'>Comments*:</td><td><textarea name=admin_comments id=admin_comments cols=60 rows=3></textarea></td></tr>\n";
    138139    $result_html .= "<input type=hidden name=return_url value='" . SERVER_HTTP_PREFIX . $_SERVER[ "SERVER_NAME" ] . $server_request_uri . "&ticket_submitted=1'>\n";
    139140    $result_html .= "<tr><td width='80'></td><td><input type=submit value='Submit error log'></td>\n";
     
    158159        return;
    159160    }   
     161
     162    /* Don't show this message to non-admins */
     163    if ( ! current_user_can( 'manage_options' ) ){
     164        return;
     165    }
    160166   
    161167    $current_vulns_found = intval( get_option( SIXSCAN_OPTION_VULNERABITILY_COUNT ) );
  • 6scan-backup/trunk/admin/includes/common.php

    r579609 r587313  
    44    die( 'No direct access allowed' );
    55
    6 define ( 'SIXSCAN_VERSION' ,                            '2.2.7.1' );
     6define ( 'SIXSCAN_VERSION' ,                            '2.2.8.2' );
    77define ( 'SIXSCAN_HTACCESS_VERSION' ,                   '1' );
    88
     
    111111define ( 'SIXSCAN_ANALYTICS_OK_STRING',                 'ok' );
    112112define ( 'SIXSCAN_ANALYTICS_FAIL_PREFIX_STRING',        'error_' );
    113 
    114 define( 'SIXSCAN_HTACCESS_FILE',                        ABSPATH . '/.htaccess' );
    115 define( 'SIXSCAN_HTACCESS_6SCAN_GATE_FILE_NAME',        '6scan-gate.php' );
     113define ( 'SIXSCAN_HTACCESS_FILE',                       ABSPATH . '/.htaccess' );
     114
     115define ( 'SIXSCAN_HTACCESS_6SCAN_GATE_FILE_NAME',       '6scan-gate.php' );
    116116
    117117define( 'SIXSCAN_ADMIN_ACCESS_COOKIE_NAME',             'sixscan_wpblog_admin' );
     
    123123
    124124/*  If this script is included from outside, we will not have SIXSCAN_PLUGIN_DIR defined, but we do not really need it */
    125 if ( defined( 'SIXSCAN_PLUGIN_DIR' ) ){
     125if ( defined( 'SIXSCAN_PLUGIN_DIR' ) ){
     126
    126127    define( 'SIXSCAN_HTACCESS_6SCAN',                       SIXSCAN_PLUGIN_DIR . '/data/.htaccess.dat' );
     128    function sixscan_common_get_src_htaccess( $is_direct = TRUE ){
     129        if ( $is_direct == TRUE )
     130            return SIXSCAN_HTACCESS_6SCAN;
     131
     132        global $wp_filesystem;
     133        return untrailingslashit ( $wp_filesystem->find_folder( SIXSCAN_HTACCESS_6SCAN ) );
     134    }
     135
     136
    127137    define( 'SIXSCAN_SIGNATURE_SRC',                        SIXSCAN_PLUGIN_DIR . '/data/' . SIXSCAN_COMM_SIGNATURE_FILENAME );
     138    function sixscan_common_get_signature_src( $is_direct = TRUE ){
     139        if ( $is_direct == TRUE )
     140            return SIXSCAN_SIGNATURE_SRC;
     141       
     142        global $wp_filesystem;
     143        return untrailingslashit( $wp_filesystem->find_folder( SIXSCAN_SIGNATURE_SRC ) );   
     144    }
     145
    128146    define( 'SIXSCAN_HTACCESS_6SCAN_GATE_SOURCE',           SIXSCAN_PLUGIN_DIR . '/data/' . SIXSCAN_HTACCESS_6SCAN_GATE_FILE_NAME );
     147    function sixscan_common_get_gate_src( $is_direct = TRUE ){     
     148        if ( $is_direct == TRUE )
     149            return SIXSCAN_HTACCESS_6SCAN_GATE_SOURCE;
     150       
     151        global $wp_filesystem;
     152        return untrailingslashit( $wp_filesystem->find_folder( SIXSCAN_HTACCESS_6SCAN_GATE_SOURCE ) );     
     153    }   
    129154    define( 'SIXSCAN_ANALYZER_LOG_FILEPATH',                SIXSCAN_PLUGIN_DIR . SIXSCAN_SECURITY_LOG_FILENAME );   
    130155}
    131156
    132 define( 'SIXSCAN_HTACCESS_6SCAN_GATE_DEST',             ABSPATH . SIXSCAN_HTACCESS_6SCAN_GATE_FILE_NAME );
    133 define( 'SIXSCAN_SIGNATURE_DEST',                       ABSPATH . SIXSCAN_COMM_SIGNATURE_FILENAME );
     157
    134158define( 'SIXSCAN_COMMON_DASHBOARD_URL',                 'six-scan-dashboard' );
    135159define( 'SIXSCAN_COMMON_SETTINGS_URL',                  'six-scan-settings' );
     
    156180EOD
    157181);
     182
     183
     184function sixscan_common_get_htaccess_file_path( $is_direct ){
     185    if ( $is_direct == TRUE )
     186        return SIXSCAN_HTACCESS_FILE;
     187
     188    global $wp_filesystem;
     189    return $wp_filesystem->abspath() . '.htaccess';
     190}
     191
     192function sixscan_common_get_htaccess_dest_path( $is_direct = TRUE ){
     193    if ( $is_direct == TRUE )
     194        return ABSPATH . SIXSCAN_HTACCESS_6SCAN_GATE_FILE_NAME;
     195
     196    global $wp_filesystem;
     197    return $wp_filesystem->abspath() . SIXSCAN_HTACCESS_6SCAN_GATE_FILE_NAME;
     198}
     199
     200function sixscan_common_get_signature_dest_path( $is_direct = TRUE ){
     201    if ( $is_direct == TRUE )
     202        return ABSPATH . SIXSCAN_COMM_SIGNATURE_FILENAME;
     203
     204    global $wp_filesystem;
     205    return $wp_filesystem->abspath() . SIXSCAN_COMM_SIGNATURE_FILENAME;
     206}
    158207
    159208function sixscan_common_set_site_id( $site_id ){
     
    376425    $submission_data .= "Is access through proxy: $is_through_proxy\n";
    377426   
    378     $htaccess_contents = file_get_contents( SIXSCAN_HTACCESS_FILE );
     427    $htaccess_contents = file_get_contents( sixscan_common_get_htaccess_file_path( TRUE ) );
    379428    if ( $htaccess_contents == FALSE )
    380429        $htaccess_contents = "Empty";
     
    406455    global $wp_filesystem;
    407456
    408     $tmp_fname = tempnam( untrailingslashit( $dir_name ) , 'sixscantmp_');
     457    $tmp_fname = untrailingslashit( $dir_name ) . 'sixscantmp_';
    409458   
    410459    $ftmp_result = $wp_filesystem->put_contents( $tmp_fname , 'write_test' );   
     
    414463
    415464    /* Cleanup */
    416     unlink( $tmp_fname );
     465    $wp_filesystem->delete( $tmp_fname );
    417466    return TRUE;
    418467}
  • 6scan-backup/trunk/admin/includes/htaccess.php

    r579277 r587313  
    77    $ret_error = array();
    88
    9     $htaccess_sixscan = trim ( $wp_filesystem->get_contents( SIXSCAN_HTACCESS_6SCAN . $htaccess_sixscan_version ) ) . "\n\n";       
    10    
    11     if ( ! $wp_filesystem->copy( SIXSCAN_HTACCESS_6SCAN_GATE_SOURCE, SIXSCAN_HTACCESS_6SCAN_GATE_DEST , TRUE , 0755 ) ) {
    12         $ret_error[ 'user_message' ] = 'Failed copying ' . SIXSCAN_HTACCESS_6SCAN_GATE_FILE_NAME . ' during installation';
     9    $is_direct = ( $wp_filesystem->method == 'direct' );   
     10    $local_htaccess_path = sixscan_common_get_htaccess_file_path( $is_direct );
     11    $htaccess_sixscan = trim ( $wp_filesystem->get_contents( sixscan_common_get_src_htaccess( $is_direct ) . $htaccess_sixscan_version ) ) . "\n\n";       
     12
     13    if ( ! $wp_filesystem->copy( sixscan_common_get_gate_src( $is_direct ) , sixscan_common_get_htaccess_dest_path( $is_direct ) , TRUE , 0755 ) ) {
     14        $ret_error[ 'user_message' ] = 'Failed copying ' . sixscan_common_get_htaccess_dest_path( $is_direct ) . ' during installation';
    1315        $ret_error[ 'short_description' ] = 'Failed copying htaccess during installation';
    1416        return $ret_error;
    1517    }       
    1618
    17     if ( ! $wp_filesystem->copy( SIXSCAN_SIGNATURE_SRC, SIXSCAN_SIGNATURE_DEST , TRUE , 0755 ) ) { 
    18         $ret_error[ 'user_message' ] = 'Failed copying ' . SIXSCAN_SIGNATURE_SRC . ' during installation';
     19    if ( ! $wp_filesystem->copy( sixscan_common_get_signature_src( $is_direct ), sixscan_common_get_signature_dest_path( $is_direct ) , TRUE , 0755 ) ) {
     20        $ret_error[ 'user_message' ] = 'Failed copying ' . sixscan_common_get_signature_src( $is_direct ) . ' during installation';
    1921        $ret_error[ 'short_description' ] = 'Failed copying signature during installation';
    2022        return $ret_error;
    2123    }
    2224   
    23     if ( $wp_filesystem->exists( SIXSCAN_HTACCESS_FILE ) ) {
    24         $htaccess_content = $wp_filesystem->get_contents( SIXSCAN_HTACCESS_FILE );
     25    if ( $wp_filesystem->exists( $local_htaccess_path ) ) {
     26        $htaccess_content = $wp_filesystem->get_contents( $local_htaccess_path );
    2527        $htaccess_sixscan .= preg_replace( '@# Created by 6Scan plugin(.*?)# End of 6Scan plugin@s' , '' , $htaccess_content ) ;
    26         $wp_filesystem->delete( SIXSCAN_HTACCESS_FILE );
     28        $wp_filesystem->delete( $local_htaccess_path );
    2729    }
    2830   
    29     if ( $wp_filesystem->put_contents( SIXSCAN_HTACCESS_FILE , $htaccess_sixscan ) === FALSE ){
     31    if ( $wp_filesystem->put_contents( $local_htaccess_path , $htaccess_sixscan ) === FALSE ){
    3032        $ret_error[ 'user_message' ] = 'Failed opening htaccess during installation';
    3133        $ret_error[ 'short_description' ] = 'Failed opening htaccess during installation';
     
    4244        WP_Filesystem();
    4345
     46    $is_direct = ( $wp_filesystem->method == 'direct' );
     47    $local_htaccess_path = sixscan_common_get_htaccess_file_path( $is_direct );
     48
    4449    try {
    45         if ( $wp_filesystem->exists( SIXSCAN_HTACCESS_FILE ) ) {
    46             $htaccess_content = $wp_filesystem->get_contents( SIXSCAN_HTACCESS_FILE );
     50        if ( $wp_filesystem->exists( $local_htaccess_path ) ) {
     51            $htaccess_content = $wp_filesystem->get_contents( $local_htaccess_path );
    4752            $a = preg_replace( '@# Created by 6Scan plugin(.*?)# End of 6Scan plugin@s', '', $htaccess_content) ;
     53   
     54            if ( $wp_filesystem->put_contents( $local_htaccess_path , $a ) === FALSE )
     55                throw new Exception('Failed to open htaccess during installation');     
    4856        }
    49    
    50         if ( $wp_filesystem->put_contents( SIXSCAN_HTACCESS_FILE , $a ) === FALSE )
    51             throw new Exception('Failed to open htaccess during installation');     
    52        
    53         if ( filesize( SIXSCAN_HTACCESS_FILE ) == 1 )
    54             $wp_filesystem->delete( SIXSCAN_HTACCESS_FILE );
    5557           
    56         if ( $wp_filesystem->exists( SIXSCAN_HTACCESS_6SCAN_GATE_DEST ) )
    57             $wp_filesystem->delete( SIXSCAN_HTACCESS_6SCAN_GATE_DEST );
     58        if ( $wp_filesystem->exists( sixscan_common_get_htaccess_dest_path( $is_direct ) ) )
     59            $wp_filesystem->delete( sixscan_common_get_htaccess_dest_path( $is_direct ) ); 
    5860           
    59         if ( $wp_filesystem->exists( SIXSCAN_SIGNATURE_DEST ) )
    60             $wp_filesystem->delete ( SIXSCAN_SIGNATURE_DEST ) ;
     61        if ( $wp_filesystem->exists( sixscan_common_get_signature_dest_path( $is_direct ) ) )
     62            $wp_filesystem->delete ( sixscan_common_get_signature_dest_path( $is_direct ) ) ;
    6163       
    6264    } catch( Exception $e ) {
  • 6scan-backup/trunk/admin/includes/installation.php

    r579277 r587313  
    1515    if ( sixscan_installation_wpfs_init( $tmp_key ) == FALSE)
    1616        return;
    17 
     17   
    1818    /* Run the install */
    1919    $install_result = sixscan_installation_install( $tmp_key );
     
    117117
    118118        /*  Make sure we can create signature file and update the site's .htaccess file */
    119         if ( sixscan_common_test_dir_writable( ABSPATH ) == FALSE ){               
     119        if ( sixscan_common_test_dir_writable( $wp_filesystem->abspath() ) == FALSE ){             
    120120            $err_message = "6Scan Install <b>Error</b>: Failed creating signature file at Wordpress directory " . ABSPATH . SIXSCAN_COMM_SIGNATURE_FILENAME .
    121121            "<br/><br/>Please see <a href='http://codex.wordpress.org/Changing_File_Permissions' target='_blank'>this Wordpress article</a> for more information on how to add write permissions." .
     
    183183        update_option( SIXSCAN_OPTION_STAT_OK_REQ_COUNT , 0);
    184184        update_option( SIXSCAN_OPTION_WAF_REQUESTED , array() );
    185         update_option( SIXSCAN_OPTION_LOGIN_SETTINGS , array() );       
     185        update_option( SIXSCAN_OPTION_LOGIN_SETTINGS , array() );              
    186186        update_option( SIXSCAN_VULN_MESSAGE_DISMISSED , FALSE );
    187187
     
    241241        delete_option( SIXSCAN_OPTION_COMM_LAST_SIG_UPDATE_NONCE );     
    242242        delete_option( SIXSCAN_OPTION_VULNERABITILY_COUNT );
    243         delete_option( SIXSCAN_OPTION_LOGIN_SETTINGS );
     243        delete_option( SIXSCAN_OPTION_LOGIN_SETTINGS );     
    244244        delete_option( SIXSCAN_LOGIN_LOGS );       
    245245        delete_option( SIXSCAN_OPTION_WPFS_CONFIG );
     
    333333/*  Returns TRUE if wpfs is already initialized, FALSE if we are waiting for user to enter reg_data */
    334334function sixscan_installation_wpfs_init( &$config_key ){
    335    
     335    /*  Wordpress doesn't always detect the fs method correctly. If we detect, that we can write to the filesystem directly -
     336    we can force the method to be direct */
     337    $wpfs_detect_try = sixscan_installation_wpfs_detect();
     338    if ( $wpfs_detect_try == 'direct' )
     339        define( 'FS_METHOD' , 'direct' );
     340    else if ( $wpfs_detect_try == 'ftpext' )
     341        define( 'FS_METHOD' , 'ftpext' );   
    336342    if ( WP_Filesystem() ){
    337343        $config_key = "";
     
    360366    return FALSE;
    361367}
     368
     369/*  Since Wordpress FTP method detection is not always correct (The newly created test-file is compared to the owner of Wordpress scrit)
     370    We will run the test ourself */
     371function sixscan_installation_wpfs_detect(){
     372
     373    /* First of all - we are checking whether the .htaccess is writable via direct */
     374    if ( file_exists( SIXSCAN_HTACCESS_FILE ) && ( sixscan_installation_try_direct_write_file( SIXSCAN_HTACCESS_FILE , FALSE ) == FALSE ) ){       
     375        if ( extension_loaded( 'ftp' ) ){
     376            return 'ftpext';   
     377        }
     378        return FALSE;
     379    }
     380
     381    /*  Taken from Wordpress file.php, with minor changes for our needs, we are testing direct file access */
     382    $context = trailingslashit( $context );
     383    $temp_file_name = WP_CONTENT_DIR . 'temp-write-test-' . time();
     384    if ( sixscan_installation_try_direct_write_file( $temp_file_name , TRUE ) == TRUE )
     385        return 'direct';       
     386
     387    return FALSE;
     388}
     389
     390function sixscan_installation_try_direct_write_file( $fname , $is_to_delete = FALSE ){
     391   
     392    $temp_handle = @fopen( $fname , 'a+' );
     393    if ( $temp_handle ) {           
     394        @fclose( $temp_handle );
     395       
     396        if ( $is_to_delete == TRUE )
     397            @unlink( $fname );
     398
     399        return TRUE;
     400    }
     401
     402    return FALSE;
     403}
    362404   
    363405?>
  • 6scan-backup/trunk/modules/signatures/update.php

    r566111 r587313  
    6666    global $wp_filesystem;
    6767    /*  Prepare temporary names */
    68     $temp_upgrade_dir = get_temp_dir() . trailingslashit( "6scan_update" );
    69     $temp_zip_file = get_temp_dir() . "bguard.zip";
    70    
     68    $temp_upgrade_dir_local = trailingslashit( WP_CONTENT_DIR ) . trailingslashit( "6scan_update" );
     69    $temp_upgrade_dir = $wp_filesystem->wp_content_dir() . trailingslashit( "6scan_update" );
     70    $temp_zip_file_local = trailingslashit( WP_CONTENT_DIR ) . "bguard.zip";
     71    $temp_zip_file = $wp_filesystem->wp_content_dir() . "bguard.zip";
     72
    7173    /*  Create temp directory for update */
    72     if ( ( $wp_filesystem->is_dir( $temp_upgrade_dir ) == FALSE ) && ( $wp_filesystem->mkdir( $temp_upgrade_dir ) == FALSE ) )
     74    if ( $wp_filesystem->exists( $temp_upgrade_dir ) )
     75        $wp_filesystem->delete ( $temp_upgrade_dir , TRUE );
     76   
     77    if ( ($wp_filesystem->is_dir( $temp_upgrade_dir ) == FALSE )  && ( $wp_filesystem->mkdir( $temp_upgrade_dir ) == FALSE ) )
    7378        return "Failed creating temp directory for update at " . $temp_upgrade_dir;     
    7479       
    75     /*  Write the zip file */   
     80    /*  Write the zip file */
     81    if ( $wp_filesystem->exists( $temp_zip_file ) )
     82        $wp_filesystem->delete( $temp_zip_file );
     83   
    7684    if ( $wp_filesystem->put_contents( $temp_zip_file , $zipped_program ) == FALSE )
    7785        return "Failed writing file to " . $temp_zip_file; 
    7886   
    79     /*  unzip_file returns mixed on failure. It uses global $wp_filesystem */   
    80     if ( unzip_file( $temp_zip_file , $temp_upgrade_dir ) !== TRUE )
     87    /*  unzip_file returns mixed on failure. It uses global $wp_filesystem. */ 
     88    if ( unzip_file( $temp_zip_file_local , $temp_upgrade_dir ) !== TRUE ){     
    8189        return "unzip_file() from $temp_zip_file to $temp_upgrade_dir failed";
     90    }
    8291   
    8392    /*  Remove the no longer required zip file */
    8493    $wp_filesystem->delete( $temp_zip_file );
    8594   
    86     $plugin_main_directory = plugin_dir_path( __FILE__ ) . "../../";   
    87            
    88     $temp_upgrade_dir_internal = sixscan_signatures_update_find_plugin_dir( $temp_upgrade_dir );
    89     if ( $temp_upgrade_dir_internal == "")
    90         return "Couldn't find plugin dir in the unzipped folder $temp_upgrade_dir";
    91        
     95    $plugin_main_directory = plugin_dir_path( __FILE__ ) . "../../";
     96    $plugin_main_directory = $wp_filesystem->wp_plugins_dir() . SIXSCAN_PLUGIN_DIRNAME;
     97
     98    $temp_upgrade_dir_internal = sixscan_signatures_update_find_plugin_dir( $temp_upgrade_dir_local );
     99
     100    if ( $temp_upgrade_dir_internal == "" )
     101        return "Couldn't find plugin dir in the unzipped folder $temp_upgrade_dir_local";
     102   
     103    $temp_upgrade_dir_internal = untrailingslashit( $wp_filesystem->find_folder( $temp_upgrade_dir_internal ) );
     104
    92105    /*  Now bulk copy the rest of files to their places: */
    93106    sixscan_signatures_update_move_dir_recursive( $temp_upgrade_dir_internal , $plugin_main_directory );
    94107       
    95     /*  Remove the tmp directory */
    96     $wp_filesystem->delete ( $temp_upgrade_dir_internal );
    97     $wp_filesystem->delete ( $temp_upgrade_dir );
     108    /*  Remove the tmp directory */
     109    $wp_filesystem->delete ( $temp_upgrade_dir , TRUE );
    98110   
    99111    return TRUE;
     
    141153
    142154function sixscan_signatures_update_parse( $raw_data ) {
    143        
    144     $signature_filename = ABSPATH . "/" . SIXSCAN_COMM_SIGNATURE_FILENAME;
     155    global $wp_filesystem;
     156
     157    $signature_filename = $wp_filesystem->find_folder( ABSPATH ) . SIXSCAN_COMM_SIGNATURE_FILENAME;
    145158    $signature_filename_tmp = $signature_filename . ".tmp";
    146159    $signature_offset = strpos( $raw_data , SIXSCAN_SIGNATURE_MULTIPART_DELIMITER );
    147     global $wp_filesystem;
     160   
    148161
    149162    if ($signature_offset === FALSE)
     
    189202    global $wp_filesystem;
    190203
    191     if ( file_exists( SIXSCAN_HTACCESS_FILE ) ) {
    192         $htaccess_content = $wp_filesystem->get_contents( SIXSCAN_HTACCESS_FILE );
     204    $htaccess_fpath = sixscan_common_get_htaccess_file_path( $wp_filesystem->method == 'direct' );
     205
     206    if ( $wp_filesystem->exists( $htaccess_fpath ) ) {
     207        $htaccess_content = $wp_filesystem->get_contents( $htaccess_fpath );
    193208        /*  Remove old 6Scan signature contents */
    194209        $new_content = trim( preg_replace( '@# Created by 6Scan plugin(.*?)# End of 6Scan plugin@s', '', $htaccess_content) );
     
    287302    $htaccess_links .= $vuln_urls;     
    288303   
    289     $tmp_htaccess_file = SIXSCAN_HTACCESS_FILE . ".tmp";   
     304    $tmp_htaccess_file = $htaccess_fpath . ".tmp"; 
    290305   
    291306    $new_content = "# Created by 6Scan plugin
     
    315330    $wp_filesystem->put_contents( $tmp_htaccess_file , $new_content );
    316331       
    317     if ( sixscan_signatures_update_copy_file( $tmp_htaccess_file , SIXSCAN_HTACCESS_FILE ) == FALSE )
    318         return "Failed moving htaccess from $tmp_htaccess_file to " . SIXSCAN_HTACCESS_FILE;
     332    if ( sixscan_signatures_update_copy_file( $tmp_htaccess_file , $htaccess_fpath ) == FALSE )
     333        return "Failed moving htaccess from $tmp_htaccess_file to " . $htaccess_fpath;
    319334       
    320335    return TRUE;
     
    349364            $wp_filesystem->mkdir( $dest );
    350365           
    351         $file_list = scandir( $source );
    352 
    353         foreach( $file_list as $current_file ) {
     366        //$file_list = scandir( $source );
     367        $file_list = $wp_filesystem->dirlist( $source );
     368       
     369        foreach( $file_list as $farray => $current_fname ) {
     370            $current_file = $current_fname['name'];
     371           
    354372            if( $current_file == "." || $current_file == ".." ) {
    355373                /* skip "current" and "previous" directory */
     
    357375            }
    358376           
    359             if( is_dir( $source . "/" . $current_file ) ) {
     377            if( $wp_filesystem->is_dir( $source . "/" . $current_file ) ) {
    360378            /*  If it is directory , we have to call the recursion.*/
    361379                sixscan_signatures_update_move_dir_recursive( $source . "/" . $current_file, $dest. "/" . $current_file );
     
    416434    global $wp_filesystem;
    417435   
     436    $wp_filesystem->delete( $dst_file );
    418437    return $wp_filesystem->move( $src_file , $dst_file , TRUE );
    419438}
     
    449468        return WP_Filesystem();
    450469    }
    451    
     470
    452471    $cfg_arr = unserialize( sixscan_common_decrypt_string( base64_decode ( $wp_fs_param ) , $config_key ) );
    453472   
    454     $wp_fs = WP_Filesystem( $cfg_arr );
    455     if ( $wp_fs ){
    456         $wp_filesystem->connect();
    457         return $wp_fs;
    458     }
     473    $wp_fs = WP_Filesystem( $cfg_arr );
    459474
    460475    return $wp_fs;
  • 6scan-backup/trunk/readme.txt

    r579277 r587313  
    11=== 6Scan Backup ===
    22Contributors: 6Scan
    3 Version: 2.2.7
     3Version: 2.2.8
    44Tags: backup, automatic backup, cloud, online, secured, restore, recovery
    55Requires at least: 3.0.0
     
    165165* Several minor bugfixes.
    166166
     167= 2.2.8 =
     168* Changed path references from 'direct' access constants (like 'ABSPATH') to their wp_filesystem counterparts (like $wp_filesystem->abspath). This is used to create backups in filesystems, where FTP credentials are required to access the files (Read/write permissions issues)
     169
    167170
    168171== Upgrade Notice ==
Note: See TracChangeset for help on using the changeset viewer.