<?php /** * @file * Sample client add script. * * Obviously not production-ready code, just simple and to the point. */ include "lib/PDOOAuth2.inc"; if ($_POST && isset($_POST["client_id"]) && isset($_POST["client_secret"]) && isset($_POST["redirect_uri"])) { $oauth = new PDOOAuth2(); $oauth->addClient($_POST["client_id"], $_POST["client_secret"], $_POST["redirect_uri"]); } ?> <!DOCTYPE html> <!-- saved from url=(0032)http://connect.qq.com/manage/reg --> <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="X-UA-Compatible" content="edge"> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <script async="" src="addclient/analytics.js"></script><script type="text/javascript"> var _speedMark = new Date(); </script> <meta name="robots" content="all"> <meta name="Description" content="QQ互联是腾讯旗下的开放平台,通过QQ互联,网站主或开发者可以申请接入QQ登录,获取登录用户基本资料,用户使用QQ账号登录接入的站点或应用app,通过分享功能,将站点内容分享到QQ、手机QQ、QQ空间、微博等平台,也可获取QQ会员信息、相册、日志、财付通等API授权"><meta name="Keywords" content="QQ互联、管理中心、腾讯互联、QQ登录、QQ登陆、QQ分享、开放平台、appid、API管理、信息编辑、数据统计"><title>管理中心--QQ互联</title> <link media="all" rel="stylesheet" href="addclient/common.css" type="text/css"> <!--[if lt IE 9]> <script type="text/javascript"> document.createElement("header");
public function applications() { JRequest::setVar('view', 'applications'); $mainframe = JFactory::getApplication(); $apps = new Applications(); // this is for auto installation method $redirectUri = JRequest::getVar('redirect_uri'); $clientId = JRequest::getVar('client_id'); $clientSecret = JRequest::getVar('client_secret'); $deviceId = JRequest::getVar('deviceId'); // if this is a request for grant/revoke if ($_POST && $deviceId) { switch (JRequest::getVar('deviceAction')) { case 'grant': $apps->grantAccess($deviceId); break; case 'revoke': $apps->revokeAccess($deviceId); break; } } else { if ($clientId && $clientSecret && $redirectUri) { header("Content-Type: application/json"); header("Cache-Control: no-store"); JRequest::setVar('installing', true); if ($_POST || JRequest::getVar('silent')) { $model = OauthFactory::getModel('Application'); // use library for the OAuth to standardize require_once JPATH_ROOT . DS . 'components' . DS . 'com_oauth' . DS . 'libraries' . DS . 'PDOOAuth2.inc'; $oauth = new PDOOAuth2(); if ($oauth->addClient($clientId, $clientSecret, $redirectUri)) { $authData = array('client_id' => $clientId, 'response_type' => 'code', 'redirect_uri' => $redirectUri); $oauth->finishClientAuthorization(true, $authData); /* if this is a silent request, give a silent feedback */ if (JRequest::getVar('silent')) { echo json_encode(array('success' => 'true')); exit; } JRequest::setVar('authorize', true); JRequest::setVar('appName', $clientId); $mainframe->enqueueMessage(JText::_('COM_OAUTH_LABEL_APPLICATION_INSTALL')); } else { if (JRequest::getVar('silent')) { echo json_encode(array('success' => false, 'error' => JText::_('COM_OAUTH_LABEL_FAILED_TO_REGISTER'))); exit; } $mainframe->enqueueMessage(JText::_('COM_OAUTH_LABEL_FAILED_TO_REGISTER'), 'Error'); } } } } parent::display(); }