diff --git a/Application/Admin/View/Post/send.html b/Application/Admin/View/Post/send.html deleted file mode 100644 index 2b0d315..0000000 --- a/Application/Admin/View/Post/send.html +++ /dev/null @@ -1,27 +0,0 @@ - -
-
-
-

分发漏洞报告

-
通过邮件快速转发漏洞报告给对应部门,帮助各部门协同响应安全事件

-
- -
- - - -
-
- - - -
-
- - - -
- -
-
- \ No newline at end of file diff --git a/Application/Common/Conf/oauth.php b/Application/Common/Conf/oauth.php deleted file mode 100644 index 6906b7e..0000000 --- a/Application/Common/Conf/oauth.php +++ /dev/null @@ -1,25 +0,0 @@ - array( - 'APP_KEY' => '******', //应用注册成功后分配的 APP ID - 'APP_SECRET' => '******', //应用注册成功后分配的KEY - 'CALLBACK' => URL_CALLBACK . 'qq', - ), - //新浪微博配置 - 'THINK_SDK_SINA' => array( - 'APP_KEY' => '******', //应用注册成功后分配的 APP ID - 'APP_SECRET' => '******', //应用注册成功后分配的KEY - 'CALLBACK' => URL_CALLBACK . 'sina', - ), - //人人网配置 - 'THINK_SDK_RENREN' => array( - 'APP_KEY' => '******', //应用注册成功后分配的 APP ID - 'APP_SECRET' => '******', //应用注册成功后分配的KEY - 'CALLBACK' => URL_CALLBACK . 'renren', - ) -); diff --git a/Application/Common/Conf/wechat.php b/Application/Common/Conf/wechat.php deleted file mode 100644 index 02116b9..0000000 --- a/Application/Common/Conf/wechat.php +++ /dev/null @@ -1,9 +0,0 @@ -'******', - 'WX_APPID'=>'******', - 'WX_APPSECRET'=>'************************************', - 'WX_ENCODINGAESKEY'=>'************************************', - 'WX_DOMAIN'=>'************', -); diff --git a/Application/Extend/Oauth/sdk/DiandianSDK.class.php b/Application/Extend/Oauth/sdk/DiandianSDK.class.php deleted file mode 100644 index f010685..0000000 --- a/Application/Extend/Oauth/sdk/DiandianSDK.class.php +++ /dev/null @@ -1,76 +0,0 @@ - -// +---------------------------------------------------------------------- -// | SinaSDK.class.php 2013-03-01 -// +---------------------------------------------------------------------- -use Extend\Oauth\ThinkOauth; - -class DiandianSDK extends ThinkOauth{ - /** - * 获取requestCode的api接口 - * @var string - */ - protected $GetRequestCodeURL = 'https://api.diandian.com/oauth/authorize'; - - /** - * 获取access_token的api接口 - * @var string - */ - protected $GetAccessTokenURL = 'https://api.diandian.com/oauth/token'; - - /** - * API根路径 - * @var string - */ - protected $ApiBase = 'https://api.diandian.com/v1/'; - - /** - * 组装接口调用参数 并调用接口 - * @param string $api 点点网API - * @param string $param 调用API的额外参数 - * @param string $method HTTP请求方法 默认为GET - * @return json - */ - public function call($api, $param = '', $method = 'GET', $multi = false){ - /* 点点网调用公共参数 */ - $params = array( - 'access_token' => $this->Token['access_token'], - ); - - $data = $this->http($this->url($api, '.json'), $this->param($params, $param), $method); - return json_decode($data, true); - } - - /** - * 解析access_token方法请求后的返回值 - * @param string $result 获取access_token的方法的返回值 - */ - protected function parseToken($result, $extend){ - $data = json_decode($result, true); - if($data['access_token'] && $data['expires_in'] && $data['token_type'] && $data['uid']){ - $data['openid'] = $data['uid']; - unset($data['uid']); - return $data; - } else - throw new Exception("获取点点网ACCESS_TOKEN出错:{$data['error']}"); - } - - /** - * 获取当前授权应用的openid - * @return string - */ - public function openid(){ - $data = $this->Token; - if(isset($data['openid'])) - return $data['openid']; - else - throw new Exception('没有获取到点点网用户ID!'); - } -} \ No newline at end of file diff --git a/Application/Extend/Oauth/sdk/DoubanSDK.class.php b/Application/Extend/Oauth/sdk/DoubanSDK.class.php deleted file mode 100644 index d85f6a5..0000000 --- a/Application/Extend/Oauth/sdk/DoubanSDK.class.php +++ /dev/null @@ -1,75 +0,0 @@ - -// +---------------------------------------------------------------------- -// | DoubanSDK.class.php 2013-02-25 -// +---------------------------------------------------------------------- -use Extend\Oauth\ThinkOauth; - -class DoubanSDK extends ThinkOauth{ - /** - * 获取requestCode的api接口 - * @var string - */ - protected $GetRequestCodeURL = 'https://www.douban.com/service/auth2/auth'; - - /** - * 获取access_token的api接口 - * @var string - */ - protected $GetAccessTokenURL = 'https://www.douban.com/service/auth2/token'; - - /** - * API根路径 - * @var string - */ - protected $ApiBase = 'https://api.douban.com/v2/'; - - /** - * 组装接口调用参数 并调用接口 - * @param string $api 微博API - * @param string $param 调用API的额外参数 - * @param string $method HTTP请求方法 默认为GET - * @return json - */ - public function call($api, $param = '', $method = 'GET', $multi = false){ - /* 豆瓣调用公共参数 */ - $params = array(); - $header = array("Authorization: Bearer {$this->Token['access_token']}"); - $data = $this->http($this->url($api), $this->param($params, $param), $method, $header); - return json_decode($data, true); - } - - /** - * 解析access_token方法请求后的返回值 - * @param string $result 获取access_token的方法的返回值 - */ - protected function parseToken($result, $extend){ - $data = json_decode($result, true); - if($data['access_token'] && $data['expires_in'] && $data['refresh_token'] && $data['douban_user_id']){ - $data['openid'] = $data['douban_user_id']; - unset($data['douban_user_id']); - return $data; - } else - throw new Exception("获取豆瓣ACCESS_TOKEN出错:{$data['msg']}"); - } - - /** - * 获取当前授权应用的openid - * @return string - */ - public function openid(){ - $data = $this->Token; - if(isset($data['douban_user_id'])) - return $data['douban_user_id']; - else - throw new Exception('没有获取到豆瓣用户ID!'); - } - -} \ No newline at end of file diff --git a/Application/Extend/Oauth/sdk/GithubSDK.class.php b/Application/Extend/Oauth/sdk/GithubSDK.class.php deleted file mode 100644 index 925f9fe..0000000 --- a/Application/Extend/Oauth/sdk/GithubSDK.class.php +++ /dev/null @@ -1,79 +0,0 @@ - -// +---------------------------------------------------------------------- -// | GithubSDK.class.php 2013-02-26 -// +---------------------------------------------------------------------- -use Extend\Oauth\ThinkOauth; - -class GithubSDK extends ThinkOauth{ - /** - * 获取requestCode的api接口 - * @var string - */ - protected $GetRequestCodeURL = 'https://github.com/login/oauth/authorize'; - - /** - * 获取access_token的api接口 - * @var string - */ - protected $GetAccessTokenURL = 'https://github.com/login/oauth/access_token'; - - /** - * API根路径 - * @var string - */ - protected $ApiBase = 'https://api.github.com/'; - - /** - * 组装接口调用参数 并调用接口 - * @param string $api 微博API - * @param string $param 调用API的额外参数 - * @param string $method HTTP请求方法 默认为GET - * @return json - */ - public function call($api, $param = '', $method = 'GET', $multi = false){ - /* Github 调用公共参数 */ - $params = array(); - $header = array("Authorization: bearer {$this->Token['access_token']}"); - - $data = $this->http($this->url($api), $this->param($params, $param), $method, $header); - return json_decode($data, true); - } - - /** - * 解析access_token方法请求后的返回值 - * @param string $result 获取access_token的方法的返回值 - */ - protected function parseToken($result, $extend){ - parse_str($result, $data); - if($data['access_token'] && $data['token_type']){ - $this->Token = $data; - $data['openid'] = $this->openid(); - return $data; - } else - throw new Exception("获取 Github ACCESS_TOKEN出错:未知错误"); - } - - /** - * 获取当前授权应用的openid - * @return string - */ - public function openid(){ - if(isset($this->Token['openid'])) - return $this->Token['openid']; - - $data = $this->call('user'); - if(!empty($data['id'])) - return $data['id']; - else - throw new Exception('没有获取到 Github 用户ID!'); - } - -} \ No newline at end of file diff --git a/Application/Extend/Oauth/sdk/GoogleSDK.class.php b/Application/Extend/Oauth/sdk/GoogleSDK.class.php deleted file mode 100644 index 5b46e32..0000000 --- a/Application/Extend/Oauth/sdk/GoogleSDK.class.php +++ /dev/null @@ -1,85 +0,0 @@ - -// +---------------------------------------------------------------------- -// | GoogleSDK.class.php 2013-02-26 -// +---------------------------------------------------------------------- -use Extend\Oauth\ThinkOauth; - -class GoogleSDK extends ThinkOauth{ - /** - * 获取requestCode的api接口 - * @var string - */ - protected $GetRequestCodeURL = 'https://accounts.google.com/o/oauth2/auth'; - - /** - * 获取access_token的api接口 - * @var string - */ - protected $GetAccessTokenURL = 'https://accounts.google.com/o/oauth2/token'; - - /** - * 获取request_code的额外参数 URL查询字符串格式 - * @var srting - */ - protected $Authorize = 'scope=https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email'; - - /** - * API根路径 - * @var string - */ - protected $ApiBase = 'https://www.googleapis.com/oauth2/v1/'; - - /** - * 组装接口调用参数 并调用接口 - * @param string $api 微博API - * @param string $param 调用API的额外参数 - * @param string $method HTTP请求方法 默认为GET - * @return json - */ - public function call($api, $param = '', $method = 'GET', $multi = false){ - /* Google 调用公共参数 */ - $params = array(); - $header = array("Authorization: Bearer {$this->Token['access_token']}"); - - $data = $this->http($this->url($api), $this->param($params, $param), $method, $header); - return json_decode($data, true); - } - - /** - * 解析access_token方法请求后的返回值 - * @param string $result 获取access_token的方法的返回值 - */ - protected function parseToken($result, $extend){ - $data = json_decode($result, true); - if($data['access_token'] && $data['token_type'] && $data['expires_in']){ - $this->Token = $data; - $data['openid'] = $this->openid(); - return $data; - } else - throw new Exception("获取 Google ACCESS_TOKEN出错:未知错误"); - } - - /** - * 获取当前授权应用的openid - * @return string - */ - public function openid(){ - if(isset($this->Token['openid'])) - return $this->Token['openid']; - - $data = $this->call('userinfo'); - if(!empty($data['id'])) - return $data['id']; - else - throw new Exception('没有获取到 Google 用户ID!'); - } - -} \ No newline at end of file diff --git a/Application/Extend/Oauth/sdk/KaixinSDK.class.php b/Application/Extend/Oauth/sdk/KaixinSDK.class.php deleted file mode 100644 index 8ef8e56..0000000 --- a/Application/Extend/Oauth/sdk/KaixinSDK.class.php +++ /dev/null @@ -1,80 +0,0 @@ - -// +---------------------------------------------------------------------- -// | KaixinSDK.class.php 2013-03-27 -// +---------------------------------------------------------------------- -use Extend\Oauth\ThinkOauth; - -class KaixinSDK extends ThinkOauth{ - /** - * 获取requestCode的api接口 - * @var string - */ - protected $GetRequestCodeURL = 'http://api.kaixin001.com/oauth2/authorize'; - - /** - * 获取access_token的api接口 - * @var string - */ - protected $GetAccessTokenURL = 'https://api.kaixin001.com/oauth2/access_token'; - - /** - * API根路径 - * @var string - */ - protected $ApiBase = 'https://api.kaixin001.com/'; - - /** - * 组装接口调用参数 并调用接口 - * @param string $api 开心网API - * @param string $param 调用API的额外参数 - * @param string $method HTTP请求方法 默认为GET - * @return json - */ - public function call($api, $param = '', $method = 'GET', $multi = false){ - /* 开心网调用公共参数 */ - $params = array( - 'access_token' => $this->Token['access_token'], - ); - - $data = $this->http($this->url($api, '.json'), $this->param($params, $param), $method); - return json_decode($data, true); - } - - /** - * 解析access_token方法请求后的返回值 - * @param string $result 获取access_token的方法的返回值 - */ - protected function parseToken($result, $extend){ - $data = json_decode($result, true); - if($data['access_token'] && $data['expires_in'] && $data['refresh_token']){ - $this->Token = $data; - $data['openid'] = $this->openid(); - return $data; - } else - throw new Exception("获取开心网ACCESS_TOKEN出错:{$data['error']}"); - } - - /** - * 获取当前授权应用的openid - * @return string - */ - public function openid(){ - if(isset($this->Token['openid'])) - return $this->Token['openid']; - - $data = $this->call('users/me'); - if(!empty($data['uid'])) - return $data['uid']; - else - throw new Exception('没有获取到开心网用户ID!'); - } - -} \ No newline at end of file diff --git a/Application/Extend/Oauth/sdk/MsnSDK.class.php b/Application/Extend/Oauth/sdk/MsnSDK.class.php deleted file mode 100644 index 882b211..0000000 --- a/Application/Extend/Oauth/sdk/MsnSDK.class.php +++ /dev/null @@ -1,86 +0,0 @@ - -// +---------------------------------------------------------------------- -// | MsnSDK.class.php 2013-02-27 -// +---------------------------------------------------------------------- -use Extend\Oauth\ThinkOauth; - -class MsnSDK extends ThinkOauth{ - /** - * 获取requestCode的api接口 - * @var string - */ - protected $GetRequestCodeURL = 'https://login.live.com/oauth20_authorize.srf'; - - /** - * 获取access_token的api接口 - * @var string - */ - protected $GetAccessTokenURL = 'https://login.live.com/oauth20_token.srf'; - - /** - * 获取request_code的额外参数 URL查询字符串格式 - * @var srting - */ - protected $Authorize = 'scope=wl.basic wl.offline_access wl.signin wl.emails wl.photos'; - - /** - * API根路径 - * @var string - */ - protected $ApiBase = 'https://apis.live.net/v5.0/'; - - /** - * 组装接口调用参数 并调用接口 - * @param string $api 微博API - * @param string $param 调用API的额外参数 - * @param string $method HTTP请求方法 默认为GET - * @return json - */ - public function call($api, $param = '', $method = 'GET', $multi = false){ - /* MSN 调用公共参数 */ - $params = array( - 'access_token' => $this->Token['access_token'], - ); - - $data = $this->http($this->url($api), $this->param($params, $param), $method); - return json_decode($data, true); - } - - /** - * 解析access_token方法请求后的返回值 - * @param string $result 获取access_token的方法的返回值 - */ - protected function parseToken($result, $extend){ - $data = json_decode($result, true); - if($data['access_token'] && $data['token_type'] && $data['expires_in']){ - $this->Token = $data; - $data['openid'] = $this->openid(); - return $data; - } else - throw new Exception("获取 MSN ACCESS_TOKEN出错:未知错误"); - } - - /** - * 获取当前授权应用的openid - * @return string - */ - public function openid(){ - if(isset($this->Token['openid'])) - return $this->Token['openid']; - - $data = $this->call('me'); - if(!empty($data['id'])) - return $data['id']; - else - throw new Exception('没有获取到 MSN 用户ID!'); - } - -} \ No newline at end of file diff --git a/Application/Extend/Oauth/sdk/QqSDK.class.php b/Application/Extend/Oauth/sdk/QqSDK.class.php deleted file mode 100644 index df1d9f1..0000000 --- a/Application/Extend/Oauth/sdk/QqSDK.class.php +++ /dev/null @@ -1,93 +0,0 @@ - -// +---------------------------------------------------------------------- -// | QqSDK.class.php 2013-02-25 -// +---------------------------------------------------------------------- -use Extend\Oauth\ThinkOauth; - -class QqSDK extends ThinkOauth{ - /** - * 获取requestCode的api接口 - * @var string - */ - protected $GetRequestCodeURL = 'https://graph.qq.com/oauth2.0/authorize'; - - /** - * 获取access_token的api接口 - * @var string - */ - protected $GetAccessTokenURL = 'https://graph.qq.com/oauth2.0/token'; - - /** - * 获取request_code的额外参数,可在配置中修改 URL查询字符串格式 - * @var srting - */ - protected $Authorize = 'scope=get_user_info,add_share'; - - /** - * API根路径 - * @var string - */ - protected $ApiBase = 'https://graph.qq.com/'; - - /** - * 组装接口调用参数 并调用接口 - * @param string $api 微博API - * @param string $param 调用API的额外参数 - * @param string $method HTTP请求方法 默认为GET - * @return json - */ - public function call($api, $param = '', $method = 'GET', $multi = false){ - /* 腾讯QQ调用公共参数 */ - $params = array( - 'oauth_consumer_key' => $this->AppKey, - 'access_token' => $this->Token['access_token'], - 'openid' => $this->openid(), - 'format' => 'json' - ); - - $data = $this->http($this->url($api), $this->param($params, $param), $method); - return json_decode($data, true); - } - - /** - * 解析access_token方法请求后的返回值 - * @param string $result 获取access_token的方法的返回值 - */ - protected function parseToken($result, $extend){ - parse_str($result, $data); - if($data['access_token'] && $data['expires_in']){ - $this->Token = $data; - $data['openid'] = $this->openid(); - return $data; - } else - throw new Exception("获取腾讯QQ ACCESS_TOKEN 出错:{$result}"); - } - - /** - * 获取当前授权应用的openid - * @return string - */ - public function openid(){ - $data = $this->Token; - if(isset($data['openid'])) - return $data['openid']; - elseif($data['access_token']){ - $data = $this->http($this->url('oauth2.0/me'), array('access_token' => $data['access_token'])); - $data = json_decode(trim(substr($data, 9), " );\n"), true); - if(isset($data['openid'])) - return $data['openid']; - else - throw new Exception("获取用户openid出错:{$data['error_description']}"); - } else { - throw new Exception('没有获取到openid!'); - } - } -} \ No newline at end of file diff --git a/Application/Extend/Oauth/sdk/RenrenSDK.class.php b/Application/Extend/Oauth/sdk/RenrenSDK.class.php deleted file mode 100644 index 66c551d..0000000 --- a/Application/Extend/Oauth/sdk/RenrenSDK.class.php +++ /dev/null @@ -1,100 +0,0 @@ - -// +---------------------------------------------------------------------- -// | RenrenSDK.class.php 2013-02-25 -// +---------------------------------------------------------------------- -use Extend\Oauth\ThinkOauth; - -class RenrenSDK extends ThinkOauth{ - /** - * 获取requestCode的api接口 - * @var string - */ - protected $GetRequestCodeURL = 'https://graph.renren.com/oauth/authorize'; - - /** - * 获取access_token的api接口 - * @var string - */ - protected $GetAccessTokenURL = 'https://graph.renren.com/oauth/token'; - - /** - * API根路径 - * @var string - */ - protected $ApiBase = 'http://api.renren.com/restserver.do'; - - /** - * 组装接口调用参数 并调用接口 - * @param string $api 微博API - * @param string $param 调用API的额外参数 - * @param string $method HTTP请求方法 默认为GET - * @return json - */ - public function call($api, $param = '', $method = 'POST', $multi = false){ - /* 人人网调用公共参数 */ - $params = array( - 'method' => $api, - 'access_token' => $this->Token['access_token'], - 'v' => '1.0', - 'format' => 'json', - ); - - $data = $this->http($this->url(''), $this->param($params, $param), $method); - return json_decode($data, true); - } - - /** - * 合并默认参数和额外参数 - * @param array $params 默认参数 - * @param array/string $param 额外参数 - * @return array: - */ - protected function param($params, $param){ - $params = parent::param($params, $param); - - /* 签名 */ - ksort($params); - $param = array(); - foreach ($params as $key => $value){ - $param[] = "{$key}={$value}"; - } - $sign = implode('', $param).$this->AppSecret; - $params['sig'] = md5($sign); - - return $params; - } - - /** - * 解析access_token方法请求后的返回值 - * @param string $result 获取access_token的方法的返回值 - */ - protected function parseToken($result, $extend){ - $data = json_decode($result, true); - if($data['access_token'] && $data['expires_in'] && $data['refresh_token'] && $data['user']['id']){ - $data['openid'] = $data['user']['id']; - unset($data['user']); - return $data; - } else - throw new Exception("获取人人网ACCESS_TOKEN出错:{$data['error_description']}"); - } - - /** - * 获取当前授权应用的openid - * @return string - */ - public function openid(){ - $data = $this->Token; - if(!empty($data['openid'])) - return $data['openid']; - else - throw new Exception('没有获取到人人网用户ID!'); - } -} \ No newline at end of file diff --git a/Application/Extend/Oauth/sdk/SinaSDK.class.php b/Application/Extend/Oauth/sdk/SinaSDK.class.php deleted file mode 100644 index dc807e8..0000000 --- a/Application/Extend/Oauth/sdk/SinaSDK.class.php +++ /dev/null @@ -1,78 +0,0 @@ - -// +---------------------------------------------------------------------- -// | SinaSDK.class.php 2013-02-25 -// +---------------------------------------------------------------------- -use Extend\Oauth\ThinkOauth; - -class SinaSDK extends ThinkOauth{ - /** - * 获取requestCode的api接口 - * @var string - */ - protected $GetRequestCodeURL = 'https://api.weibo.com/oauth2/authorize'; - - /** - * 获取access_token的api接口 - * @var string - */ - protected $GetAccessTokenURL = 'https://api.weibo.com/oauth2/access_token'; - - /** - * API根路径 - * @var string - */ - protected $ApiBase = 'https://api.weibo.com/2/'; - - /** - * 组装接口调用参数 并调用接口 - * @param string $api 微博API - * @param string $param 调用API的额外参数 - * @param string $method HTTP请求方法 默认为GET - * @return json - */ - public function call($api, $param = '', $method = 'GET', $multi = false){ - /* 新浪微博调用公共参数 */ - $params = array( - 'access_token' => $this->Token['access_token'], - ); - - $vars = $this->param($params, $param); - $data = $this->http($this->url($api, '.json'), $vars, $method, array(), $multi); - return json_decode($data, true); - } - - /** - * 解析access_token方法请求后的返回值 - * @param string $result 获取access_token的方法的返回值 - */ - protected function parseToken($result, $extend){ - $data = json_decode($result, true); - if($data['access_token'] && $data['expires_in'] && $data['remind_in'] && $data['uid']){ - $data['openid'] = $data['uid']; - unset($data['uid']); - return $data; - } else - throw new Exception("获取新浪微博ACCESS_TOKEN出错:{$data['error']}"); - } - - /** - * 获取当前授权应用的openid - * @return string - */ - public function openid(){ - $data = $this->Token; - if(isset($data['openid'])) - return $data['openid']; - else - throw new Exception('没有获取到新浪微博用户ID!'); - } - -} \ No newline at end of file diff --git a/Application/Extend/Oauth/sdk/SohuSDK.class.php b/Application/Extend/Oauth/sdk/SohuSDK.class.php deleted file mode 100644 index fa41651..0000000 --- a/Application/Extend/Oauth/sdk/SohuSDK.class.php +++ /dev/null @@ -1,77 +0,0 @@ - -// +---------------------------------------------------------------------- -// | SohuSDK.class.php 2013-03-27 -// +---------------------------------------------------------------------- -use Extend\Oauth\ThinkOauth; - -class SohuSDK extends ThinkOauth{ - /** - * 获取requestCode的api接口 - * @var string - */ - protected $GetRequestCodeURL = 'https://api.sohu.com/oauth2/authorize'; - - /** - * 获取access_token的api接口 - * @var string - */ - protected $GetAccessTokenURL = 'https://api.sohu.com/oauth2/token'; - - /** - * API根路径 - * @var string - */ - protected $ApiBase = 'https://api.sohu.com/rest/'; - - /** - * 组装接口调用参数 并调用接口 - * @param string $api 搜狐API - * @param string $param 调用API的额外参数 - * @param string $method HTTP请求方法 默认为GET - * @return json - */ - public function call($api, $param = '', $method = 'GET', $multi = false){ - /* 搜狐调用公共参数 */ - $params = array( - 'access_token' => $this->Token['access_token'], - ); - - $data = $this->http($this->url($api), $this->param($params, $param), $method); - return json_decode($data, true); - } - - /** - * 解析access_token方法请求后的返回值 - * @param string $result 获取access_token的方法的返回值 - */ - protected function parseToken($result, $extend){ - $data = json_decode($result, true); - if($data['access_token'] && $data['expires_in'] && $data['refresh_token'] && $data['open_id']){ - $data['openid'] = $data['open_id']; - unset($data['open_id']); - return $data; - } else - throw new Exception("获取搜狐ACCESS_TOKEN出错:{$data['error']}"); - } - - /** - * 获取当前授权应用的openid - * @return string - */ - public function openid(){ - $data = $this->Token; - if(isset($data['openid'])) - return $data['openid']; - else - throw new Exception('没有获取到搜狐用户ID!'); - } - -} \ No newline at end of file diff --git a/Application/Extend/Oauth/sdk/T163SDK.class.php b/Application/Extend/Oauth/sdk/T163SDK.class.php deleted file mode 100644 index 45a155f..0000000 --- a/Application/Extend/Oauth/sdk/T163SDK.class.php +++ /dev/null @@ -1,80 +0,0 @@ - -// +---------------------------------------------------------------------- -// | T163SDK.class.php 2013-02-25 -// +---------------------------------------------------------------------- -use Extend\Oauth\ThinkOauth; - -class T163SDK extends ThinkOauth{ - /** - * 获取requestCode的api接口 - * @var string - */ - protected $GetRequestCodeURL = 'https://api.t.163.com/oauth2/authorize'; - - /** - * 获取access_token的api接口 - * @var string - */ - protected $GetAccessTokenURL = 'https://api.t.163.com/oauth2/access_token'; - - /** - * API根路径 - * @var string - */ - protected $ApiBase = 'https://api.t.163.com/'; - - /** - * 组装接口调用参数 并调用接口 - * @param string $api 微博API - * @param string $param 调用API的额外参数 - * @param string $method HTTP请求方法 默认为GET - * @return json - */ - public function call($api, $param = '', $method = 'GET', $multi = false){ - /* 新浪微博调用公共参数 */ - $params = array( - 'oauth_token' => $this->Token['access_token'], - ); - - $data = $this->http($this->url($api, '.json'), $this->param($params, $param), $method); - return json_decode($data, true); - } - - /** - * 解析access_token方法请求后的返回值 - * @param string $result 获取access_token的方法的返回值 - */ - protected function parseToken($result, $extend){ - $data = json_decode($result, true); - if($data['uid'] && $data['access_token'] && $data['expires_in'] && $data['refresh_token']){ - $data['openid'] = $data['uid']; - unset($data['uid']); - return $data; - } else - throw new Exception("获取网易微博ACCESS_TOKEN出错:{$data['error']}"); - } - - /** - * 获取当前授权应用的openid - * @return string - */ - public function openid(){ - if(isset($this->Token['openid'])) - return $this->Token['openid']; - - $data = $this->call('users/show'); - if(!empty($data['id'])) - return $data['id']; - else - throw new Exception('没有获取到网易微博用户ID!'); - } - -} \ No newline at end of file diff --git a/Application/Extend/Oauth/sdk/TaobaoSDK.class.php b/Application/Extend/Oauth/sdk/TaobaoSDK.class.php deleted file mode 100644 index f33c9e6..0000000 --- a/Application/Extend/Oauth/sdk/TaobaoSDK.class.php +++ /dev/null @@ -1,79 +0,0 @@ - -// +---------------------------------------------------------------------- -// | TaobaoSDK.class.php 2013-03-13 -// +---------------------------------------------------------------------- -use Extend\Oauth\ThinkOauth; - -class TaobaoSDK extends ThinkOauth{ - /** - * 获取requestCode的api接口 - * @var string - */ - protected $GetRequestCodeURL = 'https://oauth.taobao.com/authorize'; - - /** - * 获取access_token的api接口 - * @var string - */ - protected $GetAccessTokenURL = 'https://oauth.taobao.com/token'; - - /** - * API根路径 - * @var string - */ - protected $ApiBase = 'https://eco.taobao.com/router/rest'; - - /** - * 组装接口调用参数 并调用接口 - * @param string $api 微博API - * @param string $param 调用API的额外参数 - * @param string $method HTTP请求方法 默认为GET - * @return json - */ - public function call($api, $param = '', $method = 'GET', $multi = false){ - /* 淘宝网调用公共参数 */ - $params = array( - 'method' => $api, - 'access_token' => $this->Token['access_token'], - 'format' => 'json', - 'v' => '2.0', - ); - $data = $this->http($this->url(''), $this->param($params, $param), $method); - return json_decode($data, true); - } - - /** - * 解析access_token方法请求后的返回值 - * @param string $result 获取access_token的方法的返回值 - */ - protected function parseToken($result, $extend){ - $data = json_decode($result, true); - if($data['access_token'] && $data['expires_in'] && $data['taobao_user_id']){ - $data['openid'] = $data['taobao_user_id']; - unset($data['taobao_user_id']); - return $data; - } else - throw new Exception("获取淘宝网ACCESS_TOKEN出错:{$data['error']}"); - } - - /** - * 获取当前授权应用的openid - * @return string - */ - public function openid(){ - $data = $this->Token; - if(isset($data['openid'])) - return $data['openid']; - else - throw new Exception('没有获取到淘宝网用户ID!'); - } - -} \ No newline at end of file diff --git a/Application/Extend/Oauth/sdk/TencentSDK.class.php b/Application/Extend/Oauth/sdk/TencentSDK.class.php deleted file mode 100644 index 592fe62..0000000 --- a/Application/Extend/Oauth/sdk/TencentSDK.class.php +++ /dev/null @@ -1,82 +0,0 @@ - -// +---------------------------------------------------------------------- -// | TencentSDK.class.php 2013-02-25 -// +---------------------------------------------------------------------- -use Extend\Oauth\ThinkOauth; - -class TencentSDK extends ThinkOauth{ - /** - * 获取requestCode的api接口 - * @var string - */ - protected $GetRequestCodeURL = 'https://open.t.qq.com/cgi-bin/oauth2/authorize'; - - /** - * 获取access_token的api接口 - * @var string - */ - protected $GetAccessTokenURL = 'https://open.t.qq.com/cgi-bin/oauth2/access_token'; - - /** - * API根路径 - * @var string - */ - protected $ApiBase = 'https://open.t.qq.com/api/'; - - /** - * 组装接口调用参数 并调用接口 - * @param string $api 微博API - * @param string $param 调用API的额外参数 - * @param string $method HTTP请求方法 默认为GET - * @return json - */ - public function call($api, $param = '', $method = 'GET', $multi = false){ - /* 腾讯微博调用公共参数 */ - $params = array( - 'oauth_consumer_key' => $this->AppKey, - 'access_token' => $this->Token['access_token'], - 'openid' => $this->openid(), - 'clientip' => get_client_ip(), - 'oauth_version' => '2.a', - 'scope' => 'all', - 'format' => 'json' - ); - - $vars = $this->param($params, $param); - $data = $this->http($this->url($api), $vars, $method, array(), $multi); - return json_decode($data, true); - } - - /** - * 解析access_token方法请求后的返回值 - * @param string $result 获取access_token的方法的返回值 - */ - protected function parseToken($result, $extend){ - parse_str($result, $data); - $data = array_merge($data, $extend); - if($data['access_token'] && $data['expires_in'] && $data['openid']) - return $data; - else - throw new Exception("获取腾讯微博 ACCESS_TOKEN 出错:{$result}"); - } - - /** - * 获取当前授权应用的openid - * @return string - */ - public function openid(){ - $data = $this->Token; - if(isset($data['openid'])) - return $data['openid']; - else - throw new Exception('没有获取到openid!'); - } -} \ No newline at end of file diff --git a/Application/Extend/Oauth/sdk/X360SDK.class.php b/Application/Extend/Oauth/sdk/X360SDK.class.php deleted file mode 100644 index e2e1b29..0000000 --- a/Application/Extend/Oauth/sdk/X360SDK.class.php +++ /dev/null @@ -1,80 +0,0 @@ - -// +---------------------------------------------------------------------- -// | X360SDK.class.php 2013-02-25 -// +---------------------------------------------------------------------- -use Extend\Oauth\ThinkOauth; - -class X360SDK extends ThinkOauth{ - /** - * 获取requestCode的api接口 - * @var string - */ - protected $GetRequestCodeURL = 'https://openapi.360.cn/oauth2/authorize'; - - /** - * 获取access_token的api接口 - * @var string - */ - protected $GetAccessTokenURL = 'https://openapi.360.cn/oauth2/access_token'; - - /** - * API根路径 - * @var string - */ - protected $ApiBase = 'https://openapi.360.cn/'; - - /** - * 组装接口调用参数 并调用接口 - * @param string $api 360开放平台API - * @param string $param 调用API的额外参数 - * @param string $method HTTP请求方法 默认为GET - * @return json - */ - public function call($api, $param = '', $method = 'GET', $multi = false){ - /* 360开放平台调用公共参数 */ - $params = array( - 'access_token' => $this->Token['access_token'], - ); - - $data = $this->http($this->url($api, '.json'), $this->param($params, $param), $method); - return json_decode($data, true); - } - - /** - * 解析access_token方法请求后的返回值 - * @param string $result 获取access_token的方法的返回值 - */ - protected function parseToken($result, $extend){ - $data = json_decode($result, true); - if($data['access_token'] && $data['expires_in'] && $data['refresh_token']){ - $this->Token = $data; - $data['openid'] = $this->openid(); - return $data; - } else - throw new Exception("获取360开放平台ACCESS_TOKEN出错:{$data['error']}"); - } - - /** - * 获取当前授权应用的openid - * @return string - */ - public function openid(){ - if(isset($this->Token['openid'])) - return $this->Token['openid']; - - $data = $this->call('user/me'); - if(!empty($data['id'])) - return $data['id']; - else - throw new Exception('没有获取到360开放平台用户ID!'); - } - -} \ No newline at end of file diff --git a/Application/Home/Controller/LoginController.class.php b/Application/Home/Controller/LoginController.class.php deleted file mode 100644 index bba226b..0000000 --- a/Application/Home/Controller/LoginController.class.php +++ /dev/null @@ -1,104 +0,0 @@ - 2015-07-27 - * @copyright ©2105-2018 SRCMS - * @homepage http://www.src.pw - * @version 1.0 - */ - -namespace Home\Controller; - -use Think\Controller; -use Extend\Oauth\ThinkOauth; -/** - * 用户本地登陆和第三方登陆 - */ -class LoginController extends Controller{ - - public function index() - { - - - } - - public function login($type=null) - { - //本地账号登陆 - if(empty($type)){ - if(!IS_POST){ - $this->display(); - } - if(IS_POST){ - //验证码自己开启。代码省略 - $data['username'] = I('post.username'); - $data['password'] = I('post.password','','md5'); - $member = M('member')->where($data)->find(); - if($member){ - session('userid',$member['id']); - session('username',$member['username']); - $this->success("登陆成功"); - }else{ - $this->error("账号或密码错误"); - } - } - return; - } - //第三方登陆 这里最好先验证一下$type - //验证允许实用的登陆方式,可在后台用代码实现 - - $can_use = in_array(strtolower($type), array('qq','sina','github')); - if(!$can_use){ - $this->error("不允许使用此方式登陆"); - } - //验证通过 使用第三方登陆 - if($type != null){ - $sns = ThinkOauth::getInstance($type); - redirect($sns->getRequestCodeURL()); - } - - } - - public function callback($type = null, $code = null) - { - - if(empty($type) || empty($code)){ - $this->error('参数错误'); - } - - $sns = ThinkOauth::getInstance($type); - - //腾讯微博需传递的额外参数 - $extend = null; - if ($type == 'tencent') { - $extend = array('openid' => $this->_get('openid'), 'openkey' => $this->_get('openkey')); - } - $tokenArray = $sns->getAccessToken($code, $extend); - $openid = $tokenArray['openid']; - //$token = $tokenArray['access_token']; //根据需求储存 主要用来刷新并延长授权时间 - //dd($tokenArray); - // - //执行后续操作,代码自己实现。 - //请记住每个用户的openid都是唯一的,所以把openid存到数据库即可 - $member = D('MemberView'); - //根据openid判断用户是否存在,如果存在 ,判断用户是否被禁用。如果不存在,把openid存到数据库,相当于注册用户 - - # - # - # 代码自己实现 - # - # - # - - - } - - - public function logout() - { - session('userid',null); - session('username',null); - $this->success("已成功退出登陆"); - - } -} diff --git a/Application/README.md b/Application/README.md deleted file mode 100644 index 5bc1d44..0000000 --- a/Application/README.md +++ /dev/null @@ -1 +0,0 @@ -项目目录 \ No newline at end of file diff --git a/Application/User/index.html b/Application/User/index.html deleted file mode 100644 index 0519ecb..0000000 --- a/Application/User/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/Application/index.html b/Application/index.html deleted file mode 100644 index 0519ecb..0000000 --- a/Application/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/Public/README.md b/Public/README.md deleted file mode 100644 index 40f011a..0000000 --- a/Public/README.md +++ /dev/null @@ -1 +0,0 @@ -资源文件目录 \ No newline at end of file