Plugin Directory

Changeset 637584


Ignore:
Timestamp:
12/12/2012 09:02:51 AM (13 years ago)
Author:
6Scan
Message:

Support for WP 3.5
Registration process changed

Location:
6scan-backup/trunk
Files:
3 added
3 edited

Legend:

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

    r597897 r637584  
    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.9
     7Version: 2.3.0
    88Author URI: http://www.6scan.com
    99*/
  • 6scan-backup/trunk/admin/includes/common.php

    r597897 r637584  
    44    die( 'No direct access allowed' );
    55
    6 define ( 'SIXSCAN_VERSION' ,                            '2.2.9.0' );
     6define ( 'SIXSCAN_VERSION' ,                            '2.3.0.0' );
    77define ( 'SIXSCAN_HTACCESS_VERSION' ,                   '1' );
    88
     
    119119define( 'SIXSCAN_ANALYZER_MAX_LOG_FILESIZE',            512000 );   
    120120define( 'SIXSCAN_SECURITY_LOG_FILENAME',                '/data/security_log/logger.txt' );
    121 define( 'SIXSCAN_SECURITY_LOCK_NOTIFY_FILENAME',        '/data/lockout_email.html');
     121define( 'SIXSCAN_SECURITY_LOCK_NOTIFY_FILENAME',        '/data/lockout_email.html' );
     122define( 'SIXCAN_REGISTRATION_PAGE_FILENAME' ,           '/data/regpage/reg.html' );
    122123define( 'SIXSCAN_SECURITY_LOG_SEPARATOR',               "\n" );
    123124
     
    455456    global $wp_filesystem;
    456457
    457     $tmp_fname = untrailingslashit( $dir_name ) . 'sixscantmp_';
     458    $tmp_fname = trailingslashit( $dir_name ) . 'sixscantmp_';
    458459   
    459460    $ftmp_result = $wp_filesystem->put_contents( $tmp_fname , 'write_test' );   
  • 6scan-backup/trunk/admin/includes/installation.php

    r597897 r637584  
    33if ( ! defined( 'ABSPATH' ) )
    44    die( 'No direct access allowed' ); 
     5
    56
    67function sixscan_installation_manager()
     
    1011    if ( ( sixscan_common_is_partner_version() ) && ( sixscan_installation_partner_is_to_install() === FALSE ) )
    1112        return;
     13
     14    /* Before install of any kind progresses, user is shown a registration page.
     15    On the first load it shows a registration screen and returns False.
     16    If user clicks 'Agree' - the page reloads with &agree=yes parameter, sixscan_registration_at_install() returns True and registration continues.
     17    No data is transferred to the server until user clicks "Agree" */
     18    if ( sixscan_registration_at_install() === FALSE )
     19        return;     
    1220
    1321    /* If we are waiting for user to input wpfs data */
     
    2432            print $install_result;     
    2533           
     34            /* Makes 6Scan not-active */
    2635            $sixscan_plugin_name = plugin_basename( realpath( dirname( __FILE__ ) . "/../../6scan.php" ) );
    27            
     36       
    2837            /*  This dirty patch is required because some hostings (free?) have a short sql timeout. When it timeouts, 6Scan can't
    2938            disable itelf, and user gets stuck in infinite deactivate loop.
     
    3746
    3847            /*  deactivate myself */           
    39             deactivate_plugins( $sixscan_plugin_name );
     48            deactivate_plugins( $sixscan_plugin_name );         
    4049        }
    4150        else if ( sixscan_installation_partner_run_first_time() === FALSE  ){
     
    4857        /*  No redirects in partner version */
    4958        if ( sixscan_common_is_partner_version() === FALSE ){
    50        
    51             /*  If the install has succeeded - forward user to the registration page */     
    52             $reg_page_address = get_bloginfo( "wpurl" ) . "/wp-admin/admin.php?page=" . SIXSCAN_COMMON_DASHBOARD_URL . "&sixscan_activated=1";
    5359           
    54             /* If user's JavaScript is disabled, he will see this notice to upgrade */
    55             sixscan_installation_account_setup_required_notice();
    56             /*  Forward user to the registration screen */
    57             print <<<EOT
    58                 <script type="text/javascript">
    59                     document.getElementById('6scan_dashboard_redirect_caption').style.display = 'none';
    60                     window.location = "$reg_page_address";
    61                 </script>
    62 EOT;
     60            sixscan_registration_forward_to_dashboard( "&sixscan_activated=1" );
    6361        }
    6462    }
     
    6765    if ( sixscan_common_is_partner_version() )
    6866        sixscan_installation_partner_mark_install_tried();
     67}
     68
     69function sixscan_registration_forward_to_dashboard( $additional_flags = "" ){
     70    $reg_page_address = get_bloginfo( "wpurl" ) . "/wp-admin/admin.php?page=" . SIXSCAN_COMMON_DASHBOARD_URL . $additional_flags;
     71    /*  If the install has succeeded - forward user to the registration page */     
     72           
     73    /* If user's JavaScript is disabled, he will see this notice to upgrade */
     74    sixscan_installation_account_setup_required_notice();
     75    /*  Forward user to the registration screen */
     76    print <<<EOT
     77        <script type="text/javascript">
     78            document.getElementById('6scan_dashboard_redirect_caption').style.display = 'none';
     79            window.location = "$reg_page_address";
     80        </script>
     81EOT;
     82}
     83
     84function sixscan_registration_at_install(){
     85    /* The logic is as following:
     86    When the plugin just got activated - forward user to the dashboard.
     87    When the current page is 6Scan Dashboard - show him the registration page
     88    */
     89    $just_activated = isset( $_GET[ 'activate' ] ) ? strtolower( $_GET[ 'activate' ] ) : '';
     90    $current_page = isset( $_GET[ 'page' ] ) ? strtolower( $_GET[ 'page' ] ) : '';
     91    $agree_val = isset( $_GET[ 'agree' ] ) ? strtolower( $_GET[ 'agree' ] ) : '';
     92   
     93    if ( $just_activated == 'true' ){
     94        sixscan_registration_forward_to_dashboard();
     95        return FALSE;
     96    }
     97
     98    if ( $current_page != SIXSCAN_COMMON_DASHBOARD_URL )
     99        return FALSE;
     100
     101    /* First entry to registration page */
     102    if ( $agree_val == '' ){       
     103        /* Registration page content */
     104        $registration_page = file_get_contents( SIXSCAN_PLUGIN_DIR . SIXCAN_REGISTRATION_PAGE_FILENAME );
     105
     106        /* Add nonce token and email address to the Registration form (Nothing is sent to the server) */   
     107        $replaced_values = array( '_nonce_value_sixscan' , '_email_value_sixscan' , '_page_value_sixscan' , '_reg_logo_link_sixscan');
     108        $new_values =  array( wp_create_nonce( 'sixscan_registration_html' ) , get_option( 'admin_email' ) , SIXSCAN_COMMON_DASHBOARD_URL , SIXSCAN_PLUGIN_URL . 'data/img/reg_logo.png' );
     109        $registration_page = str_replace ( $replaced_values , $new_values , $registration_page );
     110       
     111
     112
     113        print $registration_page;
     114        return FALSE;
     115    }
     116
     117    /* Origin verification */
     118    if (! wp_verify_nonce( $_GET[ '_sixscannonce' ], 'sixscan_registration_html') ) die( 'Security failure' );
     119
     120    /* User clicked 'yes'. Continue to registration */
     121    if ($agree_val == 'yes' ){
     122        return TRUE;
     123    }
     124
     125    return FALSE;
    69126}
    70127
     
    271328
    272329function sixscan_installation_register_with_server( $tmpkey ){
    273        
     330   
     331    $admin_email = isset( $_GET['email'] ) ? $_GET['email'] : "";
     332   
    274333    /*  If there is partner file, partner_id and partner_key are filled */
    275334    sixscan_installation_partner_info_get( $partner_id , $partner_key );
    276335
    277336    $sixscan_register_result = sixscan_communication_oracle_reg_register( get_option( 'siteurl' ) ,
    278                             get_option( 'admin_email' ) , SIXSCAN_PLUGIN_URL . "modules/signatures/notice.php" ,
     337                            $admin_email , SIXSCAN_PLUGIN_URL . "modules/signatures/notice.php" ,
    279338                            $sixscan_oracle_auth_struct , $partner_id , $partner_key , $tmpkey );           
    280339
Note: See TracChangeset for help on using the changeset viewer.