awake.php
5 years ago
bgLogin.php
5 years ago
cancelBackup.php
5 years ago
cancelDownload.php
5 years ago
checkBackupCreation.php
5 years ago
checkFreeMigration.php
5 years ago
checkPHPVersionCompatibility.php
5 years ago
checkRestoreCreation.php
5 years ago
chooseProfile.php
5 years ago
cloudDropbox.php
5 years ago
createCloudUser.php
5 years ago
curlChecker.php
5 years ago
deleteBackup.php
5 years ago
dismissDiscountNotice.php
5 years ago
downloadBackup.php
5 years ago
getAction.php
5 years ago
getBackupContent.php
5 years ago
getRunningActions.php
5 years ago
hideNotice.php
5 years ago
importBackup.php
5 years ago
isBgUserExists.php
5 years ago
isFeatureAvailable.php
5 years ago
manualBackup.php
5 years ago
modalBackupGuardDetails.php
5 years ago
modalImport.php
5 years ago
modalManualBackup.php
5 years ago
modalManualRestore.php
5 years ago
modalPrivacy.php
5 years ago
modalReview.php
5 years ago
modalTerms.php
5 years ago
resetStatus.php
5 years ago
restore.php
5 years ago
reviewBannerActions.php
5 years ago
schedule.php
5 years ago
sendUsageStatus.php
5 years ago
setReviewPopupState.php
5 years ago
setUserInfoVerificationPopupState.php
5 years ago
settings.php
5 years ago
storeSubscriberInfo.php
5 years ago
storeSurveyResult.php
5 years ago
bgLogin.php
58 lines
| 1 | <?php |
| 2 | |
| 3 | require_once(dirname(__FILE__).'/../boot.php'); |
| 4 | require_once(SG_STORAGE_PATH.'BackupGuardStorage.php'); |
| 5 | require_once(SG_LIB_PATH.'SGAuthClient.php'); |
| 6 | |
| 7 | function BackupGuardLogouCloudUser() { |
| 8 | SGConfig::set('SG_BACKUPGUARD_UPLOAD_ACCESS_TOKEN', ''); |
| 9 | SGConfig::set('SG_BACKUPGUARD_UPLOAD_ACCESS_TOKEN_EXPIRES',''); |
| 10 | SGConfig::set('SG_BACKUPGUARD_UPLOAD_REFRESH_TOKEN',''); |
| 11 | SGConfig::set('SG_BACKUPGUARD_CLOUD_ACCOUNT', ''); |
| 12 | SGConfig::set('SG_BACKUPGUARD_CLOUD_ACCOUNT_EMAIL', ''); |
| 13 | SGConfig::set('BACKUP_GUARD_PROFILE_ID', ''); |
| 14 | } |
| 15 | if(backupGuardIsAjax() && count($_POST)) { |
| 16 | $_POST = backupGuardRemoveSlashes($_POST); |
| 17 | $_POST = backupGuardSanitizeTextField($_POST); |
| 18 | |
| 19 | if(isset($_POST['cancel'])) { |
| 20 | |
| 21 | BackupGuardLogouCloudUser(); |
| 22 | die('{"success":"success"}'); |
| 23 | } |
| 24 | |
| 25 | try { |
| 26 | BackupGuardLogouCloudUser(); |
| 27 | $email = $_POST['email']; |
| 28 | $password = sha1($_POST['password']); |
| 29 | |
| 30 | if (!$email || !$password) { |
| 31 | die('{"error":"Invalid arguments"}'); |
| 32 | } |
| 33 | |
| 34 | $bgStorage = new BackupGuard\Storage(); |
| 35 | |
| 36 | $accessToken = $bgStorage->connect($email, $password, true); |
| 37 | if ($accessToken) { |
| 38 | try { |
| 39 | $account = $bgStorage->checkCloudAccount(); |
| 40 | SGConfig::set('SG_BACKUPGUARD_CLOUD_ACCOUNT', serialize($account)); |
| 41 | } |
| 42 | catch(Exception $exp) { |
| 43 | $bgStorage->addCloudAccountToUser(); |
| 44 | } |
| 45 | |
| 46 | $bgStorage->connect($email, $password); |
| 47 | $profiles = $bgStorage->getProfiles(); |
| 48 | } |
| 49 | } |
| 50 | catch(Exception $exp) { |
| 51 | die('{"error":"'.$exp->getMessage().'"}'); |
| 52 | } |
| 53 | |
| 54 | SGConfig::set('SG_BACKUPGUARD_CLOUD_ACCOUNT_EMAIL', $email); |
| 55 | die(json_encode(array( |
| 56 | 'profiles' => $profiles |
| 57 | ))); |
| 58 | } |