public function processform() { if (isset($_POST["public_key_{$this->name}"])) { $this->public_key = $_POST["public_key_{$this->name}"]; } parent::processform(); }
protected function create() { parent::create(); $this->data['name'] = 'twitter'; $this->data['title'] = 'Twitter'; $this->data['icon'] = 'twitter.png'; $this->data['url'] = '/twitter-oauth1callback.php'; }
public function request($arg) { if ($err = parent::request($arg)) { return $err; } $code = $_REQUEST['code']; $resp = http::post('https://accounts.google.com/o/oauth2/token', array('code' => $code, 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'redirect_uri' => litepublisher::$site->url . $this->url, 'grant_type' => 'authorization_code')); if ($resp) { $tokens = json_decode($resp); if ($r = http::get('https://www.googleapis.com/oauth2/v1/userinfo?access_token=' . $tokens->access_token)) { $info = json_decode($r); return $this->adduser(array('service' => $this->name, 'email' => isset($info->email) ? $info->email : '', 'name' => $info->name, 'website' => isset($info->link) ? $info->link : ''), $info); } } return $this->errorauth(); }
public function request($arg) { if ($err = parent::request($arg)) { return $err; } $code = $_REQUEST['code']; $resp = http::post('https://oauth.yandex.ru/token', array('code' => $code, 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'grant_type' => 'authorization_code')); if ($resp) { $tokens = json_decode($resp); if ($r = http::get('https://login.yandex.ru/info?format=json&oauth_token=' . $tokens->access_token)) { $info = json_decode($r); return $this->adduser(array('service' => $this->name, 'uid' => $info->id, 'email' => isset($info->default_email) ? $info->default_email : $info->emails[0], 'name' => isset($info->real_name) ? $info->real_name : $info->display_name), $info); } } return $this->errorauth(); }
public function request($arg) { if ($err = parent::request($arg)) { return $err; } $code = $_REQUEST['code']; $resp = http::get('https://graph.facebook.com/oauth/access_token?' . http_build_query(array('code' => $code, 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'redirect_uri' => litepublisher::$site->url . $this->url))); if ($resp) { $params = null; parse_str($resp, $params); if ($r = http::get('https://graph.facebook.com/me?access_token=' . $params['access_token'])) { $info = json_decode($r); return $this->adduser(array('service' => $this->name, 'uid' => isset($info->id) ? $info->id : '', 'email' => isset($info->email) ? $info->email : '', 'name' => $info->name, 'website' => isset($info->link) ? $info->link : ''), $info); } } return $this->errorauth(); }
public function request($arg) { if ($err = parent::request($arg)) { return $err; } $code = $_REQUEST['code']; $resp = http::post('https://oauth.vk.com/access_token', array('code' => $code, 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'redirect_uri' => litepublisher::$site->url . $this->url)); if ($resp) { $tokens = json_decode($resp); if ($r = http::get('https://api.vk.com/method/getProfiles?uids=' . $tokens->user_id . '&access_token=' . $tokens->access_token)) { $js = json_decode($r); $info = $js->response[0]; return $this->adduser(array('service' => $this->name, 'uid' => $info->uid, 'name' => $info->first_name . ' ' . $info->last_name, 'website' => 'http://vk.com/id' . $info->uid), $info); } } return $this->errorauth(); }
public function request($arg) { if ($err = parent::request($arg)) { return $err; } $code = $_REQUEST['code']; $resp = http::post('https://connect.mail.ru/oauth/token', array('code' => $code, 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'redirect_uri' => litepublisher::$site->url . $this->url, 'grant_type' => 'authorization_code')); if ($resp) { $tokens = json_decode($resp); $params = array('method' => 'users.getInfo', 'app_id' => $this->client_id, 'session_key' => $tokens->access_token, 'uids' => $tokens->x_mailru_vid, 'secure' => '1', 'format' => 'json'); ksort($params); $params['sig'] = $this->sign($params, $this->client_secret); if ($r = http::get('http://www.appsmail.ru/platform/api?' . http_build_query($params))) { $js = json_decode($r); $info = $js[0]; return $this->adduser(array('uid' => $info->uid, 'email' => isset($info->email) ? $info->email : '', 'name' => $info->nick, 'website' => isset($info->link) ? $info->link : ''), $info); } } return $this->errorauth(); }