/**
  * Install plugin with new user information after approval.
  *
  * @author Vova Feldman (@svovaf)
  * @since  1.0.7
  */
 function _install_with_new_user()
 {
     $this->_logger->entrance();
     if ($this->is_registered()) {
         return;
     }
     if (fs_request_is_action($this->_slug . '_activate_new')) {
         //				check_admin_referer( $this->_slug . '_activate_new' );
         $this->_admin_notices->remove_sticky('connect_account');
         if (fs_request_has('user_secret_key')) {
             $user = new FS_User();
             $user->id = fs_request_get('user_id');
             $user->public_key = fs_request_get('user_public_key');
             $user->secret_key = fs_request_get('user_secret_key');
             $this->_user = $user;
             $user_result = $this->get_api_user_scope()->get();
             $user = new FS_User($user_result);
             $this->_user = $user;
             $site = new FS_Site();
             $site->id = fs_request_get('install_id');
             $site->public_key = fs_request_get('install_public_key');
             $site->secret_key = fs_request_get('install_secret_key');
             $this->_site = $site;
             $site_result = $this->get_api_site_scope()->get();
             $site = new FS_Site($site_result);
             $this->_site = $site;
             $this->setup_account($this->_user, $this->_site);
         } else {
             if (fs_request_has('pending_activation')) {
                 // Install must be activated via email since
                 // user with the same email already exist.
                 $this->_storage->is_pending_activation = true;
                 $this->_add_pending_activation_notice(fs_request_get('user_email'));
                 // Reload the page with with pending activation message.
                 if (fs_redirect($this->get_after_activation_url('after_pending_connect_url'))) {
                     exit;
                 }
             }
         }
     }
 }
 /**
  * Install plugin with new user information after approval.
  *
  * @author Vova Feldman (@svovaf)
  * @since  1.0.7
  */
 function _install_with_new_user()
 {
     $this->_logger->entrance();
     if ($this->is_registered()) {
         return;
     }
     if (fs_request_is_action($this->_slug . '_activate_new')) {
         //				check_admin_referer( $this->_slug . '_activate_new' );
         if (fs_request_has('user_secret_key')) {
             $this->install_with_new_user(fs_request_get('user_id'), fs_request_get('user_public_key'), fs_request_get('user_secret_key'), fs_request_get('install_id'), fs_request_get('install_public_key'), fs_request_get('install_secret_key'));
         } else {
             if (fs_request_has('pending_activation')) {
                 $this->set_pending_confirmation(fs_request_get('user_email'), true);
             }
         }
     }
 }
Exemple #3
0
 /**
  * Install plugin with new user information after approval.
  *
  * @author Vova Feldman (@svovaf)
  * @since  1.0.7
  */
 function _install_with_new_user()
 {
     if ($this->is_registered()) {
         return;
     }
     if (fs_request_is_action($this->_slug . '_activate_new')) {
         //				check_admin_referer( $this->_slug . '_activate_new' );
         if (fs_request_has('user_secret_key')) {
             $user = new FS_User();
             $user->id = fs_request_get('user_id');
             $user->public_key = fs_request_get('user_public_key');
             $user->secret_key = fs_request_get('user_secret_key');
             $this->_user = $user;
             $user_result = $this->get_api_user_scope()->get();
             $user = new FS_User($user_result);
             $this->_user = $user;
             $site = new FS_Site();
             $site->id = fs_request_get('install_id');
             $site->public_key = fs_request_get('install_public_key');
             $site->secret_key = fs_request_get('install_secret_key');
             $this->_site = $site;
             $site_result = $this->get_api_site_scope()->get();
             $site = new FS_Site($site_result);
             $this->_site = $site;
             $this->setup_account($this->_user, $this->_site);
             $plugin_id = fs_request_get('plugin_id', false);
             // Store activation time ONLY for plugins (not add-ons).
             if (!is_numeric($plugin_id) || $plugin_id == $this->_plugin->id) {
                 $this->_storage->activation_timestamp = WP_FS__SCRIPT_START_TIME;
             }
             if (is_numeric($plugin_id)) {
                 if ($plugin_id != $this->_plugin->id) {
                     // Add-on was purchased - sync license after install.
                     if (fs_redirect(fs_nonce_url($this->_get_admin_page_url('account', array('fs_action' => $this->_slug . '_sync_license', 'plugin_id' => $plugin_id)), $this->_slug . '_sync_license'))) {
                         exit;
                     }
                 }
             }
         } else {
             if (fs_request_has('pending_activation')) {
                 // Install must be activated via email since
                 // user with the same email already exist.
                 $this->_storage->is_pending_activation = true;
                 $this->_add_pending_activation_notice(fs_request_get('user_email'));
             }
         }
         if (fs_redirect($this->_get_admin_page_url())) {
             exit;
         }
     }
 }