options=$options; } $this->add_remote=false; } public function pre_add_remote($remote,$id) { if($remote['type']==WPVIVID_REMOTE_ONEDRIVE) { $remote['id']=$id; } return $remote; } public function handle_auth_actions() { if (isset($_GET['action']) && isset($_GET['page'])) { if($_GET['page'] === 'WPvivid') { if($_GET['action']=='wpvivid_one_drive_auth') { $check=current_user_can('manage_options'); if(!$check) { return; } try { $rand_id = substr(md5(time().rand()), 0,13); $auth_id = 'wpvivid-auth-'.$rand_id; $remote_options['auth_id']=$auth_id; set_transient('onedrive_auth_id', $remote_options, 900); $url = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize' . '?client_id=' . urlencode('37668be9-b55f-458f-b6a3-97e6f8aa10c9') . '&scope=' . urlencode('offline_access files.readwrite.all') . '&response_type=code' . '&redirect_uri=' . urlencode('https://auth.wpvivid.com/onedrive_v2/') . '&state=' . urlencode(admin_url() . 'admin.php?page=WPvivid' . '&action=wpvivid_one_drive_finish_auth&main_tab=storage&sub_tab=one_drive&sub_page=storage_account_one_drive&auth_id='.$auth_id) . '&display=popup' . '&locale=en'; header('Location: ' . esc_url_raw($url)); } catch (Exception $e){ echo '
'.esc_html($e->getMessage()).'
'; esc_html_e('You have authenticated the Microsoft OneDrive account as your remote storage.', 'wpvivid-backuprestore'); echo '
'.esc_html($e->getMessage()).'
'.esc_html($e->getMessage()).'
'; esc_html_e('You have authenticated the Microsoft OneDrive account as your remote storage.', 'wpvivid-backuprestore'); echo '
'.esc_html($_GET['resp_msg']).'