예제 #1
0
 protected function saveAccount()
 {
     // TODO: check nonce
     if (isset($_POST['wplister_account_id'])) {
         // get account
         $account = new WPLE_eBayAccount($_POST['wplister_account_id']);
         $account->title = stripslashes($_POST['wplister_title']);
         $account->site_id = $_POST['wplister_site_id'];
         $account->site_code = EbayController::getEbaySiteCode($account->site_id);
         $account->token = $_POST['wplister_token'];
         $account->sandbox_mode = $_POST['wplister_sandbox_mode'];
         $account->active = $_POST['wplister_account_is_active'];
         $account->paypal_email = $_POST['wplister_paypal_email'];
         $account->oosc_mode = @$_POST['wplister_oosc_mode'];
         $account->update();
         // update user details
         // $account->updateUserDetails();
         // set enabled flag for site
         $site = WPLE_eBaySite::getSiteObj($account->site_id);
         $site->enabled = 1;
         $site->update();
         // update default account
         if ($account->id == get_option('wplister_default_account_id')) {
             $this->makeDefaultAccount($account->id);
         }
         $this->showMessage(__('Account was updated.', 'wplister'));
     }
 }
예제 #2
0
 protected function saveCategoriesSettings()
 {
     self::check_max_post_vars();
     // TODO: check nonce
     if (isset($_POST['wpl_e2e_ebay_category_id']) && isset($_POST['submit'])) {
         $account_id = isset($_REQUEST['account_id']) ? $_REQUEST['account_id'] : get_option('wplister_default_account_id');
         $site_id = WPLE()->accounts[$account_id]->site_id;
         if ($account_id) {
             $account = new WPLE_eBayAccount($account_id);
             $account->default_ebay_category_id = $this->getValueFromPost('default_ebay_category_id');
             $account->categories_map_ebay = maybe_serialize($this->getValueFromPost('ebay_category_id'));
             $account->categories_map_store = maybe_serialize($this->getValueFromPost('store_category_id'));
             $account->update();
             WPLE()->loadAccounts();
         }
         // update current default account (legacy)
         if ($account_id == get_option('wplister_default_account_id')) {
             // save ebay categories mapping
             self::updateOption('categories_map_ebay', $this->getValueFromPost('ebay_category_id'));
             // save store categories mapping
             self::updateOption('categories_map_store', $this->getValueFromPost('store_category_id'));
             // save default ebay category
             self::updateOption('default_ebay_category_id', $this->getValueFromPost('default_ebay_category_id'));
         }
         $this->showMessage(__('Categories mapping updated.', 'wplister'));
     }
 }
예제 #3
0
 public function doFetchToken($account_id = false)
 {
     // $account_id = $account_id ? $account_id : get_option('wplister_default_account_id'); // we can *not* fall back to the default account here, or adding a new account would overwrite the default account's token
     $SessionID = get_option('wplister_ebay_sessionid');
     $token = $this->FetchToken($SessionID);
     if ($token) {
         if ($account_id) {
             $account = new WPLE_eBayAccount($account_id);
             $account->token = $token;
             $account->update();
         }
         // check if setup wizard is still active
         if (get_option('wplister_setup_next_step') == 1) {
             // update legacy data
             update_option('wplister_ebay_token', $token);
             // move setup to step 2
             update_option('wplister_setup_next_step', '2');
             // remember when WP-Lister was connected to an eBay account for the first time
             update_option('ignore_orders_before_ts', time());
         }
         // // obsolete - already called in fetchTokenForAccount()
         // update_option('wplister_ebay_token_is_invalid', false );
     }
     return $token;
 }