PHP User::UpdateOptions Examples

PHP User::UpdateOptions - 3 examples found. These are the top rated real world PHP examples of User::UpdateOptions extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
    if ($fbAppDetails = $fb->AppDetailsFromAt(Input::Get("fb_accesstoken"))) {
        if ($fb->GetAccessToken($fbAppDetails->id, $userData->id)) {
            $fb->UpdateAccessToken($user->data()->id, $fbAppDetails->id, $userData->id, Input::Get("fb_accesstoken"));
        } else {
            $fb->SaveAccessToken($user->data()->id, $fbAppDetails->id, $userData->id, Input::Get("fb_accesstoken"));
        }
    } else {
        echo lang("UNABLE_TO_GET_FB_APP_DETAILS");
        exit;
    }
    // Save new facebook account
    $fbaccount->setUserId($user->data()->id);
    $fbaccount->setFbId($userData->id);
    $fbaccount->setLastname($userData->first_name);
    $fbaccount->setFirstname($userData->last_name);
    $fbaccount->setGroups($fbgroups);
    if (!$fbaccount->UserFbAccountDefaultApp()) {
        $fbaccount->setDefaultApp($fbAppDetails->id);
    }
    // Check if this facebook account is already exists;
    if ($fbaccount->exists($userData->id)) {
        $fbaccount->Update();
    } else {
        $fbaccount->Save();
    }
    // Set the current account as the default fb account if there is no default account
    if (!$fbaccount->UserDefaultFbAccount()) {
        $user->UpdateOptions(array('default_Fb_Account' => $userData->id));
    }
    echo "true";
}
Example #2
0
        $user->UpdateOptions(array('default_Fb_Account' => Input::Get("switchFbAccount")));
        if (!httpReferer()) {
            Redirect::To("settings.php");
        }
        Redirect::To(httpReferer());
    }
}
// Delete facebook account
if (Input::get("action", "GET") == "deletefbaccount" && Input::get("id", "GET")) {
    try {
        $fbaccount->delete(Input::get("id", "GET"));
        Session::Flash("settings", "success", lang("FB_ACCOUNT_SUCCESS_DELETED"), true);
    } catch (Exception $ex) {
        Session::Flash("settings", "danger", $ex->GetMessage(), true);
    }
    Redirect::To("settings.php#tab-fbAccounts");
}
// Delete facebook app
if (Input::get("action", "GET") == "deletefbapp" && Input::get("id", "GET")) {
    try {
        $fb->DeleteApp(Input::get("id", "GET"));
    } catch (Exception $ex) {
        Session::Flash("settings", "danger", $ex->GetMessage(), true);
    }
    Redirect::To("settings.php#tab-fbApps");
}
// Deauthorize
if (Input::get("action", "GET") == "deauthorize" && Input::get("id", "GET")) {
    try {
        $fb->DeauthorizeApp(Input::get("id", "GET"));
        Session::Flash("settings", "success", lang('APP_DEAUTH_SUCCESS'), true);
    } catch (Exception $ex) {
        echo $ex->GetMessage();
        Session::Flash("settings", "danger", $ex->GetMessage(), true);
    }
    Redirect::To("settings.php#tab-fbApps");
}
if (Input::get('save')) {
    $validate = new Validate();
    $validation = $validate->check($_POST, array('postInterval' => array('disp_text' => lang('POST_INTERVAL'), 'required' => true), 'language' => array('disp_text' => lang('LANGUAGE'), 'required' => true, 'inArray' => Language::GetAvailableLangs())));
    if (Input::Get("email") != $user->data()->email) {
        $validation = $validate->check($_POST, array('email' => array('disp_text' => lang('EMAIL'), 'required' => true, 'unique' => 'users', 'valid_email' => true)));
    }
    if (Input::Get("password")) {
        $validation = $validate->check($_POST, array('password' => array('disp_text' => lang('PASSWORD'), 'min' => '6', 'max' => '32'), 'repassword' => array('disp_text' => lang('RE_ENTER_PASSWORD'), 'required' => true, 'matches' => 'password')));
    }
    if ($validation->passed()) {
        try {
            $db = DB::GetInstance();
            $openGroupOnly = Input::Get("openGroupOnly") == "on" ? 1 : 0;
            $uniquePost = Input::Get("uniquePost") == "on" ? 1 : 0;
            $uniqueLink = Input::Get("uniqueLink") == "on" ? 1 : 0;
            $user->UpdateOptions(array('postInterval' => Input::Get("postInterval"), 'openGroupOnly' => $openGroupOnly, 'lang' => Input::Get("language"), 'uniquePost' => $uniquePost, 'uniqueLink' => $uniqueLink, 'timezone' => Input::Get("timezone")));
Example #3
0
 public function delete($id)
 {
     $user = new User();
     // Delete the facebook account is exists
     if ($this->exists($id)) {
         // Delete the account
         DB::GetInstance()->query("DELETE FROM fb_accounts WHERE fb_id = ? AND user_id = ? ", array($id, $user->data()->id));
         // Delete the account apps
         DB::GetInstance()->query("DELETE FROM user_fbapp WHERE fb_id = ? AND userid = ? ", array($id, $user->data()->id));
         // Remove the account from user options if it is the default account
         if ($this->UserDefaultFbAccount() == $id) {
             $user->UpdateOptions(array("default_Fb_Account" => ""));
         }
         return true;
     }
     throw new Exception(lang("FB_ACCOUNT_NOT_EXISTS"));
 }