From 326492cd95e004acd97fa87aa1adc5357995f8f6 Mon Sep 17 00:00:00 2001 From: hisune Date: Thu, 23 Jul 2015 10:53:56 +0800 Subject: [PATCH] add purview and curl request add purview and curl request --- Tiny/Auth.php | 5 ++++ Tiny/Config.php | 1 + Tiny/Curl.php | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 Tiny/Curl.php diff --git a/Tiny/Auth.php b/Tiny/Auth.php index 4cd394a..ebd13ef 100644 --- a/Tiny/Auth.php +++ b/Tiny/Auth.php @@ -107,6 +107,11 @@ public static function hasPurview($controller = null, $method = null) } $purview = self::getPurviewCache(); + if(!$purview && Config::$authPurviewMethod){ + $class = Config::$authPurviewMethod['0']; + $call = Config::$authPurviewMethod['1']; + $class::$call(); + } $white = property_exists($ctr, 'authWhite') && isset($ctr::$authWhite['purview']) ? $ctr::$authWhite['purview'] : array(); if( diff --git a/Tiny/Config.php b/Tiny/Config.php index 74667f4..6dafacc 100644 --- a/Tiny/Config.php +++ b/Tiny/Config.php @@ -19,6 +19,7 @@ abstract class Config static $error404 = array(); // array('Controller', 'method') static $secret = '8RtX*K#%Gw=5VEQ=VT'; static $authPurview = false; // 是否验证权限 + static $authPurviewMethod = false; // 自动更新权限的方法 public static function __callStatic($method, $args = array()) { diff --git a/Tiny/Curl.php b/Tiny/Curl.php new file mode 100644 index 0000000..3ff8621 --- /dev/null +++ b/Tiny/Curl.php @@ -0,0 +1,62 @@ + false, + 'errno' => $errno, + 'msg' => $err, + 'info' => $info, + ); + } + + curl_close($ch); + + return array( + 'result' => true, + 'msg' => $ret, + ); + } +} \ No newline at end of file