删除过期文件

This commit is contained in:
Martin Zhou
2016-01-24 12:21:54 +08:00
parent 1b1f4f1c21
commit 723a65923c
22 changed files with 0 additions and 1319 deletions

View File

@@ -1,27 +0,0 @@
<include file="Public/header" title="审核报告" />
<div id="page-wrapper">
<form method="post" action="{:U('post/send')}">
<div class="form-group">
<h4><strong>分发漏洞报告</strong></h4>
<h5>通过邮件快速转发漏洞报告给对应部门,帮助各部门协同响应安全事件</h5><hr/>
</div>
<div class="form-group">
<label>邮箱地址:</label>
<input type="text" name="email" class="form-control" style="width:50%" value="请输入邮箱地址" >
</label>
</div>
<div class="form-group">
<label>标题:</label>
<input type="text" name="title" class="form-control" style="width:50%" value="新的漏洞报告需要处理" >
</label>
</div>
<div class="form-group">
<label>附言:</label>
<input type="text" name="tips" class="form-control" style="width:50%;" value="您好!有一封新的漏洞报告需要您处理:[报告编号 {$post.id}]{$post.title}报告地址http://__ROOT__/admin.php??m=Admin&c=post&a=update&id={$post.id},请您登录应急响应中心后台跟进并及时更新漏洞状态!" >
</label>
</div>
<button type="submit" class="btn btn-default">提交</button>
</form>
</div>
<include file="Public/footer" />

View File

@@ -1,25 +0,0 @@
<?php
$SITE_URL = "******";
define('URL_CALLBACK', "" . $SITE_URL . "index.php/Login/callback?type=");
return array(
//腾讯QQ登录配置
'THINK_SDK_QQ' => 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',
)
);

View File

@@ -1,9 +0,0 @@
<?php
//使用微信API之前请务必将下面的配置信息改为你自己的
return array(
'WX_TOKEN'=>'******',
'WX_APPID'=>'******',
'WX_APPSECRET'=>'************************************',
'WX_ENCODINGAESKEY'=>'************************************',
'WX_DOMAIN'=>'************',
);

View File

@@ -1,76 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 杨维杰 <zuojiazi.cn@gmail.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------
// | 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');
}
}

View File

@@ -1,75 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi.cn@gmail.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------
// | 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');
}
}

View File

@@ -1,79 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi.cn@gmail.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------
// | 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');
}
}

View File

@@ -1,85 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi.cn@gmail.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------
// | 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');
}
}

View File

@@ -1,80 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi.cn@gmail.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------
// | 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');
}
}

View File

@@ -1,86 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi.cn@gmail.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------
// | 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');
}
}

View File

@@ -1,93 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi.cn@gmail.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------
// | 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');
}
}
}

View File

@@ -1,100 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi.cn@gmail.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------
// | 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');
}
}

View File

@@ -1,78 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi.cn@gmail.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------
// | 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');
}
}

View File

@@ -1,77 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi.cn@gmail.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------
// | 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');
}
}

View File

@@ -1,80 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi.cn@gmail.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------
// | 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');
}
}

View File

@@ -1,79 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi.cn@gmail.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------
// | 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');
}
}

View File

@@ -1,82 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi.cn@gmail.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------
// | 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');
}
}

View File

@@ -1,80 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | TOPThink [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://topthink.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi.cn@gmail.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------
// | 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');
}
}

View File

@@ -1,104 +0,0 @@
<?php
/**
* @author Zhou Yuyang <1009465756@qq.com> 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("已成功退出登陆");
}
}

View File

@@ -1 +0,0 @@
项目目录

View File

@@ -1 +0,0 @@

View File

@@ -1 +0,0 @@

View File

@@ -1 +0,0 @@
资源文件目录