public static function DoAction() { self::$postObj = self::GetRequestXMLData(); if (self::$postObj === FALSE || !isset(self::$postObj->FromUserName) || !isset(self::$postObj->ToUserName) || !isset(self::$postObj->CreateTime) || !isset(self::$postObj->MsgType) || \Web\Utils\StringUtitly::IsBlank(self::$postObj->FromUserName) || \Web\Utils\StringUtitly::IsBlank(self::$postObj->ToUserName) || \Web\Utils\StringUtitly::IsBlank(self::$postObj->CreateTime) || \Web\Utils\StringUtitly::IsBlank(self::$postObj->MsgType)) { \Web\Utils\MPXML::TextAlertEx(0, 0, "request error"); exit; } $ControllerClass = "\\Web\\Controller\\MPMsg\\MType_" . strtoupper(self::$Context->MsgType); if (!class_exists($ControllerClass, true)) { \Web\Utils\Logger::Error(self::$postObj, "MsgType Not Class Attach"); \Web\Utils\MPXML::TextAlert(self::$postObj, "MsgType Not Class Attach"); } $openid = self::$postObj->FromUserName; self::$Context = new $ControllerClass(); self::$Context->Initialize(); }
public static function checkSignature($token) { $CheckPass = false; if (isset($_GET["signature"]) && isset($_GET["timestamp"]) && isset($_GET["nonce"])) { $signature = $_GET["signature"]; $timestamp = $_GET["timestamp"]; $nonce = $_GET["nonce"]; $tmpArr = array($token, $timestamp, $nonce); sort($tmpArr, SORT_STRING); $tmpStr = implode($tmpArr); $tmpStr = sha1($tmpStr); if ($tmpStr == $signature) { $CheckPass = true; } else { Logger::Error($_SERVER, __LINE__); Logger::Error($_REQUEST, __LINE__); } } return $CheckPass; }
public static function AutoLoader($klass) { $parts = explode('\\', $klass); $path = null; if ($parts[0] != 'Web') { return; } $parts = array_slice($parts, 1); $cpath = DIRECTORY_SEPARATOR . 'Web.' . implode(DIRECTORY_SEPARATOR, $parts) . '.Class.php'; $path = Core::$FrameworkIncludePath . $cpath; if (!file_exists($path)) { $path = self::$WebRoot . DIRECTORY_SEPARATOR . 'include' . $cpath; } if (!file_exists($path)) { NDebug::VerDump($path); Logger::Error('ERROR: class not found :' . $klass); return; } return require $path; }