- del_pconfig(local_user(), 'twitter', 'consumerkey');
- del_pconfig(local_user(), 'twitter', 'consumersecret');
- del_pconfig(local_user(), 'twitter', 'oauthtoken');
- del_pconfig(local_user(), 'twitter', 'oauthsecret');
- del_pconfig(local_user(), 'twitter', 'post');
- del_pconfig(local_user(), 'twitter', 'post_by_default');
- del_pconfig(local_user(), 'twitter', 'lastid');
- del_pconfig(local_user(), 'twitter', 'mirror_posts');
- del_pconfig(local_user(), 'twitter', 'import');
- del_pconfig(local_user(), 'twitter', 'create_user');
- del_pconfig(local_user(), 'twitter', 'own_id');
- } else {
- if (isset($_POST['twitter-pin'])) {
- // if the user supplied us with a PIN from Twitter, let the magic of OAuth happen
- logger('got a Twitter PIN');
- require_once('library/twitteroauth.php');
- $ckey = get_config('twitter', 'consumerkey');
- $csecret = get_config('twitter', 'consumersecret');
- // the token and secret for which the PIN was generated were hidden in the settings
- // form as token and token2, we need a new connection to Twitter using these token
- // and secret to request a Access Token with the PIN
- $connection = new TwitterOAuth($ckey, $csecret, $_POST['twitter-token'], $_POST['twitter-token2']);
- $token = $connection->getAccessToken( $_POST['twitter-pin'] );
- // ok, now that we have the Access Token, save them in the user config
- set_pconfig(local_user(),'twitter', 'oauthtoken', $token['oauth_token']);
- set_pconfig(local_user(),'twitter', 'oauthsecret', $token['oauth_token_secret']);
- set_pconfig(local_user(),'twitter', 'post', 1);
- // reload the Addon Settings page, if we don't do it see Bug #42
- goaway($a->get_baseurl().'/settings/connectors');
+ PConfig::delete(local_user(), 'twitter', 'consumerkey');
+ PConfig::delete(local_user(), 'twitter', 'consumersecret');
+ PConfig::delete(local_user(), 'twitter', 'oauthtoken');
+ PConfig::delete(local_user(), 'twitter', 'oauthsecret');
+ PConfig::delete(local_user(), 'twitter', 'post');
+ PConfig::delete(local_user(), 'twitter', 'post_by_default');
+ PConfig::delete(local_user(), 'twitter', 'lastid');
+ PConfig::delete(local_user(), 'twitter', 'mirror_posts');
+ PConfig::delete(local_user(), 'twitter', 'import');
+ PConfig::delete(local_user(), 'twitter', 'create_user');
+ PConfig::delete(local_user(), 'twitter', 'own_id');