From 1c3e19f1af452937f14f5ece3b1ca1257adc4a07 Mon Sep 17 00:00:00 2001 From: cyc Date: Wed, 8 Jan 2020 16:48:43 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E7=BD=B2=E9=92=89=E9=92=89=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dingdingcallback/api/Activate.php | 60 + dingdingcallback/api/Auth.php | 107 ++ dingdingcallback/api/Chat.php | 38 + dingdingcallback/api/Department.php | 28 + dingdingcallback/api/ISVClass.php | 48 + dingdingcallback/api/ISVService.php | 216 +++ dingdingcallback/api/Message.php | 18 + dingdingcallback/api/User.php | 18 + dingdingcallback/composer.json | 5 + dingdingcallback/composer.lock | 68 + dingdingcallback/config.php | 11 + dingdingcallback/crypto/DingtalkCrypt.php | 90 ++ dingdingcallback/crypto/errorCode.php | 26 + dingdingcallback/crypto/pkcs7Encoder.php | 129 ++ dingdingcallback/crypto/sha1.php | 23 + dingdingcallback/filecache.php | 1 + dingdingcallback/getPerson.php | 16 + dingdingcallback/index.php | 24 + dingdingcallback/indexpc.php | 22 + dingdingcallback/isv.log | 60 + dingdingcallback/public/javascripts/demo.js | 169 +++ dingdingcallback/public/javascripts/demopc.js | 135 ++ dingdingcallback/public/javascripts/logger.js | 24 + .../public/javascripts/zepto.min.js | 1 + dingdingcallback/public/stylesheets/style.css | 41 + dingdingcallback/receive.php | 184 +++ dingdingcallback/sendMsg.php | 40 + dingdingcallback/util/Cache.php | 231 ++++ dingdingcallback/util/Http.php | 61 + dingdingcallback/util/Log.php | 22 + dingdingcallback/vendor/autoload.php | 7 + .../vendor/composer/ClassLoader.php | 413 ++++++ .../vendor/composer/autoload_classmap.php | 9 + .../vendor/composer/autoload_namespaces.php | 10 + .../vendor/composer/autoload_psr4.php | 9 + .../vendor/composer/autoload_real.php | 50 + .../vendor/composer/installed.json | 54 + .../vendor/nategood/httpful/.gitignore | 5 + .../vendor/nategood/httpful/.travis.yml | 7 + .../vendor/nategood/httpful/LICENSE.txt | 7 + .../vendor/nategood/httpful/README.md | 215 +++ .../vendor/nategood/httpful/bootstrap.php | 4 + .../vendor/nategood/httpful/build | 51 + .../vendor/nategood/httpful/composer.json | 27 + .../nategood/httpful/examples/freebase.php | 12 + .../nategood/httpful/examples/github.php | 9 + .../nategood/httpful/examples/override.php | 44 + .../nategood/httpful/examples/showclix.php | 24 + .../httpful/src/Httpful/Bootstrap.php | 97 ++ .../Exception/ConnectionErrorException.php | 7 + .../src/Httpful/Handlers/CsvHandler.php | 50 + .../src/Httpful/Handlers/FormHandler.php | 30 + .../src/Httpful/Handlers/JsonHandler.php | 41 + .../Httpful/Handlers/MimeHandlerAdapter.php | 54 + .../httpful/src/Httpful/Handlers/README.md | 44 + .../src/Httpful/Handlers/XHtmlHandler.php | 15 + .../src/Httpful/Handlers/XmlHandler.php | 152 +++ .../nategood/httpful/src/Httpful/Http.php | 86 ++ .../nategood/httpful/src/Httpful/Httpful.php | 46 + .../nategood/httpful/src/Httpful/Mime.php | 60 + .../nategood/httpful/src/Httpful/Proxy.php | 16 + .../nategood/httpful/src/Httpful/Request.php | 1160 +++++++++++++++++ .../nategood/httpful/src/Httpful/Response.php | 194 +++ .../httpful/src/Httpful/Response/Headers.php | 58 + .../httpful/tests/Httpful/HttpfulTest.php | 604 +++++++++ .../httpful/tests/Httpful/requestTest.php | 21 + .../httpful/tests/bootstrap-server.php | 42 + .../vendor/nategood/httpful/tests/phpunit.xml | 16 + .../nategood/httpful/tests/static/test.json | 1 + .../nategood/httpful/tests/test_image.jpg | Bin 0 -> 52666 bytes .../dingtools/controllers/index.php | 12 +- 71 files changed, 5674 insertions(+), 5 deletions(-) create mode 100644 dingdingcallback/api/Activate.php create mode 100644 dingdingcallback/api/Auth.php create mode 100644 dingdingcallback/api/Chat.php create mode 100644 dingdingcallback/api/Department.php create mode 100644 dingdingcallback/api/ISVClass.php create mode 100644 dingdingcallback/api/ISVService.php create mode 100644 dingdingcallback/api/Message.php create mode 100644 dingdingcallback/api/User.php create mode 100644 dingdingcallback/composer.json create mode 100644 dingdingcallback/composer.lock create mode 100644 dingdingcallback/config.php create mode 100644 dingdingcallback/crypto/DingtalkCrypt.php create mode 100644 dingdingcallback/crypto/errorCode.php create mode 100644 dingdingcallback/crypto/pkcs7Encoder.php create mode 100644 dingdingcallback/crypto/sha1.php create mode 100644 dingdingcallback/filecache.php create mode 100644 dingdingcallback/getPerson.php create mode 100644 dingdingcallback/index.php create mode 100644 dingdingcallback/indexpc.php create mode 100644 dingdingcallback/isv.log create mode 100644 dingdingcallback/public/javascripts/demo.js create mode 100644 dingdingcallback/public/javascripts/demopc.js create mode 100644 dingdingcallback/public/javascripts/logger.js create mode 100644 dingdingcallback/public/javascripts/zepto.min.js create mode 100644 dingdingcallback/public/stylesheets/style.css create mode 100644 dingdingcallback/receive.php create mode 100644 dingdingcallback/sendMsg.php create mode 100644 dingdingcallback/util/Cache.php create mode 100644 dingdingcallback/util/Http.php create mode 100644 dingdingcallback/util/Log.php create mode 100644 dingdingcallback/vendor/autoload.php create mode 100644 dingdingcallback/vendor/composer/ClassLoader.php create mode 100644 dingdingcallback/vendor/composer/autoload_classmap.php create mode 100644 dingdingcallback/vendor/composer/autoload_namespaces.php create mode 100644 dingdingcallback/vendor/composer/autoload_psr4.php create mode 100644 dingdingcallback/vendor/composer/autoload_real.php create mode 100644 dingdingcallback/vendor/composer/installed.json create mode 100644 dingdingcallback/vendor/nategood/httpful/.gitignore create mode 100644 dingdingcallback/vendor/nategood/httpful/.travis.yml create mode 100644 dingdingcallback/vendor/nategood/httpful/LICENSE.txt create mode 100644 dingdingcallback/vendor/nategood/httpful/README.md create mode 100644 dingdingcallback/vendor/nategood/httpful/bootstrap.php create mode 100644 dingdingcallback/vendor/nategood/httpful/build create mode 100644 dingdingcallback/vendor/nategood/httpful/composer.json create mode 100644 dingdingcallback/vendor/nategood/httpful/examples/freebase.php create mode 100644 dingdingcallback/vendor/nategood/httpful/examples/github.php create mode 100644 dingdingcallback/vendor/nategood/httpful/examples/override.php create mode 100644 dingdingcallback/vendor/nategood/httpful/examples/showclix.php create mode 100644 dingdingcallback/vendor/nategood/httpful/src/Httpful/Bootstrap.php create mode 100644 dingdingcallback/vendor/nategood/httpful/src/Httpful/Exception/ConnectionErrorException.php create mode 100644 dingdingcallback/vendor/nategood/httpful/src/Httpful/Handlers/CsvHandler.php create mode 100644 dingdingcallback/vendor/nategood/httpful/src/Httpful/Handlers/FormHandler.php create mode 100644 dingdingcallback/vendor/nategood/httpful/src/Httpful/Handlers/JsonHandler.php create mode 100644 dingdingcallback/vendor/nategood/httpful/src/Httpful/Handlers/MimeHandlerAdapter.php create mode 100644 dingdingcallback/vendor/nategood/httpful/src/Httpful/Handlers/README.md create mode 100644 dingdingcallback/vendor/nategood/httpful/src/Httpful/Handlers/XHtmlHandler.php create mode 100644 dingdingcallback/vendor/nategood/httpful/src/Httpful/Handlers/XmlHandler.php create mode 100644 dingdingcallback/vendor/nategood/httpful/src/Httpful/Http.php create mode 100644 dingdingcallback/vendor/nategood/httpful/src/Httpful/Httpful.php create mode 100644 dingdingcallback/vendor/nategood/httpful/src/Httpful/Mime.php create mode 100644 dingdingcallback/vendor/nategood/httpful/src/Httpful/Proxy.php create mode 100644 dingdingcallback/vendor/nategood/httpful/src/Httpful/Request.php create mode 100644 dingdingcallback/vendor/nategood/httpful/src/Httpful/Response.php create mode 100644 dingdingcallback/vendor/nategood/httpful/src/Httpful/Response/Headers.php create mode 100644 dingdingcallback/vendor/nategood/httpful/tests/Httpful/HttpfulTest.php create mode 100644 dingdingcallback/vendor/nategood/httpful/tests/Httpful/requestTest.php create mode 100644 dingdingcallback/vendor/nategood/httpful/tests/bootstrap-server.php create mode 100644 dingdingcallback/vendor/nategood/httpful/tests/phpunit.xml create mode 100644 dingdingcallback/vendor/nategood/httpful/tests/static/test.json create mode 100644 dingdingcallback/vendor/nategood/httpful/tests/test_image.jpg diff --git a/dingdingcallback/api/Activate.php b/dingdingcallback/api/Activate.php new file mode 100644 index 00000000..f3770a41 --- /dev/null +++ b/dingdingcallback/api/Activate.php @@ -0,0 +1,60 @@ +errcode != 0) + { + exit("Failed: " . json_encode($res)); + } + } +} diff --git a/dingdingcallback/api/Auth.php b/dingdingcallback/api/Auth.php new file mode 100644 index 00000000..dd100661 --- /dev/null +++ b/dingdingcallback/api/Auth.php @@ -0,0 +1,107 @@ + 'jsapi', 'access_token' => $accessToken)); + self::check($response); + $jsticket = $response->ticket; + Cache::setJsTicket('js_ticket_'.$corpId,$jsticket); + } + + return $jsticket; + } + + + function curPageURL() + { + $pageURL = 'http'; + + if (array_key_exists('HTTPS',$_SERVER)&&$_SERVER["HTTPS"] == "on") + { + $pageURL .= "s"; + } + $pageURL .= "://"; + + if ($_SERVER["SERVER_PORT"] != "80") + { + $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"]; + } + else + { + $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; + } + return $pageURL; + } + + public static function isvConfig($corpId) + { + $corpInfo = ISVClass::getCorpInfo($corpId); + $corpId = $corpInfo['corp_id']; + $agentId = ISVService::getCurAgentId($corpId,APPID); + $nonceStr = 'abcdefg'; + $timeStamp = time(); + $url = self::curPageURL(); + $ticket = self::getTicket($corpId,$corpInfo['corpAccessToken']); + $signature = self::sign($ticket, $nonceStr, $timeStamp, $url); + $arr = array(); + $arr['ticket'] = $ticket; + $arr['nonceStr'] = $nonceStr; + $arr['timeStamp'] = $timeStamp; + $arr['url'] = $url; + $arr['signature'] = $signature; + + $config = array( + 'url' => $url, + 'nonceStr' => $nonceStr, + 'agentId' => $agentId, + 'timeStamp' => $timeStamp, + 'corpId' => $corpId, + 'suite_key' => SUITE_KEY, + 'signature' => $signature); + return json_encode($config, JSON_UNESCAPED_SLASHES); + } + + public static function sign($ticket, $nonceStr, $timeStamp, $url) + { + $plain = 'jsapi_ticket=' . $ticket . + '&noncestr=' . $nonceStr . + '×tamp=' . $timeStamp . + '&url=' . $url; + return sha1($plain); + } + + /** + * @param $accessToken + * @param $code + * @return 个人授权信息 + */ + public static function getPerson($accessToken, $code) + { + $response = Http::get("/user/get_private_info", + array("access_token" => $accessToken, "tmp_auth_code" => $code)); + return json_encode($response); + } + + + static function check($res) + { + if ($res->errcode != 0) + { + Log::e("FAIL: " . json_encode($res)); + exit("Failed: " . json_encode($res)); + } + } +} diff --git a/dingdingcallback/api/Chat.php b/dingdingcallback/api/Chat.php new file mode 100644 index 00000000..4910bd86 --- /dev/null +++ b/dingdingcallback/api/Chat.php @@ -0,0 +1,38 @@ + $accessToken), + json_encode($chatOpt)); + return $response; + } + + public static function bindChat($accessToken, $chatid,$agentid) + { + $response = Http::get("/chat/bind", + array("access_token" => $accessToken,"chatid"=>$chatid,"agentid"=>$agentid)); + return $response; + } + + public static function sendmsg($accessToken, $opt) + { + $response = Http::post("/chat/send", + array("access_token" => $accessToken), + json_encode($opt)); + return $response; + } + + public static function callback($accessToken, $opt) + { + $response = Http::post("/call_back/register_call_back", + array("access_token" => $accessToken), + json_encode($opt)); + return $response; + } +} \ No newline at end of file diff --git a/dingdingcallback/api/Department.php b/dingdingcallback/api/Department.php new file mode 100644 index 00000000..809315a3 --- /dev/null +++ b/dingdingcallback/api/Department.php @@ -0,0 +1,28 @@ + $accessToken), + json_encode($dept)); + return $response->id; + } + + + public static function listDept($accessToken) + { + $response = Http::get("/department/list", + array("access_token" => $accessToken)); + return $response->department; + } + + + public static function deleteDept($accessToken, $id) + { + $response = Http::get("/department/delete", + array("access_token" => $accessToken, "id" => $id)); + return $response->errcode == 0; + } +} \ No newline at end of file diff --git a/dingdingcallback/api/ISVClass.php b/dingdingcallback/api/ISVClass.php new file mode 100644 index 00000000..b06dfea4 --- /dev/null +++ b/dingdingcallback/api/ISVClass.php @@ -0,0 +1,48 @@ +errcode != 0) + { + exit("Failed: " . json_encode($res)); + } +} diff --git a/dingdingcallback/api/ISVService.php b/dingdingcallback/api/ISVService.php new file mode 100644 index 00000000..34e63ae7 --- /dev/null +++ b/dingdingcallback/api/ISVService.php @@ -0,0 +1,216 @@ + SUITE_KEY, + "suite_secret" => SUITE_SECRET, + "suite_ticket" => $suiteTicket + ))); + self::check($response); + $suiteAccessToken = $response->suite_access_token; + Cache::setSuiteAccessToken($suiteAccessToken); + } + return $suiteAccessToken; + } + + public static function getCorpInfoByCorId($corpId){ + $corpList = json_decode(Cache::getCorpInfo(),true); + if(!is_array($corpList)){ + return false; + } + + foreach($corpList as $corp){ + if($corp['corp_id']==$corpId){ + return $corp; + } + } + } + + public static function getCorpInfoByTmpCode($code){ + $corpList = json_decode(Cache::getCorpInfo(),true); + if(!is_array($corpList)){ + return false; + } + + foreach($corpList as $corp){ + if($corp['tmp_auth_code']==$code){ + return $corp; + } + } + } + + public static function getPermanentCodeInfo($suiteAccessToken,$tmpAuthCode) + { + $permanentCodeInfo = json_decode(ISVService::getCorpInfoByTmpCode($tmpAuthCode)); + + if (!$permanentCodeInfo) + { + $permanentCodeResult = Http::post("/service/get_permanent_code", + array( + "suite_access_token" => $suiteAccessToken + ), + json_encode(array( + "tmp_auth_code" => $tmpAuthCode + ))); + self::check($permanentCodeResult); + $permanentCodeInfo = self::savePermanentCodeInfo($permanentCodeResult,$tmpAuthCode); + } + return $permanentCodeInfo; + } + + public static function savePermanentCodeInfo($permanentCodeInfo,$tmpAuthCode){ + $arr = array(); + $arr['corp_name'] = $permanentCodeInfo->auth_corp_info->corp_name; + $arr['corp_id'] = $permanentCodeInfo->auth_corp_info->corpid; + $arr['permanent_code'] = $permanentCodeInfo->permanent_code; + $arr['tmp_auth_code'] = $tmpAuthCode; + $corpInfo = json_decode(Cache::getCorpInfo()); + if(!$corpInfo){ + $corpInfo = array(); + } + + $corpExist = false; + foreach($corpInfo as $cp){ + if($cp->corp_id == $arr['corp_id']){ + $corpExist = true; + } + } + + if(!$corpExist){ + $corpInfo[] = $arr; + Cache::setCorpInfo(json_encode($corpInfo)); + } + return $arr; + } + + public static function getCurAgentId($corpId,$appId){ + $authInfo = json_decode(Cache::getAuthInfo("corpAuthInfo_".$corpId)); + $agents = $authInfo->agent; + $agentId = 0; + foreach($agents as $agent){ + if($agent->appid==$appId){ + $agentId = $agent->agentid; + break; + } + } + Log::i("[AGENTID]".$corpId."-----".$appId."-----".$agentId); + return $agentId; + } + + public static function getIsvCorpAccessToken($suiteAccessToken, $authCorpId, $permanentCode) + { + $key = "IsvCorpAccessToken_".$authCorpId; + $corpAccessToken = Cache::getIsvCorpAccessToken($key); + if (!$corpAccessToken) + { + $response = Http::post("/service/get_corp_token", + array( + "suite_access_token" => $suiteAccessToken + ), + json_encode(array( + "auth_corpid" => $authCorpId, + "permanent_code" => $permanentCode + ))); + self::check($response); + $corpAccessToken = $response->access_token; + Cache::setIsvCorpAccessToken($key,$corpAccessToken); + } + return $corpAccessToken; + } + + public static function getAuthInfo($suiteAccessToken, $authCorpId, $permanentCode) + { + $authInfo = json_decode(Cache::getAuthInfo("corpAuthInfo_".$authCorpId)); + if (!$authInfo) + { + $authInfo = Http::post("/service/get_auth_info", + array( + "suite_access_token" => $suiteAccessToken + ), + json_encode(array( + "suite_key" => SUITE_KEY, + "auth_corpid" => $authCorpId, + "permanent_code" => $permanentCode + ))); + self::check($authInfo); + Cache::setAuthInfo("corpAuthInfo_".$authCorpId,json_encode($authInfo->auth_info)); + } + + return $authInfo; + } + + + public static function getAgent($suiteAccessToken, $authCorpId, $permanentCode, $agentId) + { + $response = Http::post("/service/get_agent", + array( + "suite_access_token" => $suiteAccessToken + ), + json_encode(array( + "suite_key" => SUITE_KEY, + "auth_corpid" => $authCorpId, + "permanent_code" => $permanentCode, + "agentid" => $agentId + ))); + self::check($response); + return $response; + } + + + public static function activeSuite($suiteAccessToken, $authCorpId, $permanentCode) + { + $key = "dingdingActive_".$authCorpId; + $response = Http::post("/service/activate_suite", + array( + "suite_access_token" => $suiteAccessToken + ), + json_encode(array( + "suite_key" => SUITE_KEY, + "auth_corpid" => $authCorpId, + "permanent_code" => $permanentCode + ))); + + if($response->errcode==0){ + Cache::setActiveStatus($key); + } + self::check($response); + return $response; + } + + public static function removeCorpInfo($authCorpId){ + $arr = array(); + $key1 = "dingdingActive_".$authCorpId; + $key2 = "corpAuthInfo_".$authCorpId; + $key3 = "IsvCorpAccessToken_".$authCorpId; + $key4 = "js_ticket_".$authCorpId; + $arr[] = $key1; + $arr[] = $key2; + $arr[] = $key3; + $arr[] = $key4; + Cache::removeByKeyArr($arr); + } + + static function check($res) + { + if ($res->errcode != 0) + { + Log::e("[FAIL]: " . json_encode($res)); + exit("Failed: " . json_encode($res)); + } + } +} diff --git a/dingdingcallback/api/Message.php b/dingdingcallback/api/Message.php new file mode 100644 index 00000000..43c5dcb2 --- /dev/null +++ b/dingdingcallback/api/Message.php @@ -0,0 +1,18 @@ + $accessToken), + json_encode($opt)); + return $response; + } + + public static function send($accessToken, $opt) + { + $response = Http::post("/message/send", + array("access_token" => $accessToken),json_encode($opt)); + return $response; + } +} \ No newline at end of file diff --git a/dingdingcallback/api/User.php b/dingdingcallback/api/User.php new file mode 100644 index 00000000..0031e114 --- /dev/null +++ b/dingdingcallback/api/User.php @@ -0,0 +1,18 @@ + $accessToken, "code" => $code)); + return json_encode($response); + } + + + public static function simplelist($accessToken,$deptId){ + $response = Http::get("/user/simplelist", + array("access_token" => $accessToken,"department_id"=>$deptId)); + return $response->userlist; + + } +} diff --git a/dingdingcallback/composer.json b/dingdingcallback/composer.json new file mode 100644 index 00000000..c5e87a60 --- /dev/null +++ b/dingdingcallback/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "nategood/httpful": "*" + } +} diff --git a/dingdingcallback/composer.lock b/dingdingcallback/composer.lock new file mode 100644 index 00000000..f65516a8 --- /dev/null +++ b/dingdingcallback/composer.lock @@ -0,0 +1,68 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "e23d30d76ba6b3d3bcdab145c9f7f9f3", + "packages": [ + { + "name": "nategood/httpful", + "version": "0.2.19", + "source": { + "type": "git", + "url": "https://github.com/nategood/httpful.git", + "reference": "bd73f89d34d8f879c54ac46eb94b0f7be1d00820" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nategood/httpful/zipball/bd73f89d34d8f879c54ac46eb94b0f7be1d00820", + "reference": "bd73f89d34d8f879c54ac46eb94b0f7be1d00820", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "php": ">=5.3" + }, + "require-dev": { + "phpunit/phpunit": "*" + }, + "type": "library", + "autoload": { + "psr-0": { + "Httpful": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nate Good", + "email": "me@nategood.com", + "homepage": "http://nategood.com" + } + ], + "description": "A Readable, Chainable, REST friendly, PHP HTTP Client", + "homepage": "http://github.com/nategood/httpful", + "keywords": [ + "api", + "curl", + "http", + "requests", + "rest", + "restful" + ], + "time": "2015-03-08 15:22:23" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/dingdingcallback/config.php b/dingdingcallback/config.php new file mode 100644 index 00000000..cb6af7aa --- /dev/null +++ b/dingdingcallback/config.php @@ -0,0 +1,11 @@ +m_token = $token; + $this->m_encodingAesKey = $encodingAesKey; + $this->m_suiteKey = $suiteKey; + } + + + public function EncryptMsg($plain, $timeStamp, $nonce, &$encryptMsg) + { + $pc = new Prpcrypt($this->m_encodingAesKey); + + $array = $pc->encrypt($plain, $this->m_suiteKey); + $ret = $array[0]; + if ($ret != 0) { + return $ret; + } + + if ($timeStamp == null) { + $timeStamp = time(); + } + $encrypt = $array[1]; + + $sha1 = new SHA1; + $array = $sha1->getSHA1($this->m_token, $timeStamp, $nonce, $encrypt); + $ret = $array[0]; + if ($ret != 0) { + return $ret; + } + $signature = $array[1]; + + $encryptMsg = json_encode(array( + "msg_signature" => $signature, + "encrypt" => $encrypt, + "timeStamp" => $timeStamp, + "nonce" => $nonce + )); + return ErrorCode::$OK; + } + + + public function DecryptMsg($signature, $timeStamp = null, $nonce, $encrypt, &$decryptMsg) + { + if (strlen($this->m_encodingAesKey) != 43) { + return ErrorCode::$IllegalAesKey; + } + + $pc = new Prpcrypt($this->m_encodingAesKey); + + if ($timeStamp == null) { + $timeStamp = time(); + } + + $sha1 = new SHA1; + $array = $sha1->getSHA1($this->m_token, $timeStamp, $nonce, $encrypt); + $ret = $array[0]; + + if ($ret != 0) { + return $ret; + } + + $verifySignature = $array[1]; + if ($verifySignature != $signature) { + return ErrorCode::$ValidateSignatureError; + } + + $result = $pc->decrypt($encrypt, $this->m_suiteKey); + if ($result[0] != 0) { + return $result[0]; + } + $decryptMsg = $result[1]; + + return ErrorCode::$OK; + } + +} + diff --git a/dingdingcallback/crypto/errorCode.php b/dingdingcallback/crypto/errorCode.php new file mode 100644 index 00000000..c5edf8da --- /dev/null +++ b/dingdingcallback/crypto/errorCode.php @@ -0,0 +1,26 @@ + + *
  • -900004: encodingAesKey 非法
  • + *
  • -900005: 签名验证错误
  • + *
  • -900006: sha加密生成签名失败
  • + *
  • -900007: aes 加密失败
  • + *
  • -900008: aes 解密失败
  • + *
  • -900010: suiteKey 校验错误
  • + * + */ +class ErrorCode +{ + public static $OK = 0; + + public static $IllegalAesKey = 900004; + public static $ValidateSignatureError = 900005; + public static $ComputeSignatureError = 900006; + public static $EncryptAESError = 900007; + public static $DecryptAESError = 900008; + public static $ValidateSuiteKeyError = 900010; +} + +?> \ No newline at end of file diff --git a/dingdingcallback/crypto/pkcs7Encoder.php b/dingdingcallback/crypto/pkcs7Encoder.php new file mode 100644 index 00000000..2b6948cd --- /dev/null +++ b/dingdingcallback/crypto/pkcs7Encoder.php @@ -0,0 +1,129 @@ + PKCS7Encoder::$block_size) { + $pad = 0; + } + return substr($text, 0, (strlen($text) - $pad)); + } + +} + + +class Prpcrypt +{ + public $key; + + function Prpcrypt($k) + { + $this->key = base64_decode($k . "="); + } + + public function encrypt($text, $corpid) + { + + try { + //获得16位随机字符串,填充到明文之前 + $random = $this->getRandomStr(); + $text = $random . pack("N", strlen($text)) . $text . $corpid; + // 网络字节序 + $size = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); + $module = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, ''); + $iv = substr($this->key, 0, 16); + //使用自定义的填充方式对明文进行补位填充 + $pkc_encoder = new PKCS7Encoder; + $text = $pkc_encoder->encode($text); + mcrypt_generic_init($module, $this->key, $iv); + //加密 + $encrypted = mcrypt_generic($module, $text); + mcrypt_generic_deinit($module); + mcrypt_module_close($module); + + //print(base64_encode($encrypted)); + //使用BASE64对加密后的字符串进行编码 + return array(ErrorCode::$OK, base64_encode($encrypted)); + } catch (Exception $e) { + print $e; + return array(ErrorCode::$EncryptAESError, null); + } + } + + public function decrypt($encrypted, $corpid) + { + + try { + $ciphertext_dec = base64_decode($encrypted); + $module = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, ''); + $iv = substr($this->key, 0, 16); + mcrypt_generic_init($module, $this->key, $iv); + + $decrypted = mdecrypt_generic($module, $ciphertext_dec); + mcrypt_generic_deinit($module); + mcrypt_module_close($module); + } catch (Exception $e) { + return array(ErrorCode::$DecryptAESError, null); + } + + + try { + //去除补位字符 + $pkc_encoder = new PKCS7Encoder; + $result = $pkc_encoder->decode($decrypted); + //去除16位随机字符串,网络字节序和AppId + if (strlen($result) < 16) + return ""; + $content = substr($result, 16, strlen($result)); + $len_list = unpack("N", substr($content, 0, 4)); + $xml_len = $len_list[1]; + $xml_content = substr($content, 4, $xml_len); + $from_corpid = substr($content, $xml_len + 4); + } catch (Exception $e) { + print $e; + return array(ErrorCode::$DecryptAESError, null); + } + if ($from_corpid != $corpid) + return array(ErrorCode::$ValidateSuiteKeyError, null); + return array(0, $xml_content); + + } + + function getRandomStr() + { + + $str = ""; + $str_pol = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"; + $max = strlen($str_pol) - 1; + for ($i = 0; $i < 16; $i++) { + $str .= $str_pol[mt_rand(0, $max)]; + } + return $str; + } + +} + +?> \ No newline at end of file diff --git a/dingdingcallback/crypto/sha1.php b/dingdingcallback/crypto/sha1.php new file mode 100644 index 00000000..400d4ffb --- /dev/null +++ b/dingdingcallback/crypto/sha1.php @@ -0,0 +1,23 @@ + \ No newline at end of file diff --git a/dingdingcallback/filecache.php b/dingdingcallback/filecache.php new file mode 100644 index 00000000..4d66f3ff --- /dev/null +++ b/dingdingcallback/filecache.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/dingdingcallback/getPerson.php b/dingdingcallback/getPerson.php new file mode 100644 index 00000000..8b2a0170 --- /dev/null +++ b/dingdingcallback/getPerson.php @@ -0,0 +1,16 @@ + + + + + jsapi demo + + + + + + + + + + + + + + diff --git a/dingdingcallback/indexpc.php b/dingdingcallback/indexpc.php new file mode 100644 index 00000000..ac37e5a9 --- /dev/null +++ b/dingdingcallback/indexpc.php @@ -0,0 +1,22 @@ + + + + + jsapi demo + + + + + + + + + + + + + + diff --git a/dingdingcallback/isv.log b/dingdingcallback/isv.log new file mode 100644 index 00000000..c7252675 --- /dev/null +++ b/dingdingcallback/isv.log @@ -0,0 +1,60 @@ +E/ 2020-01-08 09:57:27 ERROR: suiteTicket not cached,please check the callback url +E/ 2020-01-08 09:57:32 [FAIL]: {"errcode":40014,"errmsg":"\u4e0d\u5408\u6cd5\u7684access_token"} +E/ 2020-01-08 09:57:57 [] ERR:900004 +E/ 2020-01-08 09:57:57 []CREATE SUITE ERR:900004 +E/ 2020-01-08 09:59:01 [] ERR:900004 +E/ 2020-01-08 09:59:01 []CREATE SUITE ERR:900004 +E/ 2020-01-08 09:59:06 [] ERR:900004 +E/ 2020-01-08 09:59:06 []CREATE SUITE ERR:900004 +E/ 2020-01-08 10:00:15 [] ERR:900004 +E/ 2020-01-08 10:00:15 []CREATE SUITE ERR:900004 +E/ 2020-01-08 10:46:10 [] ERR:900004 +E/ 2020-01-08 10:46:10 []CREATE SUITE ERR:900004 +E/ 2020-01-08 10:46:33 [] ERR:900004 +E/ 2020-01-08 10:46:33 []CREATE SUITE ERR:900004 +E/ 2020-01-08 10:46:35 [] ERR:900004 +E/ 2020-01-08 10:46:35 []CREATE SUITE ERR:900004 +E/ 2020-01-08 10:47:08 [] ERR:900004 +E/ 2020-01-08 10:47:08 []CREATE SUITE ERR:900004 +E/ 2020-01-08 10:47:09 [] ERR:900004 +E/ 2020-01-08 10:47:09 []CREATE SUITE ERR:900004 +E/ 2020-01-08 10:47:55 [] ERR:900004 +E/ 2020-01-08 10:47:55 []CREATE SUITE ERR:900004 +E/ 2020-01-08 10:47:57 [] ERR:900004 +E/ 2020-01-08 10:47:57 []CREATE SUITE ERR:900004 +E/ 2020-01-08 10:48:29 [] ERR:900004 +E/ 2020-01-08 10:48:29 []CREATE SUITE ERR:900004 +E/ 2020-01-08 10:48:30 [] ERR:900004 +E/ 2020-01-08 10:48:30 []CREATE SUITE ERR:900004 +E/ 2020-01-08 10:48:30 [] ERR:900004 +E/ 2020-01-08 10:48:30 []CREATE SUITE ERR:900004 +E/ 2020-01-08 10:48:31 [] ERR:900004 +E/ 2020-01-08 10:48:31 []CREATE SUITE ERR:900004 +E/ 2020-01-08 10:48:31 [] ERR:900004 +E/ 2020-01-08 10:48:31 []CREATE SUITE ERR:900004 +E/ 2020-01-08 02:44:14 [] ERR:900004 +E/ 2020-01-08 02:44:14 []CREATE SUITE ERR:900004 +E/ 2020-01-08 02:48:15 [] ERR:900005 +E/ 2020-01-08 02:48:15 []CREATE SUITE ERR:900005 +E/ 2020-01-08 02:48:38 [] ERR:900005 +E/ 2020-01-08 02:48:38 []CREATE SUITE ERR:900005 +E/ 2020-01-08 02:49:13 [] ERR:900005 +E/ 2020-01-08 02:49:13 []CREATE SUITE ERR:900005 +E/ 2020-01-08 02:49:34 [] ERR:900005 +E/ 2020-01-08 02:49:34 []CREATE SUITE ERR:900005 +E/ 2020-01-08 02:50:35 [] ERR:900005 +E/ 2020-01-08 02:50:35 []CREATE SUITE ERR:900005 +E/ 2020-01-08 02:50:36 [] ERR:900005 +E/ 2020-01-08 02:50:36 []CREATE SUITE ERR:900005 +E/ 2020-01-08 02:50:36 [] ERR:900005 +E/ 2020-01-08 02:50:36 []CREATE SUITE ERR:900005 +E/ 2020-01-08 02:50:36 [] ERR:900005 +E/ 2020-01-08 02:50:36 []CREATE SUITE ERR:900005 +I/ 2020-01-08 04:17:37 DECRYPT MSG SUCCESS [] {"EventType":"check_url"} +I/ 2020-01-08 04:17:37 RESPONSE: {"msg_signature":"dddd562596877498f925cfde6be89dcdb2b0b260","encrypt":"bfWI8rpT2xLmwK78PjZOy7yv4UptXvYMPPNaZdeUtPrJBV15bBCJB\/X8RNzU9nybvfgt2fP5WJ6wKE\/5cjNeew==","timeStamp":"1578453834041","nonce":"bpmnoUjO"} +E/ 2020-01-08 04:45:11 ERROR: suiteTicket not cached,please check the callback url +E/ 2020-01-08 04:45:12 [FAIL]: {"errcode":40014,"errmsg":"\u4e0d\u5408\u6cd5\u7684access_token"} +I/ 2020-01-08 04:45:24 DECRYPT MSG SUCCESS [] {"EventType":"check_url"} +I/ 2020-01-08 04:45:24 RESPONSE: {"msg_signature":"9b012263e14a86181c1b1440cf3b9d24d10fb94f","encrypt":"WCP4qSubCQ4zqzuLvc5rWvOEsoISdZf44MfTeJudHwS\/OdHbgthABNmWHOmWHXm8jvIz+9MHLX+jJzB3osGCbw==","timeStamp":"1578453834041","nonce":"bpmnoUjO"} +E/ 2020-01-08 04:46:48 [] ERR:900005 +E/ 2020-01-08 04:46:48 []CREATE SUITE ERR:900005 diff --git a/dingdingcallback/public/javascripts/demo.js b/dingdingcallback/public/javascripts/demo.js new file mode 100644 index 00000000..3f79b510 --- /dev/null +++ b/dingdingcallback/public/javascripts/demo.js @@ -0,0 +1,169 @@ +/** + * Created by liqiao on 8/10/15. + */ + +logger.i('Here we go...'); + +logger.i(location.href); + +/** + * _config comes from server-side template. see views/index.jade + */ +dd.config({ + agentId: _config.agentId, + corpId: _config.corpId, + timeStamp: _config.timeStamp, + nonceStr: _config.nonceStr, + signature: _config.signature, + jsApiList: [ + 'runtime.info', + 'device.notification.prompt', + 'biz.chat.pickConversation', + 'device.notification.confirm', + 'device.notification.alert', + 'device.notification.prompt', + 'biz.chat.open', + 'biz.util.open', + 'biz.user.get', + 'biz.contact.choose', + 'biz.telephone.call', + 'biz.util.uploadImage', + 'biz.ding.post'] +}); +dd.userid=0; +dd.ready(function() { + logger.i('dd.ready rocks!'); + + dd.runtime.info({ + onSuccess: function(info) { + logger.i('runtime info: ' + JSON.stringify(info)); + }, + onFail: function(err) { + logger.e('fail: ' + JSON.stringify(err)); + } + }); + + dd.runtime.permission.requestAuthCode({ + corpId: _config.corpId, //企业id + onSuccess: function (info) { + logger.i('authcode: ' + info.code); + $.ajax({ + url: '/sendMsg.php', + type:"POST", + data: {"event":"get_userinfo","code":info.code,"corpId":_config.corpId}, + dataType:'json', + timeout: 900, + success: function (data, status, xhr) { + var info = JSON.parse(data); + if (info.errcode === 0) { + logger.i('user id: ' + info.userid); + dd.userid = info.userid; + } + else { + logger.e('auth error: ' + data); + } + }, + error: function (xhr, errorType, error) { + logger.e(errorType + ', ' + error); + } + }); + }, + onFail: function (err) { + logger.e('requestAuthCode fail: ' + JSON.stringify(err)); + } + }); + + $('.chooseonebtn').on('click', function() { + + dd.biz.chat.pickConversation({ + corpId: _config.corpId, //企业id + isConfirm:'false', //是否弹出确认窗口,默认为true + onSuccess: function (data) { + var chatinfo = data; + if(chatinfo){ + console.log(chatinfo.cid); + dd.device.notification.prompt({ + message: "发送消息", + title: chatinfo.title, + buttonLabels: ['发送', '取消'], + onSuccess : function(result) { + var text = result.value; + if(text==''){ + return false; + } + + $.ajax({ + url: '/sendMsg.php', + type:"POST", + data: {"event":"send_to_conversation","cid":chatinfo.cid,"sender":dd.userid,"content":text,"corpId":_config.corpId}, + dataType:'json', + timeout: 900, + success: function (data, status, xhr) { + var info = data; + logger.i('sendMsg: ' + JSON.stringify(data)); + if(info.errcode==0){ + logger.i('sendMsg: 发送成功'); + /** + * 跳转到对话界面 + */ + dd.biz.chat.open({ + cid:chatinfo.cid, + onSuccess : function(result) { + }, + onFail : function(err) {} + }); + }else{ + logger.e('sendMsg: 发送失败'+info.errmsg); + } + }, + error: function (xhr, errorType, error) { + logger.e(errorType + ', ' + error); + } + }); + }, + onFail : function(err) {} + }); + } + }, + onFail: function (err) { + } + }); + }); + + $('.phonecall').on('click', function() { + dd.biz.contact.choose({ + startWithDepartmentId: 0, //-1表示打开的通讯录从自己所在部门开始展示, 0表示从企业最上层开始,(其他数字表示从该部门开始:暂时不支持) + multiple: false, //是否多选: true多选 false单选; 默认true + users: [], //默认选中的用户列表,userid;成功回调中应包含该信息 + corpId: _config.corpId, //企业id + max: 10, //人数限制,当multiple为true才生效,可选范围1-1500 + onSuccess: function(data) { + if(data&&data.length>0){ + var selectUserId = data[0].emplId; + if(selectUserId>0){ + dd.biz.telephone.call({ + users: [selectUserId], //用户列表,工号 + corpId: _config.corpId, //企业id + onSuccess : function(info) { + logger.i('biz.telephone.call: info' + JSON.stringify(info)); + + }, + onFail : function(err) { + logger.e('biz.telephone.call: error' + JSON.stringify(err)); + } + }) + }else{ + return false; + } + }else{ + return false; + } + }, + onFail : function(err) {} + }); + }); +}); + +dd.error(function(err) { + logger.e('dd error: ' + JSON.stringify(err)); +}); diff --git a/dingdingcallback/public/javascripts/demopc.js b/dingdingcallback/public/javascripts/demopc.js new file mode 100644 index 00000000..04bc0889 --- /dev/null +++ b/dingdingcallback/public/javascripts/demopc.js @@ -0,0 +1,135 @@ +/** + * Created by liqiao on 8/10/15. + */ + +logger.i('Here we go...'); + +logger.i(location.href); + +/** + * _config comes from server-side template. see views/index.jade + */ +DingTalkPC.config({ + agentId: _config.agentId, + corpId: _config.corpId, + timeStamp: _config.timeStamp, + nonceStr: _config.nonceStr, + signature: _config.signature, + jsApiList: [ + 'runtime.permission.requestAuthCode', + 'device.notification.alert', + 'device.notification.confirm', + 'biz.contact.choose', + 'device.notification.prompt', + 'biz.ding.post' + ] // 必填,需要使用的jsapi列表 +}); +DingTalkPC.userid=0; +DingTalkPC.ready(function(res){ + logger.i('dd.ready rocks!'); + + DingTalkPC.runtime.permission.requestAuthCode({ + corpId: _config.corpId, //企业ID + onSuccess: function(info) { + logger.i('authcode: ' + info.code); + $.ajax({ + url: '/sendMsg.php', + type:"POST", + data: {"event":"get_userinfo","code":info.code,"corpId":_config.corpId}, + dataType:'json', + timeout: 900, + success: function (data, status, xhr) { + var info = JSON.parse(data); + if (info.errcode === 0) { + logger.i('user id: ' + info.userid); + DingTalkPC.userid = info.userid; + } + else { + logger.e('auth error: ' + data); + } + }, + error: function (xhr, errorType, error) { + logger.e(errorType + ', ' + error); + } + }); + }, + onFail : function(err) { + logger.e(JSON.stringify(err)); + } + + }); + $('.chooseonebtn').on('click', function() { + + DingTalkPC.biz.contact.choose({ + multiple: false, //是否多选: true多选 false单选; 默认true + users: [], //默认选中的用户列表,工号;成功回调中应包含该信息 + corpId: _config.corpId, //企业id + max: 1, //人数限制,当multiple为true才生效,可选范围1-1500 + onSuccess: function(data) { + if(data&&data.length>0){ + var selectUserId = data[0].emplId; + if(selectUserId>0){ + DingTalkPC.device.notification.prompt({ + message: "发送消息", + title: data[0].name, + buttonLabels: ['发送', '取消'], + onSuccess : function(result) { + var textContent = result.value; + alert(textContent+">>>1"); + if(textContent==''){ + return false; + } + DingTalkPC.biz.ding.post({ + users : [selectUserId],//用户列表,工号 + corpId: _config.corpId, //加密的企业id + type: 1, //钉类型 1:image 2:link + alertType: 2, + alertDate: {"format":"yyyy-MM-dd HH:mm","value":"2016-05-09 08:00"}, + attachment: { + images: [] //只取第一个image + }, //附件信息 + text: textContent, //消息体 + onSuccess : function(info) { + alert(">>>2"); + logger.i('DingTalkPC.biz.ding.post: info' + JSON.stringify(info)); + }, + onFail : function(err) { + logger.e('DingTalkPC.biz.ding.post: info' + JSON.stringify(err)); + } + }) + /* + { + buttonIndex: 0, //被点击按钮的索引值,Number类型,从0开始 + value: '' //输入的值 + } + */ + }, + onFail : function(err) { + logger.e('DingTalkPC.biz.ding.post: info' + JSON.stringify(err)); + } + }); + } + } + }, + onFail : function(err) {} + }); + }); + /*DingTalkPC.biz.util.uploadImage({ + multiple: false, //是否多选,默认false + max: 5, //最多可选个数 + onSuccess : function(result) { + logger.i(result); + }, + onFail : function() {} + });*/ + /*DingTalkPC.device.notification.alert({ + message: "亲爱的", + title: "提示",//可传空 + buttonName: "收到", + onSuccess : function() { + }, + onFail : function(err) {} + });*/ +}); + + diff --git a/dingdingcallback/public/javascripts/logger.js b/dingdingcallback/public/javascripts/logger.js new file mode 100644 index 00000000..5b015445 --- /dev/null +++ b/dingdingcallback/public/javascripts/logger.js @@ -0,0 +1,24 @@ +/** + * Created by liqiao on 8/14/15. + */ + +var log = document.createElement('div'); +log.setAttribute('id', 'log'); +document.body.appendChild(log); + +var logger = { + i: function(info) { + add(info, 'i'); + }, + e: function(err) { + add(err, 'e'); + } +}; + +function add(msg, level) { + var row = document.createElement('div'); + row.setAttribute('class', 'log-row log-' + level); + row.innerHTML = msg; + + document.querySelector('#log').appendChild(row); +} \ No newline at end of file diff --git a/dingdingcallback/public/javascripts/zepto.min.js b/dingdingcallback/public/javascripts/zepto.min.js new file mode 100644 index 00000000..1c9203e3 --- /dev/null +++ b/dingdingcallback/public/javascripts/zepto.min.js @@ -0,0 +1 @@ +(function(a){String.prototype.trim===a&&(String.prototype.trim=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}),Array.prototype.reduce===a&&(Array.prototype.reduce=function(b){if(this===void 0||this===null)throw new TypeError;var c=Object(this),d=c.length>>>0,e=0,f;if(typeof b!="function")throw new TypeError;if(d==0&&arguments.length==1)throw new TypeError;if(arguments.length>=2)f=arguments[1];else do{if(e in c){f=c[e++];break}if(++e>=d)throw new TypeError}while(!0);while(e0?[].concat.apply([],a):a}function H(a){return a.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function I(a){return a in i?i[a]:i[a]=new RegExp("(^|\\s)"+a+"(\\s|$)")}function J(a,b){return typeof b=="number"&&!k[H(a)]?b+"px":b}function K(a){var b,c;return h[a]||(b=g.createElement(a),g.body.appendChild(b),c=j(b,"").getPropertyValue("display"),b.parentNode.removeChild(b),c=="none"&&(c="block"),h[a]=c),h[a]}function L(b,d){return d===a?c(b):c(b).filter(d)}function M(a,b,c,d){return A(b)?b.call(a,c,d):b}function N(a,b,d){var e=a%2?b:b.parentNode;e?e.insertBefore(d,a?a==1?e.firstChild:a==2?b:null:b.nextSibling):c(d).remove()}function O(a,b){b(a);for(var c in a.childNodes)O(a.childNodes[c],b)}var a,b,c,d,e=[],f=e.slice,g=window.document,h={},i={},j=g.defaultView.getComputedStyle,k={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},l=/^\s*<(\w+|!)[^>]*>/,m=[1,3,8,9,11],n=["after","prepend","before","append"],o=g.createElement("table"),p=g.createElement("tr"),q={tr:g.createElement("tbody"),tbody:o,thead:o,tfoot:o,td:p,th:p,"*":g.createElement("div")},r=/complete|loaded|interactive/,s=/^\.([\w-]+)$/,t=/^#([\w-]+)$/,u=/^[\w-]+$/,v={}.toString,w={},x,y,z=g.createElement("div");return w.matches=function(a,b){if(!a||a.nodeType!==1)return!1;var c=a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.matchesSelector;if(c)return c.call(a,b);var d,e=a.parentNode,f=!e;return f&&(e=z).appendChild(a),d=~w.qsa(e,b).indexOf(a),f&&z.removeChild(a),d},x=function(a){return a.replace(/-+(.)?/g,function(a,b){return b?b.toUpperCase():""})},y=function(a){return a.filter(function(b,c){return a.indexOf(b)==c})},w.fragment=function(b,d){d===a&&(d=l.test(b)&&RegExp.$1),d in q||(d="*");var e=q[d];return e.innerHTML=""+b,c.each(f.call(e.childNodes),function(){e.removeChild(this)})},w.Z=function(a,b){return a=a||[],a.__proto__=arguments.callee.prototype,a.selector=b||"",a},w.isZ=function(a){return a instanceof w.Z},w.init=function(b,d){if(!b)return w.Z();if(A(b))return c(g).ready(b);if(w.isZ(b))return b;var e;if(D(b))e=F(b);else if(C(b))e=[c.extend({},b)],b=null;else if(m.indexOf(b.nodeType)>=0||b===window)e=[b],b=null;else if(l.test(b))e=w.fragment(b.trim(),RegExp.$1),b=null;else{if(d!==a)return c(d).find(b);e=w.qsa(g,b)}return w.Z(e,b)},c=function(a,b){return w.init(a,b)},c.extend=function(c){return f.call(arguments,1).forEach(function(d){for(b in d)d[b]!==a&&(c[b]=d[b])}),c},w.qsa=function(a,b){var c;return a===g&&t.test(b)?(c=a.getElementById(RegExp.$1))?[c]:e:a.nodeType!==1&&a.nodeType!==9?e:f.call(s.test(b)?a.getElementsByClassName(RegExp.$1):u.test(b)?a.getElementsByTagName(b):a.querySelectorAll(b))},c.isFunction=A,c.isObject=B,c.isArray=D,c.isPlainObject=C,c.inArray=function(a,b,c){return e.indexOf.call(b,a,c)},c.trim=function(a){return a.trim()},c.uuid=0,c.map=function(a,b){var c,d=[],e,f;if(E(a))for(e=0;e0&&w.matches(this[0],a)},not:function(b){var d=[];if(A(b)&&b.call!==a)this.each(function(a){b.call(this,a)||d.push(this)});else{var e=typeof b=="string"?this.filter(b):E(b)&&A(b.item)?f.call(b):c(b);this.forEach(function(a){e.indexOf(a)<0&&d.push(a)})}return c(d)},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){var a=this[0];return a&&!B(a)?a:c(a)},last:function(){var a=this[this.length-1];return a&&!B(a)?a:c(a)},find:function(a){var b;return this.length==1?b=w.qsa(this[0],a):b=this.map(function(){return w.qsa(this,a)}),c(b)},closest:function(a,b){var d=this[0];while(d&&!w.matches(d,a))d=d!==b&&d!==g&&d.parentNode;return c(d)},parents:function(a){var b=[],d=this;while(d.length>0)d=c.map(d,function(a){if((a=a.parentNode)&&a!==g&&b.indexOf(a)<0)return b.push(a),a});return L(b,a)},parent:function(a){return L(y(this.pluck("parentNode")),a)},children:function(a){return L(this.map(function(){return f.call(this.children)}),a)},siblings:function(a){return L(this.map(function(a,b){return f.call(b.parentNode.children).filter(function(a){return a!==b})}),a)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(a){return this.map(function(){return this[a]})},show:function(){return this.each(function(){this.style.display=="none"&&(this.style.display=null),j(this,"").getPropertyValue("display")=="none"&&(this.style.display=K(this.nodeName))})},replaceWith:function(a){return this.before(a).remove()},wrap:function(a){return this.each(function(){c(this).wrapAll(c(a)[0].cloneNode(!1))})},wrapAll:function(a){return this[0]&&(c(this[0]).before(a=c(a)),a.append(this)),this},unwrap:function(){return this.parent().each(function(){c(this).replaceWith(c(this).children())}),this},clone:function(){return c(this.map(function(){return this.cloneNode(!0)}))},hide:function(){return this.css("display","none")},toggle:function(b){return(b===a?this.css("display")=="none":b)?this.show():this.hide()},prev:function(){return c(this.pluck("previousElementSibling"))},next:function(){return c(this.pluck("nextElementSibling"))},html:function(b){return b===a?this.length>0?this[0].innerHTML:null:this.each(function(a){var d=this.innerHTML;c(this).empty().append(M(this,b,a,d))})},text:function(b){return b===a?this.length>0?this[0].textContent:null:this.each(function(){this.textContent=b})},attr:function(c,d){var e;return typeof c=="string"&&d===a?this.length==0||this[0].nodeType!==1?a:c=="value"&&this[0].nodeName=="INPUT"?this.val():!(e=this[0].getAttribute(c))&&c in this[0]?this[0][c]:e:this.each(function(a){if(this.nodeType!==1)return;if(B(c))for(b in c)this.setAttribute(b,c[b]);else this.setAttribute(c,M(this,d,a,this.getAttribute(c)))})},removeAttr:function(a){return this.each(function(){this.nodeType===1&&this.removeAttribute(a)})},prop:function(b,c){return c===a?this[0]?this[0][b]:a:this.each(function(a){this[b]=M(this,c,a,this[b])})},data:function(b,c){var d=this.attr("data-"+H(b),c);return d!==null?d:a},val:function(b){return b===a?this.length>0?this[0].value:a:this.each(function(a){this.value=M(this,b,a,this.value)})},offset:function(){if(this.length==0)return null;var a=this[0].getBoundingClientRect();return{left:a.left+window.pageXOffset,top:a.top+window.pageYOffset,width:a.width,height:a.height}},css:function(c,d){if(d===a&&typeof c=="string")return this.length==0?a:this[0].style[x(c)]||j(this[0],"").getPropertyValue(c);var e="";for(b in c)typeof c[b]=="string"&&c[b]==""?this.each(function(){this.style.removeProperty(H(b))}):e+=H(b)+":"+J(b,c[b])+";";return typeof c=="string"&&(d==""?this.each(function(){this.style.removeProperty(H(c))}):e=H(c)+":"+J(c,d)),this.each(function(){this.style.cssText+=";"+e})},index:function(a){return a?this.indexOf(c(a)[0]):this.parent().children().indexOf(this[0])},hasClass:function(a){return this.length<1?!1:I(a).test(this[0].className)},addClass:function(a){return this.each(function(b){d=[];var e=this.className,f=M(this,a,b,e);f.split(/\s+/g).forEach(function(a){c(this).hasClass(a)||d.push(a)},this),d.length&&(this.className+=(e?" ":"")+d.join(" "))})},removeClass:function(b){return this.each(function(c){if(b===a)return this.className="";d=this.className,M(this,b,c,d).split(/\s+/g).forEach(function(a){d=d.replace(I(a)," ")}),this.className=d.trim()})},toggleClass:function(b,d){return this.each(function(e){var f=M(this,b,e,this.className);(d===a?!c(this).hasClass(f):d)?c(this).addClass(f):c(this).removeClass(f)})}},["width","height"].forEach(function(b){c.fn[b]=function(d){var e,f=b.replace(/./,function(a){return a[0].toUpperCase()});return d===a?this[0]==window?window["inner"+f]:this[0]==g?g.documentElement["offset"+f]:(e=this.offset())&&e[b]:this.each(function(a){var e=c(this);e.css(b,M(this,d,a,e[b]()))})}}),n.forEach(function(a,b){c.fn[a]=function(){var a=c.map(arguments,function(a){return B(a)?a:w.fragment(a)});if(a.length<1)return this;var d=this.length,e=d>1,f=b<2;return this.each(function(c,g){for(var h=0;h0&&this.bind(o,n),setTimeout(function(){m.css(i),e<=0&&setTimeout(function(){m.each(function(){n.call(this)})},0)},0),this},i=null}(Zepto),function($){function triggerAndReturn(a,b,c){var d=$.Event(b);return $(a).trigger(d,c),!d.defaultPrevented}function triggerGlobal(a,b,c,d){if(a.global)return triggerAndReturn(b||document,c,d)}function ajaxStart(a){a.global&&$.active++===0&&triggerGlobal(a,null,"ajaxStart")}function ajaxStop(a){a.global&&!--$.active&&triggerGlobal(a,null,"ajaxStop")}function ajaxBeforeSend(a,b){var c=b.context;if(b.beforeSend.call(c,a,b)===!1||triggerGlobal(b,c,"ajaxBeforeSend",[a,b])===!1)return!1;triggerGlobal(b,c,"ajaxSend",[a,b])}function ajaxSuccess(a,b,c){var d=c.context,e="success";c.success.call(d,a,e,b),triggerGlobal(c,d,"ajaxSuccess",[b,c,a]),ajaxComplete(e,b,c)}function ajaxError(a,b,c,d){var e=d.context;d.error.call(e,c,b,a),triggerGlobal(d,e,"ajaxError",[c,d,a]),ajaxComplete(b,c,d)}function ajaxComplete(a,b,c){var d=c.context;c.complete.call(d,b,a),triggerGlobal(c,d,"ajaxComplete",[b,c]),ajaxStop(c)}function empty(){}function mimeToDataType(a){return a&&(a==htmlType?"html":a==jsonType?"json":scriptTypeRE.test(a)?"script":xmlTypeRE.test(a)&&"xml")||"text"}function appendQuery(a,b){return(a+"&"+b).replace(/[&?]{1,2}/,"?")}function serializeData(a){isObject(a.data)&&(a.data=$.param(a.data)),a.data&&(!a.type||a.type.toUpperCase()=="GET")&&(a.url=appendQuery(a.url,a.data))}function serialize(a,b,c,d){var e=$.isArray(b);$.each(b,function(b,f){d&&(b=c?d:d+"["+(e?"":b)+"]"),!d&&e?a.add(f.name,f.value):(c?$.isArray(f):isObject(f))?serialize(a,f,c,b):a.add(b,f)})}var jsonpID=0,isObject=$.isObject,document=window.document,key,name,rscript=/)<[^<]*)*<\/script>/gi,scriptTypeRE=/^(?:text|application)\/javascript/i,xmlTypeRE=/^(?:text|application)\/xml/i,jsonType="application/json",htmlType="text/html",blankRE=/^\s*$/;$.active=0,$.ajaxJSONP=function(a){var b="jsonp"+ ++jsonpID,c=document.createElement("script"),d=function(){$(c).remove(),b in window&&(window[b]=empty),ajaxComplete("abort",e,a)},e={abort:d},f;return a.error&&(c.onerror=function(){e.abort(),a.error()}),window[b]=function(d){clearTimeout(f),$(c).remove(),delete window[b],ajaxSuccess(d,e,a)},serializeData(a),c.src=a.url.replace(/=\?/,"="+b),$("head").append(c),a.timeout>0&&(f=setTimeout(function(){e.abort(),ajaxComplete("timeout",e,a)},a.timeout)),e},$.ajaxSettings={type:"GET",beforeSend:empty,success:empty,error:empty,complete:empty,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript",json:jsonType,xml:"application/xml, text/xml",html:htmlType,text:"text/plain"},crossDomain:!1,timeout:0},$.ajax=function(options){var settings=$.extend({},options||{});for(key in $.ajaxSettings)settings[key]===undefined&&(settings[key]=$.ajaxSettings[key]);ajaxStart(settings),settings.crossDomain||(settings.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(settings.url)&&RegExp.$2!=window.location.host);var dataType=settings.dataType,hasPlaceholder=/=\?/.test(settings.url);if(dataType=="jsonp"||hasPlaceholder)return hasPlaceholder||(settings.url=appendQuery(settings.url,"callback=?")),$.ajaxJSONP(settings);settings.url||(settings.url=window.location.toString()),serializeData(settings);var mime=settings.accepts[dataType],baseHeaders={},protocol=/^([\w-]+:)\/\//.test(settings.url)?RegExp.$1:window.location.protocol,xhr=$.ajaxSettings.xhr(),abortTimeout;settings.crossDomain||(baseHeaders["X-Requested-With"]="XMLHttpRequest"),mime&&(baseHeaders.Accept=mime,mime.indexOf(",")>-1&&(mime=mime.split(",",2)[0]),xhr.overrideMimeType&&xhr.overrideMimeType(mime));if(settings.contentType||settings.data&&settings.type.toUpperCase()!="GET")baseHeaders["Content-Type"]=settings.contentType||"application/x-www-form-urlencoded";settings.headers=$.extend(baseHeaders,settings.headers||{}),xhr.onreadystatechange=function(){if(xhr.readyState==4){clearTimeout(abortTimeout);var result,error=!1;if(xhr.status>=200&&xhr.status<300||xhr.status==304||xhr.status==0&&protocol=="file:"){dataType=dataType||mimeToDataType(xhr.getResponseHeader("content-type")),result=xhr.responseText;try{dataType=="script"?(1,eval)(result):dataType=="xml"?result=xhr.responseXML:dataType=="json"&&(result=blankRE.test(result)?null:JSON.parse(result))}catch(e){error=e}error?ajaxError(error,"parsererror",xhr,settings):ajaxSuccess(result,xhr,settings)}else ajaxError(null,"error",xhr,settings)}};var async="async"in settings?settings.async:!0;xhr.open(settings.type,settings.url,async);for(name in settings.headers)xhr.setRequestHeader(name,settings.headers[name]);return ajaxBeforeSend(xhr,settings)===!1?(xhr.abort(),!1):(settings.timeout>0&&(abortTimeout=setTimeout(function(){xhr.onreadystatechange=empty,xhr.abort(),ajaxError(null,"timeout",xhr,settings)},settings.timeout)),xhr.send(settings.data?settings.data:null),xhr)},$.get=function(a,b){return $.ajax({url:a,success:b})},$.post=function(a,b,c,d){return $.isFunction(b)&&(d=d||c,c=b,b=null),$.ajax({type:"POST",url:a,data:b,success:c,dataType:d})},$.getJSON=function(a,b){return $.ajax({url:a,success:b,dataType:"json"})},$.fn.load=function(a,b){if(!this.length)return this;var c=this,d=a.split(/\s/),e;return d.length>1&&(a=d[0],e=d[1]),$.get(a,function(a){c.html(e?$(document.createElement("div")).html(a.replace(rscript,"")).find(e).html():a),b&&b.call(c)}),this};var escape=encodeURIComponent;$.param=function(a,b){var c=[];return c.add=function(a,b){this.push(escape(a)+"="+escape(b))},serialize(c,a,b),c.join("&").replace("%20","+")}}(Zepto),function(a){a.fn.serializeArray=function(){var b=[],c;return a(Array.prototype.slice.call(this.get(0).elements)).each(function(){c=a(this);var d=c.attr("type");this.nodeName.toLowerCase()!="fieldset"&&!this.disabled&&d!="submit"&&d!="reset"&&d!="button"&&(d!="radio"&&d!="checkbox"||this.checked)&&b.push({name:c.attr("name"),value:c.val()})}),b},a.fn.serialize=function(){var a=[];return this.serializeArray().forEach(function(b){a.push(encodeURIComponent(b.name)+"="+encodeURIComponent(b.value))}),a.join("&")},a.fn.submit=function(b){if(b)this.bind("submit",b);else if(this.length){var c=a.Event("submit");this.eq(0).trigger(c),c.defaultPrevented||this.get(0).submit()}return this}}(Zepto),function(a){function d(a){return"tagName"in a?a:a.parentNode}function e(a,b,c,d){var e=Math.abs(a-b),f=Math.abs(c-d);return e>=f?a-b>0?"Left":"Right":c-d>0?"Up":"Down"}function h(){g=null,b.last&&(b.el.trigger("longTap"),b={})}function i(){g&&clearTimeout(g),g=null}var b={},c,f=750,g;a(document).ready(function(){var j,k;a(document.body).bind("touchstart",function(e){j=Date.now(),k=j-(b.last||j),b.el=a(d(e.touches[0].target)),c&&clearTimeout(c),b.x1=e.touches[0].pageX,b.y1=e.touches[0].pageY,k>0&&k<=250&&(b.isDoubleTap=!0),b.last=j,g=setTimeout(h,f)}).bind("touchmove",function(a){i(),b.x2=a.touches[0].pageX,b.y2=a.touches[0].pageY}).bind("touchend",function(a){i(),b.isDoubleTap?(b.el.trigger("doubleTap"),b={}):b.x2&&Math.abs(b.x1-b.x2)>30||b.y2&&Math.abs(b.y1-b.y2)>30?(b.el.trigger("swipe")&&b.el.trigger("swipe"+e(b.x1,b.x2,b.y1,b.y2)),b={}):"last"in b&&(b.el.trigger("tap"),c=setTimeout(function(){c=null,b.el.trigger("singleTap"),b={}},250))}).bind("touchcancel",function(){c&&clearTimeout(c),g&&clearTimeout(g),g=c=null,b={}})}),["swipe","swipeLeft","swipeRight","swipeUp","swipeDown","doubleTap","tap","singleTap","longTap"].forEach(function(b){a.fn[b]=function(a){return this.bind(b,a)}})}(Zepto); \ No newline at end of file diff --git a/dingdingcallback/public/stylesheets/style.css b/dingdingcallback/public/stylesheets/style.css new file mode 100644 index 00000000..a6f54f75 --- /dev/null +++ b/dingdingcallback/public/stylesheets/style.css @@ -0,0 +1,41 @@ +body { + padding: 50px; + font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; +} + +a { + color: #00B7FF; +} + +.log-i { + color: green; +} + +.log-e { + color: red; +} + +.tag { + display: inline-block; + width: 170px; +} + +.api { + display: inline-block; + width: 300px; +} + +.hidden { + display: none; +} + +.row button { + width: 100%; + height: 100px; +} + +.log-row { + margin: 20px 10px 20px 10px; + font-size: 30px; + word-break: break-all;word-wrap: break-word; +} \ No newline at end of file diff --git a/dingdingcallback/receive.php b/dingdingcallback/receive.php new file mode 100644 index 00000000..d9f51a1b --- /dev/null +++ b/dingdingcallback/receive.php @@ -0,0 +1,184 @@ +decrypt($encrypt, $corpid); + +print_r($result); +die(); +*/ +$signature = $_GET["signature"]; +$timeStamp = $_GET["timestamp"]; +$nonce = $_GET["nonce"]; +$postdata = file_get_contents("php://input"); +/*$signature = '36e154f3bbaf043a6110b2025dca684967d67784'; +$timeStamp = '1578453834041'; +$nonce = 'bpmnoUjO'; +$postdata = '{"encrypt":"mh8kSwUzMKYr4VyvH+6Ay5UJdz41rgPqhjniHqdq3euo2P0XLZqu2fhQxgQBs5ZLNv7W8hjuQgmpf+ZVNElAhNv9SVT39ZdBmXY/e1481qOsZoLw9SP9HE6Q/Uma9feA"}';*/ +$postList = json_decode($postdata,true); +$encrypt = $postList['encrypt']; +$crypt = new DingtalkCrypt(TOKEN, ENCODING_AES_KEY, SUITE_KEY); + +$msg = ""; +$errCode = $crypt->DecryptMsg($signature, $timeStamp, $nonce, $encrypt, $msg); + +if ($errCode != 0) +{ + Log::e(json_encode($_GET) . " ERR:" . $errCode); + + /** + * 创建套件时检测回调地址有效性,使用CREATE_SUITE_KEY作为SuiteKey + */ + $crypt = new DingtalkCrypt(TOKEN, ENCODING_AES_KEY, CREATE_SUITE_KEY); + $errCode = $crypt->DecryptMsg($signature, $timeStamp, $nonce, $encrypt, $msg); + if ($errCode == 0) + { + Log::i("DECRYPT CREATE SUITE MSG SUCCESS " . json_encode($_GET) . " " . $msg); + $eventMsg = json_decode($msg); + $eventType = $eventMsg->EventType; + if ("check_create_suite_url" === $eventType) + { + $random = $eventMsg->Random; + $testSuiteKey = $eventMsg->TestSuiteKey; + + $encryptMsg = ""; + $errCode = $crypt->EncryptMsg($random, $timeStamp, $nonce, $encryptMsg); + if ($errCode == 0) + { + Log::i("CREATE SUITE URL RESPONSE: " . $encryptMsg); + echo $encryptMsg; + } + else + { + Log::e("CREATE SUITE URL RESPONSE ERR: " . $errCode); + } + } + else + { + //should never happened + } + } + else + { + Log::e(json_encode($_GET) . "CREATE SUITE ERR:" . $errCode); + } + return; +} +else +{ + /** + * 套件创建成功后的回调推送 + */ + Log::i("DECRYPT MSG SUCCESS " . json_encode($_GET) . " " . $msg); + $eventMsg = json_decode($msg); + $eventType = $eventMsg->EventType; + /** + * 套件ticket + */ + if ("suite_ticket" === $eventType) + { + Cache::setSuiteTicket($eventMsg->SuiteTicket); + } + /** + * 临时授权码 + */ + else if ("tmp_auth_code" === $eventType) + { + $tmpAuthCode = $eventMsg->AuthCode; + Activate::autoActivateSuite($tmpAuthCode); + } + /** + * 授权变更事件 + */ + + /*user_add_org : 通讯录用户增加 + user_modify_org : 通讯录用户更改 + user_leave_org : 通讯录用户离职 + org_admin_add :通讯录用户被设为管理员 + org_admin_remove :通讯录用户被取消设置管理员 + org_dept_create : 通讯录企业部门创建 + org_dept_modify : 通讯录企业部门修改 + org_dept_remove : 通讯录企业部门删除 + org_remove : 企业被解散 + */ + + else if ("user_add_org" === $eventType) + { + Log::e(json_encode($_GET) . " ERR:user_add_org"); + //handle auth change event + } + + else if ("user_modify_org" === $eventType) + { + Log::e(json_encode($_GET) . " ERR:user_modify_org"); + //handle auth change event + } + + else if ("user_leave_org" === $eventType) + { + Log::e(json_encode($_GET) . " ERR:user_leave_org"); + //handle auth change event + } + /** + * 应用被解除授权的时候,需要删除相应企业的存储信息 + */ + else if ("suite_relieve" === $eventType) + { + $corpid = $eventMsg->AuthCorpId; + ISVService::removeCorpInfo($corpid); + //handle auth change event + }else if ("change_auth" === $eventType) + { + //handle auth change event + } + + /** + * 回调地址更新 + */ + else if ("check_update_suite_url" === $eventType) + { + $random = $eventMsg->Random; + $testSuiteKey = $eventMsg->TestSuiteKey; + + $encryptMsg = ""; + $errCode = $crypt->EncryptMsg($random, $timeStamp, $nonce, $encryptMsg); + if ($errCode == 0) + { + Log::i("UPDATE SUITE URL RESPONSE: " . $encryptMsg); + echo $encryptMsg; + return; + } + else + { + Log::e("UPDATE SUITE URL RESPONSE ERR: " . $errCode); + } + } + else + { + //should never happen + } + + $res = "success"; + $encryptMsg = ""; + $errCode = $crypt->EncryptMsg($res, $timeStamp, $nonce, $encryptMsg); + if ($errCode == 0) + { + echo $encryptMsg; + Log::i("RESPONSE: " . $encryptMsg); + } + else + { + Log::e("RESPONSE ERR: " . $errCode); + } +} diff --git a/dingdingcallback/sendMsg.php b/dingdingcallback/sendMsg.php new file mode 100644 index 00000000..d0810fa7 --- /dev/null +++ b/dingdingcallback/sendMsg.php @@ -0,0 +1,40 @@ +"4000")); + break; + case 'send_to_conversation': + $sender = $_POST['sender']; + $cid = $_POST['cid']; + $content = $_POST['content']; + $corpId = $_POST['corpId']; + $corpInfo = ISVClass::getCorpInfo($corpId); + $accessToken = $corpInfo['corpAccessToken']; + $option = array( + "sender"=>$sender, + "cid"=>$cid, + "msgtype"=>"text", + "text"=>array("content"=>$content) + ); + $response = Message::sendToConversation($accessToken,$option); + echo json_encode($response); + break; + + case 'get_userinfo': + $corpId = $_POST['corpId']; + $corpInfo = ISVClass::getCorpInfo($corpId); + $accessToken = $corpInfo['corpAccessToken']; + $code = $_POST["code"]; + $userInfo = User::getUserInfo($accessToken, $code); + echo json_encode($userInfo); + break; +} \ No newline at end of file diff --git a/dingdingcallback/util/Cache.php b/dingdingcallback/util/Cache.php new file mode 100644 index 00000000..0882122f --- /dev/null +++ b/dingdingcallback/util/Cache.php @@ -0,0 +1,231 @@ +set("suite_ticket", $ticket); + } + + public static function getSuiteTicket() + { + $memcache = self::getMemcache(); + return $memcache->get("suite_ticket"); + } + + public static function setJsTicket($key,$ticket) + { + $memcache = self::getMemcache(); + $memcache->set($key, $ticket, 0, time() + 7000); // js ticket有效期为7200秒,这里设置为7000秒 + } + + public static function getJsTicket($key) + { + $memcache = self::getMemcache(); + return $memcache->get($key); + } + + public static function setSuiteAccessToken($accessToken) + { + $memcache = self::getMemcache(); + $memcache->set("suite_access_token", $accessToken, 0, time() + 7000); // suite access token有效期为7200秒,这里设置为7000秒 + } + + public static function getSuiteAccessToken() + { + $memcache = self::getMemcache(); + return $memcache->get("suite_access_token"); + } + + public static function setIsvCorpAccessToken($key,$accessToken) + { + $memcache = self::getMemcache(); + $memcache->set($key, $accessToken, 0, time() + 7000); + } + + public static function getIsvCorpAccessToken($key) + { + $memcache = self::getMemcache(); + return $memcache->get($key); + } + + public static function setTmpAuthCode($tmpAuthCode){ + $memcache = self::getMemcache(); + $memcache->set("tmp_auth_code", $tmpAuthCode); + } + + public static function getTmpAuthCode(){ + $memcache = self::getMemcache(); + return $memcache->get("tmp_auth_code"); + } + + public static function setPermanentCode($key,$value){ + $memcache = self::getMemcache(); + $memcache->set($key, $value); + } + + public static function getPermanentCode($key){ + $memcache = self::getMemcache(); + return $memcache->get($key); + } + + public static function setActiveStatus($corpKey){ + $memcache = self::getMemcache(); + $memcache->set($corpKey,100); + } + + public static function getActiveStatus($key){ + $memcache = self::getMemcache(); + return $memcache->get($key); + } + + public static function setCorpInfo($data){ + $memcache = self::getMemcache(); + $memcache->set('dingding_corp_info',$data); + } + + public static function getCorpInfo(){ + $memcache = self::getMemcache(); + $corpInfo = $memcache->get('dingding_corp_info'); + return $corpInfo; + } + + + public static function setAuthInfo($key,$authInfo){ + $memcache = self::getMemcache(); + $memcache->set($key,$authInfo); + } + + public static function getAuthInfo($key){ + $memcache = self::getMemcache(); + return $memcache->get($key); + } + + public static function removeByKeyArr($arr){ + $memcache = self::getMemcache(); + foreach($arr as $a){ + $memcache->set($a,''); + } + } + + private static function getMemcache() + { + /*if (class_exists("Memcache")) + { + $memcache = new Memcache; + if ($memcache->connect('localhost', 11211)) + { + return $memcache; + } + }*/ + + return new FileCache; + } + + public static function get($key) + { + return self::getMemcache()->get($key); + } + + public static function set($key, $value) + { + self::getMemcache()->set($key, $value); + } +} + +/** + * fallbacks + */ +class FileCache +{ + function __call($name, $args) + { + if($name=='set') + { + switch(count($args)) + { + case 0:break; + case 1: break; + case 2: $this->setComm($args[0], $args[1]); break; + case 4: $this->setLimit($args[0], $args[1],$args[2],$args[3]); break; + default: //do something + break; + } + } + } + + function setComm($key, $value) + { + if($key){ + $data = json_decode($this->get_file(DIR_ROOT ."filecache.php"),true); + if(!$value){ + unset($data["$key"]); + }else{ + $item = array(); + $item["$key"] = $value; + $item['expire_time'] = 0; + $item['create_time'] = time(); + $data["$key"] = $item; + } + $this->set_file("filecache.php",json_encode($data)); + } + } + + function setLimit($key, $value,$tag,$time) + { + if($key){ + $data = json_decode($this->get_file(DIR_ROOT ."filecache.php"),true); + if(!$value){ + unset($data["$key"]); + }else{ + $item = array(); + $item["$key"] = $value; + $item['expire_time'] = $time; + $item['create_time'] = time(); + $data["$key"] = $item; + } + + $this->set_file("filecache.php",json_encode($data)); + } + } + + function get($key) + { + if($key){ + $data = json_decode($this->get_file(DIR_ROOT ."filecache.php"),true); + if($data&&array_key_exists($key,$data)){ + $item = $data["$key"]; + if(!$item){ + return false; + } + if($item['expire_time']>0&&$item['expire_time'] < time()){ + return false; + } + + return $item["$key"]; + }else{ + return false; + } + + } + } + + function get_file($filename) { + if (!file_exists($filename)) { + $fp = fopen($filename, "w"); + fwrite($fp, "" . ''); + fclose($fp); + return false; + }else{ + $content = trim(substr(file_get_contents($filename), 15)); + } + return $content; + } + + function set_file($filename, $content) { + $fp = fopen($filename, "w"); + fwrite($fp, "" . $content); + fclose($fp); + } +} diff --git a/dingdingcallback/util/Http.php b/dingdingcallback/util/Http.php new file mode 100644 index 00000000..b4d705c2 --- /dev/null +++ b/dingdingcallback/util/Http.php @@ -0,0 +1,61 @@ +send(); + if ($response->hasErrors()) + { + var_dump($response); + } + if ($response->body->errcode != 0) + { + var_dump($response->body); + } + return $response->body; + } + + + public static function post($path, $params, $data) + { + $url = self::joinParams($path, $params); + $response = \Httpful\Request::post($url) + ->body($data) + ->sendsJson() + ->send(); + if ($response->hasErrors()) + { + var_dump($response); + } + if ($response->body->errcode != 0) + { + var_dump($response->body); + } + return $response->body; + } + + + private static function joinParams($path, $params) + { + $url = OAPI_HOST . $path; + if (count($params) > 0) + { + $url = $url . "?"; + foreach ($params as $key => $value) + { + $url = $url . $key . "=" . $value . "&"; + } + $length = count($url); + if ($url[$length - 1] == '&') + { + $url = substr($url, 0, $length - 1); + } + } + return $url; + } +} \ No newline at end of file diff --git a/dingdingcallback/util/Log.php b/dingdingcallback/util/Log.php new file mode 100644 index 00000000..64c8f402 --- /dev/null +++ b/dingdingcallback/util/Log.php @@ -0,0 +1,22 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0 class loader + * + * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + */ +class ClassLoader +{ + // PSR-4 + private $prefixLengthsPsr4 = array(); + private $prefixDirsPsr4 = array(); + private $fallbackDirsPsr4 = array(); + + // PSR-0 + private $prefixesPsr0 = array(); + private $fallbackDirsPsr0 = array(); + + private $useIncludePath = false; + private $classMap = array(); + + private $classMapAuthoritative = false; + + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', $this->prefixesPsr0); + } + + return array(); + } + + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-0 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 base directories + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + } + + /** + * Unregisters this instance as an autoloader. + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return bool|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731 + if ('\\' == $class[0]) { + $class = substr($class, 1); + } + + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative) { + return false; + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if ($file === null && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if ($file === null) { + // Remember that this class does not exist. + return $this->classMap[$class] = false; + } + + return $file; + } + + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { + if (0 === strpos($class, $prefix)) { + foreach ($this->prefixDirsPsr4[$prefix] as $dir) { + if (is_file($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + */ +function includeFile($file) +{ + include $file; +} diff --git a/dingdingcallback/vendor/composer/autoload_classmap.php b/dingdingcallback/vendor/composer/autoload_classmap.php new file mode 100644 index 00000000..7a91153b --- /dev/null +++ b/dingdingcallback/vendor/composer/autoload_classmap.php @@ -0,0 +1,9 @@ + array($vendorDir . '/nategood/httpful/src'), +); diff --git a/dingdingcallback/vendor/composer/autoload_psr4.php b/dingdingcallback/vendor/composer/autoload_psr4.php new file mode 100644 index 00000000..b265c64a --- /dev/null +++ b/dingdingcallback/vendor/composer/autoload_psr4.php @@ -0,0 +1,9 @@ + $path) { + $loader->set($namespace, $path); + } + + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } + + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + + $loader->register(true); + + return $loader; + } +} + +function composerRequire9c336c4d71b270c36d1e071cf0b19270($file) +{ + require $file; +} diff --git a/dingdingcallback/vendor/composer/installed.json b/dingdingcallback/vendor/composer/installed.json new file mode 100644 index 00000000..881f3272 --- /dev/null +++ b/dingdingcallback/vendor/composer/installed.json @@ -0,0 +1,54 @@ +[ + { + "name": "nategood/httpful", + "version": "0.2.19", + "version_normalized": "0.2.19.0", + "source": { + "type": "git", + "url": "https://github.com/nategood/httpful.git", + "reference": "bd73f89d34d8f879c54ac46eb94b0f7be1d00820" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nategood/httpful/zipball/bd73f89d34d8f879c54ac46eb94b0f7be1d00820", + "reference": "bd73f89d34d8f879c54ac46eb94b0f7be1d00820", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "php": ">=5.3" + }, + "require-dev": { + "phpunit/phpunit": "*" + }, + "time": "2015-03-08 15:22:23", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Httpful": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nate Good", + "email": "me@nategood.com", + "homepage": "http://nategood.com" + } + ], + "description": "A Readable, Chainable, REST friendly, PHP HTTP Client", + "homepage": "http://github.com/nategood/httpful", + "keywords": [ + "api", + "curl", + "http", + "requests", + "rest", + "restful" + ] + } +] diff --git a/dingdingcallback/vendor/nategood/httpful/.gitignore b/dingdingcallback/vendor/nategood/httpful/.gitignore new file mode 100644 index 00000000..6cf3a90c --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/.gitignore @@ -0,0 +1,5 @@ +.DS_Store +composer.lock +vendor +downloads +.idea/* diff --git a/dingdingcallback/vendor/nategood/httpful/.travis.yml b/dingdingcallback/vendor/nategood/httpful/.travis.yml new file mode 100644 index 00000000..6a632947 --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/.travis.yml @@ -0,0 +1,7 @@ +language: php +before_script: cd tests +php: + - 5.3 + - 5.4 + - 5.5 + - hhvm \ No newline at end of file diff --git a/dingdingcallback/vendor/nategood/httpful/LICENSE.txt b/dingdingcallback/vendor/nategood/httpful/LICENSE.txt new file mode 100644 index 00000000..90892706 --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/LICENSE.txt @@ -0,0 +1,7 @@ +Copyright (c) 2012 Nate Good + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/dingdingcallback/vendor/nategood/httpful/README.md b/dingdingcallback/vendor/nategood/httpful/README.md new file mode 100644 index 00000000..d4925ef4 --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/README.md @@ -0,0 +1,215 @@ +# Httpful + +[![Build Status](https://secure.travis-ci.org/nategood/httpful.png?branch=master)](http://travis-ci.org/nategood/httpful) [![Total Downloads](https://poser.pugx.org/nategood/httpful/downloads.png)](https://packagist.org/packages/nategood/httpful) + +[Httpful](http://phphttpclient.com) is a simple Http Client library for PHP 5.3+. There is an emphasis of readability, simplicity, and flexibility – basically provide the features and flexibility to get the job done and make those features really easy to use. + +Features + + - Readable HTTP Method Support (GET, PUT, POST, DELETE, HEAD, PATCH and OPTIONS) + - Custom Headers + - Automatic "Smart" Parsing + - Automatic Payload Serialization + - Basic Auth + - Client Side Certificate Auth + - Request "Templates" + +# Sneak Peak + +Here's something to whet your appetite. Search the twitter API for tweets containing "#PHP". Include a trivial header for the heck of it. Notice that the library automatically interprets the response as JSON (can override this if desired) and parses it as an array of objects. + +```php +$url = "http://search.twitter.com/search.json?q=" . urlencode('#PHP'); +$response = Request::get($url) + ->withXTrivialHeader('Just as a demo') + ->send(); + +foreach ($response->body->results as $tweet) { + echo "@{$tweet->from_user} tweets \"{$tweet->text}\"\n"; +} +``` + +# Installation + +## Phar + +A [PHP Archive](http://php.net/manual/en/book.phar.php) (or .phar) file is available for [downloading](http://phphttpclient.com/httpful.phar). Simply [download](http://phphttpclient.com/httpful.phar) the .phar, drop it into your project, and include it like you would any other php file. _This method is ideal for smaller projects, one off scripts, and quick API hacking_. + +```php +include('httpful.phar'); +$r = \Httpful\Request::get($uri)->sendIt(); +... +``` + +## Composer + +Httpful is PSR-0 compliant and can be installed using [composer](http://getcomposer.org/). Simply add `nategood/httpful` to your composer.json file. _Composer is the sane alternative to PEAR. It is excellent for managing dependencies in larger projects_. + + { + "require": { + "nategood/httpful": "*" + } + } + +## Install from Source + +Because Httpful is PSR-0 compliant, you can also just clone the Httpful repository and use a PSR-0 compatible autoloader to load the library, like [Symfony's](http://symfony.com/doc/current/components/class_loader.html). Alternatively you can use the PSR-0 compliant autoloader included with the Httpful (simply `require("bootstrap.php")`). + +# Show Me More! + +You can checkout the [Httpful Landing Page](http://phphttpclient.com) for more info including many examples and [documentation](http://phphttpclient.com/docs). + +# Contributing + +Httpful highly encourages sending in pull requests. When submitting a pull request please: + + - All pull requests should target the `dev` branch (not `master`) + - Make sure your code follows the [coding conventions](http://pear.php.net/manual/en/standards.php) + - Please use soft tabs (four spaces) instead of hard tabs + - Make sure you add appropriate test coverage for your changes + - Run all unit tests in the test directory via `phpunit ./tests` + - Include commenting where appropriate and add a descriptive pull request message + +# Changelog + +## 0.2.19 + + - FEATURE Before send hook [PR #164](https://github.com/nategood/httpful/pull/164) + - MINOR More descriptive connection exceptions [PR #166](https://github.com/nategood/httpful/pull/166) + +## 0.2.18 + + - FIX [PR #149](https://github.com/nategood/httpful/pull/149) + - FIX [PR #150](https://github.com/nategood/httpful/pull/150) + - FIX [PR #156](https://github.com/nategood/httpful/pull/156) + +## 0.2.17 + + - FEATURE [PR #144](https://github.com/nategood/httpful/pull/144) Adds additional parameter to the Response class to specify additional meta data about the request/response (e.g. number of redirect). + +## 0.2.16 + + - FEATURE Added support for whenError to define a custom callback to be fired upon error. Useful for logging or overriding the default error_log behavior. + +## 0.2.15 + + - FEATURE [I #131](https://github.com/nategood/httpful/pull/131) Support for SOCKS proxy + +## 0.2.14 + + - FEATURE [I #138](https://github.com/nategood/httpful/pull/138) Added alternative option for XML request construction. In the next major release this will likely supplant the older version. + +## 0.2.13 + + - REFACTOR [I #121](https://github.com/nategood/httpful/pull/121) Throw more descriptive exception on curl errors + - REFACTOR [I #122](https://github.com/nategood/httpful/issues/122) Better proxy scrubbing in Request + - REFACTOR [I #119](https://github.com/nategood/httpful/issues/119) Better document the mimeType param on Request::body + - Misc code and test cleanup + +## 0.2.12 + + - REFACTOR [I #123](https://github.com/nategood/httpful/pull/123) Support new curl file upload method + - FEATURE [I #118](https://github.com/nategood/httpful/pull/118) 5.4 HTTP Test Server + - FIX [I #109](https://github.com/nategood/httpful/pull/109) Typo + - FIX [I #103](https://github.com/nategood/httpful/pull/103) Handle also CURLOPT_SSL_VERIFYHOST for strictSsl mode + +## 0.2.11 + + - FIX [I #99](https://github.com/nategood/httpful/pull/99) Prevent hanging on HEAD requests + +## 0.2.10 + + - FIX [I #93](https://github.com/nategood/httpful/pull/86) Fixes edge case where content-length would be set incorrectly + +## 0.2.9 + + - FEATURE [I #89](https://github.com/nategood/httpful/pull/89) multipart/form-data support (a.k.a. file uploads)! Thanks @dtelaroli! + +## 0.2.8 + + - FIX Notice fix for Pull Request 86 + +## 0.2.7 + + - FIX [I #86](https://github.com/nategood/httpful/pull/86) Remove Connection Established header when using a proxy + +## 0.2.6 + + - FIX [I #85](https://github.com/nategood/httpful/issues/85) Empty Content Length issue resolved + +## 0.2.5 + + - FEATURE [I #80](https://github.com/nategood/httpful/issues/80) [I #81](https://github.com/nategood/httpful/issues/81) Proxy support added with `useProxy` method. + +## 0.2.4 + + - FEATURE [I #77](https://github.com/nategood/httpful/issues/77) Convenience method for setting a timeout (seconds) `$req->timeoutIn(10);` + - FIX [I #75](https://github.com/nategood/httpful/issues/75) [I #78](https://github.com/nategood/httpful/issues/78) Bug with checking if digest auth is being used. + +## 0.2.3 + + - FIX Overriding default Mime Handlers + - FIX [PR #73](https://github.com/nategood/httpful/pull/73) Parsing http status codes + +## 0.2.2 + + - FEATURE Add support for parsing JSON responses as associative arrays instead of objects + - FEATURE Better support for setting constructor arguments on Mime Handlers + +## 0.2.1 + + - FEATURE [PR #72](https://github.com/nategood/httpful/pull/72) Allow support for custom Accept header + +## 0.2.0 + + - REFACTOR [PR #49](https://github.com/nategood/httpful/pull/49) Broke headers out into their own class + - REFACTOR [PR #54](https://github.com/nategood/httpful/pull/54) Added more specific Exceptions + - FIX [PR #58](https://github.com/nategood/httpful/pull/58) Fixes throwing an error on an empty xml response + - FEATURE [PR #57](https://github.com/nategood/httpful/pull/57) Adds support for digest authentication + +## 0.1.6 + + - Ability to set the number of max redirects via overloading `followRedirects(int max_redirects)` + - Standards Compliant fix to `Accepts` header + - Bug fix for bootstrap process when installed via Composer + +## 0.1.5 + + - Use `DIRECTORY_SEPARATOR` constant [PR #33](https://github.com/nategood/httpful/pull/32) + - [PR #35](https://github.com/nategood/httpful/pull/35) + - Added the raw\_headers property reference to response. + - Compose request header and added raw\_header to Request object. + - Fixed response has errors and added more comments for clarity. + - Fixed header parsing to allow the minimum (status line only) and also cater for the actual CRLF ended headers as per RFC2616. + - Added the perfect test Accept: header for all Acceptable scenarios see @b78e9e82cd9614fbe137c01bde9439c4e16ca323 for details. + - Added default User-Agent header + - `User-Agent: Httpful/0.1.5` + curl version + server software + PHP version + - To bypass this "default" operation simply add a User-Agent to the request headers even a blank User-Agent is sufficient and more than simple enough to produce me thinks. + - Completed test units for additions. + - Added phpunit coverage reporting and helped phpunit auto locate the tests a bit easier. + +## 0.1.4 + + - Add support for CSV Handling [PR #32](https://github.com/nategood/httpful/pull/32) + +## 0.1.3 + + - Handle empty responses in JsonParser and XmlParser + +## 0.1.2 + + - Added support for setting XMLHandler configuration options + - Added examples for overriding XmlHandler and registering a custom parser + - Removed the httpful.php download (deprecated in favor of httpful.phar) + +## 0.1.1 + + - Bug fix serialization default case and phpunit tests + +## 0.1.0 + + - Added Support for Registering Mime Handlers + - Created AbstractMimeHandler type that all Mime Handlers must extend + - Pulled out the parsing/serializing logic from the Request/Response classes into their own MimeHandler classes + - Added ability to register new mime handlers for mime types + diff --git a/dingdingcallback/vendor/nategood/httpful/bootstrap.php b/dingdingcallback/vendor/nategood/httpful/bootstrap.php new file mode 100644 index 00000000..10f2a7cf --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/bootstrap.php @@ -0,0 +1,4 @@ +setStub($stub); +} catch(Exception $e) { + $phar = false; +} +exit_unless($phar, "Unable to create a phar. Make certain you have phar.readonly=0 set in your ini file."); +$phar->buildFromDirectory(dirname($source_dir)); +echo "[ OK ]\n"; + + + +// Add it to git! +//echo "Adding httpful.phar to the repo... "; +//$return_code = 0; +//passthru("git add $phar_path", $return_code); +//exit_unless($return_code === 0, "Unable to add download files to git."); +//echo "[ OK ]\n"; +echo "\nBuild completed successfully.\n\n"; diff --git a/dingdingcallback/vendor/nategood/httpful/composer.json b/dingdingcallback/vendor/nategood/httpful/composer.json new file mode 100644 index 00000000..577fe140 --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/composer.json @@ -0,0 +1,27 @@ +{ + "name": "nategood/httpful", + "description": "A Readable, Chainable, REST friendly, PHP HTTP Client", + "homepage": "http://github.com/nategood/httpful", + "license": "MIT", + "keywords": ["http", "curl", "rest", "restful", "api", "requests"], + "version": "0.2.19", + "authors": [ + { + "name": "Nate Good", + "email": "me@nategood.com", + "homepage": "http://nategood.com" + } + ], + "require": { + "php": ">=5.3", + "ext-curl": "*" + }, + "autoload": { + "psr-0": { + "Httpful": "src/" + } + }, + "require-dev": { + "phpunit/phpunit": "*" + } +} diff --git a/dingdingcallback/vendor/nategood/httpful/examples/freebase.php b/dingdingcallback/vendor/nategood/httpful/examples/freebase.php new file mode 100644 index 00000000..bb3b528f --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/examples/freebase.php @@ -0,0 +1,12 @@ +expectsJson() + ->sendIt(); + +echo 'The Dead Weather has ' . count($response->body->result->album) . " albums.\n"; \ No newline at end of file diff --git a/dingdingcallback/vendor/nategood/httpful/examples/github.php b/dingdingcallback/vendor/nategood/httpful/examples/github.php new file mode 100644 index 00000000..8eb3f3ba --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/examples/github.php @@ -0,0 +1,9 @@ +send(); + +echo "{$request->body->name} joined GitHub on " . date('M jS', strtotime($request->body->{'created-at'})) ."\n"; \ No newline at end of file diff --git a/dingdingcallback/vendor/nategood/httpful/examples/override.php b/dingdingcallback/vendor/nategood/httpful/examples/override.php new file mode 100644 index 00000000..2c3bdd5c --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/examples/override.php @@ -0,0 +1,44 @@ + 'http://example.com'); +\Httpful\Httpful::register(\Httpful\Mime::XML, new \Httpful\Handlers\XmlHandler($conf)); + +// We can also add the parsers with our own... +class SimpleCsvHandler extends \Httpful\Handlers\MimeHandlerAdapter +{ + /** + * Takes a response body, and turns it into + * a two dimensional array. + * + * @param string $body + * @return mixed + */ + public function parse($body) + { + return str_getcsv($body); + } + + /** + * Takes a two dimensional array and turns it + * into a serialized string to include as the + * body of a request + * + * @param mixed $payload + * @return string + */ + public function serialize($payload) + { + $serialized = ''; + foreach ($payload as $line) { + $serialized .= '"' . implode('","', $line) . '"' . "\n"; + } + return $serialized; + } +} + +\Httpful\Httpful::register('text/csv', new SimpleCsvHandler()); \ No newline at end of file diff --git a/dingdingcallback/vendor/nategood/httpful/examples/showclix.php b/dingdingcallback/vendor/nategood/httpful/examples/showclix.php new file mode 100644 index 00000000..861537eb --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/examples/showclix.php @@ -0,0 +1,24 @@ +expectsType('json') + ->send(); + +// Print out the event details +echo "The event {$response->body->event} will take place on {$response->body->event_start}\n"; + +// Example overriding the default JSON handler with one that encodes the response as an array +\Httpful\Httpful::register(\Httpful\Mime::JSON, new \Httpful\Handlers\JsonHandler(array('decode_as_array' => true))); + +$response = Request::get($uri) + ->expectsType('json') + ->send(); + +// Print out the event details +echo "The event {$response->body['event']} will take place on {$response->body['event_start']}\n"; \ No newline at end of file diff --git a/dingdingcallback/vendor/nategood/httpful/src/Httpful/Bootstrap.php b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Bootstrap.php new file mode 100644 index 00000000..3bf62ae6 --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Bootstrap.php @@ -0,0 +1,97 @@ + + */ +class Bootstrap +{ + + const DIR_GLUE = DIRECTORY_SEPARATOR; + const NS_GLUE = '\\'; + + public static $registered = false; + + /** + * Register the autoloader and any other setup needed + */ + public static function init() + { + spl_autoload_register(array('\Httpful\Bootstrap', 'autoload')); + self::registerHandlers(); + } + + /** + * The autoload magic (PSR-0 style) + * + * @param string $classname + */ + public static function autoload($classname) + { + self::_autoload(dirname(dirname(__FILE__)), $classname); + } + + /** + * Register the autoloader and any other setup needed + */ + public static function pharInit() + { + spl_autoload_register(array('\Httpful\Bootstrap', 'pharAutoload')); + self::registerHandlers(); + } + + /** + * Phar specific autoloader + * + * @param string $classname + */ + public static function pharAutoload($classname) + { + self::_autoload('phar://httpful.phar', $classname); + } + + /** + * @param string base + * @param string classname + */ + private static function _autoload($base, $classname) + { + $parts = explode(self::NS_GLUE, $classname); + $path = $base . self::DIR_GLUE . implode(self::DIR_GLUE, $parts) . '.php'; + + if (file_exists($path)) { + require_once($path); + } + } + /** + * Register default mime handlers. Is idempotent. + */ + public static function registerHandlers() + { + if (self::$registered === true) { + return; + } + + // @todo check a conf file to load from that instead of + // hardcoding into the library? + $handlers = array( + \Httpful\Mime::JSON => new \Httpful\Handlers\JsonHandler(), + \Httpful\Mime::XML => new \Httpful\Handlers\XmlHandler(), + \Httpful\Mime::FORM => new \Httpful\Handlers\FormHandler(), + \Httpful\Mime::CSV => new \Httpful\Handlers\CsvHandler(), + ); + + foreach ($handlers as $mime => $handler) { + // Don't overwrite if the handler has already been registered + if (Httpful::hasParserRegistered($mime)) + continue; + Httpful::register($mime, $handler); + } + + self::$registered = true; + } +} diff --git a/dingdingcallback/vendor/nategood/httpful/src/Httpful/Exception/ConnectionErrorException.php b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Exception/ConnectionErrorException.php new file mode 100644 index 00000000..bba73a69 --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Exception/ConnectionErrorException.php @@ -0,0 +1,7 @@ + + */ + +namespace Httpful\Handlers; + +class CsvHandler extends MimeHandlerAdapter +{ + /** + * @param string $body + * @return mixed + */ + public function parse($body) + { + if (empty($body)) + return null; + + $parsed = array(); + $fp = fopen('data://text/plain;base64,' . base64_encode($body), 'r'); + while (($r = fgetcsv($fp)) !== FALSE) { + $parsed[] = $r; + } + + if (empty($parsed)) + throw new \Exception("Unable to parse response as CSV"); + return $parsed; + } + + /** + * @param mixed $payload + * @return string + */ + public function serialize($payload) + { + $fp = fopen('php://temp/maxmemory:'. (6*1024*1024), 'r+'); + $i = 0; + foreach ($payload as $fields) { + if($i++ == 0) { + fputcsv($fp, array_keys($fields)); + } + fputcsv($fp, $fields); + } + rewind($fp); + $data = stream_get_contents($fp); + fclose($fp); + return $data; + } +} diff --git a/dingdingcallback/vendor/nategood/httpful/src/Httpful/Handlers/FormHandler.php b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Handlers/FormHandler.php new file mode 100644 index 00000000..fea1c37c --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Handlers/FormHandler.php @@ -0,0 +1,30 @@ + + */ + +namespace Httpful\Handlers; + +class FormHandler extends MimeHandlerAdapter +{ + /** + * @param string $body + * @return mixed + */ + public function parse($body) + { + $parsed = array(); + parse_str($body, $parsed); + return $parsed; + } + + /** + * @param mixed $payload + * @return string + */ + public function serialize($payload) + { + return http_build_query($payload, null, '&'); + } +} \ No newline at end of file diff --git a/dingdingcallback/vendor/nategood/httpful/src/Httpful/Handlers/JsonHandler.php b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Handlers/JsonHandler.php new file mode 100644 index 00000000..c6543cba --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Handlers/JsonHandler.php @@ -0,0 +1,41 @@ + + */ + +namespace Httpful\Handlers; + +class JsonHandler extends MimeHandlerAdapter +{ + private $decode_as_array = false; + + public function init(array $args) + { + $this->decode_as_array = !!(array_key_exists('decode_as_array', $args) ? $args['decode_as_array'] : false); + } + + /** + * @param string $body + * @return mixed + */ + public function parse($body) + { + $body = $this->stripBom($body); + if (empty($body)) + return null; + $parsed = json_decode($body, $this->decode_as_array); + if (is_null($parsed) && 'null' !== strtolower($body)) + throw new \Exception("Unable to parse response as JSON"); + return $parsed; + } + + /** + * @param mixed $payload + * @return string + */ + public function serialize($payload) + { + return json_encode($payload); + } +} diff --git a/dingdingcallback/vendor/nategood/httpful/src/Httpful/Handlers/MimeHandlerAdapter.php b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Handlers/MimeHandlerAdapter.php new file mode 100644 index 00000000..e57ebb0b --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Handlers/MimeHandlerAdapter.php @@ -0,0 +1,54 @@ +init($args); + } + + /** + * Initial setup of + * @param array $args + */ + public function init(array $args) + { + } + + /** + * @param string $body + * @return mixed + */ + public function parse($body) + { + return $body; + } + + /** + * @param mixed $payload + * @return string + */ + function serialize($payload) + { + return (string) $payload; + } + + protected function stripBom($body) + { + if ( substr($body,0,3) === "\xef\xbb\xbf" ) // UTF-8 + $body = substr($body,3); + else if ( substr($body,0,4) === "\xff\xfe\x00\x00" || substr($body,0,4) === "\x00\x00\xfe\xff" ) // UTF-32 + $body = substr($body,4); + else if ( substr($body,0,2) === "\xff\xfe" || substr($body,0,2) === "\xfe\xff" ) // UTF-16 + $body = substr($body,2); + return $body; + } +} \ No newline at end of file diff --git a/dingdingcallback/vendor/nategood/httpful/src/Httpful/Handlers/README.md b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Handlers/README.md new file mode 100644 index 00000000..5542d406 --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Handlers/README.md @@ -0,0 +1,44 @@ +# Handlers + +Handlers are simple classes that are used to parse response bodies and serialize request payloads. All Handlers must extend the `MimeHandlerAdapter` class and implement two methods: `serialize($payload)` and `parse($response)`. Let's build a very basic Handler to register for the `text/csv` mime type. + + + */ + +namespace Httpful\Handlers; + +class XHtmlHandler extends MimeHandlerAdapter +{ + // @todo add html specific parsing + // see DomDocument::load http://docs.php.net/manual/en/domdocument.loadhtml.php +} \ No newline at end of file diff --git a/dingdingcallback/vendor/nategood/httpful/src/Httpful/Handlers/XmlHandler.php b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Handlers/XmlHandler.php new file mode 100644 index 00000000..84ddf20b --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Handlers/XmlHandler.php @@ -0,0 +1,152 @@ + + * @author Nathan Good + */ + +namespace Httpful\Handlers; + +class XmlHandler extends MimeHandlerAdapter +{ + /** + * @var string $namespace xml namespace to use with simple_load_string + */ + private $namespace; + + /** + * @var int $libxml_opts see http://www.php.net/manual/en/libxml.constants.php + */ + private $libxml_opts; + + /** + * @param array $conf sets configuration options + */ + public function __construct(array $conf = array()) + { + $this->namespace = isset($conf['namespace']) ? $conf['namespace'] : ''; + $this->libxml_opts = isset($conf['libxml_opts']) ? $conf['libxml_opts'] : 0; + } + + /** + * @param string $body + * @return mixed + * @throws Exception if unable to parse + */ + public function parse($body) + { + $body = $this->stripBom($body); + if (empty($body)) + return null; + $parsed = simplexml_load_string($body, null, $this->libxml_opts, $this->namespace); + if ($parsed === false) + throw new \Exception("Unable to parse response as XML"); + return $parsed; + } + + /** + * @param mixed $payload + * @return string + * @throws Exception if unable to serialize + */ + public function serialize($payload) + { + list($_, $dom) = $this->_future_serializeAsXml($payload); + return $dom->saveXml(); + } + + /** + * @param mixed $payload + * @return string + * @author Ted Zellers + */ + public function serialize_clean($payload) + { + $xml = new \XMLWriter; + $xml->openMemory(); + $xml->startDocument('1.0','ISO-8859-1'); + $this->serialize_node($xml, $payload); + return $xml->outputMemory(true); + } + + /** + * @param XMLWriter $xmlw + * @param mixed $node to serialize + * @author Ted Zellers + */ + public function serialize_node(&$xmlw, $node){ + if (!is_array($node)){ + $xmlw->text($node); + } else { + foreach ($node as $k => $v){ + $xmlw->startElement($k); + $this->serialize_node($xmlw, $v); + $xmlw->endElement(); + } + } + } + + /** + * @author Zack Douglas + */ + private function _future_serializeAsXml($value, $node = null, $dom = null) + { + if (!$dom) { + $dom = new \DOMDocument; + } + if (!$node) { + if (!is_object($value)) { + $node = $dom->createElement('response'); + $dom->appendChild($node); + } else { + $node = $dom; + } + } + if (is_object($value)) { + $objNode = $dom->createElement(get_class($value)); + $node->appendChild($objNode); + $this->_future_serializeObjectAsXml($value, $objNode, $dom); + } else if (is_array($value)) { + $arrNode = $dom->createElement('array'); + $node->appendChild($arrNode); + $this->_future_serializeArrayAsXml($value, $arrNode, $dom); + } else if (is_bool($value)) { + $node->appendChild($dom->createTextNode($value?'TRUE':'FALSE')); + } else { + $node->appendChild($dom->createTextNode($value)); + } + return array($node, $dom); + } + /** + * @author Zack Douglas + */ + private function _future_serializeArrayAsXml($value, &$parent, &$dom) + { + foreach ($value as $k => &$v) { + $n = $k; + if (is_numeric($k)) { + $n = "child-{$n}"; + } + $el = $dom->createElement($n); + $parent->appendChild($el); + $this->_future_serializeAsXml($v, $el, $dom); + } + return array($parent, $dom); + } + /** + * @author Zack Douglas + */ + private function _future_serializeObjectAsXml($value, &$parent, &$dom) + { + $refl = new \ReflectionObject($value); + foreach ($refl->getProperties() as $pr) { + if (!$pr->isPrivate()) { + $el = $dom->createElement($pr->getName()); + $parent->appendChild($el); + $this->_future_serializeAsXml($pr->getValue($value), $el, $dom); + } + } + return array($parent, $dom); + } +} \ No newline at end of file diff --git a/dingdingcallback/vendor/nategood/httpful/src/Httpful/Http.php b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Http.php new file mode 100644 index 00000000..59374e93 --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Http.php @@ -0,0 +1,86 @@ + + */ +class Http +{ + const HEAD = 'HEAD'; + const GET = 'GET'; + const POST = 'POST'; + const PUT = 'PUT'; + const DELETE = 'DELETE'; + const PATCH = 'PATCH'; + const OPTIONS = 'OPTIONS'; + const TRACE = 'TRACE'; + + /** + * @return array of HTTP method strings + */ + public static function safeMethods() + { + return array(self::HEAD, self::GET, self::OPTIONS, self::TRACE); + } + + /** + * @return bool + * @param string HTTP method + */ + public static function isSafeMethod($method) + { + return in_array($method, self::safeMethods()); + } + + /** + * @return bool + * @param string HTTP method + */ + public static function isUnsafeMethod($method) + { + return !in_array($method, self::safeMethods()); + } + + /** + * @return array list of (always) idempotent HTTP methods + */ + public static function idempotentMethods() + { + // Though it is possible to be idempotent, POST + // is not guarunteed to be, and more often than + // not, it is not. + return array(self::HEAD, self::GET, self::PUT, self::DELETE, self::OPTIONS, self::TRACE, self::PATCH); + } + + /** + * @return bool + * @param string HTTP method + */ + public static function isIdempotent($method) + { + return in_array($method, self::safeidempotentMethodsMethods()); + } + + /** + * @return bool + * @param string HTTP method + */ + public static function isNotIdempotent($method) + { + return !in_array($method, self::idempotentMethods()); + } + + /** + * @deprecated Technically anything *can* have a body, + * they just don't have semantic meaning. So say's Roy + * http://tech.groups.yahoo.com/group/rest-discuss/message/9962 + * + * @return array of HTTP method strings + */ + public static function canHaveBody() + { + return array(self::POST, self::PUT, self::PATCH, self::OPTIONS); + } + +} \ No newline at end of file diff --git a/dingdingcallback/vendor/nategood/httpful/src/Httpful/Httpful.php b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Httpful.php new file mode 100644 index 00000000..f21b31bf --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Httpful.php @@ -0,0 +1,46 @@ + + */ +class Mime +{ + const JSON = 'application/json'; + const XML = 'application/xml'; + const XHTML = 'application/html+xml'; + const FORM = 'application/x-www-form-urlencoded'; + const UPLOAD = 'multipart/form-data'; + const PLAIN = 'text/plain'; + const JS = 'text/javascript'; + const HTML = 'text/html'; + const YAML = 'application/x-yaml'; + const CSV = 'text/csv'; + + /** + * Map short name for a mime type + * to a full proper mime type + */ + public static $mimes = array( + 'json' => self::JSON, + 'xml' => self::XML, + 'form' => self::FORM, + 'plain' => self::PLAIN, + 'text' => self::PLAIN, + 'upload' => self::UPLOAD, + 'html' => self::HTML, + 'xhtml' => self::XHTML, + 'js' => self::JS, + 'javascript'=> self::JS, + 'yaml' => self::YAML, + 'csv' => self::CSV, + ); + + /** + * Get the full Mime Type name from a "short name". + * Returns the short if no mapping was found. + * @return string full mime type (e.g. application/json) + * @param string common name for mime type (e.g. json) + */ + public static function getFullMime($short_name) + { + return array_key_exists($short_name, self::$mimes) ? self::$mimes[$short_name] : $short_name; + } + + /** + * @return bool + * @param string $short_name + */ + public static function supportsMimeType($short_name) + { + return array_key_exists($short_name, self::$mimes); + } +} diff --git a/dingdingcallback/vendor/nategood/httpful/src/Httpful/Proxy.php b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Proxy.php new file mode 100644 index 00000000..4ab9ea63 --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Proxy.php @@ -0,0 +1,16 @@ + + */ +class Request +{ + + // Option constants + const SERIALIZE_PAYLOAD_NEVER = 0; + const SERIALIZE_PAYLOAD_ALWAYS = 1; + const SERIALIZE_PAYLOAD_SMART = 2; + + const MAX_REDIRECTS_DEFAULT = 25; + + public $uri, + $method = Http::GET, + $headers = array(), + $raw_headers = '', + $strict_ssl = false, + $content_type, + $expected_type, + $additional_curl_opts = array(), + $auto_parse = true, + $serialize_payload_method = self::SERIALIZE_PAYLOAD_SMART, + $username, + $password, + $serialized_payload, + $payload, + $parse_callback, + $error_callback, + $send_callback, + $follow_redirects = false, + $max_redirects = self::MAX_REDIRECTS_DEFAULT, + $payload_serializers = array(); + + // Options + // private $_options = array( + // 'serialize_payload_method' => self::SERIALIZE_PAYLOAD_SMART + // 'auto_parse' => true + // ); + + // Curl Handle + public $_ch, + $_debug; + + // Template Request object + private static $_template; + + /** + * We made the constructor private to force the factory style. This was + * done to keep the syntax cleaner and better the support the idea of + * "default templates". Very basic and flexible as it is only intended + * for internal use. + * @param array $attrs hash of initial attribute values + */ + private function __construct($attrs = null) + { + if (!is_array($attrs)) return; + foreach ($attrs as $attr => $value) { + $this->$attr = $value; + } + } + + // Defaults Management + + /** + * Let's you configure default settings for this + * class from a template Request object. Simply construct a + * Request object as much as you want to and then pass it to + * this method. It will then lock in those settings from + * that template object. + * The most common of which may be default mime + * settings or strict ssl settings. + * Again some slight memory overhead incurred here but in the grand + * scheme of things as it typically only occurs once + * @param Request $template + */ + public static function ini(Request $template) + { + self::$_template = clone $template; + } + + /** + * Reset the default template back to the + * library defaults. + */ + public static function resetIni() + { + self::_initializeDefaults(); + } + + /** + * Get default for a value based on the template object + * @return mixed default value + * @param string|null $attr Name of attribute (e.g. mime, headers) + * if null just return the whole template object; + */ + public static function d($attr) + { + return isset($attr) ? self::$_template->$attr : self::$_template; + } + + // Accessors + + /** + * @return bool does the request have a timeout? + */ + public function hasTimeout() + { + return isset($this->timeout); + } + + /** + * @return bool has the internal curl request been initialized? + */ + public function hasBeenInitialized() + { + return isset($this->_ch); + } + + /** + * @return bool Is this request setup for basic auth? + */ + public function hasBasicAuth() + { + return isset($this->password) && isset($this->username); + } + + /** + * @return bool Is this request setup for digest auth? + */ + public function hasDigestAuth() + { + return isset($this->password) && isset($this->username) && $this->additional_curl_opts[CURLOPT_HTTPAUTH] == CURLAUTH_DIGEST; + } + + /** + * Specify a HTTP timeout + * @return Request $this + * @param float|int $timeout seconds to timeout the HTTP call + */ + public function timeout($timeout) + { + $this->timeout = $timeout; + return $this; + } + + // alias timeout + public function timeoutIn($seconds) + { + return $this->timeout($seconds); + } + + /** + * If the response is a 301 or 302 redirect, automatically + * send off another request to that location + * @return Request $this + * @param bool|int $follow follow or not to follow or maximal number of redirects + */ + public function followRedirects($follow = true) + { + $this->max_redirects = $follow === true ? self::MAX_REDIRECTS_DEFAULT : max(0, $follow); + $this->follow_redirects = (bool) $follow; + return $this; + } + + /** + * @return Request $this + * @see Request::followRedirects() + */ + public function doNotFollowRedirects() + { + return $this->followRedirects(false); + } + + /** + * Actually send off the request, and parse the response + * @return string|associative array of parsed results + * @throws ConnectionErrorException when unable to parse or communicate w server + */ + public function send() + { + if (!$this->hasBeenInitialized()) + $this->_curlPrep(); + + $result = curl_exec($this->_ch); + + if ($result === false) { + if ($curlErrorNumber = curl_errno($this->_ch)) { + $curlErrorString = curl_error($this->_ch); + $this->_error($curlErrorString); + throw new ConnectionErrorException('Unable to connect to "'.$this->uri.'": ' . $curlErrorNumber . ' ' . $curlErrorString); + } + + $this->_error('Unable to connect to "'.$this->uri.'".'); + throw new ConnectionErrorException('Unable to connect to "'.$this->uri.'".'); + } + + $info = curl_getinfo($this->_ch); + + // Remove the "HTTP/1.x 200 Connection established" string and any other headers added by proxy + $proxy_regex = "/HTTP\/1\.[01] 200 Connection established.*?\r\n\r\n/s"; + if ($this->hasProxy() && preg_match($proxy_regex, $result)) { + $result = preg_replace($proxy_regex, '', $result); + } + + $response = explode("\r\n\r\n", $result, 2 + $info['redirect_count']); + + $body = array_pop($response); + $headers = array_pop($response); + + curl_close($this->_ch); + + return new Response($body, $headers, $this, $info); + } + public function sendIt() + { + return $this->send(); + } + + // Setters + + /** + * @return Request this + * @param string $uri + */ + public function uri($uri) + { + $this->uri = $uri; + return $this; + } + + /** + * User Basic Auth. + * Only use when over SSL/TSL/HTTPS. + * @return Request this + * @param string $username + * @param string $password + */ + public function basicAuth($username, $password) + { + $this->username = $username; + $this->password = $password; + return $this; + } + // @alias of basicAuth + public function authenticateWith($username, $password) + { + return $this->basicAuth($username, $password); + } + // @alias of basicAuth + public function authenticateWithBasic($username, $password) + { + return $this->basicAuth($username, $password); + } + + /** + * User Digest Auth. + * @return Request this + * @param string $username + * @param string $password + */ + public function digestAuth($username, $password) + { + $this->addOnCurlOption(CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); + return $this->basicAuth($username, $password); + } + + // @alias of digestAuth + public function authenticateWithDigest($username, $password) + { + return $this->digestAuth($username, $password); + } + + /** + * @return is this request setup for client side cert? + */ + public function hasClientSideCert() + { + return isset($this->client_cert) && isset($this->client_key); + } + + /** + * Use Client Side Cert Authentication + * @return Request $this + * @param string $key file path to client key + * @param string $cert file path to client cert + * @param string $passphrase for client key + * @param string $encoding default PEM + */ + public function clientSideCert($cert, $key, $passphrase = null, $encoding = 'PEM') + { + $this->client_cert = $cert; + $this->client_key = $key; + $this->client_passphrase = $passphrase; + $this->client_encoding = $encoding; + + return $this; + } + // @alias of basicAuth + public function authenticateWithCert($cert, $key, $passphrase = null, $encoding = 'PEM') + { + return $this->clientSideCert($cert, $key, $passphrase, $encoding); + } + + /** + * Set the body of the request + * @return Request this + * @param mixed $payload + * @param string $mimeType currently, sets the sends AND expects mime type although this + * behavior may change in the next minor release (as it is a potential breaking change). + */ + public function body($payload, $mimeType = null) + { + $this->mime($mimeType); + $this->payload = $payload; + // Iserntentially don't call _serializePayload yet. Wait until + // we actually send off the request to convert payload to string. + // At that time, the `serialized_payload` is set accordingly. + return $this; + } + + /** + * Helper function to set the Content type and Expected as same in + * one swoop + * @return Request this + * @param string $mime mime type to use for content type and expected return type + */ + public function mime($mime) + { + if (empty($mime)) return $this; + $this->content_type = $this->expected_type = Mime::getFullMime($mime); + if ($this->isUpload()) { + $this->neverSerializePayload(); + } + return $this; + } + // @alias of mime + public function sendsAndExpectsType($mime) + { + return $this->mime($mime); + } + // @alias of mime + public function sendsAndExpects($mime) + { + return $this->mime($mime); + } + + /** + * Set the method. Shouldn't be called often as the preferred syntax + * for instantiation is the method specific factory methods. + * @return Request this + * @param string $method + */ + public function method($method) + { + if (empty($method)) return $this; + $this->method = $method; + return $this; + } + + /** + * @return Request this + * @param string $mime + */ + public function expects($mime) + { + if (empty($mime)) return $this; + $this->expected_type = Mime::getFullMime($mime); + return $this; + } + // @alias of expects + public function expectsType($mime) + { + return $this->expects($mime); + } + + public function attach($files) + { + $finfo = finfo_open(FILEINFO_MIME_TYPE); + foreach ($files as $key => $file) { + $mimeType = finfo_file($finfo, $file); + if (function_exists('curl_file_create')) { + $this->payload[$key] = curl_file_create($file, $mimeType); + } else { + $this->payload[$key] = '@' . $file . ';type=' . $mimeType; + } + } + $this->sendsType(Mime::UPLOAD); + return $this; + } + + /** + * @return Request this + * @param string $mime + */ + public function contentType($mime) + { + if (empty($mime)) return $this; + $this->content_type = Mime::getFullMime($mime); + if ($this->isUpload()) { + $this->neverSerializePayload(); + } + return $this; + } + // @alias of contentType + public function sends($mime) + { + return $this->contentType($mime); + } + // @alias of contentType + public function sendsType($mime) + { + return $this->contentType($mime); + } + + /** + * Do we strictly enforce SSL verification? + * @return Request this + * @param bool $strict + */ + public function strictSSL($strict) + { + $this->strict_ssl = $strict; + return $this; + } + public function withoutStrictSSL() + { + return $this->strictSSL(false); + } + public function withStrictSSL() + { + return $this->strictSSL(true); + } + + /** + * Use proxy configuration + * @return Request this + * @param string $proxy_host Hostname or address of the proxy + * @param number $proxy_port Port of the proxy. Default 80 + * @param string $auth_type Authentication type or null. Accepted values are CURLAUTH_BASIC, CURLAUTH_NTLM. Default null, no authentication + * @param string $auth_username Authentication username. Default null + * @param string $auth_password Authentication password. Default null + */ + public function useProxy($proxy_host, $proxy_port = 80, $auth_type = null, $auth_username = null, $auth_password = null, $proxy_type = Proxy::HTTP) + { + $this->addOnCurlOption(CURLOPT_PROXY, "{$proxy_host}:{$proxy_port}"); + $this->addOnCurlOption(CURLOPT_PROXYTYPE, $proxy_type); + if (in_array($auth_type, array(CURLAUTH_BASIC,CURLAUTH_NTLM))) { + $this->addOnCurlOption(CURLOPT_PROXYAUTH, $auth_type) + ->addOnCurlOption(CURLOPT_PROXYUSERPWD, "{$auth_username}:{$auth_password}"); + } + return $this; + } + + /** + * Shortcut for useProxy to configure SOCKS 4 proxy + * @see Request::useProxy + * @return Request + */ + public function useSocks4Proxy($proxy_host, $proxy_port = 80, $auth_type = null, $auth_username = null, $auth_password = null) + { + return $this->useProxy($proxy_host, $proxy_port, $auth_type, $auth_username, $auth_password, Proxy::SOCKS4); + } + + /** + * Shortcut for useProxy to configure SOCKS 5 proxy + * @see Request::useProxy + * @return Request + */ + public function useSocks5Proxy($proxy_host, $proxy_port = 80, $auth_type = null, $auth_username = null, $auth_password = null) + { + return $this->useProxy($proxy_host, $proxy_port, $auth_type, $auth_username, $auth_password, Proxy::SOCKS5); + } + + /** + * @return is this request setup for using proxy? + */ + public function hasProxy() + { + return isset($this->additional_curl_opts[CURLOPT_PROXY]) && is_string($this->additional_curl_opts[CURLOPT_PROXY]); + } + + /** + * Determine how/if we use the built in serialization by + * setting the serialize_payload_method + * The default (SERIALIZE_PAYLOAD_SMART) is... + * - if payload is not a scalar (object/array) + * use the appropriate serialize method according to + * the Content-Type of this request. + * - if the payload IS a scalar (int, float, string, bool) + * than just return it as is. + * When this option is set SERIALIZE_PAYLOAD_ALWAYS, + * it will always use the appropriate + * serialize option regardless of whether payload is scalar or not + * When this option is set SERIALIZE_PAYLOAD_NEVER, + * it will never use any of the serialization methods. + * Really the only use for this is if you want the serialize methods + * to handle strings or not (e.g. Blah is not valid JSON, but "Blah" + * is). Forcing the serialization helps prevent that kind of error from + * happening. + * @return Request $this + * @param int $mode + */ + public function serializePayload($mode) + { + $this->serialize_payload_method = $mode; + return $this; + } + + /** + * @see Request::serializePayload() + * @return Request + */ + public function neverSerializePayload() + { + return $this->serializePayload(self::SERIALIZE_PAYLOAD_NEVER); + } + + /** + * This method is the default behavior + * @see Request::serializePayload() + * @return Request + */ + public function smartSerializePayload() + { + return $this->serializePayload(self::SERIALIZE_PAYLOAD_SMART); + } + + /** + * @see Request::serializePayload() + * @return Request + */ + public function alwaysSerializePayload() + { + return $this->serializePayload(self::SERIALIZE_PAYLOAD_ALWAYS); + } + + /** + * Add an additional header to the request + * Can also use the cleaner syntax of + * $Request->withMyHeaderName($my_value); + * @see Request::__call() + * + * @return Request this + * @param string $header_name + * @param string $value + */ + public function addHeader($header_name, $value) + { + $this->headers[$header_name] = $value; + return $this; + } + + /** + * Add group of headers all at once. Note: This is + * here just as a convenience in very specific cases. + * The preferred "readable" way would be to leverage + * the support for custom header methods. + * @return Request $this + * @param array $headers + */ + public function addHeaders(array $headers) + { + foreach ($headers as $header => $value) { + $this->addHeader($header, $value); + } + return $this; + } + + /** + * @return Request + * @param bool $auto_parse perform automatic "smart" + * parsing based on Content-Type or "expectedType" + * If not auto parsing, Response->body returns the body + * as a string. + */ + public function autoParse($auto_parse = true) + { + $this->auto_parse = $auto_parse; + return $this; + } + + /** + * @see Request::autoParse() + * @return Request + */ + public function withoutAutoParsing() + { + return $this->autoParse(false); + } + + /** + * @see Request::autoParse() + * @return Request + */ + public function withAutoParsing() + { + return $this->autoParse(true); + } + + /** + * Use a custom function to parse the response. + * @return Request this + * @param \Closure $callback Takes the raw body of + * the http response and returns a mixed + */ + public function parseWith(\Closure $callback) + { + $this->parse_callback = $callback; + return $this; + } + + /** + * @see Request::parseResponsesWith() + * @return Request $this + * @param \Closure $callback + */ + public function parseResponsesWith(\Closure $callback) + { + return $this->parseWith($callback); + } + + /** + * Callback called to handle HTTP errors. When nothing is set, defaults + * to logging via `error_log` + * @return Request + * @param \Closure $callback (string $error) + */ + public function whenError(\Closure $callback) + { + $this->error_callback = $callback; + return $this; + } + + /** + * Callback invoked after payload has been serialized but before + * the request has been built. + * @return Request this + * @param \Closure $callback (Request $request) + */ + public function beforeSend(\Closure $callback) + { + $this->send_callback = $callback; + return $this; + } + + /** + * Register a callback that will be used to serialize the payload + * for a particular mime type. When using "*" for the mime + * type, it will use that parser for all responses regardless of the mime + * type. If a custom '*' and 'application/json' exist, the custom + * 'application/json' would take precedence over the '*' callback. + * + * @return Request $this + * @param string $mime mime type we're registering + * @param Closure $callback takes one argument, $payload, + * which is the payload that we'll be + */ + public function registerPayloadSerializer($mime, \Closure $callback) + { + $this->payload_serializers[Mime::getFullMime($mime)] = $callback; + return $this; + } + + /** + * @see Request::registerPayloadSerializer() + * @return Request $this + * @param Closure $callback + */ + public function serializePayloadWith(\Closure $callback) + { + return $this->registerPayloadSerializer('*', $callback); + } + + /** + * Magic method allows for neatly setting other headers in a + * similar syntax as the other setters. This method also allows + * for the sends* syntax. + * @return Request this + * @param string $method "missing" method name called + * the method name called should be the name of the header that you + * are trying to set in camel case without dashes e.g. to set a + * header for Content-Type you would use contentType() or more commonly + * to add a custom header like X-My-Header, you would use xMyHeader(). + * To promote readability, you can optionally prefix these methods with + * "with" (e.g. withXMyHeader("blah") instead of xMyHeader("blah")). + * @param array $args in this case, there should only ever be 1 argument provided + * and that argument should be a string value of the header we're setting + */ + public function __call($method, $args) + { + // This method supports the sends* methods + // like sendsJSON, sendsForm + //!method_exists($this, $method) && + if (substr($method, 0, 5) === 'sends') { + $mime = strtolower(substr($method, 5)); + if (Mime::supportsMimeType($mime)) { + $this->sends(Mime::getFullMime($mime)); + return $this; + } + // else { + // throw new \Exception("Unsupported Content-Type $mime"); + // } + } + if (substr($method, 0, 7) === 'expects') { + $mime = strtolower(substr($method, 7)); + if (Mime::supportsMimeType($mime)) { + $this->expects(Mime::getFullMime($mime)); + return $this; + } + // else { + // throw new \Exception("Unsupported Content-Type $mime"); + // } + } + + // This method also adds the custom header support as described in the + // method comments + if (count($args) === 0) + return; + + // Strip the sugar. If it leads with "with", strip. + // This is okay because: No defined HTTP headers begin with with, + // and if you are defining a custom header, the standard is to prefix it + // with an "X-", so that should take care of any collisions. + if (substr($method, 0, 4) === 'with') + $method = substr($method, 4); + + // Precede upper case letters with dashes, uppercase the first letter of method + $header = ucwords(implode('-', preg_split('/([A-Z][^A-Z]*)/', $method, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY))); + $this->addHeader($header, $args[0]); + return $this; + } + + // Internal Functions + + /** + * This is the default template to use if no + * template has been provided. The template + * tells the class which default values to use. + * While there is a slight overhead for object + * creation once per execution (not once per + * Request instantiation), it promotes readability + * and flexibility within the class. + */ + private static function _initializeDefaults() + { + // This is the only place you will + // see this constructor syntax. It + // is only done here to prevent infinite + // recusion. Do not use this syntax elsewhere. + // It goes against the whole readability + // and transparency idea. + self::$_template = new Request(array('method' => Http::GET)); + + // This is more like it... + self::$_template + ->withoutStrictSSL(); + } + + /** + * Set the defaults on a newly instantiated object + * Doesn't copy variables prefixed with _ + * @return Request this + */ + private function _setDefaults() + { + if (!isset(self::$_template)) + self::_initializeDefaults(); + foreach (self::$_template as $k=>$v) { + if ($k[0] != '_') + $this->$k = $v; + } + return $this; + } + + private function _error($error) + { + // TODO add in support for various Loggers that follow + // PSR 3 https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md + if (isset($this->error_callback)) { + $this->error_callback->__invoke($error); + } else { + error_log($error); + } + } + + /** + * Factory style constructor works nicer for chaining. This + * should also really only be used internally. The Request::get, + * Request::post syntax is preferred as it is more readable. + * @return Request + * @param string $method Http Method + * @param string $mime Mime Type to Use + */ + public static function init($method = null, $mime = null) + { + // Setup our handlers, can call it here as it's idempotent + Bootstrap::init(); + + // Setup the default template if need be + if (!isset(self::$_template)) + self::_initializeDefaults(); + + $request = new Request(); + return $request + ->_setDefaults() + ->method($method) + ->sendsType($mime) + ->expectsType($mime); + } + + /** + * Does the heavy lifting. Uses de facto HTTP + * library cURL to set up the HTTP request. + * Note: It does NOT actually send the request + * @return Request $this; + */ + public function _curlPrep() + { + // Check for required stuff + if (!isset($this->uri)) + throw new \Exception('Attempting to send a request before defining a URI endpoint.'); + + if (isset($this->payload)) { + $this->serialized_payload = $this->_serializePayload($this->payload); + } + + if (isset($this->send_callback)) { + call_user_func($this->send_callback, $this); + } + + $ch = curl_init($this->uri); + + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $this->method); + if ($this->method === Http::HEAD) { + curl_setopt($ch, CURLOPT_NOBODY, true); + } + + if ($this->hasBasicAuth()) { + curl_setopt($ch, CURLOPT_USERPWD, $this->username . ':' . $this->password); + } + + if ($this->hasClientSideCert()) { + + if (!file_exists($this->client_key)) + throw new \Exception('Could not read Client Key'); + + if (!file_exists($this->client_cert)) + throw new \Exception('Could not read Client Certificate'); + + curl_setopt($ch, CURLOPT_SSLCERTTYPE, $this->client_encoding); + curl_setopt($ch, CURLOPT_SSLKEYTYPE, $this->client_encoding); + curl_setopt($ch, CURLOPT_SSLCERT, $this->client_cert); + curl_setopt($ch, CURLOPT_SSLKEY, $this->client_key); + curl_setopt($ch, CURLOPT_SSLKEYPASSWD, $this->client_passphrase); + // curl_setopt($ch, CURLOPT_SSLCERTPASSWD, $this->client_cert_passphrase); + } + + if ($this->hasTimeout()) { + if (defined('CURLOPT_TIMEOUT_MS')) { + curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->timeout * 1000); + } else { + curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout); + } + } + + if ($this->follow_redirects) { + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($ch, CURLOPT_MAXREDIRS, $this->max_redirects); + } + + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->strict_ssl); + // zero is safe for all curl versions + $verifyValue = $this->strict_ssl + 0; + //Support for value 1 removed in cURL 7.28.1 value 2 valid in all versions + if ($verifyValue > 0) $verifyValue++; + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $verifyValue); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + + // https://github.com/nategood/httpful/issues/84 + // set Content-Length to the size of the payload if present + if (isset($this->payload)) { + curl_setopt($ch, CURLOPT_POSTFIELDS, $this->serialized_payload); + if (!$this->isUpload()) { + $this->headers['Content-Length'] = + $this->_determineLength($this->serialized_payload); + } + } + + $headers = array(); + // https://github.com/nategood/httpful/issues/37 + // Except header removes any HTTP 1.1 Continue from response headers + $headers[] = 'Expect:'; + + if (!isset($this->headers['User-Agent'])) { + $headers[] = $this->buildUserAgent(); + } + + $headers[] = "Content-Type: {$this->content_type}"; + + // allow custom Accept header if set + if (!isset($this->headers['Accept'])) { + // http://pretty-rfc.herokuapp.com/RFC2616#header.accept + $accept = 'Accept: */*; q=0.5, text/plain; q=0.8, text/html;level=3;'; + + if (!empty($this->expected_type)) { + $accept .= "q=0.9, {$this->expected_type}"; + } + + $headers[] = $accept; + } + + // Solve a bug on squid proxy, NONE/411 when miss content length + if (!isset($this->headers['Content-Length']) && !$this->isUpload()) { + $this->headers['Content-Length'] = 0; + } + + foreach ($this->headers as $header => $value) { + $headers[] = "$header: $value"; + } + + $url = \parse_url($this->uri); + $path = (isset($url['path']) ? $url['path'] : '/').(isset($url['query']) ? '?'.$url['query'] : ''); + $this->raw_headers = "{$this->method} $path HTTP/1.1\r\n"; + $host = (isset($url['host']) ? $url['host'] : 'localhost').(isset($url['port']) ? ':'.$url['port'] : ''); + $this->raw_headers .= "Host: $host\r\n"; + $this->raw_headers .= \implode("\r\n", $headers); + $this->raw_headers .= "\r\n"; + + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + + if ($this->_debug) { + curl_setopt($ch, CURLOPT_VERBOSE, true); + } + + curl_setopt($ch, CURLOPT_HEADER, 1); + + // If there are some additional curl opts that the user wants + // to set, we can tack them in here + foreach ($this->additional_curl_opts as $curlopt => $curlval) { + curl_setopt($ch, $curlopt, $curlval); + } + + $this->_ch = $ch; + + return $this; + } + + /** + * @return int length of payload in bytes + * @param string $str payload + */ + public function _determineLength($str) + { + if (function_exists('mb_strlen')) { + return mb_strlen($str, '8bit'); + } else { + return strlen($str); + } + } + + /** + * @return bool + */ + public function isUpload() + { + return Mime::UPLOAD == $this->content_type; + } + + /** + * @return string + */ + public function buildUserAgent() + { + $user_agent = 'User-Agent: Httpful/' . Httpful::VERSION . ' (cURL/'; + $curl = \curl_version(); + + if (isset($curl['version'])) { + $user_agent .= $curl['version']; + } else { + $user_agent .= '?.?.?'; + } + + $user_agent .= ' PHP/'. PHP_VERSION . ' (' . PHP_OS . ')'; + + if (isset($_SERVER['SERVER_SOFTWARE'])) { + $user_agent .= ' ' . \preg_replace('~PHP/[\d\.]+~U', '', + $_SERVER['SERVER_SOFTWARE']); + } else { + if (isset($_SERVER['TERM_PROGRAM'])) { + $user_agent .= " {$_SERVER['TERM_PROGRAM']}"; + } + + if (isset($_SERVER['TERM_PROGRAM_VERSION'])) { + $user_agent .= "/{$_SERVER['TERM_PROGRAM_VERSION']}"; + } + } + + if (isset($_SERVER['HTTP_USER_AGENT'])) { + $user_agent .= " {$_SERVER['HTTP_USER_AGENT']}"; + } + + $user_agent .= ')'; + + return $user_agent; + } + + /** + * Semi-reluctantly added this as a way to add in curl opts + * that are not otherwise accessible from the rest of the API. + * @return Request $this + * @param string $curlopt + * @param mixed $curloptval + */ + public function addOnCurlOption($curlopt, $curloptval) + { + $this->additional_curl_opts[$curlopt] = $curloptval; + return $this; + } + + /** + * Turn payload from structured data into + * a string based on the current Mime type. + * This uses the auto_serialize option to determine + * it's course of action. See serialize method for more. + * Renamed from _detectPayload to _serializePayload as of + * 2012-02-15. + * + * Added in support for custom payload serializers. + * The serialize_payload_method stuff still holds true though. + * @see Request::registerPayloadSerializer() + * + * @return string + * @param mixed $payload + */ + private function _serializePayload($payload) + { + if (empty($payload) || $this->serialize_payload_method === self::SERIALIZE_PAYLOAD_NEVER) + return $payload; + + // When we are in "smart" mode, don't serialize strings/scalars, assume they are already serialized + if ($this->serialize_payload_method === self::SERIALIZE_PAYLOAD_SMART && is_scalar($payload)) + return $payload; + + // Use a custom serializer if one is registered for this mime type + if (isset($this->payload_serializers['*']) || isset($this->payload_serializers[$this->content_type])) { + $key = isset($this->payload_serializers[$this->content_type]) ? $this->content_type : '*'; + return call_user_func($this->payload_serializers[$key], $payload); + } + + return Httpful::get($this->content_type)->serialize($payload); + } + + /** + * HTTP Method Get + * @return Request + * @param string $uri optional uri to use + * @param string $mime expected + */ + public static function get($uri, $mime = null) + { + return self::init(Http::GET)->uri($uri)->mime($mime); + } + + + /** + * Like Request:::get, except that it sends off the request as well + * returning a response + * @return Response + * @param string $uri optional uri to use + * @param string $mime expected + */ + public static function getQuick($uri, $mime = null) + { + return self::get($uri, $mime)->send(); + } + + /** + * HTTP Method Post + * @return Request + * @param string $uri optional uri to use + * @param string $payload data to send in body of request + * @param string $mime MIME to use for Content-Type + */ + public static function post($uri, $payload = null, $mime = null) + { + return self::init(Http::POST)->uri($uri)->body($payload, $mime); + } + + /** + * HTTP Method Put + * @return Request + * @param string $uri optional uri to use + * @param string $payload data to send in body of request + * @param string $mime MIME to use for Content-Type + */ + public static function put($uri, $payload = null, $mime = null) + { + return self::init(Http::PUT)->uri($uri)->body($payload, $mime); + } + + /** + * HTTP Method Patch + * @return Request + * @param string $uri optional uri to use + * @param string $payload data to send in body of request + * @param string $mime MIME to use for Content-Type + */ + public static function patch($uri, $payload = null, $mime = null) + { + return self::init(Http::PATCH)->uri($uri)->body($payload, $mime); + } + + /** + * HTTP Method Delete + * @return Request + * @param string $uri optional uri to use + */ + public static function delete($uri, $mime = null) + { + return self::init(Http::DELETE)->uri($uri)->mime($mime); + } + + /** + * HTTP Method Head + * @return Request + * @param string $uri optional uri to use + */ + public static function head($uri) + { + return self::init(Http::HEAD)->uri($uri); + } + + /** + * HTTP Method Options + * @return Request + * @param string $uri optional uri to use + */ + public static function options($uri) + { + return self::init(Http::OPTIONS)->uri($uri); + } +} diff --git a/dingdingcallback/vendor/nategood/httpful/src/Httpful/Response.php b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Response.php new file mode 100644 index 00000000..9a0e7cf9 --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Response.php @@ -0,0 +1,194 @@ + + */ +class Response +{ + + public $body, + $raw_body, + $headers, + $raw_headers, + $request, + $code = 0, + $content_type, + $parent_type, + $charset, + $meta_data, + $is_mime_vendor_specific = false, + $is_mime_personal = false; + + private $parsers; + /** + * @param string $body + * @param string $headers + * @param Request $request + * @param array $meta_data + */ + public function __construct($body, $headers, Request $request, array $meta_data = array()) + { + $this->request = $request; + $this->raw_headers = $headers; + $this->raw_body = $body; + $this->meta_data = $meta_data; + + $this->code = $this->_parseCode($headers); + $this->headers = Response\Headers::fromString($headers); + + $this->_interpretHeaders(); + + $this->body = $this->_parse($body); + } + + /** + * Status Code Definitions + * + * Informational 1xx + * Successful 2xx + * Redirection 3xx + * Client Error 4xx + * Server Error 5xx + * + * http://pretty-rfc.herokuapp.com/RFC2616#status.codes + * + * @return bool Did we receive a 4xx or 5xx? + */ + public function hasErrors() + { + return $this->code >= 400; + } + + /** + * @return return bool + */ + public function hasBody() + { + return !empty($this->body); + } + + /** + * Parse the response into a clean data structure + * (most often an associative array) based on the expected + * Mime type. + * @return array|string|object the response parse accordingly + * @param string Http response body + */ + public function _parse($body) + { + // If the user decided to forgo the automatic + // smart parsing, short circuit. + if (!$this->request->auto_parse) { + return $body; + } + + // If provided, use custom parsing callback + if (isset($this->request->parse_callback)) { + return call_user_func($this->request->parse_callback, $body); + } + + // Decide how to parse the body of the response in the following order + // 1. If provided, use the mime type specifically set as part of the `Request` + // 2. If a MimeHandler is registered for the content type, use it + // 3. If provided, use the "parent type" of the mime type from the response + // 4. Default to the content-type provided in the response + $parse_with = $this->request->expected_type; + if (empty($this->request->expected_type)) { + $parse_with = Httpful::hasParserRegistered($this->content_type) + ? $this->content_type + : $this->parent_type; + } + + return Httpful::get($parse_with)->parse($body); + } + + /** + * Parse text headers from response into + * array of key value pairs + * @return array parse headers + * @param string $headers raw headers + */ + public function _parseHeaders($headers) + { + $headers = preg_split("/(\r|\n)+/", $headers, -1, \PREG_SPLIT_NO_EMPTY); + $parse_headers = array(); + for ($i = 1; $i < count($headers); $i++) { + list($key, $raw_value) = explode(':', $headers[$i], 2); + $key = trim($key); + $value = trim($raw_value); + if (array_key_exists($key, $parse_headers)) { + // See HTTP RFC Sec 4.2 Paragraph 5 + // http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 + // If a header appears more than once, it must also be able to + // be represented as a single header with a comma-separated + // list of values. We transform accordingly. + $parse_headers[$key] .= ',' . $value; + } else { + $parse_headers[$key] = $value; + } + } + return $parse_headers; + } + + public function _parseCode($headers) + { + $end = strpos($headers, "\r\n"); + if ($end === false) $end = strlen($headers); + $parts = explode(' ', substr($headers, 0, $end)); + if (count($parts) < 2 || !is_numeric($parts[1])) { + throw new \Exception("Unable to parse response code from HTTP response due to malformed response"); + } + return intval($parts[1]); + } + + /** + * After we've parse the headers, let's clean things + * up a bit and treat some headers specially + */ + public function _interpretHeaders() + { + // Parse the Content-Type and charset + $content_type = isset($this->headers['Content-Type']) ? $this->headers['Content-Type'] : ''; + $content_type = explode(';', $content_type); + + $this->content_type = $content_type[0]; + if (count($content_type) == 2 && strpos($content_type[1], '=') !== false) { + list($nill, $this->charset) = explode('=', $content_type[1]); + } + + // RFC 2616 states "text/*" Content-Types should have a default + // charset of ISO-8859-1. "application/*" and other Content-Types + // are assumed to have UTF-8 unless otherwise specified. + // http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7.1 + // http://www.w3.org/International/O-HTTP-charset.en.php + if (!isset($this->charset)) { + $this->charset = substr($this->content_type, 5) === 'text/' ? 'iso-8859-1' : 'utf-8'; + } + + // Is vendor type? Is personal type? + if (strpos($this->content_type, '/') !== false) { + list($type, $sub_type) = explode('/', $this->content_type); + $this->is_mime_vendor_specific = substr($sub_type, 0, 4) === 'vnd.'; + $this->is_mime_personal = substr($sub_type, 0, 4) === 'prs.'; + } + + // Parent type (e.g. xml for application/vnd.github.message+xml) + $this->parent_type = $this->content_type; + if (strpos($this->content_type, '+') !== false) { + list($vendor, $this->parent_type) = explode('+', $this->content_type, 2); + $this->parent_type = Mime::getFullMime($this->parent_type); + } + } + + /** + * @return string + */ + public function __toString() + { + return $this->raw_body; + } +} diff --git a/dingdingcallback/vendor/nategood/httpful/src/Httpful/Response/Headers.php b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Response/Headers.php new file mode 100644 index 00000000..7abc57dd --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/src/Httpful/Response/Headers.php @@ -0,0 +1,58 @@ +headers = $headers; + } + + public static function fromString($string) + { + $lines = preg_split("/(\r|\n)+/", $string, -1, PREG_SPLIT_NO_EMPTY); + array_shift($lines); // HTTP HEADER + $headers = array(); + foreach ($lines as $line) { + list($name, $value) = explode(':', $line, 2); + $headers[strtolower(trim($name))] = trim($value); + } + return new self($headers); + } + + public function offsetExists($offset) + { + return isset($this->headers[strtolower($offset)]); + } + + public function offsetGet($offset) + { + if (isset($this->headers[$name = strtolower($offset)])) { + return $this->headers[$name]; + } + } + + public function offsetSet($offset, $value) + { + throw new \Exception("Headers are read-only."); + } + + public function offsetUnset($offset) + { + throw new \Exception("Headers are read-only."); + } + + public function count() + { + return count($this->headers); + } + + public function toArray() + { + return $this->headers; + } + +} \ No newline at end of file diff --git a/dingdingcallback/vendor/nategood/httpful/tests/Httpful/HttpfulTest.php b/dingdingcallback/vendor/nategood/httpful/tests/Httpful/HttpfulTest.php new file mode 100644 index 00000000..ad74d0d1 --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/tests/Httpful/HttpfulTest.php @@ -0,0 +1,604 @@ + + */ +namespace Httpful\Test; + +require(dirname(dirname(dirname(__FILE__))) . '/bootstrap.php'); +\Httpful\Bootstrap::init(); + +use Httpful\Httpful; +use Httpful\Request; +use Httpful\Mime; +use Httpful\Http; +use Httpful\Response; +use Httpful\Handlers\JsonHandler; + +define('TEST_SERVER', WEB_SERVER_HOST . ':' . WEB_SERVER_PORT); + +class HttpfulTest extends \PHPUnit_Framework_TestCase +{ + const TEST_SERVER = TEST_SERVER; + const TEST_URL = 'http://127.0.0.1:8008'; + const TEST_URL_400 = 'http://127.0.0.1:8008/400'; + + const SAMPLE_JSON_HEADER = +"HTTP/1.1 200 OK +Content-Type: application/json +Connection: keep-alive +Transfer-Encoding: chunked\r\n"; + const SAMPLE_JSON_RESPONSE = '{"key":"value","object":{"key":"value"},"array":[1,2,3,4]}'; + const SAMPLE_CSV_HEADER = +"HTTP/1.1 200 OK +Content-Type: text/csv +Connection: keep-alive +Transfer-Encoding: chunked\r\n"; + const SAMPLE_CSV_RESPONSE = +"Key1,Key2 +Value1,Value2 +\"40.0\",\"Forty\""; + const SAMPLE_XML_RESPONSE = '2a stringTRUE'; + const SAMPLE_XML_HEADER = +"HTTP/1.1 200 OK +Content-Type: application/xml +Connection: keep-alive +Transfer-Encoding: chunked\r\n"; + const SAMPLE_VENDOR_HEADER = +"HTTP/1.1 200 OK +Content-Type: application/vnd.nategood.message+xml +Connection: keep-alive +Transfer-Encoding: chunked\r\n"; + const SAMPLE_VENDOR_TYPE = "application/vnd.nategood.message+xml"; + const SAMPLE_MULTI_HEADER = +"HTTP/1.1 200 OK +Content-Type: application/json +Connection: keep-alive +Transfer-Encoding: chunked +X-My-Header:Value1 +X-My-Header:Value2\r\n"; + + function testInit() + { + $r = Request::init(); + // Did we get a 'Request' object? + $this->assertEquals('Httpful\Request', get_class($r)); + } + + function testDetermineLength() + { + $r = Request::init(); + $this->assertEquals(1, $r->_determineLength('A')); + $this->assertEquals(2, $r->_determineLength('À')); + $this->assertEquals(2, $r->_determineLength('Ab')); + $this->assertEquals(3, $r->_determineLength('Àb')); + $this->assertEquals(6, $r->_determineLength('世界')); + } + + function testMethods() + { + $valid_methods = array('get', 'post', 'delete', 'put', 'options', 'head'); + $url = 'http://example.com/'; + foreach ($valid_methods as $method) { + $r = call_user_func(array('Httpful\Request', $method), $url); + $this->assertEquals('Httpful\Request', get_class($r)); + $this->assertEquals(strtoupper($method), $r->method); + } + } + + function testDefaults() + { + // Our current defaults are as follows + $r = Request::init(); + $this->assertEquals(Http::GET, $r->method); + $this->assertFalse($r->strict_ssl); + } + + function testShortMime() + { + // Valid short ones + $this->assertEquals(Mime::JSON, Mime::getFullMime('json')); + $this->assertEquals(Mime::XML, Mime::getFullMime('xml')); + $this->assertEquals(Mime::HTML, Mime::getFullMime('html')); + $this->assertEquals(Mime::CSV, Mime::getFullMime('csv')); + $this->assertEquals(Mime::UPLOAD, Mime::getFullMime('upload')); + + // Valid long ones + $this->assertEquals(Mime::JSON, Mime::getFullMime(Mime::JSON)); + $this->assertEquals(Mime::XML, Mime::getFullMime(Mime::XML)); + $this->assertEquals(Mime::HTML, Mime::getFullMime(Mime::HTML)); + $this->assertEquals(Mime::CSV, Mime::getFullMime(Mime::CSV)); + $this->assertEquals(Mime::UPLOAD, Mime::getFullMime(Mime::UPLOAD)); + + // No false positives + $this->assertNotEquals(Mime::XML, Mime::getFullMime(Mime::HTML)); + $this->assertNotEquals(Mime::JSON, Mime::getFullMime(Mime::XML)); + $this->assertNotEquals(Mime::HTML, Mime::getFullMime(Mime::JSON)); + $this->assertNotEquals(Mime::XML, Mime::getFullMime(Mime::CSV)); + } + + function testSettingStrictSsl() + { + $r = Request::init() + ->withStrictSsl(); + + $this->assertTrue($r->strict_ssl); + + $r = Request::init() + ->withoutStrictSsl(); + + $this->assertFalse($r->strict_ssl); + } + + function testSendsAndExpectsType() + { + $r = Request::init() + ->sendsAndExpectsType(Mime::JSON); + $this->assertEquals(Mime::JSON, $r->expected_type); + $this->assertEquals(Mime::JSON, $r->content_type); + + $r = Request::init() + ->sendsAndExpectsType('html'); + $this->assertEquals(Mime::HTML, $r->expected_type); + $this->assertEquals(Mime::HTML, $r->content_type); + + $r = Request::init() + ->sendsAndExpectsType('form'); + $this->assertEquals(Mime::FORM, $r->expected_type); + $this->assertEquals(Mime::FORM, $r->content_type); + + $r = Request::init() + ->sendsAndExpectsType('application/x-www-form-urlencoded'); + $this->assertEquals(Mime::FORM, $r->expected_type); + $this->assertEquals(Mime::FORM, $r->content_type); + + $r = Request::init() + ->sendsAndExpectsType(Mime::CSV); + $this->assertEquals(Mime::CSV, $r->expected_type); + $this->assertEquals(Mime::CSV, $r->content_type); + } + + function testIni() + { + // Test setting defaults/templates + + // Create the template + $template = Request::init() + ->method(Http::POST) + ->withStrictSsl() + ->expectsType(Mime::HTML) + ->sendsType(Mime::FORM); + + Request::ini($template); + + $r = Request::init(); + + $this->assertTrue($r->strict_ssl); + $this->assertEquals(Http::POST, $r->method); + $this->assertEquals(Mime::HTML, $r->expected_type); + $this->assertEquals(Mime::FORM, $r->content_type); + + // Test the default accessor as well + $this->assertTrue(Request::d('strict_ssl')); + $this->assertEquals(Http::POST, Request::d('method')); + $this->assertEquals(Mime::HTML, Request::d('expected_type')); + $this->assertEquals(Mime::FORM, Request::d('content_type')); + + Request::resetIni(); + } + + function testAccept() + { + $r = Request::get('http://example.com/') + ->expectsType(Mime::JSON); + + $this->assertEquals(Mime::JSON, $r->expected_type); + $r->_curlPrep(); + $this->assertContains('application/json', $r->raw_headers); + } + + function testCustomAccept() + { + $accept = 'application/api-1.0+json'; + $r = Request::get('http://example.com/') + ->addHeader('Accept', $accept); + + $r->_curlPrep(); + $this->assertContains($accept, $r->raw_headers); + $this->assertEquals($accept, $r->headers['Accept']); + } + + function testUserAgent() + { + $r = Request::get('http://example.com/') + ->withUserAgent('ACME/1.2.3'); + + $this->assertArrayHasKey('User-Agent', $r->headers); + $r->_curlPrep(); + $this->assertContains('User-Agent: ACME/1.2.3', $r->raw_headers); + $this->assertNotContains('User-Agent: HttpFul/1.0', $r->raw_headers); + + $r = Request::get('http://example.com/') + ->withUserAgent(''); + + $this->assertArrayHasKey('User-Agent', $r->headers); + $r->_curlPrep(); + $this->assertContains('User-Agent:', $r->raw_headers); + $this->assertNotContains('User-Agent: HttpFul/1.0', $r->raw_headers); + } + + function testAuthSetup() + { + $username = 'nathan'; + $password = 'opensesame'; + + $r = Request::get('http://example.com/') + ->authenticateWith($username, $password); + + $this->assertEquals($username, $r->username); + $this->assertEquals($password, $r->password); + $this->assertTrue($r->hasBasicAuth()); + } + + function testDigestAuthSetup() + { + $username = 'nathan'; + $password = 'opensesame'; + + $r = Request::get('http://example.com/') + ->authenticateWithDigest($username, $password); + + $this->assertEquals($username, $r->username); + $this->assertEquals($password, $r->password); + $this->assertTrue($r->hasDigestAuth()); + } + + function testJsonResponseParse() + { + $req = Request::init()->sendsAndExpects(Mime::JSON); + $response = new Response(self::SAMPLE_JSON_RESPONSE, self::SAMPLE_JSON_HEADER, $req); + + $this->assertEquals("value", $response->body->key); + $this->assertEquals("value", $response->body->object->key); + $this->assertInternalType('array', $response->body->array); + $this->assertEquals(1, $response->body->array[0]); + } + + function testXMLResponseParse() + { + $req = Request::init()->sendsAndExpects(Mime::XML); + $response = new Response(self::SAMPLE_XML_RESPONSE, self::SAMPLE_XML_HEADER, $req); + $sxe = $response->body; + $this->assertEquals("object", gettype($sxe)); + $this->assertEquals("SimpleXMLElement", get_class($sxe)); + $bools = $sxe->xpath('/stdClass/boolProp'); + list( , $bool ) = each($bools); + $this->assertEquals("TRUE", (string) $bool); + $ints = $sxe->xpath('/stdClass/arrayProp/array/k1/myClass/intProp'); + list( , $int ) = each($ints); + $this->assertEquals("2", (string) $int); + $strings = $sxe->xpath('/stdClass/stringProp'); + list( , $string ) = each($strings); + $this->assertEquals("a string", (string) $string); + } + + function testCsvResponseParse() + { + $req = Request::init()->sendsAndExpects(Mime::CSV); + $response = new Response(self::SAMPLE_CSV_RESPONSE, self::SAMPLE_CSV_HEADER, $req); + + $this->assertEquals("Key1", $response->body[0][0]); + $this->assertEquals("Value1", $response->body[1][0]); + $this->assertInternalType('string', $response->body[2][0]); + $this->assertEquals("40.0", $response->body[2][0]); + } + + function testParsingContentTypeCharset() + { + $req = Request::init()->sendsAndExpects(Mime::JSON); + // $response = new Response(SAMPLE_JSON_RESPONSE, "", $req); + // // Check default content type of iso-8859-1 + $response = new Response(self::SAMPLE_JSON_RESPONSE, "HTTP/1.1 200 OK +Content-Type: text/plain; charset=utf-8\r\n", $req); + $this->assertInstanceOf('Httpful\Response\Headers', $response->headers); + $this->assertEquals($response->headers['Content-Type'], 'text/plain; charset=utf-8'); + $this->assertEquals($response->content_type, 'text/plain'); + $this->assertEquals($response->charset, 'utf-8'); + } + + function testParsingContentTypeUpload() + { + $req = Request::init(); + + $req->sendsType(Mime::UPLOAD); + // $response = new Response(SAMPLE_JSON_RESPONSE, "", $req); + // // Check default content type of iso-8859-1 + $this->assertEquals($req->content_type, 'multipart/form-data'); + } + + function testAttach() { + $req = Request::init(); + $testsPath = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..'); + $filename = $testsPath . DIRECTORY_SEPARATOR . 'test_image.jpg'; + $req->attach(array('index' => $filename)); + $payload = $req->payload['index']; + // PHP 5.5 + will take advantage of CURLFile while previous + // versions just use the string syntax + if (is_string($payload)) { + $this->assertEquals($payload, '@' . $filename . ';type=image/jpeg'); + } else { + $this->assertInstanceOf('CURLFile', $payload); + } + + $this->assertEquals($req->content_type, Mime::UPLOAD); + $this->assertEquals($req->serialize_payload_method, Request::SERIALIZE_PAYLOAD_NEVER); + } + + function testIsUpload() { + $req = Request::init(); + + $req->sendsType(Mime::UPLOAD); + + $this->assertTrue($req->isUpload()); + } + + function testEmptyResponseParse() + { + $req = Request::init()->sendsAndExpects(Mime::JSON); + $response = new Response("", self::SAMPLE_JSON_HEADER, $req); + $this->assertEquals(null, $response->body); + + $reqXml = Request::init()->sendsAndExpects(Mime::XML); + $responseXml = new Response("", self::SAMPLE_XML_HEADER, $reqXml); + $this->assertEquals(null, $responseXml->body); + } + + function testNoAutoParse() + { + $req = Request::init()->sendsAndExpects(Mime::JSON)->withoutAutoParsing(); + $response = new Response(self::SAMPLE_JSON_RESPONSE, self::SAMPLE_JSON_HEADER, $req); + $this->assertInternalType('string', $response->body); + $req = Request::init()->sendsAndExpects(Mime::JSON)->withAutoParsing(); + $response = new Response(self::SAMPLE_JSON_RESPONSE, self::SAMPLE_JSON_HEADER, $req); + $this->assertInternalType('object', $response->body); + } + + function testParseHeaders() + { + $req = Request::init()->sendsAndExpects(Mime::JSON); + $response = new Response(self::SAMPLE_JSON_RESPONSE, self::SAMPLE_JSON_HEADER, $req); + $this->assertEquals('application/json', $response->headers['Content-Type']); + } + + function testRawHeaders() + { + $req = Request::init()->sendsAndExpects(Mime::JSON); + $response = new Response(self::SAMPLE_JSON_RESPONSE, self::SAMPLE_JSON_HEADER, $req); + $this->assertContains('Content-Type: application/json', $response->raw_headers); + } + + function testHasErrors() + { + $req = Request::init()->sendsAndExpects(Mime::JSON); + $response = new Response('', "HTTP/1.1 100 Continue\r\n", $req); + $this->assertFalse($response->hasErrors()); + $response = new Response('', "HTTP/1.1 200 OK\r\n", $req); + $this->assertFalse($response->hasErrors()); + $response = new Response('', "HTTP/1.1 300 Multiple Choices\r\n", $req); + $this->assertFalse($response->hasErrors()); + $response = new Response('', "HTTP/1.1 400 Bad Request\r\n", $req); + $this->assertTrue($response->hasErrors()); + $response = new Response('', "HTTP/1.1 500 Internal Server Error\r\n", $req); + $this->assertTrue($response->hasErrors()); + } + + function testWhenError() { + $caught = false; + + try { + Request::get('malformed:url') + ->whenError(function($error) use(&$caught) { + $caught = true; + }) + ->timeoutIn(0.1) + ->send(); + } catch (\Httpful\Exception\ConnectionErrorException $e) {} + + $this->assertTrue($caught); + } + + function testBeforeSend() { + $invoked = false; + $changed = false; + $self = $this; + + try { + Request::get('malformed://url') + ->beforeSend(function($request) use(&$invoked,$self) { + $self->assertEquals('malformed://url', $request->uri); + $self->assertEquals('A payload', $request->serialized_payload); + $request->uri('malformed2://url'); + $invoked = true; + }) + ->whenError(function($error) { /* Be silent */ }) + ->body('A payload') + ->send(); + } catch (\Httpful\Exception\ConnectionErrorException $e) { + $this->assertTrue(strpos($e->getMessage(), 'malformed2') !== false); + $changed = true; + } + + $this->assertTrue($invoked); + $this->assertTrue($changed); + } + + function test_parseCode() + { + $req = Request::init()->sendsAndExpects(Mime::JSON); + $response = new Response(self::SAMPLE_JSON_RESPONSE, self::SAMPLE_JSON_HEADER, $req); + $code = $response->_parseCode("HTTP/1.1 406 Not Acceptable\r\n"); + $this->assertEquals(406, $code); + } + + function testToString() + { + $req = Request::init()->sendsAndExpects(Mime::JSON); + $response = new Response(self::SAMPLE_JSON_RESPONSE, self::SAMPLE_JSON_HEADER, $req); + $this->assertEquals(self::SAMPLE_JSON_RESPONSE, (string)$response); + } + + function test_parseHeaders() + { + $parse_headers = Response\Headers::fromString(self::SAMPLE_JSON_HEADER); + $this->assertCount(3, $parse_headers); + $this->assertEquals('application/json', $parse_headers['Content-Type']); + $this->assertTrue(isset($parse_headers['Connection'])); + } + + function testMultiHeaders() + { + $req = Request::init(); + $response = new Response(self::SAMPLE_JSON_RESPONSE, self::SAMPLE_MULTI_HEADER, $req); + $parse_headers = $response->_parseHeaders(self::SAMPLE_MULTI_HEADER); + $this->assertEquals('Value1,Value2', $parse_headers['X-My-Header']); + } + + function testDetectContentType() + { + $req = Request::init(); + $response = new Response(self::SAMPLE_JSON_RESPONSE, self::SAMPLE_JSON_HEADER, $req); + $this->assertEquals('application/json', $response->headers['Content-Type']); + } + + function testMissingBodyContentType() + { + $body = 'A string'; + $request = Request::post(HttpfulTest::TEST_URL, $body)->_curlPrep(); + $this->assertEquals($body, $request->serialized_payload); + } + + function testParentType() + { + // Parent type + $request = Request::init()->sendsAndExpects(Mime::XML); + $response = new Response('Nathan', self::SAMPLE_VENDOR_HEADER, $request); + + $this->assertEquals("application/xml", $response->parent_type); + $this->assertEquals(self::SAMPLE_VENDOR_TYPE, $response->content_type); + $this->assertTrue($response->is_mime_vendor_specific); + + // Make sure we still parsed as if it were plain old XML + $this->assertEquals("Nathan", $response->body->name->__toString()); + } + + function testMissingContentType() + { + // Parent type + $request = Request::init()->sendsAndExpects(Mime::XML); + $response = new Response('Nathan', +"HTTP/1.1 200 OK +Connection: keep-alive +Transfer-Encoding: chunked\r\n", $request); + + $this->assertEquals("", $response->content_type); + } + + function testCustomMimeRegistering() + { + // Register new mime type handler for "application/vnd.nategood.message+xml" + Httpful::register(self::SAMPLE_VENDOR_TYPE, new DemoMimeHandler()); + + $this->assertTrue(Httpful::hasParserRegistered(self::SAMPLE_VENDOR_TYPE)); + + $request = Request::init(); + $response = new Response('Nathan', self::SAMPLE_VENDOR_HEADER, $request); + + $this->assertEquals(self::SAMPLE_VENDOR_TYPE, $response->content_type); + $this->assertEquals('custom parse', $response->body); + } + + public function testShorthandMimeDefinition() + { + $r = Request::init()->expects('json'); + $this->assertEquals(Mime::JSON, $r->expected_type); + + $r = Request::init()->expectsJson(); + $this->assertEquals(Mime::JSON, $r->expected_type); + } + + public function testOverrideXmlHandler() + { + // Lazy test... + $prev = \Httpful\Httpful::get(\Httpful\Mime::XML); + $this->assertEquals($prev, new \Httpful\Handlers\XmlHandler()); + $conf = array('namespace' => 'http://example.com'); + \Httpful\Httpful::register(\Httpful\Mime::XML, new \Httpful\Handlers\XmlHandler($conf)); + $new = \Httpful\Httpful::get(\Httpful\Mime::XML); + $this->assertNotEquals($prev, $new); + } + + public function testHasProxyWithoutProxy() + { + $r = Request::get('someUrl'); + $this->assertFalse($r->hasProxy()); + } + + public function testHasProxyWithProxy() + { + $r = Request::get('some_other_url'); + $r->useProxy('proxy.com'); + $this->assertTrue($r->hasProxy()); + } + + public function testParseJSON() + { + $handler = new JsonHandler(); + + $bodies = array( + 'foo', + array(), + array('foo', 'bar'), + null + ); + foreach ($bodies as $body) { + $this->assertEquals($body, $handler->parse(json_encode($body))); + } + + try { + $result = $handler->parse('invalid{json'); + } catch(\Exception $e) { + $this->assertEquals('Unable to parse response as JSON', $e->getMessage()); + return; + } + $this->fail('Expected an exception to be thrown due to invalid json'); + } + + // /** + // * Skeleton for testing against the 5.4 baked in server + // */ + // public function testLocalServer() + // { + // if (!defined('WITHOUT_SERVER') || (defined('WITHOUT_SERVER') && !WITHOUT_SERVER)) { + // // PHP test server seems to always set content type to application/octet-stream + // // so force parsing as JSON here + // Httpful::register('application/octet-stream', new \Httpful\Handlers\JsonHandler()); + // $response = Request::get(TEST_SERVER . '/test.json') + // ->sendsAndExpects(MIME::JSON); + // $response->send(); + // $this->assertTrue(...); + // } + // } +} + +class DemoMimeHandler extends \Httpful\Handlers\MimeHandlerAdapter +{ + public function parse($body) + { + return 'custom parse'; + } +} + diff --git a/dingdingcallback/vendor/nategood/httpful/tests/Httpful/requestTest.php b/dingdingcallback/vendor/nategood/httpful/tests/Httpful/requestTest.php new file mode 100644 index 00000000..32867650 --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/tests/Httpful/requestTest.php @@ -0,0 +1,21 @@ + + */ +namespace Httpful\Test; + +class requestTest extends \PHPUnit_Framework_TestCase +{ + + /** + * @author Nick Fox + * @expectedException Httpful\Exception\ConnectionErrorException + * @expectedExceptionMessage Unable to connect + */ + public function testGet_InvalidURL() + { + // Silence the default logger via whenError override + \Httpful\Request::get('unavailable.url')->whenError(function($error) {})->send(); + } + +} diff --git a/dingdingcallback/vendor/nategood/httpful/tests/bootstrap-server.php b/dingdingcallback/vendor/nategood/httpful/tests/bootstrap-server.php new file mode 100644 index 00000000..1c27bd9c --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/tests/bootstrap-server.php @@ -0,0 +1,42 @@ +./server.log 2>&1 & echo $!', WEB_SERVER_HOST, WEB_SERVER_PORT, WEB_SERVER_DOCROOT); + + // Execute the command and store the process ID + $output = array(); + exec($command, $output, $exit_code); + + // sleep for a second to let server come up + sleep(1); + $pid = (int) $output[0]; + + // check server.log to see if it failed to start + $server_logs = file_get_contents("./server.log"); + if (strpos($server_logs, "Fail") !== false) { + // server failed to start for some reason + print "Failed to start server! Logs:" . PHP_EOL . PHP_EOL; + print_r($server_logs); + exit(1); + } + + echo sprintf('%s - Web server started on %s:%d with PID %d', date('r'), WEB_SERVER_HOST, WEB_SERVER_PORT, $pid) . PHP_EOL; + + register_shutdown_function(function() { + // cleanup after ourselves -- remove log file, shut down server + global $pid; + unlink("./server.log"); + posix_kill($pid, SIGKILL); + }); +} diff --git a/dingdingcallback/vendor/nategood/httpful/tests/phpunit.xml b/dingdingcallback/vendor/nategood/httpful/tests/phpunit.xml new file mode 100644 index 00000000..18ab15ab --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/tests/phpunit.xml @@ -0,0 +1,16 @@ + + + + . + + + + + + + + + + + + diff --git a/dingdingcallback/vendor/nategood/httpful/tests/static/test.json b/dingdingcallback/vendor/nategood/httpful/tests/static/test.json new file mode 100644 index 00000000..a628852b --- /dev/null +++ b/dingdingcallback/vendor/nategood/httpful/tests/static/test.json @@ -0,0 +1 @@ +{"foo": "bar", "baz": false} diff --git a/dingdingcallback/vendor/nategood/httpful/tests/test_image.jpg b/dingdingcallback/vendor/nategood/httpful/tests/test_image.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3ce28ddd21269a8a3af4d0143115842202ee4297 GIT binary patch literal 52666 zcmbT7Wl&tf*X9Rz2pT*D2AALx9KryD1sR+Khr!*QKmrWzgFAx-cM{y)WpE1+AV?q( zAj|)Kw|1-c)9#+G+jXmMS6Bb)R?9i(>3_@rwg4}{AY~8$1qA>=c`kr|PXKXwEd^N} z4Xw8fHkRCWE><=SUVJ>f3~Zk6P$wG(Ww0Ux_`QN6gO@NrI~Rkir71LeOA@IMU&6%8E&6AK#$7w@@2(+dD93K|+JIvNHBI{I_#z~}D( zbYcvW*L<>=q?%?}jILz-p@{|9OmcNS%n0X(E3Gg?lyx<0TkS3zW5K?f06y)frb5lk^L{Q|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R8L_%KWVEqa>qdb9S0z==ZiQaH{b$wpknR zu6z1){c3L;UPUd8aKMVHj4^@86=Cn~Mi={0SSjO*j`DjOsEluVj1OFjh0Nxp*2b2P zD~wsj+1i$WvCsjZt!8#t!(BD{@Q9xFv+b_A}a7~|Ty?^1I2 zV{<6dQI4$Tt)hF4sPVC2csT1?SL-uH8cPE_D=5O_(0BanX|&tJ0hKi*`fjSy+3Frq zZ?=+so~EQKMW-cU#Ydw#ZAKq9MMa7hg0KiXd=t{p!JS zeH$J3a%0))MdjQ?Y`vIc{i@EVG~vjH2&Fz|b(+L*wXz7q0E1~hNB={>#1Y}bYsD%{i*}cnOy3dj)zAwdXjOP4;2x)hqH=bwL|^!Rm(2H%z|;4+v!k3 zM#XOA3YJOYU~t3ms^@Q(6<-`;sV8AJt`{+tjq%P$6sAuh0Vf2GDq$d!&7op4MmJO! z_ISAnBm^pqep&vsEq&G|($x^|GKZ6>T7~(1vBrCMt5HTG%7ekidFxWk9lqe@0MDgp zq?0pg$r+MLOKerZ#%kUj43hgVv?^{Ah#-ts}`h3z`Ud1d;wSnN(#{r|2f#=LTRB^zl@xDIk z$*VAgc5rwO#L*_NaY8LCGBwFoCp;}xfbM5L^`g+KGbn6=wN)SxlZsJjsYTrlJONv_ zb|2_Ta7gDP6^6j$rF0s6<+Sjdx^}E+>W7Y-encrypt; + $signature = $_GET['signature']; + $timestamp = $_GET['timestamp']; + $nonce = $_GET['nonce']; log_message('error','dingding回调:'.$recivejson); log_message('error','signature:'.$_GET['signature']); log_message('error','timestamp:'.$_GET['timestamp']); - log_message('error','nonce:'.$_GET['nonce']); - log_message('error','get:'.$_GET); + log_message('error','nonce:'.$_GET['nonce']);*/ } } \ No newline at end of file