function handle($args) { parent::handle($args); $secret = common_config('facebook', 'secret'); $sig = ''; ksort($_POST); foreach ($_POST as $key => $val) { if (substr($key, 0, 7) == 'fb_sig_') { $sig .= substr($key, 7) . '=' . $val; } } $sig .= $secret; $verify = md5($sig); if ($verify == $this->arg('fb_sig')) { $flink = Foreign_link::getByForeignID($this->arg('fb_sig_user'), 2); common_debug("Removing foreign link to Facebook - local user ID: {$flink->user_id}, Facebook ID: {$flink->foreign_id}"); $result = $flink->delete(); if (!$result) { common_log_db_error($flink, 'DELETE', __FILE__); $this->serverError(_('Couldn\'t remove Facebook user.')); return; } } else { # Someone bad tried to remove facebook link? common_log(LOG_ERR, "Someone from {$_SERVER['REMOTE_ADDR']} " . 'unsuccessfully tried to remove a foreign link to Facebook!'); } }
function handle($args) { parent::handle($args); $this->error = $error; if ($this->flink) { if (!$this->facebook->api_client->users_hasAppPermission('publish_stream') && $this->facebook->api_client->data_getUserPreference(FACEBOOK_PROMPTED_UPDATE_PREF) == 'true') { echo '<h1>REDIRECT TO HOME</h1>'; } } else { $this->showPage(); } }
function handle($args) { parent::handle($args); // If the user has opted not to initially allow the app to have // Facebook status update permission, store that preference. Only // promt the user the first time she uses the app if ($this->arg('skip') || $args['fb_sig_request_method'] == 'GET') { $this->facebook->api_client->data_setUserPreference(FACEBOOK_PROMPTED_UPDATE_PREF, 'true'); } if ($this->flink) { $this->user = $this->flink->getUser(); // If this is the first time the user has started the app // prompt for Facebook status update permission if (!$this->facebook->api_client->users_hasAppPermission('publish_stream')) { if ($this->facebook->api_client->data_getUserPreference(FACEBOOK_PROMPTED_UPDATE_PREF) != 'true') { $this->getUpdatePermission(); return; } } // Make sure the user's profile box has the lastest notice $notice = $this->user->getCurrentNotice(); if ($notice) { $this->updateProfileBox($notice); } if ($this->arg('status_submit') == 'Send') { $this->saveNewNotice(); } // User is authenticated and has already been prompted once for // Facebook status update permission? Then show the main page // of the app $this->showPage(); } else { // User hasn't authenticated yet, prompt for creds $this->login(); } }
function handle($args) { parent::handle($args); $this->showPage(); }
function handle($args) { parent::handle($args); $this->showForm(); }