From ab4534af37aa1e6eedd691fa2f3d9648b155c353 Mon Sep 17 00:00:00 2001 From: oott123 Date: Mon, 22 Jul 2013 12:25:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=8C=E9=98=B2=E6=AD=A2?= =?UTF-8?q?=E8=87=AA=E6=9D=80=E8=A1=8C=E4=B8=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bpcs_uploader.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bpcs_uploader.php b/bpcs_uploader.php index 8f70c9c..1bce4e5 100644 --- a/bpcs_uploader.php +++ b/bpcs_uploader.php @@ -9,7 +9,7 @@ die('this script can\'t run from the broswer.'); } //设置项目 - define('FILES_DIR',dirname(__FIle__).'/_bpcs_files_'); //设置目录,尾部不需要/ + define('FILES_DIR',dirname(__FILE__).'/_bpcs_files_'); //设置目录,尾部不需要/ define('CONFIG_DIR',FILES_DIR.'/config'); //配置目录 //函数文件 include(FILES_DIR.'/common.inc.php'); @@ -41,10 +41,13 @@ if($refresh_token){ //若存在refresh token,则刷新它。 $token_array=do_oauth_refresh(file_get_contents(CONFIG_DIR.'/appkey') , file_get_contents(CONFIG_DIR.'/appsec') , file_get_contents(CONFIG_DIR.'/refresh_token')); - $access_token = $token_array['access_token']; - $refresh_token = $token_array['refresh_token']; - file_put_contents(CONFIG_DIR.'/access_token',$access_token); - file_put_contents(CONFIG_DIR.'/refresh_token',$refresh_token); + if($token_array['access_token'] && $token_array['refresh_token']){ + //防止获取不到token而自杀的行为 + $access_token = $token_array['access_token']; + $refresh_token = $token_array['refresh_token']; + file_put_contents(CONFIG_DIR.'/access_token',$access_token); + file_put_contents(CONFIG_DIR.'/refresh_token',$refresh_token); + } } switch($argv[1]){