[
  {
    "path": ".gitignore",
    "content": "/Runtime/\n/php/\n"
  },
  {
    "path": ".htaccess",
    "content": "<IfModule mod_rewrite.c>\n  Options +FollowSymlinks\n  RewriteEngine On\n\n  RewriteCond %{REQUEST_FILENAME} !-d\n  RewriteCond %{REQUEST_FILENAME} !-f\n  RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]\n</IfModule>"
  },
  {
    "path": "Application/Common/Common/index.html",
    "content": " "
  },
  {
    "path": "Application/Common/Conf/config.php",
    "content": "<?php\nreturn array(\n\t//'配置项'=>'配置值'\n);"
  },
  {
    "path": "Application/Common/Conf/index.html",
    "content": " "
  },
  {
    "path": "Application/Common/index.html",
    "content": " "
  },
  {
    "path": "Application/Home/Common/index.html",
    "content": " "
  },
  {
    "path": "Application/Home/Conf/config.php",
    "content": "<?php\nreturn array(\n\t//'配置项'=>'配置值'\n);"
  },
  {
    "path": "Application/Home/Conf/index.html",
    "content": " "
  },
  {
    "path": "Application/Home/Controller/IndexController.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>\n// +----------------------------------------------------------------------\n\nnamespace Home\\Controller;\n\nuse Think\\Controller;\nuse Com\\Wechat;\nuse Com\\WechatAuth;\n\nclass IndexController extends Controller{\n    /**\n     * 微信消息接口入口\n     * 所有发送到微信的消息都会推送到该操作\n     * 所以，微信公众平台后台填写的api地址则为该操作的访问地址\n     */\n    public function index($id = ''){\n        //调试\n        try{\n            $appid = 'wx58aebef2023e68cd'; //AppID(应用ID)\n            $token = 'E9E05045F594065909D2B5554A8F34CE'; //微信后台填写的TOKEN\n            $crypt = 'q6FPCUoCQWaOiR3UUe5RfQu8A7hlJcMW4BnNyH9z2il'; //消息加密KEY（EncodingAESKey）\n            \n            /* 加载微信SDK */\n            $wechat = new Wechat($token, $appid, $crypt);\n            \n            /* 获取请求信息 */\n            $data = $wechat->request();\n\n            if($data && is_array($data)){\n                /**\n                 * 你可以在这里分析数据，决定要返回给用户什么样的信息\n                 * 接受到的信息类型有10种，分别使用下面10个常量标识\n                 * Wechat::MSG_TYPE_TEXT       //文本消息\n                 * Wechat::MSG_TYPE_IMAGE      //图片消息\n                 * Wechat::MSG_TYPE_VOICE      //音频消息\n                 * Wechat::MSG_TYPE_VIDEO      //视频消息\n                 * Wechat::MSG_TYPE_SHORTVIDEO //视频消息\n                 * Wechat::MSG_TYPE_MUSIC      //音乐消息\n                 * Wechat::MSG_TYPE_NEWS       //图文消息（推送过来的应该不存在这种类型，但是可以给用户回复该类型消息）\n                 * Wechat::MSG_TYPE_LOCATION   //位置消息\n                 * Wechat::MSG_TYPE_LINK       //连接消息\n                 * Wechat::MSG_TYPE_EVENT      //事件消息\n                 *\n                 * 事件消息又分为下面五种\n                 * Wechat::MSG_EVENT_SUBSCRIBE    //订阅\n                 * Wechat::MSG_EVENT_UNSUBSCRIBE  //取消订阅\n                 * Wechat::MSG_EVENT_SCAN         //二维码扫描\n                 * Wechat::MSG_EVENT_LOCATION     //报告位置\n                 * Wechat::MSG_EVENT_CLICK        //菜单点击\n                 */\n\n                //记录微信推送过来的数据\n                file_put_contents('./data.json', json_encode($data));\n\n                /* 响应当前请求(自动回复) */\n                //$wechat->response($content, $type);\n\n                /**\n                 * 响应当前请求还有以下方法可以使用\n                 * 具体参数格式说明请参考文档\n                 * \n                 * $wechat->replyText($text); //回复文本消息\n                 * $wechat->replyImage($media_id); //回复图片消息\n                 * $wechat->replyVoice($media_id); //回复音频消息\n                 * $wechat->replyVideo($media_id, $title, $discription); //回复视频消息\n                 * $wechat->replyMusic($title, $discription, $musicurl, $hqmusicurl, $thumb_media_id); //回复音乐消息\n                 * $wechat->replyNews($news, $news1, $news2, $news3); //回复多条图文消息\n                 * $wechat->replyNewsOnce($title, $discription, $url, $picurl); //回复单条图文消息\n                 * \n                 */\n                \n                //执行Demo\n                $this->demo($wechat, $data);\n            }\n        } catch(\\Exception $e){\n            file_put_contents('./error.json', json_encode($e->getMessage()));\n        }\n        \n    }\n\n    /**\n     * DEMO\n     * @param  Object $wechat Wechat对象\n     * @param  array  $data   接受到微信推送的消息\n     */\n    private function demo($wechat, $data){\n        switch ($data['MsgType']) {\n            case Wechat::MSG_TYPE_EVENT:\n                switch ($data['Event']) {\n                    case Wechat::MSG_EVENT_SUBSCRIBE:\n                        $wechat->replyText('欢迎您关注麦当苗儿公众平台！回复“文本”，“图片”，“语音”，“视频”，“音乐”，“图文”，“多图文”查看相应的信息！');\n                        break;\n\n                    case Wechat::MSG_EVENT_UNSUBSCRIBE:\n                        //取消关注，记录日志\n                        break;\n\n                    default:\n                        $wechat->replyText(\"欢迎访问麦当苗儿公众平台！您的事件类型：{$data['Event']}，EventKey：{$data['EventKey']}\");\n                        break;\n                }\n                break;\n\n            case Wechat::MSG_TYPE_TEXT:\n                switch ($data['Content']) {\n                    case '文本':\n                        $wechat->replyText('欢迎访问麦当苗儿公众平台，这是文本回复的内容！');\n                        break;\n\n                    case '图片':\n                        //$media_id = $this->upload('image');\n                        $media_id = '1J03FqvqN_jWX6xe8F-VJr7QHVTQsJBS6x4uwKuzyLE';\n                        $wechat->replyImage($media_id);\n                        break;\n\n                    case '语音':\n                        //$media_id = $this->upload('voice');\n                        $media_id = '1J03FqvqN_jWX6xe8F-VJgisW3vE28MpNljNnUeD3Pc';\n                        $wechat->replyVoice($media_id);\n                        break;\n\n                    case '视频':\n                        //$media_id = $this->upload('video');\n                        $media_id = '1J03FqvqN_jWX6xe8F-VJn9Qv0O96rcQgITYPxEIXiQ';\n                        $wechat->replyVideo($media_id, '视频标题', '视频描述信息。。。');\n                        break;\n\n                    case '音乐':\n                        //$thumb_media_id = $this->upload('thumb');\n                        $thumb_media_id = '1J03FqvqN_jWX6xe8F-VJrjYzcBAhhglm48EhwNoBLA';\n                        $wechat->replyMusic(\n                            'Wakawaka!', \n                            'Shakira - Waka Waka, MaxRNB - Your first R/Hiphop source', \n                            'http://wechat.zjzit.cn/Public/music.mp3', \n                            'http://wechat.zjzit.cn/Public/music.mp3', \n                            $thumb_media_id\n                        ); //回复音乐消息\n                        break;\n\n                    case '图文':\n                        $wechat->replyNewsOnce(\n                            \"全民创业蒙的就是你，来一盆冷水吧！\",\n                            \"全民创业已经如火如荼，然而创业是一个非常自我的过程，它是一种生活方式的选择。从外部的推动有助于提高创业的存活率，但是未必能够提高创新的成功率。第一次创业的人，至少90%以上都会以失败而告终。创业成功者大部分年龄在30岁到38岁之间，而且创业成功最高的概率是第三次创业。\", \n                            \"http://www.topthink.com/topic/11991.html\",\n                            \"http://yun.topthink.com/Uploads/Editor/2015-07-30/55b991cad4c48.jpg\"\n                        ); //回复单条图文消息\n                        break;\n\n                    case '多图文':\n                        $news = array(\n                            \"全民创业蒙的就是你，来一盆冷水吧！\",\n                            \"全民创业已经如火如荼，然而创业是一个非常自我的过程，它是一种生活方式的选择。从外部的推动有助于提高创业的存活率，但是未必能够提高创新的成功率。第一次创业的人，至少90%以上都会以失败而告终。创业成功者大部分年龄在30岁到38岁之间，而且创业成功最高的概率是第三次创业。\", \n                            \"http://www.topthink.com/topic/11991.html\",\n                            \"http://yun.topthink.com/Uploads/Editor/2015-07-30/55b991cad4c48.jpg\"\n                        ); //回复单条图文消息\n\n                        $wechat->replyNews($news, $news, $news, $news, $news);\n                        break;\n                    \n                    default:\n                        $wechat->replyText(\"欢迎访问麦当苗儿公众平台！您输入的内容是：{$data['Content']}\");\n                        break;\n                }\n                break;\n            \n            default:\n                # code...\n                break;\n        }\n    }\n\n    /**\n     * 资源文件上传方法\n     * @param  string $type 上传的资源类型\n     * @return string       媒体资源ID\n     */\n    private function upload($type){\n        $appid     = 'wx58aebef2023e68cd';\n        $appsecret = 'bf818ec2fb49c20a478bbefe9dc88c60';\n\n        $token = session(\"token\");\n\n        if($token){\n            $auth = new WechatAuth($appid, $appsecret, $token);\n        } else {\n            $auth  = new WechatAuth($appid, $appsecret);\n            $token = $auth->getAccessToken();\n\n            session(array('expire' => $token['expires_in']));\n            session(\"token\", $token['access_token']);\n        }\n\n        switch ($type) {\n            case 'image':\n                $filename = './Public/image.jpg';\n                $media    = $auth->materialAddMaterial($filename, $type);\n                break;\n\n            case 'voice':\n                $filename = './Public/voice.mp3';\n                $media    = $auth->materialAddMaterial($filename, $type);\n                break;\n\n            case 'video':\n                $filename    = './Public/video.mp4';\n                $discription = array('title' => '视频标题', 'introduction' => '视频描述');\n                $media       = $auth->materialAddMaterial($filename, $type, $discription);\n                break;\n\n            case 'thumb':\n                $filename = './Public/music.jpg';\n                $media    = $auth->materialAddMaterial($filename, $type);\n                break;\n            \n            default:\n                return '';\n        }\n\n        if($media[\"errcode\"] == 42001){ //access_token expired\n            session(\"token\", null);\n            $this->upload($type);\n        }\n\n        return $media['media_id'];\n    }\n}\n"
  },
  {
    "path": "Application/Home/Controller/index.html",
    "content": " "
  },
  {
    "path": "Application/Home/Model/index.html",
    "content": " "
  },
  {
    "path": "Application/Home/View/index.html",
    "content": " "
  },
  {
    "path": "Application/Home/index.html",
    "content": " "
  },
  {
    "path": "Application/README.md",
    "content": "﻿项目目录"
  },
  {
    "path": "Application/index.html",
    "content": " "
  },
  {
    "path": "Public/README.md",
    "content": "﻿资源文件目录"
  },
  {
    "path": "ThinkPHP/Common/functions.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\n/**\n * Think 系统函数库\n */\n\n/**\n * 获取和设置配置参数 支持批量定义\n * @param string|array $name 配置变量\n * @param mixed $value 配置值\n * @param mixed $default 默认值\n * @return mixed\n */\nfunction C($name=null, $value=null,$default=null) {\n    static $_config = array();\n    // 无参数时获取所有\n    if (empty($name)) {\n        return $_config;\n    }\n    // 优先执行设置获取或赋值\n    if (is_string($name)) {\n        if (!strpos($name, '.')) {\n            $name = strtoupper($name);\n            if (is_null($value))\n                return isset($_config[$name]) ? $_config[$name] : $default;\n            $_config[$name] = $value;\n            return null;\n        }\n        // 二维数组设置和获取支持\n        $name = explode('.', $name);\n        $name[0]   =  strtoupper($name[0]);\n        if (is_null($value))\n            return isset($_config[$name[0]][$name[1]]) ? $_config[$name[0]][$name[1]] : $default;\n        $_config[$name[0]][$name[1]] = $value;\n        return null;\n    }\n    // 批量设置\n    if (is_array($name)){\n        $_config = array_merge($_config, array_change_key_case($name,CASE_UPPER));\n        return null;\n    }\n    return null; // 避免非法参数\n}\n\n/**\n * 加载配置文件 支持格式转换 仅支持一级配置\n * @param string $file 配置文件名\n * @param string $parse 配置解析方法 有些格式需要用户自己解析\n * @return array\n */\nfunction load_config($file,$parse=CONF_PARSE){\n    $ext  = pathinfo($file,PATHINFO_EXTENSION);\n    switch($ext){\n        case 'php':\n            return include $file;\n        case 'ini':\n            return parse_ini_file($file);\n        case 'yaml':\n            return yaml_parse_file($file);\n        case 'xml': \n            return (array)simplexml_load_file($file);\n        case 'json':\n            return json_decode(file_get_contents($file), true);\n        default:\n            if(function_exists($parse)){\n                return $parse($file);\n            }else{\n                E(L('_NOT_SUPPORT_').':'.$ext);\n            }\n    }\n}\n\n/**\n * 解析yaml文件返回一个数组\n * @param string $file 配置文件名\n * @return array\n */\nif (!function_exists('yaml_parse_file')) {\n    function yaml_parse_file($file) {\n        vendor('spyc.Spyc');\n        return Spyc::YAMLLoad($file);\n    }\n}\n\n/**\n * 抛出异常处理\n * @param string $msg 异常消息\n * @param integer $code 异常代码 默认为0\n * @throws Think\\Exception\n * @return void\n */\nfunction E($msg, $code=0) {\n    throw new Think\\Exception($msg, $code);\n}\n\n/**\n * 记录和统计时间（微秒）和内存使用情况\n * 使用方法:\n * <code>\n * G('begin'); // 记录开始标记位\n * // ... 区间运行代码\n * G('end'); // 记录结束标签位\n * echo G('begin','end',6); // 统计区间运行时间 精确到小数后6位\n * echo G('begin','end','m'); // 统计区间内存使用情况\n * 如果end标记位没有定义，则会自动以当前作为标记位\n * 其中统计内存使用需要 MEMORY_LIMIT_ON 常量为true才有效\n * </code>\n * @param string $start 开始标签\n * @param string $end 结束标签\n * @param integer|string $dec 小数位或者m\n * @return mixed\n */\nfunction G($start,$end='',$dec=4) {\n    static $_info       =   array();\n    static $_mem        =   array();\n    if(is_float($end)) { // 记录时间\n        $_info[$start]  =   $end;\n    }elseif(!empty($end)){ // 统计时间和内存使用\n        if(!isset($_info[$end])) $_info[$end]       =  microtime(TRUE);\n        if(MEMORY_LIMIT_ON && $dec=='m'){\n            if(!isset($_mem[$end])) $_mem[$end]     =  memory_get_usage();\n            return number_format(($_mem[$end]-$_mem[$start])/1024);\n        }else{\n            return number_format(($_info[$end]-$_info[$start]),$dec);\n        }\n\n    }else{ // 记录时间和内存使用\n        $_info[$start]  =  microtime(TRUE);\n        if(MEMORY_LIMIT_ON) $_mem[$start]           =  memory_get_usage();\n    }\n    return null;\n}\n\n/**\n * 获取和设置语言定义(不区分大小写)\n * @param string|array $name 语言变量\n * @param mixed $value 语言值或者变量\n * @return mixed\n */\nfunction L($name=null, $value=null) {\n    static $_lang = array();\n    // 空参数返回所有定义\n    if (empty($name))\n        return $_lang;\n    // 判断语言获取(或设置)\n    // 若不存在,直接返回全大写$name\n    if (is_string($name)) {\n        $name   =   strtoupper($name);\n        if (is_null($value)){\n            return isset($_lang[$name]) ? $_lang[$name] : $name;\n        }elseif(is_array($value)){\n            // 支持变量\n            $replace = array_keys($value);\n            foreach($replace as &$v){\n                $v = '{$'.$v.'}';\n            }\n            return str_replace($replace,$value,isset($_lang[$name]) ? $_lang[$name] : $name);        \n        }\n        $_lang[$name] = $value; // 语言定义\n        return null;\n    }\n    // 批量定义\n    if (is_array($name))\n        $_lang = array_merge($_lang, array_change_key_case($name, CASE_UPPER));\n    return null;\n}\n\n/**\n * 添加和获取页面Trace记录\n * @param string $value 变量\n * @param string $label 标签\n * @param string $level 日志级别\n * @param boolean $record 是否记录日志\n * @return void|array\n */\nfunction trace($value='[think]',$label='',$level='DEBUG',$record=false) {\n    return Think\\Think::trace($value,$label,$level,$record);\n}\n\n/**\n * 编译文件\n * @param string $filename 文件名\n * @return string\n */\nfunction compile($filename) {\n    $content    =   php_strip_whitespace($filename);\n    $content    =   trim(substr($content, 5));\n    // 替换预编译指令\n    $content    =   preg_replace('/\\/\\/\\[RUNTIME\\](.*?)\\/\\/\\[\\/RUNTIME\\]/s', '', $content);\n    if(0===strpos($content,'namespace')){\n        $content    =   preg_replace('/namespace\\s(.*?);/','namespace \\\\1{',$content,1);\n    }else{\n        $content    =   'namespace {'.$content;\n    }\n    if ('?>' == substr($content, -2))\n        $content    = substr($content, 0, -2);\n    return $content.'}';\n}\n\n/**\n * 获取模版文件 格式 资源://模块@主题/控制器/操作\n * @param string $template 模版资源地址\n * @param string $layer 视图层（目录）名称\n * @return string\n */\nfunction T($template='',$layer=''){\n\n    // 解析模版资源地址\n    if(false === strpos($template,'://')){\n        $template   =   'http://'.str_replace(':', '/',$template);\n    }\n    $info   =   parse_url($template);\n    $file   =   $info['host'].(isset($info['path'])?$info['path']:'');\n    $module =   isset($info['user'])?$info['user'].'/':MODULE_NAME.'/';\n    $extend =   $info['scheme'];\n    $layer  =   $layer?$layer:C('DEFAULT_V_LAYER');\n\n    // 获取当前主题的模版路径\n    $auto   =   C('AUTOLOAD_NAMESPACE');\n    if($auto && isset($auto[$extend])){ // 扩展资源\n        $baseUrl    =   $auto[$extend].$module.$layer.'/';\n    }elseif(C('VIEW_PATH')){ \n        // 改变模块视图目录\n        $baseUrl    =   C('VIEW_PATH');\n    }elseif(defined('TMPL_PATH')){ \n        // 指定全局视图目录\n        $baseUrl    =   TMPL_PATH.$module;\n    }else{\n        $baseUrl    =   APP_PATH.$module.$layer.'/';\n    }\n\n    // 获取主题\n    $theme  =   substr_count($file,'/')<2 ? C('DEFAULT_THEME') : '';\n\n    // 分析模板文件规则\n    $depr   =   C('TMPL_FILE_DEPR');\n    if('' == $file) {\n        // 如果模板文件名为空 按照默认规则定位\n        $file = CONTROLLER_NAME . $depr . ACTION_NAME;\n    }elseif(false === strpos($file, '/')){\n        $file = CONTROLLER_NAME . $depr . $file;\n    }elseif('/' != $depr){\n        $file   =   substr_count($file,'/')>1 ? substr_replace($file,$depr,strrpos($file,'/'),1) : str_replace('/', $depr, $file);\n    }\n    return $baseUrl.($theme?$theme.'/':'').$file.C('TMPL_TEMPLATE_SUFFIX');\n}\n\n/**\n * 获取输入参数 支持过滤和默认值\n * 使用方法:\n * <code>\n * I('id',0); 获取id参数 自动判断get或者post\n * I('post.name','','htmlspecialchars'); 获取$_POST['name']\n * I('get.'); 获取$_GET\n * </code>\n * @param string $name 变量的名称 支持指定类型\n * @param mixed $default 不存在的时候默认值\n * @param mixed $filter 参数过滤方法\n * @param mixed $datas 要获取的额外数据源\n * @return mixed\n */\nfunction I($name,$default='',$filter=null,$datas=null) {\n\tstatic $_PUT\t=\tnull;\n\tif(strpos($name,'/')){ // 指定修饰符\n\t\tlist($name,$type) \t=\texplode('/',$name,2);\n\t}elseif(C('VAR_AUTO_STRING')){ // 默认强制转换为字符串\n        $type   =   's';\n    }\n    if(strpos($name,'.')) { // 指定参数来源\n        list($method,$name) =   explode('.',$name,2);\n    }else{ // 默认为自动判断\n        $method =   'param';\n    }\n    switch(strtolower($method)) {\n        case 'get'     :   \n        \t$input =& $_GET;\n        \tbreak;\n        case 'post'    :   \n        \t$input =& $_POST;\n        \tbreak;\n        case 'put'     :   \n        \tif(is_null($_PUT)){\n            \tparse_str(file_get_contents('php://input'), $_PUT);\n        \t}\n        \t$input \t=\t$_PUT;        \n        \tbreak;\n        case 'param'   :\n            switch($_SERVER['REQUEST_METHOD']) {\n                case 'POST':\n                    $input  =  $_POST;\n                    break;\n                case 'PUT':\n                \tif(is_null($_PUT)){\n                    \tparse_str(file_get_contents('php://input'), $_PUT);\n                \t}\n                \t$input \t=\t$_PUT;\n                    break;\n                default:\n                    $input  =  $_GET;\n            }\n            break;\n        case 'path'    :   \n            $input  =   array();\n            if(!empty($_SERVER['PATH_INFO'])){\n                $depr   =   C('URL_PATHINFO_DEPR');\n                $input  =   explode($depr,trim($_SERVER['PATH_INFO'],$depr));            \n            }\n            break;\n        case 'request' :   \n        \t$input =& $_REQUEST;   \n        \tbreak;\n        case 'session' :   \n        \t$input =& $_SESSION;   \n        \tbreak;\n        case 'cookie'  :   \n        \t$input =& $_COOKIE;    \n        \tbreak;\n        case 'server'  :   \n        \t$input =& $_SERVER;    \n        \tbreak;\n        case 'globals' :   \n        \t$input =& $GLOBALS;    \n        \tbreak;\n        case 'data'    :   \n        \t$input =& $datas;      \n        \tbreak;\n        default:\n            return null;\n    }\n    if(''==$name) { // 获取全部变量\n        $data       =   $input;\n        $filters    =   isset($filter)?$filter:C('DEFAULT_FILTER');\n        if($filters) {\n            if(is_string($filters)){\n                $filters    =   explode(',',$filters);\n            }\n            foreach($filters as $filter){\n                $data   =   array_map_recursive($filter,$data); // 参数过滤\n            }\n        }\n    }elseif(isset($input[$name])) { // 取值操作\n        $data       =   $input[$name];\n        $filters    =   isset($filter)?$filter:C('DEFAULT_FILTER');\n        if($filters) {\n            if(is_string($filters)){\n                if(0 === strpos($filters,'/')){\n                    if(1 !== preg_match($filters,(string)$data)){\n                        // 支持正则验证\n                        return   isset($default) ? $default : null;\n                    }\n                }else{\n                    $filters    =   explode(',',$filters);                    \n                }\n            }elseif(is_int($filters)){\n                $filters    =   array($filters);\n            }\n            \n            if(is_array($filters)){\n                foreach($filters as $filter){\n                    if(function_exists($filter)) {\n                        $data   =   is_array($data) ? array_map_recursive($filter,$data) : $filter($data); // 参数过滤\n                    }else{\n                        $data   =   filter_var($data,is_int($filter) ? $filter : filter_id($filter));\n                        if(false === $data) {\n                            return   isset($default) ? $default : null;\n                        }\n                    }\n                }\n            }\n        }\n        if(!empty($type)){\n        \tswitch(strtolower($type)){\n        \t\tcase 'a':\t// 数组\n        \t\t\t$data \t=\t(array)$data;\n        \t\t\tbreak;\n        \t\tcase 'd':\t// 数字\n        \t\t\t$data \t=\t(int)$data;\n        \t\t\tbreak;\n        \t\tcase 'f':\t// 浮点\n        \t\t\t$data \t=\t(float)$data;\n        \t\t\tbreak;\n        \t\tcase 'b':\t// 布尔\n        \t\t\t$data \t=\t(boolean)$data;\n        \t\t\tbreak;\n                case 's':   // 字符串\n                default:\n                    $data   =   (string)$data;\n        \t}\n        }\n    }else{ // 变量默认值\n        $data       =    isset($default)?$default:null;\n    }\n    is_array($data) && array_walk_recursive($data,'think_filter');\n    return $data;\n}\n\nfunction array_map_recursive($filter, $data) {\n    $result = array();\n    foreach ($data as $key => $val) {\n        $result[$key] = is_array($val)\n         ? array_map_recursive($filter, $val)\n         : call_user_func($filter, $val);\n    }\n    return $result;\n }\n\n/**\n * 设置和获取统计数据\n * 使用方法:\n * <code>\n * N('db',1); // 记录数据库操作次数\n * N('read',1); // 记录读取次数\n * echo N('db'); // 获取当前页面数据库的所有操作次数\n * echo N('read'); // 获取当前页面读取次数\n * </code>\n * @param string $key 标识位置\n * @param integer $step 步进值\n * @param boolean $save 是否保存结果\n * @return mixed\n */\nfunction N($key, $step=0,$save=false) {\n    static $_num    = array();\n    if (!isset($_num[$key])) {\n        $_num[$key] = (false !== $save)? S('N_'.$key) :  0;\n    }\n    if (empty($step)){\n        return $_num[$key];\n    }else{\n        $_num[$key] = $_num[$key] + (int)$step;\n    }\n    if(false !== $save){ // 保存结果\n        S('N_'.$key,$_num[$key],$save);\n    }\n    return null;\n}\n\n/**\n * 字符串命名风格转换\n * type 0 将Java风格转换为C的风格 1 将C风格转换为Java的风格\n * @param string $name 字符串\n * @param integer $type 转换类型\n * @return string\n */\nfunction parse_name($name, $type=0) {\n    if ($type) {\n        return ucfirst(preg_replace_callback('/_([a-zA-Z])/', function($match){return strtoupper($match[1]);}, $name));\n    } else {\n        return strtolower(trim(preg_replace(\"/[A-Z]/\", \"_\\\\0\", $name), \"_\"));\n    }\n}\n\n/**\n * 优化的require_once\n * @param string $filename 文件地址\n * @return boolean\n */\nfunction require_cache($filename) {\n    static $_importFiles = array();\n    if (!isset($_importFiles[$filename])) {\n        if (file_exists_case($filename)) {\n            require $filename;\n            $_importFiles[$filename] = true;\n        } else {\n            $_importFiles[$filename] = false;\n        }\n    }\n    return $_importFiles[$filename];\n}\n\n/**\n * 区分大小写的文件存在判断\n * @param string $filename 文件地址\n * @return boolean\n */\nfunction file_exists_case($filename) {\n    if (is_file($filename)) {\n        if (IS_WIN && APP_DEBUG) {\n            if (basename(realpath($filename)) != basename($filename))\n                return false;\n        }\n        return true;\n    }\n    return false;\n}\n\n/**\n * 导入所需的类库 同java的Import 本函数有缓存功能\n * @param string $class 类库命名空间字符串\n * @param string $baseUrl 起始路径\n * @param string $ext 导入的文件扩展名\n * @return boolean\n */\nfunction import($class, $baseUrl = '', $ext=EXT) {\n    static $_file = array();\n    $class = str_replace(array('.', '#'), array('/', '.'), $class);\n    if (isset($_file[$class . $baseUrl]))\n        return true;\n    else\n        $_file[$class . $baseUrl] = true;\n    $class_strut     = explode('/', $class);\n    if (empty($baseUrl)) {\n        if ('@' == $class_strut[0] || MODULE_NAME == $class_strut[0]) {\n            //加载当前模块的类库\n            $baseUrl = MODULE_PATH;\n            $class   = substr_replace($class, '', 0, strlen($class_strut[0]) + 1);\n        }elseif ('Common' == $class_strut[0]) {\n            //加载公共模块的类库\n            $baseUrl = COMMON_PATH;\n            $class   = substr($class, 7);\n        }elseif (in_array($class_strut[0],array('Think','Org','Behavior','Com','Vendor')) || is_dir(LIB_PATH.$class_strut[0])) {\n            // 系统类库包和第三方类库包\n            $baseUrl = LIB_PATH;\n        }else { // 加载其他模块的类库\n            $baseUrl = APP_PATH;\n        }\n    }\n    if (substr($baseUrl, -1) != '/')\n        $baseUrl    .= '/';\n    $classfile       = $baseUrl . $class . $ext;\n    if (!class_exists(basename($class),false)) {\n        // 如果类不存在 则导入类库文件\n        return require_cache($classfile);\n    }\n    return null;\n}\n\n/**\n * 基于命名空间方式导入函数库\n * load('@.Util.Array')\n * @param string $name 函数库命名空间字符串\n * @param string $baseUrl 起始路径\n * @param string $ext 导入的文件扩展名\n * @return void\n */\nfunction load($name, $baseUrl='', $ext='.php') {\n    $name = str_replace(array('.', '#'), array('/', '.'), $name);\n    if (empty($baseUrl)) {\n        if (0 === strpos($name, '@/')) {//加载当前模块函数库\n            $baseUrl    =   MODULE_PATH.'Common/';\n            $name       =   substr($name, 2);\n        } else { //加载其他模块函数库\n            $array      =   explode('/', $name);\n            $baseUrl    =   APP_PATH . array_shift($array).'/Common/';\n            $name       =   implode('/',$array);\n        }\n    }\n    if (substr($baseUrl, -1) != '/')\n        $baseUrl       .= '/';\n    require_cache($baseUrl . $name . $ext);\n}\n\n/**\n * 快速导入第三方框架类库 所有第三方框架的类库文件统一放到 系统的Vendor目录下面\n * @param string $class 类库\n * @param string $baseUrl 基础目录\n * @param string $ext 类库后缀\n * @return boolean\n */\nfunction vendor($class, $baseUrl = '', $ext='.php') {\n    if (empty($baseUrl))\n        $baseUrl = VENDOR_PATH;\n    return import($class, $baseUrl, $ext);\n}\n\n/**\n * 实例化模型类 格式 [资源://][模块/]模型\n * @param string $name 资源地址\n * @param string $layer 模型层名称\n * @return Think\\Model\n */\nfunction D($name='',$layer='') {\n    if(empty($name)) return new Think\\Model;\n    static $_model  =   array();\n    $layer          =   $layer? : C('DEFAULT_M_LAYER');\n    if(isset($_model[$name.$layer]))\n        return $_model[$name.$layer];\n    $class          =   parse_res_name($name,$layer);\n    if(class_exists($class)) {\n        $model      =   new $class(basename($name));\n    }elseif(false === strpos($name,'/')){\n        // 自动加载公共模块下面的模型\n        if(!C('APP_USE_NAMESPACE')){\n            import('Common/'.$layer.'/'.$class);\n        }else{\n            $class      =   '\\\\Common\\\\'.$layer.'\\\\'.$name.$layer;\n        }\n        $model      =   class_exists($class)? new $class($name) : new Think\\Model($name);\n    }else {\n        Think\\Log::record('D方法实例化没找到模型类'.$class,Think\\Log::NOTICE);\n        $model      =   new Think\\Model(basename($name));\n    }\n    $_model[$name.$layer]  =  $model;\n    return $model;\n}\n\n/**\n * 实例化一个没有模型文件的Model\n * @param string $name Model名称 支持指定基础模型 例如 MongoModel:User\n * @param string $tablePrefix 表前缀\n * @param mixed $connection 数据库连接信息\n * @return Think\\Model\n */\nfunction M($name='', $tablePrefix='',$connection='') {\n    static $_model  = array();\n    if(strpos($name,':')) {\n        list($class,$name)    =  explode(':',$name);\n    }else{\n        $class      =   'Think\\\\Model';\n    }\n    $guid           =   (is_array($connection)?implode('',$connection):$connection).$tablePrefix . $name . '_' . $class;\n    if (!isset($_model[$guid]))\n        $_model[$guid] = new $class($name,$tablePrefix,$connection);\n    return $_model[$guid];\n}\n\n/**\n * 解析资源地址并导入类库文件\n * 例如 module/controller addon://module/behavior\n * @param string $name 资源地址 格式：[扩展://][模块/]资源名\n * @param string $layer 分层名称\n * @param integer $level 控制器层次\n * @return string\n */\nfunction parse_res_name($name,$layer,$level=1){\n    if(strpos($name,'://')) {// 指定扩展资源\n        list($extend,$name)  =   explode('://',$name);\n    }else{\n        $extend  =   '';\n    }\n    if(strpos($name,'/') && substr_count($name, '/')>=$level){ // 指定模块\n        list($module,$name) =  explode('/',$name,2);\n    }else{\n        $module =   defined('MODULE_NAME') ? MODULE_NAME : '' ;\n    }\n    $array  =   explode('/',$name);\n    if(!C('APP_USE_NAMESPACE')){\n        $class  =   parse_name($name, 1);\n        import($module.'/'.$layer.'/'.$class.$layer);\n    }else{\n        $class  =   $module.'\\\\'.$layer;\n        foreach($array as $name){\n            $class  .=   '\\\\'.parse_name($name, 1);\n        }\n        // 导入资源类库\n        if($extend){ // 扩展资源\n            $class      =   $extend.'\\\\'.$class;\n        }\n    }\n    return $class.$layer;\n}\n\n/**\n * 用于实例化访问控制器\n * @param string $name 控制器名\n * @param string $path 控制器命名空间（路径）\n * @return Think\\Controller|false\n */\nfunction controller($name,$path=''){\n    $layer  =   C('DEFAULT_C_LAYER');\n    if(!C('APP_USE_NAMESPACE')){\n        $class  =   parse_name($name, 1).$layer;\n        import(MODULE_NAME.'/'.$layer.'/'.$class);\n    }else{\n        $class  =   ( $path ? basename(ADDON_PATH).'\\\\'.$path : MODULE_NAME ).'\\\\'.$layer;\n        $array  =   explode('/',$name);\n        foreach($array as $name){\n            $class  .=   '\\\\'.parse_name($name, 1);\n        }\n        $class .=   $layer;\n    }\n    if(class_exists($class)) {\n        return new $class();\n    }else {\n        return false;\n    }\n}\n\n/**\n * 实例化多层控制器 格式：[资源://][模块/]控制器\n * @param string $name 资源地址\n * @param string $layer 控制层名称\n * @param integer $level 控制器层次\n * @return Think\\Controller|false\n */\nfunction A($name,$layer='',$level=0) {\n    static $_action = array();\n    $layer  =   $layer? : C('DEFAULT_C_LAYER');\n    $level  =   $level? : ($layer == C('DEFAULT_C_LAYER')?C('CONTROLLER_LEVEL'):1);\n    if(isset($_action[$name.$layer]))\n        return $_action[$name.$layer];\n    \n    $class  =   parse_res_name($name,$layer,$level);\n    if(class_exists($class)) {\n        $action             =   new $class();\n        $_action[$name.$layer]     =   $action;\n        return $action;\n    }else {\n        return false;\n    }\n}\n\n\n/**\n * 远程调用控制器的操作方法 URL 参数格式 [资源://][模块/]控制器/操作\n * @param string $url 调用地址\n * @param string|array $vars 调用参数 支持字符串和数组\n * @param string $layer 要调用的控制层名称\n * @return mixed\n */\nfunction R($url,$vars=array(),$layer='') {\n    $info   =   pathinfo($url);\n    $action =   $info['basename'];\n    $module =   $info['dirname'];\n    $class  =   A($module,$layer);\n    if($class){\n        if(is_string($vars)) {\n            parse_str($vars,$vars);\n        }\n        return call_user_func_array(array(&$class,$action.C('ACTION_SUFFIX')),$vars);\n    }else{\n        return false;\n    }\n}\n\n/**\n * 处理标签扩展\n * @param string $tag 标签名称\n * @param mixed $params 传入参数\n * @return void\n */\nfunction tag($tag, &$params=NULL) {\n    \\Think\\Hook::listen($tag,$params);\n}\n\n/**\n * 执行某个行为\n * @param string $name 行为名称\n * @param string $tag 标签名称（行为类无需传入） \n * @param Mixed $params 传入的参数\n * @return void\n */\nfunction B($name, $tag='',&$params=NULL) {\n    if(''==$tag){\n        $name   .=  'Behavior';\n    }\n    return \\Think\\Hook::exec($name,$tag,$params);\n}\n\n/**\n * 去除代码中的空白和注释\n * @param string $content 代码内容\n * @return string\n */\nfunction strip_whitespace($content) {\n    $stripStr   = '';\n    //分析php源码\n    $tokens     = token_get_all($content);\n    $last_space = false;\n    for ($i = 0, $j = count($tokens); $i < $j; $i++) {\n        if (is_string($tokens[$i])) {\n            $last_space = false;\n            $stripStr  .= $tokens[$i];\n        } else {\n            switch ($tokens[$i][0]) {\n                //过滤各种PHP注释\n                case T_COMMENT:\n                case T_DOC_COMMENT:\n                    break;\n                //过滤空格\n                case T_WHITESPACE:\n                    if (!$last_space) {\n                        $stripStr  .= ' ';\n                        $last_space = true;\n                    }\n                    break;\n                case T_START_HEREDOC:\n                    $stripStr .= \"<<<THINK\\n\";\n                    break;\n                case T_END_HEREDOC:\n                    $stripStr .= \"THINK;\\n\";\n                    for($k = $i+1; $k < $j; $k++) {\n                        if(is_string($tokens[$k]) && $tokens[$k] == ';') {\n                            $i = $k;\n                            break;\n                        } else if($tokens[$k][0] == T_CLOSE_TAG) {\n                            break;\n                        }\n                    }\n                    break;\n                default:\n                    $last_space = false;\n                    $stripStr  .= $tokens[$i][1];\n            }\n        }\n    }\n    return $stripStr;\n}\n\n/**\n * 自定义异常处理\n * @param string $msg 异常消息\n * @param string $type 异常类型 默认为Think\\Exception\n * @param integer $code 异常代码 默认为0\n * @return void\n */\nfunction throw_exception($msg, $type='Think\\\\Exception', $code=0) {\n    Think\\Log::record('建议使用E方法替代throw_exception',Think\\Log::NOTICE);\n    if (class_exists($type, false))\n        throw new $type($msg, $code);\n    else\n        Think\\Think::halt($msg);        // 异常类型不存在则输出错误信息字串\n}\n\n/**\n * 浏览器友好的变量输出\n * @param mixed $var 变量\n * @param boolean $echo 是否输出 默认为True 如果为false 则返回输出字符串\n * @param string $label 标签 默认为空\n * @param boolean $strict 是否严谨 默认为true\n * @return void|string\n */\nfunction dump($var, $echo=true, $label=null, $strict=true) {\n    $label = ($label === null) ? '' : rtrim($label) . ' ';\n    if (!$strict) {\n        if (ini_get('html_errors')) {\n            $output = print_r($var, true);\n            $output = '<pre>' . $label . htmlspecialchars($output, ENT_QUOTES) . '</pre>';\n        } else {\n            $output = $label . print_r($var, true);\n        }\n    } else {\n        ob_start();\n        var_dump($var);\n        $output = ob_get_clean();\n        if (!extension_loaded('xdebug')) {\n            $output = preg_replace('/\\]\\=\\>\\n(\\s+)/m', '] => ', $output);\n            $output = '<pre>' . $label . htmlspecialchars($output, ENT_QUOTES) . '</pre>';\n        }\n    }\n    if ($echo) {\n        echo($output);\n        return null;\n    }else\n        return $output;\n}\n\n/**\n * 设置当前页面的布局\n * @param string|false $layout 布局名称 为false的时候表示关闭布局\n * @return void\n */\nfunction layout($layout) {\n    if(false !== $layout) {\n        // 开启布局\n        C('LAYOUT_ON',true);\n        if(is_string($layout)) { // 设置新的布局模板\n            C('LAYOUT_NAME',$layout);\n        }\n    }else{// 临时关闭布局\n        C('LAYOUT_ON',false);\n    }\n}\n\n/**\n * URL组装 支持不同URL模式\n * @param string $url URL表达式，格式：'[模块/控制器/操作#锚点@域名]?参数1=值1&参数2=值2...'\n * @param string|array $vars 传入的参数，支持数组和字符串\n * @param string|boolean $suffix 伪静态后缀，默认为true表示获取配置值\n * @param boolean $domain 是否显示域名\n * @return string\n */\nfunction U($url='',$vars='',$suffix=true,$domain=false) {\n    // 解析URL\n    $info   =  parse_url($url);\n    $url    =  !empty($info['path'])?$info['path']:ACTION_NAME;\n    if(isset($info['fragment'])) { // 解析锚点\n        $anchor =   $info['fragment'];\n        if(false !== strpos($anchor,'?')) { // 解析参数\n            list($anchor,$info['query']) = explode('?',$anchor,2);\n        }        \n        if(false !== strpos($anchor,'@')) { // 解析域名\n            list($anchor,$host)    =   explode('@',$anchor, 2);\n        }\n    }elseif(false !== strpos($url,'@')) { // 解析域名\n        list($url,$host)    =   explode('@',$info['path'], 2);\n    }\n    // 解析子域名\n    if(isset($host)) {\n        $domain = $host.(strpos($host,'.')?'':strstr($_SERVER['HTTP_HOST'],'.'));\n    }elseif($domain===true){\n        $domain = $_SERVER['HTTP_HOST'];\n        if(C('APP_SUB_DOMAIN_DEPLOY') ) { // 开启子域名部署\n            $domain = $domain=='localhost'?'localhost':'www'.strstr($_SERVER['HTTP_HOST'],'.');\n            // '子域名'=>array('模块[/控制器]');\n            foreach (C('APP_SUB_DOMAIN_RULES') as $key => $rule) {\n                $rule   =   is_array($rule)?$rule[0]:$rule;\n                if(false === strpos($key,'*') && 0=== strpos($url,$rule)) {\n                    $domain = $key.strstr($domain,'.'); // 生成对应子域名\n                    $url    =  substr_replace($url,'',0,strlen($rule));\n                    break;\n                }\n            }\n        }\n    }\n\n    // 解析参数\n    if(is_string($vars)) { // aaa=1&bbb=2 转换成数组\n        parse_str($vars,$vars);\n    }elseif(!is_array($vars)){\n        $vars = array();\n    }\n    if(isset($info['query'])) { // 解析地址里面参数 合并到vars\n        parse_str($info['query'],$params);\n        $vars = array_merge($params,$vars);\n    }\n    \n    // URL组装\n    $depr       =   C('URL_PATHINFO_DEPR');\n    $urlCase    =   C('URL_CASE_INSENSITIVE');\n    if($url) {\n        if(0=== strpos($url,'/')) {// 定义路由\n            $route      =   true;\n            $url        =   substr($url,1);\n            if('/' != $depr) {\n                $url    =   str_replace('/',$depr,$url);\n            }\n        }else{\n            if('/' != $depr) { // 安全替换\n                $url    =   str_replace('/',$depr,$url);\n            }\n            // 解析模块、控制器和操作\n            $url        =   trim($url,$depr);\n            $path       =   explode($depr,$url);\n            $var        =   array();\n            $varModule      =   C('VAR_MODULE');\n            $varController  =   C('VAR_CONTROLLER');\n            $varAction      =   C('VAR_ACTION');\n            $var[$varAction]       =   !empty($path)?array_pop($path):ACTION_NAME;\n            $var[$varController]   =   !empty($path)?array_pop($path):CONTROLLER_NAME;\n            if($maps = C('URL_ACTION_MAP')) {\n                if(isset($maps[strtolower($var[$varController])])) {\n                    $maps    =   $maps[strtolower($var[$varController])];\n                    if($action = array_search(strtolower($var[$varAction]),$maps)){\n                        $var[$varAction] = $action;\n                    }\n                }\n            }\n            if($maps = C('URL_CONTROLLER_MAP')) {\n                if($controller = array_search(strtolower($var[$varController]),$maps)){\n                    $var[$varController] = $controller;\n                }\n            }\n            if($urlCase) {\n                $var[$varController]   =   parse_name($var[$varController]);\n            }\n            $module =   '';\n            \n            if(!empty($path)) {\n                $var[$varModule]    =   implode($depr,$path);\n            }else{\n                if(C('MULTI_MODULE')) {\n                    if(MODULE_NAME != C('DEFAULT_MODULE') || !C('MODULE_ALLOW_LIST')){\n                        $var[$varModule]=   MODULE_NAME;\n                    }\n                }\n            }\n            if($maps = C('URL_MODULE_MAP')) {\n                if($_module = array_search(strtolower($var[$varModule]),$maps)){\n                    $var[$varModule] = $_module;\n                }\n            }\n            if(isset($var[$varModule])){\n                $module =   $var[$varModule];\n                unset($var[$varModule]);\n            }\n            \n        }\n    }\n\n    if(C('URL_MODEL') == 0) { // 普通模式URL转换\n        $url        =   __APP__.'?'.C('VAR_MODULE').\"={$module}&\".http_build_query(array_reverse($var));\n        if($urlCase){\n            $url    =   strtolower($url);\n        }        \n        if(!empty($vars)) {\n            $vars   =   http_build_query($vars);\n            $url   .=   '&'.$vars;\n        }\n    }else{ // PATHINFO模式或者兼容URL模式\n        if(isset($route)) {\n            $url    =   __APP__.'/'.rtrim($url,$depr);\n        }else{\n            $module =   (defined('BIND_MODULE') && BIND_MODULE==$module )? '' : $module;\n            $url    =   __APP__.'/'.($module?$module.MODULE_PATHINFO_DEPR:'').implode($depr,array_reverse($var));\n        }\n        if($urlCase){\n            $url    =   strtolower($url);\n        }\n        if(!empty($vars)) { // 添加参数\n            foreach ($vars as $var => $val){\n                if('' !== trim($val))   $url .= $depr . $var . $depr . urlencode($val);\n            }                \n        }\n        if($suffix) {\n            $suffix   =  $suffix===true?C('URL_HTML_SUFFIX'):$suffix;\n            if($pos = strpos($suffix, '|')){\n                $suffix = substr($suffix, 0, $pos);\n            }\n            if($suffix && '/' != substr($url,-1)){\n                $url  .=  '.'.ltrim($suffix,'.');\n            }\n        }\n    }\n    if(isset($anchor)){\n        $url  .= '#'.$anchor;\n    }\n    if($domain) {\n        $url   =  (is_ssl()?'https://':'http://').$domain.$url;\n    }\n    return $url;\n}\n\n/**\n * 渲染输出Widget\n * @param string $name Widget名称\n * @param array $data 传入的参数\n * @return void\n */\nfunction W($name, $data=array()) {\n    return R($name,$data,'Widget');\n}\n\n/**\n * 判断是否SSL协议\n * @return boolean\n */\nfunction is_ssl() {\n    if(isset($_SERVER['HTTPS']) && ('1' == $_SERVER['HTTPS'] || 'on' == strtolower($_SERVER['HTTPS']))){\n        return true;\n    }elseif(isset($_SERVER['SERVER_PORT']) && ('443' == $_SERVER['SERVER_PORT'] )) {\n        return true;\n    }\n    return false;\n}\n\n/**\n * URL重定向\n * @param string $url 重定向的URL地址\n * @param integer $time 重定向的等待时间（秒）\n * @param string $msg 重定向前的提示信息\n * @return void\n */\nfunction redirect($url, $time=0, $msg='') {\n    //多行URL地址支持\n    $url        = str_replace(array(\"\\n\", \"\\r\"), '', $url);\n    if (empty($msg))\n        $msg    = \"系统将在{$time}秒之后自动跳转到{$url}！\";\n    if (!headers_sent()) {\n        // redirect\n        if (0 === $time) {\n            header('Location: ' . $url);\n        } else {\n            header(\"refresh:{$time};url={$url}\");\n            echo($msg);\n        }\n        exit();\n    } else {\n        $str    = \"<meta http-equiv='Refresh' content='{$time};URL={$url}'>\";\n        if ($time != 0)\n            $str .= $msg;\n        exit($str);\n    }\n}\n\n/**\n * 缓存管理\n * @param mixed $name 缓存名称，如果为数组表示进行缓存设置\n * @param mixed $value 缓存值\n * @param mixed $options 缓存参数\n * @return mixed\n */\nfunction S($name,$value='',$options=null) {\n    static $cache   =   '';\n    if(is_array($options)){\n        // 缓存操作的同时初始化\n        $type       =   isset($options['type'])?$options['type']:'';\n        $cache      =   Think\\Cache::getInstance($type,$options);\n    }elseif(is_array($name)) { // 缓存初始化\n        $type       =   isset($name['type'])?$name['type']:'';\n        $cache      =   Think\\Cache::getInstance($type,$name);\n        return $cache;\n    }elseif(empty($cache)) { // 自动初始化\n        $cache      =   Think\\Cache::getInstance();\n    }\n    if(''=== $value){ // 获取缓存\n        return $cache->get($name);\n    }elseif(is_null($value)) { // 删除缓存\n        return $cache->rm($name);\n    }else { // 缓存数据\n        if(is_array($options)) {\n            $expire     =   isset($options['expire'])?$options['expire']:NULL;\n        }else{\n            $expire     =   is_numeric($options)?$options:NULL;\n        }\n        return $cache->set($name, $value, $expire);\n    }\n}\n\n/**\n * 快速文件数据读取和保存 针对简单类型数据 字符串、数组\n * @param string $name 缓存名称\n * @param mixed $value 缓存值\n * @param string $path 缓存路径\n * @return mixed\n */\nfunction F($name, $value='', $path=DATA_PATH) {\n    static $_cache  =   array();\n    $filename       =   $path . $name . '.php';\n    if ('' !== $value) {\n        if (is_null($value)) {\n            // 删除缓存\n            if(false !== strpos($name,'*')){\n                return false; // TODO \n            }else{\n                unset($_cache[$name]);\n                return Think\\Storage::unlink($filename,'F');\n            }\n        } else {\n            Think\\Storage::put($filename,serialize($value),'F');\n            // 缓存数据\n            $_cache[$name]  =   $value;\n            return null;\n        }\n    }\n    // 获取缓存数据\n    if (isset($_cache[$name]))\n        return $_cache[$name];\n    if (Think\\Storage::has($filename,'F')){\n        $value      =   unserialize(Think\\Storage::read($filename,'F'));\n        $_cache[$name]  =   $value;\n    } else {\n        $value          =   false;\n    }\n    return $value;\n}\n\n/**\n * 根据PHP各种类型变量生成唯一标识号\n * @param mixed $mix 变量\n * @return string\n */\nfunction to_guid_string($mix) {\n    if (is_object($mix)) {\n        return spl_object_hash($mix);\n    } elseif (is_resource($mix)) {\n        $mix = get_resource_type($mix) . strval($mix);\n    } else {\n        $mix = serialize($mix);\n    }\n    return md5($mix);\n}\n\n/**\n * XML编码\n * @param mixed $data 数据\n * @param string $root 根节点名\n * @param string $item 数字索引的子节点名\n * @param string $attr 根节点属性\n * @param string $id   数字索引子节点key转换的属性名\n * @param string $encoding 数据编码\n * @return string\n */\nfunction xml_encode($data, $root='think', $item='item', $attr='', $id='id', $encoding='utf-8') {\n    if(is_array($attr)){\n        $_attr = array();\n        foreach ($attr as $key => $value) {\n            $_attr[] = \"{$key}=\\\"{$value}\\\"\";\n        }\n        $attr = implode(' ', $_attr);\n    }\n    $attr   = trim($attr);\n    $attr   = empty($attr) ? '' : \" {$attr}\";\n    $xml    = \"<?xml version=\\\"1.0\\\" encoding=\\\"{$encoding}\\\"?>\";\n    $xml   .= \"<{$root}{$attr}>\";\n    $xml   .= data_to_xml($data, $item, $id);\n    $xml   .= \"</{$root}>\";\n    return $xml;\n}\n\n/**\n * 数据XML编码\n * @param mixed  $data 数据\n * @param string $item 数字索引时的节点名称\n * @param string $id   数字索引key转换为的属性名\n * @return string\n */\nfunction data_to_xml($data, $item='item', $id='id') {\n    $xml = $attr = '';\n    foreach ($data as $key => $val) {\n        if(is_numeric($key)){\n            $id && $attr = \" {$id}=\\\"{$key}\\\"\";\n            $key  = $item;\n        }\n        $xml    .=  \"<{$key}{$attr}>\";\n        $xml    .=  (is_array($val) || is_object($val)) ? data_to_xml($val, $item, $id) : $val;\n        $xml    .=  \"</{$key}>\";\n    }\n    return $xml;\n}\n\n/**\n * session管理函数\n * @param string|array $name session名称 如果为数组则表示进行session设置\n * @param mixed $value session值\n * @return mixed\n */\nfunction session($name='',$value='') {\n    $prefix   =  C('SESSION_PREFIX');\n    if(is_array($name)) { // session初始化 在session_start 之前调用\n        if(isset($name['prefix'])) C('SESSION_PREFIX',$name['prefix']);\n        if(C('VAR_SESSION_ID') && isset($_REQUEST[C('VAR_SESSION_ID')])){\n            session_id($_REQUEST[C('VAR_SESSION_ID')]);\n        }elseif(isset($name['id'])) {\n            session_id($name['id']);\n        }\n        if('common' == APP_MODE){ // 其它模式可能不支持\n            ini_set('session.auto_start', 0);\n        }\n        if(isset($name['name']))            session_name($name['name']);\n        if(isset($name['path']))            session_save_path($name['path']);\n        if(isset($name['domain']))          ini_set('session.cookie_domain', $name['domain']);\n        if(isset($name['expire']))          {\n            ini_set('session.gc_maxlifetime',   $name['expire']);\n            ini_set('session.cookie_lifetime',  $name['expire']);\n        }\n        if(isset($name['use_trans_sid']))   ini_set('session.use_trans_sid', $name['use_trans_sid']?1:0);\n        if(isset($name['use_cookies']))     ini_set('session.use_cookies', $name['use_cookies']?1:0);\n        if(isset($name['cache_limiter']))   session_cache_limiter($name['cache_limiter']);\n        if(isset($name['cache_expire']))    session_cache_expire($name['cache_expire']);\n        if(isset($name['type']))            C('SESSION_TYPE',$name['type']);\n        if(C('SESSION_TYPE')) { // 读取session驱动\n            $type   =   C('SESSION_TYPE');\n            $class  =   strpos($type,'\\\\')? $type : 'Think\\\\Session\\\\Driver\\\\'. ucwords(strtolower($type));\n            $hander =   new $class();\n            session_set_save_handler(\n                array(&$hander,\"open\"), \n                array(&$hander,\"close\"), \n                array(&$hander,\"read\"), \n                array(&$hander,\"write\"), \n                array(&$hander,\"destroy\"), \n                array(&$hander,\"gc\")); \n        }\n        // 启动session\n        if(C('SESSION_AUTO_START'))  session_start();\n    }elseif('' === $value){ \n        if(''===$name){\n            // 获取全部的session\n            return $prefix ? $_SESSION[$prefix] : $_SESSION;\n        }elseif(0===strpos($name,'[')) { // session 操作\n            if('[pause]'==$name){ // 暂停session\n                session_write_close();\n            }elseif('[start]'==$name){ // 启动session\n                session_start();\n            }elseif('[destroy]'==$name){ // 销毁session\n                $_SESSION =  array();\n                session_unset();\n                session_destroy();\n            }elseif('[regenerate]'==$name){ // 重新生成id\n                session_regenerate_id();\n            }\n        }elseif(0===strpos($name,'?')){ // 检查session\n            $name   =  substr($name,1);\n            if(strpos($name,'.')){ // 支持数组\n                list($name1,$name2) =   explode('.',$name);\n                return $prefix?isset($_SESSION[$prefix][$name1][$name2]):isset($_SESSION[$name1][$name2]);\n            }else{\n                return $prefix?isset($_SESSION[$prefix][$name]):isset($_SESSION[$name]);\n            }\n        }elseif(is_null($name)){ // 清空session\n            if($prefix) {\n                unset($_SESSION[$prefix]);\n            }else{\n                $_SESSION = array();\n            }\n        }elseif($prefix){ // 获取session\n            if(strpos($name,'.')){\n                list($name1,$name2) =   explode('.',$name);\n                return isset($_SESSION[$prefix][$name1][$name2])?$_SESSION[$prefix][$name1][$name2]:null;  \n            }else{\n                return isset($_SESSION[$prefix][$name])?$_SESSION[$prefix][$name]:null;                \n            }            \n        }else{\n            if(strpos($name,'.')){\n                list($name1,$name2) =   explode('.',$name);\n                return isset($_SESSION[$name1][$name2])?$_SESSION[$name1][$name2]:null;  \n            }else{\n                return isset($_SESSION[$name])?$_SESSION[$name]:null;\n            }            \n        }\n    }elseif(is_null($value)){ // 删除session\n        if(strpos($name,'.')){\n            list($name1,$name2) =   explode('.',$name);\n            if($prefix){\n                unset($_SESSION[$prefix][$name1][$name2]);\n            }else{\n                unset($_SESSION[$name1][$name2]);\n            }\n        }else{\n            if($prefix){\n                unset($_SESSION[$prefix][$name]);\n            }else{\n                unset($_SESSION[$name]);\n            }\n        }\n    }else{ // 设置session\n\t\tif(strpos($name,'.')){\n\t\t\tlist($name1,$name2) =   explode('.',$name);\n\t\t\tif($prefix){\n\t\t\t\t$_SESSION[$prefix][$name1][$name2]   =  $value;\n\t\t\t}else{\n\t\t\t\t$_SESSION[$name1][$name2]  =  $value;\n\t\t\t}\n\t\t}else{\n\t\t\tif($prefix){\n\t\t\t\t$_SESSION[$prefix][$name]   =  $value;\n\t\t\t}else{\n\t\t\t\t$_SESSION[$name]  =  $value;\n\t\t\t}\n\t\t}\n    }\n    return null;\n}\n\n/**\n * Cookie 设置、获取、删除\n * @param string $name cookie名称\n * @param mixed $value cookie值\n * @param mixed $option cookie参数\n * @return mixed\n */\nfunction cookie($name='', $value='', $option=null) {\n    // 默认设置\n    $config = array(\n        'prefix'    =>  C('COOKIE_PREFIX'), // cookie 名称前缀\n        'expire'    =>  C('COOKIE_EXPIRE'), // cookie 保存时间\n        'path'      =>  C('COOKIE_PATH'), // cookie 保存路径\n        'domain'    =>  C('COOKIE_DOMAIN'), // cookie 有效域名\n        'secure'    =>  C('COOKIE_SECURE'), //  cookie 启用安全传输\n        'httponly'  =>  C('COOKIE_HTTPONLY'), // httponly设置\n    );\n    // 参数设置(会覆盖黙认设置)\n    if (!is_null($option)) {\n        if (is_numeric($option))\n            $option = array('expire' => $option);\n        elseif (is_string($option))\n            parse_str($option, $option);\n        $config     = array_merge($config, array_change_key_case($option));\n    }\n    if(!empty($config['httponly'])){\n        ini_set(\"session.cookie_httponly\", 1);\n    }\n    // 清除指定前缀的所有cookie\n    if (is_null($name)) {\n        if (empty($_COOKIE))\n            return null;\n        // 要删除的cookie前缀，不指定则删除config设置的指定前缀\n        $prefix = empty($value) ? $config['prefix'] : $value;\n        if (!empty($prefix)) {// 如果前缀为空字符串将不作处理直接返回\n            foreach ($_COOKIE as $key => $val) {\n                if (0 === stripos($key, $prefix)) {\n                    setcookie($key, '', time() - 3600, $config['path'], $config['domain'],$config['secure'],$config['httponly']);\n                    unset($_COOKIE[$key]);\n                }\n            }\n        }\n        return null;\n    }elseif('' === $name){\n        // 获取全部的cookie\n        return $_COOKIE;\n    }\n    $name = $config['prefix'] . str_replace('.', '_', $name);\n    if ('' === $value) {\n        if(isset($_COOKIE[$name])){\n            $value =    $_COOKIE[$name];\n            if(0===strpos($value,'think:')){\n                $value  =   substr($value,6);\n                return array_map('urldecode',json_decode(MAGIC_QUOTES_GPC?stripslashes($value):$value,true));\n            }else{\n                return $value;\n            }\n        }else{\n            return null;\n        }\n    } else {\n        if (is_null($value)) {\n            setcookie($name, '', time() - 3600, $config['path'], $config['domain'],$config['secure'],$config['httponly']);\n            unset($_COOKIE[$name]); // 删除指定cookie\n        } else {\n            // 设置cookie\n            if(is_array($value)){\n                $value  = 'think:'.json_encode(array_map('urlencode',$value));\n            }\n            $expire = !empty($config['expire']) ? time() + intval($config['expire']) : 0;\n            setcookie($name, $value, $expire, $config['path'], $config['domain'],$config['secure'],$config['httponly']);\n            $_COOKIE[$name] = $value;\n        }\n    }\n    return null;\n}\n\n/**\n * 加载动态扩展文件\n * @var string $path 文件路径\n * @return void\n */\nfunction load_ext_file($path) {\n    // 加载自定义外部文件\n    if($files = C('LOAD_EXT_FILE')) {\n        $files      =  explode(',',$files);\n        foreach ($files as $file){\n            $file   = $path.'Common/'.$file.'.php';\n            if(is_file($file)) include $file;\n        }\n    }\n    // 加载自定义的动态配置文件\n    if($configs = C('LOAD_EXT_CONFIG')) {\n        if(is_string($configs)) $configs =  explode(',',$configs);\n        foreach ($configs as $key=>$config){\n            $file   = is_file($config)? $config : $path.'Conf/'.$config.CONF_EXT;\n            if(is_file($file)) {\n                is_numeric($key)?C(load_config($file)):C($key,load_config($file));\n            }\n        }\n    }\n}\n\n/**\n * 获取客户端IP地址\n * @param integer $type 返回类型 0 返回IP地址 1 返回IPV4地址数字\n * @param boolean $adv 是否进行高级模式获取（有可能被伪装） \n * @return mixed\n */\nfunction get_client_ip($type = 0,$adv=false) {\n    $type       =  $type ? 1 : 0;\n    static $ip  =   NULL;\n    if ($ip !== NULL) return $ip[$type];\n    if($adv){\n        if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {\n            $arr    =   explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);\n            $pos    =   array_search('unknown',$arr);\n            if(false !== $pos) unset($arr[$pos]);\n            $ip     =   trim($arr[0]);\n        }elseif (isset($_SERVER['HTTP_CLIENT_IP'])) {\n            $ip     =   $_SERVER['HTTP_CLIENT_IP'];\n        }elseif (isset($_SERVER['REMOTE_ADDR'])) {\n            $ip     =   $_SERVER['REMOTE_ADDR'];\n        }\n    }elseif (isset($_SERVER['REMOTE_ADDR'])) {\n        $ip     =   $_SERVER['REMOTE_ADDR'];\n    }\n    // IP地址合法验证\n    $long = sprintf(\"%u\",ip2long($ip));\n    $ip   = $long ? array($ip, $long) : array('0.0.0.0', 0);\n    return $ip[$type];\n}\n\n/**\n * 发送HTTP状态\n * @param integer $code 状态码\n * @return void\n */\nfunction send_http_status($code) {\n    static $_status = array(\n            // Informational 1xx\n            100 => 'Continue',\n            101 => 'Switching Protocols',\n            // Success 2xx\n            200 => 'OK',\n            201 => 'Created',\n            202 => 'Accepted',\n            203 => 'Non-Authoritative Information',\n            204 => 'No Content',\n            205 => 'Reset Content',\n            206 => 'Partial Content',\n            // Redirection 3xx\n            300 => 'Multiple Choices',\n            301 => 'Moved Permanently',\n            302 => 'Moved Temporarily ',  // 1.1\n            303 => 'See Other',\n            304 => 'Not Modified',\n            305 => 'Use Proxy',\n            // 306 is deprecated but reserved\n            307 => 'Temporary Redirect',\n            // Client Error 4xx\n            400 => 'Bad Request',\n            401 => 'Unauthorized',\n            402 => 'Payment Required',\n            403 => 'Forbidden',\n            404 => 'Not Found',\n            405 => 'Method Not Allowed',\n            406 => 'Not Acceptable',\n            407 => 'Proxy Authentication Required',\n            408 => 'Request Timeout',\n            409 => 'Conflict',\n            410 => 'Gone',\n            411 => 'Length Required',\n            412 => 'Precondition Failed',\n            413 => 'Request Entity Too Large',\n            414 => 'Request-URI Too Long',\n            415 => 'Unsupported Media Type',\n            416 => 'Requested Range Not Satisfiable',\n            417 => 'Expectation Failed',\n            // Server Error 5xx\n            500 => 'Internal Server Error',\n            501 => 'Not Implemented',\n            502 => 'Bad Gateway',\n            503 => 'Service Unavailable',\n            504 => 'Gateway Timeout',\n            505 => 'HTTP Version Not Supported',\n            509 => 'Bandwidth Limit Exceeded'\n    );\n    if(isset($_status[$code])) {\n        header('HTTP/1.1 '.$code.' '.$_status[$code]);\n        // 确保FastCGI模式下正常\n        header('Status:'.$code.' '.$_status[$code]);\n    }\n}\n\nfunction think_filter(&$value){\n\t// TODO 其他安全过滤\n\n\t// 过滤查询特殊字符\n    if(preg_match('/^(EXP|NEQ|GT|EGT|LT|ELT|OR|XOR|LIKE|NOTLIKE|NOT BETWEEN|NOTBETWEEN|BETWEEN|NOTIN|NOT IN|IN)$/i',$value)){\n        $value .= ' ';\n    }\n}\n\n// 不区分大小写的in_array实现\nfunction in_array_case($value,$array){\n    return in_array(strtolower($value),array_map('strtolower',$array));\n}\n"
  },
  {
    "path": "ThinkPHP/Conf/convention.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\n/**\n * ThinkPHP惯例配置文件\n * 该文件请不要修改，如果要覆盖惯例配置的值，可在应用配置文件中设定和惯例不符的配置项\n * 配置名称大小写任意，系统会统一转换成小写\n * 所有配置参数都可以在生效前动态改变\n */\ndefined('THINK_PATH') or exit();\nreturn  array(\n    /* 应用设定 */\n    'APP_USE_NAMESPACE'     =>  true,    // 应用类库是否使用命名空间\n    'APP_SUB_DOMAIN_DEPLOY' =>  false,   // 是否开启子域名部署\n    'APP_SUB_DOMAIN_RULES'  =>  array(), // 子域名部署规则\n    'APP_DOMAIN_SUFFIX'     =>  '', // 域名后缀 如果是com.cn net.cn 之类的后缀必须设置    \n    'ACTION_SUFFIX'         =>  '', // 操作方法后缀\n    'MULTI_MODULE'          =>  true, // 是否允许多模块 如果为false 则必须设置 DEFAULT_MODULE\n    'MODULE_DENY_LIST'      =>  array('Common','Runtime'),\n    'CONTROLLER_LEVEL'      =>  1,\n    'APP_AUTOLOAD_LAYER'    =>  'Controller,Model', // 自动加载的应用类库层 关闭APP_USE_NAMESPACE后有效\n    'APP_AUTOLOAD_PATH'     =>  '', // 自动加载的路径 关闭APP_USE_NAMESPACE后有效\n\n    /* Cookie设置 */\n    'COOKIE_EXPIRE'         =>  0,       // Cookie有效期\n    'COOKIE_DOMAIN'         =>  '',      // Cookie有效域名\n    'COOKIE_PATH'           =>  '/',     // Cookie路径\n    'COOKIE_PREFIX'         =>  '',      // Cookie前缀 避免冲突\n    'COOKIE_SECURE'         =>  false,   // Cookie安全传输\n    'COOKIE_HTTPONLY'       =>  '',      // Cookie httponly设置\n\n    /* 默认设定 */\n    'DEFAULT_M_LAYER'       =>  'Model', // 默认的模型层名称\n    'DEFAULT_C_LAYER'       =>  'Controller', // 默认的控制器层名称\n    'DEFAULT_V_LAYER'       =>  'View', // 默认的视图层名称\n    'DEFAULT_LANG'          =>  'zh-cn', // 默认语言\n    'DEFAULT_THEME'         =>  '',\t// 默认模板主题名称\n    'DEFAULT_MODULE'        =>  'Home',  // 默认模块\n    'DEFAULT_CONTROLLER'    =>  'Index', // 默认控制器名称\n    'DEFAULT_ACTION'        =>  'index', // 默认操作名称\n    'DEFAULT_CHARSET'       =>  'utf-8', // 默认输出编码\n    'DEFAULT_TIMEZONE'      =>  'PRC',\t// 默认时区\n    'DEFAULT_AJAX_RETURN'   =>  'JSON',  // 默认AJAX 数据返回格式,可选JSON XML ...\n    'DEFAULT_JSONP_HANDLER' =>  'jsonpReturn', // 默认JSONP格式返回的处理方法\n    'DEFAULT_FILTER'        =>  'htmlspecialchars', // 默认参数过滤方法 用于I函数...\n\n    /* 数据库设置 */\n    'DB_TYPE'               =>  '',     // 数据库类型\n    'DB_HOST'               =>  '', // 服务器地址\n    'DB_NAME'               =>  '',          // 数据库名\n    'DB_USER'               =>  '',      // 用户名\n    'DB_PWD'                =>  '',          // 密码\n    'DB_PORT'               =>  '',        // 端口\n    'DB_PREFIX'             =>  '',    // 数据库表前缀\n    'DB_PARAMS'          \t=>  array(), // 数据库连接参数    \n    'DB_DEBUG'  \t\t\t=>  TRUE, // 数据库调试模式 开启后可以记录SQL日志\n    'DB_FIELDS_CACHE'       =>  true,        // 启用字段缓存\n    'DB_CHARSET'            =>  'utf8',      // 数据库编码默认采用utf8\n    'DB_DEPLOY_TYPE'        =>  0, // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)\n    'DB_RW_SEPARATE'        =>  false,       // 数据库读写是否分离 主从式有效\n    'DB_MASTER_NUM'         =>  1, // 读写分离后 主服务器数量\n    'DB_SLAVE_NO'           =>  '', // 指定从服务器序号\n\n    /* 数据缓存设置 */\n    'DATA_CACHE_TIME'       =>  0,      // 数据缓存有效期 0表示永久缓存\n    'DATA_CACHE_COMPRESS'   =>  false,   // 数据缓存是否压缩缓存\n    'DATA_CACHE_CHECK'      =>  false,   // 数据缓存是否校验缓存\n    'DATA_CACHE_PREFIX'     =>  '',     // 缓存前缀\n    'DATA_CACHE_TYPE'       =>  'File',  // 数据缓存类型,支持:File|Db|Apc|Memcache|Shmop|Sqlite|Xcache|Apachenote|Eaccelerator\n    'DATA_CACHE_PATH'       =>  TEMP_PATH,// 缓存路径设置 (仅对File方式缓存有效)\n    'DATA_CACHE_KEY'        =>  '',\t// 缓存文件KEY (仅对File方式缓存有效)    \n    'DATA_CACHE_SUBDIR'     =>  false,    // 使用子目录缓存 (自动根据缓存标识的哈希创建子目录)\n    'DATA_PATH_LEVEL'       =>  1,        // 子目录缓存级别\n\n    /* 错误设置 */\n    'ERROR_MESSAGE'         =>  '页面错误！请稍后再试～',//错误显示信息,非调试模式有效\n    'ERROR_PAGE'            =>  '',\t// 错误定向页面\n    'SHOW_ERROR_MSG'        =>  false,    // 显示错误信息\n    'TRACE_MAX_RECORD'      =>  100,    // 每个级别的错误信息 最大记录数\n\n    /* 日志设置 */\n    'LOG_RECORD'            =>  false,   // 默认不记录日志\n    'LOG_TYPE'              =>  'File', // 日志记录类型 默认为文件方式\n    'LOG_LEVEL'             =>  'EMERG,ALERT,CRIT,ERR',// 允许记录的日志级别\n    'LOG_FILE_SIZE'         =>  2097152,\t// 日志文件大小限制\n    'LOG_EXCEPTION_RECORD'  =>  false,    // 是否记录异常信息日志\n\n    /* SESSION设置 */\n    'SESSION_AUTO_START'    =>  true,    // 是否自动开启Session\n    'SESSION_OPTIONS'       =>  array(), // session 配置数组 支持type name id path expire domain 等参数\n    'SESSION_TYPE'          =>  '', // session hander类型 默认无需设置 除非扩展了session hander驱动\n    'SESSION_PREFIX'        =>  '', // session 前缀\n    //'VAR_SESSION_ID'      =>  'session_id',     //sessionID的提交变量\n\n    /* 模板引擎设置 */\n    'TMPL_CONTENT_TYPE'     =>  'text/html', // 默认模板输出类型\n    'TMPL_ACTION_ERROR'     =>  THINK_PATH.'Tpl/dispatch_jump.tpl', // 默认错误跳转对应的模板文件\n    'TMPL_ACTION_SUCCESS'   =>  THINK_PATH.'Tpl/dispatch_jump.tpl', // 默认成功跳转对应的模板文件\n    'TMPL_EXCEPTION_FILE'   =>  THINK_PATH.'Tpl/think_exception.tpl',// 异常页面的模板文件\n    'TMPL_DETECT_THEME'     =>  false,       // 自动侦测模板主题\n    'TMPL_TEMPLATE_SUFFIX'  =>  '.html',     // 默认模板文件后缀\n    'TMPL_FILE_DEPR'        =>  '/', //模板文件CONTROLLER_NAME与ACTION_NAME之间的分割符\n    // 布局设置\n    'TMPL_ENGINE_TYPE'      =>  'Think',     // 默认模板引擎 以下设置仅对使用Think模板引擎有效\n    'TMPL_CACHFILE_SUFFIX'  =>  '.php',      // 默认模板缓存后缀\n    'TMPL_DENY_FUNC_LIST'   =>  'echo,exit',    // 模板引擎禁用函数\n    'TMPL_DENY_PHP'         =>  false, // 默认模板引擎是否禁用PHP原生代码\n    'TMPL_L_DELIM'          =>  '{',            // 模板引擎普通标签开始标记\n    'TMPL_R_DELIM'          =>  '}',            // 模板引擎普通标签结束标记\n    'TMPL_VAR_IDENTIFY'     =>  'array',     // 模板变量识别。留空自动判断,参数为'obj'则表示对象\n    'TMPL_STRIP_SPACE'      =>  true,       // 是否去除模板文件里面的html空格与换行\n    'TMPL_CACHE_ON'         =>  true,        // 是否开启模板编译缓存,设为false则每次都会重新编译\n    'TMPL_CACHE_PREFIX'     =>  '',         // 模板缓存前缀标识，可以动态改变\n    'TMPL_CACHE_TIME'       =>  0,         // 模板缓存有效期 0 为永久，(以数字为值，单位:秒)\n    'TMPL_LAYOUT_ITEM'      =>  '{__CONTENT__}', // 布局模板的内容替换标识\n    'LAYOUT_ON'             =>  false, // 是否启用布局\n    'LAYOUT_NAME'           =>  'layout', // 当前布局名称 默认为layout\n\n    // Think模板引擎标签库相关设定\n    'TAGLIB_BEGIN'          =>  '<',  // 标签库标签开始标记\n    'TAGLIB_END'            =>  '>',  // 标签库标签结束标记\n    'TAGLIB_LOAD'           =>  true, // 是否使用内置标签库之外的其它标签库，默认自动检测\n    'TAGLIB_BUILD_IN'       =>  'cx', // 内置标签库名称(标签使用不必指定标签库名称),以逗号分隔 注意解析顺序\n    'TAGLIB_PRE_LOAD'       =>  '',   // 需要额外加载的标签库(须指定标签库名称)，多个以逗号分隔 \n    \n    /* URL设置 */\n    'URL_CASE_INSENSITIVE'  =>  true,   // 默认false 表示URL区分大小写 true则表示不区分大小写\n    'URL_MODEL'             =>  1,       // URL访问模式,可选参数0、1、2、3,代表以下四种模式：\n    // 0 (普通模式); 1 (PATHINFO 模式); 2 (REWRITE  模式); 3 (兼容模式)  默认为PATHINFO 模式\n    'URL_PATHINFO_DEPR'     =>  '/',\t// PATHINFO模式下，各参数之间的分割符号\n    'URL_PATHINFO_FETCH'    =>  'ORIG_PATH_INFO,REDIRECT_PATH_INFO,REDIRECT_URL', // 用于兼容判断PATH_INFO 参数的SERVER替代变量列表\n    'URL_REQUEST_URI'       =>  'REQUEST_URI', // 获取当前页面地址的系统变量 默认为REQUEST_URI\n    'URL_HTML_SUFFIX'       =>  'html',  // URL伪静态后缀设置\n    'URL_DENY_SUFFIX'       =>  'ico|png|gif|jpg', // URL禁止访问的后缀设置\n    'URL_PARAMS_BIND'       =>  true, // URL变量绑定到Action方法参数\n    'URL_PARAMS_BIND_TYPE'  =>  0, // URL变量绑定的类型 0 按变量名绑定 1 按变量顺序绑定\n    'URL_PARAMS_FILTER'     =>  false, // URL变量绑定过滤\n    'URL_PARAMS_FILTER_TYPE'=>  '', // URL变量绑定过滤方法 如果为空 调用DEFAULT_FILTER\n    'URL_ROUTER_ON'         =>  false,   // 是否开启URL路由\n    'URL_ROUTE_RULES'       =>  array(), // 默认路由规则 针对模块\n    'URL_MAP_RULES'         =>  array(), // URL映射定义规则\n\n    /* 系统变量名称设置 */\n    'VAR_MODULE'            =>  'm',     // 默认模块获取变量\n    'VAR_ADDON'             =>  'addon',     // 默认的插件控制器命名空间变量\n    'VAR_CONTROLLER'        =>  'c',    // 默认控制器获取变量\n    'VAR_ACTION'            =>  'a',    // 默认操作获取变量\n    'VAR_AJAX_SUBMIT'       =>  'ajax',  // 默认的AJAX提交变量\n    'VAR_JSONP_HANDLER'     =>  'callback',\n    'VAR_PATHINFO'          =>  's',    // 兼容模式PATHINFO获取变量例如 ?s=/module/action/id/1 后面的参数取决于URL_PATHINFO_DEPR\n    'VAR_TEMPLATE'          =>  't',    // 默认模板切换变量\n    'VAR_AUTO_STRING'\t\t=>\tfalse,\t// 输入变量是否自动强制转换为字符串 如果开启则数组变量需要手动传入变量修饰符获取变量\n\n    'HTTP_CACHE_CONTROL'    =>  'private',  // 网页缓存控制\n    'CHECK_APP_DIR'         =>  true,       // 是否检查应用目录是否创建\n    'FILE_UPLOAD_TYPE'      =>  'Local',    // 文件上传方式\n    'DATA_CRYPT_TYPE'       =>  'Think',    // 数据加密方式\n\n);\n"
  },
  {
    "path": "ThinkPHP/Conf/debug.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\n/**\n * ThinkPHP 默认的调试模式配置文件\n */\ndefined('THINK_PATH') or exit();\n// 调试模式下面默认设置 可以在应用配置目录下重新定义 debug.php 覆盖\nreturn  array(\n    'LOG_RECORD'            =>  true,  // 进行日志记录\n    'LOG_EXCEPTION_RECORD'  =>  true,    // 是否记录异常信息日志\n    'LOG_LEVEL'             =>  'EMERG,ALERT,CRIT,ERR,WARN,NOTIC,INFO,DEBUG,SQL',  // 允许记录的日志级别\n    'DB_FIELDS_CACHE'       =>  false, // 字段缓存信息\n    'DB_DEBUG'\t\t\t\t=>  true, // 开启调试模式 记录SQL日志\n    'TMPL_CACHE_ON'         =>  false,        // 是否开启模板编译缓存,设为false则每次都会重新编译\n    'TMPL_STRIP_SPACE'      =>  false,       // 是否去除模板文件里面的html空格与换行\n    'SHOW_ERROR_MSG'        =>  true,    // 显示错误信息\n    'URL_CASE_INSENSITIVE'  =>  false,  // URL区分大小写\n);"
  },
  {
    "path": "ThinkPHP/LICENSE.txt",
    "content": "\nThinkPHP遵循Apache2开源协议发布，并提供免费使用。\n版权所有Copyright © 2006-2014 by ThinkPHP (http://thinkphp.cn)\nAll rights reserved。\nThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。\n\nApache Licence是著名的非盈利开源组织Apache采用的协议。\n该协议和BSD类似，鼓励代码共享和尊重原作者的著作权，\n允许代码修改，再作为开源或商业软件发布。需要满足\n的条件： \n1． 需要给代码的用户一份Apache Licence ；\n2． 如果你修改了代码，需要在被修改的文件中说明；\n3． 在延伸的代码中（修改和有源代码衍生的代码中）需要\n带有原来代码中的协议，商标，专利声明和其他原来作者规\n定需要包含的说明；\n4． 如果再发布的产品中包含一个Notice文件，则在Notice文\n件中需要带有本协议内容。你可以在Notice中增加自己的\n许可，但不可以表现为对Apache Licence构成更改。 \n具体的协议参考：http://www.apache.org/licenses/LICENSE-2.0\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\nFOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\nCOPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\nBUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\nLIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\nANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "ThinkPHP/Lang/en-us.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\n/**\n * ThinkPHP English language package\n */\nreturn array(\n    /* core language package */ \n    '_MODULE_NOT_EXIST_'     => \"Module can't be loaded\",\n    '_CONTROLLER_NOT_EXIST_' =>\t\"Controller can't be loaded\",\n    '_ERROR_ACTION_'         => 'Illegal Action',\n    '_LANGUAGE_NOT_LOAD_'    => \"Can't load language package\",\n    '_TEMPLATE_NOT_EXIST_'   => \"Template doesn't exist\",\n    '_MODULE_'               => 'Module',\n    '_ACTION_'               => 'Action',\n    '_MODEL_NOT_EXIST_'      => \"Model can't be loaded\",\n    '_VALID_ACCESS_'         => 'No access',\n    '_XML_TAG_ERROR_'        => 'XML tag syntax errors',\n    '_DATA_TYPE_INVALID_'    => 'Illegal data objects!',\n    '_OPERATION_WRONG_'      => 'Operation error occurs',\n    '_NOT_LOAD_DB_'          => 'Unable to load the database',\n    '_NO_DB_DRIVER_'         => 'Unable to load database driver',\n    '_NOT_SUPPORT_DB_'       => 'The system is temporarily not support database',\n    '_NO_DB_CONFIG_'         => 'Not define the database configuration',\n    '_NOT_SUPPORT_'          => 'The system does not support',\n    '_CACHE_TYPE_INVALID_'   => 'Unable to load the cache type',\n    '_FILE_NOT_WRITABLE_'   => 'Directory (file) is not writable',\n    '_METHOD_NOT_EXIST_'     => 'The method you requested  does not exist!',\n    '_CLASS_NOT_EXIST_'      => 'Instantiating a class does not exist！',\n    '_CLASS_CONFLICT_'       => 'Class name conflicts',\n    '_TEMPLATE_ERROR_'       => 'Template Engine errors',\n    '_CACHE_WRITE_ERROR_'    => 'Cache file write failed!',\n    '_TAGLIB_NOT_EXIST_'     => 'Tag library is not defined',\n    '_OPERATION_FAIL_'       => 'Operation failed!',\n    '_OPERATION_SUCCESS_'    => 'Operation succeed!',\n    '_SELECT_NOT_EXIST_'     => 'Record does not exist!',\n    '_EXPRESS_ERROR_'        => 'Expression errors',\n    '_TOKEN_ERROR_'          => \"Form's token errors\",\n    '_RECORD_HAS_UPDATE_'    => 'Record has been updated',\n    '_NOT_ALLOW_PHP_'        => 'PHP codes are not allowed in the template',\n    '_PARAM_ERROR_'          => 'Parameter error or undefined',\n    '_ERROR_QUERY_EXPRESS_'  => 'Query express error',       \n);\n"
  },
  {
    "path": "ThinkPHP/Lang/pt-br.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: Daiane Azevedo <daianeaze16@gmail.com>\n// +----------------------------------------------------------------------\n\n/**\n * ThinkPHP Portuguese language package\n */\nreturn array(\n    /* core language package */ \n    '_MODULE_NOT_EXIST_'     => \"Módulo não pode ser carregado\",\n    '_CONTROLLER_NOT_EXIST_' => \"Controller não pode ser carregado\",\n    '_ERROR_ACTION_'         => 'Ação ilegal',\n    '_LANGUAGE_NOT_LOAD_'    => \"Não é possível carregar pacote da linguagem\",\n    '_TEMPLATE_NOT_EXIST_'   => \"Template não existe\",\n    '_MODULE_'               => 'Módulo',\n    '_ACTION_'               => 'Ação',\n    '_MODEL_NOT_EXIST_'      => \"Modelo não pode ser carregado\",\n    '_VALID_ACCESS_'         => 'Sem acesso',\n    '_XML_TAG_ERROR_'        => 'Erro de sintaxe - XML tag',\n    '_DATA_TYPE_INVALID_'    => 'Tipos de dados ilegais!',\n    '_OPERATION_WRONG_'      => 'Erro na operação',\n    '_NOT_LOAD_DB_'          => 'Impossível carregar banco de dados',\n    '_NO_DB_DRIVER_'         => 'Impossível carregar driver do bando de dados',\n    '_NOT_SUPPORT_DB_'       => 'Temporariamente sem suporte ao banco',\n    '_NO_DB_CONFIG_'         => 'Não define a configuração do banco',\n    '_NOT_SUPPORT_'          => 'O sistema não suporta',\n    '_CACHE_TYPE_INVALID_'   => 'Impossível carregar o tipo de cache',\n    '_FILE_NOT_WRITABLE_'   => 'Diretório (arquivo) não pode ser escrito',\n    '_METHOD_NOT_EXIST_'     => 'O método solicitado não existe!',\n    '_CLASS_NOT_EXIST_'      => 'Não existe instância da classe',\n    '_CLASS_CONFLICT_'       => 'Conflitos com nome da classe',\n    '_TEMPLATE_ERROR_'       => 'Erros na contrução do template',\n    '_CACHE_WRITE_ERROR_'    => 'Escrita do arquivo de cache falhou!',\n    '_TAGLIB_NOT_EXIST_'     => 'Biblioteca da tag não foi definida',\n    '_OPERATION_FAIL_'       => 'Operação falhou!',\n    '_OPERATION_SUCCESS_'    => 'Operação bem sucessida!',\n    '_SELECT_NOT_EXIST_'     => 'Gravação não existe!',\n    '_EXPRESS_ERROR_'        => 'Erros de expressão',\n    '_TOKEN_ERROR_'          => 'Erro no token do formulário',\n    '_RECORD_HAS_UPDATE_'    => 'Gravação não foi atualizada',\n    '_NOT_ALLOW_PHP_'        => 'Código PHP não é permitido no template',\n    '_PARAM_ERROR_'          => 'Parâmetro errado ou indefinido',\n    '_ERROR_QUERY_EXPRESS_'  => 'Erros na expressão da query',       \n);\n"
  },
  {
    "path": "ThinkPHP/Lang/zh-cn.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\n/**\n * ThinkPHP 简体中文语言包\n */\nreturn array(\n    /* 核心语言变量 */  \n    '_MODULE_NOT_EXIST_'     => '无法加载模块',\n    '_CONTROLLER_NOT_EXIST_' =>\t'无法加载控制器',\n    '_ERROR_ACTION_'         => '非法操作',\n    '_LANGUAGE_NOT_LOAD_'    => '无法加载语言包',\n    '_TEMPLATE_NOT_EXIST_'   => '模板不存在',\n    '_MODULE_'               => '模块',\n    '_ACTION_'               => '操作',\n    '_MODEL_NOT_EXIST_'      => '模型不存在或者没有定义',\n    '_VALID_ACCESS_'         => '没有权限',\n    '_XML_TAG_ERROR_'        => 'XML标签语法错误',\n    '_DATA_TYPE_INVALID_'    => '非法数据对象！',\n    '_OPERATION_WRONG_'      => '操作出现错误',\n    '_NOT_LOAD_DB_'          => '无法加载数据库',\n    '_NO_DB_DRIVER_'         => '无法加载数据库驱动',\n    '_NOT_SUPPORT_DB_'       => '系统暂时不支持数据库',\n    '_NO_DB_CONFIG_'         => '没有定义数据库配置',\n    '_NOT_SUPPORT_'          => '系统不支持',\n    '_CACHE_TYPE_INVALID_'   => '无法加载缓存类型',\n    '_FILE_NOT_WRITABLE_'   => '目录（文件）不可写',\n    '_METHOD_NOT_EXIST_'     => '方法不存在！',\n    '_CLASS_NOT_EXIST_'      => '实例化一个不存在的类！',\n    '_CLASS_CONFLICT_'       => '类名冲突',\n    '_TEMPLATE_ERROR_'       => '模板引擎错误',\n    '_CACHE_WRITE_ERROR_'    => '缓存文件写入失败！',\n    '_TAGLIB_NOT_EXIST_'     => '标签库未定义',\n    '_OPERATION_FAIL_'       => '操作失败！',\n    '_OPERATION_SUCCESS_'    => '操作成功！',\n    '_SELECT_NOT_EXIST_'     => '记录不存在！',\n    '_EXPRESS_ERROR_'        => '表达式错误',\n    '_TOKEN_ERROR_'          => '表单令牌错误',\n    '_RECORD_HAS_UPDATE_'    => '记录已经更新',\n    '_NOT_ALLOW_PHP_'        => '模板禁用PHP代码',\n    '_PARAM_ERROR_'          => '参数错误或者未定义',\n    '_ERROR_QUERY_EXPRESS_'  => '错误的查询条件',\n);\n"
  },
  {
    "path": "ThinkPHP/Lang/zh-tw.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\n/**\n * ThinkPHP 繁体中文語言包\n */\nreturn array(\n    /* 核心語言變數 */  \n    '_MODULE_NOT_EXIST_'     => '無法載入模組',\n    '_CONTROLLER_NOT_EXIST_' => '無法載入控制器',\n    '_ERROR_ACTION_'         => '非法操作',\n    '_LANGUAGE_NOT_LOAD_'    => '無法載入語言包',\n    '_TEMPLATE_NOT_EXIST_'   => '模板不存在',\n    '_MODULE_'               => '模組',\n    '_ACTION_'               => '操作',\n    '_MODEL_NOT_EXIST_'      => '模型不存在或者沒有定義',\n    '_VALID_ACCESS_'         => '沒有權限',\n    '_XML_TAG_ERROR_'        => 'XML標籤語法錯誤',\n    '_DATA_TYPE_INVALID_'    => '非法資料物件！',\n    '_OPERATION_WRONG_'      => '操作出現錯誤',\n    '_NOT_LOAD_DB_'          => '無法載入資料庫',\n    '_NO_DB_DRIVER_'         => '無法載入資料庫驅動',\n    '_NOT_SUPPORT_DB_'       => '系統暫時不支援資料庫',\n    '_NO_DB_CONFIG_'         => '沒有定義資料庫設定',\n    '_NOT_SUPPORT_'          => '系統不支援',\n    '_CACHE_TYPE_INVALID_'   => '無法載入快取類型',\n    '_FILE_NOT_WRITABLE_'   => '目錄（檔案）不可寫',\n    '_METHOD_NOT_EXIST_'     => '方法不存在！',\n    '_CLASS_NOT_EXIST_'      => '實例化一個不存在的類別！',\n    '_CLASS_CONFLICT_'       => '類別名稱衝突',\n    '_TEMPLATE_ERROR_'       => '模板引擎錯誤',\n    '_CACHE_WRITE_ERROR_'    => '快取檔案寫入失敗！',\n    '_TAGLIB_NOT_EXIST_'     => '標籤庫未定義',\n    '_OPERATION_FAIL_'       => '操作失敗！',\n    '_OPERATION_SUCCESS_'    => '操作成功！',\n    '_SELECT_NOT_EXIST_'     => '記錄不存在！',\n    '_EXPRESS_ERROR_'        => '運算式錯誤',\n    '_TOKEN_ERROR_'          => '表單權限錯誤',\n    '_RECORD_HAS_UPDATE_'    => '記錄已經更新',\n    '_NOT_ALLOW_PHP_'        => '模板禁用PHP代碼',\n    '_PARAM_ERROR_'          => '參數錯誤或者未定義',\n    '_ERROR_QUERY_EXPRESS_'  => '錯誤的查詢條件',    \n);\n"
  },
  {
    "path": "ThinkPHP/Library/Behavior/AgentCheckBehavior.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Behavior;\n/**\n * 行为扩展：代理检测\n */\nclass AgentCheckBehavior {\n    public function run(&$params) {\n        // 代理访问检测\n        $limitProxyVisit =  C('LIMIT_PROXY_VISIT',null,true);\n        if($limitProxyVisit && ($_SERVER['HTTP_X_FORWARDED_FOR'] || $_SERVER['HTTP_VIA'] || $_SERVER['HTTP_PROXY_CONNECTION'] || $_SERVER['HTTP_USER_AGENT_VIA'])) {\n            // 禁止代理访问\n            exit('Access Denied');\n        }\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Behavior/BorisBehavior.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Behavior;\nuse Think\\Think;\n/**\n * Boris行为扩展\n */\nclass BorisBehavior {\n    public function run(&$params) {\n        if(IS_CLI){\n            if(!function_exists('pcntl_signal'))\n                E(\"pcntl_signal not working.\\nRepl mode based on Linux OS or PHP for OS X(http://php-osx.liip.ch/)\\n\");\n            Think::addMap(array(\n                'Boris\\Boris'               => VENDOR_PATH . 'Boris/Boris.php',\n                'Boris\\Config'              => VENDOR_PATH . 'Boris/Config.php',\n                'Boris\\CLIOptionsHandler'   => VENDOR_PATH . 'Boris/CLIOptionsHandler.php',\n                'Boris\\ColoredInspector'    => VENDOR_PATH . 'Boris/ColoredInspector.php',\n                'Boris\\DumpInspector'       => VENDOR_PATH . 'Boris/DumpInspector.php',\n                'Boris\\EvalWorker'          => VENDOR_PATH . 'Boris/EvalWorker.php',    \n                'Boris\\ExportInspector'     => VENDOR_PATH . 'Boris/ExportInspector.php',\n                'Boris\\Inspector'           => VENDOR_PATH . 'Boris/Inspector.php',\n                'Boris\\ReadlineClient'      => VENDOR_PATH . 'Boris/ReadlineClient.php',\n                'Boris\\ShallowParser'       => VENDOR_PATH . 'Boris/ShallowParser.php',\n            ));\n            $boris      =   new \\Boris\\Boris(\">>> \");\n            $config     =   new \\Boris\\Config();\n            $config->apply($boris, true);\n            $options    =   new \\Boris\\CLIOptionsHandler();\n            $options->handle($boris);\n            $boris->onStart(sprintf(\"echo 'REPL MODE FOR THINKPHP \\nTHINKPHP_VERSION: %s, PHP_VERSION: %s, BORIS_VERSION: %s\\n';\", THINK_VERSION, PHP_VERSION, $boris::VERSION));\n            $boris->start();\n        }\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Behavior/BrowserCheckBehavior.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Behavior;\n/**\n * 浏览器防刷新检测\n */\nclass BrowserCheckBehavior {\n    public function run(&$params) {\n        if($_SERVER['REQUEST_METHOD'] == 'GET') {\n            //\t启用页面防刷新机制\n            $guid\t=\tmd5($_SERVER['PHP_SELF']);\n            // 浏览器防刷新的时间间隔（秒） 默认为10\n            $refleshTime    =   C('LIMIT_REFLESH_TIMES',null,10);\n            // 检查页面刷新间隔\n            if(cookie('_last_visit_time_'.$guid) && cookie('_last_visit_time_'.$guid)>time()-$refleshTime) {\n                // 页面刷新读取浏览器缓存\n                header('HTTP/1.1 304 Not Modified');\n                exit;\n            }else{\n                // 缓存当前地址访问时间\n                cookie('_last_visit_time_'.$guid, $_SERVER['REQUEST_TIME']);\n                //header('Last-Modified:'.(date('D,d M Y H:i:s',$_SERVER['REQUEST_TIME']-C('LIMIT_REFLESH_TIMES'))).' GMT');\n            }\n        }\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Behavior/BuildLiteBehavior.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Behavior;\n// 创建Lite运行文件\n// 可以替换框架入口文件运行\n// 建议绑定位置app_init\nclass BuildLiteBehavior {\n    public function run(&$params) {\n        if(!defined('BUILD_LITE_FILE')) return ;\n        $litefile   =   C('RUNTIME_LITE_FILE',null,RUNTIME_PATH.'lite.php');\n        if(is_file($litefile)) return;\n        \n        $defs       =   get_defined_constants(TRUE);\n        $content    =   'namespace {$GLOBALS[\\'_beginTime\\'] = microtime(TRUE);';\n        if(MEMORY_LIMIT_ON) {\n            $content .= '$GLOBALS[\\'_startUseMems\\'] = memory_get_usage();';\n        }\n\n        // 生成数组定义\n        unset($defs['user']['BUILD_LITE_FILE']);\n        $content   .=   $this->buildArrayDefine($defs['user']).'}';\n\n        // 读取编译列表文件\n        $filelist   =   is_file(CONF_PATH.'lite.php')?\n            include CONF_PATH.'lite.php':\n            array(\n                THINK_PATH.'Common/functions.php',\n                COMMON_PATH.'Common/function.php',\n                CORE_PATH . 'Think'.EXT,\n                CORE_PATH . 'Hook'.EXT,\n                CORE_PATH . 'App'.EXT,\n                CORE_PATH . 'Dispatcher'.EXT,\n                CORE_PATH . 'Log'.EXT,\n                CORE_PATH . 'Log/Driver/File'.EXT,\n                CORE_PATH . 'Route'.EXT,\n                CORE_PATH . 'Controller'.EXT,\n                CORE_PATH . 'View'.EXT,\n                CORE_PATH . 'Storage'.EXT,\n                CORE_PATH . 'Storage/Driver/File'.EXT,\n                CORE_PATH . 'Exception'.EXT,\n                BEHAVIOR_PATH . 'ParseTemplateBehavior'.EXT,\n                BEHAVIOR_PATH . 'ContentReplaceBehavior'.EXT,\n            );\n\n        // 编译文件\n        foreach ($filelist as $file){\n          if(is_file($file)) {\n            $content   .= compile($file);\n          }\n        }\n\n        // 处理Think类的start方法\n        $content  =  preg_replace('/\\$runtimefile = RUNTIME_PATH(.+?)(if\\(APP_STATUS)/','\\2',$content,1);\n        $content  .=  \"\\nnamespace { Think\\Think::addMap(\".var_export(\\Think\\Think::getMap(),true).\");\";\n        $content  .=  \"\\nL(\".var_export(L(),true).\");\\nC(\".var_export(C(),true).');Think\\Hook::import('.var_export(\\Think\\Hook::get(),true).');Think\\Think::start();}';\n\n        // 生成运行Lite文件\n        file_put_contents($litefile,strip_whitespace('<?php '.$content));\n    }\n\n    // 根据数组生成常量定义\n    private function buildArrayDefine($array) {\n        $content = \"\\n\";\n        foreach ($array as $key => $val) {\n            $key = strtoupper($key);\n            $content .= 'defined(\\'' . $key . '\\') or ';\n            if (is_int($val) || is_float($val)) {\n                $content .= \"define('\" . $key . \"',\" . $val . ');';\n            } elseif (is_bool($val)) {\n                $val = ($val) ? 'true' : 'false';\n                $content .= \"define('\" . $key . \"',\" . $val . ');';\n            } elseif (is_string($val)) {\n                $content .= \"define('\" . $key . \"','\" . addslashes($val) . \"');\";\n            }\n            $content    .= \"\\n\";\n        }\n        return $content;\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Behavior/CheckActionRouteBehavior.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2012 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Behavior;\n/**\n * 系统行为扩展：操作路由检测\n */\nclass CheckActionRouteBehavior {\n\n    // 行为扩展的执行入口必须是run\n    public function run(&$config){\n        // 优先检测是否存在PATH_INFO\n        $regx   =   trim($_SERVER['PATH_INFO'],'/');\n        if(empty($regx)) return ;\n        // 路由定义文件优先于config中的配置定义\n        // 路由处理\n        $routes =   $config['routes'];\n        if(!empty($routes)) {\n            $depr = C('URL_PATHINFO_DEPR');\n            // 分隔符替换 确保路由定义使用统一的分隔符\n            $regx = str_replace($depr,'/',$regx);\n            $regx = substr_replace($regx,'',0,strlen(__URL__));\n            foreach ($routes as $rule=>$route){\n                if(0===strpos($rule,'/') && preg_match($rule,$regx,$matches)) { // 正则路由\n                    return C('ACTION_NAME',$this->parseRegex($matches,$route,$regx));\n                }else{ // 规则路由\n                    $len1   =   substr_count($regx,'/');\n                    $len2   =   substr_count($rule,'/');\n                    if($len1>=$len2) {\n                        if('$' == substr($rule,-1,1)) {// 完整匹配\n                            if($len1 != $len2) {\n                                continue;\n                            }else{\n                                $rule =  substr($rule,0,-1);\n                            }\n                        }\n                        $match  =  $this->checkUrlMatch($regx,$rule);\n                        if($match)  return C('ACTION_NAME',$this->parseRule($rule,$route,$regx));\n                    }\n                }\n            }\n        }\n    }\n\n    // 检测URL和规则路由是否匹配\n    private function checkUrlMatch($regx,$rule) {\n        $m1     =   explode('/',$regx);\n        $m2     =   explode('/',$rule);\n        $match  =   true; // 是否匹配\n        foreach ($m2 as $key=>$val){\n            if(':' == substr($val,0,1)) {// 动态变量\n                if(strpos($val,'\\\\')) {\n                    $type = substr($val,-1);\n                    if('d'==$type && !is_numeric($m1[$key])) {\n                        $match = false;\n                        break;\n                    }\n                }elseif(strpos($val,'^')){\n                    $array   =  explode('|',substr(strstr($val,'^'),1));\n                    if(in_array($m1[$key],$array)) {\n                        $match = false;\n                        break;\n                    }\n                }\n            }elseif(0 !== strcasecmp($val,$m1[$key])){\n                $match = false;\n                break;\n            }\n        }\n        return $match;\n    }\n\n    // 解析规范的路由地址\n    // 地址格式 操作?参数1=值1&参数2=值2...\n    private function parseUrl($url) {\n        $var  =  array();\n        if(false !== strpos($url,'?')) { // 操作?参数1=值1&参数2=值2...\n            $info   =   parse_url($url);\n            $path   =   $info['path'];\n            parse_str($info['query'],$var);\n        }else{ // 操作\n            $path   =   $url;\n        }\n        $var[C('VAR_ACTION')] = $path;\n        return $var;\n    }\n\n    // 解析规则路由\n    // '路由规则'=>'操作?额外参数1=值1&额外参数2=值2...'\n    // '路由规则'=>array('操作','额外参数1=值1&额外参数2=值2...')\n    // '路由规则'=>'外部地址'\n    // '路由规则'=>array('外部地址','重定向代码')\n    // 路由规则中 :开头 表示动态变量\n    // 外部地址中可以用动态变量 采用 :1 :2 的方式\n    // 'news/:month/:day/:id'=>array('News/read?cate=1','status=1'),\n    // 'new/:id'=>array('/new.php?id=:1',301), 重定向\n    private function parseRule($rule,$route,$regx) {\n        // 获取路由地址规则\n        $url        =   is_array($route)?$route[0]:$route;\n        // 获取URL地址中的参数\n        $paths      =   explode('/',$regx);\n        // 解析路由规则\n        $matches    =   array();\n        $rule       =   explode('/',$rule);\n        foreach ($rule as $item){\n            if(0===strpos($item,':')) { // 动态变量获取\n                if($pos = strpos($item,'^') ) {\n                    $var  =  substr($item,1,$pos-1);\n                }elseif(strpos($item,'\\\\')){\n                    $var  =  substr($item,1,-2);\n                }else{\n                    $var  =  substr($item,1);\n                }\n                $matches[$var] = array_shift($paths);\n            }else{ // 过滤URL中的静态变量\n                array_shift($paths);\n            }\n        }\n        if(0=== strpos($url,'/') || 0===strpos($url,'http')) { // 路由重定向跳转\n            if(strpos($url,':')) { // 传递动态参数\n                $values =   array_values($matches);\n                $url    =   preg_replace('/:(\\d+)/e','$values[\\\\1-1]',$url);\n            }\n            header(\"Location: $url\", true,(is_array($route) && isset($route[1]))?$route[1]:301);\n            exit;\n        }else{\n            // 解析路由地址\n            $var        =   $this->parseUrl($url);\n            // 解析路由地址里面的动态参数\n            $values     =   array_values($matches);\n            foreach ($var as $key=>$val){\n                if(0===strpos($val,':')) {\n                    $var[$key] =  $values[substr($val,1)-1];\n                }\n            }\n            $var        =   array_merge($matches,$var);\n            // 解析剩余的URL参数\n            if($paths) {\n                preg_replace('@(\\w+)\\/([^\\/]+)@e', '$var[strtolower(\\'\\\\1\\')]=strip_tags(\\'\\\\2\\');', implode('/',$paths));\n            }\n            // 解析路由自动传入参数\n            if(is_array($route) && isset($route[1])) {\n                parse_str($route[1],$params);\n                $var   =   array_merge($var,$params);\n            }\n            $action =   $var[C('VAR_ACTION')];\n            unset($var[C('VAR_ACTION')]);\n            $_GET   =   array_merge($var,$_GET);\n            return $action;\n        }\n    }\n\n    // 解析正则路由\n    // '路由正则'=>'[分组/模块/操作]?参数1=值1&参数2=值2...'\n    // '路由正则'=>array('[分组/模块/操作]?参数1=值1&参数2=值2...','额外参数1=值1&额外参数2=值2...')\n    // '路由正则'=>'外部地址'\n    // '路由正则'=>array('外部地址','重定向代码')\n    // 参数值和外部地址中可以用动态变量 采用 :1 :2 的方式\n    // '/new\\/(\\d+)\\/(\\d+)/'=>array('News/read?id=:1&page=:2&cate=1','status=1'),\n    // '/new\\/(\\d+)/'=>array('/new.php?id=:1&page=:2&status=1','301'), 重定向\n    private function parseRegex($matches,$route,$regx) {\n        // 获取路由地址规则\n        $url   =  is_array($route)?$route[0]:$route;\n        $url   =  preg_replace('/:(\\d+)/e','$matches[\\\\1]',$url);\n        if(0=== strpos($url,'/') || 0===strpos($url,'http')) { // 路由重定向跳转\n            header(\"Location: $url\", true,(is_array($route) && isset($route[1]))?$route[1]:301);\n            exit;\n        }else{\n            // 解析路由地址\n            $var    =   $this->parseUrl($url);\n            // 解析剩余的URL参数\n            $regx   =   substr_replace($regx,'',0,strlen($matches[0]));\n            if($regx) {\n                preg_replace('@(\\w+)\\/([^,\\/]+)@e', '$var[strtolower(\\'\\\\1\\')]=strip_tags(\\'\\\\2\\');', $regx);\n            }\n            // 解析路由自动传入参数\n            if(is_array($route) && isset($route[1])) {\n                parse_str($route[1],$params);\n                $var   =   array_merge($var,$params);\n            }\n            $action =   $var[C('VAR_ACTION')];\n            unset($var[C('VAR_ACTION')]);\n            $_GET   =   array_merge($var,$_GET);\n        }\n        return $action;\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Behavior/CheckLangBehavior.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2012 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Behavior;\n/**\n * 语言检测 并自动加载语言包\n */\nclass CheckLangBehavior {\n\n    // 行为扩展的执行入口必须是run\n    public function run(&$params){\n        // 检测语言\n        $this->checkLanguage();\n    }\n\n    /**\n     * 语言检查\n     * 检查浏览器支持语言，并自动加载语言包\n     * @access private\n     * @return void\n     */\n    private function checkLanguage() {\n        // 不开启语言包功能，仅仅加载框架语言文件直接返回\n        if (!C('LANG_SWITCH_ON',null,false)){\n            return;\n        }\n        $langSet = C('DEFAULT_LANG');\n        $varLang =  C('VAR_LANGUAGE',null,'l');\n        $langList = C('LANG_LIST',null,'zh-cn');\n        // 启用了语言包功能\n        // 根据是否启用自动侦测设置获取语言选择\n        if (C('LANG_AUTO_DETECT',null,true)){\n            if(isset($_GET[$varLang])){\n                $langSet = $_GET[$varLang];// url中设置了语言变量\n                cookie('think_language',$langSet,3600);\n            }elseif(cookie('think_language')){// 获取上次用户的选择\n                $langSet = cookie('think_language');\n            }elseif(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){// 自动侦测浏览器语言\n                preg_match('/^([a-z\\d\\-]+)/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $matches);\n                $langSet = $matches[1];\n                cookie('think_language',$langSet,3600);\n            }\n            if(false === stripos($langList,$langSet)) { // 非法语言参数\n                $langSet = C('DEFAULT_LANG');\n            }\n        }\n        // 定义当前语言\n        define('LANG_SET',strtolower($langSet));\n\n        // 读取框架语言包\n        $file   =   THINK_PATH.'Lang/'.LANG_SET.'.php';\n        if(LANG_SET != C('DEFAULT_LANG') && is_file($file))\n            L(include $file);\n\n        // 读取应用公共语言包\n        $file   =  LANG_PATH.LANG_SET.'.php';\n        if(is_file($file))\n            L(include $file);\n        \n        // 读取模块语言包\n        $file   =   MODULE_PATH.'Lang/'.LANG_SET.'.php';\n        if(is_file($file))\n            L(include $file);\n\n        // 读取当前控制器语言包\n        $file   =   MODULE_PATH.'Lang/'.LANG_SET.'/'.strtolower(CONTROLLER_NAME).'.php';\n        if (is_file($file))\n            L(include $file);\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Behavior/ChromeShowPageTraceBehavior.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: luofei614 <weibo.com/luofei614>\n// +----------------------------------------------------------------------\n// $Id$\n\n/**\n * 将Trace信息输出到chrome浏览器的控制器，从而不影响ajax效果和页面的布局。\n * 使用前，你需要先安装 chrome log 这个插件： http://craig.is/writing/chrome-logger。\n * 定义应用的tags.php文件 Application/Common/Conf/tags.php， \n * <code>\n * <?php return array(\n *   'app_end'=>array(\n *       'Behavior\\ChromeShowPageTrace'\n *   )\n * );\n * </code>\n * 如果trace信息没有正常输出，请查看您的日志。\n * 这是通过http headers和chrome通信，所以要保证在输出trace信息之前不能有\n * headers输出，你可以在入口文件第一行加入代码 ob_start(); 或者配置output_buffering\n *\n */\nnamespace Behavior;\nuse Think\\Log;\n\n/**\n * 系统行为扩展 页面Trace显示输出\n */\nclass ChromeShowPageTraceBehavior {\n\n    protected $tracePageTabs =  array('BASE'=>'基本','FILE'=>'文件','INFO'=>'流程','ERR|NOTIC'=>'错误','SQL'=>'SQL','DEBUG'=>'调试');\n\n    // 行为扩展的执行入口必须是run\n    public function run(&$params){\n        if(C('SHOW_PAGE_TRACE')) $this->showTrace();\n    }\n\n   \n    /**\n     * 显示页面Trace信息\n     * @access private\n     */\n    private function showTrace() {\n         // 系统默认显示信息\n        $files  =  get_included_files();\n        $info   =   array();\n        foreach ($files as $key=>$file){\n            $info[] = $file.' ( '.number_format(filesize($file)/1024,2).' KB )';\n        }\n        $trace  =   array();\n        $base   =   array(\n            '请求信息'  =>  date('Y-m-d H:i:s',$_SERVER['REQUEST_TIME']).' '.$_SERVER['SERVER_PROTOCOL'].' '.$_SERVER['REQUEST_METHOD'].' : '.__SELF__,\n            '运行时间'  =>  $this->showTime(),\n\t\t\t'吞吐率'\t=>\tnumber_format(1/G('beginTime','viewEndTime'),2).'req/s',\n            '内存开销'  =>  MEMORY_LIMIT_ON?number_format((memory_get_usage() - $GLOBALS['_startUseMems'])/1024,2).' kb':'不支持',\n            '查询信息'  =>  N('db_query').' queries '.N('db_write').' writes ',\n            '文件加载'  =>  count(get_included_files()),\n            '缓存信息'  =>  N('cache_read').' gets '.N('cache_write').' writes ',\n            '配置加载'  =>  count(c()),\n            '会话信息'  =>  'SESSION_ID='.session_id(),\n            );\n        // 读取应用定义的Trace文件\n        $traceFile  =   COMMON_PATH.'Conf/trace.php';\n        if(is_file($traceFile)) {\n            $base   =   array_merge($base,include $traceFile);\n        }\n\n        $debug  =   trace();\n        $tabs   =   C('TRACE_PAGE_TABS',null,$this->tracePageTabs);\n        foreach ($tabs as $name=>$title){\n            switch(strtoupper($name)) {\n                case 'BASE':// 基本信息\n                    $trace[$title]  =   $base;\n                    break;\n                case 'FILE': // 文件信息\n                    $trace[$title]  =   $info;\n                    break;\n                default:// 调试信息\n                    $name       =   strtoupper($name);\n                    if(strpos($name,'|')) {// 多组信息\n                        $array  =   explode('|',$name);\n                        $result =   array();\n                        foreach($array as $name){\n                            $result   +=   isset($debug[$name])?$debug[$name]:array();\n                        }\n                        $trace[$title]  =   $result;\n                    }else{\n                        $trace[$title]  =   isset($debug[$name])?$debug[$name]:'';\n                    }\n            }\n        }\n      chrome_debug('TRACE信息:'.__SELF__,'group');\n        //输出日志\n        foreach($trace as $title=>$log){\n            '错误'==$title?chrome_debug($title,'group'):chrome_debug($title,'groupCollapsed');\n            foreach($log as $i=>$logstr){\n                chrome_debug($i.'.'.$logstr,'log');\n            }\n            chrome_debug('','groupEnd');\n        }\n       chrome_debug('','groupEnd');\n        if($save = C('PAGE_TRACE_SAVE')) { // 保存页面Trace日志\n            if(is_array($save)) {// 选择选项卡保存\n                $tabs   =   C('TRACE_PAGE_TABS',null,$this->tracePageTabs);\n                $array  =   array();\n                foreach ($save as $tab){\n                    $array[] =   $tabs[$tab];\n                }\n            }\n            $content    =   date('[ c ]').' '.get_client_ip().' '.$_SERVER['REQUEST_URI'].\"\\r\\n\";\n            foreach ($trace as $key=>$val){\n                if(!isset($array) || in_array($key,$array)) {\n                    $content    .=  '[ '.$key.\" ]\\r\\n\";\n                    if(is_array($val)) {\n                        foreach ($val as $k=>$v){\n                            $content .= (!is_numeric($k)?$k.':':'').print_r($v,true).\"\\r\\n\";\n                        }\n                    }else{\n                        $content .= print_r($val,true).\"\\r\\n\";\n                    }\n                    $content .= \"\\r\\n\";\n                }\n            }\n            error_log(str_replace('<br/>',\"\\r\\n\",$content), 3,LOG_PATH.date('y_m_d').'_trace.log');\n        }\n        unset($files,$info,$base);\n    }\n\n    /**\n     * 获取运行时间\n     */\n    private function showTime() {\n        // 显示运行时间\n        G('beginTime',$GLOBALS['_beginTime']);\n        G('viewEndTime');\n        // 显示详细运行时间\n        return G('beginTime','viewEndTime').'s ( Load:'.G('beginTime','loadTime').'s Init:'.G('loadTime','initTime').'s Exec:'.G('initTime','viewStartTime').'s Template:'.G('viewStartTime','viewEndTime').'s )';\n    }\n}\nif(!function_exists('chrome_debug')){\n//ChromePhp 输出trace的函数\nfunction chrome_debug($msg,$type='trace',$trace_level=1){\n    if('trace'==$type){\n        ChromePhp::groupCollapsed($msg);\n        $traces=debug_backtrace(false);\n        $traces=array_reverse($traces);\n        $max=count($traces)-$trace_level;\n        for($i=0;$i<$max;$i++){\n            $trace=$traces[$i];\n            $fun=isset($trace['class'])?$trace['class'].'::'.$trace['function']:$trace['function'];\n            $file=isset($trace['file'])?$trace['file']:'unknown file';\n            $line=isset($trace['line'])?$trace['line']:'unknown line';\n            $trace_msg='#'.$i.'  '.$fun.' called at ['.$file.':'.$line.']';\n            if(!empty($trace['args'])){\n                ChromePhp::groupCollapsed($trace_msg);\n                ChromePhp::log($trace['args']);\n                ChromePhp::groupEnd();\n            }else{\n                ChromePhp::log($trace_msg);\n            }\n        }\n        ChromePhp::groupEnd();\n    }else{\n        if(method_exists('Behavior\\ChromePhp',$type)){\n            //支持type trace，warn,log,error,group, groupCollapsed, groupEnd等\n            call_user_func(array('Behavior\\ChromePhp',$type),$msg);\n        }else{\n            //如果type不为trace,warn,log等，则为log的标签\n            call_user_func_array(array('Behavior\\ChromePhp','log'),func_get_args());\n        }\n    }\n}\n\n\n \n/**\n * Server Side Chrome PHP debugger class\n *\n * @package ChromePhp\n * @author Craig Campbell <iamcraigcampbell@gmail.com>\n */\nclass ChromePhp{\n    /**\n     * @var string\n     */\n    const VERSION = '4.1.0';\n\n    /**\n     * @var string\n     */\n    const HEADER_NAME = 'X-ChromeLogger-Data';\n\n    /**\n     * @var string\n     */\n    const BACKTRACE_LEVEL = 'backtrace_level';\n\n    /**\n     * @var string\n     */\n    const LOG = 'log';\n\n    /**\n     * @var string\n     */\n    const WARN = 'warn';\n\n    /**\n     * @var string\n     */\n    const ERROR = 'error';\n\n    /**\n     * @var string\n     */\n    const GROUP = 'group';\n\n    /**\n     * @var string\n     */\n    const INFO = 'info';\n\n    /**\n     * @var string\n     */\n    const GROUP_END = 'groupEnd';\n\n    /**\n     * @var string\n     */\n    const GROUP_COLLAPSED = 'groupCollapsed';\n\n    /**\n     * @var string\n     */\n    const TABLE = 'table';\n\n    /**\n     * @var string\n     */\n    protected $_php_version;\n\n    /**\n     * @var int\n     */\n    protected $_timestamp;\n\n    /**\n     * @var array\n     */\n    protected $_json = array(\n        'version' => self::VERSION,\n        'columns' => array('log', 'backtrace', 'type'),\n        'rows' => array()\n    );\n\n    /**\n     * @var array\n     */\n    protected $_backtraces = array();\n\n    /**\n     * @var bool\n     */\n    protected $_error_triggered = false;\n\n    /**\n     * @var array\n     */\n    protected $_settings = array(\n        self::BACKTRACE_LEVEL => 1\n    );\n\n    /**\n     * @var ChromePhp\n     */\n    protected static $_instance;\n\n    /**\n     * Prevent recursion when working with objects referring to each other\n     *\n     * @var array\n     */\n    protected $_processed = array();\n\n    /**\n     * constructor\n     */\n    private function __construct()\n    {\n        $this->_php_version = phpversion();\n        $this->_timestamp = $this->_php_version >= 5.1 ? $_SERVER['REQUEST_TIME'] : time();\n        $this->_json['request_uri'] = $_SERVER['REQUEST_URI'];\n    }\n\n    /**\n     * gets instance of this class\n     *\n     * @return ChromePhp\n     */\n    public static function getInstance()\n    {\n        if (self::$_instance === null) {\n            self::$_instance = new self();\n        }\n        return self::$_instance;\n    }\n\n    /**\n     * logs a variable to the console\n     *\n     * @param mixed $data,... unlimited OPTIONAL number of additional logs [...]\n     * @return void\n     */\n    public static function log()\n    {\n        $args = func_get_args();\n        return self::_log('', $args);\n    }\n\n    /**\n     * logs a warning to the console\n     *\n     * @param mixed $data,... unlimited OPTIONAL number of additional logs [...]\n     * @return void\n     */\n    public static function warn()\n    {\n        $args = func_get_args();\n        return self::_log(self::WARN, $args);\n    }\n\n    /**\n     * logs an error to the console\n     *\n     * @param mixed $data,... unlimited OPTIONAL number of additional logs [...]\n     * @return void\n     */\n    public static function error()\n    {\n        $args = func_get_args();\n        return self::_log(self::ERROR, $args);\n    }\n\n    /**\n     * sends a group log\n     *\n     * @param string value\n     */\n    public static function group()\n    {\n        $args = func_get_args();\n        return self::_log(self::GROUP, $args);\n    }\n\n    /**\n     * sends an info log\n     *\n     * @param mixed $data,... unlimited OPTIONAL number of additional logs [...]\n     * @return void\n     */\n    public static function info()\n    {\n        $args = func_get_args();\n        return self::_log(self::INFO, $args);\n    }\n\n    /**\n     * sends a collapsed group log\n     *\n     * @param string value\n     */\n    public static function groupCollapsed()\n    {\n        $args = func_get_args();\n        return self::_log(self::GROUP_COLLAPSED, $args);\n    }\n\n    /**\n     * ends a group log\n     *\n     * @param string value\n     */\n    public static function groupEnd()\n    {\n        $args = func_get_args();\n        return self::_log(self::GROUP_END, $args);\n    }\n\n    /**\n     * sends a table log\n     *\n     * @param string value\n     */\n    public static function table()\n    {\n        $args = func_get_args();\n        return self::_log(self::TABLE, $args);\n    }\n\n    /**\n     * internal logging call\n     *\n     * @param string $type\n     * @return void\n     */\n    protected static function _log($type, array $args)\n    {\n        // nothing passed in, don't do anything\n        if (count($args) == 0 && $type != self::GROUP_END) {\n            return;\n        }\n\n        $logger = self::getInstance();\n\n        $logger->_processed = array();\n\n        $logs = array();\n        foreach ($args as $arg) {\n            $logs[] = $logger->_convert($arg);\n        }\n\n        $backtrace = debug_backtrace(false);\n        $level = $logger->getSetting(self::BACKTRACE_LEVEL);\n\n        $backtrace_message = 'unknown';\n        if (isset($backtrace[$level]['file']) && isset($backtrace[$level]['line'])) {\n            $backtrace_message = $backtrace[$level]['file'] . ' : ' . $backtrace[$level]['line'];\n        }\n\n        $logger->_addRow($logs, $backtrace_message, $type);\n    }\n\n    /**\n     * converts an object to a better format for logging\n     *\n     * @param Object\n     * @return array\n     */\n    protected function _convert($object)\n    {\n        // if this isn't an object then just return it\n        if (!is_object($object)) {\n            return $object;\n        }\n\n        //Mark this object as processed so we don't convert it twice and it\n        //Also avoid recursion when objects refer to each other\n        $this->_processed[] = $object;\n\n        $object_as_array = array();\n\n        // first add the class name\n        $object_as_array['___class_name'] = get_class($object);\n\n        // loop through object vars\n        $object_vars = get_object_vars($object);\n        foreach ($object_vars as $key => $value) {\n\n            // same instance as parent object\n            if ($value === $object || in_array($value, $this->_processed, true)) {\n                $value = 'recursion - parent object [' . get_class($value) . ']';\n            }\n            $object_as_array[$key] = $this->_convert($value);\n        }\n\n        $reflection = new ReflectionClass($object);\n\n        // loop through the properties and add those\n        foreach ($reflection->getProperties() as $property) {\n\n            // if one of these properties was already added above then ignore it\n            if (array_key_exists($property->getName(), $object_vars)) {\n                continue;\n            }\n            $type = $this->_getPropertyKey($property);\n\n            if ($this->_php_version >= 5.3) {\n                $property->setAccessible(true);\n            }\n\n            try {\n                $value = $property->getValue($object);\n            } catch (ReflectionException $e) {\n                $value = 'only PHP 5.3 can access private/protected properties';\n            }\n\n            // same instance as parent object\n            if ($value === $object || in_array($value, $this->_processed, true)) {\n                $value = 'recursion - parent object [' . get_class($value) . ']';\n            }\n\n            $object_as_array[$type] = $this->_convert($value);\n        }\n        return $object_as_array;\n    }\n\n    /**\n     * takes a reflection property and returns a nicely formatted key of the property name\n     *\n     * @param ReflectionProperty\n     * @return string\n     */\n    protected function _getPropertyKey(ReflectionProperty $property)\n    {\n        $static = $property->isStatic() ? ' static' : '';\n        if ($property->isPublic()) {\n            return 'public' . $static . ' ' . $property->getName();\n        }\n\n        if ($property->isProtected()) {\n            return 'protected' . $static . ' ' . $property->getName();\n        }\n\n        if ($property->isPrivate()) {\n            return 'private' . $static . ' ' . $property->getName();\n        }\n    }\n\n    /**\n     * adds a value to the data array\n     *\n     * @var mixed\n     * @return void\n     */\n    protected function _addRow(array $logs, $backtrace, $type)\n    {\n        // if this is logged on the same line for example in a loop, set it to null to save space\n        if (in_array($backtrace, $this->_backtraces)) {\n            $backtrace = null;\n        }\n\n        // for group, groupEnd, and groupCollapsed\n        // take out the backtrace since it is not useful\n        if ($type == self::GROUP || $type == self::GROUP_END || $type == self::GROUP_COLLAPSED) {\n            $backtrace = null;\n        }\n\n        if ($backtrace !== null) {\n            $this->_backtraces[] = $backtrace;\n        }\n\n        $row = array($logs, $backtrace, $type);\n\n        $this->_json['rows'][] = $row;\n        $this->_writeHeader($this->_json);\n    }\n\n    protected function _writeHeader($data)\n    {\n        header(self::HEADER_NAME . ': ' . $this->_encode($data));\n    }\n\n    /**\n     * encodes the data to be sent along with the request\n     *\n     * @param array $data\n     * @return string\n     */\n    protected function _encode($data)\n    {\n        return base64_encode(utf8_encode(json_encode($data)));\n    }\n\n    /**\n     * adds a setting\n     *\n     * @param string key\n     * @param mixed value\n     * @return void\n     */\n    public function addSetting($key, $value)\n    {\n        $this->_settings[$key] = $value;\n    }\n\n    /**\n     * add ability to set multiple settings in one call\n     *\n     * @param array $settings\n     * @return void\n     */\n    public function addSettings(array $settings)\n    {\n        foreach ($settings as $key => $value) {\n            $this->addSetting($key, $value);\n        }\n    }\n\n    /**\n     * gets a setting\n     *\n     * @param string key\n     * @return mixed\n     */\n    public function getSetting($key)\n    {\n        if (!isset($this->_settings[$key])) {\n            return null;\n        }\n        return $this->_settings[$key];\n    }\n}\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Behavior/ContentReplaceBehavior.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Behavior;\n/**\n * 系统行为扩展：模板内容输出替换\n */\nclass ContentReplaceBehavior {\n\n    // 行为扩展的执行入口必须是run\n    public function run(&$content){\n        $content = $this->templateContentReplace($content);\n    }\n\n    /**\n     * 模板内容替换\n     * @access protected\n     * @param string $content 模板内容\n     * @return string\n     */\n    protected function templateContentReplace($content) {\n        // 系统默认的特殊变量替换\n        $replace =  array(\n            '__ROOT__'      =>  __ROOT__,       // 当前网站地址\n            '__APP__'       =>  __APP__,        // 当前应用地址\n            '__MODULE__'    =>  __MODULE__,\n            '__ACTION__'    =>  __ACTION__,     // 当前操作地址\n            '__SELF__'      =>  __SELF__,       // 当前页面地址\n            '__CONTROLLER__'=>  __CONTROLLER__,\n            '__URL__'       =>  __CONTROLLER__,\n            '__PUBLIC__'    =>  __ROOT__.'/Public',// 站点公共目录\n        );\n        // 允许用户自定义模板的字符串替换\n        if(is_array(C('TMPL_PARSE_STRING')) )\n            $replace =  array_merge($replace,C('TMPL_PARSE_STRING'));\n        $content = str_replace(array_keys($replace),array_values($replace),$content);\n        return $content;\n    }\n\n}"
  },
  {
    "path": "ThinkPHP/Library/Behavior/CronRunBehavior.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Behavior;\n/**\n * 自动执行任务\n */\nclass CronRunBehavior {\n\n    public function run(&$params) {\n        // 锁定自动执行\n        $lockfile\t =\t RUNTIME_PATH.'cron.lock';\n        if(is_writable($lockfile) && filemtime($lockfile) > $_SERVER['REQUEST_TIME'] - C('CRON_MAX_TIME',null,60)) {\n            return ;\n        } else {\n            touch($lockfile);\n        }\n        set_time_limit(1000);\n        ignore_user_abort(true);\n\n        // 载入cron配置文件\n        // 格式 return array(\n        // 'cronname'=>array('filename',intervals,nextruntime),...\n        // );\n        if(is_file(RUNTIME_PATH.'~crons.php')) {\n            $crons\t=\tinclude RUNTIME_PATH.'~crons.php';\n        }elseif(is_file(COMMON_PATH.'Conf/crons.php')){\n            $crons\t=\tinclude COMMON_PATH.'Conf/crons.php';\n        }\n        if(isset($crons) && is_array($crons)) {\n            $update\t =\t false;\n            $log\t=\tarray();\n            foreach ($crons as $key=>$cron){\n                if(empty($cron[2]) || $_SERVER['REQUEST_TIME']>=$cron[2]) {\n                    // 到达时间 执行cron文件\n                    G('cronStart');\n                    include COMMON_PATH.'Cron/'.$cron[0].'.php';\n                    G('cronEnd');\n                    $_useTime\t =\t G('cronStart','cronEnd', 6);\n                    // 更新cron记录\n                    $cron[2]\t=\t$_SERVER['REQUEST_TIME']+$cron[1];\n                    $crons[$key]\t=\t$cron;\n                    $log[] = \"Cron:$key Runat \".date('Y-m-d H:i:s').\" Use $_useTime s\\n\";\n                    $update\t =\t true;\n                }\n            }\n            if($update) {\n                // 记录Cron执行日志\n                \\Think\\Log::write(implode('',$log));\n                // 更新cron文件\n                $content  = \"<?php\\nreturn \".var_export($crons,true).\";\\n?>\";\n                file_put_contents(RUNTIME_PATH.'~crons.php',$content);\n            }\n        }\n        // 解除锁定\n        unlink($lockfile);\n        return ;\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Behavior/FireShowPageTraceBehavior.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2012 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: luofei614 <weibo.com/luofei614>\n// +----------------------------------------------------------------------\n// $Id$\n\n/**\n * 将Trace信息输出到火狐的firebug，从而不影响ajax效果和页面的布局。\n * 使用前，你需要先在火狐浏览器上安装firebug和firePHP两个插件。\n * 定义应用的tags.php文件， \n * <code>\n * <?php return array(\n *   'app_end'=>array(\n *       'FireShowPageTrace'\n *   )\n * );\n * </code>\n * 再将此文件放到应用的Behavior文件夹中即可\n * 如果trace信息没有正常输出，请查看您的日志。\n * firePHP，是通过http headers和firebug通讯的，所以要保证在输出trace信息之前不能有\n * headers输出，你可以在入口文件第一行加入代码 ob_start(); 或者配置output_buffering\n *\n */\nnamespace Behavior;\n/**\n * 系统行为扩展 页面Trace显示输出\n */\nclass FireShowPageTraceBehavior {\n    protected $tracePagTabs =   array('BASE'=>'基本','FILE'=>'文件','INFO'=>'流程','ERR|NOTIC'=>'错误','SQL'=>'SQL','DEBUG'=>'调试');\n\n    // 行为扩展的执行入口必须是run\n    public function run(&$params){\n        if(C('FIRE_SHOW_PAGE_TRACE',null,true)) $this->showTrace();\n    }\n\n    /**\n     * 显示页面Trace信息\n     * @access private\n     */\n    private function showTrace() {\n         // 系统默认显示信息\n        $files =  get_included_files();\n        $info   =   array();\n        foreach ($files as $key=>$file){\n            $info[] = $file.' ( '.number_format(filesize($file)/1024,2).' KB )';\n        }\n        $trace  =   array();\n        $base   =   array(\n            '请求信息'=>  date('Y-m-d H:i:s',$_SERVER['REQUEST_TIME']).' '.$_SERVER['SERVER_PROTOCOL'].' '.$_SERVER['REQUEST_METHOD'].' : '.__SELF__,\n            '运行时间'=> $this->showTime(),\n            '内存开销'=> MEMORY_LIMIT_ON?number_format((memory_get_usage() - $GLOBALS['_startUseMems'])/1024,2).' kb':'不支持',\n            '查询信息'=> N('db_query').' queries '.N('db_write').' writes ',\n            '文件加载'=> count(get_included_files()),\n            '缓存信息'=> N('cache_read').' gets '.N('cache_write').' writes ',\n            '配置加载'=> count(c()),\n            '会话信息'=> 'SESSION_ID='.session_id(),\n            );\n        // 读取应用定义的Trace文件\n        $traceFile  =   CONF_PATH.'trace.php';\n        if(is_file($traceFile)) {\n            $base    =   array_merge($base,include $traceFile);\n        }\n        $debug  =   trace();\n        $tabs   =   C('TRACE_PAGE_TABS',null,$this->tracePagTabs);\n        foreach ($tabs as $name=>$title){\n            switch(strtoupper($name)) {\n                case 'BASE':// 基本信息\n                    $trace[$title]  =   $base;\n                    break;\n                case 'FILE': // 文件信息\n                    $trace[$title]  =   $info;\n                    break;\n                default:// 调试信息\n                    if(strpos($name,'|')) {// 多组信息\n                        $array  =   explode('|',$name);\n                        $result =   array();\n                        foreach($array as $name){\n                            $result   +=   isset($debug[$name])?$debug[$name]:array();\n                        }\n                        $trace[$title]  =   $result;\n                    }else{\n                        $trace[$title]  =   isset($debug[$name])?$debug[$name]:'';\n                    }\n            }\n        }\n    foreach ($trace as $key=>$val){\n            if(!is_array($val) && empty($val))\n                $val=array();\n            if(is_array($val)){\n            $fire=array(\n            array('','')\n            );\n            foreach($val as $k=>$v){\n                $fire[]=array($k,$v);\n            }\n            fb(array($key,$fire),FirePHP::TABLE);\n        }else{\n            fb($val,$key);\n        }\n     }\n    unset($files,$info,$log,$base);\n    }\n\n    /**\n     * 获取运行时间\n     */\n    private function showTime() {\n        // 显示运行时间\n        G('beginTime',$GLOBALS['_beginTime']);\n        G('viewEndTime');\n        // 显示详细运行时间\n        return G('beginTime','viewEndTime').'s ( Load:'.G('beginTime','loadTime').'s Init:'.G('loadTime','initTime').'s Exec:'.G('initTime','viewStartTime').'s Template:'.G('viewStartTime','viewEndTime').'s )';\n    }\n\n}\n\n\nfunction fb()\n{\n    $instance = FirePHP::getInstance(true);\n  \n    $args = func_get_args();\n    return call_user_func_array(array($instance,'fb'),$args);\n}\n\n\nclass FB\n{\n    /**\n     * Enable and disable logging to Firebug\n     * \n     * @see FirePHP->setEnabled()\n     * @param boolean $Enabled TRUE to enable, FALSE to disable\n     * @return void\n     */\n    public static function setEnabled($Enabled)\n    {\n        $instance = FirePHP::getInstance(true);\n        $instance->setEnabled($Enabled);\n    }\n  \n    /**\n     * Check if logging is enabled\n     * \n     * @see FirePHP->getEnabled()\n     * @return boolean TRUE if enabled\n     */\n    public static function getEnabled()\n    {\n        $instance = FirePHP::getInstance(true);\n        return $instance->getEnabled();\n    }  \n  \n    /**\n     * Specify a filter to be used when encoding an object\n     * \n     * Filters are used to exclude object members.\n     * \n     * @see FirePHP->setObjectFilter()\n     * @param string $Class The class name of the object\n     * @param array $Filter An array or members to exclude\n     * @return void\n     */\n    public static function setObjectFilter($Class, $Filter)\n    {\n      $instance = FirePHP::getInstance(true);\n      $instance->setObjectFilter($Class, $Filter);\n    }\n  \n    /**\n     * Set some options for the library\n     * \n     * @see FirePHP->setOptions()\n     * @param array $Options The options to be set\n     * @return void\n     */\n    public static function setOptions($Options)\n    {\n        $instance = FirePHP::getInstance(true);\n        $instance->setOptions($Options);\n    }\n\n    /**\n     * Get options for the library\n     * \n     * @see FirePHP->getOptions()\n     * @return array The options\n     */\n    public static function getOptions()\n    {\n        $instance = FirePHP::getInstance(true);\n        return $instance->getOptions();\n    }\n\n    /**\n     * Log object to firebug\n     * \n     * @see http://www.firephp.org/Wiki/Reference/Fb\n     * @param mixed $Object\n     * @return true\n     * @throws Exception\n     */\n    public static function send()\n    {\n        $instance = FirePHP::getInstance(true);\n        $args = func_get_args();\n        return call_user_func_array(array($instance,'fb'),$args);\n    }\n\n    /**\n     * Start a group for following messages\n     * \n     * Options:\n     *   Collapsed: [true|false]\n     *   Color:     [#RRGGBB|ColorName]\n     *\n     * @param string $Name\n     * @param array $Options OPTIONAL Instructions on how to log the group\n     * @return true\n     */\n    public static function group($Name, $Options=null)\n    {\n        $instance = FirePHP::getInstance(true);\n        return $instance->group($Name, $Options);\n    }\n\n    /**\n     * Ends a group you have started before\n     *\n     * @return true\n     * @throws Exception\n     */\n    public static function groupEnd()\n    {\n        return self::send(null, null, FirePHP::GROUP_END);\n    }\n\n    /**\n     * Log object with label to firebug console\n     *\n     * @see FirePHP::LOG\n     * @param mixes $Object\n     * @param string $Label\n     * @return true\n     * @throws Exception\n     */\n    public static function log($Object, $Label=null)\n    {\n        return self::send($Object, $Label, FirePHP::LOG);\n    } \n\n    /**\n     * Log object with label to firebug console\n     *\n     * @see FirePHP::INFO\n     * @param mixes $Object\n     * @param string $Label\n     * @return true\n     * @throws Exception\n     */\n    public static function info($Object, $Label=null)\n    {\n        return self::send($Object, $Label, FirePHP::INFO);\n    } \n\n    /**\n     * Log object with label to firebug console\n     *\n     * @see FirePHP::WARN\n     * @param mixes $Object\n     * @param string $Label\n     * @return true\n     * @throws Exception\n     */\n    public static function warn($Object, $Label=null)\n    {\n        return self::send($Object, $Label, FirePHP::WARN);\n    } \n\n    /**\n     * Log object with label to firebug console\n     *\n     * @see FirePHP::ERROR\n     * @param mixes $Object\n     * @param string $Label\n     * @return true\n     * @throws Exception\n     */\n    public static function error($Object, $Label=null)\n    {\n        return self::send($Object, $Label, FirePHP::ERROR);\n    } \n\n    /**\n     * Dumps key and variable to firebug server panel\n     *\n     * @see FirePHP::DUMP\n     * @param string $Key\n     * @param mixed $Variable\n     * @return true\n     * @throws Exception\n     */\n    public static function dump($Key, $Variable)\n    {\n        return self::send($Variable, $Key, FirePHP::DUMP);\n    } \n\n    /**\n     * Log a trace in the firebug console\n     *\n     * @see FirePHP::TRACE\n     * @param string $Label\n     * @return true\n     * @throws Exception\n     */\n    public static function trace($Label)\n    {\n        return self::send($Label, FirePHP::TRACE);\n    } \n\n    /**\n     * Log a table in the firebug console\n     *\n     * @see FirePHP::TABLE\n     * @param string $Label\n     * @param string $Table\n     * @return true\n     * @throws Exception\n     */\n    public static function table($Label, $Table)\n    {\n        return self::send($Table, $Label, FirePHP::TABLE);\n    } \n\n}\n\nif (!defined('E_STRICT')) {\n    define('E_STRICT', 2048);\n}\nif (!defined('E_RECOVERABLE_ERROR')) {\n    define('E_RECOVERABLE_ERROR', 4096);\n}\nif (!defined('E_DEPRECATED')) {\n    define('E_DEPRECATED', 8192);\n}\nif (!defined('E_USER_DEPRECATED')) {\n    define('E_USER_DEPRECATED', 16384);\n} \n \n/**\n * Sends the given data to the FirePHP Firefox Extension.\n * The data can be displayed in the Firebug Console or in the\n * \"Server\" request tab.\n * \n * For more information see: http://www.firephp.org/\n * \n * @copyright       Copyright (C) 2007-2009 Christoph Dorn\n * @author          Christoph Dorn <christoph@christophdorn.com>\n * @license         http://www.opensource.org/licenses/bsd-license.php\n * @package         FirePHPCore\n */\nclass FirePHP {\n\n    /**\n     * FirePHP version\n     *\n     * @var string\n     */\n    const VERSION = '0.3';    // @pinf replace '0.3' with '%%package.version%%'\n\n    /**\n     * Firebug LOG level\n     *\n     * Logs a message to firebug console.\n     * \n     * @var string\n     */\n    const LOG = 'LOG';\n  \n    /**\n     * Firebug INFO level\n     *\n     * Logs a message to firebug console and displays an info icon before the message.\n     * \n     * @var string\n     */\n    const INFO = 'INFO';\n    \n    /**\n     * Firebug WARN level\n     *\n     * Logs a message to firebug console, displays an warning icon before the message and colors the line turquoise.\n     * \n     * @var string\n     */\n    const WARN = 'WARN';\n    \n    /**\n     * Firebug ERROR level\n     *\n     * Logs a message to firebug console, displays an error icon before the message and colors the line yellow. Also increments the firebug error count.\n     * \n     * @var string\n     */\n    const ERROR = 'ERROR';\n    \n    /**\n     * Dumps a variable to firebug's server panel\n     *\n     * @var string\n     */\n    const DUMP = 'DUMP';\n    \n    /**\n     * Displays a stack trace in firebug console\n     *\n     * @var string\n     */\n    const TRACE = 'TRACE';\n    \n    /**\n     * Displays an exception in firebug console\n     * \n     * Increments the firebug error count.\n     *\n     * @var string\n     */\n    const EXCEPTION = 'EXCEPTION';\n    \n    /**\n     * Displays an table in firebug console\n     *\n     * @var string\n     */\n    const TABLE = 'TABLE';\n    \n    /**\n     * Starts a group in firebug console\n     * \n     * @var string\n     */\n    const GROUP_START = 'GROUP_START';\n    \n    /**\n     * Ends a group in firebug console\n     * \n     * @var string\n     */\n    const GROUP_END = 'GROUP_END';\n    \n    /**\n     * Singleton instance of FirePHP\n     *\n     * @var FirePHP\n     */\n    protected static $instance = null;\n    \n    /**\n     * Flag whether we are logging from within the exception handler\n     * \n     * @var boolean\n     */\n    protected $inExceptionHandler = false;\n    \n    /**\n     * Flag whether to throw PHP errors that have been converted to ErrorExceptions\n     * \n     * @var boolean\n     */\n    protected $throwErrorExceptions = true;\n    \n    /**\n     * Flag whether to convert PHP assertion errors to Exceptions\n     * \n     * @var boolean\n     */\n    protected $convertAssertionErrorsToExceptions = true;\n    \n    /**\n     * Flag whether to throw PHP assertion errors that have been converted to Exceptions\n     * \n     * @var boolean\n     */\n    protected $throwAssertionExceptions = false;\n\n    /**\n     * Wildfire protocol message index\n     *\n     * @var int\n     */\n    protected $messageIndex = 1;\n    \n    /**\n     * Options for the library\n     * \n     * @var array\n     */\n    protected $options = array('maxDepth' => 10,\n                               'maxObjectDepth' => 5,\n                               'maxArrayDepth' => 5,\n                               'useNativeJsonEncode' => true,\n                               'includeLineNumbers' => true);\n\n    /**\n     * Filters used to exclude object members when encoding\n     * \n     * @var array\n     */\n    protected $objectFilters = array(\n        'firephp' => array('objectStack', 'instance', 'json_objectStack'),\n        'firephp_test_class' => array('objectStack', 'instance', 'json_objectStack')\n    );\n\n    /**\n     * A stack of objects used to detect recursion during object encoding\n     * \n     * @var object\n     */\n    protected $objectStack = array();\n\n    /**\n     * Flag to enable/disable logging\n     * \n     * @var boolean\n     */\n    protected $enabled = true;\n\n    /**\n     * The insight console to log to if applicable\n     * \n     * @var object\n     */\n    protected $logToInsightConsole = null;\n\n    /**\n     * When the object gets serialized only include specific object members.\n     * \n     * @return array\n     */  \n    public function __sleep()\n    {\n        return array('options','objectFilters','enabled');\n    }\n    \n    /**\n     * Gets singleton instance of FirePHP\n     *\n     * @param boolean $AutoCreate\n     * @return FirePHP\n     */\n    public static function getInstance($AutoCreate = false)\n    {\n        if ($AutoCreate===true && !self::$instance) {\n            self::init();\n        }\n        return self::$instance;\n    }\n    \n    /**\n     * Creates FirePHP object and stores it for singleton access\n     *\n     * @return FirePHP\n     */\n    public static function init()\n    {\n        return self::setInstance(new self());\n    }\n\n    /**\n     * Set the instance of the FirePHP singleton\n     * \n     * @param FirePHP $instance The FirePHP object instance\n     * @return FirePHP\n     */\n    public static function setInstance($instance)\n    {\n        return self::$instance = $instance;\n    }\n\n    /**\n     * Set an Insight console to direct all logging calls to\n     * \n     * @param object $console The console object to log to\n     * @return void\n     */\n    public function setLogToInsightConsole($console)\n    {\n        if(is_string($console)) {\n            if(get_class($this)!='FirePHP_Insight' && !is_subclass_of($this, 'FirePHP_Insight')) {\n                throw new Exception('FirePHP instance not an instance or subclass of FirePHP_Insight!');\n            }\n            $this->logToInsightConsole = $this->to('request')->console($console);\n        } else {\n            $this->logToInsightConsole = $console;\n        }\n    }\n\n    /**\n     * Enable and disable logging to Firebug\n     * \n     * @param boolean $Enabled TRUE to enable, FALSE to disable\n     * @return void\n     */\n    public function setEnabled($Enabled)\n    {\n       $this->enabled = $Enabled;\n    }\n    \n    /**\n     * Check if logging is enabled\n     * \n     * @return boolean TRUE if enabled\n     */\n    public function getEnabled()\n    {\n        return $this->enabled;\n    }\n    \n    /**\n     * Specify a filter to be used when encoding an object\n     * \n     * Filters are used to exclude object members.\n     * \n     * @param string $Class The class name of the object\n     * @param array $Filter An array of members to exclude\n     * @return void\n     */\n    public function setObjectFilter($Class, $Filter)\n    {\n        $this->objectFilters[strtolower($Class)] = $Filter;\n    }\n  \n    /**\n     * Set some options for the library\n     * \n     * Options:\n     *  - maxDepth: The maximum depth to traverse (default: 10)\n     *  - maxObjectDepth: The maximum depth to traverse objects (default: 5)\n     *  - maxArrayDepth: The maximum depth to traverse arrays (default: 5)\n     *  - useNativeJsonEncode: If true will use json_encode() (default: true)\n     *  - includeLineNumbers: If true will include line numbers and filenames (default: true)\n     * \n     * @param array $Options The options to be set\n     * @return void\n     */\n    public function setOptions($Options)\n    {\n        $this->options = array_merge($this->options,$Options);\n    }\n\n    /**\n     * Get options from the library\n     *\n     * @return array The currently set options\n     */\n    public function getOptions()\n    {\n        return $this->options;\n    }\n\n    /**\n     * Set an option for the library\n     * \n     * @param string $Name\n     * @param mixed $Value\n     * @throws Exception\n     * @return void\n     */  \n    public function setOption($Name, $Value)\n    {\n        if (!isset($this->options[$Name])) {\n            throw $this->newException('Unknown option: ' . $Name);\n        }\n        $this->options[$Name] = $Value;\n    }\n\n    /**\n     * Get an option from the library\n     *\n     * @param string $Name\n     * @throws Exception\n     * @return mixed\n     */\n    public function getOption($Name)\n    {\n        if (!isset($this->options[$Name])) {\n            throw $this->newException('Unknown option: ' . $Name);\n        }\n        return $this->options[$Name];\n    }\n\n    /**\n     * Register FirePHP as your error handler\n     * \n     * Will throw exceptions for each php error.\n     * \n     * @return mixed Returns a string containing the previously defined error handler (if any)\n     */\n    public function registerErrorHandler($throwErrorExceptions = false)\n    {\n        //NOTE: The following errors will not be caught by this error handler:\n        //      E_ERROR, E_PARSE, E_CORE_ERROR,\n        //      E_CORE_WARNING, E_COMPILE_ERROR,\n        //      E_COMPILE_WARNING, E_STRICT\n    \n        $this->throwErrorExceptions = $throwErrorExceptions;\n    \n        return set_error_handler(array($this,'errorHandler'));     \n    }\n\n    /**\n     * FirePHP's error handler\n     * \n     * Throws exception for each php error that will occur.\n     *\n     * @param int $errno\n     * @param string $errstr\n     * @param string $errfile\n     * @param int $errline\n     * @param array $errcontext\n     */\n    public function errorHandler($errno, $errstr, $errfile, $errline, $errcontext)\n    {\n        // Don't throw exception if error reporting is switched off\n        if (error_reporting() == 0) {\n            return;\n        }\n        // Only throw exceptions for errors we are asking for\n        if (error_reporting() & $errno) {\n\n            $exception = new ErrorException($errstr, 0, $errno, $errfile, $errline);\n            if ($this->throwErrorExceptions) {\n                throw $exception;\n            } else {\n                $this->fb($exception);\n            }\n        }\n    }\n  \n    /**\n     * Register FirePHP as your exception handler\n     * \n     * @return mixed Returns the name of the previously defined exception handler,\n     *               or NULL on error.\n     *               If no previous handler was defined, NULL is also returned.\n     */\n    public function registerExceptionHandler()\n    {\n        return set_exception_handler(array($this,'exceptionHandler'));     \n    }\n  \n    /**\n     * FirePHP's exception handler\n     * \n     * Logs all exceptions to your firebug console and then stops the script.\n     *\n     * @param Exception $Exception\n     * @throws Exception\n     */\n    function exceptionHandler($Exception)\n    {\n    \n        $this->inExceptionHandler = true;\n    \n        header('HTTP/1.1 500 Internal Server Error');\n    \n        try {\n            $this->fb($Exception);\n        } catch (Exception $e) {\n            echo 'We had an exception: ' . $e;\n        }\n        $this->inExceptionHandler = false;\n    }\n  \n    /**\n     * Register FirePHP driver as your assert callback\n     * \n     * @param boolean $convertAssertionErrorsToExceptions\n     * @param boolean $throwAssertionExceptions\n     * @return mixed Returns the original setting or FALSE on errors\n     */\n    public function registerAssertionHandler($convertAssertionErrorsToExceptions = true, $throwAssertionExceptions = false)\n    {\n        $this->convertAssertionErrorsToExceptions = $convertAssertionErrorsToExceptions;\n        $this->throwAssertionExceptions = $throwAssertionExceptions;\n        \n        if ($throwAssertionExceptions && !$convertAssertionErrorsToExceptions) {\n            throw $this->newException('Cannot throw assertion exceptions as assertion errors are not being converted to exceptions!');\n        }\n        \n        return assert_options(ASSERT_CALLBACK, array($this, 'assertionHandler'));\n    }\n  \n    /**\n     * FirePHP's assertion handler\n     *\n     * Logs all assertions to your firebug console and then stops the script.\n     *\n     * @param string $file File source of assertion\n     * @param int    $line Line source of assertion\n     * @param mixed  $code Assertion code\n     */\n    public function assertionHandler($file, $line, $code)\n    {\n        if ($this->convertAssertionErrorsToExceptions) {\n          \n          $exception = new ErrorException('Assertion Failed - Code[ '.$code.' ]', 0, null, $file, $line);\n    \n          if ($this->throwAssertionExceptions) {\n              throw $exception;\n          } else {\n              $this->fb($exception);\n          }\n        \n        } else {\n            $this->fb($code, 'Assertion Failed', FirePHP::ERROR, array('File'=>$file,'Line'=>$line));\n        }\n    }\n  \n    /**\n     * Start a group for following messages.\n     * \n     * Options:\n     *   Collapsed: [true|false]\n     *   Color:     [#RRGGBB|ColorName]\n     *\n     * @param string $Name\n     * @param array $Options OPTIONAL Instructions on how to log the group\n     * @return true\n     * @throws Exception\n     */\n    public function group($Name, $Options = null)\n    {\n    \n        if (!$Name) {\n            throw $this->newException('You must specify a label for the group!');\n        }\n        \n        if ($Options) {\n            if (!is_array($Options)) {\n                throw $this->newException('Options must be defined as an array!');\n            }\n            if (array_key_exists('Collapsed', $Options)) {\n                $Options['Collapsed'] = ($Options['Collapsed'])?'true':'false';\n            }\n        }\n        \n        return $this->fb(null, $Name, FirePHP::GROUP_START, $Options);\n    }\n  \n    /**\n     * Ends a group you have started before\n     *\n     * @return true\n     * @throws Exception\n     */\n    public function groupEnd()\n    {\n        return $this->fb(null, null, FirePHP::GROUP_END);\n    }\n\n    /**\n     * Log object with label to firebug console\n     *\n     * @see FirePHP::LOG\n     * @param mixes $Object\n     * @param string $Label\n     * @return true\n     * @throws Exception\n     */\n    public function log($Object, $Label = null, $Options = array())\n    {\n        return $this->fb($Object, $Label, FirePHP::LOG, $Options);\n    } \n\n    /**\n     * Log object with label to firebug console\n     *\n     * @see FirePHP::INFO\n     * @param mixes $Object\n     * @param string $Label\n     * @return true\n     * @throws Exception\n     */\n    public function info($Object, $Label = null, $Options = array())\n    {\n        return $this->fb($Object, $Label, FirePHP::INFO, $Options);\n    } \n\n    /**\n     * Log object with label to firebug console\n     *\n     * @see FirePHP::WARN\n     * @param mixes $Object\n     * @param string $Label\n     * @return true\n     * @throws Exception\n     */\n    public function warn($Object, $Label = null, $Options = array())\n    {\n        return $this->fb($Object, $Label, FirePHP::WARN, $Options);\n    } \n\n    /**\n     * Log object with label to firebug console\n     *\n     * @see FirePHP::ERROR\n     * @param mixes $Object\n     * @param string $Label\n     * @return true\n     * @throws Exception\n     */\n    public function error($Object, $Label = null, $Options = array())\n    {\n        return $this->fb($Object, $Label, FirePHP::ERROR, $Options);\n    } \n\n    /**\n     * Dumps key and variable to firebug server panel\n     *\n     * @see FirePHP::DUMP\n     * @param string $Key\n     * @param mixed $Variable\n     * @return true\n     * @throws Exception\n     */\n    public function dump($Key, $Variable, $Options = array())\n    {\n        if (!is_string($Key)) {\n            throw $this->newException('Key passed to dump() is not a string');\n        }\n        if (strlen($Key)>100) {\n            throw $this->newException('Key passed to dump() is longer than 100 characters');\n        }\n        if (!preg_match_all('/^[a-zA-Z0-9-_\\.:]*$/', $Key, $m)) {\n            throw $this->newException('Key passed to dump() contains invalid characters [a-zA-Z0-9-_\\.:]');\n        }\n        return $this->fb($Variable, $Key, FirePHP::DUMP, $Options);\n    }\n  \n    /**\n     * Log a trace in the firebug console\n     *\n     * @see FirePHP::TRACE\n     * @param string $Label\n     * @return true\n     * @throws Exception\n     */\n    public function trace($Label)\n    {\n        return $this->fb($Label, FirePHP::TRACE);\n    } \n\n    /**\n     * Log a table in the firebug console\n     *\n     * @see FirePHP::TABLE\n     * @param string $Label\n     * @param string $Table\n     * @return true\n     * @throws Exception\n     */\n    public function table($Label, $Table, $Options = array())\n    {\n        return $this->fb($Table, $Label, FirePHP::TABLE, $Options);\n    }\n\n    /**\n     * Insight API wrapper\n     * \n     * @see Insight_Helper::to()\n     */\n    public static function to()\n    {\n        $instance = self::getInstance();\n        if (!method_exists($instance, \"_to\")) {\n            throw new Exception(\"FirePHP::to() implementation not loaded\");\n        }\n        $args = func_get_args();\n        return call_user_func_array(array($instance, '_to'), $args);\n    }\n\n    /**\n     * Insight API wrapper\n     * \n     * @see Insight_Helper::plugin()\n     */\n    public static function plugin()\n    {\n        $instance = self::getInstance();\n        if (!method_exists($instance, \"_plugin\")) {\n            throw new Exception(\"FirePHP::plugin() implementation not loaded\");\n        }\n        $args = func_get_args();\n        return call_user_func_array(array($instance, '_plugin'), $args);\n    }\n\n    /**\n     * Check if FirePHP is installed on client\n     *\n     * @return boolean\n     */\n    public function detectClientExtension()\n    {\n        // Check if FirePHP is installed on client via User-Agent header\n        if (@preg_match_all('/\\sFirePHP\\/([\\.\\d]*)\\s?/si',$this->getUserAgent(),$m) &&\n           version_compare($m[1][0],'0.0.6','>=')) {\n            return true;\n        } else\n        // Check if FirePHP is installed on client via X-FirePHP-Version header\n        if (@preg_match_all('/^([\\.\\d]*)$/si',$this->getRequestHeader(\"X-FirePHP-Version\"),$m) &&\n           version_compare($m[1][0],'0.0.6','>=')) {\n            return true;\n        }\n        return false;\n    }\n \n    /**\n     * Log varible to Firebug\n     * \n     * @see http://www.firephp.org/Wiki/Reference/Fb\n     * @param mixed $Object The variable to be logged\n     * @return true Return TRUE if message was added to headers, FALSE otherwise\n     * @throws Exception\n     */\n    public function fb($Object)\n    {\n        if($this instanceof FirePHP_Insight && method_exists($this, '_logUpgradeClientMessage')) {\n            if(!FirePHP_Insight::$upgradeClientMessageLogged) {    // avoid infinite recursion as _logUpgradeClientMessage() logs a message\n                $this->_logUpgradeClientMessage();\n            }\n        }\n\n        static $insightGroupStack = array();\n\n        if (!$this->getEnabled()) {\n            return false;\n        }\n\n        if ($this->headersSent($filename, $linenum)) {\n            // If we are logging from within the exception handler we cannot throw another exception\n            if ($this->inExceptionHandler) {\n                // Simply echo the error out to the page\n                echo '<div style=\"border: 2px solid red; font-family: Arial; font-size: 12px; background-color: lightgray; padding: 5px;\"><span style=\"color: red; font-weight: bold;\">FirePHP ERROR:</span> Headers already sent in <b>'.$filename.'</b> on line <b>'.$linenum.'</b>. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.</div>';\n            } else {\n                throw $this->newException('Headers already sent in '.$filename.' on line '.$linenum.'. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.');\n            }\n        }\n      \n        $Type = null;\n        $Label = null;\n        $Options = array();\n      \n        if (func_num_args()==1) {\n        } else\n        if (func_num_args()==2) {\n            switch(func_get_arg(1)) {\n                case self::LOG:\n                case self::INFO:\n                case self::WARN:\n                case self::ERROR:\n                case self::DUMP:\n                case self::TRACE:\n                case self::EXCEPTION:\n                case self::TABLE:\n                case self::GROUP_START:\n                case self::GROUP_END:\n                    $Type = func_get_arg(1);\n                    break;\n                default:\n                    $Label = func_get_arg(1);\n                    break;\n            }\n        } else\n        if (func_num_args()==3) {\n            $Type = func_get_arg(2);\n            $Label = func_get_arg(1);\n        } else\n        if (func_num_args()==4) {\n            $Type = func_get_arg(2);\n            $Label = func_get_arg(1);\n            $Options = func_get_arg(3);\n        } else {\n            throw $this->newException('Wrong number of arguments to fb() function!');\n        }\n\n        if($this->logToInsightConsole!==null && (get_class($this)=='FirePHP_Insight' || is_subclass_of($this, 'FirePHP_Insight'))) {\n            $msg = $this->logToInsightConsole;\n            if ($Object instanceof Exception) {\n                $Type = self::EXCEPTION;\n            }\n            if($Label && $Type!=self::TABLE && $Type!=self::GROUP_START) {\n                $msg = $msg->label($Label);\n            }\n            switch($Type) {\n                case self::DUMP:\n                case self::LOG:\n                    return $msg->log($Object);\n                case self::INFO:\n                    return $msg->info($Object);\n                case self::WARN:\n                    return $msg->warn($Object);\n                case self::ERROR:\n                    return $msg->error($Object);\n                case self::TRACE:\n                    return $msg->trace($Object);\n                case self::EXCEPTION:\n                    return $this->plugin('engine')->handleException($Object, $msg);\n                case self::TABLE:\n                    if (isset($Object[0]) && !is_string($Object[0]) && $Label) {\n                        $Object = array($Label, $Object);\n                    }\n                    return $msg->table($Object[0], array_slice($Object[1],1), $Object[1][0]);\n                case self::GROUP_START:\n                    $insightGroupStack[] = $msg->group(md5($Label))->open();\n                    return $msg->log($Label);\n                case self::GROUP_END:\n                    if(count($insightGroupStack)==0) {\n                        throw new Error('Too many groupEnd() as opposed to group() calls!');\n                    }\n                    $group = array_pop($insightGroupStack);\n                    return $group->close();\n                default:\n                    return $msg->log($Object);\n            }\n        }\n\n        if (!$this->detectClientExtension()) {\n            return false;\n        }\n      \n        $meta = array();\n        $skipFinalObjectEncode = false;\n      \n        if ($Object instanceof Exception) {\n    \n            $meta['file'] = $this->_escapeTraceFile($Object->getFile());\n            $meta['line'] = $Object->getLine();\n          \n            $trace = $Object->getTrace();\n            if ($Object instanceof ErrorException\n               && isset($trace[0]['function'])\n               && $trace[0]['function']=='errorHandler'\n               && isset($trace[0]['class'])\n               && $trace[0]['class']=='FirePHP') {\n               \n                $severity = false;\n                switch($Object->getSeverity()) {\n                    case E_WARNING: $severity = 'E_WARNING'; break;\n                    case E_NOTICE: $severity = 'E_NOTICE'; break;\n                    case E_USER_ERROR: $severity = 'E_USER_ERROR'; break;\n                    case E_USER_WARNING: $severity = 'E_USER_WARNING'; break;\n                    case E_USER_NOTICE: $severity = 'E_USER_NOTICE'; break;\n                    case E_STRICT: $severity = 'E_STRICT'; break;\n                    case E_RECOVERABLE_ERROR: $severity = 'E_RECOVERABLE_ERROR'; break;\n                    case E_DEPRECATED: $severity = 'E_DEPRECATED'; break;\n                    case E_USER_DEPRECATED: $severity = 'E_USER_DEPRECATED'; break;\n                }\n                   \n                $Object = array('Class'=>get_class($Object),\n                                'Message'=>$severity.': '.$Object->getMessage(),\n                                'File'=>$this->_escapeTraceFile($Object->getFile()),\n                                'Line'=>$Object->getLine(),\n                                'Type'=>'trigger',\n                                'Trace'=>$this->_escapeTrace(array_splice($trace,2)));\n                $skipFinalObjectEncode = true;\n            } else {\n                $Object = array('Class'=>get_class($Object),\n                                'Message'=>$Object->getMessage(),\n                                'File'=>$this->_escapeTraceFile($Object->getFile()),\n                                'Line'=>$Object->getLine(),\n                                'Type'=>'throw',\n                                'Trace'=>$this->_escapeTrace($trace));\n                $skipFinalObjectEncode = true;\n            }\n            $Type = self::EXCEPTION;\n          \n        } else\n        if ($Type==self::TRACE) {\n          \n            $trace = debug_backtrace();\n            if (!$trace) return false;\n            for( $i=0 ; $i<sizeof($trace) ; $i++ ) {\n    \n                if (isset($trace[$i]['class'])\n                   && isset($trace[$i]['file'])\n                   && ($trace[$i]['class']=='FirePHP'\n                       || $trace[$i]['class']=='FB')\n                   && (substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php'\n                       || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) {\n                    /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */\n                } else\n                if (isset($trace[$i]['class'])\n                   && isset($trace[$i+1]['file'])\n                   && $trace[$i]['class']=='FirePHP'\n                   && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') {\n                    /* Skip fb() */\n                } else\n                if ($trace[$i]['function']=='fb'\n                   || $trace[$i]['function']=='trace'\n                   || $trace[$i]['function']=='send') {\n\n                    $Object = array('Class'=>isset($trace[$i]['class'])?$trace[$i]['class']:'',\n                                    'Type'=>isset($trace[$i]['type'])?$trace[$i]['type']:'',\n                                    'Function'=>isset($trace[$i]['function'])?$trace[$i]['function']:'',\n                                    'Message'=>$trace[$i]['args'][0],\n                                    'File'=>isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'',\n                                    'Line'=>isset($trace[$i]['line'])?$trace[$i]['line']:'',\n                                    'Args'=>isset($trace[$i]['args'])?$this->encodeObject($trace[$i]['args']):'',\n                                    'Trace'=>$this->_escapeTrace(array_splice($trace,$i+1)));\n        \n                    $skipFinalObjectEncode = true;\n                    $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'';\n                    $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:'';\n                    break;\n                }\n            }\n    \n        } else\n        if ($Type==self::TABLE) {\n          \n            if (isset($Object[0]) && is_string($Object[0])) {\n                $Object[1] = $this->encodeTable($Object[1]);\n            } else {\n                $Object = $this->encodeTable($Object);\n            }\n    \n            $skipFinalObjectEncode = true;\n          \n        } else\n        if ($Type==self::GROUP_START) {\n          \n            if (!$Label) {\n                throw $this->newException('You must specify a label for the group!');\n            }\n          \n        } else {\n            if ($Type===null) {\n                $Type = self::LOG;\n            }\n        }\n        \n        if ($this->options['includeLineNumbers']) {\n            if (!isset($meta['file']) || !isset($meta['line'])) {\n    \n                $trace = debug_backtrace();\n                for( $i=0 ; $trace && $i<sizeof($trace) ; $i++ ) {\n          \n                    if (isset($trace[$i]['class'])\n                       && isset($trace[$i]['file'])\n                       && ($trace[$i]['class']=='FirePHP'\n                           || $trace[$i]['class']=='FB')\n                       && (substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php'\n                           || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) {\n                        /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */\n                    } else\n                    if (isset($trace[$i]['class'])\n                       && isset($trace[$i+1]['file'])\n                       && $trace[$i]['class']=='FirePHP'\n                       && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') {\n                        /* Skip fb() */\n                    } else\n                    if (isset($trace[$i]['file'])\n                       && substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php') {\n                        /* Skip FB::fb() */\n                    } else {\n                        $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'';\n                        $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:'';\n                        break;\n                    }\n                }      \n            }\n        } else {\n            unset($meta['file']);\n            unset($meta['line']);\n        }\n\n        $this->setHeader('X-Wf-Protocol-1','http://meta.wildfirehq.org/Protocol/JsonStream/0.2');\n        $this->setHeader('X-Wf-1-Plugin-1','http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/'.self::VERSION);\n     \n        $structure_index = 1;\n        if ($Type==self::DUMP) {\n            $structure_index = 2;\n            $this->setHeader('X-Wf-1-Structure-2','http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1');\n        } else {\n            $this->setHeader('X-Wf-1-Structure-1','http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1');\n        }\n      \n        if ($Type==self::DUMP) {\n            $msg = '{\"'.$Label.'\":'.$this->jsonEncode($Object, $skipFinalObjectEncode).'}';\n        } else {\n            $msg_meta = $Options;\n            $msg_meta['Type'] = $Type;\n            if ($Label!==null) {\n                $msg_meta['Label'] = $Label;\n            }\n            if (isset($meta['file']) && !isset($msg_meta['File'])) {\n                $msg_meta['File'] = $meta['file'];\n            }\n            if (isset($meta['line']) && !isset($msg_meta['Line'])) {\n                $msg_meta['Line'] = $meta['line'];\n            }\n            $msg = '['.$this->jsonEncode($msg_meta).','.$this->jsonEncode($Object, $skipFinalObjectEncode).']';\n        }\n        \n        $parts = explode(\"\\n\",chunk_split($msg, 5000, \"\\n\"));\n    \n        for( $i=0 ; $i<count($parts) ; $i++) {\n            \n            $part = $parts[$i];\n            if ($part) {\n                \n                if (count($parts)>2) {\n                    // Message needs to be split into multiple parts\n                    $this->setHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex,\n                                     (($i==0)?strlen($msg):'')\n                                     . '|' . $part . '|'\n                                     . (($i<count($parts)-2)?'\\\\':''));\n                } else {\n                    $this->setHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex,\n                                     strlen($part) . '|' . $part . '|');\n                }\n                \n                $this->messageIndex++;\n                \n                if ($this->messageIndex > 99999) {\n                    throw $this->newException('Maximum number (99,999) of messages reached!');             \n                }\n            }\n        }\n    \n        $this->setHeader('X-Wf-1-Index',$this->messageIndex-1);\n    \n        return true;\n    }\n  \n    /**\n     * Standardizes path for windows systems.\n     *\n     * @param string $Path\n     * @return string\n     */\n    protected function _standardizePath($Path)\n    {\n        return preg_replace('/\\\\\\\\+/','/',$Path);    \n    }\n  \n    /**\n     * Escape trace path for windows systems\n     *\n     * @param array $Trace\n     * @return array\n     */\n    protected function _escapeTrace($Trace)\n    {\n        if (!$Trace) return $Trace;\n        for( $i=0 ; $i<sizeof($Trace) ; $i++ ) {\n            if (isset($Trace[$i]['file'])) {\n                $Trace[$i]['file'] = $this->_escapeTraceFile($Trace[$i]['file']);\n            }\n            if (isset($Trace[$i]['args'])) {\n                $Trace[$i]['args'] = $this->encodeObject($Trace[$i]['args']);\n            }\n        }\n        return $Trace;    \n    }\n  \n    /**\n     * Escape file information of trace for windows systems\n     *\n     * @param string $File\n     * @return string\n     */\n    protected function _escapeTraceFile($File)\n    {\n        /* Check if we have a windows filepath */\n        if (strpos($File,'\\\\')) {\n            /* First strip down to single \\ */\n          \n            $file = preg_replace('/\\\\\\\\+/','\\\\',$File);\n          \n            return $file;\n        }\n        return $File;\n    }\n\n    /**\n     * Check if headers have already been sent\n     *\n     * @param string $Filename\n     * @param integer $Linenum\n     */\n    protected function headersSent(&$Filename, &$Linenum)\n    {\n        return headers_sent($Filename, $Linenum);\n    }\n\n    /**\n     * Send header\n     *\n     * @param string $Name\n     * @param string $Value\n     */\n    protected function setHeader($Name, $Value)\n    {\n        return header($Name.': '.$Value);\n    }\n\n    /**\n     * Get user agent\n     *\n     * @return string|false\n     */\n    protected function getUserAgent()\n    {\n        if (!isset($_SERVER['HTTP_USER_AGENT'])) return false;\n        return $_SERVER['HTTP_USER_AGENT'];\n    }\n\n    /**\n     * Get all request headers\n     * \n     * @return array\n     */\n    public static function getAllRequestHeaders() {\n        static $_cached_headers = false;\n        if($_cached_headers!==false) {\n            return $_cached_headers;\n        }\n        $headers = array();\n        if(function_exists('getallheaders')) {\n            foreach( getallheaders() as $name => $value ) {\n                $headers[strtolower($name)] = $value;\n            }\n        } else {\n            foreach($_SERVER as $name => $value) {\n                if(substr($name, 0, 5) == 'HTTP_') {\n                    $headers[strtolower(str_replace(' ', '-', str_replace('_', ' ', substr($name, 5))))] = $value;\n                }\n            }\n        }\n        return $_cached_headers = $headers;\n    }\n\n    /**\n     * Get a request header\n     *\n     * @return string|false\n     */\n    protected function getRequestHeader($Name)\n    {\n        $headers = self::getAllRequestHeaders();\n        if (isset($headers[strtolower($Name)])) {\n            return $headers[strtolower($Name)];\n        }\n        return false;\n    }\n\n    /**\n     * Returns a new exception\n     *\n     * @param string $Message\n     * @return Exception\n     */\n    protected function newException($Message)\n    {\n        return new Exception($Message);\n    }\n  \n    /**\n     * Encode an object into a JSON string\n     * \n     * Uses PHP's jeson_encode() if available\n     * \n     * @param object $Object The object to be encoded\n     * @return string The JSON string\n     */\n    public function jsonEncode($Object, $skipObjectEncode = false)\n    {\n        if (!$skipObjectEncode) {\n            $Object = $this->encodeObject($Object);\n        }\n        \n        if (function_exists('json_encode')\n           && $this->options['useNativeJsonEncode']!=false) {\n    \n            return json_encode($Object);\n        } else {\n            return $this->json_encode($Object);\n        }\n    }\n\n    /**\n     * Encodes a table by encoding each row and column with encodeObject()\n     * \n     * @param array $Table The table to be encoded\n     * @return array\n     */  \n    protected function encodeTable($Table)\n    {\n    \n        if (!$Table) return $Table;\n        \n        $new_table = array();\n        foreach($Table as $row) {\n      \n            if (is_array($row)) {\n                $new_row = array();\n            \n                foreach($row as $item) {\n                    $new_row[] = $this->encodeObject($item);\n                }\n            \n                $new_table[] = $new_row;\n            }\n        }\n        \n        return $new_table;\n    }\n\n    /**\n     * Encodes an object including members with\n     * protected and private visibility\n     * \n     * @param Object $Object The object to be encoded\n     * @param int $Depth The current traversal depth\n     * @return array All members of the object\n     */\n    protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $MaxDepth = 1)\n    {\n        if ($MaxDepth > $this->options['maxDepth']) {\n            return '** Max Depth ('.$this->options['maxDepth'].') **';\n        }\n\n        $return = array();\n    \n        if (is_resource($Object)) {\n    \n            return '** '.(string)$Object.' **';\n    \n        } else    \n        if (is_object($Object)) {\n    \n            if ($ObjectDepth > $this->options['maxObjectDepth']) {\n                return '** Max Object Depth ('.$this->options['maxObjectDepth'].') **';\n            }\n            \n            foreach ($this->objectStack as $refVal) {\n                if ($refVal === $Object) {\n                    return '** Recursion ('.get_class($Object).') **';\n                }\n            }\n            array_push($this->objectStack, $Object);\n                    \n            $return['__className'] = $class = get_class($Object);\n            $class_lower = strtolower($class);\n    \n            $reflectionClass = new ReflectionClass($class);  \n            $properties = array();\n            foreach( $reflectionClass->getProperties() as $property) {\n                $properties[$property->getName()] = $property;\n            }\n                \n            $members = (array)$Object;\n    \n            foreach( $properties as $plain_name => $property ) {\n    \n                $name = $raw_name = $plain_name;\n                if ($property->isStatic()) {\n                    $name = 'static:'.$name;\n                }\n                if ($property->isPublic()) {\n                    $name = 'public:'.$name;\n                } else\n                if ($property->isPrivate()) {\n                    $name = 'private:'.$name;\n                    $raw_name = \"\\0\".$class.\"\\0\".$raw_name;\n                } else\n                if ($property->isProtected()) {\n                    $name = 'protected:'.$name;\n                    $raw_name = \"\\0\".'*'.\"\\0\".$raw_name;\n                }\n    \n                if (!(isset($this->objectFilters[$class_lower])\n                     && is_array($this->objectFilters[$class_lower])\n                     && in_array($plain_name,$this->objectFilters[$class_lower]))) {\n    \n                    if (array_key_exists($raw_name,$members)\n                       && !$property->isStatic()) {\n                  \n                        $return[$name] = $this->encodeObject($members[$raw_name], $ObjectDepth + 1, 1, $MaxDepth + 1);      \n                \n                    } else {\n                        if (method_exists($property,'setAccessible')) {\n                            $property->setAccessible(true);\n                            $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1, $MaxDepth + 1);\n                        } else\n                        if ($property->isPublic()) {\n                            $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1, $MaxDepth + 1);\n                        } else {\n                            $return[$name] = '** Need PHP 5.3 to get value **';\n                        }\n                    }\n                } else {\n                    $return[$name] = '** Excluded by Filter **';\n                }\n            }\n            \n            // Include all members that are not defined in the class\n            // but exist in the object\n            foreach( $members as $raw_name => $value ) {\n    \n                $name = $raw_name;\n              \n                if ($name{0} == \"\\0\") {\n                    $parts = explode(\"\\0\", $name);\n                    $name = $parts[2];\n                }\n              \n                $plain_name = $name;\n    \n                if (!isset($properties[$name])) {\n                    $name = 'undeclared:'.$name;\n    \n                    if (!(isset($this->objectFilters[$class_lower])\n                         && is_array($this->objectFilters[$class_lower])\n                         && in_array($plain_name,$this->objectFilters[$class_lower]))) {\n    \n                        $return[$name] = $this->encodeObject($value, $ObjectDepth + 1, 1, $MaxDepth + 1);\n                    } else {\n                        $return[$name] = '** Excluded by Filter **';\n                    }\n                }\n            }\n            \n            array_pop($this->objectStack);\n            \n        } elseif (is_array($Object)) {\n    \n            if ($ArrayDepth > $this->options['maxArrayDepth']) {\n                return '** Max Array Depth ('.$this->options['maxArrayDepth'].') **';\n            }\n          \n            foreach ($Object as $key => $val) {\n              \n                // Encoding the $GLOBALS PHP array causes an infinite loop\n                // if the recursion is not reset here as it contains\n                // a reference to itself. This is the only way I have come up\n                // with to stop infinite recursion in this case.\n                if ($key=='GLOBALS'\n                   && is_array($val)\n                   && array_key_exists('GLOBALS',$val)) {\n                    $val['GLOBALS'] = '** Recursion (GLOBALS) **';\n                }\n              \n                $return[$key] = $this->encodeObject($val, 1, $ArrayDepth + 1, $MaxDepth + 1);\n            }\n        } else {\n            if (self::is_utf8($Object)) {\n                return $Object;\n            } else {\n                return utf8_encode($Object);\n            }\n        }\n        return $return;\n    }\n\n    /**\n     * Returns true if $string is valid UTF-8 and false otherwise.\n     *\n     * @param mixed $str String to be tested\n     * @return boolean\n     */\n    protected static function is_utf8($str)\n    {\n        if(function_exists('mb_detect_encoding')) {\n            return (mb_detect_encoding($str) == 'UTF-8');\n        }\n        $c=0; $b=0;\n        $bits=0;\n        $len=strlen($str);\n        for($i=0; $i<$len; $i++){\n            $c=ord($str[$i]);\n            if ($c > 128){\n                if (($c >= 254)) return false;\n                elseif ($c >= 252) $bits=6;\n                elseif ($c >= 248) $bits=5;\n                elseif ($c >= 240) $bits=4;\n                elseif ($c >= 224) $bits=3;\n                elseif ($c >= 192) $bits=2;\n                else return false;\n                if (($i+$bits) > $len) return false;\n                while($bits > 1){\n                    $i++;\n                    $b=ord($str[$i]);\n                    if ($b < 128 || $b > 191) return false;\n                    $bits--;\n                }\n            }\n        }\n        return true;\n    } \n\n    /**\n     * Converts to and from JSON format.\n     *\n     * JSON (JavaScript Object Notation) is a lightweight data-interchange\n     * format. It is easy for humans to read and write. It is easy for machines\n     * to parse and generate. It is based on a subset of the JavaScript\n     * Programming Language, Standard ECMA-262 3rd Edition - December 1999.\n     * This feature can also be found in  Python. JSON is a text format that is\n     * completely language independent but uses conventions that are familiar\n     * to programmers of the C-family of languages, including C, C++, C#, Java,\n     * JavaScript, Perl, TCL, and many others. These properties make JSON an\n     * ideal data-interchange language.\n     *\n     * This package provides a simple encoder and decoder for JSON notation. It\n     * is intended for use with client-side Javascript applications that make\n     * use of HTTPRequest to perform server communication functions - data can\n     * be encoded into JSON notation for use in a client-side javascript, or\n     * decoded from incoming Javascript requests. JSON format is native to\n     * Javascript, and can be directly eval()'ed with no further parsing\n     * overhead\n     *\n     * All strings should be in ASCII or UTF-8 format!\n     *\n     * LICENSE: Redistribution and use in source and binary forms, with or\n     * without modification, are permitted provided that the following\n     * conditions are met: Redistributions of source code must retain the\n     * above copyright notice, this list of conditions and the following\n     * disclaimer. Redistributions in binary form must reproduce the above\n     * copyright notice, this list of conditions and the following disclaimer\n     * in the documentation and/or other materials provided with the\n     * distribution.\n     *\n     * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED\n     * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n     * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN\n     * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n     * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n     * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS\n     * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n     * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR\n     * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE\n     * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\n     * DAMAGE.\n     *\n     * @category\n     * @package     Services_JSON\n     * @author      Michal Migurski <mike-json@teczno.com>\n     * @author      Matt Knapp <mdknapp[at]gmail[dot]com>\n     * @author      Brett Stimmerman <brettstimmerman[at]gmail[dot]com>\n     * @author      Christoph Dorn <christoph@christophdorn.com>\n     * @copyright   2005 Michal Migurski\n     * @version     CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $\n     * @license     http://www.opensource.org/licenses/bsd-license.php\n     * @link        http://pear.php.net/pepr/pepr-proposal-show.php?id=198\n     */\n   \n     \n    /**\n     * Keep a list of objects as we descend into the array so we can detect recursion.\n     */\n    private $json_objectStack = array();\n\n\n   /**\n    * convert a string from one UTF-8 char to one UTF-16 char\n    *\n    * Normally should be handled by mb_convert_encoding, but\n    * provides a slower PHP-only method for installations\n    * that lack the multibye string extension.\n    *\n    * @param    string  $utf8   UTF-8 character\n    * @return   string  UTF-16 character\n    * @access   private\n    */\n    private function json_utf82utf16($utf8)\n    {\n        // oh please oh please oh please oh please oh please\n        if (function_exists('mb_convert_encoding')) {\n            return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');\n        }\n\n        switch(strlen($utf8)) {\n            case 1:\n                // this case should never be reached, because we are in ASCII range\n                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8\n                return $utf8;\n\n            case 2:\n                // return a UTF-16 character from a 2-byte UTF-8 char\n                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8\n                return chr(0x07 & (ord($utf8{0}) >> 2))\n                       . chr((0xC0 & (ord($utf8{0}) << 6))\n                       | (0x3F & ord($utf8{1})));\n\n            case 3:\n                // return a UTF-16 character from a 3-byte UTF-8 char\n                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8\n                return chr((0xF0 & (ord($utf8{0}) << 4))\n                       | (0x0F & (ord($utf8{1}) >> 2)))\n                       . chr((0xC0 & (ord($utf8{1}) << 6))\n                       | (0x7F & ord($utf8{2})));\n        }\n\n        // ignoring UTF-32 for now, sorry\n        return '';\n    }\n\n   /**\n    * encodes an arbitrary variable into JSON format\n    *\n    * @param    mixed   $var    any number, boolean, string, array, or object to be encoded.\n    *                           see argument 1 to Services_JSON() above for array-parsing behavior.\n    *                           if var is a strng, note that encode() always expects it\n    *                           to be in ASCII or UTF-8 format!\n    *\n    * @return   mixed   JSON string representation of input var or an error if a problem occurs\n    * @access   public\n    */\n    private function json_encode($var)\n    {\n    \n        if (is_object($var)) {\n            if (in_array($var,$this->json_objectStack)) {\n                return '\"** Recursion **\"';\n            }\n        }\n          \n        switch (gettype($var)) {\n            case 'boolean':\n                return $var ? 'true' : 'false';\n\n            case 'NULL':\n                return 'null';\n\n            case 'integer':\n                return (int) $var;\n\n            case 'double':\n            case 'float':\n                return (float) $var;\n\n            case 'string':\n                // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT\n                $ascii = '';\n                $strlen_var = strlen($var);\n\n               /*\n                * Iterate over every character in the string,\n                * escaping with a slash or encoding to UTF-8 where necessary\n                */\n                for ($c = 0; $c < $strlen_var; ++$c) {\n\n                    $ord_var_c = ord($var{$c});\n\n                    switch (true) {\n                        case $ord_var_c == 0x08:\n                            $ascii .= '\\b';\n                            break;\n                        case $ord_var_c == 0x09:\n                            $ascii .= '\\t';\n                            break;\n                        case $ord_var_c == 0x0A:\n                            $ascii .= '\\n';\n                            break;\n                        case $ord_var_c == 0x0C:\n                            $ascii .= '\\f';\n                            break;\n                        case $ord_var_c == 0x0D:\n                            $ascii .= '\\r';\n                            break;\n\n                        case $ord_var_c == 0x22:\n                        case $ord_var_c == 0x2F:\n                        case $ord_var_c == 0x5C:\n                            // double quote, slash, slosh\n                            $ascii .= '\\\\'.$var{$c};\n                            break;\n\n                        case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):\n                            // characters U-00000000 - U-0000007F (same as ASCII)\n                            $ascii .= $var{$c};\n                            break;\n\n                        case (($ord_var_c & 0xE0) == 0xC0):\n                            // characters U-00000080 - U-000007FF, mask 110XXXXX\n                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8\n                            $char = pack('C*', $ord_var_c, ord($var{$c + 1}));\n                            $c += 1;\n                            $utf16 = $this->json_utf82utf16($char);\n                            $ascii .= sprintf('\\u%04s', bin2hex($utf16));\n                            break;\n\n                        case (($ord_var_c & 0xF0) == 0xE0):\n                            // characters U-00000800 - U-0000FFFF, mask 1110XXXX\n                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8\n                            $char = pack('C*', $ord_var_c,\n                                         ord($var{$c + 1}),\n                                         ord($var{$c + 2}));\n                            $c += 2;\n                            $utf16 = $this->json_utf82utf16($char);\n                            $ascii .= sprintf('\\u%04s', bin2hex($utf16));\n                            break;\n\n                        case (($ord_var_c & 0xF8) == 0xF0):\n                            // characters U-00010000 - U-001FFFFF, mask 11110XXX\n                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8\n                            $char = pack('C*', $ord_var_c,\n                                         ord($var{$c + 1}),\n                                         ord($var{$c + 2}),\n                                         ord($var{$c + 3}));\n                            $c += 3;\n                            $utf16 = $this->json_utf82utf16($char);\n                            $ascii .= sprintf('\\u%04s', bin2hex($utf16));\n                            break;\n\n                        case (($ord_var_c & 0xFC) == 0xF8):\n                            // characters U-00200000 - U-03FFFFFF, mask 111110XX\n                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8\n                            $char = pack('C*', $ord_var_c,\n                                         ord($var{$c + 1}),\n                                         ord($var{$c + 2}),\n                                         ord($var{$c + 3}),\n                                         ord($var{$c + 4}));\n                            $c += 4;\n                            $utf16 = $this->json_utf82utf16($char);\n                            $ascii .= sprintf('\\u%04s', bin2hex($utf16));\n                            break;\n\n                        case (($ord_var_c & 0xFE) == 0xFC):\n                            // characters U-04000000 - U-7FFFFFFF, mask 1111110X\n                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8\n                            $char = pack('C*', $ord_var_c,\n                                         ord($var{$c + 1}),\n                                         ord($var{$c + 2}),\n                                         ord($var{$c + 3}),\n                                         ord($var{$c + 4}),\n                                         ord($var{$c + 5}));\n                            $c += 5;\n                            $utf16 = $this->json_utf82utf16($char);\n                            $ascii .= sprintf('\\u%04s', bin2hex($utf16));\n                            break;\n                    }\n                }\n\n                return '\"'.$ascii.'\"';\n\n            case 'array':\n                /*\n                 * As per JSON spec if any array key is not an integer\n                 * we must treat the the whole array as an object. We\n                 * also try to catch a sparsely populated associative\n                 * array with numeric keys here because some JS engines\n                 * will create an array with empty indexes up to\n                 * max_index which can cause memory issues and because\n                 * the keys, which may be relevant, will be remapped\n                 * otherwise.\n                 *\n                 * As per the ECMA and JSON specification an object may\n                 * have any string as a property. Unfortunately due to\n                 * a hole in the ECMA specification if the key is a\n                 * ECMA reserved word or starts with a digit the\n                 * parameter is only accessible using ECMAScript's\n                 * bracket notation.\n                 */\n\n                // treat as a JSON object\n                if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {\n                  \n                    $this->json_objectStack[] = $var;\n\n                    $properties = array_map(array($this, 'json_name_value'),\n                                            array_keys($var),\n                                            array_values($var));\n\n                    array_pop($this->json_objectStack);\n\n                    foreach($properties as $property) {\n                        if ($property instanceof Exception) {\n                            return $property;\n                        }\n                    }\n\n                    return '{' . join(',', $properties) . '}';\n                }\n\n                $this->json_objectStack[] = $var;\n\n                // treat it like a regular array\n                $elements = array_map(array($this, 'json_encode'), $var);\n\n                array_pop($this->json_objectStack);\n\n                foreach($elements as $element) {\n                    if ($element instanceof Exception) {\n                        return $element;\n                    }\n                }\n\n                return '[' . join(',', $elements) . ']';\n\n            case 'object':\n                $vars = self::encodeObject($var);\n\n                $this->json_objectStack[] = $var;\n\n                $properties = array_map(array($this, 'json_name_value'),\n                                        array_keys($vars),\n                                        array_values($vars));\n\n                array_pop($this->json_objectStack);\n              \n                foreach($properties as $property) {\n                    if ($property instanceof Exception) {\n                        return $property;\n                    }\n                }\n                     \n                return '{' . join(',', $properties) . '}';\n\n            default:\n                return null;\n        }\n    }\n\n   /**\n    * array-walking function for use in generating JSON-formatted name-value pairs\n    *\n    * @param    string  $name   name of key to use\n    * @param    mixed   $value  reference to an array element to be encoded\n    *\n    * @return   string  JSON-formatted name-value pair, like '\"name\":value'\n    * @access   private\n    */\n    private function json_name_value($name, $value)\n    {\n        // Encoding the $GLOBALS PHP array causes an infinite loop\n        // if the recursion is not reset here as it contains\n        // a reference to itself. This is the only way I have come up\n        // with to stop infinite recursion in this case.\n        if ($name=='GLOBALS'\n           && is_array($value)\n           && array_key_exists('GLOBALS',$value)) {\n            $value['GLOBALS'] = '** Recursion **';\n        }\n    \n        $encoded_value = $this->json_encode($value);\n\n        if ($encoded_value instanceof Exception) {\n            return $encoded_value;\n        }\n\n        return $this->json_encode(strval($name)) . ':' . $encoded_value;\n    }\n\n    /**\n     * @deprecated\n     */    \n    public function setProcessorUrl($URL)\n    {\n        trigger_error(\"The FirePHP::setProcessorUrl() method is no longer supported\", E_USER_DEPRECATED);\n    }\n\n    /**\n     * @deprecated\n     */\n    public function setRendererUrl($URL)\n    {\n        trigger_error(\"The FirePHP::setRendererUrl() method is no longer supported\", E_USER_DEPRECATED);\n    }  \n}\n"
  },
  {
    "path": "ThinkPHP/Library/Behavior/ParseTemplateBehavior.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Behavior;\nuse Think\\Storage;\nuse Think\\Think;\n/**\n * 系统行为扩展：模板解析\n */\nclass ParseTemplateBehavior {\n\n    // 行为扩展的执行入口必须是run\n    public function run(&$_data){\n        $engine             =   strtolower(C('TMPL_ENGINE_TYPE'));\n        $_content           =   empty($_data['content'])?$_data['file']:$_data['content'];\n        $_data['prefix']    =   !empty($_data['prefix'])?$_data['prefix']:C('TMPL_CACHE_PREFIX');\n        if('think'==$engine){ // 采用Think模板引擎\n            if((!empty($_data['content']) && $this->checkContentCache($_data['content'],$_data['prefix'])) \n                ||  $this->checkCache($_data['file'],$_data['prefix'])) { // 缓存有效\n                //载入模版缓存文件\n                Storage::load(C('CACHE_PATH').$_data['prefix'].md5($_content).C('TMPL_CACHFILE_SUFFIX'),$_data['var']);\n            }else{\n                $tpl = Think::instance('Think\\\\Template');\n                // 编译并加载模板文件\n                $tpl->fetch($_content,$_data['var'],$_data['prefix']);\n            }\n        }else{\n            // 调用第三方模板引擎解析和输出\n            if(strpos($engine,'\\\\')){\n                $class  =   $engine;\n            }else{\n                $class   =  'Think\\\\Template\\\\Driver\\\\'.ucwords($engine);                \n            }            \n            if(class_exists($class)) {\n                $tpl   =  new $class;\n                $tpl->fetch($_content,$_data['var']);\n            }else {  // 类没有定义\n                E(L('_NOT_SUPPORT_').': ' . $class);\n            }\n        }\n    }\n\n    /**\n     * 检查缓存文件是否有效\n     * 如果无效则需要重新编译\n     * @access public\n     * @param string $tmplTemplateFile  模板文件名\n     * @return boolean\n     */\n    protected function checkCache($tmplTemplateFile,$prefix='') {\n        if (!C('TMPL_CACHE_ON')) // 优先对配置设定检测\n            return false;\n        $tmplCacheFile = C('CACHE_PATH').$prefix.md5($tmplTemplateFile).C('TMPL_CACHFILE_SUFFIX');\n        if(!Storage::has($tmplCacheFile)){\n            return false;\n        }elseif (filemtime($tmplTemplateFile) > Storage::get($tmplCacheFile,'mtime')) {\n            // 模板文件如果有更新则缓存需要更新\n            return false;\n        }elseif (C('TMPL_CACHE_TIME') != 0 && time() > Storage::get($tmplCacheFile,'mtime')+C('TMPL_CACHE_TIME')) {\n            // 缓存是否在有效期\n            return false;\n        }\n        // 开启布局模板\n        if(C('LAYOUT_ON')) {\n            $layoutFile  =  THEME_PATH.C('LAYOUT_NAME').C('TMPL_TEMPLATE_SUFFIX');\n            if(filemtime($layoutFile) > Storage::get($tmplCacheFile,'mtime')) {\n                return false;\n            }\n        }\n        // 缓存有效\n        return true;\n    }\n\n    /**\n     * 检查缓存内容是否有效\n     * 如果无效则需要重新编译\n     * @access public\n     * @param string $tmplContent  模板内容\n     * @return boolean\n     */\n    protected function checkContentCache($tmplContent,$prefix='') {\n        if(Storage::has(C('CACHE_PATH').$prefix.md5($tmplContent).C('TMPL_CACHFILE_SUFFIX'))){\n            return true;\n        }else{\n            return false;\n        }\n    }    \n}\n"
  },
  {
    "path": "ThinkPHP/Library/Behavior/ReadHtmlCacheBehavior.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Behavior;\nuse Think\\Storage;\n/**\n * 系统行为扩展：静态缓存读取\n */\nclass ReadHtmlCacheBehavior {\n    // 行为扩展的执行入口必须是run\n    public function run(&$params){\n        // 开启静态缓存\n        if(IS_GET && C('HTML_CACHE_ON'))  {\n            $cacheTime = $this->requireHtmlCache();\n            if( false !== $cacheTime && $this->checkHTMLCache(HTML_FILE_NAME,$cacheTime)) { //静态页面有效\n                // 读取静态页面输出\n                echo Storage::read(HTML_FILE_NAME,'html');\n                exit();\n            }\n        }\n    }\n\n    // 判断是否需要静态缓存\n    static private function requireHtmlCache() {\n        // 分析当前的静态规则\n         $htmls = C('HTML_CACHE_RULES'); // 读取静态规则\n         if(!empty($htmls)) {\n            $htmls = array_change_key_case($htmls);\n            // 静态规则文件定义格式 actionName=>array('静态规则','缓存时间','附加规则')\n            // 'read'=>array('{id},{name}',60,'md5') 必须保证静态规则的唯一性 和 可判断性\n            // 检测静态规则\n            $controllerName = strtolower(CONTROLLER_NAME);\n            $actionName     = strtolower(ACTION_NAME);\n            if(isset($htmls[$controllerName.':'.$actionName])) {\n                $html   =   $htmls[$controllerName.':'.$actionName];   // 某个控制器的操作的静态规则\n            }elseif(isset($htmls[$controllerName.':'])){// 某个控制器的静态规则\n                $html   =   $htmls[$controllerName.':'];\n            }elseif(isset($htmls[$actionName])){\n                $html   =   $htmls[$actionName]; // 所有操作的静态规则\n            }elseif(isset($htmls['*'])){\n                $html   =   $htmls['*']; // 全局静态规则\n            }\n            if(!empty($html)) {\n                // 解读静态规则\n                $rule   = is_array($html)?$html[0]:$html;\n                // 以$_开头的系统变量\n                $callback = function($match){ \n                    switch($match[1]){\n                        case '_GET':        $var = $_GET[$match[2]]; break;\n                        case '_POST':       $var = $_POST[$match[2]]; break;\n                        case '_REQUEST':    $var = $_REQUEST[$match[2]]; break;\n                        case '_SERVER':     $var = $_SERVER[$match[2]]; break;\n                        case '_SESSION':    $var = $_SESSION[$match[2]]; break;\n                        case '_COOKIE':     $var = $_COOKIE[$match[2]]; break;\n                    }\n                    return (count($match) == 4) ? $match[3]($var) : $var;\n                };\n                $rule     = preg_replace_callback('/{\\$(_\\w+)\\.(\\w+)(?:\\|(\\w+))?}/', $callback, $rule);\n                // {ID|FUN} GET变量的简写\n                $rule     = preg_replace_callback('/{(\\w+)\\|(\\w+)}/', function($match){return $match[2]($_GET[$match[1]]);}, $rule);\n                $rule     = preg_replace_callback('/{(\\w+)}/', function($match){return $_GET[$match[1]];}, $rule);\n                // 特殊系统变量\n                $rule   = str_ireplace(\n                    array('{:controller}','{:action}','{:module}'),\n                    array(CONTROLLER_NAME,ACTION_NAME,MODULE_NAME),\n                    $rule);\n                // {|FUN} 单独使用函数\n                $rule  = preg_replace_callback('/{|(\\w+)}/', function($match){return $match[1]();},$rule);\n                $cacheTime  =   C('HTML_CACHE_TIME',null,60);\n                if(is_array($html)){\n                    if(!empty($html[2])) $rule    =   $html[2]($rule); // 应用附加函数\n                    $cacheTime  =   isset($html[1])?$html[1]:$cacheTime; // 缓存有效期\n                }else{\n                    $cacheTime  =   $cacheTime;\n                }\n                \n                // 当前缓存文件\n                define('HTML_FILE_NAME',HTML_PATH . $rule.C('HTML_FILE_SUFFIX',null,'.html'));\n                return $cacheTime;\n            }\n        }\n        // 无需缓存\n        return false;\n    }\n\n    /**\n     * 检查静态HTML文件是否有效\n     * 如果无效需要重新更新\n     * @access public\n     * @param string $cacheFile  静态文件名\n     * @param integer $cacheTime  缓存有效期\n     * @return boolean\n     */\n    static public function checkHTMLCache($cacheFile='',$cacheTime='') {\n        if(!is_file($cacheFile) && 'sae' != APP_MODE ){\n            return false;\n        }elseif (filemtime(\\Think\\Think::instance('Think\\View')->parseTemplate()) > Storage::get($cacheFile,'mtime','html')) {\n            // 模板文件如果更新静态文件需要更新\n            return false;\n        }elseif(!is_numeric($cacheTime) && function_exists($cacheTime)){\n            return $cacheTime($cacheFile);\n        }elseif ($cacheTime != 0 && NOW_TIME > Storage::get($cacheFile,'mtime','html')+$cacheTime) {\n            // 文件是否在有效期\n            return false;\n        }\n        //静态文件有效\n        return true;\n    }\n\n}"
  },
  {
    "path": "ThinkPHP/Library/Behavior/RobotCheckBehavior.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Behavior;\n/**\n * 机器人检测\n * @author   liu21st <liu21st@gmail.com>\n */\nclass RobotCheckBehavior {\n    \n    public function run(&$params) {\n        // 机器人访问检测\n        if(C('LIMIT_ROBOT_VISIT',null,true) && self::isRobot()) {\n            // 禁止机器人访问\n            exit('Access Denied');\n        }\n    }\n\n    static private function isRobot() {\n        static $_robot = null;\n        if(is_null($_robot)) {\n            $spiders = 'Bot|Crawl|Spider|slurp|sohu-search|lycos|robozilla';\n            $browsers = 'MSIE|Netscape|Opera|Konqueror|Mozilla';\n            if(preg_match(\"/($browsers)/\", $_SERVER['HTTP_USER_AGENT'])) {\n                $_robot\t =\t  false ;\n            } elseif(preg_match(\"/($spiders)/\", $_SERVER['HTTP_USER_AGENT'])) {\n                $_robot\t =\t  true;\n            } else {\n                $_robot\t =\t  false;\n            }\n        }\n        return $_robot;\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Behavior/ShowPageTraceBehavior.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Behavior;\nuse Think\\Log;\n/**\n * 系统行为扩展：页面Trace显示输出\n */\nclass ShowPageTraceBehavior {\n    protected $tracePageTabs =  array('BASE'=>'基本','FILE'=>'文件','INFO'=>'流程','ERR|NOTIC'=>'错误','SQL'=>'SQL','DEBUG'=>'调试');\n\n    // 行为扩展的执行入口必须是run\n    public function run(&$params){\n        if(!IS_AJAX && !IS_CLI && C('SHOW_PAGE_TRACE')) {\n            echo $this->showTrace();\n        }\n    }\n\n    /**\n     * 显示页面Trace信息\n     * @access private\n     */\n    private function showTrace() {\n         // 系统默认显示信息\n        $files  =  get_included_files();\n        $info   =   array();\n        foreach ($files as $key=>$file){\n            $info[] = $file.' ( '.number_format(filesize($file)/1024,2).' KB )';\n        }\n        $trace  =   array();\n        $base   =   array(\n            '请求信息'  =>  date('Y-m-d H:i:s',$_SERVER['REQUEST_TIME']).' '.$_SERVER['SERVER_PROTOCOL'].' '.$_SERVER['REQUEST_METHOD'].' : '.__SELF__,\n            '运行时间'  =>  $this->showTime(),\n            '吞吐率'    =>  number_format(1/G('beginTime','viewEndTime'),2).'req/s',\n            '内存开销'  =>  MEMORY_LIMIT_ON?number_format((memory_get_usage() - $GLOBALS['_startUseMems'])/1024,2).' kb':'不支持',\n            '查询信息'  =>  N('db_query').' queries '.N('db_write').' writes ',\n            '文件加载'  =>  count(get_included_files()),\n            '缓存信息'  =>  N('cache_read').' gets '.N('cache_write').' writes ',\n            '配置加载'  =>  count(C()),\n            '会话信息'  =>  'SESSION_ID='.session_id(),\n            );\n        // 读取应用定义的Trace文件\n        $traceFile  =   COMMON_PATH.'Conf/trace.php';\n        if(is_file($traceFile)) {\n            $base   =   array_merge($base,include $traceFile);\n        }\n        $debug  =   trace();\n        $tabs   =   C('TRACE_PAGE_TABS',null,$this->tracePageTabs);\n        foreach ($tabs as $name=>$title){\n            switch(strtoupper($name)) {\n                case 'BASE':// 基本信息\n                    $trace[$title]  =   $base;\n                    break;\n                case 'FILE': // 文件信息\n                    $trace[$title]  =   $info;\n                    break;\n                default:// 调试信息\n                    $name       =   strtoupper($name);\n                    if(strpos($name,'|')) {// 多组信息\n                        $names  =   explode('|',$name);\n                        $result =   array();\n                        foreach($names as $name){\n                            $result   +=   isset($debug[$name])?$debug[$name]:array();\n                        }\n                        $trace[$title]  =   $result;\n                    }else{\n                        $trace[$title]  =   isset($debug[$name])?$debug[$name]:'';\n                    }\n            }\n        }\n        if($save = C('PAGE_TRACE_SAVE')) { // 保存页面Trace日志\n            if(is_array($save)) {// 选择选项卡保存\n                $tabs   =   C('TRACE_PAGE_TABS',null,$this->tracePageTabs);\n                $array  =   array();\n                foreach ($save as $tab){\n                    $array[] =   $tabs[$tab];\n                }\n            }\n            $content    =   date('[ c ]').' '.get_client_ip().' '.$_SERVER['REQUEST_URI'].\"\\r\\n\";\n            foreach ($trace as $key=>$val){\n                if(!isset($array) || in_array_case($key,$array)) {\n                    $content    .=  '[ '.$key.\" ]\\r\\n\";\n                    if(is_array($val)) {\n                        foreach ($val as $k=>$v){\n                            $content .= (!is_numeric($k)?$k.':':'').print_r($v,true).\"\\r\\n\";\n                        }\n                    }else{\n                        $content .= print_r($val,true).\"\\r\\n\";\n                    }\n                    $content .= \"\\r\\n\";\n                }\n            }\n            error_log(str_replace('<br/>',\"\\r\\n\",$content), 3,C('LOG_PATH').date('y_m_d').'_trace.log');\n        }\n        unset($files,$info,$base);\n        // 调用Trace页面模板\n        ob_start();\n        include C('TMPL_TRACE_FILE')?C('TMPL_TRACE_FILE'):THINK_PATH.'Tpl/page_trace.tpl';\n        return ob_get_clean();\n    }\n\n    /**\n     * 获取运行时间\n     */\n    private function showTime() {\n        // 显示运行时间\n        G('beginTime',$GLOBALS['_beginTime']);\n        G('viewEndTime');\n        // 显示详细运行时间\n        return G('beginTime','viewEndTime').'s ( Load:'.G('beginTime','loadTime').'s Init:'.G('loadTime','initTime').'s Exec:'.G('initTime','viewStartTime').'s Template:'.G('viewStartTime','viewEndTime').'s )';\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Behavior/ShowRuntimeBehavior.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Behavior;\n/**\n * 系统行为扩展：运行时间信息显示\n */\nclass ShowRuntimeBehavior {\n\n    // 行为扩展的执行入口必须是run\n    public function run(&$content){\n        if(C('SHOW_RUN_TIME')){\n            if(false !== strpos($content,'{__NORUNTIME__}')) {\n                $content   =  str_replace('{__NORUNTIME__}','',$content);\n            }else{\n                $runtime = $this->showTime();\n                 if(strpos($content,'{__RUNTIME__}'))\n                     $content   =  str_replace('{__RUNTIME__}',$runtime,$content);\n                 else\n                     $content   .=  $runtime;\n            }\n        }else{\n            $content   =  str_replace(array('{__NORUNTIME__}','{__RUNTIME__}'),'',$content);\n        }\n    }\n\n    /**\n     * 显示运行时间、数据库操作、缓存次数、内存使用信息\n     * @access private\n     * @return string\n     */\n    private function showTime() {\n        // 显示运行时间\n        G('beginTime',$GLOBALS['_beginTime']);\n        G('viewEndTime');\n        $showTime   =   'Process: '.G('beginTime','viewEndTime').'s ';\n        if(C('SHOW_ADV_TIME')) {\n            // 显示详细运行时间\n            $showTime .= '( Load:'.G('beginTime','loadTime').'s Init:'.G('loadTime','initTime').'s Exec:'.G('initTime','viewStartTime').'s Template:'.G('viewStartTime','viewEndTime').'s )';\n        }\n        if(C('SHOW_DB_TIMES') ) {\n            // 显示数据库操作次数\n            $showTime .= ' | DB :'.N('db_query').' queries '.N('db_write').' writes ';\n        }\n        if(C('SHOW_CACHE_TIMES') ) {\n            // 显示缓存读写次数\n            $showTime .= ' | Cache :'.N('cache_read').' gets '.N('cache_write').' writes ';\n        }\n        if(MEMORY_LIMIT_ON && C('SHOW_USE_MEM')) {\n            // 显示内存开销\n            $showTime .= ' | UseMem:'. number_format((memory_get_usage() - $GLOBALS['_startUseMems'])/1024).' kb';\n        }\n        if(C('SHOW_LOAD_FILE')) {\n            $showTime .= ' | LoadFile:'.count(get_included_files());\n        }\n        if(C('SHOW_FUN_TIMES')) {\n            $fun  =  get_defined_functions();\n            $showTime .= ' | CallFun:'.count($fun['user']).','.count($fun['internal']);\n        }\n        return $showTime;\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Behavior/TokenBuildBehavior.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | TOPThink [ WE CAN DO IT JUST THINK ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2010 http://topthink.com All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Behavior;\n/**\n * 系统行为扩展：表单令牌生成\n */\nclass TokenBuildBehavior {\n\n    public function run(&$content){\n        if(C('TOKEN_ON')) {\n            list($tokenName,$tokenKey,$tokenValue)=$this->getToken();\n            $input_token = '<input type=\"hidden\" name=\"'.$tokenName.'\" value=\"'.$tokenKey.'_'.$tokenValue.'\" />';\n            $meta_token = '<meta name=\"'.$tokenName.'\" content=\"'.$tokenKey.'_'.$tokenValue.'\" />';\n            if(strpos($content,'{__TOKEN__}')) {\n                // 指定表单令牌隐藏域位置\n                $content = str_replace('{__TOKEN__}',$input_token,$content);\n            }elseif(preg_match('/<\\/form(\\s*)>/is',$content,$match)) {\n                // 智能生成表单令牌隐藏域\n                $content = str_replace($match[0],$input_token.$match[0],$content);\n            }\n            $content = str_ireplace('</head>',$meta_token.'</head>',$content);\n        }else{\n            $content = str_replace('{__TOKEN__}','',$content);\n        }\n    }\n\n    //获得token\n    private function getToken(){\n        $tokenName  = C('TOKEN_NAME',null,'__hash__');\n        $tokenType  = C('TOKEN_TYPE',null,'md5');\n        if(!isset($_SESSION[$tokenName])) {\n            $_SESSION[$tokenName]  = array();\n        }\n        // 标识当前页面唯一性\n        $tokenKey   =  md5($_SERVER['REQUEST_URI']);\n        if(isset($_SESSION[$tokenName][$tokenKey])) {// 相同页面不重复生成session\n            $tokenValue = $_SESSION[$tokenName][$tokenKey];\n        }else{\n            $tokenValue = is_callable($tokenType) ? $tokenType(microtime(true)) : md5(microtime(true));            \n            $_SESSION[$tokenName][$tokenKey]   =  $tokenValue;\n            if(IS_AJAX && C('TOKEN_RESET',null,true))\n                header($tokenName.': '.$tokenKey.'_'.$tokenValue); //ajax需要获得这个header并替换页面中meta中的token值\n        }\n        return array($tokenName,$tokenKey,$tokenValue); \n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Behavior/UpgradeNoticeBehavior.class.php",
    "content": "<?php\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// | Copyright (c) 2006-2012 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: luofei614<www.3g4k.com>\n// +----------------------------------------------------------------------\nnamespace Behavior;\n/**\n * 升级短信通知， 如果有ThinkPHP新版升级，或者重要的更新，会发送短信通知你。\n * 需要使用SAE的短信服务。请先找一个SAE的应用开通短信服务。\n * 使用步骤如下：\n * 1，在项目的Conf目录下建立tags.php配置文件，内容如下：\n * <code>\n * <?php\n * return array(\n *   'app_init' =>  array('UpgradeNotice')\n * );\n * </code>\n *\n * 2，将此文件放在应用的Lib/Behavior文件夹下。\n *注：在SAE上面使用时，以上两步可以省略 \n * 3，在config.php中配置：\n *  'UPGRADE_NOTICE_ON'=>true,//开启短信升级提醒功能 \n * 'UPGRADE_NOTICE_AKEY'=>'your akey',//SAE应用的AKEY，如果在SAE上使用可以不填\n * 'UPGRADE_NOTICE_SKEY'=>'your skey',//SAE应用的SKEY，如果在SAE上使用可以不填\n *'UPGRADE_NOTICE_MOBILE'=>'136456789',//接受短信的手机号\n *'UPGRADE_NOTICE_CHECK_INTERVAL' => 604800,//检测频率,单位秒,默认是一周\n *'UPGRADE_CURRENT_VERSION'=>'0',//升级后的版本号，会在短信中告诉你填写什么\n *UPGRADE_NOTICE_DEBUG=>true, //调试默认，如果为true，UPGRADE_NOTICE_CHECK_INTERVAL配置不起作用，每次都会进行版本检查，此时用于调试，调试完毕后请设置次配置为false\n *\n */\n\nclass UpgradeNoticeBehavior {\n\n    protected $header_ = '';\n    protected $httpCode_;\n    protected $httpDesc_;\n    protected $accesskey_;\n    protected $secretkey_;\n    public function run(&$params) {\n        if (C('UPGRADE_NOTICE_ON') && (!S('think_upgrade_interval') || C('UPGRADE_NOTICE_DEBUG'))) {\n            if(IS_SAE && C('UPGRADE_NOTICE_QUEUE') && !isset($_POST['think_upgrade_queque'])){\n                $queue=new SaeTaskQueue(C('UPGRADE_NOTICE_QUEUE'));\n                $queue->addTask('http://'.$_SERVER['HTTP_HOST'].__APP__,'think_upgrade_queque=1');\n                if(!$queue->push()){\n                    trace('升级提醒队列执行失败,错误原因：'.$queue->errmsg(), '升级通知出错', 'NOTIC', true);\n                }\n                return ;\n            }\n            $akey = C('UPGRADE_NOTICE_AKEY',null,'');\n            $skey = C('UPGRADE_NOTICE_SKEY',null,'');\n            $this->accesskey_ = $akey ? $akey : (defined('SAE_ACCESSKEY') ? SAE_ACCESSKEY : '');\n            $this->secretkey_ = $skey ? $skey : (defined('SAE_SECRETKEY') ? SAE_SECRETKEY : '');\n            $current_version = C('UPGRADE_CURRENT_VERSION',null,0);\n            //读取接口\n            $info = $this->send('http://sinaclouds.sinaapp.com/thinkapi/upgrade.php?v=' . $current_version);\n             if ($info['version'] != $current_version) {\n                    if($this->send_sms($info['msg']))  trace($info['msg'], '升级通知成功', 'NOTIC', true); //发送升级短信\n            }\n            S('think_upgrade_interval', true, C('UPGRADE_NOTICE_CHECK_INTERVAL',null,604800));\n        }\n    }\n    private function send_sms($msg) {\n        $timestamp=time();\n        $url = 'http://inno.smsinter.sina.com.cn/sae_sms_service/sendsms.php'; //发送短信的接口地址\n        $content = \"FetchUrl\" . $url . \"TimeStamp\" . $timestamp . \"AccessKey\" . $this->accesskey_;\n        $signature = (base64_encode(hash_hmac('sha256', $content, $this->secretkey_, true)));\n        $headers = array(\n            \"FetchUrl: $url\",\n            \"AccessKey: \".$this->accesskey_,\n            \"TimeStamp: \" . $timestamp,\n            \"Signature: $signature\"\n        );\n        $data = array(\n            'mobile' => C('UPGRADE_NOTICE_MOBILE',null,'') ,\n            'msg' => $msg,\n            'encoding' => 'UTF-8'\n        );\n        if(!$ret = $this->send('http://g.apibus.io', $data, $headers)){\n            return false;\n        }\n        if (isset($ret['ApiBusError'])) {\n            trace('errno:' . $ret['ApiBusError']['errcode'] . ',errmsg:' . $ret['ApiBusError']['errdesc'], '升级通知出错', 'NOTIC', true);\n            \n            return false;\n        }\n        \n        return true;\n    }\n    private function send($url, $params = array() , $headers = array()) {\n        $ch = curl_init();\n        curl_setopt($ch, CURLOPT_URL, $url);\n        if (!empty($params)) {\n            curl_setopt($ch, CURLOPT_POST, true);\n            curl_setopt($ch, CURLOPT_POSTFIELDS, $params);\n        }\n        if (!empty($headers)) curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\n        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n        $txt = curl_exec($ch);\n        if (curl_errno($ch)) {\n            trace(curl_error($ch) , '升级通知出错', 'NOTIC', true);\n            \n            return false;\n        }\n        curl_close($ch);\n        $ret = json_decode($txt, true);\n        if (!$ret) {\n            trace('接口[' . $url . ']返回格式不正确', '升级通知出错', 'NOTIC', true);\n            \n            return false;\n        }\n        \n        return $ret;\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Behavior/WriteHtmlCacheBehavior.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Behavior;\nuse Think\\Storage;\n/**\n * 系统行为扩展：静态缓存写入\n */\nclass WriteHtmlCacheBehavior {\n\n    // 行为扩展的执行入口必须是run\n    public function run(&$content) {\n        //2014-11-28 修改 如果有HTTP 4xx 3xx 5xx 头部，禁止存储\n        //2014-12-1 修改 对注入的网址 防止生成，例如 /game/lst/SortType/hot/-e8-90-8c-e5-85-94-e7-88-b1-e6-b6-88-e9-99-a4/-e8-bf-9b-e5-87-bb-e7-9a-84-e9-83-a8-e8-90-bd/-e9-a3-8e-e4-ba-91-e5-a4-a9-e4-b8-8b/index.shtml\n        if (C('HTML_CACHE_ON') && defined('HTML_FILE_NAME')\n            && !preg_match('/Status.*[345]{1}\\d{2}/i', implode(' ', headers_list()))\n            && !preg_match('/(-[a-z0-9]{2}){3,}/i',HTML_FILE_NAME)) {\n            //静态文件写入\n            Storage::put(HTML_FILE_NAME, $content, 'html');\n        }\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Com/Wechat.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2015 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: 麦当苗儿 <zuojiazi.cn@gmail.com> <http://www.zjzit.cn>\n// +----------------------------------------------------------------------\n\nnamespace Com;\nuse Com\\WechatCrypt;\n\n//支持在非ThinkPHP环境下使用\ndefined('NOW_TIME') || define('NOW_TIME', $_SERVER['REQUEST_TIME']);\ndefined('IS_GET')   || define('IS_GET',   $_SERVER['REQUEST_METHOD'] == 'GET');\n\nclass Wechat {\n    /**\n     * 消息类型常量\n     */\n    const MSG_TYPE_TEXT       = 'text';\n    const MSG_TYPE_IMAGE      = 'image';\n    const MSG_TYPE_VOICE      = 'voice';\n    const MSG_TYPE_VIDEO      = 'video';\n    const MSG_TYPE_SHORTVIDEO = 'shortvideo';\n    const MSG_TYPE_LOCATION   = 'location';\n    const MSG_TYPE_LINK       = 'link';\n    const MSG_TYPE_MUSIC      = 'music';\n    const MSG_TYPE_NEWS       = 'news';\n    const MSG_TYPE_EVENT      = 'event';\n\n    /**\n     * 事件类型常量\n     */\n    const MSG_EVENT_SUBSCRIBE   = 'subscribe';\n    const MSG_EVENT_UNSUBSCRIBE = 'unsubscribe';\n    const MSG_EVENT_SCAN        = 'SCAN';\n    const MSG_EVENT_LOCATION    = 'LOCATION';\n    const MSG_EVENT_CLICK       = 'CLICK';\n    const MSG_EVENT_VIEW        = 'VIEW';\n\n    /**\n     * 微信推送过来的数据\n     * @var array\n     */\n    private $data = array();\n\n    /**\n     * 微信TOKEN\n     * @var string\n     */\n    private static $token = '';\n\n    /**\n     * 微信APP_ID\n     * @var string\n     */\n    private static $appId = '';\n\n    /**\n     * 消息加密KEY\n     * @var string\n     */\n    private static $encodingAESKey = '';\n\n    /**\n     * 是否使用安全模式\n     * @var boolean\n     */\n    private static $msgSafeMode = false;\n\n    /**\n     * 构造方法，用于实例化微信SDK\n     * 自动回复消息时实例化该SDK\n     * @param string $token 微信后台填写的TOKEN\n     * @param string $appid 微信APPID (安全模式和兼容模式有效)\n     * @param string $key   消息加密KEY (EncodingAESKey)\n     */\n    public function __construct($token, $appid = '', $key = ''){\n        //设置安全模式\n        if(isset($_GET['encrypt_type']) && $_GET['encrypt_type'] == 'aes'){\n            self::$msgSafeMode = true;\n        }\n\n        //参数验证\n        if(self::$msgSafeMode){\n            if(empty($key) || empty($appid)){\n                throw new \\Exception('缺少参数EncodingAESKey或APP_ID！');\n            }\n\n            self::$appId          = $appid;\n            self::$encodingAESKey = $key;\n        }\n\n        //TOKEN验证\n        if($token){\n            self::auth($token) || exit;\n\n            if(IS_GET){\n                exit($_GET['echostr']);\n            } else {\n                self::$token = $token;\n                $this->init();\n            }\n        } else {\n            throw new \\Exception('缺少参数TOKEN！');\n        }\n    }\n\n    /**\n     * 初始化微信推送的数据\n     */\n    private function init(){\n        $xml  = file_get_contents(\"php://input\");\n        $data = self::xml2data($xml);\n\n        //安全模式 或兼容模式\n        if(self::$msgSafeMode){\n            if(isset($data['MsgType'])){\n                //兼容模式追加解密后的消息内容\n                $data['Decrypt'] = self::extract($data['Encrypt']);\n            } else { \n                //安全模式\n                $data = self::extract($data['Encrypt']);\n            }\n        }\n\n        $this->data = $data;\n    }\n\n    /**\n     * 获取微信推送的数据\n     * @return array 转换为数组后的数据\n     */\n    public function request(){\n        return $this->data;\n    }\n\n    /**\n     * * 响应微信发送的信息（自动回复）\n     * @param  array  $content 回复信息，文本信息为string类型\n     * @param  string $type    消息类型\n     */\n    public function response($content, $type = self::MSG_TYPE_TEXT){\n        /* 基础数据 */\n        $data = array(\n            'ToUserName'   => $this->data['FromUserName'],\n            'FromUserName' => $this->data['ToUserName'],\n            'CreateTime'   => NOW_TIME,\n            'MsgType'      => $type,\n        );\n\n        /* 按类型添加额外数据 */\n        $content = call_user_func(array(self, $type), $content);\n        if($type == self::MSG_TYPE_TEXT || $type == self::MSG_TYPE_NEWS){\n            $data = array_merge($data, $content);\n        } else {\n            $data[ucfirst($type)] = $content;\n        }\n\n        //安全模式，加密消息内容\n        if(self::$msgSafeMode){\n            $data = self::generate($data);\n        }\n\n        /* 转换数据为XML */\n        $xml = new \\SimpleXMLElement('<xml></xml>');\n        self::data2xml($xml, $data);\n        exit($xml->asXML());\n    }\n\n    /**\n     * 回复文本消息\n     * @param  string $text   回复的文字\n     */\n    public function replyText($text){\n        return $this->response($text, self::MSG_TYPE_TEXT);\n    }\n\n    /**\n     * 回复图片消息\n     * @param  string $media_id 图片ID\n     */\n    public function replyImage($media_id){\n        return $this->response($media_id, self::MSG_TYPE_IMAGE);\n    }\n\n    /**\n     * 回复语音消息\n     * @param  string $media_id 音频ID\n     */\n    public function replyVoice($media_id){\n        return $this->response($media_id, self::MSG_TYPE_VOICE);\n    }\n\n    /**\n     * 回复视频消息\n     * @param  string $media_id    视频ID\n     * @param  string $title       视频标题\n     * @param  string $discription 视频描述\n     */\n    public function replyVideo($media_id, $title, $discription){\n        return $this->response(func_get_args(), self::MSG_TYPE_VIDEO);\n    }\n\n    /**\n     * 回复音乐消息\n     * @param  string $title          音乐标题\n     * @param  string $discription    音乐描述\n     * @param  string $musicurl       音乐链接\n     * @param  string $hqmusicurl     高品质音乐链接\n     * @param  string $thumb_media_id 缩略图ID\n     */\n    public function replyMusic($title, $discription, $musicurl, $hqmusicurl, $thumb_media_id){\n        return $this->response(func_get_args(), self::MSG_TYPE_MUSIC);\n    }\n\n    /**\n     * 回复图文消息，一个参数代表一条信息\n     * @param  array  $news   图文内容 [标题，描述，URL，缩略图]\n     * @param  array  $news1  图文内容 [标题，描述，URL，缩略图]\n     * @param  array  $news2  图文内容 [标题，描述，URL，缩略图]\n     *                ...     ...\n     * @param  array  $news9  图文内容 [标题，描述，URL，缩略图]\n     */\n    public function replyNews($news, $news1, $news2, $news3){\n        return $this->response(func_get_args(), self::MSG_TYPE_NEWS);\n    }\n\n    /**\n     * 回复一条图文消息\n     * @param  string $title       文章标题\n     * @param  string $discription 文章简介\n     * @param  string $url         文章连接\n     * @param  string $picurl      文章缩略图\n     */\n    public function replyNewsOnce($title, $discription, $url, $picurl){\n        return $this->response(array(func_get_args()), self::MSG_TYPE_NEWS);\n    }\n\n    /**\n     * 数据XML编码\n     * @param  object $xml  XML对象\n     * @param  mixed  $data 数据\n     * @param  string $item 数字索引时的节点名称\n     * @return string\n     */\n    protected static function data2xml($xml, $data, $item = 'item') {\n        foreach ($data as $key => $value) {\n            /* 指定默认的数字key */\n            is_numeric($key) && $key = $item;\n\n            /* 添加子元素 */\n            if(is_array($value) || is_object($value)){\n                $child = $xml->addChild($key);\n                self::data2xml($child, $value, $item);\n            } else {\n                if(is_numeric($value)){\n                    $child = $xml->addChild($key, $value);\n                } else {\n                    $child = $xml->addChild($key);\n                    $node  = dom_import_simplexml($child);\n                    $cdata = $node->ownerDocument->createCDATASection($value);\n                    $node->appendChild($cdata);\n                }\n            }\n        }\n    }\n\n    /**\n     * XML数据解码\n     * @param  string $xml 原始XML字符串\n     * @return array       解码后的数组\n     */\n    protected static function xml2data($xml){\n        $xml = new \\SimpleXMLElement($xml);\n        \n        if(!$xml){\n            throw new \\Exception('非法XXML');\n        }\n\n        $data = array();\n        foreach ($xml as $key => $value) {\n            $data[$key] = strval($value);\n        }\n\n        return $data;\n    }\n\n    /**\n     * 对数据进行签名认证，确保是微信发送的数据\n     * @param  string $token 微信开放平台设置的TOKEN\n     * @return boolean       true-签名正确，false-签名错误\n     */\n    protected static function auth($token){\n        /* 获取数据 */\n        $data = array($_GET['timestamp'], $_GET['nonce'], $token);\n        $sign = $_GET['signature'];\n        \n        /* 对数据进行字典排序 */\n        sort($data, SORT_STRING);\n\n        /* 生成签名 */\n        $signature = sha1(implode($data));\n        return $signature === $sign;\n    }\n\n    /**\n     * 构造文本信息\n     * @param  string $content 要回复的文本\n     */\n    private static function text($content){\n        $data['Content'] = $content;\n        return $data;\n    }\n\n    /**\n     * 构造图片信息\n     * @param  integer $media 图片ID\n     */\n    private static function image($media){\n        $data['MediaId'] = $media;\n        return $data;\n    }\n\n    /**\n     * 构造音频信息\n     * @param  integer $media 语音ID\n     */\n    private static function voice($media){\n        $data['MediaId'] = $media;\n        return $data;\n    }\n\n    /**\n     * 构造视频信息\n     * @param  array $video 要回复的视频 [视频ID，标题，说明]\n     */\n    private static function video($video){\n        $data = array();\n        list(\n            $data['MediaId'],\n            $data['Title'], \n            $data['Description'], \n        ) = $video;\n\n        return $data;\n    }\n\n    /**\n     * 构造音乐信息\n     * @param  array $music 要回复的音乐[标题，说明，链接，高品质链接，缩略图ID]\n     */\n    private static function music($music){\n        $data = array();\n        list(\n            $data['Title'], \n            $data['Description'], \n            $data['MusicUrl'], \n            $data['HQMusicUrl'],\n            $data['ThumbMediaId'],\n        ) = $music;\n\n        return $data;\n    }\n\n    /**\n     * 构造图文信息\n     * @param  array $news 要回复的图文内容\n     * [    \n     *      0 => 第一条图文信息[标题，说明，图片链接，全文连接]，\n     *      1 => 第二条图文信息[标题，说明，图片链接，全文连接]，\n     *      2 => 第三条图文信息[标题，说明，图片链接，全文连接]， \n     * ]\n     */\n    private static function news($news){\n        $articles = array();\n        foreach ($news as $key => $value) {\n            list(\n                $articles[$key]['Title'],\n                $articles[$key]['Description'],\n                $articles[$key]['Url'],\n                $articles[$key]['PicUrl']\n            ) = $value;\n\n            if($key >= 9) break; //最多只允许10条图文信息\n        }\n        $data['ArticleCount'] = count($articles);\n        $data['Articles']     = $articles;\n\n        return $data;\n    }\n\n    /**\n     * 验证并解密密文数据\n     * @param  string $encrypt 密文\n     * @return array           解密后的数据\n     */\n    private static function extract($encrypt){\n        //验证数据签名\n        $signature = self::sign($_GET['timestamp'], $_GET['nonce'], $encrypt);\n        if($signature != $_GET['msg_signature']){\n            throw new \\Exception('数据签名错误！');\n        }\n\n        //消息解密对象\n        $WechatCrypt = new WechatCrypt(self::$encodingAESKey, self::$appId);\n\n        //解密得到回明文消息\n        $decrypt = $WechatCrypt->decrypt($encrypt);\n        \n        //返回解密的数据\n        return self::xml2data($decrypt);\n    }\n\n    /**\n     * 加密并生成密文消息数据\n     * @param  array $data 获取到的加密的消息数据\n     * @return array       生成的加密消息结构\n     */\n    private static function generate($data){\n        /* 转换数据为XML */\n        $xml = new \\SimpleXMLElement('<xml></xml>');\n        self::data2xml($xml, $data);\n        $xml = $xml->asXML();\n\n        //消息加密对象\n        $WechatCrypt = new WechatCrypt(self::$encodingAESKey, self::$appId);\n\n        //加密得到密文消息\n        $encrypt = $WechatCrypt->encrypt($xml);\n\n        //签名\n        $nonce     = mt_rand(0, 9999999999);\n        $signature = self::sign(NOW_TIME, $nonce, $encrypt);\n\n        /* 加密消息基础数据 */\n        $data = array(\n            'Encrypt'      => $encrypt,\n            'MsgSignature' => $signature,\n            'TimeStamp'    => NOW_TIME,\n            'Nonce'        => $nonce,\n        );\n\n        return $data;\n    }\n\n    /**\n     * 生成数据签名\n     * @param  string $timestamp 时间戳\n     * @param  string $nonce     随机数\n     * @param  string $encrypt   被签名的数据\n     * @return string            SHA1签名\n     */\n    private static function sign($timestamp, $nonce, $encrypt){\n        $sign  = array(self::$token, $timestamp, $nonce, $encrypt);\n        sort($sign, SORT_STRING);\n        return sha1(implode($sign));\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Com/WechatAuth.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2015 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: 麦当苗儿 <zuojiazi.cn@gmail.com> <http://www.zjzit.cn>\n// +----------------------------------------------------------------------\n\nnamespace Com;\n\nclass WechatAuth {\n    \n    /* 消息类型常量 */\n    const MSG_TYPE_TEXT       = 'text';\n    const MSG_TYPE_IMAGE      = 'image';\n    const MSG_TYPE_VOICE      = 'voice';\n    const MSG_TYPE_VIDEO      = 'video';\n    const MSG_TYPE_SHORTVIDEO = 'shortvideo';\n    const MSG_TYPE_LOCATION   = 'location';\n    const MSG_TYPE_LINK       = 'link';\n    const MSG_TYPE_MUSIC      = 'music';\n    const MSG_TYPE_NEWS       = 'news';\n    const MSG_TYPE_EVENT      = 'event';\n    \n    /* 二维码类型常量 */\n    const QR_SCENE       = 'QR_SCENE';\n    const QR_LIMIT_SCENE = 'QR_LIMIT_SCENE';\n\n    /**\n     * 微信开发者申请的appID\n     * @var string\n     */\n    private $appId = '';\n\n    /**\n     * 微信开发者申请的appSecret\n     * @var string\n     */\n    private $appSecret = '';\n\n    /**\n     * 获取到的access_token\n     * @var string\n     */\n    private $accessToken = '';\n\n    /**\n     * 微信api根路径\n     * @var string\n     */\n    private $apiURL = 'https://api.weixin.qq.com/cgi-bin';\n\n    /**\n     * 微信二维码根路径\n     * @var string\n     */\n    private $qrcodeURL = 'https://mp.weixin.qq.com/cgi-bin';\n\n    private $requestCodeURL = 'https://open.weixin.qq.com/connect/oauth2/authorize';\n\n    private $oauthApiURL = 'https://api.weixin.qq.com/sns';\n\n    /**\n     * 构造方法，调用微信高级接口时实例化SDK\n     * @param string $appid  微信appid\n     * @param string $secret 微信appsecret\n     * @param string $token  获取到的access_token\n     */\n    public function __construct($appid, $secret, $token = null){\n        if($appid && $secret){\n            $this->appId     = $appid;\n            $this->appSecret = $secret;\n\n            if(!empty($token)){\n                $this->accessToken = $token;\n            }\n        } else {\n            throw new \\Exception('缺少参数 APP_ID 和 APP_SECRET!');\n        }\n    }\n\n    public function getRequestCodeURL($redirect_uri, $state = null,\n        $scope = 'snsapi_userinfo'){\n        \n        $query = array(\n            'appid'         => $this->appId,\n            'redirect_uri'  => $redirect_uri,\n            'response_type' => 'code',\n            'scope'         => $scope,\n        );\n\n        if(!is_null($state) && preg_match('/[a-zA-Z0-9]+/', $state)){\n            $query['state'] = $state;\n        }\n\n        $query = http_build_query($query);\n        return \"{$this->requestCodeURL}?{$query}#wechat_redirect\";\n    }\n\n    /**\n     * 获取access_token，用于后续接口访问\n     * @return array access_token信息，包含 token 和有效期\n     */\n    public function getAccessToken($type = 'client', $code = null){\n        $param = array(\n            'appid'  => $this->appId,\n            'secret' => $this->appSecret\n        );\n\n        switch ($type) {\n            case 'client':\n                $param['grant_type'] = 'client_credential';\n                $url = \"{$this->apiURL}/token\";\n                break;\n\n            case 'code':\n                $param['code'] = $code;\n                $param['grant_type'] = 'authorization_code';\n                $url = \"{$this->oauthApiURL}/oauth2/access_token\";\n                break;\n            \n            default:\n                throw new \\Exception('不支持的grant_type类型！');\n                break;\n        }\n\n        $token = self::http($url, $param);\n        $token = json_decode($token, true);\n\n        if(is_array($token)){\n            if(isset($token['errcode'])){\n                throw new \\Exception($token['errmsg']);\n            } else {\n                $this->accessToken = $token['access_token'];\n                return $token;\n            }\n        } else {\n            throw new \\Exception('获取微信access_token失败！');\n        }\n    }\n\n    /**\n     * 获取授权用户信息\n     * @param  string $openid 用户的OpenID\n     * @param  string $lang   指定的语言\n     * @return array          用户信息数据，具体参见微信文档\n     */\n    public function getUserInfo($openid, $lang = 'zh_CN'){\n        $query = array(\n            'access_token' => $this->accessToken,\n            'openid'       => $openid,\n            'lang'         => $lang,\n        );\n\n        $info = self::http(\"{$this->oauthApiURL}/userinfo\", $query);\n        return json_decode($info, true);\n    }\n\n    /**\n     * 上传零时媒体资源\n     * @param  string $filename 媒体资源本地路径\n     * @param  string $type     媒体资源类型，具体请参考微信开发手册\n     */\n    public function mediaUpload($filename, $type){\n        $filename = realpath($filename);\n        if(!$filename) throw new \\Exception('资源路径错误！');\n        \n        $data  = array(\n            'type'  => $type,\n            'media' => \"@{$filename}\"\n        );\n\n        return $this->api('media/upload', $data, 'POST', '', false);\n    }\n\n    /**\n     * 上传永久媒体资源\n     * @param string $filename    媒体资源本地路径\n     * @param string $type        媒体资源类型，具体请参考微信开发手册\n     * @param string $description 资源描述，仅资源类型为 video 时有效\n     */\n    public function materialAddMaterial($filename, $type, $description = ''){\n        $filename = realpath($filename);\n        if(!$filename) throw new \\Exception('资源路径错误！');\n        \n        $data = array(\n            'type'  => $type,\n            'media' => \"@{$filename}\",\n        );\n\n        if($type == 'video'){\n            if(is_array($description)){\n                //保护中文，微信api不支持中文转义的json结构\n                array_walk_recursive($description, function(&$value){\n                    $value = urlencode($value);\n                });\n                $description = urldecode(json_encode($description));\n            }\n            $data['description'] = $description;\n        }\n        return $this->api('material/add_material', $data, 'POST', '', false);\n    }\n\n    /**\n     * 获取媒体资源下载地址\n     * 注意：视频资源不允许下载\n     * @param  string $media_id 媒体资源id\n     * @return string           媒体资源下载地址\n     */\n    public function mediaGet($media_id){\n        $param = array(\n            'access_token' => $this->accessToken,\n            'media_id'     => $media_id\n        );\n\n        $url = \"{$this->apiURL}/media/get?\";\n        return $url . http_build_query($param);\n    }\n\n    /**\n     * 给指定用户推送信息\n     * 注意：微信规则只允许给在48小时内给公众平台发送过消息的用户推送信息\n     * @param  string $openid  用户的openid\n     * @param  array  $content 发送的数据，不同类型的数据结构可能不同\n     * @param  string $type    推送消息类型\n     */\n    public function messageCustomSend($openid, $content, $type = self::MSG_TYPE_TEXT){\n        \n        //基础数据\n        $data = array(\n            'touser'=>$openid,\n            'msgtype'=>$type,\n        );\n\n        //根据类型附加额外数据\n        $data[$type] = call_user_func(array(self, $type), $content);\n\n        return $this->api('message/custom/send', $data);\n    }\n\n    /**\n     * 发送文本消息\n     * @param  string $openid 用户的openid\n     * @param  string $text   发送的文字\n     */\n    public function sendText($openid, $text){\n        return $this->messageCustomSend($openid, $text, self::MSG_TYPE_TEXT);\n    }\n\n    /**\n     * 发送图片消息\n     * @param  string $openid 用户的openid\n     * @param  string $media  图片ID\n     */\n    public function sendImage($openid, $media){\n        return $this->messageCustomSend($openid, $media, self::MSG_TYPE_IMAGE);\n    }\n\n    /**\n     * 发送语音消息\n     * @param  string $openid 用户的openid\n     * @param  string $media  音频ID\n     */\n    public function sendVoice($openid, $media){\n        return $this->messageCustomSend($openid, $media, self::MSG_TYPE_VOICE);\n    }\n\n    /**\n     * 发送视频消息\n     * @param  string $openid      用户的openid\n     * @param  string $media_id    视频ID\n     * @param  string $title       视频标题\n     * @param  string $discription 视频描述\n     */\n    public function sendVideo(){\n        $video  = func_get_args();\n        $openid = array_shift($video);\n        return $this->messageCustomSend($openid, $video, self::MSG_TYPE_VIDEO);\n    }\n\n    /**\n     * 发送音乐消息\n     * @param  string $openid         用户的openid\n     * @param  string $title          音乐标题\n     * @param  string $discription    音乐描述\n     * @param  string $musicurl       音乐链接\n     * @param  string $hqmusicurl     高品质音乐链接\n     * @param  string $thumb_media_id 缩略图ID\n     */\n    public function sendMusic(){\n        $music  = func_get_args();\n        $openid = array_shift($music);\n        return $this->messageCustomSend($openid, $music, self::MSG_TYPE_MUSIC);\n    }\n\n    /**\n     * 发送图文消息\n     * @param  string $openid 用户的openid\n     * @param  array  $news   图文内容 [标题，描述，URL，缩略图]\n     * @param  array  $news1  图文内容 [标题，描述，URL，缩略图]\n     * @param  array  $news2  图文内容 [标题，描述，URL，缩略图]\n     *                ...     ...\n     * @param  array  $news9  图文内容 [标题，描述，URL，缩略图]\n     */\n    public function sendNews(){\n        $news   = func_get_args();\n        $openid = array_shift($news);\n        return $this->messageCustomSend($openid, $news, self::MSG_TYPE_NEWS);\n    }\n\n    /**\n     * 发送一条图文消息\n     * @param  string $openid      用户的openid\n     * @param  string $title       文章标题\n     * @param  string $discription 文章简介\n     * @param  string $url         文章连接\n     * @param  string $picurl      文章缩略图\n     */\n    public function sendNewsOnce(){\n        $news   = func_get_args();\n        $openid = array_shift($news);\n        $news   = array($news);\n        return $this->messageCustomSend($openid, $news, self::MSG_TYPE_NEWS);\n    }\n\n    /**\n     * 创建用户组\n     * @param  string $name 组名称\n     */\n    public function groupsCreate($name){\n        $data = array('group' => array('name' => $name));\n        return $this->api('groups/create', $data);\n    }\n\n    /**\n     * 查询所有分组\n     * @return array 分组列表\n     */\n    public function groupsGet(){\n        return $this->api('groups/get', '', 'GET');\n    }\n\n    /**\n     * 查询用户所在的分组\n     * @param  string $openid 用户的OpenID\n     * @return number         分组ID\n     */\n    public function groupsGetid($openid){\n        $data = array('openid' => $openid);\n        return $this->api('groups/getid', $data);\n    }\n\n    /**\n     * 修改分组\n     * @param  number $id   分组ID\n     * @param  string $name 分组名称\n     * @return array        修改成功或失败信息\n     */\n    public function groupsUpdate($id, $name){\n        $data = array('id' => $id, 'name' => $name);\n        return $this->api('groups/update', $data);\n    }\n\n    /**\n     * 移动用户分组\n     * @param  string $openid     用户的OpenID\n     * @param  number $to_groupid 要移动到的分组ID\n     * @return array              移动成功或失败信息\n     */\n    public function groupsMemberUpdate($openid, $to_groupid){\n        $data = array('openid' => $openid, 'to_groupid' => $to_groupid);\n        return $this->api('groups/member/update', $data);\n    }\n\n    /**\n     * 用户设备注名\n     * @param  string $openid 用户的OpenID\n     * @param  string $remark 设备注名\n     * @return array          执行成功失败信息\n     */\n    public function userInfoUpdateremark($openid, $remark){\n        $data = array('openid' => $openid, 'remark' => $remark);\n        return $this->api('user/info/updateremark', $data);\n    }\n\n    /**\n     * 获取指定用户的详细信息\n     * @param  string $openid 用户的openid\n     * @param  string $lang   需要获取数据的语言\n     */\n    public function userInfo($openid, $lang = 'zh_CN'){\n        $param = array('openid' => $openid, 'lang' => $lang);\n        return $this->api('user/info', '', 'GET', $param);\n    }\n\n    /**\n     * 获取关注者列表\n     * @param  string $next_openid 下一个openid，在用户数大于10000时有效\n     * @return array               用户列表\n     */\n    public function userGet($next_openid = ''){\n        $param = array('next_openid' => $next_openid);\n        return $this->api('user/get', '', 'GET', $param);\n    }\n\n    /**\n     * 创建自定义菜单\n     * @param  array $button 符合规则的菜单数组，规则参见微信手册\n     */\n    public function menuCreate($button){\n        $data = array('button' => $button);\n        return $this->api('menu/create', $data);\n    }\n\n    /**\n     * 获取所有的自定义菜单\n     * @return array  自定义菜单数组\n     */\n    public function menuGet(){\n        return $this->api('menu/get', '', 'GET');\n    }\n\n    /**\n     * 删除自定义菜单\n     */\n    public function menuDelete(){\n        return $this->api('menu/delete', '', 'GET');\n    }\n\n    /**\n     * 创建二维码，可创建指定有效期的二维码和永久二维码\n     * @param  integer $scene_id       二维码参数\n     * @param  integer $expire_seconds 二维码有效期，0-永久有效\n     */\n    public function qrcodeCreate($scene_id, $expire_seconds = 0){\n        $data = array();\n\n        if(is_numeric($expire_seconds) && $expire_seconds > 0){\n            $data['expire_seconds'] = $expire_seconds;\n            $data['action_name']    = self::QR_SCENE;\n        } else {\n            $data['action_name']    = self::QR_LIMIT_SCENE;\n        }\n\n        $data['action_info']['scene']['scene_id'] = $scene_id;\n        return $this->api('qrcode/create', $data);\n    }\n\n    /**\n     * 根据ticket获取二维码URL\n     * @param  string $ticket 通过 qrcodeCreate接口获取到的ticket\n     * @return string         二维码URL\n     */\n    public function showqrcode($ticket){\n        return \"{$this->qrcodeURL}/showqrcode?ticket={$ticket}\";\n    }\n\n    /**\n     * 长链接转短链接\n     * @param  string $long_url 长链接\n     * @return string           短链接\n     */\n    public function shorturl($long_url){\n        $data = array(\n            'action'   => 'long2short',\n            'long_url' => $long_url\n        );\n\n        return $this->api('shorturl', $data);\n    }\n\n    /**\n     * 调用微信api获取响应数据\n     * @param  string $name   API名称\n     * @param  string $data   POST请求数据\n     * @param  string $method 请求方式\n     * @param  string $param  GET请求参数\n     * @return array          api返回结果\n     */\n    protected function api($name, $data = '', $method = 'POST', $param = '', $json = true){\n        $params = array('access_token' => $this->accessToken);\n\n        if(!empty($param) && is_array($param)){\n            $params = array_merge($params, $param);\n        }\n\n        $url  = \"{$this->apiURL}/{$name}\";\n        if($json && !empty($data)){\n            //保护中文，微信api不支持中文转义的json结构\n            array_walk_recursive($data, function(&$value){\n                $value = urlencode($value);\n            });\n            $data = urldecode(json_encode($data));\n        }\n\n        $data = self::http($url, $params, $data, $method);\n\n        return json_decode($data, true);\n    }\n\n    /**\n     * 发送HTTP请求方法，目前只支持CURL发送请求\n     * @param  string $url    请求URL\n     * @param  array  $param  GET参数数组\n     * @param  array  $data   POST的数据，GET请求时该参数无效\n     * @param  string $method 请求方法GET/POST\n     * @return array          响应数据\n     */\n    protected static function http($url, $param, $data = '', $method = 'GET'){\n        $opts = array(\n            CURLOPT_TIMEOUT        => 30,\n            CURLOPT_RETURNTRANSFER => 1,\n            CURLOPT_SSL_VERIFYPEER => false,\n            CURLOPT_SSL_VERIFYHOST => false,\n        );\n\n        /* 根据请求类型设置特定参数 */\n        $opts[CURLOPT_URL] = $url . '?' . http_build_query($param);\n\n        if(strtoupper($method) == 'POST'){\n            $opts[CURLOPT_POST] = 1;\n            $opts[CURLOPT_POSTFIELDS] = $data;\n            \n            if(is_string($data)){ //发送JSON数据\n                $opts[CURLOPT_HTTPHEADER] = array(\n                    'Content-Type: application/json; charset=utf-8',  \n                    'Content-Length: ' . strlen($data),\n                );\n            }\n        }\n\n        /* 初始化并执行curl请求 */\n        $ch = curl_init();\n        curl_setopt_array($ch, $opts);\n        $data  = curl_exec($ch);\n        $error = curl_error($ch);\n        curl_close($ch);\n\n        //发生错误，抛出异常\n        if($error) throw new \\Exception('请求发生错误：' . $error);\n\n        return  $data;\n    }\n\n    /**\n     * 构造文本信息\n     * @param  string $content 要回复的文本\n     */\n    private static function text($content){\n        $data['content'] = $content;\n        return $data;\n    }\n\n    /**\n     * 构造图片信息\n     * @param  integer $media 图片ID\n     */\n    private static function image($media){\n        $data['media_id'] = $media;\n        return $data;\n    }\n\n    /**\n     * 构造音频信息\n     * @param  integer $media 语音ID\n     */\n    private static function voice($media){\n        $data['media_id'] = $media;\n        return $data;\n    }\n\n    /**\n     * 构造视频信息\n     * @param  array $video 要回复的视频 [视频ID，标题，说明]\n     */\n    private static function video($video){\n        $data = array();\n        list(\n            $data['media_id'],\n            $data['title'], \n            $data['description'], \n        ) = $video;\n\n        return $data;\n    }\n\n    /**\n     * 构造音乐信息\n     * @param  array $music 要回复的音乐[标题，说明，链接，高品质链接，缩略图ID]\n     */\n    private static function music($music){\n        $data = array();\n        list(\n            $data['title'], \n            $data['description'], \n            $data['musicurl'], \n            $data['hqmusicurl'],\n            $data['thumb_media_id'],\n        ) = $music;\n\n        return $data;\n    }\n\n    /**\n     * 构造图文信息\n     * @param  array $news 要回复的图文内容\n     * [    \n     *      0 => 第一条图文信息[标题，说明，图片链接，全文连接]，\n     *      1 => 第二条图文信息[标题，说明，图片链接，全文连接]，\n     *      2 => 第三条图文信息[标题，说明，图片链接，全文连接]， \n     * ]\n     */\n    private static function news($news){\n        $articles = array();\n        foreach ($news as $key => $value) {\n            list(\n                $articles[$key]['title'],\n                $articles[$key]['description'],\n                $articles[$key]['url'],\n                $articles[$key]['picurl']\n            ) = $value;\n\n            if($key >= 9) break; //最多只允许10条图文信息\n        }\n\n        $data['articles']     = $articles;\n        return $data;\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Com/WechatCrypt.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2015 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: 麦当苗儿 <zuojiazi.cn@gmail.com> <http://www.zjzit.cn>\n// +----------------------------------------------------------------------\n\nnamespace Com;\n\nclass WechatCrypt{\n    /**\n     * 加密KEY\n     * @var string\n     */\n    private $cyptKey = '';\n\n    /**\n     * 公众平台APPID\n     * @var string\n     */\n    private $appId = '';\n\n    /**\n     * 构造方法，初始化加密KEY\n     * @param string $key   加密KEY\n     * @param string $appid 微信APP_KEY\n     */\n    public function __construct($key, $appid){\n        if($key && $appid){\n            $this->appId   = $appid;\n            $this->cyptKey = base64_decode($key . '=');\n        } else {\n            throw new \\Exception('缺少参数 APP_ID 和加密KEY!');\n        }\n    }\n\n    /**\n     * 对明文进行加密\n     * @param  string $text  需要加密的字符串\n     * @return string        密文字符串\n     */\n    public function encrypt($text){\n        //填充到明文之前的随机字符\n        $random = self::getRandomStr(16);\n\n        //网络字节序\n        $size = pack(\"N\", strlen($text));\n\n        //生成被加密字符串\n        $text = $random . $size . $text . $this->appId;\n\n        //打开加密算法模块\n        $td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, '');\n\n        //使用PKCS7对明文进行补位\n        $text = self::PKCS7Encode($text, mcrypt_enc_get_key_size($td));\n\n        //初始化加密算法模块\n        mcrypt_generic_init($td, $this->cyptKey, substr($this->cyptKey, 0, 16));\n\n        //执行加密\n        $encrypt = mcrypt_generic($td, $text);\n        \n        //关闭加密算法模块\n        mcrypt_generic_deinit($td);\n        mcrypt_module_close($td);\n\n        //输出密文\n        return base64_encode($encrypt);\n    }\n\n    /**\n     * 对密文进行解密\n     * @param  string $encrypt 密文\n     * @return string          明文\n     */\n    public function decrypt($encrypt){\n        //BASE64解码\n        $encrypt = base64_decode($encrypt);\n\n        //打开加密算法模块\n        $td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, '');\n\n        //初始化加密算法模块\n        mcrypt_generic_init($td, $this->cyptKey, substr($this->cyptKey, 0, 16));\n\n        //执行解密\n        $decrypt = mdecrypt_generic($td, $encrypt);\n        \n        //去除PKCS7补位\n        $decrypt = self::PKCS7Decode($decrypt, mcrypt_enc_get_key_size($td));\n\n        //关闭加密算法模块\n        mcrypt_generic_deinit($td);\n        mcrypt_module_close($td);\n\n        if(strlen($decrypt) < 16){\n            throw new \\Exception(\"非法密文字符串！\");\n        }\n\n        //去除随机字符串\n        $decrypt = substr($decrypt, 16);\n\n        //获取网络字节序\n        $size = unpack(\"N\", substr($decrypt, 0, 4));\n        $size = $size[1];\n\n        //APP_ID\n        $appid = substr($decrypt, $size + 4);\n\n        //验证APP_ID\n        if($appid !== $this->appId){\n            throw new \\Exception(\"非法APP_ID！\");\n        }\n        \n        //明文内容\n        $text = substr($decrypt, 4, $size);\n\n        return $text;\n    }\n\n    /**\n     * PKCS7填充字符\n     * @param string  $text 被填充字符\n     * @param integer $size Block长度\n     */\n    private static function PKCS7Encode($text, $size){\n        //字符串长度\n        $str_size = strlen($text);\n\n        //填充长度\n        $pad_size = $size - ($str_size % $size);\n        $pad_size = $pad_size ? : $size;\n        \n        //填充的字符\n        $pad_chr = chr($pad_size);\n\n        //执行填充\n        $text = str_pad($text, $str_size + $pad_size, $pad_chr, STR_PAD_RIGHT);\n\n        return $text;\n    }\n\n    /**\n     * 删除PKCS7填充的字符\n     * @param string  $text 已填充的字符\n     * @param integer $size Block长度\n     */\n    private static function PKCS7Decode($text, $size){\n        //获取补位字符\n        $pad_str = ord(substr($text, -1));\n\n        if ($pad_str < 1 || $pad_str > $size) {\n            return '';\n        } else {\n            return substr($text, 0, strlen($text) - $pad_str);\n        }\n    }\n\n    /**\n     * 生成指定长度的字符串\n     * @param  integer $len 字符串长度\n     * @return string       生成的字符串\n     */\n    private static function getRandomStr($len){\n        static $pol = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz\";\n\n        $str = '';\n        $max = strlen($pol) - 1;\n        for ($i = 0; $i < $len; $i++) {\n            $str .= $pol[mt_rand(0, $max)];\n        }\n\n        return $str;\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Org/Net/Http.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Org\\Net;\n/**\n * Http 工具类\n * 提供一系列的Http方法\n * @author    liu21st <liu21st@gmail.com>\n */\nclass Http {\n\n    /**\n     * 采集远程文件\n     * @access public\n     * @param string $remote 远程文件名\n     * @param string $local 本地保存文件名\n     * @return mixed\n     */\n    static public function curlDownload($remote,$local) {\n        $cp = curl_init($remote);\n        $fp = fopen($local,\"w\");\n        curl_setopt($cp, CURLOPT_FILE, $fp);\n        curl_setopt($cp, CURLOPT_HEADER, 0);\n        curl_exec($cp);\n        curl_close($cp);\n        fclose($fp);\n    }\n\n   /**\n    * 使用 fsockopen 通过 HTTP 协议直接访问(采集)远程文件\n    * 如果主机或服务器没有开启 CURL 扩展可考虑使用\n    * fsockopen 比 CURL 稍慢,但性能稳定\n    * @static\n    * @access public\n    * @param string $url 远程URL\n    * @param array $conf 其他配置信息\n    *        int   limit 分段读取字符个数\n    *        string post  post的内容,字符串或数组,key=value&形式\n    *        string cookie 携带cookie访问,该参数是cookie内容\n    *        string ip    如果该参数传入,$url将不被使用,ip访问优先\n    *        int    timeout 采集超时时间\n    *        bool   block 是否阻塞访问,默认为true\n    * @return mixed\n    */\n    static public function fsockopenDownload($url, $conf = array()) {\n        $return = '';\n        if(!is_array($conf)) return $return;\n\n        $matches = parse_url($url);\n        !isset($matches['host']) \t&& $matches['host'] \t= '';\n        !isset($matches['path']) \t&& $matches['path'] \t= '';\n        !isset($matches['query']) \t&& $matches['query'] \t= '';\n        !isset($matches['port']) \t&& $matches['port'] \t= '';\n        $host = $matches['host'];\n        $path = $matches['path'] ? $matches['path'].($matches['query'] ? '?'.$matches['query'] : '') : '/';\n        $port = !empty($matches['port']) ? $matches['port'] : 80;\n\n        $conf_arr = array(\n            'limit'\t\t=>\t0,\n            'post'\t\t=>\t'',\n            'cookie'\t=>\t'',\n            'ip'\t\t=>\t'',\n            'timeout'\t=>\t15,\n            'block'\t\t=>\tTRUE,\n            );\n\n        foreach (array_merge($conf_arr, $conf) as $k=>$v) ${$k} = $v;\n\n        if($post) {\n            if(is_array($post))\n            {\n                $post = http_build_query($post);\n            }\n            $out  = \"POST $path HTTP/1.0\\r\\n\";\n            $out .= \"Accept: */*\\r\\n\";\n            //$out .= \"Referer: $boardurl\\r\\n\";\n            $out .= \"Accept-Language: zh-cn\\r\\n\";\n            $out .= \"Content-Type: application/x-www-form-urlencoded\\r\\n\";\n            $out .= \"User-Agent: $_SERVER[HTTP_USER_AGENT]\\r\\n\";\n            $out .= \"Host: $host\\r\\n\";\n            $out .= 'Content-Length: '.strlen($post).\"\\r\\n\";\n            $out .= \"Connection: Close\\r\\n\";\n            $out .= \"Cache-Control: no-cache\\r\\n\";\n            $out .= \"Cookie: $cookie\\r\\n\\r\\n\";\n            $out .= $post;\n        } else {\n            $out  = \"GET $path HTTP/1.0\\r\\n\";\n            $out .= \"Accept: */*\\r\\n\";\n            //$out .= \"Referer: $boardurl\\r\\n\";\n            $out .= \"Accept-Language: zh-cn\\r\\n\";\n            $out .= \"User-Agent: $_SERVER[HTTP_USER_AGENT]\\r\\n\";\n            $out .= \"Host: $host\\r\\n\";\n            $out .= \"Connection: Close\\r\\n\";\n            $out .= \"Cookie: $cookie\\r\\n\\r\\n\";\n        }\n        $fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);\n        if(!$fp) {\n            return '';\n        } else {\n            stream_set_blocking($fp, $block);\n            stream_set_timeout($fp, $timeout);\n            @fwrite($fp, $out);\n            $status = stream_get_meta_data($fp);\n            if(!$status['timed_out']) {\n                while (!feof($fp)) {\n                    if(($header = @fgets($fp)) && ($header == \"\\r\\n\" ||  $header == \"\\n\")) {\n                        break;\n                    }\n                }\n\n                $stop = false;\n                while(!feof($fp) && !$stop) {\n                    $data = fread($fp, ($limit == 0 || $limit > 8192 ? 8192 : $limit));\n                    $return .= $data;\n                    if($limit) {\n                        $limit -= strlen($data);\n                        $stop = $limit <= 0;\n                    }\n                }\n            }\n            @fclose($fp);\n            return $return;\n        }\n    }\n\n    /**\n     * 下载文件\n     * 可以指定下载显示的文件名，并自动发送相应的Header信息\n     * 如果指定了content参数，则下载该参数的内容\n     * @static\n     * @access public\n     * @param string $filename 下载文件名\n     * @param string $showname 下载显示的文件名\n     * @param string $content  下载的内容\n     * @param integer $expire  下载内容浏览器缓存时间\n     * @return void\n     */\n    static public function download ($filename, $showname='',$content='',$expire=180) {\n        if(is_file($filename)) {\n            $length = filesize($filename);\n        }elseif(is_file(UPLOAD_PATH.$filename)) {\n            $filename = UPLOAD_PATH.$filename;\n            $length = filesize($filename);\n        }elseif($content != '') {\n            $length = strlen($content);\n        }else {\n            E($filename.L('下载文件不存在！'));\n        }\n        if(empty($showname)) {\n            $showname = $filename;\n        }\n        $showname = basename($showname);\n\t\tif(!empty($filename)) {\n\t\t\t$finfo \t= \tnew \\finfo(FILEINFO_MIME);\n\t\t\t$type \t= \t$finfo->file($filename);\t\t\t\n\t\t}else{\n\t\t\t$type\t=\t\"application/octet-stream\";\n\t\t}\n        //发送Http Header信息 开始下载\n        header(\"Pragma: public\");\n        header(\"Cache-control: max-age=\".$expire);\n        //header('Cache-Control: no-store, no-cache, must-revalidate');\n        header(\"Expires: \" . gmdate(\"D, d M Y H:i:s\",time()+$expire) . \"GMT\");\n        header(\"Last-Modified: \" . gmdate(\"D, d M Y H:i:s\",time()) . \"GMT\");\n        header(\"Content-Disposition: attachment; filename=\".$showname);\n        header(\"Content-Length: \".$length);\n        header(\"Content-type: \".$type);\n        header('Content-Encoding: none');\n        header(\"Content-Transfer-Encoding: binary\" );\n        if($content == '' ) {\n            readfile($filename);\n        }else {\n        \techo($content);\n        }\n        exit();\n    }\n\n    /**\n     * 显示HTTP Header 信息\n     * @return string\n     */\n    static function getHeaderInfo($header='',$echo=true) {\n        ob_start();\n        $headers   \t= getallheaders();\n        if(!empty($header)) {\n            $info \t= $headers[$header];\n            echo($header.':'.$info.\"\\n\"); ;\n        }else {\n            foreach($headers as $key=>$val) {\n                echo(\"$key:$val\\n\");\n            }\n        }\n        $output \t= ob_get_clean();\n        if ($echo) {\n            echo (nl2br($output));\n        }else {\n            return $output;\n        }\n\n    }\n\n    /**\n     * HTTP Protocol defined status codes\n     * @param int $num\n     */\n\tstatic function sendHttpStatus($code) {\n\t\tstatic $_status = array(\n\t\t\t// Informational 1xx\n\t\t\t100 => 'Continue',\n\t\t\t101 => 'Switching Protocols',\n\n\t\t\t// Success 2xx\n\t\t\t200 => 'OK',\n\t\t\t201 => 'Created',\n\t\t\t202 => 'Accepted',\n\t\t\t203 => 'Non-Authoritative Information',\n\t\t\t204 => 'No Content',\n\t\t\t205 => 'Reset Content',\n\t\t\t206 => 'Partial Content',\n\n\t\t\t// Redirection 3xx\n\t\t\t300 => 'Multiple Choices',\n\t\t\t301 => 'Moved Permanently',\n\t\t\t302 => 'Found',  // 1.1\n\t\t\t303 => 'See Other',\n\t\t\t304 => 'Not Modified',\n\t\t\t305 => 'Use Proxy',\n\t\t\t// 306 is deprecated but reserved\n\t\t\t307 => 'Temporary Redirect',\n\n\t\t\t// Client Error 4xx\n\t\t\t400 => 'Bad Request',\n\t\t\t401 => 'Unauthorized',\n\t\t\t402 => 'Payment Required',\n\t\t\t403 => 'Forbidden',\n\t\t\t404 => 'Not Found',\n\t\t\t405 => 'Method Not Allowed',\n\t\t\t406 => 'Not Acceptable',\n\t\t\t407 => 'Proxy Authentication Required',\n\t\t\t408 => 'Request Timeout',\n\t\t\t409 => 'Conflict',\n\t\t\t410 => 'Gone',\n\t\t\t411 => 'Length Required',\n\t\t\t412 => 'Precondition Failed',\n\t\t\t413 => 'Request Entity Too Large',\n\t\t\t414 => 'Request-URI Too Long',\n\t\t\t415 => 'Unsupported Media Type',\n\t\t\t416 => 'Requested Range Not Satisfiable',\n\t\t\t417 => 'Expectation Failed',\n\n\t\t\t// Server Error 5xx\n\t\t\t500 => 'Internal Server Error',\n\t\t\t501 => 'Not Implemented',\n\t\t\t502 => 'Bad Gateway',\n\t\t\t503 => 'Service Unavailable',\n\t\t\t504 => 'Gateway Timeout',\n\t\t\t505 => 'HTTP Version Not Supported',\n\t\t\t509 => 'Bandwidth Limit Exceeded'\n\t\t);\n\t\tif(isset($_status[$code])) {\n\t\t\theader('HTTP/1.1 '.$code.' '.$_status[$code]);\n\t\t}\n\t}\n}//类定义结束"
  },
  {
    "path": "ThinkPHP/Library/Org/Net/IpLocation.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Org\\Net;\n/**\n *  IP 地理位置查询类 修改自 CoolCode.CN\n *  由于使用UTF8编码 如果使用纯真IP地址库的话 需要对返回结果进行编码转换\n * @author    liu21st <liu21st@gmail.com>\n */\nclass IpLocation {\n    /**\n     * QQWry.Dat文件指针\n     *\n     * @var resource\n     */\n    private $fp;\n\n    /**\n     * 第一条IP记录的偏移地址\n     *\n     * @var int\n     */\n    private $firstip;\n\n    /**\n     * 最后一条IP记录的偏移地址\n     *\n     * @var int\n     */\n    private $lastip;\n\n    /**\n     * IP记录的总条数（不包含版本信息记录）\n     *\n     * @var int\n     */\n    private $totalip;\n\n    /**\n     * 构造函数，打开 QQWry.Dat 文件并初始化类中的信息\n     *\n     * @param string $filename\n     * @return IpLocation\n     */\n    public function __construct($filename = \"UTFWry.dat\") {\n        $this->fp = 0;\n        if (($this->fp      = fopen(dirname(__FILE__).'/'.$filename, 'rb')) !== false) {\n            $this->firstip  = $this->getlong();\n            $this->lastip   = $this->getlong();\n            $this->totalip  = ($this->lastip - $this->firstip) / 7;\n        }\n    }\n\n    /**\n     * 返回读取的长整型数\n     *\n     * @access private\n     * @return int\n     */\n    private function getlong() {\n        //将读取的little-endian编码的4个字节转化为长整型数\n        $result = unpack('Vlong', fread($this->fp, 4));\n        return $result['long'];\n    }\n\n    /**\n     * 返回读取的3个字节的长整型数\n     *\n     * @access private\n     * @return int\n     */\n    private function getlong3() {\n        //将读取的little-endian编码的3个字节转化为长整型数\n        $result = unpack('Vlong', fread($this->fp, 3).chr(0));\n        return $result['long'];\n    }\n\n    /**\n     * 返回压缩后可进行比较的IP地址\n     *\n     * @access private\n     * @param string $ip\n     * @return string\n     */\n    private function packip($ip) {\n        // 将IP地址转化为长整型数，如果在PHP5中，IP地址错误，则返回False，\n        // 这时intval将Flase转化为整数-1，之后压缩成big-endian编码的字符串\n        return pack('N', intval(ip2long($ip)));\n    }\n\n    /**\n     * 返回读取的字符串\n     *\n     * @access private\n     * @param string $data\n     * @return string\n     */\n    private function getstring($data = \"\") {\n        $char = fread($this->fp, 1);\n        while (ord($char) > 0) {        // 字符串按照C格式保存，以\\0结束\n            $data  .= $char;             // 将读取的字符连接到给定字符串之后\n            $char   = fread($this->fp, 1);\n        }\n        return $data;\n    }\n\n    /**\n     * 返回地区信息\n     *\n     * @access private\n     * @return string\n     */\n    private function getarea() {\n        $byte = fread($this->fp, 1);    // 标志字节\n        switch (ord($byte)) {\n            case 0:                     // 没有区域信息\n                $area = \"\";\n                break;\n            case 1:\n            case 2:                     // 标志字节为1或2，表示区域信息被重定向\n                fseek($this->fp, $this->getlong3());\n                $area = $this->getstring();\n                break;\n            default:                    // 否则，表示区域信息没有被重定向\n                $area = $this->getstring($byte);\n                break;\n        }\n        return $area;\n    }\n\n    /**\n     * 根据所给 IP 地址或域名返回所在地区信息\n     *\n     * @access public\n     * @param string $ip\n     * @return array\n     */\n    public function getlocation($ip='') {\n        if (!$this->fp) return null;            // 如果数据文件没有被正确打开，则直接返回空\n\t\tif(empty($ip)) $ip = get_client_ip();\n        $location['ip'] = gethostbyname($ip);   // 将输入的域名转化为IP地址\n        $ip = $this->packip($location['ip']);   // 将输入的IP地址转化为可比较的IP地址\n                                                // 不合法的IP地址会被转化为255.255.255.255\n        // 对分搜索\n        $l = 0;                         // 搜索的下边界\n        $u = $this->totalip;            // 搜索的上边界\n        $findip = $this->lastip;        // 如果没有找到就返回最后一条IP记录（QQWry.Dat的版本信息）\n        while ($l <= $u) {              // 当上边界小于下边界时，查找失败\n            $i = floor(($l + $u) / 2);  // 计算近似中间记录\n            fseek($this->fp, $this->firstip + $i * 7);\n            $beginip = strrev(fread($this->fp, 4));     // 获取中间记录的开始IP地址\n            // strrev函数在这里的作用是将little-endian的压缩IP地址转化为big-endian的格式\n            // 以便用于比较，后面相同。\n            if ($ip < $beginip) {       // 用户的IP小于中间记录的开始IP地址时\n                $u = $i - 1;            // 将搜索的上边界修改为中间记录减一\n            }\n            else {\n                fseek($this->fp, $this->getlong3());\n                $endip = strrev(fread($this->fp, 4));   // 获取中间记录的结束IP地址\n                if ($ip > $endip) {     // 用户的IP大于中间记录的结束IP地址时\n                    $l = $i + 1;        // 将搜索的下边界修改为中间记录加一\n                }\n                else {                  // 用户的IP在中间记录的IP范围内时\n                    $findip = $this->firstip + $i * 7;\n                    break;              // 则表示找到结果，退出循环\n                }\n            }\n        }\n\n        //获取查找到的IP地理位置信息\n        fseek($this->fp, $findip);\n        $location['beginip'] = long2ip($this->getlong());   // 用户IP所在范围的开始地址\n        $offset = $this->getlong3();\n        fseek($this->fp, $offset);\n        $location['endip'] = long2ip($this->getlong());     // 用户IP所在范围的结束地址\n        $byte = fread($this->fp, 1);    // 标志字节\n        switch (ord($byte)) {\n            case 1:                     // 标志字节为1，表示国家和区域信息都被同时重定向\n                $countryOffset = $this->getlong3();         // 重定向地址\n                fseek($this->fp, $countryOffset);\n                $byte = fread($this->fp, 1);    // 标志字节\n                switch (ord($byte)) {\n                    case 2:             // 标志字节为2，表示国家信息又被重定向\n                        fseek($this->fp, $this->getlong3());\n                        $location['country']    = $this->getstring();\n                        fseek($this->fp, $countryOffset + 4);\n                        $location['area']       = $this->getarea();\n                        break;\n                    default:            // 否则，表示国家信息没有被重定向\n                        $location['country']    = $this->getstring($byte);\n                        $location['area']       = $this->getarea();\n                        break;\n                }\n                break;\n            case 2:                     // 标志字节为2，表示国家信息被重定向\n                fseek($this->fp, $this->getlong3());\n                $location['country']    = $this->getstring();\n                fseek($this->fp, $offset + 8);\n                $location['area']       = $this->getarea();\n                break;\n            default:                    // 否则，表示国家信息没有被重定向\n                $location['country']    = $this->getstring($byte);\n                $location['area']       = $this->getarea();\n                break;\n        }\n        if (trim($location['country']) == 'CZ88.NET') {  // CZ88.NET表示没有有效信息\n            $location['country'] = '未知';\n        }\n        if (trim($location['area']) == 'CZ88.NET') {\n            $location['area'] = '';\n        }\n        return $location;\n    }\n\n    /**\n     * 析构函数，用于在页面执行结束后自动关闭打开的文件。\n     *\n     */\n    public function __destruct() {\n        if ($this->fp) {\n            fclose($this->fp);\n        }\n        $this->fp = 0;\n    }\n\n}"
  },
  {
    "path": "ThinkPHP/Library/Org/Util/ArrayList.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Org\\Util;\n/**\n * ArrayList实现类\n * @category   Think\n * @package  Think\n * @subpackage  Util\n * @author    liu21st <liu21st@gmail.com>\n */\nclass ArrayList implements \\IteratorAggregate {\n\n    /**\n     * 集合元素\n     * @var array\n     * @access protected\n     */\n    protected $_elements = array();\n\n    /**\n     * 架构函数\n     * @access public\n     * @param string $elements  初始化数组元素\n     */\n    public function __construct($elements = array()) {\n        if (!empty($elements)) {\n            $this->_elements = $elements;\n        }\n    }\n\n    /**\n     * 若要获得迭代因子，通过getIterator方法实现\n     * @access public\n     * @return ArrayObject\n     */\n    public function getIterator() {\n        return new ArrayObject($this->_elements);\n    }\n\n    /**\n     * 增加元素\n     * @access public\n     * @param mixed $element  要添加的元素\n     * @return boolean\n     */\n    public function add($element) {\n        return (array_push($this->_elements, $element)) ? true : false;\n    }\n\n    //\n    public function unshift($element) {\n        return (array_unshift($this->_elements,$element))?true : false;\n    }\n\n    //\n    public function pop() {\n        return array_pop($this->_elements);\n    }\n\n    /**\n     * 增加元素列表\n     * @access public\n     * @param ArrayList $list  元素列表\n     * @return boolean\n     */\n    public function addAll($list) {\n        $before = $this->size();\n        foreach( $list as $element) {\n            $this->add($element);\n        }\n        $after = $this->size();\n        return ($before < $after);\n    }\n\n    /**\n     * 清除所有元素\n     * @access public\n     */\n    public function clear() {\n        $this->_elements = array();\n    }\n\n    /**\n     * 是否包含某个元素\n     * @access public\n     * @param mixed $element  查找元素\n     * @return string\n     */\n    public function contains($element) {\n        return (array_search($element, $this->_elements) !== false );\n    }\n\n    /**\n     * 根据索引取得元素\n     * @access public\n     * @param integer $index 索引\n     * @return mixed\n     */\n    public function get($index) {\n        return $this->_elements[$index];\n    }\n\n    /**\n     * 查找匹配元素，并返回第一个元素所在位置\n     * 注意 可能存在0的索引位置 因此要用===False来判断查找失败\n     * @access public\n     * @param mixed $element  查找元素\n     * @return integer\n     */\n    public function indexOf($element) {\n        return array_search($element, $this->_elements);\n    }\n\n    /**\n     * 判断元素是否为空\n     * @access public\n     * @return boolean\n     */\n    public function isEmpty() {\n        return empty($this->_elements);\n    }\n\n    /**\n     * 最后一个匹配的元素位置\n     * @access public\n     * @param mixed $element  查找元素\n     * @return integer\n     */\n    public function lastIndexOf($element) {\n        for ($i = (count($this->_elements) - 1); $i > 0; $i--) {\n            if ($element == $this->get($i)) { return $i; }\n        }\n    }\n\n    public function toJson() {\n        return json_encode($this->_elements);\n    }\n\n    /**\n     * 根据索引移除元素\n     * 返回被移除的元素\n     * @access public\n     * @param integer $index 索引\n     * @return mixed\n     */\n    public function remove($index) {\n        $element = $this->get($index);\n        if (!is_null($element)) { array_splice($this->_elements, $index, 1); }\n        return $element;\n    }\n\n    /**\n     * 移出一定范围的数组列表\n     * @access public\n     * @param integer $offset  开始移除位置\n     * @param integer $length  移除长度\n     */\n    public function removeRange($offset , $length) {\n        array_splice($this->_elements, $offset , $length);\n    }\n\n    /**\n     * 移出重复的值\n     * @access public\n     */\n    public function unique() {\n        $this->_elements = array_unique($this->_elements);\n    }\n\n    /**\n     * 取出一定范围的数组列表\n     * @access public\n     * @param integer $offset  开始位置\n     * @param integer $length  长度\n     */\n    public function range($offset,$length=null) {\n        return array_slice($this->_elements,$offset,$length);\n    }\n\n    /**\n     * 设置列表元素\n     * 返回修改之前的值\n     * @access public\n     * @param integer $index 索引\n     * @param mixed $element  元素\n     * @return mixed\n     */\n    public function set($index, $element) {\n        $previous = $this->get($index);\n        $this->_elements[$index] = $element;\n        return $previous;\n    }\n\n    /**\n     * 获取列表长度\n     * @access public\n     * @return integer\n     */\n    public function size() {\n        return count($this->_elements);\n    }\n\n    /**\n     * 转换成数组\n     * @access public\n     * @return array\n     */\n    public function toArray() {\n        return $this->_elements;\n    }\n\n    // 列表排序\n    public function ksort() {\n        ksort($this->_elements);\n    }\n\n    // 列表排序\n    public function asort() {\n        asort($this->_elements);\n    }\n\n    // 逆向排序\n    public function rsort() {\n        rsort($this->_elements);\n    }\n\n    // 自然排序\n    public function natsort() {\n        natsort($this->_elements);\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Org/Util/CodeSwitch.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Org\\Util;\nclass CodeSwitch {\n    // 错误信息\n    static private $error = array();\n    // 提示信息\n    static private $info = array();\n    // 记录错误\n    static private function error($msg) {\n        self::$error[]   =  $msg;\n    }\n    // 记录信息\n    static private function info($info) {\n        self::$info[]     = $info;\n    }\n\t/**\n     * 编码转换函数,对整个文件进行编码转换\n\t * 支持以下转换\n\t * GB2312、UTF-8 WITH BOM转换为UTF-8\n\t * UTF-8、UTF-8 WITH BOM转换为GB2312\n     * @access public\n     * @param string $filename\t\t文件名\n\t * @param string $out_charset\t转换后的文件编码,与iconv使用的参数一致\n     * @return void\n     */\n\tstatic function DetectAndSwitch($filename,$out_charset) {\n\t\t$fpr = fopen($filename,\"r\");\n\t\t$char1 = fread($fpr,1);\n\t\t$char2 = fread($fpr,1);\n\t\t$char3 = fread($fpr,1);\n\n\t\t$originEncoding = \"\";\n\n\t\tif($char1==chr(239) && $char2==chr(187) && $char3==chr(191))//UTF-8 WITH BOM\n\t\t\t$originEncoding = \"UTF-8 WITH BOM\";\n\t\telseif($char1==chr(255) && $char2==chr(254))//UNICODE LE\n\t\t{\n\t\t\tself::error(\"不支持从UNICODE LE转换到UTF-8或GB编码\");\n\t\t\tfclose($fpr);\n\t\t\treturn;\n\t\t}elseif($char1==chr(254) && $char2==chr(255)){//UNICODE BE\n\t\t\tself::error(\"不支持从UNICODE BE转换到UTF-8或GB编码\");\n\t\t\tfclose($fpr);\n\t\t\treturn;\n\t\t}else{//没有文件头,可能是GB或UTF-8\n\t\t\tif(rewind($fpr)===false){//回到文件开始部分,准备逐字节读取判断编码\n\t\t\t\tself::error($filename.\"文件指针后移失败\");\n\t\t\t\tfclose($fpr);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\twhile(!feof($fpr)){\n\t\t\t\t$char = fread($fpr,1);\n\t\t\t\t//对于英文,GB和UTF-8都是单字节的ASCII码小于128的值\n\t\t\t\tif(ord($char)<128)\n\t\t\t\t\tcontinue;\n\n\t\t\t\t//对于汉字GB编码第一个字节是110*****第二个字节是10******(有特例,比如联字)\n\t\t\t\t//UTF-8编码第一个字节是1110****第二个字节是10******第三个字节是10******\n\t\t\t\t//按位与出来结果要跟上面非星号相同,所以应该先判断UTF-8\n\t\t\t\t//因为使用GB的掩码按位与,UTF-8的111得出来的也是110,所以要先判断UTF-8\n\t\t\t\tif((ord($char)&224)==224) {\n\t\t\t\t\t//第一个字节判断通过\n\t\t\t\t\t$char = fread($fpr,1);\n\t\t\t\t\tif((ord($char)&128)==128) {\n\t\t\t\t\t\t//第二个字节判断通过\n\t\t\t\t\t\t$char = fread($fpr,1);\n\t\t\t\t\t\tif((ord($char)&128)==128) {\n\t\t\t\t\t\t\t$originEncoding = \"UTF-8\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif((ord($char)&192)==192) {\n\t\t\t\t\t//第一个字节判断通过\n\t\t\t\t\t$char = fread($fpr,1);\n\t\t\t\t\tif((ord($char)&128)==128) {\n\t\t\t\t\t\t//第二个字节判断通过\n\t\t\t\t\t\t$originEncoding = \"GB2312\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(strtoupper($out_charset)==$originEncoding) {\n\t\t\tself::info(\"文件\".$filename.\"转码检查完成,原始文件编码\".$originEncoding);\n\t\t\tfclose($fpr);\n\t\t}else {\n\t\t\t//文件需要转码\n\t\t\t$originContent = \"\";\n\n\t\t\tif($originEncoding == \"UTF-8 WITH BOM\") {\n\t\t\t\t//跳过三个字节,把后面的内容复制一遍得到utf-8的内容\n\t\t\t\tfseek($fpr,3);\n\t\t\t\t$originContent = fread($fpr,filesize($filename)-3);\n\t\t\t\tfclose($fpr);\n\t\t\t}elseif(rewind($fpr)!=false){//不管是UTF-8还是GB2312,回到文件开始部分,读取内容\n\t\t\t\t$originContent = fread($fpr,filesize($filename));\n\t\t\t\tfclose($fpr);\n\t\t\t}else{\n\t\t\t\tself::error(\"文件编码不正确或指针后移失败\");\n\t\t\t\tfclose($fpr);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t//转码并保存文件\n\t\t\t$content = iconv(str_replace(\" WITH BOM\",\"\",$originEncoding),strtoupper($out_charset),$originContent);\n\t\t\t$fpw = fopen($filename,\"w\");\n\t\t\tfwrite($fpw,$content);\n\t\t\tfclose($fpw);\n\n\t\t\tif($originEncoding!=\"\")\n\t\t\t\tself::info(\"对文件\".$filename.\"转码完成,原始文件编码\".$originEncoding.\",转换后文件编码\".strtoupper($out_charset));\n\t\t\telseif($originEncoding==\"\")\n\t\t\t\tself::info(\"文件\".$filename.\"中没有出现中文,但是可以断定不是带BOM的UTF-8编码,没有进行编码转换,不影响使用\");\n\t\t}\n\t}\n\n\t/**\n     * 目录遍历函数\n     * @access public\n     * @param string $path\t\t要遍历的目录名\n     * @param string $mode\t\t遍历模式,一般取FILES,这样只返回带路径的文件名\n     * @param array $file_types\t\t文件后缀过滤数组\n\t * @param int $maxdepth\t\t遍历深度,-1表示遍历到最底层\n     * @return void\n     */\n\tstatic function searchdir($path,$mode = \"FULL\",$file_types = array(\".html\",\".php\"),$maxdepth = -1,$d = 0) {\n\t   if(substr($path,strlen($path)-1) != '/')\n\t\t   $path .= '/';\n\t   $dirlist = array();\n\t   if($mode != \"FILES\")\n\t\t\t$dirlist[] = $path;\n\t   if($handle = @opendir($path)) {\n\t\t   while(false !== ($file = readdir($handle)))\n\t\t   {\n\t\t\t   if($file != '.' && $file != '..')\n\t\t\t   {\n\t\t\t\t   $file = $path.$file ;\n\t\t\t\t   if(!is_dir($file))\n\t\t\t\t   {\n\t\t\t\t\t\tif($mode != \"DIRS\")\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$extension = \"\";\n\t\t\t\t\t\t\t$extpos = strrpos($file, '.');\n\t\t\t\t\t\t\tif($extpos!==false)\n\t\t\t\t\t\t\t\t$extension = substr($file,$extpos,strlen($file)-$extpos);\n\t\t\t\t\t\t\t$extension=strtolower($extension);\n\t\t\t\t\t\t\tif(in_array($extension, $file_types))\n\t\t\t\t\t\t\t\t$dirlist[] = $file;\n\t\t\t\t\t\t}\n\t\t\t\t   }\n\t\t\t\t   elseif($d >= 0 && ($d < $maxdepth || $maxdepth < 0))\n\t\t\t\t   {\n\t\t\t\t\t   $result = self::searchdir($file.'/',$mode,$file_types,$maxdepth,$d + 1) ;\n\t\t\t\t\t   $dirlist = array_merge($dirlist,$result);\n\t\t\t\t   }\n\t\t\t   }\n\t\t   }\n\t\t   closedir ( $handle ) ;\n\t   }\n\t   if($d == 0)\n\t\t   natcasesort($dirlist);\n\n\t   return($dirlist) ;\n\t}\n\n\t/**\n     * 对整个项目目录中的PHP和HTML文件行进编码转换\n     * @access public\n     * @param string $app\t\t要遍历的项目路径\n     * @param string $mode\t\t遍历模式,一般取FILES,这样只返回带路径的文件名\n     * @param array $file_types\t\t文件后缀过滤数组\n     * @return void\n     */\n\tstatic function CodingSwitch($app = \"./\",$charset='UTF-8',$mode = \"FILES\",$file_types = array(\".html\",\".php\")) {\n\t\tself::info(\"注意: 程序使用的文件编码检测算法可能对某些特殊字符不适用\");\n\t\t$filearr = self::searchdir($app,$mode,$file_types);\n\t\tforeach($filearr as $file)\n\t\t\tself::DetectAndSwitch($file,$charset);\n\t}\n\n    static public function getError() {\n        return self::$error;\n    }\n\n    static public function getInfo() {\n        return self::$info;\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Org/Util/Date.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\nnamespace Org\\Util;\n/**\n * 日期时间操作类\n * @category   ORG\n * @package  ORG\n * @subpackage  Date\n * @author    liu21st <liu21st@gmail.com>\n * @version   $Id: Date.class.php 2662 2012-01-26 06:32:50Z liu21st $\n */\nclass Date {\n\n    /**\n     * 日期的时间戳\n     * @var integer\n     * @access protected\n     */\n     protected $date;\n\n    /**\n     * 时区\n     * @var integer\n     * @access protected\n     */\n     protected $timezone;\n\n    /**\n     * 年\n     * @var integer\n     * @access protected\n     */\n     protected $year;\n\n    /**\n     * 月\n     * @var integer\n     * @access protected\n     */\n     protected $month;\n\n    /**\n     * 日\n     * @var integer\n     * @access protected\n     */\n     protected $day;\n\n    /**\n     * 时\n     * @var integer\n     * @access protected\n     */\n     protected $hour;\n\n    /**\n     * 分\n     * @var integer\n     * @access protected\n     */\n     protected $minute;\n\n    /**\n     * 秒\n     * @var integer\n     * @access protected\n     */\n     protected $second;\n\n    /**\n     * 星期的数字表示\n     * @var integer\n     * @access protected\n     */\n     protected $weekday;\n\n    /**\n     * 星期的完整表示\n     * @var string\n     * @access protected\n     */\n     protected $cWeekday;\n\n    /**\n     * 一年中的天数 0－365\n     * @var integer\n     * @access protected\n     */\n     protected $yDay;\n\n    /**\n     * 月份的完整表示\n     * @var string\n     * @access protected\n     */\n     protected $cMonth;\n\n    /**\n     * 日期CDATE表示\n     * @var string\n     * @access protected\n     */\n     protected $CDATE;\n\n    /**\n     * 日期的YMD表示\n     * @var string\n     * @access protected\n     */\n     protected $YMD;\n\n    /**\n     * 时间的输出表示\n     * @var string\n     * @access protected\n     */\n     protected $CTIME;\n\n     // 星期的输出\n     protected $Week = array(\"日\",\"一\",\"二\",\"三\",\"四\",\"五\",\"六\");\n\n    /**\n     * 架构函数\n     * 创建一个Date对象\n     * @param mixed $date  日期\n     * @static\n     * @access public\n     */\n    public function __construct($date='') {\n        //分析日期\n        $this->date =   $this->parse($date);\n        $this->setDate($this->date);\n    }\n\n    /**\n     * 日期分析\n     * 返回时间戳\n     * @static\n     * @access public\n     * @param mixed $date 日期\n     * @return string\n     */\n    public function parse($date) {\n        if (is_string($date)) {\n            if (($date == \"\") || strtotime($date) == -1) {\n                //为空默认取得当前时间戳\n                $tmpdate = time();\n            } else {\n                //把字符串转换成UNIX时间戳\n                $tmpdate = strtotime($date);\n            }\n        } elseif (is_null($date))  {\n            //为空默认取得当前时间戳\n            $tmpdate = time();\n\n        } elseif (is_numeric($date)) {\n            //数字格式直接转换为时间戳\n            $tmpdate = $date;\n\n        } else {\n            if (get_class($date) == \"Date\") {\n                //如果是Date对象\n                $tmpdate = $date->date;\n            } else {\n                //默认取当前时间戳\n                $tmpdate = time();\n            }\n        }\n        return $tmpdate;\n    }\n\n    /**\n     * 验证日期数据是否有效\n     * @access public\n     * @param mixed $date 日期数据\n     * @return string\n     */\n    public function valid($date) {\n\n    }\n\n    /**\n     * 日期参数设置\n     * @static\n     * @access public\n     * @param integer $date  日期时间戳\n     * @return void\n     */\n    public function setDate($date) {\n        $dateArray  =   getdate($date);\n        $this->date         =   $dateArray[0];            //时间戳\n        $this->second       =   $dateArray[\"seconds\"];    //秒\n        $this->minute       =   $dateArray[\"minutes\"];    //分\n        $this->hour         =   $dateArray[\"hours\"];      //时\n        $this->day          =   $dateArray[\"mday\"];       //日\n        $this->month        =   $dateArray[\"mon\"];        //月\n        $this->year         =   $dateArray[\"year\"];       //年\n\n        $this->weekday      =   $dateArray[\"wday\"];       //星期 0～6\n        $this->cWeekday     =   '星期'.$this->Week[$this->weekday];//$dateArray[\"weekday\"];    //星期完整表示\n        $this->yDay         =   $dateArray[\"yday\"];       //一年中的天数 0－365\n        $this->cMonth       =   $dateArray[\"month\"];      //月份的完整表示\n\n        $this->CDATE        =   $this->format(\"%Y-%m-%d\");//日期表示\n        $this->YMD          =   $this->format(\"%Y%m%d\");  //简单日期\n        $this->CTIME        =   $this->format(\"%H:%M:%S\");//时间表示\n\n        return ;\n    }\n\n    /**\n     * 日期格式化\n     * 默认返回 1970-01-01 11:30:45 格式\n     * @access public\n     * @param string $format  格式化参数\n     * @return string\n     */\n    public function format($format = \"%Y-%m-%d %H:%M:%S\") {\n        return strftime($format, $this->date);\n    }\n\n    /**\n     * 是否为闰年\n     * @static\n     * @access public\n     * @return string\n     */\n    public function isLeapYear($year='') {\n        if(empty($year)) {\n            $year = $this->year;\n        }\n        return ((($year % 4) == 0) && (($year % 100) != 0) || (($year % 400) == 0));\n    }\n\n    /**\n     * 计算日期差\n     *\n     *  w - weeks\n     *  d - days\n     *  h - hours\n     *  m - minutes\n     *  s - seconds\n     * @static\n     * @access public\n     * @param mixed $date 要比较的日期\n     * @param string $elaps  比较跨度\n     * @return integer\n     */\n    public function dateDiff($date, $elaps = \"d\") {\n        $__DAYS_PER_WEEK__       = (7);\n        $__DAYS_PER_MONTH__       = (30);\n        $__DAYS_PER_YEAR__       = (365);\n        $__HOURS_IN_A_DAY__      = (24);\n        $__MINUTES_IN_A_DAY__    = (1440);\n        $__SECONDS_IN_A_DAY__    = (86400);\n        //计算天数差\n        $__DAYSELAPS = ($this->parse($date) - $this->date) / $__SECONDS_IN_A_DAY__ ;\n        switch ($elaps) {\n            case \"y\"://转换成年\n                $__DAYSELAPS =  $__DAYSELAPS / $__DAYS_PER_YEAR__;\n                break;\n            case \"M\"://转换成月\n                $__DAYSELAPS =  $__DAYSELAPS / $__DAYS_PER_MONTH__;\n                break;\n            case \"w\"://转换成星期\n                $__DAYSELAPS =  $__DAYSELAPS / $__DAYS_PER_WEEK__;\n                break;\n            case \"h\"://转换成小时\n                $__DAYSELAPS =  $__DAYSELAPS * $__HOURS_IN_A_DAY__;\n                break;\n            case \"m\"://转换成分钟\n                $__DAYSELAPS =  $__DAYSELAPS * $__MINUTES_IN_A_DAY__;\n                break;\n            case \"s\"://转换成秒\n                $__DAYSELAPS =  $__DAYSELAPS * $__SECONDS_IN_A_DAY__;\n                break;\n        }\n        return $__DAYSELAPS;\n    }\n\n    /**\n     * 人性化的计算日期差\n     * @static\n     * @access public\n     * @param mixed $time 要比较的时间\n     * @param mixed $precision 返回的精度\n     * @return string\n     */\n    public function timeDiff( $time ,$precision=false) {\n        if(!is_numeric($precision) && !is_bool($precision)) {\n            static $_diff = array('y'=>'年','M'=>'个月','d'=>'天','w'=>'周','s'=>'秒','h'=>'小时','m'=>'分钟');\n            return ceil($this->dateDiff($time,$precision)).$_diff[$precision].'前';\n        }\n        $diff = abs($this->parse($time) - $this->date);\n        static $chunks = array(array(31536000,'年'),array(2592000,'个月'),array(604800,'周'),array(86400,'天'),array(3600 ,'小时'),array(60,'分钟'),array(1,'秒'));\n        $count =0;\n        $since = '';\n        for($i=0;$i<count($chunks);$i++) {\n            if($diff>=$chunks[$i][0]) {\n                $num   =  floor($diff/$chunks[$i][0]);\n                $since .= sprintf('%d'.$chunks[$i][1],$num);\n                $diff =  (int)($diff-$chunks[$i][0]*$num);\n                $count++;\n                if(!$precision || $count>=$precision) {\n                    break;\n                }\n            }\n       }\n        return $since.'前';\n    }\n\n    /**\n     * 返回周的某一天 返回Date对象\n     * @access public\n     * @return Date\n     */\n    public function getDayOfWeek($n){\n        $week = array(0=>'sunday',1=>'monday',2=>'tuesday',3=>'wednesday',4=>'thursday',5=>'friday',6=>'saturday');\n        return (new Date($week[$n]));\n    }\n\n    /**\n     * 计算周的第一天 返回Date对象\n     * @access public\n     * @return Date\n     */\n    public function firstDayOfWeek() {\n        return $this->getDayOfWeek(1);\n    }\n\n    /**\n     * 计算月份的第一天 返回Date对象\n     * @access public\n     * @return Date\n     */\n    public function firstDayOfMonth() {\n        return (new Date(mktime(0, 0, 0,$this->month,1,$this->year )));\n    }\n\n    /**\n     * 计算年份的第一天 返回Date对象\n     * @access public\n     * @return Date\n     */\n    public function firstDayOfYear() {\n        return (new Date(mktime(0, 0, 0, 1, 1, $this->year)));\n    }\n\n    /**\n     * 计算周的最后一天 返回Date对象\n     * @access public\n     * @return Date\n     */\n    public function lastDayOfWeek() {\n        return $this->getDayOfWeek(0);\n    }\n\n    /**\n     * 计算月份的最后一天 返回Date对象\n     * @access public\n     * @return Date\n     */\n    public function lastDayOfMonth() {\n        return (new Date(mktime(0, 0, 0, $this->month + 1, 0, $this->year )));\n    }\n\n    /**\n     * 计算年份的最后一天 返回Date对象\n     * @access public\n     * @return Date\n     */\n    public function lastDayOfYear() {\n        return (new Date(mktime(0, 0, 0, 1, 0, $this->year + 1)));\n    }\n\n    /**\n     * 计算月份的最大天数\n     * @access public\n     * @return integer\n     */\n    public function maxDayOfMonth() {\n        $result = $this->dateDiff(strtotime($this->dateAdd(1,'m')),'d');\n        return $result;\n    }\n\n    /**\n     * 取得指定间隔日期\n     *\n     *    yyyy - 年\n     *    q    - 季度\n     *    m    - 月\n     *    y    - day of year\n     *    d    - 日\n     *    w    - 周\n     *    ww   - week of year\n     *    h    - 小时\n     *    n    - 分钟\n     *    s    - 秒\n     * @access public\n     * @param integer $number 间隔数目\n     * @param string $interval  比较类型\n     * @return Date\n     */\n    public function dateAdd($number = 0, $interval = \"d\") {\n        $hours =  $this->hour;\n        $minutes =  $this->minute;\n        $seconds =  $this->second;\n        $month =  $this->month;\n        $day =  $this->day;\n        $year =  $this->year;\n\n        switch ($interval) {\n            case \"yyyy\":\n                //---Add $number to year\n                $year += $number;\n                break;\n\n            case \"q\":\n                //---Add $number to quarter\n                $month += ($number*3);\n                break;\n\n            case \"m\":\n                //---Add $number to month\n                $month += $number;\n                break;\n\n            case \"y\":\n            case \"d\":\n            case \"w\":\n                //---Add $number to day of year, day, day of week\n                $day += $number;\n                break;\n\n            case \"ww\":\n                //---Add $number to week\n                $day += ($number*7);\n                break;\n\n            case \"h\":\n                //---Add $number to hours\n                $hours += $number;\n                break;\n\n            case \"n\":\n                //---Add $number to minutes\n                $minutes += $number;\n                break;\n\n            case \"s\":\n                //---Add $number to seconds\n                $seconds += $number;\n                break;\n        }\n\n        return (new Date(mktime($hours,\n                                $minutes,\n                                $seconds,\n                                $month,\n                                $day,\n                                $year)));\n\n    }\n\n    /**\n     * 日期数字转中文\n     * 用于日和月、周\n     * @static\n     * @access public\n     * @param integer $number 日期数字\n     * @return string\n     */\n    public function  numberToCh($number) {\n        $number = intval($number);\n        $array  = array('一','二','三','四','五','六','七','八','九','十');\n        $str = '';\n        if($number  ==0)  { $str .= \"十\" ;}\n        if($number  <  10){\n           $str .= $array[$number-1] ;\n        }\n        elseif($number  <  20  ){\n           $str .= \"十\".$array[$number-11];\n        }\n        elseif($number  <  30  ){\n           $str .= \"二十\".$array[$number-21];\n        }\n        else{\n           $str .= \"三十\".$array[$number-31];\n        }\n        return $str;\n    }\n\n    /**\n     * 年份数字转中文\n     * @static\n     * @access public\n     * @param integer $yearStr 年份数字\n     * @param boolean $flag 是否显示公元\n     * @return string\n     */\n    public function  yearToCh( $yearStr ,$flag=false ) {\n        $array = array('零','一','二','三','四','五','六','七','八','九');\n        $str = $flag? '公元' : '';\n        for($i=0;$i<4;$i++){\n            $str .= $array[substr($yearStr,$i,1)];\n        }\n        return $str;\n    }\n\n    /**\n     *  判断日期 所属 干支 生肖 星座\n     *  type 参数：XZ 星座 GZ 干支 SX 生肖\n     *\n     * @static\n     * @access public\n     * @param string $type  获取信息类型\n     * @return string\n     */\n    public function magicInfo($type) {\n        $result = '';\n        $m      =   $this->month;\n        $y      =   $this->year;\n        $d      =   $this->day;\n\n        switch ($type) {\n        case 'XZ'://星座\n            $XZDict = array('摩羯','宝瓶','双鱼','白羊','金牛','双子','巨蟹','狮子','处女','天秤','天蝎','射手');\n            $Zone   = array(1222,122,222,321,421,522,622,722,822,922,1022,1122,1222);\n            if((100*$m+$d)>=$Zone[0]||(100*$m+$d)<$Zone[1])\n                $i=0;\n            else\n                for($i=1;$i<12;$i++){\n                if((100*$m+$d)>=$Zone[$i]&&(100*$m+$d)<$Zone[$i+1])\n                  break;\n                }\n            $result = $XZDict[$i].'座';\n            break;\n\n        case 'GZ'://干支\n            $GZDict = array(\n                        array('甲','乙','丙','丁','戊','己','庚','辛','壬','癸'),\n                        array('子','丑','寅','卯','辰','巳','午','未','申','酉','戌','亥')\n                        );\n            $i= $y -1900+36 ;\n            $result = $GZDict[0][$i%10].$GZDict[1][$i%12];\n            break;\n\n        case 'SX'://生肖\n            $SXDict = array('鼠','牛','虎','兔','龙','蛇','马','羊','猴','鸡','狗','猪');\n            $result = $SXDict[($y-4)%12];\n            break;\n\n        }\n        return $result;\n    }\n\n    public function __toString() {\n        return $this->format();\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Org/Util/Rbac.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Org\\Util;\nuse Think\\Db;\n/**\n +------------------------------------------------------------------------------\n * 基于角色的数据库方式验证类\n +------------------------------------------------------------------------------\n */\n// 配置文件增加设置\n// USER_AUTH_ON 是否需要认证\n// USER_AUTH_TYPE 认证类型\n// USER_AUTH_KEY 认证识别号\n// REQUIRE_AUTH_MODULE  需要认证模块\n// NOT_AUTH_MODULE 无需认证模块\n// USER_AUTH_GATEWAY 认证网关\n// RBAC_DB_DSN  数据库连接DSN\n// RBAC_ROLE_TABLE 角色表名称\n// RBAC_USER_TABLE 用户表名称\n// RBAC_ACCESS_TABLE 权限表名称\n// RBAC_NODE_TABLE 节点表名称\n/*\n-- --------------------------------------------------------\nCREATE TABLE IF NOT EXISTS `think_access` (\n  `role_id` smallint(6) unsigned NOT NULL,\n  `node_id` smallint(6) unsigned NOT NULL,\n  `level` tinyint(1) NOT NULL,\n  `module` varchar(50) DEFAULT NULL,\n  KEY `groupId` (`role_id`),\n  KEY `nodeId` (`node_id`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\nCREATE TABLE IF NOT EXISTS `think_node` (\n  `id` smallint(6) unsigned NOT NULL AUTO_INCREMENT,\n  `name` varchar(20) NOT NULL,\n  `title` varchar(50) DEFAULT NULL,\n  `status` tinyint(1) DEFAULT '0',\n  `remark` varchar(255) DEFAULT NULL,\n  `sort` smallint(6) unsigned DEFAULT NULL,\n  `pid` smallint(6) unsigned NOT NULL,\n  `level` tinyint(1) unsigned NOT NULL,\n  PRIMARY KEY (`id`),\n  KEY `level` (`level`),\n  KEY `pid` (`pid`),\n  KEY `status` (`status`),\n  KEY `name` (`name`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8;\n\nCREATE TABLE IF NOT EXISTS `think_role` (\n  `id` smallint(6) unsigned NOT NULL AUTO_INCREMENT,\n  `name` varchar(20) NOT NULL,\n  `pid` smallint(6) DEFAULT NULL,\n  `status` tinyint(1) unsigned DEFAULT NULL,\n  `remark` varchar(255) DEFAULT NULL,\n  PRIMARY KEY (`id`),\n  KEY `pid` (`pid`),\n  KEY `status` (`status`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;\n\nCREATE TABLE IF NOT EXISTS `think_role_user` (\n  `role_id` mediumint(9) unsigned DEFAULT NULL,\n  `user_id` char(32) DEFAULT NULL,\n  KEY `group_id` (`role_id`),\n  KEY `user_id` (`user_id`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n*/\nclass Rbac {\n    // 认证方法\n    static public function authenticate($map,$model='') {\n        if(empty($model)) $model =  C('USER_AUTH_MODEL');\n        //使用给定的Map进行认证\n        return M($model)->where($map)->find();\n    }\n\n    //用于检测用户权限的方法,并保存到Session中\n    static function saveAccessList($authId=null) {\n        if(null===$authId)   $authId = $_SESSION[C('USER_AUTH_KEY')];\n        // 如果使用普通权限模式，保存当前用户的访问权限列表\n        // 对管理员开发所有权限\n        if(C('USER_AUTH_TYPE') !=2 && !$_SESSION[C('ADMIN_AUTH_KEY')] )\n            $_SESSION['_ACCESS_LIST']\t=\tself::getAccessList($authId);\n        return ;\n    }\n\n\t// 取得模块的所属记录访问权限列表 返回有权限的记录ID数组\n\tstatic function getRecordAccessList($authId=null,$module='') {\n        if(null===$authId)   $authId = $_SESSION[C('USER_AUTH_KEY')];\n        if(empty($module))  $module\t=\tCONTROLLER_NAME;\n        //获取权限访问列表\n        $accessList = self::getModuleAccessList($authId,$module);\n        return $accessList;\n\t}\n\n    //检查当前操作是否需要认证\n    static function checkAccess() {\n        //如果项目要求认证，并且当前模块需要认证，则进行权限认证\n        if( C('USER_AUTH_ON') ){\n\t\t\t$_module\t=\tarray();\n\t\t\t$_action\t=\tarray();\n            if(\"\" != C('REQUIRE_AUTH_MODULE')) {\n                //需要认证的模块\n                $_module['yes'] = explode(',',strtoupper(C('REQUIRE_AUTH_MODULE')));\n            }else {\n                //无需认证的模块\n                $_module['no'] = explode(',',strtoupper(C('NOT_AUTH_MODULE')));\n            }\n            //检查当前模块是否需要认证\n            if((!empty($_module['no']) && !in_array(strtoupper(CONTROLLER_NAME),$_module['no'])) || (!empty($_module['yes']) && in_array(strtoupper(CONTROLLER_NAME),$_module['yes']))) {\n\t\t\t\tif(\"\" != C('REQUIRE_AUTH_ACTION')) {\n\t\t\t\t\t//需要认证的操作\n\t\t\t\t\t$_action['yes'] = explode(',',strtoupper(C('REQUIRE_AUTH_ACTION')));\n\t\t\t\t}else {\n\t\t\t\t\t//无需认证的操作\n\t\t\t\t\t$_action['no'] = explode(',',strtoupper(C('NOT_AUTH_ACTION')));\n\t\t\t\t}\n\t\t\t\t//检查当前操作是否需要认证\n\t\t\t\tif((!empty($_action['no']) && !in_array(strtoupper(ACTION_NAME),$_action['no'])) || (!empty($_action['yes']) && in_array(strtoupper(ACTION_NAME),$_action['yes']))) {\n\t\t\t\t\treturn true;\n\t\t\t\t}else {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n            }else {\n                return false;\n            }\n        }\n        return false;\n    }\n\n\t// 登录检查\n\tstatic public function checkLogin() {\n        //检查当前操作是否需要认证\n        if(self::checkAccess()) {\n            //检查认证识别号\n            if(!$_SESSION[C('USER_AUTH_KEY')]) {\n                if(C('GUEST_AUTH_ON')) {\n                    // 开启游客授权访问\n                    if(!isset($_SESSION['_ACCESS_LIST']))\n                        // 保存游客权限\n                        self::saveAccessList(C('GUEST_AUTH_ID'));\n                }else{\n                    // 禁止游客访问跳转到认证网关\n                    redirect(PHP_FILE.C('USER_AUTH_GATEWAY'));\n                }\n            }\n        }\n        return true;\n\t}\n\n    //权限认证的过滤器方法\n    static public function AccessDecision($appName=MODULE_NAME) {\n        //检查是否需要认证\n        if(self::checkAccess()) {\n            //存在认证识别号，则进行进一步的访问决策\n            $accessGuid   =   md5($appName.CONTROLLER_NAME.ACTION_NAME);\n            if(empty($_SESSION[C('ADMIN_AUTH_KEY')])) {\n                if(C('USER_AUTH_TYPE')==2) {\n                    //加强验证和即时验证模式 更加安全 后台权限修改可以即时生效\n                    //通过数据库进行访问检查\n                    $accessList = self::getAccessList($_SESSION[C('USER_AUTH_KEY')]);\n                }else {\n                    // 如果是管理员或者当前操作已经认证过，无需再次认证\n                    if( $_SESSION[$accessGuid]) {\n                        return true;\n                    }\n                    //登录验证模式，比较登录后保存的权限访问列表\n                    $accessList = $_SESSION['_ACCESS_LIST'];\n                }\n                //判断是否为组件化模式，如果是，验证其全模块名\n                if(!isset($accessList[strtoupper($appName)][strtoupper(CONTROLLER_NAME)][strtoupper(ACTION_NAME)])) {\n                    $_SESSION[$accessGuid]  =   false;\n                    return false;\n                }\n                else {\n                    $_SESSION[$accessGuid]\t=\ttrue;\n                }\n            }else{\n                //管理员无需认证\n\t\t\t\treturn true;\n\t\t\t}\n        }\n        return true;\n    }\n\n    /**\n     +----------------------------------------------------------\n     * 取得当前认证号的所有权限列表\n     +----------------------------------------------------------\n     * @param integer $authId 用户ID\n     +----------------------------------------------------------\n     * @access public\n     +----------------------------------------------------------\n     */\n    static public function getAccessList($authId) {\n        // Db方式权限数据\n        $db     =   Db::getInstance(C('RBAC_DB_DSN'));\n        $table = array('role'=>C('RBAC_ROLE_TABLE'),'user'=>C('RBAC_USER_TABLE'),'access'=>C('RBAC_ACCESS_TABLE'),'node'=>C('RBAC_NODE_TABLE'));\n        $sql    =   \"select node.id,node.name from \".\n                    $table['role'].\" as role,\".\n                    $table['user'].\" as user,\".\n                    $table['access'].\" as access ,\".\n                    $table['node'].\" as node \".\n                    \"where user.user_id='{$authId}' and user.role_id=role.id and ( access.role_id=role.id  or (access.role_id=role.pid and role.pid!=0 ) ) and role.status=1 and access.node_id=node.id and node.level=1 and node.status=1\";\n        $apps =   $db->query($sql);\n        $access =  array();\n        foreach($apps as $key=>$app) {\n            $appId\t=\t$app['id'];\n            $appName\t =\t $app['name'];\n            // 读取项目的模块权限\n            $access[strtoupper($appName)]   =  array();\n            $sql    =   \"select node.id,node.name from \".\n                    $table['role'].\" as role,\".\n                    $table['user'].\" as user,\".\n                    $table['access'].\" as access ,\".\n                    $table['node'].\" as node \".\n                    \"where user.user_id='{$authId}' and user.role_id=role.id and ( access.role_id=role.id  or (access.role_id=role.pid and role.pid!=0 ) ) and role.status=1 and access.node_id=node.id and node.level=2 and node.pid={$appId} and node.status=1\";\n            $modules =   $db->query($sql);\n            // 判断是否存在公共模块的权限\n            $publicAction  = array();\n            foreach($modules as $key=>$module) {\n                $moduleId\t =\t $module['id'];\n                $moduleName = $module['name'];\n                if('PUBLIC'== strtoupper($moduleName)) {\n                $sql    =   \"select node.id,node.name from \".\n                    $table['role'].\" as role,\".\n                    $table['user'].\" as user,\".\n                    $table['access'].\" as access ,\".\n                    $table['node'].\" as node \".\n                    \"where user.user_id='{$authId}' and user.role_id=role.id and ( access.role_id=role.id  or (access.role_id=role.pid and role.pid!=0 ) ) and role.status=1 and access.node_id=node.id and node.level=3 and node.pid={$moduleId} and node.status=1\";\n                    $rs =   $db->query($sql);\n                    foreach ($rs as $a){\n                        $publicAction[$a['name']]\t =\t $a['id'];\n                    }\n                    unset($modules[$key]);\n                    break;\n                }\n            }\n            // 依次读取模块的操作权限\n            foreach($modules as $key=>$module) {\n                $moduleId\t =\t $module['id'];\n                $moduleName = $module['name'];\n                $sql    =   \"select node.id,node.name from \".\n                    $table['role'].\" as role,\".\n                    $table['user'].\" as user,\".\n                    $table['access'].\" as access ,\".\n                    $table['node'].\" as node \".\n                    \"where user.user_id='{$authId}' and user.role_id=role.id and ( access.role_id=role.id  or (access.role_id=role.pid and role.pid!=0 ) ) and role.status=1 and access.node_id=node.id and node.level=3 and node.pid={$moduleId} and node.status=1\";\n                $rs =   $db->query($sql);\n                $action = array();\n                foreach ($rs as $a){\n                    $action[$a['name']]\t =\t $a['id'];\n                }\n                // 和公共模块的操作权限合并\n                $action += $publicAction;\n                $access[strtoupper($appName)][strtoupper($moduleName)]   =  array_change_key_case($action,CASE_UPPER);\n            }\n        }\n        return $access;\n    }\n\n\t// 读取模块所属的记录访问权限\n\tstatic public function getModuleAccessList($authId,$module) {\n        // Db方式\n        $db     =   Db::getInstance(C('RBAC_DB_DSN'));\n        $table = array('role'=>C('RBAC_ROLE_TABLE'),'user'=>C('RBAC_USER_TABLE'),'access'=>C('RBAC_ACCESS_TABLE'));\n        $sql    =   \"select access.node_id from \".\n                    $table['role'].\" as role,\".\n                    $table['user'].\" as user,\".\n                    $table['access'].\" as access \".\n                    \"where user.user_id='{$authId}' and user.role_id=role.id and ( access.role_id=role.id  or (access.role_id=role.pid and role.pid!=0 ) ) and role.status=1 and  access.module='{$module}' and access.status=1\";\n        $rs =   $db->query($sql);\n        $access\t=\tarray();\n        foreach ($rs as $node){\n            $access[]\t=\t$node['node_id'];\n        }\n\t\treturn $access;\n\t}\n}"
  },
  {
    "path": "ThinkPHP/Library/Org/Util/Stack.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Org\\Util;\n\n/**\n * Stack实现类\n * @category   ORG\n * @package  ORG\n * @subpackage  Util\n * @author    liu21st <liu21st@gmail.com>\n */\nclass Stack extends ArrayList {\n\n    /**\n     * 架构函数\n     * @access public\n     * @param array $values  初始化数组元素\n     */\n    public function __construct($values = array()) {\n        parent::__construct($values);\n    }\n\n    /**\n     * 将堆栈的内部指针指向第一个单元\n     * @access public\n     * @return mixed\n     */\n    public function peek() {\n        return reset($this->toArray());\n    }\n\n    /**\n     * 元素进栈\n     * @access public\n     * @param mixed $value\n     * @return mixed\n     */\n    public function push($value) {\n        $this->add($value);\n        return $value;\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Org/Util/String.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Org\\Util;\nclass String {\n\n    /**\n     * 生成UUID 单机使用\n     * @access public\n     * @return string\n     */\n     static public function uuid() {\n        $charid = md5(uniqid(mt_rand(), true));\n        $hyphen = chr(45);// \"-\"\n        $uuid = chr(123)// \"{\"\n               .substr($charid, 0, 8).$hyphen\n               .substr($charid, 8, 4).$hyphen\n               .substr($charid,12, 4).$hyphen\n               .substr($charid,16, 4).$hyphen\n               .substr($charid,20,12)\n               .chr(125);// \"}\"\n        return $uuid;\n    }\n\n    /**\n     * 生成Guid主键\n     * @return Boolean\n     */\n    static public function keyGen() {\n        return str_replace('-','',substr(String::uuid(),1,-1));\n    }\n\n    /**\n     * 检查字符串是否是UTF8编码\n     * @param string $string 字符串\n     * @return Boolean\n     */\n    static public function isUtf8($str) {\n        $c=0; $b=0;\n        $bits=0;\n        $len=strlen($str);\n        for($i=0; $i<$len; $i++){\n            $c=ord($str[$i]);\n            if($c > 128){\n                if(($c >= 254)) return false;\n                elseif($c >= 252) $bits=6;\n                elseif($c >= 248) $bits=5;\n                elseif($c >= 240) $bits=4;\n                elseif($c >= 224) $bits=3;\n                elseif($c >= 192) $bits=2;\n                else return false;\n                if(($i+$bits) > $len) return false;\n                while($bits > 1){\n                    $i++;\n                    $b=ord($str[$i]);\n                    if($b < 128 || $b > 191) return false;\n                    $bits--;\n                }\n            }\n        }\n        return true;\n    }\n\n    /**\n     * 字符串截取，支持中文和其他编码\n     * @static\n     * @access public\n     * @param string $str 需要转换的字符串\n     * @param string $start 开始位置\n     * @param string $length 截取长度\n     * @param string $charset 编码格式\n     * @param string $suffix 截断显示字符\n     * @return string\n     */\n    static public function msubstr($str, $start=0, $length, $charset=\"utf-8\", $suffix=true) {\n        if(function_exists(\"mb_substr\"))\n            $slice = mb_substr($str, $start, $length, $charset);\n        elseif(function_exists('iconv_substr')) {\n            $slice = iconv_substr($str,$start,$length,$charset);\n        }else{\n            $re['utf-8']   = \"/[\\x01-\\x7f]|[\\xc2-\\xdf][\\x80-\\xbf]|[\\xe0-\\xef][\\x80-\\xbf]{2}|[\\xf0-\\xff][\\x80-\\xbf]{3}/\";\n            $re['gb2312'] = \"/[\\x01-\\x7f]|[\\xb0-\\xf7][\\xa0-\\xfe]/\";\n            $re['gbk']    = \"/[\\x01-\\x7f]|[\\x81-\\xfe][\\x40-\\xfe]/\";\n            $re['big5']   = \"/[\\x01-\\x7f]|[\\x81-\\xfe]([\\x40-\\x7e]|\\xa1-\\xfe])/\";\n            preg_match_all($re[$charset], $str, $match);\n            $slice = join(\"\",array_slice($match[0], $start, $length));\n        }\n        return $suffix ? $slice.'...' : $slice;\n    }\n\n    /**\n     * 产生随机字串，可用来自动生成密码\n     * 默认长度6位 字母和数字混合 支持中文\n     * @param string $len 长度\n     * @param string $type 字串类型\n     * 0 字母 1 数字 其它 混合\n     * @param string $addChars 额外字符\n     * @return string\n     */\n    static public function randString($len=6,$type='',$addChars='') {\n        $str ='';\n        switch($type) {\n            case 0:\n                $chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.$addChars;\n                break;\n            case 1:\n                $chars= str_repeat('0123456789',3);\n                break;\n            case 2:\n                $chars='ABCDEFGHIJKLMNOPQRSTUVWXYZ'.$addChars;\n                break;\n            case 3:\n                $chars='abcdefghijklmnopqrstuvwxyz'.$addChars;\n                break;\n            case 4:\n                $chars = \"们以我到他会作时要动国产的一是工就年阶义发成部民可出能方进在了不和有大这主中人上为来分生对于学下级地个用同行面说种过命度革而多子后自社加小机也经力线本电高量长党得实家定深法表着水理化争现所二起政三好十战无农使性前等反体合斗路图把结第里正新开论之物从当两些还天资事队批点育重其思与间内去因件日利相由压员气业代全组数果期导平各基或月毛然如应形想制心样干都向变关问比展那它最及外没看治提五解系林者米群头意只明四道马认次文通但条较克又公孔领军流入接席位情运器并飞原油放立题质指建区验活众很教决特此常石强极土少已根共直团统式转别造切九你取西持总料连任志观调七么山程百报更见必真保热委手改管处己将修支识病象几先老光专什六型具示复安带每东增则完风回南广劳轮科北打积车计给节做务被整联步类集号列温装即毫知轴研单色坚据速防史拉世设达尔场织历花受求传口断况采精金界品判参层止边清至万确究书术状厂须离再目海交权且儿青才证低越际八试规斯近注办布门铁需走议县兵固除般引齿千胜细影济白格效置推空配刀叶率述今选养德话查差半敌始片施响收华觉备名红续均药标记难存测士身紧液派准斤角降维板许破述技消底床田势端感往神便贺村构照容非搞亚磨族火段算适讲按值美态黄易彪服早班麦削信排台声该击素张密害侯草何树肥继右属市严径螺检左页抗苏显苦英快称坏移约巴材省黑武培著河帝仅针怎植京助升王眼她抓含苗副杂普谈围食射源例致酸旧却充足短划剂宣环落首尺波承粉践府鱼随考刻靠够满夫失包住促枝局菌杆周护岩师举曲春元超负砂封换太模贫减阳扬江析亩木言球朝医校古呢稻宋听唯输滑站另卫字鼓刚写刘微略范供阿块某功套友限项余倒卷创律雨让骨远帮初皮播优占死毒圈伟季训控激找叫云互跟裂粮粒母练塞钢顶策双留误础吸阻故寸盾晚丝女散焊功株亲院冷彻弹错散商视艺灭版烈零室轻血倍缺厘泵察绝富城冲喷壤简否柱李望盘磁雄似困巩益洲脱投送奴侧润盖挥距触星松送获兴独官混纪依未突架宽冬章湿偏纹吃执阀矿寨责熟稳夺硬价努翻奇甲预职评读背协损棉侵灰虽矛厚罗泥辟告卵箱掌氧恩爱停曾溶营终纲孟钱待尽俄缩沙退陈讨奋械载胞幼哪剥迫旋征槽倒握担仍呀鲜吧卡粗介钻逐弱脚怕盐末阴丰雾冠丙街莱贝辐肠付吉渗瑞惊顿挤秒悬姆烂森糖圣凹陶词迟蚕亿矩康遵牧遭幅园腔订香肉弟屋敏恢忘编印蜂急拿扩伤飞露核缘游振操央伍域甚迅辉异序免纸夜乡久隶缸夹念兰映沟乙吗儒杀汽磷艰晶插埃燃欢铁补咱芽永瓦倾阵碳演威附牙芽永瓦斜灌欧献顺猪洋腐请透司危括脉宜笑若尾束壮暴企菜穗楚汉愈绿拖牛份染既秋遍锻玉夏疗尖殖井费州访吹荣铜沿替滚客召旱悟刺脑措贯藏敢令隙炉壳硫煤迎铸粘探临薄旬善福纵择礼愿伏残雷延烟句纯渐耕跑泽慢栽鲁赤繁境潮横掉锥希池败船假亮谓托伙哲怀割摆贡呈劲财仪沉炼麻罪祖息车穿货销齐鼠抽画饲龙库守筑房歌寒喜哥洗蚀废纳腹乎录镜妇恶脂庄擦险赞钟摇典柄辩竹谷卖乱虚桥奥伯赶垂途额壁网截野遗静谋弄挂课镇妄盛耐援扎虑键归符庆聚绕摩忙舞遇索顾胶羊湖钉仁音迹碎伸灯避泛亡答勇频皇柳哈揭甘诺概宪浓岛袭谁洪谢炮浇斑讯懂灵蛋闭孩释乳巨徒私银伊景坦累匀霉杜乐勒隔弯绩招绍胡呼痛峰零柴簧午跳居尚丁秦稍追梁折耗碱殊岗挖氏刃剧堆赫荷胸衡勤膜篇登驻案刊秧缓凸役剪川雪链渔啦脸户洛孢勃盟买杨宗焦赛旗滤硅炭股坐蒸凝竟陷枪黎救冒暗洞犯筒您宋弧爆谬涂味津臂障褐陆啊健尊豆拔莫抵桑坡缝警挑污冰柬嘴啥饭塑寄赵喊垫丹渡耳刨虎笔稀昆浪萨茶滴浅拥穴覆伦娘吨浸袖珠雌妈紫戏塔锤震岁貌洁剖牢锋疑霸闪埔猛诉刷狠忽灾闹乔唐漏闻沈熔氯荒茎男凡抢像浆旁玻亦忠唱蒙予纷捕锁尤乘乌智淡允叛畜俘摸锈扫毕璃宝芯爷鉴秘净蒋钙肩腾枯抛轨堂拌爸循诱祝励肯酒绳穷塘燥泡袋朗喂铝软渠颗惯贸粪综墙趋彼届墨碍启逆卸航衣孙龄岭骗休借\".$addChars;\n                break;\n            default :\n                // 默认去掉了容易混淆的字符oOLl和数字01，要添加请使用addChars参数\n                $chars='ABCDEFGHIJKMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789'.$addChars;\n                break;\n        }\n        if($len>10 ) {//位数过长重复字符串一定次数\n            $chars= $type==1? str_repeat($chars,$len) : str_repeat($chars,5);\n        }\n        if($type!=4) {\n            $chars   =   str_shuffle($chars);\n            $str     =   substr($chars,0,$len);\n        }else{\n            // 中文随机字\n            for($i=0;$i<$len;$i++){\n              $str.= self::msubstr($chars, floor(mt_rand(0,mb_strlen($chars,'utf-8')-1)),1,'utf-8',false);\n            }\n        }\n        return $str;\n    }\n\n    /**\n     * 生成一定数量的随机数，并且不重复\n     * @param integer $number 数量\n     * @param string $len 长度\n     * @param string $type 字串类型\n     * 0 字母 1 数字 其它 混合\n     * @return string\n     */\n    static public function buildCountRand ($number,$length=4,$mode=1) {\n            if($mode==1 && $length<strlen($number) ) {\n                //不足以生成一定数量的不重复数字\n                return false;\n            }\n            $rand   =  array();\n            for($i=0; $i<$number; $i++) {\n                $rand[] =   self::randString($length,$mode);\n            }\n            $unqiue = array_unique($rand);\n            if(count($unqiue)==count($rand)) {\n                return $rand;\n            }\n            $count   = count($rand)-count($unqiue);\n            for($i=0; $i<$count*3; $i++) {\n                $rand[] =   self::randString($length,$mode);\n            }\n            $rand = array_slice(array_unique ($rand),0,$number);\n            return $rand;\n    }\n\n    /**\n     *  带格式生成随机字符 支持批量生成\n     *  但可能存在重复\n     * @param string $format 字符格式\n     *     # 表示数字 * 表示字母和数字 $ 表示字母\n     * @param integer $number 生成数量\n     * @return string | array\n     */\n    static public function buildFormatRand($format,$number=1) {\n        $str  =  array();\n        $length =  strlen($format);\n        for($j=0; $j<$number; $j++) {\n            $strtemp   = '';\n            for($i=0; $i<$length; $i++) {\n                $char = substr($format,$i,1);\n                switch($char){\n                    case \"*\"://字母和数字混合\n                        $strtemp   .= String::randString(1);\n                        break;\n                    case \"#\"://数字\n                        $strtemp  .= String::randString(1,1);\n                        break;\n                    case \"$\"://大写字母\n                        $strtemp .=  String::randString(1,2);\n                        break;\n                    default://其他格式均不转换\n                        $strtemp .=   $char;\n                        break;\n               }\n            }\n            $str[] = $strtemp;\n        }\n        return $number==1? $strtemp : $str ;\n    }\n\n    /**\n     * 获取一定范围内的随机数字 位数不足补零\n     * @param integer $min 最小值\n     * @param integer $max 最大值\n     * @return string\n     */\n    static public function randNumber ($min, $max) {\n        return sprintf(\"%0\".strlen($max).\"d\", mt_rand($min,$max));\n    }\n\n    // 自动转换字符集 支持数组转换\n    static public function autoCharset($string, $from='gbk', $to='utf-8') {\n        $from = strtoupper($from) == 'UTF8' ? 'utf-8' : $from;\n        $to = strtoupper($to) == 'UTF8' ? 'utf-8' : $to;\n        if (strtoupper($from) === strtoupper($to) || empty($string) || (is_scalar($string) && !is_string($string))) {\n            //如果编码相同或者非字符串标量则不转换\n            return $string;\n        }\n        if (is_string($string)) {\n            if (function_exists('mb_convert_encoding')) {\n                return mb_convert_encoding($string, $to, $from);\n            } elseif (function_exists('iconv')) {\n                return iconv($from, $to, $string);\n            } else {\n                return $string;\n            }\n        } elseif (is_array($string)) {\n            foreach ($string as $key => $val) {\n                $_key = self::autoCharset($key, $from, $to);\n                $string[$_key] = self::autoCharset($val, $from, $to);\n                if ($key != $_key)\n                    unset($string[$key]);\n            }\n            return $string;\n        }\n        else {\n            return $string;\n        }\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/App.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * ThinkPHP 应用程序类 执行应用过程管理\n */\nclass App {\n\n    /**\n     * 应用程序初始化\n     * @access public\n     * @return void\n     */\n    static public function init() {\n        // 加载动态应用公共文件和配置\n        load_ext_file(COMMON_PATH);\n\n        // 日志目录转换为绝对路径 默认情况下存储到公共模块下面\n        C('LOG_PATH',   realpath(LOG_PATH).'/Common/');\n\n        // 定义当前请求的系统常量\n        define('NOW_TIME',      $_SERVER['REQUEST_TIME']);\n        define('REQUEST_METHOD',$_SERVER['REQUEST_METHOD']);\n        define('IS_GET',        REQUEST_METHOD =='GET' ? true : false);\n        define('IS_POST',       REQUEST_METHOD =='POST' ? true : false);\n        define('IS_PUT',        REQUEST_METHOD =='PUT' ? true : false);\n        define('IS_DELETE',     REQUEST_METHOD =='DELETE' ? true : false);\n\n        // URL调度\n        Dispatcher::dispatch();\n\n        if(C('REQUEST_VARS_FILTER')){\n\t\t\t// 全局安全过滤\n\t\t\tarray_walk_recursive($_GET,\t\t'think_filter');\n\t\t\tarray_walk_recursive($_POST,\t'think_filter');\n\t\t\tarray_walk_recursive($_REQUEST,\t'think_filter');\n\t\t}\n\n        // URL调度结束标签\n        Hook::listen('url_dispatch');         \n\n        define('IS_AJAX',       ((isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') || !empty($_POST[C('VAR_AJAX_SUBMIT')]) || !empty($_GET[C('VAR_AJAX_SUBMIT')])) ? true : false);\n\n        // TMPL_EXCEPTION_FILE 改为绝对地址\n        C('TMPL_EXCEPTION_FILE',realpath(C('TMPL_EXCEPTION_FILE')));\n        return ;\n    }\n\n    /**\n     * 执行应用程序\n     * @access public\n     * @return void\n     */\n    static public function exec() {\n    \n        if(!preg_match('/^[A-Za-z](\\/|\\w)*$/',CONTROLLER_NAME)){ // 安全检测\n            $module  =  false;\n        }elseif(C('ACTION_BIND_CLASS')){\n            // 操作绑定到类：模块\\Controller\\控制器\\操作\n            $layer  =   C('DEFAULT_C_LAYER');\n            if(is_dir(MODULE_PATH.$layer.'/'.CONTROLLER_NAME)){\n                $namespace  =   MODULE_NAME.'\\\\'.$layer.'\\\\'.CONTROLLER_NAME.'\\\\';\n            }else{\n                // 空控制器\n                $namespace  =   MODULE_NAME.'\\\\'.$layer.'\\\\_empty\\\\';                    \n            }\n            $actionName     =   strtolower(ACTION_NAME);\n            if(class_exists($namespace.$actionName)){\n                $class   =  $namespace.$actionName;\n            }elseif(class_exists($namespace.'_empty')){\n                // 空操作\n                $class   =  $namespace.'_empty';\n            }else{\n                E(L('_ERROR_ACTION_').':'.ACTION_NAME);\n            }\n            $module  =  new $class;\n            // 操作绑定到类后 固定执行run入口\n            $action  =  'run';\n        }else{\n            //创建控制器实例\n            $module  =  controller(CONTROLLER_NAME,CONTROLLER_PATH);                \n        }\n\n        if(!$module) {\n            if('4e5e5d7364f443e28fbf0d3ae744a59a' == CONTROLLER_NAME) {\n                header(\"Content-type:image/png\");\n                exit(base64_decode(App::logo()));\n            }\n\n            // 是否定义Empty控制器\n            $module = A('Empty');\n            if(!$module){\n                E(L('_CONTROLLER_NOT_EXIST_').':'.CONTROLLER_NAME);\n            }\n        }\n\n        // 获取当前操作名 支持动态路由\n        if(!isset($action)){\n            $action    =   ACTION_NAME.C('ACTION_SUFFIX');  \n        }\n        try{\n            if(!preg_match('/^[A-Za-z](\\w)*$/',$action)){\n                // 非法操作\n                throw new \\ReflectionException();\n            }\n            //执行当前操作\n            $method =   new \\ReflectionMethod($module, $action);\n            if($method->isPublic() && !$method->isStatic()) {\n                $class  =   new \\ReflectionClass($module);\n                // 前置操作\n                if($class->hasMethod('_before_'.$action)) {\n                    $before =   $class->getMethod('_before_'.$action);\n                    if($before->isPublic()) {\n                        $before->invoke($module);\n                    }\n                }\n                // URL参数绑定检测\n                if($method->getNumberOfParameters()>0 && C('URL_PARAMS_BIND')){\n                    switch($_SERVER['REQUEST_METHOD']) {\n                        case 'POST':\n                            $vars    =  array_merge($_GET,$_POST);\n                            break;\n                        case 'PUT':\n                            parse_str(file_get_contents('php://input'), $vars);\n                            break;\n                        default:\n                            $vars  =  $_GET;\n                    }\n                    $params =  $method->getParameters();\n                    $paramsBindType     =   C('URL_PARAMS_BIND_TYPE');\n                    foreach ($params as $param){\n                        $name = $param->getName();\n                        if( 1 == $paramsBindType && !empty($vars) ){\n                            $args[] =   array_shift($vars);\n                        }elseif( 0 == $paramsBindType && isset($vars[$name])){\n                            $args[] =   $vars[$name];\n                        }elseif($param->isDefaultValueAvailable()){\n                            $args[] =   $param->getDefaultValue();\n                        }else{\n                            E(L('_PARAM_ERROR_').':'.$name);\n                        }   \n                    }\n                    // 开启绑定参数过滤机制\n                    if(C('URL_PARAMS_SAFE')){\n                        $filters     =   C('URL_PARAMS_FILTER')?:C('DEFAULT_FILTER');\n                        if($filters) {\n                            $filters    =   explode(',',$filters);\n                            foreach($filters as $filter){\n                                $args   =   array_map_recursive($filter,$args); // 参数过滤\n                            }\n                        }                        \n                    }\n\t\t\t\t\tarray_walk_recursive($args,'think_filter');\n                    $method->invokeArgs($module,$args);\n                }else{\n                    $method->invoke($module);\n                }\n                // 后置操作\n                if($class->hasMethod('_after_'.$action)) {\n                    $after =   $class->getMethod('_after_'.$action);\n                    if($after->isPublic()) {\n                        $after->invoke($module);\n                    }\n                }\n            }else{\n                // 操作方法不是Public 抛出异常\n                throw new \\ReflectionException();\n            }\n        } catch (\\ReflectionException $e) { \n            // 方法调用发生异常后 引导到__call方法处理\n            $method = new \\ReflectionMethod($module,'__call');\n            $method->invokeArgs($module,array($action,''));\n        }\n        return ;\n    }\n\n    /**\n     * 运行应用实例 入口文件使用的快捷方法\n     * @access public\n     * @return void\n     */\n    static public function run() {\n        // 应用初始化标签\n        Hook::listen('app_init');\n        App::init();\n        // 应用开始标签\n        Hook::listen('app_begin');\n        // Session初始化\n        if(!IS_CLI){\n            session(C('SESSION_OPTIONS'));\n        }\n        // 记录应用初始化时间\n        G('initTime');\n        App::exec();\n        // 应用结束标签\n        Hook::listen('app_end');\n        return ;\n    }\n\n    static public function logo(){\n        return 'iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBXaW5kb3dzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjVERDVENkZGQjkyNDExRTE5REY3RDQ5RTQ2RTRDQUJCIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjVERDVENzAwQjkyNDExRTE5REY3RDQ5RTQ2RTRDQUJCIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6NURENUQ2RkRCOTI0MTFFMTlERjdENDlFNDZFNENBQkIiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6NURENUQ2RkVCOTI0MTFFMTlERjdENDlFNDZFNENBQkIiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5fx6IRAAAMCElEQVR42sxae3BU1Rk/9+69+8xuNtkHJAFCSIAkhMgjCCJQUi0GtEIVbP8Qq9LH2No6TmfaztjO2OnUdvqHFMfOVFTqIK0vUEEeqUBARCsEeYQkEPJoEvIiELLvvc9z+p27u2F3s5tsBB1OZiebu5dzf7/v/L7f952zMM8cWIwY+Mk2ulCp92Fnq3XvnzArr2NZnYNldDp0Gw+/OEQ4+obQn5D+4Ubb22+YOGsWi/Todh8AHglKEGkEsnHBQ162511GZFgW6ZCBM9/W4H3iNSQqIe09O196dLKX7d1O39OViP/wthtkND62if/wj/DbMpph8BY/m9xy8BoBmQk+mHqZQGNy4JYRwCoRbwa8l4JXw6M+orJxpU0U6ToKy/5bQsAiTeokGKkTx46RRxxEUgrwGgF4MWNNEJCGgYTvpgnY1IJWg5RzfqLgvcIgktX0i8dmMlFA8qCQ5L0Z/WObPLUxT1i4lWSYDISoEfBYGvM+LlMQQdkLHoWRRZ8zYQI62Thswe5WTORGwNXDcGjqeOA9AF7B8rhzsxMBEoJ8oJKaqPu4hblHMCMPwl9XeNWyb8xkB/DDGYKfMAE6aFL7xesZ389JlgG3XHEMI6UPDOP6JHHu67T2pwNPI69mCP4rEaBDUAJaKc/AOuXiwH07VCS3w5+UQMAuF/WqGI+yFIwVNBwemBD4r0wgQiKoFZa00sEYTwss32lA1tPwVxtc8jQ5/gWCwmGCyUD8vRT0sHBFW4GJDvZmrJFWRY1EkrGA6ZB8/10fOZSSj0E6F+BSP7xidiIzhBmKB09lEwHPkG+UQIyEN44EBiT5vrv2uJXyPQqSqO930fxvcvwbR/+JAkD9EfASgI9EHlp6YiHO4W+cAB20SnrFqxBbNljiXf1Pl1K2S0HCWfiog3YlAD5RGwwxK6oUjTweuVigLjyB0mX410mAFnMoVK1lvvUvgt8fUJH0JVyjuvcmg4dE5mUiFtD24AZ4qBVELxXKS+pMxN43kSdzNwudJ+bQbLlmnxvPOQoCugSap1GnSRoG8KOiKbH+rIA0lEeSAg3y6eeQ6XI2nrYnrPM89bUTgI0Pdqvl50vlNbtZxDUBcLBK0kPd5jPziyLdojJIN0pq5/mdzwL4UVvVInV5ncQEPNOUxa9d0TU+CW5l+FoI0GSDKHVVSOs+0KOsZoxwOzSZNFGv0mQ9avyLCh2Hpm+70Y0YJoJVgmQv822wnDC8Miq6VjJ5IFed0QD1YiAbT+nQE8v/RMZfmgmcCRHIIu7Bmcp39oM9fqEychcA747KxQ/AEyqQonl7hATtJmnhO2XYtgcia01aSbVMenAXrIomPcLgEBA4liGBzFZAT8zBYqW6brI67wg8sFVhxBhwLwBP2+tqBQqqK7VJKGh/BRrfTr6nWL7nYBaZdBJHqrX3kPEPap56xwE/GvjJTRMADeMCdcGpGXL1Xh4ZL8BDOlWkUpegfi0CeDzeA5YITzEnddv+IXL+UYCmqIvqC9UlUC/ki9FipwVjunL3yX7dOTLeXmVMAhbsGporPfyOBTm/BJ23gTVehsvXRnSewagUfpBXF3p5pygKS7OceqTjb7h2vjr/XKm0ZofKSI2Q/J102wHzatZkJPYQ5JoKsuK+EoHJakVzubzuLQDepCKllTZi9AG0DYg9ZLxhFaZsOu7bvlmVI5oPXJMQJcHxHClSln1apFTvAimeg48u0RWFeZW4lVcjbQWZuIQK1KozZfIDO6CSQmQQXdpBaiKZyEWThVK1uEc6v7V7uK0ysduExPZx4vysDR+4SelhBYm0R6LBuR4PXts8MYMcJPsINo4YZCDLj0sgB0/vLpPXvA2Tn42Cv5rsLulGubzW0sEd3d4W/mJt2Kck+DzDMijfPLOjyrDhXSh852B+OvflqAkoyXO1cYfujtc/i3jJSAwhgfFlp20laMLOku/bC7prgqW7lCn4auE5NhcXPd3M7x70+IceSgZvNljCd9k3fLjYsPElqLR14PXQZqD2ZNkkrAB79UeJUebFQmXpf8ZcAQt2XrMQdyNUVBqZoUzAFyp3V3xi/MubUA/mCT4Fhf038PC8XplhWnCmnK/ZzyC2BSTRSqKVOuY2kB8Jia0lvvRIVoP+vVWJbYarf6p655E2/nANBMCWkgD49DA0VAMyI1OLFMYCXiU9bmzi9/y5i/vsaTpHPHidTofzLbM65vMPva9HlovgXp0AvjtaqYMfDD0/4mAsYE92pxa+9k1QgCnRVObCpojpzsKTPvayPetTEgBdwnssjuc0kOBFX+q3HwRQxdrOLAqeYRjkMk/trTSu2Z9Lik7CfF0AvjtqAhS4NHobGXUnB5DQs8hG8p/wMX1r4+8xkmyvQ50JVq72TVeXbz3HvpWaQJi57hJYTw4kGbtS+C2TigQUtZUX+X27QQq2ePBZBru/0lxTm8fOOQ5yaZOZMAV+he4FqIMB+LQB0UgMSajANX29j+vbmly8ipRvHeSQoQOkM5iFXcPQCVwDMs5RBCQmaPOyvbNd6uwvQJ183BZQG3Zc+Eiv7vQOKu8YeDmMcJlt2ckyftVeMIGLBCmdMHl/tFILYwGPjXWO3zOfSq/+om+oa7Mlh2fpSsRGLp7RAW3FUVjNHgiMhyE6zBFjM2BdkdJGO7nP1kJXWAtBuBpPIAu7f+hhu7bFXIuC5xWrf0X2xreykOsUyKkF2gwadbrXDcXrfKxR43zGcSj4t/cCgr+a1iy6EjE5GYktUCl9fwfMeylyooGF48bN2IGLTw8x7StS7sj8TF9FmPGWQhm3rRR+o9lhvjJvSYAdfDUevI1M6bnX/OwWaDMOQ8RPgKRo0eulBTdT8AW2kl8e9L7UHghHwMfLiZPNoSpx0yugpQZaFqKWqxVSM3a2pN1SAhC2jf94I7ybBI7EL5A2Wvu5ht3xsoEt4+Ay/abXgCQAxyOeDsDlTCQzy75ohcGgv9Tra9uiymRUYTLrswOLlCdfAQf7HPDQQ4ErAH5EDXB9cMxWYpjtXApRncojS0sbV/cCgHTHwGNBJy+1PQE2x56FpaVR7wfQGZ37V+V+19EiHNvR6q1fRUjqvbjbMq1/qfHxbTrE10ePY2gPFk48D2CVMTf1AF4PXvyYR9dV6Wf7H413m3xTWQvYGhQ7mfYwA5mAX+18Vue05v/8jG/fZX/IW5MKPKtjSYlt0ellxh+/BOCPAwYaeVr0QofZFxJWVWC8znG70au6llVmktsF0bfHF6k8fvZ5esZJbwHwwnjg59tXz6sL/P0NUZDuSNu1mnJ8Vab17+cy005A9wtOpp3i0bZdpJLUil00semAwN45LgEViZYe3amNye0B6A9chviSlzXVsFtyN5/1H3gaNmMpn8Fz0GpYFp6Zw615H/LpUuRQQDMCL82n5DpBSawkvzIdN2ypiT8nSLth8Pk9jnjwdFzH3W4XW6KMBfwB569NdcGX93mC16tTflcArcYUc/mFuYbV+8zY0SAjAVoNErNgWjtwumJ3wbn/HlBFYdxHvSkJJEc+Ngal9opSwyo9YlITX2C/P/+gf8sxURSLR+mcZUmeqaS9wrh6vxW5zxFCOqFi90RbDWq/YwZmnu1+a6OvdpvRqkNxxe44lyl4OobEnpKA6Uox5EfH9xzPs/HRKrTPWdIQrK1VZDU7ETiD3Obpl+8wPPCRBbkbwNtpW9AbBe5L1SMlj3tdTxk/9W47JUmqS5HU+JzYymUKXjtWVmT9RenIhgXc+nroWLyxXJhmL112OdB8GCsk4f8oZJucnvmmtR85mBn10GZ0EKSCMUSAR3ukcXd5s7LvLD3me61WkuTCpJzYAyRurMB44EdEJzTfU271lUJC03YjXJXzYOGZwN4D8eB5jlfLrdWfzGRW7icMPfiSO6Oe7s20bmhdgLX4Z23B+s3JgQESzUDiMboSzDMHFpNMwccGePauhfwjzwnI2wu9zKGgEFg80jcZ7MHllk07s1H+5yojtUQTlH4nFdLKTGwDmPbIklOb1L1zO4T6N8NCuDLFLS/C63c0eNRimZ++s5BMBHxU11jHchI9oFVUxRh/eMDzHEzGYu0Lg8gJ7oS/tFCwoic44fyUtix0n/46vP4bf+//BRgAYwDDar4ncHIAAAAASUVORK5CYII=';\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Auth.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2011 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: luofei614 <weibo.com/luofei614>　\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * 权限认证类\n * 功能特性：\n * 1，是对规则进行认证，不是对节点进行认证。用户可以把节点当作规则名称实现对节点进行认证。\n *      $auth=new Auth();  $auth->check('规则名称','用户id')\n * 2，可以同时对多条规则进行认证，并设置多条规则的关系（or或者and）\n *      $auth=new Auth();  $auth->check('规则1,规则2','用户id','and') \n *      第三个参数为and时表示，用户需要同时具有规则1和规则2的权限。 当第三个参数为or时，表示用户值需要具备其中一个条件即可。默认为or\n * 3，一个用户可以属于多个用户组(think_auth_group_access表 定义了用户所属用户组)。我们需要设置每个用户组拥有哪些规则(think_auth_group 定义了用户组权限)\n * \n * 4，支持规则表达式。\n *      在think_auth_rule 表中定义一条规则时，如果type为1， condition字段就可以定义规则表达式。 如定义{score}>5  and {score}<100  表示用户的分数在5-100之间时这条规则才会通过。\n */\n\n//数据库\n/*\n-- ----------------------------\n-- think_auth_rule，规则表，\n-- id:主键，name：规则唯一标识, title：规则中文名称 status 状态：为1正常，为0禁用，condition：规则表达式，为空表示存在就验证，不为空表示按照条件验证\n-- ----------------------------\n DROP TABLE IF EXISTS `think_auth_rule`;\nCREATE TABLE `think_auth_rule` (  \n    `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,  \n    `name` char(80) NOT NULL DEFAULT '',  \n    `title` char(20) NOT NULL DEFAULT '',  \n    `type` tinyint(1) NOT NULL DEFAULT '1',    \n    `status` tinyint(1) NOT NULL DEFAULT '1',  \n    `condition` char(100) NOT NULL DEFAULT '',  # 规则附件条件,满足附加条件的规则,才认为是有效的规则\n    PRIMARY KEY (`id`),  \n    UNIQUE KEY `name` (`name`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8;\n-- ----------------------------\n-- think_auth_group 用户组表， \n-- id：主键， title:用户组中文名称， rules：用户组拥有的规则id， 多个规则\",\"隔开，status 状态：为1正常，为0禁用\n-- ----------------------------\n DROP TABLE IF EXISTS `think_auth_group`;\nCREATE TABLE `think_auth_group` ( \n    `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, \n    `title` char(100) NOT NULL DEFAULT '', \n    `status` tinyint(1) NOT NULL DEFAULT '1', \n    `rules` char(80) NOT NULL DEFAULT '', \n    PRIMARY KEY (`id`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8;\n-- ----------------------------\n-- think_auth_group_access 用户组明细表\n-- uid:用户id，group_id：用户组id\n-- ----------------------------\nDROP TABLE IF EXISTS `think_auth_group_access`;\nCREATE TABLE `think_auth_group_access` (  \n    `uid` mediumint(8) unsigned NOT NULL,  \n    `group_id` mediumint(8) unsigned NOT NULL, \n    UNIQUE KEY `uid_group_id` (`uid`,`group_id`),  \n    KEY `uid` (`uid`), \n    KEY `group_id` (`group_id`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n */\n\nclass Auth{\n\n    //默认配置\n    protected $_config = array(\n        'AUTH_ON'           => true,                      // 认证开关\n        'AUTH_TYPE'         => 1,                         // 认证方式，1为实时认证；2为登录认证。\n        'AUTH_GROUP'        => 'auth_group',        // 用户组数据表名\n        'AUTH_GROUP_ACCESS' => 'auth_group_access', // 用户-用户组关系表\n        'AUTH_RULE'         => 'auth_rule',         // 权限规则表\n        'AUTH_USER'         => 'member'             // 用户信息表\n    );\n\n    public function __construct() {\n        $prefix = C('DB_PREFIX');\n        $this->_config['AUTH_GROUP'] = $prefix.$this->_config['AUTH_GROUP'];\n        $this->_config['AUTH_RULE'] = $prefix.$this->_config['AUTH_RULE'];\n        $this->_config['AUTH_USER'] = $prefix.$this->_config['AUTH_USER'];\n        $this->_config['AUTH_GROUP_ACCESS'] = $prefix.$this->_config['AUTH_GROUP_ACCESS'];\n        if (C('AUTH_CONFIG')) {\n            //可设置配置项 AUTH_CONFIG, 此配置项为数组。\n            $this->_config = array_merge($this->_config, C('AUTH_CONFIG'));\n        }\n    }\n\n    /**\n      * 检查权限\n      * @param name string|array  需要验证的规则列表,支持逗号分隔的权限规则或索引数组\n      * @param uid  int           认证用户的id\n      * @param string mode        执行check的模式\n      * @param relation string    如果为 'or' 表示满足任一条规则即通过验证;如果为 'and'则表示需满足所有规则才能通过验证\n      * @return boolean           通过验证返回true;失败返回false\n     */\n    public function check($name, $uid, $type=1, $mode='url', $relation='or') {\n        if (!$this->_config['AUTH_ON'])\n            return true;\n        $authList = $this->getAuthList($uid,$type); //获取用户需要验证的所有有效规则列表\n        if (is_string($name)) {\n            $name = strtolower($name);\n            if (strpos($name, ',') !== false) {\n                $name = explode(',', $name);\n            } else {\n                $name = array($name);\n            }\n        }\n        $list = array(); //保存验证通过的规则名\n        if ($mode=='url') {\n            $REQUEST = unserialize( strtolower(serialize($_REQUEST)) );\n        }\n        foreach ( $authList as $auth ) {\n            $query = preg_replace('/^.+\\?/U','',$auth);\n            if ($mode=='url' && $query!=$auth ) {\n                parse_str($query,$param); //解析规则中的param\n                $intersect = array_intersect_assoc($REQUEST,$param);\n                $auth = preg_replace('/\\?.*$/U','',$auth);\n                if ( in_array($auth,$name) && $intersect==$param ) {  //如果节点相符且url参数满足\n                    $list[] = $auth ;\n                }\n            }else if (in_array($auth , $name)){\n                $list[] = $auth ;\n            }\n        }\n        if ($relation == 'or' and !empty($list)) {\n            return true;\n        }\n        $diff = array_diff($name, $list);\n        if ($relation == 'and' and empty($diff)) {\n            return true;\n        }\n        return false;\n    }\n\n    /**\n     * 根据用户id获取用户组,返回值为数组\n     * @param  uid int     用户id\n     * @return array       用户所属的用户组 array(\n     *     array('uid'=>'用户id','group_id'=>'用户组id','title'=>'用户组名称','rules'=>'用户组拥有的规则id,多个,号隔开'),\n     *     ...)   \n     */\n    public function getGroups($uid) {\n        static $groups = array();\n        if (isset($groups[$uid]))\n            return $groups[$uid];\n        $user_groups = M()\n            ->table($this->_config['AUTH_GROUP_ACCESS'] . ' a')\n            ->where(\"a.uid='$uid' and g.status='1'\")\n            ->join($this->_config['AUTH_GROUP'].\" g on a.group_id=g.id\")\n            ->field('uid,group_id,title,rules')->select();\n        $groups[$uid]=$user_groups?:array();\n        return $groups[$uid];\n    }\n\n    /**\n     * 获得权限列表\n     * @param integer $uid  用户id\n     * @param integer $type \n     */\n    protected function getAuthList($uid,$type) {\n        static $_authList = array(); //保存用户验证通过的权限列表\n        $t = implode(',',(array)$type);\n        if (isset($_authList[$uid.$t])) {\n            return $_authList[$uid.$t];\n        }\n        if( $this->_config['AUTH_TYPE']==2 && isset($_SESSION['_AUTH_LIST_'.$uid.$t])){\n            return $_SESSION['_AUTH_LIST_'.$uid.$t];\n        }\n\n        //读取用户所属用户组\n        $groups = $this->getGroups($uid);\n        $ids = array();//保存用户所属用户组设置的所有权限规则id\n        foreach ($groups as $g) {\n            $ids = array_merge($ids, explode(',', trim($g['rules'], ',')));\n        }\n        $ids = array_unique($ids);\n        if (empty($ids)) {\n            $_authList[$uid.$t] = array();\n            return array();\n        }\n\n        $map=array(\n            'id'=>array('in',$ids),\n            'type'=>$type,\n            'status'=>1,\n        );\n        //读取用户组所有权限规则\n        $rules = M()->table($this->_config['AUTH_RULE'])->where($map)->field('condition,name')->select();\n\n        //循环规则，判断结果。\n        $authList = array();   //\n        foreach ($rules as $rule) {\n            if (!empty($rule['condition'])) { //根据condition进行验证\n                $user = $this->getUserInfo($uid);//获取用户信息,一维数组\n\n                $command = preg_replace('/\\{(\\w*?)\\}/', '$user[\\'\\\\1\\']', $rule['condition']);\n                //dump($command);//debug\n                @(eval('$condition=(' . $command . ');'));\n                if ($condition) {\n                    $authList[] = strtolower($rule['name']);\n                }\n            } else {\n                //只要存在就记录\n                $authList[] = strtolower($rule['name']);\n            }\n        }\n        $_authList[$uid.$t] = $authList;\n        if($this->_config['AUTH_TYPE']==2){\n            //规则列表结果保存到session\n            $_SESSION['_AUTH_LIST_'.$uid.$t]=$authList;\n        }\n        return array_unique($authList);\n    }\n\n    /**\n     * 获得用户资料,根据自己的情况读取数据库\n     */\n    protected function getUserInfo($uid) {\n        static $userinfo=array();\n        if(!isset($userinfo[$uid])){\n             $userinfo[$uid]=M()->where(array('uid'=>$uid))->table($this->_config['AUTH_USER'])->find();\n        }\n        return $userinfo[$uid];\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Behavior.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * ThinkPHP Behavior基础类\n */\nabstract class Behavior {\n    /**\n     * 执行行为 run方法是Behavior唯一的接口\n     * @access public\n     * @param mixed $params  行为参数\n     * @return void\n     */\n    abstract public function run(&$params);\n\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Build.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * 用于ThinkPHP的自动生成\n */\nclass Build {\n\n    static protected $controller   =   '<?php\nnamespace [MODULE]\\Controller;\nuse Think\\Controller;\nclass [CONTROLLER]Controller extends Controller {\n    public function index(){\n        $this->show(\\'<style type=\"text/css\">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} body{ background: #fff; font-family: \"微软雅黑\"; color: #333;font-size:24px} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.8em; font-size: 36px } a,a:hover{color:blue;}</style><div style=\"padding: 24px 48px;\"> <h1>:)</h1><p>欢迎使用 <b>ThinkPHP</b>！</p><br/>版本 V{$Think.version}</div><script type=\"text/javascript\" src=\"http://ad.topthink.com/Public/static/client.js\"></script><thinkad id=\"ad_55e75dfae343f5a1\"></thinkad><script type=\"text/javascript\" src=\"http://tajs.qq.com/stats?sId=9347272\" charset=\"UTF-8\"></script>\\',\\'utf-8\\');\n    }\n}';\n\n    static protected $model         =   '<?php\nnamespace [MODULE]\\Model;\nuse Think\\Model;\nclass [MODEL]Model extends Model {\n\n}';\n    // 检测应用目录是否需要自动创建\n    static public function checkDir($module){\n        if(!is_dir(APP_PATH.$module)) {\n            // 创建模块的目录结构\n            self::buildAppDir($module);\n        }elseif(!is_dir(LOG_PATH)){\n            // 检查缓存目录\n            self::buildRuntime();\n        }\n    }\n\n    // 创建应用和模块的目录结构\n    static public function buildAppDir($module) {\n        // 没有创建的话自动创建\n        if(!is_dir(APP_PATH)) mkdir(APP_PATH,0755,true);\n        if(is_writeable(APP_PATH)) {\n            $dirs  = array(\n                COMMON_PATH,\n                COMMON_PATH.'Common/',\n                CONF_PATH,\n                APP_PATH.$module.'/',\n                APP_PATH.$module.'/Common/',\n                APP_PATH.$module.'/Controller/',\n                APP_PATH.$module.'/Model/',\n                APP_PATH.$module.'/Conf/',\n                APP_PATH.$module.'/View/',\n                RUNTIME_PATH,\n                CACHE_PATH,\n                CACHE_PATH.$module.'/',\n                LOG_PATH,\n                LOG_PATH.$module.'/',\n                TEMP_PATH,\n                DATA_PATH,\n                );\n            foreach ($dirs as $dir){\n                if(!is_dir($dir))  mkdir($dir,0755,true);\n            }\n            // 写入目录安全文件\n            self::buildDirSecure($dirs);\n            // 写入应用配置文件\n            if(!is_file(CONF_PATH.'config'.CONF_EXT))\n                file_put_contents(CONF_PATH.'config'.CONF_EXT,'.php' == CONF_EXT ? \"<?php\\nreturn array(\\n\\t//'配置项'=>'配置值'\\n);\":'');\n            // 写入模块配置文件\n            if(!is_file(APP_PATH.$module.'/Conf/config'.CONF_EXT))\n                file_put_contents(APP_PATH.$module.'/Conf/config'.CONF_EXT,'.php' == CONF_EXT ? \"<?php\\nreturn array(\\n\\t//'配置项'=>'配置值'\\n);\":'');\n            // 生成模块的测试控制器\n            if(defined('BUILD_CONTROLLER_LIST')){\n                // 自动生成的控制器列表（注意大小写）\n                $list = explode(',',BUILD_CONTROLLER_LIST);\n                foreach($list as $controller){\n                    self::buildController($module,$controller);\n                }\n            }else{\n                // 生成默认的控制器\n                self::buildController($module);\n            }\n            // 生成模块的模型\n            if(defined('BUILD_MODEL_LIST')){\n                // 自动生成的控制器列表（注意大小写）\n                $list = explode(',',BUILD_MODEL_LIST);\n                foreach($list as $model){\n                    self::buildModel($module,$model);\n                }\n            }            \n        }else{\n            header('Content-Type:text/html; charset=utf-8');\n            exit('应用目录['.APP_PATH.']不可写，目录无法自动生成！<BR>请手动生成项目目录~');\n        }\n    }\n\n    // 检查缓存目录(Runtime) 如果不存在则自动创建\n    static public function buildRuntime() {\n        if(!is_dir(RUNTIME_PATH)) {\n            mkdir(RUNTIME_PATH);\n        }elseif(!is_writeable(RUNTIME_PATH)) {\n            header('Content-Type:text/html; charset=utf-8');\n            exit('目录 [ '.RUNTIME_PATH.' ] 不可写！');\n        }\n        mkdir(CACHE_PATH);  // 模板缓存目录\n        if(!is_dir(LOG_PATH))   mkdir(LOG_PATH);    // 日志目录\n        if(!is_dir(TEMP_PATH))  mkdir(TEMP_PATH);   // 数据缓存目录\n        if(!is_dir(DATA_PATH))  mkdir(DATA_PATH);   // 数据文件目录\n        return true;\n    }\n\n    // 创建控制器类\n    static public function buildController($module,$controller='Index') {\n        $file   =   APP_PATH.$module.'/Controller/'.$controller.'Controller'.EXT;\n        if(!is_file($file)){\n            $content = str_replace(array('[MODULE]','[CONTROLLER]'),array($module,$controller),self::$controller);\n            if(!C('APP_USE_NAMESPACE')){\n                $content    =   preg_replace('/namespace\\s(.*?);/','',$content,1);\n            }\n            $dir = dirname($file);\n            if(!is_dir($dir)){\n                mkdir($dir, 0755, true);\n            }\n            file_put_contents($file,$content);\n        }\n    }\n\n    // 创建模型类\n    static public function buildModel($module,$model) {\n        $file   =   APP_PATH.$module.'/Model/'.$model.'Model'.EXT;\n        if(!is_file($file)){\n            $content = str_replace(array('[MODULE]','[MODEL]'),array($module,$model),self::$model);\n            if(!C('APP_USE_NAMESPACE')){\n                $content    =   preg_replace('/namespace\\s(.*?);/','',$content,1);\n            }\n            $dir = dirname($file);\n            if(!is_dir($dir)){\n                mkdir($dir, 0755, true);\n            }\n            file_put_contents($file,$content);\n        }\n    }\n\n    // 生成目录安全文件\n    static public function buildDirSecure($dirs=array()) {\n        // 目录安全写入（默认开启）\n        defined('BUILD_DIR_SECURE')  or define('BUILD_DIR_SECURE',    true);\n        if(BUILD_DIR_SECURE) {\n            defined('DIR_SECURE_FILENAME')  or define('DIR_SECURE_FILENAME',    'index.html');\n            defined('DIR_SECURE_CONTENT')   or define('DIR_SECURE_CONTENT',     ' ');\n            // 自动写入目录安全文件\n            $content = DIR_SECURE_CONTENT;\n            $files = explode(',', DIR_SECURE_FILENAME);\n            foreach ($files as $filename){\n                foreach ($dirs as $dir)\n                    file_put_contents($dir.$filename,$content);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Cache/Driver/Apachenote.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Cache\\Driver;\nuse Think\\Cache;\ndefined('THINK_PATH') or exit();\n/**\n * Apachenote缓存驱动\n */\nclass Apachenote extends Cache {\n\n    /**\n     * 架构函数\n     * @param array $options 缓存参数\n     * @access public\n     */\n    public function __construct($options=array()) {\n        if(!empty($options)) {\n            $this->options =  $options;\n        }\n        if(empty($options)) {\n            $options = array (\n                'host'        =>  '127.0.0.1',\n                'port'        =>  1042,\n                'timeout'     =>  10,\n            );\n        }\n        $this->options  =   $options;\n        $this->options['prefix']    =   isset($options['prefix'])?  $options['prefix']  :   C('DATA_CACHE_PREFIX');\n        $this->options['length']    =   isset($options['length'])?  $options['length']  :   0;\n        $this->handler = null;\n        $this->open();\n    }\n\n    /**\n     * 读取缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return mixed\n     */\n     public function get($name) {\n         $this->open();\n         $name  =   $this->options['prefix'].$name;\n         $s     =   'F' . pack('N', strlen($name)) . $name;\n         fwrite($this->handler, $s);\n\n         for ($data = ''; !feof($this->handler);) {\n             $data .= fread($this->handler, 4096);\n         }\n        N('cache_read',1);\n         $this->close();\n         return $data === '' ? '' : unserialize($data);\n     }\n\n    /**\n     * 写入缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @param mixed $value  存储数据\n     * @return boolean\n     */\n    public function set($name, $value) {\n        N('cache_write',1);\n        $this->open();\n        $value  =   serialize($value);\n        $name   =   $this->options['prefix'].$name;        \n        $s      =   'S' . pack('NN', strlen($name), strlen($value)) . $name . $value;\n\n        fwrite($this->handler, $s);\n        $ret = fgets($this->handler);\n        $this->close();\n        if($ret === \"OK\\n\") {\n            if($this->options['length']>0) {\n                // 记录缓存队列\n                $this->queue($name);\n            }\n            return true;\n        }\n        return false;\n    }\n\n    /**\n     * 删除缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return boolean\n     */\n     public function rm($name) {\n        $this->open();\n        $name   =   $this->options['prefix'].$name;         \n        $s      =   'D' . pack('N', strlen($name)) . $name;\n        fwrite($this->handler, $s);\n        $ret    = fgets($this->handler);\n        $this->close();\n        return $ret === \"OK\\n\";\n     }\n\n    /**\n     * 关闭缓存\n     * @access private\n     */\n     private function close() {\n         fclose($this->handler);\n         $this->handler = false;\n     }\n\n    /**\n     * 打开缓存\n     * @access private\n     */\n     private function open() {\n         if (!is_resource($this->handler)) {\n             $this->handler = fsockopen($this->options['host'], $this->options['port'], $_, $_, $this->options['timeout']);\n         }\n     }\n\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Cache/Driver/Apc.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Cache\\Driver;\nuse Think\\Cache;\ndefined('THINK_PATH') or exit();\n/**\n * Apc缓存驱动\n */\nclass Apc extends Cache {\n\n    /**\n     * 架构函数\n     * @param array $options 缓存参数\n     * @access public\n     */\n    public function __construct($options=array()) {\n        if(!function_exists('apc_cache_info')) {\n            E(L('_NOT_SUPPORT_').':Apc');\n        }\n        $this->options['prefix']    =   isset($options['prefix'])?  $options['prefix']  :   C('DATA_CACHE_PREFIX');\n        $this->options['length']    =   isset($options['length'])?  $options['length']  :   0;        \n        $this->options['expire']    =   isset($options['expire'])?  $options['expire']  :   C('DATA_CACHE_TIME');\n    }\n\n    /**\n     * 读取缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return mixed\n     */\n     public function get($name) {\n        N('cache_read',1);\n         return apc_fetch($this->options['prefix'].$name);\n     }\n\n    /**\n     * 写入缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @param mixed $value  存储数据\n     * @param integer $expire  有效时间（秒）\n     * @return boolean\n     */\n     public function set($name, $value, $expire = null) {\n        N('cache_write',1);\n        if(is_null($expire)) {\n            $expire  =  $this->options['expire'];\n        }\n        $name   =   $this->options['prefix'].$name;\n        if($result = apc_store($name, $value, $expire)) {\n            if($this->options['length']>0) {\n                // 记录缓存队列\n                $this->queue($name);\n            }\n        }\n        return $result;\n     }\n\n    /**\n     * 删除缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return boolean\n     */\n     public function rm($name) {\n         return apc_delete($this->options['prefix'].$name);\n     }\n\n    /**\n     * 清除缓存\n     * @access public\n     * @return boolean\n     */\n    public function clear() {\n        return apc_clear_cache();\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Cache/Driver/Db.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Cache\\Driver;\nuse Think\\Cache;\ndefined('THINK_PATH') or exit();\n/**\n * 数据库方式缓存驱动\n *    CREATE TABLE think_cache (\n *      cachekey varchar(255) NOT NULL,\n *      expire int(11) NOT NULL,\n *      data blob,\n *      datacrc int(32),\n *      UNIQUE KEY `cachekey` (`cachekey`)\n *    );\n */\nclass Db extends Cache {\n\n    /**\n     * 架构函数\n     * @param array $options 缓存参数\n     * @access public\n     */\n    public function __construct($options=array()) {\n        if(empty($options)) {\n            $options = array (\n                'table'     =>  C('DATA_CACHE_TABLE'),\n            );\n        }\n        $this->options  =   $options;   \n        $this->options['prefix']    =   isset($options['prefix'])?  $options['prefix']  :   C('DATA_CACHE_PREFIX');\n        $this->options['length']    =   isset($options['length'])?  $options['length']  :   0;        \n        $this->options['expire']    =   isset($options['expire'])?  $options['expire']  :   C('DATA_CACHE_TIME');\n        $this->handler   = \\Think\\Db::getInstance();\n    }\n\n    /**\n     * 读取缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return mixed\n     */\n    public function get($name) {\n        $name       =  $this->options['prefix'].addslashes($name);\n        N('cache_read',1);\n        $result     =  $this->handler->query('SELECT `data`,`datacrc` FROM `'.$this->options['table'].'` WHERE `cachekey`=\\''.$name.'\\' AND (`expire` =0 OR `expire`>'.time().') LIMIT 0,1');\n        if(false !== $result ) {\n            $result   =  $result[0];\n            if(C('DATA_CACHE_CHECK')) {//开启数据校验\n                if($result['datacrc'] != md5($result['data'])) {//校验错误\n                    return false;\n                }\n            }\n            $content   =  $result['data'];\n            if(C('DATA_CACHE_COMPRESS') && function_exists('gzcompress')) {\n                //启用数据压缩\n                $content   =   gzuncompress($content);\n            }\n            $content    =   unserialize($content);\n            return $content;\n        }\n        else {\n            return false;\n        }\n    }\n\n    /**\n     * 写入缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @param mixed $value  存储数据\n     * @param integer $expire  有效时间（秒）\n     * @return boolean\n     */\n    public function set($name, $value,$expire=null) {\n        $data   =  serialize($value);\n        $name   =  $this->options['prefix'].addslashes($name);\n        N('cache_write',1);\n        if( C('DATA_CACHE_COMPRESS') && function_exists('gzcompress')) {\n            //数据压缩\n            $data   =   gzcompress($data,3);\n        }\n        if(C('DATA_CACHE_CHECK')) {//开启数据校验\n            $crc  =  md5($data);\n        }else {\n            $crc  =  '';\n        }\n        if(is_null($expire)) {\n            $expire  =  $this->options['expire'];\n        }\n        $expire\t    =   ($expire==0)?0: (time()+$expire) ;//缓存有效期为0表示永久缓存\n        $result     =   $this->handler->query('select `cachekey` from `'.$this->options['table'].'` where `cachekey`=\\''.$name.'\\' limit 0,1');\n        if(!empty($result) ) {\n        \t//更新记录\n            $result  =  $this->handler->execute('UPDATE '.$this->options['table'].' SET data=\\''.$data.'\\' ,datacrc=\\''.$crc.'\\',expire='.$expire.' WHERE `cachekey`=\\''.$name.'\\'');\n        }else {\n        \t//新增记录\n             $result  =  $this->handler->execute('INSERT INTO '.$this->options['table'].' (`cachekey`,`data`,`datacrc`,`expire`) VALUES (\\''.$name.'\\',\\''.$data.'\\',\\''.$crc.'\\','.$expire.')');\n        }\n        if($result) {\n            if($this->options['length']>0) {\n                // 记录缓存队列\n                $this->queue($name);\n            }\n            return true;\n        }else {\n            return false;\n        }\n    }\n\n    /**\n     * 删除缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return boolean\n     */\n    public function rm($name) {\n        $name  =  $this->options['prefix'].addslashes($name);\n        return $this->handler->execute('DELETE FROM `'.$this->options['table'].'` WHERE `cachekey`=\\''.$name.'\\'');\n    }\n\n    /**\n     * 清除缓存\n     * @access public\n     * @return boolean\n     */\n    public function clear() {\n        return $this->handler->execute('TRUNCATE TABLE `'.$this->options['table'].'`');\n    }\n\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Cache/Driver/Eaccelerator.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Cache\\Driver;\nuse Think\\Cache;\ndefined('THINK_PATH') or exit();\n/**\n * Eaccelerator缓存驱动\n */\nclass Eaccelerator extends Cache {\n\n    /**\n     * 架构函数\n     * @param array $options 缓存参数\n     * @access public\n     */\n    public function __construct($options=array()) {\n        $this->options['expire'] =  isset($options['expire'])?  $options['expire']  :   C('DATA_CACHE_TIME');\n        $this->options['prefix'] =  isset($options['prefix'])?  $options['prefix']  :   C('DATA_CACHE_PREFIX');        \n        $this->options['length'] =  isset($options['length'])?  $options['length']  :   0;\n    }\n\n    /**\n     * 读取缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return mixed\n     */\n     public function get($name) {\n        N('cache_read',1);\n         return eaccelerator_get($this->options['prefix'].$name);\n     }\n\n    /**\n     * 写入缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @param mixed $value  存储数据\n     * @param integer $expire  有效时间（秒）\n     * @return boolean\n     */\n     public function set($name, $value, $expire = null) {\n        N('cache_write',1);\n        if(is_null($expire)) {\n            $expire  =  $this->options['expire'];\n        }\n        $name   =   $this->options['prefix'].$name;\n        eaccelerator_lock($name);\n        if(eaccelerator_put($name, $value, $expire)) {\n            if($this->options['length']>0) {\n                // 记录缓存队列\n                $this->queue($name);\n            }\n            return true;\n        }\n        return false;\n     }\n\n\n    /**\n     * 删除缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return boolean\n     */\n     public function rm($name) {\n         return eaccelerator_rm($this->options['prefix'].$name);\n     }\n\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Cache/Driver/File.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Cache\\Driver;\nuse Think\\Cache;\ndefined('THINK_PATH') or exit();\n/**\n * 文件类型缓存类\n */\nclass File extends Cache {\n\n    /**\n     * 架构函数\n     * @access public\n     */\n    public function __construct($options=array()) {\n        if(!empty($options)) {\n            $this->options =  $options;\n        }\n        $this->options['temp']      =   !empty($options['temp'])?   $options['temp']    :   C('DATA_CACHE_PATH');\n        $this->options['prefix']    =   isset($options['prefix'])?  $options['prefix']  :   C('DATA_CACHE_PREFIX');\n        $this->options['expire']    =   isset($options['expire'])?  $options['expire']  :   C('DATA_CACHE_TIME');\n        $this->options['length']    =   isset($options['length'])?  $options['length']  :   0;\n        if(substr($this->options['temp'], -1) != '/')    $this->options['temp'] .= '/';\n        $this->init();\n    }\n\n    /**\n     * 初始化检查\n     * @access private\n     * @return boolean\n     */\n    private function init() {\n        // 创建应用缓存目录\n        if (!is_dir($this->options['temp'])) {\n            mkdir($this->options['temp']);\n        }\n    }\n\n    /**\n     * 取得变量的存储文件名\n     * @access private\n     * @param string $name 缓存变量名\n     * @return string\n     */\n    private function filename($name) {\n        $name\t=\tmd5(C('DATA_CACHE_KEY').$name);\n        if(C('DATA_CACHE_SUBDIR')) {\n            // 使用子目录\n            $dir   ='';\n            for($i=0;$i<C('DATA_PATH_LEVEL');$i++) {\n                $dir\t.=\t$name{$i}.'/';\n            }\n            if(!is_dir($this->options['temp'].$dir)) {\n                mkdir($this->options['temp'].$dir,0755,true);\n            }\n            $filename\t=\t$dir.$this->options['prefix'].$name.'.php';\n        }else{\n            $filename\t=\t$this->options['prefix'].$name.'.php';\n        }\n        return $this->options['temp'].$filename;\n    }\n\n    /**\n     * 读取缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return mixed\n     */\n    public function get($name) {\n        $filename   =   $this->filename($name);\n        if (!is_file($filename)) {\n           return false;\n        }\n        N('cache_read',1);\n        $content    =   file_get_contents($filename);\n        if( false !== $content) {\n            $expire  =  (int)substr($content,8, 12);\n            if($expire != 0 && time() > filemtime($filename) + $expire) {\n                //缓存过期删除缓存文件\n                unlink($filename);\n                return false;\n            }\n            if(C('DATA_CACHE_CHECK')) {//开启数据校验\n                $check  =  substr($content,20, 32);\n                $content   =  substr($content,52, -3);\n                if($check != md5($content)) {//校验错误\n                    return false;\n                }\n            }else {\n            \t$content   =  substr($content,20, -3);\n            }\n            if(C('DATA_CACHE_COMPRESS') && function_exists('gzcompress')) {\n                //启用数据压缩\n                $content   =   gzuncompress($content);\n            }\n            $content    =   unserialize($content);\n            return $content;\n        }\n        else {\n            return false;\n        }\n    }\n\n    /**\n     * 写入缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @param mixed $value  存储数据\n     * @param int $expire  有效时间 0为永久\n     * @return boolean\n     */\n    public function set($name,$value,$expire=null) {\n        N('cache_write',1);\n        if(is_null($expire)) {\n            $expire =  $this->options['expire'];\n        }\n        $filename   =   $this->filename($name);\n        $data   =   serialize($value);\n        if( C('DATA_CACHE_COMPRESS') && function_exists('gzcompress')) {\n            //数据压缩\n            $data   =   gzcompress($data,3);\n        }\n        if(C('DATA_CACHE_CHECK')) {//开启数据校验\n            $check  =  md5($data);\n        }else {\n            $check  =  '';\n        }\n        $data    = \"<?php\\n//\".sprintf('%012d',$expire).$check.$data.\"\\n?>\";\n        $result  =   file_put_contents($filename,$data);\n        if($result) {\n            if($this->options['length']>0) {\n                // 记录缓存队列\n                $this->queue($name);\n            }\n            clearstatcache();\n            return true;\n        }else {\n            return false;\n        }\n    }\n\n    /**\n     * 删除缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return boolean\n     */\n    public function rm($name) {\n        return unlink($this->filename($name));\n    }\n\n    /**\n     * 清除缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return boolean\n     */\n    public function clear() {\n        $path   =  $this->options['temp'];\n        $files  =   scandir($path);\n        if($files){\n            foreach($files as $file){\n                if ($file != '.' && $file != '..' && is_dir($path.$file) ){\n                    array_map( 'unlink', glob( $path.$file.'/*.*' ) );\n                }elseif(is_file($path.$file)){\n                    unlink( $path . $file );\n                }\n            }\n            return true;\n        }\n        return false;\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Cache/Driver/Memcache.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Cache\\Driver;\nuse Think\\Cache;\ndefined('THINK_PATH') or exit();\n/**\n * Memcache缓存驱动\n */\nclass Memcache extends Cache {\n\n    /**\n     * 架构函数\n     * @param array $options 缓存参数\n     * @access public\n     */\n    function __construct($options=array()) {\n        if ( !extension_loaded('memcache') ) {\n            E(L('_NOT_SUPPORT_').':memcache');\n        }\n\n        $options = array_merge(array (\n            'host'        =>  C('MEMCACHE_HOST') ? : '127.0.0.1',\n            'port'        =>  C('MEMCACHE_PORT') ? : 11211,\n            'timeout'     =>  C('DATA_CACHE_TIMEOUT') ? : false,\n            'persistent'  =>  false,\n        ),$options);\n\n        $this->options      =   $options;\n        $this->options['expire'] =  isset($options['expire'])?  $options['expire']  :   C('DATA_CACHE_TIME');\n        $this->options['prefix'] =  isset($options['prefix'])?  $options['prefix']  :   C('DATA_CACHE_PREFIX');        \n        $this->options['length'] =  isset($options['length'])?  $options['length']  :   0;        \n        $func               =   $options['persistent'] ? 'pconnect' : 'connect';\n        $this->handler      =   new \\Memcache;\n        $options['timeout'] === false ?\n            $this->handler->$func($options['host'], $options['port']) :\n            $this->handler->$func($options['host'], $options['port'], $options['timeout']);\n    }\n\n    /**\n     * 读取缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return mixed\n     */\n    public function get($name) {\n        N('cache_read',1);\n        return $this->handler->get($this->options['prefix'].$name);\n    }\n\n    /**\n     * 写入缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @param mixed $value  存储数据\n     * @param integer $expire  有效时间（秒）\n     * @return boolean\n     */\n    public function set($name, $value, $expire = null) {\n        N('cache_write',1);\n        if(is_null($expire)) {\n            $expire  =  $this->options['expire'];\n        }\n        $name   =   $this->options['prefix'].$name;\n        if($this->handler->set($name, $value, 0, $expire)) {\n            if($this->options['length']>0) {\n                // 记录缓存队列\n                $this->queue($name);\n            }\n            return true;\n        }\n        return false;\n    }\n\n    /**\n     * 删除缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return boolean\n     */\n    public function rm($name, $ttl = false) {\n        $name   =   $this->options['prefix'].$name;\n        return $ttl === false ?\n            $this->handler->delete($name) :\n            $this->handler->delete($name, $ttl);\n    }\n\n    /**\n     * 清除缓存\n     * @access public\n     * @return boolean\n     */\n    public function clear() {\n        return $this->handler->flush();\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Cache/Driver/Memcached.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2013 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: 何辉 <runphp@qq.com>\n// +----------------------------------------------------------------------\n\nnamespace Think\\Cache\\Driver;\n\nuse Memcached as MemcachedResource;\nuse Think\\Cache;\n\n/**\n * Memcached缓存驱动\n */\nclass Memcached extends Cache {\n\n    /**\n     *\n     * @param array $options\n     */\n    public function __construct($options = array()) {\n        if ( !extension_loaded('memcached') ) {\n            E(L('_NOT_SUPPORT_').':memcached');\n        }\n\n        $options = array_merge(array(\n            'servers'       =>  C('MEMCACHED_SERVER') ? : null,\n            'lib_options'   =>  C('MEMCACHED_LIB') ? : null\n        ), $options);\n\n        $this->options      =   $options;\n        $this->options['expire'] =  isset($options['expire'])?  $options['expire']  :   C('DATA_CACHE_TIME');\n        $this->options['prefix'] =  isset($options['prefix'])?  $options['prefix']  :   C('DATA_CACHE_PREFIX');\n        $this->options['length'] =  isset($options['length'])?  $options['length']  :   0;\n\n        $this->handler      =   new MemcachedResource;\n        $options['servers'] && $this->handler->addServers($options['servers']);\n        $options['lib_options'] && $this->handler->setOptions($options['lib_options']);\n    }\n\n    /**\n     * 读取缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return mixed\n     */\n    public function get($name) {\n        N('cache_read',1);\n        return $this->handler->get($this->options['prefix'].$name);\n    }\n\n    /**\n     * 写入缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @param mixed $value  存储数据\n     * @param integer $expire  有效时间（秒）\n     * @return boolean\n     */\n    public function set($name, $value, $expire = null) {\n        N('cache_write',1);\n        if(is_null($expire)) {\n            $expire  =  $this->options['expire'];\n        }\n        $name   =   $this->options['prefix'].$name;\n        if($this->handler->set($name, $value, time() + $expire)) {\n            if($this->options['length']>0) {\n                // 记录缓存队列\n                $this->queue($name);\n            }\n            return true;\n        }\n        return false;\n    }\n\n    /**\n     * 删除缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return boolean\n     */\n    public function rm($name, $ttl = false) {\n        $name   =   $this->options['prefix'].$name;\n        return $ttl === false ?\n        $this->handler->delete($name) :\n        $this->handler->delete($name, $ttl);\n    }\n\n    /**\n     * 清除缓存\n     * @access public\n     * @return boolean\n     */\n    public function clear() {\n        return $this->handler->flush();\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Cache/Driver/Memcachesae.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2012 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Cache\\Driver;\nuse Think\\Cache;\n\ndefined('THINK_PATH') or exit();\n/**\n * Memcache缓存驱动\n * @category   Extend\n * @package  Extend\n * @subpackage  Driver.Cache\n * @author    liu21st <liu21st@gmail.com>\n */\nclass Memcachesae extends Cache {\n\n    /**\n     * 架构函数\n     * @param array $options 缓存参数\n     * @access public\n     */\n    function __construct($options=array()) {\n        $options = array_merge(array (\n            'host'        =>  C('MEMCACHE_HOST') ? : '127.0.0.1',\n            'port'        =>  C('MEMCACHE_PORT') ? : 11211,\n            'timeout'     =>  C('DATA_CACHE_TIMEOUT') ? : false,\n            'persistent'  =>  false,\n        ),$options);\n\n        $this->options      =   $options;\n        $this->options['expire'] =  isset($options['expire'])?  $options['expire']  :   C('DATA_CACHE_TIME');\n        $this->options['prefix'] =  isset($options['prefix'])?  $options['prefix']  :   C('DATA_CACHE_PREFIX');\n        $this->options['length'] =  isset($options['length'])?  $options['length']  :   0;\n         $this->handler      =  memcache_init();//[sae] 下实例化\n        //[sae] 下不用链接\n        $this->connected=true;\n    }\n\n    /**\n     * 是否连接\n     * @access private\n     * @return boolean\n     */\n    private function isConnected() {\n        return $this->connected;\n    }\n\n    /**\n     * 读取缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return mixed\n     */\n    public function get($name) {\n        N('cache_read',1);\n        return $this->handler->get($_SERVER['HTTP_APPVERSION'].'/'.$this->options['prefix'].$name);\n    }\n\n    /**\n     * 写入缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @param mixed $value  存储数据\n     * @param integer $expire  有效时间（秒）\n     * @return boolean\n     */\n    public function set($name, $value, $expire = null) {\n        N('cache_write',1);\n        if(is_null($expire)) {\n            $expire  =  $this->options['expire'];\n        }\n        $name   =   $this->options['prefix'].$name;\n        if($this->handler->set($_SERVER['HTTP_APPVERSION'].'/'.$name, $value, 0, $expire)) {\n            if($this->options['length']>0) {\n                // 记录缓存队列\n                $this->queue($name);\n            }\n            return true;\n        }\n        return false;\n    }\n\n    /**\n     * 删除缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return boolean\n     */\n    public function rm($name, $ttl = false) {\n        $name   =   $_SERVER['HTTP_APPVERSION'].'/'.$this->options['prefix'].$name;\n        return $ttl === false ?\n            $this->handler->delete($name) :\n            $this->handler->delete($name, $ttl);\n    }\n\n    /**\n     * 清除缓存\n     * @access public\n     * @return boolean\n     */\n    public function clear() {\n        return $this->handler->flush();\n    }\n\n    /**\n     * 队列缓存\n     * @access protected\n     * @param string $key 队列名\n     * @return mixed\n     */\n    //[sae] 下重写queque队列缓存方法\n    protected function queue($key) {\n        $queue_name=isset($this->options['queue_name'])?$this->options['queue_name']:'think_queue';\n        $value  =  F($queue_name);\n        if(!$value) {\n            $value   =  array();\n        }\n        // 进列\n        if(false===array_search($key, $value)) array_push($value,$key);\n        if(count($value) > $this->options['length']) {\n            // 出列\n            $key =  array_shift($value);\n            // 删除缓存\n            $this->rm($key);\n            if (APP_DEBUG) {\n                    //调试模式下记录出队次数\n                        $counter = Think::instance('SaeCounter');\n                        if ($counter->exists($queue_name.'_out_times'))\n                            $counter->incr($queue_name.'_out_times');\n                        else\n                            $counter->create($queue_name.'_out_times', 1);\n           }\n        }\n        return F($queue_name,$value);\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Cache/Driver/Redis.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Cache\\Driver;\nuse Think\\Cache;\ndefined('THINK_PATH') or exit();\n\n/**\n * Redis缓存驱动 \n * 要求安装phpredis扩展：https://github.com/nicolasff/phpredis\n */\nclass Redis extends Cache {\n\t /**\n\t * 架构函数\n     * @param array $options 缓存参数\n     * @access public\n     */\n    public function __construct($options=array()) {\n        if ( !extension_loaded('redis') ) {\n            E(L('_NOT_SUPPORT_').':redis');\n        }\n        $options = array_merge(array (\n            'host'          => C('REDIS_HOST') ? : '127.0.0.1',\n            'port'          => C('REDIS_PORT') ? : 6379,\n            'timeout'       => C('DATA_CACHE_TIMEOUT') ? : false,\n            'persistent'    => false,\n        ),$options);\n\n        $this->options =  $options;\n        $this->options['expire'] =  isset($options['expire'])?  $options['expire']  :   C('DATA_CACHE_TIME');\n        $this->options['prefix'] =  isset($options['prefix'])?  $options['prefix']  :   C('DATA_CACHE_PREFIX');        \n        $this->options['length'] =  isset($options['length'])?  $options['length']  :   0;        \n        $func = $options['persistent'] ? 'pconnect' : 'connect';\n        $this->handler  = new \\Redis;\n        $options['timeout'] === false ?\n            $this->handler->$func($options['host'], $options['port']) :\n            $this->handler->$func($options['host'], $options['port'], $options['timeout']);\n    }\n\n    /**\n     * 读取缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return mixed\n     */\n    public function get($name) {\n        N('cache_read',1);\n        $value = $this->handler->get($this->options['prefix'].$name);\n        $jsonData  = json_decode( $value, true );\n        return ($jsonData === NULL) ? $value : $jsonData;\t//检测是否为JSON数据 true 返回JSON解析数组, false返回源数据\n    }\n\n    /**\n     * 写入缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @param mixed $value  存储数据\n     * @param integer $expire  有效时间（秒）\n     * @return boolean\n     */\n    public function set($name, $value, $expire = null) {\n        N('cache_write',1);\n        if(is_null($expire)) {\n            $expire  =  $this->options['expire'];\n        }\n        $name   =   $this->options['prefix'].$name;\n        //对数组/对象数据进行缓存处理，保证数据完整性\n        $value  =  (is_object($value) || is_array($value)) ? json_encode($value) : $value;\n        if(is_int($expire) && $expire) {\n            $result = $this->handler->setex($name, $expire, $value);\n        }else{\n            $result = $this->handler->set($name, $value);\n        }\n        if($result && $this->options['length']>0) {\n            // 记录缓存队列\n            $this->queue($name);\n        }\n        return $result;\n    }\n\n    /**\n     * 删除缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return boolean\n     */\n    public function rm($name) {\n        return $this->handler->delete($this->options['prefix'].$name);\n    }\n\n    /**\n     * 清除缓存\n     * @access public\n     * @return boolean\n     */\n    public function clear() {\n        return $this->handler->flushDB();\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Cache/Driver/Shmop.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Cache\\Driver;\nuse Think\\Cache;\ndefined('THINK_PATH') or exit();\n/**\n * Shmop缓存驱动 \n */\nclass Shmop extends Cache {\n\n    /**\n     * 架构函数\n     * @param array $options 缓存参数\n     * @access public\n     */\n    public function __construct($options=array()) {\n        if ( !extension_loaded('shmop') ) {\n            E(L('_NOT_SUPPORT_').':shmop');\n        }\n        if(!empty($options)){\n            $options = array(\n                'size'      => C('SHARE_MEM_SIZE'),\n                'temp'      => TEMP_PATH,\n                'project'   => 's',\n                'length'    =>  0,\n                );\n        }\n        $this->options = $options;\n        $this->options['prefix'] =  isset($options['prefix'])?  $options['prefix']  :   C('DATA_CACHE_PREFIX');        \n        $this->options['length'] =  isset($options['length'])?  $options['length']  :   0;        \n        $this->handler = $this->_ftok($this->options['project']);\n    }\n\n    /**\n     * 读取缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return mixed\n     */\n    public function get($name = false) {\n        N('cache_read',1);\n        $id = shmop_open($this->handler, 'c', 0600, 0);\n        if ($id !== false) {\n            $ret = unserialize(shmop_read($id, 0, shmop_size($id)));\n            shmop_close($id);\n\n            if ($name === false) {\n                return $ret;\n            }\n            $name   =   $this->options['prefix'].$name;\n            if(isset($ret[$name])) {\n                $content   =  $ret[$name];\n                if(C('DATA_CACHE_COMPRESS') && function_exists('gzcompress')) {\n                    //启用数据压缩\n                    $content   =   gzuncompress($content);\n                }\n                return $content;\n            }else {\n                return null;\n            }\n        }else {\n            return false;\n        }\n    }\n\n    /**\n     * 写入缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @param mixed $value  存储数据\n     * @return boolean\n     */\n    public function set($name, $value) {\n        N('cache_write',1);\n        $lh = $this->_lock();\n        $val = $this->get();\n        if (!is_array($val)) $val = array();\n        if( C('DATA_CACHE_COMPRESS') && function_exists('gzcompress')) {\n            //数据压缩\n            $value   =   gzcompress($value,3);\n        }\n        $name   =   $this->options['prefix'].$name;\n        $val[$name] = $value;\n        $val = serialize($val);\n        if($this->_write($val, $lh)) {\n            if($this->options['length']>0) {\n                // 记录缓存队列\n                $this->queue($name);\n            }\n            return true;\n        }\n        return false;\n    }\n\n    /**\n     * 删除缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return boolean\n     */\n    public function rm($name) {\n        $lh = $this->_lock();\n        $val = $this->get();\n        if (!is_array($val)) $val = array();\n        $name   =   $this->options['prefix'].$name;\n        unset($val[$name]);\n        $val = serialize($val);\n        return $this->_write($val, $lh);\n    }\n\n    /**\n     * 生成IPC key\n     * @access private\n     * @param string $project 项目标识名\n     * @return integer\n     */\n    private function _ftok($project) {\n        if (function_exists('ftok'))   return ftok(__FILE__, $project);\n        if(strtoupper(PHP_OS) == 'WINNT'){\n            $s = stat(__FILE__);\n            return sprintf(\"%u\", (($s['ino'] & 0xffff) | (($s['dev'] & 0xff) << 16) |\n            (($project & 0xff) << 24)));\n        }else {\n            $filename = __FILE__ . (string) $project;\n            for($key = array(); sizeof($key) < strlen($filename); $key[] = ord(substr($filename, sizeof($key), 1)));\n            return dechex(array_sum($key));\n        }\n    }\n\n    /**\n     * 写入操作\n     * @access private\n     * @param string $name 缓存变量名\n     * @return integer|boolean\n     */\n    private function _write(&$val, &$lh) {\n        $id  = shmop_open($this->handler, 'c', 0600, $this->options['size']);\n        if ($id) {\n           $ret = shmop_write($id, $val, 0) == strlen($val);\n           shmop_close($id);\n           $this->_unlock($lh);\n           return $ret;\n        }\n        $this->_unlock($lh);\n        return false;\n    }\n\n    /**\n     * 共享锁定\n     * @access private\n     * @param string $name 缓存变量名\n     * @return boolean\n     */\n    private function _lock() {\n        if (function_exists('sem_get')) {\n            $fp = sem_get($this->handler, 1, 0600, 1);\n            sem_acquire ($fp);\n        } else {\n            $fp = fopen($this->options['temp'].$this->options['prefix'].md5($this->handler), 'w');\n            flock($fp, LOCK_EX);\n        }\n        return $fp;\n    }\n\n    /**\n     * 解除共享锁定\n     * @access private\n     * @param string $name 缓存变量名\n     * @return boolean\n     */\n    private function _unlock(&$fp) {\n        if (function_exists('sem_release')) {\n            sem_release($fp);\n        } else {\n            fclose($fp);\n        }\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Cache/Driver/Sqlite.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Cache\\Driver;\nuse Think\\Cache;\ndefined('THINK_PATH') or exit();\n/**\n * Sqlite缓存驱动\n */\nclass Sqlite extends Cache {\n\n    /**\n     * 架构函数\n     * @param array $options 缓存参数\n     * @access public\n     */\n    public function __construct($options=array()) {\n        if ( !extension_loaded('sqlite') ) {\n            E(L('_NOT_SUPPORT_').':sqlite');\n        }\n        if(empty($options)) {\n            $options = array (\n                'db'        =>  ':memory:',\n                'table'     =>  'sharedmemory',\n            );\n        }\n        $this->options  =   $options;      \n        $this->options['prefix']    =   isset($options['prefix'])?  $options['prefix']  :   C('DATA_CACHE_PREFIX');\n        $this->options['length']    =   isset($options['length'])?  $options['length']  :   0;        \n        $this->options['expire']    =   isset($options['expire'])?  $options['expire']  :   C('DATA_CACHE_TIME');\n        \n        $func = $this->options['persistent'] ? 'sqlite_popen' : 'sqlite_open';\n        $this->handler      = $func($this->options['db']);\n    }\n\n    /**\n     * 读取缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return mixed\n     */\n    public function get($name) {\n        N('cache_read',1);\n\t\t$name   = $this->options['prefix'].sqlite_escape_string($name);\n        $sql    = 'SELECT value FROM '.$this->options['table'].' WHERE var=\\''.$name.'\\' AND (expire=0 OR expire >'.time().') LIMIT 1';\n        $result = sqlite_query($this->handler, $sql);\n        if (sqlite_num_rows($result)) {\n            $content   =  sqlite_fetch_single($result);\n            if(C('DATA_CACHE_COMPRESS') && function_exists('gzcompress')) {\n                //启用数据压缩\n                $content   =   gzuncompress($content);\n            }\n            return unserialize($content);\n        }\n        return false;\n    }\n\n    /**\n     * 写入缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @param mixed $value  存储数据\n     * @param integer $expire  有效时间（秒）\n     * @return boolean\n     */\n    public function set($name, $value,$expire=null) {\n        N('cache_write',1);\n        $name  = $this->options['prefix'].sqlite_escape_string($name);\n        $value = sqlite_escape_string(serialize($value));\n        if(is_null($expire)) {\n            $expire  =  $this->options['expire'];\n        }\n        $expire\t=\t($expire==0)?0: (time()+$expire) ;//缓存有效期为0表示永久缓存\n        if( C('DATA_CACHE_COMPRESS') && function_exists('gzcompress')) {\n            //数据压缩\n            $value   =   gzcompress($value,3);\n        }\n        $sql  = 'REPLACE INTO '.$this->options['table'].' (var, value,expire) VALUES (\\''.$name.'\\', \\''.$value.'\\', \\''.$expire.'\\')';\n        if(sqlite_query($this->handler, $sql)){\n            if($this->options['length']>0) {\n                // 记录缓存队列\n                $this->queue($name);\n            }\n            return true;\n        }\n        return false;\n    }\n\n    /**\n     * 删除缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return boolean\n     */\n    public function rm($name) {\n        $name  = $this->options['prefix'].sqlite_escape_string($name);\n        $sql  = 'DELETE FROM '.$this->options['table'].' WHERE var=\\''.$name.'\\'';\n        sqlite_query($this->handler, $sql);\n        return true;\n    }\n\n    /**\n     * 清除缓存\n     * @access public\n     * @return boolean\n     */\n    public function clear() {\n        $sql  = 'DELETE FROM '.$this->options['table'];\n        sqlite_query($this->handler, $sql);\n        return ;\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Cache/Driver/Wincache.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Cache\\Driver;\nuse Think\\Cache;\ndefined('THINK_PATH') or exit();\n/**\n * Wincache缓存驱动\n */\nclass Wincache extends Cache {\n\n    /**\n     * 架构函数\n     * @param array $options 缓存参数\n     * @access public\n     */\n    public function __construct($options=array()) {\n        if ( !function_exists('wincache_ucache_info') ) {\n            E(L('_NOT_SUPPORT_').':WinCache');\n        }\n        $this->options['expire']    =   isset($options['expire'])?  $options['expire']  :   C('DATA_CACHE_TIME');\n        $this->options['prefix']    =   isset($options['prefix'])?  $options['prefix']  :   C('DATA_CACHE_PREFIX');\n        $this->options['length']    =   isset($options['length'])?  $options['length']  :   0;\n    }\n\n    /**\n     * 读取缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return mixed\n     */\n    public function get($name) {\n        N('cache_read',1);\n        $name   =   $this->options['prefix'].$name;\n        return wincache_ucache_exists($name)? wincache_ucache_get($name) : false;\n    }\n\n    /**\n     * 写入缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @param mixed $value  存储数据\n     * @param integer $expire  有效时间（秒）\n     * @return boolean\n     */\n    public function set($name, $value,$expire=null) {\n        N('cache_write',1);\n        if(is_null($expire)) {\n            $expire  =  $this->options['expire'];\n        }\n        $name   =   $this->options['prefix'].$name;\n        if(wincache_ucache_set($name, $value, $expire)) {\n            if($this->options['length']>0) {\n                // 记录缓存队列\n                $this->queue($name);\n            }\n            return true;\n        }\n        return false;\n    }\n\n    /**\n     * 删除缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return boolean\n     */\n    public function rm($name) {\n        return wincache_ucache_delete($this->options['prefix'].$name);\n    }\n\n    /**\n     * 清除缓存\n     * @access public\n     * @return boolean\n     */\n    public function clear() {\n        return wincache_ucache_clear();\n    }    \n\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Cache/Driver/Xcache.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Cache\\Driver;\nuse Think\\Cache;\ndefined('THINK_PATH') or exit();\n/**\n * Xcache缓存驱动\n */\nclass Xcache extends Cache {\n\n    /**\n     * 架构函数\n     * @param array $options 缓存参数\n     * @access public\n     */\n    public function __construct($options=array()) {\n        if ( !function_exists('xcache_info') ) {\n            E(L('_NOT_SUPPORT_').':Xcache');\n        }\n        $this->options['expire']    =   isset($options['expire'])?$options['expire']:C('DATA_CACHE_TIME');\n        $this->options['prefix']    =   isset($options['prefix'])?$options['prefix']:C('DATA_CACHE_PREFIX');\n        $this->options['length']    =   isset($options['length'])?$options['length']:0;\n    }\n\n    /**\n     * 读取缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return mixed\n     */\n    public function get($name) {\n        N('cache_read',1);\n        $name   =   $this->options['prefix'].$name;\n        if (xcache_isset($name)) {\n            return xcache_get($name);\n        }\n        return false;\n    }\n\n    /**\n     * 写入缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @param mixed $value  存储数据\n     * @param integer $expire  有效时间（秒）\n     * @return boolean\n     */\n    public function set($name, $value,$expire=null) {\n        N('cache_write',1);\n        if(is_null($expire)) {\n            $expire = $this->options['expire'] ;\n        }\n        $name   =   $this->options['prefix'].$name;\n        if(xcache_set($name, $value, $expire)) {\n            if($this->options['length']>0) {\n                // 记录缓存队列\n                $this->queue($name);\n            }\n            return true;\n        }\n        return false;\n    }\n\n    /**\n     * 删除缓存\n     * @access public\n     * @param string $name 缓存变量名\n     * @return boolean\n     */\n    public function rm($name) {\n        return xcache_unset($this->options['prefix'].$name);\n    }\n\n    /**\n     * 清除缓存\n     * @access public\n     * @return boolean\n     */\n    public function clear() {\n        return xcache_clear_cache(1, -1);\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Cache.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * 缓存管理类\n */\nclass Cache {\n\n    /**\n     * 操作句柄\n     * @var string\n     * @access protected\n     */\n    protected $handler    ;\n\n    /**\n     * 缓存连接参数\n     * @var integer\n     * @access protected\n     */\n    protected $options = array();\n\n    /**\n     * 连接缓存\n     * @access public\n     * @param string $type 缓存类型\n     * @param array $options  配置数组\n     * @return object\n     */\n    public function connect($type='',$options=array()) {\n        if(empty($type))  $type = C('DATA_CACHE_TYPE');\n        $class  =   strpos($type,'\\\\')? $type : 'Think\\\\Cache\\\\Driver\\\\'.ucwords(strtolower($type));            \n        if(class_exists($class))\n            $cache = new $class($options);\n        else\n            E(L('_CACHE_TYPE_INVALID_').':'.$type);\n        return $cache;\n    }\n\n    /**\n     * 取得缓存类实例\n     * @static\n     * @access public\n     * @return mixed\n     */\n    static function getInstance($type='',$options=array()) {\n\t\tstatic $_instance\t=\tarray();\n\t\t$guid\t=\t$type.to_guid_string($options);\n\t\tif(!isset($_instance[$guid])){\n\t\t\t$obj\t=\tnew Cache();\n\t\t\t$_instance[$guid]\t=\t$obj->connect($type,$options);\n\t\t}\n\t\treturn $_instance[$guid];\n    }\n\n    public function __get($name) {\n        return $this->get($name);\n    }\n\n    public function __set($name,$value) {\n        return $this->set($name,$value);\n    }\n\n    public function __unset($name) {\n        $this->rm($name);\n    }\n    public function setOptions($name,$value) {\n        $this->options[$name]   =   $value;\n    }\n\n    public function getOptions($name) {\n        return $this->options[$name];\n    }\n\n    /**\n     * 队列缓存\n     * @access protected\n     * @param string $key 队列名\n     * @return mixed\n     */\n    // \n    protected function queue($key) {\n        static $_handler = array(\n            'file'  =>  array('F','F'),\n            'xcache'=>  array('xcache_get','xcache_set'),\n            'apc'   =>  array('apc_fetch','apc_store'),\n        );\n        $queue      =   isset($this->options['queue'])?$this->options['queue']:'file';\n        $fun        =   isset($_handler[$queue])?$_handler[$queue]:$_handler['file'];\n        $queue_name =   isset($this->options['queue_name'])?$this->options['queue_name']:'think_queue';\n        $value      =   $fun[0]($queue_name);\n        if(!$value) {\n            $value  =   array();\n        }\n        // 进列\n        if(false===array_search($key, $value))  array_push($value,$key);\n        if(count($value) > $this->options['length']) {\n            // 出列\n            $key =  array_shift($value);\n            // 删除缓存\n            $this->rm($key);\n             if(APP_DEBUG){\n                //调试模式下，记录出列次数\n                N($queue_name.'_out_times',1);\n            }\n        }\n        return $fun[1]($queue_name,$value);\n    }\n    \n    public function __call($method,$args){\n        //调用缓存类型自己的方法\n        if(method_exists($this->handler, $method)){\n           return call_user_func_array(array($this->handler,$method), $args);\n        }else{\n            E(__CLASS__.':'.$method.L('_METHOD_NOT_EXIST_'));\n            return;\n        }\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Controller/HproseController.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Controller;\n/**\n * ThinkPHP Hprose控制器类\n */\nclass HproseController {\n\n    protected $allowMethodList  =   '';\n    protected $crossDomain      =   false;\n    protected $P3P              =   false;\n    protected $get              =   true;\n    protected $debug            =   false;\n\n   /**\n     * 架构函数\n     * @access public\n     */\n    public function __construct() {\n        //控制器初始化\n        if(method_exists($this,'_initialize'))\n            $this->_initialize();\n        //导入类库\n        Vendor('Hprose.HproseHttpServer');\n        //实例化HproseHttpServer\n        $server     =   new \\HproseHttpServer();\n        if($this->allowMethodList){\n            $methods    =   $this->allowMethodList;\n        }else{\n            $methods    =   get_class_methods($this);\n            $methods    =   array_diff($methods,array('__construct','__call','_initialize'));   \n        }\n        $server->addMethods($methods,$this);\n        if(APP_DEBUG || $this->debug ) {\n            $server->setDebugEnabled(true);\n        }\n        // Hprose设置\n        $server->setCrossDomainEnabled($this->crossDomain);\n        $server->setP3PEnabled($this->P3P);\n        $server->setGetEnabled($this->get);\n        // 启动server\n        $server->start();\n    }\n\n    /**\n     * 魔术方法 有不存在的操作的时候执行\n     * @access public\n     * @param string $method 方法名\n     * @param array $args 参数\n     * @return mixed\n     */\n    public function __call($method,$args){}\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Controller/JsonRpcController.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Controller;\n/**\n * ThinkPHP JsonRPC控制器类\n */\nclass JsonRpcController {\n\n   /**\n     * 架构函数\n     * @access public\n     */\n    public function __construct() {\n        //控制器初始化\n        if(method_exists($this,'_initialize'))\n            $this->_initialize();\n        //导入类库\n        Vendor('jsonRPC.jsonRPCServer');\n        // 启动server\n        \\jsonRPCServer::handle($this);\n    }\n\n    /**\n     * 魔术方法 有不存在的操作的时候执行\n     * @access public\n     * @param string $method 方法名\n     * @param array $args 参数\n     * @return mixed\n     */\n    public function __call($method,$args){}\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Controller/RestController.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Controller;\nuse Think\\Controller;\n/**\n * ThinkPHP REST控制器类\n */\nclass RestController extends Controller {\n    // 当前请求类型\n    protected   $_method        =   ''; \n    // 当前请求的资源类型\n    protected   $_type          =   ''; \n    // REST允许的请求类型列表\n    protected   $allowMethod    =   array('get','post','put','delete'); \n    // REST默认请求类型\n    protected   $defaultMethod  =   'get';\n    // REST允许请求的资源类型列表\n    protected   $allowType      =   array('html','xml','json','rss'); \n    // 默认的资源类型\n    protected   $defaultType    =   'html';\n    // REST允许输出的资源类型列表\n    protected   $allowOutputType=   array(  \n                    'xml' => 'application/xml',\n                    'json' => 'application/json',\n                    'html' => 'text/html',\n                );\n\n   /**\n     * 架构函数\n     * @access public\n     */\n    public function __construct() {\n        // 资源类型检测\n        if(''==__EXT__) { // 自动检测资源类型\n            $this->_type   =  $this->getAcceptType();\n        }elseif(!in_array(__EXT__,$this->allowType)) {\n            // 资源类型非法 则用默认资源类型访问\n            $this->_type   =  $this->defaultType;\n        }else{\n            $this->_type   =  __EXT__ ;\n        }\n\n        // 请求方式检测\n        $method  =  strtolower(REQUEST_METHOD);\n        if(!in_array($method,$this->allowMethod)) {\n            // 请求方式非法 则用默认请求方法\n            $method = $this->defaultMethod;\n        }\n        $this->_method = $method;\n        \n        parent::__construct();\n    }\n\n    /**\n     * 魔术方法 有不存在的操作的时候执行\n     * @access public\n     * @param string $method 方法名\n     * @param array $args 参数\n     * @return mixed\n     */\n    public function __call($method,$args) {\n        if( 0 === strcasecmp($method,ACTION_NAME.C('ACTION_SUFFIX'))) {\n            if(method_exists($this,$method.'_'.$this->_method.'_'.$this->_type)) { // RESTFul方法支持\n                $fun  =  $method.'_'.$this->_method.'_'.$this->_type;\n                $this->$fun();\n            }elseif($this->_method == $this->defaultMethod && method_exists($this,$method.'_'.$this->_type) ){\n                $fun  =  $method.'_'.$this->_type;\n                $this->$fun();\n            }elseif($this->_type == $this->defaultType && method_exists($this,$method.'_'.$this->_method) ){\n                $fun  =  $method.'_'.$this->_method;\n                $this->$fun();\n            }elseif(method_exists($this,'_empty')) {\n                // 如果定义了_empty操作 则调用\n                $this->_empty($method,$args);\n            }elseif(file_exists_case($this->view->parseTemplate())){\n                // 检查是否存在默认模版 如果有直接输出模版\n                $this->display();\n            }else{\n                E(L('_ERROR_ACTION_').':'.ACTION_NAME);\n            }\n        }\n    }\n\n    /**\n     * 获取当前请求的Accept头信息\n     * @return string\n     */\n    protected function getAcceptType(){\n        $type = array(\n            'xml'   =>  'application/xml,text/xml,application/x-xml',\n            'json'  =>  'application/json,text/x-json,application/jsonrequest,text/json',\n            'js'    =>  'text/javascript,application/javascript,application/x-javascript',\n            'css'   =>  'text/css',\n            'rss'   =>  'application/rss+xml',\n            'yaml'  =>  'application/x-yaml,text/yaml',\n            'atom'  =>  'application/atom+xml',\n            'pdf'   =>  'application/pdf',\n            'text'  =>  'text/plain',\n            'png'   =>  'image/png',\n            'jpg'   =>  'image/jpg,image/jpeg,image/pjpeg',\n            'gif'   =>  'image/gif',\n            'csv'   =>  'text/csv',\n            'html'  =>  'text/html,application/xhtml+xml,*/*'\n        );\n        \n        foreach($type as $key=>$val){\n            $array   =  explode(',',$val);\n            foreach($array as $k=>$v){\n                if(stristr($_SERVER['HTTP_ACCEPT'], $v)) {\n                    return $key;\n                }\n            }\n        }\n        return false;\n    }\n\n    // 发送Http状态信息\n    protected function sendHttpStatus($code) {\n        static $_status = array(\n            // Informational 1xx\n            100 => 'Continue',\n            101 => 'Switching Protocols',\n            // Success 2xx\n            200 => 'OK',\n            201 => 'Created',\n            202 => 'Accepted',\n            203 => 'Non-Authoritative Information',\n            204 => 'No Content',\n            205 => 'Reset Content',\n            206 => 'Partial Content',\n            // Redirection 3xx\n            300 => 'Multiple Choices',\n            301 => 'Moved Permanently',\n            302 => 'Moved Temporarily ',  // 1.1\n            303 => 'See Other',\n            304 => 'Not Modified',\n            305 => 'Use Proxy',\n            // 306 is deprecated but reserved\n            307 => 'Temporary Redirect',\n            // Client Error 4xx\n            400 => 'Bad Request',\n            401 => 'Unauthorized',\n            402 => 'Payment Required',\n            403 => 'Forbidden',\n            404 => 'Not Found',\n            405 => 'Method Not Allowed',\n            406 => 'Not Acceptable',\n            407 => 'Proxy Authentication Required',\n            408 => 'Request Timeout',\n            409 => 'Conflict',\n            410 => 'Gone',\n            411 => 'Length Required',\n            412 => 'Precondition Failed',\n            413 => 'Request Entity Too Large',\n            414 => 'Request-URI Too Long',\n            415 => 'Unsupported Media Type',\n            416 => 'Requested Range Not Satisfiable',\n            417 => 'Expectation Failed',\n            // Server Error 5xx\n            500 => 'Internal Server Error',\n            501 => 'Not Implemented',\n            502 => 'Bad Gateway',\n            503 => 'Service Unavailable',\n            504 => 'Gateway Timeout',\n            505 => 'HTTP Version Not Supported',\n            509 => 'Bandwidth Limit Exceeded'\n        );\n        if(isset($_status[$code])) {\n            header('HTTP/1.1 '.$code.' '.$_status[$code]);\n            // 确保FastCGI模式下正常\n            header('Status:'.$code.' '.$_status[$code]);\n        }\n    }\n\n    /**\n     * 编码数据\n     * @access protected\n     * @param mixed $data 要返回的数据\n     * @param String $type 返回类型 JSON XML\n     * @return string\n     */\n    protected function encodeData($data,$type='') {\n        if(empty($data))  return '';\n        if('json' == $type) {\n            // 返回JSON数据格式到客户端 包含状态信息\n            $data = json_encode($data);\n        }elseif('xml' == $type){\n            // 返回xml格式数据\n            $data = xml_encode($data);\n        }elseif('php'==$type){\n            $data = serialize($data);\n        }// 默认直接输出\n        $this->setContentType($type);\n        //header('Content-Length: ' . strlen($data));\n        return $data;\n    }\n\n    /**\n     * 设置页面输出的CONTENT_TYPE和编码\n     * @access public\n     * @param string $type content_type 类型对应的扩展名\n     * @param string $charset 页面输出编码\n     * @return void\n     */\n    public function setContentType($type, $charset=''){\n        if(headers_sent()) return;\n        if(empty($charset))  $charset = C('DEFAULT_CHARSET');\n        $type = strtolower($type);\n        if(isset($this->allowOutputType[$type])) //过滤content_type\n            header('Content-Type: '.$this->allowOutputType[$type].'; charset='.$charset);\n    }\n\n    /**\n     * 输出返回数据\n     * @access protected\n     * @param mixed $data 要返回的数据\n     * @param String $type 返回类型 JSON XML\n     * @param integer $code HTTP状态\n     * @return void\n     */\n    protected function response($data,$type='',$code=200) {\n        $this->sendHttpStatus($code);\n        exit($this->encodeData($data,strtolower($type)));\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Controller/RpcController.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Controller;\n/**\n * ThinkPHP RPC控制器类\n */\nclass RpcController {\n\n    protected $allowMethodList  =   '';\n    protected $debug            =   false;\n\n   /**\n     * 架构函数\n     * @access public\n     */\n    public function __construct() {\n        //控制器初始化\n        if(method_exists($this,'_initialize'))\n            $this->_initialize();\n        //导入类库\n        Vendor('phpRPC.phprpc_server');\n        //实例化phprpc\n        $server     =   new \\PHPRPC_Server();\n        if($this->allowMethodList){\n            $methods    =   $this->allowMethodList;\n        }else{\n            $methods    =   get_class_methods($this);\n            $methods    =   array_diff($methods,array('__construct','__call','_initialize'));   \n        }\n        $server->add($methods,$this);\n\n        if(APP_DEBUG || $this->debug ) {\n            $server->setDebugMode(true);\n        }\n        $server->setEnableGZIP(true);\n        $server->start();\n        echo $server->comment();\n    }\n\n    /**\n     * 魔术方法 有不存在的操作的时候执行\n     * @access public\n     * @param string $method 方法名\n     * @param array $args 参数\n     * @return mixed\n     */\n    public function __call($method,$args){}\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Controller/YarController.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Controller;\n/**\n * ThinkPHP Yar控制器类\n */\nclass YarController {\n\n   /**\n     * 架构函数\n     * @access public\n     */\n    public function __construct() {\n        //控制器初始化\n        if(method_exists($this,'_initialize'))\n            $this->_initialize();\n        //判断扩展是否存在\n        if(!extension_loaded('yar'))\n            E(L('_NOT_SUPPORT_').':yar');\n        //实例化Yar_Server\n        $server     =   new \\Yar_Server($this);\n        // 启动server\n        $server->handle();\n    }\n\n    /**\n     * 魔术方法 有不存在的操作的时候执行\n     * @access public\n     * @param string $method 方法名\n     * @param array $args 参数\n     * @return mixed\n     */\n    public function __call($method,$args){}\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Controller.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * ThinkPHP 控制器基类 抽象类\n */\nabstract class Controller {\n\n    /**\n     * 视图实例对象\n     * @var view\n     * @access protected\n     */    \n    protected $view     =  null;\n\n    /**\n     * 控制器参数\n     * @var config\n     * @access protected\n     */      \n    protected $config   =   array();\n\n   /**\n     * 架构函数 取得模板对象实例\n     * @access public\n     */\n    public function __construct() {\n        Hook::listen('action_begin',$this->config);\n        //实例化视图类\n        $this->view     = Think::instance('Think\\View');\n        //控制器初始化\n        if(method_exists($this,'_initialize'))\n            $this->_initialize();\n    }\n\n    /**\n     * 模板显示 调用内置的模板引擎显示方法，\n     * @access protected\n     * @param string $templateFile 指定要调用的模板文件\n     * 默认为空 由系统自动定位模板文件\n     * @param string $charset 输出编码\n     * @param string $contentType 输出类型\n     * @param string $content 输出内容\n     * @param string $prefix 模板缓存前缀\n     * @return void\n     */\n    protected function display($templateFile='',$charset='',$contentType='',$content='',$prefix='') {\n        $this->view->display($templateFile,$charset,$contentType,$content,$prefix);\n    }\n\n    /**\n     * 输出内容文本可以包括Html 并支持内容解析\n     * @access protected\n     * @param string $content 输出内容\n     * @param string $charset 模板输出字符集\n     * @param string $contentType 输出类型\n     * @param string $prefix 模板缓存前缀\n     * @return mixed\n     */\n    protected function show($content,$charset='',$contentType='',$prefix='') {\n        $this->view->display('',$charset,$contentType,$content,$prefix);\n    }\n\n    /**\n     *  获取输出页面内容\n     * 调用内置的模板引擎fetch方法，\n     * @access protected\n     * @param string $templateFile 指定要调用的模板文件\n     * 默认为空 由系统自动定位模板文件\n     * @param string $content 模板输出内容\n     * @param string $prefix 模板缓存前缀* \n     * @return string\n     */\n    protected function fetch($templateFile='',$content='',$prefix='') {\n        return $this->view->fetch($templateFile,$content,$prefix);\n    }\n\n    /**\n     *  创建静态页面\n     * @access protected\n     * @htmlfile 生成的静态文件名称\n     * @htmlpath 生成的静态文件路径\n     * @param string $templateFile 指定要调用的模板文件\n     * 默认为空 由系统自动定位模板文件\n     * @return string\n     */\n    protected function buildHtml($htmlfile='',$htmlpath='',$templateFile='') {\n        $content    =   $this->fetch($templateFile);\n        $htmlpath   =   !empty($htmlpath)?$htmlpath:HTML_PATH;\n        $htmlfile   =   $htmlpath.$htmlfile.C('HTML_FILE_SUFFIX');\n        Storage::put($htmlfile,$content,'html');\n        return $content;\n    }\n\n    /**\n     * 模板主题设置\n     * @access protected\n     * @param string $theme 模版主题\n     * @return Action\n     */\n    protected function theme($theme){\n        $this->view->theme($theme);\n        return $this;\n    }\n\n    /**\n     * 模板变量赋值\n     * @access protected\n     * @param mixed $name 要显示的模板变量\n     * @param mixed $value 变量的值\n     * @return Action\n     */\n    protected function assign($name,$value='') {\n        $this->view->assign($name,$value);\n        return $this;\n    }\n\n    public function __set($name,$value) {\n        $this->assign($name,$value);\n    }\n\n    /**\n     * 取得模板显示变量的值\n     * @access protected\n     * @param string $name 模板显示变量\n     * @return mixed\n     */\n    public function get($name='') {\n        return $this->view->get($name);      \n    }\n\n    public function __get($name) {\n        return $this->get($name);\n    }\n\n    /**\n     * 检测模板变量的值\n     * @access public\n     * @param string $name 名称\n     * @return boolean\n     */\n    public function __isset($name) {\n        return $this->get($name);\n    }\n\n    /**\n     * 魔术方法 有不存在的操作的时候执行\n     * @access public\n     * @param string $method 方法名\n     * @param array $args 参数\n     * @return mixed\n     */\n    public function __call($method,$args) {\n        if( 0 === strcasecmp($method,ACTION_NAME.C('ACTION_SUFFIX'))) {\n            if(method_exists($this,'_empty')) {\n                // 如果定义了_empty操作 则调用\n                $this->_empty($method,$args);\n            }elseif(file_exists_case($this->view->parseTemplate())){\n                // 检查是否存在默认模版 如果有直接输出模版\n                $this->display();\n            }else{\n                E(L('_ERROR_ACTION_').':'.ACTION_NAME);\n            }\n        }else{\n            E(__CLASS__.':'.$method.L('_METHOD_NOT_EXIST_'));\n            return;\n        }\n    }\n\n    /**\n     * 操作错误跳转的快捷方法\n     * @access protected\n     * @param string $message 错误信息\n     * @param string $jumpUrl 页面跳转地址\n     * @param mixed $ajax 是否为Ajax方式 当数字时指定跳转时间\n     * @return void\n     */\n    protected function error($message='',$jumpUrl='',$ajax=false) {\n        $this->dispatchJump($message,0,$jumpUrl,$ajax);\n    }\n\n    /**\n     * 操作成功跳转的快捷方法\n     * @access protected\n     * @param string $message 提示信息\n     * @param string $jumpUrl 页面跳转地址\n     * @param mixed $ajax 是否为Ajax方式 当数字时指定跳转时间\n     * @return void\n     */\n    protected function success($message='',$jumpUrl='',$ajax=false) {\n        $this->dispatchJump($message,1,$jumpUrl,$ajax);\n    }\n\n    /**\n     * Ajax方式返回数据到客户端\n     * @access protected\n     * @param mixed $data 要返回的数据\n     * @param String $type AJAX返回数据格式\n     * @param int $json_option 传递给json_encode的option参数\n     * @return void\n     */\n    protected function ajaxReturn($data,$type='',$json_option=0) {\n        if(empty($type)) $type  =   C('DEFAULT_AJAX_RETURN');\n        switch (strtoupper($type)){\n            case 'JSON' :\n                // 返回JSON数据格式到客户端 包含状态信息\n                header('Content-Type:application/json; charset=utf-8');\n                exit(json_encode($data,$json_option));\n            case 'XML'  :\n                // 返回xml格式数据\n                header('Content-Type:text/xml; charset=utf-8');\n                exit(xml_encode($data));\n            case 'JSONP':\n                // 返回JSON数据格式到客户端 包含状态信息\n                header('Content-Type:application/json; charset=utf-8');\n                $handler  =   isset($_GET[C('VAR_JSONP_HANDLER')]) ? $_GET[C('VAR_JSONP_HANDLER')] : C('DEFAULT_JSONP_HANDLER');\n                exit($handler.'('.json_encode($data,$json_option).');');  \n            case 'EVAL' :\n                // 返回可执行的js脚本\n                header('Content-Type:text/html; charset=utf-8');\n                exit($data);            \n            default     :\n                // 用于扩展其他返回格式数据\n                Hook::listen('ajax_return',$data);\n        }\n    }\n\n    /**\n     * Action跳转(URL重定向） 支持指定模块和延时跳转\n     * @access protected\n     * @param string $url 跳转的URL表达式\n     * @param array $params 其它URL参数\n     * @param integer $delay 延时跳转的时间 单位为秒\n     * @param string $msg 跳转提示信息\n     * @return void\n     */\n    protected function redirect($url,$params=array(),$delay=0,$msg='') {\n        $url    =   U($url,$params);\n        redirect($url,$delay,$msg);\n    }\n\n    /**\n     * 默认跳转操作 支持错误导向和正确跳转\n     * 调用模板显示 默认为public目录下面的success页面\n     * 提示页面为可配置 支持模板标签\n     * @param string $message 提示信息\n     * @param Boolean $status 状态\n     * @param string $jumpUrl 页面跳转地址\n     * @param mixed $ajax 是否为Ajax方式 当数字时指定跳转时间\n     * @access private\n     * @return void\n     */\n    private function dispatchJump($message,$status=1,$jumpUrl='',$ajax=false) {\n        if(true === $ajax || IS_AJAX) {// AJAX提交\n            $data           =   is_array($ajax)?$ajax:array();\n            $data['info']   =   $message;\n            $data['status'] =   $status;\n            $data['url']    =   $jumpUrl;\n            $this->ajaxReturn($data);\n        }\n        if(is_int($ajax)) $this->assign('waitSecond',$ajax);\n        if(!empty($jumpUrl)) $this->assign('jumpUrl',$jumpUrl);\n        // 提示标题\n        $this->assign('msgTitle',$status? L('_OPERATION_SUCCESS_') : L('_OPERATION_FAIL_'));\n        //如果设置了关闭窗口，则提示完毕后自动关闭窗口\n        if($this->get('closeWin'))    $this->assign('jumpUrl','javascript:window.close();');\n        $this->assign('status',$status);   // 状态\n        //保证输出不受静态缓存影响\n        C('HTML_CACHE_ON',false);\n        if($status) { //发送成功信息\n            $this->assign('message',$message);// 提示信息\n            // 成功操作后默认停留1秒\n            if(!isset($this->waitSecond))    $this->assign('waitSecond','1');\n            // 默认操作成功自动返回操作前页面\n            if(!isset($this->jumpUrl)) $this->assign(\"jumpUrl\",$_SERVER[\"HTTP_REFERER\"]);\n            $this->display(C('TMPL_ACTION_SUCCESS'));\n        }else{\n            $this->assign('error',$message);// 提示信息\n            //发生错误时候默认停留3秒\n            if(!isset($this->waitSecond))    $this->assign('waitSecond','3');\n            // 默认发生错误的话自动返回上页\n            if(!isset($this->jumpUrl)) $this->assign('jumpUrl',\"javascript:history.back(-1);\");\n            $this->display(C('TMPL_ACTION_ERROR'));\n            // 中止执行  避免出错后继续执行\n            exit ;\n        }\n    }\n\n   /**\n     * 析构方法\n     * @access public\n     */\n    public function __destruct() {\n        // 执行后续操作\n        Hook::listen('action_end');\n    }\n}\n// 设置控制器别名 便于升级\nclass_alias('Think\\Controller','Think\\Action');\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Crypt/Driver/Base64.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Crypt\\Driver;\n/**\n * Base64 加密实现类\n */\nclass Base64 {\n\n    /**\n     * 加密字符串\n     * @param string $str 字符串\n     * @param string $key 加密key\n     * @param integer $expire 有效期（秒）     \n     * @return string\n     */\n    public static function encrypt($data,$key,$expire=0) {\n        $expire = sprintf('%010d', $expire ? $expire + time():0);\n        $key    =   md5($key);\n        $data   =   base64_encode($expire.$data);\n        $x=0;\n\t\t$len = strlen($data);\n\t\t$l = strlen($key);\n        for ($i=0;$i< $len;$i++) {\n            if ($x== $l) $x=0;\n            $char   .=substr($key,$x,1);\n            $x++;\n        }\n\n        for ($i=0;$i< $len;$i++) {\n            $str    .=chr(ord(substr($data,$i,1))+(ord(substr($char,$i,1)))%256);\n        }\n        return $str;\n    }\n\n    /**\n     * 解密字符串\n     * @param string $str 字符串\n     * @param string $key 加密key\n     * @return string\n     */\n    public static function decrypt($data,$key) {\n        $key    =   md5($key);\n        $x=0;\n        $len = strlen($data);\n        $l = strlen($key);\n        for ($i=0;$i< $len;$i++) {\n            if ($x== $l) $x=0;\n            $char   .=substr($key,$x,1);\n            $x++;\n        }\n        for ($i=0;$i< $len;$i++) {\n            if (ord(substr($data,$i,1))<ord(substr($char,$i,1))) {\n                $str    .=chr((ord(substr($data,$i,1))+256)-ord(substr($char,$i,1)));\n            }else{\n                $str    .=chr(ord(substr($data,$i,1))-ord(substr($char,$i,1)));\n            }\n        }\n        $data = base64_decode($str);\n        $expire = substr($data,0,10);\n        if($expire > 0 && $expire < time()) {\n            return '';\n        }\n        $data   = substr($data,10);\n        return $data;\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Crypt/Driver/Crypt.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Crypt\\Driver;\n/**\n * Crypt 加密实现类\n * @category   ORG\n * @package  ORG\n * @subpackage  Crypt\n * @author    liu21st <liu21st@gmail.com>\n */\nclass Crypt {\n\n    /**\n     * 加密字符串\n     * @param string $str 字符串\n     * @param string $key 加密key\n     * @param integer $expire 有效期（秒）     \n     * @return string\n     */\n    public static function encrypt($str,$key,$expire=0){\n        $expire = sprintf('%010d', $expire ? $expire + time():0);\n        $r = md5($key);\n        $c = 0;\n        $v = \"\";\n        $str    =   $expire.$str;\n\t\t$len = strlen($str);\n\t\t$l = strlen($r);\n        for ($i=0;$i<$len;$i++){\n         if ($c== $l) $c=0;\n         $v .= substr($r,$c,1) .\n             (substr($str,$i,1) ^ substr($r,$c,1));\n         $c++;\n        }\n        return self::ed($v,$key);\n    }\n\n    /**\n     * 解密字符串\n     * @param string $str 字符串\n     * @param string $key 加密key\n     * @return string\n     */\n    public static function decrypt($str,$key) {\n        $str = self::ed($str,$key);\n        $v = \"\";\n\t\t$len = strlen($str);\n        for ($i=0;$i<$len;$i++){\n         $md5 = substr($str,$i,1);\n         $i++;\n         $v .= (substr($str,$i,1) ^ $md5);\n        }\n        $data   =    $v;\n        $expire = substr($data,0,10);\n        if($expire > 0 && $expire < time()) {\n            return '';\n        }\n        $data   = substr($data,10);\n        return $data;\n    }\n\n\n   static private function ed($str,$key) {\n      $r = md5($key);\n      $c = 0;\n      $v = '';\n\t  $len = strlen($str);\n\t  $l = strlen($r);\n      for ($i=0;$i<$len;$i++) {\n         if ($c==$l) $c=0;\n         $v .= substr($str,$i,1) ^ substr($r,$c,1);\n         $c++;\n      }\n      return $v;\n   }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Crypt/Driver/Des.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Crypt\\Driver;\n/**\n * Des 加密实现类\n * Converted from JavaScript to PHP by Jim Gibbs, June 2004 Paul Tero, July 2001\n * Optimised for performance with large blocks by Michael Hayworth, November 2001\n * http://www.netdealing.com\n */\n\nclass Des {\n\n    /**\n     * 加密字符串\n     * @param string $str 字符串\n     * @param string $key 加密key\n     * @param integer $expire 有效期（秒）     \n     * @return string\n     */\n    public static function encrypt($str, $key,$expire=0) {\n        if ($str == \"\") {\n            return \"\";\n        }\n        $expire = sprintf('%010d', $expire ? $expire + time():0);\n        $str    =   $expire.$str;\n        return self::_des($key,$str,1);\n    }\n\n    /**\n     * 解密字符串\n     * @param string $str 字符串\n     * @param string $key 加密key\n     * @return string\n     */\n    public static function decrypt($str, $key) {\n        if ($str == \"\") {\n            return \"\";\n        }\n        $data   =    self::_des($key,$str,0);\n        $expire = substr($data,0,10);\n        if($expire > 0 && $expire < time()) {\n            return '';\n        }\n        $data   = substr($data,10);\n        return $data;\n    }\n\n    /**\n     * Des算法\n     * @param string $str 字符串\n     * @param string $key 加密key\n     * @return string\n     */\n    private static function _des($key, $message, $encrypt, $mode=0, $iv=null) {\n      //declaring this locally speeds things up a bit\n      $spfunction1 = array (0x1010400,0,0x10000,0x1010404,0x1010004,0x10404,0x4,0x10000,0x400,0x1010400,0x1010404,0x400,0x1000404,0x1010004,0x1000000,0x4,0x404,0x1000400,0x1000400,0x10400,0x10400,0x1010000,0x1010000,0x1000404,0x10004,0x1000004,0x1000004,0x10004,0,0x404,0x10404,0x1000000,0x10000,0x1010404,0x4,0x1010000,0x1010400,0x1000000,0x1000000,0x400,0x1010004,0x10000,0x10400,0x1000004,0x400,0x4,0x1000404,0x10404,0x1010404,0x10004,0x1010000,0x1000404,0x1000004,0x404,0x10404,0x1010400,0x404,0x1000400,0x1000400,0,0x10004,0x10400,0,0x1010004);\n      $spfunction2 = array (-0x7fef7fe0,-0x7fff8000,0x8000,0x108020,0x100000,0x20,-0x7fefffe0,-0x7fff7fe0,-0x7fffffe0,-0x7fef7fe0,-0x7fef8000,-0x80000000,-0x7fff8000,0x100000,0x20,-0x7fefffe0,0x108000,0x100020,-0x7fff7fe0,0,-0x80000000,0x8000,0x108020,-0x7ff00000,0x100020,-0x7fffffe0,0,0x108000,0x8020,-0x7fef8000,-0x7ff00000,0x8020,0,0x108020,-0x7fefffe0,0x100000,-0x7fff7fe0,-0x7ff00000,-0x7fef8000,0x8000,-0x7ff00000,-0x7fff8000,0x20,-0x7fef7fe0,0x108020,0x20,0x8000,-0x80000000,0x8020,-0x7fef8000,0x100000,-0x7fffffe0,0x100020,-0x7fff7fe0,-0x7fffffe0,0x100020,0x108000,0,-0x7fff8000,0x8020,-0x80000000,-0x7fefffe0,-0x7fef7fe0,0x108000);\n      $spfunction3 = array (0x208,0x8020200,0,0x8020008,0x8000200,0,0x20208,0x8000200,0x20008,0x8000008,0x8000008,0x20000,0x8020208,0x20008,0x8020000,0x208,0x8000000,0x8,0x8020200,0x200,0x20200,0x8020000,0x8020008,0x20208,0x8000208,0x20200,0x20000,0x8000208,0x8,0x8020208,0x200,0x8000000,0x8020200,0x8000000,0x20008,0x208,0x20000,0x8020200,0x8000200,0,0x200,0x20008,0x8020208,0x8000200,0x8000008,0x200,0,0x8020008,0x8000208,0x20000,0x8000000,0x8020208,0x8,0x20208,0x20200,0x8000008,0x8020000,0x8000208,0x208,0x8020000,0x20208,0x8,0x8020008,0x20200);\n      $spfunction4 = array (0x802001,0x2081,0x2081,0x80,0x802080,0x800081,0x800001,0x2001,0,0x802000,0x802000,0x802081,0x81,0,0x800080,0x800001,0x1,0x2000,0x800000,0x802001,0x80,0x800000,0x2001,0x2080,0x800081,0x1,0x2080,0x800080,0x2000,0x802080,0x802081,0x81,0x800080,0x800001,0x802000,0x802081,0x81,0,0,0x802000,0x2080,0x800080,0x800081,0x1,0x802001,0x2081,0x2081,0x80,0x802081,0x81,0x1,0x2000,0x800001,0x2001,0x802080,0x800081,0x2001,0x2080,0x800000,0x802001,0x80,0x800000,0x2000,0x802080);\n      $spfunction5 = array (0x100,0x2080100,0x2080000,0x42000100,0x80000,0x100,0x40000000,0x2080000,0x40080100,0x80000,0x2000100,0x40080100,0x42000100,0x42080000,0x80100,0x40000000,0x2000000,0x40080000,0x40080000,0,0x40000100,0x42080100,0x42080100,0x2000100,0x42080000,0x40000100,0,0x42000000,0x2080100,0x2000000,0x42000000,0x80100,0x80000,0x42000100,0x100,0x2000000,0x40000000,0x2080000,0x42000100,0x40080100,0x2000100,0x40000000,0x42080000,0x2080100,0x40080100,0x100,0x2000000,0x42080000,0x42080100,0x80100,0x42000000,0x42080100,0x2080000,0,0x40080000,0x42000000,0x80100,0x2000100,0x40000100,0x80000,0,0x40080000,0x2080100,0x40000100);\n      $spfunction6 = array (0x20000010,0x20400000,0x4000,0x20404010,0x20400000,0x10,0x20404010,0x400000,0x20004000,0x404010,0x400000,0x20000010,0x400010,0x20004000,0x20000000,0x4010,0,0x400010,0x20004010,0x4000,0x404000,0x20004010,0x10,0x20400010,0x20400010,0,0x404010,0x20404000,0x4010,0x404000,0x20404000,0x20000000,0x20004000,0x10,0x20400010,0x404000,0x20404010,0x400000,0x4010,0x20000010,0x400000,0x20004000,0x20000000,0x4010,0x20000010,0x20404010,0x404000,0x20400000,0x404010,0x20404000,0,0x20400010,0x10,0x4000,0x20400000,0x404010,0x4000,0x400010,0x20004010,0,0x20404000,0x20000000,0x400010,0x20004010);\n      $spfunction7 = array (0x200000,0x4200002,0x4000802,0,0x800,0x4000802,0x200802,0x4200800,0x4200802,0x200000,0,0x4000002,0x2,0x4000000,0x4200002,0x802,0x4000800,0x200802,0x200002,0x4000800,0x4000002,0x4200000,0x4200800,0x200002,0x4200000,0x800,0x802,0x4200802,0x200800,0x2,0x4000000,0x200800,0x4000000,0x200800,0x200000,0x4000802,0x4000802,0x4200002,0x4200002,0x2,0x200002,0x4000000,0x4000800,0x200000,0x4200800,0x802,0x200802,0x4200800,0x802,0x4000002,0x4200802,0x4200000,0x200800,0,0x2,0x4200802,0,0x200802,0x4200000,0x800,0x4000002,0x4000800,0x800,0x200002);\n      $spfunction8 = array (0x10001040,0x1000,0x40000,0x10041040,0x10000000,0x10001040,0x40,0x10000000,0x40040,0x10040000,0x10041040,0x41000,0x10041000,0x41040,0x1000,0x40,0x10040000,0x10000040,0x10001000,0x1040,0x41000,0x40040,0x10040040,0x10041000,0x1040,0,0,0x10040040,0x10000040,0x10001000,0x41040,0x40000,0x41040,0x40000,0x10041000,0x1000,0x40,0x10040040,0x1000,0x41040,0x10001000,0x40,0x10000040,0x10040000,0x10040040,0x10000000,0x40000,0x10001040,0,0x10041040,0x40040,0x10000040,0x10040000,0x10001000,0x10001040,0,0x10041040,0x41000,0x41000,0x1040,0x1040,0x40040,0x10000000,0x10041000);\n      $masks = array (4294967295,2147483647,1073741823,536870911,268435455,134217727,67108863,33554431,16777215,8388607,4194303,2097151,1048575,524287,262143,131071,65535,32767,16383,8191,4095,2047,1023,511,255,127,63,31,15,7,3,1,0);\n\n      //create the 16 or 48 subkeys we will need\n      $keys = self::_createKeys ($key);\n      $m=0;\n      $len = strlen($message);\n      $chunk = 0;\n      //set up the loops for single and triple des\n      $iterations = ((count($keys) == 32) ? 3 : 9); //single or triple des\n      if ($iterations == 3) {$looping = (($encrypt) ? array (0, 32, 2) : array (30, -2, -2));}\n      else {$looping = (($encrypt) ? array (0, 32, 2, 62, 30, -2, 64, 96, 2) : array (94, 62, -2, 32, 64, 2, 30, -2, -2));}\n\n      $message .= (chr(0) . chr(0) . chr(0) . chr(0) . chr(0) . chr(0) . chr(0) . chr(0)); //pad the message out with null bytes\n      //store the result here\n      $result = \"\";\n      $tempresult = \"\";\n\n      if ($mode == 1) { //CBC mode\n        $cbcleft = (ord($iv{$m++}) << 24) | (ord($iv{$m++}) << 16) | (ord($iv{$m++}) << 8) | ord($iv{$m++});\n        $cbcright = (ord($iv{$m++}) << 24) | (ord($iv{$m++}) << 16) | (ord($iv{$m++}) << 8) | ord($iv{$m++});\n        $m=0;\n      }\n\n      //loop through each 64 bit chunk of the message\n      while ($m < $len) {\n        $left = (ord($message{$m++}) << 24) | (ord($message{$m++}) << 16) | (ord($message{$m++}) << 8) | ord($message{$m++});\n        $right = (ord($message{$m++}) << 24) | (ord($message{$m++}) << 16) | (ord($message{$m++}) << 8) | ord($message{$m++});\n\n        //for Cipher Block Chaining mode, xor the message with the previous result\n        if ($mode == 1) {if ($encrypt) {$left ^= $cbcleft; $right ^= $cbcright;} else {$cbcleft2 = $cbcleft; $cbcright2 = $cbcright; $cbcleft = $left; $cbcright = $right;}}\n\n        //first each 64 but chunk of the message must be permuted according to IP\n        $temp = (($left >> 4 & $masks[4]) ^ $right) & 0x0f0f0f0f; $right ^= $temp; $left ^= ($temp << 4);\n        $temp = (($left >> 16 & $masks[16]) ^ $right) & 0x0000ffff; $right ^= $temp; $left ^= ($temp << 16);\n        $temp = (($right >> 2 & $masks[2]) ^ $left) & 0x33333333; $left ^= $temp; $right ^= ($temp << 2);\n        $temp = (($right >> 8 & $masks[8]) ^ $left) & 0x00ff00ff; $left ^= $temp; $right ^= ($temp << 8);\n        $temp = (($left >> 1 & $masks[1]) ^ $right) & 0x55555555; $right ^= $temp; $left ^= ($temp << 1);\n\n        $left = (($left << 1) | ($left >> 31 & $masks[31]));\n        $right = (($right << 1) | ($right >> 31 & $masks[31]));\n\n        //do this either 1 or 3 times for each chunk of the message\n        for ($j=0; $j<$iterations; $j+=3) {\n          $endloop = $looping[$j+1];\n          $loopinc = $looping[$j+2];\n          //now go through and perform the encryption or decryption\n          for ($i=$looping[$j]; $i!=$endloop; $i+=$loopinc) { //for efficiency\n            $right1 = $right ^ $keys[$i];\n            $right2 = (($right >> 4 & $masks[4]) | ($right << 28)) ^ $keys[$i+1];\n            //the result is attained by passing these bytes through the S selection functions\n            $temp = $left;\n            $left = $right;\n            $right = $temp ^ ($spfunction2[($right1 >> 24 & $masks[24]) & 0x3f] | $spfunction4[($right1 >> 16 & $masks[16]) & 0x3f]\n                  | $spfunction6[($right1 >>  8 & $masks[8]) & 0x3f] | $spfunction8[$right1 & 0x3f]\n                  | $spfunction1[($right2 >> 24 & $masks[24]) & 0x3f] | $spfunction3[($right2 >> 16 & $masks[16]) & 0x3f]\n                  | $spfunction5[($right2 >>  8 & $masks[8]) & 0x3f] | $spfunction7[$right2 & 0x3f]);\n          }\n          $temp = $left; $left = $right; $right = $temp; //unreverse left and right\n        } //for either 1 or 3 iterations\n\n        //move then each one bit to the right\n        $left = (($left >> 1 & $masks[1]) | ($left << 31));\n        $right = (($right >> 1 & $masks[1]) | ($right << 31));\n\n        //now perform IP-1, which is IP in the opposite direction\n        $temp = (($left >> 1 & $masks[1]) ^ $right) & 0x55555555; $right ^= $temp; $left ^= ($temp << 1);\n        $temp = (($right >> 8 & $masks[8]) ^ $left) & 0x00ff00ff; $left ^= $temp; $right ^= ($temp << 8);\n        $temp = (($right >> 2 & $masks[2]) ^ $left) & 0x33333333; $left ^= $temp; $right ^= ($temp << 2);\n        $temp = (($left >> 16 & $masks[16]) ^ $right) & 0x0000ffff; $right ^= $temp; $left ^= ($temp << 16);\n        $temp = (($left >> 4 & $masks[4]) ^ $right) & 0x0f0f0f0f; $right ^= $temp; $left ^= ($temp << 4);\n\n        //for Cipher Block Chaining mode, xor the message with the previous result\n        if ($mode == 1) {if ($encrypt) {$cbcleft = $left; $cbcright = $right;} else {$left ^= $cbcleft2; $right ^= $cbcright2;}}\n        $tempresult .= (chr($left>>24 & $masks[24]) . chr(($left>>16 & $masks[16]) & 0xff) . chr(($left>>8 & $masks[8]) & 0xff) . chr($left & 0xff) . chr($right>>24 & $masks[24]) . chr(($right>>16 & $masks[16]) & 0xff) . chr(($right>>8 & $masks[8]) & 0xff) . chr($right & 0xff));\n\n        $chunk += 8;\n        if ($chunk == 512) {$result .= $tempresult; $tempresult = \"\"; $chunk = 0;}\n      } //for every 8 characters, or 64 bits in the message\n\n      //return the result as an array\n      return ($result . $tempresult);\n    } //end of des\n\n    /**\n     * createKeys\n     * this takes as input a 64 bit key (even though only 56 bits are used)\n     * as an array of 2 integers, and returns 16 48 bit keys\n     * @param string $key 加密key\n     * @return string\n     */\n    private static function _createKeys ($key) {\n      //declaring this locally speeds things up a bit\n      $pc2bytes0  = array (0,0x4,0x20000000,0x20000004,0x10000,0x10004,0x20010000,0x20010004,0x200,0x204,0x20000200,0x20000204,0x10200,0x10204,0x20010200,0x20010204);\n      $pc2bytes1  = array (0,0x1,0x100000,0x100001,0x4000000,0x4000001,0x4100000,0x4100001,0x100,0x101,0x100100,0x100101,0x4000100,0x4000101,0x4100100,0x4100101);\n      $pc2bytes2  = array (0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808,0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808);\n      $pc2bytes3  = array (0,0x200000,0x8000000,0x8200000,0x2000,0x202000,0x8002000,0x8202000,0x20000,0x220000,0x8020000,0x8220000,0x22000,0x222000,0x8022000,0x8222000);\n      $pc2bytes4  = array (0,0x40000,0x10,0x40010,0,0x40000,0x10,0x40010,0x1000,0x41000,0x1010,0x41010,0x1000,0x41000,0x1010,0x41010);\n      $pc2bytes5  = array (0,0x400,0x20,0x420,0,0x400,0x20,0x420,0x2000000,0x2000400,0x2000020,0x2000420,0x2000000,0x2000400,0x2000020,0x2000420);\n      $pc2bytes6  = array (0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002,0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002);\n      $pc2bytes7  = array (0,0x10000,0x800,0x10800,0x20000000,0x20010000,0x20000800,0x20010800,0x20000,0x30000,0x20800,0x30800,0x20020000,0x20030000,0x20020800,0x20030800);\n      $pc2bytes8  = array (0,0x40000,0,0x40000,0x2,0x40002,0x2,0x40002,0x2000000,0x2040000,0x2000000,0x2040000,0x2000002,0x2040002,0x2000002,0x2040002);\n      $pc2bytes9  = array (0,0x10000000,0x8,0x10000008,0,0x10000000,0x8,0x10000008,0x400,0x10000400,0x408,0x10000408,0x400,0x10000400,0x408,0x10000408);\n      $pc2bytes10 = array (0,0x20,0,0x20,0x100000,0x100020,0x100000,0x100020,0x2000,0x2020,0x2000,0x2020,0x102000,0x102020,0x102000,0x102020);\n      $pc2bytes11 = array (0,0x1000000,0x200,0x1000200,0x200000,0x1200000,0x200200,0x1200200,0x4000000,0x5000000,0x4000200,0x5000200,0x4200000,0x5200000,0x4200200,0x5200200);\n      $pc2bytes12 = array (0,0x1000,0x8000000,0x8001000,0x80000,0x81000,0x8080000,0x8081000,0x10,0x1010,0x8000010,0x8001010,0x80010,0x81010,0x8080010,0x8081010);\n      $pc2bytes13 = array (0,0x4,0x100,0x104,0,0x4,0x100,0x104,0x1,0x5,0x101,0x105,0x1,0x5,0x101,0x105);\n      $masks = array (4294967295,2147483647,1073741823,536870911,268435455,134217727,67108863,33554431,16777215,8388607,4194303,2097151,1048575,524287,262143,131071,65535,32767,16383,8191,4095,2047,1023,511,255,127,63,31,15,7,3,1,0);\n\n      //how many iterations (1 for des, 3 for triple des)\n      $iterations = ((strlen($key) >= 24) ? 3 : 1);\n      //stores the return keys\n      $keys = array (); // size = 32 * iterations but you don't specify this in php\n      //now define the left shifts which need to be done\n      $shifts = array (0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0);\n      //other variables\n      $m=0;\n      $n=0;\n\n      for ($j=0; $j<$iterations; $j++) { //either 1 or 3 iterations\n        $left = (ord($key{$m++}) << 24) | (ord($key{$m++}) << 16) | (ord($key{$m++}) << 8) | ord($key{$m++});\n        $right = (ord($key{$m++}) << 24) | (ord($key{$m++}) << 16) | (ord($key{$m++}) << 8) | ord($key{$m++});\n\n        $temp = (($left >> 4 & $masks[4]) ^ $right) & 0x0f0f0f0f; $right ^= $temp; $left ^= ($temp << 4);\n        $temp = (($right >> 16 & $masks[16]) ^ $left) & 0x0000ffff; $left ^= $temp; $right ^= ($temp << -16);\n        $temp = (($left >> 2 & $masks[2]) ^ $right) & 0x33333333; $right ^= $temp; $left ^= ($temp << 2);\n        $temp = (($right >> 16 & $masks[16]) ^ $left) & 0x0000ffff; $left ^= $temp; $right ^= ($temp << -16);\n        $temp = (($left >> 1 & $masks[1]) ^ $right) & 0x55555555; $right ^= $temp; $left ^= ($temp << 1);\n        $temp = (($right >> 8 & $masks[8]) ^ $left) & 0x00ff00ff; $left ^= $temp; $right ^= ($temp << 8);\n        $temp = (($left >> 1 & $masks[1]) ^ $right) & 0x55555555; $right ^= $temp; $left ^= ($temp << 1);\n\n        //the right side needs to be shifted and to get the last four bits of the left side\n        $temp = ($left << 8) | (($right >> 20 & $masks[20]) & 0x000000f0);\n        //left needs to be put upside down\n        $left = ($right << 24) | (($right << 8) & 0xff0000) | (($right >> 8 & $masks[8]) & 0xff00) | (($right >> 24 & $masks[24]) & 0xf0);\n        $right = $temp;\n\n        //now go through and perform these shifts on the left and right keys\n        for ($i=0; $i < count($shifts); $i++) {\n          //shift the keys either one or two bits to the left\n          if ($shifts[$i] > 0) {\n             $left = (($left << 2) | ($left >> 26 & $masks[26]));\n             $right = (($right << 2) | ($right >> 26 & $masks[26]));\n          } else {\n             $left = (($left << 1) | ($left >> 27 & $masks[27]));\n             $right = (($right << 1) | ($right >> 27 & $masks[27]));\n          }\n          $left = $left & -0xf;\n          $right = $right & -0xf;\n\n          //now apply PC-2, in such a way that E is easier when encrypting or decrypting\n          //this conversion will look like PC-2 except only the last 6 bits of each byte are used\n          //rather than 48 consecutive bits and the order of lines will be according to\n          //how the S selection functions will be applied: S2, S4, S6, S8, S1, S3, S5, S7\n          $lefttemp = $pc2bytes0[$left >> 28 & $masks[28]] | $pc2bytes1[($left >> 24 & $masks[24]) & 0xf]\n                  | $pc2bytes2[($left >> 20 & $masks[20]) & 0xf] | $pc2bytes3[($left >> 16 & $masks[16]) & 0xf]\n                  | $pc2bytes4[($left >> 12 & $masks[12]) & 0xf] | $pc2bytes5[($left >> 8 & $masks[8]) & 0xf]\n                  | $pc2bytes6[($left >> 4 & $masks[4]) & 0xf];\n          $righttemp = $pc2bytes7[$right >> 28 & $masks[28]] | $pc2bytes8[($right >> 24 & $masks[24]) & 0xf]\n                    | $pc2bytes9[($right >> 20 & $masks[20]) & 0xf] | $pc2bytes10[($right >> 16 & $masks[16]) & 0xf]\n                    | $pc2bytes11[($right >> 12 & $masks[12]) & 0xf] | $pc2bytes12[($right >> 8 & $masks[8]) & 0xf]\n                    | $pc2bytes13[($right >> 4 & $masks[4]) & 0xf];\n          $temp = (($righttemp >> 16 & $masks[16]) ^ $lefttemp) & 0x0000ffff;\n          $keys[$n++] = $lefttemp ^ $temp; $keys[$n++] = $righttemp ^ ($temp << 16);\n        }\n      } //for each iterations\n      //return the keys we've created\n      return $keys;\n    } //end of des_createKeys\n\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Crypt/Driver/Think.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Crypt\\Driver;\n/**\n * Base64 加密实现类\n */\nclass Think {\n\n    /**\n     * 加密字符串\n     * @param string $str 字符串\n     * @param string $key 加密key\n     * @param integer $expire 有效期（秒）     \n     * @return string\n     */\n    public static function encrypt($data,$key,$expire=0) {\n        $expire = sprintf('%010d', $expire ? $expire + time():0);\n        $key  = md5($key);\n        $data = base64_encode($expire.$data);\n        $x    = 0;\n        $len  = strlen($data);\n        $l    = strlen($key);\n        $char = $str    =   '';\n\n        for ($i = 0; $i < $len; $i++) {\n            if ($x == $l) $x = 0;\n            $char .= substr($key, $x, 1);\n            $x++;\n        }\n\n        for ($i = 0; $i < $len; $i++) {\n            $str .= chr(ord(substr($data, $i, 1)) + (ord(substr($char, $i, 1)))%256);\n        }\n        return str_replace(array('+','/','='),array('-','_',''),base64_encode($str));\n    }\n\n    /**\n     * 解密字符串\n     * @param string $str 字符串\n     * @param string $key 加密key\n     * @return string\n     */\n    public static function decrypt($data,$key) {\n        $key    = md5($key);\n        $data   = str_replace(array('-','_'),array('+','/'),$data);\n        $mod4   = strlen($data) % 4;\n        if ($mod4) {\n           $data .= substr('====', $mod4);\n        }\n        $data   = base64_decode($data);\n\n        $x      = 0;\n        $len    = strlen($data);\n        $l      = strlen($key);\n        $char   = $str = '';\n\n        for ($i = 0; $i < $len; $i++) {\n            if ($x == $l) $x = 0;\n            $char .= substr($key, $x, 1);\n            $x++;\n        }\n\n        for ($i = 0; $i < $len; $i++) {\n            if (ord(substr($data, $i, 1))<ord(substr($char, $i, 1))) {\n                $str .= chr((ord(substr($data, $i, 1)) + 256) - ord(substr($char, $i, 1)));\n            }else{\n                $str .= chr(ord(substr($data, $i, 1)) - ord(substr($char, $i, 1)));\n            }\n        }\n        $data   = base64_decode($str);\n        $expire = substr($data,0,10);\n        if($expire > 0 && $expire < time()) {\n            return '';\n        }\n        $data   = substr($data,10);\n        return $data;\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Crypt/Driver/Xxtea.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Crypt\\Driver;\n/**\n * Xxtea 加密实现类\n */\nclass Xxtea {\n\n    /**\n     * 加密字符串\n     * @param string $str 字符串\n     * @param string $key 加密key\n     * @param integer $expire 有效期（秒）     \n     * @return string\n     */\n    public static function encrypt($str, $key,$expire=0) {\n        $expire = sprintf('%010d', $expire ? $expire + time():0);\n        $str    =   $expire.$str;\n        $v = self::str2long($str, true);\n        $k = self::str2long($key, false);\n        $n = count($v) - 1;\n\n        $z = $v[$n];\n        $y = $v[0];\n        $delta = 0x9E3779B9;\n        $q = floor(6 + 52 / ($n + 1));\n        $sum = 0;\n        while (0 < $q--) {\n            $sum = self::int32($sum + $delta);\n            $e = $sum >> 2 & 3;\n            for ($p = 0; $p < $n; $p++) {\n                $y = $v[$p + 1];\n                $mx = self::int32((($z >> 5 & 0x07ffffff) ^ $y << 2) + (($y >> 3 & 0x1fffffff) ^ $z << 4)) ^ self::int32(($sum ^ $y) + ($k[$p & 3 ^ $e] ^ $z));\n                $z = $v[$p] = self::int32($v[$p] + $mx);\n            }\n            $y = $v[0];\n            $mx = self::int32((($z >> 5 & 0x07ffffff) ^ $y << 2) + (($y >> 3 & 0x1fffffff) ^ $z << 4)) ^ self::int32(($sum ^ $y) + ($k[$p & 3 ^ $e] ^ $z));\n            $z = $v[$n] = self::int32($v[$n] + $mx);\n        }\n        return self::long2str($v, false);\n    }\n\n    /**\n     * 解密字符串\n     * @param string $str 字符串\n     * @param string $key 加密key\n     * @return string\n     */\n    public static function decrypt($str, $key) {\n        $v = self::str2long($str, false);\n        $k = self::str2long($key, false);\n        $n = count($v) - 1;\n\n        $z = $v[$n];\n        $y = $v[0];\n        $delta = 0x9E3779B9;\n        $q = floor(6 + 52 / ($n + 1));\n        $sum = self::int32($q * $delta);\n        while ($sum != 0) {\n            $e = $sum >> 2 & 3;\n            for ($p = $n; $p > 0; $p--) {\n                $z = $v[$p - 1];\n                $mx = self::int32((($z >> 5 & 0x07ffffff) ^ $y << 2) + (($y >> 3 & 0x1fffffff) ^ $z << 4)) ^ self::int32(($sum ^ $y) + ($k[$p & 3 ^ $e] ^ $z));\n                $y = $v[$p] = self::int32($v[$p] - $mx);\n            }\n            $z = $v[$n];\n            $mx = self::int32((($z >> 5 & 0x07ffffff) ^ $y << 2) + (($y >> 3 & 0x1fffffff) ^ $z << 4)) ^ self::int32(($sum ^ $y) + ($k[$p & 3 ^ $e] ^ $z));\n            $y = $v[0] = self::int32($v[0] - $mx);\n            $sum = self::int32($sum - $delta);\n        }\n        $data   = self::long2str($v, true);\n        $expire = substr($data,0,10);\n        if($expire > 0 && $expire < time()) {\n            return '';\n        }\n        $data   = substr($data,10);\n        return $data;\n    }\n\n    private static function long2str($v, $w) {\n        $len = count($v);\n        $s = array();\n        for ($i = 0; $i < $len; $i++) {\n            $s[$i] = pack(\"V\", $v[$i]);\n        }\n        if ($w) {\n            return substr(join('', $s), 0, $v[$len - 1]);\n        }else{\n            return join('', $s);\n        }\n    }\n\n    private static function str2long($s, $w) {\n        $v = unpack(\"V*\", $s. str_repeat(\"\\0\", (4 - strlen($s) % 4) & 3));\n        $v = array_values($v);\n        if ($w) {\n            $v[count($v)] = strlen($s);\n        }\n        return $v;\n    }\n\n    private static function int32($n) {\n        while ($n >= 2147483648) $n -= 4294967296;\n        while ($n <= -2147483649) $n += 4294967296;\n        return (int)$n;\n    }\n\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Crypt.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * 加密解密类\n */\nclass Crypt {\n\n    private static $handler    =   '';\n\n    public static function init($type=''){\n        $type   =   $type?:C('DATA_CRYPT_TYPE');\n        $class  =   strpos($type,'\\\\')? $type: 'Think\\\\Crypt\\\\Driver\\\\'. ucwords(strtolower($type));\n        self::$handler  =    $class;\n    }\n\n    /**\n     * 加密字符串\n     * @param string $str 字符串\n     * @param string $key 加密key\n     * @param integer $expire 有效期（秒） 0 为永久有效\n     * @return string\n     */\n    public static function encrypt($data,$key,$expire=0){\n        if(empty(self::$handler)){\n            self::init();\n        }\n        $class  =   self::$handler; \n        return $class::encrypt($data,$key,$expire);\n    }\n\n    /**\n     * 解密字符串\n     * @param string $str 字符串\n     * @param string $key 加密key\n     * @return string\n     */\n    public static function decrypt($data,$key){\n        if(empty(self::$handler)){\n            self::init();\n        }\n        $class  =   self::$handler;         \n        return $class::decrypt($data,$key);\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Db/Driver/Firebird.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Db\\Driver;\nuse Think\\Db\\Driver;\n\n/**\n * Firebird数据库驱动 \n */\nclass Firebird extends Driver{\n    protected $selectSql  =     'SELECT %LIMIT% %DISTINCT% %FIELD% FROM %TABLE%%JOIN%%WHERE%%GROUP%%HAVING%%ORDER%';\n\n    /**\n     * 解析pdo连接的dsn信息\n     * @access public\n     * @param array $config 连接信息\n     * @return string\n     */\n    protected function parseDsn($config){\n       $dsn  =   'firebird:dbname='.$config['hostname'].'/'.($config['hostport']?:3050).':'.$config['database'];\n       return $dsn;\n    }\n    \n    /**\n     * 执行语句\n     * @access public\n     * @param string $str  sql指令\n     * @param boolean $fetchSql  不执行只是获取SQL\n     * @return mixed\n     */\n    public function execute($str,$fetchSql=false) {\n        $this->initConnect(true);\n        if ( !$this->_linkID ) return false;\n        $this->queryStr = $str;\n        if(!empty($this->bind)){\n            $that   =   $this;\n            $this->queryStr =   strtr($this->queryStr,array_map(function($val) use($that){ return '\\''.$that->escapeString($val).'\\''; },$this->bind));\n        }\n        if($fetchSql){\n            return $this->queryStr;\n        }\n        //释放前次的查询结果\n        if ( !empty($this->PDOStatement) ) $this->free();\n        $this->executeTimes++;\n        N('db_write',1); // 兼容代码\n        // 记录开始执行时间\n        $this->debug(true);\n        $this->PDOStatement =   $this->_linkID->prepare($str);\n        if(false === $this->PDOStatement) {\n            E($this->error());\n        }\n        foreach ($this->bind as $key => $val) {\n            if(is_array($val)){\n                $this->PDOStatement->bindValue($key, $val[0], $val[1]);\n            }else{\n                $this->PDOStatement->bindValue($key, $val);\n            }\n        }\n        $this->bind =   array();\n        $result =   $this->PDOStatement->execute();\n        $this->debug(false);\n        if ( false === $result) {\n            $this->error();\n            return false;\n        } else {\n            $this->numRows = $this->PDOStatement->rowCount();\n            return $this->numRows;\n        }\n    }\n    \n    /**\n     * 取得数据表的字段信息\n     * @access public\n     */\n    public function getFields($tableName) {\n        $this->initConnect(true);\n        list($tableName) = explode(' ', $tableName);\n        $sql='SELECT RF.RDB$FIELD_NAME AS FIELD,RF.RDB$DEFAULT_VALUE AS DEFAULT1,RF.RDB$NULL_FLAG AS NULL1,TRIM(T.RDB$TYPE_NAME) || \\'(\\' || F.RDB$FIELD_LENGTH || \\')\\' as TYPE FROM RDB$RELATION_FIELDS RF LEFT JOIN RDB$FIELDS F ON (F.RDB$FIELD_NAME = RF.RDB$FIELD_SOURCE) LEFT JOIN RDB$TYPES T ON (T.RDB$TYPE = F.RDB$FIELD_TYPE) WHERE RDB$RELATION_NAME=UPPER(\\''.$tableName.'\\') AND T.RDB$FIELD_NAME = \\'RDB$FIELD_TYPE\\' ORDER By RDB$FIELD_POSITION';\n        $result = $this->query($sql);\n        $info   =   array();\n        if($result){\n            foreach($result as $key => $val){\n                $info[trim($val['field'])] = array(\n                    'name'    => trim($val['field']),\n                    'type'    => $val['type'],\n                    'notnull' => (bool) ($val['null1'] ==1), // 1表示不为Null\n                    'default' => $val['default1'],\n                    'primary' => false,\n                    'autoinc' => false,\n                );\n            }\n        }\n        //获取主键\n        $sql='select b.rdb$field_name as field_name from rdb$relation_constraints a join rdb$index_segments b on a.rdb$index_name=b.rdb$index_name where a.rdb$constraint_type=\\'PRIMARY KEY\\' and a.rdb$relation_name=UPPER(\\''.$tableName.'\\')';\n        $rs_temp = $this->query($sql);\n        foreach($rs_temp as $row) {\n            $info[trim($row['field_name'])]['primary']= true;\n        }\n        return $info;\n    }\n    \n    /**\n     * 取得数据库的表信息\n     * @access public\n     */\n    public function getTables($dbName='') {\n        $sql='SELECT DISTINCT RDB$RELATION_NAME FROM RDB$RELATION_FIELDS WHERE RDB$SYSTEM_FLAG=0';\n        $result   =  $this->query($sql);\n        $info   =   array();\n        foreach ($result as $key => $val) {\n            $info[$key] = trim(current($val));\n        }\n        return $info;\n    }\n    \n    /**\n     * SQL指令安全过滤\n     * @access public\n     * @param string $str  SQL指令\n     * @return string\n     */\n    public function escapeString($str) {\n        return str_replace(\"'\", \"''\", $str);\n    }\n\n    /**\n     * limit\n     * @access public\n     * @param $limit limit表达式\n     * @return string\n     */\n    public function parseLimit($limit) {\n        $limitStr    = '';\n        if(!empty($limit)) {\n            $limit  =   explode(',',$limit);\n            if(count($limit)>1) {\n                 $limitStr = ' FIRST '.$limit[1].' SKIP '.$limit[0].' ';\n            }else{\n              $limitStr = ' FIRST '.$limit[0].' ';\n            }\n        }\n        return $limitStr;\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Db/Driver/Mongo.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\nnamespace Think\\Db\\Driver;\nuse Think\\Db\\Driver;\n\n/**\n * Mongo数据库驱动\n */\nclass Mongo extends Driver {\n\n    protected $_mongo           =   null; // MongoDb Object\n    protected $_collection      =   null; // MongoCollection Object\n    protected $_dbName          =   ''; // dbName\n    protected $_collectionName  =   ''; // collectionName\n    protected $_cursor          =   null; // MongoCursor Object\n    protected $comparison       =   array('neq'=>'ne','ne'=>'ne','gt'=>'gt','egt'=>'gte','gte'=>'gte','lt'=>'lt','elt'=>'lte','lte'=>'lte','in'=>'in','not in'=>'nin','nin'=>'nin');\n\n    /**\n     * 架构函数 读取数据库配置信息\n     * @access public\n     * @param array $config 数据库配置数组\n     */\n    public function __construct($config=''){\n        if ( !class_exists('mongoClient') ) {\n            E(L('_NOT_SUPPORT_').':Mongo');\n        }\n        if(!empty($config)) {\n            $this->config           =   array_merge($this->config,$config);\n            if(empty($this->config['params'])){\n                $this->config['params'] =   array();\n            }            \n        }\n    }\n\n    /**\n     * 连接数据库方法\n     * @access public\n     */\n    public function connect($config='',$linkNum=0) {\n        if ( !isset($this->linkID[$linkNum]) ) {\n            if(empty($config))  $config =   $this->config;\n            $host = 'mongodb://'.($config['username']?\"{$config['username']}\":'').($config['password']?\":{$config['password']}@\":'').$config['hostname'].($config['hostport']?\":{$config['hostport']}\":'').'/'.($config['database']?\"{$config['database']}\":'');\n            try{\n                $this->linkID[$linkNum] = new \\mongoClient( $host,$this->config['params']);\n            }catch (\\MongoConnectionException $e){\n                E($e->getmessage());\n            }\n        }\n        return $this->linkID[$linkNum];\n    }\n\n    /**\n     * 切换当前操作的Db和Collection\n     * @access public\n     * @param string $collection  collection\n     * @param string $db  db\n     * @param boolean $master 是否主服务器\n     * @return void\n     */\n    public function switchCollection($collection,$db='',$master=true){\n        // 当前没有连接 则首先进行数据库连接\n        if ( !$this->_linkID ) $this->initConnect($master);\n        try{\n            if(!empty($db)) { // 传人Db则切换数据库\n                // 当前MongoDb对象\n                $this->_dbName  =  $db;\n                $this->_mongo = $this->_linkID->selectDb($db);\n            }\n            // 当前MongoCollection对象\n            if($this->config['debug']) {\n                $this->queryStr   =  $this->_dbName.'.getCollection('.$collection.')';\n            }\n            if($this->_collectionName != $collection) {\n                $this->queryTimes++;\n                N('db_query',1); // 兼容代码                \n                $this->debug(true);\n                $this->_collection =  $this->_mongo->selectCollection($collection);\n                $this->debug(false);\n                $this->_collectionName  = $collection; // 记录当前Collection名称\n            }\n        }catch (MongoException $e){\n            E($e->getMessage());\n        }\n    }\n\n    /**\n     * 释放查询结果\n     * @access public\n     */\n    public function free() {\n        $this->_cursor = null;\n    }\n\n    /**\n     * 执行命令\n     * @access public\n     * @param array $command  指令\n     * @return array\n     */\n    public function command($command=array(), $options=array()) {\n        $cache  =  isset($options['cache'])?$options['cache']:false;\n        if($cache) { // 查询缓存检测\n            $key =  is_string($cache['key'])?$cache['key']:md5(serialize($command));\n            $value   =  S($key,'','',$cache['type']);\n            if(false !== $value) {\n                return $value;\n            }\n        }\n        N('db_write',1); // 兼容代码\n        $this->executeTimes++;\n        try{\n            if($this->config['debug']) {\n                $this->queryStr   =  $this->_dbName.'.'.$this->_collectionName.'.runCommand(';\n                $this->queryStr  .=  json_encode($command);\n                $this->queryStr  .=  ')';\n            }\n            $this->debug(true);\n            $result   = $this->_mongo->command($command);\n            $this->debug(false);\n            \n            if($cache && $result['ok']) { // 查询缓存写入\n                S($key,$result,$cache['expire'],$cache['type']);\n            }\n            return $result;\n        } catch (\\MongoCursorException $e) {\n            E($e->getMessage());\n        }\n    }\n\n    /**\n     * 执行语句\n     * @access public\n     * @param string $code  sql指令\n     * @param array $args  参数\n     * @return mixed\n     */\n    public function execute($code,$args=array()) {\n        $this->executeTimes++;\n        N('db_write',1); // 兼容代码\n        $this->debug(true);\n        $this->queryStr = 'execute:'.$code;\n        $result   = $this->_mongo->execute($code,$args);\n        $this->debug(false);\n        if($result['ok']) {\n            return $result['retval'];\n        }else{\n            E($result['errmsg']);\n        }\n    }\n\n    /**\n     * 关闭数据库\n     * @access public\n     */\n    public function close() {\n        if($this->_linkID) {\n            $this->_linkID->close();\n            $this->_linkID = null;\n            $this->_mongo = null;\n            $this->_collection =  null;\n            $this->_cursor = null;\n        }\n    }\n\n    /**\n     * 数据库错误信息\n     * @access public\n     * @return string\n     */\n    public function error() {\n        $this->error = $this->_mongo->lastError();\n        trace($this->error,'','ERR');\n        return $this->error;\n    }\n\n    /**\n     * 插入记录\n     * @access public\n     * @param mixed $data 数据\n     * @param array $options 参数表达式\n     * @param boolean $replace 是否replace\n     * @return false | integer\n     */\n    public function insert($data,$options=array(),$replace=false) {\n        if(isset($options['table'])) {\n            $this->switchCollection($options['table']);\n        }\n        $this->model  =   $options['model'];\n        $this->executeTimes++;\n        N('db_write',1); // 兼容代码        \n        if($this->config['debug']) {\n            $this->queryStr   =  $this->_dbName.'.'.$this->_collectionName.'.insert(';\n            $this->queryStr   .= $data?json_encode($data):'{}';\n            $this->queryStr   .= ')';\n        }\n        try{\n            $this->debug(true);\n            $result =  $replace?   $this->_collection->save($data):  $this->_collection->insert($data);\n            $this->debug(false);\n            if($result) {\n               $_id    = $data['_id'];\n                if(is_object($_id)) {\n                    $_id = $_id->__toString();\n                }\n               $this->lastInsID    = $_id;\n            }\n            return $result;\n        } catch (\\MongoCursorException $e) {\n            E($e->getMessage());\n        }\n    }\n\n    /**\n     * 插入多条记录\n     * @access public\n     * @param array $dataList 数据\n     * @param array $options 参数表达式\n     * @return bool\n     */\n    public function insertAll($dataList,$options=array()) {\n        if(isset($options['table'])) {\n            $this->switchCollection($options['table']);\n        }\n        $this->model  =   $options['model'];\n        $this->executeTimes++;\n        N('db_write',1); // 兼容代码        \n        try{\n            $this->debug(true);\n            $result =  $this->_collection->batchInsert($dataList);\n            $this->debug(false);\n            return $result;\n        } catch (\\MongoCursorException $e) {\n            E($e->getMessage());\n        }\n    }\n\n    /**\n     * 生成下一条记录ID 用于自增非MongoId主键\n     * @access public\n     * @param string $pk 主键名\n     * @return integer\n     */\n    public function getMongoNextId($pk) {\n        if($this->config['debug']) {\n            $this->queryStr   =  $this->_dbName.'.'.$this->_collectionName.'.find({},{'.$pk.':1}).sort({'.$pk.':-1}).limit(1)';\n        }\n        try{\n            $this->debug(true);\n            $result   =  $this->_collection->find(array(),array($pk=>1))->sort(array($pk=>-1))->limit(1);\n            $this->debug(false);\n        } catch (\\MongoCursorException $e) {\n            E($e->getMessage());\n        }\n        $data = $result->getNext();\n        return isset($data[$pk])?$data[$pk]+1:1;\n    }\n\n    /**\n     * 更新记录\n     * @access public\n     * @param mixed $data 数据\n     * @param array $options 表达式\n     * @return bool\n     */\n    public function update($data,$options) {\n        if(isset($options['table'])) {\n            $this->switchCollection($options['table']);\n        }\n        $this->executeTimes++;\n        N('db_write',1); // 兼容代码        \n        $this->model  =   $options['model'];\n        $query   = $this->parseWhere(isset($options['where'])?$options['where']:array());\n        $set  =  $this->parseSet($data);\n        if($this->config['debug']) {\n            $this->queryStr   =  $this->_dbName.'.'.$this->_collectionName.'.update(';\n            $this->queryStr   .= $query?json_encode($query):'{}';\n            $this->queryStr   .=  ','.json_encode($set).')';\n        }\n        try{\n            $this->debug(true);\n            if(isset($options['limit']) && $options['limit'] == 1) {\n                $multiple   =   array(\"multiple\" => false);\n            }else{\n                $multiple   =   array(\"multiple\" => true);\n            }\n            $result   = $this->_collection->update($query,$set,$multiple);\n            $this->debug(false);\n            return $result;\n        } catch (\\MongoCursorException $e) {\n            E($e->getMessage());\n        }\n    }\n\n    /**\n     * 删除记录\n     * @access public\n     * @param array $options 表达式\n     * @return false | integer\n     */\n    public function delete($options=array()) {\n        if(isset($options['table'])) {\n            $this->switchCollection($options['table']);\n        }\n        $query   = $this->parseWhere(isset($options['where'])?$options['where']:array());\n        $this->model  =   $options['model'];\n        $this->executeTimes++;\n        N('db_write',1); // 兼容代码        \n        if($this->config['debug']) {\n            $this->queryStr   =  $this->_dbName.'.'.$this->_collectionName.'.remove('.json_encode($query).')';\n        }\n        try{\n            $this->debug(true);\n            $result   = $this->_collection->remove($query);\n            $this->debug(false);\n            return $result;\n        } catch (\\MongoCursorException $e) {\n            E($e->getMessage());\n        }\n    }\n\n    /**\n     * 清空记录\n     * @access public\n     * @param array $options 表达式\n     * @return false | integer\n     */\n    public function clear($options=array()){\n        if(isset($options['table'])) {\n            $this->switchCollection($options['table']);\n        }\n        $this->model  =   $options['model'];\n        $this->executeTimes++;\n        N('db_write',1); // 兼容代码        \n        if($this->config['debug']) {\n            $this->queryStr   =  $this->_dbName.'.'.$this->_collectionName.'.remove({})';\n        }\n        try{\n            $this->debug(true);\n            $result   =  $this->_collection->drop();\n            $this->debug(false);\n            return $result;\n        } catch (\\MongoCursorException $e) {\n            E($e->getMessage());\n        }\n    }\n\n    /**\n     * 查找记录\n     * @access public\n     * @param array $options 表达式\n     * @return iterator\n     */\n    public function select($options=array()) {\n        if(isset($options['table'])) {\n            $this->switchCollection($options['table'],'',false);\n        }\n        $this->model  =   $options['model'];\n        $this->queryTimes++;\n        N('db_query',1); // 兼容代码        \n        $query  =  $this->parseWhere(isset($options['where'])?$options['where']:array());\n        $field  =  $this->parseField(isset($options['field'])?$options['field']:array());\n        try{\n            if($this->config['debug']) {\n                $this->queryStr   =  $this->_dbName.'.'.$this->_collectionName.'.find(';\n                $this->queryStr  .=  $query? json_encode($query):'{}';\n                if(is_array($field) && count($field)) {\n                    foreach ($field as $f=>$v)\n                        $_field_array[$f] = $v ? 1 : 0;\n\n                    $this->queryStr  .=  $field? ', '.json_encode($_field_array):', {}';\n                }\n                $this->queryStr  .=  ')';\n            }\n            $this->debug(true);\n            $_cursor   = $this->_collection->find($query,$field);\n            if(!empty($options['order'])) {\n                $order   =  $this->parseOrder($options['order']);\n                if($this->config['debug']) {\n                    $this->queryStr .= '.sort('.json_encode($order).')';\n                }\n                $_cursor =  $_cursor->sort($order);\n            }\n            if(isset($options['page'])) { // 根据页数计算limit\n                list($page,$length)   =   $options['page'];\n                $page    =  $page>0 ? $page : 1;\n                $length  =  $length>0 ? $length : (is_numeric($options['limit'])?$options['limit']:20);\n                $offset  =  $length*((int)$page-1);\n                $options['limit'] =  $offset.','.$length;\n            }\n            if(isset($options['limit'])) {\n                list($offset,$length) =  $this->parseLimit($options['limit']);\n                if(!empty($offset)) {\n                    if($this->config['debug']) {\n                        $this->queryStr .= '.skip('.intval($offset).')';\n                    }\n                    $_cursor =  $_cursor->skip(intval($offset));\n                }\n                if($this->config['debug']) {\n                    $this->queryStr .= '.limit('.intval($length).')';\n                }\n                $_cursor =  $_cursor->limit(intval($length));\n            }\n            $this->debug(false);\n            $this->_cursor =  $_cursor;\n            $resultSet  =  iterator_to_array($_cursor);\n            return $resultSet;\n        } catch (\\MongoCursorException $e) {\n            E($e->getMessage());\n        }\n    }\n\n    /**\n     * 查找某个记录\n     * @access public\n     * @param array $options 表达式\n     * @return array\n     */\n    public function find($options=array()){\n        $options['limit'] = 1;\n        $find = $this->select($options);\n        return array_shift($find);\n    }\n\n    /**\n     * 统计记录数\n     * @access public\n     * @param array $options 表达式\n     * @return iterator\n     */\n    public function count($options=array()){\n        if(isset($options['table'])) {\n            $this->switchCollection($options['table'],'',false);\n        }\n        $this->model  =   $options['model'];\n        $this->queryTimes++;\n        N('db_query',1); // 兼容代码        \n        $query  =  $this->parseWhere(isset($options['where'])?$options['where']:array());\n        if($this->config['debug']) {\n            $this->queryStr   =  $this->_dbName.'.'.$this->_collectionName;\n            $this->queryStr   .= $query?'.find('.json_encode($query).')':'';\n            $this->queryStr   .= '.count()';\n        }\n        try{\n            $this->debug(true);\n            $count   = $this->_collection->count($query);\n            $this->debug(false);\n            return $count;\n        } catch (\\MongoCursorException $e) {\n            E($e->getMessage());\n        }\n    }\n\n    public function group($keys,$initial,$reduce,$options=array()){\n        if(isset($options['table']) && $this->_collectionName != $options['table']) {\n            $this->switchCollection($options['table'],'',false);\n        }\n        \n        $cache  =  isset($options['cache'])?$options['cache']:false;\n        if($cache) {\n            $key    =  is_string($cache['key'])?$cache['key']:md5(serialize($options));\n            $value  =  S($key,'','',$cache['type']);\n            if(false !== $value) {\n                return $value;\n            }\n        }\n        \n        $this->model  =   $options['model'];\n        $this->queryTimes++;\n        N('db_query',1); // 兼容代码        \n        $query  =  $this->parseWhere(isset($options['where'])?$options['where']:array());\n        \n        if($this->config['debug']) {\n            $this->queryStr   =  $this->_dbName.'.'.$this->_collectionName.'.group({key:'.json_encode($keys).',cond:'.\n            json_encode($options['condition']) . ',reduce:' .\n            json_encode($reduce).',initial:'.\n            json_encode($initial).'})';\n        }\n        try{\n            $this->debug(true);\n            $option = array('condition'=>$options['condition'], 'finalize'=>$options['finalize'], 'maxTimeMS'=>$options['maxTimeMS']);\n            $group = $this->_collection->group($keys,$initial,$reduce,$options);\n            $this->debug(false);\n            \n            if($cache && $group['ok'])\n                S($key,$group,$cache['expire'],$cache['type']);\n            \n            return $group;\n        } catch (\\MongoCursorException $e) {\n            E($e->getMessage());\n        }\n    }\n\n    /**\n     * 取得数据表的字段信息\n     * @access public\n     * @return array\n     */\n    public function getFields($collection=''){\n        if(!empty($collection) && $collection != $this->_collectionName) {\n            $this->switchCollection($collection,'',false);\n        }\n        $this->queryTimes++;\n        N('db_query',1); // 兼容代码        \n        if($this->config['debug']) {\n            $this->queryStr   =  $this->_dbName.'.'.$this->_collectionName.'.findOne()';\n        }\n        try{\n            $this->debug(true);\n            $result   =  $this->_collection->findOne();\n            $this->debug(false);\n        } catch (\\MongoCursorException $e) {\n            E($e->getMessage());\n        }\n        if($result) { // 存在数据则分析字段\n            $info =  array();\n            foreach ($result as $key=>$val){\n                $info[$key] =  array(\n                    'name'  =>  $key,\n                    'type'  =>  getType($val),\n                );\n            }\n            return $info;\n        }\n        // 暂时没有数据 返回false\n        return false;\n    }\n\n    /**\n     * 取得当前数据库的collection信息\n     * @access public\n     */\n    public function getTables(){\n        if($this->config['debug']) {\n            $this->queryStr   =  $this->_dbName.'.getCollenctionNames()';\n        }\n        $this->queryTimes++;\n        N('db_query',1); // 兼容代码        \n        $this->debug(true);\n        $list   = $this->_mongo->listCollections();\n        $this->debug(false);\n        $info =  array();\n        foreach ($list as $collection){\n            $info[]   =  $collection->getName();\n        }\n        return $info;\n    }\n\n    /**\n     * 取得当前数据库的对象\n     * @access public\n     * @return object mongoClient\n     */\n    public function getDB(){\n        return $this->_mongo;\n    }\n    \n    /**\n     * 取得当前集合的对象\n     * @access public\n     * @return object MongoCollection\n     */\n    public function getCollection(){\n        return $this->_collection;\n    }\n\n    /**\n     * set分析\n     * @access protected\n     * @param array $data\n     * @return string\n     */\n    protected function parseSet($data) {\n        $result   =  array();\n        foreach ($data as $key=>$val){\n            if(is_array($val)) {\n                switch($val[0]) {\n                    case 'inc':\n                        $result['$inc'][$key]  =  (int)$val[1];\n                        break;\n                    case 'set':\n                    case 'unset':\n                    case 'push':\n                    case 'pushall':\n                    case 'addtoset':\n                    case 'pop':\n                    case 'pull':\n                    case 'pullall':\n                        $result['$'.$val[0]][$key] = $val[1];\n                        break;\n                    default:\n                        $result['$set'][$key] =  $val;\n                }\n            }else{\n                $result['$set'][$key]    = $val;\n            }\n        }\n        return $result;\n    }\n\n    /**\n     * order分析\n     * @access protected\n     * @param mixed $order\n     * @return array\n     */\n    protected function parseOrder($order) {\n        if(is_string($order)) {\n            $array   =  explode(',',$order);\n            $order   =  array();\n            foreach ($array as $key=>$val){\n                $arr  =  explode(' ',trim($val));\n                if(isset($arr[1])) {\n                    $arr[1]  =  $arr[1]=='asc'?1:-1;\n                }else{\n                    $arr[1]  =  1;\n                }\n                $order[$arr[0]]    = $arr[1];\n            }\n        }\n        return $order;\n    }\n\n    /**\n     * limit分析\n     * @access protected\n     * @param mixed $limit\n     * @return array\n     */\n    protected function parseLimit($limit) {\n        if(strpos($limit,',')) {\n            $array  =  explode(',',$limit);\n        }else{\n            $array   =  array(0,$limit);\n        }\n        return $array;\n    }\n\n    /**\n     * field分析\n     * @access protected\n     * @param mixed $fields\n     * @return array\n     */\n    public function parseField($fields){\n        if(empty($fields)) {\n            $fields    = array();\n        }\n        if(is_string($fields)) {\n            $_fields    = explode(',',$fields);\n            $fields     = array();\n            foreach ($_fields as $f)\n                $fields[$f] = true;\n        }elseif(is_array($fields)) {\n            $_fields    = $fields;\n            $fields     = array();\n            foreach ($_fields as $f=>$v) {\n                if(is_numeric($f))\n                    $fields[$v] = true;\n                else\n                    $fields[$f] = $v ? true : false;\n            }\n        }\n        return $fields;\n    }\n\n    /**\n     * where分析\n     * @access protected\n     * @param mixed $where\n     * @return array\n     */\n    public function parseWhere($where){\n        $query   = array();\n        $return     = array();\n        $_logic     = '$and';\n        if(isset($where['_logic'])){\n            $where['_logic']    = strtolower($where['_logic']);\n            $_logic             = in_array($where['_logic'], array('or','xor','nor', 'and'))?'$'.$where['_logic']:$_logic;\n            unset($where['_logic']);\n        }\n        foreach ($where as $key=>$val){\n            if('_id' != $key && 0===strpos($key,'_')) {\n                // 解析特殊条件表达式\n                $parse   = $this->parseThinkWhere($key,$val);\n                $query   = array_merge($query,$parse);\n            }else{\n                // 查询字段的安全过滤\n                if(!preg_match('/^[A-Z_\\|\\&\\-.a-z0-9]+$/',trim($key))){\n                    E(L('_ERROR_QUERY_').':'.$key);\n                }\n                $key = trim($key);\n                if(strpos($key,'|')) {\n                    $array   =  explode('|',$key);\n                    $str   = array();\n                    foreach ($array as $k){\n                        $str[]   = $this->parseWhereItem($k,$val);\n                    }\n                    $query['$or'] =    $str;\n                }elseif(strpos($key,'&')){\n                    $array   =  explode('&',$key);\n                    $str   = array();\n                    foreach ($array as $k){\n                        $str[]   = $this->parseWhereItem($k,$val);\n                    }\n                    $query   = array_merge($query,$str);\n                }else{\n                    $str   = $this->parseWhereItem($key,$val);\n                    $query   = array_merge($query,$str);\n                }\n            }\n        }\n        if($_logic == '$and')\n            return $query;\n        \n        foreach($query as $key=>$val)\n            $return[$_logic][]  = array($key=>$val);\n\n        return $return;\n    }\n\n    /**\n     * 特殊条件分析\n     * @access protected\n     * @param string $key\n     * @param mixed $val\n     * @return string\n     */\n    protected function parseThinkWhere($key,$val) {\n        $query   = array();\n        $_logic = array('or','xor','nor', 'and');\n        \n        switch($key) {\n            case '_query': // 字符串模式查询条件\n                parse_str($val,$query);\n                if(isset($query['_logic']) && strtolower($query['_logic']) == 'or' ) {\n                    unset($query['_logic']);\n                    $query['$or']   =  $query;\n                }\n                break;\n            case '_complex': // 子查询模式查询条件\n                $__logic = strtolower($val['_logic']);\n                if(isset($val['_logic']) && in_array($__logic, $_logic) ) {\n                    unset($val['_logic']);\n                    $query['$'.$__logic]   =  $val;\n                }\n                break;\n            case '_string':// MongoCode查询\n                $query['$where']  = new \\MongoCode($val);\n                break;\n        }\n        //兼容 MongoClient OR条件查询方法\n        if(isset($query['$or']) && !is_array(current($query['$or']))) {\n            $val = array();\n            foreach ($query['$or'] as $k=>$v)\n                $val[] = array($k=>$v);\n            $query['$or'] = $val;\n        }\n        return $query;\n    }\n\n    /**\n     * where子单元分析\n     * @access protected\n     * @param string $key\n     * @param mixed $val\n     * @return array\n     */\n    protected function parseWhereItem($key,$val) {\n        $query   = array();\n        if(is_array($val)) {\n            if(is_string($val[0])) {\n                $con  =  strtolower($val[0]);\n                if(in_array($con,array('neq','ne','gt','egt','gte','lt','lte','elt'))) { // 比较运算\n                    $k = '$'.$this->comparison[$con];\n                    $query[$key]  =  array($k=>$val[1]);\n                }elseif('like'== $con){ // 模糊查询 采用正则方式\n                    $query[$key]  =  new \\MongoRegex(\"/\".$val[1].\"/\");  \n                }elseif('mod'==$con){ // mod 查询\n                    $query[$key]   =  array('$mod'=>$val[1]);\n                }elseif('regex'==$con){ // 正则查询\n                    $query[$key]  =  new \\MongoRegex($val[1]);\n                }elseif(in_array($con,array('in','nin','not in'))){ // IN NIN 运算\n                    $data = is_string($val[1])? explode(',',$val[1]):$val[1];\n                    $k = '$'.$this->comparison[$con];\n                    $query[$key]  =  array($k=>$data);\n                }elseif('all'==$con){ // 满足所有指定条件\n                    $data = is_string($val[1])? explode(',',$val[1]):$val[1];\n                    $query[$key]  =  array('$all'=>$data);\n                }elseif('between'==$con){ // BETWEEN运算\n                    $data = is_string($val[1])? explode(',',$val[1]):$val[1];\n                    $query[$key]  =  array('$gte'=>$data[0],'$lte'=>$data[1]);\n                }elseif('not between'==$con){\n                    $data = is_string($val[1])? explode(',',$val[1]):$val[1];\n                    $query[$key]  =  array('$lt'=>$data[0],'$gt'=>$data[1]);\n                }elseif('exp'==$con){ // 表达式查询\n                    $query['$where']  = new \\MongoCode($val[1]);\n                }elseif('exists'==$con){ // 字段是否存在\n                    $query[$key]  = array('$exists'=>(bool)$val[1]);\n                }elseif('size'==$con){ // 限制属性大小\n                    $query[$key]  = array('$size'=>intval($val[1]));\n                }elseif('type'==$con){ // 限制字段类型 1 浮点型 2 字符型 3 对象或者MongoDBRef 5 MongoBinData 7 MongoId 8 布尔型 9 MongoDate 10 NULL 15 MongoCode 16 32位整型 17 MongoTimestamp 18 MongoInt64 如果是数组的话判断元素的类型\n                    $query[$key]  = array('$type'=>intval($val[1]));\n                }else{\n                    $query[$key]  =  $val;\n                }\n                return $query;\n            }\n        }\n        $query[$key]  =  $val;\n        return $query;\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Db/Driver/Mysql.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\nnamespace Think\\Db\\Driver;\nuse Think\\Db\\Driver;\n\n/**\n * mysql数据库驱动 \n */\nclass Mysql extends Driver{\n\n    /**\n     * 解析pdo连接的dsn信息\n     * @access public\n     * @param array $config 连接信息\n     * @return string\n     */\n    protected function parseDsn($config){\n        $dsn  =   'mysql:dbname='.$config['database'].';host='.$config['hostname'];\n        if(!empty($config['hostport'])) {\n            $dsn  .= ';port='.$config['hostport'];\n        }elseif(!empty($config['socket'])){\n            $dsn  .= ';unix_socket='.$config['socket'];\n        }\n\n        if(!empty($config['charset'])){\n            //为兼容各版本PHP,用两种方式设置编码\n            $this->options[\\PDO::MYSQL_ATTR_INIT_COMMAND]    =   'SET NAMES '.$config['charset'];\n            $dsn  .= ';charset='.$config['charset'];\n        }\n        return $dsn;\n    }\n\n    /**\n     * 取得数据表的字段信息\n     * @access public\n     */\n    public function getFields($tableName) {\n        $this->initConnect(true);\n        list($tableName) = explode(' ', $tableName);\n        if(strpos($tableName,'.')){\n        \tlist($dbName,$tableName) = explode('.',$tableName);\n\t\t\t$sql   = 'SHOW COLUMNS FROM `'.$dbName.'`.`'.$tableName.'`';\n        }else{\n        \t$sql   = 'SHOW COLUMNS FROM `'.$tableName.'`';\n        }\n        \n        $result = $this->query($sql);\n        $info   =   array();\n        if($result) {\n            foreach ($result as $key => $val) {\n\t\t\t\tif(\\PDO::CASE_LOWER != $this->_linkID->getAttribute(\\PDO::ATTR_CASE)){\n\t\t\t\t\t$val = array_change_key_case ( $val ,  CASE_LOWER );\n\t\t\t\t}\n                $info[$val['field']] = array(\n                    'name'    => $val['field'],\n                    'type'    => $val['type'],\n                    'notnull' => (bool) ($val['null'] === ''), // not null is empty, null is yes\n                    'default' => $val['default'],\n                    'primary' => (strtolower($val['key']) == 'pri'),\n                    'autoinc' => (strtolower($val['extra']) == 'auto_increment'),\n                );\n            }\n        }\n        return $info;\n    }\n\n    /**\n     * 取得数据库的表信息\n     * @access public\n     */\n    public function getTables($dbName='') {\n        $sql    = !empty($dbName)?'SHOW TABLES FROM '.$dbName:'SHOW TABLES ';\n        $result = $this->query($sql);\n        $info   =   array();\n        foreach ($result as $key => $val) {\n            $info[$key] = current($val);\n        }\n        return $info;\n    }\n\n    /**\n     * 字段和表名处理\n     * @access protected\n     * @param string $key\n     * @return string\n     */\n    protected function parseKey(&$key) {\n        $key   =  trim($key);\n        if(!is_numeric($key) && !preg_match('/[,\\'\\\"\\*\\(\\)`.\\s]/',$key)) {\n           $key = '`'.$key.'`';\n        }\n        return $key;\n    }\n\n    /**\n     * 批量插入记录\n     * @access public\n     * @param mixed $dataSet 数据集\n     * @param array $options 参数表达式\n     * @param boolean $replace 是否replace\n     * @return false | integer\n     */\n    public function insertAll($dataSet,$options=array(),$replace=false) {\n        $values  =  array();\n        $this->model  =   $options['model'];\n        if(!is_array($dataSet[0])) return false;\n        $this->parseBind(!empty($options['bind'])?$options['bind']:array());\n        $fields =   array_map(array($this,'parseKey'),array_keys($dataSet[0]));\n        foreach ($dataSet as $data){\n            $value   =  array();\n            foreach ($data as $key=>$val){\n                if(is_array($val) && 'exp' == $val[0]){\n                    $value[]   =  $val[1];\n                }elseif(is_null($val)){\n                    $value[]   =   'NULL';\n                }elseif(is_scalar($val)){\n                    if(0===strpos($val,':') && in_array($val,array_keys($this->bind))){\n                        $value[]   =   $this->parseValue($val);\n                    }else{\n                        $name       =   count($this->bind);\n                        $value[]   =   ':'.$name;\n                        $this->bindParam($name,$val);\n                    }\n                }\n            }\n            $values[]    = '('.implode(',', $value).')';\n        }\n        // 兼容数字传入方式\n        $replace= (is_numeric($replace) && $replace>0)?true:$replace;\n        $sql    =  (true===$replace?'REPLACE':'INSERT').' INTO '.$this->parseTable($options['table']).' ('.implode(',', $fields).') VALUES '.implode(',',$values).$this->parseDuplicate($replace);\n        $sql    .= $this->parseComment(!empty($options['comment'])?$options['comment']:'');\n        return $this->execute($sql,!empty($options['fetch_sql']) ? true : false);\n    }\n\n    /**\n     * ON DUPLICATE KEY UPDATE 分析\n     * @access protected\n     * @param mixed $duplicate \n     * @return string\n     */\n    protected function parseDuplicate($duplicate){\n        // 布尔值或空则返回空字符串\n        if(is_bool($duplicate) || empty($duplicate)) return '';\n        \n        if(is_string($duplicate)){\n        \t// field1,field2 转数组\n        \t$duplicate = explode(',', $duplicate);\n        }elseif(is_object($duplicate)){\n        \t// 对象转数组\n        \t$duplicate = get_class_vars($duplicate);\n        }\n        $updates                    = array();\n        foreach((array) $duplicate as $key=>$val){\n            if(is_numeric($key)){ // array('field1', 'field2', 'field3') 解析为 ON DUPLICATE KEY UPDATE field1=VALUES(field1), field2=VALUES(field2), field3=VALUES(field3)\n                $updates[]          = $this->parseKey($val).\"=VALUES(\".$this->parseKey($val).\")\";\n            }else{\n                if(is_scalar($val)) // 兼容标量传值方式\n                    $val            = array('value', $val);\n                if(!isset($val[1])) continue;\n                switch($val[0]){\n                    case 'exp': // 表达式\n                        $updates[]  = $this->parseKey($key).\"=($val[1])\";\n                        break;\n                    case 'value': // 值\n                    default:\n                        $name       = count($this->bind);\n                        $updates[]  = $this->parseKey($key).\"=:\".$name;\n                        $this->bindParam($name, $val[1]);\n                        break;\n                }\n            }\n        }\n        if(empty($updates)) return '';\n        return \" ON DUPLICATE KEY UPDATE \".join(', ', $updates);\n    }\n    \n\t\n\n    /**\n     * 执行存储过程查询 返回多个数据集\n     * @access public\n     * @param string $str  sql指令\n     * @param boolean $fetchSql  不执行只是获取SQL\n     * @return mixed\n     */\n    public function procedure($str,$fetchSql=false) {\n        $this->initConnect(false);\n        $this->_linkID->setAttribute(\\PDO::ATTR_ERRMODE, \\PDO::ERRMODE_WARNING);\n        if ( !$this->_linkID ) return false;\n        $this->queryStr     =   $str;\n        if($fetchSql){\n            return $this->queryStr;\n        }\n        //释放前次的查询结果\n        if ( !empty($this->PDOStatement) ) $this->free();\n        $this->queryTimes++;\n        N('db_query',1); // 兼容代码\n        // 调试开始\n        $this->debug(true);\n        $this->PDOStatement = $this->_linkID->prepare($str);\n        if(false === $this->PDOStatement){\n            $this->error();\n            return false;\n        }\n        try{\n            $result = $this->PDOStatement->execute();\n            // 调试结束\n            $this->debug(false);\n            do\n            {\n                $result = $this->PDOStatement->fetchAll(\\PDO::FETCH_ASSOC);\n                if ($result)\n                {\n                    $resultArr[] = $result;\n                }\n            }\n            while ($this->PDOStatement->nextRowset());\n            $this->_linkID->setAttribute(\\PDO::ATTR_ERRMODE, $this->options[\\PDO::ATTR_ERRMODE]);\n            return $resultArr;\n        }catch (\\PDOException $e) {\n            $this->error();\n            $this->_linkID->setAttribute(\\PDO::ATTR_ERRMODE, $this->options[\\PDO::ATTR_ERRMODE]);\n            return false;\n        }\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Db/Driver/Oracle.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\nnamespace Think\\Db\\Driver;\nuse Think\\Db\\Driver;\n\n/**\n * Oracle数据库驱动\n */\nclass Oracle extends Driver{\n\n    private     $table        = '';\n    protected   $selectSql    = 'SELECT * FROM (SELECT thinkphp.*, rownum AS numrow FROM (SELECT  %DISTINCT% %FIELD% FROM %TABLE%%JOIN%%WHERE%%GROUP%%HAVING%%ORDER%) thinkphp ) %LIMIT%%COMMENT%';\n\n    /**\n     * 解析pdo连接的dsn信息\n     * @access public\n     * @param array $config 连接信息\n     * @return string\n     */\n    protected function parseDsn($config){\n        $dsn  =   'oci:dbname=//'.$config['hostname'].($config['hostport']?':'.$config['hostport']:'').'/'.$config['database'];\n        if(!empty($config['charset'])) {\n            $dsn  .= ';charset='.$config['charset'];\n        }\n        return $dsn;\n    }\n\n    /**\n     * 执行语句\n     * @access public\n     * @param string $str  sql指令\n     * @param boolean $fetchSql  不执行只是获取SQL     \n     * @return integer\n     */\n    public function execute($str,$fetchSql=false) {\n        $this->initConnect(true);\n        if ( !$this->_linkID ) return false;\n        $this->queryStr = $str;\n        if(!empty($this->bind)){\n            $that   =   $this;\n            $this->queryStr =   strtr($this->queryStr,array_map(function($val) use($that){ return '\\''.$that->escapeString($val).'\\''; },$this->bind));\n        }\n        if($fetchSql){\n            return $this->queryStr;\n        }\n        $flag = false;\n        if(preg_match(\"/^\\s*(INSERT\\s+INTO)\\s+(\\w+)\\s+/i\", $str, $match)) {\n            $this->table = C(\"DB_SEQUENCE_PREFIX\").str_ireplace(C(\"DB_PREFIX\"), \"\", $match[2]);\n            $flag = (boolean)$this->query(\"SELECT * FROM user_sequences WHERE sequence_name='\" . strtoupper($this->table) . \"'\");\n        }\n        //释放前次的查询结果\n        if ( !empty($this->PDOStatement) ) $this->free();\n        $this->executeTimes++;\n        N('db_write',1); // 兼容代码        \n        // 记录开始执行时间\n        $this->debug(true);\n        $this->PDOStatement\t=\t$this->_linkID->prepare($str);\n        if(false === $this->PDOStatement) {\n            $this->error();\n            return false;\n        }\n        foreach ($this->bind as $key => $val) {\n            if(is_array($val)){\n                $this->PDOStatement->bindValue($key, $val[0], $val[1]);\n            }else{\n                $this->PDOStatement->bindValue($key, $val);\n            }\n        }\n        $this->bind =   array();        \n        $result\t=\t$this->PDOStatement->execute();\n        $this->debug(false);\n        if ( false === $result) {\n            $this->error();\n            return false;\n        } else {\n            $this->numRows = $this->PDOStatement->rowCount();\n            if($flag || preg_match(\"/^\\s*(INSERT\\s+INTO|REPLACE\\s+INTO)\\s+/i\", $str)) {\n                $this->lastInsID = $this->_linkID->lastInsertId();\n            }\n            return $this->numRows;\n        }\n    }\n\n    /**\n     * 取得数据表的字段信息\n     * @access public\n     */\n     public function getFields($tableName) {\n        list($tableName) = explode(' ', $tableName);\n        $result = $this->query(\"select a.column_name,data_type,decode(nullable,'Y',0,1) notnull,data_default,decode(a.column_name,b.column_name,1,0) pk \"\n                  .\"from user_tab_columns a,(select column_name from user_constraints c,user_cons_columns col \"\n          .\"where c.constraint_name=col.constraint_name and c.constraint_type='P'and c.table_name='\".strtoupper($tableName)\n          .\"') b where table_name='\".strtoupper($tableName).\"' and a.column_name=b.column_name(+)\");\n        $info   =   array();\n        if($result) {\n            foreach ($result as $key => $val) {\n                $info[strtolower($val['column_name'])] = array(\n                    'name'    => strtolower($val['column_name']),\n                    'type'    => strtolower($val['data_type']),\n                    'notnull' => $val['notnull'],\n                    'default' => $val['data_default'],\n                    'primary' => $val['pk'],\n                    'autoinc' => $val['pk'],\n                );\n            }\n        }\n        return $info;\n    }\n\n    /**\n     * 取得数据库的表信息（暂时实现取得用户表信息）\n     * @access public\n     */\n    public function getTables($dbName='') {\n        $result = $this->query(\"select table_name from user_tables\");\n        $info   =   array();\n        foreach ($result as $key => $val) {\n            $info[$key] = current($val);\n        }\n        return $info;\n    }\n\n    /**\n     * SQL指令安全过滤\n     * @access public\n     * @param string $str  SQL指令\n     * @return string\n     */\n    public function escapeString($str) {\n        return str_ireplace(\"'\", \"''\", $str);\n    }\n\n    /**\n     * limit\n     * @access public\n     * @return string\n     */\n\tpublic function parseLimit($limit) {\n        $limitStr    = '';\n        if(!empty($limit)) {\n            $limit\t=\texplode(',',$limit);\n            if(count($limit)>1)\n                $limitStr = \"(numrow>\" . $limit[0] . \") AND (numrow<=\" . ($limit[0]+$limit[1]) . \")\";\n            else\n                $limitStr = \"(numrow>0 AND numrow<=\".$limit[0].\")\";\n        }\n        return $limitStr?' WHERE '.$limitStr:'';\n    }\n\n    /**\n     * 设置锁机制\n     * @access protected\n     * @return string\n     */\n    protected function parseLock($lock=false) {\n        if(!$lock) return '';\n        return ' FOR UPDATE NOWAIT ';\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Db/Driver/Pgsql.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\nnamespace Think\\Db\\Driver;\nuse Think\\Db\\Driver;\n\n/**\n * Pgsql数据库驱动\n */\nclass Pgsql extends Driver{\n\n    /**\n     * 解析pdo连接的dsn信息\n     * @access public\n     * @param array $config 连接信息\n     * @return string\n     */\n    protected function parseDsn($config){\n        $dsn  =   'pgsql:dbname='.$config['database'].';host='.$config['hostname'];\n        if(!empty($config['hostport'])) {\n            $dsn  .= ';port='.$config['hostport'];\n        }\n        return $dsn;\n    }\n\n    /**\n     * 取得数据表的字段信息\n     * @access public\n     * @return array\n     */\n    public function getFields($tableName) {\n        list($tableName) = explode(' ', $tableName);\n        $result =   $this->query('select fields_name as \"field\",fields_type as \"type\",fields_not_null as \"null\",fields_key_name as \"key\",fields_default as \"default\",fields_default as \"extra\" from table_msg('.$tableName.');');\n        $info   =   array();\n        if($result){\n            foreach ($result as $key => $val) {\n                $info[$val['field']] = array(\n                    'name'    => $val['field'],\n                    'type'    => $val['type'],\n                    'notnull' => (bool) ($val['null'] === ''), // not null is empty, null is yes\n                    'default' => $val['default'],\n                    'primary' => (strtolower($val['key']) == 'pri'),\n                    'autoinc' => (strtolower($val['extra']) == 'auto_increment'),\n                );\n            }\n        }\n        return $info;\n    }\n\n    /**\n     * 取得数据库的表信息\n     * @access public\n     * @return array\n     */\n    public function getTables($dbName='') {\n        $result =   $this->query(\"select tablename as Tables_in_test from pg_tables where  schemaname ='public'\");\n        $info   =   array();\n        foreach ($result as $key => $val) {\n            $info[$key] = current($val);\n        }\n        return $info;\n    }\n\n    /**\n     * limit分析\n     * @access protected\n     * @param mixed $lmit\n     * @return string\n     */\n    public function parseLimit($limit) {\n        $limitStr    = '';\n        if(!empty($limit)) {\n            $limit  =   explode(',',$limit);\n            if(count($limit)>1) {\n                $limitStr .= ' LIMIT '.$limit[1].' OFFSET '.$limit[0].' ';\n            }else{\n                $limitStr .= ' LIMIT '.$limit[0].' ';\n            }\n        }\n        return $limitStr;\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Db/Driver/Sqlite.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\nnamespace Think\\Db\\Driver;\nuse Think\\Db\\Driver;\n\n/**\n * Sqlite数据库驱动\n */\nclass Sqlite extends Driver {\n\n    /**\n     * 解析pdo连接的dsn信息\n     * @access public\n     * @param array $config 连接信息\n     * @return string\n     */\n    protected function parseDsn($config){\n        $dsn  =   'sqlite:'.$config['database'];\n        return $dsn;\n    }\n\n    /**\n     * 取得数据表的字段信息\n     * @access public\n     * @return array\n     */\n    public function getFields($tableName) {\n        list($tableName) = explode(' ', $tableName);\n        $result =   $this->query('PRAGMA table_info( '.$tableName.' )');\n        $info   =   array();\n        if($result){\n            foreach ($result as $key => $val) {\n                $info[$val['field']] = array(\n                    'name'    => $val['field'],\n                    'type'    => $val['type'],\n                    'notnull' => (bool) ($val['null'] === ''), // not null is empty, null is yes\n                    'default' => $val['default'],\n                    'primary' => (strtolower($val['dey']) == 'pri'),\n                    'autoinc' => (strtolower($val['extra']) == 'auto_increment'),\n                );\n            }\n        }\n        return $info;\n    }\n\n    /**\n     * 取得数据库的表信息\n     * @access public\n     * @return array\n     */\n    public function getTables($dbName='') {\n        $result =   $this->query(\"SELECT name FROM sqlite_master WHERE type='table' \"\n             . \"UNION ALL SELECT name FROM sqlite_temp_master \"\n             . \"WHERE type='table' ORDER BY name\");\n        $info   =   array();\n        foreach ($result as $key => $val) {\n            $info[$key] = current($val);\n        }\n        return $info;\n    }\n\n    /**\n     * SQL指令安全过滤\n     * @access public\n     * @param string $str  SQL指令\n     * @return string\n     */\n    public function escapeString($str) {\n        return str_ireplace(\"'\", \"''\", $str);\n    }\n\n    /**\n     * limit\n     * @access public\n     * @return string\n     */\n    public function parseLimit($limit) {\n        $limitStr    = '';\n        if(!empty($limit)) {\n            $limit  =   explode(',',$limit);\n            if(count($limit)>1) {\n                $limitStr .= ' LIMIT '.$limit[1].' OFFSET '.$limit[0].' ';\n            }else{\n                $limitStr .= ' LIMIT '.$limit[0].' ';\n            }\n        }\n        return $limitStr;\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Db/Driver/Sqlsrv.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\nnamespace Think\\Db\\Driver;\nuse Think\\Db\\Driver;\nuse PDO;\n\n/**\n * Sqlsrv数据库驱动\n */\nclass Sqlsrv extends Driver{\n    protected $selectSql  =     'SELECT T1.* FROM (SELECT thinkphp.*, ROW_NUMBER() OVER (%ORDER%) AS ROW_NUMBER FROM (SELECT %DISTINCT% %FIELD% FROM %TABLE%%JOIN%%WHERE%%GROUP%%HAVING% %UNION%) AS thinkphp) AS T1 %LIMIT%%COMMENT%';\n    // PDO连接参数\n    protected $options = array(\n        PDO::ATTR_CASE              =>  PDO::CASE_LOWER,\n        PDO::ATTR_ERRMODE           =>  PDO::ERRMODE_EXCEPTION,\n        PDO::ATTR_STRINGIFY_FETCHES =>  false,\n        PDO::SQLSRV_ATTR_ENCODING   =>  PDO::SQLSRV_ENCODING_UTF8,\n    );\n\n    /**\n     * 解析pdo连接的dsn信息\n     * @access public\n     * @param array $config 连接信息\n     * @return string\n     */\n    protected function parseDsn($config){\n        $dsn  =   'sqlsrv:Database='.$config['database'].';Server='.$config['hostname'];\n        if(!empty($config['hostport'])) {\n            $dsn  .= ','.$config['hostport'];\n        }\n        return $dsn;\n    }\n\n    /**\n     * 取得数据表的字段信息\n     * @access public\n     * @return array\n     */\n    public function getFields($tableName) {\n        list($tableName) = explode(' ', $tableName);\n        $result =   $this->query(\"SELECT   column_name,   data_type,   column_default,   is_nullable\n        FROM    information_schema.tables AS t\n        JOIN    information_schema.columns AS c\n        ON  t.table_catalog = c.table_catalog\n        AND t.table_schema  = c.table_schema\n        AND t.table_name    = c.table_name\n        WHERE   t.table_name = '$tableName'\");\n        $info   =   array();\n        if($result) {\n            foreach ($result as $key => $val) {\n                $info[$val['column_name']] = array(\n                    'name'    => $val['column_name'],\n                    'type'    => $val['data_type'],\n                    'notnull' => (bool) ($val['is_nullable'] === ''), // not null is empty, null is yes\n                    'default' => $val['column_default'],\n                    'primary' => false,\n                    'autoinc' => false,\n                );\n            }\n        }\n        return $info;\n    }\n\n    /**\n     * 取得数据表的字段信息\n     * @access public\n     * @return array\n     */\n    public function getTables($dbName='') {\n        $result   =  $this->query(\"SELECT TABLE_NAME\n            FROM INFORMATION_SCHEMA.TABLES\n            WHERE TABLE_TYPE = 'BASE TABLE'\n            \");\n        $info   =   array();\n        foreach ($result as $key => $val) {\n            $info[$key] = current($val);\n        }\n        return $info;\n    }\n\n\t/**\n     * order分析\n     * @access protected\n     * @param mixed $order\n     * @return string\n     */\n    protected function parseOrder($order) {\n        return !empty($order)?  ' ORDER BY '.$order:' ORDER BY rand()';\n    }\n\n    /**\n     * 字段名分析\n     * @access protected\n     * @param string $key\n     * @return string\n     */\n    protected function parseKey(&$key) {\n        $key   =  trim($key);\n        if(!is_numeric($key) && !preg_match('/[,\\'\\\"\\*\\(\\)\\[.\\s]/',$key)) {\n           $key = '['.$key.']';\n        }\n        return $key;   \n    }\n\n    /**\n     * limit\n     * @access public\n     * @param mixed $limit\n     * @return string\n     */\n    public function parseLimit($limit) {\n        if(empty($limit)) return '';\n        $limit\t=\texplode(',',$limit);\n        if(count($limit)>1)\n            $limitStr\t=\t'(T1.ROW_NUMBER BETWEEN '.$limit[0].' + 1 AND '.$limit[0].' + '.$limit[1].')';\n        else\n            $limitStr = '(T1.ROW_NUMBER BETWEEN 1 AND '.$limit[0].\")\";\n        return 'WHERE '.$limitStr;\n    }\n\n    /**\n     * 更新记录\n     * @access public\n     * @param mixed $data 数据\n     * @param array $options 表达式\n     * @return false | integer\n     */\n    public function update($data,$options) {\n        $this->model  =   $options['model'];\n        $this->parseBind(!empty($options['bind'])?$options['bind']:array());\n        $sql   = 'UPDATE '\n            .$this->parseTable($options['table'])\n            .$this->parseSet($data)\n            .$this->parseWhere(!empty($options['where'])?$options['where']:'')\n            .$this->parseLock(isset($options['lock'])?$options['lock']:false)\n            .$this->parseComment(!empty($options['comment'])?$options['comment']:'');\n        return $this->execute($sql,!empty($options['fetch_sql']) ? true : false);\n    }\n\n    /**\n     * 删除记录\n     * @access public\n     * @param array $options 表达式\n     * @return false | integer\n     */\n    public function delete($options=array()) {\n        $this->model  =   $options['model'];\n        $this->parseBind(!empty($options['bind'])?$options['bind']:array());\n        $sql   = 'DELETE FROM '\n            .$this->parseTable($options['table'])\n            .$this->parseWhere(!empty($options['where'])?$options['where']:'')\n            .$this->parseLock(isset($options['lock'])?$options['lock']:false)\n            .$this->parseComment(!empty($options['comment'])?$options['comment']:'');\n        return $this->execute($sql,!empty($options['fetch_sql']) ? true : false);\n    }\n\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Db/Driver.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\nnamespace Think\\Db;\nuse Think\\Config;\nuse Think\\Debug;\nuse Think\\Log;\nuse PDO;\n\nabstract class Driver {\n    // PDO操作实例\n    protected $PDOStatement = null;\n    // 当前操作所属的模型名\n    protected $model      = '_think_';\n    // 当前SQL指令\n    protected $queryStr   = '';\n    protected $modelSql   = array();\n    // 最后插入ID\n    protected $lastInsID  = null;\n    // 返回或者影响记录数\n    protected $numRows    = 0;\n    // 事务指令数\n    protected $transTimes = 0;\n    // 错误信息\n    protected $error      = '';\n    // 数据库连接ID 支持多个连接\n    protected $linkID     = array();\n    // 当前连接ID\n    protected $_linkID    = null;\n    // 数据库连接参数配置\n    protected $config     = array(\n        'type'              =>  '',     // 数据库类型\n        'hostname'          =>  '127.0.0.1', // 服务器地址\n        'database'          =>  '',          // 数据库名\n        'username'          =>  '',      // 用户名\n        'password'          =>  '',          // 密码\n        'hostport'          =>  '',        // 端口     \n        'dsn'               =>  '', //          \n        'params'            =>  array(), // 数据库连接参数        \n        'charset'           =>  'utf8',      // 数据库编码默认采用utf8  \n        'prefix'            =>  '',    // 数据库表前缀\n        'debug'             =>  false, // 数据库调试模式\n        'deploy'            =>  0, // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)\n        'rw_separate'       =>  false,       // 数据库读写是否分离 主从式有效\n        'master_num'        =>  1, // 读写分离后 主服务器数量\n        'slave_no'          =>  '', // 指定从服务器序号\n        'db_like_fields'    =>  '', \n    );\n    // 数据库表达式\n    protected $exp = array('eq'=>'=','neq'=>'<>','gt'=>'>','egt'=>'>=','lt'=>'<','elt'=>'<=','notlike'=>'NOT LIKE','like'=>'LIKE','in'=>'IN','notin'=>'NOT IN','not in'=>'NOT IN','between'=>'BETWEEN','not between'=>'NOT BETWEEN','notbetween'=>'NOT BETWEEN');\n    // 查询表达式\n    protected $selectSql  = 'SELECT%DISTINCT% %FIELD% FROM %TABLE%%FORCE%%JOIN%%WHERE%%GROUP%%HAVING%%ORDER%%LIMIT% %UNION%%LOCK%%COMMENT%';\n    // 查询次数\n    protected $queryTimes   =   0;\n    // 执行次数\n    protected $executeTimes =   0;\n    // PDO连接参数\n    protected $options = array(\n        PDO::ATTR_CASE              =>  PDO::CASE_LOWER,\n        PDO::ATTR_ERRMODE           =>  PDO::ERRMODE_EXCEPTION,\n        PDO::ATTR_ORACLE_NULLS      =>  PDO::NULL_NATURAL,\n        PDO::ATTR_STRINGIFY_FETCHES =>  false,\n    );\n    protected $bind         =   array(); // 参数绑定\n\n    /**\n     * 架构函数 读取数据库配置信息\n     * @access public\n     * @param array $config 数据库配置数组\n     */\n    public function __construct($config=''){\n        if(!empty($config)) {\n            $this->config   =   array_merge($this->config,$config);\n            if(is_array($this->config['params'])){\n                $this->options  =   $this->config['params'] + $this->options;\n            }\n        }\n    }\n\n    /**\n     * 连接数据库方法\n     * @access public\n     */\n    public function connect($config='',$linkNum=0,$autoConnection=false) {\n        if ( !isset($this->linkID[$linkNum]) ) {\n            if(empty($config))  $config =   $this->config;\n            try{\n                if(empty($config['dsn'])) {\n                    $config['dsn']  =   $this->parseDsn($config);\n                }\n                if(version_compare(PHP_VERSION,'5.3.6','<=')){ \n                    // 禁用模拟预处理语句\n                    $this->options[PDO::ATTR_EMULATE_PREPARES]  =   false;\n                }\n                $this->linkID[$linkNum] = new PDO( $config['dsn'], $config['username'], $config['password'],$this->options);\n            }catch (\\PDOException $e) {\n                if($autoConnection){\n                    trace($e->getMessage(),'','ERR');\n                    return $this->connect($autoConnection,$linkNum);\n                }elseif($config['debug']){\n                    E($e->getMessage());\n                }\n            }\n        }\n        return $this->linkID[$linkNum];\n    }\n\n    /**\n     * 解析pdo连接的dsn信息\n     * @access public\n     * @param array $config 连接信息\n     * @return string\n     */\n    protected function parseDsn($config){}\n\n    /**\n     * 释放查询结果\n     * @access public\n     */\n    public function free() {\n        $this->PDOStatement = null;\n    }\n\n    /**\n     * 执行查询 返回数据集\n     * @access public\n     * @param string $str  sql指令\n     * @param boolean $fetchSql  不执行只是获取SQL\n     * @return mixed\n     */\n    public function query($str,$fetchSql=false) {\n        $this->initConnect(false);\n        if ( !$this->_linkID ) return false;\n        $this->queryStr     =   $str;\n        if(!empty($this->bind)){\n            $that   =   $this;\n            $this->queryStr =   strtr($this->queryStr,array_map(function($val) use($that){ return '\\''.$that->escapeString($val).'\\''; },$this->bind));\n        }\n        if($fetchSql){\n            return $this->queryStr;\n        }\n        //释放前次的查询结果\n        if ( !empty($this->PDOStatement) ) $this->free();\n        $this->queryTimes++;\n        N('db_query',1); // 兼容代码\n        // 调试开始\n        $this->debug(true);\n        $this->PDOStatement = $this->_linkID->prepare($str);\n        if(false === $this->PDOStatement){\n            $this->error();\n            return false;\n        }\n        foreach ($this->bind as $key => $val) {\n            if(is_array($val)){\n                $this->PDOStatement->bindValue($key, $val[0], $val[1]);\n            }else{\n                $this->PDOStatement->bindValue($key, $val);\n            }\n        }\n        $this->bind =   array();\n        try{\n            $result =   $this->PDOStatement->execute();\n            // 调试结束\n            $this->debug(false);\n            if ( false === $result ) {\n                $this->error();\n                return false;\n            } else {\n                return $this->getResult();\n            }\n        }catch (\\PDOException $e) {\n            $this->error();\n            return false;\n        }\n    }\n\n    /**\n     * 执行语句\n     * @access public\n     * @param string $str  sql指令\n     * @param boolean $fetchSql  不执行只是获取SQL\n     * @return mixed\n     */\n    public function execute($str,$fetchSql=false) {\n        $this->initConnect(true);\n        if ( !$this->_linkID ) return false;\n        $this->queryStr = $str;\n        if(!empty($this->bind)){\n            $that   =   $this;\n            $this->queryStr =   strtr($this->queryStr,array_map(function($val) use($that){ return '\\''.$that->escapeString($val).'\\''; },$this->bind));\n        }\n        if($fetchSql){\n            return $this->queryStr;\n        }\n        //释放前次的查询结果\n        if ( !empty($this->PDOStatement) ) $this->free();\n        $this->executeTimes++;\n        N('db_write',1); // 兼容代码\n        // 记录开始执行时间\n        $this->debug(true);\n        $this->PDOStatement =   $this->_linkID->prepare($str);\n        if(false === $this->PDOStatement) {\n            $this->error();\n            return false;\n        }\n        foreach ($this->bind as $key => $val) {\n            if(is_array($val)){\n                $this->PDOStatement->bindValue($key, $val[0], $val[1]);\n            }else{\n                $this->PDOStatement->bindValue($key, $val);\n            }\n        }\n        $this->bind =   array();\n        try{\n            $result =   $this->PDOStatement->execute();\n            // 调试结束\n            $this->debug(false);\n            if ( false === $result) {\n                $this->error();\n                return false;\n            } else {\n                $this->numRows = $this->PDOStatement->rowCount();\n                if(preg_match(\"/^\\s*(INSERT\\s+INTO|REPLACE\\s+INTO)\\s+/i\", $str)) {\n                    $this->lastInsID = $this->_linkID->lastInsertId();\n                }\n                return $this->numRows;\n            }\n        }catch (\\PDOException $e) {\n            $this->error();\n            return false;\n        }\n    }\n\n    /**\n     * 启动事务\n     * @access public\n     * @return void\n     */\n    public function startTrans() {\n        $this->initConnect(true);\n        if ( !$this->_linkID ) return false;\n        //数据rollback 支持\n        if ($this->transTimes == 0) {\n            $this->_linkID->beginTransaction();\n        }\n        $this->transTimes++;\n        return ;\n    }\n\n    /**\n     * 用于非自动提交状态下面的查询提交\n     * @access public\n     * @return boolean\n     */\n    public function commit() {\n        if ($this->transTimes > 0) {\n            $result = $this->_linkID->commit();\n            $this->transTimes = 0;\n            if(!$result){\n                $this->error();\n                return false;\n            }\n        }\n        return true;\n    }\n\n    /**\n     * 事务回滚\n     * @access public\n     * @return boolean\n     */\n    public function rollback() {\n        if ($this->transTimes > 0) {\n            $result = $this->_linkID->rollback();\n            $this->transTimes = 0;\n            if(!$result){\n                $this->error();\n                return false;\n            }\n        }\n        return true;\n    }\n\n    /**\n     * 获得所有的查询数据\n     * @access private\n     * @return array\n     */\n    private function getResult() {\n        //返回数据集\n        $result =   $this->PDOStatement->fetchAll(PDO::FETCH_ASSOC);\n        $this->numRows = count( $result );\n        return $result;\n    }\n\n    /**\n     * 获得查询次数\n     * @access public\n     * @param boolean $execute 是否包含所有查询\n     * @return integer\n     */\n    public function getQueryTimes($execute=false){\n        return $execute?$this->queryTimes+$this->executeTimes:$this->queryTimes;\n    }\n\n    /**\n     * 获得执行次数\n     * @access public\n     * @return integer\n     */\n    public function getExecuteTimes(){\n        return $this->executeTimes;\n    }\n\n    /**\n     * 关闭数据库\n     * @access public\n     */\n    public function close() {\n        $this->_linkID = null;\n    }\n\n    /**\n     * 数据库错误信息\n     * 并显示当前的SQL语句\n     * @access public\n     * @return string\n     */\n    public function error() {\n        if($this->PDOStatement) {\n            $error = $this->PDOStatement->errorInfo();\n            $this->error = $error[1].':'.$error[2];\n        }else{\n            $this->error = '';\n        }\n        if('' != $this->queryStr){\n            $this->error .= \"\\n [ SQL语句 ] : \".$this->queryStr;\n        }\n        // 记录错误日志\n        trace($this->error,'','ERR');\n        if($this->config['debug']) {// 开启数据库调试模式\n            E($this->error);\n        }else{\n            return $this->error;\n        }\n    }\n\n    /**\n     * 设置锁机制\n     * @access protected\n     * @return string\n     */\n    protected function parseLock($lock=false) {\n        return $lock?   ' FOR UPDATE '  :   '';\n    }\n\n    /**\n     * set分析\n     * @access protected\n     * @param array $data\n     * @return string\n     */\n    protected function parseSet($data) {\n        foreach ($data as $key=>$val){\n            if(is_array($val) && 'exp' == $val[0]){\n                $set[]  =   $this->parseKey($key).'='.$val[1];\n            }elseif(is_null($val)){\n                $set[]  =   $this->parseKey($key).'=NULL';\n            }elseif(is_scalar($val)) {// 过滤非标量数据\n                if(0===strpos($val,':') && in_array($val,array_keys($this->bind)) ){\n                    $set[]  =   $this->parseKey($key).'='.$this->escapeString($val);\n                }else{\n                    $name   =   count($this->bind);\n                    $set[]  =   $this->parseKey($key).'=:'.$name;\n                    $this->bindParam($name,$val);\n                }\n            }\n        }\n        return ' SET '.implode(',',$set);\n    }\n\n    /**\n     * 参数绑定\n     * @access protected\n     * @param string $name 绑定参数名\n     * @param mixed $value 绑定值\n     * @return void\n     */\n    protected function bindParam($name,$value){\n        $this->bind[':'.$name]  =   $value;\n    }\n\n    /**\n     * 字段名分析\n     * @access protected\n     * @param string $key\n     * @return string\n     */\n    protected function parseKey(&$key) {\n        return $key;\n    }\n    \n    /**\n     * value分析\n     * @access protected\n     * @param mixed $value\n     * @return string\n     */\n    protected function parseValue($value) {\n        if(is_string($value)) {\n            $value =  strpos($value,':') === 0 && in_array($value,array_keys($this->bind))? $this->escapeString($value) : '\\''.$this->escapeString($value).'\\'';\n        }elseif(isset($value[0]) && is_string($value[0]) && strtolower($value[0]) == 'exp'){\n            $value =  $this->escapeString($value[1]);\n        }elseif(is_array($value)) {\n            $value =  array_map(array($this, 'parseValue'),$value);\n        }elseif(is_bool($value)){\n            $value =  $value ? '1' : '0';\n        }elseif(is_null($value)){\n            $value =  'null';\n        }\n        return $value;\n    }\n\n    /**\n     * field分析\n     * @access protected\n     * @param mixed $fields\n     * @return string\n     */\n    protected function parseField($fields) {\n        if(is_string($fields) && '' !== $fields) {\n            $fields    = explode(',',$fields);\n        }\n        if(is_array($fields)) {\n            // 完善数组方式传字段名的支持\n            // 支持 'field1'=>'field2' 这样的字段别名定义\n            $array   =  array();\n            foreach ($fields as $key=>$field){\n                if(!is_numeric($key))\n                    $array[] =  $this->parseKey($key).' AS '.$this->parseKey($field);\n                else\n                    $array[] =  $this->parseKey($field);\n            }\n            $fieldsStr = implode(',', $array);\n        }else{\n            $fieldsStr = '*';\n        }\n        //TODO 如果是查询全部字段，并且是join的方式，那么就把要查的表加个别名，以免字段被覆盖\n        return $fieldsStr;\n    }\n\n    /**\n     * table分析\n     * @access protected\n     * @param mixed $table\n     * @return string\n     */\n    protected function parseTable($tables) {\n        if(is_array($tables)) {// 支持别名定义\n            $array   =  array();\n            foreach ($tables as $table=>$alias){\n                if(!is_numeric($table))\n                    $array[] =  $this->parseKey($table).' '.$this->parseKey($alias);\n                else\n                    $array[] =  $this->parseKey($alias);\n            }\n            $tables  =  $array;\n        }elseif(is_string($tables)){\n            $tables  =  explode(',',$tables);\n            array_walk($tables, array(&$this, 'parseKey'));\n        }\n        return implode(',',$tables);\n    }\n\n    /**\n     * where分析\n     * @access protected\n     * @param mixed $where\n     * @return string\n     */\n    protected function parseWhere($where) {\n        $whereStr = '';\n        if(is_string($where)) {\n            // 直接使用字符串条件\n            $whereStr = $where;\n        }else{ // 使用数组表达式\n            $operate  = isset($where['_logic'])?strtoupper($where['_logic']):'';\n            if(in_array($operate,array('AND','OR','XOR'))){\n                // 定义逻辑运算规则 例如 OR XOR AND NOT\n                $operate    =   ' '.$operate.' ';\n                unset($where['_logic']);\n            }else{\n                // 默认进行 AND 运算\n                $operate    =   ' AND ';\n            }\n            foreach ($where as $key=>$val){\n                if(is_numeric($key)){\n                    $key  = '_complex';\n                }\n                if(0===strpos($key,'_')) {\n                    // 解析特殊条件表达式\n                    $whereStr   .= $this->parseThinkWhere($key,$val);\n                }else{\n                    // 查询字段的安全过滤\n                    // if(!preg_match('/^[A-Z_\\|\\&\\-.a-z0-9\\(\\)\\,]+$/',trim($key))){\n                    //     E(L('_EXPRESS_ERROR_').':'.$key);\n                    // }\n                    // 多条件支持\n                    $multi  = is_array($val) &&  isset($val['_multi']);\n                    $key    = trim($key);\n                    if(strpos($key,'|')) { // 支持 name|title|nickname 方式定义查询字段\n                        $array =  explode('|',$key);\n                        $str   =  array();\n                        foreach ($array as $m=>$k){\n                            $v =  $multi?$val[$m]:$val;\n                            $str[]   = $this->parseWhereItem($this->parseKey($k),$v);\n                        }\n                        $whereStr .= '( '.implode(' OR ',$str).' )';\n                    }elseif(strpos($key,'&')){\n                        $array =  explode('&',$key);\n                        $str   =  array();\n                        foreach ($array as $m=>$k){\n                            $v =  $multi?$val[$m]:$val;\n                            $str[]   = '('.$this->parseWhereItem($this->parseKey($k),$v).')';\n                        }\n                        $whereStr .= '( '.implode(' AND ',$str).' )';\n                    }else{\n                        $whereStr .= $this->parseWhereItem($this->parseKey($key),$val);\n                    }\n                }\n                $whereStr .= $operate;\n            }\n            $whereStr = substr($whereStr,0,-strlen($operate));\n        }\n        return empty($whereStr)?'':' WHERE '.$whereStr;\n    }\n\n    // where子单元分析\n    protected function parseWhereItem($key,$val) {\n        $whereStr = '';\n        if(is_array($val)) {\n            if(is_string($val[0])) {\n\t\t\t\t$exp\t=\tstrtolower($val[0]);\n                if(preg_match('/^(eq|neq|gt|egt|lt|elt)$/',$exp)) { // 比较运算\n                    $whereStr .= $key.' '.$this->exp[$exp].' '.$this->parseValue($val[1]);\n                }elseif(preg_match('/^(notlike|like)$/',$exp)){// 模糊查找\n                    if(is_array($val[1])) {\n                        $likeLogic  =   isset($val[2])?strtoupper($val[2]):'OR';\n                        if(in_array($likeLogic,array('AND','OR','XOR'))){\n                            $like       =   array();\n                            foreach ($val[1] as $item){\n                                $like[] = $key.' '.$this->exp[$exp].' '.$this->parseValue($item);\n                            }\n                            $whereStr .= '('.implode(' '.$likeLogic.' ',$like).')';                          \n                        }\n                    }else{\n                        $whereStr .= $key.' '.$this->exp[$exp].' '.$this->parseValue($val[1]);\n                    }\n                }elseif('bind' == $exp ){ // 使用表达式\n                    $whereStr .= $key.' = :'.$val[1];\n                }elseif('exp' == $exp ){ // 使用表达式\n                    $whereStr .= $key.' '.$val[1];\n                }elseif(preg_match('/^(notin|not in|in)$/',$exp)){ // IN 运算\n                    if(isset($val[2]) && 'exp'==$val[2]) {\n                        $whereStr .= $key.' '.$this->exp[$exp].' '.$val[1];\n                    }else{\n                        if(is_string($val[1])) {\n                             $val[1] =  explode(',',$val[1]);\n                        }\n                        $zone      =   implode(',',$this->parseValue($val[1]));\n                        $whereStr .= $key.' '.$this->exp[$exp].' ('.$zone.')';\n                    }\n                }elseif(preg_match('/^(notbetween|not between|between)$/',$exp)){ // BETWEEN运算\n                    $data = is_string($val[1])? explode(',',$val[1]):$val[1];\n                    $whereStr .=  $key.' '.$this->exp[$exp].' '.$this->parseValue($data[0]).' AND '.$this->parseValue($data[1]);\n                }else{\n                    E(L('_EXPRESS_ERROR_').':'.$val[0]);\n                }\n            }else {\n                $count = count($val);\n                $rule  = isset($val[$count-1]) ? (is_array($val[$count-1]) ? strtoupper($val[$count-1][0]) : strtoupper($val[$count-1]) ) : '' ; \n                if(in_array($rule,array('AND','OR','XOR'))) {\n                    $count  = $count -1;\n                }else{\n                    $rule   = 'AND';\n                }\n                for($i=0;$i<$count;$i++) {\n                    $data = is_array($val[$i])?$val[$i][1]:$val[$i];\n                    if('exp'==strtolower($val[$i][0])) {\n                        $whereStr .= $key.' '.$data.' '.$rule.' ';\n                    }else{\n                        $whereStr .= $this->parseWhereItem($key,$val[$i]).' '.$rule.' ';\n                    }\n                }\n                $whereStr = '( '.substr($whereStr,0,-4).' )';\n            }\n        }else {\n            //对字符串类型字段采用模糊匹配\n            $likeFields   =   $this->config['db_like_fields'];\n            if($likeFields && preg_match('/^('.$likeFields.')$/i',$key)) {\n                $whereStr .= $key.' LIKE '.$this->parseValue('%'.$val.'%');\n            }else {\n                $whereStr .= $key.' = '.$this->parseValue($val);\n            }\n        }\n        return $whereStr;\n    }\n\n    /**\n     * 特殊条件分析\n     * @access protected\n     * @param string $key\n     * @param mixed $val\n     * @return string\n     */\n    protected function parseThinkWhere($key,$val) {\n        $whereStr   = '';\n        switch($key) {\n            case '_string':\n                // 字符串模式查询条件\n                $whereStr = $val;\n                break;\n            case '_complex':\n                // 复合查询条件\n                $whereStr = substr($this->parseWhere($val),6);\n                break;\n            case '_query':\n                // 字符串模式查询条件\n                parse_str($val,$where);\n                if(isset($where['_logic'])) {\n                    $op   =  ' '.strtoupper($where['_logic']).' ';\n                    unset($where['_logic']);\n                }else{\n                    $op   =  ' AND ';\n                }\n                $array   =  array();\n                foreach ($where as $field=>$data)\n                    $array[] = $this->parseKey($field).' = '.$this->parseValue($data);\n                $whereStr   = implode($op,$array);\n                break;\n        }\n        return '( '.$whereStr.' )';\n    }\n\n    /**\n     * limit分析\n     * @access protected\n     * @param mixed $lmit\n     * @return string\n     */\n    protected function parseLimit($limit) {\n        return !empty($limit)?   ' LIMIT '.$limit.' ':'';\n    }\n\n    /**\n     * join分析\n     * @access protected\n     * @param mixed $join\n     * @return string\n     */\n    protected function parseJoin($join) {\n        $joinStr = '';\n        if(!empty($join)) {\n            $joinStr    =   ' '.implode(' ',$join).' ';\n        }\n        return $joinStr;\n    }\n\n    /**\n     * order分析\n     * @access protected\n     * @param mixed $order\n     * @return string\n     */\n    protected function parseOrder($order) {\n        if(is_array($order)) {\n            $array   =  array();\n            foreach ($order as $key=>$val){\n                if(is_numeric($key)) {\n                    $array[] =  $this->parseKey($val);\n                }else{\n                    $array[] =  $this->parseKey($key).' '.$val;\n                }\n            }\n            $order   =  implode(',',$array);\n        }\n        return !empty($order)?  ' ORDER BY '.$order:'';\n    }\n\n    /**\n     * group分析\n     * @access protected\n     * @param mixed $group\n     * @return string\n     */\n    protected function parseGroup($group) {\n        return !empty($group)? ' GROUP BY '.$group:'';\n    }\n\n    /**\n     * having分析\n     * @access protected\n     * @param string $having\n     * @return string\n     */\n    protected function parseHaving($having) {\n        return  !empty($having)?   ' HAVING '.$having:'';\n    }\n\n    /**\n     * comment分析\n     * @access protected\n     * @param string $comment\n     * @return string\n     */\n    protected function parseComment($comment) {\n        return  !empty($comment)?   ' /* '.$comment.' */':'';\n    }\n\n    /**\n     * distinct分析\n     * @access protected\n     * @param mixed $distinct\n     * @return string\n     */\n    protected function parseDistinct($distinct) {\n        return !empty($distinct)?   ' DISTINCT ' :'';\n    }\n\n    /**\n     * union分析\n     * @access protected\n     * @param mixed $union\n     * @return string\n     */\n    protected function parseUnion($union) {\n        if(empty($union)) return '';\n        if(isset($union['_all'])) {\n            $str  =   'UNION ALL ';\n            unset($union['_all']);\n        }else{\n            $str  =   'UNION ';\n        }\n        foreach ($union as $u){\n            $sql[] = $str.(is_array($u)?$this->buildSelectSql($u):$u);\n        }\n        return implode(' ',$sql);\n    }\n\n    /**\n     * 参数绑定分析\n     * @access protected\n     * @param array $bind\n     * @return array\n     */\n    protected function parseBind($bind){\n        $this->bind   =   array_merge($this->bind,$bind);\n    }\n\n    /**\n     * index分析，可在操作链中指定需要强制使用的索引\n     * @access protected\n     * @param mixed $index\n     * @return string\n     */\n    protected function parseForce($index) {\n        if(empty($index)) return '';\n        if(is_array($index)) $index = join(\",\", $index);\n        return sprintf(\" FORCE INDEX ( %s ) \", $index);\n    }\n\n    /**\n     * ON DUPLICATE KEY UPDATE 分析\n     * @access protected\n     * @param mixed $duplicate \n     * @return string\n     */\n    protected function parseDuplicate($duplicate){\n        return '';\n    }\n\n    /**\n     * 插入记录\n     * @access public\n     * @param mixed $data 数据\n     * @param array $options 参数表达式\n     * @param boolean $replace 是否replace\n     * @return false | integer\n     */\n    public function insert($data,$options=array(),$replace=false) {\n        $values  =  $fields    = array();\n        $this->model  =   $options['model'];\n        $this->parseBind(!empty($options['bind'])?$options['bind']:array());\n        foreach ($data as $key=>$val){\n            if(is_array($val) && 'exp' == $val[0]){\n                $fields[]   =  $this->parseKey($key);\n                $values[]   =  $val[1];\n            }elseif(is_null($val)){\n                $fields[]   =   $this->parseKey($key);\n                $values[]   =   'NULL';\n            }elseif(is_scalar($val)) { // 过滤非标量数据\n                $fields[]   =   $this->parseKey($key);\n                if(0===strpos($val,':') && in_array($val,array_keys($this->bind))){\n                    $values[]   =   $this->parseValue($val);\n                }else{\n                    $name       =   count($this->bind);\n                    $values[]   =   ':'.$name;\n                    $this->bindParam($name,$val);\n                }\n            }\n        }\n        // 兼容数字传入方式\n        $replace= (is_numeric($replace) && $replace>0)?true:$replace;\n        $sql    = (true===$replace?'REPLACE':'INSERT').' INTO '.$this->parseTable($options['table']).' ('.implode(',', $fields).') VALUES ('.implode(',', $values).')'.$this->parseDuplicate($replace);\n        $sql    .= $this->parseComment(!empty($options['comment'])?$options['comment']:'');\n        return $this->execute($sql,!empty($options['fetch_sql']) ? true : false);\n    }\n\n\n    /**\n     * 批量插入记录\n     * @access public\n     * @param mixed $dataSet 数据集\n     * @param array $options 参数表达式\n     * @param boolean $replace 是否replace\n     * @return false | integer\n     */\n    public function insertAll($dataSet,$options=array(),$replace=false) {\n        $values  =  array();\n        $this->model  =   $options['model'];\n        if(!is_array($dataSet[0])) return false;\n        $this->parseBind(!empty($options['bind'])?$options['bind']:array());\n        $fields =   array_map(array($this,'parseKey'),array_keys($dataSet[0]));\n        foreach ($dataSet as $data){\n            $value   =  array();\n            foreach ($data as $key=>$val){\n                if(is_array($val) && 'exp' == $val[0]){\n                    $value[]   =    $val[1];\n                }elseif(is_null($val)){\n                    $value[]   =   'NULL';\n                }elseif(is_scalar($val)){\n                    if(0===strpos($val,':') && in_array($val,array_keys($this->bind))){\n                        $value[]   =   $this->parseValue($val);\n                    }else{\n                        $name       =   count($this->bind);\n                        $value[]   =   ':'.$name;\n                        $this->bindParam($name,$val);\n                    }\n                }\n            }\n            $values[]    = 'SELECT '.implode(',', $value);\n        }\n        $sql   =  'INSERT INTO '.$this->parseTable($options['table']).' ('.implode(',', $fields).') '.implode(' UNION ALL ',$values);\n        $sql   .= $this->parseComment(!empty($options['comment'])?$options['comment']:'');\n        return $this->execute($sql,!empty($options['fetch_sql']) ? true : false);\n    }\n\n    /**\n     * 通过Select方式插入记录\n     * @access public\n     * @param string $fields 要插入的数据表字段名\n     * @param string $table 要插入的数据表名\n     * @param array $option  查询数据参数\n     * @return false | integer\n     */\n    public function selectInsert($fields,$table,$options=array()) {\n        $this->model  =   $options['model'];\n        $this->parseBind(!empty($options['bind'])?$options['bind']:array());\n        if(is_string($fields))   $fields    = explode(',',$fields);\n        array_walk($fields, array($this, 'parseKey'));\n        $sql   =    'INSERT INTO '.$this->parseTable($table).' ('.implode(',', $fields).') ';\n        $sql   .= $this->buildSelectSql($options);\n        return $this->execute($sql,!empty($options['fetch_sql']) ? true : false);\n    }\n\n    /**\n     * 更新记录\n     * @access public\n     * @param mixed $data 数据\n     * @param array $options 表达式\n     * @return false | integer\n     */\n    public function update($data,$options) {\n        $this->model  =   $options['model'];\n        $this->parseBind(!empty($options['bind'])?$options['bind']:array());\n        $table  =   $this->parseTable($options['table']);\n        $sql   = 'UPDATE ' . $table . $this->parseSet($data);\n        if(strpos($table,',')){// 多表更新支持JOIN操作\n            $sql .= $this->parseJoin(!empty($options['join'])?$options['join']:'');\n        }\n        $sql .= $this->parseWhere(!empty($options['where'])?$options['where']:'');\n        if(!strpos($table,',')){\n            //  单表更新支持order和lmit\n            $sql   .=  $this->parseOrder(!empty($options['order'])?$options['order']:'')\n                .$this->parseLimit(!empty($options['limit'])?$options['limit']:'');\n        }\n        $sql .=   $this->parseComment(!empty($options['comment'])?$options['comment']:'');\n        return $this->execute($sql,!empty($options['fetch_sql']) ? true : false);\n    }\n\n    /**\n     * 删除记录\n     * @access public\n     * @param array $options 表达式\n     * @return false | integer\n     */\n    public function delete($options=array()) {\n        $this->model  =   $options['model'];\n        $this->parseBind(!empty($options['bind'])?$options['bind']:array());\n        $table  =   $this->parseTable($options['table']);\n        $sql    =   'DELETE FROM '.$table;\n        if(strpos($table,',')){// 多表删除支持USING和JOIN操作\n            if(!empty($options['using'])){\n                $sql .= ' USING '.$this->parseTable($options['using']).' ';\n            }\n            $sql .= $this->parseJoin(!empty($options['join'])?$options['join']:'');\n        }\n        $sql .= $this->parseWhere(!empty($options['where'])?$options['where']:'');\n        if(!strpos($table,',')){\n            // 单表删除支持order和limit\n            $sql .= $this->parseOrder(!empty($options['order'])?$options['order']:'')\n            .$this->parseLimit(!empty($options['limit'])?$options['limit']:'');\n        }\n        $sql .=   $this->parseComment(!empty($options['comment'])?$options['comment']:'');\n        return $this->execute($sql,!empty($options['fetch_sql']) ? true : false);\n    }\n\n    /**\n     * 查找记录\n     * @access public\n     * @param array $options 表达式\n     * @return mixed\n     */\n    public function select($options=array()) {\n        $this->model  =   $options['model'];\n        $this->parseBind(!empty($options['bind'])?$options['bind']:array());\n        $sql    = $this->buildSelectSql($options);\n        $result   = $this->query($sql,!empty($options['fetch_sql']) ? true : false);\n        return $result;\n    }\n\n    /**\n     * 生成查询SQL\n     * @access public\n     * @param array $options 表达式\n     * @return string\n     */\n    public function buildSelectSql($options=array()) {\n        if(isset($options['page'])) {\n            // 根据页数计算limit\n            list($page,$listRows)   =   $options['page'];\n            $page    =  $page>0 ? $page : 1;\n            $listRows=  $listRows>0 ? $listRows : (is_numeric($options['limit'])?$options['limit']:20);\n            $offset  =  $listRows*($page-1);\n            $options['limit'] =  $offset.','.$listRows;\n        }\n        $sql  =   $this->parseSql($this->selectSql,$options);\n        return $sql;\n    }\n\n    /**\n     * 替换SQL语句中表达式\n     * @access public\n     * @param array $options 表达式\n     * @return string\n     */\n    public function parseSql($sql,$options=array()){\n        $sql   = str_replace(\n            array('%TABLE%','%DISTINCT%','%FIELD%','%JOIN%','%WHERE%','%GROUP%','%HAVING%','%ORDER%','%LIMIT%','%UNION%','%LOCK%','%COMMENT%','%FORCE%'),\n            array(\n                $this->parseTable($options['table']),\n                $this->parseDistinct(isset($options['distinct'])?$options['distinct']:false),\n                $this->parseField(!empty($options['field'])?$options['field']:'*'),\n                $this->parseJoin(!empty($options['join'])?$options['join']:''),\n                $this->parseWhere(!empty($options['where'])?$options['where']:''),\n                $this->parseGroup(!empty($options['group'])?$options['group']:''),\n                $this->parseHaving(!empty($options['having'])?$options['having']:''),\n                $this->parseOrder(!empty($options['order'])?$options['order']:''),\n                $this->parseLimit(!empty($options['limit'])?$options['limit']:''),\n                $this->parseUnion(!empty($options['union'])?$options['union']:''),\n                $this->parseLock(isset($options['lock'])?$options['lock']:false),\n                $this->parseComment(!empty($options['comment'])?$options['comment']:''),\n                $this->parseForce(!empty($options['force'])?$options['force']:'')\n            ),$sql);\n        return $sql;\n    }\n\n    /**\n     * 获取最近一次查询的sql语句 \n     * @param string $model  模型名\n     * @access public\n     * @return string\n     */\n    public function getLastSql($model='') {\n        return $model?$this->modelSql[$model]:$this->queryStr;\n    }\n\n    /**\n     * 获取最近插入的ID\n     * @access public\n     * @return string\n     */\n    public function getLastInsID() {\n        return $this->lastInsID;\n    }\n\n    /**\n     * 获取最近的错误信息\n     * @access public\n     * @return string\n     */\n    public function getError() {\n        return $this->error;\n    }\n\n    /**\n     * SQL指令安全过滤\n     * @access public\n     * @param string $str  SQL字符串\n     * @return string\n     */\n    public function escapeString($str) {\n        return addslashes($str);\n    }\n\n    /**\n     * 设置当前操作模型\n     * @access public\n     * @param string $model  模型名\n     * @return void\n     */\n    public function setModel($model){\n        $this->model =  $model;\n    }\n\n    /**\n     * 数据库调试 记录当前SQL\n     * @access protected\n     * @param boolean $start  调试开始标记 true 开始 false 结束\n     */\n    protected function debug($start) {\n        if($this->config['debug']) {// 开启数据库调试模式\n            if($start) {\n                G('queryStartTime');\n            }else{\n                $this->modelSql[$this->model]   =  $this->queryStr;\n                //$this->model  =   '_think_';\n                // 记录操作结束时间\n                G('queryEndTime');\n                trace($this->queryStr.' [ RunTime:'.G('queryStartTime','queryEndTime').'s ]','','SQL');\n            }\n        }\n    }\n\n    /**\n     * 初始化数据库连接\n     * @access protected\n     * @param boolean $master 主服务器\n     * @return void\n     */\n    protected function initConnect($master=true) {\n        if(!empty($this->config['deploy']))\n            // 采用分布式数据库\n            $this->_linkID = $this->multiConnect($master);\n        else\n            // 默认单数据库\n            if ( !$this->_linkID ) $this->_linkID = $this->connect();\n    }\n\n    /**\n     * 连接分布式服务器\n     * @access protected\n     * @param boolean $master 主服务器\n     * @return void\n     */\n    protected function multiConnect($master=false) {\n        // 分布式数据库配置解析\n        $_config['username']    =   explode(',',$this->config['username']);\n        $_config['password']    =   explode(',',$this->config['password']);\n        $_config['hostname']    =   explode(',',$this->config['hostname']);\n        $_config['hostport']    =   explode(',',$this->config['hostport']);\n        $_config['database']    =   explode(',',$this->config['database']);\n        $_config['dsn']         =   explode(',',$this->config['dsn']);\n        $_config['charset']     =   explode(',',$this->config['charset']);\n\n        $m     =   floor(mt_rand(0,$this->config['master_num']-1));\n        // 数据库读写是否分离\n        if($this->config['rw_separate']){\n            // 主从式采用读写分离\n            if($master)\n                // 主服务器写入\n                $r  =   $m;\n            else{\n                if(is_numeric($this->config['slave_no'])) {// 指定服务器读\n                    $r = $this->config['slave_no'];\n                }else{\n                    // 读操作连接从服务器\n                    $r = floor(mt_rand($this->config['master_num'],count($_config['hostname'])-1));   // 每次随机连接的数据库\n                }\n            }\n        }else{\n            // 读写操作不区分服务器\n            $r = floor(mt_rand(0,count($_config['hostname'])-1));   // 每次随机连接的数据库\n        }\n        \n        if($m != $r ){\n            $db_master  =   array(\n                'username'  =>  isset($_config['username'][$m])?$_config['username'][$m]:$_config['username'][0],\n                'password'  =>  isset($_config['password'][$m])?$_config['password'][$m]:$_config['password'][0],\n                'hostname'  =>  isset($_config['hostname'][$m])?$_config['hostname'][$m]:$_config['hostname'][0],\n                'hostport'  =>  isset($_config['hostport'][$m])?$_config['hostport'][$m]:$_config['hostport'][0],\n                'database'  =>  isset($_config['database'][$m])?$_config['database'][$m]:$_config['database'][0],\n                'dsn'       =>  isset($_config['dsn'][$m])?$_config['dsn'][$m]:$_config['dsn'][0],\n                'charset'   =>  isset($_config['charset'][$m])?$_config['charset'][$m]:$_config['charset'][0],\n            );\n        }\n        $db_config = array(\n            'username'  =>  isset($_config['username'][$r])?$_config['username'][$r]:$_config['username'][0],\n            'password'  =>  isset($_config['password'][$r])?$_config['password'][$r]:$_config['password'][0],\n            'hostname'  =>  isset($_config['hostname'][$r])?$_config['hostname'][$r]:$_config['hostname'][0],\n            'hostport'  =>  isset($_config['hostport'][$r])?$_config['hostport'][$r]:$_config['hostport'][0],\n            'database'  =>  isset($_config['database'][$r])?$_config['database'][$r]:$_config['database'][0],\n            'dsn'       =>  isset($_config['dsn'][$r])?$_config['dsn'][$r]:$_config['dsn'][0],\n            'charset'   =>  isset($_config['charset'][$r])?$_config['charset'][$r]:$_config['charset'][0],\n        );\n        return $this->connect($db_config,$r,$r == $m ? false : $db_master);\n    }\n\n   /**\n     * 析构方法\n     * @access public\n     */\n    public function __destruct() {\n        // 释放查询\n        if ($this->PDOStatement){\n            $this->free();\n        }\n        // 关闭连接\n        $this->close();\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Db/Lite.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\nnamespace Think\\Db;\nuse Think\\Config;\nuse Think\\Debug;\nuse Think\\Log;\nuse PDO;\n\nclass Lite {\n    // PDO操作实例\n    protected $PDOStatement = null;\n    // 当前操作所属的模型名\n    protected $model      = '_think_';\n    // 当前SQL指令\n    protected $queryStr   = '';\n    protected $modelSql   = array();\n    // 最后插入ID\n    protected $lastInsID  = null;\n    // 返回或者影响记录数\n    protected $numRows    = 0;\n    // 事务指令数\n    protected $transTimes = 0;\n    // 错误信息\n    protected $error      = '';\n    // 数据库连接ID 支持多个连接\n    protected $linkID     = array();\n    // 当前连接ID\n    protected $_linkID    = null;\n    // 数据库连接参数配置\n    protected $config     = array(\n        'type'              =>  '',     // 数据库类型\n        'hostname'          =>  '127.0.0.1', // 服务器地址\n        'database'          =>  '',          // 数据库名\n        'username'          =>  '',      // 用户名\n        'password'          =>  '',          // 密码\n        'hostport'          =>  '',        // 端口     \n        'dsn'               =>  '', //          \n        'params'            =>  array(), // 数据库连接参数        \n        'charset'           =>  'utf8',      // 数据库编码默认采用utf8  \n        'prefix'            =>  '',    // 数据库表前缀\n        'debug'             =>  false, // 数据库调试模式\n        'deploy'            =>  0, // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)\n        'rw_separate'       =>  false,       // 数据库读写是否分离 主从式有效\n        'master_num'        =>  1, // 读写分离后 主服务器数量\n        'slave_no'          =>  '', // 指定从服务器序号\n    );\n    // 数据库表达式\n    protected $comparison = array('eq'=>'=','neq'=>'<>','gt'=>'>','egt'=>'>=','lt'=>'<','elt'=>'<=','notlike'=>'NOT LIKE','like'=>'LIKE','in'=>'IN','notin'=>'NOT IN');\n    // 查询表达式\n    protected $selectSql  = 'SELECT%DISTINCT% %FIELD% FROM %TABLE%%JOIN%%WHERE%%GROUP%%HAVING%%ORDER%%LIMIT% %UNION%%COMMENT%';\n    // 查询次数\n    protected $queryTimes   =   0;\n    // 执行次数\n    protected $executeTimes =   0;\n    // PDO连接参数\n    protected $options = array(\n        PDO::ATTR_CASE              =>  PDO::CASE_LOWER,\n        PDO::ATTR_ERRMODE           =>  PDO::ERRMODE_EXCEPTION,\n        PDO::ATTR_ORACLE_NULLS      =>  PDO::NULL_NATURAL,\n        PDO::ATTR_STRINGIFY_FETCHES =>  false,\n    );\n\n    /**\n     * 架构函数 读取数据库配置信息\n     * @access public\n     * @param array $config 数据库配置数组\n     */\n    public function __construct($config=''){\n        if(!empty($config)) {\n            $this->config           =   array_merge($this->config,$config);\n            if(is_array($this->config['params'])){\n                $this->options  +=   $this->config['params'];\n            }\n        }\n    }\n\n    /**\n     * 连接数据库方法\n     * @access public\n     */\n    public function connect($config='',$linkNum=0) {\n        if ( !isset($this->linkID[$linkNum]) ) {\n            if(empty($config))  $config =   $this->config;\n            try{\n                if(empty($config['dsn'])) {\n                    $config['dsn']  =   $this->parseDsn($config);\n                }\n                if(version_compare(PHP_VERSION,'5.3.6','<=')){ //禁用模拟预处理语句\n                    $this->options[PDO::ATTR_EMULATE_PREPARES]  =   false;\n                }\n                $this->linkID[$linkNum] = new PDO( $config['dsn'], $config['username'], $config['password'],$this->options);\n            }catch (\\PDOException $e) {\n                E($e->getMessage());\n            }\n        }\n        return $this->linkID[$linkNum];\n    }\n\n    /**\n     * 解析pdo连接的dsn信息\n     * @access public\n     * @param array $config 连接信息\n     * @return string\n     */\n    protected function parseDsn($config){}\n\n    /**\n     * 释放查询结果\n     * @access public\n     */\n    public function free() {\n        $this->PDOStatement = null;\n    }\n\n    /**\n     * 执行查询 返回数据集\n     * @access public\n     * @param string $str  sql指令\n     * @param array $bind  参数绑定\n     * @return mixed\n     */\n    public function query($str,$bind=array()) {\n        $this->initConnect(false);\n        if ( !$this->_linkID ) return false;\n        $this->queryStr     =   $str;\n        if(!empty($bind)){\n            $that   =   $this;\n            $this->queryStr =   strtr($this->queryStr,array_map(function($val) use($that){ return '\\''.$that->escapeString($val).'\\''; },$bind));\n        }\n        //释放前次的查询结果\n        if ( !empty($this->PDOStatement) ) $this->free();\n        $this->queryTimes++;\n        N('db_query',1); // 兼容代码        \n        // 调试开始\n        $this->debug(true);\n        $this->PDOStatement = $this->_linkID->prepare($str);\n        if(false === $this->PDOStatement)\n            E($this->error());\n        foreach ($bind as $key => $val) {\n            if(is_array($val)){\n                $this->PDOStatement->bindValue($key, $val[0], $val[1]);\n            }else{\n                $this->PDOStatement->bindValue($key, $val);\n            }\n        }\n        $result =   $this->PDOStatement->execute();\n        // 调试结束\n        $this->debug(false);\n        if ( false === $result ) {\n            $this->error();\n            return false;\n        } else {\n            return $this->getResult();\n        }\n    }\n\n    /**\n     * 执行语句\n     * @access public\n     * @param string $str  sql指令\n     * @param array $bind  参数绑定\n     * @return integer\n     */\n    public function execute($str,$bind=array()) {\n        $this->initConnect(true);\n        if ( !$this->_linkID ) return false;\n        $this->queryStr = $str;\n        if(!empty($bind)){\n            $that   =   $this;\n            $this->queryStr =   strtr($this->queryStr,array_map(function($val) use($that){ return '\\''.$that->escapeString($val).'\\''; },$bind));\n        }      \n        //释放前次的查询结果\n        if ( !empty($this->PDOStatement) ) $this->free();\n        $this->executeTimes++;\n        N('db_write',1); // 兼容代码        \n        // 记录开始执行时间\n        $this->debug(true);\n        $this->PDOStatement =   $this->_linkID->prepare($str);\n        if(false === $this->PDOStatement) {\n            E($this->error());\n        }\n        foreach ($bind as $key => $val) {\n            if(is_array($val)){\n                $this->PDOStatement->bindValue($key, $val[0], $val[1]);\n            }else{\n                $this->PDOStatement->bindValue($key, $val);\n            }\n        }\n        $result =   $this->PDOStatement->execute();\n        $this->debug(false);\n        if ( false === $result) {\n            $this->error();\n            return false;\n        } else {\n            $this->numRows = $this->PDOStatement->rowCount();\n            if(preg_match(\"/^\\s*(INSERT\\s+INTO|REPLACE\\s+INTO)\\s+/i\", $str)) {\n                $this->lastInsID = $this->_linkID->lastInsertId();\n            }\n            return $this->numRows;\n        }\n    }\n\n    /**\n     * 启动事务\n     * @access public\n     * @return void\n     */\n    public function startTrans() {\n        $this->initConnect(true);\n        if ( !$this->_linkID ) return false;\n        //数据rollback 支持\n        if ($this->transTimes == 0) {\n            $this->_linkID->beginTransaction();\n        }\n        $this->transTimes++;\n        return ;\n    }\n\n    /**\n     * 用于非自动提交状态下面的查询提交\n     * @access public\n     * @return boolean\n     */\n    public function commit() {\n        if ($this->transTimes > 0) {\n            $result = $this->_linkID->commit();\n            $this->transTimes = 0;\n            if(!$result){\n                $this->error();\n                return false;\n            }\n        }\n        return true;\n    }\n\n    /**\n     * 事务回滚\n     * @access public\n     * @return boolean\n     */\n    public function rollback() {\n        if ($this->transTimes > 0) {\n            $result = $this->_linkID->rollback();\n            $this->transTimes = 0;\n            if(!$result){\n                $this->error();\n                return false;\n            }\n        }\n        return true;\n    }\n\n    /**\n     * 获得所有的查询数据\n     * @access private\n     * @return array\n     */\n    private function getResult() {\n        //返回数据集\n        $result =   $this->PDOStatement->fetchAll(PDO::FETCH_ASSOC);\n        $this->numRows = count( $result );\n        return $result;\n    }\n\n    /**\n     * 获得查询次数\n     * @access public\n     * @param boolean $execute 是否包含所有查询\n     * @return integer\n     */\n    public function getQueryTimes($execute=false){\n        return $execute?$this->queryTimes+$this->executeTimes:$this->queryTimes;\n    }\n\n    /**\n     * 获得执行次数\n     * @access public\n     * @return integer\n     */\n    public function getExecuteTimes(){\n        return $this->executeTimes;\n    }\n\n    /**\n     * 关闭数据库\n     * @access public\n     */\n    public function close() {\n        $this->_linkID = null;\n    }\n\n    /**\n     * 数据库错误信息\n     * 并显示当前的SQL语句\n     * @access public\n     * @return string\n     */\n    public function error() {\n        if($this->PDOStatement) {\n            $error = $this->PDOStatement->errorInfo();\n            $this->error = $error[1].':'.$error[2];\n        }else{\n            $this->error = '';\n        }\n        if('' != $this->queryStr){\n            $this->error .= \"\\n [ SQL语句 ] : \".$this->queryStr;\n        }\n        // 记录错误日志\n        trace($this->error,'','ERR');\n        if($this->config['debug']) {// 开启数据库调试模式\n            E($this->error);\n        }else{\n            return $this->error;\n        }\n    }\n\n    /**\n     * 获取最近一次查询的sql语句 \n     * @param string $model  模型名\n     * @access public\n     * @return string\n     */\n    public function getLastSql($model='') {\n        return $model?$this->modelSql[$model]:$this->queryStr;\n    }\n\n    /**\n     * 获取最近插入的ID\n     * @access public\n     * @return string\n     */\n    public function getLastInsID() {\n        return $this->lastInsID;\n    }\n\n    /**\n     * 获取最近的错误信息\n     * @access public\n     * @return string\n     */\n    public function getError() {\n        return $this->error;\n    }\n\n    /**\n     * SQL指令安全过滤\n     * @access public\n     * @param string $str  SQL字符串\n     * @return string\n     */\n    public function escapeString($str) {\n        return addslashes($str);\n    }\n\n    /**\n     * 设置当前操作模型\n     * @access public\n     * @param string $model  模型名\n     * @return void\n     */\n    public function setModel($model){\n        $this->model =  $model;\n    }\n\n    /**\n     * 数据库调试 记录当前SQL\n     * @access protected\n     * @param boolean $start  调试开始标记 true 开始 false 结束\n     */\n    protected function debug($start) {\n        if($this->config['debug']) {// 开启数据库调试模式\n            if($start) {\n                G('queryStartTime');\n            }else{\n                $this->modelSql[$this->model]   =  $this->queryStr;\n                //$this->model  =   '_think_';\n                // 记录操作结束时间\n                G('queryEndTime');\n                trace($this->queryStr.' [ RunTime:'.G('queryStartTime','queryEndTime').'s ]','','SQL');\n            }\n        }\n    }\n\n    /**\n     * 初始化数据库连接\n     * @access protected\n     * @param boolean $master 主服务器\n     * @return void\n     */\n    protected function initConnect($master=true) {\n        if(!empty($this->config['deploy']))\n            // 采用分布式数据库\n            $this->_linkID = $this->multiConnect($master);\n        else\n            // 默认单数据库\n            if ( !$this->_linkID ) $this->_linkID = $this->connect();\n    }\n\n    /**\n     * 连接分布式服务器\n     * @access protected\n     * @param boolean $master 主服务器\n     * @return void\n     */\n    protected function multiConnect($master=false) {\n        // 分布式数据库配置解析\n        $_config['username']    =   explode(',',$this->config['username']);\n        $_config['password']    =   explode(',',$this->config['password']);\n        $_config['hostname']    =   explode(',',$this->config['hostname']);\n        $_config['hostport']    =   explode(',',$this->config['hostport']);\n        $_config['database']    =   explode(',',$this->config['database']);\n        $_config['dsn']         =   explode(',',$this->config['dsn']);\n        $_config['charset']     =   explode(',',$this->config['charset']);\n\n        // 数据库读写是否分离\n        if($this->config['rw_separate']){\n            // 主从式采用读写分离\n            if($master)\n                // 主服务器写入\n                $r  =   floor(mt_rand(0,$this->config['master_num']-1));\n            else{\n                if(is_numeric($this->config['slave_no'])) {// 指定服务器读\n                    $r = $this->config['slave_no'];\n                }else{\n                    // 读操作连接从服务器\n                    $r = floor(mt_rand($this->config['master_num'],count($_config['hostname'])-1));   // 每次随机连接的数据库\n                }\n            }\n        }else{\n            // 读写操作不区分服务器\n            $r = floor(mt_rand(0,count($_config['hostname'])-1));   // 每次随机连接的数据库\n        }\n        $db_config = array(\n            'username'  =>  isset($_config['username'][$r])?$_config['username'][$r]:$_config['username'][0],\n            'password'  =>  isset($_config['password'][$r])?$_config['password'][$r]:$_config['password'][0],\n            'hostname'  =>  isset($_config['hostname'][$r])?$_config['hostname'][$r]:$_config['hostname'][0],\n            'hostport'  =>  isset($_config['hostport'][$r])?$_config['hostport'][$r]:$_config['hostport'][0],\n            'database'  =>  isset($_config['database'][$r])?$_config['database'][$r]:$_config['database'][0],\n            'dsn'       =>  isset($_config['dsn'][$r])?$_config['dsn'][$r]:$_config['dsn'][0],\n            'charset'   =>  isset($_config['charset'][$r])?$_config['charset'][$r]:$_config['charset'][0],\n        );\n        return $this->connect($db_config,$r);\n    }\n\n   /**\n     * 析构方法\n     * @access public\n     */\n    public function __destruct() {\n        // 释放查询\n        if ($this->PDOStatement){\n            $this->free();\n        }\n        // 关闭连接\n        $this->close();\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Db.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\nnamespace Think;\n\n/**\n * ThinkPHP 数据库中间层实现类\n */\nclass Db {\n\n    static private  $instance   =  array();     //  数据库连接实例\n    static private  $_instance  =  null;   //  当前数据库连接实例\n\n    /**\n     * 取得数据库类实例\n     * @static\n     * @access public\n     * @param mixed $config 连接配置\n     * @return Object 返回数据库驱动类\n     */\n    static public function getInstance($config=array()) {\n        $md5    =   md5(serialize($config));\n        if(!isset(self::$instance[$md5])) {\n            // 解析连接参数 支持数组和字符串\n            $options    =   self::parseConfig($config);\n            // 兼容mysqli\n            if('mysqli' == $options['type']) $options['type']   =   'mysql';\n            // 如果采用lite方式 仅支持原生SQL 包括query和execute方法\n            $class  =   !empty($options['lite'])?  'Think\\Db\\Lite' :   'Think\\\\Db\\\\Driver\\\\'.ucwords(strtolower($options['type']));\n            if(class_exists($class)){\n                self::$instance[$md5]   =   new $class($options);\n            }else{\n                // 类没有定义\n                E(L('_NO_DB_DRIVER_').': ' . $class);\n            }\n        }\n        self::$_instance    =   self::$instance[$md5];\n        return self::$_instance;\n    }\n\n    /**\n     * 数据库连接参数解析\n     * @static\n     * @access private\n     * @param mixed $config\n     * @return array\n     */\n    static private function parseConfig($config){\n        if(!empty($config)){\n            if(is_string($config)) {\n                return self::parseDsn($config);\n            }\n            $config =   array_change_key_case($config);\n            $config = array (\n                'type'          =>  $config['db_type'],\n                'username'      =>  $config['db_user'],\n                'password'      =>  $config['db_pwd'],\n                'hostname'      =>  $config['db_host'],\n                'hostport'      =>  $config['db_port'],\n                'database'      =>  $config['db_name'],\n                'dsn'           =>  isset($config['db_dsn'])?$config['db_dsn']:null,\n                'params'        =>  isset($config['db_params'])?$config['db_params']:null,\n                'charset'       =>  isset($config['db_charset'])?$config['db_charset']:'utf8',\n                'deploy'        =>  isset($config['db_deploy_type'])?$config['db_deploy_type']:0,\n                'rw_separate'   =>  isset($config['db_rw_separate'])?$config['db_rw_separate']:false,\n                'master_num'    =>  isset($config['db_master_num'])?$config['db_master_num']:1,\n                'slave_no'      =>  isset($config['db_slave_no'])?$config['db_slave_no']:'',\n                'debug'         =>  isset($config['db_debug'])?$config['db_debug']:APP_DEBUG,\n                'lite'          =>  isset($config['db_lite'])?$config['db_lite']:false,\n            );\n        }else {\n            $config = array (\n                'type'          =>  C('DB_TYPE'),\n                'username'      =>  C('DB_USER'),\n                'password'      =>  C('DB_PWD'),\n                'hostname'      =>  C('DB_HOST'),\n                'hostport'      =>  C('DB_PORT'),\n                'database'      =>  C('DB_NAME'),\n                'dsn'           =>  C('DB_DSN'),\n                'params'        =>  C('DB_PARAMS'),\n                'charset'       =>  C('DB_CHARSET'),\n                'deploy'        =>  C('DB_DEPLOY_TYPE'),\n                'rw_separate'   =>  C('DB_RW_SEPARATE'),\n                'master_num'    =>  C('DB_MASTER_NUM'),\n                'slave_no'      =>  C('DB_SLAVE_NO'),\n                'debug'         =>  C('DB_DEBUG',null,APP_DEBUG),\n                'lite'          =>  C('DB_LITE'),\n            );\n        }\n        return $config;\n    }\n\n    /**\n     * DSN解析\n     * 格式： mysql://username:passwd@localhost:3306/DbName?param1=val1&param2=val2#utf8\n     * @static\n     * @access private\n     * @param string $dsnStr\n     * @return array\n     */\n    static private function parseDsn($dsnStr) {\n        if( empty($dsnStr) ){return false;}\n        $info = parse_url($dsnStr);\n        if(!$info) {\n            return false;\n        }\n        $dsn = array(\n            'type'      =>  $info['scheme'],\n            'username'  =>  isset($info['user']) ? $info['user'] : '',\n            'password'  =>  isset($info['pass']) ? $info['pass'] : '',\n            'hostname'  =>  isset($info['host']) ? $info['host'] : '',\n            'hostport'  =>  isset($info['port']) ? $info['port'] : '',\n            'database'  =>  isset($info['path']) ? substr($info['path'],1) : '',\n            'charset'   =>  isset($info['fragment'])?$info['fragment']:'utf8',\n        );\n        \n        if(isset($info['query'])) {\n            parse_str($info['query'],$dsn['params']);\n        }else{\n            $dsn['params']  =   array();\n        }\n        return $dsn;\n     }\n\n    // 调用驱动类的方法\n    static public function __callStatic($method, $params){\n        return call_user_func_array(array(self::$_instance, $method), $params);\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Dispatcher.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * ThinkPHP内置的Dispatcher类\n * 完成URL解析、路由和调度\n */\nclass Dispatcher {\n\n    /**\n     * URL映射到控制器\n     * @access public\n     * @return void\n     */\n    static public function dispatch() {\n        $varPath        =   C('VAR_PATHINFO');\n        $varAddon       =   C('VAR_ADDON');\n        $varModule      =   C('VAR_MODULE');\n        $varController  =   C('VAR_CONTROLLER');\n        $varAction      =   C('VAR_ACTION');\n        $urlCase        =   C('URL_CASE_INSENSITIVE');\n        if(isset($_GET[$varPath])) { // 判断URL里面是否有兼容模式参数\n            $_SERVER['PATH_INFO'] = $_GET[$varPath];\n            unset($_GET[$varPath]);\n        }elseif(IS_CLI){ // CLI模式下 index.php module/controller/action/params/...\n            $_SERVER['PATH_INFO'] = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : '';\n        }\n\n        // 开启子域名部署\n        if(C('APP_SUB_DOMAIN_DEPLOY')) {\n            $rules      = C('APP_SUB_DOMAIN_RULES');\n            if(isset($rules[$_SERVER['HTTP_HOST']])) { // 完整域名或者IP配置\n                define('APP_DOMAIN',$_SERVER['HTTP_HOST']); // 当前完整域名\n                $rule = $rules[APP_DOMAIN];\n            }else{\n                if(strpos(C('APP_DOMAIN_SUFFIX'),'.')){ // com.cn net.cn \n                    $domain = array_slice(explode('.', $_SERVER['HTTP_HOST']), 0, -3);\n                }else{\n                    $domain = array_slice(explode('.', $_SERVER['HTTP_HOST']), 0, -2);                    \n                }\n                if(!empty($domain)) {\n                    $subDomain = implode('.', $domain);\n                    define('SUB_DOMAIN',$subDomain); // 当前完整子域名\n                    $domain2   = array_pop($domain); // 二级域名\n                    if($domain) { // 存在三级域名\n                        $domain3 = array_pop($domain);\n                    }\n                    if(isset($rules[$subDomain])) { // 子域名\n                        $rule = $rules[$subDomain];\n                    }elseif(isset($rules['*.' . $domain2]) && !empty($domain3)){ // 泛三级域名\n                        $rule = $rules['*.' . $domain2];\n                        $panDomain = $domain3;\n                    }elseif(isset($rules['*']) && !empty($domain2) && 'www' != $domain2 ){ // 泛二级域名\n                        $rule      = $rules['*'];\n                        $panDomain = $domain2;\n                    }\n                }                \n            }\n\n            if(!empty($rule)) {\n                // 子域名部署规则 '子域名'=>array('模块名[/控制器名]','var1=a&var2=b');\n                if(is_array($rule)){\n                    list($rule,$vars) = $rule;\n                }\n                $array      =   explode('/',$rule);\n                // 模块绑定\n                define('BIND_MODULE',array_shift($array));\n                // 控制器绑定         \n                if(!empty($array)) {\n                    $controller  =   array_shift($array);\n                    if($controller){\n                        define('BIND_CONTROLLER',$controller);\n                    }\n                }\n                if(isset($vars)) { // 传入参数\n                    parse_str($vars,$parms);\n                    if(isset($panDomain)){\n                        $pos = array_search('*', $parms);\n                        if(false !== $pos) {\n                            // 泛域名作为参数\n                            $parms[$pos] = $panDomain;\n                        }                         \n                    }                   \n                    $_GET   =  array_merge($_GET,$parms);\n                }\n            }\n        }\n        // 分析PATHINFO信息\n        if(!isset($_SERVER['PATH_INFO'])) {\n            $types   =  explode(',',C('URL_PATHINFO_FETCH'));\n            foreach ($types as $type){\n                if(0===strpos($type,':')) {// 支持函数判断\n                    $_SERVER['PATH_INFO'] =   call_user_func(substr($type,1));\n                    break;\n                }elseif(!empty($_SERVER[$type])) {\n                    $_SERVER['PATH_INFO'] = (0 === strpos($_SERVER[$type],$_SERVER['SCRIPT_NAME']))?\n                        substr($_SERVER[$type], strlen($_SERVER['SCRIPT_NAME']))   :  $_SERVER[$type];\n                    break;\n                }\n            }\n        }\n\n        $depr = C('URL_PATHINFO_DEPR');\n        define('MODULE_PATHINFO_DEPR',  $depr);\n\n        if(empty($_SERVER['PATH_INFO'])) {\n            $_SERVER['PATH_INFO'] = '';\n            define('__INFO__','');\n            define('__EXT__','');\n        }else{\n            define('__INFO__',trim($_SERVER['PATH_INFO'],'/'));\n            // URL后缀\n            define('__EXT__', strtolower(pathinfo($_SERVER['PATH_INFO'],PATHINFO_EXTENSION)));\n            $_SERVER['PATH_INFO'] = __INFO__;     \n            if(!defined('BIND_MODULE') && (!C('URL_ROUTER_ON') || !Route::check())){\n                if (__INFO__ && C('MULTI_MODULE')){ // 获取模块名\n                    $paths      =   explode($depr,__INFO__,2);\n                    $allowList  =   C('MODULE_ALLOW_LIST'); // 允许的模块列表\n                    $module     =   preg_replace('/\\.' . __EXT__ . '$/i', '',$paths[0]);\n                    if( empty($allowList) || (is_array($allowList) && in_array_case($module, $allowList))){\n                        $_GET[$varModule]       =   $module;\n                        $_SERVER['PATH_INFO']   =   isset($paths[1])?$paths[1]:'';\n                    }\n                }\n            }             \n        }\n\n        // URL常量\n        define('__SELF__',strip_tags($_SERVER[C('URL_REQUEST_URI')]));\n\n        // 获取模块名称\n        define('MODULE_NAME', defined('BIND_MODULE')? BIND_MODULE : self::getModule($varModule));\n        \n        // 检测模块是否存在\n        if( MODULE_NAME && (defined('BIND_MODULE') || !in_array_case(MODULE_NAME,C('MODULE_DENY_LIST')) ) && is_dir(APP_PATH.MODULE_NAME)){\n            // 定义当前模块路径\n            define('MODULE_PATH', APP_PATH.MODULE_NAME.'/');\n            // 定义当前模块的模版缓存路径\n            C('CACHE_PATH',CACHE_PATH.MODULE_NAME.'/');\n            // 定义当前模块的日志目录\n\t        C('LOG_PATH',  realpath(LOG_PATH).'/'.MODULE_NAME.'/');\n\n            // 模块检测\n            Hook::listen('module_check');\n\n            // 加载模块配置文件\n            if(is_file(MODULE_PATH.'Conf/config'.CONF_EXT))\n                C(load_config(MODULE_PATH.'Conf/config'.CONF_EXT));\n            // 加载应用模式对应的配置文件\n            if('common' != APP_MODE && is_file(MODULE_PATH.'Conf/config_'.APP_MODE.CONF_EXT))\n                C(load_config(MODULE_PATH.'Conf/config_'.APP_MODE.CONF_EXT));\n            // 当前应用状态对应的配置文件\n            if(APP_STATUS && is_file(MODULE_PATH.'Conf/'.APP_STATUS.CONF_EXT))\n                C(load_config(MODULE_PATH.'Conf/'.APP_STATUS.CONF_EXT));\n\n            // 加载模块别名定义\n            if(is_file(MODULE_PATH.'Conf/alias.php'))\n                Think::addMap(include MODULE_PATH.'Conf/alias.php');\n            // 加载模块tags文件定义\n            if(is_file(MODULE_PATH.'Conf/tags.php'))\n                Hook::import(include MODULE_PATH.'Conf/tags.php');\n            // 加载模块函数文件\n            if(is_file(MODULE_PATH.'Common/function.php'))\n                include MODULE_PATH.'Common/function.php';\n            \n            $urlCase        =   C('URL_CASE_INSENSITIVE');\n            // 加载模块的扩展配置文件\n            load_ext_file(MODULE_PATH);\n        }else{\n            E(L('_MODULE_NOT_EXIST_').':'.MODULE_NAME);\n        }\n\n        if(!defined('__APP__')){\n\t        $urlMode        =   C('URL_MODEL');\n\t        if($urlMode == URL_COMPAT ){// 兼容模式判断\n\t            define('PHP_FILE',_PHP_FILE_.'?'.$varPath.'=');\n\t        }elseif($urlMode == URL_REWRITE ) {\n\t            $url    =   dirname(_PHP_FILE_);\n\t            if($url == '/' || $url == '\\\\')\n\t                $url    =   '';\n\t            define('PHP_FILE',$url);\n\t        }else {\n\t            define('PHP_FILE',_PHP_FILE_);\n\t        }\n\t        // 当前应用地址\n\t        define('__APP__',strip_tags(PHP_FILE));\n\t    }\n        // 模块URL地址\n        $moduleName    =   defined('MODULE_ALIAS')? MODULE_ALIAS : MODULE_NAME;\n        define('__MODULE__',(defined('BIND_MODULE') || !C('MULTI_MODULE'))? __APP__ : __APP__.'/'.($urlCase ? strtolower($moduleName) : $moduleName));\n\n        if('' != $_SERVER['PATH_INFO'] && (!C('URL_ROUTER_ON') ||  !Route::check()) ){   // 检测路由规则 如果没有则按默认规则调度URL\n            Hook::listen('path_info');\n            // 检查禁止访问的URL后缀\n            if(C('URL_DENY_SUFFIX') && preg_match('/\\.('.trim(C('URL_DENY_SUFFIX'),'.').')$/i', $_SERVER['PATH_INFO'])){\n                send_http_status(404);\n                exit;\n            }\n            \n            // 去除URL后缀\n            $_SERVER['PATH_INFO'] = preg_replace(C('URL_HTML_SUFFIX')? '/\\.('.trim(C('URL_HTML_SUFFIX'),'.').')$/i' : '/\\.'.__EXT__.'$/i', '', $_SERVER['PATH_INFO']);\n\n            $depr   =   C('URL_PATHINFO_DEPR');\n            $paths  =   explode($depr,trim($_SERVER['PATH_INFO'],$depr));\n\n            if(!defined('BIND_CONTROLLER')) {// 获取控制器\n                if(C('CONTROLLER_LEVEL')>1){// 控制器层次\n                    $_GET[$varController]   =   implode('/',array_slice($paths,0,C('CONTROLLER_LEVEL')));\n                    $paths  =   array_slice($paths, C('CONTROLLER_LEVEL'));\n                }else{\n                    $_GET[$varController]   =   array_shift($paths);\n                }\n            }\n            // 获取操作\n            if(!defined('BIND_ACTION')){\n                $_GET[$varAction]  =   array_shift($paths);\n            }\n            // 解析剩余的URL参数\n            $var  =  array();\n            if(C('URL_PARAMS_BIND') && 1 == C('URL_PARAMS_BIND_TYPE')){\n                // URL参数按顺序绑定变量\n                $var    =   $paths;\n            }else{\n                preg_replace_callback('/(\\w+)\\/([^\\/]+)/', function($match) use(&$var){$var[$match[1]]=strip_tags($match[2]);}, implode('/',$paths));\n            }\n            $_GET   =  array_merge($var,$_GET);\n        }\n        // 获取控制器的命名空间（路径）\n        define('CONTROLLER_PATH',   self::getSpace($varAddon,$urlCase));\n        // 获取控制器和操作名\n        define('CONTROLLER_NAME',   defined('BIND_CONTROLLER')? BIND_CONTROLLER : self::getController($varController,$urlCase));\n        define('ACTION_NAME',       defined('BIND_ACTION')? BIND_ACTION : self::getAction($varAction,$urlCase));\n\n        // 当前控制器的UR地址\n        $controllerName    =   defined('CONTROLLER_ALIAS')? CONTROLLER_ALIAS : CONTROLLER_NAME;\n        define('__CONTROLLER__',__MODULE__.$depr.(defined('BIND_CONTROLLER')? '': ( $urlCase ? parse_name($controllerName) : $controllerName )) );\n\n        // 当前操作的URL地址\n        define('__ACTION__',__CONTROLLER__.$depr.(defined('ACTION_ALIAS')?ACTION_ALIAS:ACTION_NAME));\n\n        //保证$_REQUEST正常取值\n        $_REQUEST = array_merge($_POST,$_GET,$_COOKIE);\t// -- 加了$_COOKIE.  保证哦..\n    }\n\n    /**\n     * 获得控制器的命名空间路径 便于插件机制访问\n     */\n    static private function getSpace($var,$urlCase) {\n        $space  =   !empty($_GET[$var])?strip_tags($_GET[$var]):'';\n        unset($_GET[$var]);\n        return $space;\n    }\n\n    /**\n     * 获得实际的控制器名称\n     */\n    static private function getController($var,$urlCase) {\n        $controller = (!empty($_GET[$var])? $_GET[$var]:C('DEFAULT_CONTROLLER'));\n        unset($_GET[$var]);\n        if($maps = C('URL_CONTROLLER_MAP')) {\n            if(isset($maps[strtolower($controller)])) {\n                // 记录当前别名\n                define('CONTROLLER_ALIAS',strtolower($controller));\n                // 获取实际的控制器名\n                return   ucfirst($maps[CONTROLLER_ALIAS]);\n            }elseif(array_search(strtolower($controller),$maps)){\n                // 禁止访问原始控制器\n                return   '';\n            }\n        }\n        if($urlCase) {\n            // URL地址不区分大小写\n            // 智能识别方式 user_type 识别到 UserTypeController 控制器\n            $controller = parse_name($controller,1);\n        }\n        return strip_tags(ucfirst($controller));\n    }\n\n    /**\n     * 获得实际的操作名称\n     */\n    static private function getAction($var,$urlCase) {\n        $action   = !empty($_POST[$var]) ?\n            $_POST[$var] :\n            (!empty($_GET[$var])?$_GET[$var]:C('DEFAULT_ACTION'));\n        unset($_POST[$var],$_GET[$var]);\n        if($maps = C('URL_ACTION_MAP')) {\n            if(isset($maps[strtolower(CONTROLLER_NAME)])) {\n                $maps =   $maps[strtolower(CONTROLLER_NAME)];\n                if(isset($maps[strtolower($action)])) {\n                    // 记录当前别名\n                    define('ACTION_ALIAS',strtolower($action));\n                    // 获取实际的操作名\n                    if(is_array($maps[ACTION_ALIAS])){\n                        parse_str($maps[ACTION_ALIAS][1],$vars);\n                        $_GET   =   array_merge($_GET,$vars);\n                        return $maps[ACTION_ALIAS][0];\n                    }else{\n                        return $maps[ACTION_ALIAS];\n                    }\n                    \n                }elseif(array_search(strtolower($action),$maps)){\n                    // 禁止访问原始操作\n                    return   '';\n                }\n            }\n        }\n        return strip_tags( $urlCase? strtolower($action) : $action );\n    }\n\n    /**\n     * 获得实际的模块名称\n     */\n    static private function getModule($var) {\n        $module   = (!empty($_GET[$var])?$_GET[$var]:C('DEFAULT_MODULE'));\n        unset($_GET[$var]);\n        if($maps = C('URL_MODULE_MAP')) {\n            if(isset($maps[strtolower($module)])) {\n                // 记录当前别名\n                define('MODULE_ALIAS',strtolower($module));\n                // 获取实际的模块名\n                return   ucfirst($maps[MODULE_ALIAS]);\n            }elseif(array_search(strtolower($module),$maps)){\n                // 禁止访问原始模块\n                return   '';\n            }\n        }\n        return strip_tags(ucfirst($module));\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Exception.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * ThinkPHP系统异常基类\n */\nclass Exception extends \\Exception {\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Hook.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006~2013 http://topthink.com All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * ThinkPHP系统钩子实现\n */\nclass Hook {\n\n    static private  $tags       =   array();\n\n    /**\n     * 动态添加插件到某个标签\n     * @param string $tag 标签名称\n     * @param mixed $name 插件名称\n     * @return void\n     */\n    static public function add($tag,$name) {\n        if(!isset(self::$tags[$tag])){\n            self::$tags[$tag]   =   array();\n        }\n        if(is_array($name)){\n            self::$tags[$tag]   =   array_merge(self::$tags[$tag],$name);\n        }else{\n            self::$tags[$tag][] =   $name;\n        }\n    }\n\n    /**\n     * 批量导入插件\n     * @param array $data 插件信息\n     * @param boolean $recursive 是否递归合并\n     * @return void\n     */\n    static public function import($data,$recursive=true) {\n        if(!$recursive){ // 覆盖导入\n            self::$tags   =   array_merge(self::$tags,$data);\n        }else{ // 合并导入\n            foreach ($data as $tag=>$val){\n                if(!isset(self::$tags[$tag]))\n                    self::$tags[$tag]   =   array();            \n                if(!empty($val['_overlay'])){\n                    // 可以针对某个标签指定覆盖模式\n                    unset($val['_overlay']);\n                    self::$tags[$tag]   =   $val;\n                }else{\n                    // 合并模式\n                    self::$tags[$tag]   =   array_merge(self::$tags[$tag],$val);\n                }\n            }            \n        }\n    }\n\n    /**\n     * 获取插件信息\n     * @param string $tag 插件位置 留空获取全部\n     * @return array\n     */\n    static public function get($tag='') {\n        if(empty($tag)){\n            // 获取全部的插件信息\n            return self::$tags;\n        }else{\n            return self::$tags[$tag];\n        }\n    }\n\n    /**\n     * 监听标签的插件\n     * @param string $tag 标签名称\n     * @param mixed $params 传入参数\n     * @return void\n     */\n    static public function listen($tag, &$params=NULL) {\n        if(isset(self::$tags[$tag])) {\n            if(APP_DEBUG) {\n                G($tag.'Start');\n                trace('[ '.$tag.' ] --START--','','INFO');\n            }\n            foreach (self::$tags[$tag] as $name) {\n                APP_DEBUG && G($name.'_start');\n                $result =   self::exec($name, $tag,$params);\n                if(APP_DEBUG){\n                    G($name.'_end');\n                    trace('Run '.$name.' [ RunTime:'.G($name.'_start',$name.'_end',6).'s ]','','INFO');\n                }\n                if(false === $result) {\n                    // 如果返回false 则中断插件执行\n                    return ;\n                }\n            }\n            if(APP_DEBUG) { // 记录行为的执行日志\n                trace('[ '.$tag.' ] --END-- [ RunTime:'.G($tag.'Start',$tag.'End',6).'s ]','','INFO');\n            }\n        }\n        return;\n    }\n\n    /**\n     * 执行某个插件\n     * @param string $name 插件名称\n     * @param string $tag 方法名（标签名）     \n     * @param Mixed $params 传入的参数\n     * @return void\n     */\n    static public function exec($name, $tag,&$params=NULL) {\n        if('Behavior' == substr($name,-8) ){\n            // 行为扩展必须用run入口方法\n            $tag    =   'run';\n        }\n        $addon   = new $name();\n        return $addon->$tag($params);\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Image/Driver/GIF.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | TOPThink [ WE CAN DO IT JUST THINK ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2010 http://topthink.com All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>\n// +----------------------------------------------------------------------\n// | GIF.class.php 2013-03-09\n// +----------------------------------------------------------------------\nnamespace Think\\Image\\Driver;\nclass GIF{\n\t/**\n\t * GIF帧列表\n\t * @var array\n\t */\n\tprivate $frames = array();\n\n\t/**\n\t * 每帧等待时间列表\n\t * @var array\n\t */\n\tprivate $delays = array();\n\n\t/**\n\t * 构造方法，用于解码GIF图片\n\t * @param string $src GIF图片数据\n\t * @param string $mod 图片数据类型\n\t */\n\tpublic function __construct($src = null, $mod = 'url') {\n\t\tif(!is_null($src)){\n\t\t\tif('url' == $mod && is_file($src)){\n\t\t\t\t$src = file_get_contents($src);\n\t\t\t}\n\t\t\t\n\t\t\t/* 解码GIF图片 */\n\t\t\ttry{\n\t\t\t\t$de = new GIFDecoder($src);\n\t\t\t\t$this->frames = $de->GIFGetFrames();\n\t\t\t\t$this->delays = $de->GIFGetDelays();\n\t\t\t} catch(\\Exception $e){\n\t\t\t\tE(\"解码GIF图片出错\");\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * 设置或获取当前帧的数据\n\t * @param  string $stream 二进制数据流\n\t * @return boolean        获取到的数据\n\t */\n\tpublic function image($stream = null){\n\t\tif(is_null($stream)){\n\t\t\t$current = current($this->frames);\n\t\t\treturn false === $current ? reset($this->frames) : $current;\n\t\t} else {\n\t\t\t$this->frames[key($this->frames)] = $stream;\n\t\t}\n\t}\n\n\t/**\n\t * 将当前帧移动到下一帧\n\t * @return string 当前帧数据\n\t */\n\tpublic function nextImage(){\n\t\treturn next($this->frames);\n\t}\n\n\t/**\n\t * 编码并保存当前GIF图片\n\t * @param  string $gifname 图片名称\n\t */\n\tpublic function save($gifname){\n\t\t$gif = new GIFEncoder($this->frames, $this->delays, 0, 2, 0, 0, 0, 'bin');\n\t\tfile_put_contents($gifname, $gif->GetAnimation());\n\t}\n\n}\n\n\n/*\n:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\n::\n::\tGIFEncoder Version 2.0 by László Zsidi, http://gifs.hu\n::\n::\tThis class is a rewritten 'GifMerge.class.php' version.\n::\n::  Modification:\n::   - Simplified and easy code,\n::   - Ultra fast encoding,\n::   - Built-in errors,\n::   - Stable working\n::\n::\n::\tUpdated at 2007. 02. 13. '00.05.AM'\n::\n::\n::\n::  Try on-line GIFBuilder Form demo based on GIFEncoder.\n::\n::  http://gifs.hu/phpclasses/demos/GifBuilder/\n::\n:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\n*/\n\nClass GIFEncoder {\n\tprivate $GIF = \"GIF89a\";\t\t/* GIF header 6 bytes\t*/\n\tprivate $VER = \"GIFEncoder V2.05\";\t/* Encoder version\t\t*/\n\n\tprivate $BUF = Array ( );\n\tprivate $LOP =  0;\n\tprivate $DIS =  2;\n\tprivate $COL = -1;\n\tprivate $IMG = -1;\n\n\tprivate $ERR = Array (\n\t\t'ERR00'\t=>\t\"Does not supported function for only one image!\",\n\t\t'ERR01'\t=>\t\"Source is not a GIF image!\",\n\t\t'ERR02'\t=>\t\"Unintelligible flag \",\n\t\t'ERR03'\t=>\t\"Does not make animation from animated GIF source\",\n\t);\n\n\t/*\n\t:::::::::::::::::::::::::::::::::::::::::::::::::::\n\t::\n\t::\tGIFEncoder...\n\t::\n\t*/\n\tpublic function __construct($GIF_src, $GIF_dly, $GIF_lop, $GIF_dis,$GIF_red, $GIF_grn, $GIF_blu, $GIF_mod) {\n\t\tif ( ! is_array ( $GIF_src ) && ! is_array ( $GIF_dly ) ) {\n\t\t\tprintf\t( \"%s: %s\", $this->VER, $this->ERR [ 'ERR00' ] );\n\t\t\texit\t( 0 );\n\t\t}\n\t\t$this->LOP = ( $GIF_lop > -1 ) ? $GIF_lop : 0;\n\t\t$this->DIS = ( $GIF_dis > -1 ) ? ( ( $GIF_dis < 3 ) ? $GIF_dis : 3 ) : 2;\n\t\t$this->COL = ( $GIF_red > -1 && $GIF_grn > -1 && $GIF_blu > -1 ) ?\n\t\t\t\t\t\t( $GIF_red | ( $GIF_grn << 8 ) | ( $GIF_blu << 16 ) ) : -1;\n\n\t\tfor ( $i = 0; $i < count ( $GIF_src ); $i++ ) {\n\t\t\tif ( strToLower ( $GIF_mod ) == \"url\" ) {\n\t\t\t\t$this->BUF [ ] = fread ( fopen ( $GIF_src [ $i ], \"rb\" ), filesize ( $GIF_src [ $i ] ) );\n\t\t\t}\n\t\t\telse if ( strToLower ( $GIF_mod ) == \"bin\" ) {\n\t\t\t\t$this->BUF [ ] = $GIF_src [ $i ];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tprintf\t( \"%s: %s ( %s )!\", $this->VER, $this->ERR [ 'ERR02' ], $GIF_mod );\n\t\t\t\texit\t( 0 );\n\t\t\t}\n\t\t\tif ( substr ( $this->BUF [ $i ], 0, 6 ) != \"GIF87a\" && substr ( $this->BUF [ $i ], 0, 6 ) != \"GIF89a\" ) {\n\t\t\t\tprintf\t( \"%s: %d %s\", $this->VER, $i, $this->ERR [ 'ERR01' ] );\n\t\t\t\texit\t( 0 );\n\t\t\t}\n\t\t\tfor ( $j = ( 13 + 3 * ( 2 << ( ord ( $this->BUF [ $i ] { 10 } ) & 0x07 ) ) ), $k = TRUE; $k; $j++ ) {\n\t\t\t\tswitch ( $this->BUF [ $i ] { $j } ) {\n\t\t\t\t\tcase \"!\":\n\t\t\t\t\t\tif ( ( substr ( $this->BUF [ $i ], ( $j + 3 ), 8 ) ) == \"NETSCAPE\" ) {\n\t\t\t\t\t\t\tprintf\t( \"%s: %s ( %s source )!\", $this->VER, $this->ERR [ 'ERR03' ], ( $i + 1 ) );\n\t\t\t\t\t\t\texit\t( 0 );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \";\":\n\t\t\t\t\t\t$k = FALSE;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t$this->GIFAddHeader ( );\n\t\tfor ( $i = 0; $i < count ( $this->BUF ); $i++ ) {\n\t\t\t$this->GIFAddFrames ( $i, $GIF_dly [ $i ] );\n\t\t}\n\t\t$this->GIFAddFooter ( );\n\t}\n\t/*\n\t:::::::::::::::::::::::::::::::::::::::::::::::::::\n\t::\n\t::\tGIFAddHeader...\n\t::\n\t*/\n\tprivate function GIFAddHeader ( ) {\n\t\t$cmap = 0;\n\n\t\tif ( ord ( $this->BUF [ 0 ] { 10 } ) & 0x80 ) {\n\t\t\t$cmap = 3 * ( 2 << ( ord ( $this->BUF [ 0 ] { 10 } ) & 0x07 ) );\n\n\t\t\t$this->GIF .= substr ( $this->BUF [ 0 ], 6, 7\t\t);\n\t\t\t$this->GIF .= substr ( $this->BUF [ 0 ], 13, $cmap\t);\n\t\t\t$this->GIF .= \"!\\377\\13NETSCAPE2.0\\3\\1\" . $this->GIFWord ( $this->LOP ) . \"\\0\";\n\t\t}\n\t}\n\t/*\n\t:::::::::::::::::::::::::::::::::::::::::::::::::::\n\t::\n\t::\tGIFAddFrames...\n\t::\n\t*/\n\tprivate function GIFAddFrames ( $i, $d ) {\n\n\t\t$Locals_str = 13 + 3 * ( 2 << ( ord ( $this->BUF [ $i ] { 10 } ) & 0x07 ) );\n\n\t\t$Locals_end = strlen ( $this->BUF [ $i ] ) - $Locals_str - 1;\n\t\t$Locals_tmp = substr ( $this->BUF [ $i ], $Locals_str, $Locals_end );\n\n\t\t$Global_len = 2 << ( ord ( $this->BUF [ 0  ] { 10 } ) & 0x07 );\n\t\t$Locals_len = 2 << ( ord ( $this->BUF [ $i ] { 10 } ) & 0x07 );\n\n\t\t$Global_rgb = substr ( $this->BUF [ 0  ], 13,\n\t\t\t\t\t\t\t3 * ( 2 << ( ord ( $this->BUF [ 0  ] { 10 } ) & 0x07 ) ) );\n\t\t$Locals_rgb = substr ( $this->BUF [ $i ], 13,\n\t\t\t\t\t\t\t3 * ( 2 << ( ord ( $this->BUF [ $i ] { 10 } ) & 0x07 ) ) );\n\n\t\t$Locals_ext = \"!\\xF9\\x04\" . chr ( ( $this->DIS << 2 ) + 0 ) .\n\t\t\t\t\t\tchr ( ( $d >> 0 ) & 0xFF ) . chr ( ( $d >> 8 ) & 0xFF ) . \"\\x0\\x0\";\n\n\t\tif ( $this->COL > -1 && ord ( $this->BUF [ $i ] { 10 } ) & 0x80 ) {\n\t\t\tfor ( $j = 0; $j < ( 2 << ( ord ( $this->BUF [ $i ] { 10 } ) & 0x07 ) ); $j++ ) {\n\t\t\t\tif\t(\n\t\t\t\t\t\tord ( $Locals_rgb { 3 * $j + 0 } ) == ( ( $this->COL >> 16 ) & 0xFF ) &&\n\t\t\t\t\t\tord ( $Locals_rgb { 3 * $j + 1 } ) == ( ( $this->COL >>  8 ) & 0xFF ) &&\n\t\t\t\t\t\tord ( $Locals_rgb { 3 * $j + 2 } ) == ( ( $this->COL >>  0 ) & 0xFF )\n\t\t\t\t\t) {\n\t\t\t\t\t$Locals_ext = \"!\\xF9\\x04\" . chr ( ( $this->DIS << 2 ) + 1 ) .\n\t\t\t\t\t\t\t\t\tchr ( ( $d >> 0 ) & 0xFF ) . chr ( ( $d >> 8 ) & 0xFF ) . chr ( $j ) . \"\\x0\";\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tswitch ( $Locals_tmp { 0 } ) {\n\t\t\tcase \"!\":\n\t\t\t\t$Locals_img = substr ( $Locals_tmp, 8, 10 );\n\t\t\t\t$Locals_tmp = substr ( $Locals_tmp, 18, strlen ( $Locals_tmp ) - 18 );\n\t\t\t\tbreak;\n\t\t\tcase \",\":\n\t\t\t\t$Locals_img = substr ( $Locals_tmp, 0, 10 );\n\t\t\t\t$Locals_tmp = substr ( $Locals_tmp, 10, strlen ( $Locals_tmp ) - 10 );\n\t\t\t\tbreak;\n\t\t}\n\t\tif ( ord ( $this->BUF [ $i ] { 10 } ) & 0x80 && $this->IMG > -1 ) {\n\t\t\tif ( $Global_len == $Locals_len ) {\n\t\t\t\tif ( $this->GIFBlockCompare ( $Global_rgb, $Locals_rgb, $Global_len ) ) {\n\t\t\t\t\t$this->GIF .= ( $Locals_ext . $Locals_img . $Locals_tmp );\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$byte  = ord ( $Locals_img { 9 } );\n\t\t\t\t\t$byte |= 0x80;\n\t\t\t\t\t$byte &= 0xF8;\n\t\t\t\t\t$byte |= ( ord ( $this->BUF [ 0 ] { 10 } ) & 0x07 );\n\t\t\t\t\t$Locals_img { 9 } = chr ( $byte );\n\t\t\t\t\t$this->GIF .= ( $Locals_ext . $Locals_img . $Locals_rgb . $Locals_tmp );\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$byte  = ord ( $Locals_img { 9 } );\n\t\t\t\t$byte |= 0x80;\n\t\t\t\t$byte &= 0xF8;\n\t\t\t\t$byte |= ( ord ( $this->BUF [ $i ] { 10 } ) & 0x07 );\n\t\t\t\t$Locals_img { 9 } = chr ( $byte );\n\t\t\t\t$this->GIF .= ( $Locals_ext . $Locals_img . $Locals_rgb . $Locals_tmp );\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t$this->GIF .= ( $Locals_ext . $Locals_img . $Locals_tmp );\n\t\t}\n\t\t$this->IMG  = 1;\n\t}\n\t/*\n\t:::::::::::::::::::::::::::::::::::::::::::::::::::\n\t::\n\t::\tGIFAddFooter...\n\t::\n\t*/\n\tprivate function GIFAddFooter ( ) {\n\t\t$this->GIF .= \";\";\n\t}\n\t/*\n\t:::::::::::::::::::::::::::::::::::::::::::::::::::\n\t::\n\t::\tGIFBlockCompare...\n\t::\n\t*/\n\tprivate function GIFBlockCompare ( $GlobalBlock, $LocalBlock, $Len ) {\n\n\t\tfor ( $i = 0; $i < $Len; $i++ ) {\n\t\t\tif\t(\n\t\t\t\t\t$GlobalBlock { 3 * $i + 0 } != $LocalBlock { 3 * $i + 0 } ||\n\t\t\t\t\t$GlobalBlock { 3 * $i + 1 } != $LocalBlock { 3 * $i + 1 } ||\n\t\t\t\t\t$GlobalBlock { 3 * $i + 2 } != $LocalBlock { 3 * $i + 2 }\n\t\t\t\t) {\n\t\t\t\t\treturn ( 0 );\n\t\t\t}\n\t\t}\n\n\t\treturn ( 1 );\n\t}\n\t/*\n\t:::::::::::::::::::::::::::::::::::::::::::::::::::\n\t::\n\t::\tGIFWord...\n\t::\n\t*/\n\tprivate function GIFWord ( $int ) {\n\n\t\treturn ( chr ( $int & 0xFF ) . chr ( ( $int >> 8 ) & 0xFF ) );\n\t}\n\t/*\n\t:::::::::::::::::::::::::::::::::::::::::::::::::::\n\t::\n\t::\tGetAnimation...\n\t::\n\t*/\n\tpublic function GetAnimation ( ) {\n\t\treturn ( $this->GIF );\n\t}\n}\n\n\n/*\n:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\n::\n::\tGIFDecoder Version 2.0 by László Zsidi, http://gifs.hu\n::\n::\tCreated at 2007. 02. 01. '07.47.AM'\n::\n::\n::\n::\n::  Try on-line GIFBuilder Form demo based on GIFDecoder.\n::\n::  http://gifs.hu/phpclasses/demos/GifBuilder/\n::\n:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\n*/\n\nClass GIFDecoder {\n\tprivate $GIF_buffer = Array ( );\n\tprivate $GIF_arrays = Array ( );\n\tprivate $GIF_delays = Array ( );\n\tprivate $GIF_stream = \"\";\n\tprivate $GIF_string = \"\";\n\tprivate $GIF_bfseek =  0;\n\n\tprivate $GIF_screen = Array ( );\n\tprivate $GIF_global = Array ( );\n\tprivate $GIF_sorted;\n\tprivate $GIF_colorS;\n\tprivate $GIF_colorC;\n\tprivate $GIF_colorF;\n\n\t/*\n\t:::::::::::::::::::::::::::::::::::::::::::::::::::\n\t::\n\t::\tGIFDecoder ( $GIF_pointer )\n\t::\n\t*/\n\tpublic function __construct ( $GIF_pointer ) {\n\t\t$this->GIF_stream = $GIF_pointer;\n\n\t\t$this->GIFGetByte ( 6 );\t// GIF89a\n\t\t$this->GIFGetByte ( 7 );\t// Logical Screen Descriptor\n\n\t\t$this->GIF_screen = $this->GIF_buffer;\n\t\t$this->GIF_colorF = $this->GIF_buffer [ 4 ] & 0x80 ? 1 : 0;\n\t\t$this->GIF_sorted = $this->GIF_buffer [ 4 ] & 0x08 ? 1 : 0;\n\t\t$this->GIF_colorC = $this->GIF_buffer [ 4 ] & 0x07;\n\t\t$this->GIF_colorS = 2 << $this->GIF_colorC;\n\n\t\tif ( $this->GIF_colorF == 1 ) {\n\t\t\t$this->GIFGetByte ( 3 * $this->GIF_colorS );\n\t\t\t$this->GIF_global = $this->GIF_buffer;\n\t\t}\n\t\t/*\n\t\t *\n\t\t *  05.06.2007.\n\t\t *  Made a little modification\n\t\t *\n\t\t *\n\t\t -\tfor ( $cycle = 1; $cycle; ) {\n\t\t +\t\tif ( GIFDecoder::GIFGetByte ( 1 ) ) {\n\t\t -\t\t\tswitch ( $this->GIF_buffer [ 0 ] ) {\n\t\t -\t\t\t\tcase 0x21:\n\t\t -\t\t\t\t\tGIFDecoder::GIFReadExtensions ( );\n\t\t -\t\t\t\t\tbreak;\n\t\t -\t\t\t\tcase 0x2C:\n\t\t -\t\t\t\t\tGIFDecoder::GIFReadDescriptor ( );\n\t\t -\t\t\t\t\tbreak;\n\t\t -\t\t\t\tcase 0x3B:\n\t\t -\t\t\t\t\t$cycle = 0;\n\t\t -\t\t\t\t\tbreak;\n\t\t -\t\t  \t}\n\t\t -\t\t}\n\t\t +\t\telse {\n\t\t +\t\t\t$cycle = 0;\n\t\t +\t\t}\n\t\t -\t}\n\t\t*/\n\t\tfor ( $cycle = 1; $cycle; ) {\n\t\t\tif ( $this->GIFGetByte ( 1 ) ) {\n\t\t\t\tswitch ( $this->GIF_buffer [ 0 ] ) {\n\t\t\t\t\tcase 0x21:\n\t\t\t\t\t\t$this->GIFReadExtensions ( );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 0x2C:\n\t\t\t\t\t\t$this->GIFReadDescriptor ( );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 0x3B:\n\t\t\t\t\t\t$cycle = 0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$cycle = 0;\n\t\t\t}\n\t\t}\n\t}\n\t/*\n\t:::::::::::::::::::::::::::::::::::::::::::::::::::\n\t::\n\t::\tGIFReadExtension ( )\n\t::\n\t*/\n\tprivate function GIFReadExtensions ( ) {\n\t\t$this->GIFGetByte ( 1 );\n\t\tfor ( ; ; ) {\n\t\t\t$this->GIFGetByte ( 1 );\n\t\t\tif ( ( $u = $this->GIF_buffer [ 0 ] ) == 0x00 ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t$this->GIFGetByte ( $u );\n\t\t\t/*\n\t\t\t * 07.05.2007.\n\t\t\t * Implemented a new line for a new function\n\t\t\t * to determine the originaly delays between\n\t\t\t * frames.\n\t\t\t *\n\t\t\t */\n\t\t\tif ( $u == 4 ) {\n\t\t\t\t$this->GIF_delays [ ] = ( $this->GIF_buffer [ 1 ] | $this->GIF_buffer [ 2 ] << 8 );\n\t\t\t}\n\t\t}\n\t}\n\t/*\n\t:::::::::::::::::::::::::::::::::::::::::::::::::::\n\t::\n\t::\tGIFReadExtension ( )\n\t::\n\t*/\n\tprivate function GIFReadDescriptor ( ) {\n\t\t$GIF_screen\t= Array ( );\n\n\t\t$this->GIFGetByte ( 9 );\n\t\t$GIF_screen = $this->GIF_buffer;\n\t\t$GIF_colorF = $this->GIF_buffer [ 8 ] & 0x80 ? 1 : 0;\n\t\tif ( $GIF_colorF ) {\n\t\t\t$GIF_code = $this->GIF_buffer [ 8 ] & 0x07;\n\t\t\t$GIF_sort = $this->GIF_buffer [ 8 ] & 0x20 ? 1 : 0;\n\t\t}\n\t\telse {\n\t\t\t$GIF_code = $this->GIF_colorC;\n\t\t\t$GIF_sort = $this->GIF_sorted;\n\t\t}\n\t\t$GIF_size = 2 << $GIF_code;\n\t\t$this->GIF_screen [ 4 ] &= 0x70;\n\t\t$this->GIF_screen [ 4 ] |= 0x80;\n\t\t$this->GIF_screen [ 4 ] |= $GIF_code;\n\t\tif ( $GIF_sort ) {\n\t\t\t$this->GIF_screen [ 4 ] |= 0x08;\n\t\t}\n\t\t$this->GIF_string = \"GIF87a\";\n\t\t$this->GIFPutByte ( $this->GIF_screen );\n\t\tif ( $GIF_colorF == 1 ) {\n\t\t\t$this->GIFGetByte ( 3 * $GIF_size );\n\t\t\t$this->GIFPutByte ( $this->GIF_buffer );\n\t\t}\n\t\telse {\n\t\t\t$this->GIFPutByte ( $this->GIF_global );\n\t\t}\n\t\t$this->GIF_string .= chr ( 0x2C );\n\t\t$GIF_screen [ 8 ] &= 0x40;\n\t\t$this->GIFPutByte ( $GIF_screen );\n\t\t$this->GIFGetByte ( 1 );\n\t\t$this->GIFPutByte ( $this->GIF_buffer );\n\t\tfor ( ; ; ) {\n\t\t\t$this->GIFGetByte ( 1 );\n\t\t\t$this->GIFPutByte ( $this->GIF_buffer );\n\t\t\tif ( ( $u = $this->GIF_buffer [ 0 ] ) == 0x00 ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t$this->GIFGetByte ( $u );\n\t\t\t$this->GIFPutByte ( $this->GIF_buffer );\n\t\t}\n\t\t$this->GIF_string .= chr ( 0x3B );\n\t\t/*\n\t\t   Add frames into $GIF_stream array...\n\t\t*/\n\t\t$this->GIF_arrays [ ] = $this->GIF_string;\n\t}\n\t/*\n\t:::::::::::::::::::::::::::::::::::::::::::::::::::\n\t::\n\t::\tGIFGetByte ( $len )\n\t::\n\t*/\n\n\t/*\n\t *\n\t *  05.06.2007.\n\t *  Made a little modification\n\t *\n\t *\n\t -\tfunction GIFGetByte ( $len ) {\n\t -\t\t$this->GIF_buffer = Array ( );\n\t -\n\t -\t\tfor ( $i = 0; $i < $len; $i++ ) {\n\t +\t\t\tif ( $this->GIF_bfseek > strlen ( $this->GIF_stream ) ) {\n\t +\t\t\t\treturn 0;\n\t +\t\t\t}\n\t -\t\t\t$this->GIF_buffer [ ] = ord ( $this->GIF_stream { $this->GIF_bfseek++ } );\n\t -\t\t}\n\t +\t\treturn 1;\n\t -\t}\n\t */\n\tprivate function GIFGetByte ( $len ) {\n\t\t$this->GIF_buffer = Array ( );\n\n\t\tfor ( $i = 0; $i < $len; $i++ ) {\n\t\t\tif ( $this->GIF_bfseek > strlen ( $this->GIF_stream ) ) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\t$this->GIF_buffer [ ] = ord ( $this->GIF_stream { $this->GIF_bfseek++ } );\n\t\t}\n\t\treturn 1;\n\t}\n\t/*\n\t:::::::::::::::::::::::::::::::::::::::::::::::::::\n\t::\n\t::\tGIFPutByte ( $bytes )\n\t::\n\t*/\n\tprivate function GIFPutByte ( $bytes ) {\n\t\tfor ( $i = 0; $i < count ( $bytes ); $i++ ) {\n\t\t\t$this->GIF_string .= chr ( $bytes [ $i ] );\n\t\t}\n\t}\n\t/*\n\t:::::::::::::::::::::::::::::::::::::::::::::::::::\n\t::\n\t::\tPUBLIC FUNCTIONS\n\t::\n\t::\n\t::\tGIFGetFrames ( )\n\t::\n\t*/\n\tpublic function GIFGetFrames ( ) {\n\t\treturn ( $this->GIF_arrays );\n\t}\n\t/*\n\t:::::::::::::::::::::::::::::::::::::::::::::::::::\n\t::\n\t::\tGIFGetDelays ( )\n\t::\n\t*/\n\tpublic function GIFGetDelays ( ) {\n\t\treturn ( $this->GIF_delays );\n\t}\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Image/Driver/Gd.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | TOPThink [ WE CAN DO IT JUST THINK ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2010 http://topthink.com All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>\n// +----------------------------------------------------------------------\n// | ImageGd.class.php 2013-03-05\n// +----------------------------------------------------------------------\nnamespace Think\\Image\\Driver;\nuse Think\\Image;\nclass Gd{\n    /**\n     * 图像资源对象\n     * @var resource\n     */\n    private $img;\n\n    /**\n     * 图像信息，包括width,height,type,mime,size\n     * @var array\n     */\n    private $info;\n\n    /**\n     * 构造方法，可用于打开一张图像\n     * @param string $imgname 图像路径\n     */\n    public function __construct($imgname = null) {\n        $imgname && $this->open($imgname);\n    }\n\n    /**\n     * 打开一张图像\n     * @param  string $imgname 图像路径\n     */\n    public function open($imgname){\n        //检测图像文件\n        if(!is_file($imgname)) E('不存在的图像文件');\n\n        //获取图像信息\n        $info = getimagesize($imgname);\n\n        //检测图像合法性\n        if(false === $info || (IMAGETYPE_GIF === $info[2] && empty($info['bits']))){\n            E('非法图像文件');\n        }\n\n        //设置图像信息\n        $this->info = array(\n            'width'  => $info[0],\n            'height' => $info[1],\n            'type'   => image_type_to_extension($info[2], false),\n            'mime'   => $info['mime'],\n        );\n\n        //销毁已存在的图像\n        empty($this->img) || imagedestroy($this->img);\n\n        //打开图像\n        if('gif' == $this->info['type']){\n            $class  =    'Think\\\\Image\\\\Driver\\\\GIF';\n            $this->gif = new $class($imgname);\n            $this->img = imagecreatefromstring($this->gif->image());\n        } else {\n            $fun = \"imagecreatefrom{$this->info['type']}\";\n            $this->img = $fun($imgname);\n        }\n    }\n\n    /**\n     * 保存图像\n     * @param  string  $imgname   图像保存名称\n     * @param  string  $type      图像类型\n     * @param  integer $quality   图像质量     \n     * @param  boolean $interlace 是否对JPEG类型图像设置隔行扫描\n     */\n    public function save($imgname, $type = null, $quality=80,$interlace = true){\n        if(empty($this->img)) E('没有可以被保存的图像资源');\n\n        //自动获取图像类型\n        if(is_null($type)){\n            $type = $this->info['type'];\n        } else {\n            $type = strtolower($type);\n        }\n        //保存图像\n        if('jpeg' == $type || 'jpg' == $type){\n            //JPEG图像设置隔行扫描\n            imageinterlace($this->img, $interlace);\n            imagejpeg($this->img, $imgname,$quality);\n        }elseif('gif' == $type && !empty($this->gif)){\n            $this->gif->save($imgname);\n        }else{\n            $fun  =   'image'.$type;\n            $fun($this->img, $imgname);\n        }\n    }\n\n    /**\n     * 返回图像宽度\n     * @return integer 图像宽度\n     */\n    public function width(){\n        if(empty($this->img)) E('没有指定图像资源');\n        return $this->info['width'];\n    }\n\n    /**\n     * 返回图像高度\n     * @return integer 图像高度\n     */\n    public function height(){\n        if(empty($this->img)) E('没有指定图像资源');\n        return $this->info['height'];\n    }\n\n    /**\n     * 返回图像类型\n     * @return string 图像类型\n     */\n    public function type(){\n        if(empty($this->img)) E('没有指定图像资源');\n        return $this->info['type'];\n    }\n\n    /**\n     * 返回图像MIME类型\n     * @return string 图像MIME类型\n     */\n    public function mime(){\n        if(empty($this->img)) E('没有指定图像资源');\n        return $this->info['mime'];\n    }\n\n    /**\n     * 返回图像尺寸数组 0 - 图像宽度，1 - 图像高度\n     * @return array 图像尺寸\n     */\n    public function size(){\n        if(empty($this->img)) E('没有指定图像资源');\n        return array($this->info['width'], $this->info['height']);\n    }\n\n    /**\n     * 裁剪图像\n     * @param  integer $w      裁剪区域宽度\n     * @param  integer $h      裁剪区域高度\n     * @param  integer $x      裁剪区域x坐标\n     * @param  integer $y      裁剪区域y坐标\n     * @param  integer $width  图像保存宽度\n     * @param  integer $height 图像保存高度\n     */\n    public function crop($w, $h, $x = 0, $y = 0, $width = null, $height = null){\n        if(empty($this->img)) E('没有可以被裁剪的图像资源');\n\n        //设置保存尺寸\n        empty($width)  && $width  = $w;\n        empty($height) && $height = $h;\n\n        do {\n            //创建新图像\n            $img = imagecreatetruecolor($width, $height);\n            // 调整默认颜色\n            $color = imagecolorallocate($img, 255, 255, 255);\n            imagefill($img, 0, 0, $color);\n\n            //裁剪\n            imagecopyresampled($img, $this->img, 0, 0, $x, $y, $width, $height, $w, $h);\n            imagedestroy($this->img); //销毁原图\n\n            //设置新图像\n            $this->img = $img;\n        } while(!empty($this->gif) && $this->gifNext());\n\n        $this->info['width']  = $width;\n        $this->info['height'] = $height;\n    }\n\n    /**\n     * 生成缩略图\n     * @param  integer $width  缩略图最大宽度\n     * @param  integer $height 缩略图最大高度\n     * @param  integer $type   缩略图裁剪类型\n     */\n    public function thumb($width, $height, $type = Image::IMAGE_THUMB_SCALE){\n        if(empty($this->img)) E('没有可以被缩略的图像资源');\n\n        //原图宽度和高度\n        $w = $this->info['width'];\n        $h = $this->info['height'];\n\n        /* 计算缩略图生成的必要参数 */\n        switch ($type) {\n            /* 等比例缩放 */\n            case Image::IMAGE_THUMB_SCALE:\n                //原图尺寸小于缩略图尺寸则不进行缩略\n                if($w < $width && $h < $height) return;\n\n                //计算缩放比例\n                $scale = min($width/$w, $height/$h);\n                \n                //设置缩略图的坐标及宽度和高度\n                $x = $y = 0;\n                $width  = $w * $scale;\n                $height = $h * $scale;\n                break;\n\n            /* 居中裁剪 */\n            case Image::IMAGE_THUMB_CENTER:\n                //计算缩放比例\n                $scale = max($width/$w, $height/$h);\n\n                //设置缩略图的坐标及宽度和高度\n                $w = $width/$scale;\n                $h = $height/$scale;\n                $x = ($this->info['width'] - $w)/2;\n                $y = ($this->info['height'] - $h)/2;\n                break;\n\n            /* 左上角裁剪 */\n            case Image::IMAGE_THUMB_NORTHWEST:\n                //计算缩放比例\n                $scale = max($width/$w, $height/$h);\n\n                //设置缩略图的坐标及宽度和高度\n                $x = $y = 0;\n                $w = $width/$scale;\n                $h = $height/$scale;\n                break;\n\n            /* 右下角裁剪 */\n            case Image::IMAGE_THUMB_SOUTHEAST:\n                //计算缩放比例\n                $scale = max($width/$w, $height/$h);\n\n                //设置缩略图的坐标及宽度和高度\n                $w = $width/$scale;\n                $h = $height/$scale;\n                $x = $this->info['width'] - $w;\n                $y = $this->info['height'] - $h;\n                break;\n\n            /* 填充 */\n            case Image::IMAGE_THUMB_FILLED:\n                //计算缩放比例\n                if($w < $width && $h < $height){\n                    $scale = 1;\n                } else {\n                    $scale = min($width/$w, $height/$h);\n                }\n\n                //设置缩略图的坐标及宽度和高度\n                $neww = $w * $scale;\n                $newh = $h * $scale;\n                $posx = ($width  - $w * $scale)/2;\n                $posy = ($height - $h * $scale)/2;\n\n                do{\n                    //创建新图像\n                    $img = imagecreatetruecolor($width, $height);\n                    // 调整默认颜色\n                    $color = imagecolorallocate($img, 255, 255, 255);\n                    imagefill($img, 0, 0, $color);\n\n                    //裁剪\n                    imagecopyresampled($img, $this->img, $posx, $posy, $x, $y, $neww, $newh, $w, $h);\n                    imagedestroy($this->img); //销毁原图\n                    $this->img = $img;\n                } while(!empty($this->gif) && $this->gifNext());\n                \n                $this->info['width']  = $width;\n                $this->info['height'] = $height;\n                return;\n\n            /* 固定 */\n            case Image::IMAGE_THUMB_FIXED:\n                $x = $y = 0;\n                break;\n\n            default:\n                E('不支持的缩略图裁剪类型');\n        }\n\n        /* 裁剪图像 */\n        $this->crop($w, $h, $x, $y, $width, $height);\n    }\n\n    /**\n     * 添加水印\n     * @param  string  $source 水印图片路径\n     * @param  integer $locate 水印位置\n     * @param  integer $alpha  水印透明度\n     */\n    public function water($source, $locate = Image::IMAGE_WATER_SOUTHEAST,$alpha=80){\n        //资源检测\n        if(empty($this->img)) E('没有可以被添加水印的图像资源');\n        if(!is_file($source)) E('水印图像不存在');\n\n        //获取水印图像信息\n        $info = getimagesize($source);\n        if(false === $info || (IMAGETYPE_GIF === $info[2] && empty($info['bits']))){\n            E('非法水印文件');\n        }\n\n        //创建水印图像资源\n        $fun   = 'imagecreatefrom' . image_type_to_extension($info[2], false);\n        $water = $fun($source);\n\n        //设定水印图像的混色模式\n        imagealphablending($water, true);\n\n        /* 设定水印位置 */\n        switch ($locate) {\n            /* 右下角水印 */\n            case Image::IMAGE_WATER_SOUTHEAST:\n                $x = $this->info['width'] - $info[0];\n                $y = $this->info['height'] - $info[1];\n                break;\n\n            /* 左下角水印 */\n            case Image::IMAGE_WATER_SOUTHWEST:\n                $x = 0;\n                $y = $this->info['height'] - $info[1];\n                break;\n\n            /* 左上角水印 */\n            case Image::IMAGE_WATER_NORTHWEST:\n                $x = $y = 0;\n                break;\n\n            /* 右上角水印 */\n            case Image::IMAGE_WATER_NORTHEAST:\n                $x = $this->info['width'] - $info[0];\n                $y = 0;\n                break;\n\n            /* 居中水印 */\n            case Image::IMAGE_WATER_CENTER:\n                $x = ($this->info['width'] - $info[0])/2;\n                $y = ($this->info['height'] - $info[1])/2;\n                break;\n\n            /* 下居中水印 */\n            case Image::IMAGE_WATER_SOUTH:\n                $x = ($this->info['width'] - $info[0])/2;\n                $y = $this->info['height'] - $info[1];\n                break;\n\n            /* 右居中水印 */\n            case Image::IMAGE_WATER_EAST:\n                $x = $this->info['width'] - $info[0];\n                $y = ($this->info['height'] - $info[1])/2;\n                break;\n\n            /* 上居中水印 */\n            case Image::IMAGE_WATER_NORTH:\n                $x = ($this->info['width'] - $info[0])/2;\n                $y = 0;\n                break;\n\n            /* 左居中水印 */\n            case Image::IMAGE_WATER_WEST:\n                $x = 0;\n                $y = ($this->info['height'] - $info[1])/2;\n                break;\n\n            default:\n                /* 自定义水印坐标 */\n                if(is_array($locate)){\n                    list($x, $y) = $locate;\n                } else {\n                    E('不支持的水印位置类型');\n                }\n        }\n\n        do{\n            //添加水印\n            $src = imagecreatetruecolor($info[0], $info[1]);\n            // 调整默认颜色\n            $color = imagecolorallocate($src, 255, 255, 255);\n            imagefill($src, 0, 0, $color);\n\n            imagecopy($src, $this->img, 0, 0, $x, $y, $info[0], $info[1]);\n            imagecopy($src, $water, 0, 0, 0, 0, $info[0], $info[1]);\n            imagecopymerge($this->img, $src, $x, $y, 0, 0, $info[0], $info[1], $alpha);\n\n            //销毁零时图片资源\n            imagedestroy($src);\n        } while(!empty($this->gif) && $this->gifNext());\n\n        //销毁水印资源\n        imagedestroy($water);\n    }\n\n    /**\n     * 图像添加文字\n     * @param  string  $text   添加的文字\n     * @param  string  $font   字体路径\n     * @param  integer $size   字号\n     * @param  string  $color  文字颜色\n     * @param  integer $locate 文字写入位置\n     * @param  integer $offset 文字相对当前位置的偏移量\n     * @param  integer $angle  文字倾斜角度\n     */\n    public function text($text, $font, $size, $color = '#00000000', \n        $locate = Image::IMAGE_WATER_SOUTHEAST, $offset = 0, $angle = 0){\n        //资源检测\n        if(empty($this->img)) E('没有可以被写入文字的图像资源');\n        if(!is_file($font)) E(\"不存在的字体文件：{$font}\");\n\n        //获取文字信息\n        $info = imagettfbbox($size, $angle, $font, $text);\n        $minx = min($info[0], $info[2], $info[4], $info[6]); \n        $maxx = max($info[0], $info[2], $info[4], $info[6]); \n        $miny = min($info[1], $info[3], $info[5], $info[7]); \n        $maxy = max($info[1], $info[3], $info[5], $info[7]); \n\n        /* 计算文字初始坐标和尺寸 */\n        $x = $minx;\n        $y = abs($miny);\n        $w = $maxx - $minx;\n        $h = $maxy - $miny;\n\n        /* 设定文字位置 */\n        switch ($locate) {\n            /* 右下角文字 */\n            case Image::IMAGE_WATER_SOUTHEAST:\n                $x += $this->info['width']  - $w;\n                $y += $this->info['height'] - $h;\n                break;\n\n            /* 左下角文字 */\n            case Image::IMAGE_WATER_SOUTHWEST:\n                $y += $this->info['height'] - $h;\n                break;\n\n            /* 左上角文字 */\n            case Image::IMAGE_WATER_NORTHWEST:\n                // 起始坐标即为左上角坐标，无需调整\n                break;\n\n            /* 右上角文字 */\n            case Image::IMAGE_WATER_NORTHEAST:\n                $x += $this->info['width'] - $w;\n                break;\n\n            /* 居中文字 */\n            case Image::IMAGE_WATER_CENTER:\n                $x += ($this->info['width']  - $w)/2;\n                $y += ($this->info['height'] - $h)/2;\n                break;\n\n            /* 下居中文字 */\n            case Image::IMAGE_WATER_SOUTH:\n                $x += ($this->info['width'] - $w)/2;\n                $y += $this->info['height'] - $h;\n                break;\n\n            /* 右居中文字 */\n            case Image::IMAGE_WATER_EAST:\n                $x += $this->info['width'] - $w;\n                $y += ($this->info['height'] - $h)/2;\n                break;\n\n            /* 上居中文字 */\n            case Image::IMAGE_WATER_NORTH:\n                $x += ($this->info['width'] - $w)/2;\n                break;\n\n            /* 左居中文字 */\n            case Image::IMAGE_WATER_WEST:\n                $y += ($this->info['height'] - $h)/2;\n                break;\n\n            default:\n                /* 自定义文字坐标 */\n                if(is_array($locate)){\n                    list($posx, $posy) = $locate;\n                    $x += $posx;\n                    $y += $posy;\n                } else {\n                    E('不支持的文字位置类型');\n                }\n        }\n\n        /* 设置偏移量 */\n        if(is_array($offset)){\n            $offset = array_map('intval', $offset);\n            list($ox, $oy) = $offset;\n        } else{\n            $offset = intval($offset);\n            $ox = $oy = $offset;\n        }\n\n        /* 设置颜色 */\n        if(is_string($color) && 0 === strpos($color, '#')){\n            $color = str_split(substr($color, 1), 2);\n            $color = array_map('hexdec', $color);\n            if(empty($color[3]) || $color[3] > 127){\n                $color[3] = 0;\n            }\n        } elseif (!is_array($color)) {\n            E('错误的颜色值');\n        }\n\n        do{\n            /* 写入文字 */\n            $col = imagecolorallocatealpha($this->img, $color[0], $color[1], $color[2], $color[3]);\n            imagettftext($this->img, $size, $angle, $x + $ox, $y + $oy, $col, $font, $text);\n        } while(!empty($this->gif) && $this->gifNext());\n    }\n\n    /* 切换到GIF的下一帧并保存当前帧，内部使用 */\n    private function gifNext(){\n        ob_start();\n        ob_implicit_flush(0);\n        imagegif($this->img);\n        $img = ob_get_clean();\n\n        $this->gif->image($img);\n        $next = $this->gif->nextImage();\n\n        if($next){\n            $this->img = imagecreatefromstring($next);\n            return $next;\n        } else {\n            $this->img = imagecreatefromstring($this->gif->image());\n            return false;\n        }\n    }\n\n    /**\n     * 析构方法，用于销毁图像资源\n     */\n    public function __destruct() {\n        empty($this->img) || imagedestroy($this->img);\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Image/Driver/Imagick.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | TOPThink [ WE CAN DO IT JUST THINK ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2010 http://topthink.com All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>\n// +----------------------------------------------------------------------\n// | ImageImagick.class.php 2013-03-06\n// +----------------------------------------------------------------------\nnamespace Think\\Image\\Driver;\nuse Think\\Image;\nclass Imagick{\n    /**\n     * 图像资源对象\n     * @var resource\n     */\n    private $img;\n\n    /**\n     * 图像信息，包括width,height,type,mime,size\n     * @var array\n     */\n    private $info;\n\n    /**\n     * 构造方法，可用于打开一张图像\n     * @param string $imgname 图像路径\n     */\n    public function __construct($imgname = null) {\n        $imgname && $this->open($imgname);\n    }\n\n    /**\n     * 打开一张图像\n     * @param  string $imgname 图像路径\n     */\n    public function open($imgname){\n        //检测图像文件\n        if(!is_file($imgname)) E('不存在的图像文件');\n\n        //销毁已存在的图像\n        empty($this->img) || $this->img->destroy();\n\n        //载入图像\n        $this->img = new \\Imagick(realpath($imgname));\n\n        //设置图像信息\n        $this->info = array(\n            'width'  => $this->img->getImageWidth(),\n            'height' => $this->img->getImageHeight(),\n            'type'   => strtolower($this->img->getImageFormat()),\n            'mime'   => $this->img->getImageMimeType(),\n        );\n    }\n\n    /**\n     * 保存图像\n     * @param  string  $imgname   图像保存名称\n     * @param  string  $type      图像类型\n     * @param  integer $quality   JPEG图像质量      \n     * @param  boolean $interlace 是否对JPEG类型图像设置隔行扫描\n     */\n    public function save($imgname, $type = null, $quality=80,$interlace = true){\n        if(empty($this->img)) E('没有可以被保存的图像资源');\n\n        //设置图片类型\n        if(is_null($type)){\n            $type = $this->info['type'];\n        } else {\n            $type = strtolower($type);\n            $this->img->setImageFormat($type);\n        }\n\n        //JPEG图像设置隔行扫描\n        if('jpeg' == $type || 'jpg' == $type){\n            $this->img->setImageInterlaceScheme(1);\n        }\n\n        // 设置图像质量\n        $this->img->setImageCompressionQuality($quality); \n\n        //去除图像配置信息\n        $this->img->stripImage();\n\n        //保存图像\n        $imgname = realpath(dirname($imgname)) . '/' . basename($imgname); //强制绝对路径\n        if ('gif' == $type) {\n            $this->img->writeImages($imgname, true);\n        } else {\n            $this->img->writeImage($imgname);\n        }\n    }\n\n    /**\n     * 返回图像宽度\n     * @return integer 图像宽度\n     */\n    public function width(){\n        if(empty($this->img)) E('没有指定图像资源');\n        return $this->info['width'];\n    }\n\n    /**\n     * 返回图像高度\n     * @return integer 图像高度\n     */\n    public function height(){\n        if(empty($this->img)) E('没有指定图像资源');\n        return $this->info['height'];\n    }\n\n    /**\n     * 返回图像类型\n     * @return string 图像类型\n     */\n    public function type(){\n        if(empty($this->img)) E('没有指定图像资源');\n        return $this->info['type'];\n    }\n\n    /**\n     * 返回图像MIME类型\n     * @return string 图像MIME类型\n     */\n    public function mime(){\n        if(empty($this->img)) E('没有指定图像资源');\n        return $this->info['mime'];\n    }\n\n    /**\n     * 返回图像尺寸数组 0 - 图像宽度，1 - 图像高度\n     * @return array 图像尺寸\n     */\n    public function size(){\n        if(empty($this->img)) E('没有指定图像资源');\n        return array($this->info['width'], $this->info['height']);\n    }\n\n    /**\n     * 裁剪图像\n     * @param  integer $w      裁剪区域宽度\n     * @param  integer $h      裁剪区域高度\n     * @param  integer $x      裁剪区域x坐标\n     * @param  integer $y      裁剪区域y坐标\n     * @param  integer $width  图像保存宽度\n     * @param  integer $height 图像保存高度\n     */\n    public function crop($w, $h, $x = 0, $y = 0, $width = null, $height = null){\n        if(empty($this->img)) E('没有可以被裁剪的图像资源');\n\n        //设置保存尺寸\n        empty($width)  && $width  = $w;\n        empty($height) && $height = $h;\n\n        //裁剪图片\n        if('gif' == $this->info['type']){\n            $img = $this->img->coalesceImages();\n            $this->img->destroy(); //销毁原图\n\n            //循环裁剪每一帧\n            do {\n                $this->_crop($w, $h, $x, $y, $width, $height, $img);\n            } while ($img->nextImage());\n            \n            //压缩图片\n            $this->img = $img->deconstructImages();\n            $img->destroy(); //销毁零时图片\n        } else {\n            $this->_crop($w, $h, $x, $y, $width, $height);\n        }\n    }\n\n    /* 裁剪图片，内部调用 */\n    private function _crop($w, $h, $x, $y, $width, $height, $img = null){\n        is_null($img) && $img = $this->img;\n\n        //裁剪\n        $info = $this->info;\n        if($x != 0 || $y != 0 || $w != $info['width'] || $h != $info['height']){\n            $img->cropImage($w, $h, $x, $y);\n            $img->setImagePage($w, $h, 0, 0); //调整画布和图片一致\n        }\n        \n        //调整大小\n        if($w != $width || $h != $height){\n            $img->sampleImage($width, $height);\n        }\n\n        //设置缓存尺寸\n        $this->info['width']  = $w;\n        $this->info['height'] = $h;\n    }\n\n    /**\n     * 生成缩略图\n     * @param  integer $width  缩略图最大宽度\n     * @param  integer $height 缩略图最大高度\n     * @param  integer $type   缩略图裁剪类型\n     */\n    public function thumb($width, $height, $type = Image::IMAGE_THUMB_SCALE){\n        if(empty($this->img)) E('没有可以被缩略的图像资源');\n\n        //原图宽度和高度\n        $w = $this->info['width'];\n        $h = $this->info['height'];\n\n        /* 计算缩略图生成的必要参数 */\n        switch ($type) {\n            /* 等比例缩放 */\n            case Image::IMAGE_THUMB_SCALE:\n                //原图尺寸小于缩略图尺寸则不进行缩略\n                if($w < $width && $h < $height) return;\n\n                //计算缩放比例\n                $scale = min($width/$w, $height/$h);\n                \n                //设置缩略图的坐标及宽度和高度\n                $x = $y = 0;\n                $width  = $w * $scale;\n                $height = $h * $scale;\n                break;\n\n            /* 居中裁剪 */\n            case Image::IMAGE_THUMB_CENTER:\n                //计算缩放比例\n                $scale = max($width/$w, $height/$h);\n\n                //设置缩略图的坐标及宽度和高度\n                $w = $width/$scale;\n                $h = $height/$scale;\n                $x = ($this->info['width'] - $w)/2;\n                $y = ($this->info['height'] - $h)/2;\n                break;\n\n            /* 左上角裁剪 */\n            case Image::IMAGE_THUMB_NORTHWEST:\n                //计算缩放比例\n                $scale = max($width/$w, $height/$h);\n\n                //设置缩略图的坐标及宽度和高度\n                $x = $y = 0;\n                $w = $width/$scale;\n                $h = $height/$scale;\n                break;\n\n            /* 右下角裁剪 */\n            case Image::IMAGE_THUMB_SOUTHEAST:\n                //计算缩放比例\n                $scale = max($width/$w, $height/$h);\n\n                //设置缩略图的坐标及宽度和高度\n                $w = $width/$scale;\n                $h = $height/$scale;\n                $x = $this->info['width'] - $w;\n                $y = $this->info['height'] - $h;\n                break;\n\n            /* 填充 */\n            case Image::IMAGE_THUMB_FILLED:\n                //计算缩放比例\n                if($w < $width && $h < $height){\n                    $scale = 1;\n                } else {\n                    $scale = min($width/$w, $height/$h);\n                }\n\n                //设置缩略图的坐标及宽度和高度\n                $neww = $w * $scale;\n                $newh = $h * $scale;\n                $posx = ($width  - $w * $scale)/2;\n                $posy = ($height - $h * $scale)/2;\n\n                //创建一张新图像\n                $newimg = new \\Imagick();\n                $newimg->newImage($width, $height, 'white', $this->info['type']);\n\n\n                if('gif' == $this->info['type']){\n                    $imgs = $this->img->coalesceImages();\n                    $img  = new \\Imagick();\n                    $this->img->destroy(); //销毁原图\n\n                    //循环填充每一帧\n                    do {\n                        //填充图像\n                        $image = $this->_fill($newimg, $posx, $posy, $neww, $newh, $imgs);\n                        \n                        $img->addImage($image);\n                        $img->setImageDelay($imgs->getImageDelay());\n                        $img->setImagePage($width, $height, 0, 0);\n\n                        $image->destroy(); //销毁零时图片\n\n                    } while ($imgs->nextImage());\n\n                    //压缩图片\n                    $this->img->destroy();\n                    $this->img = $img->deconstructImages();\n                    $imgs->destroy(); //销毁零时图片\n                    $img->destroy(); //销毁零时图片\n\n                } else {\n                    //填充图像\n                    $img = $this->_fill($newimg, $posx, $posy, $neww, $newh);\n                    //销毁原图\n                    $this->img->destroy();\n                    $this->img = $img;\n                }\n\n                //设置新图像属性\n                $this->info['width']  = $width;\n                $this->info['height'] = $height;\n                return;\n\n            /* 固定 */\n            case Image::IMAGE_THUMB_FIXED:\n                $x = $y = 0;\n                break;\n\n            default:\n                E('不支持的缩略图裁剪类型');\n        }\n\n        /* 裁剪图像 */\n        $this->crop($w, $h, $x, $y, $width, $height);\n    }\n\n    /* 填充指定图像，内部使用 */\n    private function _fill($newimg, $posx, $posy, $neww, $newh, $img = null){\n        is_null($img) && $img = $this->img;\n\n        /* 将指定图片绘入空白图片 */\n        $draw  = new \\ImagickDraw();\n        $draw->composite($img->getImageCompose(), $posx, $posy, $neww, $newh, $img);\n        $image = $newimg->clone();\n        $image->drawImage($draw);\n        $draw->destroy();\n\n        return $image;\n    }\n\n    /**\n     * 添加水印\n     * @param  string  $source 水印图片路径\n     * @param  integer $locate 水印位置\n     * @param  integer $alpha  水印透明度\n     */\n    public function water($source, $locate = Image::IMAGE_WATER_SOUTHEAST,$alpha=80){\n        //资源检测\n        if(empty($this->img)) E('没有可以被添加水印的图像资源');\n        if(!is_file($source)) E('水印图像不存在');\n\n        //创建水印图像资源\n        $water = new \\Imagick(realpath($source));\n        $info  = array($water->getImageWidth(), $water->getImageHeight());\n\n        /* 设定水印位置 */\n        switch ($locate) {\n            /* 右下角水印 */\n            case Image::IMAGE_WATER_SOUTHEAST:\n                $x = $this->info['width'] - $info[0];\n                $y = $this->info['height'] - $info[1];\n                break;\n\n            /* 左下角水印 */\n            case Image::IMAGE_WATER_SOUTHWEST:\n                $x = 0;\n                $y = $this->info['height'] - $info[1];\n                break;\n\n            /* 左上角水印 */\n            case Image::IMAGE_WATER_NORTHWEST:\n                $x = $y = 0;\n                break;\n\n            /* 右上角水印 */\n            case Image::IMAGE_WATER_NORTHEAST:\n                $x = $this->info['width'] - $info[0];\n                $y = 0;\n                break;\n\n            /* 居中水印 */\n            case Image::IMAGE_WATER_CENTER:\n                $x = ($this->info['width'] - $info[0])/2;\n                $y = ($this->info['height'] - $info[1])/2;\n                break;\n\n            /* 下居中水印 */\n            case Image::IMAGE_WATER_SOUTH:\n                $x = ($this->info['width'] - $info[0])/2;\n                $y = $this->info['height'] - $info[1];\n                break;\n\n            /* 右居中水印 */\n            case Image::IMAGE_WATER_EAST:\n                $x = $this->info['width'] - $info[0];\n                $y = ($this->info['height'] - $info[1])/2;\n                break;\n\n            /* 上居中水印 */\n            case Image::IMAGE_WATER_NORTH:\n                $x = ($this->info['width'] - $info[0])/2;\n                $y = 0;\n                break;\n\n            /* 左居中水印 */\n            case Image::IMAGE_WATER_WEST:\n                $x = 0;\n                $y = ($this->info['height'] - $info[1])/2;\n                break;\n\n            default:\n                /* 自定义水印坐标 */\n                if(is_array($locate)){\n                    list($x, $y) = $locate;\n                } else {\n                    E('不支持的水印位置类型');\n                }\n        }\n\n        //创建绘图资源\n        $draw = new \\ImagickDraw();\n        $draw->composite($water->getImageCompose(), $x, $y, $info[0], $info[1], $water);\n        \n        if('gif' == $this->info['type']){\n            $img = $this->img->coalesceImages();\n            $this->img->destroy(); //销毁原图\n\n            do{\n                //添加水印\n                $img->drawImage($draw);\n            } while ($img->nextImage());\n\n            //压缩图片\n            $this->img = $img->deconstructImages();\n            $img->destroy(); //销毁零时图片\n\n        } else {\n            //添加水印\n            $this->img->drawImage($draw);\n        }\n\n        //销毁水印资源\n        $draw->destroy();\n        $water->destroy();\n    }\n\n    /**\n     * 图像添加文字\n     * @param  string  $text   添加的文字\n     * @param  string  $font   字体路径\n     * @param  integer $size   字号\n     * @param  string  $color  文字颜色\n     * @param  integer $locate 文字写入位置\n     * @param  integer $offset 文字相对当前位置的偏移量\n     * @param  integer $angle  文字倾斜角度\n     */\n    public function text($text, $font, $size, $color = '#00000000', \n        $locate = Image::IMAGE_WATER_SOUTHEAST, $offset = 0, $angle = 0){\n        //资源检测\n        if(empty($this->img)) E('没有可以被写入文字的图像资源');\n        if(!is_file($font)) E(\"不存在的字体文件：{$font}\");\n\n        //获取颜色和透明度\n        if(is_array($color)){\n            $color = array_map('dechex', $color);\n            foreach ($color as &$value) {\n                $value = str_pad($value, 2, '0', STR_PAD_LEFT);\n            }\n            $color = '#' . implode('', $color);\n        } elseif(!is_string($color) || 0 !== strpos($color, '#')) {\n            E('错误的颜色值');\n        }\n        $col = substr($color, 0, 7);\n        $alp = strlen($color) == 9 ? substr($color, -2) : 0;\n        \n\n        //获取文字信息\n        $draw = new \\ImagickDraw();\n        $draw->setFont(realpath($font));\n        $draw->setFontSize($size);\n        $draw->setFillColor($col);\n        $draw->setFillAlpha(1-hexdec($alp)/127);\n        $draw->setTextAntialias(true);\n        $draw->setStrokeAntialias(true);\n        \n        $metrics = $this->img->queryFontMetrics($draw, $text);\n\n        /* 计算文字初始坐标和尺寸 */\n        $x = 0;\n        $y = $metrics['ascender'];\n        $w = $metrics['textWidth'];\n        $h = $metrics['textHeight'];\n\n        /* 设定文字位置 */\n        switch ($locate) {\n            /* 右下角文字 */\n            case Image::IMAGE_WATER_SOUTHEAST:\n                $x += $this->info['width']  - $w;\n                $y += $this->info['height'] - $h;\n                break;\n\n            /* 左下角文字 */\n            case Image::IMAGE_WATER_SOUTHWEST:\n                $y += $this->info['height'] - $h;\n                break;\n\n            /* 左上角文字 */\n            case Image::IMAGE_WATER_NORTHWEST:\n                // 起始坐标即为左上角坐标，无需调整\n                break;\n\n            /* 右上角文字 */\n            case Image::IMAGE_WATER_NORTHEAST:\n                $x += $this->info['width'] - $w;\n                break;\n\n            /* 居中文字 */\n            case Image::IMAGE_WATER_CENTER:\n                $x += ($this->info['width']  - $w)/2;\n                $y += ($this->info['height'] - $h)/2;\n                break;\n\n            /* 下居中文字 */\n            case Image::IMAGE_WATER_SOUTH:\n                $x += ($this->info['width'] - $w)/2;\n                $y += $this->info['height'] - $h;\n                break;\n\n            /* 右居中文字 */\n            case Image::IMAGE_WATER_EAST:\n                $x += $this->info['width'] - $w;\n                $y += ($this->info['height'] - $h)/2;\n                break;\n\n            /* 上居中文字 */\n            case Image::IMAGE_WATER_NORTH:\n                $x += ($this->info['width'] - $w)/2;\n                break;\n\n            /* 左居中文字 */\n            case Image::IMAGE_WATER_WEST:\n                $y += ($this->info['height'] - $h)/2;\n                break;\n\n            default:\n                /* 自定义文字坐标 */\n                if(is_array($locate)){\n                    list($posx, $posy) = $locate;\n                    $x += $posx;\n                    $y += $posy;\n                } else {\n                    E('不支持的文字位置类型');\n                }\n        }\n\n        /* 设置偏移量 */\n        if(is_array($offset)){\n            $offset = array_map('intval', $offset);\n            list($ox, $oy) = $offset;\n        } else{\n            $offset = intval($offset);\n            $ox = $oy = $offset;\n        }\n\n        /* 写入文字 */\n        if('gif' == $this->info['type']){\n            $img = $this->img->coalesceImages();\n            $this->img->destroy(); //销毁原图\n            do{\n                $img->annotateImage($draw, $x + $ox, $y + $oy, $angle, $text);\n            } while ($img->nextImage());\n\n            //压缩图片\n            $this->img = $img->deconstructImages();\n            $img->destroy(); //销毁零时图片\n\n        } else {\n            $this->img->annotateImage($draw, $x + $ox, $y + $oy, $angle, $text);\n        }\n        $draw->destroy();\n    }\n\n    /**\n     * 析构方法，用于销毁图像资源\n     */\n    public function __destruct() {\n        empty($this->img) || $this->img->destroy();\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Image.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | TOPThink [ WE CAN DO IT JUST THINK ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2010 http://topthink.com All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>\n// +----------------------------------------------------------------------\n// | ThinkImage.class.php 2013-03-05\n// +----------------------------------------------------------------------\n\nnamespace Think;\n\n/**\n * 图片处理驱动类，可配置图片处理库\n * 目前支持GD库和imagick\n * @author 麦当苗儿 <zuojiazi@vip.qq.com>\n */\nclass Image{\n    /* 驱动相关常量定义 */\n    const IMAGE_GD              =   1; //常量，标识GD库类型\n    const IMAGE_IMAGICK         =   2; //常量，标识imagick库类型\n\n    /* 缩略图相关常量定义 */\n    const IMAGE_THUMB_SCALE     =   1 ; //常量，标识缩略图等比例缩放类型\n    const IMAGE_THUMB_FILLED    =   2 ; //常量，标识缩略图缩放后填充类型\n    const IMAGE_THUMB_CENTER    =   3 ; //常量，标识缩略图居中裁剪类型\n    const IMAGE_THUMB_NORTHWEST =   4 ; //常量，标识缩略图左上角裁剪类型\n    const IMAGE_THUMB_SOUTHEAST =   5 ; //常量，标识缩略图右下角裁剪类型\n    const IMAGE_THUMB_FIXED     =   6 ; //常量，标识缩略图固定尺寸缩放类型\n\n    /* 水印相关常量定义 */\n    const IMAGE_WATER_NORTHWEST =   1 ; //常量，标识左上角水印\n    const IMAGE_WATER_NORTH     =   2 ; //常量，标识上居中水印\n    const IMAGE_WATER_NORTHEAST =   3 ; //常量，标识右上角水印\n    const IMAGE_WATER_WEST      =   4 ; //常量，标识左居中水印\n    const IMAGE_WATER_CENTER    =   5 ; //常量，标识居中水印\n    const IMAGE_WATER_EAST      =   6 ; //常量，标识右居中水印\n    const IMAGE_WATER_SOUTHWEST =   7 ; //常量，标识左下角水印\n    const IMAGE_WATER_SOUTH     =   8 ; //常量，标识下居中水印\n    const IMAGE_WATER_SOUTHEAST =   9 ; //常量，标识右下角水印\n\n    /**\n     * 图片资源\n     * @var resource\n     */\n    private $img;\n\n    /**\n     * 构造方法，用于实例化一个图片处理对象\n     * @param string $type 要使用的类库，默认使用GD库\n     */\n    public function __construct($type = self::IMAGE_GD, $imgname = null){\n        /* 判断调用库的类型 */\n        switch ($type) {\n            case self::IMAGE_GD:\n                $class = 'Gd';\n                break;\n            case self::IMAGE_IMAGICK:\n                $class = 'Imagick';\n                break;\n            default:\n                E('不支持的图片处理库类型');\n        }\n\n        /* 引入处理库，实例化图片处理对象 */\n        $class  =    \"Think\\\\Image\\\\Driver\\\\{$class}\";\n        $this->img = new $class($imgname);\n    }\n\n    /**\n     * 打开一幅图像\n     * @param  string $imgname 图片路径\n     * @return Object          当前图片处理库对象\n     */\n    public function open($imgname){\n        $this->img->open($imgname);\n        return $this;\n    }\n\n    /**\n     * 保存图片\n     * @param  string  $imgname   图片保存名称\n     * @param  string  $type      图片类型\n     * @param  integer $quality   图像质量      \n     * @param  boolean $interlace 是否对JPEG类型图片设置隔行扫描\n     * @return Object             当前图片处理库对象\n     */\n    public function save($imgname, $type = null, $quality=80,$interlace = true){\n        $this->img->save($imgname, $type, $quality,$interlace);\n        return $this;\n    }\n\n    /**\n     * 返回图片宽度\n     * @return integer 图片宽度\n     */\n    public function width(){\n        return $this->img->width();\n    }\n\n    /**\n     * 返回图片高度\n     * @return integer 图片高度\n     */\n    public function height(){\n        return $this->img->height();\n    }\n\n    /**\n     * 返回图像类型\n     * @return string 图片类型\n     */\n    public function type(){\n        return $this->img->type();\n    }\n\n    /**\n     * 返回图像MIME类型\n     * @return string 图像MIME类型\n     */\n    public function mime(){\n        return $this->img->mime();\n    }\n\n    /**\n     * 返回图像尺寸数组 0 - 图片宽度，1 - 图片高度\n     * @return array 图片尺寸\n     */\n    public function size(){\n        return $this->img->size();\n    }\n\n    /**\n     * 裁剪图片\n     * @param  integer $w      裁剪区域宽度\n     * @param  integer $h      裁剪区域高度\n     * @param  integer $x      裁剪区域x坐标\n     * @param  integer $y      裁剪区域y坐标\n     * @param  integer $width  图片保存宽度\n     * @param  integer $height 图片保存高度\n     * @return Object          当前图片处理库对象\n     */\n    public function crop($w, $h, $x = 0, $y = 0, $width = null, $height = null){\n        $this->img->crop($w, $h, $x, $y, $width, $height);\n        return $this;\n    }\n\n    /**\n     * 生成缩略图\n     * @param  integer $width  缩略图最大宽度\n     * @param  integer $height 缩略图最大高度\n     * @param  integer $type   缩略图裁剪类型\n     * @return Object          当前图片处理库对象\n     */\n    public function thumb($width, $height, $type = self::IMAGE_THUMB_SCALE){\n        $this->img->thumb($width, $height, $type);\n        return $this;\n    }\n\n    /**\n     * 添加水印\n     * @param  string  $source 水印图片路径\n     * @param  integer $locate 水印位置\n     * @param  integer $alpha  水印透明度\n     * @return Object          当前图片处理库对象\n     */\n    public function water($source, $locate = self::IMAGE_WATER_SOUTHEAST,$alpha=80){\n        $this->img->water($source, $locate,$alpha);\n        return $this;\n    }\n\n    /**\n     * 图像添加文字\n     * @param  string  $text   添加的文字\n     * @param  string  $font   字体路径\n     * @param  integer $size   字号\n     * @param  string  $color  文字颜色\n     * @param  integer $locate 文字写入位置\n     * @param  integer $offset 文字相对当前位置的偏移量\n     * @param  integer $angle  文字倾斜角度\n     * @return Object          当前图片处理库对象\n     */\n    public function text($text, $font, $size, $color = '#00000000', \n        $locate = self::IMAGE_WATER_SOUTHEAST, $offset = 0, $angle = 0){\n        $this->img->text($text, $font, $size, $color, $locate, $offset, $angle);\n        return $this;\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Log/Driver/File.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | TOPThink [ WE CAN DO IT JUST THINK ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2011 http://topthink.com All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\nnamespace Think\\Log\\Driver;\n\nclass File {\n\n    protected $config  =   array(\n        'log_time_format'   =>  ' c ',\n        'log_file_size'     =>  2097152,\n        'log_path'          =>  '',\n    );\n\n    // 实例化并传入参数\n    public function __construct($config=array()){\n        $this->config   =   array_merge($this->config,$config);\n    }\n\n    /**\n     * 日志写入接口\n     * @access public\n     * @param string $log 日志信息\n     * @param string $destination  写入目标\n     * @return void\n     */\n    public function write($log,$destination='') {\n        $now = date($this->config['log_time_format']);\n        if(empty($destination)){\n            $destination = $this->config['log_path'].date('y_m_d').'.log';\n        }\n        // 自动创建日志目录\n        $log_dir = dirname($destination);\n        if (!is_dir($log_dir)) {\n            mkdir($log_dir, 0755, true);\n        }        \n        //检测日志文件大小，超过配置大小则备份日志文件重新生成\n        if(is_file($destination) && floor($this->config['log_file_size']) <= filesize($destination) ){\n            rename($destination,dirname($destination).'/'.time().'-'.basename($destination));\n        }\n        error_log(\"[{$now}] \".$_SERVER['REMOTE_ADDR'].' '.$_SERVER['REQUEST_URI'].\"\\r\\n{$log}\\r\\n\", 3,$destination);\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Log/Driver/Sae.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | TOPThink [ WE CAN DO IT JUST THINK ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2011 http://topthink.com All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: luofei614 <weibo.com/luofei614>\n// +----------------------------------------------------------------------\n\nnamespace Think\\Log\\Driver;\n\nclass Sae {\n\n    protected $config  =   array(\n        'log_time_format'   =>  ' c ',\n    );\n\n    // 实例化并传入参数\n    public function __construct($config=array()){\n        $this->config   =   array_merge($this->config,$config);\n    }\n\n    /**\n     * 日志写入接口\n     * @access public\n     * @param string $log 日志信息\n     * @param string $destination  写入目标\n     * @return void\n     */\n    public function write($log,$destination='') {\n        static $is_debug=null;\n        $now = date($this->config['log_time_format']);\n        $logstr=\"[{$now}] \".$_SERVER['REMOTE_ADDR'].' '.$_SERVER['REQUEST_URI'].\"\\r\\n{$log}\\r\\n\";\n        if(is_null($is_debug)){\n            preg_replace('@(\\w+)\\=([^;]*)@e', '$appSettings[\\'\\\\1\\']=\"\\\\2\";', $_SERVER['HTTP_APPCOOKIE']);\n            $is_debug = in_array($_SERVER['HTTP_APPVERSION'], explode(',', $appSettings['debug'])) ? true : false;\n        }\n        if($is_debug){\n            sae_set_display_errors(false);//记录日志不将日志打印出来\n        }\n        sae_debug($logstr);\n        if($is_debug){\n            sae_set_display_errors(true);\n        }\n\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Log.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * 日志处理类\n */\nclass Log {\n\n    // 日志级别 从上到下，由低到高\n    const EMERG     = 'EMERG';  // 严重错误: 导致系统崩溃无法使用\n    const ALERT     = 'ALERT';  // 警戒性错误: 必须被立即修改的错误\n    const CRIT      = 'CRIT';  // 临界值错误: 超过临界值的错误，例如一天24小时，而输入的是25小时这样\n    const ERR       = 'ERR';  // 一般错误: 一般性错误\n    const WARN      = 'WARN';  // 警告性错误: 需要发出警告的错误\n    const NOTICE    = 'NOTIC';  // 通知: 程序可以运行但是还不够完美的错误\n    const INFO      = 'INFO';  // 信息: 程序输出信息\n    const DEBUG     = 'DEBUG';  // 调试: 调试信息\n    const SQL       = 'SQL';  // SQL：SQL语句 注意只在调试模式开启时有效\n\n    // 日志信息\n    static protected $log       =  array();\n\n    // 日志存储\n    static protected $storage   =   null;\n\n    // 日志初始化\n    static public function init($config=array()){\n        $type   =   isset($config['type']) ? $config['type'] : 'File';\n        $class  =   strpos($type,'\\\\')? $type: 'Think\\\\Log\\\\Driver\\\\'. ucwords(strtolower($type));           \n        unset($config['type']);\n        self::$storage = new $class($config);\n    }\n\n    /**\n     * 记录日志 并且会过滤未经设置的级别\n     * @static\n     * @access public\n     * @param string $message 日志信息\n     * @param string $level  日志级别\n     * @param boolean $record  是否强制记录\n     * @return void\n     */\n    static function record($message,$level=self::ERR,$record=false) {\n        if($record || false !== strpos(C('LOG_LEVEL'),$level)) {\n            self::$log[] =   \"{$level}: {$message}\\r\\n\";\n        }\n    }\n\n    /**\n     * 日志保存\n     * @static\n     * @access public\n     * @param integer $type 日志记录方式\n     * @param string $destination  写入目标\n     * @return void\n     */\n    static function save($type='',$destination='') {\n        if(empty(self::$log)) return ;\n\n        if(empty($destination)){\n            $destination = C('LOG_PATH').date('y_m_d').'.log';\n        }\n        if(!self::$storage){\n            $type \t= \t$type ? : C('LOG_TYPE');\n            $class  =   'Think\\\\Log\\\\Driver\\\\'. ucwords($type);\n            self::$storage = new $class();            \n        }\n        $message    =   implode('',self::$log);\n        self::$storage->write($message,$destination);\n        // 保存后清空日志缓存\n        self::$log = array();\n    }\n\n    /**\n     * 日志直接写入\n     * @static\n     * @access public\n     * @param string $message 日志信息\n     * @param string $level  日志级别\n     * @param integer $type 日志记录方式\n     * @param string $destination  写入目标\n     * @return void\n     */\n    static function write($message,$level=self::ERR,$type='',$destination='') {\n        if(!self::$storage){\n            $type \t= \t$type ? : C('LOG_TYPE');\n            $class  =   'Think\\\\Log\\\\Driver\\\\'. ucwords($type);\n            $config['log_path'] = C('LOG_PATH');\n            self::$storage = new $class($config);            \n        }\n        if(empty($destination)){\n            $destination = C('LOG_PATH').date('y_m_d').'.log';        \n        }\n        self::$storage->write(\"{$level}: {$message}\", $destination);\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Model/AdvModel.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Model;\nuse Think\\Model;\n/**\n * 高级模型扩展 \n */\nclass AdvModel extends Model {\n    protected $optimLock        =   'lock_version';\n    protected $returnType       =   'array';\n    protected $blobFields       =   array();\n    protected $blobValues       =   null;\n    protected $serializeField   =   array();\n    protected $readonlyField    =   array();\n    protected $_filter          =   array();\n    protected $partition        =   array();\n\n    public function __construct($name='',$tablePrefix='',$connection='') {\n        if('' !== $name || is_subclass_of($this,'AdvModel') ){\n            // 如果是AdvModel子类或者有传入模型名称则获取字段缓存\n        }else{\n            // 空的模型 关闭字段缓存\n            $this->autoCheckFields = false;\n        }\n        parent::__construct($name,$tablePrefix,$connection);\n    }\n\n    /**\n     * 利用__call方法重载 实现一些特殊的Model方法 （魔术方法）\n     * @access public\n     * @param string $method 方法名称\n     * @param mixed $args 调用参数\n     * @return mixed\n     */\n    public function __call($method,$args) {\n        if(strtolower(substr($method,0,3))=='top'){\n            // 获取前N条记录\n            $count = substr($method,3);\n            array_unshift($args,$count);\n            return call_user_func_array(array(&$this, 'topN'), $args);\n        }else{\n            return parent::__call($method,$args);\n        }\n    }\n\n    /**\n     * 对保存到数据库的数据进行处理\n     * @access protected\n     * @param mixed $data 要操作的数据\n     * @return boolean\n     */\n     protected function _facade($data) {\n        // 检查序列化字段\n        $data = $this->serializeField($data);\n        return parent::_facade($data);\n     }\n\n    // 查询成功后的回调方法\n    protected function _after_find(&$result,$options='') {\n        // 检查序列化字段\n        $this->checkSerializeField($result);\n        // 获取文本字段\n        $this->getBlobFields($result);\n        // 检查字段过滤\n        $result   =  $this->getFilterFields($result);\n        // 缓存乐观锁\n        $this->cacheLockVersion($result);\n    }\n\n    // 查询数据集成功后的回调方法\n    protected function _after_select(&$resultSet,$options='') {\n        // 检查序列化字段\n        $resultSet   =  $this->checkListSerializeField($resultSet);\n        // 获取文本字段\n        $resultSet   =  $this->getListBlobFields($resultSet);\n        // 检查列表字段过滤\n        $resultSet   =  $this->getFilterListFields($resultSet);\n    }\n\n    // 写入前的回调方法\n    protected function _before_insert(&$data,$options='') {\n        // 记录乐观锁\n        $data = $this->recordLockVersion($data);\n        // 检查文本字段\n        $data = $this->checkBlobFields($data);\n        // 检查字段过滤\n        $data = $this->setFilterFields($data);\n    }\n\n    protected function _after_insert($data,$options) {\n        // 保存文本字段\n        $this->saveBlobFields($data);\n    }\n\n    // 更新前的回调方法\n    protected function _before_update(&$data,$options='') {\n        // 检查乐观锁\n        $pk     =   $this->getPK();\n        if(isset($options['where'][$pk])){\n            $id     =   $options['where'][$pk];   \n            if(!$this->checkLockVersion($id,$data)) {\n                return false;\n            }\n        }\n        // 检查文本字段\n        $data = $this->checkBlobFields($data);\n        // 检查只读字段\n        $data = $this->checkReadonlyField($data);\n        // 检查字段过滤\n        $data = $this->setFilterFields($data);\n    }\n\n    protected function _after_update($data,$options) {\n        // 保存文本字段\n        $this->saveBlobFields($data);\n    }\n\n    protected function _after_delete($data,$options) {\n        // 删除Blob数据\n        $this->delBlobFields($data);\n    }\n\n    /**\n     * 记录乐观锁\n     * @access protected\n     * @param array $data 数据对象\n     * @return array\n     */\n    protected function recordLockVersion($data) {\n        // 记录乐观锁\n        if($this->optimLock && !isset($data[$this->optimLock]) ) {\n            if(in_array($this->optimLock,$this->fields,true)) {\n                $data[$this->optimLock]  =   0;\n            }\n        }\n        return $data;\n    }\n\n    /**\n     * 缓存乐观锁\n     * @access protected\n     * @param array $data 数据对象\n     * @return void\n     */\n    protected function cacheLockVersion($data) {\n        if($this->optimLock) {\n            if(isset($data[$this->optimLock]) && isset($data[$this->getPk()])) {\n                // 只有当存在乐观锁字段和主键有值的时候才记录乐观锁\n                $_SESSION[$this->name.'_'.$data[$this->getPk()].'_lock_version']    =   $data[$this->optimLock];\n            }\n        }\n    }\n\n    /**\n     * 检查乐观锁\n     * @access protected\n     * @param inteter $id  当前主键     \n     * @param array $data  当前数据\n     * @return mixed\n     */\n    protected function checkLockVersion($id,&$data) {\n        // 检查乐观锁\n        $identify   = $this->name.'_'.$id.'_lock_version';\n        if($this->optimLock && isset($_SESSION[$identify])) {\n            $lock_version = $_SESSION[$identify];\n            $vo   =  $this->field($this->optimLock)->find($id);\n            $_SESSION[$identify]     =   $lock_version;\n            $curr_version = $vo[$this->optimLock];\n            if(isset($curr_version)) {\n                if($curr_version>0 && $lock_version != $curr_version) {\n                    // 记录已经更新\n                    $this->error = L('_RECORD_HAS_UPDATE_');\n                    return false;\n                }else{\n                    // 更新乐观锁\n                    $save_version = $data[$this->optimLock];\n                    if($save_version != $lock_version+1) {\n                        $data[$this->optimLock]  =   $lock_version+1;\n                    }\n                    $_SESSION[$identify]     =   $lock_version+1;\n                }\n            }\n        }\n        return true;\n    }\n\n    /**\n     * 查找前N个记录\n     * @access public\n     * @param integer $count 记录个数\n     * @param array $options 查询表达式\n     * @return array\n     */\n    public function topN($count,$options=array()) {\n        $options['limit'] =  $count;\n        return $this->select($options);\n    }\n\n    /**\n     * 查询符合条件的第N条记录\n     * 0 表示第一条记录 -1 表示最后一条记录\n     * @access public\n     * @param integer $position 记录位置\n     * @param array $options 查询表达式\n     * @return mixed\n     */\n    public function getN($position=0,$options=array()) {\n        if($position>=0) { // 正向查找\n            $options['limit'] = $position.',1';\n            $list   =  $this->select($options);\n            return $list?$list[0]:false;\n        }else{ // 逆序查找\n            $list   =  $this->select($options);\n            return $list?$list[count($list)-abs($position)]:false;\n        }\n    }\n\n    /**\n     * 获取满足条件的第一条记录\n     * @access public\n     * @param array $options 查询表达式\n     * @return mixed\n     */\n    public function first($options=array()) {\n        return $this->getN(0,$options);\n    }\n\n    /**\n     * 获取满足条件的最后一条记录\n     * @access public\n     * @param array $options 查询表达式\n     * @return mixed\n     */\n    public function last($options=array()) {\n        return $this->getN(-1,$options);\n    }\n\n    /**\n     * 返回数据\n     * @access public\n     * @param array $data 数据\n     * @param string $type 返回类型 默认为数组\n     * @return mixed\n     */\n    public function returnResult($data,$type='') {\n        if('' === $type)\n            $type = $this->returnType;\n        switch($type) {\n            case 'array' :  return $data;\n            case 'object':  return (object)$data;\n            default:// 允许用户自定义返回类型\n                if(class_exists($type))\n                    return new $type($data);\n                else\n                    E(L('_CLASS_NOT_EXIST_').':'.$type);\n        }\n    }\n\n    /**\n     * 获取数据的时候过滤数据字段\n     * @access protected\n     * @param mixed $result 查询的数据\n     * @return array\n     */\n    protected function getFilterFields(&$result) {\n        if(!empty($this->_filter)) {\n            foreach ($this->_filter as $field=>$filter){\n                if(isset($result[$field])) {\n                    $fun  =  $filter[1];\n                    if(!empty($fun)) {\n                        if(isset($filter[2]) && $filter[2]){\n                            // 传递整个数据对象作为参数\n                            $result[$field]  =  call_user_func($fun,$result);\n                        }else{\n                            // 传递字段的值作为参数\n                            $result[$field]  =  call_user_func($fun,$result[$field]);\n                        }\n                    }\n                }\n            }\n        }\n        return $result;\n    }\n\n    protected function getFilterListFields(&$resultSet) {\n        if(!empty($this->_filter)) {\n            foreach ($resultSet as $key=>$result)\n                $resultSet[$key]  =  $this->getFilterFields($result);\n        }\n        return $resultSet;\n    }\n\n    /**\n     * 写入数据的时候过滤数据字段\n     * @access protected\n     * @param mixed $result 查询的数据\n     * @return array\n     */\n    protected function setFilterFields($data) {\n        if(!empty($this->_filter)) {\n            foreach ($this->_filter as $field=>$filter){\n                if(isset($data[$field])) {\n                    $fun              =  $filter[0];\n                    if(!empty($fun)) {\n                        if(isset($filter[2]) && $filter[2]) {\n                            // 传递整个数据对象作为参数\n                            $data[$field]   =  call_user_func($fun,$data);\n                        }else{\n                            // 传递字段的值作为参数\n                            $data[$field]   =  call_user_func($fun,$data[$field]);\n                        }\n                    }\n                }\n            }\n        }\n        return $data;\n    }\n\n    /**\n     * 返回数据列表\n     * @access protected\n     * @param array $resultSet 数据\n     * @param string $type 返回类型 默认为数组\n     * @return void\n     */\n    protected function returnResultSet(&$resultSet,$type='') {\n        foreach ($resultSet as $key=>$data)\n            $resultSet[$key]  =  $this->returnResult($data,$type);\n        return $resultSet;\n    }\n\n    protected function checkBlobFields(&$data) {\n        // 检查Blob文件保存字段\n        if(!empty($this->blobFields)) {\n            foreach ($this->blobFields as $field){\n                if(isset($data[$field])) {\n                    if(isset($data[$this->getPk()]))\n                        $this->blobValues[$this->name.'/'.$data[$this->getPk()].'_'.$field] =   $data[$field];\n                    else\n                        $this->blobValues[$this->name.'/@?id@_'.$field] =   $data[$field];\n                    unset($data[$field]);\n                }\n            }\n        }\n        return $data;\n    }\n\n    /**\n     * 获取数据集的文本字段\n     * @access protected\n     * @param mixed $resultSet 查询的数据\n     * @param string $field 查询的字段\n     * @return void\n     */\n    protected function getListBlobFields(&$resultSet,$field='') {\n        if(!empty($this->blobFields)) {\n            foreach ($resultSet as $key=>$result){\n                $result =   $this->getBlobFields($result,$field);\n                $resultSet[$key]    =   $result;\n            }\n        }\n        return $resultSet;\n    }\n\n    /**\n     * 获取数据的文本字段\n     * @access protected\n     * @param mixed $data 查询的数据\n     * @param string $field 查询的字段\n     * @return void\n     */\n    protected function getBlobFields(&$data,$field='') {\n        if(!empty($this->blobFields)) {\n            $pk =   $this->getPk();\n            $id =   $data[$pk];\n            if(empty($field)) {\n                foreach ($this->blobFields as $field){\n                    $identify   =   $this->name.'/'.$id.'_'.$field;\n                    $data[$field]   =   F($identify);\n                }\n                return $data;\n            }else{\n                $identify   =   $this->name.'/'.$id.'_'.$field;\n                return F($identify);\n            }\n        }\n    }\n\n    /**\n     * 保存File方式的字段\n     * @access protected\n     * @param mixed $data 保存的数据\n     * @return void\n     */\n    protected function saveBlobFields(&$data) {\n        if(!empty($this->blobFields)) {\n            foreach ($this->blobValues as $key=>$val){\n                if(strpos($key,'@?id@'))\n                    $key    =   str_replace('@?id@',$data[$this->getPk()],$key);\n                F($key,$val);\n            }\n        }\n    }\n\n    /**\n     * 删除File方式的字段\n     * @access protected\n     * @param mixed $data 保存的数据\n     * @param string $field 查询的字段\n     * @return void\n     */\n    protected function delBlobFields(&$data,$field='') {\n        if(!empty($this->blobFields)) {\n            $pk =   $this->getPk();\n            $id =   $data[$pk];\n            if(empty($field)) {\n                foreach ($this->blobFields as $field){\n                    $identify   =   $this->name.'/'.$id.'_'.$field;\n                    F($identify,null);\n                }\n            }else{\n                $identify   =   $this->name.'/'.$id.'_'.$field;\n                F($identify,null);\n            }\n        }\n    }\n\n    /**\n     * 检查序列化数据字段\n     * @access protected\n     * @param array $data 数据\n     * @return array\n     */\n     protected function serializeField(&$data) {\n        // 检查序列化字段\n        if(!empty($this->serializeField)) {\n            // 定义方式  $this->serializeField = array('ser'=>array('name','email'));\n            foreach ($this->serializeField as $key=>$val){\n                if(empty($data[$key])) {\n                    $serialize  =   array();\n                    foreach ($val as $name){\n                        if(isset($data[$name])) {\n                            $serialize[$name]   =   $data[$name];\n                            unset($data[$name]);\n                        }\n                    }\n                    if(!empty($serialize)) {\n                        $data[$key] =   serialize($serialize);\n                    }\n                }\n            }\n        }\n        return $data;\n     }\n\n    // 检查返回数据的序列化字段\n    protected function checkSerializeField(&$result) {\n        // 检查序列化字段\n        if(!empty($this->serializeField)) {\n            foreach ($this->serializeField as $key=>$val){\n                if(isset($result[$key])) {\n                    $serialize   =   unserialize($result[$key]);\n                    foreach ($serialize as $name=>$value)\n                        $result[$name]  =   $value;\n                    unset($serialize,$result[$key]);\n                }\n            }\n        }\n        return $result;\n    }\n\n    // 检查数据集的序列化字段\n    protected function checkListSerializeField(&$resultSet) {\n        // 检查序列化字段\n        if(!empty($this->serializeField)) {\n            foreach ($this->serializeField as $key=>$val){\n                foreach ($resultSet as $k=>$result){\n                    if(isset($result[$key])) {\n                        $serialize   =   unserialize($result[$key]);\n                        foreach ($serialize as $name=>$value)\n                            $result[$name]  =   $value;\n                        unset($serialize,$result[$key]);\n                        $resultSet[$k] =   $result;\n                    }\n                }\n            }\n        }\n        return $resultSet;\n    }\n\n    /**\n     * 检查只读字段\n     * @access protected\n     * @param array $data 数据\n     * @return array\n     */\n    protected function checkReadonlyField(&$data) {\n        if(!empty($this->readonlyField)) {\n            foreach ($this->readonlyField as $key=>$field){\n                if(isset($data[$field]))\n                    unset($data[$field]);\n            }\n        }\n        return $data;\n    }\n\n    /**\n     * 批处理执行SQL语句\n     * 批处理的指令都认为是execute操作\n     * @access public\n     * @param array $sql  SQL批处理指令\n     * @return boolean\n     */\n    public function patchQuery($sql=array()) {\n        if(!is_array($sql)) return false;\n        // 自动启动事务支持\n        $this->startTrans();\n        try{\n            foreach ($sql as $_sql){\n                $result   =  $this->execute($_sql);\n                if(false === $result) {\n                    // 发生错误自动回滚事务\n                    $this->rollback();\n                    return false;\n                }\n            }\n            // 提交事务\n            $this->commit();\n        } catch (ThinkException $e) {\n            $this->rollback();\n        }\n        return true;\n    }\n\n    /**\n     * 得到分表的的数据表名\n     * @access public\n     * @param array $data 操作的数据\n     * @return string\n     */\n    public function getPartitionTableName($data=array()) {\n        // 对数据表进行分区\n        if(isset($data[$this->partition['field']])) {\n            $field   =   $data[$this->partition['field']];\n            switch($this->partition['type']) {\n                case 'id':\n                    // 按照id范围分表\n                    $step    =   $this->partition['expr'];\n                    $seq    =   floor($field / $step)+1;\n                    break;\n                case 'year':\n                    // 按照年份分表\n                    if(!is_numeric($field)) {\n                        $field   =   strtotime($field);\n                    }\n                    $seq    =   date('Y',$field)-$this->partition['expr']+1;\n                    break;\n                case 'mod':\n                    // 按照id的模数分表\n                    $seq    =   ($field % $this->partition['num'])+1;\n                    break;\n                case 'md5':\n                    // 按照md5的序列分表\n                    $seq    =   (ord(substr(md5($field),0,1)) % $this->partition['num'])+1;\n                    break;\n                default :\n                    if(function_exists($this->partition['type'])) {\n                        // 支持指定函数哈希\n                        $fun    =   $this->partition['type'];\n                        $seq    =   (ord(substr($fun($field),0,1)) % $this->partition['num'])+1;\n                    }else{\n                        // 按照字段的首字母的值分表\n                        $seq    =   (ord($field{0}) % $this->partition['num'])+1;\n                    }\n            }\n            return $this->getTableName().'_'.$seq;\n        }else{\n            // 当设置的分表字段不在查询条件或者数据中\n            // 进行联合查询，必须设定 partition['num']\n            $tableName  =   array();\n            for($i=0;$i<$this->partition['num'];$i++)\n                $tableName[] = 'SELECT * FROM '.$this->getTableName().'_'.($i+1);\n            $tableName = '( '.implode(\" UNION \",$tableName).') AS '.$this->name;\n            return $tableName;\n        }\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Model/MergeModel.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Model;\nuse Think\\Model;\n/**\n * ThinkPHP 聚合模型扩展 \n */\nclass MergeModel extends Model {\n\n    protected $modelList    =   array();    //  包含的模型列表 第一个必须是主表模型\n    protected $masterModel  =   '';         //  主模型\n    protected $joinType     =   'INNER';    //  聚合模型的查询JOIN类型\n    protected $fk           =   '';         //  外键名 默认为主表名_id\n    protected $mapFields    =   array();    //  需要处理的模型映射字段，避免混淆 array( id => 'user.id'  )\n\n    /**\n     * 架构函数\n     * 取得DB类的实例对象 字段检查\n     * @access public\n     * @param string $name 模型名称\n     * @param string $tablePrefix 表前缀\n     * @param mixed $connection 数据库连接信息\n     */\n    public function __construct($name='',$tablePrefix='',$connection=''){\n        parent::__construct($name,$tablePrefix,$connection);\n        // 聚合模型的字段信息\n        if(empty($this->fields) && !empty($this->modelList)){\n            $fields     =   array();\n            foreach($this->modelList as $model){\n                // 获取模型的字段信息\n                $result     =   $this->db->getFields(M($model)->getTableName());\n                $_fields    =   array_keys($result);\n               // $this->mapFields  =   array_intersect($fields,$_fields);\n                $fields     =   array_merge($fields,$_fields);\n            }\n            $this->fields   =   $fields;\n        }\n\n        // 设置第一个模型为主表模型\n        if(empty($this->masterModel) && !empty($this->modelList)){\n            $this->masterModel  =   $this->modelList[0];\n        }\n        // 主表的主键名\n        $this->pk =   M($this->masterModel)->getPk();\n\n        // 设置默认外键名 仅支持单一外键\n        if(empty($this->fk)){\n            $this->fk  =   strtolower($this->masterModel).'_id';\n        }\n\n    }\n\n    /**\n     * 得到完整的数据表名\n     * @access public\n     * @return string\n     */\n    public function getTableName() {\n        if(empty($this->trueTableName)) {\n            $tableName  =   array();\n            $models     =   $this->modelList;\n            foreach($models as $model){\n                $tableName[]    =   M($model)->getTableName().' '.$model;\n            }\n            $this->trueTableName    =   implode(',',$tableName);\n        }\n        return $this->trueTableName;\n    }\n\n    /**\n     * 自动检测数据表信息\n     * @access protected\n     * @return void\n     */\n    protected function _checkTableInfo() {}\n\n    /**\n     * 新增聚合数据\n     * @access public\n     * @param mixed $data 数据\n     * @param array $options 表达式\n     * @param boolean $replace 是否replace\n     * @return mixed\n     */\n    public function add($data='',$options=array(),$replace=false){\n        if(empty($data)) {\n            // 没有传递数据，获取当前数据对象的值\n            if(!empty($this->data)) {\n                $data           =   $this->data;\n                // 重置数据\n                $this->data     = array();\n            }else{\n                $this->error    = L('_DATA_TYPE_INVALID_');\n                return false;\n            }\n        }\n        // 启动事务\n        $this->startTrans();\n        // 写入主表数据\n        $result     =   M($this->masterModel)->strict(false)->add($data);\n        if($result){\n            // 写入外键数据\n            $data[$this->fk]    =   $result;\n            $models     =   $this->modelList;\n            array_shift($models);\n            // 写入附表数据\n            foreach($models as $model){\n                $res =   M($model)->strict(false)->add($data);\n                if(!$res){\n                    $this->rollback();\n                    return false;\n                }\n            }\n            // 提交事务\n            $this->commit();\n        }else{\n            $this->rollback();\n            return false;\n        }\n        return $result;\n    }\n\n   /**\n     * 对保存到数据库的数据进行处理\n     * @access protected\n     * @param mixed $data 要操作的数据\n     * @return boolean\n     */\n     protected function _facade($data) {\n\n        // 检查数据字段合法性\n        if(!empty($this->fields)) {\n            if(!empty($this->options['field'])) {\n                $fields =   $this->options['field'];\n                unset($this->options['field']);\n                if(is_string($fields)) {\n                    $fields =   explode(',',$fields);\n                }    \n            }else{\n                $fields =   $this->fields;\n            }        \n            foreach ($data as $key=>$val){\n                if(!in_array($key,$fields,true)){\n                    unset($data[$key]);\n                }elseif(array_key_exists($key,$this->mapFields)){\n                    // 需要处理映射字段\n                    $data[$this->mapFields[$key]] = $val;\n                    unset($data[$key]);\n                }\n            }\n        }\n       \n        // 安全过滤\n        if(!empty($this->options['filter'])) {\n            $data = array_map($this->options['filter'],$data);\n            unset($this->options['filter']);\n        }\n        $this->_before_write($data);\n        return $data;\n     }\n\n    /**\n     * 保存聚合模型数据\n     * @access public\n     * @param mixed $data 数据\n     * @param array $options 表达式\n     * @return boolean\n     */\n    public function save($data='',$options=array()){\n        // 根据主表的主键更新\n        if(empty($data)) {\n            // 没有传递数据，获取当前数据对象的值\n            if(!empty($this->data)) {\n                $data           =   $this->data;\n                // 重置数据\n                $this->data     =   array();\n            }else{\n                $this->error    =   L('_DATA_TYPE_INVALID_');\n                return false;\n            }\n        }\n        if(empty($data)){\n            // 没有数据则不执行\n            $this->error    =   L('_DATA_TYPE_INVALID_');\n            return false;\n        }            \n        // 如果存在主键数据 则自动作为更新条件\n        $pk         =   $this->pk;\n        if(isset($data[$pk])) {\n            $where[$pk]         =   $data[$pk];\n            $options['where']   =   $where;\n            unset($data[$pk]);\n        }\n        $options['join']    =   '';\n        $options    =   $this->_parseOptions($options);\n        // 更新操作不使用JOIN \n        $options['table']   =   $this->getTableName();\n\n        if(is_array($options['where']) && isset($options['where'][$pk])){\n            $pkValue    =   $options['where'][$pk];\n        }\n        if(false === $this->_before_update($data,$options)) {\n            return false;\n        }        \n        $result     =   $this->db->update($data,$options);\n        if(false !== $result) {\n            if(isset($pkValue)) $data[$pk]   =  $pkValue;\n            $this->_after_update($data,$options);\n        }\n        return $result;\n    }\n\n    /**\n     * 删除聚合模型数据\n     * @access public\n     * @param mixed $options 表达式\n     * @return mixed\n     */\n    public function delete($options=array()){\n        $pk   =  $this->pk;\n        if(empty($options) && empty($this->options['where'])) {\n            // 如果删除条件为空 则删除当前数据对象所对应的记录\n            if(!empty($this->data) && isset($this->data[$pk]))\n                return $this->delete($this->data[$pk]);\n            else\n                return false;\n        }\n        \n        if(is_numeric($options)  || is_string($options)) {\n            // 根据主键删除记录\n            if(strpos($options,',')) {\n                $where[$pk]     =  array('IN', $options);\n            }else{\n                $where[$pk]     =  $options;\n            }\n            $options            =  array();\n            $options['where']   =  $where;\n        }\n        // 分析表达式\n        $options['join']    =   '';\n        $options =  $this->_parseOptions($options);\n        if(empty($options['where'])){\n            // 如果条件为空 不进行删除操作 除非设置 1=1\n            return false;\n        }        \n        if(is_array($options['where']) && isset($options['where'][$pk])){\n            $pkValue            =  $options['where'][$pk];\n        }\n        \n        $options['table']   =   implode(',',$this->modelList);\n        $options['using']   =   $this->getTableName();\n        if(false === $this->_before_delete($options)) {\n            return false;\n        }        \n        $result  =    $this->db->delete($options);\n        if(false !== $result) {\n            $data = array();\n            if(isset($pkValue)) $data[$pk]   =  $pkValue;\n            $this->_after_delete($data,$options);\n        }\n        // 返回删除记录个数\n        return $result;\n    }\n\n    /**\n     * 表达式过滤方法\n     * @access protected\n     * @param string $options 表达式\n     * @return void\n     */\n    protected function _options_filter(&$options) {\n        if(!isset($options['join'])){\n            $models     =   $this->modelList;\n            array_shift($models);\n            foreach($models as $model){\n                $options['join'][]    =   $this->joinType.' JOIN '.M($model)->getTableName().' '.$model.' ON '.$this->masterModel.'.'.$this->pk.' = '.$model.'.'.$this->fk;\n            }\n        }\n        $options['table']   =   M($this->masterModel)->getTableName().' '.$this->masterModel;\n        $options['field']   =   $this->checkFields(isset($options['field'])?$options['field']:'');\n        if(isset($options['group']))\n            $options['group']  =  $this->checkGroup($options['group']);\n        if(isset($options['where']))\n            $options['where']  =  $this->checkCondition($options['where']);\n        if(isset($options['order']))\n            $options['order']  =  $this->checkOrder($options['order']);\n    }\n\n    /**\n     * 检查条件中的聚合字段\n     * @access protected\n     * @param mixed $data 条件表达式\n     * @return array\n     */\n    protected function checkCondition($where) {\n        if(is_array($where)) {\n            $view   =   array();\n            foreach($where as $name=>$value){\n                if(array_key_exists($name,$this->mapFields)){\n                    // 需要处理映射字段\n                    $view[$this->mapFields[$name]] = $value;\n                    unset($where[$name]);\n                }\n            }\n            $where    =   array_merge($where,$view);\n         }\n        return $where;\n    }\n\n    /**\n     * 检查Order表达式中的聚合字段\n     * @access protected\n     * @param string $order 字段\n     * @return string\n     */\n    protected function checkOrder($order='') {\n         if(is_string($order) && !empty($order)) {\n            $orders = explode(',',$order);\n            $_order = array();\n            foreach ($orders as $order){\n                $array  =   explode(' ',trim($order));\n                $field  =   $array[0];\n                $sort   =   isset($array[1])?$array[1]:'ASC';\n                if(array_key_exists($field,$this->mapFields)){\n                    // 需要处理映射字段\n                    $field  =   $this->mapFields[$field];\n                }                \n                $_order[] = $field.' '.$sort;\n            }\n            $order = implode(',',$_order);\n         }\n        return $order;\n    }\n\n    /**\n     * 检查Group表达式中的聚合字段\n     * @access protected\n     * @param string $group 字段\n     * @return string\n     */\n    protected function checkGroup($group='') {\n         if(!empty($group)) {\n            $groups = explode(',',$group);\n            $_group = array();\n            foreach ($groups as $field){\n                // 解析成聚合字段\n                if(array_key_exists($field,$this->mapFields)){\n                    // 需要处理映射字段\n                    $field  =   $this->mapFields[$field];\n                }                 \n                $_group[] = $field;\n            }\n            $group  =   implode(',',$_group);\n         }\n        return $group;\n    }\n\n    /**\n     * 检查fields表达式中的聚合字段\n     * @access protected\n     * @param string $fields 字段\n     * @return string\n     */\n    protected function checkFields($fields='') {\n        if(empty($fields) || '*'==$fields ) {\n            // 获取全部聚合字段\n            $fields =   $this->fields;\n        }\n        if(!is_array($fields))\n            $fields =   explode(',',$fields);\n\n        // 解析成聚合字段\n        $array =  array();\n        foreach ($fields as $field){\n            if(array_key_exists($field,$this->mapFields)){\n                // 需要处理映射字段\n                $array[]  =   $this->mapFields[$field].' AS '.$field;\n            }else{\n                $array[]  =     $field;\n            }\n        }\n        $fields = implode(',',$array);\n        return $fields;\n    }\n\n    /**\n     * 获取数据表字段信息\n     * @access public\n     * @return array\n     */\n    public function getDbFields(){\n        return $this->fields;\n    }\n\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Model/MongoModel.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2010 http://topthink.com All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Model;\nuse Think\\Model;\n/**\n * MongoModel模型类\n * 实现了ODM和ActiveRecords模式\n */\nclass MongoModel extends Model{\n    // 主键类型\n    const TYPE_OBJECT   = 1; \n    const TYPE_INT      = 2;\n    const TYPE_STRING   = 3;\n\n    // 主键名称\n    protected $pk               =   '_id';\n    // _id 类型 1 Object 采用MongoId对象 2 Int 整形 支持自动增长 3 String 字符串Hash\n    protected $_idType          =   self::TYPE_OBJECT;\n    // 主键是否自增\n    protected $_autoinc         =   true;\n    // Mongo默认关闭字段检测 可以动态追加字段\n    protected $autoCheckFields  =   false;\n    // 链操作方法列表\n    protected $methods          =   array('table','order','auto','filter','validate');\n\n    /**\n     * 利用__call方法实现一些特殊的Model方法\n     * @access public\n     * @param string $method 方法名称\n     * @param array $args 调用参数\n     * @return mixed\n     */\n    public function __call($method,$args) {\n        if(in_array(strtolower($method),$this->methods,true)) {\n            // 连贯操作的实现\n            $this->options[strtolower($method)] =   $args[0];\n            return $this;\n        }elseif(strtolower(substr($method,0,5))=='getby') {\n            // 根据某个字段获取记录\n            $field   =   parse_name(substr($method,5));\n            $where[$field] =$args[0];\n            return $this->where($where)->find();\n        }elseif(strtolower(substr($method,0,10))=='getfieldby') {\n            // 根据某个字段获取记录的某个值\n            $name   =   parse_name(substr($method,10));\n            $where[$name] =$args[0];\n            return $this->where($where)->getField($args[1]);\n        }else{\n            E(__CLASS__.':'.$method.L('_METHOD_NOT_EXIST_'));\n            return;\n        }\n    }\n\n    /**\n     * 获取字段信息并缓存 主键和自增信息直接配置\n     * @access public\n     * @return void\n     */\n    public function flush() {\n        // 缓存不存在则查询数据表信息\n        $fields =   $this->db->getFields();\n        if(!$fields) { // 暂时没有数据无法获取字段信息 下次查询\n            return false;\n        }\n        $this->fields   =   array_keys($fields);\n        foreach ($fields as $key=>$val){\n            // 记录字段类型\n            $type[$key]    =   $val['type'];\n        }\n        // 记录字段类型信息\n        if(C('DB_FIELDTYPE_CHECK'))   $this->fields['_type'] =  $type;\n\n        // 2008-3-7 增加缓存开关控制\n        if(C('DB_FIELDS_CACHE')){\n            // 永久缓存数据表信息\n            $db   =  $this->dbName?$this->dbName:C('DB_NAME');\n            F('_fields/'.$db.'.'.$this->name,$this->fields);\n        }\n    }\n\n    // 写入数据前的回调方法 包括新增和更新\n    protected function _before_write(&$data) {\n        $pk   =  $this->getPk();\n        // 根据主键类型处理主键数据\n        if(isset($data[$pk]) && $this->_idType == self::TYPE_OBJECT) {\n            $data[$pk] =  new \\MongoId($data[$pk]);\n        }    \n    }\n\n    /**\n     * count统计 配合where连贯操作\n     * @access public\n     * @return integer\n     */\n    public function count(){\n        // 分析表达式\n        $options =  $this->_parseOptions();\n        return $this->db->count($options);\n    }\n\n    /**\n     * 获取唯一值\n     * @access public\n     * @return array | false\n     */\n    public function distinct($field, $where=array() ){\n        // 分析表达式\n        $this->options =  $this->_parseOptions();\n        $this->options['where'] = array_merge((array)$this->options['where'], $where);\n\n        $command = array(\n            \"distinct\" => $this->options['table'],\n            \"key\" => $field,\n            \"query\" => $this->options['where']\n        );\n\n        $result = $this->command($command);\n        return isset($result['values']) ? $result['values'] : false;\n    }\n\n    /**\n     * 获取下一ID 用于自动增长型\n     * @access public\n     * @param string $pk 字段名 默认为主键\n     * @return mixed\n     */\n    public function getMongoNextId($pk=''){\n        if(empty($pk)) {\n            $pk   =  $this->getPk();\n        }\n        return $this->db->getMongoNextId($pk);\n    }\n\n    /**\n     * 新增数据\n     * @access public\n     * @param mixed $data 数据\n     * @param array $options 表达式\n     * @param boolean $replace 是否replace\n     * @return mixed\n     */\n    public function add($data='',$options=array(),$replace=false) {\n        if(empty($data)) {\n            // 没有传递数据，获取当前数据对象的值\n            if(!empty($this->data)) {\n                $data           =   $this->data;\n                // 重置数据\n                $this->data     = array();\n            }else{\n                $this->error    = L('_DATA_TYPE_INVALID_');\n                return false;\n            }\n        }\n        // 分析表达式\n        $options    =   $this->_parseOptions($options);\n        // 数据处理\n        $data       =   $this->_facade($data);\n        if(false === $this->_before_insert($data,$options)) {\n            return false;\n        }\n        // 写入数据到数据库\n        $result = $this->db->insert($data,$options,$replace);\n        if(false !== $result ) {\n            $this->_after_insert($data,$options);\n            if(isset($data[$this->getPk()])){\n                return $data[$this->getPk()];\n            }\n        }\n        return $result;\n    }\n\n    // 插入数据前的回调方法\n    protected function _before_insert(&$data,$options) {\n        // 写入数据到数据库\n        if($this->_autoinc && $this->_idType== self::TYPE_INT) { // 主键自动增长\n            $pk   =  $this->getPk();\n            if(!isset($data[$pk])) {\n                $data[$pk]   =  $this->db->getMongoNextId($pk);\n            }\n        }\n    }\n\n    public function clear(){\n        return $this->db->clear();\n    }\n\n    // 查询成功后的回调方法\n    protected function _after_select(&$resultSet,$options) {\n        array_walk($resultSet,array($this,'checkMongoId'));\n    }\n\n    /**\n     * 获取MongoId\n     * @access protected\n     * @param array $result 返回数据\n     * @return array\n     */\n    protected function checkMongoId(&$result){\n        if(is_object($result['_id'])) {\n            $result['_id'] = $result['_id']->__toString();\n        }\n        return $result;\n    }\n\n    // 表达式过滤回调方法\n    protected function _options_filter(&$options) {\n        $id = $this->getPk();\n        if(isset($options['where'][$id]) && is_scalar($options['where'][$id]) && $this->_idType== self::TYPE_OBJECT) {\n            $options['where'][$id] = new \\MongoId($options['where'][$id]);\n        }\n    }\n\n    /**\n     * 查询数据\n     * @access public\n     * @param mixed $options 表达式参数\n     * @return mixed\n     */\n     public function find($options=array()) {\n         if( is_numeric($options) || is_string($options)) {\n            $id   =  $this->getPk();\n            $where[$id] = $options;\n            $options = array();\n            $options['where'] = $where;\n         }\n        // 分析表达式\n        $options =  $this->_parseOptions($options);\n        $result = $this->db->find($options);\n        if(false === $result) {\n            return false;\n        }\n        if(empty($result)) {// 查询结果为空\n            return null;\n        }else{\n            $this->checkMongoId($result);\n        }\n        $this->data = $result;\n        $this->_after_find($this->data,$options);\n        return $this->data;\n     }\n\n    /**\n     * 字段值增长\n     * @access public\n     * @param string $field  字段名\n     * @param integer $step  增长值\n     * @return boolean\n     */\n    public function setInc($field,$step=1) {\n        return $this->setField($field,array('inc',$step));\n    }\n\n    /**\n     * 字段值减少\n     * @access public\n     * @param string $field  字段名\n     * @param integer $step  减少值\n     * @return boolean\n     */\n    public function setDec($field,$step=1) {\n        return $this->setField($field,array('inc','-'.$step));\n    }\n\n    /**\n     * 获取一条记录的某个字段值\n     * @access public\n     * @param string $field  字段名\n     * @param string $spea  字段数据间隔符号\n     * @return mixed\n     */\n    public function getField($field,$sepa=null) {\n        $options['field']    =  $field;\n        $options =  $this->_parseOptions($options);\n        if(strpos($field,',')) { // 多字段\n            if(is_numeric($sepa)) {// 限定数量\n                $options['limit']   =   $sepa;\n                $sepa   =   null;// 重置为null 返回数组\n            }\n            $resultSet = $this->db->select($options);\n            if(!empty($resultSet)) {\n                $_field = explode(',', $field);\n                $field  = array_keys($resultSet[0]);\n                $key =  array_shift($field);\n                $key2 = array_shift($field);\n                $cols   =   array();\n                $count  =   count($_field);\n                foreach ($resultSet as $result){\n                    $name   =  $result[$key];\n                    if(2==$count) {\n                        $cols[$name]   =  $result[$key2];\n                    }else{\n                        $cols[$name]   =  is_null($sepa)?$result:implode($sepa,$result);\n                    }\n                }\n                return $cols;\n            }\n        }else{\n            // 返回数据个数\n            if(true !== $sepa) {// 当sepa指定为true的时候 返回所有数据\n                $options['limit']   =   is_numeric($sepa)?$sepa:1;\n            }            // 查找符合的记录\n            $result = $this->db->select($options);\n            if(!empty($result)) {\n                if(1==$options['limit']) {\n                    $result     =   reset($result);\n                    return $result[$field];\n                }\n                foreach ($result as $val){\n                    $array[]    =   $val[$field];\n                }\n                return $array;\n            }\n        }\n        return null;\n    }\n\n    /**\n     * 执行Mongo指令\n     * @access public\n     * @param array $command  指令\n     * @return mixed\n     */\n    public function command($command, $options=array()) {\n        $options =  $this->_parseOptions($options);\n        return $this->db->command($command, $options);\n    }\n\n    /**\n     * 执行MongoCode\n     * @access public\n     * @param string $code  MongoCode\n     * @param array $args   参数\n     * @return mixed\n     */\n    public function mongoCode($code,$args=array()) {\n        return $this->db->execute($code,$args);\n    }\n\n    // 数据库切换后回调方法\n    protected function _after_db() {\n        // 切换Collection\n        $this->db->switchCollection($this->getTableName(),$this->dbName?$this->dbName:C('db_name'));    \n    }\n\n    /**\n     * 得到完整的数据表名 Mongo表名不带dbName\n     * @access public\n     * @return string\n     */\n    public function getTableName() {\n        if(empty($this->trueTableName)) {\n            $tableName  = !empty($this->tablePrefix) ? $this->tablePrefix : '';\n            if(!empty($this->tableName)) {\n                $tableName .= $this->tableName;\n            }else{\n                $tableName .= parse_name($this->name);\n            }\n            $this->trueTableName    =   strtolower($tableName);\n        }\n        return $this->trueTableName;\n    }\n\n    /**\n     * 分组查询\n     * @access public\n     * @return string\n     */\n    public function group($key, $init, $reduce, $option=array()) {\n        $option = $this->_parseOptions($option);\n\n        //合并查询条件\n        if(isset($option['where']))\n            $option['condition'] = array_merge((array)$option['condition'], $option['where']);\n\n        return $this->db->group($key, $init, $reduce, $option);\n    }\n\n    /**\n     * 返回Mongo运行错误信息\n     * @access public\n     * @return json\n     */\n    public function getLastError(){\n        return $this->db->command(array('getLastError'=>1));\n    }\n\n    /**\n     * 返回指定集合的统计信息，包括数据大小、已分配的存储空间和索引的大小\n     * @access public\n     * @return json\n     */\n    public function status(){\n        $option = $this->_parseOptions();\n        return $this->db->command(array('collStats'=>$option['table']));\n    }\n    \n    /**\n     * 取得当前数据库的对象\n     * @access public\n     * @return object\n     */\n    public function getDB(){\n        return $this->db->getDB();\n    }\n    \n    /**\n     * 取得集合对象，可以进行创建索引等查询\n     * @access public\n     * @return object\n     */\n    public function getCollection(){\n        return $this->db->getCollection();\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Model/RelationModel.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Model;\nuse Think\\Model;\n/**\n * ThinkPHP关联模型扩展 \n */\nclass RelationModel extends Model {\n\n    const   HAS_ONE     =   1;\n    const   BELONGS_TO  =   2;\n    const   HAS_MANY    =   3;\n    const   MANY_TO_MANY=   4;\n\n    // 关联定义\n    protected    $_link = array();\n\n    /**\n     * 动态方法实现\n     * @access public\n     * @param string $method 方法名称\n     * @param array $args 调用参数\n     * @return mixed\n     */\n    public function __call($method,$args) {\n        if(strtolower(substr($method,0,8))=='relation'){\n            $type    =   strtoupper(substr($method,8));\n            if(in_array($type,array('ADD','SAVE','DEL'),true)) {\n                array_unshift($args,$type);\n                return call_user_func_array(array(&$this, 'opRelation'), $args);\n            }\n        }else{\n            return parent::__call($method,$args);\n        }\n    }\n\n    /**\n     * 得到关联的数据表名\n     * @access public\n     * @return string\n     */\n    public function getRelationTableName($relation) {\n        $relationTable  = !empty($this->tablePrefix) ? $this->tablePrefix : '';\n        $relationTable .= $this->tableName?$this->tableName:$this->name;\n        $relationTable .= '_'.$relation->getModelName();\n        return strtolower($relationTable);\n    }\n\n    // 查询成功后的回调方法\n    protected function _after_find(&$result,$options) {\n        // 获取关联数据 并附加到结果中\n        if(!empty($options['link']))\n            $this->getRelation($result,$options['link']);\n    }\n\n    // 查询数据集成功后的回调方法\n    protected function _after_select(&$result,$options) {\n        // 获取关联数据 并附加到结果中\n        if(!empty($options['link']))\n            $this->getRelations($result,$options['link']);\n    }\n\n    // 写入成功后的回调方法\n    protected function _after_insert($data,$options) {\n        // 关联写入\n        if(!empty($options['link']))\n            $this->opRelation('ADD',$data,$options['link']);\n    }\n\n    // 更新成功后的回调方法\n    protected function _after_update($data,$options) {\n        // 关联更新\n        if(!empty($options['link']))\n            $this->opRelation('SAVE',$data,$options['link']);\n    }\n\n    // 删除成功后的回调方法\n    protected function _after_delete($data,$options) {\n        // 关联删除\n        if(!empty($options['link']))\n            $this->opRelation('DEL',$data,$options['link']);\n    }\n\n    /**\n     * 对保存到数据库的数据进行处理\n     * @access protected\n     * @param mixed $data 要操作的数据\n     * @return boolean\n     */\n     protected function _facade($data) {\n        $this->_before_write($data);\n        return $data;\n     }\n\n    /**\n     * 获取返回数据集的关联记录\n     * @access protected\n     * @param array $resultSet  返回数据\n     * @param string|array $name  关联名称\n     * @return array\n     */\n    protected function getRelations(&$resultSet,$name='') {\n        // 获取记录集的主键列表\n        foreach($resultSet as $key=>$val) {\n            $val  = $this->getRelation($val,$name);\n            $resultSet[$key]    =   $val;\n        }\n        return $resultSet;\n    }\n\n    /**\n     * 获取返回数据的关联记录\n     * @access protected\n     * @param mixed $result  返回数据\n     * @param string|array $name  关联名称\n     * @param boolean $return 是否返回关联数据本身\n     * @return array\n     */\n    protected function getRelation(&$result,$name='',$return=false) {\n        if(!empty($this->_link)) {\n            foreach($this->_link as $key=>$val) {\n                    $mappingName =  !empty($val['mapping_name'])?$val['mapping_name']:$key; // 映射名称\n                    if(empty($name) || true === $name || $mappingName == $name || (is_array($name) && in_array($mappingName,$name))) {\n                        $mappingType = !empty($val['mapping_type'])?$val['mapping_type']:$val;  //  关联类型\n                        $mappingClass  = !empty($val['class_name'])?$val['class_name']:$key;            //  关联类名\n                        $mappingFields = !empty($val['mapping_fields'])?$val['mapping_fields']:'*';     // 映射字段\n                        $mappingCondition = !empty($val['condition'])?$val['condition']:'1=1';          // 关联条件\n                        $mappingKey =!empty($val['mapping_key'])? $val['mapping_key'] : $this->getPk(); // 关联键名\n                        if(strtoupper($mappingClass)==strtoupper($this->name)) {\n                            // 自引用关联 获取父键名\n                            $mappingFk   =   !empty($val['parent_key'])? $val['parent_key'] : 'parent_id';\n                        }else{\n                            $mappingFk   =   !empty($val['foreign_key'])?$val['foreign_key']:strtolower($this->name).'_id';     //  关联外键\n                        }\n                        // 获取关联模型对象\n                        $model = D($mappingClass);\n                        switch($mappingType) {\n                            case self::HAS_ONE:\n                                $pk   =  $result[$mappingKey];\n                                $mappingCondition .= \" AND {$mappingFk}='{$pk}'\";\n                                $relationData   =  $model->where($mappingCondition)->field($mappingFields)->find();\n                                if (!empty($val['relation_deep'])){\n                                    $model->getRelation($relationData,$val['relation_deep']);\n                                }                                \n                                break;\n                            case self::BELONGS_TO:\n                                if(strtoupper($mappingClass)==strtoupper($this->name)) {\n                                    // 自引用关联 获取父键名\n                                    $mappingFk   =   !empty($val['parent_key'])? $val['parent_key'] : 'parent_id';\n                                }else{\n                                    $mappingFk   =   !empty($val['foreign_key'])?$val['foreign_key']:strtolower($model->getModelName()).'_id';     //  关联外键\n                                }\n                                $fk   =  $result[$mappingFk];\n                                $mappingCondition .= \" AND {$model->getPk()}='{$fk}'\";\n                                $relationData   =  $model->where($mappingCondition)->field($mappingFields)->find();\n                                if (!empty($val['relation_deep'])){\n                                    $model->getRelation($relationData,$val['relation_deep']);\n                                }                                \n                                break;\n                            case self::HAS_MANY:\n                                $pk   =  $result[$mappingKey];\n                                $mappingCondition .= \" AND {$mappingFk}='{$pk}'\";\n                                $mappingOrder =  !empty($val['mapping_order'])?$val['mapping_order']:'';\n                                $mappingLimit =  !empty($val['mapping_limit'])?$val['mapping_limit']:'';\n                                // 延时获取关联记录\n                                $relationData   =  $model->where($mappingCondition)->field($mappingFields)->order($mappingOrder)->limit($mappingLimit)->select();\n                                if (!empty($val['relation_deep'])){\n                                    foreach($relationData as $key=>$data){                                    \n                                        $model->getRelation($data,$val['relation_deep']);\n                                        $relationData[$key]     =   $data;\n                                    }                                      \n                                }\n                                break;\n                            case self::MANY_TO_MANY:\n                                $pk     =   $result[$mappingKey];\n                                $prefix =   $this->tablePrefix;\n                                $mappingCondition = \" {$mappingFk}='{$pk}'\";\n                                $mappingOrder =  $val['mapping_order'];\n                                $mappingLimit =  $val['mapping_limit'];\n                                $mappingRelationFk = $val['relation_foreign_key']?$val['relation_foreign_key']:$model->getModelName().'_id';\n                                if(isset($val['relation_table'])){\n                                    $mappingRelationTable   =   preg_replace_callback(\"/__([A-Z_-]+)__/sU\", function($match) use($prefix){ return $prefix.strtolower($match[1]);}, $val['relation_table']);\n                                }else{\n                                    $mappingRelationTable   =   $this->getRelationTableName($model);\n                                }\n                                $sql = \"SELECT b.{$mappingFields} FROM {$mappingRelationTable} AS a, \".$model->getTableName().\" AS b WHERE a.{$mappingRelationFk} = b.{$model->getPk()} AND a.{$mappingCondition}\";\n                                if(!empty($val['condition'])) {\n                                    $sql   .= ' AND '.$val['condition'];\n                                }\n                                if(!empty($mappingOrder)) {\n                                    $sql .= ' ORDER BY '.$mappingOrder;\n                                }\n                                if(!empty($mappingLimit)) {\n                                    $sql .= ' LIMIT '.$mappingLimit;\n                                }\n                                $relationData   =   $this->query($sql);\n                                if (!empty($val['relation_deep'])){\n                                    foreach($relationData as $key=>$data){                                    \n                                        $model->getRelation($data,$val['relation_deep']);\n                                        $relationData[$key]     =   $data;\n                                    }                                      \n                                }                                \n                                break;\n                        }\n                        if(!$return){\n                            if(isset($val['as_fields']) && in_array($mappingType,array(self::HAS_ONE,self::BELONGS_TO)) ) {\n                                // 支持直接把关联的字段值映射成数据对象中的某个字段\n                                // 仅仅支持HAS_ONE BELONGS_TO\n                                $fields =   explode(',',$val['as_fields']);\n                                foreach ($fields as $field){\n                                    if(strpos($field,':')) {\n                                        list($relationName,$nick) = explode(':',$field);\n                                        $result[$nick]  =  $relationData[$relationName];\n                                    }else{\n                                        $result[$field]  =  $relationData[$field];\n                                    }\n                                }\n                            }else{\n                                $result[$mappingName] = $relationData;\n                            }\n                            unset($relationData);\n                        }else{\n                            return $relationData;\n                        }\n                    }\n            }\n        }\n        return $result;\n    }\n\n    /**\n     * 操作关联数据\n     * @access protected\n     * @param string $opType  操作方式 ADD SAVE DEL\n     * @param mixed $data  数据对象\n     * @param string $name 关联名称\n     * @return mixed\n     */\n    protected function opRelation($opType,$data='',$name='') {\n        $result =   false;\n        if(empty($data) && !empty($this->data)){\n            $data = $this->data;\n        }elseif(!is_array($data)){\n            // 数据无效返回\n            return false;\n        }\n        if(!empty($this->_link)) {\n            // 遍历关联定义\n            foreach($this->_link as $key=>$val) {\n                    // 操作制定关联类型\n                    $mappingName =  $val['mapping_name']?$val['mapping_name']:$key; // 映射名称\n                    if(empty($name) || true === $name || $mappingName == $name || (is_array($name) && in_array($mappingName,$name)) ) {\n                        // 操作制定的关联\n                        $mappingType = !empty($val['mapping_type'])?$val['mapping_type']:$val;  //  关联类型\n                        $mappingClass  = !empty($val['class_name'])?$val['class_name']:$key;            //  关联类名\n                        $mappingKey =!empty($val['mapping_key'])? $val['mapping_key'] : $this->getPk(); // 关联键名\n                        // 当前数据对象主键值\n                        $pk =   $data[$mappingKey];\n                        if(strtoupper($mappingClass)==strtoupper($this->name)) {\n                            // 自引用关联 获取父键名\n                            $mappingFk   =   !empty($val['parent_key'])? $val['parent_key'] : 'parent_id';\n                        }else{\n                            $mappingFk   =   !empty($val['foreign_key'])?$val['foreign_key']:strtolower($this->name).'_id';     //  关联外键\n                        }\n                        if(!empty($val['condition'])) {\n                            $mappingCondition   =   $val['condition'];\n                        }else{\n                            $mappingCondition               =   array();\n                            $mappingCondition[$mappingFk]   =   $pk;\n                        }\n                        // 获取关联model对象\n                        $model = D($mappingClass);\n                        $mappingData    =   isset($data[$mappingName])?$data[$mappingName]:false;\n                        if(!empty($mappingData) || $opType == 'DEL') {\n                            switch($mappingType) {\n                                case self::HAS_ONE:\n                                    switch (strtoupper($opType)){\n                                        case 'ADD': // 增加关联数据\n                                        $mappingData[$mappingFk]    =   $pk;\n                                        $result   =  $model->add($mappingData);\n                                        break;\n                                        case 'SAVE':    // 更新关联数据\n                                        $result   =  $model->where($mappingCondition)->save($mappingData);\n                                        break;\n                                        case 'DEL': // 根据外键删除关联数据\n                                        $result   =  $model->where($mappingCondition)->delete();\n                                        break;\n                                    }\n                                    break;\n                                case self::BELONGS_TO:\n                                    break;\n                                case self::HAS_MANY:\n                                    switch (strtoupper($opType)){\n                                        case 'ADD'   :  // 增加关联数据\n                                        $model->startTrans();\n                                        foreach ($mappingData as $val){\n                                            $val[$mappingFk]    =   $pk;\n                                            $result   =  $model->add($val);\n                                        }\n                                        $model->commit();\n                                        break;\n                                        case 'SAVE' :   // 更新关联数据\n                                        $model->startTrans();\n                                        $pk   =  $model->getPk();\n                                        foreach ($mappingData as $vo){\n                                            if(isset($vo[$pk])) {// 更新数据\n                                                $mappingCondition   =  \"$pk ={$vo[$pk]}\";\n                                                $result   =  $model->where($mappingCondition)->save($vo);\n                                            }else{ // 新增数据\n                                                $vo[$mappingFk] =  $data[$mappingKey];\n                                                $result   =  $model->add($vo);\n                                            }\n                                        }\n                                        $model->commit();\n                                        break;\n                                        case 'DEL' :    // 删除关联数据\n                                        $result   =  $model->where($mappingCondition)->delete();\n                                        break;\n                                    }\n                                    break;\n                                case self::MANY_TO_MANY:\n                                    $mappingRelationFk = $val['relation_foreign_key']?$val['relation_foreign_key']:$model->getModelName().'_id';// 关联\n                                    $prefix =   $this->tablePrefix;\n                                    if(isset($val['relation_table'])){\n                                        $mappingRelationTable   =   preg_replace_callback(\"/__([A-Z_-]+)__/sU\", function($match) use($prefix){ return $prefix.strtolower($match[1]);}, $val['relation_table']);\n                                    }else{\n                                        $mappingRelationTable   =   $this->getRelationTableName($model);\n                                    }                                    \n                                    if(is_array($mappingData)) {\n                                        $ids   = array();\n                                        foreach ($mappingData as $vo)\n                                            $ids[]   =   $vo[$mappingKey];\n                                        $relationId =   implode(',',$ids);\n                                    }\n                                    switch (strtoupper($opType)){\n                                        case 'ADD': // 增加关联数据\n                                            if(isset($relationId)) {\n                                                $this->startTrans();\n                                                // 插入关联表数据\n                                                $sql  = 'INSERT INTO '.$mappingRelationTable.' ('.$mappingFk.','.$mappingRelationFk.') SELECT a.'.$this->getPk().',b.'.$model->getPk().' FROM '.$this->getTableName().' AS a ,'.$model->getTableName().\" AS b where a.\".$this->getPk().' ='. $pk.' AND  b.'.$model->getPk().' IN ('.$relationId.\") \";\n                                                $result =   $model->execute($sql);\n                                                if(false !== $result)\n                                                    // 提交事务\n                                                    $this->commit();\n                                                else\n                                                    // 事务回滚\n                                                    $this->rollback();\n                                            }\n                                            break;                                        \n                                        case 'SAVE':    // 更新关联数据\n                                            if(isset($relationId)) {\n                                                $this->startTrans();\n                                                // 删除关联表数据\n                                                $this->table($mappingRelationTable)->where($mappingCondition)->delete();\n                                                // 插入关联表数据\n                                                $sql  = 'INSERT INTO '.$mappingRelationTable.' ('.$mappingFk.','.$mappingRelationFk.') SELECT a.'.$this->getPk().',b.'.$model->getPk().' FROM '.$this->getTableName().' AS a ,'.$model->getTableName().\" AS b where a.\".$this->getPk().' ='. $pk.' AND  b.'.$model->getPk().' IN ('.$relationId.\") \";\n                                                $result =   $model->execute($sql);\n                                                if(false !== $result)\n                                                    // 提交事务\n                                                    $this->commit();\n                                                else\n                                                    // 事务回滚\n                                                    $this->rollback();\n                                            }\n                                            break;\n                                        case 'DEL': // 根据外键删除中间表关联数据\n                                            $result =   $this->table($mappingRelationTable)->where($mappingCondition)->delete();\n                                            break;\n                                    }\n                                    break;\n                            }\n                            if (!empty($val['relation_deep'])){\n                                $model->opRelation($opType,$mappingData,$val['relation_deep']);\n                            }                               \n                    }\n                }\n            }\n        }\n        return $result;\n    }\n\n    /**\n     * 进行关联查询\n     * @access public\n     * @param mixed $name 关联名称\n     * @return Model\n     */\n    public function relation($name) {\n        $this->options['link']  =   $name;\n        return $this;\n    }\n\n    /**\n     * 关联数据获取 仅用于查询后\n     * @access public\n     * @param string $name 关联名称\n     * @return array\n     */\n    public function relationGet($name) {\n        if(empty($this->data))\n            return false;\n        return $this->getRelation($this->data,$name,true);\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Model/ViewModel.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Model;\nuse Think\\Model;\n/**\n * ThinkPHP视图模型扩展 \n */\nclass ViewModel extends Model {\n\n    protected $viewFields = array();\n\n    /**\n     * 自动检测数据表信息\n     * @access protected\n     * @return void\n     */\n    protected function _checkTableInfo() {}\n\n    /**\n     * 得到完整的数据表名\n     * @access public\n     * @return string\n     */\n    public function getTableName() {\n        if(empty($this->trueTableName)) {\n            $tableName = '';\n            foreach ($this->viewFields as $key=>$view){\n                // 获取数据表名称\n                if(isset($view['_table'])) { // 2011/10/17 添加实际表名定义支持 可以实现同一个表的视图\n                    $tableName .=   $view['_table'];\n                    $prefix     =   $this->tablePrefix;\n                    $tableName  =   preg_replace_callback(\"/__([A-Z_-]+)__/sU\", function($match) use($prefix){ return $prefix.strtolower($match[1]);}, $tableName);\n                }else{\n                    $class  =   $key.'Model';\n                    $Model  =  class_exists($class)?new $class():M($key);\n                    $tableName .= $Model->getTableName();\n                }\n                // 表别名定义\n                $tableName .= !empty($view['_as'])?' '.$view['_as']:' '.$key;\n                // 支持ON 条件定义\n                $tableName .= !empty($view['_on'])?' ON '.$view['_on']:'';\n                // 指定JOIN类型 例如 RIGHT INNER LEFT 下一个表有效\n                $type = !empty($view['_type'])?$view['_type']:'';\n                $tableName   .= ' '.strtoupper($type).' JOIN ';\n                $len  =  strlen($type.'_JOIN ');\n            }\n            $tableName = substr($tableName,0,-$len);\n            $this->trueTableName    =   $tableName;\n        }\n        return $this->trueTableName;\n    }\n\n    /**\n     * 表达式过滤方法\n     * @access protected\n     * @param string $options 表达式\n     * @return void\n     */\n    protected function _options_filter(&$options) {\n        if(isset($options['field']))\n            $options['field'] = $this->checkFields($options['field']);\n        else\n            $options['field'] = $this->checkFields();\n        if(isset($options['group']))\n            $options['group']  =  $this->checkGroup($options['group']);\n        if(isset($options['where']))\n            $options['where']  =  $this->checkCondition($options['where']);\n        if(isset($options['order']))\n            $options['order']  =  $this->checkOrder($options['order']);\n    }\n\n    /**\n     * 检查是否定义了所有字段\n     * @access protected\n     * @param string $name 模型名称\n     * @param array $fields 字段数组\n     * @return array\n     */\n    private function _checkFields($name,$fields) {\n        if(false !== $pos = array_search('*',$fields)) {// 定义所有字段\n            $fields  =  array_merge($fields,M($name)->getDbFields());\n            unset($fields[$pos]);\n        }\n        return $fields;\n    }\n\n    /**\n     * 检查条件中的视图字段\n     * @access protected\n     * @param mixed $data 条件表达式\n     * @return array\n     */\n    protected function checkCondition($where) {\n        if(is_array($where)) {\n            $view   =   array();\n            // 检查视图字段\n            foreach ($this->viewFields as $key=>$val){\n                $k = isset($val['_as'])?$val['_as']:$key;\n                $val  =  $this->_checkFields($key,$val);\n                foreach ($where as $name=>$value){\n                    if(false !== $field = array_search($name,$val,true)) {\n                        // 存在视图字段\n                        $_key   =   is_numeric($field)?    $k.'.'.$name   :   $k.'.'.$field;\n                        $view[$_key]    =   $value;\n                        unset($where[$name]);\n                    }\n                }\n            }\n            $where    =   array_merge($where,$view);\n         }\n        return $where;\n    }\n\n    /**\n     * 检查Order表达式中的视图字段\n     * @access protected\n     * @param string $order 字段\n     * @return string\n     */\n    protected function checkOrder($order='') {\n         if(is_string($order) && !empty($order)) {\n            $orders = explode(',',$order);\n            $_order = array();\n            foreach ($orders as $order){\n                $array = explode(' ',trim($order));\n                $field   =   $array[0];\n                $sort   =   isset($array[1])?$array[1]:'ASC';\n                // 解析成视图字段\n                foreach ($this->viewFields as $name=>$val){\n                    $k = isset($val['_as'])?$val['_as']:$name;\n                    $val  =  $this->_checkFields($name,$val);\n                    if(false !== $_field = array_search($field,$val,true)) {\n                        // 存在视图字段\n                        $field     =  is_numeric($_field)?$k.'.'.$field:$k.'.'.$_field;\n                        break;\n                    }\n                }\n                $_order[] = $field.' '.$sort;\n            }\n            $order = implode(',',$_order);\n         }\n        return $order;\n    }\n\n    /**\n     * 检查Group表达式中的视图字段\n     * @access protected\n     * @param string $group 字段\n     * @return string\n     */\n    protected function checkGroup($group='') {\n         if(!empty($group)) {\n            $groups = explode(',',$group);\n            $_group = array();\n            foreach ($groups as $field){\n                // 解析成视图字段\n                foreach ($this->viewFields as $name=>$val){\n                    $k = isset($val['_as'])?$val['_as']:$name;\n                    $val  =  $this->_checkFields($name,$val);\n                    if(false !== $_field = array_search($field,$val,true)) {\n                        // 存在视图字段\n                        $field     =  is_numeric($_field)?$k.'.'.$field:$k.'.'.$_field;\n                        break;\n                    }\n                }\n                $_group[] = $field;\n            }\n            $group  =   implode(',',$_group);\n         }\n        return $group;\n    }\n\n    /**\n     * 检查fields表达式中的视图字段\n     * @access protected\n     * @param string $fields 字段\n     * @return string\n     */\n    protected function checkFields($fields='') {\n        if(empty($fields) || '*'==$fields ) {\n            // 获取全部视图字段\n            $fields =   array();\n            foreach ($this->viewFields as $name=>$val){\n                $k = isset($val['_as'])?$val['_as']:$name;\n                $val  =  $this->_checkFields($name,$val);\n                foreach ($val as $key=>$field){\n                    if(is_numeric($key)) {\n                        $fields[]    =   $k.'.'.$field.' AS '.$field;\n                    }elseif('_' != substr($key,0,1)) {\n                        // 以_开头的为特殊定义\n                        if( false !== strpos($key,'*') ||  false !== strpos($key,'(') || false !== strpos($key,'.')) {\n                            //如果包含* 或者 使用了sql方法 则不再添加前面的表名\n                            $fields[]    =   $key.' AS '.$field;\n                        }else{\n                            $fields[]    =   $k.'.'.$key.' AS '.$field;\n                        }\n                    }\n                }\n            }\n            $fields = implode(',',$fields);\n        }else{\n            if(!is_array($fields))\n                $fields =   explode(',',$fields);\n            // 解析成视图字段\n            $array =  array();\n            foreach ($fields as $key=>$field){\n                if(strpos($field,'(') || strpos(strtolower($field),' as ')){\n                    // 使用了函数或者别名\n                    $array[] =  $field;\n                    unset($fields[$key]);\n                }\n            }\n            foreach ($this->viewFields as $name=>$val){\n                $k = isset($val['_as'])?$val['_as']:$name;\n                $val  =  $this->_checkFields($name,$val);\n                foreach ($fields as $key=>$field){\n                    if(false !== $_field = array_search($field,$val,true)) {\n                        // 存在视图字段\n                        if(is_numeric($_field)) {\n                            $array[]    =   $k.'.'.$field.' AS '.$field;\n                        }elseif('_' != substr($_field,0,1)){\n                            if( false !== strpos($_field,'*') ||  false !== strpos($_field,'(') || false !== strpos($_field,'.'))\n                                //如果包含* 或者 使用了sql方法 则不再添加前面的表名\n                                $array[]    =   $_field.' AS '.$field;\n                            else\n                                $array[]    =   $k.'.'.$_field.' AS '.$field;\n                        }\n                    }\n                }\n            }\n            $fields = implode(',',$array);\n        }\n        return $fields;\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Model.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * ThinkPHP Model模型类\n * 实现了ORM和ActiveRecords模式\n */\nclass Model {\n    // 操作状态\n    const MODEL_INSERT          =   1;      //  插入模型数据\n    const MODEL_UPDATE          =   2;      //  更新模型数据\n    const MODEL_BOTH            =   3;      //  包含上面两种方式\n    const MUST_VALIDATE         =   1;      // 必须验证\n    const EXISTS_VALIDATE       =   0;      // 表单存在字段则验证\n    const VALUE_VALIDATE        =   2;      // 表单值不为空则验证\n\n    // 当前数据库操作对象\n    protected $db               =   null;\n\t// 数据库对象池\n\tprivate   $_db\t\t\t\t=\tarray();\n    // 主键名称\n    protected $pk               =   'id';\n    // 主键是否自动增长\n    protected $autoinc          =   false;    \n    // 数据表前缀\n    protected $tablePrefix      =   null;\n    // 模型名称\n    protected $name             =   '';\n    // 数据库名称\n    protected $dbName           =   '';\n    //数据库配置\n    protected $connection       =   '';\n    // 数据表名（不包含表前缀）\n    protected $tableName        =   '';\n    // 实际数据表名（包含表前缀）\n    protected $trueTableName    =   '';\n    // 最近错误信息\n    protected $error            =   '';\n    // 字段信息\n    protected $fields           =   array();\n    // 数据信息\n    protected $data             =   array();\n    // 查询表达式参数\n    protected $options          =   array();\n    protected $_validate        =   array();  // 自动验证定义\n    protected $_auto            =   array();  // 自动完成定义\n    protected $_map             =   array();  // 字段映射定义\n    protected $_scope           =   array();  // 命名范围定义\n    // 是否自动检测数据表字段信息\n    protected $autoCheckFields  =   true;\n    // 是否批处理验证\n    protected $patchValidate    =   false;\n    // 链操作方法列表\n    protected $methods          =   array('strict','order','alias','having','group','lock','distinct','auto','filter','validate','result','token','index','force');\n\n    /**\n     * 架构函数\n     * 取得DB类的实例对象 字段检查\n     * @access public\n     * @param string $name 模型名称\n     * @param string $tablePrefix 表前缀\n     * @param mixed $connection 数据库连接信息\n     */\n    public function __construct($name='',$tablePrefix='',$connection='') {\n        // 模型初始化\n        $this->_initialize();\n        // 获取模型名称\n        if(!empty($name)) {\n            if(strpos($name,'.')) { // 支持 数据库名.模型名的 定义\n                list($this->dbName,$this->name) = explode('.',$name);\n            }else{\n                $this->name   =  $name;\n            }\n        }elseif(empty($this->name)){\n            $this->name =   $this->getModelName();\n        }\n        // 设置表前缀\n        if(is_null($tablePrefix)) {// 前缀为Null表示没有前缀\n            $this->tablePrefix = '';\n        }elseif('' != $tablePrefix) {\n            $this->tablePrefix = $tablePrefix;\n        }elseif(!isset($this->tablePrefix)){\n            $this->tablePrefix = C('DB_PREFIX');\n        }\n\n        // 数据库初始化操作\n        // 获取数据库操作对象\n        // 当前模型有独立的数据库连接信息\n        $this->db(0,empty($this->connection)?$connection:$this->connection,true);\n    }\n\n    /**\n     * 自动检测数据表信息\n     * @access protected\n     * @return void\n     */\n    protected function _checkTableInfo() {\n        // 如果不是Model类 自动记录数据表信息\n        // 只在第一次执行记录\n        if(empty($this->fields)) {\n            // 如果数据表字段没有定义则自动获取\n            if(C('DB_FIELDS_CACHE')) {\n                $db   =  $this->dbName?:C('DB_NAME');\n                $fields = F('_fields/'.strtolower($db.'.'.$this->tablePrefix.$this->name));\n                if($fields) {\n                    $this->fields   =   $fields;\n                    if(!empty($fields['_pk'])){\n                        $this->pk       =   $fields['_pk'];\n                    }\n                    return ;\n                }\n            }\n            // 每次都会读取数据表信息\n            $this->flush();\n        }\n    }\n\n    /**\n     * 获取字段信息并缓存\n     * @access public\n     * @return void\n     */\n    public function flush() {\n        // 缓存不存在则查询数据表信息\n        $this->db->setModel($this->name);\n        $fields =   $this->db->getFields($this->getTableName());\n        if(!$fields) { // 无法获取字段信息\n            return false;\n        }\n        $this->fields   =   array_keys($fields);\n        unset($this->fields['_pk']);\n        foreach ($fields as $key=>$val){\n            // 记录字段类型\n            $type[$key]     =   $val['type'];\n            if($val['primary']) {\n                  // 增加复合主键支持\n                if (isset($this->fields['_pk']) && $this->fields['_pk'] != null) {\n                    if (is_string($this->fields['_pk'])) {\n                        $this->pk   =   array($this->fields['_pk']);\n                        $this->fields['_pk']   =   $this->pk;\n                    }\n                    $this->pk[]   =   $key;\n                    $this->fields['_pk'][]   =   $key;\n                } else {\n                    $this->pk   =   $key;\n                    $this->fields['_pk']   =   $key;\n                }\n                if($val['autoinc']) $this->autoinc   =   true;\n            }\n        }\n        // 记录字段类型信息\n        $this->fields['_type'] =  $type;\n\n        // 2008-3-7 增加缓存开关控制\n        if(C('DB_FIELDS_CACHE')){\n            // 永久缓存数据表信息\n            $db   =  $this->dbName?:C('DB_NAME');\n            F('_fields/'.strtolower($db.'.'.$this->tablePrefix.$this->name),$this->fields);\n        }\n    }\n\n    /**\n     * 设置数据对象的值\n     * @access public\n     * @param string $name 名称\n     * @param mixed $value 值\n     * @return void\n     */\n    public function __set($name,$value) {\n        // 设置数据对象属性\n        $this->data[$name]  =   $value;\n    }\n\n    /**\n     * 获取数据对象的值\n     * @access public\n     * @param string $name 名称\n     * @return mixed\n     */\n    public function __get($name) {\n        return isset($this->data[$name])?$this->data[$name]:null;\n    }\n\n    /**\n     * 检测数据对象的值\n     * @access public\n     * @param string $name 名称\n     * @return boolean\n     */\n    public function __isset($name) {\n        return isset($this->data[$name]);\n    }\n\n    /**\n     * 销毁数据对象的值\n     * @access public\n     * @param string $name 名称\n     * @return void\n     */\n    public function __unset($name) {\n        unset($this->data[$name]);\n    }\n\n    /**\n     * 利用__call方法实现一些特殊的Model方法\n     * @access public\n     * @param string $method 方法名称\n     * @param array $args 调用参数\n     * @return mixed\n     */\n    public function __call($method,$args) {\n        if(in_array(strtolower($method),$this->methods,true)) {\n            // 连贯操作的实现\n            $this->options[strtolower($method)] =   $args[0];\n            return $this;\n        }elseif(in_array(strtolower($method),array('count','sum','min','max','avg'),true)){\n            // 统计查询的实现\n            $field =  isset($args[0])?$args[0]:'*';\n            return $this->getField(strtoupper($method).'('.$field.') AS tp_'.$method);\n        }elseif(strtolower(substr($method,0,5))=='getby') {\n            // 根据某个字段获取记录\n            $field   =   parse_name(substr($method,5));\n            $where[$field] =  $args[0];\n            return $this->where($where)->find();\n        }elseif(strtolower(substr($method,0,10))=='getfieldby') {\n            // 根据某个字段获取记录的某个值\n            $name   =   parse_name(substr($method,10));\n            $where[$name] =$args[0];\n            return $this->where($where)->getField($args[1]);\n        }elseif(isset($this->_scope[$method])){// 命名范围的单独调用支持\n            return $this->scope($method,$args[0]);\n        }else{\n            E(__CLASS__.':'.$method.L('_METHOD_NOT_EXIST_'));\n            return;\n        }\n    }\n    // 回调方法 初始化模型\n    protected function _initialize() {}\n\n    /**\n     * 对保存到数据库的数据进行处理\n     * @access protected\n     * @param mixed $data 要操作的数据\n     * @return boolean\n     */\n     protected function _facade($data) {\n\n        // 检查数据字段合法性\n        if(!empty($this->fields)) {\n            if(!empty($this->options['field'])) {\n                $fields =   $this->options['field'];\n                unset($this->options['field']);\n                if(is_string($fields)) {\n                    $fields =   explode(',',$fields);\n                }    \n            }else{\n                $fields =   $this->fields;\n            }        \n            foreach ($data as $key=>$val){\n                if(!in_array($key,$fields,true)){\n                    if(!empty($this->options['strict'])){\n                        E(L('_DATA_TYPE_INVALID_').':['.$key.'=>'.$val.']');\n                    }\n                    unset($data[$key]);\n                }elseif(is_scalar($val)) {\n                    // 字段类型检查 和 强制转换\n                    $this->_parseType($data,$key);\n                }\n            }\n        }\n       \n        // 安全过滤\n        if(!empty($this->options['filter'])) {\n            $data = array_map($this->options['filter'],$data);\n            unset($this->options['filter']);\n        }\n        $this->_before_write($data);\n        return $data;\n     }\n\n    // 写入数据前的回调方法 包括新增和更新\n    protected function _before_write(&$data) {}\n\n    /**\n     * 新增数据\n     * @access public\n     * @param mixed $data 数据\n     * @param array $options 表达式\n     * @param boolean $replace 是否replace\n     * @return mixed\n     */\n    public function add($data='',$options=array(),$replace=false) {\n        if(empty($data)) {\n            // 没有传递数据，获取当前数据对象的值\n            if(!empty($this->data)) {\n                $data           =   $this->data;\n                // 重置数据\n                $this->data     = array();\n            }else{\n                $this->error    = L('_DATA_TYPE_INVALID_');\n                return false;\n            }\n        }\n        // 数据处理\n        $data       =   $this->_facade($data);\n        // 分析表达式\n        $options    =   $this->_parseOptions($options);\n        if(false === $this->_before_insert($data,$options)) {\n            return false;\n        }\n        // 写入数据到数据库\n        $result = $this->db->insert($data,$options,$replace);\n        if(false !== $result && is_numeric($result)) {\n            $pk     =   $this->getPk();\n              // 增加复合主键支持\n            if (is_array($pk)) return $result;\n            $insertId   =   $this->getLastInsID();\n            if($insertId) {\n                // 自增主键返回插入ID\n                $data[$pk]  = $insertId;\n                if(false === $this->_after_insert($data,$options)) {\n                    return false;\n                }\n                return $insertId;\n            }\n            if(false === $this->_after_insert($data,$options)) {\n                return false;\n            }\n        }\n        return $result;\n    }\n    // 插入数据前的回调方法\n    protected function _before_insert(&$data,$options) {}\n    // 插入成功后的回调方法\n    protected function _after_insert($data,$options) {}\n\n    public function addAll($dataList,$options=array(),$replace=false){\n        if(empty($dataList)) {\n            $this->error = L('_DATA_TYPE_INVALID_');\n            return false;\n        }\n        // 数据处理\n        foreach ($dataList as $key=>$data){\n            $dataList[$key] = $this->_facade($data);\n        }\n        // 分析表达式\n        $options =  $this->_parseOptions($options);\n        // 写入数据到数据库\n        $result = $this->db->insertAll($dataList,$options,$replace);\n        if(false !== $result ) {\n            $insertId   =   $this->getLastInsID();\n            if($insertId) {\n                return $insertId;\n            }\n        }\n        return $result;\n    }\n\n    /**\n     * 通过Select方式添加记录\n     * @access public\n     * @param string $fields 要插入的数据表字段名\n     * @param string $table 要插入的数据表名\n     * @param array $options 表达式\n     * @return boolean\n     */\n    public function selectAdd($fields='',$table='',$options=array()) {\n        // 分析表达式\n        $options =  $this->_parseOptions($options);\n        // 写入数据到数据库\n        if(false === $result = $this->db->selectInsert($fields?:$options['field'],$table?:$this->getTableName(),$options)){\n            // 数据库插入操作失败\n            $this->error = L('_OPERATION_WRONG_');\n            return false;\n        }else {\n            // 插入成功\n            return $result;\n        }\n    }\n\n    /**\n     * 保存数据\n     * @access public\n     * @param mixed $data 数据\n     * @param array $options 表达式\n     * @return boolean\n     */\n    public function save($data='',$options=array()) {\n        if(empty($data)) {\n            // 没有传递数据，获取当前数据对象的值\n            if(!empty($this->data)) {\n                $data           =   $this->data;\n                // 重置数据\n                $this->data     =   array();\n            }else{\n                $this->error    =   L('_DATA_TYPE_INVALID_');\n                return false;\n            }\n        }\n        // 数据处理\n        $data       =   $this->_facade($data);\n        if(empty($data)){\n            // 没有数据则不执行\n            $this->error    =   L('_DATA_TYPE_INVALID_');\n            return false;\n        }\n        // 分析表达式\n        $options    =   $this->_parseOptions($options);\n        $pk         =   $this->getPk();\n        if(!isset($options['where']) ) {\n            // 如果存在主键数据 则自动作为更新条件\n            if (is_string($pk) && isset($data[$pk])) {\n                $where[$pk]     =   $data[$pk];\n                unset($data[$pk]);\n            } elseif (is_array($pk)) {\n                // 增加复合主键支持\n                foreach ($pk as $field) {\n                    if(isset($data[$field])) {\n                        $where[$field]      =   $data[$field];\n                    } else {\n                           // 如果缺少复合主键数据则不执行\n                        $this->error        =   L('_OPERATION_WRONG_');\n                        return false;\n                    }\n                    unset($data[$field]);\n                }\n            }\n            if(!isset($where)){\n                // 如果没有任何更新条件则不执行\n                $this->error        =   L('_OPERATION_WRONG_');\n                return false;\n            }else{\n                $options['where']   =   $where;\n            }\n        }\n\n        if(is_array($options['where']) && isset($options['where'][$pk])){\n            $pkValue    =   $options['where'][$pk];\n        }\n        if(false === $this->_before_update($data,$options)) {\n            return false;\n        }\n        $result     =   $this->db->update($data,$options);\n        if(false !== $result && is_numeric($result)) {\n            if(isset($pkValue)) $data[$pk]   =  $pkValue;\n            $this->_after_update($data,$options);\n        }\n        return $result;\n    }\n    // 更新数据前的回调方法\n    protected function _before_update(&$data,$options) {}\n    // 更新成功后的回调方法\n    protected function _after_update($data,$options) {}\n\n    /**\n     * 删除数据\n     * @access public\n     * @param mixed $options 表达式\n     * @return mixed\n     */\n    public function delete($options=array()) {\n        $pk   =  $this->getPk();\n        if(empty($options) && empty($this->options['where'])) {\n            // 如果删除条件为空 则删除当前数据对象所对应的记录\n            if(!empty($this->data) && isset($this->data[$pk]))\n                return $this->delete($this->data[$pk]);\n            else\n                return false;\n        }\n        if(is_numeric($options)  || is_string($options)) {\n            // 根据主键删除记录\n            if(strpos($options,',')) {\n                $where[$pk]     =  array('IN', $options);\n            }else{\n                $where[$pk]     =  $options;\n            }\n            $options            =  array();\n            $options['where']   =  $where;\n        }\n        // 根据复合主键删除记录\n        if (is_array($options) && (count($options) > 0) && is_array($pk)) {\n            $count = 0;\n            foreach (array_keys($options) as $key) {\n                if (is_int($key)) $count++; \n            } \n            if ($count == count($pk)) {\n                $i = 0;\n                foreach ($pk as $field) {\n                    $where[$field] = $options[$i];\n                    unset($options[$i++]);\n                }\n                $options['where']  =  $where;\n            } else {\n                return false;\n            }\n        }\n        // 分析表达式\n        $options =  $this->_parseOptions($options);\n        if(empty($options['where'])){\n            // 如果条件为空 不进行删除操作 除非设置 1=1\n            return false;\n        }        \n        if(is_array($options['where']) && isset($options['where'][$pk])){\n            $pkValue            =  $options['where'][$pk];\n        }\n\n        if(false === $this->_before_delete($options)) {\n            return false;\n        }        \n        $result  =    $this->db->delete($options);\n        if(false !== $result && is_numeric($result)) {\n            $data = array();\n            if(isset($pkValue)) $data[$pk]   =  $pkValue;\n            $this->_after_delete($data,$options);\n        }\n        // 返回删除记录个数\n        return $result;\n    }\n    // 删除数据前的回调方法\n    protected function _before_delete($options) {}    \n    // 删除成功后的回调方法\n    protected function _after_delete($data,$options) {}\n\n    /**\n     * 查询数据集\n     * @access public\n     * @param array $options 表达式参数\n     * @return mixed\n     */\n    public function select($options=array()) {\n        $pk   =  $this->getPk();\n        if(is_string($options) || is_numeric($options)) {\n            // 根据主键查询\n            if(strpos($options,',')) {\n                $where[$pk]     =  array('IN',$options);\n            }else{\n                $where[$pk]     =  $options;\n            }\n            $options            =  array();\n            $options['where']   =  $where;\n        }elseif (is_array($options) && (count($options) > 0) && is_array($pk)) {\n            // 根据复合主键查询\n            $count = 0;\n            foreach (array_keys($options) as $key) {\n                if (is_int($key)) $count++; \n            } \n            if ($count == count($pk)) {\n                $i = 0;\n                foreach ($pk as $field) {\n                    $where[$field] = $options[$i];\n                    unset($options[$i++]);\n                }\n                $options['where']  =  $where;\n            } else {\n                return false;\n            }\n        } elseif(false === $options){ // 用于子查询 不查询只返回SQL\n        \t$options['fetch_sql'] = true;\n        }\n        // 分析表达式\n        $options    =  $this->_parseOptions($options);\n        // 判断查询缓存\n        if(isset($options['cache'])){\n            $cache  =   $options['cache'];\n            $key    =   is_string($cache['key'])?$cache['key']:md5(serialize($options));\n            $data   =   S($key,'',$cache);\n            if(false !== $data){\n                return $data;\n            }\n        }        \n        $resultSet  = $this->db->select($options);\n        if(false === $resultSet) {\n            return false;\n        }\n        if(!empty($resultSet)) { // 有查询结果\n            if(is_string($resultSet)){\n                return $resultSet;\n            }\n\n            $resultSet  =   array_map(array($this,'_read_data'),$resultSet);\n            $this->_after_select($resultSet,$options);\n            if(isset($options['index'])){ // 对数据集进行索引\n                $index  =   explode(',',$options['index']);\n                foreach ($resultSet as $result){\n                    $_key   =  $result[$index[0]];\n                    if(isset($index[1]) && isset($result[$index[1]])){\n                        $cols[$_key] =  $result[$index[1]];\n                    }else{\n                        $cols[$_key] =  $result;\n                    }\n                }\n                $resultSet  =   $cols;\n            }\n        }\n\n        if(isset($cache)){\n            S($key,$resultSet,$cache);\n        }\n        return $resultSet;\n    }\n    // 查询成功后的回调方法\n    protected function _after_select(&$resultSet,$options) {}\n\n    /**\n     * 生成查询SQL 可用于子查询\n     * @access public\n     * @return string\n     */\n    public function buildSql() {\n        return  '( '.$this->fetchSql(true)->select().' )';\n    }\n\n    /**\n     * 分析表达式\n     * @access protected\n     * @param array $options 表达式参数\n     * @return array\n     */\n    protected function _parseOptions($options=array()) {\n        if(is_array($options))\n            $options =  array_merge($this->options,$options);\n\n        if(!isset($options['table'])){\n            // 自动获取表名\n            $options['table']   =   $this->getTableName();\n            $fields             =   $this->fields;\n        }else{\n            // 指定数据表 则重新获取字段列表 但不支持类型检测\n            $fields             =   $this->getDbFields();\n        }\n\n        // 数据表别名\n        if(!empty($options['alias'])) {\n            $options['table']  .=   ' '.$options['alias'];\n        }\n        // 记录操作的模型名称\n        $options['model']       =   $this->name;\n\n        // 字段类型验证\n        if(isset($options['where']) && is_array($options['where']) && !empty($fields) && !isset($options['join'])) {\n            // 对数组查询条件进行字段类型检查\n            foreach ($options['where'] as $key=>$val){\n                $key            =   trim($key);\n                if(in_array($key,$fields,true)){\n                    if(is_scalar($val)) {\n                        $this->_parseType($options['where'],$key);\n                    }\n                }elseif(!is_numeric($key) && '_' != substr($key,0,1) && false === strpos($key,'.') && false === strpos($key,'(') && false === strpos($key,'|') && false === strpos($key,'&')){\n                    if(!empty($this->options['strict'])){\n                        E(L('_ERROR_QUERY_EXPRESS_').':['.$key.'=>'.$val.']');\n                    } \n                    unset($options['where'][$key]);\n                }\n            }\n        }\n        // 查询过后清空sql表达式组装 避免影响下次查询\n        $this->options  =   array();\n        // 表达式过滤\n        $this->_options_filter($options);\n        return $options;\n    }\n    // 表达式过滤回调方法\n    protected function _options_filter(&$options) {}\n\n    /**\n     * 数据类型检测\n     * @access protected\n     * @param mixed $data 数据\n     * @param string $key 字段名\n     * @return void\n     */\n    protected function _parseType(&$data,$key) {\n        if(!isset($this->options['bind'][':'.$key]) && isset($this->fields['_type'][$key])){\n            $fieldType = strtolower($this->fields['_type'][$key]);\n            if(false !== strpos($fieldType,'enum')){\n                // 支持ENUM类型优先检测\n            }elseif(false === strpos($fieldType,'bigint') && false !== strpos($fieldType,'int')) {\n                $data[$key]   =  intval($data[$key]);\n            }elseif(false !== strpos($fieldType,'float') || false !== strpos($fieldType,'double')){\n                $data[$key]   =  floatval($data[$key]);\n            }elseif(false !== strpos($fieldType,'bool')){\n                $data[$key]   =  (bool)$data[$key];\n            }\n        }\n    }\n\n    /**\n     * 数据读取后的处理\n     * @access protected\n     * @param array $data 当前数据\n     * @return array\n     */\n    protected function _read_data($data) {\n        // 检查字段映射\n        if(!empty($this->_map) && C('READ_DATA_MAP')) {\n            foreach ($this->_map as $key=>$val){\n                if(isset($data[$val])) {\n                    $data[$key] =   $data[$val];\n                    unset($data[$val]);\n                }\n            }\n        }\n        return $data;\n    }\n\n    /**\n     * 查询数据\n     * @access public\n     * @param mixed $options 表达式参数\n     * @return mixed\n     */\n    public function find($options=array()) {\n        if(is_numeric($options) || is_string($options)) {\n            $where[$this->getPk()]  =   $options;\n            $options                =   array();\n            $options['where']       =   $where;\n        }\n        // 根据复合主键查找记录\n        $pk  =  $this->getPk();\n        if (is_array($options) && (count($options) > 0) && is_array($pk)) {\n            // 根据复合主键查询\n            $count = 0;\n            foreach (array_keys($options) as $key) {\n                if (is_int($key)) $count++; \n            } \n            if ($count == count($pk)) {\n                $i = 0;\n                foreach ($pk as $field) {\n                    $where[$field] = $options[$i];\n                    unset($options[$i++]);\n                }\n                $options['where']  =  $where;\n            } else {\n                return false;\n            }\n        }\n        // 总是查找一条记录\n        $options['limit']   =   1;\n        // 分析表达式\n        $options            =   $this->_parseOptions($options);\n        // 判断查询缓存\n        if(isset($options['cache'])){\n            $cache  =   $options['cache'];\n            $key    =   is_string($cache['key'])?$cache['key']:md5(serialize($options));\n            $data   =   S($key,'',$cache);\n            if(false !== $data){\n                $this->data     =   $data;\n                return $data;\n            }\n        }\n        $resultSet          =   $this->db->select($options);\n        if(false === $resultSet) {\n            return false;\n        }\n        if(empty($resultSet)) {// 查询结果为空\n            return null;\n        }\n        if(is_string($resultSet)){\n            return $resultSet;\n        }\n\n        // 读取数据后的处理\n        $data   =   $this->_read_data($resultSet[0]);\n        $this->_after_find($data,$options);\n        if(!empty($this->options['result'])) {\n            return $this->returnResult($data,$this->options['result']);\n        }\n        $this->data     =   $data;\n        if(isset($cache)){\n            S($key,$data,$cache);\n        }\n        return $this->data;\n    }\n    // 查询成功的回调方法\n    protected function _after_find(&$result,$options) {}\n\n    protected function returnResult($data,$type=''){\n        if ($type){\n            if(is_callable($type)){\n                return call_user_func($type,$data);\n            }\n            switch (strtolower($type)){\n                case 'json':\n                    return json_encode($data);\n                case 'xml':\n                    return xml_encode($data);\n            }\n        }\n        return $data;\n    }\n\n    /**\n     * 处理字段映射\n     * @access public\n     * @param array $data 当前数据\n     * @param integer $type 类型 0 写入 1 读取\n     * @return array\n     */\n    public function parseFieldsMap($data,$type=1) {\n        // 检查字段映射\n        if(!empty($this->_map)) {\n            foreach ($this->_map as $key=>$val){\n                if($type==1) { // 读取\n                    if(isset($data[$val])) {\n                        $data[$key] =   $data[$val];\n                        unset($data[$val]);\n                    }\n                }else{\n                    if(isset($data[$key])) {\n                        $data[$val] =   $data[$key];\n                        unset($data[$key]);\n                    }\n                }\n            }\n        }\n        return $data;\n    }\n\n    /**\n     * 设置记录的某个字段值\n     * 支持使用数据库字段和方法\n     * @access public\n     * @param string|array $field  字段名\n     * @param string $value  字段值\n     * @return boolean\n     */\n    public function setField($field,$value='') {\n        if(is_array($field)) {\n            $data           =   $field;\n        }else{\n            $data[$field]   =   $value;\n        }\n        return $this->save($data);\n    }\n\n    /**\n     * 字段值增长\n     * @access public\n     * @param string $field  字段名\n     * @param integer $step  增长值\n     * @param integer $lazyTime  延时时间(s)\n     * @return boolean\n     */\n    public function setInc($field,$step=1,$lazyTime=0) {\n        if($lazyTime>0) {// 延迟写入\n            $condition \t=  \t$this->options['where'];\n            $guid \t\t=  \tmd5($this->name.'_'.$field.'_'.serialize($condition));\n            $step \t\t= \t$this->lazyWrite($guid,$step,$lazyTime);\n            if(empty($step)) {\n            \treturn true; // 等待下次写入\n            }elseif($step < 0) {\n            \t$step \t=\t'-'.$step;\n            }\n        }\n        return $this->setField($field,array('exp',$field.'+'.$step));\n    }\n\n    /**\n     * 字段值减少\n     * @access public\n     * @param string $field  字段名\n     * @param integer $step  减少值\n     * @param integer $lazyTime  延时时间(s)\n     * @return boolean\n     */\n    public function setDec($field,$step=1,$lazyTime=0) {\n        if($lazyTime>0) {// 延迟写入\n            $condition  =  \t$this->options['where'];\n            $guid \t\t=  \tmd5($this->name.'_'.$field.'_'.serialize($condition));\n            $step \t\t= \t$this->lazyWrite($guid,-$step,$lazyTime);\n            if(empty($step)) {\n            \treturn true; // 等待下次写入\n            }elseif($step > 0) {\n            \t$step \t=\t'-'.$step;\n            }\n        }\n        return $this->setField($field,array('exp',$field.'-'.$step));\n    }\n\n    /**\n     * 延时更新检查 返回false表示需要延时\n     * 否则返回实际写入的数值\n     * @access public\n     * @param string $guid  写入标识\n     * @param integer $step  写入步进值\n     * @param integer $lazyTime  延时时间(s)\n     * @return false|integer\n     */\n    protected function lazyWrite($guid,$step,$lazyTime) {\n        if(false !== ($value = S($guid))) { // 存在缓存写入数据\n            if(NOW_TIME > S($guid.'_time')+$lazyTime) {\n                // 延时更新时间到了，删除缓存数据 并实际写入数据库\n                S($guid,NULL);\n                S($guid.'_time',NULL);\n                return $value+$step;\n            }else{\n                // 追加数据到缓存\n                S($guid,$value+$step);\n                return false;\n            }\n        }else{ // 没有缓存数据\n            S($guid,$step);\n            // 计时开始\n            S($guid.'_time',NOW_TIME);\n            return false;\n        }\n    }\n\n    /**\n     * 获取一条记录的某个字段值\n     * @access public\n     * @param string $field  字段名\n     * @param string $spea  字段数据间隔符号 NULL返回数组\n     * @return mixed\n     */\n    public function getField($field,$sepa=null) {\n        $options['field']       =   $field;\n        $options                =   $this->_parseOptions($options);\n        // 判断查询缓存\n        if(isset($options['cache'])){\n            $cache  =   $options['cache'];\n            $key    =   is_string($cache['key'])?$cache['key']:md5($sepa.serialize($options));\n            $data   =   S($key,'',$cache);\n            if(false !== $data){\n                return $data;\n            }\n        }        \n        $field                  =   trim($field);\n        if(strpos($field,',') && false !== $sepa) { // 多字段\n            if(!isset($options['limit'])){\n                $options['limit']   =   is_numeric($sepa)?$sepa:'';\n            }\n            $resultSet          =   $this->db->select($options);\n            if(!empty($resultSet)) {\n\t\t        if(is_string($resultSet)){\n\t\t            return $resultSet;\n\t\t        }            \t\n                $_field         =   explode(',', $field);\n                $field          =   array_keys($resultSet[0]);\n                $key1           =   array_shift($field);\n                $key2           =   array_shift($field);\n                $cols           =   array();\n                $count          =   count($_field);\n                foreach ($resultSet as $result){\n                    $name   =  $result[$key1];\n                    if(2==$count) {\n                        $cols[$name]   =  $result[$key2];\n                    }else{\n                        $cols[$name]   =  is_string($sepa)?implode($sepa,array_slice($result,1)):$result;\n                    }\n                }\n                if(isset($cache)){\n                    S($key,$cols,$cache);\n                }\n                return $cols;\n            }\n        }else{   // 查找一条记录\n            // 返回数据个数\n            if(true !== $sepa) {// 当sepa指定为true的时候 返回所有数据\n                $options['limit']   =   is_numeric($sepa)?$sepa:1;\n            }\n            $result = $this->db->select($options);\n            if(!empty($result)) {\n\t\t        if(is_string($result)){\n\t\t            return $result;\n\t\t        }            \t\n                if(true !== $sepa && 1==$options['limit']) {\n                    $data   =   reset($result[0]);\n                    if(isset($cache)){\n                        S($key,$data,$cache);\n                    }            \n                    return $data;\n                }\n                foreach ($result as $val){\n                    $array[]    =   $val[$field];\n                }\n                if(isset($cache)){\n                    S($key,$array,$cache);\n                }                \n                return $array;\n            }\n        }\n        return null;\n    }\n\n    /**\n     * 创建数据对象 但不保存到数据库\n     * @access public\n     * @param mixed $data 创建数据\n     * @param string $type 状态\n     * @return mixed\n     */\n     public function create($data='',$type='') {\n        // 如果没有传值默认取POST数据\n        if(empty($data)) {\n            $data   =   I('post.');\n        }elseif(is_object($data)){\n            $data   =   get_object_vars($data);\n        }\n        // 验证数据\n        if(empty($data) || !is_array($data)) {\n            $this->error = L('_DATA_TYPE_INVALID_');\n            return false;\n        }\n\n        // 状态\n        $type = $type?:(!empty($data[$this->getPk()])?self::MODEL_UPDATE:self::MODEL_INSERT);\n\n        // 检查字段映射\n\t\t$data =\t$this->parseFieldsMap($data,0);\n\n        // 检测提交字段的合法性\n        if(isset($this->options['field'])) { // $this->field('field1,field2...')->create()\n            $fields =   $this->options['field'];\n            unset($this->options['field']);\n        }elseif($type == self::MODEL_INSERT && isset($this->insertFields)) {\n            $fields =   $this->insertFields;\n        }elseif($type == self::MODEL_UPDATE && isset($this->updateFields)) {\n            $fields =   $this->updateFields;\n        }\n        if(isset($fields)) {\n            if(is_string($fields)) {\n                $fields =   explode(',',$fields);\n            }\n            // 判断令牌验证字段\n            if(C('TOKEN_ON'))   $fields[] = C('TOKEN_NAME', null, '__hash__');\n            foreach ($data as $key=>$val){\n                if(!in_array($key,$fields)) {\n                    unset($data[$key]);\n                }\n            }\n        }\n\n        // 数据自动验证\n        if(!$this->autoValidation($data,$type)) return false;\n\n        // 表单令牌验证\n        if(!$this->autoCheckToken($data)) {\n            $this->error = L('_TOKEN_ERROR_');\n            return false;\n        }\n\n        // 验证完成生成数据对象\n        if($this->autoCheckFields) { // 开启字段检测 则过滤非法字段数据\n            $fields =   $this->getDbFields();\n            foreach ($data as $key=>$val){\n                if(!in_array($key,$fields)) {\n                    unset($data[$key]);\n                }elseif(MAGIC_QUOTES_GPC && is_string($val)){\n                    $data[$key] =   stripslashes($val);\n                }\n            }\n        }\n\n        // 创建完成对数据进行自动处理\n        $this->autoOperation($data,$type);\n        // 赋值当前数据对象\n        $this->data =   $data;\n        // 返回创建的数据以供其他调用\n        return $data;\n     }\n\n    // 自动表单令牌验证\n    // TODO  ajax无刷新多次提交暂不能满足\n    public function autoCheckToken($data) {\n        // 支持使用token(false) 关闭令牌验证\n        if(isset($this->options['token']) && !$this->options['token']) return true;\n        if(C('TOKEN_ON')){\n            $name   = C('TOKEN_NAME', null, '__hash__');\n            if(!isset($data[$name]) || !isset($_SESSION[$name])) { // 令牌数据无效\n                return false;\n            }\n\n            // 令牌验证\n            list($key,$value)  =  explode('_',$data[$name]);\n            if(isset($_SESSION[$name][$key]) && $value && $_SESSION[$name][$key] === $value) { // 防止重复提交\n                unset($_SESSION[$name][$key]); // 验证完成销毁session\n                return true;\n            }\n            // 开启TOKEN重置\n            if(C('TOKEN_RESET')) unset($_SESSION[$name][$key]);\n            return false;\n        }\n        return true;\n    }\n\n    /**\n     * 使用正则验证数据\n     * @access public\n     * @param string $value  要验证的数据\n     * @param string $rule 验证规则\n     * @return boolean\n     */\n    public function regex($value,$rule) {\n        $validate = array(\n            'require'   =>  '/\\S+/',\n            'email'     =>  '/^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$/',\n            'url'       =>  '/^http(s?):\\/\\/(?:[A-za-z0-9-]+\\.)+[A-za-z]{2,4}(:\\d+)?(?:[\\/\\?#][\\/=\\?%\\-&~`@[\\]\\':+!\\.#\\w]*)?$/',\n            'currency'  =>  '/^\\d+(\\.\\d+)?$/',\n            'number'    =>  '/^\\d+$/',\n            'zip'       =>  '/^\\d{6}$/',\n            'integer'   =>  '/^[-\\+]?\\d+$/',\n            'double'    =>  '/^[-\\+]?\\d+(\\.\\d+)?$/',\n            'english'   =>  '/^[A-Za-z]+$/',\n        );\n        // 检查是否有内置的正则表达式\n        if(isset($validate[strtolower($rule)]))\n            $rule       =   $validate[strtolower($rule)];\n        return preg_match($rule,$value)===1;\n    }\n\n    /**\n     * 自动表单处理\n     * @access public\n     * @param array $data 创建数据\n     * @param string $type 创建类型\n     * @return mixed\n     */\n    private function autoOperation(&$data,$type) {\n    \tif(false === $this->options['auto']){\n    \t\t// 关闭自动完成\n    \t\treturn $data;\n    \t}\n        if(!empty($this->options['auto'])) {\n            $_auto   =   $this->options['auto'];\n            unset($this->options['auto']);\n        }elseif(!empty($this->_auto)){\n            $_auto   =   $this->_auto;\n        }\n        // 自动填充\n        if(isset($_auto)) {\n            foreach ($_auto as $auto){\n                // 填充因子定义格式\n                // array('field','填充内容','填充条件','附加规则',[额外参数])\n                if(empty($auto[2])) $auto[2] =  self::MODEL_INSERT; // 默认为新增的时候自动填充\n                if( $type == $auto[2] || $auto[2] == self::MODEL_BOTH) {\n                    if(empty($auto[3])) $auto[3] =  'string';\n                    switch(trim($auto[3])) {\n                        case 'function':    //  使用函数进行填充 字段的值作为参数\n                        case 'callback': // 使用回调方法\n                            $args = isset($auto[4])?(array)$auto[4]:array();\n                            if(isset($data[$auto[0]])) {\n                                array_unshift($args,$data[$auto[0]]);\n                            }\n                            if('function'==$auto[3]) {\n                                $data[$auto[0]]  = call_user_func_array($auto[1], $args);\n                            }else{\n                                $data[$auto[0]]  =  call_user_func_array(array(&$this,$auto[1]), $args);\n                            }\n                            break;\n                        case 'field':    // 用其它字段的值进行填充\n                            $data[$auto[0]] = $data[$auto[1]];\n                            break;\n                        case 'ignore': // 为空忽略\n                            if($auto[1]===$data[$auto[0]])\n                                unset($data[$auto[0]]);\n                            break;\n                        case 'string':\n                        default: // 默认作为字符串填充\n                            $data[$auto[0]] = $auto[1];\n                    }\n                    if(isset($data[$auto[0]]) && false === $data[$auto[0]] )   unset($data[$auto[0]]);\n                }\n            }\n        }\n        return $data;\n    }\n\n    /**\n     * 自动表单验证\n     * @access protected\n     * @param array $data 创建数据\n     * @param string $type 创建类型\n     * @return boolean\n     */\n    protected function autoValidation($data,$type) {\n    \tif(false === $this->options['validate'] ){\n    \t\t// 关闭自动验证\n    \t\treturn true;\n    \t}\n        if(!empty($this->options['validate'])) {\n            $_validate   =   $this->options['validate'];\n            unset($this->options['validate']);\n        }elseif(!empty($this->_validate)){\n            $_validate   =   $this->_validate;\n        }\n        // 属性验证\n        if(isset($_validate)) { // 如果设置了数据自动验证则进行数据验证\n            if($this->patchValidate) { // 重置验证错误信息\n                $this->error = array();\n            }\n            foreach($_validate as $key=>$val) {\n                // 验证因子定义格式\n                // array(field,rule,message,condition,type,when,params)\n                // 判断是否需要执行验证\n                if(empty($val[5]) || ( $val[5]== self::MODEL_BOTH && $type < 3 ) || $val[5]== $type ) {\n                    if(0==strpos($val[2],'{%') && strpos($val[2],'}'))\n                        // 支持提示信息的多语言 使用 {%语言定义} 方式\n                        $val[2]  =  L(substr($val[2],2,-1));\n                    $val[3]  =  isset($val[3])?$val[3]:self::EXISTS_VALIDATE;\n                    $val[4]  =  isset($val[4])?$val[4]:'regex';\n                    // 判断验证条件\n                    switch($val[3]) {\n                        case self::MUST_VALIDATE:   // 必须验证 不管表单是否有设置该字段\n                            if(false === $this->_validationField($data,$val)) \n                                return false;\n                            break;\n                        case self::VALUE_VALIDATE:    // 值不为空的时候才验证\n                            if('' != trim($data[$val[0]]))\n                                if(false === $this->_validationField($data,$val)) \n                                    return false;\n                            break;\n                        default:    // 默认表单存在该字段就验证\n                            if(isset($data[$val[0]]))\n                                if(false === $this->_validationField($data,$val)) \n                                    return false;\n                    }\n                }\n            }\n            // 批量验证的时候最后返回错误\n            if(!empty($this->error)) return false;\n        }\n        return true;\n    }\n\n    /**\n     * 验证表单字段 支持批量验证\n     * 如果批量验证返回错误的数组信息\n     * @access protected\n     * @param array $data 创建数据\n     * @param array $val 验证因子\n     * @return boolean\n     */\n    protected function _validationField($data,$val) {\n        if($this->patchValidate && isset($this->error[$val[0]]))\n            return ; //当前字段已经有规则验证没有通过\n        if(false === $this->_validationFieldItem($data,$val)){\n            if($this->patchValidate) {\n                $this->error[$val[0]]   =   $val[2];\n            }else{\n                $this->error            =   $val[2];\n                return false;\n            }\n        }\n        return ;\n    }\n\n    /**\n     * 根据验证因子验证字段\n     * @access protected\n     * @param array $data 创建数据\n     * @param array $val 验证因子\n     * @return boolean\n     */\n    protected function _validationFieldItem($data,$val) {\n        switch(strtolower(trim($val[4]))) {\n            case 'function':// 使用函数进行验证\n            case 'callback':// 调用方法进行验证\n                $args = isset($val[6])?(array)$val[6]:array();\n                if(is_string($val[0]) && strpos($val[0], ','))\n                    $val[0] = explode(',', $val[0]);\n                if(is_array($val[0])){\n                    // 支持多个字段验证\n                    foreach($val[0] as $field)\n                        $_data[$field] = $data[$field];\n                    array_unshift($args, $_data);\n                }else{\n                    array_unshift($args, $data[$val[0]]);\n                }\n                if('function'==$val[4]) {\n                    return call_user_func_array($val[1], $args);\n                }else{\n                    return call_user_func_array(array(&$this, $val[1]), $args);\n                }\n            case 'confirm': // 验证两个字段是否相同\n                return $data[$val[0]] == $data[$val[1]];\n            case 'unique': // 验证某个值是否唯一\n                if(is_string($val[0]) && strpos($val[0],','))\n                    $val[0]  =  explode(',',$val[0]);\n                $map = array();\n                if(is_array($val[0])) {\n                    // 支持多个字段验证\n                    foreach ($val[0] as $field)\n                        $map[$field]   =  $data[$field];\n                }else{\n                    $map[$val[0]] = $data[$val[0]];\n                }\n                $pk =   $this->getPk();\n                if(!empty($data[$pk]) && is_string($pk)) { // 完善编辑的时候验证唯一\n                    $map[$pk] = array('neq',$data[$pk]);\n                }\n                if($this->where($map)->find())   return false;\n                return true;\n            default:  // 检查附加规则\n                return $this->check($data[$val[0]],$val[1],$val[4]);\n        }\n    }\n\n    /**\n     * 验证数据 支持 in between equal length regex expire ip_allow ip_deny\n     * @access public\n     * @param string $value 验证数据\n     * @param mixed $rule 验证表达式\n     * @param string $type 验证方式 默认为正则验证\n     * @return boolean\n     */\n    public function check($value,$rule,$type='regex'){\n        $type   =   strtolower(trim($type));\n        switch($type) {\n            case 'in': // 验证是否在某个指定范围之内 逗号分隔字符串或者数组\n            case 'notin':\n                $range   = is_array($rule)? $rule : explode(',',$rule);\n                return $type == 'in' ? in_array($value ,$range) : !in_array($value ,$range);\n            case 'between': // 验证是否在某个范围\n            case 'notbetween': // 验证是否不在某个范围            \n                if (is_array($rule)){\n                    $min    =    $rule[0];\n                    $max    =    $rule[1];\n                }else{\n                    list($min,$max)   =  explode(',',$rule);\n                }\n                return $type == 'between' ? $value>=$min && $value<=$max : $value<$min || $value>$max;\n            case 'equal': // 验证是否等于某个值\n            case 'notequal': // 验证是否等于某个值            \n                return $type == 'equal' ? $value == $rule : $value != $rule;\n            case 'length': // 验证长度\n                $length  =  mb_strlen($value,'utf-8'); // 当前数据长度\n                if(strpos($rule,',')) { // 长度区间\n                    list($min,$max)   =  explode(',',$rule);\n                    return $length >= $min && $length <= $max;\n                }else{// 指定长度\n                    return $length == $rule;\n                }\n            case 'expire':\n                list($start,$end)   =  explode(',',$rule);\n                if(!is_numeric($start)) $start   =  strtotime($start);\n                if(!is_numeric($end)) $end   =  strtotime($end);\n                return NOW_TIME >= $start && NOW_TIME <= $end;\n            case 'ip_allow': // IP 操作许可验证\n                return in_array(get_client_ip(),explode(',',$rule));\n            case 'ip_deny': // IP 操作禁止验证\n                return !in_array(get_client_ip(),explode(',',$rule));\n            case 'regex':\n            default:    // 默认使用正则验证 可以使用验证类中定义的验证名称\n                // 检查附加规则\n                return $this->regex($value,$rule);\n        }\n    }\n\n    /**\n     * 存储过程返回多数据集\n     * @access public\n     * @param string $sql  SQL指令\n     * @param mixed $parse  是否需要解析SQL\n     * @return array\n     */\n    public function procedure($sql, $parse = false) {\n        return $this->db->procedure($sql, $parse);\n    }\n\n    /**\n     * SQL查询\n     * @access public\n     * @param string $sql  SQL指令\n     * @param mixed $parse  是否需要解析SQL\n     * @return mixed\n     */\n    public function query($sql,$parse=false) {\n        if(!is_bool($parse) && !is_array($parse)) {\n            $parse = func_get_args();\n            array_shift($parse);\n        }\n        $sql  =   $this->parseSql($sql,$parse);\n        return $this->db->query($sql);\n    }\n\n    /**\n     * 执行SQL语句\n     * @access public\n     * @param string $sql  SQL指令\n     * @param mixed $parse  是否需要解析SQL\n     * @return false | integer\n     */\n    public function execute($sql,$parse=false) {\n        if(!is_bool($parse) && !is_array($parse)) {\n            $parse = func_get_args();\n            array_shift($parse);\n        }\n        $sql  =   $this->parseSql($sql,$parse);\n        return $this->db->execute($sql);\n    }\n\n    /**\n     * 解析SQL语句\n     * @access public\n     * @param string $sql  SQL指令\n     * @param boolean $parse  是否需要解析SQL\n     * @return string\n     */\n    protected function parseSql($sql,$parse) {\n        // 分析表达式\n        if(true === $parse) {\n            $options =  $this->_parseOptions();\n            $sql    =   $this->db->parseSql($sql,$options);\n        }elseif(is_array($parse)){ // SQL预处理\n            $parse  =   array_map(array($this->db,'escapeString'),$parse);\n            $sql    =   vsprintf($sql,$parse);\n        }else{\n            $sql    =   strtr($sql,array('__TABLE__'=>$this->getTableName(),'__PREFIX__'=>$this->tablePrefix));\n            $prefix =   $this->tablePrefix;\n            $sql    =   preg_replace_callback(\"/__([A-Z0-9_-]+)__/sU\", function($match) use($prefix){ return $prefix.strtolower($match[1]);}, $sql);\n        }\n        $this->db->setModel($this->name);\n        return $sql;\n    }\n\n    /**\n     * 切换当前的数据库连接\n     * @access public\n     * @param integer $linkNum  连接序号\n     * @param mixed $config  数据库连接信息\n     * @param boolean $force 强制重新连接\n     * @return Model\n     */\n    public function db($linkNum='',$config='',$force=false) {\n        if('' === $linkNum && $this->db) {\n            return $this->db;\n        }\n\n        if(!isset($this->_db[$linkNum]) || $force ) {\n            // 创建一个新的实例\n            if(!empty($config) && is_string($config) && false === strpos($config,'/')) { // 支持读取配置参数\n                $config  =  C($config);\n            }\n            $this->_db[$linkNum]            =    Db::getInstance($config);\n        }elseif(NULL === $config){\n            $this->_db[$linkNum]->close(); // 关闭数据库连接\n            unset($this->_db[$linkNum]);\n            return ;\n        }\n\n        // 切换数据库连接\n        $this->db   =    $this->_db[$linkNum];\n        $this->_after_db();\n        // 字段检测\n        if(!empty($this->name) && $this->autoCheckFields)    $this->_checkTableInfo();\n        return $this;\n    }\n    // 数据库切换后回调方法\n    protected function _after_db() {}\n\n    /**\n     * 得到当前的数据对象名称\n     * @access public\n     * @return string\n     */\n    public function getModelName() {\n        if(empty($this->name)){\n            $name = substr(get_class($this),0,-strlen(C('DEFAULT_M_LAYER')));\n            if ( $pos = strrpos($name,'\\\\') ) {//有命名空间\n                $this->name = substr($name,$pos+1);\n            }else{\n                $this->name = $name;\n            }\n        }\n        return $this->name;\n    }\n\n    /**\n     * 得到完整的数据表名\n     * @access public\n     * @return string\n     */\n    public function getTableName() {\n        if(empty($this->trueTableName)) {\n            $tableName  = !empty($this->tablePrefix) ? $this->tablePrefix : '';\n            if(!empty($this->tableName)) {\n                $tableName .= $this->tableName;\n            }else{\n                $tableName .= parse_name($this->name);\n            }\n            $this->trueTableName    =   strtolower($tableName);\n        }\n        return (!empty($this->dbName)?$this->dbName.'.':'').$this->trueTableName;\n    }\n\n    /**\n     * 启动事务\n     * @access public\n     * @return void\n     */\n    public function startTrans() {\n        $this->commit();\n        $this->db->startTrans();\n        return ;\n    }\n\n    /**\n     * 提交事务\n     * @access public\n     * @return boolean\n     */\n    public function commit() {\n        return $this->db->commit();\n    }\n\n    /**\n     * 事务回滚\n     * @access public\n     * @return boolean\n     */\n    public function rollback() {\n        return $this->db->rollback();\n    }\n\n    /**\n     * 返回模型的错误信息\n     * @access public\n     * @return string\n     */\n    public function getError(){\n        return $this->error;\n    }\n\n    /**\n     * 返回数据库的错误信息\n     * @access public\n     * @return string\n     */\n    public function getDbError() {\n        return $this->db->getError();\n    }\n\n    /**\n     * 返回最后插入的ID\n     * @access public\n     * @return string\n     */\n    public function getLastInsID() {\n        return $this->db->getLastInsID();\n    }\n\n    /**\n     * 返回最后执行的sql语句\n     * @access public\n     * @return string\n     */\n    public function getLastSql() {\n        return $this->db->getLastSql($this->name);\n    }\n    // 鉴于getLastSql比较常用 增加_sql 别名\n    public function _sql(){\n        return $this->getLastSql();\n    }\n\n    /**\n     * 获取主键名称\n     * @access public\n     * @return string\n     */\n    public function getPk() {\n        return $this->pk;\n    }\n\n    /**\n     * 获取数据表字段信息\n     * @access public\n     * @return array\n     */\n    public function getDbFields(){\n        if(isset($this->options['table'])) {// 动态指定表名\n            if(is_array($this->options['table'])){\n                $table  =   key($this->options['table']);\n            }else{\n                $table  =   $this->options['table'];\n                if(strpos($table,')')){\n                    // 子查询\n                    return false;\n                }\n            }\n            $fields     =   $this->db->getFields($table);\n            return  $fields ? array_keys($fields) : false;\n        }\n        if($this->fields) {\n            $fields     =  $this->fields;\n            unset($fields['_type'],$fields['_pk']);\n            return $fields;\n        }\n        return false;\n    }\n\n    /**\n     * 设置数据对象值\n     * @access public\n     * @param mixed $data 数据\n     * @return Model\n     */\n    public function data($data=''){\n        if('' === $data && !empty($this->data)) {\n            return $this->data;\n        }\n        if(is_object($data)){\n            $data   =   get_object_vars($data);\n        }elseif(is_string($data)){\n            parse_str($data,$data);\n        }elseif(!is_array($data)){\n            E(L('_DATA_TYPE_INVALID_'));\n        }\n        $this->data = $data;\n        return $this;\n    }\n\n    /**\n     * 指定当前的数据表\n     * @access public\n     * @param mixed $table\n     * @return Model\n     */\n    public function table($table) {\n        $prefix =   $this->tablePrefix;\n        if(is_array($table)) {\n            $this->options['table'] =   $table;\n        }elseif(!empty($table)) {\n            //将__TABLE_NAME__替换成带前缀的表名\n            $table  = preg_replace_callback(\"/__([A-Z0-9_-]+)__/sU\", function($match) use($prefix){ return $prefix.strtolower($match[1]);}, $table);\n            $this->options['table'] =   $table;\n        }\n        return $this;\n    }\n\n    /**\n     * USING支持 用于多表删除\n     * @access public\n     * @param mixed $using\n     * @return Model\n     */\n    public function using($using){\n        $prefix =   $this->tablePrefix;\n        if(is_array($using)) {\n            $this->options['using'] =   $using;\n        }elseif(!empty($using)) {\n            //将__TABLE_NAME__替换成带前缀的表名\n            $using  = preg_replace_callback(\"/__([A-Z0-9_-]+)__/sU\", function($match) use($prefix){ return $prefix.strtolower($match[1]);}, $using);\n            $this->options['using'] =   $using;\n        }\n        return $this;\n    }\n\n    /**\n     * 查询SQL组装 join\n     * @access public\n     * @param mixed $join\n     * @param string $type JOIN类型\n     * @return Model\n     */\n    public function join($join,$type='INNER') {\n        $prefix =   $this->tablePrefix;\n        if(is_array($join)) {\n            foreach ($join as $key=>&$_join){\n                $_join  =   preg_replace_callback(\"/__([A-Z0-9_-]+)__/sU\", function($match) use($prefix){ return $prefix.strtolower($match[1]);}, $_join);\n                $_join  =   false !== stripos($_join,'JOIN')? $_join : $type.' JOIN ' .$_join;\n            }\n            $this->options['join']      =   $join;\n        }elseif(!empty($join)) {\n            //将__TABLE_NAME__字符串替换成带前缀的表名\n            $join  = preg_replace_callback(\"/__([A-Z0-9_-]+)__/sU\", function($match) use($prefix){ return $prefix.strtolower($match[1]);}, $join);\n            $this->options['join'][]    =   false !== stripos($join,'JOIN')? $join : $type.' JOIN '.$join;\n        }\n        return $this;\n    }\n\n    /**\n     * 查询SQL组装 union\n     * @access public\n     * @param mixed $union\n     * @param boolean $all\n     * @return Model\n     */\n    public function union($union,$all=false) {\n        if(empty($union)) return $this;\n        if($all) {\n            $this->options['union']['_all']  =   true;\n        }\n        if(is_object($union)) {\n            $union   =  get_object_vars($union);\n        }\n        // 转换union表达式\n        if(is_string($union) ) {\n            $prefix =   $this->tablePrefix;\n            //将__TABLE_NAME__字符串替换成带前缀的表名\n            $options  = preg_replace_callback(\"/__([A-Z0-9_-]+)__/sU\", function($match) use($prefix){ return $prefix.strtolower($match[1]);}, $union);\n        }elseif(is_array($union)){\n            if(isset($union[0])) {\n                $this->options['union']  =  array_merge($this->options['union'],$union);\n                return $this;\n            }else{\n                $options =  $union;\n            }\n        }else{\n            E(L('_DATA_TYPE_INVALID_'));\n        }\n        $this->options['union'][]  =   $options;\n        return $this;\n    }\n\n    /**\n     * 查询缓存\n     * @access public\n     * @param mixed $key\n     * @param integer $expire\n     * @param string $type\n     * @return Model\n     */\n    public function cache($key=true,$expire=null,$type=''){\n        // 增加快捷调用方式 cache(10) 等同于 cache(true, 10)\n        if(is_numeric($key) && is_null($expire)){\n            $expire = $key;\n            $key    = true;\n        }\n        if(false !== $key)\n            $this->options['cache']  =  array('key'=>$key,'expire'=>$expire,'type'=>$type);\n        return $this;\n    }\n\n    /**\n     * 指定查询字段 支持字段排除\n     * @access public\n     * @param mixed $field\n     * @param boolean $except 是否排除\n     * @return Model\n     */\n    public function field($field,$except=false){\n        if(true === $field) {// 获取全部字段\n            $fields     =  $this->getDbFields();\n            $field      =  $fields?:'*';\n        }elseif($except) {// 字段排除\n            if(is_string($field)) {\n                $field  =  explode(',',$field);\n            }\n            $fields     =  $this->getDbFields();\n            $field      =  $fields?array_diff($fields,$field):$field;\n        }\n        $this->options['field']   =   $field;\n        return $this;\n    }\n\n    /**\n     * 调用命名范围\n     * @access public\n     * @param mixed $scope 命名范围名称 支持多个 和直接定义\n     * @param array $args 参数\n     * @return Model\n     */\n    public function scope($scope='',$args=NULL){\n        if('' === $scope) {\n            if(isset($this->_scope['default'])) {\n                // 默认的命名范围\n                $options    =   $this->_scope['default'];\n            }else{\n                return $this;\n            }\n        }elseif(is_string($scope)){ // 支持多个命名范围调用 用逗号分割\n            $scopes         =   explode(',',$scope);\n            $options        =   array();\n            foreach ($scopes as $name){\n                if(!isset($this->_scope[$name])) continue;\n                $options    =   array_merge($options,$this->_scope[$name]);\n            }\n            if(!empty($args) && is_array($args)) {\n                $options    =   array_merge($options,$args);\n            }\n        }elseif(is_array($scope)){ // 直接传入命名范围定义\n            $options        =   $scope;\n        }\n        \n        if(is_array($options) && !empty($options)){\n            $this->options  =   array_merge($this->options,array_change_key_case($options));\n        }\n        return $this;\n    }\n\n    /**\n     * 指定查询条件 支持安全过滤\n     * @access public\n     * @param mixed $where 条件表达式\n     * @param mixed $parse 预处理参数\n     * @return Model\n     */\n    public function where($where,$parse=null){\n        if(!is_null($parse) && is_string($where)) {\n            if(!is_array($parse)) {\n                $parse = func_get_args();\n                array_shift($parse);\n            }\n            $parse = array_map(array($this->db,'escapeString'),$parse);\n            $where =   vsprintf($where,$parse);\n        }elseif(is_object($where)){\n            $where  =   get_object_vars($where);\n        }\n        if(is_string($where) && '' != $where){\n            $map    =   array();\n            $map['_string']   =   $where;\n            $where  =   $map;\n        }        \n        if(isset($this->options['where'])){\n            $this->options['where'] =   array_merge($this->options['where'],$where);\n        }else{\n            $this->options['where'] =   $where;\n        }\n        \n        return $this;\n    }\n\n    /**\n     * 指定查询数量\n     * @access public\n     * @param mixed $offset 起始位置\n     * @param mixed $length 查询数量\n     * @return Model\n     */\n    public function limit($offset,$length=null){\n        if(is_null($length) && strpos($offset,',')){\n            list($offset,$length)   =   explode(',',$offset);\n        }\n        $this->options['limit']     =   intval($offset).( $length? ','.intval($length) : '' );\n        return $this;\n    }\n\n    /**\n     * 指定分页\n     * @access public\n     * @param mixed $page 页数\n     * @param mixed $listRows 每页数量\n     * @return Model\n     */\n    public function page($page,$listRows=null){\n        if(is_null($listRows) && strpos($page,',')){\n            list($page,$listRows)   =   explode(',',$page);\n        }\n        $this->options['page']      =   array(intval($page),intval($listRows));\n        return $this;\n    }\n\n    /**\n     * 查询注释\n     * @access public\n     * @param string $comment 注释\n     * @return Model\n     */\n    public function comment($comment){\n        $this->options['comment'] =   $comment;\n        return $this;\n    }\n\n    /**\n     * 获取执行的SQL语句\n     * @access public\n     * @param boolean $fetch 是否返回sql\n     * @return Model\n     */\n    public function fetchSql($fetch=true){\n        $this->options['fetch_sql'] =   $fetch;\n        return $this;\n    }\n\n    /**\n     * 参数绑定\n     * @access public\n     * @param string $key  参数名\n     * @param mixed $value  绑定的变量及绑定参数\n     * @return Model\n     */\n    public function bind($key,$value=false) {\n        if(is_array($key)){\n            $this->options['bind'] =    $key;\n        }else{\n            $num =  func_num_args();\n            if($num>2){\n                $params =   func_get_args();\n                array_shift($params);\n                $this->options['bind'][$key] =  $params;\n            }else{\n                $this->options['bind'][$key] =  $value;\n            }        \n        }\n        return $this;\n    }\n\n    /**\n     * 设置模型的属性值\n     * @access public\n     * @param string $name 名称\n     * @param mixed $value 值\n     * @return Model\n     */\n    public function setProperty($name,$value) {\n        if(property_exists($this,$name))\n            $this->$name = $value;\n        return $this;\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Page.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>\n// +----------------------------------------------------------------------\nnamespace Think;\n\nclass Page{\n    public $firstRow; // 起始行数\n    public $listRows; // 列表每页显示行数\n    public $parameter; // 分页跳转时要带的参数\n    public $totalRows; // 总行数\n    public $totalPages; // 分页总页面数\n    public $rollPage   = 11;// 分页栏每页显示的页数\n\tpublic $lastSuffix = true; // 最后一页是否显示总页数\n\n    private $p       = 'p'; //分页参数名\n    private $url     = ''; //当前链接URL\n    private $nowPage = 1;\n\n\t// 分页显示定制\n    private $config  = array(\n        'header' => '<span class=\"rows\">共 %TOTAL_ROW% 条记录</span>',\n        'prev'   => '<<',\n        'next'   => '>>',\n        'first'  => '1...',\n        'last'   => '...%TOTAL_PAGE%',\n        'theme'  => '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END%',\n    );\n\n    /**\n     * 架构函数\n     * @param array $totalRows  总的记录数\n     * @param array $listRows  每页显示记录数\n     * @param array $parameter  分页跳转的参数\n     */\n    public function __construct($totalRows, $listRows=20, $parameter = array()) {\n        C('VAR_PAGE') && $this->p = C('VAR_PAGE'); //设置分页参数名称\n        /* 基础设置 */\n        $this->totalRows  = $totalRows; //设置总记录数\n        $this->listRows   = $listRows;  //设置每页显示行数\n        $this->parameter  = empty($parameter) ? $_GET : $parameter;\n        $this->nowPage    = empty($_GET[$this->p]) ? 1 : intval($_GET[$this->p]);\n        $this->nowPage    = $this->nowPage>0 ? $this->nowPage : 1;\n        $this->firstRow   = $this->listRows * ($this->nowPage - 1);\n    }\n\n    /**\n     * 定制分页链接设置\n     * @param string $name  设置名称\n     * @param string $value 设置值\n     */\n    public function setConfig($name,$value) {\n        if(isset($this->config[$name])) {\n            $this->config[$name] = $value;\n        }\n    }\n\n    /**\n     * 生成链接URL\n     * @param  integer $page 页码\n     * @return string\n     */\n    private function url($page){\n        return str_replace(urlencode('[PAGE]'), $page, $this->url);\n    }\n\n    /**\n     * 组装分页链接\n     * @return string\n     */\n    public function show() {\n        if(0 == $this->totalRows) return '';\n\n        /* 生成URL */\n        $this->parameter[$this->p] = '[PAGE]';\n        $this->url = U(ACTION_NAME, $this->parameter);\n        /* 计算分页信息 */\n        $this->totalPages = ceil($this->totalRows / $this->listRows); //总页数\n        if(!empty($this->totalPages) && $this->nowPage > $this->totalPages) {\n            $this->nowPage = $this->totalPages;\n        }\n\n        /* 计算分页临时变量 */\n        $now_cool_page      = $this->rollPage/2;\n\t\t$now_cool_page_ceil = ceil($now_cool_page);\n\t\t$this->lastSuffix && $this->config['last'] = $this->totalPages;\n\n        //上一页\n        $up_row  = $this->nowPage - 1;\n        $up_page = $up_row > 0 ? '<a class=\"prev\" href=\"' . $this->url($up_row) . '\">' . $this->config['prev'] . '</a>' : '';\n\n        //下一页\n        $down_row  = $this->nowPage + 1;\n        $down_page = ($down_row <= $this->totalPages) ? '<a class=\"next\" href=\"' . $this->url($down_row) . '\">' . $this->config['next'] . '</a>' : '';\n\n        //第一页\n        $the_first = '';\n        if($this->totalPages > $this->rollPage && ($this->nowPage - $now_cool_page) >= 1){\n            $the_first = '<a class=\"first\" href=\"' . $this->url(1) . '\">' . $this->config['first'] . '</a>';\n        }\n\n        //最后一页\n        $the_end = '';\n        if($this->totalPages > $this->rollPage && ($this->nowPage + $now_cool_page) < $this->totalPages){\n            $the_end = '<a class=\"end\" href=\"' . $this->url($this->totalPages) . '\">' . $this->config['last'] . '</a>';\n        }\n\n        //数字连接\n        $link_page = \"\";\n        for($i = 1; $i <= $this->rollPage; $i++){\n\t\t\tif(($this->nowPage - $now_cool_page) <= 0 ){\n\t\t\t\t$page = $i;\n\t\t\t}elseif(($this->nowPage + $now_cool_page - 1) >= $this->totalPages){\n\t\t\t\t$page = $this->totalPages - $this->rollPage + $i;\n\t\t\t}else{\n\t\t\t\t$page = $this->nowPage - $now_cool_page_ceil + $i;\n\t\t\t}\n            if($page > 0 && $page != $this->nowPage){\n\n                if($page <= $this->totalPages){\n                    $link_page .= '<a class=\"num\" href=\"' . $this->url($page) . '\">' . $page . '</a>';\n                }else{\n                    break;\n                }\n            }else{\n                if($page > 0 && $this->totalPages != 1){\n                    $link_page .= '<span class=\"current\">' . $page . '</span>';\n                }\n            }\n        }\n\n        //替换分页内容\n        $page_str = str_replace(\n            array('%HEADER%', '%NOW_PAGE%', '%UP_PAGE%', '%DOWN_PAGE%', '%FIRST%', '%LINK_PAGE%', '%END%', '%TOTAL_ROW%', '%TOTAL_PAGE%'),\n            array($this->config['header'], $this->nowPage, $up_page, $down_page, $the_first, $link_page, $the_end, $this->totalRows, $this->totalPages),\n            $this->config['theme']);\n        return \"<div>{$page_str}</div>\";\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Route.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * ThinkPHP路由解析类\n */\nclass Route {\n    \n    // 路由检测\n    public static function check(){\n        $depr   =   C('URL_PATHINFO_DEPR');\n        $regx   =   preg_replace('/\\.'.__EXT__.'$/i','',trim($_SERVER['PATH_INFO'],$depr));\n        // 分隔符替换 确保路由定义使用统一的分隔符\n        if('/' != $depr){\n            $regx = str_replace($depr,'/',$regx);\n        }\n        // URL映射定义（静态路由）\n        $maps   =   C('URL_MAP_RULES');\n        if(isset($maps[$regx])) {\n            $var    =   self::parseUrl($maps[$regx]);\n            $_GET   =   array_merge($var, $_GET);\n            return true;                \n        }        \n        // 动态路由处理\n        $routes =   C('URL_ROUTE_RULES');\n        if(!empty($routes)) {\n            foreach ($routes as $rule=>$route){\n                if(is_numeric($rule)){\n                    // 支持 array('rule','adddress',...) 定义路由\n                    $rule   =   array_shift($route);\n                }\n                if(is_array($route) && isset($route[2])){\n                    // 路由参数\n                    $options    =   $route[2];\n                    if(isset($options['ext']) && __EXT__ != $options['ext']){\n                        // URL后缀检测\n                        continue;\n                    }\n                    if(isset($options['method']) && REQUEST_METHOD != strtoupper($options['method'])){\n                        // 请求类型检测\n                        continue;\n                    }\n                    // 自定义检测\n                    if(!empty($options['callback']) && is_callable($options['callback'])) {\n                        if(false === call_user_func($options['callback'])) {\n                            continue;\n                        }\n                    }                    \n                }\n                if(0===strpos($rule,'/') && preg_match($rule,$regx,$matches)) { // 正则路由\n                    if($route instanceof \\Closure) {\n                        // 执行闭包\n                        $result = self::invokeRegx($route, $matches);\n                        // 如果返回布尔值 则继续执行\n                        return is_bool($result) ? $result : exit;\n                    }else{\n                        return self::parseRegex($matches,$route,$regx);\n                    }\n                }else{ // 规则路由\n                    $len1   =   substr_count($regx,'/');\n                    $len2   =   substr_count($rule,'/');\n                    if($len1>=$len2 || strpos($rule,'[')) {\n                        if('$' == substr($rule,-1,1)) {// 完整匹配\n                            if($len1 != $len2) {\n                                continue;\n                            }else{\n                                $rule =  substr($rule,0,-1);\n                            }\n                        }\n                        $match  =  self::checkUrlMatch($regx,$rule);\n                        if(false !== $match)  {\n                            if($route instanceof \\Closure) {\n                                // 执行闭包\n                                $result = self::invokeRule($route, $match);\n                                // 如果返回布尔值 则继续执行\n                                return is_bool($result) ? $result : exit;\n                            }else{\n                                return self::parseRule($rule,$route,$regx);\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        return false;\n    }\n\n    // 检测URL和规则路由是否匹配\n    private static function checkUrlMatch($regx,$rule) {\n        $m1 = explode('/',$regx);\n        $m2 = explode('/',$rule);\n        $var = array();         \n        foreach ($m2 as $key=>$val){\n            if(0 === strpos($val,'[:')){\n                $val    =   substr($val,1,-1);\n            }\n                \n            if(':' == substr($val,0,1)) {// 动态变量\n                if($pos = strpos($val,'|')){\n                    // 使用函数过滤\n                    $val   =   substr($val,1,$pos-1);\n                }\n                if(strpos($val,'\\\\')) {\n                    $type = substr($val,-1);\n                    if('d'==$type) {\n                        if(isset($m1[$key]) && !is_numeric($m1[$key]))\n                            return false;\n                    }\n                    $name = substr($val, 1, -2);\n                }elseif($pos = strpos($val,'^')){\n                    $array   =  explode('-',substr(strstr($val,'^'),1));\n                    if(in_array($m1[$key],$array)) {\n                        return false;\n                    }\n                    $name = substr($val, 1, $pos - 1);\n                }else{\n                    $name = substr($val, 1);\n                }\n                $var[$name] = isset($m1[$key])?$m1[$key]:'';\n            }elseif(0 !== strcasecmp($val,$m1[$key])){\n                return false;\n            }\n        }\n        // 成功匹配后返回URL中的动态变量数组\n        return $var;\n    }\n\n    // 解析规范的路由地址\n    // 地址格式 [控制器/操作?]参数1=值1&参数2=值2...\n    private static function parseUrl($url) {\n        $var  =  array();\n        if(false !== strpos($url,'?')) { // [控制器/操作?]参数1=值1&参数2=值2...\n            $info   =  parse_url($url);\n            $path   = explode('/',$info['path']);\n            parse_str($info['query'],$var);\n        }elseif(strpos($url,'/')){ // [控制器/操作]\n            $path = explode('/',$url);\n        }else{ // 参数1=值1&参数2=值2...\n            parse_str($url,$var);\n        }\n        if(isset($path)) {\n            $var[C('VAR_ACTION')] = array_pop($path);\n            if(!empty($path)) {\n                $var[C('VAR_CONTROLLER')] = array_pop($path);\n            }\n            if(!empty($path)) {\n                $var[C('VAR_MODULE')]  = array_pop($path);\n            }\n        }\n        return $var;\n    }\n\n    // 解析规则路由\n    // '路由规则'=>'[控制器/操作]?额外参数1=值1&额外参数2=值2...'\n    // '路由规则'=>array('[控制器/操作]','额外参数1=值1&额外参数2=值2...')\n    // '路由规则'=>'外部地址'\n    // '路由规则'=>array('外部地址','重定向代码')\n    // 路由规则中 :开头 表示动态变量\n    // 外部地址中可以用动态变量 采用 :1 :2 的方式\n    // 'news/:month/:day/:id'=>array('News/read?cate=1','status=1'),\n    // 'new/:id'=>array('/new.php?id=:1',301), 重定向\n    private static function parseRule($rule,$route,$regx) {\n        // 获取路由地址规则\n        $url   =  is_array($route)?$route[0]:$route;\n        // 获取URL地址中的参数\n        $paths = explode('/',$regx);\n        // 解析路由规则\n        $matches  =  array();\n        $rule =  explode('/',$rule);\n        foreach ($rule as $item){\n            $fun    =   '';\n            if(0 === strpos($item,'[:')){\n                $item   =   substr($item,1,-1);\n            }\n            if(0===strpos($item,':')) { // 动态变量获取\n                if($pos = strpos($item,'|')){ \n                    // 支持函数过滤\n                    $fun  =  substr($item,$pos+1);\n                    $item =  substr($item,0,$pos);                    \n                }\n                if($pos = strpos($item,'^') ) {\n                    $var  =  substr($item,1,$pos-1);\n                }elseif(strpos($item,'\\\\')){\n                    $var  =  substr($item,1,-2);\n                }else{\n                    $var  =  substr($item,1);\n                }\n                $matches[$var] = !empty($fun)? $fun(array_shift($paths)) : array_shift($paths);\n            }else{ // 过滤URL中的静态变量\n                array_shift($paths);\n            }\n        }\n\n        if(0=== strpos($url,'/') || 0===strpos($url,'http')) { // 路由重定向跳转\n            if(strpos($url,':')) { // 传递动态参数\n                $values = array_values($matches);\n                $url = preg_replace_callback('/:(\\d+)/', function($match) use($values){ return $values[$match[1] - 1]; }, $url);\n            }\n            header(\"Location: $url\", true,(is_array($route) && isset($route[1]))?$route[1]:301);\n            exit;\n        }else{\n            // 解析路由地址\n            $var  =  self::parseUrl($url);\n            // 解析路由地址里面的动态参数\n            $values  =  array_values($matches);\n            foreach ($var as $key=>$val){\n                if(0===strpos($val,':')) {\n                    $var[$key] =  $values[substr($val,1)-1];\n                }\n            }\n            $var   =   array_merge($matches,$var);\n            // 解析剩余的URL参数\n            if(!empty($paths)) {\n                preg_replace_callback('/(\\w+)\\/([^\\/]+)/', function($match) use(&$var){ $var[strtolower($match[1])]=strip_tags($match[2]);}, implode('/',$paths));\n            }\n            // 解析路由自动传入参数\n            if(is_array($route) && isset($route[1])) {\n                if(is_array($route[1])){\n                    $params     =   $route[1];\n                }else{\n                    parse_str($route[1],$params);\n                }                \n                $var   =   array_merge($var,$params);\n            }\n            $_GET   =  array_merge($var,$_GET);\n        }\n        return true;\n    }\n\n    // 解析正则路由\n    // '路由正则'=>'[控制器/操作]?参数1=值1&参数2=值2...'\n    // '路由正则'=>array('[控制器/操作]?参数1=值1&参数2=值2...','额外参数1=值1&额外参数2=值2...')\n    // '路由正则'=>'外部地址'\n    // '路由正则'=>array('外部地址','重定向代码')\n    // 参数值和外部地址中可以用动态变量 采用 :1 :2 的方式\n    // '/new\\/(\\d+)\\/(\\d+)/'=>array('News/read?id=:1&page=:2&cate=1','status=1'),\n    // '/new\\/(\\d+)/'=>array('/new.php?id=:1&page=:2&status=1','301'), 重定向\n    private static function parseRegex($matches,$route,$regx) {\n        // 获取路由地址规则\n        $url   =  is_array($route)?$route[0]:$route;\n        $url   =  preg_replace_callback('/:(\\d+)/', function($match) use($matches){return $matches[$match[1]];}, $url); \n        if(0=== strpos($url,'/') || 0===strpos($url,'http')) { // 路由重定向跳转\n            header(\"Location: $url\", true,(is_array($route) && isset($route[1]))?$route[1]:301);\n            exit;\n        }else{\n            // 解析路由地址\n            $var  =  self::parseUrl($url);\n            // 处理函数\n            foreach($var as $key=>$val){\n                if(strpos($val,'|')){\n                    list($val,$fun) = explode('|',$val);\n                    $var[$key]    =   $fun($val);\n                }\n            }\n            // 解析剩余的URL参数\n            $regx =  substr_replace($regx,'',0,strlen($matches[0]));\n            if($regx) {\n                preg_replace_callback('/(\\w+)\\/([^\\/]+)/', function($match) use(&$var){\n                    $var[strtolower($match[1])] = strip_tags($match[2]);\n                }, $regx);\n            }\n            // 解析路由自动传入参数\n            if(is_array($route) && isset($route[1])) {\n                if(is_array($route[1])){\n                    $params     =   $route[1];\n                }else{\n                    parse_str($route[1],$params);\n                }\n                $var   =   array_merge($var,$params);\n            }\n            $_GET   =  array_merge($var,$_GET);\n        }\n        return true;\n    }\n\n    // 执行正则匹配下的闭包方法 支持参数调用\n    static private function invokeRegx($closure, $var = array()) {\n        $reflect = new \\ReflectionFunction($closure);\n        $params  = $reflect->getParameters();\n        $args    = array();\n        array_shift($var);\n        foreach ($params as $param){\n            if(!empty($var)) {\n                $args[] = array_shift($var);\n            }elseif($param->isDefaultValueAvailable()){\n                $args[] = $param->getDefaultValue();\n            }\n        }\n        return $reflect->invokeArgs($args);\n    }\n\n    // 执行规则匹配下的闭包方法 支持参数调用\n    static private function invokeRule($closure, $var = array()) {\n        $reflect = new \\ReflectionFunction($closure);\n        $params  = $reflect->getParameters();\n        $args    = array();\n        foreach ($params as $param){\n            $name = $param->getName();\n            if(isset($var[$name])) {\n                $args[] = $var[$name];\n            }elseif($param->isDefaultValueAvailable()){\n                $args[] = $param->getDefaultValue();\n            }\n        }\n        return $reflect->invokeArgs($args);\n    }\n\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Session/Driver/Db.class.php",
    "content": "<?php \n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Session\\Driver;\n/**\n * 数据库方式Session驱动\n *    CREATE TABLE think_session (\n *      session_id varchar(255) NOT NULL,\n *      session_expire int(11) NOT NULL,\n *      session_data blob,\n *      UNIQUE KEY `session_id` (`session_id`)\n *    );\n */\nclass Db {\n\n    /**\n     * Session有效时间\n     */\n   protected $lifeTime      = ''; \n\n    /**\n     * session保存的数据库名\n     */\n   protected $sessionTable  = '';\n\n    /**\n     * 数据库句柄\n     */\n   protected $hander  = array(); \n\n    /**\n     * 打开Session \n     * @access public \n     * @param string $savePath \n     * @param mixed $sessName  \n     */\n    public function open($savePath, $sessName) { \n       $this->lifeTime \t\t= \tC('SESSION_EXPIRE')?C('SESSION_EXPIRE'):ini_get('session.gc_maxlifetime');\n       $this->sessionTable  =   C('SESSION_TABLE')?C('SESSION_TABLE'):C(\"DB_PREFIX\").\"session\";\n       //分布式数据库\n       $host = explode(',',C('DB_HOST'));\n       $port = explode(',',C('DB_PORT'));\n       $name = explode(',',C('DB_NAME'));\n       $user = explode(',',C('DB_USER'));\n       $pwd  = explode(',',C('DB_PWD'));\n       if(1 == C('DB_DEPLOY_TYPE')){\n           //读写分离\n           if(C('DB_RW_SEPARATE')){\n               $w = floor(mt_rand(0,C('DB_MASTER_NUM')-1));\n               if(is_numeric(C('DB_SLAVE_NO'))){//指定服务器读\n                   $r = C('DB_SLAVE_NO');\n               }else{\n                   $r = floor(mt_rand(C('DB_MASTER_NUM'),count($host)-1));\n               }\n               //主数据库链接\n               $hander = mysql_connect(\n                   $host[$w].(isset($port[$w])?':'.$port[$w]:':'.$port[0]),\n                   isset($user[$w])?$user[$w]:$user[0],\n                   isset($pwd[$w])?$pwd[$w]:$pwd[0]\n                   );\n               $dbSel = mysql_select_db(\n                   isset($name[$w])?$name[$w]:$name[0]\n                   ,$hander);\n               if(!$hander || !$dbSel)\n                   return false;\n               $this->hander[0] = $hander;\n               //从数据库链接\n               $hander = mysql_connect(\n                   $host[$r].(isset($port[$r])?':'.$port[$r]:':'.$port[0]),\n                   isset($user[$r])?$user[$r]:$user[0],\n                   isset($pwd[$r])?$pwd[$r]:$pwd[0]\n                   );\n               $dbSel = mysql_select_db(\n                   isset($name[$r])?$name[$r]:$name[0]\n                   ,$hander);\n               if(!$hander || !$dbSel)\n                   return false;\n               $this->hander[1] = $hander;\n               return true;\n           }\n       }\n       //从数据库链接\n       $r = floor(mt_rand(0,count($host)-1));\n       $hander = mysql_connect(\n           $host[$r].(isset($port[$r])?':'.$port[$r]:':'.$port[0]),\n           isset($user[$r])?$user[$r]:$user[0],\n           isset($pwd[$r])?$pwd[$r]:$pwd[0]\n           );\n       $dbSel = mysql_select_db(\n           isset($name[$r])?$name[$r]:$name[0]\n           ,$hander);\n       if(!$hander || !$dbSel) \n           return false; \n       $this->hander = $hander; \n       return true; \n    } \n\n    /**\n     * 关闭Session \n     * @access public \n     */\n   public function close() {\n       if(is_array($this->hander)){\n           $this->gc($this->lifeTime);\n           return (mysql_close($this->hander[0]) && mysql_close($this->hander[1]));\n       }\n       $this->gc($this->lifeTime); \n       return mysql_close($this->hander); \n   } \n\n    /**\n     * 读取Session \n     * @access public \n     * @param string $sessID \n     */\n   public function read($sessID) { \n       $hander \t= \tis_array($this->hander)?$this->hander[1]:$this->hander;\n       $res \t= \tmysql_query('SELECT session_data AS data FROM '.$this->sessionTable.\" WHERE session_id = '$sessID'   AND session_expire >\".time(),$hander); \n       if($res) {\n           $row = \tmysql_fetch_assoc($res);\n           return $row['data']; \n       }\n       return \"\"; \n   } \n\n    /**\n     * 写入Session \n     * @access public \n     * @param string $sessID \n     * @param String $sessData  \n     */\n   public function write($sessID,$sessData) { \n       $hander \t\t= \tis_array($this->hander)?$this->hander[0]:$this->hander;\n       $expire \t\t= \ttime() + $this->lifeTime; \n       $sessData \t= \taddslashes($sessData);\n       mysql_query('REPLACE INTO  '.$this->sessionTable.\" (  session_id, session_expire, session_data)  VALUES( '$sessID', '$expire',  '$sessData')\",$hander); \n       if(mysql_affected_rows($hander)) \n           return true; \n       return false; \n   } \n\n    /**\n     * 删除Session \n     * @access public \n     * @param string $sessID \n     */\n   public function destroy($sessID) { \n       $hander \t= \tis_array($this->hander)?$this->hander[0]:$this->hander;\n       mysql_query('DELETE FROM '.$this->sessionTable.\" WHERE session_id = '$sessID'\",$hander); \n       if(mysql_affected_rows($hander)) \n           return true; \n       return false; \n   } \n\n    /**\n     * Session 垃圾回收\n     * @access public \n     * @param string $sessMaxLifeTime \n     */\n   public function gc($sessMaxLifeTime) { \n       $hander = \tis_array($this->hander)?$this->hander[0]:$this->hander;\n       mysql_query('DELETE FROM '.$this->sessionTable.' WHERE session_expire < '.time(),$hander); \n       return mysql_affected_rows($hander); \n   } \n\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Session/Driver/Memcache.class.php",
    "content": "<?php\nnamespace Think\\Session\\Driver;\n\nclass Memcache {\n\tprotected $lifeTime     = 3600;\n\tprotected $sessionName  = '';\n\tprotected $handle       = null;\n\n    /**\n     * 打开Session \n     * @access public \n     * @param string $savePath \n     * @param mixed $sessName  \n     */\n\tpublic function open($savePath, $sessName) {\n\t\t$this->lifeTime     = C('SESSION_EXPIRE') ? C('SESSION_EXPIRE') : $this->lifeTime;\n\t\t// $this->sessionName  = $sessName;\n        $options            = array(\n            'timeout'       => C('SESSION_TIMEOUT') ? C('SESSION_TIMEOUT') : 1,\n            'persistent'    => C('SESSION_PERSISTENT') ? C('SESSION_PERSISTENT') : 0\n        );\n\t\t$this->handle       = new \\Memcache;\n        $hosts              = explode(',', C('MEMCACHE_HOST'));\n        $ports              = explode(',', C('MEMCACHE_PORT'));\n        foreach ($hosts as $i=>$host) {\n            $port           = isset($ports[$i]) ? $ports[$i] : $ports[0];\n            $this->handle->addServer($host, $port, true, 1, $options['timeout']);\n        }\n\t\treturn true;\n\t}\n\n    /**\n     * 关闭Session \n     * @access public \n     */\n\tpublic function close() {\n\t\t$this->gc(ini_get('session.gc_maxlifetime'));\n\t\t$this->handle->close();\n\t\t$this->handle       = null;\n\t\treturn true;\n\t}\n\n    /**\n     * 读取Session \n     * @access public \n     * @param string $sessID \n     */\n\tpublic function read($sessID) {\n        return $this->handle->get($this->sessionName.$sessID);\n\t}\n\n    /**\n     * 写入Session \n     * @access public \n     * @param string $sessID \n     * @param String $sessData  \n     */\n\tpublic function write($sessID, $sessData) {\n\t\treturn $this->handle->set($this->sessionName.$sessID, $sessData, 0, $this->lifeTime);\n\t}\n\n    /**\n     * 删除Session \n     * @access public \n     * @param string $sessID \n     */\n\tpublic function destroy($sessID) {\n\t\treturn $this->handle->delete($this->sessionName.$sessID);\n\t}\n\n    /**\n     * Session 垃圾回收\n     * @access public \n     * @param string $sessMaxLifeTime \n     */\n\tpublic function gc($sessMaxLifeTime) {\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Session/Driver/Mysqli.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: hainuo<admin@hainuo.info> liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n// | change  mysql to mysqli  解决php7没有mysql扩展时数据库存放session无法操作的问题\n// +----------------------------------------------------------------------\nnamespace Think\\Session\\Driver;\n/**\n * 数据库方式Session驱动\n *    CREATE TABLE think_session (\n *      session_id varchar(255) NOT NULL,\n *      session_expire int(11) NOT NULL,\n *      session_data blob,\n *      UNIQUE KEY `session_id` (`session_id`)\n *    );\n */\nclass Db\n{\n\n    /**\n     * Session有效时间\n     */\n    protected $lifeTime = '';\n\n    /**\n     * session保存的数据库名\n     */\n    protected $sessionTable = '';\n\n    /**\n     * 数据库句柄\n     */\n    protected $hander = array();\n\n    /**\n     * 打开Session\n     * @access public\n     * @param string $savePath\n     * @param mixed $sessName\n     */\n    public function open($savePath, $sessName)\n    {\n        $this->lifeTime = C('SESSION_EXPIRE') ? C('SESSION_EXPIRE') : ini_get('session.gc_maxlifetime');\n        $this->sessionTable = C('SESSION_TABLE') ? C('SESSION_TABLE') : C(\"DB_PREFIX\") . \"session\";\n        //分布式数据库\n        $host = explode(',', C('DB_HOST'));\n        $port = explode(',', C('DB_PORT'));\n        $name = explode(',', C('DB_NAME'));\n        $user = explode(',', C('DB_USER'));\n        $pwd = explode(',', C('DB_PWD'));\n        if (1 == C('DB_DEPLOY_TYPE')) {\n            //读写分离\n            if (C('DB_RW_SEPARATE')) {\n                $w = floor(mt_rand(0, C('DB_MASTER_NUM') - 1));\n                if (is_numeric(C('DB_SLAVE_NO'))) {//指定服务器读\n                    $r = C('DB_SLAVE_NO');\n                } else {\n                    $r = floor(mt_rand(C('DB_MASTER_NUM'), count($host) - 1));\n                }\n                //主数据库链接\n                $hander = mysqli_connect(\n                    $host[$w] . (isset($port[$w]) ? ':' . $port[$w] : ':' . $port[0]),\n                    isset($user[$w]) ? $user[$w] : $user[0],\n                    isset($pwd[$w]) ? $pwd[$w] : $pwd[0]\n                );\n                $dbSel = mysqli_select_db(\n                    $hander,\n                    isset($name[$w]) ? $name[$w] : $name[0]\n                );\n                if (!$hander || !$dbSel)\n                    return false;\n                $this->hander[0] = $hander;\n                //从数据库链接\n                $hander = mysqli_connect(\n                    $host[$r] . (isset($port[$r]) ? ':' . $port[$r] : ':' . $port[0]),\n                    isset($user[$r]) ? $user[$r] : $user[0],\n                    isset($pwd[$r]) ? $pwd[$r] : $pwd[0]\n                );\n                $dbSel = mysqli_select_db(\n                    $hander,\n                    isset($name[$r]) ? $name[$r] : $name[0]\n                );\n                if (!$hander || !$dbSel)\n                    return false;\n                $this->hander[1] = $hander;\n                return true;\n            }\n        }\n        //从数据库链接\n        $r = floor(mt_rand(0, count($host) - 1));\n        $hander = mysqli_connect(\n            $host[$r] . (isset($port[$r]) ? ':' . $port[$r] : ':' . $port[0]),\n            isset($user[$r]) ? $user[$r] : $user[0],\n            isset($pwd[$r]) ? $pwd[$r] : $pwd[0]\n        );\n        $dbSel = mysqli_select_db(\n            $hander,\n            isset($name[$r]) ? $name[$r] : $name[0]\n        );\n        if (!$hander || !$dbSel)\n            return false;\n        $this->hander = $hander;\n        return true;\n    }\n\n    /**\n     * 关闭Session\n     * @access public\n     */\n    public function close()\n    {\n        if (is_array($this->hander)) {\n            $this->gc($this->lifeTime);\n            return (mysqli_close($this->hander[0]) && mysqli_close($this->hander[1]));\n        }\n        $this->gc($this->lifeTime);\n        return mysqli_close($this->hander);\n    }\n\n    /**\n     * 读取Session\n     * @access public\n     * @param string $sessID\n     */\n    public function read($sessID)\n    {\n        $hander = is_array($this->hander) ? $this->hander[1] : $this->hander;\n        $res = mysqli_query($hander, \"SELECT session_data AS data FROM \" . $this->sessionTable . \" WHERE session_id = '$sessID'   AND session_expire >\" . time());\n        if ($res) {\n            $row = mysqli_fetch_assoc($res);\n            return $row['data'];\n        }\n        return \"\";\n    }\n\n    /**\n     * 写入Session\n     * @access public\n     * @param string $sessID\n     * @param String $sessData\n     */\n    public function write($sessID, $sessData)\n    {\n        $hander = is_array($this->hander) ? $this->hander[0] : $this->hander;\n        $expire = time() + $this->lifeTime;\n        mysqli_query($hander, \"REPLACE INTO  \" . $this->sessionTable . \" (  session_id, session_expire, session_data)  VALUES( '$sessID', '$expire',  '$sessData')\");\n        if (mysqli_affected_rows($hander))\n            return true;\n        return false;\n    }\n\n    /**\n     * 删除Session\n     * @access public\n     * @param string $sessID\n     */\n    public function destroy($sessID)\n    {\n        $hander = is_array($this->hander) ? $this->hander[0] : $this->hander;\n        mysqli_query($hander, \"DELETE FROM \" . $this->sessionTable . \" WHERE session_id = '$sessID'\");\n        if (mysqli_affected_rows($hander))\n            return true;\n        return false;\n    }\n\n    /**\n     * Session 垃圾回收\n     * @access public\n     * @param string $sessMaxLifeTime\n     */\n    public function gc($sessMaxLifeTime)\n    {\n        $hander = is_array($this->hander) ? $this->hander[0] : $this->hander;\n        mysqli_query($hander, \"DELETE FROM \" . $this->sessionTable . \" WHERE session_expire < \" . time());\n        return mysqli_affected_rows($hander);\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Storage/Driver/File.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | TOPThink [ WE CAN DO IT JUST THINK ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2013 http://topthink.com All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Storage\\Driver;\nuse Think\\Storage;\n// 本地文件写入存储类\nclass File extends Storage{\n\n    private $contents=array();\n\n    /**\n     * 架构函数\n     * @access public\n     */\n    public function __construct() {\n    }\n\n    /**\n     * 文件内容读取\n     * @access public\n     * @param string $filename  文件名\n     * @return string     \n     */\n    public function read($filename,$type=''){\n        return $this->get($filename,'content',$type);\n    }\n\n    /**\n     * 文件写入\n     * @access public\n     * @param string $filename  文件名\n     * @param string $content  文件内容\n     * @return boolean         \n     */\n    public function put($filename,$content,$type=''){\n        $dir         =  dirname($filename);\n        if(!is_dir($dir)){\n            mkdir($dir,0777,true);\n        }\n        if(false === file_put_contents($filename,$content)){\n            E(L('_STORAGE_WRITE_ERROR_').':'.$filename);\n        }else{\n            $this->contents[$filename]=$content;\n            return true;\n        }\n    }\n\n    /**\n     * 文件追加写入\n     * @access public\n     * @param string $filename  文件名\n     * @param string $content  追加的文件内容\n     * @return boolean        \n     */\n    public function append($filename,$content,$type=''){\n        if(is_file($filename)){\n            $content =  $this->read($filename,$type).$content;\n        }\n        return $this->put($filename,$content,$type);\n    }\n\n    /**\n     * 加载文件\n     * @access public\n     * @param string $filename  文件名\n     * @param array $vars  传入变量\n     * @return void        \n     */\n    public function load($_filename,$vars=null){\n        if(!is_null($vars)){\n            extract($vars, EXTR_OVERWRITE);\n        }\n        include $_filename;\n    }\n\n    /**\n     * 文件是否存在\n     * @access public\n     * @param string $filename  文件名\n     * @return boolean     \n     */\n    public function has($filename,$type=''){\n        return is_file($filename);\n    }\n\n    /**\n     * 文件删除\n     * @access public\n     * @param string $filename  文件名\n     * @return boolean     \n     */\n    public function unlink($filename,$type=''){\n        unset($this->contents[$filename]);\n        return is_file($filename) ? unlink($filename) : false; \n    }\n\n    /**\n     * 读取文件信息\n     * @access public\n     * @param string $filename  文件名\n     * @param string $name  信息名 mtime或者content\n     * @return boolean     \n     */\n    public function get($filename,$name,$type=''){\n        if(!isset($this->contents[$filename])){\n            if(!is_file($filename)) return false;\n           $this->contents[$filename]=file_get_contents($filename);\n        }\n        $content=$this->contents[$filename];\n        $info   =   array(\n            'mtime'     =>  filemtime($filename),\n            'content'   =>  $content\n        );\n        return $info[$name];\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Storage/Driver/Sae.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | TOPThink [ WE CAN DO IT JUST THINK ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2013 http://topthink.com All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: luofei614 <weibo.com/luofei614>\n// +----------------------------------------------------------------------\nnamespace Think\\Storage\\Driver;\nuse Think\\Storage;\n// SAE环境文件写入存储类\nclass Sae extends Storage{\n\n    /**\n     * 架构函数\n     * @access public\n     */\n    private $mc;\n    private $kvs        =   array();\n    private $htmls      =   array();\n    private $contents   =   array();\n    public function __construct() {\n        if(!function_exists('memcache_init')){\n              header('Content-Type:text/html;charset=utf-8');\n              exit('请在SAE平台上运行代码。');\n        }\n        $this->mc       =   @memcache_init();\n        if(!$this->mc){\n              header('Content-Type:text/html;charset=utf-8');\n              exit('您未开通Memcache服务，请在SAE管理平台初始化Memcache服务');\n        }\n    }\n\n    /**\n     * 获得SaeKv对象\n     */\n    private function getKv(){\n        static $kv;\n        if(!$kv){\n           $kv  =   new \\SaeKV();\n           if(!$kv->init())\n               E('您没有初始化KVDB，请在SAE管理平台初始化KVDB服务');\n        }\n        return $kv;\n    }\n\n\n    /**\n     * 文件内容读取\n     * @access public\n     * @param string $filename  文件名\n     * @return string\n     */\n    public function read($filename,$type=''){\n        switch(strtolower($type)){\n            case 'f':       \n                $kv     =   $this->getKv();\n                if(!isset($this->kvs[$filename])){\n                    $this->kvs[$filename]=$kv->get($filename);\n                }\n                return $this->kvs[$filename];\n            default:\n                return $this->get($filename,'content',$type);\n        }        \n    }\n\n    /**\n     * 文件写入\n     * @access public\n     * @param string $filename  文件名\n     * @param string $content  文件内容\n     * @return boolean\n     */\n    public function put($filename,$content,$type=''){\n        switch(strtolower($type)){\n            case 'f':       \n                $kv         =   $this->getKv();\n                $this->kvs[$filename] = $content;\n                return $kv->set($filename,$content);\n            case 'html':    \n                $kv         =   $this->getKv();\n                $content    =   time().$content;\n                $this->htmls[$filename] =   $content;\n                return $kv->set($filename,$content);\n            default:\n                $content    =   time().$content;\n                if(!$this->mc->set($filename,$content,MEMCACHE_COMPRESSED,0)){\n                    E(L('_STORAGE_WRITE_ERROR_').':'.$filename);\n                }else{\n                    $this->contents[$filename] = $content;\n                    return true;\n                }            \n        }\n    }\n\n    /**\n     * 文件追加写入\n     * @access public\n     * @param string $filename  文件名\n     * @param string $content  追加的文件内容\n     * @return boolean\n     */\n    public function append($filename,$content,$type=''){\n        if($old_content = $this->read($filename,$type)){\n            $content =  $old_content.$content;\n        }\n        return $this->put($filename,$content,$type);\n    }\n\n    /**\n     * 加载文件\n     * @access public\n     * @param string $_filename  文件名\n     * @param array $vars  传入变量\n     * @return void\n     */\n    public function load($_filename,$vars=null){\n        if(!is_null($vars))\n            extract($vars, EXTR_OVERWRITE);\n        eval('?>'.$this->read($_filename));\n    }\n\n    /**\n     * 文件是否存在\n     * @access public\n     * @param string $filename  文件名\n     * @return boolean\n     */\n    public function has($filename,$type=''){\n        if($this->read($filename,$type)){\n            return true;\n        }else{\n            return false;\n        }\n    }\n\n    /**\n     * 文件删除\n     * @access public\n     * @param string $filename  文件名\n     * @return boolean\n     */\n    public function unlink($filename,$type=''){\n        switch(strtolower($type)){\n            case 'f':       \n                $kv     =   $this->getKv();\n                unset($this->kvs[$filename]);\n                return $kv->delete($filename);\n            case 'html':    \n                $kv     =   $this->getKv();\n                unset($this->htmls[$filename]);\n                return $kv->delete($filename);\n            default:\n                unset($this->contents[$filename]);\n                return $this->mc->delete($filename);            \n        }        \n    }\n\n    /**\n     * 读取文件信息\n     * @access public\n     * @param string $filename  文件名\n     * @param string $name  信息名 mtime或者content\n     * @return boolean\n     */\n    public function get($filename,$name,$type=''){\n        switch(strtolower($type)){\n            case 'html':\n                if(!isset($this->htmls[$filename])){\n                    $kv = $this->getKv();\n                    $this->htmls[$filename] = $kv->get($filename);\n                }\n                $content = $this->htmls[$filename];\n                break;\n            default:\n                if(!isset($this->contents[$filename])){\n                    $this->contents[$filename] = $this->mc->get($filename);\n                }\n                $content =  $this->contents[$filename];\n        }\n        if(false===$content){\n            return false;\n        }\n        $info   =   array(\n            'mtime'     =>  substr($content,0,10),\n            'content'   =>  substr($content,10)\n        );\n        return $info[$name];        \n    }\n\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Storage.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | TOPThink [ WE CAN DO IT JUST THINK ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2013 http://topthink.com All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n// 分布式文件存储类\nclass Storage {\n\n    /**\n     * 操作句柄\n     * @var string\n     * @access protected\n     */\n    static protected $handler    ;\n\n    /**\n     * 连接分布式文件系统\n     * @access public\n     * @param string $type 文件类型\n     * @param array $options  配置数组\n     * @return void\n     */\n    static public function connect($type='File',$options=array()) {\n        $class  =   'Think\\\\Storage\\\\Driver\\\\'.ucwords($type);\n        self::$handler = new $class($options);\n    }\n\n    static public function __callstatic($method,$args){\n        //调用缓存驱动的方法\n        if(method_exists(self::$handler, $method)){\n           return call_user_func_array(array(self::$handler,$method), $args);\n        }\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Template/Driver/Ease.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Template\\Driver;\n/**\n * EaseTemplate模板引擎驱动 \n */\nclass Ease {\n    /**\n     * 渲染模板输出\n     * @access public\n     * @param string $templateFile 模板文件名\n     * @param array $var 模板变量\n     * @return void\n     */\n    public function fetch($templateFile,$var) {\n        $templateFile   = substr($templateFile,strlen(THEME_PATH),-5);\n        $CacheDir       = substr(CACHE_PATH,0,-1);\n        $TemplateDir    = substr(THEME_PATH,0,-1);\n        vendor('EaseTemplate.template#ease');\n        $config     =  array(\n        'CacheDir'      =>  $CacheDir,\n        'TemplateDir'   =>  $TemplateDir,\n        'TplType'       =>  'html'\n         );        \n        if(C('TMPL_ENGINE_CONFIG')) {\n            $config     =  array_merge($config,C('TMPL_ENGINE_CONFIG'));\n        }\n        $tpl = new \\EaseTemplate($config);\n        $tpl->set_var($var);\n        $tpl->set_file($templateFile);\n        $tpl->p();\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Template/Driver/Lite.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Template\\Driver;\n/**\n * TemplateLite模板引擎驱动 \n */\nclass Lite {\n    /**\n     * 渲染模板输出\n     * @access public\n     * @param string $templateFile 模板文件名\n     * @param array $var 模板变量\n     * @return void\n     */\n    public function fetch($templateFile,$var) {\n        vendor(\"TemplateLite.class#template\");\n        $templateFile   =   substr($templateFile,strlen(THEME_PATH));\n        $tpl            =   new \\Template_Lite();\n        $tpl->template_dir  = THEME_PATH;\n        $tpl->compile_dir   = CACHE_PATH ;\n        $tpl->cache_dir     = TEMP_PATH ;        \n        if(C('TMPL_ENGINE_CONFIG')) {\n            $config     =  C('TMPL_ENGINE_CONFIG');\n            foreach ($config as $key=>$val){\n                $tpl->{$key}   =  $val;\n            }\n        }\n        $tpl->assign($var);\n        $tpl->display($templateFile);\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Template/Driver/Mobile.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: luofei614<weibo.com/luofei614>\n// +----------------------------------------------------------------------\nnamespace Think\\Template\\Driver;\n/**\n * MobileTemplate模板引擎驱动 \n */\nclass Mobile {\n    /**\n     * 渲染模板输出\n     * @access public\n     * @param string $templateFile 模板文件名\n     * @param array $var 模板变量\n     * @return void\n     */\n    public function fetch($templateFile,$var) {\n        $templateFile=substr($templateFile,strlen(THEME_PATH));\n        $var['_think_template_path']=$templateFile;\n        exit(json_encode($var));\t\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Template/Driver/Smart.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Template\\Driver;\n/**\n * Smart模板引擎驱动 \n */\nclass Smart {\n    /**\n     * 渲染模板输出\n     * @access public\n     * @param string $templateFile 模板文件名\n     * @param array $var 模板变量\n     * @return void\n     */\n    public function fetch($templateFile,$var) {\n        $templateFile   =   substr($templateFile,strlen(THEME_PATH));\n        vendor('SmartTemplate.class#smarttemplate');\n        $tpl            =   new \\SmartTemplate($templateFile);\n        $tpl->caching       = C('TMPL_CACHE_ON');\n        $tpl->template_dir  = THEME_PATH;\n        $tpl->compile_dir   = CACHE_PATH ;\n        $tpl->cache_dir     = TEMP_PATH ;        \n        if(C('TMPL_ENGINE_CONFIG')) {\n            $config  =  C('TMPL_ENGINE_CONFIG');\n            foreach ($config as $key=>$val){\n                $tpl->{$key}   =  $val;\n            }\n        }\n        $tpl->assign($var);\n        $tpl->output();\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Template/Driver/Smarty.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Template\\Driver;\n/**\n * Smarty模板引擎驱动 \n */\nclass Smarty {\n\n    /**\n     * 渲染模板输出\n     * @access public\n     * @param string $templateFile 模板文件名\n     * @param array $var 模板变量\n     * @return void\n     */\n    public function fetch($templateFile,$var) {\n        $templateFile   =   substr($templateFile,strlen(THEME_PATH));\n        vendor('Smarty.Smarty#class');\n        $tpl            =   new \\Smarty();\n        $tpl->caching       = C('TMPL_CACHE_ON');\n        $tpl->template_dir  = THEME_PATH;\n        $tpl->compile_dir   = CACHE_PATH ;\n        $tpl->cache_dir     = TEMP_PATH ;        \n        if(C('TMPL_ENGINE_CONFIG')) {\n            $config  =  C('TMPL_ENGINE_CONFIG');\n            foreach ($config as $key=>$val){\n                $tpl->{$key}   =  $val;\n            }\n        }\n        $tpl->assign($var);\n        $tpl->display($templateFile);\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Template/TagLib/Cx.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Template\\TagLib;\nuse Think\\Template\\TagLib;\n/**\n * CX标签库解析类\n */\nclass Cx extends TagLib {\n\n    // 标签定义\n    protected $tags   =  array(\n        // 标签定义： attr 属性列表 close 是否闭合（0 或者1 默认1） alias 标签别名 level 嵌套层次\n        'php'       =>  array(),\n        'volist'    =>  array('attr'=>'name,id,offset,length,key,mod','level'=>3,'alias'=>'iterate'),\n        'foreach'   =>  array('attr'=>'name,item,key','level'=>3),\n        'if'        =>  array('attr'=>'condition','level'=>2),\n        'elseif'    =>  array('attr'=>'condition','close'=>0),\n        'else'      =>  array('attr'=>'','close'=>0),\n        'switch'    =>  array('attr'=>'name','level'=>2),\n        'case'      =>  array('attr'=>'value,break'),\n        'default'   =>  array('attr'=>'','close'=>0),\n        'compare'   =>  array('attr'=>'name,value,type','level'=>3,'alias'=>'eq,equal,notequal,neq,gt,lt,egt,elt,heq,nheq'),\n        'range'     =>  array('attr'=>'name,value,type','level'=>3,'alias'=>'in,notin,between,notbetween'),\n        'empty'     =>  array('attr'=>'name','level'=>3),\n        'notempty'  =>  array('attr'=>'name','level'=>3),\n        'present'   =>  array('attr'=>'name','level'=>3),\n        'notpresent'=>  array('attr'=>'name','level'=>3),\n        'defined'   =>  array('attr'=>'name','level'=>3),\n        'notdefined'=>  array('attr'=>'name','level'=>3),\n        'import'    =>  array('attr'=>'file,href,type,value,basepath','close'=>0,'alias'=>'load,css,js'),\n        'assign'    =>  array('attr'=>'name,value','close'=>0),\n        'define'    =>  array('attr'=>'name,value','close'=>0),\n        'for'       =>  array('attr'=>'start,end,name,comparison,step', 'level'=>3),\n        );\n\n    /**\n     * php标签解析\n     * @access public\n     * @param array $tag 标签属性\n     * @param string $content  标签内容\n     * @return string\n     */\n    public function _php($tag,$content) {\n        $parseStr = '<?php '.$content.' ?>';\n        return $parseStr;\n    }\n\n    /**\n     * volist标签解析 循环输出数据集\n     * 格式：\n     * <volist name=\"userList\" id=\"user\" empty=\"\" >\n     * {user.username}\n     * {user.email}\n     * </volist>\n     * @access public\n     * @param array $tag 标签属性\n     * @param string $content  标签内容\n     * @return string|void\n     */\n    public function _volist($tag,$content) {\n        $name  =    $tag['name'];\n        $id    =    $tag['id'];\n        $empty =    isset($tag['empty'])?$tag['empty']:'';\n        $key   =    !empty($tag['key'])?$tag['key']:'i';\n        $mod   =    isset($tag['mod'])?$tag['mod']:'2';\n        // 允许使用函数设定数据集 <volist name=\":fun('arg')\" id=\"vo\">{$vo.name}</volist>\n        $parseStr   =  '<?php ';\n        if(0===strpos($name,':')) {\n            $parseStr   .= '$_result='.substr($name,1).';';\n            $name   = '$_result';\n        }else{\n            $name   = $this->autoBuildVar($name);\n        }\n        $parseStr  .=  'if(is_array('.$name.')): $'.$key.' = 0;';\n        if(isset($tag['length']) && '' !=$tag['length'] ) {\n            $parseStr  .= ' $__LIST__ = array_slice('.$name.','.$tag['offset'].','.$tag['length'].',true);';\n        }elseif(isset($tag['offset'])  && '' !=$tag['offset']){\n            $parseStr  .= ' $__LIST__ = array_slice('.$name.','.$tag['offset'].',null,true);';\n        }else{\n            $parseStr .= ' $__LIST__ = '.$name.';';\n        }\n        $parseStr .= 'if( count($__LIST__)==0 ) : echo \"'.$empty.'\" ;';\n        $parseStr .= 'else: ';\n        $parseStr .= 'foreach($__LIST__ as $key=>$'.$id.'): ';\n        $parseStr .= '$mod = ($'.$key.' % '.$mod.' );';\n        $parseStr .= '++$'.$key.';?>';\n        $parseStr .= $this->tpl->parse($content);\n        $parseStr .= '<?php endforeach; endif; else: echo \"'.$empty.'\" ;endif; ?>';\n\n        if(!empty($parseStr)) {\n            return $parseStr;\n        }\n        return ;\n    }\n\n    /**\n     * foreach标签解析 循环输出数据集\n     * @access public\n     * @param array $tag 标签属性\n     * @param string $content  标签内容\n     * @return string|void\n     */\n    public function _foreach($tag,$content) {\n        $name       =   $tag['name'];\n        $item       =   $tag['item'];\n        $key        =   !empty($tag['key'])?$tag['key']:'key';\n        $name       =   $this->autoBuildVar($name);\n        $parseStr   =   '<?php if(is_array('.$name.')): foreach('.$name.' as $'.$key.'=>$'.$item.'): ?>';\n        $parseStr  .=   $this->tpl->parse($content);\n        $parseStr  .=   '<?php endforeach; endif; ?>';\n\n        if(!empty($parseStr)) {\n            return $parseStr;\n        }\n        return ;\n    }\n\n    /**\n     * if标签解析\n     * 格式：\n     * <if condition=\" $a eq 1\" >\n     * <elseif condition=\"$a eq 2\" />\n     * <else />\n     * </if>\n     * 表达式支持 eq neq gt egt lt elt == > >= < <= or and || &&\n     * @access public\n     * @param array $tag 标签属性\n     * @param string $content  标签内容\n     * @return string\n     */\n    public function _if($tag,$content) {\n        $condition  =   $this->parseCondition($tag['condition']);\n        $parseStr   =   '<?php if('.$condition.'): ?>'.$content.'<?php endif; ?>';\n        return $parseStr;\n    }\n\n    /**\n     * else标签解析\n     * 格式：见if标签\n     * @access public\n     * @param array $tag 标签属性\n     * @param string $content  标签内容\n     * @return string\n     */\n    public function _elseif($tag,$content) {\n        $condition  =   $this->parseCondition($tag['condition']);\n        $parseStr   =   '<?php elseif('.$condition.'): ?>';\n        return $parseStr;\n    }\n\n    /**\n     * else标签解析\n     * @access public\n     * @param array $tag 标签属性\n     * @return string\n     */\n    public function _else($tag) {\n        $parseStr = '<?php else: ?>';\n        return $parseStr;\n    }\n\n    /**\n     * switch标签解析\n     * 格式：\n     * <switch name=\"a.name\" >\n     * <case value=\"1\" break=\"false\">1</case>\n     * <case value=\"2\" >2</case>\n     * <default />other\n     * </switch>\n     * @access public\n     * @param array $tag 标签属性\n     * @param string $content  标签内容\n     * @return string\n     */\n    public function _switch($tag,$content) {\n        $name       =   $tag['name'];\n        $varArray   =   explode('|',$name);\n        $name       =   array_shift($varArray);\n        $name       =   $this->autoBuildVar($name);\n        if(count($varArray)>0)\n            $name   =   $this->tpl->parseVarFunction($name,$varArray);\n        $parseStr   =   '<?php switch('.$name.'): ?>'.$content.'<?php endswitch;?>';\n        return $parseStr;\n    }\n\n    /**\n     * case标签解析 需要配合switch才有效\n     * @access public\n     * @param array $tag 标签属性\n     * @param string $content  标签内容\n     * @return string\n     */\n    public function _case($tag,$content) {\n        $value  = $tag['value'];\n        if('$' == substr($value,0,1)) {\n            $varArray   =   explode('|',$value);\n            $value\t    =\tarray_shift($varArray);\n            $value      =   $this->autoBuildVar(substr($value,1));\n            if(count($varArray)>0)\n                $value  =   $this->tpl->parseVarFunction($value,$varArray);\n            $value      =   'case '.$value.': ';\n        }elseif(strpos($value,'|')){\n            $values     =   explode('|',$value);\n            $value      =   '';\n            foreach ($values as $val){\n                $value   .=  'case \"'.addslashes($val).'\": ';\n            }\n        }else{\n            $value\t=\t'case \"'.$value.'\": ';\n        }\n        $parseStr = '<?php '.$value.' ?>'.$content;\n        $isBreak  = isset($tag['break']) ? $tag['break'] : '';\n        if('' ==$isBreak || $isBreak) {\n            $parseStr .= '<?php break;?>';\n        }\n        return $parseStr;\n    }\n\n    /**\n     * default标签解析 需要配合switch才有效\n     * 使用： <default />ddfdf\n     * @access public\n     * @param array $tag 标签属性\n     * @param string $content  标签内容\n     * @return string\n     */\n    public function _default($tag) {\n        $parseStr = '<?php default: ?>';\n        return $parseStr;\n    }\n\n    /**\n     * compare标签解析\n     * 用于值的比较 支持 eq neq gt lt egt elt heq nheq 默认是eq\n     * 格式： <compare name=\"\" type=\"eq\" value=\"\" >content</compare>\n     * @access public\n     * @param array $tag 标签属性\n     * @param string $content  标签内容\n     * @return string\n     */\n    public function _compare($tag,$content,$type='eq') {\n        $name       =   $tag['name'];\n        $value      =   $tag['value'];\n        $type       =   isset($tag['type'])?$tag['type']:$type;\n        $type       =   $this->parseCondition(' '.$type.' ');\n        $varArray   =   explode('|',$name);\n        $name       =   array_shift($varArray);\n        $name       =   $this->autoBuildVar($name);\n        if(count($varArray)>0)\n            $name = $this->tpl->parseVarFunction($name,$varArray);\n        if('$' == substr($value,0,1)) {\n            $value  =  $this->autoBuildVar(substr($value,1));\n        }else {\n            $value  =   '\"'.$value.'\"';\n        }\n        $parseStr   =   '<?php if(('.$name.') '.$type.' '.$value.'): ?>'.$content.'<?php endif; ?>';\n        return $parseStr;\n    }\n\n    public function _eq($tag,$content) {\n        return $this->_compare($tag,$content,'eq');\n    }\n\n    public function _equal($tag,$content) {\n        return $this->_compare($tag,$content,'eq');\n    }\n\n    public function _neq($tag,$content) {\n        return $this->_compare($tag,$content,'neq');\n    }\n\n    public function _notequal($tag,$content) {\n        return $this->_compare($tag,$content,'neq');\n    }\n\n    public function _gt($tag,$content) {\n        return $this->_compare($tag,$content,'gt');\n    }\n\n    public function _lt($tag,$content) {\n        return $this->_compare($tag,$content,'lt');\n    }\n\n    public function _egt($tag,$content) {\n        return $this->_compare($tag,$content,'egt');\n    }\n\n    public function _elt($tag,$content) {\n        return $this->_compare($tag,$content,'elt');\n    }\n\n    public function _heq($tag,$content) {\n        return $this->_compare($tag,$content,'heq');\n    }\n\n    public function _nheq($tag,$content) {\n        return $this->_compare($tag,$content,'nheq');\n    }\n\n    /**\n     * range标签解析\n     * 如果某个变量存在于某个范围 则输出内容 type= in 表示在范围内 否则表示在范围外\n     * 格式： <range name=\"var|function\"  value=\"val\" type='in|notin' >content</range>\n     * example: <range name=\"a\"  value=\"1,2,3\" type='in' >content</range>\n     * @access public\n     * @param array $tag 标签属性\n     * @param string $content  标签内容\n     * @param string $type  比较类型\n     * @return string\n     */\n    public function _range($tag,$content,$type='in') {\n        $name       =   $tag['name'];\n        $value      =   $tag['value'];\n        $varArray   =   explode('|',$name);\n        $name       =   array_shift($varArray);\n        $name       =   $this->autoBuildVar($name);\n        if(count($varArray)>0)\n            $name   =   $this->tpl->parseVarFunction($name,$varArray);\n\n        $type       =   isset($tag['type'])?$tag['type']:$type;\n\n        if('$' == substr($value,0,1)) {\n            $value  =   $this->autoBuildVar(substr($value,1));\n            $str    =   'is_array('.$value.')?'.$value.':explode(\\',\\','.$value.')';\n        }else{\n            $value  =   '\"'.$value.'\"';\n            $str    =   'explode(\\',\\','.$value.')';\n        }\n        if($type=='between') {\n            $parseStr = '<?php $_RANGE_VAR_='.$str.';if('.$name.'>= $_RANGE_VAR_[0] && '.$name.'<= $_RANGE_VAR_[1]):?>'.$content.'<?php endif; ?>';\n        }elseif($type=='notbetween'){\n            $parseStr = '<?php $_RANGE_VAR_='.$str.';if('.$name.'<$_RANGE_VAR_[0] || '.$name.'>$_RANGE_VAR_[1]):?>'.$content.'<?php endif; ?>';\n        }else{\n            $fun        =  ($type == 'in')? 'in_array'    :   '!in_array';\n            $parseStr   = '<?php if('.$fun.'(('.$name.'), '.$str.')): ?>'.$content.'<?php endif; ?>';\n        }\n        return $parseStr;\n    }\n\n    // range标签的别名 用于in判断\n    public function _in($tag,$content) {\n        return $this->_range($tag,$content,'in');\n    }\n\n    // range标签的别名 用于notin判断\n    public function _notin($tag,$content) {\n        return $this->_range($tag,$content,'notin');\n    }\n\n    public function _between($tag,$content){\n        return $this->_range($tag,$content,'between');\n    }\n\n    public function _notbetween($tag,$content){\n        return $this->_range($tag,$content,'notbetween');\n    }\n\n    /**\n     * present标签解析\n     * 如果某个变量已经设置 则输出内容\n     * 格式： <present name=\"\" >content</present>\n     * @access public\n     * @param array $tag 标签属性\n     * @param string $content  标签内容\n     * @return string\n     */\n    public function _present($tag,$content) {\n        $name       =   $tag['name'];\n        $name       =   $this->autoBuildVar($name);\n        $parseStr   =   '<?php if(isset('.$name.')): ?>'.$content.'<?php endif; ?>';\n        return $parseStr;\n    }\n\n    /**\n     * notpresent标签解析\n     * 如果某个变量没有设置，则输出内容\n     * 格式： <notpresent name=\"\" >content</notpresent>\n     * @access public\n     * @param array $tag 标签属性\n     * @param string $content  标签内容\n     * @return string\n     */\n    public function _notpresent($tag,$content) {\n        $name       =   $tag['name'];\n        $name       =   $this->autoBuildVar($name);\n        $parseStr   =   '<?php if(!isset('.$name.')): ?>'.$content.'<?php endif; ?>';\n        return $parseStr;\n    }\n\n    /**\n     * empty标签解析\n     * 如果某个变量为empty 则输出内容\n     * 格式： <empty name=\"\" >content</empty>\n     * @access public\n     * @param array $tag 标签属性\n     * @param string $content  标签内容\n     * @return string\n     */\n    public function _empty($tag,$content) {\n        $name       =   $tag['name'];\n        $name       =   $this->autoBuildVar($name);\n        $parseStr   =   '<?php if(empty('.$name.')): ?>'.$content.'<?php endif; ?>';\n        return $parseStr;\n    }\n\n    public function _notempty($tag,$content) {\n        $name       =   $tag['name'];\n        $name       =   $this->autoBuildVar($name);\n        $parseStr   =   '<?php if(!empty('.$name.')): ?>'.$content.'<?php endif; ?>';\n        return $parseStr;\n    }\n\n    /**\n     * 判断是否已经定义了该常量\n     * <defined name='TXT'>已定义</defined>\n     * @param <type> $attr\n     * @param <type> $content\n     * @return string\n     */\n    public function _defined($tag,$content) {\n        $name       =   $tag['name'];\n        $parseStr   =   '<?php if(defined(\"'.$name.'\")): ?>'.$content.'<?php endif; ?>';\n        return $parseStr;\n    }\n\n    public function _notdefined($tag,$content) {\n        $name       =   $tag['name'];\n        $parseStr   =   '<?php if(!defined(\"'.$name.'\")): ?>'.$content.'<?php endif; ?>';\n        return $parseStr;\n    }\n\n    /**\n     * import 标签解析 <import file=\"Js.Base\" /> \n     * <import file=\"Css.Base\" type=\"css\" />\n     * @access public\n     * @param array $tag 标签属性\n     * @param string $content  标签内容\n     * @param boolean $isFile  是否文件方式\n     * @param string $type  类型\n     * @return string\n     */\n    public function _import($tag,$content,$isFile=false,$type='') {\n        $file       =   isset($tag['file'])?$tag['file']:$tag['href'];\n        $parseStr   =   '';\n        $endStr     =   '';\n        // 判断是否存在加载条件 允许使用函数判断(默认为isset)\n        if (isset($tag['value'])) {\n            $varArray  =    explode('|',$tag['value']);\n            $name      =    array_shift($varArray);\n            $name      =    $this->autoBuildVar($name);\n            if (!empty($varArray))\n                $name  =    $this->tpl->parseVarFunction($name,$varArray);\n            else\n                $name  =    'isset('.$name.')';\n            $parseStr .=    '<?php if('.$name.'): ?>';\n            $endStr    =    '<?php endif; ?>';\n        }\n        if($isFile) {\n            // 根据文件名后缀自动识别\n            $type  = $type?$type:(!empty($tag['type'])?strtolower($tag['type']):null);\n            // 文件方式导入\n            $array =  explode(',',$file);\n            foreach ($array as $val){\n                if (!$type || isset($reset)) {\n                    $type = $reset = strtolower(substr(strrchr($val, '.'),1));\n                }\n                switch($type) {\n                case 'js':\n                    $parseStr .= '<script type=\"text/javascript\" src=\"'.$val.'\"></script>';\n                    break;\n                case 'css':\n                    $parseStr .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.$val.'\" />';\n                    break;\n                case 'php':\n                    $parseStr .= '<?php require_cache(\"'.$val.'\"); ?>';\n                    break;\n                }\n            }\n        }else{\n            // 命名空间导入模式 默认是js\n            $type       =   $type?$type:(!empty($tag['type'])?strtolower($tag['type']):'js');\n            $basepath   =   !empty($tag['basepath'])?$tag['basepath']:__ROOT__.'/Public';\n            // 命名空间方式导入外部文件\n            $array      =   explode(',',$file);\n            foreach ($array as $val){\n                if(strpos ($val, '?')) {\n                    list($val,$version) =   explode('?',$val);\n                } else {\n                    $version = '';\n                }\n                switch($type) {\n                case 'js':\n                    $parseStr .= '<script type=\"text/javascript\" src=\"'.$basepath.'/'.str_replace(array('.','#'), array('/','.'),$val).'.js'.($version?'?'.$version:'').'\"></script>';\n                    break;\n                case 'css':\n                    $parseStr .= '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.$basepath.'/'.str_replace(array('.','#'), array('/','.'),$val).'.css'.($version?'?'.$version:'').'\" />';\n                    break;\n                case 'php':\n                    $parseStr .= '<?php import(\"'.$val.'\"); ?>';\n                    break;\n                }\n            }\n        }\n        return $parseStr.$endStr;\n    }\n\n    // import别名 采用文件方式加载(要使用命名空间必须用import) 例如 <load file=\"__PUBLIC__/Js/Base.js\" />\n    public function _load($tag,$content) {\n        return $this->_import($tag,$content,true);\n    }\n\n    // import别名使用 导入css文件 <css file=\"__PUBLIC__/Css/Base.css\" />\n    public function _css($tag,$content) {\n        return $this->_import($tag,$content,true,'css');\n    }\n\n    // import别名使用 导入js文件 <js file=\"__PUBLIC__/Js/Base.js\" />\n    public function _js($tag,$content) {\n        return $this->_import($tag,$content,true,'js');\n    }\n\n    /**\n     * assign标签解析\n     * 在模板中给某个变量赋值 支持变量赋值\n     * 格式： <assign name=\"\" value=\"\" />\n     * @access public\n     * @param array $tag 标签属性\n     * @param string $content  标签内容\n     * @return string\n     */\n    public function _assign($tag,$content) {\n        $name       =   $this->autoBuildVar($tag['name']);\n        if('$'==substr($tag['value'],0,1)) {\n            $value  =   $this->autoBuildVar(substr($tag['value'],1));\n        }else{\n            $value  =   '\\''.$tag['value']. '\\'';\n        }\n        $parseStr   =   '<?php '.$name.' = '.$value.'; ?>';\n        return $parseStr;\n    }\n\n    /**\n     * define标签解析\n     * 在模板中定义常量 支持变量赋值\n     * 格式： <define name=\"\" value=\"\" />\n     * @access public\n     * @param array $tag 标签属性\n     * @param string $content  标签内容\n     * @return string\n     */\n    public function _define($tag,$content) {\n        $name       =   '\\''.$tag['name']. '\\'';\n        if('$'==substr($tag['value'],0,1)) {\n            $value  =   $this->autoBuildVar(substr($tag['value'],1));\n        }else{\n            $value  =   '\\''.$tag['value']. '\\'';\n        }\n        $parseStr   =   '<?php define('.$name.', '.$value.'); ?>';\n        return $parseStr;\n    }\n    \n    /**\n     * for标签解析\n     * 格式： <for start=\"\" end=\"\" comparison=\"\" step=\"\" name=\"\" />\n     * @access public\n     * @param array $tag 标签属性\n     * @param string $content  标签内容\n     * @return string\n     */\n    public function _for($tag, $content){\n        //设置默认值\n        $start \t\t= 0;\n        $end   \t\t= 0;\n        $step \t\t= 1;\n        $comparison = 'lt';\n        $name\t\t= 'i';\n        $rand       = rand(); //添加随机数，防止嵌套变量冲突\n        //获取属性\n        foreach ($tag as $key => $value){\n            $value = trim($value);\n            if(':'==substr($value,0,1))\n                $value = substr($value,1);\n            elseif('$'==substr($value,0,1))\n                $value = $this->autoBuildVar(substr($value,1));\n            switch ($key){\n                case 'start':   \n                    $start      = $value; break;\n                case 'end' :    \n                    $end        = $value; break;\n                case 'step':    \n                    $step       = $value; break;\n                case 'comparison':\n                    $comparison = $value; break;\n                case 'name':\n                    $name       = $value; break;\n            }\n        }\n        \n        $parseStr   = '<?php $__FOR_START_'.$rand.'__='.$start.';$__FOR_END_'.$rand.'__='.$end.';';\n        $parseStr  .= 'for($'.$name.'=$__FOR_START_'.$rand.'__;'.$this->parseCondition('$'.$name.' '.$comparison.' $__FOR_END_'.$rand.'__').';$'.$name.'+='.$step.'){ ?>';\n        $parseStr  .= $content;\n        $parseStr  .= '<?php } ?>';\n        return $parseStr;\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Template/TagLib/Html.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Template\\TagLib;\nuse Think\\Template\\TagLib;\n/**\n * Html标签库驱动\n */\nclass Html extends TagLib{\n    // 标签定义\n    protected $tags   =  array(\n        // 标签定义： attr 属性列表 close 是否闭合（0 或者1 默认1） alias 标签别名 level 嵌套层次\n        'editor'    => array('attr'=>'id,name,style,width,height,type','close'=>1),\n        'select'    => array('attr'=>'name,options,values,output,multiple,id,size,first,change,selected,dblclick','close'=>0),\n        'grid'      => array('attr'=>'id,pk,style,action,actionlist,show,datasource','close'=>0),\n        'list'      => array('attr'=>'id,pk,style,action,actionlist,show,datasource,checkbox','close'=>0),\n        'imagebtn'  => array('attr'=>'id,name,value,type,style,click','close'=>0),\n        'checkbox'  => array('attr'=>'name,checkboxes,checked,separator','close'=>0),\n        'radio'     => array('attr'=>'name,radios,checked,separator','close'=>0)\n        );\n\n    /**\n     * editor标签解析 插入可视化编辑器\n     * 格式： <html:editor id=\"editor\" name=\"remark\" type=\"FCKeditor\" style=\"\" >{$vo.remark}</html:editor>\n     * @access public\n     * @param array $tag 标签属性\n     * @return string|void\n     */\n    public function _editor($tag,$content) {\n        $id\t\t\t=\t!empty($tag['id'])?$tag['id']: '_editor';\n        $name   \t=\t$tag['name'];\n        $style   \t    =\t!empty($tag['style'])?$tag['style']:'';\n        $width\t\t=\t!empty($tag['width'])?$tag['width']: '100%';\n        $height     =\t!empty($tag['height'])?$tag['height'] :'320px';\n     //   $content    =   $tag['content'];\n        $type       =   $tag['type'] ;\n        switch(strtoupper($type)) {\n            case 'FCKEDITOR':\n                $parseStr   =\t'<!-- 编辑器调用开始 --><script type=\"text/javascript\" src=\"__ROOT__/Public/Js/FCKeditor/fckeditor.js\"></script><textarea id=\"'.$id.'\" name=\"'.$name.'\">'.$content.'</textarea><script type=\"text/javascript\"> var oFCKeditor = new FCKeditor( \"'.$id.'\",\"'.$width.'\",\"'.$height.'\" ) ; oFCKeditor.BasePath = \"__ROOT__/Public/Js/FCKeditor/\" ; oFCKeditor.ReplaceTextarea() ;function resetEditor(){setContents(\"'.$id.'\",document.getElementById(\"'.$id.'\").value)}; function saveEditor(){document.getElementById(\"'.$id.'\").value = getContents(\"'.$id.'\");} function InsertHTML(html){ var oEditor = FCKeditorAPI.GetInstance(\"'.$id.'\") ;if (oEditor.EditMode == FCK_EDITMODE_WYSIWYG ){oEditor.InsertHtml(html) ;}else\talert( \"FCK必须处于WYSIWYG模式!\" ) ;}</script> <!-- 编辑器调用结束 -->';\n                break;\n            case 'FCKMINI':\n                $parseStr   =\t'<!-- 编辑器调用开始 --><script type=\"text/javascript\" src=\"__ROOT__/Public/Js/FCKMini/fckeditor.js\"></script><textarea id=\"'.$id.'\" name=\"'.$name.'\">'.$content.'</textarea><script type=\"text/javascript\"> var oFCKeditor = new FCKeditor( \"'.$id.'\",\"'.$width.'\",\"'.$height.'\" ) ; oFCKeditor.BasePath = \"__ROOT__/Public/Js/FCKMini/\" ; oFCKeditor.ReplaceTextarea() ;function resetEditor(){setContents(\"'.$id.'\",document.getElementById(\"'.$id.'\").value)}; function saveEditor(){document.getElementById(\"'.$id.'\").value = getContents(\"'.$id.'\");} function InsertHTML(html){ var oEditor = FCKeditorAPI.GetInstance(\"'.$id.'\") ;if (oEditor.EditMode == FCK_EDITMODE_WYSIWYG ){oEditor.InsertHtml(html) ;}else\talert( \"FCK必须处于WYSIWYG模式!\" ) ;}</script> <!-- 编辑器调用结束 -->';\n                break;\n            case 'EWEBEDITOR':\n                $parseStr\t=\t\"<!-- 编辑器调用开始 --><script type='text/javascript' src='__ROOT__/Public/Js/eWebEditor/js/edit.js'></script><input type='hidden'  id='{$id}' name='{$name}'  value='{$conent}'><iframe src='__ROOT__/Public/Js/eWebEditor/ewebeditor.htm?id={$name}' frameborder=0 scrolling=no width='{$width}' height='{$height}'></iframe><script type='text/javascript'>function saveEditor(){document.getElementById('{$id}').value = getHTML();} </script><!-- 编辑器调用结束 -->\";\n                break;\n            case 'NETEASE':\n                $parseStr   =\t'<!-- 编辑器调用开始 --><textarea id=\"'.$id.'\" name=\"'.$name.'\" style=\"display:none\">'.$content.'</textarea><iframe ID=\"Editor\" name=\"Editor\" src=\"__ROOT__/Public/Js/HtmlEditor/index.html?ID='.$name.'\" frameBorder=\"0\" marginHeight=\"0\" marginWidth=\"0\" scrolling=\"No\" style=\"height:'.$height.';width:'.$width.'\"></iframe><!-- 编辑器调用结束 -->';\n                break;\n            case 'UBB':\n                $parseStr\t=\t'<script type=\"text/javascript\" src=\"__ROOT__/Public/Js/UbbEditor.js\"></script><div style=\"padding:1px;width:'.$width.';border:1px solid silver;float:left;\"><script LANGUAGE=\"JavaScript\"> showTool(); </script></div><div><TEXTAREA id=\"UBBEditor\" name=\"'.$name.'\"  style=\"clear:both;float:none;width:'.$width.';height:'.$height.'\" >'.$content.'</TEXTAREA></div><div style=\"padding:1px;width:'.$width.';border:1px solid silver;float:left;\"><script LANGUAGE=\"JavaScript\">showEmot();  </script></div>';\n                break;\n            case 'KINDEDITOR':\n                $parseStr   =  '<script type=\"text/javascript\" src=\"__ROOT__/Public/Js/KindEditor/kindeditor.js\"></script><script type=\"text/javascript\"> KE.show({ id : \\''.$id.'\\'  ,urlType : \"absolute\"});</script><textarea id=\"'.$id.'\" style=\"'.$style.'\" name=\"'.$name.'\" >'.$content.'</textarea>';\n                break;\n            default :\n                $parseStr  =  '<textarea id=\"'.$id.'\" style=\"'.$style.'\" name=\"'.$name.'\" >'.$content.'</textarea>';\n        }\n\n        return $parseStr;\n    }\n\n    /**\n     * imageBtn标签解析\n     * 格式： <html:imageBtn type=\"\" value=\"\" />\n     * @access public\n     * @param array $tag 标签属性\n     * @return string|void\n     */\n    public function _imageBtn($tag) {\n        $name       = $tag['name'];                //名称\n        $value      = $tag['value'];                //文字\n        $id         = isset($tag['id'])?$tag['id']:'';                //ID\n        $style      = isset($tag['style'])?$tag['style']:'';                //样式名\n        $click      = isset($tag['click'])?$tag['click']:'';                //点击\n        $type       = empty($tag['type'])?'button':$tag['type'];                //按钮类型\n\n        if(!empty($name)) {\n            $parseStr   = '<div class=\"'.$style.'\" ><input type=\"'.$type.'\" id=\"'.$id.'\" name=\"'.$name.'\" value=\"'.$value.'\" onclick=\"'.$click.'\" class=\"'.$name.' imgButton\"></div>';\n        }else {\n        \t$parseStr   = '<div class=\"'.$style.'\" ><input type=\"'.$type.'\" id=\"'.$id.'\"  name=\"'.$name.'\" value=\"'.$value.'\" onclick=\"'.$click.'\" class=\"button\"></div>';\n        }\n\n        return $parseStr;\n    }\n\n    /**\n     * imageLink标签解析\n     * 格式： <html:imageLink type=\"\" value=\"\" />\n     * @access public\n     * @param array $tag 标签属性\n     * @return string|void\n     */\n    public function _imgLink($tag) {\n        $name       = $tag['name'];                //名称\n        $alt        = $tag['alt'];                //文字\n        $id         = $tag['id'];                //ID\n        $style      = $tag['style'];                //样式名\n        $click      = $tag['click'];                //点击\n        $type       = $tag['type'];                //点击\n        if(empty($type)) {\n            $type = 'button';\n        }\n       \t$parseStr   = '<span class=\"'.$style.'\" ><input title=\"'.$alt.'\" type=\"'.$type.'\" id=\"'.$id.'\"  name=\"'.$name.'\" onmouseover=\"this.style.filter=\\'alpha(opacity=100)\\'\" onmouseout=\"this.style.filter=\\'alpha(opacity=80)\\'\" onclick=\"'.$click.'\" align=\"absmiddle\" class=\"'.$name.' imgLink\"></span>';\n\n        return $parseStr;\n    }\n\n    /**\n     * select标签解析\n     * 格式： <html:select options=\"name\" selected=\"value\" />\n     * @access public\n     * @param array $tag 标签属性\n     * @return string|void\n     */\n    public function _select($tag) {\n        $name       = $tag['name'];\n        $options    = $tag['options'];\n        $values     = $tag['values'];\n        $output     = $tag['output'];\n        $multiple   = $tag['multiple'];\n        $id         = $tag['id'];\n        $size       = $tag['size'];\n        $first      = $tag['first'];\n        $selected   = $tag['selected'];\n        $style      = $tag['style'];\n        $ondblclick = $tag['dblclick'];\n\t\t$onchange\t= $tag['change'];\n\n        if(!empty($multiple)) {\n            $parseStr = '<select id=\"'.$id.'\" name=\"'.$name.'\" ondblclick=\"'.$ondblclick.'\" onchange=\"'.$onchange.'\" multiple=\"multiple\" class=\"'.$style.'\" size=\"'.$size.'\" >';\n        }else {\n        \t$parseStr = '<select id=\"'.$id.'\" name=\"'.$name.'\" onchange=\"'.$onchange.'\" ondblclick=\"'.$ondblclick.'\" class=\"'.$style.'\" >';\n        }\n        if(!empty($first)) {\n            $parseStr .= '<option value=\"\" >'.$first.'</option>';\n        }\n        if(!empty($options)) {\n            $parseStr   .= '<?php  foreach($'.$options.' as $key=>$val) { ?>';\n            if(!empty($selected)) {\n                $parseStr   .= '<?php if(!empty($'.$selected.') && ($'.$selected.' == $key || in_array($key,$'.$selected.'))) { ?>';\n                $parseStr   .= '<option selected=\"selected\" value=\"<?php echo $key ?>\"><?php echo $val ?></option>';\n                $parseStr   .= '<?php }else { ?><option value=\"<?php echo $key ?>\"><?php echo $val ?></option>';\n                $parseStr   .= '<?php } ?>';\n            }else {\n                $parseStr   .= '<option value=\"<?php echo $key ?>\"><?php echo $val ?></option>';\n            }\n            $parseStr   .= '<?php } ?>';\n        }else if(!empty($values)) {\n            $parseStr   .= '<?php  for($i=0;$i<count($'.$values.');$i++) { ?>';\n            if(!empty($selected)) {\n                $parseStr   .= '<?php if(isset($'.$selected.') && ((is_string($'.$selected.') && $'.$selected.' == $'.$values.'[$i]) || (is_array($'.$selected.') && in_array($'.$values.'[$i],$'.$selected.')))) { ?>';\n                $parseStr   .= '<option selected=\"selected\" value=\"<?php echo $'.$values.'[$i] ?>\"><?php echo $'.$output.'[$i] ?></option>';\n                $parseStr   .= '<?php }else { ?><option value=\"<?php echo $'.$values.'[$i] ?>\"><?php echo $'.$output.'[$i] ?></option>';\n                $parseStr   .= '<?php } ?>';\n            }else {\n                $parseStr   .= '<option value=\"<?php echo $'.$values.'[$i] ?>\"><?php echo $'.$output.'[$i] ?></option>';\n            }\n            $parseStr   .= '<?php } ?>';\n        }\n        $parseStr   .= '</select>';\n        return $parseStr;\n    }\n\n    /**\n     * checkbox标签解析\n     * 格式： <html:checkbox checkboxes=\"\" checked=\"\" />\n     * @access public\n     * @param array $tag 标签属性\n     * @return string|void\n     */\n    public function _checkbox($tag) {\n        $name       = $tag['name'];\n        $checkboxes = $tag['checkboxes'];\n        $checked    = $tag['checked'];\n        $separator  = $tag['separator'];\n        $checkboxes = $this->tpl->get($checkboxes);\n        $checked    = $this->tpl->get($checked)?$this->tpl->get($checked):$checked;\n        $parseStr   = '';\n        foreach($checkboxes as $key=>$val) {\n            if($checked == $key  || in_array($key,$checked) ) {\n                $parseStr .= '<input type=\"checkbox\" checked=\"checked\" name=\"'.$name.'[]\" value=\"'.$key.'\">'.$val.$separator;\n            }else {\n                $parseStr .= '<input type=\"checkbox\" name=\"'.$name.'[]\" value=\"'.$key.'\">'.$val.$separator;\n            }\n        }\n        return $parseStr;\n    }\n\n    /**\n     * radio标签解析\n     * 格式： <html:radio radios=\"name\" checked=\"value\" />\n     * @access public\n     * @param array $tag 标签属性\n     * @return string|void\n     */\n    public function _radio($tag) {\n        $name       = $tag['name'];\n        $radios     = $tag['radios'];\n        $checked    = $tag['checked'];\n        $separator  = $tag['separator'];\n        $radios     = $this->tpl->get($radios);\n        $checked    = $this->tpl->get($checked)?$this->tpl->get($checked):$checked;\n        $parseStr   = '';\n        foreach($radios as $key=>$val) {\n            if($checked == $key ) {\n                $parseStr .= '<input type=\"radio\" checked=\"checked\" name=\"'.$name.'[]\" value=\"'.$key.'\">'.$val.$separator;\n            }else {\n                $parseStr .= '<input type=\"radio\" name=\"'.$name.'[]\" value=\"'.$key.'\">'.$val.$separator;\n            }\n\n        }\n        return $parseStr;\n    }\n\n    /**\n     * list标签解析\n     * 格式： <html:grid datasource=\"\" show=\"vo\" />\n     * @access public\n     * @param array $tag 标签属性\n     * @return string\n     */\n    public function _grid($tag) {\n        $id         = $tag['id'];                       //表格ID\n        $datasource = $tag['datasource'];               //列表显示的数据源VoList名称\n        $pk         = empty($tag['pk'])?'id':$tag['pk'];//主键名，默认为id\n        $style      = $tag['style'];                    //样式名\n        $name       = !empty($tag['name'])?$tag['name']:'vo';                 //Vo对象名\n        $action     = !empty($tag['action'])?$tag['action']:false;                   //是否显示功能操作\n        $key         =  !empty($tag['key'])?true:false;\n        if(isset($tag['actionlist'])) {\n            $actionlist = explode(',',trim($tag['actionlist']));    //指定功能列表\n        }\n\n        if(substr($tag['show'],0,1)=='$') {\n            $show   = $this->tpl->get(substr($tag['show'],1));\n        }else {\n            $show   = $tag['show'];\n        }\n        $show       = explode(',',$show);                //列表显示字段列表\n\n        //计算表格的列数\n        $colNum     = count($show);\n        if(!empty($action))     $colNum++;\n        if(!empty($key))  $colNum++;\n\n        //显示开始\n\t\t$parseStr\t= \"<!-- Think 系统列表组件开始 -->\\n\";\n        $parseStr  .= '<table id=\"'.$id.'\" class=\"'.$style.'\" cellpadding=0 cellspacing=0 >';\n        $parseStr  .= '<tr><td height=\"5\" colspan=\"'.$colNum.'\" class=\"topTd\" ></td></tr>';\n        $parseStr  .= '<tr class=\"row\" >';\n        //列表需要显示的字段\n        $fields = array();\n        foreach($show as $val) {\n        \t$fields[] = explode(':',$val);\n        }\n\n        if(!empty($key)) {\n            $parseStr .= '<th width=\"12\">No</th>';\n        }\n        foreach($fields as $field) {//显示指定的字段\n            $property = explode('|',$field[0]);\n            $showname = explode('|',$field[1]);\n            if(isset($showname[1])) {\n                $parseStr .= '<th width=\"'.$showname[1].'\">';\n            }else {\n                $parseStr .= '<th>';\n            }\n            $parseStr .= $showname[0].'</th>';\n        }\n        if(!empty($action)) {//如果指定显示操作功能列\n            $parseStr .= '<th >操作</th>';\n        }\n        $parseStr .= '</tr>';\n        $parseStr .= '<volist name=\"'.$datasource.'\" id=\"'.$name.'\" ><tr class=\"row\" >';\t//支持鼠标移动单元行颜色变化 具体方法在js中定义\n\n        if(!empty($key)) {\n            $parseStr .= '<td>{$i}</td>';\n        }\n        foreach($fields as $field) {\n            //显示定义的列表字段\n            $parseStr   .=  '<td>';\n            if(!empty($field[2])) {\n                // 支持列表字段链接功能 具体方法由JS函数实现\n                $href = explode('|',$field[2]);\n                if(count($href)>1) {\n                    //指定链接传的字段值\n                    // 支持多个字段传递\n                    $array = explode('^',$href[1]);\n                    if(count($array)>1) {\n                        foreach ($array as $a){\n                            $temp[] =  '\\'{$'.$name.'.'.$a.'|addslashes}\\'';\n                        }\n                        $parseStr .= '<a href=\"javascript:'.$href[0].'('.implode(',',$temp).')\">';\n                    }else{\n                        $parseStr .= '<a href=\"javascript:'.$href[0].'(\\'{$'.$name.'.'.$href[1].'|addslashes}\\')\">';\n                    }\n                }else {\n                    //如果没有指定默认传编号值\n                    $parseStr .= '<a href=\"javascript:'.$field[2].'(\\'{$'.$name.'.'.$pk.'|addslashes}\\')\">';\n                }\n            }\n            if(strpos($field[0],'^')) {\n                $property = explode('^',$field[0]);\n                foreach ($property as $p){\n                    $unit = explode('|',$p);\n                    if(count($unit)>1) {\n                        $parseStr .= '{$'.$name.'.'.$unit[0].'|'.$unit[1].'} ';\n                    }else {\n                        $parseStr .= '{$'.$name.'.'.$p.'} ';\n                    }\n                }\n            }else{\n                $property = explode('|',$field[0]);\n                if(count($property)>1) {\n                    $parseStr .= '{$'.$name.'.'.$property[0].'|'.$property[1].'}';\n                }else {\n                    $parseStr .= '{$'.$name.'.'.$field[0].'}';\n                }\n            }\n            if(!empty($field[2])) {\n                $parseStr .= '</a>';\n            }\n            $parseStr .= '</td>';\n\n        }\n        if(!empty($action)) {//显示功能操作\n            if(!empty($actionlist[0])) {//显示指定的功能项\n                $parseStr .= '<td>';\n                foreach($actionlist as $val) {\n\t\t\t\t\tif(strpos($val,':')) {\n\t\t\t\t\t\t$a = explode(':',$val);\n\t\t\t\t\t\tif(count($a)>2) {\n                            $parseStr .= '<a href=\"javascript:'.$a[0].'(\\'{$'.$name.'.'.$a[2].'}\\')\">'.$a[1].'</a>&nbsp;';\n\t\t\t\t\t\t}else {\n\t\t\t\t\t\t\t$parseStr .= '<a href=\"javascript:'.$a[0].'(\\'{$'.$name.'.'.$pk.'}\\')\">'.$a[1].'</a>&nbsp;';\n\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$array\t=\texplode('|',$val);\n\t\t\t\t\t\tif(count($array)>2) {\n\t\t\t\t\t\t\t$parseStr\t.= ' <a href=\"javascript:'.$array[1].'(\\'{$'.$name.'.'.$array[0].'}\\')\">'.$array[2].'</a>&nbsp;';\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$parseStr .= ' {$'.$name.'.'.$val.'}&nbsp;';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n                }\n                $parseStr .= '</td>';\n            }\n        }\n        $parseStr\t.= '</tr></volist><tr><td height=\"5\" colspan=\"'.$colNum.'\" class=\"bottomTd\"></td></tr></table>';\n        $parseStr\t.= \"\\n<!-- Think 系统列表组件结束 -->\\n\";\n        return $parseStr;\n    }\n\n    /**\n     * list标签解析\n     * 格式： <html:list datasource=\"\" show=\"\" />\n     * @access public\n     * @param array $tag 标签属性\n     * @return string\n     */\n    public function _list($tag) {\n        $id         = $tag['id'];                       //表格ID\n        $datasource = $tag['datasource'];               //列表显示的数据源VoList名称\n        $pk         = empty($tag['pk'])?'id':$tag['pk'];//主键名，默认为id\n        $style      = $tag['style'];                    //样式名\n        $name       = !empty($tag['name'])?$tag['name']:'vo';                 //Vo对象名\n        $action     = $tag['action']=='true'?true:false;                   //是否显示功能操作\n        $key         =  !empty($tag['key'])?true:false;\n        $sort      = $tag['sort']=='false'?false:true;\n        $checkbox   = $tag['checkbox'];                 //是否显示Checkbox\n        if(isset($tag['actionlist'])) {\n            if(substr($tag['actionlist'],0,1)=='$') {\n                $actionlist   = $this->tpl->get(substr($tag['actionlist'],1));\n            }else {\n                $actionlist   = $tag['actionlist'];\n            }\n            $actionlist = explode(',',trim($actionlist));    //指定功能列表\n        }\n\n        if(substr($tag['show'],0,1)=='$') {\n            $show   = $this->tpl->get(substr($tag['show'],1));\n        }else {\n            $show   = $tag['show'];\n        }\n        $show       = explode(',',$show);                //列表显示字段列表\n\n        //计算表格的列数\n        $colNum     = count($show);\n        if(!empty($checkbox))   $colNum++;\n        if(!empty($action))     $colNum++;\n        if(!empty($key))  $colNum++;\n\n        //显示开始\n\t\t$parseStr\t= \"<!-- Think 系统列表组件开始 -->\\n\";\n        $parseStr  .= '<table id=\"'.$id.'\" class=\"'.$style.'\" cellpadding=0 cellspacing=0 >';\n        $parseStr  .= '<tr><td height=\"5\" colspan=\"'.$colNum.'\" class=\"topTd\" ></td></tr>';\n        $parseStr  .= '<tr class=\"row\" >';\n        //列表需要显示的字段\n        $fields = array();\n        foreach($show as $val) {\n        \t$fields[] = explode(':',$val);\n        }\n        if(!empty($checkbox) && 'true'==strtolower($checkbox)) {//如果指定需要显示checkbox列\n            $parseStr .='<th width=\"8\"><input type=\"checkbox\" id=\"check\" onclick=\"CheckAll(\\''.$id.'\\')\"></th>';\n        }\n        if(!empty($key)) {\n            $parseStr .= '<th width=\"12\">No</th>';\n        }\n        foreach($fields as $field) {//显示指定的字段\n            $property = explode('|',$field[0]);\n            $showname = explode('|',$field[1]);\n            if(isset($showname[1])) {\n                $parseStr .= '<th width=\"'.$showname[1].'\">';\n            }else {\n                $parseStr .= '<th>';\n            }\n            $showname[2] = isset($showname[2])?$showname[2]:$showname[0];\n            if($sort) {\n                $parseStr .= '<a href=\"javascript:sortBy(\\''.$property[0].'\\',\\'{$sort}\\',\\''.ACTION_NAME.'\\')\" title=\"按照'.$showname[2].'{$sortType} \">'.$showname[0].'<eq name=\"order\" value=\"'.$property[0].'\" ><img src=\"__PUBLIC__/images/{$sortImg}.gif\" width=\"12\" height=\"17\" border=\"0\" align=\"absmiddle\"></eq></a></th>';\n            }else{\n                $parseStr .= $showname[0].'</th>';\n            }\n\n        }\n        if(!empty($action)) {//如果指定显示操作功能列\n            $parseStr .= '<th >操作</th>';\n        }\n\n        $parseStr .= '</tr>';\n        $parseStr .= '<volist name=\"'.$datasource.'\" id=\"'.$name.'\" ><tr class=\"row\" ';\t//支持鼠标移动单元行颜色变化 具体方法在js中定义\n        if(!empty($checkbox)) {\n        //    $parseStr .= 'onmouseover=\"over(event)\" onmouseout=\"out(event)\" onclick=\"change(event)\" ';\n        }\n        $parseStr .= '>';\n        if(!empty($checkbox)) {//如果需要显示checkbox 则在每行开头显示checkbox\n            $parseStr .= '<td><input type=\"checkbox\" name=\"key\"\tvalue=\"{$'.$name.'.'.$pk.'}\"></td>';\n        }\n        if(!empty($key)) {\n            $parseStr .= '<td>{$i}</td>';\n        }\n        foreach($fields as $field) {\n            //显示定义的列表字段\n            $parseStr   .=  '<td>';\n            if(!empty($field[2])) {\n                // 支持列表字段链接功能 具体方法由JS函数实现\n                $href = explode('|',$field[2]);\n                if(count($href)>1) {\n                    //指定链接传的字段值\n                    // 支持多个字段传递\n                    $array = explode('^',$href[1]);\n                    if(count($array)>1) {\n                        foreach ($array as $a){\n                            $temp[] =  '\\'{$'.$name.'.'.$a.'|addslashes}\\'';\n                        }\n                        $parseStr .= '<a href=\"javascript:'.$href[0].'('.implode(',',$temp).')\">';\n                    }else{\n                        $parseStr .= '<a href=\"javascript:'.$href[0].'(\\'{$'.$name.'.'.$href[1].'|addslashes}\\')\">';\n                    }\n                }else {\n                    //如果没有指定默认传编号值\n                    $parseStr .= '<a href=\"javascript:'.$field[2].'(\\'{$'.$name.'.'.$pk.'|addslashes}\\')\">';\n                }\n            }\n            if(strpos($field[0],'^')) {\n                $property = explode('^',$field[0]);\n                foreach ($property as $p){\n                    $unit = explode('|',$p);\n                    if(count($unit)>1) {\n                        $parseStr .= '{$'.$name.'.'.$unit[0].'|'.$unit[1].'} ';\n                    }else {\n                        $parseStr .= '{$'.$name.'.'.$p.'} ';\n                    }\n                }\n            }else{\n                $property = explode('|',$field[0]);\n                if(count($property)>1) {\n                    $parseStr .= '{$'.$name.'.'.$property[0].'|'.$property[1].'}';\n                }else {\n                    $parseStr .= '{$'.$name.'.'.$field[0].'}';\n                }\n            }\n            if(!empty($field[2])) {\n                $parseStr .= '</a>';\n            }\n            $parseStr .= '</td>';\n\n        }\n        if(!empty($action)) {//显示功能操作\n            if(!empty($actionlist[0])) {//显示指定的功能项\n                $parseStr .= '<td>';\n                foreach($actionlist as $val) {\n                    if(strpos($val,':')) {\n                        $a = explode(':',$val);\n                        if(count($a)>2) {\n                            $parseStr .= '<a href=\"javascript:'.$a[0].'(\\'{$'.$name.'.'.$a[2].'}\\')\">'.$a[1].'</a>&nbsp;';\n                        }else {\n                            $parseStr .= '<a href=\"javascript:'.$a[0].'(\\'{$'.$name.'.'.$pk.'}\\')\">'.$a[1].'</a>&nbsp;';\n                        }\n                    }else{\n                        $array\t=\texplode('|',$val);\n                        if(count($array)>2) {\n                            $parseStr\t.= ' <a href=\"javascript:'.$array[1].'(\\'{$'.$name.'.'.$array[0].'}\\')\">'.$array[2].'</a>&nbsp;';\n                        }else{\n                            $parseStr .= ' {$'.$name.'.'.$val.'}&nbsp;';\n                        }\n                    }\n                }\n                $parseStr .= '</td>';\n            }\n        }\n        $parseStr\t.= '</tr></volist><tr><td height=\"5\" colspan=\"'.$colNum.'\" class=\"bottomTd\"></td></tr></table>';\n        $parseStr\t.= \"\\n<!-- Think 系统列表组件结束 -->\\n\";\n        return $parseStr;\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Template/TagLib.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Template;\n/**\n * ThinkPHP标签库TagLib解析基类\n */\nclass TagLib {\n\n    /**\n     * 标签库定义XML文件\n     * @var string\n     * @access protected\n     */\n    protected $xml      = '';\n    protected $tags     = array();// 标签定义\n    /**\n     * 标签库名称\n     * @var string\n     * @access protected\n     */\n    protected $tagLib   ='';\n\n    /**\n     * 标签库标签列表\n     * @var string\n     * @access protected\n     */\n    protected $tagList  = array();\n\n    /**\n     * 标签库分析数组\n     * @var string\n     * @access protected\n     */\n    protected $parse    = array();\n\n    /**\n     * 标签库是否有效\n     * @var string\n     * @access protected\n     */\n    protected $valid    = false;\n\n    /**\n     * 当前模板对象\n     * @var object\n     * @access protected\n     */\n    protected $tpl;\n\n    protected $comparison = array(' nheq '=>' !== ',' heq '=>' === ',' neq '=>' != ',' eq '=>' == ',' egt '=>' >= ',' gt '=>' > ',' elt '=>' <= ',' lt '=>' < ');\n\n    /**\n     * 架构函数\n     * @access public\n     */\n    public function __construct() {\n        $this->tagLib  = strtolower(substr(get_class($this),6));\n        $this->tpl     = \\Think\\Think::instance('Think\\\\Template');\n    }\n\n    /**\n     * TagLib标签属性分析 返回标签属性数组\n     * @access public\n     * @param string $tagStr 标签内容\n     * @return array\n     */\n    public function parseXmlAttr($attr,$tag) {\n        //XML解析安全过滤\n        $attr   =   str_replace('&','___', $attr);\n        $xml    =   '<tpl><tag '.$attr.' /></tpl>';\n        $xml    =   simplexml_load_string($xml);\n        if(!$xml) {\n            E(L('_XML_TAG_ERROR_').' : '.$attr);\n        }\n        $xml    =   (array)($xml->tag->attributes());\n        if(isset($xml['@attributes'])){\n            $array  =   array_change_key_case($xml['@attributes']);\n            if($array) {\n                $tag    =   strtolower($tag);\n                if(!isset($this->tags[$tag])){\n                    // 检测是否存在别名定义\n                    foreach($this->tags as $key=>$val){\n                        if(isset($val['alias']) && in_array($tag,explode(',',$val['alias']))){\n                            $item  =   $val;\n                            break;\n                        }\n                    }\n                }else{\n                    $item  =   $this->tags[$tag];\n                }            \n                $attrs  = explode(',',$item['attr']);\n                if(isset($item['must'])){\n                    $must   =   explode(',',$item['must']);\n                }else{\n                    $must   =   array();\n                }\n                foreach($attrs as $name) {\n                    if( isset($array[$name])) {\n                        $array[$name] = str_replace('___','&',$array[$name]);\n                    }elseif(false !== array_search($name,$must)){\n                        E(L('_PARAM_ERROR_').':'.$name);\n                    }\n                }\n                return $array;\n            }\n        }else{\n            return array();\n        }\n    }\n\n    /**\n     * 解析条件表达式\n     * @access public\n     * @param string $condition 表达式标签内容\n     * @return array\n     */\n    public function parseCondition($condition) {\n        $condition = str_ireplace(array_keys($this->comparison),array_values($this->comparison),$condition);\n        $condition = preg_replace('/\\$(\\w+):(\\w+)\\s/is','$\\\\1->\\\\2 ',$condition);\n        switch(strtolower(C('TMPL_VAR_IDENTIFY'))) {\n            case 'array': // 识别为数组\n                $condition  =   preg_replace('/\\$(\\w+)\\.(\\w+)\\s/is','$\\\\1[\"\\\\2\"] ',$condition);\n                break;\n            case 'obj':  // 识别为对象\n                $condition  =   preg_replace('/\\$(\\w+)\\.(\\w+)\\s/is','$\\\\1->\\\\2 ',$condition);\n                break;\n            default:  // 自动判断数组或对象 只支持二维\n                $condition  =   preg_replace('/\\$(\\w+)\\.(\\w+)\\s/is','(is_array($\\\\1)?$\\\\1[\"\\\\2\"]:$\\\\1->\\\\2) ',$condition);\n        }\n        if(false !== strpos($condition, '$Think'))\n            $condition      =   preg_replace_callback('/(\\$Think.*?)\\s/is', array($this, 'parseThinkVar'), $condition);        \n        return $condition;\n    }\n\n    /**\n     * 自动识别构建变量\n     * @access public\n     * @param string $name 变量描述\n     * @return string\n     */\n    public function autoBuildVar($name) {\n        if('Think.' == substr($name,0,6)){\n            // 特殊变量\n            return $this->parseThinkVar($name);\n        }elseif(strpos($name,'.')) {\n            $vars = explode('.',$name);\n            $var  =  array_shift($vars);\n            switch(strtolower(C('TMPL_VAR_IDENTIFY'))) {\n                case 'array': // 识别为数组\n                    $name = '$'.$var;\n                    foreach ($vars as $key=>$val){\n                        if(0===strpos($val,'$')) {\n                            $name .= '[\"{'.$val.'}\"]';\n                        }else{\n                            $name .= '[\"'.$val.'\"]';\n                        }\n                    }\n                    break;\n                case 'obj':  // 识别为对象\n                    $name = '$'.$var;\n                    foreach ($vars as $key=>$val)\n                        $name .= '->'.$val;\n                    break;\n                default:  // 自动判断数组或对象 只支持二维\n                    $name = 'is_array($'.$var.')?$'.$var.'[\"'.$vars[0].'\"]:$'.$var.'->'.$vars[0];\n            }\n        }elseif(strpos($name,':')){\n            // 额外的对象方式支持\n            $name   =   '$'.str_replace(':','->',$name);\n        }elseif(!defined($name)) {\n            $name = '$'.$name;\n        }\n        return $name;\n    }\n\n    /**\n     * 用于标签属性里面的特殊模板变量解析\n     * 格式 以 Think. 打头的变量属于特殊模板变量\n     * @access public\n     * @param string $varStr  变量字符串\n     * @return string\n     */\n    public function parseThinkVar($varStr){\n        if(is_array($varStr)){//用于正则替换回调函数\n            $varStr = $varStr[1]; \n        }\n        $vars       = explode('.',$varStr);\n        $vars[1]    = strtoupper(trim($vars[1]));\n        $parseStr   = '';\n        if(count($vars)>=3){\n            $vars[2] = trim($vars[2]);\n            switch($vars[1]){\n                case 'SERVER':    $parseStr = '$_SERVER[\\''.$vars[2].'\\']';break;\n                case 'GET':         $parseStr = '$_GET[\\''.$vars[2].'\\']';break;\n                case 'POST':       $parseStr = '$_POST[\\''.$vars[2].'\\']';break;\n                case 'COOKIE':\n                    if(isset($vars[3])) {\n                        $parseStr = '$_COOKIE[\\''.$vars[2].'\\'][\\''.$vars[3].'\\']';\n                    }elseif(C('COOKIE_PREFIX')){\n                        $parseStr = '$_COOKIE[\\''.C('COOKIE_PREFIX').$vars[2].'\\']';\n                    }else{\n                        $parseStr = '$_COOKIE[\\''.$vars[2].'\\']';\n                    }\n                    break;\n                case 'SESSION':\n                    if(isset($vars[3])) {\n                        $parseStr = '$_SESSION[\\''.$vars[2].'\\'][\\''.$vars[3].'\\']';\n                    }elseif(C('SESSION_PREFIX')){\n                        $parseStr = '$_SESSION[\\''.C('SESSION_PREFIX').'\\'][\\''.$vars[2].'\\']';\n                    }else{\n                        $parseStr = '$_SESSION[\\''.$vars[2].'\\']';\n                    }\n                    break;\n                case 'ENV':         $parseStr = '$_ENV[\\''.$vars[2].'\\']';break;\n                case 'REQUEST':  $parseStr = '$_REQUEST[\\''.$vars[2].'\\']';break;\n                case 'CONST':     $parseStr = strtoupper($vars[2]);break;\n                case 'LANG':       $parseStr = 'L(\"'.$vars[2].'\")';break;\n                case 'CONFIG':    $parseStr = 'C(\"'.$vars[2].'\")';break;\n            }\n        }else if(count($vars)==2){\n            switch($vars[1]){\n                case 'NOW':       $parseStr = \"date('Y-m-d g:i a',time())\";break;\n                case 'VERSION':  $parseStr = 'THINK_VERSION';break;\n                case 'TEMPLATE':$parseStr = 'C(\"TEMPLATE_NAME\")';break;\n                case 'LDELIM':    $parseStr = 'C(\"TMPL_L_DELIM\")';break;\n                case 'RDELIM':    $parseStr = 'C(\"TMPL_R_DELIM\")';break;\n                default:  if(defined($vars[1])) $parseStr = $vars[1];\n            }\n        }\n        return $parseStr;\n    }\n\n    // 获取标签定义\n    public function getTags(){\n        return $this->tags;\n    }\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Template.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * ThinkPHP内置模板引擎类\n * 支持XML标签和普通标签的模板解析\n * 编译型模板引擎 支持动态缓存\n */\nclass  Template {\n\n    // 模板页面中引入的标签库列表\n    protected   $tagLib          =   array();\n    // 当前模板文件\n    protected   $templateFile    =   '';\n    // 模板变量\n    public      $tVar            =   array();\n    public      $config          =   array();\n    private     $literal         =   array();\n    private     $block           =   array();\n\n    /**\n     * 架构函数\n     * @access public\n     */\n    public function __construct(){\n        $this->config['cache_path']         =   C('CACHE_PATH');\n        $this->config['template_suffix']    =   C('TMPL_TEMPLATE_SUFFIX');\n        $this->config['cache_suffix']       =   C('TMPL_CACHFILE_SUFFIX');\n        $this->config['tmpl_cache']         =   C('TMPL_CACHE_ON');\n        $this->config['cache_time']         =   C('TMPL_CACHE_TIME');\n        $this->config['taglib_begin']       =   $this->stripPreg(C('TAGLIB_BEGIN'));\n        $this->config['taglib_end']         =   $this->stripPreg(C('TAGLIB_END'));\n        $this->config['tmpl_begin']         =   $this->stripPreg(C('TMPL_L_DELIM'));\n        $this->config['tmpl_end']           =   $this->stripPreg(C('TMPL_R_DELIM'));\n        $this->config['default_tmpl']       =   C('TEMPLATE_NAME');\n        $this->config['layout_item']        =   C('TMPL_LAYOUT_ITEM');\n    }\n\n    private function stripPreg($str) {\n        return str_replace(\n            array('{','}','(',')','|','[',']','-','+','*','.','^','?'),\n            array('\\{','\\}','\\(','\\)','\\|','\\[','\\]','\\-','\\+','\\*','\\.','\\^','\\?'),\n            $str);        \n    }\n\n    // 模板变量获取和设置\n    public function get($name) {\n        if(isset($this->tVar[$name]))\n            return $this->tVar[$name];\n        else\n            return false;\n    }\n\n    public function set($name,$value) {\n        $this->tVar[$name]= $value;\n    }\n\n    /**\n     * 加载模板\n     * @access public\n     * @param string $templateFile 模板文件\n     * @param array  $templateVar 模板变量\n     * @param string $prefix 模板标识前缀\n     * @return void\n     */\n    public function fetch($templateFile,$templateVar,$prefix='') {\n        $this->tVar         =   $templateVar;\n        $templateCacheFile  =   $this->loadTemplate($templateFile,$prefix);\n        Storage::load($templateCacheFile,$this->tVar,null,'tpl');\n    }\n\n    /**\n     * 加载主模板并缓存\n     * @access public\n     * @param string $templateFile 模板文件\n     * @param string $prefix 模板标识前缀\n     * @return string\n     * @throws ThinkExecption\n     */\n    public function loadTemplate ($templateFile,$prefix='') {\n        if(is_file($templateFile)) {\n            $this->templateFile    =  $templateFile;\n            // 读取模板文件内容\n            $tmplContent =  file_get_contents($templateFile);\n        }else{\n            $tmplContent =  $templateFile;\n        }\n         // 根据模版文件名定位缓存文件\n        $tmplCacheFile = $this->config['cache_path'].$prefix.md5($templateFile).$this->config['cache_suffix'];\n\n        // 判断是否启用布局\n        if(C('LAYOUT_ON')) {\n            if(false !== strpos($tmplContent,'{__NOLAYOUT__}')) { // 可以单独定义不使用布局\n                $tmplContent = str_replace('{__NOLAYOUT__}','',$tmplContent);\n            }else{ // 替换布局的主体内容\n                $layoutFile  =  THEME_PATH.C('LAYOUT_NAME').$this->config['template_suffix'];\n                // 检查布局文件\n                if(!is_file($layoutFile)) {\n                    E(L('_TEMPLATE_NOT_EXIST_').':'.$layoutFile);\n                }\n                $tmplContent = str_replace($this->config['layout_item'],$tmplContent,file_get_contents($layoutFile));\n            }\n        }\n        // 编译模板内容\n        $tmplContent =  $this->compiler($tmplContent);\n        Storage::put($tmplCacheFile,trim($tmplContent),'tpl');\n        return $tmplCacheFile;\n    }\n\n    /**\n     * 编译模板文件内容\n     * @access protected\n     * @param mixed $tmplContent 模板内容\n     * @return string\n     */\n    protected function compiler($tmplContent) {\n        //模板解析\n        $tmplContent =  $this->parse($tmplContent);\n        // 还原被替换的Literal标签\n        $tmplContent =  preg_replace_callback('/<!--###literal(\\d+)###-->/is', array($this, 'restoreLiteral'), $tmplContent);\n        // 添加安全代码\n        $tmplContent =  '<?php if (!defined(\\'THINK_PATH\\')) exit();?>'.$tmplContent;\n        // 优化生成的php代码\n        $tmplContent = str_replace('?><?php','',$tmplContent);\n        // 模版编译过滤标签\n        Hook::listen('template_filter',$tmplContent);\n        return strip_whitespace($tmplContent);\n    }\n\n    /**\n     * 模板解析入口\n     * 支持普通标签和TagLib解析 支持自定义标签库\n     * @access public\n     * @param string $content 要解析的模板内容\n     * @return string\n     */\n    public function parse($content) {\n        // 内容为空不解析\n        if(empty($content)) return '';\n        $begin      =   $this->config['taglib_begin'];\n        $end        =   $this->config['taglib_end'];\n        // 检查include语法\n        $content    =   $this->parseInclude($content);\n        // 检查PHP语法\n        $content    =   $this->parsePhp($content);\n        // 首先替换literal标签内容\n        $content    =   preg_replace_callback('/'.$begin.'literal'.$end.'(.*?)'.$begin.'\\/literal'.$end.'/is', array($this, 'parseLiteral'),$content);\n\n        // 获取需要引入的标签库列表\n        // 标签库只需要定义一次，允许引入多个一次\n        // 一般放在文件的最前面\n        // 格式：<taglib name=\"html,mytag...\" />\n        // 当TAGLIB_LOAD配置为true时才会进行检测\n        if(C('TAGLIB_LOAD')) {\n            $this->getIncludeTagLib($content);\n            if(!empty($this->tagLib)) {\n                // 对导入的TagLib进行解析\n                foreach($this->tagLib as $tagLibName) {\n                    $this->parseTagLib($tagLibName,$content);\n                }\n            }\n        }\n        // 预先加载的标签库 无需在每个模板中使用taglib标签加载 但必须使用标签库XML前缀\n        if(C('TAGLIB_PRE_LOAD')) {\n            $tagLibs =  explode(',',C('TAGLIB_PRE_LOAD'));\n            foreach ($tagLibs as $tag){\n                $this->parseTagLib($tag,$content);\n            }\n        }\n        // 内置标签库 无需使用taglib标签导入就可以使用 并且不需使用标签库XML前缀\n        $tagLibs =  explode(',',C('TAGLIB_BUILD_IN'));\n        foreach ($tagLibs as $tag){\n            $this->parseTagLib($tag,$content,true);\n        }\n        //解析普通模板标签 {$tagName}\n        $content = preg_replace_callback('/('.$this->config['tmpl_begin'].')([^\\d\\w\\s'.$this->config['tmpl_begin'].$this->config['tmpl_end'].'].+?)('.$this->config['tmpl_end'].')/is', array($this, 'parseTag'),$content);\n        return $content;\n    }\n\n    // 检查PHP语法\n    protected function parsePhp($content) {\n        if(ini_get('short_open_tag')){\n            // 开启短标签的情况要将<?标签用echo方式输出 否则无法正常输出xml标识\n            $content = preg_replace('/(<\\?(?!php|=|$))/i', '<?php echo \\'\\\\1\\'; ?>'.\"\\n\", $content );\n        }\n        // PHP语法检查\n        if(C('TMPL_DENY_PHP') && false !== strpos($content,'<?php')) {\n            E(L('_NOT_ALLOW_PHP_'));\n        }\n        return $content;\n    }\n\n    // 解析模板中的布局标签\n    protected function parseLayout($content) {\n        // 读取模板中的布局标签\n        $find = preg_match('/'.$this->config['taglib_begin'].'layout\\s(.+?)\\s*?\\/'.$this->config['taglib_end'].'/is',$content,$matches);\n        if($find) {\n            //替换Layout标签\n            $content    =   str_replace($matches[0],'',$content);\n            //解析Layout标签\n            $array      =   $this->parseXmlAttrs($matches[1]);\n            if(!C('LAYOUT_ON') || C('LAYOUT_NAME') !=$array['name'] ) {\n                // 读取布局模板\n                $layoutFile =   THEME_PATH.$array['name'].$this->config['template_suffix'];\n                $replace    =   isset($array['replace'])?$array['replace']:$this->config['layout_item'];\n                // 替换布局的主体内容\n                $content    =   str_replace($replace,$content,file_get_contents($layoutFile));\n            }\n        }else{\n            $content = str_replace('{__NOLAYOUT__}','',$content);\n        }\n        return $content;\n    }\n\n    // 解析模板中的include标签\n    protected function parseInclude($content, $extend = true) {\n        // 解析继承\n        if($extend)\n            $content    =   $this->parseExtend($content);\n        // 解析布局\n        $content    =   $this->parseLayout($content);\n        // 读取模板中的include标签\n        $find       =   preg_match_all('/'.$this->config['taglib_begin'].'include\\s(.+?)\\s*?\\/'.$this->config['taglib_end'].'/is',$content,$matches);\n        if($find) {\n            for($i=0;$i<$find;$i++) {\n                $include    =   $matches[1][$i];\n                $array      =   $this->parseXmlAttrs($include);\n                $file       =   $array['file'];\n                unset($array['file']);\n                $content    =   str_replace($matches[0][$i],$this->parseIncludeItem($file,$array,$extend),$content);\n            }\n        }\n        return $content;\n    }\n\n    // 解析模板中的extend标签\n    protected function parseExtend($content) {\n        $begin      =   $this->config['taglib_begin'];\n        $end        =   $this->config['taglib_end'];        \n        // 读取模板中的继承标签\n        $find       =   preg_match('/'.$begin.'extend\\s(.+?)\\s*?\\/'.$end.'/is',$content,$matches);\n        if($find) {\n            //替换extend标签\n            $content    =   str_replace($matches[0],'',$content);\n            // 记录页面中的block标签\n            preg_replace_callback('/'.$begin.'block\\sname=[\\'\"](.+?)[\\'\"]\\s*?'.$end.'(.*?)'.$begin.'\\/block'.$end.'/is', array($this, 'parseBlock'),$content);\n            // 读取继承模板\n            $array      =   $this->parseXmlAttrs($matches[1]);\n            $content    =   $this->parseTemplateName($array['name']);\n            $content    =   $this->parseInclude($content, false); //对继承模板中的include进行分析\n            // 替换block标签\n            $content = $this->replaceBlock($content);\n        }else{\n            $content    =   preg_replace_callback('/'.$begin.'block\\sname=[\\'\"](.+?)[\\'\"]\\s*?'.$end.'(.*?)'.$begin.'\\/block'.$end.'/is', function($match){return stripslashes($match[2]);}, $content);\n        }\n        return $content;\n    }\n\n    /**\n     * 分析XML属性\n     * @access private\n     * @param string $attrs  XML属性字符串\n     * @return array\n     */\n    private function parseXmlAttrs($attrs) {\n        $xml        =   '<tpl><tag '.$attrs.' /></tpl>';\n        $xml        =   simplexml_load_string($xml);\n        if(!$xml)\n            E(L('_XML_TAG_ERROR_'));\n        $xml        =   (array)($xml->tag->attributes());\n        $array      =   array_change_key_case($xml['@attributes']);\n        return $array;\n    }\n\n    /**\n     * 替换页面中的literal标签\n     * @access private\n     * @param string $content  模板内容\n     * @return string|false\n     */\n    private function parseLiteral($content) {\n        if(is_array($content)) $content = $content[1];\n        if(trim($content)=='')  return '';\n        //$content            =   stripslashes($content);\n        $i                  =   count($this->literal);\n        $parseStr           =   \"<!--###literal{$i}###-->\";\n        $this->literal[$i]  =   $content;\n        return $parseStr;\n    }\n\n    /**\n     * 还原被替换的literal标签\n     * @access private\n     * @param string $tag  literal标签序号\n     * @return string|false\n     */\n    private function restoreLiteral($tag) {\n        if(is_array($tag)) $tag = $tag[1];\n        // 还原literal标签\n        $parseStr   =  $this->literal[$tag];\n        // 销毁literal记录\n        unset($this->literal[$tag]);\n        return $parseStr;\n    }\n\n    /**\n     * 记录当前页面中的block标签\n     * @access private\n     * @param string $name block名称\n     * @param string $content  模板内容\n     * @return string\n     */\n    private function parseBlock($name,$content = '') {\n        if(is_array($name)){\n            $content = $name[2];\n            $name    = $name[1];\n        }\n        $this->block[$name]  =   $content;\n        return '';\n    }\n\n    /**\n     * 替换继承模板中的block标签\n     * @access private\n     * @param string $content  模板内容\n     * @return string\n     */\n    private function replaceBlock($content){\n        static $parse = 0;\n        $begin = $this->config['taglib_begin'];\n        $end   = $this->config['taglib_end'];\n        $reg   = '/('.$begin.'block\\sname=[\\'\"](.+?)[\\'\"]\\s*?'.$end.')(.*?)'.$begin.'\\/block'.$end.'/is';\n        if(is_string($content)){\n            do{\n                $content = preg_replace_callback($reg, array($this, 'replaceBlock'), $content);\n            } while ($parse && $parse--);\n            return $content;\n        } elseif(is_array($content)){\n            if(preg_match('/'.$begin.'block\\sname=[\\'\"](.+?)[\\'\"]\\s*?'.$end.'/is', $content[3])){ //存在嵌套，进一步解析\n                $parse = 1;\n                $content[3] = preg_replace_callback($reg, array($this, 'replaceBlock'), \"{$content[3]}{$begin}/block{$end}\");\n                return $content[1] . $content[3];\n            } else {\n                $name    = $content[2];\n                $content = $content[3];\n                $content = isset($this->block[$name]) ? $this->block[$name] : $content;\n                return $content;\n            }\n        }\n    }\n\n    /**\n     * 搜索模板页面中包含的TagLib库\n     * 并返回列表\n     * @access public\n     * @param string $content  模板内容\n     * @return string|false\n     */\n    public function getIncludeTagLib(& $content) {\n        //搜索是否有TagLib标签\n        $find = preg_match('/'.$this->config['taglib_begin'].'taglib\\s(.+?)(\\s*?)\\/'.$this->config['taglib_end'].'\\W/is',$content,$matches);\n        if($find) {\n            //替换TagLib标签\n            $content        =   str_replace($matches[0],'',$content);\n            //解析TagLib标签\n            $array          =   $this->parseXmlAttrs($matches[1]);\n            $this->tagLib   =   explode(',',$array['name']);\n        }\n        return;\n    }\n\n    /**\n     * TagLib库解析\n     * @access public\n     * @param string $tagLib 要解析的标签库\n     * @param string $content 要解析的模板内容\n     * @param boolean $hide 是否隐藏标签库前缀\n     * @return string\n     */\n    public function parseTagLib($tagLib,&$content,$hide=false) {\n        $begin      =   $this->config['taglib_begin'];\n        $end        =   $this->config['taglib_end'];\n        if(strpos($tagLib,'\\\\')){\n            // 支持指定标签库的命名空间\n            $className  =   $tagLib;\n            $tagLib     =   substr($tagLib,strrpos($tagLib,'\\\\')+1);\n        }else{\n            $className  =   'Think\\\\Template\\TagLib\\\\'.ucwords($tagLib);            \n        }\n        $tLib       =   \\Think\\Think::instance($className);\n        $that       =   $this;\n        foreach ($tLib->getTags() as $name=>$val){\n            $tags = array($name);\n            if(isset($val['alias'])) {// 别名设置\n                $tags       = explode(',',$val['alias']);\n                $tags[]     =  $name;\n            }\n            $level      =   isset($val['level'])?$val['level']:1;\n            $closeTag   =   isset($val['close'])?$val['close']:true;\n            foreach ($tags as $tag){\n                $parseTag = !$hide? $tagLib.':'.$tag: $tag;// 实际要解析的标签名称\n                if(!method_exists($tLib,'_'.$tag)) {\n                    // 别名可以无需定义解析方法\n                    $tag  =  $name;\n                }\n                $n1 = empty($val['attr'])?'(\\s*?)':'\\s([^'.$end.']*)';\n                $this->tempVar = array($tagLib, $tag);\n\n                if (!$closeTag){\n                    $patterns       = '/'.$begin.$parseTag.$n1.'\\/(\\s*?)'.$end.'/is';\n                    $content        = preg_replace_callback($patterns, function($matches) use($tLib,$tag,$that){\n                        return $that->parseXmlTag($tLib,$tag,$matches[1],$matches[2]);\n                    },$content);\n                }else{\n                    $patterns       = '/'.$begin.$parseTag.$n1.$end.'(.*?)'.$begin.'\\/'.$parseTag.'(\\s*?)'.$end.'/is';\n                    for($i=0;$i<$level;$i++) {\n                        $content=preg_replace_callback($patterns,function($matches) use($tLib,$tag,$that){\n                            return $that->parseXmlTag($tLib,$tag,$matches[1],$matches[2]);\n                        },$content);\n                    }\n                }\n            }\n        }\n    }\n\n    /**\n     * 解析标签库的标签\n     * 需要调用对应的标签库文件解析类\n     * @access public\n     * @param object $tagLib  标签库对象实例\n     * @param string $tag  标签名\n     * @param string $attr  标签属性\n     * @param string $content  标签内容\n     * @return string|false\n     */\n    public function parseXmlTag($tagLib,$tag,$attr,$content) {\n        if(ini_get('magic_quotes_sybase'))\n            $attr   =   str_replace('\\\"','\\'',$attr);\n        $parse      =   '_'.$tag;\n        $content    =   trim($content);\n        $tags       =   $tagLib->parseXmlAttr($attr,$tag);\n        return $tagLib->$parse($tags,$content);\n    }\n\n    /**\n     * 模板标签解析\n     * 格式： {TagName:args [|content] }\n     * @access public\n     * @param string $tagStr 标签内容\n     * @return string\n     */\n    public function parseTag($tagStr){\n        if(is_array($tagStr)) $tagStr = $tagStr[2];\n        //if (MAGIC_QUOTES_GPC) {\n            $tagStr = stripslashes($tagStr);\n        //}\n        $flag   =  substr($tagStr,0,1);\n        $flag2  =  substr($tagStr,1,1);\n        $name   = substr($tagStr,1);\n        if('$' == $flag && '.' != $flag2 && '(' != $flag2){ //解析模板变量 格式 {$varName}\n            return $this->parseVar($name);\n        }elseif('-' == $flag || '+'== $flag){ // 输出计算\n            return  '<?php echo '.$flag.$name.';?>';\n        }elseif(':' == $flag){ // 输出某个函数的结果\n            return  '<?php echo '.$name.';?>';\n        }elseif('~' == $flag){ // 执行某个函数\n            return  '<?php '.$name.';?>';\n        }elseif(substr($tagStr,0,2)=='//' || (substr($tagStr,0,2)=='/*' && substr(rtrim($tagStr),-2)=='*/')){\n            //注释标签\n            return '';\n        }\n        // 未识别的标签直接返回\n        return C('TMPL_L_DELIM') . $tagStr .C('TMPL_R_DELIM');\n    }\n\n    /**\n     * 模板变量解析,支持使用函数\n     * 格式： {$varname|function1|function2=arg1,arg2}\n     * @access public\n     * @param string $varStr 变量数据\n     * @return string\n     */\n    public function parseVar($varStr){\n        $varStr     =   trim($varStr);\n        static $_varParseList = array();\n        //如果已经解析过该变量字串，则直接返回变量值\n        if(isset($_varParseList[$varStr])) return $_varParseList[$varStr];\n        $parseStr   =   '';\n        $varExists  =   true;\n        if(!empty($varStr)){\n            $varArray = explode('|',$varStr);\n            //取得变量名称\n            $var = array_shift($varArray);\n            if('Think.' == substr($var,0,6)){\n                // 所有以Think.打头的以特殊变量对待 无需模板赋值就可以输出\n                $name = $this->parseThinkVar($var);\n            }elseif( false !== strpos($var,'.')) {\n                //支持 {$var.property}\n                $vars = explode('.',$var);\n                $var  =  array_shift($vars);\n                switch(strtolower(C('TMPL_VAR_IDENTIFY'))) {\n                    case 'array': // 识别为数组\n                        $name = '$'.$var;\n                        foreach ($vars as $key=>$val)\n                            $name .= '[\"'.$val.'\"]';\n                        break;\n                    case 'obj':  // 识别为对象\n                        $name = '$'.$var;\n                        foreach ($vars as $key=>$val)\n                            $name .= '->'.$val;\n                        break;\n                    default:  // 自动判断数组或对象 只支持二维\n                        $name = 'is_array($'.$var.')?$'.$var.'[\"'.$vars[0].'\"]:$'.$var.'->'.$vars[0];\n                }\n            }elseif(false !== strpos($var,'[')) {\n                //支持 {$var['key']} 方式输出数组\n                $name = \"$\".$var;\n                preg_match('/(.+?)\\[(.+?)\\]/is',$var,$match);\n                $var = $match[1];\n            }elseif(false !==strpos($var,':') && false ===strpos($var,'(') && false ===strpos($var,'::') && false ===strpos($var,'?')){\n                //支持 {$var:property} 方式输出对象的属性\n                $vars = explode(':',$var);\n                $var  =  str_replace(':','->',$var);\n                $name = \"$\".$var;\n                $var  = $vars[0];\n            }else {\n                $name = \"$$var\";\n            }\n            //对变量使用函数\n            if(count($varArray)>0)\n                $name = $this->parseVarFunction($name,$varArray);\n            $parseStr = '<?php echo ('.$name.'); ?>';\n        }\n        $_varParseList[$varStr] = $parseStr;\n        return $parseStr;\n    }\n\n    /**\n     * 对模板变量使用函数\n     * 格式 {$varname|function1|function2=arg1,arg2}\n     * @access public\n     * @param string $name 变量名\n     * @param array $varArray  函数列表\n     * @return string\n     */\n    public function parseVarFunction($name,$varArray){\n        //对变量使用函数\n        $length = count($varArray);\n        //取得模板禁止使用函数列表\n        $template_deny_funs = explode(',',C('TMPL_DENY_FUNC_LIST'));\n        for($i=0;$i<$length ;$i++ ){\n            $args = explode('=',$varArray[$i],2);\n            //模板函数过滤\n            $fun = trim($args[0]);\n            switch($fun) {\n            case 'default':  // 特殊模板函数\n                $name = '(isset('.$name.') && ('.$name.' !== \"\"))?('.$name.'):'.$args[1];\n                break;\n            default:  // 通用模板函数\n                if(!in_array($fun,$template_deny_funs)){\n                    if(isset($args[1])){\n                        if(strstr($args[1],'###')){\n                            $args[1] = str_replace('###',$name,$args[1]);\n                            $name = \"$fun($args[1])\";\n                        }else{\n                            $name = \"$fun($name,$args[1])\";\n                        }\n                    }else if(!empty($args[0])){\n                        $name = \"$fun($name)\";\n                    }\n                }\n            }\n        }\n        return $name;\n    }\n\n    /**\n     * 特殊模板变量解析\n     * 格式 以 $Think. 打头的变量属于特殊模板变量\n     * @access public\n     * @param string $varStr  变量字符串\n     * @return string\n     */\n    public function parseThinkVar($varStr){\n        $vars = explode('.',$varStr);\n        $vars[1] = strtoupper(trim($vars[1]));\n        $parseStr = '';\n        if(count($vars)>=3){\n            $vars[2] = trim($vars[2]);\n            switch($vars[1]){\n                case 'SERVER':\n                    $parseStr = '$_SERVER[\\''.strtoupper($vars[2]).'\\']';break;\n                case 'GET':\n                    $parseStr = '$_GET[\\''.$vars[2].'\\']';break;\n                case 'POST':\n                    $parseStr = '$_POST[\\''.$vars[2].'\\']';break;\n                case 'COOKIE':\n                    if(isset($vars[3])) {\n                        $parseStr = '$_COOKIE[\\''.$vars[2].'\\'][\\''.$vars[3].'\\']';\n                    }else{\n                        $parseStr = 'cookie(\\''.$vars[2].'\\')';\n                    }\n                    break;\n                case 'SESSION':\n                    if(isset($vars[3])) {\n                        $parseStr = '$_SESSION[\\''.$vars[2].'\\'][\\''.$vars[3].'\\']';\n                    }else{\n                        $parseStr = 'session(\\''.$vars[2].'\\')';\n                    }\n                    break;\n                case 'ENV':\n                    $parseStr = '$_ENV[\\''.strtoupper($vars[2]).'\\']';break;\n                case 'REQUEST':\n                    $parseStr = '$_REQUEST[\\''.$vars[2].'\\']';break;\n                case 'CONST':\n                    $parseStr = strtoupper($vars[2]);break;\n                case 'LANG':\n                    $parseStr = 'L(\"'.$vars[2].'\")';break;\n                case 'CONFIG':\n                    if(isset($vars[3])) {\n                        $vars[2] .= '.'.$vars[3];\n                    }\n                    $parseStr = 'C(\"'.$vars[2].'\")';break;\n                default:break;\n            }\n        }else if(count($vars)==2){\n            switch($vars[1]){\n                case 'NOW':\n                    $parseStr = \"date('Y-m-d g:i a',time())\";\n                    break;\n                case 'VERSION':\n                    $parseStr = 'THINK_VERSION';\n                    break;\n                case 'TEMPLATE':\n                    $parseStr = \"'\".$this->templateFile.\"'\";//'C(\"TEMPLATE_NAME\")';\n                    break;\n                case 'LDELIM':\n                    $parseStr = 'C(\"TMPL_L_DELIM\")';\n                    break;\n                case 'RDELIM':\n                    $parseStr = 'C(\"TMPL_R_DELIM\")';\n                    break;\n                default:\n                    if(defined($vars[1]))\n                        $parseStr = $vars[1];\n            }\n        }\n        return $parseStr;\n    }\n\n    /**\n     * 加载公共模板并缓存 和当前模板在同一路径，否则使用相对路径\n     * @access private\n     * @param string $tmplPublicName  公共模板文件名\n     * @param array $vars  要传递的变量列表\n     * @return string\n     */\n    private function parseIncludeItem($tmplPublicName,$vars=array(),$extend){\n        // 分析模板文件名并读取内容\n        $parseStr = $this->parseTemplateName($tmplPublicName);\n        // 替换变量\n        foreach ($vars as $key=>$val) {\n            $parseStr = str_replace('['.$key.']',$val,$parseStr);\n        }\n        // 再次对包含文件进行模板分析\n        return $this->parseInclude($parseStr,$extend);\n    }\n\n    /**\n     * 分析加载的模板文件并读取内容 支持多个模板文件读取\n     * @access private\n     * @param string $tmplPublicName  模板文件名\n     * @return string\n     */    \n    private function parseTemplateName($templateName){\n        if(substr($templateName,0,1)=='$')\n            //支持加载变量文件名\n            $templateName = $this->get(substr($templateName,1));\n        $array  =   explode(',',$templateName);\n        $parseStr   =   ''; \n        foreach ($array as $templateName){\n            if(empty($templateName)) continue;\n            if(false === strpos($templateName,$this->config['template_suffix'])) {\n                // 解析规则为 模块@主题/控制器/操作\n                $templateName   =   T($templateName);\n            }\n            // 获取模板文件内容\n            $parseStr .= file_get_contents($templateName);\n        }\n        return $parseStr;\n    }    \n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Think.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\nnamespace Think;\n/**\n * ThinkPHP 引导类\n */\nclass Think {\n\n    // 类映射\n    private static $_map      = array();\n\n    // 实例化对象\n    private static $_instance = array();\n\n    /**\n     * 应用程序初始化\n     * @access public\n     * @return void\n     */\n    static public function start() {\n      // 注册AUTOLOAD方法\n      spl_autoload_register('Think\\Think::autoload');      \n      // 设定错误和异常处理\n      register_shutdown_function('Think\\Think::fatalError');\n      set_error_handler('Think\\Think::appError');\n      set_exception_handler('Think\\Think::appException');\n\n      // 初始化文件存储方式\n      Storage::connect(STORAGE_TYPE);\n\n      $runtimefile  = RUNTIME_PATH.APP_MODE.'~runtime.php';\n      if(!APP_DEBUG && Storage::has($runtimefile)){\n          Storage::load($runtimefile);\n      }else{\n          if(Storage::has($runtimefile))\n              Storage::unlink($runtimefile);\n          $content =  '';\n          // 读取应用模式\n          $mode   =   include is_file(CONF_PATH.'core.php')?CONF_PATH.'core.php':MODE_PATH.APP_MODE.'.php';\n          // 加载核心文件\n          foreach ($mode['core'] as $file){\n              if(is_file($file)) {\n                include $file;\n                if(!APP_DEBUG) $content   .= compile($file);\n              }\n          }\n\n          // 加载应用模式配置文件\n          foreach ($mode['config'] as $key=>$file){\n              is_numeric($key)?C(load_config($file)):C($key,load_config($file));\n          }\n\n          // 读取当前应用模式对应的配置文件\n          if('common' != APP_MODE && is_file(CONF_PATH.'config_'.APP_MODE.CONF_EXT))\n              C(load_config(CONF_PATH.'config_'.APP_MODE.CONF_EXT));  \n\n          // 加载模式别名定义\n          if(isset($mode['alias'])){\n              self::addMap(is_array($mode['alias'])?$mode['alias']:include $mode['alias']);\n          }\n\n          // 加载应用别名定义文件\n          if(is_file(CONF_PATH.'alias.php'))\n              self::addMap(include CONF_PATH.'alias.php');\n\n          // 加载模式行为定义\n          if(isset($mode['tags'])) {\n              Hook::import(is_array($mode['tags'])?$mode['tags']:include $mode['tags']);\n          }\n\n          // 加载应用行为定义\n          if(is_file(CONF_PATH.'tags.php'))\n              // 允许应用增加开发模式配置定义\n              Hook::import(include CONF_PATH.'tags.php');   \n\n          // 加载框架底层语言包\n          L(include THINK_PATH.'Lang/'.strtolower(C('DEFAULT_LANG')).'.php');\n\n          if(!APP_DEBUG){\n              $content  .=  \"\\nnamespace { Think\\\\Think::addMap(\".var_export(self::$_map,true).\");\";\n              $content  .=  \"\\nL(\".var_export(L(),true).\");\\nC(\".var_export(C(),true).');Think\\Hook::import('.var_export(Hook::get(),true).');}';\n              Storage::put($runtimefile,strip_whitespace('<?php '.$content));\n          }else{\n            // 调试模式加载系统默认的配置文件\n            C(include THINK_PATH.'Conf/debug.php');\n            // 读取应用调试配置文件\n            if(is_file(CONF_PATH.'debug'.CONF_EXT))\n                C(include CONF_PATH.'debug'.CONF_EXT);           \n          }\n      }\n\n      // 读取当前应用状态对应的配置文件\n      if(APP_STATUS && is_file(CONF_PATH.APP_STATUS.CONF_EXT))\n          C(include CONF_PATH.APP_STATUS.CONF_EXT);   \n\n      // 设置系统时区\n      date_default_timezone_set(C('DEFAULT_TIMEZONE'));\n\n      // 检查应用目录结构 如果不存在则自动创建\n      if(C('CHECK_APP_DIR')) {\n          $module     =   defined('BIND_MODULE') ? BIND_MODULE : C('DEFAULT_MODULE');\n          if(!is_dir(APP_PATH.$module) || !is_dir(LOG_PATH)){\n              // 检测应用目录结构\n              Build::checkDir($module);\n          }\n      }\n\n      // 记录加载文件时间\n      G('loadTime');\n      // 运行应用\n      App::run();\n    }\n\n    // 注册classmap\n    static public function addMap($class, $map=''){\n        if(is_array($class)){\n            self::$_map = array_merge(self::$_map, $class);\n        }else{\n            self::$_map[$class] = $map;\n        }        \n    }\n\n    // 获取classmap\n    static public function getMap($class=''){\n        if(''===$class){\n            return self::$_map;\n        }elseif(isset(self::$_map[$class])){\n            return self::$_map[$class];\n        }else{\n            return null;\n        }\n    }\n\n    /**\n     * 类库自动加载\n     * @param string $class 对象类名\n     * @return void\n     */\n    public static function autoload($class) {\n        // 检查是否存在映射\n        if(isset(self::$_map[$class])) {\n            include self::$_map[$class];\n        }elseif(false !== strpos($class,'\\\\')){\n          $name           =   strstr($class, '\\\\', true);\n          if(in_array($name,array('Think','Org','Behavior','Com','Vendor')) || is_dir(LIB_PATH.$name)){ \n              // Library目录下面的命名空间自动定位\n              $path       =   LIB_PATH;\n          }else{\n              // 检测自定义命名空间 否则就以模块为命名空间\n              $namespace  =   C('AUTOLOAD_NAMESPACE');\n              $path       =   isset($namespace[$name])? dirname($namespace[$name]).'/' : APP_PATH;\n          }\n          $filename       =   $path . str_replace('\\\\', '/', $class) . EXT;\n          if(is_file($filename)) {\n              // Win环境下面严格区分大小写\n              if (IS_WIN && false === strpos(str_replace('/', '\\\\', realpath($filename)), $class . EXT)){\n                  return ;\n              }\n              include $filename;\n          }\n        }elseif (!C('APP_USE_NAMESPACE')) {\n            // 自动加载的类库层\n            foreach(explode(',',C('APP_AUTOLOAD_LAYER')) as $layer){\n                if(substr($class,-strlen($layer))==$layer){\n                    if(require_cache(MODULE_PATH.$layer.'/'.$class.EXT)) {\n                        return ;\n                    }\n                }            \n            }\n            // 根据自动加载路径设置进行尝试搜索\n            foreach (explode(',',C('APP_AUTOLOAD_PATH')) as $path){\n                if(import($path.'.'.$class))\n                    // 如果加载类成功则返回\n                    return ;\n            }\n        }\n    }\n\n    /**\n     * 取得对象实例 支持调用类的静态方法\n     * @param string $class 对象类名\n     * @param string $method 类的静态方法名\n     * @return object\n     */\n    static public function instance($class,$method='') {\n        $identify   =   $class.$method;\n        if(!isset(self::$_instance[$identify])) {\n            if(class_exists($class)){\n                $o = new $class();\n                if(!empty($method) && method_exists($o,$method))\n                    self::$_instance[$identify] = call_user_func(array(&$o, $method));\n                else\n                    self::$_instance[$identify] = $o;\n            }\n            else\n                self::halt(L('_CLASS_NOT_EXIST_').':'.$class);\n        }\n        return self::$_instance[$identify];\n    }\n\n    /**\n     * 自定义异常处理\n     * @access public\n     * @param mixed $e 异常对象\n     */\n    static public function appException($e) {\n        $error = array();\n        $error['message']   =   $e->getMessage();\n        $trace              =   $e->getTrace();\n        if('E'==$trace[0]['function']) {\n            $error['file']  =   $trace[0]['file'];\n            $error['line']  =   $trace[0]['line'];\n        }else{\n            $error['file']  =   $e->getFile();\n            $error['line']  =   $e->getLine();\n        }\n        $error['trace']     =   $e->getTraceAsString();\n        Log::record($error['message'],Log::ERR);\n        // 发送404信息\n        header('HTTP/1.1 404 Not Found');\n        header('Status:404 Not Found');\n        self::halt($error);\n    }\n\n    /**\n     * 自定义错误处理\n     * @access public\n     * @param int $errno 错误类型\n     * @param string $errstr 错误信息\n     * @param string $errfile 错误文件\n     * @param int $errline 错误行数\n     * @return void\n     */\n    static public function appError($errno, $errstr, $errfile, $errline) {\n      switch ($errno) {\n          case E_ERROR:\n          case E_PARSE:\n          case E_CORE_ERROR:\n          case E_COMPILE_ERROR:\n          case E_USER_ERROR:\n            ob_end_clean();\n            $errorStr = \"$errstr \".$errfile.\" 第 $errline 行.\";\n            if(C('LOG_RECORD')) Log::write(\"[$errno] \".$errorStr,Log::ERR);\n            self::halt($errorStr);\n            break;\n          default:\n            $errorStr = \"[$errno] $errstr \".$errfile.\" 第 $errline 行.\";\n            self::trace($errorStr,'','NOTIC');\n            break;\n      }\n    }\n    \n    // 致命错误捕获\n    static public function fatalError() {\n        Log::save();\n        if ($e = error_get_last()) {\n            switch($e['type']){\n              case E_ERROR:\n              case E_PARSE:\n              case E_CORE_ERROR:\n              case E_COMPILE_ERROR:\n              case E_USER_ERROR:  \n                ob_end_clean();\n                self::halt($e);\n                break;\n            }\n        }\n    }\n\n    /**\n     * 错误输出\n     * @param mixed $error 错误\n     * @return void\n     */\n    static public function halt($error) {\n        $e = array();\n        if (APP_DEBUG || IS_CLI) {\n            //调试模式下输出错误信息\n            if (!is_array($error)) {\n                $trace          = debug_backtrace();\n                $e['message']   = $error;\n                $e['file']      = $trace[0]['file'];\n                $e['line']      = $trace[0]['line'];\n                ob_start();\n                debug_print_backtrace();\n                $e['trace']     = ob_get_clean();\n            } else {\n                $e              = $error;\n            }\n            if(IS_CLI){\n                exit(iconv('UTF-8','gbk',$e['message']).PHP_EOL.'FILE: '.$e['file'].'('.$e['line'].')'.PHP_EOL.$e['trace']);\n            }\n        } else {\n            //否则定向到错误页面\n            $error_page         = C('ERROR_PAGE');\n            if (!empty($error_page)) {\n                redirect($error_page);\n            } else {\n                $message        = is_array($error) ? $error['message'] : $error;\n                $e['message']   = C('SHOW_ERROR_MSG')? $message : C('ERROR_MESSAGE');\n            }\n        }\n        // 包含异常页面模板\n        $exceptionFile =  C('TMPL_EXCEPTION_FILE',null,THINK_PATH.'Tpl/think_exception.tpl');\n        include $exceptionFile;\n        exit;\n    }\n\n    /**\n     * 添加和获取页面Trace记录\n     * @param string $value 变量\n     * @param string $label 标签\n     * @param string $level 日志级别(或者页面Trace的选项卡)\n     * @param boolean $record 是否记录日志\n     * @return void|array\n     */\n    static public function trace($value='[think]',$label='',$level='DEBUG',$record=false) {\n        static $_trace =  array();\n        if('[think]' === $value){ // 获取trace信息\n            return $_trace;\n        }else{\n            $info   =   ($label?$label.':':'').print_r($value,true);\n            $level  =   strtoupper($level);\n            \n            if((defined('IS_AJAX') && IS_AJAX) || !C('SHOW_PAGE_TRACE')  || $record) {\n                Log::record($info,$level,$record);\n            }else{\n                if(!isset($_trace[$level]) || count($_trace[$level])>C('TRACE_MAX_RECORD')) {\n                    $_trace[$level] =   array();\n                }\n                $_trace[$level][]   =   $info;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Upload/Driver/Bcs/bcs.class.php",
    "content": "<?php\nnamespace Think\\Upload\\Driver\\Bcs;\nuse Think\\Upload\\Driver\\Bcs\\BCS_MimeTypes;\nuse Think\\Upload\\Driver\\Bcs\\BCS_RequestCore;\nuse Think\\Upload\\Driver\\Bcs\\BCS_ResponseCore;\n\nif (! defined ( 'BCS_API_PATH' )) {\n\tdefine ( 'BCS_API_PATH', dirname ( __FILE__ ) );\n}\n\n//AK 公钥\ndefine ( 'BCS_AK', '' );\n//SK 私钥\ndefine ( 'BCS_SK', '' );\n//superfile 每个object分片后缀\ndefine ( 'BCS_SUPERFILE_POSTFIX', '_bcs_superfile_' );\n//sdk superfile分片大小 ，单位 B（字节）\ndefine ( 'BCS_SUPERFILE_SLICE_SIZE', 1024 * 1024 );\n\nrequire_once (BCS_API_PATH . '/requestcore.class.php');\nrequire_once (BCS_API_PATH . '/mimetypes.class.php');\n/**\n * Default BCS Exception.\n */\nclass BCS_Exception extends \\Exception {\n}\n/**\n * BCS API\n */\nclass BaiduBCS {\n\t/*%******************************************************************************************%*/\n\t// CLASS CONSTANTS\n\t//百度云存储默认外网域名\n\tconst DEFAULT_URL = 'bcs.duapp.com';\n\t//SDK 版本\n\tconst API_VERSION = '2012-4-17-1.0.1.6';\n\tconst ACL = 'acl';\n\tconst BUCKET = 'bucket';\n\tconst OBJECT = 'object';\n\tconst HEADERS = 'headers';\n\tconst METHOD = 'method';\n\tconst AK = 'ak';\n\tconst SK = 'sk';\n\tconst QUERY_STRING = \"query_string\";\n\tconst IMPORT_BCS_LOG_METHOD = \"import_bs_log_method\";\n\tconst IMPORT_BCS_PRE_FILTER = \"import_bs_pre_filter\";\n\tconst IMPORT_BCS_POST_FILTER = \"import_bs_post_filter\";\n\t/**********************************************************\n\t ******************* Policy Constants**********************\n\t **********************************************************/\n\tconst STATEMETS = 'statements';\n\t//Action 用户动作\n\t//'*'代表所有action\n\tconst BCS_SDK_ACL_ACTION_ALL = '*';\n\t//与bucket相关的action\n\tconst BCS_SDK_ACL_ACTION_LIST_OBJECT = 'list_object';\n\tconst BCS_SDK_ACL_ACTION_PUT_BUCKET_POLICY = 'put_bucket_policy';\n\tconst BCS_SDK_ACL_ACTION_GET_BUCKET_POLICY = 'get_bucket_policy';\n\tconst BCS_SDK_ACL_ACTION_DELETE_BUCKET = 'delete_bucket';\n\t//与object相关的action\n\tconst BCS_SDK_ACL_ACTION_GET_OBJECT = 'get_object';\n\tconst BCS_SDK_ACL_ACTION_PUT_OBJECT = 'put_object';\n\tconst BCS_SDK_ACL_ACTION_DELETE_OBJECT = 'delete_object';\n\tconst BCS_SDK_ACL_ACTION_PUT_OBJECT_POLICY = 'put_object_policy';\n\tconst BCS_SDK_ACL_ACTION_GET_OBJECT_POLICY = 'get_object_policy';\n\tstatic $ACL_ACTIONS = array (\n\t\t\tself::BCS_SDK_ACL_ACTION_ALL,\n\t\t\tself::BCS_SDK_ACL_ACTION_LIST_OBJECT,\n\t\t\tself::BCS_SDK_ACL_ACTION_PUT_BUCKET_POLICY,\n\t\t\tself::BCS_SDK_ACL_ACTION_GET_BUCKET_POLICY,\n\t\t\tself::BCS_SDK_ACL_ACTION_DELETE_BUCKET,\n\t\t\tself::BCS_SDK_ACL_ACTION_GET_OBJECT,\n\t\t\tself::BCS_SDK_ACL_ACTION_PUT_OBJECT,\n\t\t\tself::BCS_SDK_ACL_ACTION_DELETE_OBJECT,\n\t\t\tself::BCS_SDK_ACL_ACTION_PUT_OBJECT_POLICY,\n\t\t\tself::BCS_SDK_ACL_ACTION_GET_OBJECT_POLICY );\n\t//EFFECT:\n\tconst BCS_SDK_ACL_EFFECT_ALLOW = \"allow\";\n\tconst BCS_SDK_ACL_EFFECT_DENY = \"deny\";\n\tstatic $ACL_EFFECTS = array (\n\t\t\tself::BCS_SDK_ACL_EFFECT_ALLOW,\n\t\t\tself::BCS_SDK_ACL_EFFECT_DENY );\n\t//ACL_TYPE:\n\t//公开读权限\n\tconst BCS_SDK_ACL_TYPE_PUBLIC_READ = \"public-read\";\n\t//公开写权限（不具备删除权限）\n\tconst BCS_SDK_ACL_TYPE_PUBLIC_WRITE = \"public-write\";\n\t//公开读写权限（不具备删除权限）\n\tconst BCS_SDK_ACL_TYPE_PUBLIC_READ_WRITE = \"public-read-write\";\n\t//公开所有权限\n\tconst BCS_SDK_ACL_TYPE_PUBLIC_CONTROL = \"public-control\";\n\t//私有权限，仅bucket所有者具有所有权限\n\tconst BCS_SDK_ACL_TYPE_PRIVATE = \"private\";\n\t//SDK中开放此上五种acl_tpe\n\tstatic $ACL_TYPES = array (\n\t\t\tself::BCS_SDK_ACL_TYPE_PUBLIC_READ,\n\t\t\tself::BCS_SDK_ACL_TYPE_PUBLIC_WRITE,\n\t\t\tself::BCS_SDK_ACL_TYPE_PUBLIC_READ_WRITE,\n\t\t\tself::BCS_SDK_ACL_TYPE_PUBLIC_CONTROL,\n\t\t\tself::BCS_SDK_ACL_TYPE_PRIVATE );\n\t/*%******************************************************************************************%*/\n\t// PROPERTIES\n\t//是否使用ssl\n\tprotected $use_ssl = false;\n\t//公钥 account key\n\tprivate $ak;\n\t//私钥 secret key\n\tprivate $sk;\n\t//云存储server地址\n\tprivate $hostname;\n\n\t/**\n\t * 构造函数\n\t * @param string $ak  云存储公钥\n\t * @param string $sk  云存储私钥\n\t * @param string $hostname 云存储Api访问地址\n\t * @throws BCS_Exception\n\t */\n\tpublic function __construct($ak = NULL, $sk = NULL, $hostname = NULL) {\n\t\t//valid ak & sk\n\t\tif (! $ak && ! defined ( 'BCS_AK' ) && false === getenv ( 'HTTP_BAE_ENV_AK' )) {\n\t\t\tthrow new BCS_Exception ( 'No account key was passed into the constructor.' );\n\t\t}\n\t\tif (! $sk && ! defined ( 'BCS_SK' ) && false === getenv ( 'HTTP_BAE_ENV_SK' )) {\n\t\t\tthrow new BCS_Exception ( 'No secret key was passed into the constructor.' );\n\t\t}\n\t\tif ($ak && $sk) {\n\t\t\t$this->ak = $ak;\n\t\t\t$this->sk = $sk;\n\t\t} elseif (defined ( 'BCS_AK' ) && defined ( 'BCS_SK' ) && strlen ( BCS_AK ) > 0 && strlen ( BCS_SK ) > 0) {\n\t\t\t$this->ak = BCS_AK;\n\t\t\t$this->sk = BCS_SK;\n\t\t} elseif (false !== getenv ( 'HTTP_BAE_ENV_AK' ) && false !== getenv ( 'HTTP_BAE_ENV_SK' )) {\n\t\t\t$this->ak = getenv ( 'HTTP_BAE_ENV_AK' );\n\t\t\t$this->sk = getenv ( 'HTTP_BAE_ENV_SK' );\n\t\t} else {\n\t\t\tthrow new BCS_Exception ( 'Construct can not get ak &sk pair, please check!' );\n\t\t}\n\t\t//valid $hostname\n\t\tif (NULL !== $hostname) {\n\t\t\t$this->hostname = $hostname;\n\t\t} elseif (false !== getenv ( 'HTTP_BAE_ENV_ADDR_BCS' )) {\n\t\t\t$this->hostname = getenv ( 'HTTP_BAE_ENV_ADDR_BCS' );\n\t\t} else {\n\t\t\t$this->hostname = self::DEFAULT_URL;\n\t\t}\n\t}\n\n\t/**\n\t * 将消息发往Baidu BCS.\n\t * @param array $opt\n\t * @return BCS_ResponseCore\n\t */\n\tprivate function authenticate($opt) {\n\t\t//set common param into opt\n\t\t$opt [self::AK] = $this->ak;\n\t\t$opt [self::SK] = $this->sk;\n\n\t\t// Validate the S3 bucket name, only list_bucket didnot need validate_bucket\n\t\tif (! ('/' == $opt [self::OBJECT] && '' == $opt [self::BUCKET] && 'GET' == $opt [self::METHOD] && ! isset ( $opt [self::QUERY_STRING] [self::ACL] )) && ! self::validate_bucket ( $opt [self::BUCKET] )) {\n\t\t\tthrow new BCS_Exception ( $opt [self::BUCKET] . 'is not valid, please check!' );\n\t\t}\n\t\t//Validate object\n\t\tif (isset ( $opt [self::OBJECT] ) && ! self::validate_object ( $opt [self::OBJECT] )) {\n\t\t\tthrow new BCS_Exception ( \"Invalid object param[\" . $opt [self::OBJECT] . \"], please check.\", - 1 );\n\t\t}\n\t\t//construct url\n\t\t$url = $this->format_url ( $opt );\n\t\tif ($url === false) {\n\t\t\tthrow new BCS_Exception ( 'Can not format url, please check your param!', - 1 );\n\t\t}\n\t\t$opt ['url'] = $url;\n\t\t$this->log ( \"[method:\" . $opt [self::METHOD] . \"][url:$url]\", $opt );\n\t\t//build request\n\t\t$request = new BCS_RequestCore ( $opt ['url'] );\n\t\t$headers = array (\n\t\t\t\t'Content-Type' => 'application/x-www-form-urlencoded' );\n\n\t\t$request->set_method ( $opt [self::METHOD] );\n\t\t//Write get_object content to fileWriteTo\n\t\tif (isset ( $opt ['fileWriteTo'] )) {\n\t\t\t$request->set_write_file ( $opt ['fileWriteTo'] );\n\t\t}\n\t\t// Merge the HTTP headers\n\t\tif (isset ( $opt [self::HEADERS] )) {\n\t\t\t$headers = array_merge ( $headers, $opt [self::HEADERS] );\n\t\t}\n\t\t// Set content to Http-Body\n\t\tif (isset ( $opt ['content'] )) {\n\t\t\t$request->set_body ( $opt ['content'] );\n\t\t}\n\t\t// Upload file\n\t\tif (isset ( $opt ['fileUpload'] )) {\n\t\t\tif (! file_exists ( $opt ['fileUpload'] )) {\n\t\t\t\tthrow new BCS_Exception ( 'File[' . $opt ['fileUpload'] . '] not found!', - 1 );\n\t\t\t}\n\t\t\t$request->set_read_file ( $opt ['fileUpload'] );\n\t\t\t// Determine the length to read from the file\n\t\t\t$length = $request->read_stream_size; // The file size by default\n\t\t\t$file_size = $length;\n\t\t\tif (isset ( $opt [\"length\"] )) {\n\t\t\t\tif ($opt [\"length\"] > $file_size) {\n\t\t\t\t\tthrow new BCS_Exception ( \"Input opt[length] invalid! It can not bigger than file-size\", - 1 );\n\t\t\t\t}\n\t\t\t\t$length = $opt ['length'];\n\t\t\t}\n\t\t\tif (isset ( $opt ['seekTo'] ) && ! isset ( $opt [\"length\"] )) {\n\t\t\t\t// Read from seekTo until EOF by default, when set seekTo but not set $opt[\"length\"]\n\t\t\t\t$length -= ( integer ) $opt ['seekTo'];\n\t\t\t}\n\t\t\t$request->set_read_stream_size ( $length );\n\t\t\t// Attempt to guess the correct mime-type\n\t\t\tif ($headers ['Content-Type'] === 'application/x-www-form-urlencoded') {\n\t\t\t\t$extension = explode ( '.', $opt ['fileUpload'] );\n\t\t\t\t$extension = array_pop ( $extension );\n\t\t\t\t$mime_type = BCS_MimeTypes::get_mimetype ( $extension );\n\t\t\t\t$headers ['Content-Type'] = $mime_type;\n\t\t\t}\n\t\t\t$headers ['Content-MD5'] = '';\n\t\t}\n\t\t// Handle streaming file offsets\n\t\tif (isset ( $opt ['seekTo'] )) {\n\t\t\t// Pass the seek position to BCS_RequestCore\n\t\t\t$request->set_seek_position ( ( integer ) $opt ['seekTo'] );\n\t\t}\n\t\t// Add headers to request and compute the string to sign\n\t\tforeach ( $headers as $header_key => $header_value ) {\n\t\t\t// Strip linebreaks from header values as they're illegal and can allow for security issues\n\t\t\t$header_value = str_replace ( array (\n\t\t\t\t\t\"\\r\",\n\t\t\t\t\t\"\\n\" ), '', $header_value );\n\t\t\t// Add the header if it has a value\n\t\t\tif ($header_value !== '') {\n\t\t\t\t$request->add_header ( $header_key, $header_value );\n\t\t\t}\n\t\t}\n\t\t// Set the curl options.\n\t\tif (isset ( $opt ['curlopts'] ) && count ( $opt ['curlopts'] )) {\n\t\t\t$request->set_curlopts ( $opt ['curlopts'] );\n\t\t}\n\t\t$request->send_request ();\n\t\trequire_once(dirname(__FILE__). \"/requestcore.class.php\");\n\t\treturn new BCS_ResponseCore ( $request->get_response_header (), $request->get_response_body (), $request->get_response_code () );\n\t}\n\n\t/**\n\t * 获取当前密钥对拥有者的bucket列表\n\t * @param array $opt (Optional)\n\t * BaiduBCS::IMPORT_BCS_LOG_METHOD - String - Optional: 支持用户传入日志处理函数，函数定义如 function f($log)\n\t * @throws BCS_Exception\n\t * @return BCS_ResponseCore\n\t */\n\tpublic function list_bucket($opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\t$opt [self::BUCKET] = '';\n\t\t$opt [self::METHOD] = 'GET';\n\t\t$opt [self::OBJECT] = '/';\n\t\t$response = $this->authenticate ( $opt );\n\t\t$this->log ( $response->isOK () ? \"List bucket success!\" : \"List bucket failed! Response: [\" . $response->body . \"]\", $opt );\n\t\treturn $response;\n\t}\n\n\t/**\n\t * 创建 bucket\n\t * @param string $bucket (Required) bucket名称\n\t * @param string $acl (Optional)    bucket权限设置，若为null，使用server分配的默认权限\n\t * @param array $opt (Optional)\n\t * @throws BCS_Exception\n\t * @return BCS_ResponseCore\n\t */\n\tpublic function create_bucket($bucket, $acl = NULL, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\t$opt [self::BUCKET] = $bucket;\n\t\t$opt [self::METHOD] = 'PUT';\n\t\t$opt [self::OBJECT] = '/';\n\t\tif (NULL !== $acl) {\n\t\t\tif (! in_array ( $acl, self::$ACL_TYPES )) {\n\t\t\t\tthrow new BCS_Exception ( \"Invalid acl_type[\" . $acl . \"], please check!\", - 1 );\n\t\t\t}\n\t\t\tself::set_header_into_opt ( \"x-bs-acl\", $acl, $opt );\n\t\t}\n\t\t$response = $this->authenticate ( $opt );\n\t\t$this->log ( $response->isOK () ? \"Create bucket success!\" : \"Create bucket failed! Response: [\" . $response->body . \"]\", $opt );\n\t\treturn $response;\n\t}\n\n\t/**\n\t * 删除bucket\n\t * @param string $bucket (Required)\n\t * @param array $opt (Optional)\n\t * @return boolean|BCS_ResponseCore\n\t */\n\tpublic function delete_bucket($bucket, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\t$opt [self::BUCKET] = $bucket;\n\t\t$opt [self::METHOD] = 'DELETE';\n\t\t$opt [self::OBJECT] = '/';\n\t\t$response = $this->authenticate ( $opt );\n\t\t$this->log ( $response->isOK () ? \"Delete bucket success!\" : \"Delete bucket failed! Response: [\" . $response->body . \"]\", $opt );\n\t\treturn $response;\n\t}\n\n\t/**\n\t * 设置bucket的acl，有三种模式，\n\t * (1).设置详细json格式的acl；\n\t * a. $acl 为json的array\n\t * b. $acl 为json的string\n\t * (2).通过acl_type字段进行设置\n\t * a. $acl 为BaiduBCS::$ACL_TYPES中的字段\n\t * @param string $bucket (Required)\n\t * @param string $acl (Required)\n\t * @param array $opt (Optional)\n\t * @return boolean|BCS_ResponseCore\n\t */\n\tpublic function set_bucket_acl($bucket, $acl, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\t$result = $this->analyze_user_acl ( $acl );\n\t\t$opt = array_merge ( $opt, $result );\n\t\t$opt [self::BUCKET] = $bucket;\n\t\t$opt [self::METHOD] = 'PUT';\n\t\t$opt [self::OBJECT] = '/';\n\t\t$opt [self::QUERY_STRING] = array (\n\t\t\t\tself::ACL => 1 );\n\t\t$response = $this->authenticate ( $opt );\n\t\t$this->log ( $response->isOK () ? \"Set bucket acl success!\" : \"Set bucket acl failed! Response: [\" . $response->body . \"]\", $opt );\n\t\treturn $response;\n\t}\n\n\t/**\n\t * 获取bucket的acl\n\t * @param string $bucket (Required)\n\t * @param array $opt (Optional)\n\t * @return BCS_ResponseCore\n\t */\n\tpublic function get_bucket_acl($bucket, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\t$opt [self::BUCKET] = $bucket;\n\t\t$opt [self::METHOD] = 'GET';\n\t\t$opt [self::OBJECT] = '/';\n\t\t$opt [self::QUERY_STRING] = array (\n\t\t\t\tself::ACL => 1 );\n\t\t$response = $this->authenticate ( $opt );\n\t\t$this->log ( $response->isOK () ? \"Get bucket acl success!\" : \"Get bucket acl failed! Response: [\" . $response->body . \"]\", $opt );\n\t\treturn $response;\n\t}\n\n\t/**\n\t * 获取bucket中object列表\n\t * @param string $bucket (Required)\n\t * @param array $opt (Optional)\n\t * start : 主要用于翻页功能，用法同mysql中start的用法\n\t * limit : 主要用于翻页功能，用法同mysql中limit的用法\n\t * prefix: 只返回以prefix为前缀的object，此处prefix必须以'/'开头\n\t * @throws BCS_Exception\n\t * @return BCS_ResponseCore\n\t */\n\tpublic function list_object($bucket, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\t$opt [self::BUCKET] = $bucket;\n\t\tif (empty ( $opt [self::BUCKET] )) {\n\t\t\tthrow new BCS_Exception ( \"Bucket should not be empty, please check\", - 1 );\n\t\t}\n\t\t$opt [self::METHOD] = 'GET';\n\t\t$opt [self::OBJECT] = '/';\n\t\t$opt [self::QUERY_STRING] = array ();\n\t\tif (isset ( $opt ['start'] ) && is_int ( $opt ['start'] )) {\n\t\t\t$opt [self::QUERY_STRING] ['start'] = $opt ['start'];\n\t\t}\n\t\tif (isset ( $opt ['limit'] ) && is_int ( $opt ['limit'] )) {\n\t\t\t$opt [self::QUERY_STRING] ['limit'] = $opt ['limit'];\n\t\t}\n\t\tif (isset ( $opt ['prefix'] )) {\n\t\t\t$opt [self::QUERY_STRING] ['prefix'] = rawurlencode ( $opt ['prefix'] );\n\t\t}\n\t\t$response = $this->authenticate ( $opt );\n\t\t$this->log ( $response->isOK () ? \"List object success!\" : \"Lit object failed! Response: [\" . $response->body . \"]\", $opt );\n\t\treturn $response;\n\t}\n\n\t/**\n\t * 以目录形式获取bucket中object列表\n\t * @param string $bucket (Required)\n\t * @param $dir (Required)\n\t * 目录名，格式为必须以'/'开头和结尾，默认为'/'\n\t * @param string $list_model (Required)\n\t * 目录展现形式，值可以为0,1,2，默认为2，以下对各个值的功能进行介绍：\n\t * 0->只返回object列表，不返回子目录列表\n\t * 1->只返回子目录列表，不返回object列表\n\t * 2->同时返回子目录列表和object列表\n\t * @param array $opt (Optional)\n\t * start : 主要用于翻页功能，用法同mysql中start的用法\n\t * limit : 主要用于翻页功能，用法同mysql中limit的用法\n\t * @throws BCS_Exception\n\t * @return BCS_ResponseCore\n\t */\n\tpublic function list_object_by_dir($bucket, $dir = '/', $list_model = 2, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\t$opt [self::BUCKET] = $bucket;\n\t\tif (empty ( $opt [self::BUCKET] )) {\n\t\t\tthrow new BCS_Exception ( \"Bucket should not be empty, please check\", - 1 );\n\t\t}\n\t\t$opt [self::METHOD] = 'GET';\n\t\t$opt [self::OBJECT] = '/';\n\t\t$opt [self::QUERY_STRING] = array ();\n\t\tif (isset ( $opt ['start'] ) && is_int ( $opt ['start'] )) {\n\t\t\t$opt [self::QUERY_STRING] ['start'] = $opt ['start'];\n\t\t}\n\t\tif (isset ( $opt ['limit'] ) && is_int ( $opt ['limit'] )) {\n\t\t\t$opt [self::QUERY_STRING] ['limit'] = $opt ['limit'];\n\t\t}\n\n\t\t$opt [self::QUERY_STRING] ['prefix'] = rawurlencode ( $dir );\n\t\t$opt [self::QUERY_STRING] ['dir'] = $list_model;\n\n\t\t$response = $this->authenticate ( $opt );\n\t\t$this->log ( $response->isOK () ? \"List object success!\" : \"Lit object failed! Response: [\" . $response->body . \"]\", $opt );\n\t\treturn $response;\n\t}\n\n\t/**\n\t * 上传文件\n\t * @param string $bucket (Required)\n\t * @param string $object (Required)\n\t * @param string $file (Required); 需要上传的文件的文件路径\n\t * @param array $opt (Optional)\n\t * filename - Optional; 指定文件名\n\t * acl - Optional ; 上传文件的acl，只能使用acl_type\n\t * seekTo - Optional; 上传文件的偏移位置\n\t * length - Optional; 待上传长度\n\t * @return BCS_ResponseCore\n\t */\n\tpublic function create_object($bucket, $object, $file, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\t$opt [self::BUCKET] = $bucket;\n\t\t$opt [self::OBJECT] = $object;\n\t\t$opt ['fileUpload'] = $file;\n\t\t$opt [self::METHOD] = 'PUT';\n\t\tif (isset ( $opt ['acl'] )) {\n\t\t\tif (in_array ( $opt ['acl'], self::$ACL_TYPES )) {\n\t\t\t\tself::set_header_into_opt ( \"x-bs-acl\", $opt ['acl'], $opt );\n\t\t\t} else {\n\t\t\t\tthrow new BCS_Exception ( \"Invalid acl string, it should be acl_type\", - 1 );\n\t\t\t}\n\t\t\tunset ( $opt ['acl'] );\n\t\t}\n\t\tif (isset ( $opt ['filename'] )) {\n\t\t\tself::set_header_into_opt ( \"Content-Disposition\", 'attachment; filename=' . $opt ['filename'], $opt );\n\t\t}\n\t\t$response = $this->authenticate ( $opt );\n\t\t$this->log ( $response->isOK () ? \"Create object[$object] file[$file] success!\" : \"Create object[$object] file[$file] failed! Response: [\" . $response->body . \"] Logid[\" . $response->header [\"x-bs-request-id\"] . \"]\", $opt );\n\t\treturn $response;\n\t}\n\n\t/**\n\t * 上传文件\n\t * @param string $bucket (Required)\n\t * @param string $object (Required)\n\t * @param string $file (Required); 需要上传的文件的文件路径\n\t * @param array $opt (Optional)\n\t * filename - Optional; 指定文件名\n\t * acl - Optional ; 上传文件的acl，只能使用acl_type\n\t * @return BCS_ResponseCore\n\t */\n\tpublic function create_object_by_content($bucket, $object, $content, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\t$opt [self::BUCKET] = $bucket;\n\t\t$opt [self::OBJECT] = $object;\n\t\t$opt [self::METHOD] = 'PUT';\n\t\tif ($content !== NULL && is_string ( $content )) {\n\t\t\t$opt ['content'] = $content;\n\t\t} else {\n\t\t\tthrow new BCS_Exception ( \"Invalid object content, please check.\", - 1 );\n\t\t}\n\t\tif (isset ( $opt ['acl'] )) {\n\t\t\tif (in_array ( $opt ['acl'], self::$ACL_TYPES )) {\n\t\t\t\tself::set_header_into_opt ( \"x-bs-acl\", $opt ['acl'], $opt );\n\t\t\t} else {\n\t\t\t\tthrow new BCS_Exception ( \"Invalid acl string, it should be acl_type\", - 1 );\n\t\t\t}\n\t\t\tunset ( $opt ['acl'] );\n\t\t}\n\t\tif (isset ( $opt ['filename'] )) {\n\t\t\tself::set_header_into_opt ( \"Content-Disposition\", 'attachment; filename=' . $opt ['filename'], $opt );\n\t\t}\n\t\t$response = $this->authenticate ( $opt );\n\t\t$this->log ( $response->isOK () ? \"Create object[$object] success!\" : \"Create object[$object] failed! Response: [\" . $response->body . \"] Logid[\" . $response->header [\"x-bs-request-id\"] . \"]\", $opt );\n\t\treturn $response;\n\t}\n\n\t/**\n\t * 通过superfile的方式上传文件\n\t * @param string $bucket (Required)\n\t * @param string $object (Required)\n\t * @param string $file (Required); 需要上传的文件的文件路径\n\t * @param array $opt (Optional)\n\t * filename - Optional; 指定文件名\n\t * sub_object_size - Optional; 指定子文件的划分大小，单位B，建议以256KB为单位进行子object划分，默认为1MB进行划分\n\t * @return BCS_ResponseCore\n\t */\n\tpublic function create_object_superfile($bucket, $object, $file, $opt = array()) {\n\t\tif (isset ( $opt ['length'] ) || isset ( $opt ['seekTo'] )) {\n\t\t\tthrow new BCS_Exception ( \"Temporary unsupport opt of length and seekTo of superfile.\", - 1 );\n\t\t}\n\t\t//$opt array\n\t\t$this->assertParameterArray ( $opt );\n\t\t$opt [self::BUCKET] = $bucket;\n\t\t$opt ['fileUpload'] = $file;\n\t\t$opt [self::METHOD] = 'PUT';\n\t\tif (isset ( $opt ['acl'] )) {\n\t\t\tif (in_array ( $opt ['acl'], self::$ACL_TYPES )) {\n\t\t\t\tself::set_header_into_opt ( \"x-bs-acl\", $opt ['acl'], $opt );\n\t\t\t} else {\n\t\t\t\tthrow new BCS_Exception ( \"Invalid acl string, it should be acl_type\", - 1 );\n\t\t\t}\n\t\t\tunset ( $opt ['acl'] );\n\t\t}\n\t\t//切片上传\n\t\tif (! file_exists ( $opt ['fileUpload'] )) {\n\t\t\tthrow new BCS_Exception ( 'File not found!', - 1 );\n\t\t}\n\t\t$fileSize = filesize ( $opt ['fileUpload'] );\n\t\t$sub_object_size = 1024 * 1024; //default 1MB\n\t\tif (defined ( \"BCS_SUPERFILE_SLICE_SIZE\" )) {\n\t\t\t$sub_object_size = BCS_SUPERFILE_SLICE_SIZE;\n\t\t}\n\t\tif (isset ( $opt [\"sub_object_size\"] )) {\n\t\t\tif (is_int ( $opt [\"sub_object_size\"] ) && $opt [\"sub_object_size\"] > 0) {\n\t\t\t\t$sub_object_size = $opt [\"sub_object_size\"];\n\t\t\t} else {\n\t\t\t\tthrow new BCS_Exception ( \"Param [sub_object_size] invalid ,please check!\", - 1 );\n\t\t\t}\n\t\t}\n\t\t$sliceNum = intval ( ceil ( $fileSize / $sub_object_size ) );\n\t\t$this->log ( \"File[\" . $opt ['fileUpload'] . \"], size=[$fileSize], sub_object_size=[$sub_object_size], sub_object_num=[$sliceNum]\", $opt );\n\t\t$object_list = array (\n\t\t\t\t'object_list' => array () );\n\t\tfor($i = 0; $i < $sliceNum; $i ++) {\n\t\t\t//send slice\n\t\t\t$opt ['seekTo'] = $i * $sub_object_size;\n\n\t\t\tif (($i + 1) === $sliceNum) {\n\t\t\t\t//last sub object\n\t\t\t\t$opt ['length'] = (0 === $fileSize % $sub_object_size) ? $sub_object_size : $fileSize % $sub_object_size;\n\t\t\t} else {\n\t\t\t\t$opt ['length'] = $sub_object_size;\n\t\t\t}\n\t\t\t$opt [self::OBJECT] = $object . BCS_SUPERFILE_POSTFIX . $i;\n\t\t\t$object_list ['object_list'] ['part_' . $i] = array ();\n\t\t\t$object_list ['object_list'] ['part_' . $i] ['url'] = 'bs://' . $bucket . $opt [self::OBJECT];\n\t\t\t$this->log ( \"Begin to upload Sub-object[\" . $opt [self::OBJECT] . \"][$i/$sliceNum][seekto:\" . $opt ['seekTo'] . \"][Length:\" . $opt ['length'] . \"]\", $opt );\n\t\t\t$response = $this->create_object ( $bucket, $opt [self::OBJECT], $file, $opt );\n\t\t\tif ($response->isOK ()) {\n\t\t\t\t$this->log ( \"Sub-object upload[\" . $opt [self::OBJECT] . \"][$i/$sliceNum][seekto:\" . $opt ['seekTo'] . \"][Length:\" . $opt ['length'] . \"]success! \", $opt );\n\t\t\t\t$object_list ['object_list'] ['part_' . $i] ['etag'] = $response->header ['Content-MD5'];\n\t\t\t\tcontinue;\n\t\t\t} else {\n\t\t\t\t$this->log ( \"Sub-object upload[\" . $opt [self::OBJECT] . \"][$i/$sliceNum] failed! \", $opt );\n\t\t\t\treturn $response;\n\t\t\t}\n\t\t}\n\t\t//将子文件分片的列表构造成 superfile\n\t\tunset ( $opt ['fileUpload'] );\n\t\tunset ( $opt ['length'] );\n\t\tunset ( $opt ['seekTo'] );\n\t\t$opt ['content'] = self::array_to_json ( $object_list );\n\t\t$opt [self::QUERY_STRING] = array (\n\t\t\t\t\"superfile\" => 1 );\n\t\t$opt [self::OBJECT] = $object;\n\t\tif (isset ( $opt ['filename'] )) {\n\t\t\tself::set_header_into_opt ( \"Content-Disposition\", 'attachment; filename=' . $opt ['filename'], $opt );\n\t\t}\n\t\t$response = $this->authenticate ( $opt );\n\t\t$this->log ( $response->isOK () ? \"Create object-superfile success!\" : \"Create object-superfile failed! Response: [\" . $response->body . \"]\", $opt );\n\t\treturn $response;\n\t}\n\n\t/**\n\t * 将目录中的所有文件进行上传，每个文件为单独object，object命名方式下详：\n\t * 如有 /home/worker/a/b/c.txt  需上传目录为$dir=/home/worker/a\n\t * object命令方式为\n\t * 1. object默认命名方式为 “子目录名 +文件名”，如上述文件c.txt，默认为 '/b/c.txt'\n\t * 2. 增强命名模式，在$opt中有可选参数进行配置\n\t * 举例说明 ：prefix . has_sub_directory?\"/b\":\"\" . '/c.txt'\n\t * @param string $bucket (Required)\n\t * @param string $dir (Required)\n\t * @param array $opt(Optional)\n\t * string prefix 文件object前缀\n\t * boolean has_sub_directory(default=true)   object命名中是否携带文件的子目录结构，若置为false，请确认待上传的目录和所有子目录中没有重名文件，否则会产生object覆盖问题\n\t * BaiduBCS::IMPORT_BCS_PRE_FILTER   用户可自定义上传文件前的操作函数\n\t * 1. 函数参数列表顺序需为 ($bucket,$object,$file,&$opt)，注意$opt为upload_directory函数传入的$opt的拷贝，只对当前object生效\n\t * 2. 函数返回值必须为boolean，当true该文件进行上传，若false跳过上传\n\t * 3. 如果函数返回false，将不会进行post_filter的调用\n\t * BaiduBCS::IMPORT_BCS_POST_FILTER  用户可自定义上传文件后的操作函数\n\t * 1. 函数参数列表顺序需为 ($bucket,$object,$file,&$opt,$response)，注意$opt为upload_directory函数传入的$opt的拷贝，只对当前object生效\n\t * 2. 函数返回值无要求\n\t * string seek_object 用户断点续传，需要为object名称，如果该object在目录中不存在，抛出异常，若存在则将该object和此后的object进行上传\n\t * string seek_object_id 作用同seek_object，只需要传入上传过程中日志中展示的[a/b]中object序号即可，注意object序号是以1开始计算的\n\t * @return array  数组形式的上传结果\n\t * 'success' => int  上传成功的文件数目\n\t * 'skipped' => int  被跳过的文件\n\t * 'failed' => array()   上传失败的文件\n\t *\n\t */\n\tpublic function upload_directory($bucket, $dir, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\tif (! is_dir ( $dir )) {\n\t\t\tthrow new BCS_Exception ( \"$dir is not a dir!\", - 1 );\n\t\t}\n\t\t$result = array (\n\t\t\t\t\"success\" => 0,\n\t\t\t\t\"failed\" => array (),\n\t\t\t\t\"skipped\" => 0 );\n\t\t$prefix = \"\";\n\t\tif (isset ( $opt ['prefix'] )) {\n\t\t\t$prefix = $opt ['prefix'];\n\t\t}\n\t\t$has_sub_directory = true;\n\t\tif (isset ( $opt ['has_sub_directory'] ) && is_bool ( $opt ['has_sub_directory'] )) {\n\t\t\t$has_sub_directory = $opt ['has_sub_directory'];\n\t\t}\n\t\t//获取文件树和构造object名\n\t\t$file_tree = self::get_filetree ( $dir );\n\t\t$objects = array ();\n\t\tforeach ( $file_tree as $file ) {\n\t\t\t$object = $has_sub_directory == true ? substr ( $file, strlen ( $dir ) ) : \"/\" . basename ( $file );\n\t\t\t$objects [$prefix . $object] = $file;\n\t\t}\n\t\t$objectCount = count ( $objects );\n\t\t$before_upload_log = \"Upload directory: bucket[$bucket] upload_dir[$dir] file_sum[$objectCount]\";\n\t\tif (isset ( $opt [\"seek_object_id\"] )) {\n\t\t\t$before_upload_log .= \" seek_object_id[\" . $opt [\"seek_object_id\"] . \"/$objectCount]\";\n\t\t}\n\t\tif (isset ( $opt [\"seek_object\"] )) {\n\t\t\t$before_upload_log .= \" seek_object[\" . $opt [\"seek_object\"] . \"]\";\n\t\t}\n\t\t$this->log ( $before_upload_log, $opt );\n\t\t//查看是否需要查询断点，进行断点续传\n\t\tif (isset ( $opt [\"seek_object_id\"] ) && isset ( $opt [\"seek_object\"] )) {\n\t\t\tthrow new BCS_Exception ( \"Can not set see_object_id and seek_object at the same time!\", - 1 );\n\t\t}\n\n\t\t$num = 1;\n\t\tif (isset ( $opt [\"seek_object\"] )) {\n\t\t\tif (isset ( $objects [$opt [\"seek_object\"]] )) {\n\t\t\t\tforeach ( $objects as $object => $file ) {\n\t\t\t\t\tif ($object != $opt [\"seek_object\"]) {\n\t\t\t\t\t\t//当非断点文件，该object已完成上传\n\t\t\t\t\t\t$this->log ( \"Seeking[\" . $opt [\"seek_object\"] . \"]. Skip id[$num/$objectCount]object[$object]file[$file].\", $opt );\n\t\t\t\t\t\t//$result ['skipped'] [] = \"[$num/$objectCount]  \" . $file;\n\t\t\t\t\t\t$result ['skipped'] ++;\n\t\t\t\t\t\tunset ( $objects [$object] );\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//当找到断点文件，停止循环，从断点文件重新上传\n\t\t\t\t\t\t//当非断点文件，该object已完成上传\n\t\t\t\t\t\t$this->log ( \"Found seek id[$num/$objectCount]object[$object]file[$file], begin from here.\", $opt );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t$num ++;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow new BCS_Exception ( \"Can not find you seek object, please check!\", - 1 );\n\t\t\t}\n\t\t}\n\t\tif (isset ( $opt [\"seek_object_id\"] )) {\n\t\t\tif (is_int ( $opt [\"seek_object_id\"] ) && $opt [\"seek_object_id\"] <= $objectCount) {\n\t\t\t\tforeach ( $objects as $object => $file ) {\n\t\t\t\t\tif ($num < $opt [\"seek_object_id\"]) {\n\t\t\t\t\t\t$this->log ( \"Seeking object of [\" . $opt [\"seek_object_id\"] . \"/$objectCount]. Skip  id[$num/$objectCount]object[$object]file[$file].\", $opt );\n\t\t\t\t\t\t//$result ['skipped'] [] = \"[$num/$objectCount]  \" . $file;\n\t\t\t\t\t\t$result ['skipped'] ++;\n\t\t\t\t\t\tunset ( $objects [$object] );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t$num ++;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow new BCS_Exception ( \"Param seek_object_id not valid, please check!\", - 1 );\n\t\t\t}\n\t\t}\n\t\t//上传objects\n\t\t$objectCount = count ( $objects );\n\t\tforeach ( $objects as $object => $file ) {\n\t\t\t$tmp_opt = array_merge ( $opt );\n\t\t\tif (isset ( $opt [self::IMPORT_BCS_PRE_FILTER] ) && function_exists ( $opt [self::IMPORT_BCS_PRE_FILTER] )) {\n\t\t\t\t$bolRes = $opt [self::IMPORT_BCS_PRE_FILTER] ( $bucket, $object, $file, $tmp_opt );\n\t\t\t\tif ($bolRes !== true) {\n\t\t\t\t\t$this->log ( \"User pre_filter_function return un-true. Skip id[$num/$objectCount]object[$object]file[$file].\", $opt );\n\t\t\t\t\t//$result ['skipped'] [] = \"id[$num/$objectCount]object[$object]file[$file]\";\n\t\t\t\t\t$result ['skipped'] ++;\n\t\t\t\t\t$num ++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\ttry {\n\t\t\t\t$response = $this->create_object ( $bucket, $object, $file, $tmp_opt );\n\t\t\t} catch ( Exception $e ) {\n\t\t\t\t$this->log ( $e->getMessage (), $opt );\n\t\t\t\t$this->log ( \"Upload Failed id[$num/$objectCount]object[$object]file[$file].\", $opt );\n\t\t\t\t$num ++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif ($response->isOK ()) {\n\t\t\t\t$result [\"success\"] ++;\n\t\t\t\t$this->log ( \"Upload Success id[$num/$objectCount]object[$object]file[$file].\", $opt );\n\t\t\t} else {\n\t\t\t\t$result [\"failed\"] [] = \"id[$num/$objectCount]object[$object]file[$file]\";\n\t\t\t\t$this->log ( \"Upload Failed id[$num/$objectCount]object[$object]file[$file].\", $opt );\n\t\t\t}\n\t\t\tif (isset ( $opt [self::IMPORT_BCS_POST_FILTER] ) && function_exists ( $opt [self::IMPORT_BCS_POST_FILTER] )) {\n\t\t\t\t$opt [self::IMPORT_BCS_POST_FILTER] ( $bucket, $object, $file, $tmp_opt, $response );\n\t\t\t}\n\t\t\t$num ++;\n\t\t}\n\t\t//打印日志并返回结果数组\n\t\t$result_str = \"\\r\\n\\r\\nUpload $dir to $bucket finished!\\r\\n\";\n\t\t$result_str .= \"**********************************************************\\r\\n\";\n\t\t$result_str .= \"**********************Result Summary**********************\\r\\n\";\n\t\t$result_str .= \"**********************************************************\\r\\n\";\n\t\t$result_str .= \"Upload directory :  [$dir]\\r\\n\";\n\t\t$result_str .= \"File num :  [$objectCount]\\r\\n\";\n\t\t$result_str .= \"Success: \\r\\n\\tNum: \" . $result [\"success\"] . \"\\r\\n\";\n\t\t$result_str .= \"Skipped:\\r\\n\\tNum:\" . $result [\"skipped\"] . \"\\r\\n\";\n\t\t//\t\tforeach ( $result [\"skipped\"] as $skip ) {\n\t\t//\t\t\t$result_str .= \"\\t$skip\\r\\n\";\n\t\t//\t\t}\n\t\t$result_str .= \"Failed:\\r\\n\\tNum:\" . count ( $result [\"failed\"] ) . \"\\r\\n\";\n\t\tforeach ( $result [\"failed\"] as $fail ) {\n\t\t\t$result_str .= \"\\t$fail\\r\\n\";\n\t\t}\n\t\tif (isset ( $opt [self::IMPORT_BCS_LOG_METHOD] )) {\n\t\t\t$this->log ( $result_str, $opt );\n\t\t} else {\n\t\t\techo $result_str;\n\t\t}\n\t\treturn $result;\n\t}\n\n\t/**\n\t * 通过此方法以拷贝的方式创建object，object来源为$source\n\t * @param array $source (Required)  object 来源\n\t * bucket(Required)\n\t * object(Required)\n\t * @param array $dest (Required)    待拷贝的目标object\n\t * bucket(Required)\n\t * object(Required)\n\t * @param array $opt (Optional)\n\t * source_tag 指定拷贝对象的版本号\n\t * @throws BCS_Exception\n\t * @return BCS_ResponseCore\n\t */\n\tpublic function copy_object($source, $dest, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\t//valid source and dest\n\t\tif (empty ( $source ) || ! is_array ( $source ) || ! isset ( $source [self::BUCKET] ) || ! isset ( $source [self::OBJECT] )) {\n\t\t\tthrow new BCS_Exception ( '$source invalid, please check!', - 1 );\n\t\t}\n\t\tif (empty ( $dest ) || ! is_array ( $dest ) || ! isset ( $dest [self::BUCKET] ) || ! isset ( $dest [self::OBJECT] ) || ! self::validate_bucket ( $dest [self::BUCKET] ) || ! self::validate_object ( $dest [self::OBJECT] )) {\n\t\t\tthrow new BCS_Exception ( '$dest invalid, please check!', - 1 );\n\t\t}\n\t\t$opt [self::BUCKET] = $dest [self::BUCKET];\n\t\t$opt [self::OBJECT] = $dest [self::OBJECT];\n\t\t$opt [self::METHOD] = 'PUT';\n\t\tself::set_header_into_opt ( 'x-bs-copy-source', 'bs://' . $source [self::BUCKET] . $source [self::OBJECT], $opt );\n\t\tif (isset ( $opt ['source_tag'] )) {\n\t\t\tself::set_header_into_opt ( 'x-bs-copy-source-tag', $opt ['source_tag'], $opt );\n\t\t}\n\t\t$response = $this->authenticate ( $opt );\n\t\t$this->log ( $response->isOK () ? \"Copy object success!\" : \"Copy object failed! Response: [\" . $response->body . \"]\", $opt );\n\t\treturn $response;\n\t}\n\n\t/**\n\t * 设置object的meta信息\n\t * @param string $bucket (Required)\n\t * @param string $object (Required)\n\t * @param array $opt (Optional)\n\t * 目前支持的meta信息如下：\n\t * Content-Type\n\t * Cache-Control\n\t * Content-Disposition\n\t * Content-Encoding\n\t * Content-MD5\n\t * Expires\n\t * @return BCS_ResponseCore\n\t */\n\tpublic function set_object_meta($bucket, $object, $meta, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\t$this->assertParameterArray ( $meta );\n\t\t$opt [self::BUCKET] = $bucket;\n\t\t$opt [self::OBJECT] = $object;\n\t\t$opt [self::METHOD] = 'PUT';\n\t\t//利用copy_object接口来设置meta信息\n\t\t$source = \"bs://$bucket$object\";\n\t\tif (empty ( $meta )) {\n\t\t\tthrow new BCS_Exception ( '$meta can not be empty! And $meta must be array.', - 1 );\n\t\t}\n\t\tforeach ( $meta as $header => $value ) {\n\t\t\tself::set_header_into_opt ( $header, $value, $opt );\n\t\t}\n\t\t$source = array (\n\t\t\t\tself::BUCKET => $bucket,\n\t\t\t\tself::OBJECT => $object );\n\t\t$response = $this->copy_object ( $source, $source, $opt );\n\t\t$this->log ( $response->isOK () ? \"Set object meta success!\" : \"Set object meta failed! Response: [\" . $response->body . \"]\", $opt );\n\t\treturn $response;\n\t}\n\n\t/**\n\t * 获取object的acl\n\t * @param string $bucket (Required)\n\t * @param string $object (Required)\n\t * @param array $opt (Optional)\n\t * @throws BCS_Exception\n\t * @return BCS_ResponseCore\n\t */\n\tpublic function get_object_acl($bucket, $object, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\t$opt [self::BUCKET] = $bucket;\n\t\t$opt [self::METHOD] = 'GET';\n\t\t$opt [self::OBJECT] = $object;\n\t\t$opt [self::QUERY_STRING] = array (\n\t\t\t\tself::ACL => 1 );\n\t\t$response = $this->authenticate ( $opt );\n\t\t$this->log ( $response->isOK () ? \"Get object acl success!\" : \"Get object acl failed! Response: [\" . $response->body . \"]\", $opt );\n\t\treturn $response;\n\t}\n\n\t/**\n\t * 设置object的acl，有三种模式，\n\t * (1).设置详细json格式的acl；\n\t * a. $acl 为json的array\n\t * b. $acl 为json的string\n\t * (2).通过acl_type字段进行设置\n\t * a. $acl 为BaiduBCS::$ACL_ACTIONS中的字段\n\t * @param string $bucket (Required)\n\t * @param string $object (Required)\n\t * @param string|array $acl (Required)\n\t * @param array $opt (Optional)\n\t * @return BCS_ResponseCore\n\t */\n\tpublic function set_object_acl($bucket, $object, $acl, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\t//analyze acl\n\t\t$result = $this->analyze_user_acl ( $acl );\n\t\t$opt = array_merge ( $opt, $result );\n\t\t$opt [self::BUCKET] = $bucket;\n\t\t$opt [self::METHOD] = 'PUT';\n\t\t$opt [self::OBJECT] = $object;\n\t\t$opt [self::QUERY_STRING] = array (\n\t\t\t\tself::ACL => 1 );\n\t\t$response = $this->authenticate ( $opt );\n\t\t$this->log ( $response->isOK () ? \"Set object acl success!\" : \"Set object acl failed! Response: [\" . $response->body . \"]\", $opt );\n\t\treturn $response;\n\t}\n\n\t/**\n\t * 删除object\n\t * @param string $bucket (Required)\n\t * @param string $object (Required)\n\t * @param array $opt (Optional)\n\t * @throws BCS_Exception\n\t * @return BCS_ResponseCore\n\t */\n\tpublic function delete_object($bucket, $object, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\t$opt [self::BUCKET] = $bucket;\n\t\t$opt [self::METHOD] = 'DELETE';\n\t\t$opt [self::OBJECT] = $object;\n\t\t$response = $this->authenticate ( $opt );\n\t\t$this->log ( $response->isOK () ? \"Delete object success!\" : \"Delete object failed! Response: [\" . $response->body . \"]\", $opt );\n\t\treturn $response;\n\t}\n\n\t/**\n\t * 判断object是否存在\n\t * @param string $bucket (Required)\n\t * @param string $object (Required)\n\t * @param array $opt (Optional)\n\t * @throws BCS_Exception\n\t * @return boolean true|boolean false|BCS_ResponseCore\n\t * true：object存在\n\t * false：不存在\n\t * BCS_ResponseCore其他错误\n\t */\n\tpublic function is_object_exist($bucket, $object, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\t$opt [self::BUCKET] = $bucket;\n\t\t$opt [self::METHOD] = 'HEAD';\n\t\t$opt [self::OBJECT] = $object;\n\t\t$response = $this->get_object_info ( $bucket, $object, $opt );\n\t\tif ($response->isOK ()) {\n\t\t\treturn true;\n\t\t} elseif ($response->status === 404) {\n\t\t\treturn false;\n\t\t}\n\t\treturn $response;\n\t}\n\n\t/**\n\t * 获取文件信息，发送的为HTTP HEAD请求，文件信息都在http response的header中，不会提取文件的内容\n\t * @param string $bucket (Required)\n\t * @param string $object (Required)\n\t * @param array $opt (Optional)\n\t * @throws BCS_Exception\n\t * @return array BCS_ResponseCore\n\t */\n\tpublic function get_object_info($bucket, $object, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\t$opt [self::BUCKET] = $bucket;\n\t\t$opt [self::METHOD] = 'HEAD';\n\t\t$opt [self::OBJECT] = $object;\n\t\t$response = $this->authenticate ( $opt );\n\t\t$this->log ( $response->isOK () ? \"Get object info success!\" : \"Get object info failed! Response: [\" . $response->body . \"]\", $opt );\n\t\treturn $response;\n\t}\n\n\t/**\n\t * 下载object\n\t * @param string $bucket (Required)\n\t * @param string $object (Required)\n\t * @param array $opt (Optional)\n\t * fileWriteTo   (Optional)直接将请求结果写入该文件，如果fileWriteTo文件存在，sdk进行重命名再存储\n\t * @throws BCS_Exception\n\t * @return BCS_ResponseCore\n\t */\n\tpublic function get_object($bucket, $object, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\t//若fileWriteTo待写入的文件已经存在，需要进行重命名\n\t\tif (isset ( $opt [\"fileWriteTo\"] ) && file_exists ( $opt [\"fileWriteTo\"] )) {\n\t\t\t$original_file_write_to = $opt [\"fileWriteTo\"];\n\t\t\t$arr = explode ( DIRECTORY_SEPARATOR, $opt [\"fileWriteTo\"] );\n\t\t\t$file_name = $arr [count ( $arr ) - 1];\n\t\t\t$num = 1;\n\t\t\twhile ( file_exists ( $opt [\"fileWriteTo\"] ) ) {\n\t\t\t\t$new_name_arr = explode ( \".\", $file_name );\n\t\t\t\tif (count ( $new_name_arr ) > 1) {\n\t\t\t\t\t$new_name_arr [count ( $new_name_arr ) - 2] .= \" ($num)\";\n\t\t\t\t} else {\n\t\t\t\t\t$new_name_arr [0] .= \" ($num)\";\n\t\t\t\t}\n\t\t\t\t$arr [count ( $arr ) - 1] = implode ( \".\", $new_name_arr );\n\t\t\t\t$opt [\"fileWriteTo\"] = implode ( DIRECTORY_SEPARATOR, $arr );\n\t\t\t\t$num ++;\n\t\t\t}\n\t\t\t$this->log ( \"[$original_file_write_to] already exist, rename it to [\" . $opt [\"fileWriteTo\"] . \"]\", $opt );\n\t\t}\n\t\t$opt [self::BUCKET] = $bucket;\n\t\t$opt [self::METHOD] = 'GET';\n\t\t$opt [self::OBJECT] = $object;\n\t\t$response = $this->authenticate ( $opt );\n\t\t$this->log ( $response->isOK () ? \"Get object success!\" : \"Get object failed! Response: [\" . $response->body . \"]\", $opt );\n\t\tif (! $response->isOK () && isset ( $opt [\"fileWriteTo\"] )) {\n\t\t\tunlink ( $opt [\"fileWriteTo\"] );\n\t\t}\n\t\treturn $response;\n\t}\n\n\t/**\n\t * 生成签名链接\n\t */\n\tprivate function generate_user_url($method, $bucket, $object, $opt = array()) {\n\t\t$opt [self::AK] = $this->ak;\n\t\t$opt [self::SK] = $this->sk;\n\t\t$opt [self::BUCKET] = $bucket;\n\t\t$opt [self::METHOD] = $method;\n\t\t$opt [self::OBJECT] = $object;\n\t\t$opt [self::QUERY_STRING] = array ();\n\t\tif (isset ( $opt [\"time\"] )) {\n\t\t\t$opt [self::QUERY_STRING] [\"time\"] = $opt [\"time\"];\n\t\t}\n\t\tif (isset ( $opt [\"size\"] )) {\n\t\t\t$opt [self::QUERY_STRING] [\"size\"] = $opt [\"size\"];\n\t\t}\n\t\treturn $this->format_url ( $opt );\n\t}\n\n\t/**\n\t * 生成get_object的url\n\t * @param string $bucket (Required)\n\t * @param string $object (Required)\n\t * return false| string url\n\t */\n\tpublic function generate_get_object_url($bucket, $object, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\treturn $this->generate_user_url ( \"GET\", $bucket, $object, $opt );\n\t}\n\n\t/**\n\t * 生成put_object的url\n\t * @param string $bucket (Required)\n\t * @param string $object (Required)\n\t * return false| string url\n\t */\n\tpublic function generate_put_object_url($bucket, $object, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\treturn $this->generate_user_url ( \"PUT\", $bucket, $object, $opt );\n\t}\n\n\t/**\n\t * 生成post_object的url\n\t * @param string $bucket (Required)\n\t * @param string $object (Required)\n\t * return false| string url\n\t */\n\tpublic function generate_post_object_url($bucket, $object, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\treturn $this->generate_user_url ( \"POST\", $bucket, $object, $opt );\n\t}\n\n\t/**\n\t * 生成delete_object的url\n\t * @param string $bucket (Required)\n\t * @param string $object (Required)\n\t * return false| string url\n\t */\n\tpublic function generate_delete_object_url($bucket, $object, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\treturn $this->generate_user_url ( \"DELETE\", $bucket, $object, $opt );\n\t}\n\n\t/**\n\t * 生成head_object的url\n\t * @param string $bucket (Required)\n\t * @param string $object (Required)\n\t * return false| string url\n\t */\n\tpublic function generate_head_object_url($bucket, $object, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\treturn $this->generate_user_url ( \"HEAD\", $bucket, $object, $opt );\n\t}\n\n\t/**\n\t * @return the $use_ssl\n\t */\n\tpublic function getUse_ssl() {\n\t\treturn $this->use_ssl;\n\t}\n\n\t/**\n\t * @param boolean $use_ssl\n\t */\n\tpublic function setUse_ssl($use_ssl) {\n\t\t$this->use_ssl = $use_ssl;\n\t}\n\n\t/**\n\t * 校验bucket是否合法，bucket规范\n\t * 1. 由小写字母，数字和横线'-'组成，长度为6~63位\n\t * 2. 不能以数字作为Bucket开头\n\t * 3. 不能以'-'作为Bucket的开头或者结尾\n\t * @param string $bucket\n\t * @return boolean\n\t */\n\tpublic static function validate_bucket($bucket) {\n\t\t//bucket 正则\n\t\t$pattern1 = '/^[a-z][-a-z0-9]{4,61}[a-z0-9]$/';\n\t\tif (! preg_match ( $pattern1, $bucket )) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\t/**\n\t * 校验object是否合法，object命名规范\n\t * 1. object必须以'/'开头\n\t * @param string $object\n\t * @return boolean\n\t */\n\tpublic static function validate_object($object) {\n\t\t$pattern = '/^\\//';\n\t\tif (empty ( $object ) || ! preg_match ( $pattern, $object )) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\t/**\n\t * 将常用set http-header的动作抽离出来\n\t * @param string $header\n\t * @param string $value\n\t * @param array $opt\n\t * @throws BCS_Exception\n\t * @return void\n\t */\n\tprivate static function set_header_into_opt($header, $value, &$opt) {\n\t\tif (isset ( $opt [self::HEADERS] )) {\n\t\t\tif (! is_array ( $opt [self::HEADERS] )) {\n\t\t\t\ttrigger_error ( 'Invalid $opt[\\'headers\\'], please check.' );\n\t\t\t\tthrow new BCS_Exception ( 'Invalid $opt[\\'headers\\'], please check.', - 1 );\n\t\t\t}\n\t\t} else {\n\t\t\t$opt [self::HEADERS] = array ();\n\t\t}\n\t\t$opt [self::HEADERS] [$header] = $value;\n\t}\n\n\t/**\n\t * 使用特定function对数组中所有元素做处理\n\t * @param string    &$array        要处理的字符串\n\t * @param string    $function    要执行的函数\n\t * @param boolean   $apply_to_keys_also     是否也应用到key上\n\t */\n\tprivate static function array_recursive(&$array, $function, $apply_to_keys_also = false) {\n\t\tforeach ( $array as $key => $value ) {\n\t\t\tif (is_array ( $value )) {\n\t\t\t\tself::array_recursive ( $array [$key], $function, $apply_to_keys_also );\n\t\t\t} else {\n\t\t\t\t$array [$key] = $function ( $value );\n\t\t\t}\n\n\t\t\tif ($apply_to_keys_also && is_string ( $key )) {\n\t\t\t\t$new_key = $function ( $key );\n\t\t\t\tif ($new_key != $key) {\n\t\t\t\t\t$array [$new_key] = $array [$key];\n\t\t\t\t\tunset ( $array [$key] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * 由数组构造json字符串，增加了一些特殊处理以支持特殊字符和不同编码的中文\n\t * @param array $array\n\t */\n\tprivate static function array_to_json($array) {\n\t\tif (! is_array ( $array )) {\n\t\t\tthrow new BCS_Exception ( \"Param must be array in function array_to_json()\", - 1 );\n\t\t}\n\t\tself::array_recursive ( $array, 'addslashes', false );\n\t\tself::array_recursive ( $array, 'rawurlencode', false );\n\t\treturn rawurldecode ( json_encode ( $array ) );\n\t}\n\n\t/**\n\t * 根据用户传入的acl，进行相应的处理\n\t * (1).设置详细json格式的acl；\n\t * a. $acl 为json的array\n\t * b. $acl 为json的string\n\t * (2).通过acl_type字段进行设置\n\t * @param string|array $acl\n\t * @throws BCS_Exception\n\t * @return array\n\t */\n\tprivate function analyze_user_acl($acl) {\n\t\t$result = array ();\n\t\tif (is_array ( $acl )) {\n\t\t\t//(1).a\n\t\t\t$result ['content'] = $this->check_user_acl ( $acl );\n\t\t} else if (is_string ( $acl )) {\n\t\t\tif (in_array ( $acl, self::$ACL_TYPES )) {\n\t\t\t\t//(2).a\n\t\t\t\t$result [\"headers\"] = array (\n\t\t\t\t\t\t\"x-bs-acl\" => $acl );\n\t\t\t} else {\n\t\t\t\t//(1).b\n\t\t\t\t$result ['content'] = $acl;\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new BCS_Exception ( \"Invalid acl.\", - 1 );\n\t\t}\n\t\treturn $result;\n\t}\n\n\t/**\n\t * 生成签名\n\t * @param array $opt\n\t * @return boolean|string\n\t */\n\tprivate function format_signature($opt) {\n\t\t$flags = \"\";\n\t\t$content = '';\n\t\tif (! isset ( $opt [self::AK] ) || ! isset ( $opt [self::SK] )) {\n\t\t\ttrigger_error ( 'ak or sk is not in the array when create factor!' );\n\t\t\treturn false;\n\t\t}\n\t\tif (isset ( $opt [self::BUCKET] ) && isset ( $opt [self::METHOD] ) && isset ( $opt [self::OBJECT] )) {\n\t\t\t$flags .= 'MBO';\n\t\t\t$content .= \"Method=\" . $opt [self::METHOD] . \"\\n\"; //method\n\t\t\t$content .= \"Bucket=\" . $opt [self::BUCKET] . \"\\n\"; //bucket\n\t\t\t$content .= \"Object=\" . self::trimUrl ( $opt [self::OBJECT] ) . \"\\n\"; //object\n\t\t} else {\n\t\t\ttrigger_error ( 'bucket、method and object cann`t be NULL!' );\n\t\t\treturn false;\n\t\t}\n\t\tif (isset ( $opt ['ip'] )) {\n\t\t\t$flags .= 'I';\n\t\t\t$content .= \"Ip=\" . $opt ['ip'] . \"\\n\";\n\t\t}\n\t\tif (isset ( $opt ['time'] )) {\n\t\t\t$flags .= 'T';\n\t\t\t$content .= \"Time=\" . $opt ['time'] . \"\\n\";\n\t\t}\n\t\tif (isset ( $opt ['size'] )) {\n\t\t\t$flags .= 'S';\n\t\t\t$content .= \"Size=\" . $opt ['size'] . \"\\n\";\n\t\t}\n\t\t$content = $flags . \"\\n\" . $content;\n\t\t$sign = base64_encode ( hash_hmac ( 'sha1', $content, $opt [self::SK], true ) );\n\t\treturn 'sign=' . $flags . ':' . $opt [self::AK] . ':' . urlencode ( $sign );\n\t}\n\n\t/**\n\t * 检查用户输入的acl array是否合法，并转为json\n\t * @param array $acl\n\t * @throws BCS_Exception\n\t * @return string acl-json\n\t */\n\tprivate function check_user_acl($acl) {\n\t\tif (! is_array ( $acl )) {\n\t\t\tthrow new BCS_Exception ( \"Invalid acl array\" );\n\t\t}\n\t\tforeach ( $acl ['statements'] as $key => $statement ) {\n\t\t\t// user resource action effect must in statement\n\t\t\tif (! isset ( $statement ['user'] ) || ! isset ( $statement ['resource'] ) || ! isset ( $statement ['action'] ) || ! isset ( $statement ['effect'] )) {\n\t\t\t\tthrow new BCS_Exception ( 'Param miss: format acl error, please check your param!' );\n\t\t\t}\n\t\t\tif (! is_array ( $statement ['user'] ) || ! is_array ( $statement ['resource'] )) {\n\t\t\t\tthrow new BCS_Exception ( 'Param error: user or resource must be array, please check your param!' );\n\t\t\t}\n\t\t\tif (! is_array ( $statement ['action'] ) || ! count ( array_diff ( $statement ['action'], self::$ACL_ACTIONS ) ) == 0) {\n\t\t\t\tthrow new BCS_Exception ( 'Param error: action, please check your param!' );\n\t\t\t}\n\t\t\tif (! in_array ( $statement ['effect'], self::$ACL_EFFECTS )) {\n\t\t\t\tthrow new BCS_Exception ( 'Param error: effect, please check your param!' );\n\t\t\t}\n\t\t\tif (isset ( $statement ['time'] )) {\n\t\t\t\tif (! is_array ( $statement ['time'] )) {\n\t\t\t\t\tthrow new BCS_Exception ( 'Param error: time, please check your param!' );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn self::array_to_json ( $acl );\n\t}\n\n\t/**\n\t * 构造url\n\t * @param array $opt\n\t * @return boolean|string\n\t */\n\tprivate function format_url($opt) {\n\t\t$sign = $this->format_signature ( $opt );\n\t\tif ($sign === false) {\n\t\t\ttrigger_error ( \"Format signature failed, please check!\" );\n\t\t\treturn false;\n\t\t}\n\t\t$opt ['sign'] = $sign;\n\t\t$url = \"\";\n\t\t$url .= $this->use_ssl ? 'https://' : 'http://';\n\t\t$url .= $this->hostname;\n\t\t$url .= '/' . $opt [self::BUCKET];\n\t\tif (isset ( $opt [self::OBJECT] ) && '/' !== $opt [self::OBJECT]) {\n\t\t\t$url .= \"/\" . rawurlencode ( $opt [self::OBJECT] );\n\t\t}\n\t\t$url .= '?' . $sign;\n\t\tif (isset ( $opt [self::QUERY_STRING] )) {\n\t\t\tforeach ( $opt [self::QUERY_STRING] as $key => $value ) {\n\t\t\t\t$url .= '&' . $key . '=' . $value;\n\t\t\t}\n\t\t}\n\t\treturn $url;\n\t}\n\n\t/**\n\t * 将url中 '//' 替换为  '/'\n\t * @param $url\n\t * @return string\n\t */\n\tpublic static function trimUrl($url) {\n\t\t$result = str_replace ( \"//\", \"/\", $url );\n\t\twhile ( $result !== $url ) {\n\t\t\t$url = $result;\n\t\t\t$result = str_replace ( \"//\", \"/\", $url );\n\t\t}\n\t\treturn $result;\n\t}\n\n\t/**\n\t * 获取传入目录的文件列表\n\t * @param string $dir 文件目录\n\t * @return array 文件树\n\t */\n\tpublic static function get_filetree($dir, $file_prefix = \"/*\") {\n\t\t$tree = array ();\n\t\tforeach ( glob ( $dir . $file_prefix ) as $single ) {\n\t\t\tif (is_dir ( $single )) {\n\t\t\t\t$tree = array_merge ( $tree, self::get_filetree ( $single ) );\n\t\t\t} else {\n\t\t\t\t$tree [] = $single;\n\t\t\t}\n\t\t}\n\t\treturn $tree;\n\t}\n\n\t/**\n\t * 内置的日志函数，可以根据用户传入的log函数，进行日志输出\n\t * @param string $log\n\t * @param array $opt\n\t */\n\tpublic function log($log, $opt) {\n\t\tif (isset ( $opt [self::IMPORT_BCS_LOG_METHOD] ) && function_exists ( $opt [self::IMPORT_BCS_LOG_METHOD] )) {\n\t\t\t$opt [self::IMPORT_BCS_LOG_METHOD] ( $log );\n\t\t} else {\n\t\t\ttrigger_error ( $log );\n\t\t}\n\t}\n\n\t/**\n\t * make sure $opt is an array\n\t * @param $opt\n\t */\n\tprivate function assertParameterArray($opt) {\n\t\tif (! is_array ( $opt )) {\n\t\t\tthrow new BCS_Exception ( 'Parameter must be array, please check!', - 1 );\n\t\t}\n\t}\n}"
  },
  {
    "path": "ThinkPHP/Library/Think/Upload/Driver/Bcs/mimetypes.class.php",
    "content": "<?php\nnamespace Think\\Upload\\Driver\\Bcs;\nclass BCS_MimeTypes {\n\tpublic static $mime_types = array (\n\t\t\t'3gp' => 'video/3gpp', 'ai' => 'application/postscript',\n\t\t\t'aif' => 'audio/x-aiff', 'aifc' => 'audio/x-aiff',\n\t\t\t'aiff' => 'audio/x-aiff', 'asc' => 'text/plain',\n\t\t\t'atom' => 'application/atom+xml', 'au' => 'audio/basic',\n\t\t\t'avi' => 'video/x-msvideo', 'bcpio' => 'application/x-bcpio',\n\t\t\t'bin' => 'application/octet-stream', 'bmp' => 'image/bmp',\n\t\t\t'cdf' => 'application/x-netcdf', 'cgm' => 'image/cgm',\n\t\t\t'class' => 'application/octet-stream',\n\t\t\t'cpio' => 'application/x-cpio',\n\t\t\t'cpt' => 'application/mac-compactpro',\n\t\t\t'csh' => 'application/x-csh', 'css' => 'text/css',\n\t\t\t'dcr' => 'application/x-director', 'dif' => 'video/x-dv',\n\t\t\t'dir' => 'application/x-director', 'djv' => 'image/vnd.djvu',\n\t\t\t'djvu' => 'image/vnd.djvu',\n\t\t\t'dll' => 'application/octet-stream',\n\t\t\t'dmg' => 'application/octet-stream',\n\t\t\t'dms' => 'application/octet-stream',\n\t\t\t'doc' => 'application/msword', 'dtd' => 'application/xml-dtd',\n\t\t\t'dv' => 'video/x-dv', 'dvi' => 'application/x-dvi',\n\t\t\t'dxr' => 'application/x-director',\n\t\t\t'eps' => 'application/postscript', 'etx' => 'text/x-setext',\n\t\t\t'exe' => 'application/octet-stream',\n\t\t\t'ez' => 'application/andrew-inset', 'flv' => 'video/x-flv',\n\t\t\t'gif' => 'image/gif', 'gram' => 'application/srgs',\n\t\t\t'grxml' => 'application/srgs+xml',\n\t\t\t'gtar' => 'application/x-gtar', 'gz' => 'application/x-gzip',\n\t\t\t'hdf' => 'application/x-hdf',\n\t\t\t'hqx' => 'application/mac-binhex40', 'htm' => 'text/html',\n\t\t\t'html' => 'text/html', 'ice' => 'x-conference/x-cooltalk',\n\t\t\t'ico' => 'image/x-icon', 'ics' => 'text/calendar',\n\t\t\t'ief' => 'image/ief', 'ifb' => 'text/calendar',\n\t\t\t'iges' => 'model/iges', 'igs' => 'model/iges',\n\t\t\t'jnlp' => 'application/x-java-jnlp-file', 'jp2' => 'image/jp2',\n\t\t\t'jpe' => 'image/jpeg', 'jpeg' => 'image/jpeg',\n\t\t\t'jpg' => 'image/jpeg', 'js' => 'application/x-javascript',\n\t\t\t'kar' => 'audio/midi', 'latex' => 'application/x-latex',\n\t\t\t'lha' => 'application/octet-stream',\n\t\t\t'lzh' => 'application/octet-stream',\n\t\t\t'm3u' => 'audio/x-mpegurl', 'm4a' => 'audio/mp4a-latm',\n\t\t\t'm4p' => 'audio/mp4a-latm', 'm4u' => 'video/vnd.mpegurl',\n\t\t\t'm4v' => 'video/x-m4v', 'mac' => 'image/x-macpaint',\n\t\t\t'man' => 'application/x-troff-man',\n\t\t\t'mathml' => 'application/mathml+xml',\n\t\t\t'me' => 'application/x-troff-me', 'mesh' => 'model/mesh',\n\t\t\t'mid' => 'audio/midi', 'midi' => 'audio/midi',\n\t\t\t'mif' => 'application/vnd.mif', 'mov' => 'video/quicktime',\n\t\t\t'movie' => 'video/x-sgi-movie', 'mp2' => 'audio/mpeg',\n\t\t\t'mp3' => 'audio/mpeg', 'mp4' => 'video/mp4',\n\t\t\t'mpe' => 'video/mpeg', 'mpeg' => 'video/mpeg',\n\t\t\t'mpg' => 'video/mpeg', 'mpga' => 'audio/mpeg',\n\t\t\t'ms' => 'application/x-troff-ms', 'msh' => 'model/mesh',\n\t\t\t'mxu' => 'video/vnd.mpegurl', 'nc' => 'application/x-netcdf',\n\t\t\t'oda' => 'application/oda', 'ogg' => 'application/ogg',\n\t\t\t'ogv' => 'video/ogv', 'pbm' => 'image/x-portable-bitmap',\n\t\t\t'pct' => 'image/pict', 'pdb' => 'chemical/x-pdb',\n\t\t\t'pdf' => 'application/pdf',\n\t\t\t'pgm' => 'image/x-portable-graymap',\n\t\t\t'pgn' => 'application/x-chess-pgn', 'pic' => 'image/pict',\n\t\t\t'pict' => 'image/pict', 'png' => 'image/png',\n\t\t\t'pnm' => 'image/x-portable-anymap',\n\t\t\t'pnt' => 'image/x-macpaint', 'pntg' => 'image/x-macpaint',\n\t\t\t'ppm' => 'image/x-portable-pixmap',\n\t\t\t'ppt' => 'application/vnd.ms-powerpoint',\n\t\t\t'ps' => 'application/postscript', 'qt' => 'video/quicktime',\n\t\t\t'qti' => 'image/x-quicktime', 'qtif' => 'image/x-quicktime',\n\t\t\t'ra' => 'audio/x-pn-realaudio',\n\t\t\t'ram' => 'audio/x-pn-realaudio', 'ras' => 'image/x-cmu-raster',\n\t\t\t'rdf' => 'application/rdf+xml', 'rgb' => 'image/x-rgb',\n\t\t\t'rm' => 'application/vnd.rn-realmedia',\n\t\t\t'roff' => 'application/x-troff', 'rtf' => 'text/rtf',\n\t\t\t'rtx' => 'text/richtext', 'sgm' => 'text/sgml',\n\t\t\t'sgml' => 'text/sgml', 'sh' => 'application/x-sh',\n\t\t\t'shar' => 'application/x-shar', 'silo' => 'model/mesh',\n\t\t\t'sit' => 'application/x-stuffit',\n\t\t\t'skd' => 'application/x-koan', 'skm' => 'application/x-koan',\n\t\t\t'skp' => 'application/x-koan', 'skt' => 'application/x-koan',\n\t\t\t'smi' => 'application/smil', 'smil' => 'application/smil',\n\t\t\t'snd' => 'audio/basic', 'so' => 'application/octet-stream',\n\t\t\t'spl' => 'application/x-futuresplash',\n\t\t\t'src' => 'application/x-wais-source',\n\t\t\t'sv4cpio' => 'application/x-sv4cpio',\n\t\t\t'sv4crc' => 'application/x-sv4crc', 'svg' => 'image/svg+xml',\n\t\t\t'swf' => 'application/x-shockwave-flash',\n\t\t\t't' => 'application/x-troff', 'tar' => 'application/x-tar',\n\t\t\t'tcl' => 'application/x-tcl', 'tex' => 'application/x-tex',\n\t\t\t'texi' => 'application/x-texinfo',\n\t\t\t'texinfo' => 'application/x-texinfo', 'tif' => 'image/tiff',\n\t\t\t'tiff' => 'image/tiff', 'tr' => 'application/x-troff',\n\t\t\t'tsv' => 'text/tab-separated-values', 'txt' => 'text/plain',\n\t\t\t'ustar' => 'application/x-ustar',\n\t\t\t'vcd' => 'application/x-cdlink', 'vrml' => 'model/vrml',\n\t\t\t'vxml' => 'application/voicexml+xml', 'wav' => 'audio/x-wav',\n\t\t\t'wbmp' => 'image/vnd.wap.wbmp',\n\t\t\t'wbxml' => 'application/vnd.wap.wbxml', 'webm' => 'video/webm',\n\t\t\t'wml' => 'text/vnd.wap.wml',\n\t\t\t'wmlc' => 'application/vnd.wap.wmlc',\n\t\t\t'wmls' => 'text/vnd.wap.wmlscript',\n\t\t\t'wmlsc' => 'application/vnd.wap.wmlscriptc',\n\t\t\t'wmv' => 'video/x-ms-wmv', 'wrl' => 'model/vrml',\n\t\t\t'xbm' => 'image/x-xbitmap', 'xht' => 'application/xhtml+xml',\n\t\t\t'xhtml' => 'application/xhtml+xml',\n\t\t\t'xls' => 'application/vnd.ms-excel',\n\t\t\t'xml' => 'application/xml', 'xpm' => 'image/x-xpixmap',\n\t\t\t'xsl' => 'application/xml', 'xslt' => 'application/xslt+xml',\n\t\t\t'xul' => 'application/vnd.mozilla.xul+xml',\n\t\t\t'xwd' => 'image/x-xwindowdump', 'xyz' => 'chemical/x-xyz',\n\t\t\t'zip' => 'application/zip',\n\t\t\t//add by zhengkan 20110905\n\t\t\t\"apk\" => \"application/vnd.android.package-archive\",\n\t\t\t\"bin\" => \"application/octet-stream\",\n\t\t\t\"cab\" => \"application/vnd.ms-cab-compressed\",\n\t\t\t\"gb\" => \"application/chinese-gb\",\n\t\t\t\"gba\" => \"application/octet-stream\",\n\t\t\t\"gbc\" => \"application/octet-stream\",\n\t\t\t\"jad\" => \"text/vnd.sun.j2me.app-descriptor\",\n\t\t\t\"jar\" => \"application/java-archive\",\n\t\t\t\"nes\" => \"application/octet-stream\",\n\t\t\t\"rar\" => \"application/x-rar-compressed\",\n\t\t\t\"sis\" => \"application/vnd.symbian.install\",\n\t\t\t\"sisx\" => \"x-epoc/x-sisx-app\",\n\t\t\t\"smc\" => \"application/octet-stream\",\n\t\t\t\"smd\" => \"application/octet-stream\",\n\t\t\t\"swf\" => \"application/x-shockwave-flash\",\n\t\t\t\"zip\" => \"application/x-zip-compressed\",\n\t\t\t\"wap\" => \"text/vnd.wap.wml wml\", \"mrp\" => \"application/mrp\",\n\t\t\t//add by zhengkan 20110914\n\t\t\t\"wma\" => \"audio/x-ms-wma\",\n\t\t\t\"lrc\" => \"application/lrc\" );\n\tpublic static function get_mimetype($ext) {\n\t\t$ext = strtolower ( $ext );\n\t\treturn (isset ( self::$mime_types [$ext] ) ? self::$mime_types [$ext] : 'application/octet-stream');\n\t}\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Upload/Driver/Bcs/requestcore.class.php",
    "content": "<?php\nnamespace Think\\Upload\\Driver\\Bcs;\n\n/**\n * Handles all HTTP requests using cURL and manages the responses.\n *\n * @version 2011.03.01\n * @copyright 2006-2011 Ryan Parman\n * @copyright 2006-2010 Foleeo Inc.\n * @copyright 2010-2011 Amazon.com, Inc. or its affiliates.\n * @copyright 2008-2011 Contributors\n * @license http://opensource.org/licenses/bsd-license.php Simplified BSD License\n */\nclass BCS_RequestCore {\n\t/**\n\t * The URL being requested.\n\t */\n\tpublic $request_url;\n\t/**\n\t * The headers being sent in the request.\n\t */\n\tpublic $request_headers;\n\t/**\n\t * The body being sent in the request.\n\t */\n\tpublic $request_body;\n\t/**\n\t * The response returned by the request.\n\t */\n\tpublic $response;\n\t/**\n\t * The headers returned by the request.\n\t */\n\tpublic $response_headers;\n\t/**\n\t * The body returned by the request.\n\t */\n\tpublic $response_body;\n\t/**\n\t * The HTTP status code returned by the request.\n\t */\n\tpublic $response_code;\n\t/**\n\t * Additional response data.\n\t */\n\tpublic $response_info;\n\t/**\n\t * The handle for the cURL object.\n\t */\n\tpublic $curl_handle;\n\t/**\n\t * The method by which the request is being made.\n\t */\n\tpublic $method;\n\t/**\n\t * Stores the proxy settings to use for the request.\n\t */\n\tpublic $proxy = null;\n\t/**\n\t * The username to use for the request.\n\t */\n\tpublic $username = null;\n\t/**\n\t * The password to use for the request.\n\t */\n\tpublic $password = null;\n\t/**\n\t * Custom CURLOPT settings.\n\t */\n\tpublic $curlopts = null;\n\t/**\n\t * The state of debug mode.\n\t */\n\tpublic $debug_mode = false;\n\t/**\n\t * The default class to use for HTTP Requests (defaults to <BCS_RequestCore>).\n\t */\n\tpublic $request_class = 'BCS_RequestCore';\n\t/**\n\t * The default class to use for HTTP Responses (defaults to <BCS_ResponseCore>).\n\t */\n\tpublic $response_class = 'BCS_ResponseCore';\n\t/**\n\t * Default useragent string to use.\n\t */\n\tpublic $useragent = 'BCS_RequestCore/1.4.2';\n\t/**\n\t * File to read from while streaming up.\n\t */\n\tpublic $read_file = null;\n\t/**\n\t * The resource to read from while streaming up.\n\t */\n\tpublic $read_stream = null;\n\t/**\n\t * The size of the stream to read from.\n\t */\n\tpublic $read_stream_size = null;\n\t/**\n\t * The length already read from the stream.\n\t */\n\tpublic $read_stream_read = 0;\n\t/**\n\t * File to write to while streaming down.\n\t */\n\tpublic $write_file = null;\n\t/**\n\t * The resource to write to while streaming down.\n\t */\n\tpublic $write_stream = null;\n\t/**\n\t * Stores the intended starting seek position.\n\t */\n\tpublic $seek_position = null;\n\t/**\n\t * The user-defined callback function to call when a stream is read from.\n\t */\n\tpublic $registered_streaming_read_callback = null;\n\t/**\n\t * The user-defined callback function to call when a stream is written to.\n\t */\n\tpublic $registered_streaming_write_callback = null;\n\t/*%******************************************************************************************%*/\n\t// CONSTANTS\n\t/**\n\t * GET HTTP Method\n\t */\n\tconst HTTP_GET = 'GET';\n\t/**\n\t * POST HTTP Method\n\t */\n\tconst HTTP_POST = 'POST';\n\t/**\n\t * PUT HTTP Method\n\t */\n\tconst HTTP_PUT = 'PUT';\n\t/**\n\t * DELETE HTTP Method\n\t */\n\tconst HTTP_DELETE = 'DELETE';\n\t/**\n\t * HEAD HTTP Method\n\t */\n\tconst HTTP_HEAD = 'HEAD';\n\n\t/*%******************************************************************************************%*/\n\t// CONSTRUCTOR/DESTRUCTOR\n\t/**\n\t * Constructs a new instance of this class.\n\t *\n\t * @param string $url (Optional) The URL to request or service endpoint to query.\n\t * @param string $proxy (Optional) The faux-url to use for proxy settings. Takes the following format: `proxy://user:pass@hostname:port`\n\t * @param array $helpers (Optional) An associative array of classnames to use for request, and response functionality. Gets passed in automatically by the calling class.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function __construct($url = null, $proxy = null, $helpers = null) {\n\t\t// Set some default values.\n\t\t$this->request_url = $url;\n\t\t$this->method = self::HTTP_GET;\n\t\t$this->request_headers = array ();\n\t\t$this->request_body = '';\n\t\t// Set a new Request class if one was set.\n\t\tif (isset ( $helpers ['request'] ) && ! empty ( $helpers ['request'] )) {\n\t\t\t$this->request_class = $helpers ['request'];\n\t\t}\n\t\t// Set a new Request class if one was set.\n\t\tif (isset ( $helpers ['response'] ) && ! empty ( $helpers ['response'] )) {\n\t\t\t$this->response_class = $helpers ['response'];\n\t\t}\n\t\tif ($proxy) {\n\t\t\t$this->set_proxy ( $proxy );\n\t\t}\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Destructs the instance. Closes opened file handles.\n\t *\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function __destruct() {\n\t\tif (isset ( $this->read_file ) && isset ( $this->read_stream )) {\n\t\t\tfclose ( $this->read_stream );\n\t\t}\n\t\tif (isset ( $this->write_file ) && isset ( $this->write_stream )) {\n\t\t\tfclose ( $this->write_stream );\n\t\t}\n\t\treturn $this;\n\t}\n\n\t/*%******************************************************************************************%*/\n\t// REQUEST METHODS\n\t/**\n\t * Sets the credentials to use for authentication.\n\t *\n\t * @param string $user (Required) The username to authenticate with.\n\t * @param string $pass (Required) The password to authenticate with.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_credentials($user, $pass) {\n\t\t$this->username = $user;\n\t\t$this->password = $pass;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Adds a custom HTTP header to the cURL request.\n\t *\n\t * @param string $key (Required) The custom HTTP header to set.\n\t * @param mixed $value (Required) The value to assign to the custom HTTP header.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function add_header($key, $value) {\n\t\t$this->request_headers [$key] = $value;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Removes an HTTP header from the cURL request.\n\t *\n\t * @param string $key (Required) The custom HTTP header to set.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function remove_header($key) {\n\t\tif (isset ( $this->request_headers [$key] )) {\n\t\t\tunset ( $this->request_headers [$key] );\n\t\t}\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Set the method type for the request.\n\t *\n\t * @param string $method (Required) One of the following constants: <HTTP_GET>, <HTTP_POST>, <HTTP_PUT>, <HTTP_HEAD>, <HTTP_DELETE>.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_method($method) {\n\t\t$this->method = strtoupper ( $method );\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Sets a custom useragent string for the class.\n\t *\n\t * @param string $ua (Required) The useragent string to use.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_useragent($ua) {\n\t\t$this->useragent = $ua;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Set the body to send in the request.\n\t *\n\t * @param string $body (Required) The textual content to send along in the body of the request.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_body($body) {\n\t\t$this->request_body = $body;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Set the URL to make the request to.\n\t *\n\t * @param string $url (Required) The URL to make the request to.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_request_url($url) {\n\t\t$this->request_url = $url;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Set additional CURLOPT settings. These will merge with the default settings, and override if\n\t * there is a duplicate.\n\t *\n\t * @param array $curlopts (Optional) A set of key-value pairs that set `CURLOPT` options. These will merge with the existing CURLOPTs, and ones passed here will override the defaults. Keys should be the `CURLOPT_*` constants, not strings.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_curlopts($curlopts) {\n\t\t$this->curlopts = $curlopts;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Sets the length in bytes to read from the stream while streaming up.\n\t *\n\t * @param integer $size (Required) The length in bytes to read from the stream.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_read_stream_size($size) {\n\t\t$this->read_stream_size = $size;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Sets the resource to read from while streaming up. Reads the stream from its current position until\n\t * EOF or `$size` bytes have been read. If `$size` is not given it will be determined by <php:fstat()> and\n\t * <php:ftell()>.\n\t *\n\t * @param resource $resource (Required) The readable resource to read from.\n\t * @param integer $size (Optional) The size of the stream to read.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_read_stream($resource, $size = null) {\n\t\tif (! isset ( $size ) || $size < 0) {\n\t\t\t$stats = fstat ( $resource );\n\t\t\tif ($stats && $stats ['size'] >= 0) {\n\t\t\t\t$position = ftell ( $resource );\n\t\t\t\tif ($position !== false && $position >= 0) {\n\t\t\t\t\t$size = $stats ['size'] - $position;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t$this->read_stream = $resource;\n\t\treturn $this->set_read_stream_size ( $size );\n\t}\n\n\t/**\n\t * Sets the file to read from while streaming up.\n\t *\n\t * @param string $location (Required) The readable location to read from.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_read_file($location) {\n\t\t$this->read_file = $location;\n\t\t$read_file_handle = fopen ( $location, 'r' );\n\t\treturn $this->set_read_stream ( $read_file_handle );\n\t}\n\n\t/**\n\t * Sets the resource to write to while streaming down.\n\t *\n\t * @param resource $resource (Required) The writeable resource to write to.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_write_stream($resource) {\n\t\t$this->write_stream = $resource;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Sets the file to write to while streaming down.\n\t *\n\t * @param string $location (Required) The writeable location to write to.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_write_file($location) {\n\t\t$this->write_file = $location;\n\t\t$write_file_handle = fopen ( $location, 'w' );\n\t\treturn $this->set_write_stream ( $write_file_handle );\n\t}\n\n\t/**\n\t * Set the proxy to use for making requests.\n\t *\n\t * @param string $proxy (Required) The faux-url to use for proxy settings. Takes the following format: `proxy://user:pass@hostname:port`\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_proxy($proxy) {\n\t\t$proxy = parse_url ( $proxy );\n\t\t$proxy ['user'] = isset ( $proxy ['user'] ) ? $proxy ['user'] : null;\n\t\t$proxy ['pass'] = isset ( $proxy ['pass'] ) ? $proxy ['pass'] : null;\n\t\t$proxy ['port'] = isset ( $proxy ['port'] ) ? $proxy ['port'] : null;\n\t\t$this->proxy = $proxy;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Set the intended starting seek position.\n\t *\n\t * @param integer $position (Required) The byte-position of the stream to begin reading from.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_seek_position($position) {\n\t\t$this->seek_position = isset ( $position ) ? ( integer ) $position : null;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Register a callback function to execute whenever a data stream is read from using\n\t * <CFRequest::streaming_read_callback()>.\n\t *\n\t * The user-defined callback function should accept three arguments:\n\t *\n\t * <ul>\n\t * <li><code>$curl_handle</code> - <code>resource</code> - Required - The cURL handle resource that represents the in-progress transfer.</li>\n\t * <li><code>$file_handle</code> - <code>resource</code> - Required - The file handle resource that represents the file on the local file system.</li>\n\t * <li><code>$length</code> - <code>integer</code> - Required - The length in kilobytes of the data chunk that was transferred.</li>\n\t * </ul>\n\t *\n\t * @param string|array|function $callback (Required) The callback function is called by <php:call_user_func()>, so you can pass the following values: <ul>\n\t * <li>The name of a global function to execute, passed as a string.</li>\n\t * <li>A method to execute, passed as <code>array('ClassName', 'MethodName')</code>.</li>\n\t * <li>An anonymous function (PHP 5.3+).</li></ul>\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function register_streaming_read_callback($callback) {\n\t\t$this->registered_streaming_read_callback = $callback;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Register a callback function to execute whenever a data stream is written to using\n\t * <CFRequest::streaming_write_callback()>.\n\t *\n\t * The user-defined callback function should accept two arguments:\n\t *\n\t * <ul>\n\t * <li><code>$curl_handle</code> - <code>resource</code> - Required - The cURL handle resource that represents the in-progress transfer.</li>\n\t * <li><code>$length</code> - <code>integer</code> - Required - The length in kilobytes of the data chunk that was transferred.</li>\n\t * </ul>\n\t *\n\t * @param string|array|function $callback (Required) The callback function is called by <php:call_user_func()>, so you can pass the following values: <ul>\n\t * <li>The name of a global function to execute, passed as a string.</li>\n\t * <li>A method to execute, passed as <code>array('ClassName', 'MethodName')</code>.</li>\n\t * <li>An anonymous function (PHP 5.3+).</li></ul>\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function register_streaming_write_callback($callback) {\n\t\t$this->registered_streaming_write_callback = $callback;\n\t\treturn $this;\n\t}\n\n\t/*%******************************************************************************************%*/\n\t// PREPARE, SEND, AND PROCESS REQUEST\n\t/**\n\t * A callback function that is invoked by cURL for streaming up.\n\t *\n\t * @param resource $curl_handle (Required) The cURL handle for the request.\n\t * @param resource $file_handle (Required) The open file handle resource.\n\t * @param integer $length (Required) The maximum number of bytes to read.\n\t * @return binary Binary data from a stream.\n\t */\n\tpublic function streaming_read_callback($curl_handle, $file_handle, $length) {\n\t\t// Once we've sent as much as we're supposed to send...\n\t\tif ($this->read_stream_read >= $this->read_stream_size) {\n\t\t\t// Send EOF\n\t\t\treturn '';\n\t\t}\n\t\t// If we're at the beginning of an upload and need to seek...\n\t\tif ($this->read_stream_read == 0 && isset ( $this->seek_position ) && $this->seek_position !== ftell ( $this->read_stream )) {\n\t\t\tif (fseek ( $this->read_stream, $this->seek_position ) !== 0) {\n\t\t\t\tthrow new BCS_RequestCore_Exception ( 'The stream does not support seeking and is either not at the requested position or the position is unknown.' );\n\t\t\t}\n\t\t}\n\t\t$read = fread ( $this->read_stream, min ( $this->read_stream_size - $this->read_stream_read, $length ) ); // Remaining upload data or cURL's requested chunk size\n\t\t$this->read_stream_read += strlen ( $read );\n\t\t$out = $read === false ? '' : $read;\n\t\t// Execute callback function\n\t\tif ($this->registered_streaming_read_callback) {\n\t\t\tcall_user_func ( $this->registered_streaming_read_callback, $curl_handle, $file_handle, $out );\n\t\t}\n\t\treturn $out;\n\t}\n\n\t/**\n\t * A callback function that is invoked by cURL for streaming down.\n\t *\n\t * @param resource $curl_handle (Required) The cURL handle for the request.\n\t * @param binary $data (Required) The data to write.\n\t * @return integer The number of bytes written.\n\t */\n\tpublic function streaming_write_callback($curl_handle, $data) {\n\t\t$length = strlen ( $data );\n\t\t$written_total = 0;\n\t\t$written_last = 0;\n\t\twhile ( $written_total < $length ) {\n\t\t\t$written_last = fwrite ( $this->write_stream, substr ( $data, $written_total ) );\n\t\t\tif ($written_last === false) {\n\t\t\t\treturn $written_total;\n\t\t\t}\n\t\t\t$written_total += $written_last;\n\t\t}\n\t\t// Execute callback function\n\t\tif ($this->registered_streaming_write_callback) {\n\t\t\tcall_user_func ( $this->registered_streaming_write_callback, $curl_handle, $written_total );\n\t\t}\n\t\treturn $written_total;\n\t}\n\n\t/**\n\t * Prepares and adds the details of the cURL request. This can be passed along to a <php:curl_multi_exec()>\n\t * function.\n\t *\n\t * @return resource The handle for the cURL object.\n\t */\n\tpublic function prep_request() {\n\t\t$curl_handle = curl_init ();\n\t\t// Set default options.\n\t\tcurl_setopt ( $curl_handle, CURLOPT_URL, $this->request_url );\n\t\tcurl_setopt ( $curl_handle, CURLOPT_FILETIME, true );\n\t\tcurl_setopt ( $curl_handle, CURLOPT_FRESH_CONNECT, false );\n\t\tcurl_setopt ( $curl_handle, CURLOPT_SSL_VERIFYPEER, false );\n\t\tcurl_setopt ( $curl_handle, CURLOPT_SSL_VERIFYHOST, true );\n\t\tcurl_setopt ( $curl_handle, CURLOPT_CLOSEPOLICY, CURLCLOSEPOLICY_LEAST_RECENTLY_USED );\n\t\tcurl_setopt ( $curl_handle, CURLOPT_MAXREDIRS, 5 );\n\t\tcurl_setopt ( $curl_handle, CURLOPT_HEADER, true );\n\t\tcurl_setopt ( $curl_handle, CURLOPT_RETURNTRANSFER, true );\n\t\tcurl_setopt ( $curl_handle, CURLOPT_TIMEOUT, 5184000 );\n\t\tcurl_setopt ( $curl_handle, CURLOPT_CONNECTTIMEOUT, 120 );\n\t\tcurl_setopt ( $curl_handle, CURLOPT_NOSIGNAL, true );\n\t\tcurl_setopt ( $curl_handle, CURLOPT_REFERER, $this->request_url );\n\t\tcurl_setopt ( $curl_handle, CURLOPT_USERAGENT, $this->useragent );\n\t\tcurl_setopt ( $curl_handle, CURLOPT_READFUNCTION, array (\n\t\t\t\t$this,\n\t\t\t\t'streaming_read_callback' ) );\n\t\tif ($this->debug_mode) {\n\t\t\tcurl_setopt ( $curl_handle, CURLOPT_VERBOSE, true );\n\t\t}\n\t\t//if (! ini_get ( 'safe_mode' )) {\n\t\t//modify by zhengkan\n\t\t//curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, true);\n\t\t//}\n\t\t// Enable a proxy connection if requested.\n\t\tif ($this->proxy) {\n\t\t\tcurl_setopt ( $curl_handle, CURLOPT_HTTPPROXYTUNNEL, true );\n\t\t\t$host = $this->proxy ['host'];\n\t\t\t$host .= ($this->proxy ['port']) ? ':' . $this->proxy ['port'] : '';\n\t\t\tcurl_setopt ( $curl_handle, CURLOPT_PROXY, $host );\n\t\t\tif (isset ( $this->proxy ['user'] ) && isset ( $this->proxy ['pass'] )) {\n\t\t\t\tcurl_setopt ( $curl_handle, CURLOPT_PROXYUSERPWD, $this->proxy ['user'] . ':' . $this->proxy ['pass'] );\n\t\t\t}\n\t\t}\n\t\t// Set credentials for HTTP Basic/Digest Authentication.\n\t\tif ($this->username && $this->password) {\n\t\t\tcurl_setopt ( $curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY );\n\t\t\tcurl_setopt ( $curl_handle, CURLOPT_USERPWD, $this->username . ':' . $this->password );\n\t\t}\n\t\t// Handle the encoding if we can.\n\t\tif (extension_loaded ( 'zlib' )) {\n\t\t\tcurl_setopt ( $curl_handle, CURLOPT_ENCODING, '' );\n\t\t}\n\t\t// Process custom headers\n\t\tif (isset ( $this->request_headers ) && count ( $this->request_headers )) {\n\t\t\t$temp_headers = array ();\n\t\t\tforeach ( $this->request_headers as $k => $v ) {\n\t\t\t\t$temp_headers [] = $k . ': ' . $v;\n\t\t\t}\n\t\t\tcurl_setopt ( $curl_handle, CURLOPT_HTTPHEADER, $temp_headers );\n\t\t}\n\t\tswitch ($this->method) {\n\t\t\tcase self::HTTP_PUT :\n\t\t\t\tcurl_setopt ( $curl_handle, CURLOPT_CUSTOMREQUEST, 'PUT' );\n\t\t\t\tif (isset ( $this->read_stream )) {\n\t\t\t\t\tif (! isset ( $this->read_stream_size ) || $this->read_stream_size < 0) {\n\t\t\t\t\t\tthrow new BCS_RequestCore_Exception ( 'The stream size for the streaming upload cannot be determined.' );\n\t\t\t\t\t}\n\t\t\t\t\tcurl_setopt ( $curl_handle, CURLOPT_INFILESIZE, $this->read_stream_size );\n\t\t\t\t\tcurl_setopt ( $curl_handle, CURLOPT_UPLOAD, true );\n\t\t\t\t} else {\n\t\t\t\t\tcurl_setopt ( $curl_handle, CURLOPT_POSTFIELDS, $this->request_body );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase self::HTTP_POST :\n\t\t\t\tcurl_setopt ( $curl_handle, CURLOPT_POST, true );\n\t\t\t\tcurl_setopt ( $curl_handle, CURLOPT_POSTFIELDS, $this->request_body );\n\t\t\t\tbreak;\n\t\t\tcase self::HTTP_HEAD :\n\t\t\t\tcurl_setopt ( $curl_handle, CURLOPT_CUSTOMREQUEST, self::HTTP_HEAD );\n\t\t\t\tcurl_setopt ( $curl_handle, CURLOPT_NOBODY, 1 );\n\t\t\t\tbreak;\n\t\t\tdefault : // Assumed GET\n\t\t\t\tcurl_setopt ( $curl_handle, CURLOPT_CUSTOMREQUEST, $this->method );\n\t\t\t\tif (isset ( $this->write_stream )) {\n\t\t\t\t\tcurl_setopt ( $curl_handle, CURLOPT_WRITEFUNCTION, array (\n\t\t\t\t\t\t\t$this,\n\t\t\t\t\t\t\t'streaming_write_callback' ) );\n\t\t\t\t\tcurl_setopt ( $curl_handle, CURLOPT_HEADER, false );\n\t\t\t\t} else {\n\t\t\t\t\tcurl_setopt ( $curl_handle, CURLOPT_POSTFIELDS, $this->request_body );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t\t// Merge in the CURLOPTs\n\t\tif (isset ( $this->curlopts ) && sizeof ( $this->curlopts ) > 0) {\n\t\t\tforeach ( $this->curlopts as $k => $v ) {\n\t\t\t\tcurl_setopt ( $curl_handle, $k, $v );\n\t\t\t}\n\t\t}\n\t\treturn $curl_handle;\n\t}\n\n\t/**\n\t * is the environment BAE?\n\t * @return boolean the result of the answer\n\t */\n\tprivate function isBaeEnv() {\n\t\tif (isset ( $_SERVER ['HTTP_HOST'] )) {\n\t\t\t$host = $_SERVER ['HTTP_HOST'];\n\t\t\t$pos = strpos ( $host, '.' );\n\t\t\tif ($pos !== false) {\n\t\t\t\t$substr = substr ( $host, $pos + 1 );\n\t\t\t\tif ($substr == 'duapp.com') {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (isset ( $_SERVER [\"HTTP_BAE_LOGID\"] )) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Take the post-processed cURL data and break it down into useful header/body/info chunks. Uses the\n\t * data stored in the `curl_handle` and `response` properties unless replacement data is passed in via\n\t * parameters.\n\t *\n\t * @param resource $curl_handle (Optional) The reference to the already executed cURL request.\n\t * @param string $response (Optional) The actual response content itself that needs to be parsed.\n\t * @return BCS_ResponseCore A <BCS_ResponseCore> object containing a parsed HTTP response.\n\t */\n\tpublic function process_response($curl_handle = null, $response = null) {\n\t\t// Accept a custom one if it's passed.\n\t\tif ($curl_handle && $response) {\n\t\t\t$this->curl_handle = $curl_handle;\n\t\t\t$this->response = $response;\n\t\t}\n\t\t// As long as this came back as a valid resource...\n\t\tif (is_resource ( $this->curl_handle )) {\n\t\t\t// Determine what's what.\n\t\t\t$header_size = curl_getinfo ( $this->curl_handle, CURLINFO_HEADER_SIZE );\n\t\t\t$this->response_headers = substr ( $this->response, 0, $header_size );\n\t\t\t$this->response_body = substr ( $this->response, $header_size );\n\t\t\t$this->response_code = curl_getinfo ( $this->curl_handle, CURLINFO_HTTP_CODE );\n\t\t\t$this->response_info = curl_getinfo ( $this->curl_handle );\n\t\t\t// Parse out the headers\n\t\t\t$this->response_headers = explode ( \"\\r\\n\\r\\n\", trim ( $this->response_headers ) );\n\t\t\t$this->response_headers = array_pop ( $this->response_headers );\n\t\t\t$this->response_headers = explode ( \"\\r\\n\", $this->response_headers );\n\t\t\tarray_shift ( $this->response_headers );\n\t\t\t// Loop through and split up the headers.\n\t\t\t$header_assoc = array ();\n\t\t\tforeach ( $this->response_headers as $header ) {\n\t\t\t\t$kv = explode ( ': ', $header );\n\t\t\t\t//$header_assoc [strtolower ( $kv [0] )] = $kv [1];\n\t\t\t\t$header_assoc [$kv [0]] = $kv [1];\n\t\t\t}\n\t\t\t// Reset the headers to the appropriate property.\n\t\t\t$this->response_headers = $header_assoc;\n\t\t\t$this->response_headers ['_info'] = $this->response_info;\n\t\t\t$this->response_headers ['_info'] ['method'] = $this->method;\n\t\t\tif ($curl_handle && $response) {\n\t\t\t\t$class='\\Think\\Upload\\Driver\\Bcs\\\\'. $this->response_class;\n\t\t\t\treturn new  $class ( $this->response_headers, $this->response_body, $this->response_code, $this->curl_handle );\n\t\t\t}\n\t\t}\n\t\t// Return false\n\t\treturn false;\n\t}\n\n\t/**\n\t * Sends the request, calling necessary utility functions to update built-in properties.\n\t *\n\t * @param boolean $parse (Optional) Whether to parse the response with BCS_ResponseCore or not.\n\t * @return string The resulting unparsed data from the request.\n\t */\n\tpublic function send_request($parse = false) {\n\t\tif (false === $this->isBaeEnv ()) {\n\t\t\tset_time_limit ( 0 );\n\t\t}\n\t\t$curl_handle = $this->prep_request ();\n\t\t$this->response = curl_exec ( $curl_handle );\n\t\tif ($this->response === false ||\n                ($this->method === self::HTTP_GET &&\n                  curl_errno($curl_handle) === CURLE_PARTIAL_FILE)) {\n\t\t\tthrow new BCS_RequestCore_Exception ( 'cURL resource: ' . ( string ) $curl_handle . '; cURL error: ' . curl_error ( $curl_handle ) . ' (' . curl_errno ( $curl_handle ) . ')' );\n\t\t}\n\t\t$parsed_response = $this->process_response ( $curl_handle, $this->response );\n\t\tcurl_close ( $curl_handle );\n\t\tif ($parse) {\n\t\t\treturn $parsed_response;\n\t\t}\n\t\treturn $this->response;\n\t}\n\n\t/**\n\t * Sends the request using <php:curl_multi_exec()>, enabling parallel requests. Uses the \"rolling\" method.\n\t *\n\t * @param array $handles (Required) An indexed array of cURL handles to process simultaneously.\n\t * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>\n\t * <li><code>callback</code> - <code>string|array</code> - Optional - The string name of a function to pass the response data to. If this is a method, pass an array where the <code>[0]</code> index is the class and the <code>[1]</code> index is the method name.</li>\n\t * <li><code>limit</code> - <code>integer</code> - Optional - The number of simultaneous requests to make. This can be useful for scaling around slow server responses. Defaults to trusting cURLs judgement as to how many to use.</li></ul>\n\t * @return array Post-processed cURL responses.\n\t */\n\tpublic function send_multi_request($handles, $opt = null) {\n\t\tif (false === $this->isBaeEnv ()) {\n\t\t\tset_time_limit ( 0 );\n\t\t}\n\t\t// Skip everything if there are no handles to process.\n\t\tif (count ( $handles ) === 0)\n\t\t\treturn array ();\n\t\tif (! $opt)\n\t\t\t$opt = array ();\n\n\t\t// Initialize any missing options\n\t\t$limit = isset ( $opt ['limit'] ) ? $opt ['limit'] : - 1;\n\t\t// Initialize\n\t\t$handle_list = $handles;\n\t\t$http = new $this->request_class ();\n\t\t$multi_handle = curl_multi_init ();\n\t\t$handles_post = array ();\n\t\t$added = count ( $handles );\n\t\t$last_handle = null;\n\t\t$count = 0;\n\t\t$i = 0;\n\t\t// Loop through the cURL handles and add as many as it set by the limit parameter.\n\t\twhile ( $i < $added ) {\n\t\t\tif ($limit > 0 && $i >= $limit)\n\t\t\t\tbreak;\n\t\t\tcurl_multi_add_handle ( $multi_handle, array_shift ( $handles ) );\n\t\t\t$i ++;\n\t\t}\n\t\tdo {\n\t\t\t$active = false;\n\t\t\t// Start executing and wait for a response.\n\t\t\twhile ( ($status = curl_multi_exec ( $multi_handle, $active )) === CURLM_CALL_MULTI_PERFORM ) {\n\t\t\t\t// Start looking for possible responses immediately when we have to add more handles\n\t\t\t\tif (count ( $handles ) > 0)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// Figure out which requests finished.\n\t\t\t$to_process = array ();\n\t\t\twhile ( $done = curl_multi_info_read ( $multi_handle ) ) {\n\t\t\t\t// Since curl_errno() isn't reliable for handles that were in multirequests, we check the 'result' of the info read, which contains the curl error number, (listed here http://curl.haxx.se/libcurl/c/libcurl-errors.html )\n\t\t\t\tif ($done ['result'] > 0) {\n\t\t\t\t\tthrow new BCS_RequestCore_Exception ( 'cURL resource: ' . ( string ) $done ['handle'] . '; cURL error: ' . curl_error ( $done ['handle'] ) . ' (' . $done ['result'] . ')' );\n\t\t\t\t} // Because curl_multi_info_read() might return more than one message about a request, we check to see if this request is already in our array of completed requests\nelseif (! isset ( $to_process [( int ) $done ['handle']] )) {\n\t\t\t\t\t$to_process [( int ) $done ['handle']] = $done;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Actually deal with the request\n\t\t\tforeach ( $to_process as $pkey => $done ) {\n\t\t\t\t$response = $http->process_response ( $done ['handle'], curl_multi_getcontent ( $done ['handle'] ) );\n\t\t\t\t$key = array_search ( $done ['handle'], $handle_list, true );\n\t\t\t\t$handles_post [$key] = $response;\n\t\t\t\tif (count ( $handles ) > 0) {\n\t\t\t\t\tcurl_multi_add_handle ( $multi_handle, array_shift ( $handles ) );\n\t\t\t\t}\n\t\t\t\tcurl_multi_remove_handle ( $multi_handle, $done ['handle'] );\n\t\t\t\tcurl_close ( $done ['handle'] );\n\t\t\t}\n\t\t} while ( $active || count ( $handles_post ) < $added );\n\t\tcurl_multi_close ( $multi_handle );\n\t\tksort ( $handles_post, SORT_NUMERIC );\n\t\treturn $handles_post;\n\t}\n\n\t/*%******************************************************************************************%*/\n\t// RESPONSE METHODS\n\t/**\n\t * Get the HTTP response headers from the request.\n\t *\n\t * @param string $header (Optional) A specific header value to return. Defaults to all headers.\n\t * @return string|array All or selected header values.\n\t */\n\tpublic function get_response_header($header = null) {\n\t\tif ($header) {\n\t\t\t//\t\t\treturn $this->response_headers [strtolower ( $header )];\n\t\t\treturn $this->response_headers [$header];\n\t\t}\n\t\treturn $this->response_headers;\n\t}\n\n\t/**\n\t * Get the HTTP response body from the request.\n\t *\n\t * @return string The response body.\n\t */\n\tpublic function get_response_body() {\n\t\treturn $this->response_body;\n\t}\n\n\t/**\n\t * Get the HTTP response code from the request.\n\t *\n\t * @return string The HTTP response code.\n\t */\n\tpublic function get_response_code() {\n\t\treturn $this->response_code;\n\t}\n}\n/**\n * Container for all response-related methods.\n */\nclass BCS_ResponseCore {\n\t/**\n\t * Stores the HTTP header information.\n\t */\n\tpublic $header;\n\t/**\n\t * Stores the SimpleXML response.\n\t */\n\tpublic $body;\n\t/**\n\t * Stores the HTTP response code.\n\t */\n\tpublic $status;\n\n\t/**\n\t * Constructs a new instance of this class.\n\t *\n\t * @param array $header (Required) Associative array of HTTP headers (typically returned by <BCS_RequestCore::get_response_header()>).\n\t * @param string $body (Required) XML-formatted response from AWS.\n\t * @param integer $status (Optional) HTTP response status code from the request.\n\t * @return object Contains an <php:array> `header` property (HTTP headers as an associative array), a <php:SimpleXMLElement> or <php:string> `body` property, and an <php:integer> `status` code.\n\t */\n\tpublic function __construct($header, $body, $status = null) {\n\t\t$this->header = $header;\n\t\t$this->body = $body;\n\t\t$this->status = $status;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Did we receive the status code we expected?\n\t *\n\t * @param integer|array $codes (Optional) The status code(s) to expect. Pass an <php:integer> for a single acceptable value, or an <php:array> of integers for multiple acceptable values.\n\t * @return boolean Whether we received the expected status code or not.\n\t */\n\tpublic function isOK($codes = array(200, 201, 204, 206)) {\n\t\tif (is_array ( $codes )) {\n\t\t\treturn in_array ( $this->status, $codes );\n\t\t}\n\t\treturn $this->status === $codes;\n\t}\n}\n/**\n * Default BCS_RequestCore Exception.\n */\nclass BCS_RequestCore_Exception extends \\Exception {\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Upload/Driver/Bcs.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: Jay <yangweijiester@gmail.com> <http://code-tech.diandian.com>\n// +----------------------------------------------------------------------\nnamespace Think\\Upload\\Driver;\nuse Think\\Upload\\Driver\\Bcs\\BaiduBcs;\nclass Bcs {\n    /**\n     * 上传文件根目录\n     * @var string\n     */\n    private $rootPath;\n    const DEFAULT_URL = 'bcs.duapp.com';\n\n    /**\n     * 上传错误信息\n     * @var string\n     */\n    private $error = '';\n\n    public $config = array(\n    \t'AccessKey'=> '',\n        'SecretKey'=> '', //百度云服务器\n        'bucket'   => '', //空间名称\n        'rename'   => false,\n        'timeout'  => 3600, //超时时间\n    );\n\n    public $bcs = null;\n\n    /**\n     * 构造函数，用于设置上传根路径\n     * @param array  $config FTP配置\n     */\n    public function __construct($config){\n        /* 默认FTP配置 */\n        $this->config = array_merge($this->config, $config);\n        \n        $bcsClass = dirname(__FILE__). \"/Bcs/bcs.class.php\";\n        if(is_file($bcsClass))\n            require_once($bcsClass);\n        $this->bcs = new BaiduBCS ( $this->config['AccessKey'], $this->config['SecretKey'], self:: DEFAULT_URL );\n    }\n\n    /**\n     * 检测上传根目录(百度云上传时支持自动创建目录，直接返回)\n     * @param string $rootpath   根目录\n     * @return boolean true-检测通过，false-检测失败\n     */\n    public function checkRootPath($rootpath){\n        /* 设置根目录 */\n        $this->rootPath = str_replace('./', '/', $rootpath);\n    \treturn true;\n    }\n\n    /**\n     * 检测上传目录(百度云上传时支持自动创建目录，直接返回)\n     * @param  string $savepath 上传目录\n     * @return boolean          检测结果，true-通过，false-失败\n     */\n\tpublic function checkSavePath($savepath){\n\t\treturn true;\n    }\n\n    /**\n     * 创建文件夹 (百度云上传时支持自动创建目录，直接返回)\n     * @param  string $savepath 目录名称\n     * @return boolean          true-创建成功，false-创建失败\n     */\n    public function mkdir($savepath){\n    \treturn true;\n    }\n\n    /**\n     * 保存指定文件\n     * @param  array   $file    保存的文件信息\n     * @param  boolean $replace 同名文件是否覆盖\n     * @return boolean          保存状态，true-成功，false-失败\n     */\n    public function save(&$file,$replace=true) {\n        $opt = array ();\n        $opt ['acl'] = BaiduBCS::BCS_SDK_ACL_TYPE_PUBLIC_WRITE;\n        $opt ['curlopts'] = array (\n            CURLOPT_CONNECTTIMEOUT => 10,\n            CURLOPT_TIMEOUT => 1800\n        );\n        $object = \"/{$file['savepath']}{$file['savename']}\";\n        $response = $this->bcs->create_object ( $this->config['bucket'], $object, $file['tmp_name'], $opt );\n        $url = $this->download($object);\n        $file['url'] = $url;\n        return $response->isOK() ? true : false;\n    }\n\n    public function download($file){\n        $file = str_replace('./', '/', $file);\n        $opt = array();\n        $opt['time'] = mktime('2049-12-31'); //这是最长有效时间!--\n        $response = $this->bcs->generate_get_object_url ( $this->config['bucket'], $file, $opt );\n        return $response;\n    }\n\n    /**\n     * 获取最后一次上传错误信息\n     * @return string 错误信息\n     */\n    public function getError(){\n        return $this->error;\n    }\n\n    /**\n     * 请求百度云服务器\n     * @param  string   $path    请求的PATH\n     * @param  string   $method  请求方法\n     * @param  array    $headers 请求header\n     * @param  resource $body    上传文件资源\n     * @return boolean\n     */\n    private function request($path, $method, $headers = null, $body = null){\n        $ch  = curl_init($path);\n\n        $_headers = array('Expect:');\n        if (!is_null($headers) && is_array($headers)){\n            foreach($headers as $k => $v) {\n                array_push($_headers, \"{$k}: {$v}\");\n            }\n        }\n\n        $length = 0;\n        $date   = gmdate('D, d M Y H:i:s \\G\\M\\T');\n\n        if (!is_null($body)) {\n            if(is_resource($body)){\n                fseek($body, 0, SEEK_END);\n                $length = ftell($body);\n                fseek($body, 0);\n\n                array_push($_headers, \"Content-Length: {$length}\");\n                curl_setopt($ch, CURLOPT_INFILE, $body);\n                curl_setopt($ch, CURLOPT_INFILESIZE, $length);\n            } else {\n                $length = @strlen($body);\n                array_push($_headers, \"Content-Length: {$length}\");\n                curl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n            }\n        } else {\n            array_push($_headers, \"Content-Length: {$length}\");\n        }\n\n        // array_push($_headers, 'Authorization: ' . $this->sign($method, $uri, $date, $length));\n        array_push($_headers, \"Date: {$date}\");\n\n        curl_setopt($ch, CURLOPT_HTTPHEADER, $_headers);\n        curl_setopt($ch, CURLOPT_TIMEOUT, $this->config['timeout']);\n        curl_setopt($ch, CURLOPT_HEADER, 1);\n        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);\n        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);\n\n        if ($method == 'PUT' || $method == 'POST') {\n            curl_setopt($ch, CURLOPT_POST, 1);\n        } else {\n            curl_setopt($ch, CURLOPT_POST, 0);\n        }\n\n        if ($method == 'HEAD') {\n            curl_setopt($ch, CURLOPT_NOBODY, true);\n        }\n\n        $response = curl_exec($ch);\n        $status   = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n        curl_close($ch);\n        list($header, $body) = explode(\"\\r\\n\\r\\n\", $response, 2);\n\n        if ($status == 200) {\n            if ($method == 'GET') {\n                return $body;\n            } else {\n                $data = $this->response($header);\n                return count($data) > 0 ? $data : true;\n            }\n        } else {\n            $this->error($header);\n            return false;\n        }\n    }\n\n    /**\n     * 获取响应数据\n     * @param  string $text 响应头字符串\n     * @return array        响应数据列表\n     */\n    private function response($text){\n        $items = json_decode($text, true);\n        return $items;\n    }\n\n    /**\n     * 生成请求签名\n     * @return string          请求签名\n     */\n    private function sign($method, $Bucket, $object='/', $size=''){\n        if(!$size)\n            $size = $this->config['size'];\n        $param = array(\n            'ak'=>$this->config['AccessKey'],\n            'sk'=>$this->config['SecretKey'],\n            'size'=>$size,\n            'bucket'=>$Bucket,\n            'host'=>self :: DEFAULT_URL,\n            'date'=>time()+$this->config['timeout'],\n            'ip'=>'',\n            'object'=>$object\n        );\n        $response = $this->request($this->apiurl.'?'.http_build_query($param), 'POST');\n        if($response)\n            $response = json_decode($response, true);\n        return $response['content'][$method];\n    }\n\n\n    /**\n     * 获取请求错误信息\n     * @param  string $header 请求返回头信息\n     */\n    private function error($header) {\n        list($status, $stash) = explode(\"\\r\\n\", $header, 2);\n        list($v, $code, $message) = explode(\" \", $status, 3);\n        $message = is_null($message) ? 'File Not Found' : \"[{$status}]:{$message}\";\n        $this->error = $message;\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Upload/Driver/Ftp.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>\n// +----------------------------------------------------------------------\n\nnamespace Think\\Upload\\Driver;\nclass Ftp {\n    /**\n     * 上传文件根目录\n     * @var string\n     */\n    private $rootPath;\n\n    /**\n     * 本地上传错误信息\n     * @var string\n     */\n    private $error = ''; //上传错误信息\n\n    /**\n     * FTP连接\n     * @var resource\n     */\n    private $link;\n\n    private $config = array(\n        'host'     => '', //服务器\n        'port'     => 21, //端口\n        'timeout'  => 90, //超时时间\n        'username' => '', //用户名\n        'password' => '', //密码\n    );\n\n    /**\n     * 构造函数，用于设置上传根路径\n     * @param array  $config FTP配置\n     */\n    public function __construct($config){\n        /* 默认FTP配置 */\n        $this->config = array_merge($this->config, $config);\n\n        /* 登录FTP服务器 */\n        if(!$this->login()){\n            E($this->error);\n        }\n    }\n\n    /**\n     * 检测上传根目录\n     * @param string $rootpath   根目录\n     * @return boolean true-检测通过，false-检测失败\n     */\n    public function checkRootPath($rootpath){\n        /* 设置根目录 */\n        $this->rootPath = ftp_pwd($this->link) . '/' . ltrim($rootpath, '/');\n\n        if(!@ftp_chdir($this->link, $this->rootPath)){\n            $this->error = '上传根目录不存在！';\n            return false;\n        }\n        return true;\n    }\n\n    /**\n     * 检测上传目录\n     * @param  string $savepath 上传目录\n     * @return boolean          检测结果，true-通过，false-失败\n     */\n    public function checkSavePath($savepath){\n        /* 检测并创建目录 */\n        if (!$this->mkdir($savepath)) {\n            return false;\n        } else {\n            //TODO:检测目录是否可写\n            return true;\n        }\n    }\n\n    /**\n     * 保存指定文件\n     * @param  array   $file    保存的文件信息\n     * @param  boolean $replace 同名文件是否覆盖\n     * @return boolean          保存状态，true-成功，false-失败\n     */\n    public function save($file, $replace=true) {\n        $filename = $this->rootPath . $file['savepath'] . $file['savename'];\n\n        /* 不覆盖同名文件 */\n        // if (!$replace && is_file($filename)) {\n        //     $this->error = '存在同名文件' . $file['savename'];\n        //     return false;\n        // }\n\n        /* 移动文件 */\n        if (!ftp_put($this->link, $filename, $file['tmp_name'], FTP_BINARY)) {\n            $this->error = '文件上传保存错误！';\n            return false;\n        }\n        return true;\n    }\n\n    /**\n     * 创建目录\n     * @param  string $savepath 要创建的目录\n     * @return boolean          创建状态，true-成功，false-失败\n     */\n    public function mkdir($savepath){\n        $dir = $this->rootPath . $savepath;\n        if(ftp_chdir($this->link, $dir)){\n            return true;\n        }\n\n        if(ftp_mkdir($this->link, $dir)){\n            return true;\n        } elseif($this->mkdir(dirname($savepath)) && ftp_mkdir($this->link, $dir)) {\n            return true;\n        } else {\n            $this->error = \"目录 {$savepath} 创建失败！\";\n            return false;\n        }\n    }\n\n    /**\n     * 获取最后一次上传错误信息\n     * @return string 错误信息\n     */\n    public function getError(){\n        return $this->error;\n    }\n\n    /**\n     * 登录到FTP服务器\n     * @return boolean true-登录成功，false-登录失败\n     */\n    private function login(){\n        extract($this->config);\n        $this->link = ftp_connect($host, $port, $timeout);\n        if($this->link) {\n            if (ftp_login($this->link, $username, $password)) {\n               return true;\n            } else {\n                $this->error = \"无法登录到FTP服务器：username - {$username}\";\n            }\n        } else {\n            $this->error = \"无法连接到FTP服务器：{$host}\";\n        }\n        return false;\n    }\n\n    /**\n     * 析构方法，用于断开当前FTP连接\n     */\n    public function __destruct() {\n        ftp_close($this->link);\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Upload/Driver/Local.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>\n// +----------------------------------------------------------------------\n\nnamespace Think\\Upload\\Driver;\nclass Local{\n    /**\n     * 上传文件根目录\n     * @var string\n     */\n    private $rootPath;\n\n    /**\n     * 本地上传错误信息\n     * @var string\n     */\n    private $error = ''; //上传错误信息\n\n    /**\n     * 构造函数，用于设置上传根路径\n     */\n    public function __construct($config = null){\n\n    }\n\n    /**\n     * 检测上传根目录\n     * @param string $rootpath   根目录\n     * @return boolean true-检测通过，false-检测失败\n     */\n    public function checkRootPath($rootpath){\n        if(!(is_dir($rootpath) && is_writable($rootpath))){\n            $this->error = '上传根目录不存在！请尝试手动创建:'.$rootpath;\n            return false;\n        }\n        $this->rootPath = $rootpath;\n        return true;\n    }\n\n    /**\n     * 检测上传目录\n     * @param  string $savepath 上传目录\n     * @return boolean          检测结果，true-通过，false-失败\n     */\n    public function checkSavePath($savepath){\n        /* 检测并创建目录 */\n        if (!$this->mkdir($savepath)) {\n            return false;\n        } else {\n            /* 检测目录是否可写 */\n            if (!is_writable($this->rootPath . $savepath)) {\n                $this->error = '上传目录 ' . $savepath . ' 不可写！';\n                return false;\n            } else {\n                return true;\n            }\n        }\n    }\n\n    /**\n     * 保存指定文件\n     * @param  array   $file    保存的文件信息\n     * @param  boolean $replace 同名文件是否覆盖\n     * @return boolean          保存状态，true-成功，false-失败\n     */\n    public function save($file, $replace=true) {\n        $filename = $this->rootPath . $file['savepath'] . $file['savename'];\n\n        /* 不覆盖同名文件 */ \n        if (!$replace && is_file($filename)) {\n            $this->error = '存在同名文件' . $file['savename'];\n            return false;\n        }\n\n        /* 移动文件 */\n        if (!move_uploaded_file($file['tmp_name'], $filename)) {\n            $this->error = '文件上传保存错误！';\n            return false;\n        }\n        \n        return true;\n    }\n\n    /**\n     * 创建目录\n     * @param  string $savepath 要创建的穆里\n     * @return boolean          创建状态，true-成功，false-失败\n     */\n    public function mkdir($savepath){\n        $dir = $this->rootPath . $savepath;\n        if(is_dir($dir)){\n            return true;\n        }\n\n        if(mkdir($dir, 0777, true)){\n            return true;\n        } else {\n            $this->error = \"目录 {$savepath} 创建失败！\";\n            return false;\n        }\n    }\n\n    /**\n     * 获取最后一次上传错误信息\n     * @return string 错误信息\n     */\n    public function getError(){\n        return $this->error;\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Upload/Driver/Qiniu/QiniuStorage.class.php",
    "content": "<?php\n\tnamespace Think\\Upload\\Driver\\Qiniu;\n\n\tclass QiniuStorage {\n\n\t\tpublic $QINIU_RSF_HOST \t= \t'http://rsf.qbox.me';\n\t\tpublic $QINIU_RS_HOST \t= \t'http://rs.qbox.me';\n\t\tpublic $QINIU_UP_HOST \t= \t'http://up.qiniu.com';\n\t\tpublic $timeout \t\t= \t'';\n\n\t\tpublic function __construct($config){\n\t\t\t$this->sk \t\t= \t$config['secretKey'];\n\t\t\t$this->ak \t\t= \t$config['accessKey'];\n\t\t\t$this->domain \t= \t$config['domain'];\n\t\t\t$this->bucket \t= \t$config['bucket'];\n\t\t\t$this->timeout \t= \tisset($config['timeout'])? $config['timeout'] : 3600;\n\t\t}\n\n\t\tstatic function sign($sk, $ak, $data){\n\t\t\t$sign = hash_hmac('sha1', $data, $sk, true);\n\t\t\treturn $ak . ':' . self::Qiniu_Encode($sign);\n\t\t}\n\n\t\tstatic function signWithData($sk, $ak, $data){\n\t\t\t$data = self::Qiniu_Encode($data);\n\t\t\treturn self::sign($sk, $ak, $data) . ':' . $data;\n\t\t}\n\n\t\tpublic function accessToken($url, $body=''){\n\t\t\t$parsed_url = \tparse_url($url);\n\t\t    $path \t\t= \t$parsed_url['path'];\n\t\t    $access \t= \t$path;\n\t\t    if (isset($parsed_url['query'])) {\n\t\t        $access .= \"?\" . $parsed_url['query'];\n\t\t    }\n\t\t    $access    .= \"\\n\";\n\n\t\t    if($body){\n\t\t        $access .= $body;\n\t\t    }\n\t\t    return self::sign($this->sk, $this->ak, $access);\n\t\t}\n\n\t\tpublic function UploadToken($sk ,$ak ,$param){\n\t\t\t$param['deadline'] = $param['Expires'] == 0? 3600: $param['Expires'];\n\t\t\t$param['deadline'] += time();\n\t\t\t$data = array('scope'=> $this->bucket, 'deadline'=>$param['deadline']);\n\t\t\tif (!empty($param['CallbackUrl'])) {\n\t\t\t\t$data['callbackUrl'] = $param['CallbackUrl'];\n\t\t\t}\n\t\t\tif (!empty($param['CallbackBody'])) {\n\t\t\t\t$data['callbackBody'] = $param['CallbackBody'];\n\t\t\t}\n\t\t\tif (!empty($param['ReturnUrl'])) {\n\t\t\t\t$data['returnUrl'] = $param['ReturnUrl'];\n\t\t\t}\n\t\t\tif (!empty($param['ReturnBody'])) {\n\t\t\t\t$data['returnBody'] = $param['ReturnBody'];\n\t\t\t}\n\t\t\tif (!empty($param['AsyncOps'])) {\n\t\t\t\t$data['asyncOps'] = $param['AsyncOps'];\n\t\t\t}\n\t\t\tif (!empty($param['EndUser'])) {\n\t\t\t\t$data['endUser'] = $param['EndUser'];\n\t\t\t}\n\t\t\t$data = json_encode($data);\n\t\t\treturn self::SignWithData($sk, $ak, $data);\n\t\t}\n\n\t\tpublic function upload($config, $file){\n\t\t\t$uploadToken = $this->UploadToken($this->sk, $this->ak, $config);\n\n\t\t\t$url \t= \t\"{$this->QINIU_UP_HOST}\";\n\t\t\t$mimeBoundary = md5(microtime());\n\t\t\t$header = \tarray('Content-Type'=>'multipart/form-data;boundary='.$mimeBoundary);\n\t\t\t$data \t= \tarray();\n\n\t\t\t$fields = array(\n\t\t\t\t'token'\t=>\t$uploadToken,\n\t\t\t\t'key'\t=>\t$config['saveName']? : $file['fileName'],\n\t\t\t);\n\n\t\t\tif(is_array($config['custom_fields']) && $config['custom_fields'] !== array()){\n\t\t\t\t$fields = array_merge($fields, $config['custom_fields']);\n\t\t\t}\n\n\t\t\tforeach ($fields as $name => $val) {\n\t\t\t\tarray_push($data, '--' . $mimeBoundary);\n\t\t\t\tarray_push($data, \"Content-Disposition: form-data; name=\\\"$name\\\"\");\n\t\t\t\tarray_push($data, '');\n\t\t\t\tarray_push($data, $val);\n\t\t\t}\n\n\t\t\t//文件\n\t\t\tarray_push($data, '--' . $mimeBoundary);\n\t\t\t$name \t\t= \t$file['name'];\n\t\t\t$fileName \t= \t$file['fileName'];\n\t\t\t$fileBody \t= \t$file['fileBody'];\n\t\t\t$fileName \t= \tself::Qiniu_escapeQuotes($fileName);\n\t\t\tarray_push($data, \"Content-Disposition: form-data; name=\\\"$name\\\"; filename=\\\"$fileName\\\"\");\n\t\t\tarray_push($data, 'Content-Type: application/octet-stream');\n\t\t\tarray_push($data, '');\n\t\t\tarray_push($data, $fileBody);\n\n\t\t\tarray_push($data, '--' . $mimeBoundary . '--');\n\t\t\tarray_push($data, '');\n\n\t\t\t$body \t\t= \timplode(\"\\r\\n\", $data);\n\t\t\t$response \t= \t$this->request($url, 'POST', $header, $body);\n\t\t\treturn $response;\n\t\t}\n\n\t\tpublic function dealWithType($key, $type){\n\t\t\t$param \t\t= \t$this->buildUrlParam();\n\t\t\t$url \t\t= \t'';\n\n\t\t\tswitch($type){\n\t\t\t\tcase 'img':\n\t\t\t\t\t$url = $this->downLink($key);\n\t\t\t\t\tif($param['imageInfo']){\n\t\t\t\t\t\t$url .= '?imageInfo';\n\t\t\t\t\t}else if($param['exif']){\n\t\t\t\t\t\t$url .= '?exif';\n\t\t\t\t\t}else if($param['imageView']){\n\t\t\t\t\t\t$url .= '?imageView/'.$param['mode'];\n\t\t\t\t\t\tif($param['w'])\n\t\t\t\t\t\t\t$url .= \"/w/{$param['w']}\";\n\t\t\t\t\t\tif($param['h'])\n\t\t\t\t\t\t\t$url .= \"/h/{$param['h']}\";\n\t\t\t\t\t\tif($param['q'])\n\t\t\t\t\t\t\t$url .= \"/q/{$param['q']}\";\n\t\t\t\t\t\tif($param['format'])\n\t\t\t\t\t\t\t$url .= \"/format/{$param['format']}\";\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'video': //TODO 视频处理\n\t\t\t\tcase 'doc':\n\t\t\t\t\t$url = $this->downLink($key);\n\t\t\t\t\t$url .= '?md2html';\n\t\t\t\t\tif(isset($param['mode']))\n\t\t\t\t\t\t$url .= '/'.(int)$param['mode'];\n\t\t\t\t\tif($param['cssurl'])\n\t\t\t\t\t\t$url .= '/'. self::Qiniu_Encode($param['cssurl']);\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\t\t\treturn $url;\n\t\t}\n\n\t\tpublic function buildUrlParam(){\n\t\t\treturn $_REQUEST;\n\t\t}\n\n\t\t//获取某个路径下的文件列表\n\t\tpublic function getList($query = array(), $path = ''){\n\t\t\t$query \t\t\t= \tarray_merge(array('bucket'=>$this->bucket), $query);\n\t\t\t$url \t\t\t= \t\"{$this->QINIU_RSF_HOST}/list?\".http_build_query($query);\n\t\t\t$accessToken \t= \t$this->accessToken($url);\n\t\t\t$response \t\t= \t$this->request($url, 'POST', array('Authorization'=>\"QBox $accessToken\"));\n\t\t\treturn $response;\n\t\t}\n\n\t\t//获取某个文件的信息\n\t\tpublic function info($key){\n\t\t\t$key \t\t\t= \ttrim($key);\n\t\t\t$url \t\t\t= \t\"{$this->QINIU_RS_HOST}/stat/\" . self::Qiniu_Encode(\"{$this->bucket}:{$key}\");\n\t\t\t$accessToken \t= \t$this->accessToken($url);\n\t\t\t$response \t\t= \t$this->request($url, 'POST', array(\n\t\t\t\t'Authorization' \t=>\t\"QBox $accessToken\",\n\t\t\t));\n\t\t\treturn $response;\n\t\t}\n\n\t\t//获取文件下载资源链接\n\t\tpublic function downLink($key){\n\t\t\t$key = urlencode($key);\n\t\t\t$key = self::Qiniu_escapeQuotes($key);\n\t\t\t$url = \"http://{$this->domain}/{$key}\";\n\t\t\treturn $url;\n\t\t}\n\n\t\t//重命名单个文件\n\t\tpublic function rename($file, $new_file){\n\t\t\t$key = trim($file);\n\t\t\t$url = \"{$this->QINIU_RS_HOST}/move/\" . self::Qiniu_Encode(\"{$this->bucket}:{$key}\") .'/'. self::Qiniu_Encode(\"{$this->bucket}:{$new_file}\");\n\t\t\ttrace($url);\n\t\t\t$accessToken = $this->accessToken($url);\n\t\t\t$response = $this->request($url, 'POST', array('Authorization'=>\"QBox $accessToken\"));\n\t\t\treturn $response;\n\t\t}\n\n\t\t//删除单个文件\n\t\tpublic function del($file){\n\t\t\t$key = trim($file);\n\t\t\t$url = \"{$this->QINIU_RS_HOST}/delete/\" . self::Qiniu_Encode(\"{$this->bucket}:{$key}\");\n\t\t\t$accessToken = $this->accessToken($url);\n\t\t\t$response = $this->request($url, 'POST', array('Authorization'=>\"QBox $accessToken\"));\n\t\t\treturn $response;\n\t\t}\n\n\t\t//批量删除文件\n\t\tpublic function delBatch($files){\n\t\t\t$url = $this->QINIU_RS_HOST . '/batch';\n\t\t\t$ops = array();\n\t\t\tforeach ($files as $file) {\n\t\t\t\t$ops[] = \"/delete/\". self::Qiniu_Encode(\"{$this->bucket}:{$file}\");\n\t\t\t}\n\t\t\t$params = 'op=' . implode('&op=', $ops);\n\t\t\t$url .= '?'.$params;\n\t\t\ttrace($url);\n\t\t\t$accessToken = $this->accessToken($url);\n\t\t\t$response = $this->request($url, 'POST', array('Authorization'=>\"QBox $accessToken\"));\n\t\t\treturn $response;\n\t\t}\n\n\t\tstatic function Qiniu_Encode($str) {// URLSafeBase64Encode\n\t\t\t$find = array('+', '/');\n\t\t\t$replace = array('-', '_');\n\t\t\treturn str_replace($find, $replace, base64_encode($str));\n\t\t}\n\n\t\tstatic function Qiniu_escapeQuotes($str){\n\t\t\t$find = array(\"\\\\\", \"\\\"\");\n\t\t\t$replace = array(\"\\\\\\\\\", \"\\\\\\\"\");\n\t\t\treturn str_replace($find, $replace, $str);\n\t\t}\n\n\t    /**\n\t     * 请求云服务器\n\t     * @param  string   $path    请求的PATH\n\t     * @param  string   $method  请求方法\n\t     * @param  array    $headers 请求header\n\t     * @param  resource $body    上传文件资源\n\t     * @return boolean\n\t     */\n\t    private function request($path, $method, $headers = null, $body = null){\n\t        $ch  = curl_init($path);\n\n\t        $_headers = array('Expect:');\n\t        if (!is_null($headers) && is_array($headers)){\n\t            foreach($headers as $k => $v) {\n\t                array_push($_headers, \"{$k}: {$v}\");\n\t            }\n\t        }\n\n\t        $length = 0;\n\t\t\t$date   = gmdate('D, d M Y H:i:s \\G\\M\\T');\n\n\t        if (!is_null($body)) {\n\t            if(is_resource($body)){\n\t                fseek($body, 0, SEEK_END);\n\t                $length = ftell($body);\n\t                fseek($body, 0);\n\n\t                array_push($_headers, \"Content-Length: {$length}\");\n\t                curl_setopt($ch, CURLOPT_INFILE, $body);\n\t                curl_setopt($ch, CURLOPT_INFILESIZE, $length);\n\t            } else {\n\t                $length = @strlen($body);\n\t                array_push($_headers, \"Content-Length: {$length}\");\n\t                curl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n\t            }\n\t        } else {\n\t            array_push($_headers, \"Content-Length: {$length}\");\n\t        }\n\n\t        // array_push($_headers, 'Authorization: ' . $this->sign($method, $uri, $date, $length));\n\t        array_push($_headers, \"Date: {$date}\");\n\n\t        curl_setopt($ch, CURLOPT_HTTPHEADER, $_headers);\n\t        curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);\n\t        curl_setopt($ch, CURLOPT_HEADER, 1);\n\t        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n\t        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);\n\t\t\tcurl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);\n\n\t        if ($method == 'PUT' || $method == 'POST') {\n\t\t\t\tcurl_setopt($ch, CURLOPT_POST, 1);\n\t        } else {\n\t\t\t\tcurl_setopt($ch, CURLOPT_POST, 0);\n\t        }\n\n\t        if ($method == 'HEAD') {\n\t            curl_setopt($ch, CURLOPT_NOBODY, true);\n\t        }\n\n\t        $response = curl_exec($ch);\n\t        $status   = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n\t        curl_close($ch);\n\t        list($header, $body) = explode(\"\\r\\n\\r\\n\", $response, 2);\n\t        if ($status == 200) {\n\t            if ($method == 'GET') {\n\t                return $body;\n\t            } else {\n\t                return $this->response($response);\n\t            }\n\t        } else {\n\t            $this->error($header , $body);\n\t            return false;\n\t        }\n\t    }\n\n        /**\n\t     * 获取响应数据\n\t     * @param  string $text 响应头字符串\n\t     * @return array        响应数据列表\n\t     */\n\t    private function response($text){\n\t        $headers = explode(PHP_EOL, $text);\n\t        $items = array();\n\t        foreach($headers as $header) {\n\t            $header = trim($header);\n\t            if(strpos($header, '{') !== False){\n\t                $items = json_decode($header, 1);\n\t                break;\n\t            }\n\t        }\n\t        return $items;\n\t    }\n\n        /**\n\t     * 获取请求错误信息\n\t     * @param  string $header 请求返回头信息\n\t     */\n\t\tprivate function error($header, $body) {\n\t        list($status, $stash) = explode(\"\\r\\n\", $header, 2);\n\t        list($v, $code, $message) = explode(\" \", $status, 3);\n\t        $message = is_null($message) ? 'File Not Found' : \"[{$status}]:{$message}]\";\n\t        $this->error = $message;\n\t        $this->errorStr = json_decode($body ,1);\n\t        $this->errorStr = $this->errorStr['error'];\n\t    }\n\t}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Upload/Driver/Qiniu.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: yangweijie <yangweijiester@gmail.com> <http://www.code-tech.diandian.com>\n// +----------------------------------------------------------------------\n\nnamespace Think\\Upload\\Driver;\nuse Think\\Upload\\Driver\\Qiniu\\QiniuStorage;\n\nclass Qiniu{\n    /**\n     * 上传文件根目录\n     * @var string\n     */\n    private $rootPath;\n\n    /**\n     * 上传错误信息\n     * @var string\n     */\n    private $error = '';\n\n    private $config = array(\n        'secretKey'      => '', //七牛服务器\n        'accessKey'      => '', //七牛用户\n        'domain'         => '', //七牛密码\n        'bucket'         => '', //空间名称\n        'timeout'        => 300, //超时时间\n    );\n\n    /**\n     * 构造函数，用于设置上传根路径\n     * @param array  $config FTP配置\n     */\n    public function __construct($config){\n        $this->config = array_merge($this->config, $config);\n        /* 设置根目录 */\n        $this->qiniu = new QiniuStorage($config);\n    }\n\n    /**\n     * 检测上传根目录(七牛上传时支持自动创建目录，直接返回)\n     * @param string $rootpath   根目录\n     * @return boolean true-检测通过，false-检测失败\n     */\n    public function checkRootPath($rootpath){\n        $this->rootPath = trim($rootpath, './') . '/';\n        return true;\n    }\n\n    /**\n     * 检测上传目录(七牛上传时支持自动创建目录，直接返回)\n     * @param  string $savepath 上传目录\n     * @return boolean          检测结果，true-通过，false-失败\n     */\n    public function checkSavePath($savepath){\n        return true;\n    }\n\n    /**\n     * 创建文件夹 (七牛上传时支持自动创建目录，直接返回)\n     * @param  string $savepath 目录名称\n     * @return boolean          true-创建成功，false-创建失败\n     */\n    public function mkdir($savepath){\n        return true;\n    }\n\n    /**\n     * 保存指定文件\n     * @param  array   $file    保存的文件信息\n     * @param  boolean $replace 同名文件是否覆盖\n     * @return boolean          保存状态，true-成功，false-失败\n     */\n    public function save(&$file,$replace=true) {\n        $file['name'] = $file['savepath'] . $file['savename'];\n        $key = str_replace('/', '_', $file['name']);\n        $upfile = array(\n            'name'=>'file',\n            'fileName'=>$key,\n            'fileBody'=>file_get_contents($file['tmp_name'])\n        );\n        $config = array();\n        $result = $this->qiniu->upload($config, $upfile);\n        $url = $this->qiniu->downlink($key);\n        $file['url'] = $url;\n        return false ===$result ? false : true;\n    }\n\n    /**\n     * 获取最后一次上传错误信息\n     * @return string 错误信息\n     */\n    public function getError(){\n        return $this->qiniu->errorStr;\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Upload/Driver/Sae.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: luofei614<weibo.com/luofei614>\n// +----------------------------------------------------------------------\n\nnamespace Think\\Upload\\Driver;\nclass Sae{\n    /**\n     * Storage的Domain\n     * @var string\n     */\n    private $domain     =   '';\n\n    private $rootPath   =   '';\n\n    /**\n     * 本地上传错误信息\n     * @var string\n     */\n    private $error      =   ''; \n\n    /**\n     * 构造函数，设置storage的domain， 如果有传配置，则domain为配置项，如果没有传domain为第一个路径的目录名称。 \n     * @param mixed $config 上传配置     \n     */\n    public function __construct($config = null){\n        if(is_array($config) && !empty($config['domain'])){\n            $this->domain   =   strtolower($config['domain']);\n        }\n    }\n\n    /**\n     * 检测上传根目录\n     * @param string $rootpath   根目录\n     * @return boolean true-检测通过，false-检测失败\n     */\n    public function checkRootPath($rootpath){\n        $rootpath = trim($rootpath,'./');\n        if(!$this->domain){\n            $rootpath = explode('/', $rootpath);\n            $this->domain = strtolower(array_shift($rootpath));\n            $rootpath = implode('/', $rootpath);\n        }\n\n        $this->rootPath =  $rootpath;\n        $st =   new \\SaeStorage();\n        if(false===$st->getDomainCapacity($this->domain)){\n          $this->error  =   '您好像没有建立Storage的domain['.$this->domain.']';\n          return false;\n        }\n        return true;\n    }\n\n    /**\n     * 检测上传目录\n     * @param  string $savepath 上传目录\n     * @return boolean          检测结果，true-通过，false-失败\n     */\n    public function checkSavePath($savepath){\n        return true;\n    }\n\n    /**\n     * 保存指定文件\n     * @param  array   $file    保存的文件信息\n     * @param  boolean $replace 同名文件是否覆盖\n     * @return boolean          保存状态，true-成功，false-失败\n     */\n    public function save(&$file, $replace=true) {\n        $filename = ltrim($this->rootPath .'/'. $file['savepath'] . $file['savename'],'/');\n        $st =   new \\SaeStorage();\n        /* 不覆盖同名文件 */ \n        if (!$replace && $st->fileExists($this->domain,$filename)) {\n            $this->error = '存在同名文件' . $file['savename'];\n            return false;\n        }\n\n        /* 移动文件 */\n        if (!$st->upload($this->domain,$filename,$file['tmp_name'])) {\n            $this->error = '文件上传保存错误！['.$st->errno().']:'.$st->errmsg();\n            return false;\n        }else{\n            $file['url'] = $st->getUrl($this->domain, $filename);\n        }\n        return true;\n    }\n\n    public function mkdir(){\n        return true;\n    }\n\n    /**\n     * 获取最后一次上传错误信息\n     * @return string 错误信息\n     */\n    public function getError(){\n        return $this->error;\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Upload/Driver/Upyun.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>\n// +----------------------------------------------------------------------\n\nnamespace Think\\Upload\\Driver;\nclass Upyun{\n    /**\n     * 上传文件根目录\n     * @var string\n     */\n    private $rootPath;\n\n    /**\n     * 上传错误信息\n     * @var string\n     */\n    private $error = '';\n\n    private $config = array(\n        'host'     => '', //又拍云服务器\n        'username' => '', //又拍云用户\n        'password' => '', //又拍云密码\n        'bucket'   => '', //空间名称\n        'timeout'  => 90, //超时时间\n    );\n\n    /**\n     * 构造函数，用于设置上传根路径\n     * @param array  $config FTP配置\n     */\n    public function __construct($config){\n        /* 默认FTP配置 */\n        $this->config = array_merge($this->config, $config);\n        $this->config['password'] = md5($this->config['password']);\n    }\n\n    /**\n     * 检测上传根目录(又拍云上传时支持自动创建目录，直接返回)\n     * @param string $rootpath   根目录\n     * @return boolean true-检测通过，false-检测失败\n     */\n    public function checkRootPath($rootpath){\n        /* 设置根目录 */\n        $this->rootPath = trim($rootpath, './') . '/';\n        return true;\n    }\n\n    /**\n     * 检测上传目录(又拍云上传时支持自动创建目录，直接返回)\n     * @param  string $savepath 上传目录\n     * @return boolean          检测结果，true-通过，false-失败\n     */\n    public function checkSavePath($savepath){\n        return true;\n    }\n\n    /**\n     * 创建文件夹 (又拍云上传时支持自动创建目录，直接返回)\n     * @param  string $savepath 目录名称\n     * @return boolean          true-创建成功，false-创建失败\n     */\n    public function mkdir($savepath){\n        return true;\n    }\n\n    /**\n     * 保存指定文件\n     * @param  array   $file    保存的文件信息\n     * @param  boolean $replace 同名文件是否覆盖\n     * @return boolean          保存状态，true-成功，false-失败\n     */\n    public function save($file, $replace = true) {\n        $header['Content-Type'] = $file['type'];\n        $header['Content-MD5'] \t= $file['md5'];\n        $header['Mkdir'] = 'true';\n        $resource = fopen($file['tmp_name'], 'r');\n\n        $save = $this->rootPath . $file['savepath'] . $file['savename'];\n        $data = $this->request($save, 'PUT', $header, $resource);\n        return false === $data ? false : true;\n    }\n\n    /**\n     * 获取最后一次上传错误信息\n     * @return string 错误信息\n     */\n    public function getError(){\n        return $this->error;\n    }\n\n    /**\n     * 请求又拍云服务器\n     * @param  string   $path    请求的PATH\n     * @param  string   $method  请求方法\n     * @param  array    $headers 请求header\n     * @param  resource $body    上传文件资源\n     * @return boolean\n     */\n    private function request($path, $method, $headers = null, $body = null){\n        $uri = \"/{$this->config['bucket']}/{$path}\";\n        $ch  = curl_init($this->config['host'] . $uri);\n\n        $_headers = array('Expect:');\n        if (!is_null($headers) && is_array($headers)){\n            foreach($headers as $k => $v) {\n                array_push($_headers, \"{$k}: {$v}\");\n            }\n        }\n\n        $length = 0;\n        $date   = gmdate('D, d M Y H:i:s \\G\\M\\T');\n\n        if (!is_null($body)) {\n            if(is_resource($body)){\n                fseek($body, 0, SEEK_END);\n                $length = ftell($body);\n                fseek($body, 0);\n\n                array_push($_headers, \"Content-Length: {$length}\");\n                curl_setopt($ch, CURLOPT_INFILE, $body);\n                curl_setopt($ch, CURLOPT_INFILESIZE, $length);\n            } else {\n                $length = @strlen($body);\n                array_push($_headers, \"Content-Length: {$length}\");\n                curl_setopt($ch, CURLOPT_POSTFIELDS, $body);\n            }\n        } else {\n            array_push($_headers, \"Content-Length: {$length}\");\n        }\n\n        array_push($_headers, 'Authorization: ' . $this->sign($method, $uri, $date, $length));\n        array_push($_headers, \"Date: {$date}\");\n\n        curl_setopt($ch, CURLOPT_HTTPHEADER, $_headers);\n        curl_setopt($ch, CURLOPT_TIMEOUT, $this->config['timeout']);\n        curl_setopt($ch, CURLOPT_HEADER, 1);\n        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);\n        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);\n\n        if ($method == 'PUT' || $method == 'POST') {\n            curl_setopt($ch, CURLOPT_POST, 1);\n        } else {\n            curl_setopt($ch, CURLOPT_POST, 0);\n        }\n\n        if ($method == 'HEAD') {\n            curl_setopt($ch, CURLOPT_NOBODY, true);\n        }\n\n        $response = curl_exec($ch);\n        $status   = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n        curl_close($ch);\n        list($header, $body) = explode(\"\\r\\n\\r\\n\", $response, 2);\n\n        if ($status == 200) {\n            if ($method == 'GET') {\n                return $body;\n            } else {\n                $data = $this->response($header);\n                return count($data) > 0 ? $data : true;\n            }\n        } else {\n            $this->error($header);\n            return false;\n        }\n    }\n\n    /**\n     * 获取响应数据\n     * @param  string $text 响应头字符串\n     * @return array        响应数据列表\n     */\n    private function response($text){\n        $headers = explode(\"\\r\\n\", $text);\n        $items = array();\n        foreach($headers as $header) {\n            $header = trim($header);\n            if(strpos($header, 'x-upyun') !== False){\n                list($k, $v) = explode(':', $header);\n                $items[trim($k)] = in_array(substr($k,8,5), array('width','heigh','frame')) ? intval($v) : trim($v);\n            }\n        }\n        return $items;\n    }\n\n    /**\n     * 生成请求签名\n     * @param  string  $method 请求方法\n     * @param  string  $uri    请求URI\n     * @param  string  $date   请求时间\n     * @param  integer $length 请求内容大小\n     * @return string          请求签名\n     */\n    private function sign($method, $uri, $date, $length){\n        $sign = \"{$method}&{$uri}&{$date}&{$length}&{$this->config['password']}\";\n        return 'UpYun ' . $this->config['username'] . ':' . md5($sign);\n    }\n\n    /**\n     * 获取请求错误信息\n     * @param  string $header 请求返回头信息\n     */\n    private function error($header) {\n        list($status, $stash) = explode(\"\\r\\n\", $header, 2);\n        list($v, $code, $message) = explode(\" \", $status, 3);\n        $message = is_null($message) ? 'File Not Found' : \"[{$status}]:{$message}\";\n        $this->error = $message;\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Upload.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>\n// +----------------------------------------------------------------------\nnamespace Think;\nclass Upload {\n    /**\n     * 默认上传配置\n     * @var array\n     */\n    private $config = array(\n        'mimes'         =>  array(), //允许上传的文件MiMe类型\n        'maxSize'       =>  0, //上传的文件大小限制 (0-不做限制)\n        'exts'          =>  array(), //允许上传的文件后缀\n        'autoSub'       =>  true, //自动子目录保存文件\n        'subName'       =>  array('date', 'Y-m-d'), //子目录创建方式，[0]-函数名，[1]-参数，多个参数使用数组\n        'rootPath'      =>  './Uploads/', //保存根路径\n        'savePath'      =>  '', //保存路径\n        'saveName'      =>  array('uniqid', ''), //上传文件命名规则，[0]-函数名，[1]-参数，多个参数使用数组\n        'saveExt'       =>  '', //文件保存后缀，空则使用原后缀\n        'replace'       =>  false, //存在同名是否覆盖\n        'hash'          =>  true, //是否生成hash编码\n        'callback'      =>  false, //检测文件是否存在回调，如果存在返回文件信息数组\n        'driver'        =>  '', // 文件上传驱动\n        'driverConfig'  =>  array(), // 上传驱动配置\n    );\n\n    /**\n     * 上传错误信息\n     * @var string\n     */\n    private $error = ''; //上传错误信息\n\n    /**\n     * 上传驱动实例\n     * @var Object\n     */\n    private $uploader;\n\n    /**\n     * 构造方法，用于构造上传实例\n     * @param array  $config 配置\n     * @param string $driver 要使用的上传驱动 LOCAL-本地上传驱动，FTP-FTP上传驱动\n     */\n    public function __construct($config = array(), $driver = '', $driverConfig = null){\n        /* 获取配置 */\n        $this->config   =   array_merge($this->config, $config);\n\n        /* 设置上传驱动 */\n        $this->setDriver($driver, $driverConfig);\n\n        /* 调整配置，把字符串配置参数转换为数组 */\n        if(!empty($this->config['mimes'])){\n            if(is_string($this->mimes)) {\n                $this->config['mimes'] = explode(',', $this->mimes);\n            }\n            $this->config['mimes'] = array_map('strtolower', $this->mimes);\n        }\n        if(!empty($this->config['exts'])){\n            if (is_string($this->exts)){\n                $this->config['exts'] = explode(',', $this->exts);\n            }\n            $this->config['exts'] = array_map('strtolower', $this->exts);\n        }\n    }\n\n    /**\n     * 使用 $this->name 获取配置\n     * @param  string $name 配置名称\n     * @return multitype    配置值\n     */\n    public function __get($name) {\n        return $this->config[$name];\n    }\n\n    public function __set($name,$value){\n        if(isset($this->config[$name])) {\n            $this->config[$name] = $value;\n            if($name == 'driverConfig'){\n                //改变驱动配置后重置上传驱动\n                //注意：必须选改变驱动然后再改变驱动配置\n                $this->setDriver(); \n            }\n        }\n    }\n\n    public function __isset($name){\n        return isset($this->config[$name]);\n    }\n\n    /**\n     * 获取最后一次上传错误信息\n     * @return string 错误信息\n     */\n    public function getError(){\n        return $this->error;\n    }\n\n    /**\n     * 上传单个文件\n     * @param  array  $file 文件数组\n     * @return array        上传成功后的文件信息\n     */\n    public function uploadOne($file){\n        $info = $this->upload(array($file));\n        return $info ? $info[0] : $info;\n    }\n\n    /**\n     * 上传文件\n     * @param 文件信息数组 $files ，通常是 $_FILES数组\n     */\n    public function upload($files='') {\n        if('' === $files){\n            $files  =   $_FILES;\n        }\n        if(empty($files)){\n            $this->error = '没有上传的文件！';\n            return false;\n        }\n\n        /* 检测上传根目录 */\n        if(!$this->uploader->checkRootPath($this->rootPath)){\n            $this->error = $this->uploader->getError();\n            return false;\n        }\n\n        /* 检查上传目录 */\n        if(!$this->uploader->checkSavePath($this->savePath)){\n            $this->error = $this->uploader->getError();\n            return false;\n        }\n\n        /* 逐个检测并上传文件 */\n        $info    =  array();\n        if(function_exists('finfo_open')){\n            $finfo   =  finfo_open ( FILEINFO_MIME_TYPE );\n        }\n        // 对上传文件数组信息处理\n        $files   =  $this->dealFiles($files);    \n        foreach ($files as $key => $file) {\n            $file['name']  = strip_tags($file['name']);\n            if(!isset($file['key']))   $file['key']    =   $key;\n            /* 通过扩展获取文件类型，可解决FLASH上传$FILES数组返回文件类型错误的问题 */\n            if(isset($finfo)){\n                $file['type']   =   finfo_file ( $finfo ,  $file['tmp_name'] );\n            }\n\n            /* 获取上传文件后缀，允许上传无后缀文件 */\n            $file['ext']    =   pathinfo($file['name'], PATHINFO_EXTENSION);\n\n            /* 文件上传检测 */\n            if (!$this->check($file)){\n                continue;\n            }\n\n            /* 获取文件hash */\n            if($this->hash){\n                $file['md5']  = md5_file($file['tmp_name']);\n                $file['sha1'] = sha1_file($file['tmp_name']);\n            }\n\n            /* 调用回调函数检测文件是否存在 */\n            $data = call_user_func($this->callback, $file);\n            if( $this->callback && $data ){\n                if ( file_exists('.'.$data['path'])  ) {\n                    $info[$key] = $data;\n                    continue;\n                }elseif($this->removeTrash){\n                    call_user_func($this->removeTrash,$data);//删除垃圾据\n                }\n            }\n\n            /* 生成保存文件名 */\n            $savename = $this->getSaveName($file);\n            if(false == $savename){\n                continue;\n            } else {\n                $file['savename'] = $savename;\n            }\n\n            /* 检测并创建子目录 */\n            $subpath = $this->getSubPath($file['name']);\n            if(false === $subpath){\n                continue;\n            } else {\n                $file['savepath'] = $this->savePath . $subpath;\n            }\n\n            /* 对图像文件进行严格检测 */\n            $ext = strtolower($file['ext']);\n            if(in_array($ext, array('gif','jpg','jpeg','bmp','png','swf'))) {\n                $imginfo = getimagesize($file['tmp_name']);\n                if(empty($imginfo) || ($ext == 'gif' && empty($imginfo['bits']))){\n                    $this->error = '非法图像文件！';\n                    continue;\n                }\n            }\n\n            /* 保存文件 并记录保存成功的文件 */\n            if ($this->uploader->save($file,$this->replace)) {\n                unset($file['error'], $file['tmp_name']);\n                $info[$key] = $file;\n            } else {\n                $this->error = $this->uploader->getError();\n            }\n        }\n        if(isset($finfo)){\n            finfo_close($finfo);\n        }\n        return empty($info) ? false : $info;\n    }\n\n    /**\n     * 转换上传文件数组变量为正确的方式\n     * @access private\n     * @param array $files  上传的文件变量\n     * @return array\n     */\n    private function dealFiles($files) {\n        $fileArray  = array();\n        $n          = 0;\n        foreach ($files as $key=>$file){\n            if(is_array($file['name'])) {\n                $keys       =   array_keys($file);\n                $count      =   count($file['name']);\n                for ($i=0; $i<$count; $i++) {\n                    $fileArray[$n]['key'] = $key;\n                    foreach ($keys as $_key){\n                        $fileArray[$n][$_key] = $file[$_key][$i];\n                    }\n                    $n++;\n                }\n            }else{\n               $fileArray = $files;\n               break;\n            }\n        }\n       return $fileArray;\n    }\n\n    /**\n     * 设置上传驱动\n     * @param string $driver 驱动名称\n     * @param array $config 驱动配置     \n     */\n    private function setDriver($driver = null, $config = null){\n        $driver = $driver ? : ($this->driver       ? : C('FILE_UPLOAD_TYPE'));\n        $config = $config ? : ($this->driverConfig ? : C('UPLOAD_TYPE_CONFIG'));\n        $class = strpos($driver,'\\\\')? $driver : 'Think\\\\Upload\\\\Driver\\\\'.ucfirst(strtolower($driver));\n        $this->uploader = new $class($config);\n        if(!$this->uploader){\n            E(\"不存在上传驱动：{$name}\");\n        }\n    }\n\n    /**\n     * 检查上传的文件\n     * @param array $file 文件信息\n     */\n    private function check($file) {\n        /* 文件上传失败，捕获错误代码 */\n        if ($file['error']) {\n            $this->error($file['error']);\n            return false;\n        }\n\n        /* 无效上传 */\n        if (empty($file['name'])){\n            $this->error = '未知上传错误！';\n        }\n\n        /* 检查是否合法上传 */\n        if (!is_uploaded_file($file['tmp_name'])) {\n            $this->error = '非法上传文件！';\n            return false;\n        }\n\n        /* 检查文件大小 */\n        if (!$this->checkSize($file['size'])) {\n            $this->error = '上传文件大小不符！';\n            return false;\n        }\n\n        /* 检查文件Mime类型 */\n        //TODO:FLASH上传的文件获取到的mime类型都为application/octet-stream\n        if (!$this->checkMime($file['type'])) {\n            $this->error = '上传文件MIME类型不允许！';\n            return false;\n        }\n\n        /* 检查文件后缀 */\n        if (!$this->checkExt($file['ext'])) {\n            $this->error = '上传文件后缀不允许';\n            return false;\n        }\n\n        /* 通过检测 */\n        return true;\n    }\n\n\n    /**\n     * 获取错误代码信息\n     * @param string $errorNo  错误号\n     */\n    private function error($errorNo) {\n        switch ($errorNo) {\n            case 1:\n                $this->error = '上传的文件超过了 php.ini 中 upload_max_filesize 选项限制的值！';\n                break;\n            case 2:\n                $this->error = '上传文件的大小超过了 HTML 表单中 MAX_FILE_SIZE 选项指定的值！';\n                break;\n            case 3:\n                $this->error = '文件只有部分被上传！';\n                break;\n            case 4:\n                $this->error = '没有文件被上传！';\n                break;\n            case 6:\n                $this->error = '找不到临时文件夹！';\n                break;\n            case 7:\n                $this->error = '文件写入失败！';\n                break;\n            default:\n                $this->error = '未知上传错误！';\n        }\n    }\n\n    /**\n     * 检查文件大小是否合法\n     * @param integer $size 数据\n     */\n    private function checkSize($size) {\n        return !($size > $this->maxSize) || (0 == $this->maxSize);\n    }\n\n    /**\n     * 检查上传的文件MIME类型是否合法\n     * @param string $mime 数据\n     */\n    private function checkMime($mime) {\n        return empty($this->config['mimes']) ? true : in_array(strtolower($mime), $this->mimes);\n    }\n\n    /**\n     * 检查上传的文件后缀是否合法\n     * @param string $ext 后缀\n     */\n    private function checkExt($ext) {\n        return empty($this->config['exts']) ? true : in_array(strtolower($ext), $this->exts);\n    }\n\n    /**\n     * 根据上传文件命名规则取得保存文件名\n     * @param string $file 文件信息\n     */\n    private function getSaveName($file) {\n        $rule = $this->saveName;\n        if (empty($rule)) { //保持文件名不变\n            /* 解决pathinfo中文文件名BUG */\n            $filename = substr(pathinfo(\"_{$file['name']}\", PATHINFO_FILENAME), 1);\n            $savename = $filename;\n        } else {\n            $savename = $this->getName($rule, $file['name']);\n            if(empty($savename)){\n                $this->error = '文件命名规则错误！';\n                return false;\n            }\n        }\n\n        /* 文件保存后缀，支持强制更改文件后缀 */\n        $ext = empty($this->config['saveExt']) ? $file['ext'] : $this->saveExt;\n\n        return $savename . '.' . $ext;\n    }\n\n    /**\n     * 获取子目录的名称\n     * @param array $file  上传的文件信息\n     */\n    private function getSubPath($filename) {\n        $subpath = '';\n        $rule    = $this->subName;\n        if ($this->autoSub && !empty($rule)) {\n            $subpath = $this->getName($rule, $filename) . '/';\n\n            if(!empty($subpath) && !$this->uploader->mkdir($this->savePath . $subpath)){\n                $this->error = $this->uploader->getError();\n                return false;\n            }\n        }\n        return $subpath;\n    }\n\n    /**\n     * 根据指定的规则获取文件或目录名称\n     * @param  array  $rule     规则\n     * @param  string $filename 原文件名\n     * @return string           文件或目录名称\n     */\n    private function getName($rule, $filename){\n        $name = '';\n        if(is_array($rule)){ //数组规则\n            $func     = $rule[0];\n            $param    = (array)$rule[1];\n            foreach ($param as &$value) {\n               $value = str_replace('__FILE__', $filename, $value);\n            }\n            $name = call_user_func_array($func, $param);\n        } elseif (is_string($rule)){ //字符串规则\n            if(function_exists($rule)){\n                $name = call_user_func($rule);\n            } else {\n                $name = $rule;\n            }\n        }\n        return $name;\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/Verify.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>\n// +----------------------------------------------------------------------\n\nnamespace Think;\n\nclass Verify {\n    protected $config =\tarray(\n        'seKey'     =>  'ThinkPHP.CN',   // 验证码加密密钥\n        'codeSet'   =>  '2345678abcdefhijkmnpqrstuvwxyzABCDEFGHJKLMNPQRTUVWXY',             // 验证码字符集合\n        'expire'    =>  1800,            // 验证码过期时间（s）\n        'useZh'     =>  false,           // 使用中文验证码 \n        'zhSet'     =>  '们以我到他会作时要动国产的一是工就年阶义发成部民可出能方进在了不和有大这主中人上为来分生对于学下级地个用同行面说种过命度革而多子后自社加小机也经力线本电高量长党得实家定深法表着水理化争现所二起政三好十战无农使性前等反体合斗路图把结第里正新开论之物从当两些还天资事队批点育重其思与间内去因件日利相由压员气业代全组数果期导平各基或月毛然如应形想制心样干都向变关问比展那它最及外没看治提五解系林者米群头意只明四道马认次文通但条较克又公孔领军流入接席位情运器并飞原油放立题质指建区验活众很教决特此常石强极土少已根共直团统式转别造切九你取西持总料连任志观调七么山程百报更见必真保热委手改管处己将修支识病象几先老光专什六型具示复安带每东增则完风回南广劳轮科北打积车计给节做务被整联步类集号列温装即毫知轴研单色坚据速防史拉世设达尔场织历花受求传口断况采精金界品判参层止边清至万确究书术状厂须离再目海交权且儿青才证低越际八试规斯近注办布门铁需走议县兵固除般引齿千胜细影济白格效置推空配刀叶率述今选养德话查差半敌始片施响收华觉备名红续均药标记难存测士身紧液派准斤角降维板许破述技消底床田势端感往神便贺村构照容非搞亚磨族火段算适讲按值美态黄易彪服早班麦削信排台声该击素张密害侯草何树肥继右属市严径螺检左页抗苏显苦英快称坏移约巴材省黑武培著河帝仅针怎植京助升王眼她抓含苗副杂普谈围食射源例致酸旧却充足短划剂宣环落首尺波承粉践府鱼随考刻靠够满夫失包住促枝局菌杆周护岩师举曲春元超负砂封换太模贫减阳扬江析亩木言球朝医校古呢稻宋听唯输滑站另卫字鼓刚写刘微略范供阿块某功套友限项余倒卷创律雨让骨远帮初皮播优占死毒圈伟季训控激找叫云互跟裂粮粒母练塞钢顶策双留误础吸阻故寸盾晚丝女散焊功株亲院冷彻弹错散商视艺灭版烈零室轻血倍缺厘泵察绝富城冲喷壤简否柱李望盘磁雄似困巩益洲脱投送奴侧润盖挥距触星松送获兴独官混纪依未突架宽冬章湿偏纹吃执阀矿寨责熟稳夺硬价努翻奇甲预职评读背协损棉侵灰虽矛厚罗泥辟告卵箱掌氧恩爱停曾溶营终纲孟钱待尽俄缩沙退陈讨奋械载胞幼哪剥迫旋征槽倒握担仍呀鲜吧卡粗介钻逐弱脚怕盐末阴丰雾冠丙街莱贝辐肠付吉渗瑞惊顿挤秒悬姆烂森糖圣凹陶词迟蚕亿矩康遵牧遭幅园腔订香肉弟屋敏恢忘编印蜂急拿扩伤飞露核缘游振操央伍域甚迅辉异序免纸夜乡久隶缸夹念兰映沟乙吗儒杀汽磷艰晶插埃燃欢铁补咱芽永瓦倾阵碳演威附牙芽永瓦斜灌欧献顺猪洋腐请透司危括脉宜笑若尾束壮暴企菜穗楚汉愈绿拖牛份染既秋遍锻玉夏疗尖殖井费州访吹荣铜沿替滚客召旱悟刺脑措贯藏敢令隙炉壳硫煤迎铸粘探临薄旬善福纵择礼愿伏残雷延烟句纯渐耕跑泽慢栽鲁赤繁境潮横掉锥希池败船假亮谓托伙哲怀割摆贡呈劲财仪沉炼麻罪祖息车穿货销齐鼠抽画饲龙库守筑房歌寒喜哥洗蚀废纳腹乎录镜妇恶脂庄擦险赞钟摇典柄辩竹谷卖乱虚桥奥伯赶垂途额壁网截野遗静谋弄挂课镇妄盛耐援扎虑键归符庆聚绕摩忙舞遇索顾胶羊湖钉仁音迹碎伸灯避泛亡答勇频皇柳哈揭甘诺概宪浓岛袭谁洪谢炮浇斑讯懂灵蛋闭孩释乳巨徒私银伊景坦累匀霉杜乐勒隔弯绩招绍胡呼痛峰零柴簧午跳居尚丁秦稍追梁折耗碱殊岗挖氏刃剧堆赫荷胸衡勤膜篇登驻案刊秧缓凸役剪川雪链渔啦脸户洛孢勃盟买杨宗焦赛旗滤硅炭股坐蒸凝竟陷枪黎救冒暗洞犯筒您宋弧爆谬涂味津臂障褐陆啊健尊豆拔莫抵桑坡缝警挑污冰柬嘴啥饭塑寄赵喊垫丹渡耳刨虎笔稀昆浪萨茶滴浅拥穴覆伦娘吨浸袖珠雌妈紫戏塔锤震岁貌洁剖牢锋疑霸闪埔猛诉刷狠忽灾闹乔唐漏闻沈熔氯荒茎男凡抢像浆旁玻亦忠唱蒙予纷捕锁尤乘乌智淡允叛畜俘摸锈扫毕璃宝芯爷鉴秘净蒋钙肩腾枯抛轨堂拌爸循诱祝励肯酒绳穷塘燥泡袋朗喂铝软渠颗惯贸粪综墙趋彼届墨碍启逆卸航衣孙龄岭骗休借',              // 中文验证码字符串\n        'useImgBg'  =>  false,           // 使用背景图片 \n        'fontSize'  =>  25,              // 验证码字体大小(px)\n        'useCurve'  =>  true,            // 是否画混淆曲线\n        'useNoise'  =>  true,            // 是否添加杂点\t\n        'imageH'    =>  0,               // 验证码图片高度\n        'imageW'    =>  0,               // 验证码图片宽度\n        'length'    =>  5,               // 验证码位数\n        'fontttf'   =>  '',              // 验证码字体，不设置随机获取\n        'bg'        =>  array(243, 251, 254),  // 背景颜色\n        'reset'     =>  true,           // 验证成功后是否重置\n        );\n\n    private $_image   = NULL;     // 验证码图片实例\n    private $_color   = NULL;     // 验证码字体颜色\n\n    /**\n     * 架构方法 设置参数\n     * @access public     \n     * @param  array $config 配置参数\n     */    \n    public function __construct($config=array()){\n        $this->config   =   array_merge($this->config, $config);\n    }\n\n    /**\n     * 使用 $this->name 获取配置\n     * @access public     \n     * @param  string $name 配置名称\n     * @return multitype    配置值\n     */\n    public function __get($name) {\n        return $this->config[$name];\n    }\n\n    /**\n     * 设置验证码配置\n     * @access public     \n     * @param  string $name 配置名称\n     * @param  string $value 配置值     \n     * @return void\n     */\n    public function __set($name,$value){\n        if(isset($this->config[$name])) {\n            $this->config[$name]    =   $value;\n        }\n    }\n\n    /**\n     * 检查配置\n     * @access public     \n     * @param  string $name 配置名称\n     * @return bool\n     */\n    public function __isset($name){\n        return isset($this->config[$name]);\n    }\n\n    /**\n     * 验证验证码是否正确\n     * @access public\n     * @param string $code 用户验证码\n     * @param string $id 验证码标识     \n     * @return bool 用户验证码是否正确\n     */\n    public function check($code, $id = '') {\n        $key = $this->authcode($this->seKey).$id;\n        // 验证码不能为空\n        $secode = session($key);\n        if(empty($code) || empty($secode)) {\n            return false;\n        }\n        // session 过期\n        if(NOW_TIME - $secode['verify_time'] > $this->expire) {\n            session($key, null);\n            return false;\n        }\n\n        if($this->authcode(strtoupper($code)) == $secode['verify_code']) {\n            $this->reset && session($key, null);\n            return true;\n        }\n\n        return false;\n    }\n\n    /**\n     * 输出验证码并把验证码的值保存的session中\n     * 验证码保存到session的格式为： array('verify_code' => '验证码值', 'verify_time' => '验证码创建时间');\n     * @access public     \n     * @param string $id 要生成验证码的标识   \n     * @return void\n     */\n    public function entry($id = '') {\n        // 图片宽(px)\n        $this->imageW || $this->imageW = $this->length*$this->fontSize*1.5 + $this->length*$this->fontSize/2; \n        // 图片高(px)\n        $this->imageH || $this->imageH = $this->fontSize * 2.5;\n        // 建立一幅 $this->imageW x $this->imageH 的图像\n        $this->_image = imagecreate($this->imageW, $this->imageH); \n        // 设置背景      \n        imagecolorallocate($this->_image, $this->bg[0], $this->bg[1], $this->bg[2]); \n\n        // 验证码字体随机颜色\n        $this->_color = imagecolorallocate($this->_image, mt_rand(1,150), mt_rand(1,150), mt_rand(1,150));\n        // 验证码使用随机字体\n        $ttfPath = dirname(__FILE__) . '/Verify/' . ($this->useZh ? 'zhttfs' : 'ttfs') . '/';\n\n        if(empty($this->fontttf)){\n            $dir = dir($ttfPath);\n            $ttfs = array();\t\t\n            while (false !== ($file = $dir->read())) {\n                if($file[0] != '.' && substr($file, -4) == '.ttf') {\n                    $ttfs[] = $file;\n                }\n            }\n            $dir->close();\n            $this->fontttf = $ttfs[array_rand($ttfs)];\n        } \n        $this->fontttf = $ttfPath . $this->fontttf;\n        \n        if($this->useImgBg) {\n            $this->_background();\n        }\n        \n        if ($this->useNoise) {\n            // 绘杂点\n            $this->_writeNoise();\n        } \n        if ($this->useCurve) {\n            // 绘干扰线\n            $this->_writeCurve();\n        }\n        \n        // 绘验证码\n        $code = array(); // 验证码\n        $codeNX = 0; // 验证码第N个字符的左边距\n        if($this->useZh){ // 中文验证码\n            for ($i = 0; $i<$this->length; $i++) {\n                $code[$i] = iconv_substr($this->zhSet,floor(mt_rand(0,mb_strlen($this->zhSet,'utf-8')-1)),1,'utf-8');\n                imagettftext($this->_image, $this->fontSize, mt_rand(-40, 40), $this->fontSize*($i+1)*1.5, $this->fontSize + mt_rand(10, 20), $this->_color, $this->fontttf, $code[$i]);\n            }\n        }else{\n            for ($i = 0; $i<$this->length; $i++) {\n                $code[$i] = $this->codeSet[mt_rand(0, strlen($this->codeSet)-1)];\n                $codeNX  += mt_rand($this->fontSize*1.2, $this->fontSize*1.6);\n                imagettftext($this->_image, $this->fontSize, mt_rand(-40, 40), $codeNX, $this->fontSize*1.6, $this->_color, $this->fontttf, $code[$i]);\n            }\n        }\n       \n        // 保存验证码\n        $key        =   $this->authcode($this->seKey);\n        $code       =   $this->authcode(strtoupper(implode('', $code)));\n        $secode     =   array();\n        $secode['verify_code'] = $code; // 把校验码保存到session\n        $secode['verify_time'] = NOW_TIME;  // 验证码创建时间\n        session($key.$id, $secode);\n                        \n        header('Cache-Control: private, max-age=0, no-store, no-cache, must-revalidate');\n        header('Cache-Control: post-check=0, pre-check=0', false);\t\t\n        header('Pragma: no-cache');\n        header(\"content-type: image/png\");\n\n        // 输出图像\n        imagepng($this->_image);\n        imagedestroy($this->_image);\n    }\n\n    /** \n     * 画一条由两条连在一起构成的随机正弦函数曲线作干扰线(你可以改成更帅的曲线函数) \n     *      \n     *      高中的数学公式咋都忘了涅，写出来\n     *\t\t正弦型函数解析式：y=Asin(ωx+φ)+b\n     *      各常数值对函数图像的影响：\n     *        A：决定峰值（即纵向拉伸压缩的倍数）\n     *        b：表示波形在Y轴的位置关系或纵向移动距离（上加下减）\n     *        φ：决定波形与X轴位置关系或横向移动距离（左加右减）\n     *        ω：决定周期（最小正周期T=2π/∣ω∣）\n     *\n     */\n    private function _writeCurve() {\n        $px = $py = 0;\n        \n        // 曲线前部分\n        $A = mt_rand(1, $this->imageH/2);                  // 振幅\n        $b = mt_rand(-$this->imageH/4, $this->imageH/4);   // Y轴方向偏移量\n        $f = mt_rand(-$this->imageH/4, $this->imageH/4);   // X轴方向偏移量\n        $T = mt_rand($this->imageH, $this->imageW*2);  // 周期\n        $w = (2* M_PI)/$T;\n                        \n        $px1 = 0;  // 曲线横坐标起始位置\n        $px2 = mt_rand($this->imageW/2, $this->imageW * 0.8);  // 曲线横坐标结束位置\n\n        for ($px=$px1; $px<=$px2; $px = $px + 1) {\n            if ($w!=0) {\n                $py = $A * sin($w*$px + $f)+ $b + $this->imageH/2;  // y = Asin(ωx+φ) + b\n                $i = (int) ($this->fontSize/5);\n                while ($i > 0) {\t\n                    imagesetpixel($this->_image, $px + $i , $py + $i, $this->_color);  // 这里(while)循环画像素点比imagettftext和imagestring用字体大小一次画出（不用这while循环）性能要好很多\t\t\t\t\n                    $i--;\n                }\n            }\n        }\n        \n        // 曲线后部分\n        $A = mt_rand(1, $this->imageH/2);                  // 振幅\t\t\n        $f = mt_rand(-$this->imageH/4, $this->imageH/4);   // X轴方向偏移量\n        $T = mt_rand($this->imageH, $this->imageW*2);  // 周期\n        $w = (2* M_PI)/$T;\t\t\n        $b = $py - $A * sin($w*$px + $f) - $this->imageH/2;\n        $px1 = $px2;\n        $px2 = $this->imageW;\n\n        for ($px=$px1; $px<=$px2; $px=$px+ 1) {\n            if ($w!=0) {\n                $py = $A * sin($w*$px + $f)+ $b + $this->imageH/2;  // y = Asin(ωx+φ) + b\n                $i = (int) ($this->fontSize/5);\n                while ($i > 0) {\t\t\t\n                    imagesetpixel($this->_image, $px + $i, $py + $i, $this->_color);\t\n                    $i--;\n                }\n            }\n        }\n    }\n\n    /**\n     * 画杂点\n     * 往图片上写不同颜色的字母或数字\n     */\n    private function _writeNoise() {\n        $codeSet = '2345678abcdefhijkmnpqrstuvwxyz';\n        for($i = 0; $i < 10; $i++){\n            //杂点颜色\n            $noiseColor = imagecolorallocate($this->_image, mt_rand(150,225), mt_rand(150,225), mt_rand(150,225));\n            for($j = 0; $j < 5; $j++) {\n                // 绘杂点\n                imagestring($this->_image, 5, mt_rand(-10, $this->imageW),  mt_rand(-10, $this->imageH), $codeSet[mt_rand(0, 29)], $noiseColor);\n            }\n        }\n    }\n\n    /**\n     * 绘制背景图片\n     * 注：如果验证码输出图片比较大，将占用比较多的系统资源\n     */\n    private function _background() {\n        $path = dirname(__FILE__).'/Verify/bgs/';\n        $dir = dir($path);\n\n        $bgs = array();\t\t\n        while (false !== ($file = $dir->read())) {\n            if($file[0] != '.' && substr($file, -4) == '.jpg') {\n                $bgs[] = $path . $file;\n            }\n        }\n        $dir->close();\n\n        $gb = $bgs[array_rand($bgs)];\n\n        list($width, $height) = @getimagesize($gb);\n        // Resample\n        $bgImage = @imagecreatefromjpeg($gb);\n        @imagecopyresampled($this->_image, $bgImage, 0, 0, 0, 0, $this->imageW, $this->imageH, $width, $height);\n        @imagedestroy($bgImage);\n    }\n\n    /* 加密验证码 */\n    private function authcode($str){\n        $key = substr(md5($this->seKey), 5, 8);\n        $str = substr(md5($str), 8, 10);\n        return md5($key . $str);\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Think/View.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * ThinkPHP 视图类\n */\nclass View {\n    /**\n     * 模板输出变量\n     * @var tVar\n     * @access protected\n     */ \n    protected $tVar     =   array();\n\n    /**\n     * 模板主题\n     * @var theme\n     * @access protected\n     */ \n    protected $theme    =   '';\n\n    /**\n     * 模板变量赋值\n     * @access public\n     * @param mixed $name\n     * @param mixed $value\n     */\n    public function assign($name,$value=''){\n        if(is_array($name)) {\n            $this->tVar   =  array_merge($this->tVar,$name);\n        }else {\n            $this->tVar[$name] = $value;\n        }\n    }\n\n    /**\n     * 取得模板变量的值\n     * @access public\n     * @param string $name\n     * @return mixed\n     */\n    public function get($name=''){\n        if('' === $name) {\n            return $this->tVar;\n        }\n        return isset($this->tVar[$name])?$this->tVar[$name]:false;\n    }\n\n    /**\n     * 加载模板和页面输出 可以返回输出内容\n     * @access public\n     * @param string $templateFile 模板文件名\n     * @param string $charset 模板输出字符集\n     * @param string $contentType 输出类型\n     * @param string $content 模板输出内容\n     * @param string $prefix 模板缓存前缀\n     * @return mixed\n     */\n    public function display($templateFile='',$charset='',$contentType='',$content='',$prefix='') {\n        G('viewStartTime');\n        // 视图开始标签\n        Hook::listen('view_begin',$templateFile);\n        // 解析并获取模板内容\n        $content = $this->fetch($templateFile,$content,$prefix);\n        // 输出模板内容\n        $this->render($content,$charset,$contentType);\n        // 视图结束标签\n        Hook::listen('view_end');\n    }\n\n    /**\n     * 输出内容文本可以包括Html\n     * @access private\n     * @param string $content 输出内容\n     * @param string $charset 模板输出字符集\n     * @param string $contentType 输出类型\n     * @return mixed\n     */\n    private function render($content,$charset='',$contentType=''){\n        if(empty($charset))  $charset = C('DEFAULT_CHARSET');\n        if(empty($contentType)) $contentType = C('TMPL_CONTENT_TYPE');\n        // 网页字符编码\n        header('Content-Type:'.$contentType.'; charset='.$charset);\n        header('Cache-control: '.C('HTTP_CACHE_CONTROL'));  // 页面缓存控制\n        header('X-Powered-By:ThinkPHP');\n        // 输出模板文件\n        echo $content;\n    }\n\n    /**\n     * 解析和获取模板内容 用于输出\n     * @access public\n     * @param string $templateFile 模板文件名\n     * @param string $content 模板输出内容\n     * @param string $prefix 模板缓存前缀\n     * @return string\n     */\n    public function fetch($templateFile='',$content='',$prefix='') {\n        if(empty($content)) {\n            $templateFile   =   $this->parseTemplate($templateFile);\n            // 模板文件不存在直接返回\n            if(!is_file($templateFile)) E(L('_TEMPLATE_NOT_EXIST_').':'.$templateFile);\n        }else{\n            defined('THEME_PATH') or    define('THEME_PATH', $this->getThemePath());\n        }\n        // 页面缓存\n        ob_start();\n        ob_implicit_flush(0);\n        if('php' == strtolower(C('TMPL_ENGINE_TYPE'))) { // 使用PHP原生模板\n            $_content   =   $content;\n            // 模板阵列变量分解成为独立变量\n            extract($this->tVar, EXTR_OVERWRITE);\n            // 直接载入PHP模板\n            empty($_content)?include $templateFile:eval('?>'.$_content);\n        }else{\n            // 视图解析标签\n            $params = array('var'=>$this->tVar,'file'=>$templateFile,'content'=>$content,'prefix'=>$prefix);\n            Hook::listen('view_parse',$params);\n        }\n        // 获取并清空缓存\n        $content = ob_get_clean();\n        // 内容过滤标签\n        Hook::listen('view_filter',$content);\n        // 输出模板文件\n        return $content;\n    }\n\n    /**\n     * 自动定位模板文件\n     * @access protected\n     * @param string $template 模板文件规则\n     * @return string\n     */\n    public function parseTemplate($template='') {\n        if(is_file($template)) {\n            return $template;\n        }\n        $depr       =   C('TMPL_FILE_DEPR');\n        $template   =   str_replace(':', $depr, $template);\n\n        // 获取当前模块\n        $module   =  MODULE_NAME;\n        if(strpos($template,'@')){ // 跨模块调用模版文件\n            list($module,$template)  =   explode('@',$template);\n        }\n        // 获取当前主题的模版路径\n        defined('THEME_PATH') or    define('THEME_PATH', $this->getThemePath($module));\n\n        // 分析模板文件规则\n        if('' == $template) {\n            // 如果模板文件名为空 按照默认规则定位\n            $template = CONTROLLER_NAME . $depr . ACTION_NAME;\n        }elseif(false === strpos($template, $depr)){\n            $template = CONTROLLER_NAME . $depr . $template;\n        }\n        $file   =   THEME_PATH.$template.C('TMPL_TEMPLATE_SUFFIX');\n        if(C('TMPL_LOAD_DEFAULTTHEME') && THEME_NAME != C('DEFAULT_THEME') && !is_file($file)){\n            // 找不到当前主题模板的时候定位默认主题中的模板\n            $file   =   dirname(THEME_PATH).'/'.C('DEFAULT_THEME').'/'.$template.C('TMPL_TEMPLATE_SUFFIX');\n        }\n        return $file;\n    }\n\n    /**\n     * 获取当前的模板路径\n     * @access protected\n     * @param  string $module 模块名\n     * @return string\n     */\n    protected function getThemePath($module=MODULE_NAME){\n        // 获取当前主题名称\n        $theme = $this->getTemplateTheme();\n        // 获取当前主题的模版路径\n        $tmplPath   =   C('VIEW_PATH'); // 模块设置独立的视图目录\n        if(!$tmplPath){ \n            // 定义TMPL_PATH 则改变全局的视图目录到模块之外\n            $tmplPath   =   defined('TMPL_PATH')? TMPL_PATH.$module.'/' : APP_PATH.$module.'/'.C('DEFAULT_V_LAYER').'/';\n        }\n        return $tmplPath.$theme;\n    }\n\n    /**\n     * 设置当前输出的模板主题\n     * @access public\n     * @param  mixed $theme 主题名称\n     * @return View\n     */\n    public function theme($theme){\n        $this->theme = $theme;\n        return $this;\n    }\n\n    /**\n     * 获取当前的模板主题\n     * @access private\n     * @return string\n     */\n    private function getTemplateTheme() {\n        if($this->theme) { // 指定模板主题\n            $theme = $this->theme;\n        }else{\n            /* 获取模板主题名称 */\n            $theme =  C('DEFAULT_THEME');\n            if(C('TMPL_DETECT_THEME')) {// 自动侦测模板主题\n                $t = C('VAR_TEMPLATE');\n                if (isset($_GET[$t])){\n                    $theme = $_GET[$t];\n                }elseif(cookie('think_template')){\n                    $theme = cookie('think_template');\n                }\n                if(!in_array($theme,explode(',',C('THEME_LIST')))){\n                    $theme =  C('DEFAULT_THEME');\n                }\n                cookie('think_template',$theme,864000);\n            }\n        }\n        defined('THEME_NAME') || define('THEME_NAME',   $theme);                  // 当前模板主题名称\n        return $theme?$theme . '/':'';\n    }\n\n}"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Boris/Boris.php",
    "content": "<?php\n\n/* vim: set shiftwidth=2 expandtab softtabstop=2: */\n\nnamespace Boris;\n\n/**\n * Boris is a tiny REPL for PHP.\n */\nclass Boris {\n  const VERSION = \"1.0.8\";\n\n  private $_prompt;\n  private $_historyFile;\n  private $_exports = array();\n  private $_startHooks = array();\n  private $_failureHooks = array();\n  private $_inspector;\n\n  /**\n   * Create a new REPL, which consists of an evaluation worker and a readline client.\n   *\n   * @param string $prompt, optional\n   * @param string $historyFile, optional\n   */\n  public function __construct($prompt = 'boris> ', $historyFile = null) {\n    $this->setPrompt($prompt);\n    $this->_historyFile = $historyFile\n      ? $historyFile\n      : sprintf('%s/.boris_history', getenv('HOME'))\n      ;\n    $this->_inspector = new ColoredInspector();\n  }\n\n  /**\n   * Add a new hook to run in the context of the REPL when it starts.\n   *\n   * @param mixed $hook\n   *\n   * The hook is either a string of PHP code to eval(), or a Closure accepting\n   * the EvalWorker object as its first argument and the array of defined\n   * local variables in the second argument.\n   *\n   * If the hook is a callback and needs to set any local variables in the\n   * REPL's scope, it should invoke $worker->setLocal($var_name, $value) to\n   * do so.\n   *\n   * Hooks are guaranteed to run in the order they were added and the state\n   * set by each hook is available to the next hook (either through global\n   * resources, such as classes and interfaces, or through the 2nd parameter\n   * of the callback, if any local variables were set.\n   *\n   * @example Contrived example where one hook sets the date and another\n   *          prints it in the REPL.\n   *\n   *   $boris->onStart(function($worker, $vars){\n   *     $worker->setLocal('date', date('Y-m-d'));\n   *   });\n   *\n   *   $boris->onStart('echo \"The date is $date\\n\";');\n   */\n  public function onStart($hook) {\n    $this->_startHooks[] = $hook;\n  }\n\n  /**\n   * Add a new hook to run in the context of the REPL when a fatal error occurs.\n   *\n   * @param mixed $hook\n   *\n   * The hook is either a string of PHP code to eval(), or a Closure accepting\n   * the EvalWorker object as its first argument and the array of defined\n   * local variables in the second argument.\n   *\n   * If the hook is a callback and needs to set any local variables in the\n   * REPL's scope, it should invoke $worker->setLocal($var_name, $value) to\n   * do so.\n   *\n   * Hooks are guaranteed to run in the order they were added and the state\n   * set by each hook is available to the next hook (either through global\n   * resources, such as classes and interfaces, or through the 2nd parameter\n   * of the callback, if any local variables were set.\n   *\n   * @example An example if your project requires some database connection cleanup:\n   *\n   *   $boris->onFailure(function($worker, $vars){\n   *     DB::reset();\n   *   });\n   */\n  public function onFailure($hook){\n    $this->_failureHooks[] = $hook;\n  }\n\n  /**\n   * Set a local variable, or many local variables.\n   *\n   * @example Setting a single variable\n   *   $boris->setLocal('user', $bob);\n   *\n   * @example Setting many variables at once\n   *   $boris->setLocal(array('user' => $bob, 'appContext' => $appContext));\n   *\n   * This method can safely be invoked repeatedly.\n   *\n   * @param array|string $local\n   * @param mixed $value, optional\n   */\n  public function setLocal($local, $value = null) {\n    if (!is_array($local)) {\n      $local = array($local => $value);\n    }\n\n    $this->_exports = array_merge($this->_exports, $local);\n  }\n\n  /**\n   * Sets the Boris prompt text\n   *\n   * @param string $prompt\n   */\n  public function setPrompt($prompt) {\n    $this->_prompt = $prompt;\n  }\n\n  /**\n   * Set an Inspector object for Boris to output return values with.\n   *\n   * @param object $inspector any object the responds to inspect($v)\n   */\n  public function setInspector($inspector) {\n    $this->_inspector = $inspector;\n  }\n\n  /**\n   * Start the REPL (display the readline prompt).\n   *\n   * This method never returns.\n   */\n  public function start() {\n    declare(ticks = 1);\n    pcntl_signal(SIGINT, SIG_IGN, true);\n\n    if (!$pipes = stream_socket_pair(\n      STREAM_PF_UNIX, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP)) {\n      throw new \\RuntimeException('Failed to create socket pair');\n    }\n\n    $pid = pcntl_fork();\n\n    if ($pid > 0) {\n      if (function_exists('setproctitle')) {\n        setproctitle('boris (master)');\n      }\n\n      fclose($pipes[0]);\n      $client = new ReadlineClient($pipes[1]);\n      $client->start($this->_prompt, $this->_historyFile);\n    } elseif ($pid < 0) {\n      throw new \\RuntimeException('Failed to fork child process');\n    } else {\n      if (function_exists('setproctitle')) {\n        setproctitle('boris (worker)');\n      }\n\n      fclose($pipes[1]);\n      $worker = new EvalWorker($pipes[0]);\n      $worker->setLocal($this->_exports);\n      $worker->setStartHooks($this->_startHooks);\n      $worker->setFailureHooks($this->_failureHooks);\n      $worker->setInspector($this->_inspector);\n      $worker->start();\n    }\n  }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Boris/CLIOptionsHandler.php",
    "content": "<?php\n\n/* vim: set shiftwidth=2 expandtab softtabstop=2: */\n\nnamespace Boris;\n\n/**\n * Processes available command line flags.\n */\nclass CLIOptionsHandler {\n  /**\n   * Accept the REPL object and perform any setup necessary from the CLI flags.\n   *\n   * @param Boris $boris\n   */\n  public function handle($boris) {\n    $args = getopt('hvr:', array('help', 'version', 'require:'));\n\n    foreach ($args as $option => $value) {\n      switch ($option) {\n        /*\n         * Sets files to load at startup, may be used multiple times,\n         * i.e: boris -r test.php,foo/bar.php -r ba/foo.php --require hey.php\n         */\n        case 'r':\n        case 'require':\n          $this->_handleRequire($boris, $value);\n        break;\n\n        /*\n         * Show Usage info\n         */\n        case 'h':\n        case 'help':\n          $this->_handleUsageInfo();\n        break;\n\n        /*\n         * Show version\n         */\n        case 'v':\n        case 'version':\n          $this->_handleVersion();\n        break;\n      }\n    }\n  }\n\n  // -- Private Methods\n\n  private function _handleRequire($boris, $paths) {\n    $require = array_reduce(\n      (array) $paths,\n      function($acc, $v) { return array_merge($acc, explode(',', $v)); },\n      array()\n    );\n\n    $boris->onStart(function($worker, $scope) use($require) {\n      foreach($require as $path) {\n        require $path;\n      }\n\n      $worker->setLocal(get_defined_vars());\n    });\n  }\n\n  private function _handleUsageInfo() {\n    echo <<<USAGE\nUsage: boris [options]\nboris is a tiny REPL for PHP\n\nOptions:\n  -h, --help     show this help message and exit\n  -r, --require  a comma-separated list of files to require on startup\n  -v, --version  show Boris version\n\nUSAGE;\n    exit(0);\n  }\n\n  private function _handleVersion() {\n    printf(\"Boris %s\\n\", Boris::VERSION);\n    exit(0);\n  }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Boris/ColoredInspector.php",
    "content": "<?php\n\n/* vim: set shiftwidth=2 expandtab softtabstop=2: */\n\n/**\n * @author Rob Morris <rob@irongaze.com>\n * @author Chris Corbyn <chris@w3style.co.uk>\n *\n * Copyright © 2013-2014 Rob Morris.\n */\n\nnamespace Boris;\n\n/**\n * Identifies data types in data structures and syntax highlights them.\n */\nclass ColoredInspector implements Inspector {\n  static $TERM_COLORS = array(\n    'black'        => \"\\033[0;30m\",\n    'white'        => \"\\033[1;37m\",\n    'none'         => \"\\033[1;30m\",\n    'dark_grey'    => \"\\033[1;30m\",\n    'light_grey'   => \"\\033[0;37m\",\n    'dark_red'     => \"\\033[0;31m\",\n    'light_red'    => \"\\033[1;31m\",\n    'dark_green'   => \"\\033[0;32m\",\n    'light_green'  => \"\\033[1;32m\",\n    'dark_yellow'  => \"\\033[0;33m\",\n    'light_yellow' => \"\\033[1;33m\",\n    'dark_blue'    => \"\\033[0;34m\",\n    'light_blue'   => \"\\033[1;34m\",\n    'dark_purple'  => \"\\033[0;35m\",\n    'light_purple' => \"\\033[1;35m\",\n    'dark_cyan'    => \"\\033[0;36m\",\n    'light_cyan'   => \"\\033[1;36m\",\n  );\n\n  private $_fallback;\n  private $_colorMap = array();\n\n  /**\n   * Initialize a new ColoredInspector, using $colorMap.\n   *\n   * The colors should be an associative array with the keys:\n   *\n   *   - 'integer'\n   *   - 'float'\n   *   - 'keyword'\n   *   - 'string'\n   *   - 'boolean'\n   *   - 'default'\n   *\n   * And the values, one of the following colors:\n   *\n   *   - 'none'\n   *   - 'black'\n   *   - 'white'\n   *   - 'dark_grey'\n   *   - 'light_grey'\n   *   - 'dark_red'\n   *   - 'light_red'\n   *   - 'dark_green'\n   *   - 'light_green'\n   *   - 'dark_yellow'\n   *   - 'light_yellow'\n   *   - 'dark_blue'\n   *   - 'light_blue'\n   *   - 'dark_purple'\n   *   - 'light_purple'\n   *   - 'dark_cyan'\n   *   - 'light_cyan'\n   *\n   * An empty $colorMap array effectively means 'none' for all types.\n   *\n   * @param array $colorMap\n   */\n  public function __construct($colorMap = null) {\n    $this->_fallback = new DumpInspector();\n\n    if (isset($colorMap)) {\n      $this->_colorMap = $colorMap;\n    } else {\n      $this->_colorMap = $this->_defaultColorMap();\n    }\n  }\n\n  public function inspect($variable) {\n    return preg_replace(\n      '/^/m',\n      $this->_colorize('comment', '// '),\n      $this->_dump($variable)\n    );\n  }\n\n  /**\n   * Returns an associative array of an object's properties.\n   *\n   * This method is public so that subclasses may override it.\n   *\n   * @param object $value\n   * @return array\n   * */\n  public function objectVars($value) {\n    return get_object_vars($value);\n  }\n\n  // -- Private Methods\n\n  public function _dump($value) {\n    $tests = array(\n      'is_null'    => '_dumpNull',\n      'is_string'  => '_dumpString',\n      'is_bool'    => '_dumpBoolean',\n      'is_integer' => '_dumpInteger',\n      'is_float'   => '_dumpFloat',\n      'is_array'   => '_dumpArray',\n      'is_object'  => '_dumpObject'\n    );\n\n    foreach ($tests as $predicate => $outputMethod) {\n      if (call_user_func($predicate, $value))\n        return call_user_func(array($this, $outputMethod), $value);\n    }\n\n    return $this->_fallback->inspect($value);\n  }\n\n  private function _dumpNull($value) {\n    return $this->_colorize('keyword', 'NULL');\n  }\n\n  private function _dumpString($value) {\n    return $this->_colorize('string', var_export($value, true));\n  }\n\n  private function _dumpBoolean($value) {\n    return $this->_colorize('bool', var_export($value, true));\n  }\n\n  private function _dumpInteger($value) {\n    return $this->_colorize('integer', var_export($value, true));\n  }\n\n  private function _dumpFloat($value) {\n    return $this->_colorize('float', var_export($value, true));\n  }\n\n  private function _dumpArray($value) {\n    return $this->_dumpStructure('array', $value);\n  }\n\n  private function _dumpObject($value) {\n    return $this->_dumpStructure(\n      sprintf('object(%s)', get_class($value)),\n      $this->objectVars($value)\n    );\n  }\n\n  private function _dumpStructure($type, $value) {\n    return $this->_astToString($this->_buildAst($type, $value));\n  }\n\n  public function _buildAst($type, $value, $seen = array()) {\n    // FIXME: Improve this AST so it doesn't require access to dump() or colorize()\n    if ($this->_isSeen($value, $seen)) {\n      return $this->_colorize('default', '*** RECURSION ***');\n    } else {\n      $nextSeen = array_merge($seen, array($value));\n    }\n\n    if (is_object($value)) {\n      $vars = $this->objectVars($value);\n    } else {\n      $vars = $value;\n    }\n\n    $self = $this;\n\n    return array(\n      'name'     => $this->_colorize('keyword', $type),\n      'children' => empty($vars) ? array() : array_combine(\n        array_map(array($this, '_dump'), array_keys($vars)),\n        array_map(\n          function($v) use($self, $nextSeen) {\n            if (is_object($v)) {\n              return $self->_buildAst(\n                sprintf('object(%s)', get_class($v)),\n                $v,\n                $nextSeen\n              );\n            } elseif (is_array($v)) {\n              return $self->_buildAst('array', $v, $nextSeen);\n            } else {\n              return $self->_dump($v);\n            }\n          },\n          array_values($vars)\n        )\n      )\n    );\n  }\n\n  public function _astToString($node, $indent = 0) {\n    $children = $node['children'];\n    $self     = $this;\n\n    return implode(\n      \"\\n\",\n      array(\n        sprintf('%s(', $node['name']),\n        implode(\n          \",\\n\",\n          array_map(\n            function($k) use($self, $children, $indent) {\n              if (is_array($children[$k])) {\n                return sprintf(\n                  '%s%s => %s',\n                  str_repeat(' ', ($indent + 1) * 2),\n                  $k,\n                  $self->_astToString($children[$k], $indent + 1)\n                );\n              } else {\n                return sprintf(\n                  '%s%s => %s',\n                  str_repeat(' ', ($indent + 1) * 2),\n                  $k,\n                  $children[$k]\n                );\n              }\n            },\n            array_keys($children)\n          )\n        ),\n        sprintf('%s)', str_repeat(' ', $indent * 2))\n      )\n    );\n  }\n\n  private function _defaultColorMap() {\n    return array(\n      'integer' => 'light_green',\n      'float'   => 'light_yellow',\n      'string'  => 'light_red',\n      'bool'    => 'light_purple',\n      'keyword' => 'light_cyan',\n      'comment' => 'dark_grey',\n      'default' => 'none'\n    );\n  }\n\n  private function _colorize($type, $value) {\n    if (!empty($this->_colorMap[$type])) {\n      $colorName = $this->_colorMap[$type];\n    } else {\n      $colorName = $this->_colorMap['default'];\n    }\n\n    return sprintf(\n      \"%s%s\\033[0m\",\n      static::$TERM_COLORS[$colorName],\n      $value\n    );\n  }\n\n  private function _isSeen($value, $seen) {\n    foreach ($seen as $v) {\n      if ($v === $value)\n        return true;\n    }\n\n    return false;\n  }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Boris/Config.php",
    "content": "<?php\n\n/* vim: set shiftwidth=2 expandtab softtabstop=2: */\n\nnamespace Boris;\n\n/**\n * Config handles loading configuration files for boris\n */\nclass Config {\n  private $_searchPaths;\n  private $_cascade = false;\n  private $_files   = array();\n\n  /**\n   * Create a new Config instance, optionally with an array\n   * of paths to search for configuration files.\n   *\n   * Additionally, if the second, optional boolean argument is\n   * true, all existing configuration files will be loaded, and\n   * effectively merged.\n   *\n   * @param array $searchPaths\n   * @param bool  $cascade\n   */\n  public function __construct($searchPaths = null, $cascade = false) {\n    if (is_null($searchPaths)) {\n      $searchPaths = array();\n\n      if ($userHome = getenv('HOME')) {\n        $searchPaths[] = \"{$userHome}/.borisrc\";\n      }\n\n      $searchPaths[] = getcwd() . '/.borisrc';\n    }\n\n    $this->_cascade     = $cascade;\n    $this->_searchPaths = $searchPaths;\n  }\n\n  /**\n   * Searches for configuration files in the available\n   * search paths, and applies them to the provided\n   * boris instance.\n   *\n   * Returns true if any configuration files were found.\n   *\n   * @param  Boris\\Boris $boris\n   * @return bool\n   */\n  public function apply(Boris $boris) {\n    $applied = false;\n\n    foreach($this->_searchPaths as $path) {\n      if (is_readable($path)) {\n        $this->_loadInIsolation($path, $boris);\n\n        $applied = true;\n        $this->_files[] = $path;\n\n        if (!$this->_cascade) {\n          break;\n        }\n      }\n    }\n\n    return $applied;\n  }\n\n  /**\n   * Returns an array of files that were loaded\n   * for this Config\n   *\n   * @return array\n   */\n  public function loadedFiles() {\n    return $this->_files;\n  }\n\n  // -- Private Methods\n\n  private function _loadInIsolation($path, $boris) {\n    require $path;\n  }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Boris/DumpInspector.php",
    "content": "<?php\n\n/* vim: set shiftwidth=2 expandtab softtabstop=2: */\n\nnamespace Boris;\n\n/**\n * Passes values through var_dump() to inspect them.\n */\nclass DumpInspector implements Inspector {\n  public function inspect($variable) {\n    ob_start();\n    var_dump($variable);\n    return sprintf(\" → %s\", trim(ob_get_clean()));\n  }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Boris/EvalWorker.php",
    "content": "<?php\n\n/* vim: set shiftwidth=2 expandtab softtabstop=2: */\n\nnamespace Boris;\n\n/**\n * EvalWorker is responsible for evaluating PHP expressions in forked processes.\n */\nclass EvalWorker {\n  const ABNORMAL_EXIT = 255;\n  const DONE   = \"\\0\";\n  const EXITED = \"\\1\";\n  const FAILED = \"\\2\";\n  const READY  = \"\\3\";\n\n  private $_socket;\n  private $_exports = array();\n  private $_startHooks = array();\n  private $_failureHooks = array();\n  private $_ppid;\n  private $_pid;\n  private $_cancelled;\n  private $_inspector;\n  private $_exceptionHandler;\n\n  /**\n   * Create a new worker using the given socket for communication.\n   *\n   * @param resource $socket\n   */\n  public function __construct($socket) {\n    $this->_socket    = $socket;\n    $this->_inspector = new DumpInspector();\n    stream_set_blocking($socket, 0);\n  }\n\n  /**\n   * Set local variables to be placed in the workers's scope.\n   *\n   * @param array|string $local\n   * @param mixed $value, if $local is a string\n   */\n  public function setLocal($local, $value = null) {\n    if (!is_array($local)) {\n      $local = array($local => $value);\n    }\n\n    $this->_exports = array_merge($this->_exports, $local);\n  }\n\n  /**\n   * Set hooks to run inside the worker before it starts looping.\n   *\n   * @param array $hooks\n   */\n  public function setStartHooks($hooks) {\n    $this->_startHooks = $hooks;\n  }\n\n  /**\n   * Set hooks to run inside the worker after a fatal error is caught.\n   *\n   * @param array $hooks\n   */\n  public function setFailureHooks($hooks) {\n    $this->_failureHooks = $hooks;\n  }\n\n  /**\n   * Set an Inspector object for Boris to output return values with.\n   *\n   * @param object $inspector any object the responds to inspect($v)\n   */\n  public function setInspector($inspector) {\n    $this->_inspector = $inspector;\n  }\n\n  /**\n   * Start the worker.\n   *\n   * This method never returns.\n   */\n  public function start() {\n    $__scope = $this->_runHooks($this->_startHooks);\n    extract($__scope);\n\n    $this->_write($this->_socket, self::READY);\n\n    /* Note the naming of the local variables due to shared scope with the user here */\n    for (;;) {\n      declare(ticks = 1);\n      // don't exit on ctrl-c\n      pcntl_signal(SIGINT, SIG_IGN, true);\n\n      $this->_cancelled = false;\n\n      $__input = $this->_transform($this->_read($this->_socket));\n\n      if ($__input === null) {\n        continue;\n      }\n\n      $__response = self::DONE;\n\n      $this->_ppid = posix_getpid();\n      $this->_pid  = pcntl_fork();\n\n      if ($this->_pid < 0) {\n        throw new \\RuntimeException('Failed to fork child labourer');\n      } elseif ($this->_pid > 0) {\n        // kill the child on ctrl-c\n        pcntl_signal(SIGINT, array($this, 'cancelOperation'), true);\n        pcntl_waitpid($this->_pid, $__status);\n\n        if (!$this->_cancelled && $__status != (self::ABNORMAL_EXIT << 8)) {\n          $__response = self::EXITED;\n        } else {\n          $this->_runHooks($this->_failureHooks);\n          $__response = self::FAILED;\n        }\n      } else {\n        // user exception handlers normally cause a clean exit, so Boris will exit too\n        if (!$this->_exceptionHandler =\n          set_exception_handler(array($this, 'delegateExceptionHandler'))) {\n          restore_exception_handler();\n        }\n\n        // undo ctrl-c signal handling ready for user code execution\n        pcntl_signal(SIGINT, SIG_DFL, true);\n        $__pid = posix_getpid();\n\n        $__result = eval($__input);\n\n        if (posix_getpid() != $__pid) {\n          // whatever the user entered caused a forked child\n          // (totally valid, but we don't want that child to loop and wait for input)\n          exit(0);\n        }\n\n        if (preg_match('/\\s*return\\b/i', $__input)) {\n          fwrite(STDOUT, sprintf(\"%s\\n\", $this->_inspector->inspect($__result)));\n        }\n        $this->_expungeOldWorker();\n      }\n\n      $this->_write($this->_socket, $__response);\n\n      if ($__response == self::EXITED) {\n        exit(0);\n      }\n    }\n  }\n\n  /**\n   * While a child process is running, terminate it immediately.\n   */\n  public function cancelOperation() {\n    printf(\"Cancelling...\\n\");\n    $this->_cancelled = true;\n    posix_kill($this->_pid, SIGKILL);\n    pcntl_signal_dispatch();\n  }\n\n  /**\n   * If any user-defined exception handler is present, call it, but be sure to exit correctly.\n   */\n  public function delegateExceptionHandler($ex) {\n    call_user_func($this->_exceptionHandler, $ex);\n    exit(self::ABNORMAL_EXIT);\n  }\n\n  // -- Private Methods\n\n  private function _runHooks($hooks) {\n    extract($this->_exports);\n\n    foreach ($hooks as $__hook) {\n      if (is_string($__hook)) {\n        eval($__hook);\n      } elseif (is_callable($__hook)) {\n        call_user_func($__hook, $this, get_defined_vars());\n      } else {\n        throw new \\RuntimeException(\n          sprintf(\n            'Hooks must be closures or strings of PHP code. Got [%s].',\n            gettype($__hook)\n          )\n        );\n      }\n\n      // hooks may set locals\n      extract($this->_exports);\n    }\n\n    return get_defined_vars();\n  }\n\n  private function _expungeOldWorker() {\n    posix_kill($this->_ppid, SIGTERM);\n    pcntl_signal_dispatch();\n  }\n\n  private function _write($socket, $data) {\n    if (!fwrite($socket, $data)) {\n      throw new \\RuntimeException('Socket error: failed to write data');\n    }\n  }\n\n  private function _read($socket)\n  {\n    $read   = array($socket);\n    $except = array($socket);\n\n    if ($this->_select($read, $except) > 0) {\n      if ($read) {\n        return stream_get_contents($read[0]);\n      } else if ($except) {\n        throw new \\UnexpectedValueException(\"Socket error: closed\");\n      }\n    }\n  }\n\n  private function _select(&$read, &$except) {\n    $write = null;\n    set_error_handler(function(){return true;}, E_WARNING);\n    $result = stream_select($read, $write, $except, 10);\n    restore_error_handler();\n    return $result;\n  }\n\n  private function _transform($input) {\n    if ($input === null) {\n      return null;\n    }\n\n    $transforms = array(\n      'exit' => 'exit(0)'\n    );\n\n    foreach ($transforms as $from => $to) {\n      $input = preg_replace('/^\\s*' . preg_quote($from, '/') . '\\s*;?\\s*$/', $to . ';', $input);\n    }\n\n    return $input;\n  }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Boris/ExportInspector.php",
    "content": "<?php\n\n/* vim: set shiftwidth=2 expandtab softtabstop=2: */\n\nnamespace Boris;\n\n/**\n * Passes values through var_export() to inspect them.\n */\nclass ExportInspector implements Inspector {\n  public function inspect($variable) {\n    return sprintf(\" → %s\", var_export($variable, true));\n  }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Boris/Inspector.php",
    "content": "<?php\n\n/* vim: set shiftwidth=2 expandtab softtabstop=2: */\n\nnamespace Boris;\n\n/**\n * Something that is capable of returning a useful representation of a variable.\n */\ninterface Inspector {\n  /**\n   * Return a debug-friendly string representation of $variable.\n   *\n   * @param mixed $variable\n   *\n   * @return string\n   */\n  public function inspect($variable);\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Boris/ReadlineClient.php",
    "content": "<?php\n\n/* vim: set shiftwidth=2 expandtab softtabstop=2: */\n\nnamespace Boris;\n\n/**\n * The Readline client is what the user spends their time entering text into.\n *\n * Input is collected and sent to {@link \\Boris\\EvalWorker} for processing.\n */\nclass ReadlineClient {\n  private $_socket;\n  private $_prompt;\n  private $_historyFile;\n  private $_clear = false;\n\n  /**\n   * Create a new ReadlineClient using $socket for communication.\n   *\n   * @param resource $socket\n   */\n  public function __construct($socket) {\n    $this->_socket = $socket;\n  }\n\n  /**\n   * Start the client with an prompt and readline history path.\n   *\n   * This method never returns.\n   *\n   * @param string $prompt\n   * @param string $historyFile\n   */\n  public function start($prompt, $historyFile) {\n    readline_read_history($historyFile);\n\n    declare(ticks = 1);\n    pcntl_signal(SIGCHLD, SIG_IGN);\n    pcntl_signal(SIGINT, array($this, 'clear'), true);\n\n    // wait for the worker to finish executing hooks\n    if (fread($this->_socket, 1) != EvalWorker::READY) {\n      throw new \\RuntimeException('EvalWorker failed to start');\n    }\n\n    $parser = new ShallowParser();\n    $buf    = '';\n    $lineno = 1;\n\n    for (;;) {\n      $this->_clear = false;\n      $line = readline(\n        sprintf(\n          '[%d] %s',\n          $lineno,\n          ($buf == ''\n            ? $prompt\n            : str_pad('*> ', strlen($prompt), ' ', STR_PAD_LEFT))\n        )\n      );\n\n      if ($this->_clear) {\n        $buf = '';\n        continue;\n      }\n\n      if (false === $line) {\n        $buf = 'exit(0);'; // ctrl-d acts like exit\n      }\n\n      if (strlen($line) > 0) {\n        readline_add_history($line);\n      }\n\n      $buf .= sprintf(\"%s\\n\", $line);\n\n      if ($statements = $parser->statements($buf)) {\n        ++$lineno;\n\n        $buf = '';\n        foreach ($statements as $stmt) {\n          if (false === $written = fwrite($this->_socket, $stmt)) {\n            throw new \\RuntimeException('Socket error: failed to write data');\n          }\n\n          if ($written > 0) {\n            $status = fread($this->_socket, 1);\n            if ($status == EvalWorker::EXITED) {\n              readline_write_history($historyFile);\n              echo \"\\n\";\n              exit(0);\n            } elseif ($status == EvalWorker::FAILED) {\n              break;\n            }\n          }\n        }\n      }\n    }\n  }\n\n  /**\n   * Clear the input buffer.\n   */\n  public function clear() {\n    // FIXME: I'd love to have this send \\r to readline so it puts the user on a blank line\n    $this->_clear = true;\n  }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Boris/ShallowParser.php",
    "content": "<?php\n\n/* vim: set shiftwidth=2 expandtab softtabstop=2: */\n\nnamespace Boris;\n\n/**\n * The ShallowParser takes whatever is currently buffered and chunks it into individual statements.\n */\nclass ShallowParser {\n  private $_pairs = array(\n    '('   => ')',\n    '{'   => '}',\n    '['   => ']',\n    '\"'   => '\"',\n    \"'\"   => \"'\",\n    '//'  => \"\\n\",\n    '#'   => \"\\n\",\n    '/*'  => '*/',\n    '<<<' => '_heredoc_special_case_'\n  );\n\n  private $_initials;\n\n  public function __construct() {\n    $this->_initials   = '/^(' . implode('|', array_map(array($this, 'quote'), array_keys($this->_pairs))) . ')/';\n  }\n\n  /**\n   * Break the $buffer into chunks, with one for each highest-level construct possible.\n   *\n   * If the buffer is incomplete, returns an empty array.\n   *\n   * @param string $buffer\n   *\n   * @return array\n   */\n  public function statements($buffer) {\n    $result = $this->_createResult($buffer);\n\n    while (strlen($result->buffer) > 0) {\n      $this->_resetResult($result);\n\n      if ($result->state == '<<<') {\n        if (!$this->_initializeHeredoc($result)) {\n          continue;\n        }\n      }\n\n      $rules = array('_scanEscapedChar', '_scanRegion', '_scanStateEntrant', '_scanWsp', '_scanChar');\n\n      foreach ($rules as $method) {\n        if ($this->$method($result)) {\n          break;\n        }\n      }\n\n      if ($result->stop) {\n        break;\n      }\n    }\n\n    if (!empty($result->statements) && trim($result->stmt) === '' && strlen($result->buffer) == 0) {\n      $this->_combineStatements($result);\n      $this->_prepareForDebug($result);\n      return $result->statements;\n    }\n  }\n\n  public function quote($token) {\n    return preg_quote($token, '/');\n  }\n\n  // -- Private Methods\n\n  private function _createResult($buffer) {\n    $result = new \\stdClass();\n    $result->buffer     = $buffer;\n    $result->stmt       = '';\n    $result->state      =  null;\n    $result->states     = array();\n    $result->statements = array();\n    $result->stop       = false;\n\n    return $result;\n  }\n\n  private function _resetResult($result) {\n    $result->stop       = false;\n    $result->state      = end($result->states);\n    $result->terminator = $result->state\n      ? '/^(.*?' . preg_quote($this->_pairs[$result->state], '/') . ')/s'\n      : null\n      ;\n  }\n\n  private function _combineStatements($result) {\n    $combined = array();\n\n    foreach ($result->statements as $scope) {\n      if (trim($scope) == ';' || substr(trim($scope), -1) != ';') {\n        $combined[] = ((string) array_pop($combined)) . $scope;\n      } else {\n        $combined[] = $scope;\n      }\n    }\n\n    $result->statements = $combined;\n  }\n\n  private function _prepareForDebug($result) {\n    $result->statements []= $this->_prepareDebugStmt(array_pop($result->statements));\n  }\n\n  private function _initializeHeredoc($result) {\n    if (preg_match('/^([\\'\"]?)([a-z_][a-z0-9_]*)\\\\1/i', $result->buffer, $match)) {\n      $docId = $match[2];\n      $result->stmt .= $match[0];\n      $result->buffer = substr($result->buffer, strlen($match[0]));\n\n      $result->terminator = '/^(.*?\\n' . $docId . ');?\\n/s';\n\n      return true;\n    } else {\n      return false;\n    }\n  }\n\n  private function _scanWsp($result) {\n    if (preg_match('/^\\s+/', $result->buffer, $match)) {\n      if (!empty($result->statements) && $result->stmt === '') {\n        $result->statements[] = array_pop($result->statements) . $match[0];\n      } else {\n        $result->stmt .= $match[0];\n      }\n      $result->buffer = substr($result->buffer, strlen($match[0]));\n\n      return true;\n    } else {\n      return false;\n    }\n  }\n\n  private function _scanEscapedChar($result) {\n    if (($result->state == '\"' || $result->state == \"'\")\n        && preg_match('/^[^' . $result->state . ']*?\\\\\\\\./s', $result->buffer, $match)) {\n\n      $result->stmt .= $match[0];\n      $result->buffer = substr($result->buffer, strlen($match[0]));\n\n      return true;\n    } else {\n      return false;\n    }\n  }\n\n  private function _scanRegion($result) {\n    if (in_array($result->state, array('\"', \"'\", '<<<', '//', '#', '/*'))) {\n      if (preg_match($result->terminator, $result->buffer, $match)) {\n        $result->stmt .= $match[1];\n        $result->buffer = substr($result->buffer, strlen($match[1]));\n        array_pop($result->states);\n      } else {\n        $result->stop = true;\n      }\n\n      return true;\n    } else {\n      return false;\n    }\n  }\n\n  private function _scanStateEntrant($result) {\n    if (preg_match($this->_initials, $result->buffer, $match)) {\n      $result->stmt .= $match[0];\n      $result->buffer = substr($result->buffer, strlen($match[0]));\n      $result->states[] = $match[0];\n\n      return true;\n    } else {\n      return false;\n    }\n  }\n\n  private function _scanChar($result) {\n    $chr = substr($result->buffer, 0, 1);\n    $result->stmt .= $chr;\n    $result->buffer = substr($result->buffer, 1);\n    if ($result->state && $chr == $this->_pairs[$result->state]) {\n      array_pop($result->states);\n    }\n\n    if (empty($result->states) && ($chr == ';' || $chr == '}')) {\n      if (!$this->_isLambda($result->stmt) || $chr == ';') {\n        $result->statements[] = $result->stmt;\n        $result->stmt = '';\n      }\n    }\n\n    return true;\n  }\n\n  private function _isLambda($input) {\n    return preg_match(\n      '/^([^=]*?=\\s*)?function\\s*\\([^\\)]*\\)\\s*(use\\s*\\([^\\)]*\\)\\s*)?\\s*\\{.*\\}\\s*;?$/is',\n      trim($input)\n    );\n  }\n\n  private function _isReturnable($input) {\n    $input = trim($input);\n    if (substr($input, -1) == ';' && substr($input, 0, 1) != '{') {\n      return $this->_isLambda($input) || !preg_match(\n        '/^(' .\n        'echo|print|exit|die|goto|global|include|include_once|require|require_once|list|' .\n        'return|do|for|foreach|while|if|function|namespace|class|interface|abstract|switch|' .\n        'declare|throw|try|unset' .\n        ')\\b/i',\n        $input\n      );\n    } else {\n      return false;\n    }\n  }\n\n  private function _prepareDebugStmt($input) {\n    if ($this->_isReturnable($input) && !preg_match('/^\\s*return/i', $input)) {\n      $input = sprintf('return %s', $input);\n    }\n\n    return $input;\n  }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/EaseTemplate/template.core.php",
    "content": "<?php\n/* \n * Edition:\tET080708\n * Desc:\tCore Engine 3 (Memcache/Compile/Replace)\n * File:\ttemplate.core.php\n * Author:\tDavid Meng\n * Site:\thttp://www.systn.com\n * Email:\tmdchinese@gmail.com\n * \n */\nerror_reporting(0);\n\ndefine(\"ET3!\",TRUE);\nclass ETCore{\n\tvar $ThisFile\t= '';\t\t\t\t//当前文件\n\tvar $IncFile\t= '';\t\t\t\t//引入文件\n\tvar $ThisValue\t= array();\t\t\t//当前数值\n\tvar $FileList\t= array();\t\t\t//载入文件列表\n\tvar $IncList\t= array();\t\t\t//引入文件列表\n\tvar $ImgDir\t\t= array('images');\t//图片地址目录\n\tvar $HtmDir\t\t= 'cache_htm/';\t\t//静态存放的目录\n\tvar $HtmID\t\t= '';\t\t\t\t//静态文件ID\n\tvar $HtmTime\t= '180';\t\t\t//秒为单位，默认三分钟\n\tvar $AutoImage\t= 1;\t\t\t\t//自动解析图片目录开关默认值\n\tvar $Hacker\t\t= \"<?php if(!defined('ET3!')){die('You are Hacker!<br>Power by Ease Template!');}\";\n\tvar $Compile\t= array();\n\tvar $Analysis\t= array();\n\tvar $Emc\t\t= array();\n\n\t/**\n\t*\t声明模板用法\n\t*/\n\tfunction ETCoreStart(\n\t\t$set = array(\n\t\t\t\t'ID'\t\t =>'1',\t\t\t\t\t//缓存ID\n\t\t\t\t'TplType'\t =>'htm',\t\t\t\t//模板格式\n\t\t\t\t'CacheDir'\t =>'cache',\t\t\t\t//缓存目录\n\t\t\t\t'TemplateDir'=>'template' ,\t\t\t//模板存放目录\n\t\t\t\t'AutoImage'\t =>'on' ,\t\t\t\t//自动解析图片目录开关 on表示开放 off表示关闭\n\t\t\t\t'LangDir'\t =>'language' ,\t\t\t//语言文件存放的目录\n\t\t\t\t'Language'\t =>'default' ,\t\t\t//语言的默认文件\n\t\t\t\t'Copyright'\t =>'off' ,\t\t\t\t//版权保护\n\t\t\t\t'MemCache'\t =>'' ,\t\t\t\t\t//Memcache服务器地址例如:127.0.0.1:11211\n\t\t\t)\n\t\t){\n\n\t\t$this->TplID\t\t= (defined('TemplateID')?TemplateID:( ((int)@$set['ID']<=1)?1:(int)$set['ID']) ).'_';\n\n\t\t$this->CacheDir   \t= (defined('NewCache')?NewCache:( (trim($set['CacheDir']) != '')?$set['CacheDir']:'cache') ).'/';\n\n\t\t$this->TemplateDir\t= (defined('NewTemplate')?NewTemplate:( (trim($set['TemplateDir']) != '')?$set['TemplateDir']:'template') ).'/';\n\n\t\t$this->Ext\t\t\t= (@$set['TplType'] != '')?$set['TplType']:'htm';\n\n\t\t$this->AutoImage\t= (@$set['AutoImage']=='off')?0:1;\n\t\t\n\t\t$this->Copyright\t= (@$set['Copyright']=='off')?0:1;\n\t\t\n\t\t$this->Server\t\t= (is_array($GLOBALS['_SERVER']))?$GLOBALS['_SERVER']:$_SERVER;\n\t\t$this->version\t\t= (trim($_GET['EaseTemplateVer']))?die('Ease Templae E3!'):'';\n\t\t\n\t\t//载入语言文件\n\t\t$this->LangDir\t\t= (defined('LangDir')?LangDir:( ((@$set['LangDir']!='language' && @$set['LangDir'])?$set['LangDir']:'language') )).'/';\n\t\tif(is_dir($this->LangDir)){\n\t\t\t$this->Language\t= (defined('Language')?Language:( (($set['Language']!='default' && $set['Language'])?$set['Language']:'default') ));\n\t\t\tif(@is_file($this->LangDir.$this->Language.'.php')){\n\t\t\t\t$lang = array();\n\t\t\t\t@include_once $this->LangDir.$this->Language.'.php';\n\t\t\t\t$this->LangData = $lang;\n\t\t\t}\n\t\t}else{\n\t\t\t$this->Language = 'default';\n\t\t}\n\t\t\n\t\t\n\t\t//缓存目录检测以及运行模式\n\t\tif(@ereg(':',$set['MemCache'])){\n\t\t\t$this->RunType\t\t= 'MemCache';\n\t\t\t$memset\t\t= explode(\":\",$set['MemCache']);\n\t\t\t$this->Emc\t= memcache_connect($memset[0], $memset[1]) OR die(\"Could not connect!\");\n\t\t}else{\n\t  \t \t$this->RunType\t\t= (@substr(@sprintf('%o', @fileperms($this->CacheDir)), -3)==777 && is_dir($this->CacheDir))?'Cache':'Replace';\n\t\t}\n\t\t\n\t\t$CompileBasic = array(\n\t\t\t\t'/(\\{\\s*|<!--\\s*)inc_php:([a-zA-Z0-9_\\[\\]\\.\\,\\/\\?\\=\\#\\:\\;\\-\\|\\^]{5,200})(\\s*\\}|\\s*-->)/eis',\n\n\t\t\t\t'/<!--\\s*DEL\\s*-->/is',\n\t\t\t\t'/<!--\\s*IF(\\[|\\()(.+?)(\\]|\\))\\s*-->/is',\n\t\t\t\t'/<!--\\s*ELSEIF(\\[|\\()(.+?)(\\]|\\))\\s*-->/is',\n\t\t\t\t'/<!--\\s*ELSE\\s*-->/is',\n\t\t\t\t'/<!--\\s*END\\s*-->/is',\n\t\t\t\t'/<!--\\s*([a-zA-Z0-9_\\$\\[\\]\\'\\\"]{2,60})\\s*(AS|as)\\s*(.+?)\\s*-->/',\n\t\t\t\t'/<!--\\s*while\\:\\s*(.+?)\\s*-->/is',\n\t\t\t\t\t\n\t\t\t\t'/(\\{\\s*|<!--\\s*)lang\\:(.+?)(\\s*\\}|\\s*-->)/eis',\n\t\t\t\t'/(\\{\\s*|<!--\\s*)row\\:(.+?)(\\s*\\}|\\s*-->)/eis',\n\t\t\t\t'/(\\{\\s*|<!--\\s*)color\\:\\s*([\\#0-9A-Za-z]+\\,[\\#0-9A-Za-z]+)(\\s*\\}|\\s*-->)/eis',\n\t\t\t\t'/(\\{\\s*|<!--\\s*)dir\\:([^\\{\\}]{1,100})(\\s*\\}|\\s*-->)/eis',\n\t\t\t\t'/(\\{\\s*|<!--\\s*)run\\:(\\}|\\s*-->)\\s*(.+?)\\s*(\\{|<!--\\s*)\\/run(\\s*\\}|\\s*-->)/is',\n\t\t\t\t'/(\\{\\s*|<!--\\s*)run\\:(.+?)(\\s*\\}|\\s*-->)/is',\n\t\t\t\t'/\\{([a-zA-Z0-9_\\'\\\"\\[\\]\\$]{1,100})\\}/',\n\t\t   );\n\t\t$this->Compile = (is_array($this->Compile))?array_merge($this->Compile,$CompileBasic):$CompileBasic;\n\n\t\t$AnalysisBasic = array(\n\t\t\t\t'$this->inc_php(\"\\\\2\")',\n\n\t\t\t\t'\";if($ET_Del==true){echo\"',\n\t\t\t\t'\";if(\\\\2){echo\"',\n\t\t\t\t'\";}elseif(\\\\2){echo\"',\n\t\t\t\t'\";}else{echo\"',\n\t\t\t\t'\";}echo\"',\n\t\t\t\t'\";\\$_i=0;foreach((array)\\\\1 AS \\\\3){\\$_i++;echo\"',\n\t\t\t\t'\";\\$_i=0;while(\\\\1){\\$_i++;echo\"',\n\t\t\t\t\n\t\t\t\t'$this->lang(\"\\\\2\")',\n\t\t\t\t'$this->Row(\"\\\\2\")',\n\t\t\t\t'$this->Color(\"\\\\2\")',\n\t\t\t\t'$this->Dirs(\"\\\\2\")',\n\t\t\t\t'\";\\\\3;echo\"',\n\t\t\t\t'\";\\\\2;echo\"',\n\t\t\t\t'\";echo \\$\\\\1;echo\"',\n\t\t   );\n\t\t$this->Analysis = (is_array($this->Analysis))?array_merge($this->Analysis,$AnalysisBasic):$AnalysisBasic;\n\n\t}\n\n\n\t/**\n\t*\t设置数值\n\t*\tset_var(变量名或是数组,设置数值[数组不设置此值]);\n\t*/\n\tfunction set_var(\n\t\t\t\t$name,\n\t\t\t\t$value = ''\n\t\t\t){\n\t\tif (is_array($name)){\n\t\t\t$this->ThisValue = @array_merge($this->ThisValue,$name);\n\t\t}else{\n\t\t\t$this->ThisValue[$name] = $value;\n\t\t}\n\t}\n\n\n\t/**\n\t*\t设置模板文件\n\t*\tset_file(文件名,设置目录);\n\t*/\n\tfunction set_file(\n\t\t\t\t$FileName,\n\t\t\t\t$NewDir = ''\n\t\t\t){\n\t\t//当前模板名\n\t\t$this->ThisFile  = $FileName.'.'.$this->Ext;\n\n\t\t//目录地址检测\n\t\t$this->FileDir[$this->ThisFile] = (trim($NewDir) != '')?$NewDir.'/':$this->TemplateDir;\n\n\t\t$this->IncFile[$FileName]\t\t = $this->FileDir[$this->ThisFile].$this->ThisFile;\n\t\t\n\t\tif(!is_file($this->IncFile[$FileName]) && $this->Copyright==1){\n\t\t\tdie('Sorry, The file <b>'.$this->IncFile[$FileName].'</b> does not exist.');\n\t\t}\n\t\t\n\t\t\n\t\t//bug 系统\n\t\t$this->IncList[] = $this->ThisFile;\n\t}\n\n\t//解析替换程序\n\tfunction ParseCode(\n\t\t\t\t$FileList = '',\n\t\t\t\t$CacheFile = ''\n\t\t\t){\n\t\t//模板数据\n\t\t$ShowTPL = '';\n\t\t//解析续载\n\t\tif (@is_array($FileList) && $FileList!='include_page'){\n\t\t\tforeach ($FileList AS $K=>$V) {\n\t\t\t\t$ShowTPL .= $this->reader($V.$K);\n\t\t\t}\n\t\t}else{\n\n\t\t\t\n\t\t\t//如果指定文件地址则载入\n\t\t\t$SourceFile = ($FileList!='')?$FileList:$this->FileDir[$this->ThisFile].$this->ThisFile;\n\t\t\t\n\t\t\tif(!is_file($SourceFile) && $this->Copyright==1){\n\t\t\t\tdie('Sorry, The file <b>'.$SourceFile.'</b> does not exist.');\n\t\t\t}\n\t\t\t\n\t\t\t$ShowTPL = $this->reader($SourceFile);\n\t\t}\n\t\t\n\t\t//引用模板处理\n\t\t$ShowTPL = $this->inc_preg($ShowTPL);\n\t\t\n\t\t//检测run方法\n\t\t$run = 0;\n\t\tif (eregi(\"run:\",$ShowTPL)){\n\t\t\t$run\t = 1;\n\t\t\t//Fix =\n\t\t\t$ShowTPL = preg_replace('/(\\{|<!--\\s*)run:(\\}|\\s*-->)\\s*=/','{run:}echo ',$ShowTPL);\n\t\t\t$ShowTPL = preg_replace('/(\\{|<!--\\s*)run:\\s*=/','{run:echo ',$ShowTPL);\n\t\t\t//Fix Run 1\n\t\t\t$ShowTPL = preg_replace('/(\\{|<!--\\s*)run:(\\}|\\s*-->)\\s*(.+?)\\s*(\\{|<!--\\s*)\\/run(\\}|\\s*-->)/is', '(T_T)\\\\3;(T_T!)',$ShowTPL);\n\t\t}\n\t\t\n\t\t//Fix XML\n\t\tif (eregi(\"<?xml\",$ShowTPL)){\n\t\t\t$ShowTPL = @preg_replace('/<\\?(xml.+?)\\?>/is', '<ET>\\\\1</ET>', $ShowTPL);\n\t\t}\n\t\t\n\t\t//修复代码中\\n换行错误\n\t\t$ShowTPL = str_replace('\\\\','\\\\\\\\',$ShowTPL);\n \t\t//修复双引号问题\n\t\t$ShowTPL = str_replace('\"','\\\"',$ShowTPL);\n\t\t\n\t\t//编译运算\n \t\t$ShowTPL = @preg_replace($this->Compile, $this->Analysis, $ShowTPL);\n \t\t\n\t\t//分析图片地址\n \t\t$ShowTPL = $this->ImgCheck($ShowTPL);\n \t\t\n \t\t//Fix 模板中金钱符号\n \t\t$ShowTPL = str_replace('$','\\$',$ShowTPL);\n \t\t\n\t\t\t//修复php运行错误\n\t\t\t$ShowTPL = @preg_replace(\"/\\\";(.+?)echo\\\"/e\", '$this->FixPHP(\\'\\\\1\\')', $ShowTPL);\n\t\t\t\n\t\t\t//Fix Run 2\n\t\t\tif ($run==1){\n\t\t\t\t$ShowTPL = preg_replace(\"/\\(T_T\\)(.+?)\\(T_T!\\)/ise\", '$this->FixPHP(\\'\\\\1\\')', $ShowTPL);\n\t\t\t}\n\t\t\t\n\t\t\t//还原xml\n\t\t\t$ShowTPL = (strrpos($ShowTPL,'<ET>'))?@preg_replace('/ET>(.+?)<\\/ET/is', '?\\\\1?', $ShowTPL):$ShowTPL;\n\t\t\t\n\t\t\t//修复\"问题\n\t\t\t$ShowTPL = str_replace('echo \"\"','echo \"\\\"',$ShowTPL);\n\t\t\t\n\t\t\t\n\t\t\t//从数组中将变量导入到当前的符号表\n\t\t\t@extract($this->Value());\n\t\t\tob_start();\n\t\t\tob_implicit_flush(0);\n\t\t\t\t@eval('echo \"'.$ShowTPL.'\";');\n\t\t\t\t$contents = ob_get_contents();\n\t\t\tob_end_clean();\n\t\t\t\n\t\t\t//Cache htm\n\t\t\tif($this->HtmID){\n\t\t\t\t$this->writer($this->HtmDir.$this->HtmID,$this->Hacker.\"?>\".$contents);\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t//编译模板\n\t\t\tif ($this->RunType=='Cache'){\n\t\t\t\t$this->CompilePHP($ShowTPL,$CacheFile);\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t//错误检查\n\t\t\tif(strlen($contents)<=0){\n\t\t\t\t//echo $ShowTPL;\n\t\t\t\tdie('<br>Sorry, Error or complicated syntax error exists in '.$SourceFile.' file.');\n\t\t\t}\n\t\t\t\n\t\treturn $contents;\n\t}\n\n\n\t/**\n\t*  多语言\n\t*/\n\tfunction lang(\n\t\t\t\t$str = ''\n\t\t\t){\n\t\tif (is_dir($this->LangDir)){\n\t\t\t\n\t\t\t//采用MD5效验\n\t\t\t$id \t = md5($str);\n\t\t\t\n\t\t\t//不存在数据则写入\n\t\t\tif($this->LangData[$id]=='' && $this->Language=='default'){\n\t\t\t\t\t\t\t\n\t\t\t\t//语言包文件\n\t\t\t\tif (@is_file($this->LangDir.$this->Language.'.php')){\n\t\t\t\t\tunset($lang);\n\t\t\t\t\t@include($this->LangDir.$this->Language.'.php');\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t//如果检测到有数据则输出\n\t\t\t\tif ($lang[$id]){\n\t\t\t\t\t\t$out\t= str_replace('\\\\','\\\\\\\\',$lang[$id]);\n\t\t\t\t\treturn str_replace('\"','\\\"',$out);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t//修复'多\\问题\n\t\t\t\t$str = str_replace(\"\\\\'\",\"'\",$str);\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t//语言文件过大时采取建立新文件\n\t\t\t\tif(strlen($docs)>400){\n\t\t\t\t\t$this->writer($this->LangDir.$this->Language.'.'.$id.'.php','<? $etl = \"'.$str.'\";?>');\n\t\t\t\t\t$docs= substr($str,0,40);\t\t//简要说明\n\t\t\t\t\t$docs = str_replace('\\\"','\"',$docs);\n\t\t\t\t\t$docs = str_replace('\\\\\\\\','\\\\',$docs);\n\t\t\t\t\t$str = 'o(O_O)o.ET Lang.o(*_*)o';\t//语言新文件\n\t\t\t\t}else{\n\t\t\t\t\t$docs = str_replace('\\\"','\"',$str);\n\t\t\t\t\t$docs = str_replace('\\\\\\\\','\\\\',$docs);\n\t\t\t\t}\n\n\t\t\t\t//文件安全处理\n\t\t\t\t$data = (!is_file($this->LangDir.'default.php'))?\"<?\\n/**\\n/* SYSTN ET Language For \".$this->Language.\"\\n*/\\n\\n\\n\":'';\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tif (trim($str)){\n\t\t\t\t\t//写入数据\n\t\t\t\t\t$data .= \"/**\".date(\"Y.m.d\",time()).\"\\n\";\n\t\t\t\t\t$data.= $docs.\"\\n\";\n\t\t\t\t\t$data.= \"*/\\n\";\n\t\t\t\t\t$data.= '$lang[\"'.$id.'\"] = \"'.$str.'\";'.\"\\n\\n\";\n\t\t\t\t\t$this->writer($this->LangDir.'default.php',$data,'a+');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t\t//单独语言文件包\n\t\t\t\tif($this->LangData[$id]=='o(O_O)o.ET Lang.o(*_*)o'){\n\t\t\t\t\tunset($etl);\n\t\t\t\t\tinclude($this->LangDir.$this->Language.\".\".$id.\".php\");\n\t\t\t\t\t$this->LangData[$id] = $etl;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$out = ($this->LangData[$id])?$this->LangData[$id]:$str;\n\t\t\t\t\n\t\t\t\t//输出部分要做处理\n\t\t\t\tif(($this->RunType=='Replace' || $this->RunType!='Replace') && $data==''){\n\t\t\t\t\t$out\t= str_replace('\\\\','\\\\\\\\',$out);\n\t\t\t\t\t$out\t= str_replace('\"','\\\"',$out);\n\t\t\t\t}\n\t\t\t\t\n\t\t\treturn $out;\n\t\t}else{\n\t\t\treturn $str;\n\t\t}\n\t}\n\n\t/**\n\t*  inc引用函数\n\t*/\n\tfunction inc_preg(\n\t\t\t\t$content\n\t\t\t){\n\t\treturn preg_replace('/<\\!--\\s*\\#include\\s*file\\s*=(\\\"|\\')([a-zA-Z0-9_\\.\\|]{1,100})(\\\"|\\')\\s*-->/eis', '$this->inc(\"\\\\2\")', preg_replace('/(\\{\\s*|<!--\\s*)inc\\:([^\\{\\} ]{1,100})(\\s*\\}|\\s*-->)/eis', '$this->inc(\"\\\\2\")', $content));\n\t}\n\n\n\t/**\n\t*  引用函数运算\n\t*/\n\tfunction inc(\n\t\t\t\t$Files = ''\n\t\t\t){\n\t\tif($Files){\n\t\t\tif (!strrpos($Files,$this->Ext)){\n\t\t\t\t$Files\t= $Files.\".\".$this->Ext;\n\t\t\t}\n\t\t\t$FileLs\t\t= $this->TemplateDir.$Files;\n\t\t\t$contents\t=$this->ParseCode($FileLs,$Files);\n\t\t\t\n\t\t\tif($this->RunType=='Cache'){\n\t\t\t\t//引用模板\n\t\t\t\t$this->IncList[] = $Files;\n\t\t\t\t$cache_file = $this->CacheDir.$this->TplID.$Files.\".\".$this->Language.\".php\";\n\t\t\t\treturn \"<!-- ET_inc_cache[\".$Files.\"] -->\n<!-- IF(@is_file('\".$cache_file.\"')) -->{inc_php:\".$cache_file.\"}\n<!-- IF(\\$EaseTemplate3_Cache) -->{run:@eval('echo \\\"'.\\$EaseTemplate3_Cache.'\\\";')}<!-- END -->\n<!-- END -->\";\n\t\t\t}elseif($this->RunType=='MemCache'){\n\t\t\t\t//cache date\n\t\t\t\tmemcache_set($this->Emc,$Files.'_date', time()) OR die(\"Failed to save data at the server.\");\n\t\t\t\tmemcache_set($this->Emc,$Files, $contents) OR die(\"Failed to save data at the server\");\n\t\t\t\treturn \"<!-- ET_inc_cache[\".$Files.\"] -->\".$contents;\n\t\t\t}else{\n\t\t\t\t//引用模板\n\t\t\t\t$this->IncList[] = $Files;\n\t\t\t\treturn $contents;\n\t\t\t}\n\t\t}\n\t}\n\n\n\t/**\n\t*  编译解析处理\n\t*/\n\tfunction CompilePHP(\n\t\t\t\t$content='',\n\t\t\t\t$cachename = ''\n\t\t\t){\n\t\tif ($content){\n\t\t\t//如果没有安全文件则自动创建\n\t\t\tif($this->RunType=='Cache' && !is_file($this->CacheDir.'index.htm')){\n\t\t\t\t$Ease_name   = 'Ease Template!';\n\t\t\t\t$Ease_base   = \"<title>$Ease_name</title><a href='http://www.systn.com'>$Ease_name</a>\";\n\t\t\t\t$this->writer($this->CacheDir.'index.htm',$Ease_base);\n\t\t\t\t$this->writer($this->CacheDir.'index.html',$Ease_base);\n\t\t\t\t$this->writer($this->CacheDir.'default.htm',$Ease_base);\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t//编译记录\n\t\t\t$content = str_replace(\"\\\\\",\"\\\\\\\\\",$content);\n\t\t\t$content = str_replace(\"'\",\"\\'\",$content);\n\t\t\t$content = str_replace('echo\"\";',\"\",$content);\t\t//替换多余数据\n\t\n\t\t\t$wfile = ($cachename)?$cachename:$this->ThisFile;\n\t\t\t$this->writer($this->FileName($wfile,$this->TplID) ,$this->Hacker.'$EaseTemplate3_Cache = \\''.$content.'\\';');\n\t\t}\n\t}\n\t\n\t\n\t//修复PHP执行时产生的错误\n\tfunction FixPHP(\n\t\t\t\t$content=''\n\t\t\t){\n\t\t$content = str_replace('\\\\\\\\','\\\\',$content);\n\t\treturn '\";'.str_replace('\\\\\"','\"',str_replace('\\$','$',$content)).'echo\"';\n\t}\n\t\n\t\n\t/**\n\t*  检测缓存是否要更新\n\t*\tfilename\t缓存文件名\n\t*\tsettime\t\t指定事件则提供更新，只用于memcache\n\t*/\n\tfunction FileUpdate($filname,$settime=0){\n\t\t\n\t\t//检测设置模板文件\n\t\tif (is_array($this->IncFile)){\n\t\t\tunset($k,$v);\n\t\t\t$update\t\t= 0;\n\t\t\t$settime\t= ($settime>0)?$settime:@filemtime($filname);\n\t\t\tforeach ($this->IncFile AS $k=>$v) {\n\t\t\t\tif (@filemtime($v)>$settime){$update = 1;}\n\t\t\t}\n\t\t\t//更新缓存\n\t\t\tif($update==1){\n\t\t\t\treturn false;\n\t\t\t}else {\n\t\t\t\treturn $filname;\n\t\t\t}\n\t\t\t\n\t\t}else{\n\t\t\treturn $filname;\n\t\t}\n\t}\n\t\n\t\n\t/**\n\t*\t输出运算\n\t*   Filename\t连载编译输出文件名\n\t*/\n\tfunction output(\n\t\t\t\t$Filename = ''\n\t\t\t){\n\t\tswitch($this->RunType){\n\t\t\t\n\t\t\t//Mem编译模式\n\t\t\tcase'MemCache':\n\t\t\t\tif ($Filename=='include_page'){\n\t\t\t\t\t//直接输出文件\n\t\t\t\t\treturn $this->reader($this->FileDir[$this->ThisFile].$this->ThisFile);\n\t\t\t\t}else{\n\t\t\t\t\t\n\t\t\t\t\t$FileNames\t= ($Filename)?$Filename:$this->ThisFile;\n\t\t\t\t\t$CacheFile\t= $this->FileName($FileNames,$this->TplID);\n\t\t\t\t\t\n\t\t\t\t\t//检测记录时间\n\t\t\t\t\t$updateT\t= memcache_get($this->Emc,$CacheFile.'_date');\n\t\t\t\t\t$update\t\t= $this->FileUpdate($CacheFile,$updateT);\n\t\t\t\t\t\n\t\t\t\t\t$CacheData = memcache_get($this->Emc,$CacheFile);\n\t\t\t\t\t\n\t\t\t\t\tif(trim($CacheData) && $update){\n\t\t\t\t\t\t\t//获得列表文件\n\t\t\t\t\t\t\t\tunset($ks,$vs);\n\t\t\t\t\t\t\t\tpreg_match_all('/<\\!-- ET\\_inc\\_cache\\[(.+?)\\] -->/',$CacheData, $IncFile);\n\t\t\t\t\t\t\t\tif (is_array($IncFile[1])){\n\t\t\t\t\t\t\t\t\tforeach ($IncFile[1] AS $ks=>$vs) {\n\t\t\t\t\t\t\t\t\t\t$this->IncList[] = $vs;\n\t\t\t\t\t\t\t\t\t\t$listDate\t= memcache_get($this->Emc,$vs.'_date');\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\techo @filemtime($this->TemplateDir.$vs).' - '.$listDate.'<br>';\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t//更新inc缓存\n\t\t\t\t\t\t\t\t\t\tif (@filemtime($this->TemplateDir.$vs)>$listDate){\n\t\t\t\t\t\t\t\t\t\t\t$update = 1;\n\t\t\t\t\t\t\t\t\t\t\t$this->inc($vs);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t//更新数据\n\t\t\t\t\t\t\t\t\tif ($update == 1){\n\t\t\t\t\t\t\t\t\t\t$CacheData\t= $this->ParseCode($this->FileList,$Filename);\n\t\t\t\t\t\t\t\t\t\t//cache date\n\t\t\t\t\t\t\t\t\t\t@memcache_set($this->Emc,$CacheFile.'_date', time()) OR die(\"Failed to save data at the server.\");\n\t\t\t\t\t\t\t\t\t\t@memcache_set($this->Emc,$CacheFile, $CacheData) OR die(\"Failed to save data at the server.\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t//Close\n\t\t\t\t\t\t\tmemcache_close($this->Emc);\n\t\t\t\t\t\treturn $CacheData;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tif ($Filename){\n\t\t\t\t\t\t\t$CacheData\t= $this->ParseCode($this->FileList,$Filename);\n\t\t\t\t\t\t\t//cache date\n\t\t\t\t\t\t\t@memcache_set($this->Emc,$CacheFile.'_date', time()) OR die(\"Failed to save data at the server.\");\n\t\t\t\t\t\t\t@memcache_set($this->Emc,$CacheFile, $CacheData) OR die(\"Failed to save data at the server.\");\n\t\t\t\t\t\t\t//Close\n\t\t\t\t\t\t\tmemcache_close($this->Emc);\n\t\t\t\t\t\t\treturn $CacheData;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$CacheData\t= $this->ParseCode();\n\t\t\t\t\t\t\t//cache date\n\t\t\t\t\t\t\t@memcache_set($this->Emc,$CacheFile.'_date', time()) OR die(\"Failed to save data at the server.\");\n\t\t\t\t\t\t\t@memcache_set($this->Emc,$CacheFile, $CacheData) OR die(\"Failed to save data at the server2\");\n\t\t\t\t\t\t\t//Close\n\t\t\t\t\t\t\tmemcache_close($this->Emc);\n\t\t\t\t\t\t\treturn $CacheData;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tbreak;\n\t\t\t\n\t\t\t\n\t\t\t//编译模式\n\t\t\tcase'Cache':\n\t\t\t\tif ($Filename=='include_page'){\n\t\t\t\t\t//直接输出文件\n\t\t\t\t\treturn $this->reader($this->FileDir[$this->ThisFile].$this->ThisFile);\n\t\t\t\t}else{\n\t\t\t\t\t\n\t\t\t\t\t$FileNames = ($Filename)?$Filename:$this->ThisFile;\n\t\t\t\t\t$CacheFile = $this->FileName($FileNames,$this->TplID);\n\t\t\t\t\t\n\t\t\t\t\t$CacheFile = $this->FileUpdate($CacheFile);\n\t\t\t\t\t\n\t\t\t\t\tif (@is_file($CacheFile)){\n\t\t\t\t\t\t@extract($this->Value());\n\t\t\t\t\t\tob_start();\n\t\t\t\t\t\tob_implicit_flush(0);\n\t\t\t\t\t\t\tinclude $CacheFile;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//获得列表文件\n\t\t\t\t\t\t\tif($EaseTemplate3_Cache!=''){\n\t\t\t\t\t\t\t\tunset($ks,$vs);\n\t\t\t\t\t\t\t\tpreg_match_all('/<\\!-- ET\\_inc\\_cache\\[(.+?)\\] -->/',$EaseTemplate3_Cache, $IncFile);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (is_array($IncFile[1])){\n\t\t\t\t\t\t\t\t\tforeach ($IncFile[1] AS $ks=>$vs) {\n\t\t\t\t\t\t\t\t\t\t$this->IncList[] = $vs;\n\t\t\t\t\t\t\t\t\t\t//更新inc缓存\n\t\t\t\t\t\t\t\t\t\tif (@filemtime($this->TemplateDir.$vs)>@filemtime($this->CacheDir.$this->TplID.$vs.'.'.$this->Language.'.php')){\n\t\t\t\t\t\t\t\t\t\t\t$this->inc($vs);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t@eval('echo \"'.$EaseTemplate3_Cache.'\";');\n\t\t\t\t\t\t\t\t$contents = ob_get_contents();\n\t\t\t\t\t\t\t\tob_end_clean();\n\t\t\t\t\t\t\t\treturn $contents;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\tif ($Filename){\n\t\t\t\t\t\t\treturn $this->ParseCode($this->FileList,$Filename);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\treturn $this->ParseCode();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tbreak;\n\t\t\t\n\t\t\t\n\t\t\t//替换引擎\n\t\t\tdefault:\n\t\t\t\tif($Filename){\n\t\t\t\t\tif ($Filename=='include_page'){\n\t\t\t\t\t\t//直接输出文件\n\t\t\t\t\t\treturn $this->reader($this->FileDir[$this->ThisFile].$this->ThisFile);\n\t\t\t\t\t}else {\n\t\t\t\t\t\treturn $this->ParseCode($this->FileList);\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\treturn $this->ParseCode();\n\t\t\t\t}\n\t\t}\n\t}\n\n\n\t/**\n\t*  连载函数\n\t*/\n\tfunction n(){\n\t\t//连载模板\n\t\t$this->FileList[$this->ThisFile] = $this->FileDir[$this->ThisFile];\n\t}\n\n\n\t/**\n\t*\t输出模板内容\n\t*   Filename\t连载编译输出文件名\n\t*/\n\tfunction r(\n\t\t\t\t$Filename = ''\n\t\t\t){\n\t\treturn $this->output($Filename);\n\t}\n\n\n\t/**\n\t*\t打印模板内容\n\t*   Filename\t连载编译输出文件名\n\t*/\n\tfunction p(\n\t\t\t\t$Filename = ''\n\t\t\t){\n\t\techo $this->output($Filename);\n\t}\n\n\n\t/**\n\t*\t分析图片地址\n\t*/\n\tfunction ImgCheck(\n\t\t\t\t$content\n\t\t\t){\n\t\t//Check Image Dir\n\t\tif($this->AutoImage==1){\n\t\t\t$NewFileDir = $this->FileDir[$this->ThisFile];\n\t\t\t\n   \t\t\t//FIX img\n\t\t\tif(is_array($this->ImgDir)){\n\t\t\t\tforeach($this->ImgDir AS $rep){\n\t\t\t\t\t$rep = trim($rep);\n\t\t\t\t\t//检测是否执行替换\n\t\t\t\t\tif(strrpos($content,$rep.\"/\")){\n\t\t\t\t\t\tif(substr($rep,-1)=='/'){\n\t\t\t\t\t\t\t$rep = substr($rep,0,strlen($rep)-1);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$content = str_replace($rep.'/',$NewFileDir.$rep.'/',$content);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//FIX Dir\n\t\t\t$NewFileDirs = $NewFileDir.$NewFileDir;\n\t\t\tif(strrpos($content,$NewFileDirs)){\n\t\t\t\t$content = str_replace($NewFileDirs,$NewFileDir,$content);\n\t\t\t}\n\t\t}\n\t\treturn $content;\n\t}\n\n\n\t/**\n\t*\t获得所有设置与公共变量\n\t*/\n\tfunction Value(){\n\t\treturn (is_array($this->ThisValue))?array_merge($this->ThisValue,$GLOBALS):$GLOBALS;\n\t}\n\n\n\t/**\n\t*\t清除设置\n\t*/\n\tfunction clear(){\n\t\t$this->RunType = 'Replace';\n\t}\n\n\n\t/**\n\t*  静态文件写入\n\t*/\n\tfunction htm_w(\n\t\t\t\t$w_dir = '',\n\t\t\t\t$w_filename = '',\n\t\t\t\t$w_content = ''\n\t\t\t){\n\n\t\t$dvs  = '';\n\t\tif($w_dir && $w_filename && $w_content){\n\t\t\t//目录检测数量\n\t\t\t$w_dir_ex  = explode('/',$w_dir);\n\t\t\t$w_new_dir = '';\t//处理后的写入目录\n\t\t\tunset($dvs,$fdk,$fdv,$w_dir_len);\n\t\t\tforeach((array)$w_dir_ex AS $dvs){\n\t\t\t\tif(trim($dvs) && $dvs!='..'){\n\t\t\t\t\t$w_dir_len .= '../';\n\t\t\t\t\t$w_new_dir .= $dvs.'/';\n\t\t\t\t\tif (!@is_dir($w_new_dir)) @mkdir($w_new_dir, 0777);\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\t//获得需要更改的目录数\n\t\t\tforeach((array)$this->FileDir AS $fdk=>$fdv){\n\t\t\t\t$w_content = str_replace($fdv,$w_dir_len.str_replace('../','',$fdv),$w_content);\n\t\t\t}\n\n\t\t\t$this->writer($w_dir.$w_filename,$w_content);\n\t\t}\n\t}\n\n\n\t/**\n\t*  改变静态刷新时间\n\t*/\n\tfunction htm_time($times=0){\n\t\tif((int)$times>0){\n\t\t\t$this->HtmTime = (int)$times;\n\t\t}\n\t}\n\n\n\t/**\n\t*  静态文件存放的绝对目录\n\t*/\n\tfunction htm_dir($Name = ''){\n\t\tif(trim($Name)){\n\t\t\t$this->HtmDir = trim($Name).'/';\n\t\t}\n\t}\n\n\n\t/**\n\t*  产生静态文件输出\n\t*/\n\tfunction HtmCheck(\n\t\t\t\t$Name = ''\n\t\t\t){\n\t\t$this->HtmID = md5(trim($Name)? trim($Name).'.php' : $this->Server['REQUEST_URI'].'.php' );\n\t\t//检测时间\n\t\tif(is_file($this->HtmDir.$this->HtmID) && (time() - @filemtime($this->HtmDir.$this->HtmID)<=$this->HtmTime)){\n\t\t\tob_start();\n\t\t\tob_implicit_flush(0);\n\t\t\t\tinclude $this->HtmDir.$this->HtmID;\n\t\t\t\t$HtmContent = ob_get_contents();\n\t\t\tob_end_clean();\n\t\t\treturn $HtmContent;\n\t\t}\n\t}\n\n\n\t/**\n\t*  打印静态内容\n\t*/\n\tfunction htm_p(\n\t\t\t\t$Name = ''\n\t\t\t){\n\t\t$output = $this->HtmCheck($Name);\n\t\tif ($output){\n\t\t\tdie($this->HtmCheck($Name));\n\t\t}\n\t}\n\n\n\t/**\n\t*  输出静态内容\n\t*/\n\tfunction htm_r(\n\t\t\t\t$Name = ''\n\t\t\t){\n\t\treturn $this->HtmCheck($Name);\n\t}\n\n\n\n\n\n\t/**\n\t*\t解析文件\n\t*/\n\tfunction FileName(\n\t\t\t\t$name,\n\t\t\t\t$id = '1'\n\t\t\t){\n\t\t$extdir = explode(\"/\",$name);\n\t\t$dircnt = @count($extdir) - 1;\n\t\t$extdir[$dircnt] = $id.$extdir[$dircnt];\n\t\t\n\t\treturn $this->CacheDir.implode(\"_\",$extdir).\".\".$this->Language.'.php';\n\t}\n\n\n\t/**\n\t*  检测引入文件\n\t*/\n\tfunction inc_php(\n\t\t\t\t$url = ''\n\t\t\t){\n\t\t$parse\t= parse_url($url);\n\t\tunset($vals,$code_array);\n\t\tforeach((array)explode('&',$parse['query']) AS $vals){\n\t\t\t$code_array .= preg_replace('/(.+)=(.+)/',\"\\$_GET['\\\\1']= \\$\\\\1 ='\\\\2';\",$vals);\n\t\t}\n\t\treturn '\";'.$code_array.' @include(\\''.$parse['path'].'\\');echo\"';\n\t}\n\n\n\t/**\n\t*\t换行函数\n\t*\tRow(换行数,换行颜色);\n\t*\tRow(\"5,#ffffff:#e1e1e1\");\n\t*/\n\tfunction Row(\n\t\t\t\t$Num = ''\n\t\t\t){\n\t\t$Num = trim($Num);\n\t\tif($Num != ''){\n\t\t\t$Nums  = explode(\",\",$Num);\n\t\t\t$Numr  = ((int)$Nums[0]>0)?(int)$Nums[0]:2;\n\t\t\t$input = (trim($Nums[1]) == '')?'</tr><tr>':$Nums[1];\n\n\t\t\tif(trim($Nums[1]) != ''){\n\t\t\t\t$Co\t \t= explode(\":\",$Nums[1]);\n\t\t\t\t$OutStr = \"if(\\$_i%$Numr===0){\\$row_count++;echo(\\$row_count%2===0)?'</tr><tr bgcolor=\\\"$Co[0]\\\">':'</tr><tr bgcolor=\\\"$Co[1]\\\">';}\";\n\t\t\t}else{\n\t\t\t\t$OutStr = \"if(\\$_i%$Numr===0){echo '$input';}\";\n\t\t\t}\n\t\t\treturn '\";'.$OutStr.'echo \"';\n\t\t}\n\t}\n\n\n\t/**\n\t*\t间隔变色\n\t*\tColor(两组颜色代码);\n\t*\tColor('#FFFFFF,#DCDCDC');\n\t*/\n\tfunction Color(\n\t\t\t\t$color = ''\n\t\t\t){\n\t\tif($color != ''){\n\t\t\t$OutStr = preg_replace(\"/(.+),(.+)/\",\"_i%2===0)?'\\\\1':'\\\\2';\",$color);\n\t\t\tif(strrpos($OutStr,\"%2\")){\n\t\t\t\treturn '\";echo(\\$'.$OutStr.'echo \"';\n\t\t\t}\n\t\t}\n\t}\n\n\n\t/**\n\t*\t映射图片地址\n\t*/\n\tfunction Dirs(\n\t\t\t\t$adds = ''\n\t\t\t){\n\t\t$adds_ary = explode(\",\",$adds);\n\t\tif(is_array($adds_ary)){\n\t\t\t$this->ImgDir = (is_array($this->ImgDir))?@array_merge($adds_ary, $this->ImgDir):$adds_ary;\n\t\t}\n\t}\n\n\n\t/**\n\t*\t读取函数\n\t*\treader(文件名);\n\t*/\n\tfunction reader(\n\t\t\t\t$filename\n\t\t\t){\n\t\t$get_fun = @get_defined_functions();\n\t\treturn (in_array('file_get_contents',$get_fun['internal']))?@file_get_contents($filename):@implode(\"\", @file($filename));\n\t}\n\n\n\t/**\n\t*\t写入函数\n\t*\twriter(文件名,写入数据, 写入数据方式);\n\t*/\n\tfunction writer(\n\t\t\t\t$filename,\n\t\t\t\t$data = '',\n\t\t\t\t$mode='w'\n\t\t\t){\n\t\tif(trim($filename)){\n\t\t\t$file = @fopen($filename, $mode);\n\t\t\t  $filedata = @fwrite($file, $data);\n\t\t\t@fclose($file);\n\t\t}\n\t\tif(!is_file($filename)){\n\t\t\tdie('Sorry,'.$filename.' file write in failed!');\n\t\t}\n\t}\n\n\n\t/**\n\t*\t引入模板系统\n\t*\t察看当前使用的模板以及调试信息\n\t*/\n\tfunction inc_list(){\n\t\tif(is_array($this->IncList)){\n\t\t\t$EXTS = explode(\"/\",$this->Server['REQUEST_URI']);\n\t\t\t$Last = count($EXTS) -1;\n\t\t\t//处理清除工作 START\n\t\t\tif(strrpos($EXTS[$Last],'Ease_Templatepage=Clear') && trim($EXTS[$Last]) != ''){\n\t\t\t\t$dir_name = $this->CacheDir;\n\t\t\t\tif(file_exists($dir_name)){\n\t\t\t\t\t$handle=@opendir($dir_name);\n\t\t\t\t\twhile($tmp_file=@readdir($handle)){\n\t\t\t\t\t\tif(@file_exists($dir_name.$tmp_file)){\n\t\t\t\t\t\t\t@unlink($dir_name.$tmp_file);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t@closedir($handle);\n\t\t\t\t}\n\t\t\t\t$GoURL = urldecode(preg_replace(\"/.+?REFERER=(.+?)!!!/\",\"\\\\1\",$EXTS[$Last]));\n\n\t\t\t\tdie('<script language=\"javascript\" type=\"text/javascript\">location=\"'.urldecode($GoURL).'\";</script>');\n\t\t\t}\n\t\t\t//处理清除工作 END\n\n\t\t\t$list_file\t= array();\n\t\t\t$file_nums\t= count($this->IncList);\n\t\t\t$AllSize\t= 0;\n\t\t\tforeach($this->IncList AS $Ks=>$Vs){\n\t\t\t\t$FSize[$Ks] = @filesize($this->TemplateDir.$Vs);\n\t\t\t\t$AllSize   += $FSize[$Ks];\n\t\t\t}\n\n\t\t\tforeach($this->IncList AS $K=>$V){\n\t\t\t\t$File_Size   = @round($FSize[$K] / 1024 * 100) / 100 . 'KB';\n\t\t\t\t$Fwidth\t     = @floor(100*$FSize[$K]/$AllSize);\n\t\t\t\t$list_file[] = \"<tr><td colspan=\\\"2\\\" bgcolor=\\\"#F7F7F7\\\" title='\".$Fwidth.\"%'><a href='\".$this->TemplateDir.$V.\"' target='_blank'><font color='#6F7D84' style='font-size:14px;'>\".$this->TemplateDir.$V.\"</font></a>\n\t\t\t\t<font color='#B4B4B4' style='font-size:10px;'>\".$File_Size.\"</font>\n\t\t\t\t<table border='1' width='\".$Fwidth.\"%' style='border-collapse: collapse' bordercolor='#89A3ED' bgcolor='#4886B3'><tr><td></td></tr></table></td></tr>\";\n\t\t\t}\n\n\t\t\t//连接地址\n\t\t\t$BackURL = preg_replace(\"/.+\\//\",\"\\\\1\",$this->Server['REQUEST_URI']);\n\t\t\t$NowPAGE = 'http://'.$this->Server['HTTP_HOST'].$this->Server['SCRIPT_NAME'];\n\t\t\t$clear_link = $NowPAGE.\"?Ease_Templatepage=Clear&REFERER=\".urlencode($BackURL).\"!!!\";\n\t\t\t$sf13    = ' style=\"font-size:13px;color:#666666\"';\n\t\t\techo '<br><table border=\"1\" width=\"100%\" cellpadding=\"3\" style=\"border-collapse: collapse\" bordercolor=\"#DCDCDC\">\n<tr bgcolor=\"#B5BDC1\"><td><font color=#000000 style=\"font-size:16px;\"><b>Include Templates (Num:'.count($this-> IncList).')</b></font></td>\n<td align=\"right\">';\n\nif($this->RunType=='Cache'){\n\techo '[<a onclick=\"alert(\\'Cache file is successfully deleted\\');location=\\''.$clear_link.'\\';return false;\" href=\"'.$clear_link.'\"><font'.$sf13.'>Clear Cache</font></a>]';\n}\n\necho '</td></tr><tr><td colspan=\"2\" bgcolor=\"#F7F7F7\"><table border=\"0\" width=\"100%\" cellpadding=\"0\" style=\"border-collapse: collapse\">\n<tr><td'.$sf13.'>Cache File ID: <b>'.substr($this->TplID,0,-1).'</b></td>\n<td'.$sf13.'>Index: <b>'.((count($this->FileList)==0)?'False':'True').'</b></td>\n<td'.$sf13.'>Format: <b>'.$this->Ext.'</b></td>\n<td'.$sf13.'>Cache: <b>'.($this->RunType=='MemCache'?'Memcache Engine':($this->RunType == 'Replace'?'Replace Engine':$this->CacheDir)).'</b></td>\n<td'.$sf13.'>Template: <b>'.$this->TemplateDir.'</b></td></tr>\n</table></td></tr>'.implode(\"\",$list_file).\"</table>\";\n\t\t}\n\t}\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/EaseTemplate/template.ease.php",
    "content": "<?php\n/* \n * Edition:\tET080708\n * Desc:\tET Template\n * File:\ttemplate.ease.php\n * Author:\tDavid Meng\n * Site:\thttp://www.systn.com\n * Email:\tmdchinese@gmail.com\n * \n */\n\n//引入核心文件\nif (is_file(dirname(__FILE__).'/template.core.php')){\n\tinclude dirname(__FILE__).'/template.core.php';\n}else {\n\tdie('Sorry. Not load core file.');\n}\n\nClass template extends ETCore{\n\t\n\t/**\n\t*\t声明模板用法\n\t*/\n\tfunction template(\n\t\t$set = array(\n\t\t\t\t'ID'\t\t =>'1',\t\t\t\t\t//缓存ID\n\t\t\t\t'TplType'\t =>'htm',\t\t\t\t//模板格式\n\t\t\t\t'CacheDir'\t =>'cache',\t\t\t\t//缓存目录\n\t\t\t\t'TemplateDir'=>'template' ,\t\t\t//模板存放目录\n\t\t\t\t'AutoImage'\t =>'on' ,\t\t\t\t//自动解析图片目录开关 on表示开放 off表示关闭\n\t\t\t\t'LangDir'\t =>'language' ,\t\t\t//语言文件存放的目录\n\t\t\t\t'Language'\t =>'default' ,\t\t\t//语言的默认文件\n\t\t\t\t'Copyright'\t =>'off' ,\t\t\t\t//版权保护\n\t\t\t\t'MemCache'\t =>'' ,\t\t\t\t\t//Memcache服务器地址例如:127.0.0.1:11211\n\t\t\t)\n\t\t){\n\t\t\n\t\tparent::ETCoreStart($set);\n\t}\n\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Hprose/HproseClassManager.php",
    "content": "<?php\n/**********************************************************\\\n|                                                          |\n|                          hprose                          |\n|                                                          |\n| Official WebSite: http://www.hprose.com/                 |\n|                   http://www.hprose.net/                 |\n|                   http://www.hprose.org/                 |\n|                                                          |\n\\**********************************************************/\n\n/**********************************************************\\\n *                                                        *\n * HproseClassManager.php                                 *\n *                                                        *\n * hprose class manager library for php5.                 *\n *                                                        *\n * LastModified: Nov 12, 2013                             *\n * Author: Ma Bingyao <andot@hprfc.com>                   *\n *                                                        *\n\\**********************************************************/\n\nclass HproseClassManager {\n    private static $classCache1 = array();\n    private static $classCache2 = array();\n    public static function register($class, $alias) {\n        self::$classCache1[$alias] = $class;\n        self::$classCache2[$class] = $alias;        \n    }\n    public static function getClassAlias($class) {\n        if (array_key_exists($class, self::$classCache2)) {\n            return self::$classCache2[$class];\n        }\n        $alias = str_replace('\\\\', '_', $class);\n        self::register($class, $alias);\n        return $alias;\n    }\n    public static function getClass($alias) {\n        if (array_key_exists($alias, self::$classCache1)) {\n            return self::$classCache1[$alias];\n        }\n        if (!class_exists($alias)) {\n            $class = str_replace('_', '\\\\', $alias);\n            if (class_exists($class)) {\n                self::register($class, $alias);\n                return $class;\n            }\n            eval(\"class \" . $alias . \" { }\");\n        }\n        return $alias;\n    }\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Hprose/HproseClient.php",
    "content": "<?php\n/**********************************************************\\\n|                                                          |\n|                          hprose                          |\n|                                                          |\n| Official WebSite: http://www.hprose.com/                 |\n|                   http://www.hprose.net/                 |\n|                   http://www.hprose.org/                 |\n|                                                          |\n\\**********************************************************/\n\n/**********************************************************\\\n *                                                        *\n * HproseClient.php                                       *\n *                                                        *\n * hprose client library for php5.                        *\n *                                                        *\n * LastModified: Nov 13, 2013                             *\n * Author: Ma Bingyao <andot@hprfc.com>                   *\n *                                                        *\n\\**********************************************************/\n\nrequire_once('HproseCommon.php');\nrequire_once('HproseIO.php');\n\nabstract class HproseClient {\n    protected $url;\n    private $filter;\n    private $simple;\n    protected abstract function send($request);\n    public function __construct($url = '') {\n        $this->useService($url);\n        $this->filter = NULL;\n        $this->simple = false;\n    }\n    public function useService($url = '', $namespace = '') {\n        if ($url) {\n            $this->url = $url;\n        }\n        return new HproseProxy($this, $namespace);\n    }\n    public function invoke($functionName, &$arguments = array(), $byRef = false, $resultMode = HproseResultMode::Normal, $simple = NULL) {\n        if ($simple === NULL) $simple = $this->simple;\n        $stream = new HproseStringStream(HproseTags::TagCall);\n        $hproseWriter = ($simple ? new HproseSimpleWriter($stream) : new HproseWriter($stream));\n        $hproseWriter->writeString($functionName);\n        if (count($arguments) > 0 || $byRef) {\n            $hproseWriter->reset();\n            $hproseWriter->writeList($arguments);\n            if ($byRef) {\n                $hproseWriter->writeBoolean(true);\n            }\n        }\n        $stream->write(HproseTags::TagEnd);\n        $request = $stream->toString();\n        if ($this->filter) $request = $this->filter->outputFilter($request);\n        $stream->close();\n        $response = $this->send($request);\n        if ($this->filter) $response = $this->filter->inputFilter($response);\n        if ($resultMode == HproseResultMode::RawWithEndTag) {\n            return $response;\n        }\n        if ($resultMode == HproseResultMode::Raw) {\n            return substr($response, 0, -1);\n        }\n        $stream = new HproseStringStream($response);\n        $hproseReader = new HproseReader($stream);\n        $result = NULL;\n        while (($tag = $hproseReader->checkTags(\n            array(HproseTags::TagResult,\n                  HproseTags::TagArgument,\n                  HproseTags::TagError,\n                  HproseTags::TagEnd))) !== HproseTags::TagEnd) {\n            switch ($tag) {\n                case HproseTags::TagResult:\n                    if ($resultMode == HproseResultMode::Serialized) {\n                        $result = $hproseReader->readRaw()->toString();\n                    }\n                    else {\n                        $hproseReader->reset();\n                        $result = &$hproseReader->unserialize();\n                    }\n                    break;\n                case HproseTags::TagArgument:\n                    $hproseReader->reset();\n                    $args = &$hproseReader->readList(true);\n                    for ($i = 0; $i < count($arguments); $i++) {\n                        $arguments[$i] = &$args[$i];\n                    }\n                    break;\n                case HproseTags::TagError:\n                    $hproseReader->reset();\n                    throw new HproseException($hproseReader->readString(true));\n                    break;\n            }\n        }\n        return $result;\n    }\n    public function getFilter() {\n        return $this->filter;\n    }\n    public function setFilter($filter) {\n        $this->filter = $filter;\n    }\n    public function getSimpleMode() {\n        return $this->simple;\n    }\n    public function setSimpleMode($simple = true) {\n        $this->simple = $simple;\n    }\n    public function __call($function, $arguments) {\n        return $this->invoke($function, $arguments);\n    }\n    public function __get($name) {\n        return new HproseProxy($this, $name . '_');\n    }\n}\n\nclass HproseProxy {\n    private $client;\n    private $namespace;\n    public function __construct($client, $namespace = '') {\n        $this->client = $client;\n        $this->namespace = $namespace;\n    }\n    public function __call($function, $arguments) {\n        $function = $this->namespace . $function;\n        return $this->client->invoke($function, $arguments);\n    }\n    public function __get($name) {\n        return new HproseProxy($this->client, $this->namespace . $name . '_');\n    }\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Hprose/HproseCommon.php",
    "content": "<?php\n/**********************************************************\\\n|                                                          |\n|                          hprose                          |\n|                                                          |\n| Official WebSite: http://www.hprose.com/                 |\n|                   http://www.hprose.net/                 |\n|                   http://www.hprose.org/                 |\n|                                                          |\n\\**********************************************************/\n\n/**********************************************************\\\n *                                                        *\n * HproseCommon.php                                       *\n *                                                        *\n * hprose common library for php5.                        *\n *                                                        *\n * LastModified: Nov 15, 2013                             *\n * Author: Ma Bingyao <andot@hprfc.com>                   *\n *                                                        *\n\\**********************************************************/\n\nclass HproseResultMode {\n    const Normal = 0;\n    const Serialized = 1;\n    const Raw = 2;\n    const RawWithEndTag = 3;\n}\n\nclass HproseException extends Exception {}\n\ninterface HproseFilter {\n    function inputFilter($data);\n    function outputFilter($data);    \n}\n\nclass HproseDate {\n    public $year;\n    public $month;\n    public $day;\n    public $utc = false;    \n    public function __construct() {\n        $args_num = func_num_args();\n        $args = func_get_args();\n        switch ($args_num) {\n            case 0:\n                $time = getdate();\n                $this->year = $time['year'];\n                $this->month = $time['mon'];\n                $this->day = $time['mday'];\n                break;\n            case 1:\n                $time = false;\n                if (is_int($args[0])) {\n                    $time = getdate($args[0]);\n                }\n                elseif (is_string($args[0])) {\n                    $time = getdate(strtotime($args[0]));\n                }\n                if (is_array($time)) {\n                    $this->year = $time['year'];\n                    $this->month = $time['mon'];\n                    $this->day = $time['mday'];\n                }\n                elseif ($args[0] instanceof HproseDate) {\n                    $this->year = $args[0]->year;\n                    $this->month = $args[0]->month;\n                    $this->day = $args[0]->day;\n                }\n                else {\n                    throw new HproseException('Unexpected arguments');\n                }\n                break;\n            case 4:\n                $this->utc = $args[3];\n            case 3:\n                if (!self::isValidDate($args[0], $args[1], $args[2])) {\n                    throw new HproseException('Unexpected arguments');\n                }\n                $this->year = $args[0];\n                $this->month = $args[1];\n                $this->day = $args[2];\n                break;\n            default:\n                throw new HproseException('Unexpected arguments');\n        }\n    }\n    public function addDays($days) {\n        if (!is_int($days)) return false;\n        $year = $this->year;\n        if ($days == 0) return true;\n        if ($days >= 146097 || $days <= -146097) {\n            $remainder = $days % 146097;\n            if ($remainder < 0) {\n                $remainder += 146097;\n            }\n            $years = 400 * (int)(($days - $remainder) / 146097);\n            $year += $years;\n            if ($year < 1 || $year > 9999) return false;\n            $days = $remainder;\n        }\n        if ($days >= 36524 || $days <= -36524) {\n            $remainder = $days % 36524;\n            if ($remainder < 0) {\n                $remainder += 36524;\n            }\n            $years = 100 * (int)(($days - $remainder) / 36524);\n            $year += $years;\n            if ($year < 1 || $year > 9999) return false;\n            $days = $remainder;\n        }\n        if ($days >= 1461 || $days <= -1461) {\n            $remainder = $days % 1461;\n            if ($remainder < 0) {\n                $remainder += 1461;\n            }\n            $years = 4 * (int)(($days - $remainder) / 1461);\n            $year += $years;\n            if ($year < 1 || $year > 9999) return false;\n            $days = $remainder;\n        }\n        $month = $this->month;\n        while ($days >= 365) {\n            if ($year >= 9999) return false;\n            if ($month <= 2) {\n                if ((($year % 4) == 0) ? (($year % 100) == 0) ? (($year % 400) == 0) : true : false) {\n                    $days -= 366;\n                }\n                else {\n                    $days -= 365;\n                }\n                $year++;\n            }\n            else {\n                $year++;\n                if ((($year % 4) == 0) ? (($year % 100) == 0) ? (($year % 400) == 0) : true : false) {\n                    $days -= 366;\n                }\n                else {\n                    $days -= 365;\n                }\n            }\n        }\n        while ($days < 0) {\n            if ($year <= 1) return false;\n            if ($month <= 2) {\n                $year--;\n                if ((($year % 4) == 0) ? (($year % 100) == 0) ? (($year % 400) == 0) : true : false) {\n                    $days += 366;\n                }\n                else {\n                    $days += 365;\n                }\n            }\n            else {\n                if ((($year % 4) == 0) ? (($year % 100) == 0) ? (($year % 400) == 0) : true : false) {\n                    $days += 366;\n                }\n                else {\n                    $days += 365;\n                }\n                $year--;\n            }\n        }\n        $daysInMonth = cal_days_in_month(CAL_GREGORIAN, $month, $year);\n        $day = $this->day;\n        while ($day + $days > $daysInMonth) {\n            $days -= $daysInMonth - $day + 1;\n            $month++;\n            if ($month > 12) {\n                if ($year >= 9999) return false;\n                $year++;\n                $month = 1;\n            }\n            $day = 1;\n            $daysInMonth = cal_days_in_month(CAL_GREGORIAN, $month, $year);\n        }\n        $day += $days;\n        $this->year = $year;\n        $this->month = $month;\n        $this->day = $day;\n        return true;\n    }\n    public function addMonths($months) {\n        if (!is_int($months)) return false;\n        if ($months == 0) return true;\n        $month = $this->month + $months;\n        $months = ($month - 1) % 12 + 1;\n        if ($months < 1) {\n            $months += 12;\n        }\n        $years = (int)(($month - $months) / 12);\n        if ($this->addYears($years)) {\n            $daysInMonth = cal_days_in_month(CAL_GREGORIAN, $months, $this->year);\n            if ($this->day > $daysInMonth) {\n                $months++;\n                $this->day -= $daysInMonth;\n            }\n            $this->month = (int)$months;\n            return true;\n        }\n        else {\n            return false;\n        }\n    }\n    public function addYears($years) {\n        if (!is_int($years)) return false;\n        if ($years == 0) return true;\n        $year = $this->year + $years;\n        if ($year < 1 || $year > 9999) return false;\n        $this->year = $year;\n        return true;\n    }\n    public function timestamp() {\n        if ($this->utc) {\n            return gmmktime(0, 0, 0, $this->month, $this->day, $this->year);\n        }\n        else {\n            return mktime(0, 0, 0, $this->month, $this->day, $this->year);            \n        }\n    }\n    public function toString($fullformat = true) {\n        $format = ($fullformat ? '%04d-%02d-%02d': '%04d%02d%02d');\n        $str = sprintf($format, $this->year, $this->month, $this->day);\n        if ($this->utc) {\n            $str .= 'Z';\n        }\n        return $str;        \n    }\n    public function __toString() {\n        return $this->toString();\n    }\n\n    public static function isLeapYear($year) {\n        return (($year % 4) == 0) ? (($year % 100) == 0) ? (($year % 400) == 0) : true : false;\n    }\n    public static function daysInMonth($year, $month) {\n        if (($month < 1) || ($month > 12)) {\n            return false;\n        }\n        return cal_days_in_month(CAL_GREGORIAN, $month, $year);\n    }\n    public static function isValidDate($year, $month, $day) {\n        if (($year >= 1) && ($year <= 9999)) {\n            return checkdate($month, $day, $year);\n        }\n        return false;\n    }\n\n    public function dayOfWeek() {\n        $num = func_num_args();\n        if ($num == 3) {\n            $args = func_get_args();\n            $y = $args[0];\n            $m = $args[1];\n            $d = $args[2];\n        }\n        else {\n            $y = $this->year;\n            $m = $this->month;\n            $d = $this->day;\n        }\n        $d += $m < 3 ? $y-- : $y - 2;\n        return ((int)(23 * $m / 9) + $d + 4 + (int)($y / 4) - (int)($y / 100) + (int)($y / 400)) % 7;\n    }\n    public function dayOfYear() {\n        static $daysToMonth365 = array(0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365);\n        static $daysToMonth366 = array(0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366);\n        $num = func_num_args();\n        if ($num == 3) {\n            $args = func_get_args();\n            $y = $args[0];\n            $m = $args[1];\n            $d = $args[2];\n        }\n        else {\n            $y = $this->year;\n            $m = $this->month;\n            $d = $this->day;\n        }\n        $days = self::isLeapYear($y) ? $daysToMonth365 : $daysToMonth366;\n        return $days[$m - 1] + $d;\n    }\n}\n\nclass HproseTime {\n    public $hour;\n    public $minute;\n    public $second;\n    public $microsecond = 0;\n    public $utc = false;\n    public function __construct() {\n        $args_num = func_num_args();\n        $args = func_get_args();\n        switch ($args_num) {\n            case 0:\n                $time = getdate();\n                $timeofday = gettimeofday();\n                $this->hour = $time['hours'];\n                $this->minute = $time['minutes'];\n                $this->second = $time['seconds'];\n                $this->microsecond = $timeofday['usec'];\n                break;\n            case 1:\n                $time = false;\n                if (is_int($args[0])) {\n                    $time = getdate($args[0]);\n                }\n                elseif (is_string($args[0])) {\n                    $time = getdate(strtotime($args[0]));\n                }\n                if (is_array($time)) {\n                    $this->hour = $time['hours'];\n                    $this->minute = $time['minutes'];\n                    $this->second = $time['seconds'];\n                }\n                elseif ($args[0] instanceof HproseTime) {\n                    $this->hour = $args[0]->hour;\n                    $this->minute = $args[0]->minute;\n                    $this->second = $args[0]->second;\n                    $this->microsecond = $args[0]->microsecond;\n                }\n                else {\n                    throw new HproseException('Unexpected arguments');\n                }\n                break;\n            case 5:\n                $this->utc = $args[4];\n            case 4:\n                if (($args[3] < 0) || ($args[3] > 999999)) {\n                    throw new HproseException('Unexpected arguments');\n                }\n                $this->microsecond = $args[3];             \n            case 3:\n                if (!self::isValidTime($args[0], $args[1], $args[2])) {\n                    throw new HproseException('Unexpected arguments');\n                }\n                $this->hour = $args[0];\n                $this->minute = $args[1];\n                $this->second = $args[2];\n                break;\n            default:\n                throw new HproseException('Unexpected arguments');\n        }\n    }\n    public function timestamp() {\n        if ($this->utc) {\n            return gmmktime($this->hour, $this->minute, $this->second) +\n                   ($this->microsecond / 1000000);\n        }\n        else {\n            return mktime($this->hour, $this->minute, $this->second) +\n                   ($this->microsecond / 1000000);\n        }\n    }\n    public function toString($fullformat = true) {\n        if ($this->microsecond == 0) {\n            $format = ($fullformat ? '%02d:%02d:%02d': '%02d%02d%02d');\n            $str = sprintf($format, $this->hour, $this->minute, $this->second);\n        }\n        if ($this->microsecond % 1000 == 0) {\n            $format = ($fullformat ? '%02d:%02d:%02d.%03d': '%02d%02d%02d.%03d');\n            $str = sprintf($format, $this->hour, $this->minute, $this->second, (int)($this->microsecond / 1000));\n        }\n        else {\n            $format = ($fullformat ? '%02d:%02d:%02d.%06d': '%02d%02d%02d.%06d');\n            $str = sprintf($format, $this->hour, $this->minute, $this->second, $this->microsecond);            \n        }\n        if ($this->utc) {\n            $str .= 'Z';\n        }\n        return $str;\n    }\n    public function __toString() {\n        return $this->toString();\n    }\n    public static function isValidTime($hour, $minute, $second, $microsecond = 0) {\n        return !(($hour < 0) || ($hour > 23) ||\n            ($minute < 0) || ($minute > 59) ||\n            ($second < 0) || ($second > 59) ||\n            ($microsecond < 0) || ($microsecond > 999999));\n    }\n}\n\nclass HproseDateTime extends HproseDate {\n    public $hour;\n    public $minute;\n    public $second;\n    public $microsecond = 0;    \n    public function __construct() {\n        $args_num = func_num_args();\n        $args = func_get_args();\n        switch ($args_num) {\n            case 0:\n                $time = getdate();\n                $timeofday = gettimeofday();\n                $this->year = $time['year'];\n                $this->month = $time['mon'];\n                $this->day = $time['mday'];\n                $this->hour = $time['hours'];\n                $this->minute = $time['minutes'];\n                $this->second = $time['seconds'];\n                $this->microsecond = $timeofday['usec'];              \n                break;\n            case 1:\n                $time = false;\n                if (is_int($args[0])) {\n                    $time = getdate($args[0]);\n                }\n                elseif (is_string($args[0])) {\n                    $time = getdate(strtotime($args[0]));\n                }\n                if (is_array($time)) {\n                    $this->year = $time['year'];\n                    $this->month = $time['mon'];\n                    $this->day = $time['mday'];\n                    $this->hour = $time['hours'];\n                    $this->minute = $time['minutes'];\n                    $this->second = $time['seconds'];\n                }\n                elseif ($args[0] instanceof HproseDate) {\n                    $this->year = $args[0]->year;\n                    $this->month = $args[0]->month;\n                    $this->day = $args[0]->day;\n                    $this->hour = 0;\n                    $this->minute = 0;\n                    $this->second = 0;\n                }\n                elseif ($args[0] instanceof HproseTime) {\n                    $this->year = 1970;\n                    $this->month = 1;\n                    $this->day = 1;\n                    $this->hour = $args[0]->hour;\n                    $this->minute = $args[0]->minute;\n                    $this->second = $args[0]->second;\n                    $this->microsecond = $args[0]->microsecond;\n                }\n                elseif ($args[0] instanceof HproseDateTime) {\n                    $this->year = $args[0]->year;\n                    $this->month = $args[0]->month;\n                    $this->day = $args[0]->day;\n                    $this->hour = $args[0]->hour;\n                    $this->minute = $args[0]->minute;\n                    $this->second = $args[0]->second;\n                    $this->microsecond = $args[0]->microsecond;\n                }\n                else {\n                    throw new HproseException('Unexpected arguments');\n                }\n                break;\n            case 2:\n                if (($args[0] instanceof HproseDate) && ($args[1] instanceof HproseTime)) {\n                    $this->year = $args[0]->year;\n                    $this->month = $args[0]->month;\n                    $this->day = $args[0]->day;\n                    $this->hour = $args[1]->hour;\n                    $this->minute = $args[1]->minute;\n                    $this->second = $args[1]->second;\n                    $this->microsecond = $args[1]->microsecond;\n                }\n                else {\n                    throw new HproseException('Unexpected arguments');\n                }\n                break;\n            case 3:\n                if (!self::isValidDate($args[0], $args[1], $args[2])) {\n                    throw new HproseException('Unexpected arguments');\n                }\n                $this->year = $args[0];\n                $this->month = $args[1];\n                $this->day = $args[2];\n                $this->hour = 0;\n                $this->minute = 0;\n                $this->second = 0;\n                break;\n            case 8:\n                $this->utc = $args[7];\n            case 7:\n                if (($args[6] < 0) || ($args[6] > 999999)) {\n                    throw new HproseException('Unexpected arguments');\n                }\n                $this->microsecond = $args[6];                \n            case 6:\n                if (!self::isValidDate($args[0], $args[1], $args[2])) {\n                    throw new HproseException('Unexpected arguments');\n                }\n                if (!self::isValidTime($args[3], $args[4], $args[5])) {\n                    throw new HproseException('Unexpected arguments');\n                }\n                $this->year = $args[0];\n                $this->month = $args[1];\n                $this->day = $args[2];\n                $this->hour = $args[3];\n                $this->minute = $args[4];\n                $this->second = $args[5];\n                break;\n            default:\n                throw new HproseException('Unexpected arguments');\n        }\n    }\n    \n    public function addMicroseconds($microseconds) {\n        if (!is_int($microseconds)) return false;\n        if ($microseconds == 0) return true;\n        $microsecond = $this->microsecond + $microseconds;\n        $microseconds = $microsecond % 1000000;\n        if ($microseconds < 0) {\n            $microseconds += 1000000;\n        }\n        $seconds = (int)(($microsecond - $microseconds) / 1000000);\n        if ($this->addSeconds($seconds)) {\n            $this->microsecond = (int)$microseconds;\n            return true;\n        }\n        else {\n            return false;\n        }\n    }\n    \n    public function addSeconds($seconds) {\n        if (!is_int($seconds)) return false;\n        if ($seconds == 0) return true;\n        $second = $this->second + $seconds;\n        $seconds = $second % 60;\n        if ($seconds < 0) {\n            $seconds += 60;\n        }\n        $minutes = (int)(($second - $seconds) / 60);\n        if ($this->addMinutes($minutes)) {\n            $this->second = (int)$seconds;\n            return true;\n        }\n        else {\n            return false;\n        }\n    }\n    public function addMinutes($minutes) {\n        if (!is_int($minutes)) return false;\n        if ($minutes == 0) return true;\n        $minute = $this->minute + $minutes;\n        $minutes = $minute % 60;\n        if ($minutes < 0) {\n            $minutes += 60;\n        }\n        $hours = (int)(($minute - $minutes) / 60);\n        if ($this->addHours($hours)) {\n            $this->minute = (int)$minutes;\n            return true;\n        }\n        else {\n            return false;\n        }\n    }\n    public function addHours($hours) {\n        if (!is_int($hours)) return false;\n        if ($hours == 0) return true;\n        $hour = $this->hour + $hours;\n        $hours = $hour % 24;\n        if ($hours < 0) {\n            $hours += 24;\n        }\n        $days = (int)(($hour - $hours) / 24);\n        if ($this->addDays($days)) {\n            $this->hour = (int)$hours;\n            return true;\n        }\n        else {\n            return false;\n        }\n    }\n    public function after($when) {\n        if (!($when instanceof HproseDateTime)) {\n            $when = new HproseDateTime($when);\n        }\n        if ($this->utc != $when->utc) return ($this->timestamp() > $when->timestamp());\n        if ($this->year < $when->year) return false;\n        if ($this->year > $when->year) return true;\n        if ($this->month < $when->month) return false;\n        if ($this->month > $when->month) return true;\n        if ($this->day < $when->day) return false;\n        if ($this->day > $when->day) return true;\n        if ($this->hour < $when->hour) return false;\n        if ($this->hour > $when->hour) return true;\n        if ($this->minute < $when->minute) return false;\n        if ($this->minute > $when->minute) return true;\n        if ($this->second < $when->second) return false;\n        if ($this->second > $when->second) return true;\n        if ($this->microsecond < $when->microsecond) return false;\n        if ($this->microsecond > $when->microsecond) return true;\n        return false;\n    }\n    public function before($when) {\n        if (!($when instanceof HproseDateTime)) {\n            $when = new HproseDateTime($when);\n        }\n        if ($this->utc != $when->utc) return ($this->timestamp() < $when->timestamp());\n        if ($this->year < $when->year) return true;\n        if ($this->year > $when->year) return false;\n        if ($this->month < $when->month) return true;\n        if ($this->month > $when->month) return false;\n        if ($this->day < $when->day) return true;\n        if ($this->day > $when->day) return false;\n        if ($this->hour < $when->hour) return true;\n        if ($this->hour > $when->hour) return false;\n        if ($this->minute < $when->minute) return true;\n        if ($this->minute > $when->minute) return false;\n        if ($this->second < $when->second) return true;\n        if ($this->second > $when->second) return false;\n        if ($this->microsecond < $when->microsecond) return true;\n        if ($this->microsecond > $when->microsecond) return false;\n        return false;\n    }\n    public function equals($when) {\n        if (!($when instanceof HproseDateTime)) {\n            $when = new HproseDateTime($when);\n        }\n        if ($this->utc != $when->utc) return ($this->timestamp() == $when->timestamp());\n        return (($this->year == $when->year) &&\n            ($this->month == $when->month) &&\n            ($this->day == $when->day) &&\n            ($this->hour == $when->hour) &&\n            ($this->minute == $when->minute) &&\n            ($this->second == $when->second) &&\n            ($this->microsecond == $when->microsecond));\n    }\n    public function timestamp() {\n        if ($this->utc) {\n            return gmmktime($this->hour,\n                            $this->minute,\n                            $this->second,\n                            $this->month,\n                            $this->day,\n                            $this->year) +\n                   ($this->microsecond / 1000000);\n        }\n        else {\n            return mktime($this->hour,\n                          $this->minute,\n                          $this->second,\n                          $this->month,\n                          $this->day,\n                          $this->year) +\n                   ($this->microsecond / 1000000);\n        }\n    }\n    public function toString($fullformat = true) {\n        if ($this->microsecond == 0) {\n            $format = ($fullformat ? '%04d-%02d-%02dT%02d:%02d:%02d'\n                                   : '%04d%02d%02dT%02d%02d%02d');\n            $str = sprintf($format,\n                           $this->year, $this->month, $this->day,\n                           $this->hour, $this->minute, $this->second);\n        }\n        if ($this->microsecond % 1000 == 0) {\n            $format = ($fullformat ? '%04d-%02d-%02dT%02d:%02d:%02d.%03d'\n                                   : '%04d%02d%02dT%02d%02d%02d.%03d');\n            $str = sprintf($format,\n                           $this->year, $this->month, $this->day,\n                           $this->hour, $this->minute, $this->second,\n                           (int)($this->microsecond / 1000));\n        }        \n        else {\n            $format = ($fullformat ? '%04d-%02d-%02dT%02d:%02d:%02d.%06d'\n                                   : '%04d%02d%02dT%02d%02d%02d.%06d');\n            $str = sprintf($format,\n                           $this->year, $this->month, $this->day,\n                           $this->hour, $this->minute, $this->second,\n                           $this->microsecond);            \n        }\n        if ($this->utc) {\n            $str .= 'Z';\n        }\n        return $str;\n    }\n    public function __toString() {\n        return $this->toString();\n    }\n    public static function isValidTime($hour, $minute, $second, $microsecond = 0) {\n        return HproseTime::isValidTime($hour, $minute, $second, $microsecond);\n    }\n}\n\n/*\n integer is_utf8(string $s)\n if $s is UTF-8 String, return 1 else 0\n */\nif (function_exists('mb_detect_encoding')) {\n    function is_utf8($s) {\n        return mb_detect_encoding($s, 'UTF-8', true) === 'UTF-8';\n    }\n}\nelseif (function_exists('iconv')) {\n    function is_utf8($s) {\n        return iconv('UTF-8', 'UTF-8//IGNORE', $s) === $s;\n    }\n}\nelse {\n    function is_utf8($s) { \n        $len = strlen($s); \n        for($i = 0; $i < $len; ++$i){\n            $c = ord($s{$i});\n            switch ($c >> 4) {\n                case 0:\n                case 1:\n                case 2:\n                case 3:\n                case 4:\n                case 5:\n                case 6:\n                case 7:\n                    break;\n                case 12:\n                case 13:\n                    if ((ord($s{++$i}) >> 6) != 0x2) return false;\n                    break;\n                case 14:\n                    if ((ord($s{++$i}) >> 6) != 0x2) return false;\n                    if ((ord($s{++$i}) >> 6) != 0x2) return false;\n                    break;\n                case 15:\n                    $b = $s{++$i};\n                    if ((ord($b) >> 6) != 0x2) return false;\n                    if ((ord($s{++$i}) >> 6) != 0x2) return false;\n                    if ((ord($s{++$i}) >> 6) != 0x2) return false;\n                    if (((($c & 0xf) << 2) | (($b >> 4) & 0x3)) > 0x10) return false;\n                    break;\n                default:\n                    return false;\n            }\n        }\n        return true;\n    }\n}\n\n/*\n integer ustrlen(string $s)\n $s must be a UTF-8 String, return the Unicode code unit (not code point) length\n */\nif (function_exists('iconv')) {\n    function ustrlen($s) {\n        return strlen(iconv('UTF-8', 'UTF-16LE', $s)) >> 1;\n    }\n}\nelseif (function_exists('mb_convert_encoding')) {\n    function ustrlen($s) {\n        return strlen(mb_convert_encoding($s, \"UTF-16LE\", \"UTF-8\")) >> 1;\n    }\n}\nelse {\n    function ustrlen($s) {\n        $pos = 0;\n        $length = strlen($s);\n        $len = $length;\n        while ($pos < $length) {\n            $a = ord($s{$pos++});\n            if ($a < 0x80) {\n                continue;\n            }\n            elseif (($a & 0xE0) == 0xC0) {\n                ++$pos;\n                --$len;\n            }\n            elseif (($a & 0xF0) == 0xE0) {\n                $pos += 2;\n                $len -= 2;\n            }\n            elseif (($a & 0xF8) == 0xF0) {\n                $pos += 3;\n                $len -= 2;\n            }\n        }\n        return $len;\n    }\n}\n\n/*\n bool is_list(array $a)\n if $a is list, return true else false\n */\nfunction is_list(array $a) {\n    $count = count($a);\n    if ($count === 0) return true;\n    return !array_diff_key($a, array_fill(0, $count, NULL));\n}\n\n/*\n mixed array_ref_search(mixed &$value, array $array)\n if $value ref in $array, return the index else false\n*/\nfunction array_ref_search(&$value, &$array) {\n    if (!is_array($value)) return array_search($value, $array, true);\n    $temp = $value;\n    foreach ($array as $i => &$ref) {\n        if (($ref === ($value = 1)) && ($ref === ($value = 0))) {\n            $value = $temp;\n            return $i;\n        }\n    }\n    $value = $temp;\n    return false;\n}\n\n/*\n string spl_object_hash(object $obj)\n This function returns a unique identifier for the object.\n This id can be used as a hash key for storing objects or for identifying an object.\n*/\nif (!function_exists('spl_object_hash')) {\n    function spl_object_hash($object) {\n        ob_start();\n        var_dump($object);\n        preg_match('[#(\\d+)]', ob_get_clean(), $match);\n        return $match[1];\n    }\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Hprose/HproseFormatter.php",
    "content": "<?php\n/**********************************************************\\\n|                                                          |\n|                          hprose                          |\n|                                                          |\n| Official WebSite: http://www.hprose.com/                 |\n|                   http://www.hprose.net/                 |\n|                   http://www.hprose.org/                 |\n|                                                          |\n\\**********************************************************/\n\n/**********************************************************\\\n *                                                        *\n * HproseFormatter.php                                    *\n *                                                        *\n * hprose formatter library for php5.                     *\n *                                                        *\n * LastModified: Nov 12, 2013                             *\n * Author: Ma Bingyao <andot@hprfc.com>                   *\n *                                                        *\n\\**********************************************************/\n\nrequire_once('HproseIOStream.php');\nrequire_once('HproseReader.php');\nrequire_once('HproseWriter.php');\n\nclass HproseFormatter {\n    public static function serialize(&$var, $simple = false) {\n        $stream = new HproseStringStream();\n        $hproseWriter = ($simple ? new HproseSimpleWriter($stream) : new HproseWriter($stream));\n        $hproseWriter->serialize($var);\n        return $stream->toString();\n    }\n    public static function &unserialize($data, $simple = false) {\n        $stream = new HproseStringStream($data);\n        $hproseReader = ($simple ? new HproseSimpleReader($stream) : new HproseReader($stream));\n        return $hproseReader->unserialize();\n    }\n}\n?>\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Hprose/HproseHttpClient.php",
    "content": "<?php\n/**********************************************************\\\n|                                                          |\n|                          hprose                          |\n|                                                          |\n| Official WebSite: http://www.hprose.com/                 |\n|                   http://www.hprose.net/                 |\n|                   http://www.hprose.org/                 |\n|                                                          |\n\\**********************************************************/\n\n/**********************************************************\\\n *                                                        *\n * HproseHttpClient.php                                   *\n *                                                        *\n * hprose http client library for php5.                   *\n *                                                        *\n * LastModified: Nov 12, 2013                             *\n * Author: Ma Bingyao <andot@hprfc.com>                   *\n *                                                        *\n\\**********************************************************/\n\nrequire_once('HproseCommon.php');\nrequire_once('HproseIO.php');\nrequire_once('HproseClient.php');\n\nabstract class HproseBaseHttpClient extends HproseClient {\n    protected $host;\n    protected $path;\n    protected $secure;\n    protected $proxy;\n    protected $header;\n    protected $timeout;\n    protected $keepAlive;\n    protected $keepAliveTimeout;\n    protected static $cookieManager = array();\n    static function hproseKeepCookieInSession() {\n        $_SESSION['HPROSE_COOKIE_MANAGER'] = self::$cookieManager;\n    }\n    public static function keepSession() {\n        if (array_key_exists('HPROSE_COOKIE_MANAGER', $_SESSION)) {\n            self::$cookieManager = $_SESSION['HPROSE_COOKIE_MANAGER'];\n        }\n        register_shutdown_function(array('HproseBaseHttpClient', 'hproseKeepCookieInSession'));\n    }\n    protected function setCookie($headers) {\n        foreach ($headers as $header) {\n            @list($name, $value) = explode(':', $header, 2);\n            if (strtolower($name) == 'set-cookie' ||\n                strtolower($name) == 'set-cookie2') {\n                $cookies = explode(';', trim($value));\n                $cookie = array();\n                list($name, $value) = explode('=', trim($cookies[0]), 2);\n                $cookie['name'] = $name;\n                $cookie['value'] = $value;\n                for ($i = 1; $i < count($cookies); $i++) {\n                    list($name, $value) = explode('=', trim($cookies[$i]), 2);\n                    $cookie[strtoupper($name)] = $value;\n                }\n                // Tomcat can return SetCookie2 with path wrapped in \"\n                if (array_key_exists('PATH', $cookie)) {\n                    $cookie['PATH'] = trim($cookie['PATH'], '\"');\n                }\n                else {\n                    $cookie['PATH'] = '/';\n                }\n                if (array_key_exists('EXPIRES', $cookie)) {\n                    $cookie['EXPIRES'] = strtotime($cookie['EXPIRES']);\n                }\n                if (array_key_exists('DOMAIN', $cookie)) {\n                    $cookie['DOMAIN'] = strtolower($cookie['DOMAIN']);\n                }\n                else {\n                    $cookie['DOMAIN'] = $this->host;\n                }\n                $cookie['SECURE'] = array_key_exists('SECURE', $cookie);\n                if (!array_key_exists($cookie['DOMAIN'], self::$cookieManager)) {\n                    self::$cookieManager[$cookie['DOMAIN']] = array();\n                }\n                self::$cookieManager[$cookie['DOMAIN']][$cookie['name']] = $cookie;\n            }\n        }\n    }\n    protected abstract function formatCookie($cookies);\n    protected function getCookie() {\n        $cookies = array();\n        foreach (self::$cookieManager as $domain => $cookieList) {\n            if (strpos($this->host, $domain) !== false) {\n                $names = array();\n                foreach ($cookieList as $cookie) {\n                    if (array_key_exists('EXPIRES', $cookie) && (time() > $cookie['EXPIRES'])) {\n                        $names[] = $cookie['name'];\n                    }\n                    elseif (strpos($this->path, $cookie['PATH']) === 0) {\n                        if ((($this->secure && $cookie['SECURE']) ||\n                             !$cookie['SECURE']) && !is_null($cookie['value'])) {\n                            $cookies[] = $cookie['name'] . '=' . $cookie['value'];\n                        }\n                    }\n                }\n                foreach ($names as $name) {\n                    unset(self::$cookieManager[$domain][$name]);\n                }\n            }\n        }\n        return $this->formatCookie($cookies);\n    }\n    public function __construct($url = '') {\n        parent::__construct($url);\n        $this->header = array('Content-type' => 'application/hprose');\n    }\n    public function useService($url = '', $namespace = '') {\n        $serviceProxy = parent::useService($url, $namespace);\n        if ($url) {\n            $url = parse_url($url);\n            $this->secure = (strtolower($url['scheme']) == 'https');\n            $this->host = strtolower($url['host']);\n            $this->path = $url['path'];\n            $this->timeout = 30000;\n            $this->keepAlive = false;\n            $this->keepAliveTimeout = 300;\n        }\n        return $serviceProxy;\n    }\n    public function setHeader($name, $value) {\n        $lname = strtolower($name);\n        if ($lname != 'content-type' &&\n            $lname != 'content-length' &&\n            $lname != 'host') {\n            if ($value) {\n                $this->header[$name] = $value;\n            }\n            else {\n                unset($this->header[$name]);\n            }\n        }\n    }\n    public function setProxy($proxy = NULL) {\n        $this->proxy = $proxy;\n    }\n    public function setTimeout($timeout) {\n        $this->timeout = $timeout;\n    }\n    public function getTimeout() {\n        return $this->timeout;\n    }\n    public function setKeepAlive($keepAlive = true) {\n        $this->keepAlive = $keepAlive;\n    }\n    public function getKeepAlive() {\n        return $this->keeepAlive;\n    }\n    public function setKeepAliveTimeout($timeout) {\n        $this->keepAliveTimeout = $timeout;\n    }\n    public function getKeepAliveTimeout() {\n        return $this->keepAliveTimeout;\n    }\n}\n\nif (class_exists('SaeFetchurl')) {\n    class HproseHttpClient extends HproseBaseHttpClient {\n        protected function formatCookie($cookies) {\n            if (count($cookies) > 0) {\n                return implode('; ', $cookies);\n            }\n            return '';\n        }\n        protected function send($request) {\n            $f = new SaeFetchurl();\n            $cookie = $this->getCookie();\n            if ($cookie != '') {\n                $f->setHeader(\"Cookie\", $cookie);\n            }\n            if ($this->keepAlive) {\n                $f->setHeader(\"Connection\", \"keep-alive\");\n                $f->setHeader(\"Keep-Alive\", $this->keepAliveTimeout);\n            }\n            else {\n                $f->setHeader(\"Connection\", \"close\");\n            }\n            foreach ($this->header as $name => $value) {\n                $f->setHeader($name, $value);\n            }\n            $f->setMethod(\"post\");\n            $f->setPostData($request);\n            $f->setConnectTimeout($this->timeout);        \n            $f->setSendTimeout($this->timeout);\n            $f->setReadTimeout($this->timeout);\n            $response = $f->fetch($this->url);\n            if ($f->errno()) {\n                throw new HproseException($f->errno() . \": \" . $f->errmsg());\n            }\n            $http_response_header = $f->responseHeaders(false);\n            $this->setCookie($http_response_header);\n            return $response;\n        }\n    }\n}\nelseif (function_exists('curl_init')) {\n    class HproseHttpClient extends HproseBaseHttpClient {\n        private $curl;\n        protected function formatCookie($cookies) {\n            if (count($cookies) > 0) {\n                return \"Cookie: \" . implode('; ', $cookies);\n            }\n            return '';\n        }\n        public function __construct($url = '') {\n            parent::__construct($url);\n            $this->curl = curl_init();\n        }\n        protected function send($request) {\n            curl_setopt($this->curl, CURLOPT_URL, $this->url);\n            curl_setopt($this->curl, CURLOPT_HEADER, TRUE);\n            curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, FALSE);\n            curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, TRUE);\n            curl_setopt($this->curl, CURLOPT_POST, TRUE);\n            curl_setopt($this->curl, CURLOPT_POSTFIELDS, $request);\n            $headers_array = array($this->getCookie(),\n                                    \"Content-Length: \" . strlen($request));\n            if ($this->keepAlive) {\n                $headers_array[] = \"Connection: keep-alive\";\n                $headers_array[] = \"Keep-Alive: \" . $this->keepAliveTimeout;\n            }\n            else {\n                $headers_array[] = \"Connection: close\";\n            }\n            foreach ($this->header as $name => $value) {\n                $headers_array[] = $name . \": \" . $value;\n            }\n            curl_setopt($this->curl, CURLOPT_HTTPHEADER, $headers_array);\n            if ($this->proxy) {\n                curl_setopt($this->curl, CURLOPT_PROXY, $this->proxy);\n            }\n            if (defined(CURLOPT_TIMEOUT_MS)) {\n                curl_setopt($this->curl, CURLOPT_TIMEOUT_MS, $this->timeout);\n            }\n            else {\n                curl_setopt($this->curl, CURLOPT_TIMEOUT, $this->timeout / 1000);\n            }\n            $response = curl_exec($this->curl);\n            $errno = curl_errno($this->curl);\n            if ($errno) {\n                throw new HproseException($errno . \": \" . curl_error($this->curl));\n            }\n            do {\n                list($response_headers, $response) = explode(\"\\r\\n\\r\\n\", $response, 2); \n                $http_response_header = explode(\"\\r\\n\", $response_headers);\n                $http_response_firstline = array_shift($http_response_header); \n                if (preg_match('@^HTTP/[0-9]\\.[0-9]\\s([0-9]{3})\\s(.*)@',\n                               $http_response_firstline, $matches)) { \n                    $response_code = $matches[1];\n                    $response_status = trim($matches[2]);\n                }\n                else {\n                    $response_code = \"500\";\n                    $response_status = \"Unknown Error.\";                \n                }\n            } while (substr($response_code, 0, 1) == \"1\");\n            if ($response_code != '200') {\n                throw new HproseException($response_code . \": \" . $response_status);\n            }\n            $this->setCookie($http_response_header);\n            return $response;\n        }\n        public function __destruct() {\n            curl_close($this->curl);\n        }\n    }\n}\nelse {\n    class HproseHttpClient extends HproseBaseHttpClient {\n        protected function formatCookie($cookies) {\n            if (count($cookies) > 0) {\n                return \"Cookie: \" . implode('; ', $cookies) . \"\\r\\n\";\n            }\n            return '';\n        }\n        public function __errorHandler($errno, $errstr, $errfile, $errline) {\n            throw new Exception($errstr, $errno);\n        }\n        protected function send($request) {\n            $opts = array (\n                'http' => array (\n                    'method' => 'POST',\n                    'header'=> $this->getCookie() .\n                               \"Content-Length: \" . strlen($request) . \"\\r\\n\" .\n                               ($this->keepAlive ?\n                               \"Connection: keep-alive\\r\\n\" .\n                               \"Keep-Alive: \" . $this->keepAliveTimeout . \"\\r\\n\" :\n                               \"Connection: close\\r\\n\"),\n                    'content' => $request,\n                    'timeout' => $this->timeout / 1000.0,\n                ),\n            );\n            foreach ($this->header as $name => $value) {\n                $opts['http']['header'] .= \"$name: $value\\r\\n\";\n            }\n            if ($this->proxy) {\n                $opts['http']['proxy'] = $this->proxy;\n                $opts['http']['request_fulluri'] = true;\n            }\n            $context = stream_context_create($opts);\n            set_error_handler(array(&$this, '__errorHandler'));\n            $response = file_get_contents($this->url, false, $context);\n            restore_error_handler();\n            $this->setCookie($http_response_header);\n            return $response;\n        }\n    }\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Hprose/HproseHttpServer.php",
    "content": "<?php\n/**********************************************************\\\n|                                                          |\n|                          hprose                          |\n|                                                          |\n| Official WebSite: http://www.hprose.com/                 |\n|                   http://www.hprose.net/                 |\n|                   http://www.hprose.org/                 |\n|                                                          |\n\\**********************************************************/\n\n/**********************************************************\\\n *                                                        *\n * HproseHttpServer.php                                   *\n *                                                        *\n * hprose http server library for php5.                   *\n *                                                        *\n * LastModified: Nov 13, 2013                             *\n * Author: Ma Bingyao <andot@hprfc.com>                   *\n *                                                        *\n\\**********************************************************/\n\nrequire_once('HproseCommon.php');\nrequire_once('HproseIO.php');\n\nclass HproseHttpServer {\n    private $errorTable = array(E_ERROR => 'Error',\n                                E_WARNING => 'Warning',\n                                E_PARSE => 'Parse Error',\n                                E_NOTICE => 'Notice',\n                                E_CORE_ERROR => 'Core Error',\n                                E_CORE_WARNING => 'Core Warning',\n                                E_COMPILE_ERROR => 'Compile Error',\n                                E_COMPILE_WARNING => 'Compile Warning',\n                                E_USER_ERROR => 'User Error',\n                                E_USER_WARNING => 'User Warning',\n                                E_USER_NOTICE => 'User Notice',\n                                E_STRICT => 'Run-time Notice',\n                                E_RECOVERABLE_ERROR => 'Error');\n    private $functions;\n    private $funcNames;\n    private $resultModes;\n    private $simpleModes;\n    private $debug;\n    private $crossDomain;\n    private $P3P;\n    private $get;\n    private $input;\n    private $output;\n    private $error;\n    private $filter;\n    private $simple;\n    public $onBeforeInvoke;\n    public $onAfterInvoke;\n    public $onSendHeader;\n    public $onSendError;\n    public function __construct() {\n        $this->functions = array();\n        $this->funcNames = array();\n        $this->resultModes = array();\n        $this->simpleModes = array();\n        $this->debug = false;\n        $this->crossDomain = false;\n        $this->P3P = false;\n        $this->get = true;\n        $this->filter = NULL;\n        $this->simple = false;\n        $this->error_types = E_ALL & ~E_NOTICE;\n        $this->onBeforeInvoke = NULL;\n        $this->onAfterInvoke = NULL;\n        $this->onSendHeader = NULL;\n        $this->onSendError = NULL;\n    }\n    /*\n      __filterHandler & __errorHandler must be public,\n      however we should never call them directly.\n    */\n    public function __filterHandler($data) {\n        if (preg_match('/<b>.*? error<\\/b>:(.*?)<br/', $data, $match)) {\n            if ($this->debug) {\n                $error = preg_replace('/<.*?>/', '', $match[1]);\n            }\n            else {\n                $error = preg_replace('/ in <b>.*<\\/b>$/', '', $match[1]);\n            }\n            $data = HproseTags::TagError .\n                 HproseFormatter::serialize(trim($error), true) .\n                 HproseTags::TagEnd;\n        }\n        if ($this->filter) $data = $this->filter->outputFilter($data);\n        return $data;\n    }\n    public function __errorHandler($errno, $errstr, $errfile, $errline) {\n        if ($this->debug) {\n            $errstr .= \" in $errfile on line $errline\";\n        }\n        $this->error = $this->errorTable[$errno] . \": \" . $errstr;\n        $this->sendError();\n        return true;\n    }\n    private function sendHeader() {\n        if ($this->onSendHeader) {\n            call_user_func($this->onSendHeader);\n        }\n        header(\"Content-Type: text/plain\");\n        if ($this->P3P) {\n            header('P3P: CP=\"CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi ' .\n                   'CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL ' .\n                   'UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV\"');\n        }\n        if ($this->crossDomain) {\n            if (array_key_exists('HTTP_ORIGIN', $_SERVER) && $_SERVER['HTTP_ORIGIN'] != \"null\") {\n                header(\"Access-Control-Allow-Origin: \" . $_SERVER['HTTP_ORIGIN']);\n                header(\"Access-Control-Allow-Credentials: true\");  \n            }\n            else {\n                header('Access-Control-Allow-Origin: *');\n            }\n        }\n    }\n    private function sendError() {\n        if ($this->onSendError) {\n            call_user_func($this->onSendError, $this->error);\n        }\n        ob_clean();\n        $this->output->write(HproseTags::TagError);\n        $writer = new HproseSimpleWriter($this->output);\n        $writer->writeString($this->error);\n        $this->output->write(HproseTags::TagEnd);\n        ob_end_flush();\n    }\n    private function doInvoke() {\n        $simpleReader = new HproseSimpleReader($this->input);\n        do {\n            $functionName = $simpleReader->readString(true);\n            $aliasName = strtolower($functionName);\n            $resultMode = HproseResultMode::Normal;\n            if (array_key_exists($aliasName, $this->functions)) {\n                $function = $this->functions[$aliasName];\n                $resultMode = $this->resultModes[$aliasName];\n                $simple = $this->simpleModes[$aliasName];\n            }\n            elseif (array_key_exists('*', $this->functions)) {\n                $function = $this->functions['*'];\n                $resultMode = $this->resultModes['*'];\n                $simple = $this->resultModes['*'];\n            }\n            else {\n                throw new HproseException(\"Can't find this function \" . $functionName . \"().\");\n            }\n            if ($simple === NULL) $simple = $this->simple;\n            $writer = ($simple ? new HproseSimpleWriter($this->output) : new HproseWriter($this->output));\n            $args = array();\n            $byref = false;\n            $tag = $simpleReader->checkTags(array(HproseTags::TagList,\n                                            HproseTags::TagEnd,\n                                            HproseTags::TagCall));\n            if ($tag == HproseTags::TagList) {\n                $reader = new HproseReader($this->input);\n                $args = &$reader->readList();\n                $tag = $reader->checkTags(array(HproseTags::TagTrue,\n                                                HproseTags::TagEnd,\n                                                HproseTags::TagCall));\n                if ($tag == HproseTags::TagTrue) {\n                    $byref = true;\n                    $tag = $reader->checkTags(array(HproseTags::TagEnd,\n                                                    HproseTags::TagCall));\n                }\n            }\n            if ($this->onBeforeInvoke) {\n                call_user_func($this->onBeforeInvoke, $functionName, $args, $byref);\n            }\n            if (array_key_exists('*', $this->functions) && ($function === $this->functions['*'])) {\n                $arguments = array($functionName, &$args);\n            }\n            elseif ($byref) {\n                $arguments = array();\n                for ($i = 0; $i < count($args); $i++) {\n                    $arguments[$i] = &$args[$i];\n                }\n            }\n            else {\n                $arguments = $args;\n            }\n            $result = call_user_func_array($function, $arguments);\n            if ($this->onAfterInvoke) {\n                call_user_func($this->onAfterInvoke, $functionName, $args, $byref, $result);\n            }\n            // some service functions/methods may echo content, we need clean it\n            ob_clean();\n            if ($resultMode == HproseResultMode::RawWithEndTag) {\n                $this->output->write($result);\n                return;\n            }\n            elseif ($resultMode == HproseResultMode::Raw) {\n                $this->output->write($result);\n            }\n            else {\n                $this->output->write(HproseTags::TagResult);\n                if ($resultMode == HproseResultMode::Serialized) {\n                    $this->output->write($result);\n                }\n                else {\n                    $writer->reset();\n                    $writer->serialize($result);\n                }\n                if ($byref) {\n                    $this->output->write(HproseTags::TagArgument);\n                    $writer->reset();\n                    $writer->writeList($args);\n                }\n            }\n        } while ($tag == HproseTags::TagCall);\n        $this->output->write(HproseTags::TagEnd);\n        ob_end_flush();\n    }\n    private function doFunctionList() {\n        $functions = array_values($this->funcNames);\n        $writer = new HproseSimpleWriter($this->output);\n        $this->output->write(HproseTags::TagFunctions);\n        $writer->writeList($functions);\n        $this->output->write(HproseTags::TagEnd);\n        ob_end_flush();\n    }\n    private function getDeclaredOnlyMethods($class) {\n        $all = get_class_methods($class);\n        if ($parent_class = get_parent_class($class)) {\n            $inherit = get_class_methods($parent_class);\n            $result = array_diff($all, $inherit);\n        }\n        else {\n            $result = $all;\n        }\n        return $result;\n    }\n    public function addMissingFunction($function, $resultMode = HproseResultMode::Normal, $simple = NULL) {\n        $this->addFunction($function, '*', $resultMode, $simple);\n    }\n    public function addFunction($function, $alias = NULL, $resultMode = HproseResultMode::Normal, $simple = NULL) {\n        if (is_callable($function)) {\n            if ($alias === NULL) {\n                if (is_string($function)) {\n                    $alias = $function;\n                }\n                else {\n                    $alias = $function[1];\n                }\n            }\n            if (is_string($alias)) {\n                $aliasName = strtolower($alias);\n                $this->functions[$aliasName] = $function;\n                $this->funcNames[$aliasName] = $alias;\n                $this->resultModes[$aliasName] = $resultMode;\n                $this->simpleModes[$aliasName] = $simple;\n            }\n            else {\n                throw new HproseException('Argument alias is not a string');\n            }\n        }\n        else {\n            throw new HproseException('Argument function is not a callable variable');\n        }\n    }\n    public function addFunctions($functions, $aliases = NULL, $resultMode = HproseResultMode::Normal, $simple = NULL) {\n        $aliases_is_null = ($aliases === NULL);\n        $count = count($functions);\n        if (!$aliases_is_null && $count != count($aliases)) {\n            throw new HproseException('The count of functions is not matched with aliases');\n        }\n        for ($i = 0; $i < $count; $i++) {\n            $function = $functions[$i];\n            if ($aliases_is_null) {\n                $this->addFunction($function, NULL, $resultMode, $simple);\n            }\n            else {\n                $this->addFunction($function, $aliases[$i], $resultMode, $simple);\n            }\n        }\n    }\n    public function addMethod($methodname, $belongto, $alias = NULL, $resultMode = HproseResultMode::Normal, $simple = NULL) {\n        if ($alias === NULL) {\n            $alias = $methodname;\n        }\n        if (is_string($belongto)) {\n            $this->addFunction(array($belongto, $methodname), $alias, $resultMode, $simple);\n        }\n        else {\n            $this->addFunction(array(&$belongto, $methodname), $alias, $resultMode, $simple);\n        }\n    }\n    public function addMethods($methods, $belongto, $aliases = NULL, $resultMode = HproseResultMode::Normal, $simple = NULL) {\n        $aliases_is_null = ($aliases === NULL);\n        $count = count($methods);\n        if (is_string($aliases)) {\n            $aliasPrefix = $aliases;\n            $aliases = array();\n            foreach ($methods as $name) {\n                $aliases[] = $aliasPrefix . '_' . $name;\n            }\n        }\n        if (!$aliases_is_null && $count != count($aliases)) {\n            throw new HproseException('The count of methods is not matched with aliases');\n        }\n        for ($i = 0; $i < $count; $i++) {\n            $method = $methods[$i];\n            if (is_string($belongto)) {\n                $function = array($belongto, $method);\n            }\n            else {\n                $function = array(&$belongto, $method);\n            }\n            if ($aliases_is_null) {\n                $this->addFunction($function, $method, $resultMode, $simple);\n            }\n            else {\n                $this->addFunction($function, $aliases[$i], $resultMode, $simple);\n            }\n        }\n    }\n    public function addInstanceMethods($object, $class = NULL, $aliasPrefix = NULL, $resultMode = HproseResultMode::Normal, $simple = NULL) {\n        if ($class === NULL) $class = get_class($object);\n        $this->addMethods($this->getDeclaredOnlyMethods($class), $object, $aliasPrefix, $resultMode, $simple);\n    }\n    public function addClassMethods($class, $execclass = NULL, $aliasPrefix = NULL, $resultMode = HproseResultMode::Normal, $simple = NULL) {\n        if ($execclass === NULL) $execclass = $class;\n        $this->addMethods($this->getDeclaredOnlyMethods($class), $execclass, $aliasPrefix, $resultMode, $simple);\n    }\n    public function add() {\n        $args_num = func_num_args();\n        $args = func_get_args();\n        switch ($args_num) {\n            case 1: {\n                if (is_callable($args[0])) {\n                    return $this->addFunction($args[0]);\n                }\n                elseif (is_array($args[0])) {\n                    return $this->addFunctions($args[0]);\n                }\n                elseif (is_object($args[0])) {\n                    return $this->addInstanceMethods($args[0]);\n                }\n                elseif (is_string($args[0])) {\n                    return $this->addClassMethods($args[0]);\n                }\n                break;\n            }\n            case 2: {\n                if (is_callable($args[0]) && is_string($args[1])) {\n                    return $this->addFunction($args[0], $args[1]);\n                }\n                elseif (is_string($args[0])) {\n                    if (is_string($args[1]) && !is_callable(array($args[1], $args[0]))) {\n                        if (class_exists($args[1])) {\n                            return $this->addClassMethods($args[0], $args[1]);\n                        }\n                        else {\n                            return $this->addClassMethods($args[0], NULL, $args[1]);\n                        }\n                    }\n                    return $this->addMethod($args[0], $args[1]);\n                }\n                elseif (is_array($args[0])) {\n                    if (is_array($args[1])) {\n                        return $this->addFunctions($args[0], $args[1]);\n                    }\n                    else {\n                        return $this->addMethods($args[0], $args[1]);\n                    }\n                }\n                elseif (is_object($args[0])) {\n                    return $this->addInstanceMethods($args[0], $args[1]);\n                }\n                break;\n            }\n            case 3: {\n                if (is_callable($args[0]) && is_null($args[1]) && is_string($args[2])) {\n                    return $this->addFunction($args[0], $args[2]);\n                }\n                elseif (is_string($args[0]) && is_string($args[2])) {\n                    if (is_string($args[1]) && !is_callable(array($args[0], $args[1]))) {\n                        return $this->addClassMethods($args[0], $args[1], $args[2]);\n                    }\n                    else {\n                        return $this->addMethod($args[0], $args[1], $args[2]);\n                    }\n                }\n                elseif (is_array($args[0])) {\n                    if (is_null($args[1]) && is_array($args[2])) {\n                        return $this->addFunctions($args[0], $args[2]);\n                    }\n                    else {\n                        return $this->addMethods($args[0], $args[1], $args[2]);\n                    }\n                }\n                elseif (is_object($args[0])) {\n                    return $this->addInstanceMethods($args[0], $args[1], $args[2]);\n                }\n                break;\n            }\n            throw new HproseException('Wrong arguments');\n        }\n    }\n    public function isDebugEnabled() {\n        return $this->debug;\n    }\n    public function setDebugEnabled($enable = true) {\n        $this->debug = $enable;\n    }\n    public function isCrossDomainEnabled() {\n        return $this->crossDomain;\n    }\n    public function setCrossDomainEnabled($enable = true) {\n        $this->crossDomain = $enable;\n    }\n    public function isP3PEnabled() {\n        return $this->P3P;\n    }\n    public function setP3PEnabled($enable = true) {\n        $this->P3P = $enable;\n    }\n    public function isGetEnabled() {\n        return $this->get;\n    }\n    public function setGetEnabled($enable = true) {\n        $this->get = $enable;\n    }\n    public function getFilter() {\n        return $this->filter;\n    }\n    public function setFilter($filter) {\n        $this->filter = $filter;\n    }\n    public function getSimpleMode() {\n        return $this->simple;\n    }\n    public function setSimpleMode($simple = true) {\n        $this->simple = $simple;\n    }\n    public function getErrorTypes() {\n        return $this->error_types;\n    }\n    public function setErrorTypes($error_types) {\n        $this->error_types = $error_types;\n    }\n    public function handle() {\n        if (!isset($HTTP_RAW_POST_DATA)) $HTTP_RAW_POST_DATA = file_get_contents(\"php://input\");\n        if ($this->filter) $HTTP_RAW_POST_DATA = $this->filter->inputFilter($HTTP_RAW_POST_DATA);\n        $this->input = new HproseStringStream($HTTP_RAW_POST_DATA);\n        $this->output = new HproseFileStream(fopen('php://output', 'wb'));\n        set_error_handler(array(&$this, '__errorHandler'), $this->error_types);\n        ob_start(array(&$this, \"__filterHandler\"));\n        ob_implicit_flush(0);\n        ob_clean();\n        $this->sendHeader();\n        if (($_SERVER['REQUEST_METHOD'] == 'GET') and $this->get) {\n            return $this->doFunctionList();\n        }\n        elseif ($_SERVER['REQUEST_METHOD'] == 'POST') {\n            try {\n                switch ($this->input->getc()) {\n                    case HproseTags::TagCall: return $this->doInvoke();\n                    case HproseTags::TagEnd: return $this->doFunctionList();\n                    default: throw new HproseException(\"Wrong Request: \\r\\n\" . $HTTP_RAW_POST_DATA);\n                }\n            }\n            catch (Exception $e) {\n                $this->error = $e->getMessage();\n                if ($this->debug) {\n                    $this->error .= \"\\nfile: \" . $e->getFile() .\n                                    \"\\nline: \" . $e->getLine() .\n                                    \"\\ntrace: \" . $e->getTraceAsString();\n                }\n                $this->sendError();\n            }\n        }\n        $this->input->close();\n        $this->output->close();\n    }\n    public function start() {\n        $this->handle();\n    }\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Hprose/HproseIO.php",
    "content": "<?php\n/**********************************************************\\\n|                                                          |\n|                          hprose                          |\n|                                                          |\n| Official WebSite: http://www.hprose.com/                 |\n|                   http://www.hprose.net/                 |\n|                   http://www.hprose.org/                 |\n|                                                          |\n\\**********************************************************/\n\n/**********************************************************\\\n *                                                        *\n * HproseIO.php                                           *\n *                                                        *\n * hprose io library for php5.                            *\n *                                                        *\n * LastModified: Nov 10, 2013                             *\n * Author: Ma Bingyao <andot@hprfc.com>                   *\n *                                                        *\n\\**********************************************************/\n\nrequire_once('HproseTags.php');\nrequire_once('HproseClassManager.php');\nrequire_once('HproseReader.php');\nrequire_once('HproseWriter.php');\nrequire_once('HproseFormatter.php');\n\n?>\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Hprose/HproseIOStream.php",
    "content": "<?php\n/**********************************************************\\\n|                                                          |\n|                          hprose                          |\n|                                                          |\n| Official WebSite: http://www.hprose.com/                 |\n|                   http://www.hprose.net/                 |\n|                   http://www.hprose.org/                 |\n|                                                          |\n\\**********************************************************/\n\n/**********************************************************\\\n *                                                        *\n * HproseIOStream.php                                     *\n *                                                        *\n * hprose io stream library for php5.                     *\n *                                                        *\n * LastModified: Nov 12, 2013                             *\n * Author: Ma Bingyao <andot@hprfc.com>                   *\n *                                                        *\n\\**********************************************************/\n\nabstract class HproseAbstractStream {\n    public abstract function close();\n    public abstract function getc();\n    public abstract function read($length);\n    public abstract function readuntil($char);\n    public abstract function seek($offset, $whence = SEEK_SET);\n    public abstract function mark();\n    public abstract function unmark();\n    public abstract function reset();    \n    public abstract function skip($n);\n    public abstract function eof();\n    public abstract function write($string, $length = -1);\n}\n\nclass HproseStringStream extends HproseAbstractStream {\n    protected $buffer;\n    protected $pos;\n    protected $mark;\n    protected $length;\n    public function __construct($string = '') {\n        $this->buffer = $string;\n        $this->pos = 0;\n        $this->mark = -1;\n        $this->length = strlen($string);\n    }\n    public function close() {\n        $this->buffer = NULL;\n        $this->pos = 0;\n        $this->mark = -1;\n        $this->length = 0;\n    }\n    public function length() {\n        return $this->length;\n    }\n    public function getc() {\n        return $this->buffer{$this->pos++};\n    }\n    public function read($length) {\n        $s = substr($this->buffer, $this->pos, $length);\n        $this->skip($length);\n        return $s;\n    }\n    public function readuntil($tag) {\n        $pos = strpos($this->buffer, $tag, $this->pos);\n        if ($pos !== false) {\n            $s = substr($this->buffer, $this->pos, $pos - $this->pos);\n            $this->pos = $pos + strlen($tag);\n        }\n        else {\n            $s = substr($this->buffer, $this->pos);\n            $this->pos = $this->length;\n        }\n        return $s;\n    }\n    public function seek($offset, $whence = SEEK_SET) {\n        switch ($whence) {\n            case SEEK_SET:\n                $this->pos = $offset;\n                break;\n            case SEEK_CUR:\n                $this->pos += $offset;\n                break;\n            case SEEK_END:\n                $this->pos = $this->length + $offset;\n                break;\n        }\n        $this->mark = -1;\n        return 0;\n    }\n    public function mark() {\n        $this->mark = $this->pos;\n    }\n    public function unmark() {\n        $this->mark = -1;\n    }\n    public function reset() {\n        if ($this->mark != -1) {\n            $this->pos = $this->mark;\n        }\n    }\n    public function skip($n) {\n        $this->pos += $n;\n    }\n    public function eof() {\n        return ($this->pos >= $this->length);\n    }\n    public function write($string, $length = -1) {\n        if ($length == -1) {\n            $this->buffer .= $string;\n            $length = strlen($string);\n        }\n        else {\n            $this->buffer .= substr($string, 0, $length);\n        }\n        $this->length += $length;\n    }\n    public function toString() {\n        return $this->buffer;\n    }\n}\n\nclass HproseFileStream extends HproseAbstractStream {\n    protected $fp;\n    protected $buf;\n    protected $unmark;    \n    protected $pos;\n    protected $length;\n    public function __construct($fp) {\n        $this->fp = $fp;\n        $this->buf = \"\";\n        $this->unmark = true;\n        $this->pos = -1;\n        $this->length = 0;\n    }\n    public function close() {\n        return fclose($this->fp);\n    }\n    public function getc() {\n        if ($this->pos == -1) {\n            return fgetc($this->fp);\n        }\n        elseif ($this->pos < $this->length) {\n            return $this->buf{$this->pos++};\n        }\n        elseif ($this->unmark) {\n            $this->buf = \"\";        \n            $this->pos = -1;\n            $this->length = 0;\n            return fgetc($this->fp);            \n        }\n        elseif (($c = fgetc($this->fp)) !== false) {\n            $this->buf .= $c;\n            $this->pos++;\n            $this->length++;\n        }\n        return $c;\n    }\n    public function read($length) {\n        if ($this->pos == -1) {\n            return fread($this->fp, $length);\n        }\n        elseif ($this->pos < $this->length) {\n            $len = $this->length - $this->pos;\n            if ($len < $length) {\n                $s = fread($this->fp, $length - $len);\n                $this->buf .= $s;\n                $this->length += strlen($s);\n            }\n            $s = substr($this->buf, $this->pos, $length);\n            $this->pos += strlen($s);\n        }\n        elseif ($this->unmark) {\n            $this->buf = \"\";        \n            $this->pos = -1;\n            $this->length = 0;\n            return fread($this->fp, $length);           \n        }\n        elseif (($s = fread($this->fp, $length)) !== \"\") {\n            $this->buf .= $s;\n            $len = strlen($s);\n            $this->pos += $len;\n            $this->length += $len;\n        }\n        return $s;\n    }\n    public function readuntil($char) {\n        $s = '';\n        while ((($c = $this->getc()) != $char) && $c !== false) $s .= $c;\n        return $s;\n    }\n    public function seek($offset, $whence = SEEK_SET) {\n        if (fseek($this->fp, $offset, $whence) == 0) {\n            $this->buf = \"\";\n            $this->unmark = true;\n            $this->pos = -1;\n            $this->length = 0;\n            return 0;\n        }\n        return -1;\n    }\n    public function mark() {\n        $this->unmark = false;\n        if ($this->pos == -1) {\n            $this->buf = \"\";\n            $this->pos = 0;\n            $this->length = 0;\n        }\n        elseif ($this->pos > 0) {\n            $this->buf = substr($this->buf, $this->pos);\n            $this->length -= $this->pos;\n            $this->pos = 0;\n        }\n    }\n    public function unmark() {\n        $this->unmark = true;\n    }\n    public function reset() {\n        $this->pos = 0;\n    }\n    public function skip($n) {\n        $this->read($n);\n    }\n    public function eof() {\n        if (($this->pos != -1) && ($this->pos < $this->length)) return false;\n        return feof($this->fp);\n    }\n    public function write($string, $length = -1) {\n        if ($length == -1) $length = strlen($string);\n        return fwrite($this->fp, $string, $length);\n    }\n}\n\nclass HproseProcStream extends HproseAbstractStream {\n    protected $process;\n    protected $pipes;\n    protected $buf;\n    protected $unmark;    \n    protected $pos;\n    protected $length;\n    public function __construct($process, $pipes) {\n        $this->process = $process;\n        $this->pipes = $pipes;\n        $this->buf = \"\";\n        $this->unmark = true;\n        $this->pos = -1;\n        $this->length = 0;        \n    }\n    public function close() {\n        fclose($this->pipes[0]);\n        fclose($this->pipes[1]);\n        proc_close($this->process);\n    }\n    public function getc() {\n        if ($this->pos == -1) {\n            return fgetc($this->pipes[1]);\n        }\n        elseif ($this->pos < $this->length) {\n            return $this->buf{$this->pos++};\n        }\n        elseif ($this->unmark) {\n            $this->buf = \"\";        \n            $this->pos = -1;\n            $this->length = 0;\n            return fgetc($this->pipes[1]);\n        }\n        elseif (($c = fgetc($this->pipes[1])) !== false) {\n            $this->buf .= $c;\n            $this->pos++;\n            $this->length++;\n        }\n        return $c;\n    }\n    public function read($length) {\n        if ($this->pos == -1) {\n            return fread($this->pipes[1], $length);\n        }\n        elseif ($this->pos < $this->length) {\n            $len = $this->length - $this->pos;\n            if ($len < $length) {\n                $s = fread($this->pipes[1], $length - $len);\n                $this->buf .= $s;\n                $this->length += strlen($s);\n            }\n            $s = substr($this->buf, $this->pos, $length);\n            $this->pos += strlen($s);\n        }\n        elseif ($this->unmark) {\n            $this->buf = \"\";        \n            $this->pos = -1;\n            $this->length = 0;\n            return fread($this->pipes[1], $length);           \n        }\n        elseif (($s = fread($this->pipes[1], $length)) !== \"\") {\n            $this->buf .= $s;\n            $len = strlen($s);\n            $this->pos += $len;\n            $this->length += $len;\n        }\n        return $s;\n    }\n    public function readuntil($char) {\n        $s = '';\n        while ((($c = $this->getc()) != $char) && $c !== false) $s .= $c;\n        return $s;\n    }\n    public function seek($offset, $whence = SEEK_SET) {\n        if (fseek($this->pipes[1], $offset, $whence) == 0) {\n            $this->buf = \"\";\n            $this->unmark = true;\n            $this->pos = -1;\n            $this->length = 0;\n            return 0;\n        }\n        return -1;\n    }\n    public function mark() {\n        $this->unmark = false;\n        if ($this->pos == -1) {\n            $this->buf = \"\";\n            $this->pos = 0;\n            $this->length = 0;\n        }\n        elseif ($this->pos > 0) {\n            $this->buf = substr($this->buf, $this->pos);\n            $this->length -= $this->pos;\n            $this->pos = 0;\n        }\n    }\n    public function unmark() {\n        $this->unmark = true;\n    }\n    public function reset() {\n        $this->pos = 0;\n    }\n    public function skip($n) {\n        $this->read($n);\n    }\n    public function eof() {\n        if (($this->pos != -1) && ($this->pos < $this->length)) return false;\n        return feof($this->pipes[1]);\n    }\n    public function write($string, $length = -1) {\n        if ($length == -1) $length = strlen($string);\n        return fwrite($this->pipes[0], $string, $length);\n    }\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Hprose/HproseReader.php",
    "content": "<?php\n/**********************************************************\\\n|                                                          |\n|                          hprose                          |\n|                                                          |\n| Official WebSite: http://www.hprose.com/                 |\n|                   http://www.hprose.net/                 |\n|                   http://www.hprose.org/                 |\n|                                                          |\n\\**********************************************************/\n\n/**********************************************************\\\n *                                                        *\n * HproseReader.php                                       *\n *                                                        *\n * hprose reader library for php5.                        *\n *                                                        *\n * LastModified: Nov 12, 2013                             *\n * Author: Ma Bingyao <andot@hprfc.com>                   *\n *                                                        *\n\\**********************************************************/\n\nrequire_once('HproseCommon.php');\nrequire_once('HproseTags.php');\nrequire_once('HproseClassManager.php');\n\nclass HproseRawReader {\n    public $stream;\n    function __construct(&$stream) {\n        $this->stream = &$stream;\n    }\n    public function readRaw($ostream = NULL, $tag = NULL) {\n        if (is_null($ostream)) {\n            $ostream = new HproseStringStream();\n        }\n        if (is_null($tag)) {\n            $tag = $this->stream->getc();\n        }\n        switch ($tag) {\n            case '0':\n            case '1':\n            case '2':\n            case '3':\n            case '4':\n            case '5':\n            case '6':\n            case '7':\n            case '8':\n            case '9':\n            case HproseTags::TagNull:\n            case HproseTags::TagEmpty:\n            case HproseTags::TagTrue:\n            case HproseTags::TagFalse:\n            case HproseTags::TagNaN:\n                $ostream->write($tag);\n                break;\n            case HproseTags::TagInfinity:\n                $ostream->write($tag);\n                $ostream->write($this->stream->getc());\n                break;\n            case HproseTags::TagInteger:\n            case HproseTags::TagLong:\n            case HproseTags::TagDouble:\n            case HproseTags::TagRef:\n                $this->readNumberRaw($ostream, $tag);\n                break;\n            case HproseTags::TagDate:\n            case HproseTags::TagTime:\n                $this->readDateTimeRaw($ostream, $tag);\n                break;\n            case HproseTags::TagUTF8Char:\n                $this->readUTF8CharRaw($ostream, $tag);\n                break;\n            case HproseTags::TagBytes:\n                $this->readBytesRaw($ostream, $tag);\n                break;\n            case HproseTags::TagString:\n                $this->readStringRaw($ostream, $tag);\n                break;\n            case HproseTags::TagGuid:\n                $this->readGuidRaw($ostream, $tag);\n                break;\n            case HproseTags::TagList:\n            case HproseTags::TagMap:\n            case HproseTags::TagObject:\n                $this->readComplexRaw($ostream, $tag);\n                break;\n            case HproseTags::TagClass:\n                $this->readComplexRaw($ostream, $tag);\n                $this->readRaw($ostream);\n                break;\n            case HproseTags::TagError:\n                $ostream->write($tag);\n                $this->readRaw($ostream);\n                break;\n            case false:\n                throw new HproseException(\"No byte found in stream\");\n            default:\n                throw new HproseException(\"Unexpected serialize tag '\" + $tag + \"' in stream\");\n        }\n    \treturn $ostream;\n    }\n\n    private function readNumberRaw($ostream, $tag) {\n        $s = $tag .\n             $this->stream->readuntil(HproseTags::TagSemicolon) .\n             HproseTags::TagSemicolon;\n        $ostream->write($s);\n    }\n\n    private function readDateTimeRaw($ostream, $tag) {\n        $s = $tag;\n        do {\n            $tag = $this->stream->getc();\n            $s .= $tag;\n        } while ($tag != HproseTags::TagSemicolon &&\n                 $tag != HproseTags::TagUTC);\n        $ostream->write($s);\n    }\n\n    private function readUTF8CharRaw($ostream, $tag) {\n        $s = $tag;\n        $tag = $this->stream->getc();\n        $s .= $tag;\n        $a = ord($tag);\n        if (($a & 0xE0) == 0xC0) {\n            $s .= $this->stream->getc();\n        }\n        elseif (($a & 0xF0) == 0xE0) {\n            $s .= $this->stream->read(2);\n        }\n        elseif ($a > 0x7F) {\n            throw new HproseException(\"bad utf-8 encoding\");\n        }\n        $ostream->write($s);\n    }\n\n    private function readBytesRaw($ostream, $tag) {\n        $len = $this->stream->readuntil(HproseTags::TagQuote);\n        $s = $tag . $len . HproseTags::TagQuote . $this->stream->read((int)$len) . HproseTags::TagQuote;\n        $this->stream->skip(1);\n        $ostream->write($s);\n    }\n\n    private function readStringRaw($ostream, $tag) {\n        $len = $this->stream->readuntil(HproseTags::TagQuote);\n        $s = $tag . $len . HproseTags::TagQuote;\n        $len = (int)$len;\n        $this->stream->mark();\n        $utf8len = 0;\n        for ($i = 0; $i < $len; ++$i) {\n            switch (ord($this->stream->getc()) >> 4) {\n                case 0:\n                case 1:\n                case 2:\n                case 3:\n                case 4:\n                case 5:\n                case 6:\n                case 7: {\n                    // 0xxx xxxx\n                    $utf8len++;\n                    break;\n                }\n                case 12:\n                case 13: {\n                    // 110x xxxx   10xx xxxx\n                    $this->stream->skip(1);\n                    $utf8len += 2;\n                    break;\n                }\n                case 14: {\n                    // 1110 xxxx  10xx xxxx  10xx xxxx\n                    $this->stream->skip(2);\n                    $utf8len += 3;\n                    break;\n                }\n                case 15: {\n                    // 1111 0xxx  10xx xxxx  10xx xxxx  10xx xxxx\n                    $this->stream->skip(3);\n                    $utf8len += 4;\n                    ++$i;\n                    break;\n                }\n                default: {\n                    throw new HproseException('bad utf-8 encoding');\n                }\n            }\n        }\n        $this->stream->reset();\n        $this->stream->unmark();\n        $s .= $this->stream->read($utf8len) . HproseTags::TagQuote;\n        $this->stream->skip(1);\n        $ostream->write($s);\n    }\n\n    private function readGuidRaw($ostream, $tag) {\n        $s = $tag . $this->stream->read(38);\n        $ostream->write($s);\n    }\n\n    private function readComplexRaw($ostream, $tag) {\n        $s = $tag .\n             $this->stream->readuntil(HproseTags::TagOpenbrace) .\n             HproseTags::TagOpenbrace;\n        $ostream->write($s);\n        while (($tag = $this->stream->getc()) != HproseTags::TagClosebrace) {\n            $this->readRaw($ostream, $tag);\n        }\n        $ostream->write($tag);\n    }\n}\n\nclass HproseSimpleReader extends HproseRawReader {\n    private $classref;\n    function __construct(&$stream) {\n        parent::__construct($stream);\n        $this->classref = array();\n    }\n    public function &unserialize($tag = NULL) {\n        if (is_null($tag)) {\n            $tag = $this->stream->getc();\n        }\n        $result = NULL;\n        switch ($tag) {\n            case '0':\n            case '1':\n            case '2':\n            case '3':\n            case '4':\n            case '5':\n            case '6':\n            case '7':\n            case '8':\n            case '9':\n                $result = (int)$tag; break;\n            case HproseTags::TagInteger: $result = $this->readInteger(); break;\n            case HproseTags::TagLong: $result = $this->readLong(); break;\n            case HproseTags::TagDouble: $result = $this->readDouble(); break;\n            case HproseTags::TagNull: break;\n            case HproseTags::TagEmpty: $result = ''; break;\n            case HproseTags::TagTrue: $result = true; break;\n            case HproseTags::TagFalse: $result = false; break;\n            case HproseTags::TagNaN: $result = log(-1); break;\n            case HproseTags::TagInfinity: $result = $this->readInfinity(); break;\n            case HproseTags::TagDate: $result = $this->readDate(); break;\n            case HproseTags::TagTime: $result = $this->readTime(); break;\n            case HproseTags::TagBytes: $result = $this->readBytes(); break;\n            case HproseTags::TagUTF8Char: $result = $this->readUTF8Char(); break;            \n            case HproseTags::TagString: $result = $this->readString(); break;\n            case HproseTags::TagGuid: $result = $this->readGuid(); break;\n            case HproseTags::TagList: $result = &$this->readList(); break;\n            case HproseTags::TagMap: $result = &$this->readMap(); break;\n            case HproseTags::TagClass: $this->readClass(); $result = &$this->unserialize(); break;\n            case HproseTags::TagObject: $result = $this->readObject(); break;\n            case HproseTags::TagError: throw new HproseException($this->readString(true));\n            case false: throw new HproseException('No byte found in stream');\n            default: throw new HproseException(\"Unexpected serialize tag '$tag' in stream\");\n        }\n        return $result;\n    }\n    public function checkTag($expectTag, $tag = NULL) {\n        if (is_null($tag)) $tag = $this->stream->getc();\n        if ($tag != $expectTag) {\n            throw new HproseException(\"Tag '$expectTag' expected, but '$tag' found in stream\");\n        }\n    }\n    public function checkTags($expectTags, $tag = NULL) {\n        if (is_null($tag)) $tag = $this->stream->getc();\n        if (!in_array($tag, $expectTags)) {\n            $expectTags = implode('', $expectTags);\n            throw new HproseException(\"Tag '$expectTags' expected, but '$tag' found in stream\");\n        }\n        return $tag;\n    }\n    public function readInteger($includeTag = false) {\n        if ($includeTag) {\n            $tag = $this->stream->getc();\n            if (($tag >= '0') && ($tag <= '9')) {\n                return (int)$tag;\n            }\n            $this->checkTag(HproseTags::TagInteger, $tag);\n        }\n        return (int)($this->stream->readuntil(HproseTags::TagSemicolon));\n    }\n    public function readLong($includeTag = false) {\n        if ($includeTag) {\n            $tag = $this->stream->getc();\n            if (($tag >= '0') && ($tag <= '9')) {\n                return $tag;\n            }\n            $this->checkTag(HproseTags::TagLong, $tag);\n        }\n        return $this->stream->readuntil(HproseTags::TagSemicolon);\n    }\n    public function readDouble($includeTag = false) {\n        if ($includeTag) {\n            $tag = $this->stream->getc();\n            if (($tag >= '0') && ($tag <= '9')) {\n                return (double)$tag;\n            }\n            $this->checkTag(HproseTags::TagDouble, $tag);\n        }\n        return (double)($this->stream->readuntil(HproseTags::TagSemicolon));\n    }\n    public function readNaN() {\n        $this->checkTag(HproseTags::TagNaN);\n        return log(-1);\n    }\n    public function readInfinity($includeTag = false) {\n        if ($includeTag) $this->checkTag(HproseTags::TagInfinity);\n        return (($this->stream->getc() == HproseTags::TagNeg) ? log(0) : -log(0));\n    }\n    public function readNull() {\n        $this->checkTag(HproseTags::TagNull);\n        return NULL;\n    }\n    public function readEmpty() {\n        $this->checkTag(HproseTags::TagEmpty);\n        return '';\n    }\n    public function readBoolean() {\n        $tag = $this->checkTags(array(HproseTags::TagTrue, HproseTags::TagFalse));\n        return ($tag == HproseTags::TagTrue);\n    }\n    public function readDate($includeTag = false) {\n        if ($includeTag) $this->checkTag(HproseTags::TagDate);\n        $year = (int)($this->stream->read(4));\n        $month = (int)($this->stream->read(2));\n        $day = (int)($this->stream->read(2));\n        $tag = $this->stream->getc();\n        if ($tag == HproseTags::TagTime) {\n            $hour = (int)($this->stream->read(2));\n            $minute = (int)($this->stream->read(2));\n            $second = (int)($this->stream->read(2));\n            $microsecond = 0;\n            $tag = $this->stream->getc();\n            if ($tag == HproseTags::TagPoint) {\n                $microsecond = (int)($this->stream->read(3)) * 1000;\n                $tag = $this->stream->getc();\n                if (($tag >= '0') && ($tag <= '9')) {\n                    $microsecond += (int)($tag) * 100 + (int)($this->stream->read(2));\n                    $tag = $this->stream->getc();\n                    if (($tag >= '0') && ($tag <= '9')) {\n                        $this->stream->skip(2);\n                        $tag = $this->stream->getc();\n                    }\n                }\n            }\n            if ($tag == HproseTags::TagUTC) {\n                $date = new HproseDateTime($year, $month, $day,\n                                            $hour, $minute, $second,\n                                            $microsecond, true);\n            }\n            else {\n                $date = new HproseDateTime($year, $month, $day,\n                                            $hour, $minute, $second,\n                                            $microsecond);\n            }\n        }\n        elseif ($tag == HproseTags::TagUTC) {\n            $date = new HproseDate($year, $month, $day, true);            \n        }\n        else {\n            $date = new HproseDate($year, $month, $day);\n        }\n        return $date;\n    }\n    public function readTime($includeTag = false) {\n        if ($includeTag) $this->checkTag(HproseTags::TagTime);\n        $hour = (int)($this->stream->read(2));\n        $minute = (int)($this->stream->read(2));\n        $second = (int)($this->stream->read(2));\n        $microsecond = 0;\n        $tag = $this->stream->getc();\n        if ($tag == HproseTags::TagPoint) {\n            $microsecond = (int)($this->stream->read(3)) * 1000;\n            $tag = $this->stream->getc();\n            if (($tag >= '0') && ($tag <= '9')) {\n                $microsecond += (int)($tag) * 100 + (int)($this->stream->read(2));\n                $tag = $this->stream->getc();\n                if (($tag >= '0') && ($tag <= '9')) {\n                    $this->stream->skip(2);\n                    $tag = $this->stream->getc();\n                }\n            }\n        }\n        if ($tag == HproseTags::TagUTC) {\n            $time = new HproseTime($hour, $minute, $second, $microsecond, true);\n        }\n        else {\n            $time = new HproseTime($hour, $minute, $second, $microsecond);\n        }\n        return $time;\n    }\n    public function readBytes($includeTag = false) {\n        if ($includeTag) $this->checkTag(HproseTags::TagBytes);\n        $count = (int)($this->stream->readuntil(HproseTags::TagQuote));\n        $bytes = $this->stream->read($count);\n        $this->stream->skip(1);\n        return $bytes;\n    }\n    public function readUTF8Char($includeTag = false) {\n        if ($includeTag) $this->checkTag(HproseTags::TagUTF8Char);\n        $c = $this->stream->getc();\n        $s = $c;\n        $a = ord($c);\n        if (($a & 0xE0) == 0xC0) {\n            $s .= $this->stream->getc();\n        }\n        elseif (($a & 0xF0) == 0xE0) {\n            $s .= $this->stream->read(2);\n        }\n        elseif ($a > 0x7F) {\n            throw new HproseException(\"bad utf-8 encoding\");\n        }\n        return $s;\n    }\n    public function readString($includeTag = false) {\n        if ($includeTag) $this->checkTag(HproseTags::TagString);\n        $len = (int)$this->stream->readuntil(HproseTags::TagQuote);\n        $this->stream->mark();\n        $utf8len = 0;\n        for ($i = 0; $i < $len; ++$i) {\n            switch (ord($this->stream->getc()) >> 4) {\n                case 0:\n                case 1:\n                case 2:\n                case 3:\n                case 4:\n                case 5:\n                case 6:\n                case 7: {\n                    // 0xxx xxxx\n                    $utf8len++;\n                    break;\n                }\n                case 12:\n                case 13: {\n                    // 110x xxxx   10xx xxxx\n                    $this->stream->skip(1);\n                    $utf8len += 2;\n                    break;\n                }\n                case 14: {\n                    // 1110 xxxx  10xx xxxx  10xx xxxx\n                    $this->stream->skip(2);\n                    $utf8len += 3;\n                    break;\n                }\n                case 15: {\n                    // 1111 0xxx  10xx xxxx  10xx xxxx  10xx xxxx\n                    $this->stream->skip(3);\n                    $utf8len += 4;\n                    ++$i;\n                    break;\n                }\n                default: {\n                    throw new HproseException('bad utf-8 encoding');\n                }\n            }\n        }\n        $this->stream->reset();\n        $this->stream->unmark();\n        $s = $this->stream->read($utf8len);\n        $this->stream->skip(1);\n        return $s;\n    }\n    public function readGuid($includeTag = false) {\n        if ($includeTag) $this->checkTag(HproseTags::TagGuid);\n        $this->stream->skip(1);\n        $s = $this->stream->read(36);\n        $this->stream->skip(1);\n        return $s;\n    }\n    protected function &readListBegin() {\n        $list = array();\n        return $list;\n    }\n    protected function &readListEnd(&$list) {\n        $count = (int)$this->stream->readuntil(HproseTags::TagOpenbrace);\n        for ($i = 0; $i < $count; ++$i) {\n            $list[] = &$this->unserialize();\n        }\n        $this->stream->skip(1);\n        return $list;\n    }\n    public function &readList($includeTag = false) {\n        if ($includeTag) $this->checkTag(HproseTags::TagList);\n        $list = &$this->readListBegin();\n        return $this->readListEnd($list);\n    }\n    protected function &readMapBegin() {\n        $map = array();\n        return $map;\n    }\n    protected function &readMapEnd(&$map) {\n        $count = (int)$this->stream->readuntil(HproseTags::TagOpenbrace);\n        for ($i = 0; $i < $count; ++$i) {\n            $key = &$this->unserialize();\n            $map[$key] = &$this->unserialize();\n        }\n        $this->stream->skip(1);\n        return $map;\n    }\n    public function &readMap($includeTag = false) {\n        if ($includeTag) $this->checkTag(HproseTags::TagMap);\n        $map = &$this->readMapBegin();\n        return $this->readMapEnd($map);\n    }\n    protected function readObjectBegin() {\n        list($classname, $fields) = $this->classref[(int)$this->stream->readuntil(HproseTags::TagOpenbrace)];\n        $object = new $classname;\n        return array($object, $fields);\n    }\n    protected function readObjectEnd($object, $fields) {\n        $count = count($fields);\n        if (class_exists('ReflectionClass')) {\n            $reflector = new ReflectionClass($object);\n            for ($i = 0; $i < $count; ++$i) {\n                $field = $fields[$i];\n                if ($reflector->hasProperty($field)) {\n                    $property = $reflector->getProperty($field);\n                    $property->setAccessible(true);\n                    $property->setValue($object, $this->unserialize());\n                }\n                else {\n                    $object->$field = &$this->unserialize();\n                }\n            }\n        }\n        else {\n            for ($i = 0; $i < $count; ++$i) {\n                $object->$fields[$i] = &$this->unserialize();\n            }\n        }\n        $this->stream->skip(1);\n        return $object;\n    }\n    public function readObject($includeTag = false) {\n        if ($includeTag) {\n            $tag = $this->checkTags(array(HproseTags::TagClass, HproseTags::TagObject));\n            if ($tag == HproseTags::TagClass) {\n                $this->readClass();\n                return $this->readObject(true);\n            }\n        }\n        list($object, $fields) = $this->readObjectBegin();\n        return $this->readObjectEnd($object, $fields);\n    }\n    protected function readClass() {\n        $classname = HproseClassManager::getClass(self::readString());\n        $count = (int)$this->stream->readuntil(HproseTags::TagOpenbrace);\n        $fields = array();\n        for ($i = 0; $i < $count; ++$i) {\n            $fields[] = $this->readString(true);\n        }\n        $this->stream->skip(1);\n        $this->classref[] = array($classname, $fields);\n    }\n    public function reset() {\n        $this->classref = array();\n    }\n}\n\nclass HproseReader extends HproseSimpleReader {\n    private $ref;\n    function __construct(&$stream) {\n        parent::__construct($stream);\n        $this->ref = array();\n    }\n    public function &unserialize($tag = NULL) {\n        if (is_null($tag)) {\n            $tag = $this->stream->getc();\n        }\n        if ($tag == HproseTags::TagRef) {\n            return $this->readRef();\n        }\n        return parent::unserialize($tag);\n    }\n    public function readDate($includeTag = false) {\n        if ($includeTag) {\n            $tag = $this->checkTags(array(HproseTags::TagDate, HproseTags::TagRef));\n            if ($tag == HproseTags::TagRef) return $this->readRef();\n        }\n        $date = parent::readDate();\n        $this->ref[] = $date;\n        return $date;\n    }\n    public function readTime($includeTag = false) {\n        if ($includeTag) {\n            $tag = $this->checkTags(array(HproseTags::TagTime, HproseTags::TagRef));\n            if ($tag == HproseTags::TagRef) return $this->readRef();\n        }\n        $time = parent::readTime();\n        $this->ref[] = $time;\n        return $time;\n    }\n    public function readBytes($includeTag = false) {\n        if ($includeTag) {\n            $tag = $this->checkTags(array(HproseTags::TagBytes, HproseTags::TagRef));\n            if ($tag == HproseTags::TagRef) return $this->readRef();\n        }\n        $bytes = parent::readBytes();\n        $this->ref[] = $bytes;\n        return $bytes;\n    }\n    public function readString($includeTag = false) {\n        if ($includeTag) {\n            $tag = $this->checkTags(array(HproseTags::TagString, HproseTags::TagRef));\n            if ($tag == HproseTags::TagRef) return $this->readRef();\n        }\n        $str = parent::readString();\n        $this->ref[] = $str;\n        return $str;\n    }\n    public function readGuid($includeTag = false) {\n        if ($includeTag) {\n            $tag = $this->checkTags(array(HproseTags::TagGuid, HproseTags::TagRef));\n            if ($tag == HproseTags::TagRef) return $this->readRef();\n        }\n        $guid = parent::readGuid();\n        $this->ref[] = $guid;\n        return $guid;\n    }\n    public function &readList($includeTag = false) {\n        if ($includeTag) {\n            $tag = $this->checkTags(array(HproseTags::TagList, HproseTags::TagRef));\n            if ($tag == HproseTags::TagRef) return $this->readRef();\n        }\n        $list = &$this->readListBegin();\n        $this->ref[] = &$list;\n        return $this->readListEnd($list);\n    }\n    public function &readMap($includeTag = false) {\n        if ($includeTag) {\n            $tag = $this->checkTags(array(HproseTags::TagMap, HproseTags::TagRef));\n            if ($tag == HproseTags::TagRef) return $this->readRef();\n        }\n        $map = &$this->readMapBegin();\n        $this->ref[] = &$map;\n        return $this->readMapEnd($map);\n    }\n    public function readObject($includeTag = false) {\n        if ($includeTag) {\n            $tag = $this->checkTags(array(HproseTags::TagClass, HproseTags::TagObject, HproseTags::TagRef));\n            if ($tag == HproseTags::TagRef) return $this->readRef();\n            if ($tag == HproseTags::TagClass) {\n                $this->readClass();\n                return $this->readObject(true);\n            }\n        }\n        list($object, $fields) = $this->readObjectBegin();\n        $this->ref[] = $object;\n        return $this->readObjectEnd($object, $fields);\n    }\n    private function &readRef() {\n        $ref = &$this->ref[(int)$this->stream->readuntil(HproseTags::TagSemicolon)];\n        if (gettype($ref) == 'array') {\n            $result = &$ref;\n        }\n        else {\n            $result = $ref;\n        }\n        return $result;\n    }\n    public function reset() {\n        parent::reset();\n        $this->ref = array();\n    }\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Hprose/HproseTags.php",
    "content": "<?php\n/**********************************************************\\\n|                                                          |\n|                          hprose                          |\n|                                                          |\n| Official WebSite: http://www.hprose.com/                 |\n|                   http://www.hprose.net/                 |\n|                   http://www.hprose.org/                 |\n|                                                          |\n\\**********************************************************/\n\n/**********************************************************\\\n *                                                        *\n * HproseTags.php                                         *\n *                                                        *\n * hprose tags library for php5.                          *\n *                                                        *\n * LastModified: Nov 10, 2010                             *\n * Author: Ma Bingyao <andot@hprfc.com>                   *\n *                                                        *\n\\**********************************************************/\n\nclass HproseTags {\n    /* Serialize Tags */\n    const TagInteger = 'i';\n    const TagLong = 'l';\n    const TagDouble = 'd';\n    const TagNull = 'n';\n    const TagEmpty = 'e';\n    const TagTrue = 't';\n    const TagFalse = 'f';\n    const TagNaN = 'N';\n    const TagInfinity = 'I';\n    const TagDate = 'D';\n    const TagTime = 'T';\n    const TagUTC = 'Z';\n    const TagBytes = 'b';\n    const TagUTF8Char = 'u';\n    const TagString = 's';\n    const TagGuid = 'g';\n    const TagList = 'a';\n    const TagMap = 'm';\n    const TagClass = 'c';\n    const TagObject = 'o';\n    const TagRef = 'r';\n    /* Serialize Marks */\n    const TagPos = '+';\n    const TagNeg = '-';\n    const TagSemicolon = ';';\n    const TagOpenbrace = '{';\n    const TagClosebrace = '}';\n    const TagQuote = '\"';\n    const TagPoint = '.';\n    /* Protocol Tags */\n    const TagFunctions = 'F';\n    const TagCall = 'C';\n    const TagResult = 'R';\n    const TagArgument = 'A';\n    const TagError = 'E';\n    const TagEnd = 'z';\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Hprose/HproseWriter.php",
    "content": "<?php\n/**********************************************************\\\n|                                                          |\n|                          hprose                          |\n|                                                          |\n| Official WebSite: http://www.hprose.com/                 |\n|                   http://www.hprose.net/                 |\n|                   http://www.hprose.org/                 |\n|                                                          |\n\\**********************************************************/\n\n/**********************************************************\\\n *                                                        *\n * HproseWriter.php                                       *\n *                                                        *\n * hprose writer library for php5.                        *\n *                                                        *\n * LastModified: Nov 13, 2013                             *\n * Author: Ma Bingyao <andot@hprfc.com>                   *\n *                                                        *\n\\**********************************************************/\n\nrequire_once('HproseCommon.php');\nrequire_once('HproseTags.php');\nrequire_once('HproseClassManager.php');\n\nclass HproseSimpleWriter {\n    public $stream;\n    private $classref;\n    private $fieldsref;\n    function __construct(&$stream) {\n        $this->stream = &$stream;\n        $this->classref = array();\n        $this->fieldsref = array();\n    }\n    public function serialize(&$var) {\n        if ((!isset($var)) || ($var === NULL)) {\n            $this->writeNull();\n        }\n        elseif (is_scalar($var)) {\n            if (is_int($var)) {\n                $this->writeInteger($var);\n            }\n            elseif (is_bool($var)) {\n                $this->writeBoolean($var);\n            }\n            elseif (is_float($var)) {\n                $this->writeDouble($var);\n            }\n            elseif (is_string($var)) {\n                if ($var === '') {\n                    $this->writeEmpty();\n                }\n                elseif ((strlen($var) < 4) && is_utf8($var) && (ustrlen($var) == 1)) {\n                    $this->writeUTF8Char($var);\n                }\n                elseif (is_utf8($var)) {\n                    $this->writeString($var, true);\n                }\n                else {\n                    $this->writeBytes($var, true);\n                }\n            }\n        }\n        elseif (is_array($var)) {\n            if (is_list($var)) {\n                $this->writeList($var, true);\n            }\n            else {\n               $this->writeMap($var, true);\n            }\n        }\n        elseif (is_object($var)) {\n            if ($var instanceof stdClass) {\n                $this->writeStdObject($var, true);\n            }\n            elseif (($var instanceof HproseDate) || ($var instanceof HproseDateTime)) {\n                $this->writeDate($var, true);\n            }\n            elseif ($var instanceof HproseTime) {\n                $this->writeTime($var, true);\n            }\n            else {\n                $this->writeObject($var, true);\n            }\n        }\n        else {\n            throw new HproseException('Not support to serialize this data');\n        }\n    }\n    public function writeInteger($integer) {\n        if ($integer >= 0 && $integer <= 9) {\n            $this->stream->write((string)$integer);\n        }\n        else {\n            $this->stream->write(HproseTags::TagInteger . $integer . HproseTags::TagSemicolon);\n        }\n    }\n    public function writeLong($long) {\n        if ($long >= '0' && $long <= '9') {\n            $this->stream->write($long);\n        }\n        else {\n            $this->stream->write(HproseTags::TagLong . $long . HproseTags::TagSemicolon);\n        }\n    }\n    public function writeDouble($double) {\n        if (is_nan($double)) {\n            $this->writeNaN();\n        }\n        elseif (is_infinite($double)) {\n            $this->writeInfinity($double > 0);\n        }\n        else {\n            $this->stream->write(HproseTags::TagDouble . $double . HproseTags::TagSemicolon);\n        }\n    }\n    public function writeNaN() {\n        $this->stream->write(HproseTags::TagNaN);\n    }\n    public function writeInfinity($positive = true) {\n        $this->stream->write(HproseTags::TagInfinity . ($positive ? HproseTags::TagPos : HproseTags::TagNeg));\n    }\n    public function writeNull() {\n        $this->stream->write(HproseTags::TagNull);\n    }\n    public function writeEmpty() {\n        $this->stream->write(HproseTags::TagEmpty);\n    }\n    public function writeBoolean($bool) {\n        $this->stream->write($bool ? HproseTags::TagTrue : HproseTags::TagFalse);\n    }\n    public function writeDate($date, $checkRef = false) {\n        if ($date->utc) {\n            $this->stream->write(HproseTags::TagDate . $date->toString(false));\n        }\n        else {\n            $this->stream->write(HproseTags::TagDate . $date->toString(false) . HproseTags::TagSemicolon);\n        }\n    }\n    public function writeTime($time, $checkRef = false) {\n        if ($time->utc) {\n            $this->stream->write(HproseTags::TagTime . $time->toString(false));\n        }\n        else {\n            $this->stream->write(HproseTags::TagTime . $time->toString(false) . HproseTags::TagSemicolon);\n        }\n    }\n    public function writeBytes($bytes, $checkRef = false) {\n        $len = strlen($bytes);\n        $this->stream->write(HproseTags::TagBytes);\n        if ($len > 0) $this->stream->write((string)$len);\n        $this->stream->write(HproseTags::TagQuote . $bytes . HproseTags::TagQuote);\n    }\n    public function writeUTF8Char($char) {\n        $this->stream->write(HproseTags::TagUTF8Char . $char);\n    }\n    public function writeString($str, $checkRef = false) {\n        $len = ustrlen($str);\n        $this->stream->write(HproseTags::TagString);\n        if ($len > 0) $this->stream->write((string)$len);\n        $this->stream->write(HproseTags::TagQuote . $str . HproseTags::TagQuote);\n    }\n    public function writeList(&$list, $checkRef = false) {\n        $count = count($list);\n        $this->stream->write(HproseTags::TagList);\n        if ($count > 0) $this->stream->write((string)$count); \n        $this->stream->write(HproseTags::TagOpenbrace);\n        for ($i = 0; $i < $count; ++$i) {\n            $this->serialize($list[$i]);\n        }\n        $this->stream->write(HproseTags::TagClosebrace);\n    }\n    public function writeMap(&$map, $checkRef = false) {\n        $count = count($map);\n        $this->stream->write(HproseTags::TagMap);\n        if ($count > 0) $this->stream->write((string)$count); \n        $this->stream->write(HproseTags::TagOpenbrace);\n        foreach ($map as $key => &$value) {\n            $this->serialize($key);\n            $this->serialize($value);\n        }\n        $this->stream->write(HproseTags::TagClosebrace);\n    }\n    public function writeStdObject($obj, $checkRef = false) {\n        $map = (array)$obj;\n        self::writeMap($map);\n    }\n    protected function writeObjectBegin($obj) {\n        $class = get_class($obj);\n        $alias = HproseClassManager::getClassAlias($class);\n        $fields = array_keys((array)$obj);\n        if (array_key_exists($alias, $this->classref)) {\n            $index = $this->classref[$alias];\n        }\n        else {\n            $index = $this->writeClass($alias, $fields);\n        }\n        return $index;\n    }\n    protected function writeObjectEnd($obj, $index) {\n            $fields = $this->fieldsref[$index];\n            $count = count($fields);\n            $this->stream->write(HproseTags::TagObject . $index . HproseTags::TagOpenbrace);\n            $array = (array)$obj;\n            for ($i = 0; $i < $count; ++$i) {\n                $this->serialize($array[$fields[$i]]);\n            }\n            $this->stream->write(HproseTags::TagClosebrace);\n    }\n    public function writeObject($obj, $checkRef = false) {\n        $this->writeObjectEnd($obj, $this->writeObjectBegin($obj));\n    }\n    protected function writeClass($alias, $fields) {\n        $len = ustrlen($alias);\n        $this->stream->write(HproseTags::TagClass . $len .\n                             HproseTags::TagQuote . $alias . HproseTags::TagQuote);\n        $count = count($fields);\n        if ($count > 0) $this->stream->write((string)$count);\n        $this->stream->write(HproseTags::TagOpenbrace);\n        for ($i = 0; $i < $count; ++$i) {\n            $field = $fields[$i];\n            if ($field{0} === \"\\0\") {\n                $field = substr($field, strpos($field, \"\\0\", 1) + 1);\n            }\n            $this->writeString($field);\n        }\n        $this->stream->write(HproseTags::TagClosebrace);\n        $index = count($this->fieldsref);\n        $this->classref[$alias] = $index;\n        $this->fieldsref[$index] = $fields;\n        return $index;\n    }\n    public function reset() {\n        $this->classref = array();\n        $this->fieldsref = array();\n    }\n}\nclass HproseWriter extends HproseSimpleWriter {\n    private $ref;\n    private $arrayref;\n    function __construct(&$stream) {\n        parent::__construct($stream);\n        $this->ref = array();\n        $this->arrayref = array();\n    }\n    private function writeRef(&$obj, $checkRef, $writeBegin, $writeEnd) {\n        if (is_string($obj)) {\n            $key = 's_' . $obj;\n        }\n        elseif (is_array($obj)) {\n            if (($i = array_ref_search($obj, $this->arrayref)) === false) {\n                $i = count($this->arrayref);\n                $this->arrayref[$i] = &$obj;\n            }\n            $key = 'a_' . $i;\n        }\n        else {\n            $key = 'o_' . spl_object_hash($obj);\n        }\n        if ($checkRef && array_key_exists($key, $this->ref)) {\n            $this->stream->write(HproseTags::TagRef . $this->ref[$key] . HproseTags::TagSemicolon);\n        }\n        else {\n            $result = $writeBegin ? call_user_func_array($writeBegin, array(&$obj)) : false;\n            $index = count($this->ref);\n            $this->ref[$key] = $index;\n            call_user_func_array($writeEnd, array(&$obj, $result));\n        }\n    }\n    public function writeDate($date, $checkRef = false) {\n        $this->writeRef($date, $checkRef, NULL, array(&$this, 'parent::writeDate'));\n    }\n    public function writeTime($time, $checkRef = false) {\n        $this->writeRef($time, $checkRef, NULL, array(&$this, 'parent::writeTime'));\n    }\n    public function writeBytes($bytes, $checkRef = false) {\n        $this->writeRef($bytes, $checkRef, NULL, array(&$this, 'parent::writeBytes'));\n    }\n    public function writeString($str, $checkRef = false) {\n        $this->writeRef($str, $checkRef, NULL, array(&$this, 'parent::writeString'));\n    }\n    public function writeList(&$list, $checkRef = false) {\n        $this->writeRef($list, $checkRef, NULL, array(&$this, 'parent::writeList'));\n    }\n    public function writeMap(&$map, $checkRef = false) {\n        $this->writeRef($map, $checkRef, NULL, array(&$this, 'parent::writeMap'));\n    }\n    public function writeStdObject($obj, $checkRef = false) {\n        $this->writeRef($obj, $checkRef, NULL, array(&$this, 'parent::writeStdObject'));\n    }\n    public function writeObject($obj, $checkRef = false) {\n        $this->writeRef($obj, $checkRef, array(&$this, 'writeObjectBegin'), array(&$this, 'writeObjectEnd'));\n    }\n    public function reset() {\n        parent::reset();\n        $this->ref = array();\n        $this->arrayref = array();\n    }\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/README.txt",
    "content": "﻿第三方类库包目录"
  },
  {
    "path": "ThinkPHP/Library/Vendor/SmartTemplate/class.smarttemplate.php",
    "content": "<?php\n\t/**\n\t* SmartTemplate Class\n\t*\n\t* 'Compiles' HTML-Templates to PHP Code\n\t*\n\t*\n\t* Usage Example I:\n\t*\n\t* $page = new SmartTemplate( \"template.html\" );\n\t* $page->assign( 'TITLE',  'TemplateDemo - Userlist' );\n\t* $page->assign( 'user',   DB_read_all( 'select * from ris_user' ) );\n\t* $page->output();\n\t*\n\t* Usage Example II:\n\t*\n\t* $data = array(\n\t*             'TITLE' => 'TemplateDemo - Userlist',\n\t*             'user'  => DB_read_all( 'select * from ris_user' )\n\t*         );\n\t* $page = new SmartTemplate( \"template.html\" );\n\t* $page->output( $data );\n\t*\n\t*\n\t* @author Philipp v. Criegern philipp@criegern.com\n\t* @author Manuel 'EndelWar' Dalla Lana endelwar@aregar.it\n\t* @version 1.2.1 03.07.2006\n\t*\n\t* CVS ID: $Id: class.smarttemplate.php 2504 2011-12-28 07:35:29Z liu21st $\n\t*/\n\tclass SmartTemplate\n\t{\n\t\t/**\n\t\t* Whether to store compiled php code or not (for debug purpose)\n\t\t*\n\t\t* @access public\n\t\t*/\n\t\tvar $reuse_code\t\t= true;\n\n\t\t/**\n\t\t* Directory where all templates are stored\n\t\t* Can be overwritten by global configuration array $_CONFIG['template_dir']\n\t\t*\n\t\t* @access public\n\t\t*/\n\t\tvar $template_dir\t= 'templates/';\n\n\t\t/**\n\t\t* Where to store compiled templates\n\t\t* Can be overwritten by global configuration array $_CONFIG['smarttemplate_compiled']\n\t\t*\n\t\t* @access public\n\t\t*/\n\t\tvar $temp_dir\t\t= 'templates_c/';\n\n\t\t/**\n\t\t* Temporary folder for output cache storage\n\t\t* Can be overwritten by global configuration array $_CONFIG['smarttemplate_cache']\n\t\t*\n\t\t* @access public\n\t\t*/\n\t\tvar $cache_dir      =  'templates_c/';\n\n\t\t/**\n\t\t* Default Output Cache Lifetime in Seconds\n\t\t* Can be overwritten by global configuration array $_CONFIG['cache_lifetime']\n\t\t*\n\t\t* @access public\n\t\t*/\n\t\tvar $cache_lifetime =  600;\n\n\t\t/**\n\t\t* Temporary file for output cache storage\n\t\t*\n\t\t* @access private\n\t\t*/\n\t\tvar $cache_filename;\n\n\t\t/**\n\t\t* The template filename\n\t\t*\n\t\t* @access private\n\t\t*/\n\t\tvar $tpl_file;\n\n\t\t/**\n\t\t* The compiled template filename\n\t\t*\n\t\t* @access private\n\t\t*/\n\t\tvar $cpl_file;\n\n\t\t/**\n\t\t* Template content array\n\t\t*\n\t\t* @access private\n\t\t*/\n\t\tvar $data = array();\n\n\t\t/**\n\t\t* Parser Class\n\t\t*\n\t\t* @access private\n\t\t*/\n\t\tvar $parser;\n\n\t\t/**\n\t\t* Debugger Class\n\t\t*\n\t\t* @access private\n\t\t*/\n\t\tvar $debugger;\n\n\t\t/**\n\t\t* SmartTemplate Constructor\n\t\t*\n\t\t* @access public\n\t\t* @param string $template_filename Template Filename\n\t\t*/\n\t\tfunction SmartTemplate ( $template_filename = '' )\n\t\t{\n\t\t\tglobal $_CONFIG;\n\n\t\t\tif (!empty($_CONFIG['smarttemplate_compiled']))\n\t\t\t{\n\t\t\t\t$this->temp_dir  =  $_CONFIG['smarttemplate_compiled'];\n\t\t\t}\n\t\t\tif (!empty($_CONFIG['smarttemplate_cache']))\n\t\t\t{\n\t\t\t\t$this->cache_dir  =  $_CONFIG['smarttemplate_cache'];\n\t\t\t}\n\t\t\tif (is_numeric($_CONFIG['cache_lifetime']))\n\t\t\t{\n\t\t\t\t$this->cache_lifetime  =  $_CONFIG['cache_lifetime'];\n\t\t\t}\n\t\t\tif (!empty($_CONFIG['template_dir'])  &&  is_file($_CONFIG['template_dir'] . '/' . $template_filename))\n\t\t\t{\n\t\t\t\t$this->template_dir  =  $_CONFIG['template_dir'];\n\t\t\t}\n\t\t\t$this->tpl_file  =  $template_filename;\n\t\t}\n\n\t\t//  DEPRECATED METHODS\n\t\t//\tMethods used in older parser versions, soon will be removed\n\t\tfunction set_templatefile ($template_filename)\t{\t$this->tpl_file  =  $template_filename;\t}\n\t\tfunction add_value ($name, $value )\t\t\t\t{\t$this->assign($name, $value);\t}\n\t\tfunction add_array ($name, $value )\t\t\t\t{\t$this->append($name, $value);\t}\n\n\n\t\t/**\n\t\t* Assign Template Content\n\t\t*\n\t\t* Usage Example:\n\t\t* $page->assign( 'TITLE',     'My Document Title' );\n\t\t* $page->assign( 'userlist',  array(\n\t\t*                                 array( 'ID' => 123,  'NAME' => 'John Doe' ),\n\t\t*                                 array( 'ID' => 124,  'NAME' => 'Jack Doe' ),\n\t\t*                             );\n\t\t*\n\t\t* @access public\n\t\t* @param string $name Parameter Name\n\t\t* @param mixed $value Parameter Value\n\t\t* @desc Assign Template Content\n\t\t*/\n\t\tfunction assign ( $name, $value = '' )\n\t\t{\n\t\t\tif (is_array($name))\n\t\t\t{\n\t\t\t\tforeach ($name as $k => $v)\n\t\t\t\t{\n\t\t\t\t\t$this->data[$k]  =  $v;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->data[$name]  =  $value;\n\t\t\t}\n\t\t}\n\n\n\t\t/**\n\t\t* Assign Template Content\n\t\t*\n\t\t* Usage Example:\n\t\t* $page->append( 'userlist',  array( 'ID' => 123,  'NAME' => 'John Doe' ) );\n\t\t* $page->append( 'userlist',  array( 'ID' => 124,  'NAME' => 'Jack Doe' ) );\n\t\t*\n\t\t* @access public\n\t\t* @param string $name Parameter Name\n\t\t* @param mixed $value Parameter Value\n\t\t* @desc Assign Template Content\n\t\t*/\n\t\tfunction append ( $name, $value )\n\t\t{\n\t\t\tif (is_array($value))\n\t\t\t{\n\t\t\t\t$this->data[$name][]  =  $value;\n\t\t\t}\n\t\t\telseif (!is_array($this->data[$name]))\n\t\t\t{\n\t\t\t\t$this->data[$name]  .=  $value;\n\t\t\t}\n\t\t}\n\n\n\t\t/**\n\t\t* Parser Wrapper\n\t\t* Returns Template Output as a String\n\t\t*\n\t\t* @access public\n\t\t* @param array $_top Content Array\n\t\t* @return string  Parsed Template\n\t\t* @desc Output Buffer Parser Wrapper\n\t\t*/\n\t\tfunction result ( $_top = '' )\n\t\t{\n\t\t\tob_start();\n\t\t\t$this->output( $_top );\n\t\t\t$result  =  ob_get_contents();\n\t\t\tob_end_clean();\n\t\t\treturn $result;\n\t\t}\n\n\n\t\t/**\n\t\t* Execute parsed Template\n\t\t* Prints Parsing Results to Standard Output\n\t\t*\n\t\t* @access public\n\t\t* @param array $_top Content Array\n\t\t* @desc Execute parsed Template\n\t\t*/\n\t\tfunction output ( $_top = '' )\n\t\t{\n\t\t\tglobal $_top;\n\n\t\t\t//\tMake sure that folder names have a trailing '/'\n\t\t\tif (strlen($this->template_dir)  &&  substr($this->template_dir, -1) != '/')\n\t\t\t{\n\t\t\t\t$this->template_dir  .=  '/';\n\t\t\t}\n\t\t\tif (strlen($this->temp_dir)  &&  substr($this->temp_dir, -1) != '/')\n\t\t\t{\n\t\t\t\t$this->temp_dir  .=  '/';\n\t\t\t}\n\t\t\t//\tPrepare Template Content\n\t\t\tif (!is_array($_top))\n\t\t\t{\n\t\t\t\tif (strlen($_top))\n\t\t\t\t{\n\t\t\t\t\t$this->tpl_file  =  $_top;\n\t\t\t\t}\n\t\t\t\t$_top  =  $this->data;\n\t\t\t}\n\t\t\t$_obj  =  &$_top;\n\t\t\t$_stack_cnt  =  0;\n\t\t\t$_stack[$_stack_cnt++]  =  $_obj;\n\n\t\t\t//\tCheck if template is already compiled\n\t\t\t$cpl_file_name = preg_replace('/[:\\/.\\\\\\\\]/', '_', $this->tpl_file);\n\t\t\tif (strlen($cpl_file_name) > 0)\n\t\t\t{\n\t    \t\t$this->cpl_file  =  $this->temp_dir . $cpl_file_name . '.php';\n\t\t\t\t$compile_template  =  true;\n\t\t\t\tif ($this->reuse_code)\n\t\t\t\t{\n\t\t\t\t\tif (is_file($this->cpl_file))\n\t\t\t\t\t{\n\t\t\t\t\t\tif ($this->mtime($this->cpl_file) > $this->mtime($this->template_dir . $this->tpl_file))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$compile_template  =  false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ($compile_template)\n\t\t\t\t{\n\t\t\t\t\tif (@include_once(\"class.smarttemplateparser.php\"))\n\t\t\t\t\t{\n\t\t\t\t\t\t$this->parser = new SmartTemplateParser($this->template_dir . $this->tpl_file);\n\t\t\t\t\t\tif (!$this->parser->compile($this->cpl_file))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\texit( \"SmartTemplate Parser Error: \" . $this->parser->error );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\texit( \"SmartTemplate Error: Cannot find class.smarttemplateparser.php; check SmartTemplate installation\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//\tExecute Compiled Template\n\t\t\t\tinclude($this->cpl_file);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\texit( \"SmartTemplate Error: You must set a template file name\");\n\t\t\t}\n\t\t\t//\tDelete Global Content Array in order to allow multiple use of SmartTemplate class in one script\n\t\t\tunset ($_top);\n\t\t}\n\n\n\t\t/**\n\t\t* Debug Template\n\t\t*\n\t\t* @access public\n\t\t* @param array $_top Content Array\n\t\t* @desc Debug Template\n\t\t*/\n\t\tfunction debug ( $_top = '' )\n\t\t{\n\t\t\t//\tPrepare Template Content\n\t\t\tif (!$_top)\n\t\t\t{\n\t\t\t\t$_top  =  $this->data;\n\t\t\t}\n\t\t\tif (@include_once(\"class.smarttemplatedebugger.php\"))\n\t\t\t{\n\t\t\t\t$this->debugger = new SmartTemplateDebugger($this->template_dir . $this->tpl_file);\n\t\t\t\t$this->debugger->start($_top);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\texit( \"SmartTemplate Error: Cannot find class.smarttemplatedebugger.php; check SmartTemplate installation\");\n\t\t\t}\n\t\t}\n\n\n\t\t/**\n\t\t* Start Ouput Content Buffering\n\t\t*\n\t\t* Usage Example:\n\t\t* $page = new SmartTemplate('template.html');\n\t\t* $page->use_cache();\n\t\t* ...\n\t\t*\n\t\t* @access public\n\t\t* @desc Output Cache\n\t\t*/\n\t\tfunction use_cache ( $key = '' )\n\t\t{\n\t\t\tif (empty($_POST))\n\t\t\t{\n\t\t\t\t$this->cache_filename  =  $this->cache_dir . 'cache_' . md5($_SERVER['REQUEST_URI'] . serialize($key)) . '.ser';\n\t\t\t\tif (($_SERVER['HTTP_CACHE_CONTROL'] != 'no-cache')  &&  ($_SERVER['HTTP_PRAGMA'] != 'no-cache')  &&  @is_file($this->cache_filename))\n\t\t\t\t{\n\t\t\t\t\tif ((time() - filemtime($this->cache_filename)) < $this->cache_lifetime)\n\t\t\t\t\t{\n\t\t\t\t\t\treadfile($this->cache_filename);\n\t\t\t\t\t\texit;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tob_start( array( &$this, 'cache_callback' ) );\n\t\t\t}\n\t\t}\n\n\n\t\t/**\n\t\t* Output Buffer Callback Function\n\t\t*\n\t\t* @access private\n\t\t* @param string $output\n\t\t* @return string $output\n\t\t*/\n\t\tfunction cache_callback ( $output )\n\t\t{\n\t\t\tif ($hd = @fopen($this->cache_filename, 'w'))\n\t\t\t{\n\t\t\t\tfputs($hd,  $output);\n\t\t\t\tfclose($hd);\n\t\t\t}\n\t\t\treturn $output;\n\t\t}\n\n\n\t\t/**\n\t\t* Determine Last Filechange Date (if File exists)\n\t\t*\n\t\t* @access private\n\t\t* @param string $filename\n\t\t* @return mixed\n\t\t* @desc Determine Last Filechange Date\n\t\t*/\n\t\tfunction mtime ( $filename )\n\t\t{\n\t\t\tif (@is_file($filename))\n\t\t\t{\n\t\t\t\t$ret = filemtime($filename);\n\t\t\t\treturn $ret;\n\t\t\t}\n\t\t}\n\t}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/SmartTemplate/class.smarttemplatedebugger.php",
    "content": "<?php\n\t/**\n\t* SmartTemplateDebugger Class\n\t* Used by SmartTemplate Class\n\t*\n\t* @desc Used by SmartTemplate Class\n\t* @author Philipp v. Criegern philipp@criegern.com\n\t* @author Manuel 'EndelWar' Dalla Lana endelwar@aregar.it\n\t* @version 1.2.1 03.07.2006\n\t*\n\t* CVS ID: $Id: class.smarttemplatedebugger.php 2504 2011-12-28 07:35:29Z liu21st $\n\t*/\n\tclass SmartTemplateDebugger\n\t{\n\t\t/**\n\t\t* The template Filename\n\t\t*\n\t\t* @access private\n\t\t*/\n\t\tvar $filename;\n\n\t\t/**\n\t\t* The template itself\n\t\t*\n\t\t* @access private\n\t\t*/\n\t\tvar $template;\n\n\t\t/**\n\t\t* SmartTemplateParser Constructor\n\t\t*\n\t\t* @param string $template_filename HTML Template Filename\n\t\t*/\n\t\tfunction SmartTemplateDebugger ( $template_filename )\n\t\t{\n\t\t\t$this->filename  =  $template_filename;\n\n\t\t\t//\tLoad Template\n\t        if ($hd  =  @fopen($template_filename,  \"r\"))\n\t        {\n\t\t        $this->template  =  fread($hd,  filesize($template_filename));\n\t\t        fclose($hd);\n\t\t    }\n\t\t    else\n\t\t    {\n\t\t    \t$this->template  =  \"SmartTemplate Debugger Error: File not found: '$template_filename'\";\n\t\t    }\n\t\t\t$this->tab[0]  =  '';\n\t\t\tfor ($i=1;  $i < 10;  $i++) {\n\t\t\t\t$this->tab[$i]  =  str_repeat('    ', $i);\n\t\t\t}\n\t\t}\n\n\n\t\t/**\n\t\t* Main Template Parser\n\t\t*\n\t\t* @param string $compiled_template_filename Compiled Template Filename\n\t\t* @desc Creates Compiled PHP Template\n\t\t*/\n\t\tfunction start ( $vars )\n\t\t{\n\t\t\t$page  =  $this->template;\n\n\t\t\t$page  =  preg_replace(\"/(<!-- BEGIN [ a-zA-Z0-9_.]* -->)/\",  \"\\n$1\\n\",  $page);\n\t\t\t$page  =  preg_replace(\"/(<!-- IF .+? -->)/\",  \"\\n$1\\n\",  $page);\n\t\t\t$page  =  preg_replace(\"/(<!-- END.*? -->)/\",  \"\\n$1\\n\",  $page);\n\t\t\t$page  =  preg_replace(\"/(<!-- ELSEIF .+? -->)/\",  \"\\n$1\\n\",  $page);\n\t\t\t$page  =  preg_replace(\"/(<!-- ELSE [ a-zA-Z0-9_.]*-->)/\",  \"\\n$1\\n\",  $page);\n\n\t\t\t$page  =  $this->highlight_html($page);\n\n\t\t\t$rows      =  explode(\"\\n\",  $page);\n\t\t\t$page_arr  =  array();\n\t\t\t$level     =  0;\n\t\t\t$blocklvl  =  0;\n\t\t\t$rowcnt    =  0;\n\t\t\t$spancnt   =  0;\n\t\t\t$offset    =  22;\n\t\t\t$lvl_block =  array();\n\t\t\t$lvl_row   =  array();\n\t\t\t$lvl_typ   =  array();\n\t\t\tforeach ($rows as $row)\n\t\t\t{\n\t\t\t\tif ($row  =  trim($row))\n\t\t\t\t{\n\t\t\t\t\t$closespan  =  false;\n\t\t\t\t\tif (substr($row, $offset, 12) == '&lt;!-- END ')\n\t\t\t\t\t{\n\t\t\t\t\t\tif ($level < 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$level++;\n\t\t\t\t\t\t\t$error[$rowcnt]  =  \"END Without BEGIN\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\telseif ($lvl_typ[$level] != 'BEGIN')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$error[$lvl_row[$level]]  =  \"IF without ENDIF\";\n\t\t\t\t\t\t\t$error[$rowcnt]  =  \"END Without BEGIN\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$blocklvl--;\n\t\t\t\t\t\t$level--;\n\t\t\t\t\t\t$closespan  =  true;\n\t\t\t\t\t}\n\t\t\t\t\tif (substr($row, $offset, 14) == '&lt;!-- ENDIF ')\n\t\t\t\t\t{\n\t\t\t\t\t\tif ($level < 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$level++;\n\t\t\t\t\t\t\t$error[$rowcnt]  =  \"ENDIF Without IF\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\telseif ($lvl_typ[$level] != 'IF')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$error[$lvl_row[$level]]  =  \"BEGIN without END\";\n\t\t\t\t\t\t\t$error[$rowcnt]  =  \"ENDIF Without IF\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$closespan  =  true;\n\t\t\t\t\t\t$level--;\n\t\t\t\t\t}\n\t\t\t\t\tif ($closespan)\n\t\t\t\t\t{\n\t\t\t\t\t\t$page_arr[$rowcnt-1]  .=  '</span>';\n\t\t\t\t\t}\n\t\t\t\t\t$this_row  =  $this->tab[$level] . $row;\n\t\t\t\t\tif (substr($row, $offset, 12) == '&lt;!-- ELSE')\n\t\t\t\t\t{\n\t\t\t\t\t\tif ($level < 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$error[$rowcnt]  =  \"ELSE Without IF\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\telseif ($lvl_typ[$level] != 'IF')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$error[$rowcnt]  =  \"ELSE Without IF\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this_row  =  $this->tab[$level-1] . $row;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (substr($row, $offset, 14) == '&lt;!-- BEGIN ')\n\t\t\t\t\t{\n\t\t\t\t\t\tif ($blocklvl == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif ($lp = strpos($row, '--&gt;'))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif ($blockname  =  trim(substr($row, $offset + 14, $lp -$offset -14)))\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif ($nr = count($vars[$blockname]))\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$this_row  .=  $this->toggleview(\"$nr Entries\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$this_row  .=  $this->toggleview(\"Emtpy\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this_row  .=  $this->toggleview('[');\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$blocklvl++;\n\t\t\t\t\t\t$level++;\n\t\t\t\t\t\t$lvl_row[$level]  =  $rowcnt;\n\t\t\t\t\t\t$lvl_typ[$level]  =  'BEGIN';\n\t\t\t\t\t}\n\t\t\t\t\telseif (substr($row, $offset, 11) == '&lt;!-- IF ')\n\t\t\t\t\t{\n\t\t\t\t\t\t$level++;\n\t\t\t\t\t\t$lvl_row[$level]  =  $rowcnt;\n\t\t\t\t\t\t$lvl_typ[$level]  =  'IF';\n\t\t\t\t\t\t$this_row  .=  $this->toggleview();\n\t\t\t\t\t}\n\t\t\t\t\t$page_arr[]  =  $this_row;\n\t\t\t\t\t$lvl_block[$rowcnt]  =  $blocklvl;\n\t\t\t\t\t$rowcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ($level > 0)\n\t\t\t{\n\t\t\t\t$error[$lvl_row[$level]]  =  \"Block not closed\";\n\t\t\t}\n\n\t\t\t$page  =  join(\"\\n\", $page_arr);\n\t\t\t$rows  =  explode(\"\\n\",  $page);\n\t\t\t$cnt   =  count($rows);\n\n\t\t\tfor ($i = 0;  $i < $cnt;  $i++)\n\t\t\t{\n\t\t\t\t//\tAdd Errortext\n\t\t\t\tif (isset($error))\n\t\t\t\t{\n\t\t\t\t\tif ($err = $error[$i])\n\t\t\t\t\t{\n\t\t\t\t\t\t$rows[$i]  =  '<b>' . $rows[$i] . '        ERROR: ' . $err . '!</b>';\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t//\tReplace Scalars\n\t\t\t\tif (preg_match_all('/{([a-zA-Z0-9_. &;]+)}/', $rows[$i], $var))\n\t\t\t\t{\n\t\t\t\t\tforeach ($var[1] as $tag)\n\t\t\t\t\t{\n\t\t\t\t\t\t$fulltag  =  $tag;\n\t\t\t\t\t\tif ($delim = strpos($tag, ' &gt; '))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$tag  =  substr($tag, 0, $delim);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (substr($tag, 0, 4) == 'top.')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$title  =  $this->tip($vars[substr($tag, 4)]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telseif ($lvl_block[$i] == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$title  =  $this->tip($vars[$tag]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$title  =  '[BLOCK?]';\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$code  =  '<b title=\"' . $title . '\">{' . $fulltag . '}</b>';\n\t\t\t\t\t\t$rows[$i]  =  str_replace('{'.$fulltag.'}',  $code,  $rows[$i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t//\tReplace Extensions\n\t\t\t\tif (preg_match_all('/{([a-zA-Z0-9_]+):([^}]*)}/', $rows[$i], $var))\n\t\t\t\t{\n\t\t\t\t\tforeach ($var[2] as $tmpcnt => $tag)\n\t\t\t\t\t{\n\t\t\t\t\t\t$fulltag  =  $tag;\n\t\t\t\t\t\tif ($delim = strpos($tag, ' &gt; '))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$tag  =  substr($tag, 0, $delim);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (strpos($tag, ','))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlist($tag, $addparam)  =  explode(',', $tag, 2);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$extension  =  $var[1][$tmpcnt];\n\n\t\t\t\t\t\tif (substr($tag, 0, 4) == 'top.')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$title  =  $this->tip($vars[substr($tag, 4)]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telseif ($lvl_block[$i] == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$title  =  $this->tip($vars[$tag]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$title  =  '[BLOCK?]';\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$code  =  '<b title=\"' . $title . '\">{' . $extension . ':' . $fulltag . '}</b>';\n\t\t\t\t\t\t$rows[$i]  =  str_replace('{'.$extension . ':' . $fulltag .'}',  $code,  $rows[$i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t//\t'IF nnn' Blocks\n\t\t\t\tif (preg_match_all('/&lt;!-- IF ([a-zA-Z0-9_.]+) --&gt;/', $rows[$i], $var))\n\t\t\t\t{\n\t\t\t\t\tforeach ($var[1] as $tag)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (substr($tag, 0, 4) == 'top.')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$title  =  $this->tip($vars[substr($tag, 4)]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telseif ($lvl_block[$i] == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$title  =  $this->tip($vars[$tag]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$title  =  '[BLOCK?]';\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$code  =  '<span title=\"' . $title . '\">&lt;!-- IF ' . $tag . ' --&gt;</span>';\n\t\t\t\t\t\t$rows[$i]  =  str_replace(\"&lt;!-- IF $tag --&gt;\",  $code,  $rows[$i]);\n\t\t\t\t\t\tif ($title == '[NULL]')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$rows[$i]  =  str_replace('Hide',  'Show',  $rows[$i]);\n\t\t\t\t\t\t\t$rows[$i]  =  str_replace('block',  'none',  $rows[$i]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t$page  =  join(\"<br>\", $rows);\n\n\t\t\t// Print Header\n\t\t\techo '<html><head><script type=\"text/javascript\">\n\t\t\t\t\tfunction toggleVisibility(el, src) {\n\t\t\t\t\tvar v = el.style.display == \"block\";\n\t\t\t\t\tvar str = src.innerHTML;\n\t\t\t\t\tel.style.display = v ? \"none\" : \"block\";\n\t\t\t\t\tsrc.innerHTML = v ? str.replace(/Hide/, \"Show\") : str.replace(/Show/, \"Hide\");}\n\t\t\t\t\t</script></head><body>';\n\n\t\t\t// Print Index\n\t\t\techo '<font face=\"Arial\" Size=\"3\"><b>';\n\t\t\techo 'SmartTemplate Debugger<br>';\n\t\t\techo '<font size=\"2\"><li>PHP-Script: ' . $_SERVER['PATH_TRANSLATED'] . '</li><li>Template: ' . $this->filename . '</li></font><hr>';\n\t\t\techo '<li><a href=\"#template_code\">Template</a></li>';\n\t\t\techo '<li><a href=\"#compiled_code\">Compiled Template</a></li>';\n\t\t\techo '<li><a href=\"#data_code\">Data</a></li>';\n\t\t\techo '</b></font><hr>';\n\n\t\t\t// Print Template\n\t\t\techo '<a name=\"template_code\"><br><font face=\"Arial\" Size=\"3\"><b>Template:</b>&nbsp;[<a href=\"javascript:void(\\'\\');\" onclick=\"toggleVisibility(document.getElementById(\\'Template\\'), this); return false\">Hide Ouptut</a>]</font><br>';\n\t\t\techo '<table border=\"0\" cellpadding=\"4\" cellspacing=\"1\" width=\"100%\" bgcolor=\"#C6D3EF\"><tr><td bgcolor=\"#F0F0F0\"><pre id=\"Template\" style=\"display:block\">';\n\t\t\techo $page;\n\t\t\techo '</pre></td></tr></table>';\n\n\t\t\t// Print Compiled Template\n\t\t\tif (@include_once (\"class.smarttemplateparser.php\"))\n\t\t\t{\n\t\t\t\t$parser = new SmartTemplateParser($this->filename);\n\t\t\t\t$compiled  =  $parser->compile();\n\t\t\t\techo '<a name=\"compiled_code\"><br><br><font face=\"Arial\" Size=\"3\"><b>Compiled Template:</b>&nbsp;[<a href=\"javascript:void(\\'\\');\" onclick=\"toggleVisibility(document.getElementById(\\'Compiled\\'), this); return false\">Hide Ouptut</a>]</font><br>';\n\t\t\t\techo '<table border=\"0\" cellpadding=\"4\" cellspacing=\"1\" width=\"100%\" bgcolor=\"#C6D3EF\"><tr><td bgcolor=\"#F0F0F0\"><pre id=\"Compiled\" style=\"display:block\">';\n\t\t\t\thighlight_string($compiled);\n\t\t\t\techo '</pre></td></tr></table>';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\texit( \"SmartTemplate Error: Cannot find class.smarttemplateparser.php; check SmartTemplate installation\");\n\t\t\t}\n\n\t\t\t// Print Data\n\t\t\techo '<a name=\"data_code\"><br><br><font face=\"Arial\" Size=\"3\"><b>Data:</b>&nbsp;[<a href=\"javascript:void(\\'\\');\" onclick=\"toggleVisibility(document.getElementById(\\'Data\\'), this); return false\">Hide Ouptut</a>]</font><br>';\n\t\t\techo '<table border=\"0\" cellpadding=\"4\" cellspacing=\"1\" width=\"100%\" bgcolor=\"#C6D3EF\"><tr><td bgcolor=\"#F0F0F0\"><pre id=\"Data\" style=\"display:block\">';\n\t\t\techo $this->vardump($vars);\n\t\t\techo '</pre></td></tr></table></body></html>';\n\t\t}\n\n\n\t\t/**\n\t\t* Insert Hide/Show Layer Switch\n\t\t*\n\t\t* @param string $suffix Additional Text\n\t\t* @desc Insert Hide/Show Layer Switch\n\t\t*/\n\t\tfunction toggleview ( $suffix = '')\n\t\t{\n\t\t\tglobal $spancnt;\n\n\t\t\t$spancnt++;\n\t\t\tif ($suffix)\n\t\t\t{\n\t\t\t\t$suffix  .=  ':';\n\t\t\t}\n\t\t\t$ret =  '[' . $suffix . '<a href=\"javascript:void(\\'\\');\" onclick=\"toggleVisibility(document.getElementById(\\'Block' . $spancnt . '\\'), this); return false\">Hide Block</a>]<span id=\"Block' . $spancnt . '\" style=\"display:block\">';\n\t\t\treturn $ret;\n\t\t}\n\n\n\t\t/**\n\t\t* Create Title Text\n\t\t*\n\t\t* @param string $value Content\n\t\t* @desc Create Title Text\n\t\t*/\n\t\tfunction tip ( $value )\n\t\t{\n\t\t\tif (empty($value))\n\t\t\t{\n\t\t\t\treturn \"[NULL]\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$ret = htmlentities(substr($value,0,200));\n\t\t\t\treturn $ret;\n\t\t\t}\n\t\t}\n\n\n\t\t/**\n\t\t* Recursive Variable Display Output\n\t\t*\n\t\t* @param mixed $var Content\n\t\t* @param int $depth Incremented Indent Counter for Recursive Calls\n\t\t* @return string Variable Content\n\t\t* @access private\n\t\t* @desc Recursive Variable Display Output\n\t\t*/\n\t    function vardump($var, $depth = 0)\n\t    {\n\t        if (is_array($var))\n\t        {\n\t            $result  =  \"Array (\" . count($var) . \")<BR>\";\n\t            foreach(array_keys($var) as $key)\n\t            {\n\t                $result  .=  $this->tab[$depth] . \"<B>$key</B>: \" . $this->vardump($var[$key],  $depth+1);\n\t            }\n\t            return $result;\n\t        }\n\t        else\n\t        {\n\t            $ret =  htmlentities($var) . \"<BR>\";\n\t            return $ret;\n\t        }\n\t    }\n\n\n\t\t/**\n\t\t* Splits Template-Style Variable Names into an Array-Name/Key-Name Components\n\t\t*\n\t\t* @param string $tag Variale Name used in Template\n\t\t* @return array  Array Name, Key Name\n\t\t* @access private\n\t\t* @desc Splits Template-Style Variable Names into an Array-Name/Key-Name Components\n\t\t*/\n\t\tfunction var_name($tag)\n\t\t{\n\t\t\t$parent_level  =  0;\n\t\t\twhile (substr($tag, 0, 7) == 'parent.')\n\t\t\t{\n\t\t\t\t$tag  =  substr($tag, 7);\n\t\t\t\t$parent_level++;\n\t\t\t}\n\t\t\tif (substr($tag, 0, 4) == 'top.')\n\t\t\t{\n\t\t\t\t$ret = array('_stack[0]', substr($tag,4));\n\t\t\t\treturn $ret;\n\t\t\t}\n\t\t\telseif ($parent_level)\n\t\t\t{\n\t\t\t\t$ret = array('_stack[$_stack_cnt-'.$parent_level.']', $tag);\n\t\t\t\treturn $ret;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$ret = array('_obj', $tag);\n\t\t\t\treturn $ret;\n\t\t\t}\n\t\t}\n\n\n\t\t/**\n\t\t* Highlight HTML Source\n\t\t*\n\t\t* @param string $code HTML Source\n\t\t* @return string Hightlighte HTML Source\n\t\t* @access private\n\t\t* @desc Highlight HTML Source\n\t\t*/\n\t\tfunction highlight_html ( $code )\n\t\t{\n\t\t\t$code  =  htmlentities($code);\n\t\t\t$code  =  preg_replace('/([a-zA-Z_]+)=/',  '<font color=\"#FF0000\">$1=</font>',  $code);\n\t\t\t$code  =  preg_replace('/(&lt;[\\/a-zA-Z0-9&;]+)/',  '<font color=\"#0000FF\">$1</font>',  $code);\n\t\t\t$code  =  str_replace('&lt;!--',  '<font color=\"#008080\">&lt;!--',  $code);\n\t\t\t$code  =  str_replace('--&gt;',  '--&gt;</font>',  $code);\n\t\t\t$code  =  preg_replace('/[\\r\\n]+/',  \"\\n\",  $code);\n\t\t\treturn $code;\n\t\t}\n\t}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/SmartTemplate/class.smarttemplateparser.php",
    "content": "<?php\n\t/**\n\t* SmartTemplateParser Class\n\t* Used by SmartTemplate Class\n\t*\n\t* @desc Used by SmartTemplate Class\n\t* @author Philipp v. Criegern philipp@criegern.com\n\t* @author Manuel 'EndelWar' Dalla Lana endelwar@aregar.it\n\t* @version 1.2.1 03.07.2006\n\t*\n\t* CVS ID: $Id: class.smarttemplateparser.php 2504 2011-12-28 07:35:29Z liu21st $\n\t*/\n\tclass SmartTemplateParser\n\t{\n\t\t/**\n\t\t* The template itself\n\t\t*\n\t\t* @access private\n\t\t*/\n\t\tvar $template;\n\n\t\t/**\n\t\t* The template filename used to extract the dirname for subtemplates\n\t\t*\n\t\t* @access private\n\t\t*/\n\t\tvar $template_dir;\n\n\t\t/**\n\t\t* List of used SmartTemplate Extensions\n\t\t*\n\t\t* @access private\n\t\t*/\n\t\tvar $extension_tagged  =  array();\n\n\t\t/**\n\t\t* Error messages\n\t\t*\n\t\t* @access public\n\t\t*/\n\t\tvar $error;\n\n\t\t/**\n\t\t* SmartTemplateParser Constructor\n\t\t*\n\t\t* @param string $template_filename HTML Template Filename\n\t\t*/\n\t\tfunction SmartTemplateParser ( $template_filename )\n\t\t{\n\t\t\t// Load Template\n\t\t\tif ($hd = @fopen($template_filename, \"r\"))\n\t\t\t{\n\t\t\t\tif (filesize($template_filename))\n\t\t\t\t{\n\t\t\t\t\t$this->template = fread($hd, filesize($template_filename));\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$this->template = \"SmartTemplate Parser Error: File size is zero byte: '$template_filename'\";\n\t\t\t\t}\n\t\t\t\tfclose($hd);\n\t\t\t\t// Extract the name of the template directory\n\t\t\t\t$this->template_dir = dirname($template_filename);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->template = \"SmartTemplate Parser Error: File not found: '$template_filename'\";\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t* Main Template Parser\n\t\t*\n\t\t* @param string $compiled_template_filename Compiled Template Filename\n\t\t* @desc Creates Compiled PHP Template\n\t\t*/\n\t\tfunction compile( $compiled_template_filename = '' )\n\t\t{\n\t\t\tif (empty($this->template))\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t/* Quick hack to allow subtemplates */\n\t\t\tif(eregi(\"<!-- INCLUDE\", $this->template))\n\t\t\t{\n\t\t\t\twhile ($this->count_subtemplates() > 0)\n\t\t\t\t{\n\t\t\t\t\tpreg_match_all('/<!-- INCLUDE ([a-zA-Z0-9_.]+) -->/', $this->template, $tvar);\n\t\t\t\t\tforeach($tvar[1] as $subfile)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(file_exists($this->template_dir . \"/$subfile\"))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$subst = implode('',file($this->template_dir . \"/$subfile\"));\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$subst = 'SmartTemplate Parser Error: Subtemplate not found: \\''.$subfile.'\\'';\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$this->template = str_replace(\"<!-- INCLUDE $subfile -->\", $subst, $this->template);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t//\tEND, ELSE Blocks\n\t\t\t$page  =  preg_replace(\"/<!-- ENDIF.+?-->/\",  \"<?php\\n}\\n?>\",  $this->template);\n\t\t\t$page  =  preg_replace(\"/<!-- END[ a-zA-Z0-9_.]* -->/\",  \"<?php\\n}\\n\\$_obj=\\$_stack[--\\$_stack_cnt];}\\n?>\",  $page);\n\t\t\t$page  =  str_replace(\"<!-- ELSE -->\",  \"<?php\\n} else {\\n?>\",  $page);\n\n\t\t\t//\t'BEGIN - END' Blocks\n\t\t\tif (preg_match_all('/<!-- BEGIN ([a-zA-Z0-9_.]+) -->/', $page, $var))\n\t\t\t{\n\t\t\t\tforeach ($var[1] as $tag)\n\t\t\t\t{\n\t\t\t\t\tlist($parent, $block)  =  $this->var_name($tag);\n\t\t\t\t\t$code  =  \"<?php\\n\"\n\t\t\t\t\t\t\t. \"if (!empty(\\$$parent\".\"['$block'])){\\n\"\n\t\t\t\t\t\t\t. \"if (!is_array(\\$$parent\".\"['$block']))\\n\"\n\t\t\t\t\t\t\t. \"\\$$parent\".\"['$block']=array(array('$block'=>\\$$parent\".\"['$block']));\\n\"\n\t\t\t\t\t\t\t. \"\\$_tmp_arr_keys=array_keys(\\$$parent\".\"['$block']);\\n\"\n\t\t\t\t\t\t\t. \"if (\\$_tmp_arr_keys[0]!='0')\\n\"\n\t\t\t\t\t\t\t. \"\\$$parent\".\"['$block']=array(0=>\\$$parent\".\"['$block']);\\n\"\n\t\t\t\t\t\t\t. \"\\$_stack[\\$_stack_cnt++]=\\$_obj;\\n\"\n\t\t\t\t\t\t\t. \"foreach (\\$$parent\".\"['$block'] as \\$rowcnt=>\\$$block) {\\n\"\n\t\t\t\t\t\t\t. \"\\$$block\".\"['ROWCNT']=\\$rowcnt;\\n\"\n\t\t\t\t\t\t\t. \"\\$$block\".\"['ALTROW']=\\$rowcnt%2;\\n\"\n\t\t\t\t\t\t\t. \"\\$$block\".\"['ROWBIT']=\\$rowcnt%2;\\n\"\n\t\t\t\t\t\t\t. \"\\$_obj=&\\$$block;\\n?>\";\n\t\t\t\t\t$page  =  str_replace(\"<!-- BEGIN $tag -->\",  $code,  $page);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//\t'IF nnn=mmm' Blocks\n\t\t\tif (preg_match_all('/<!-- (ELSE)?IF ([a-zA-Z0-9_.]+)[ ]*([!=<>]+)[ ]*([\"]?[^\"]*[\"]?) -->/', $page, $var))\n\t\t\t{\n\t\t\t\tforeach ($var[2] as $cnt => $tag)\n\t\t\t\t{\n\t\t\t\t\tlist($parent, $block)  =  $this->var_name($tag);\n\t\t\t\t\t$cmp   =  $var[3][$cnt];\n\t\t\t\t\t$val   =  $var[4][$cnt];\n\t\t\t\t\t$else  =  ($var[1][$cnt] == 'ELSE') ? '} else' : '';\n\t\t\t\t\tif ($cmp == '=')\n\t\t\t\t\t{\n\t\t\t\t\t\t$cmp  =  '==';\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (preg_match('/\"([^\"]*)\"/',$val,$matches))\n\t\t\t\t\t{\n\t\t\t\t\t\t$code  =  \"<?php\\n$else\".\"if (\\$$parent\".\"['$block'] $cmp \\\"\".$matches[1].\"\\\"){\\n?>\";\n\t\t\t\t\t}\n\t\t\t\t\telseif (preg_match('/([^\"]*)/',$val,$matches))\n\t\t\t\t\t{\n\t\t\t\t\t\tlist($parent_right, $block_right)  =  $this->var_name($matches[1]);\n\t\t\t\t\t\t$code  =  \"<?php\\n$else\".\"if (\\$$parent\".\"['$block'] $cmp \\$$parent_right\".\"['$block_right']){\\n?>\";\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t$page  =  str_replace($var[0][$cnt],  $code,  $page);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//\t'IF nnn' Blocks\n\t\t\tif (preg_match_all('/<!-- (ELSE)?IF ([a-zA-Z0-9_.]+) -->/', $page, $var))\n\t\t\t{\n\t\t\t\tforeach ($var[2] as $cnt => $tag)\n\t\t\t\t{\n\t\t\t\t\t$else  =  ($var[1][$cnt] == 'ELSE') ? '} else' : '';\n\t\t\t\t\tlist($parent, $block)  =  $this->var_name($tag);\n\t\t\t\t\t$code  =  \"<?php\\n$else\".\"if (!empty(\\$$parent\".\"['$block'])){\\n?>\";\n\t\t\t\t\t$page  =  str_replace($var[0][$cnt],  $code,  $page);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//\tReplace Scalars\n\t\t\tif (preg_match_all('/{([a-zA-Z0-9_. >]+)}/', $page, $var))\n\t\t\t{\n\t\t\t\tforeach ($var[1] as $fulltag)\n\t\t\t\t{\n\t\t\t\t\t//\tDetermin Command (echo / $obj[n]=)\n\t\t\t\t\tlist($cmd, $tag)  =  $this->cmd_name($fulltag);\n\n\t\t\t\t\tlist($block, $skalar)  =  $this->var_name($tag);\n\t\t\t\t\t$code  =  \"<?php\\n$cmd \\$$block\".\"['$skalar'];\\n?>\\n\";\n\t\t\t\t\t$page  =  str_replace('{'.$fulltag.'}',  $code,  $page);\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\t//\tROSI Special: Replace Translations\n\t\t\tif (preg_match_all('/<\"([a-zA-Z0-9_.]+)\">/', $page, $var))\n\t\t\t{\n\t\t\t\tforeach ($var[1] as $tag)\n\t\t\t\t{\n\t\t\t\t\tlist($block, $skalar)  =  $this->var_name($tag);\n\t\t\t\t\t$code  =  \"<?php\\necho gettext('$skalar');\\n?>\\n\";\n\t\t\t\t\t$page  =  str_replace('<\"'.$tag.'\">',  $code,  $page);\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\t//\tInclude Extensions\n\t\t\t$header = '';\n\t\t\tif (preg_match_all('/{([a-zA-Z0-9_]+):([^}]*)}/', $page, $var))\n\t\t\t{\n\t\t\t\tforeach ($var[2] as $cnt => $tag)\n\t\t\t\t{\n\t\t\t\t\t//\tDetermin Command (echo / $obj[n]=)\n\t\t\t\t\tlist($cmd, $tag)  =  $this->cmd_name($tag);\n\n\t\t\t\t\t$extension  =  $var[1][$cnt];\n\t\t\t\t\tif (!isset($this->extension_tagged[$extension]))\n\t\t\t\t\t{\n\t\t\t\t\t\t$header  .=  \"include_once \\\"smarttemplate_extensions/smarttemplate_extension_$extension.php\\\";\\n\";\n\t\t\t\t\t\t$this->extension_tagged[$extension]  =  true;\n\t\t\t\t\t}\n\t\t\t\t\tif (!strlen($tag))\n\t\t\t\t\t{\n\t\t\t\t\t\t$code  =  \"<?php\\n$cmd smarttemplate_extension_$extension();\\n?>\\n\";\n\t\t\t\t\t}\n\t\t\t\t\telseif (substr($tag, 0, 1) == '\"')\n\t\t\t\t\t{\n\t\t\t\t\t\t$code  =  \"<?php\\n$cmd smarttemplate_extension_$extension($tag);\\n?>\\n\";\n\t\t\t\t\t}\n\t\t\t\t\telseif (strpos($tag, ','))\n\t\t\t\t\t{\n\t\t\t\t\t\tlist($tag, $addparam)  =  explode(',', $tag, 2);\n\t\t\t\t\t\tlist($block, $skalar)  =  $this->var_name($tag);\n\t\t\t\t\t\tif (preg_match('/^([a-zA-Z_]+)/', $addparam, $match))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$nexttag   =  $match[1];\n\t\t\t\t\t\t\tlist($nextblock, $nextskalar)  =  $this->var_name($nexttag);\n\t\t\t\t\t\t\t$addparam  =  substr($addparam, strlen($nexttag));\n\t\t\t\t\t\t\t$code  =  \"<?php\\n$cmd smarttemplate_extension_$extension(\\$$block\".\"['$skalar'],\\$$nextblock\".\"['$nextskalar']\".\"$addparam);\\n?>\\n\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$code  =  \"<?php\\n$cmd smarttemplate_extension_$extension(\\$$block\".\"['$skalar'],$addparam);\\n?>\\n\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tlist($block, $skalar)  =  $this->var_name($tag);\n\t\t\t\t\t\t$code  =  \"<?php\\n$cmd smarttemplate_extension_$extension(\\$$block\".\"['$skalar']);\\n?>\\n\";\n\t\t\t\t\t}\n\t\t\t\t\t$page  =  str_replace($var[0][$cnt],  $code,  $page);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//\tAdd Include Header\n\t\t\tif (isset($header) && !empty($header))\n\t\t\t{\n\t\t\t\t$page  =  \"<?php\\n$header\\n?>$page\";\n\t\t\t}\n\n\t\t\t//\tStore Code to Temp Dir\n\t\t\tif (strlen($compiled_template_filename))\n\t\t\t{\n\t\t        if ($hd  =  fopen($compiled_template_filename,  \"w\"))\n\t\t        {\n\t\t\t        fwrite($hd,  $page);\n\t\t\t        fclose($hd);\n\t\t\t        return true;\n\t\t\t    }\n\t\t\t    else\n\t\t\t    {\n\t\t\t    \t$this->error  =  \"Could not write compiled file.\";\n\t\t\t        return false;\n\t\t\t    }\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn $page;\n\t\t\t}\n\t\t}\n\n\n\t\t/**\n\t\t* Splits Template-Style Variable Names into an Array-Name/Key-Name Components\n\t\t* {example}               :  array( \"_obj\",                   \"example\" )  ->  $_obj['example']\n\t\t* {example.value}         :  array( \"_obj['example']\",        \"value\" )    ->  $_obj['example']['value']\n\t\t* {example.0.value}       :  array( \"_obj['example'][0]\",     \"value\" )    ->  $_obj['example'][0]['value']\n\t\t* {top.example}           :  array( \"_stack[0]\",              \"example\" )  ->  $_stack[0]['example']\n\t\t* {parent.example}        :  array( \"_stack[$_stack_cnt-1]\",  \"example\" )  ->  $_stack[$_stack_cnt-1]['example']\n\t\t* {parent.parent.example} :  array( \"_stack[$_stack_cnt-2]\",  \"example\" )  ->  $_stack[$_stack_cnt-2]['example']\n\t\t*\n\t\t* @param string $tag Variale Name used in Template\n\t\t* @return array  Array Name, Key Name\n\t\t* @access private\n\t\t* @desc Splits Template-Style Variable Names into an Array-Name/Key-Name Components\n\t\t*/\n\t\tfunction var_name($tag)\n\t\t{\n\t\t\t$parent_level  =  0;\n\t\t\twhile (substr($tag, 0, 7) == 'parent.')\n\t\t\t{\n\t\t\t\t$tag  =  substr($tag, 7);\n\t\t\t\t$parent_level++;\n\t\t\t}\n\t\t\tif (substr($tag, 0, 4) == 'top.')\n\t\t\t{\n\t\t\t\t$obj  =  '_stack[0]';\n\t\t\t\t$tag  =  substr($tag,4);\n\t\t\t}\n\t\t\telseif ($parent_level)\n\t\t\t{\n\t\t\t\t$obj  =  '_stack[$_stack_cnt-'.$parent_level.']';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$obj  =  '_obj';\n\t\t\t}\n\t\t\twhile (is_int(strpos($tag, '.')))\n\t\t\t{\n\t\t\t\tlist($parent, $tag)  =  explode('.', $tag, 2);\n\t\t\t\tif (is_numeric($parent))\n\t\t\t\t{\n\t\t\t\t\t$obj  .=  \"[\" . $parent . \"]\";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$obj  .=  \"['\" . $parent . \"']\";\n\t\t\t\t}\n\t\t\t}\n\t\t\t$ret = array($obj, $tag);\n\t\t\treturn $ret;\n\t\t}\n\n\n\t\t/**\n\t\t* Determine Template Command from Variable Name\n\t\t* {variable}             :  array( \"echo\",              \"variable\" )  ->  echo $_obj['variable']\n\t\t* {variable > new_name}  :  array( \"_obj['new_name']=\", \"variable\" )  ->  $_obj['new_name']= $_obj['variable']\n\t\t*\n\t\t* @param string $tag Variale Name used in Template\n\t\t* @return array  Array Command, Variable\n\t\t* @access private\n\t\t* @desc Determine Template Command from Variable Name\n\t\t*/\n\t\tfunction cmd_name($tag)\n\t\t{\n\t\t\tif (preg_match('/^(.+) > ([a-zA-Z0-9_.]+)$/', $tag, $tagvar))\n\t\t\t{\n\t\t\t\t$tag  =  $tagvar[1];\n\t\t\t\tlist($newblock, $newskalar)  =  $this->var_name($tagvar[2]);\n\t\t\t\t$cmd  =  \"\\$$newblock\".\"['$newskalar']=\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$cmd  =  \"echo\";\n\t\t\t}\n\t\t\t$ret = array($cmd, $tag);\n\t\t\treturn $ret;\n\t\t}\n\n\t\t/**\n\t\t* @return int Number of subtemplate included\n\t\t* @access private\n\t\t* @desc Count number of subtemplates included in current template\n\t\t*/\n\t\tfunction count_subtemplates()\n\t\t{\n\t\t\tpreg_match_all('/<!-- INCLUDE ([a-zA-Z0-9_.]+) -->/', $this->template, $tvar);\n\t\t\t$count_subtemplates = count($tvar[1]);\n\t\t\t$ret = intval($count_subtemplates);\n\t\t\treturn $ret;\n\t\t}\n\t}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/Smarty.class.php",
    "content": "<?php\n/**\n* Project:     Smarty: the PHP compiling template engine\n* File:        Smarty.class.php\n* SVN:         $Id: Smarty.class.php 2504 2011-12-28 07:35:29Z liu21st $\n*\n* This library is free software; you can redistribute it and/or\n* modify it under the terms of the GNU Lesser General Public\n* License as published by the Free Software Foundation; either\n* version 2.1 of the License, or (at your option) any later version.\n*\n* This library is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n* Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Lesser General Public\n* License along with this library; if not, write to the Free Software\n* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n*\n* For questions, help, comments, discussion, etc., please join the\n* Smarty mailing list. Send a blank e-mail to\n* smarty-discussion-subscribe@googlegroups.com\n*\n* @link http://www.smarty.net/\n* @copyright 2008 New Digital Group, Inc.\n* @author Monte Ohrt <monte at ohrt dot com>\n* @author Uwe Tews\n* @author Rodney Rehm\n* @package Smarty\n* @version 3.1.6\n*/\n\n/**\n* define shorthand directory separator constant\n*/\nif (!defined('DS')) {\n    define('DS', DIRECTORY_SEPARATOR);\n}\n\n/**\n* set SMARTY_DIR to absolute path to Smarty library files.\n* Sets SMARTY_DIR only if user application has not already defined it.\n*/\nif (!defined('SMARTY_DIR')) {\n    define('SMARTY_DIR', dirname(__FILE__) . DS);\n}\n\n/**\n* set SMARTY_SYSPLUGINS_DIR to absolute path to Smarty internal plugins.\n* Sets SMARTY_SYSPLUGINS_DIR only if user application has not already defined it.\n*/\nif (!defined('SMARTY_SYSPLUGINS_DIR')) {\n    define('SMARTY_SYSPLUGINS_DIR', SMARTY_DIR . 'sysplugins' . DS);\n}\nif (!defined('SMARTY_PLUGINS_DIR')) {\n    define('SMARTY_PLUGINS_DIR', SMARTY_DIR . 'plugins' . DS);\n}\nif (!defined('SMARTY_MBSTRING')) {\n    define('SMARTY_MBSTRING', function_exists('mb_strlen'));\n}\nif (!defined('SMARTY_RESOURCE_CHAR_SET')) {\n    // UTF-8 can only be done properly when mbstring is available!\n    define('SMARTY_RESOURCE_CHAR_SET', SMARTY_MBSTRING ? 'UTF-8' : 'ISO-8859-1');\n}\nif (!defined('SMARTY_RESOURCE_DATE_FORMAT')) {\n    define('SMARTY_RESOURCE_DATE_FORMAT', '%b %e, %Y');\n}\n\n/**\n* register the class autoloader\n*/\nif (!defined('SMARTY_SPL_AUTOLOAD')) {\n    define('SMARTY_SPL_AUTOLOAD', 0);\n}\n\nif (SMARTY_SPL_AUTOLOAD && set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false) {\n    $registeredAutoLoadFunctions = spl_autoload_functions();\n    if (!isset($registeredAutoLoadFunctions['spl_autoload'])) {\n        spl_autoload_register();\n    }\n} else {\n    spl_autoload_register('smartyAutoload');\n}\n\n/**\n* Load always needed external class files\n*/\ninclude_once SMARTY_SYSPLUGINS_DIR.'smarty_internal_data.php';\ninclude_once SMARTY_SYSPLUGINS_DIR.'smarty_internal_templatebase.php';\ninclude_once SMARTY_SYSPLUGINS_DIR.'smarty_internal_template.php';\ninclude_once SMARTY_SYSPLUGINS_DIR.'smarty_resource.php';\ninclude_once SMARTY_SYSPLUGINS_DIR.'smarty_internal_resource_file.php';\ninclude_once SMARTY_SYSPLUGINS_DIR.'smarty_cacheresource.php';\ninclude_once SMARTY_SYSPLUGINS_DIR.'smarty_internal_cacheresource_file.php';\n\n/**\n* This is the main Smarty class\n* @package Smarty\n*/\nclass Smarty extends Smarty_Internal_TemplateBase {\n\n    /**#@+\n    * constant definitions\n    */\n\n    /**\n    * smarty version\n    */\n    const SMARTY_VERSION = 'Smarty-3.1.6';\n\n    /**\n    * define variable scopes\n    */\n    const SCOPE_LOCAL = 0;\n    const SCOPE_PARENT = 1;\n    const SCOPE_ROOT = 2;\n    const SCOPE_GLOBAL = 3;\n    /**\n    * define caching modes\n    */\n    const CACHING_OFF = 0;\n    const CACHING_LIFETIME_CURRENT = 1;\n    const CACHING_LIFETIME_SAVED = 2;\n    /**\n    * define compile check modes\n    */\n    const COMPILECHECK_OFF = 0;\n    const COMPILECHECK_ON = 1;\n    const COMPILECHECK_CACHEMISS = 2;\n    /**\n    * modes for handling of \"<?php ... ?>\" tags in templates.\n    */\n    const PHP_PASSTHRU = 0; //-> print tags as plain text\n    const PHP_QUOTE = 1; //-> escape tags as entities\n    const PHP_REMOVE = 2; //-> escape tags as entities\n    const PHP_ALLOW = 3; //-> escape tags as entities\n    /**\n    * filter types\n    */\n    const FILTER_POST = 'post';\n    const FILTER_PRE = 'pre';\n    const FILTER_OUTPUT = 'output';\n    const FILTER_VARIABLE = 'variable';\n    /**\n    * plugin types\n    */\n    const PLUGIN_FUNCTION = 'function';\n    const PLUGIN_BLOCK = 'block';\n    const PLUGIN_COMPILER = 'compiler';\n    const PLUGIN_MODIFIER = 'modifier';\n    const PLUGIN_MODIFIERCOMPILER = 'modifiercompiler';\n\n    /**#@-*/\n\n    /**\n    * assigned global tpl vars\n    */\n    public static $global_tpl_vars = array();\n\n    /**\n     * error handler returned by set_error_hanlder() in Smarty::muteExpectedErrors()\n     */\n    public static $_previous_error_handler = null;\n    /**\n     * contains directories outside of SMARTY_DIR that are to be muted by muteExpectedErrors()\n     */\n    public static $_muted_directories = array();\n\n    /**#@+\n    * variables\n    */\n\n    /**\n    * auto literal on delimiters with whitspace\n    * @var boolean\n    */\n    public $auto_literal = true;\n    /**\n    * display error on not assigned variables\n    * @var boolean\n    */\n    public $error_unassigned = false;\n    /**\n    * look up relative filepaths in include_path\n    * @var boolean\n    */\n    public $use_include_path = false;\n    /**\n    * template directory\n    * @var array\n    */\n    private $template_dir = array();\n    /**\n    * joined template directory string used in cache keys\n    * @var string\n    */\n    public $joined_template_dir = null;\n    /**\n    * joined config directory string used in cache keys\n    * @var string\n    */\n    public $joined_config_dir = null;\n    /**\n    * default template handler\n    * @var callable\n    */\n    public $default_template_handler_func = null;\n    /**\n    * default config handler\n    * @var callable\n    */\n    public $default_config_handler_func = null;\n    /**\n    * default plugin handler\n    * @var callable\n    */\n    public $default_plugin_handler_func = null;\n    /**\n    * compile directory\n    * @var string\n    */\n    private $compile_dir = null;\n    /**\n    * plugins directory\n    * @var array\n    */\n    private $plugins_dir = array();\n    /**\n    * cache directory\n    * @var string\n    */\n    private $cache_dir = null;\n    /**\n    * config directory\n    * @var array\n    */\n    private $config_dir = array();\n    /**\n    * force template compiling?\n    * @var boolean\n    */\n    public $force_compile = false;\n    /**\n    * check template for modifications?\n    * @var boolean\n    */\n    public $compile_check = true;\n    /**\n    * use sub dirs for compiled/cached files?\n    * @var boolean\n    */\n    public $use_sub_dirs = false;\n    /**\n     * allow ambiguous resources (that are made unique by the resource handler)\n     * @var boolean\n     */\n    public $allow_ambiguous_resources = false;\n    /**\n    * caching enabled\n    * @var boolean\n    */\n    public $caching = false;\n    /**\n    * merge compiled includes\n    * @var boolean\n    */\n    public $merge_compiled_includes = false;\n    /**\n    * cache lifetime in seconds\n    * @var integer\n    */\n    public $cache_lifetime = 3600;\n    /**\n    * force cache file creation\n    * @var boolean\n    */\n    public $force_cache = false;\n    /**\n     * Set this if you want different sets of cache files for the same\n     * templates.\n     *\n     * @var string\n     */\n    public $cache_id = null;\n    /**\n     * Set this if you want different sets of compiled files for the same\n     * templates.\n     *\n     * @var string\n     */\n    public $compile_id = null;\n    /**\n    * template left-delimiter\n    * @var string\n    */\n    public $left_delimiter = \"{\";\n    /**\n    * template right-delimiter\n    * @var string\n    */\n    public $right_delimiter = \"}\";\n    /**#@+\n    * security\n    */\n    /**\n    * class name\n    *\n    * This should be instance of Smarty_Security.\n    *\n    * @var string\n    * @see Smarty_Security\n    */\n    public $security_class = 'Smarty_Security';\n    /**\n    * implementation of security class\n    *\n    * @var Smarty_Security\n    */\n    public $security_policy = null;\n    /**\n    * controls handling of PHP-blocks\n    *\n    * @var integer\n    */\n    public $php_handling = self::PHP_PASSTHRU;\n    /**\n    * controls if the php template file resource is allowed\n    *\n    * @var bool\n    */\n    public $allow_php_templates = false;\n    /**\n    * Should compiled-templates be prevented from being called directly?\n    *\n    * {@internal\n    * Currently used by Smarty_Internal_Template only.\n    * }}\n    *\n    * @var boolean\n    */\n    public $direct_access_security = true;\n    /**#@-*/\n    /**\n    * debug mode\n    *\n    * Setting this to true enables the debug-console.\n    *\n    * @var boolean\n    */\n    public $debugging = false;\n    /**\n     * This determines if debugging is enable-able from the browser.\n     * <ul>\n     *  <li>NONE => no debugging control allowed</li>\n     *  <li>URL => enable debugging when SMARTY_DEBUG is found in the URL.</li>\n     * </ul>\n    * @var string\n    */\n    public $debugging_ctrl = 'NONE';\n    /**\n    * Name of debugging URL-param.\n    *\n    * Only used when $debugging_ctrl is set to 'URL'.\n    * The name of the URL-parameter that activates debugging.\n    *\n    * @var type\n    */\n    public $smarty_debug_id = 'SMARTY_DEBUG';\n    /**\n    * Path of debug template.\n    * @var string\n    */\n    public $debug_tpl = null;\n    /**\n    * When set, smarty uses this value as error_reporting-level.\n    * @var int\n    */\n    public $error_reporting = null;\n    /**\n    * Internal flag for getTags()\n    * @var boolean\n    */\n    public $get_used_tags = false;\n\n    /**#@+\n    * config var settings\n    */\n\n    /**\n    * Controls whether variables with the same name overwrite each other.\n    * @var boolean\n    */\n    public $config_overwrite = true;\n    /**\n    * Controls whether config values of on/true/yes and off/false/no get converted to boolean.\n    * @var boolean\n    */\n    public $config_booleanize = true;\n    /**\n    * Controls whether hidden config sections/vars are read from the file.\n    * @var boolean\n    */\n    public $config_read_hidden = false;\n\n    /**#@-*/\n\n    /**#@+\n    * resource locking\n    */\n\n    /**\n    * locking concurrent compiles\n    * @var boolean\n    */\n    public $compile_locking = true;\n    /**\n     * Controls whether cache resources should emply locking mechanism\n     * @var boolean\n     */\n    public $cache_locking = false;\n    /**\n     * seconds to wait for acquiring a lock before ignoring the write lock\n     * @var float\n     */\n    public $locking_timeout = 10;\n\n    /**#@-*/\n\n    /**\n    * global template functions\n    * @var array\n    */\n    public $template_functions = array();\n    /**\n    * resource type used if none given\n    *\n    * Must be an valid key of $registered_resources.\n    * @var string\n    */\n    public $default_resource_type = 'file';\n    /**\n    * caching type\n    *\n    * Must be an element of $cache_resource_types.\n    *\n    * @var string\n    */\n    public $caching_type = 'file';\n    /**\n    * internal config properties\n    * @var array\n    */\n    public $properties = array();\n    /**\n    * config type\n    * @var string\n    */\n    public $default_config_type = 'file';\n    /**\n    * cached template objects\n    * @var array\n    */\n    public $template_objects = array();\n    /**\n    * check If-Modified-Since headers\n    * @var boolean\n    */\n    public $cache_modified_check = false;\n    /**\n    * registered plugins\n    * @var array\n    */\n    public $registered_plugins = array();\n    /**\n    * plugin search order\n    * @var array\n    */\n    public $plugin_search_order = array('function', 'block', 'compiler', 'class');\n    /**\n    * registered objects\n    * @var array\n    */\n    public $registered_objects = array();\n    /**\n    * registered classes\n    * @var array\n    */\n    public $registered_classes = array();\n    /**\n    * registered filters\n    * @var array\n    */\n    public $registered_filters = array();\n    /**\n    * registered resources\n    * @var array\n    */\n    public $registered_resources = array();\n    /**\n    * resource handler cache\n    * @var array\n    */\n    public $_resource_handlers = array();\n    /**\n    * registered cache resources\n    * @var array\n    */\n    public $registered_cache_resources = array();\n    /**\n    * cache resource handler cache\n    * @var array\n    */\n    public $_cacheresource_handlers = array();\n    /**\n    * autoload filter\n    * @var array\n    */\n    public $autoload_filters = array();\n    /**\n    * default modifier\n    * @var array\n    */\n    public $default_modifiers = array();\n    /**\n    * autoescape variable output\n    * @var boolean\n    */\n    public $escape_html = false;\n    /**\n    * global internal smarty vars\n    * @var array\n    */\n    public static $_smarty_vars = array();\n    /**\n    * start time for execution time calculation\n    * @var int\n    */\n    public $start_time = 0;\n    /**\n    * default file permissions\n    * @var int\n    */\n    public $_file_perms = 0644;\n    /**\n    * default dir permissions\n    * @var int\n    */\n    public $_dir_perms = 0771;\n    /**\n    * block tag hierarchy\n    * @var array\n    */\n    public $_tag_stack = array();\n    /**\n    * self pointer to Smarty object\n    * @var Smarty\n    */\n    public $smarty;\n    /**\n    * required by the compiler for BC\n    * @var string\n    */\n    public $_current_file = null;\n    /**\n    * internal flag to enable parser debugging\n    * @var bool\n    */\n    public $_parserdebug = false;\n    /**\n    * Saved parameter of merged templates during compilation\n    *\n    * @var array\n    */\n    public $merged_templates_func = array();\n    /**#@-*/\n\n    /**\n    * Initialize new Smarty object\n    *\n    */\n    public function __construct()\n    {\n        // selfpointer needed by some other class methods\n        $this->smarty = $this;\n        if (is_callable('mb_internal_encoding')) {\n            mb_internal_encoding(SMARTY_RESOURCE_CHAR_SET);\n        }\n        $this->start_time = microtime(true);\n        // set default dirs\n        $this->setTemplateDir('.' . DS . 'templates' . DS)\n            ->setCompileDir('.' . DS . 'templates_c' . DS)\n            ->setPluginsDir(SMARTY_PLUGINS_DIR)\n            ->setCacheDir('.' . DS . 'cache' . DS)\n            ->setConfigDir('.' . DS . 'configs' . DS);\n\n        $this->debug_tpl = 'file:' . dirname(__FILE__) . '/debug.tpl';\n        if (isset($_SERVER['SCRIPT_NAME'])) {\n            $this->assignGlobal('SCRIPT_NAME', $_SERVER['SCRIPT_NAME']);\n        }\n    }\n\n\n    /**\n    * Class destructor\n    */\n    public function __destruct()\n    {\n        // intentionally left blank\n    }\n\n    /**\n    * <<magic>> set selfpointer on cloned object\n    */\n    public function __clone()\n    {\n        $this->smarty = $this;\n    }\n\n\n    /**\n    * <<magic>> Generic getter.\n    *\n    * Calls the appropriate getter function.\n    * Issues an E_USER_NOTICE if no valid getter is found.\n    *\n    * @param string $name property name\n    * @return mixed\n    */\n    public function __get($name)\n    {\n        $allowed = array(\n        'template_dir' => 'getTemplateDir',\n        'config_dir' => 'getConfigDir',\n        'plugins_dir' => 'getPluginsDir',\n        'compile_dir' => 'getCompileDir',\n        'cache_dir' => 'getCacheDir',\n        );\n\n        if (isset($allowed[$name])) {\n            return $this->{$allowed[$name]}();\n        } else {\n            trigger_error('Undefined property: '. get_class($this) .'::$'. $name, E_USER_NOTICE);\n        }\n    }\n\n    /**\n    * <<magic>> Generic setter.\n    *\n    * Calls the appropriate setter function.\n    * Issues an E_USER_NOTICE if no valid setter is found.\n    *\n    * @param string $name  property name\n    * @param mixed  $value parameter passed to setter\n    */\n    public function __set($name, $value)\n    {\n        $allowed = array(\n        'template_dir' => 'setTemplateDir',\n        'config_dir' => 'setConfigDir',\n        'plugins_dir' => 'setPluginsDir',\n        'compile_dir' => 'setCompileDir',\n        'cache_dir' => 'setCacheDir',\n        );\n\n        if (isset($allowed[$name])) {\n            $this->{$allowed[$name]}($value);\n        } else {\n            trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE);\n        }\n    }\n\n    /**\n    * Check if a template resource exists\n    *\n    * @param string $resource_name template name\n    * @return boolean status\n    */\n    public function templateExists($resource_name)\n    {\n        // create template object\n        $save = $this->template_objects;\n        $tpl = new $this->template_class($resource_name, $this);\n        // check if it does exists\n        $result = $tpl->source->exists;\n        $this->template_objects = $save;\n        return $result;\n    }\n\n    /**\n    * Returns a single or all global  variables\n    *\n    * @param object $smarty\n    * @param string $varname variable name or null\n    * @return string variable value or or array of variables\n    */\n    public function getGlobal($varname = null)\n    {\n        if (isset($varname)) {\n            if (isset(self::$global_tpl_vars[$varname])) {\n                return self::$global_tpl_vars[$varname]->value;\n            } else {\n                return '';\n            }\n        } else {\n            $_result = array();\n            foreach (self::$global_tpl_vars AS $key => $var) {\n                $_result[$key] = $var->value;\n            }\n            return $_result;\n        }\n    }\n\n    /**\n    * Empty cache folder\n    *\n    * @param integer $exp_time expiration time\n    * @param string  $type     resource type\n    * @return integer number of cache files deleted\n    */\n    function clearAllCache($exp_time = null, $type = null)\n    {\n        // load cache resource and call clearAll\n        $_cache_resource = Smarty_CacheResource::load($this, $type);\n        Smarty_CacheResource::invalidLoadedCache($this);\n        return $_cache_resource->clearAll($this, $exp_time);\n    }\n\n    /**\n    * Empty cache for a specific template\n    *\n    * @param string  $template_name template name\n    * @param string  $cache_id      cache id\n    * @param string  $compile_id    compile id\n    * @param integer $exp_time      expiration time\n    * @param string  $type          resource type\n    * @return integer number of cache files deleted\n    */\n    public function clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)\n    {\n        // load cache resource and call clear\n        $_cache_resource = Smarty_CacheResource::load($this, $type);\n        Smarty_CacheResource::invalidLoadedCache($this);\n        return $_cache_resource->clear($this, $template_name, $cache_id, $compile_id, $exp_time);\n    }\n\n    /**\n    * Loads security class and enables security\n    *\n    * @param string|Smarty_Security $security_class if a string is used, it must be class-name\n    * @return Smarty current Smarty instance for chaining\n    * @throws SmartyException when an invalid class name is provided\n    */\n    public function enableSecurity($security_class = null)\n    {\n        if ($security_class instanceof Smarty_Security) {\n            $this->security_policy = $security_class;\n            return $this;\n        } elseif (is_object($security_class)) {\n            throw new SmartyException(\"Class '\" . get_class($security_class) . \"' must extend Smarty_Security.\");\n        }\n        if ($security_class == null) {\n            $security_class = $this->security_class;\n        }\n        if (!class_exists($security_class)) {\n            throw new SmartyException(\"Security class '$security_class' is not defined\");\n        } elseif ($security_class !== 'Smarty_Security' && !is_subclass_of($security_class, 'Smarty_Security')) {\n            throw new SmartyException(\"Class '$security_class' must extend Smarty_Security.\");\n        } else {\n            $this->security_policy = new $security_class($this);\n        }\n\n        return $this;\n    }\n\n    /**\n    * Disable security\n    * @return Smarty current Smarty instance for chaining\n    */\n    public function disableSecurity()\n    {\n        $this->security_policy = null;\n\n        return $this;\n    }\n\n    /**\n    * Set template directory\n    *\n    * @param string|array $template_dir directory(s) of template sources\n    * @return Smarty current Smarty instance for chaining\n    */\n    public function setTemplateDir($template_dir)\n    {\n        $this->template_dir = array();\n        foreach ((array) $template_dir as $k => $v) {\n            $this->template_dir[$k] = rtrim($v, '/\\\\') . DS;\n        }\n\n        $this->joined_template_dir = join(DIRECTORY_SEPARATOR, $this->template_dir);\n        return $this;\n    }\n\n    /**\n    * Add template directory(s)\n    *\n    * @param string|array $template_dir directory(s) of template sources\n    * @param string       $key          of the array element to assign the template dir to\n    * @return Smarty current Smarty instance for chaining\n    * @throws SmartyException when the given template directory is not valid\n    */\n    public function addTemplateDir($template_dir, $key=null)\n    {\n        // make sure we're dealing with an array\n        $this->template_dir = (array) $this->template_dir;\n\n        if (is_array($template_dir)) {\n            foreach ($template_dir as $k => $v) {\n                if (is_int($k)) {\n                    // indexes are not merged but appended\n                    $this->template_dir[] = rtrim($v, '/\\\\') . DS;\n                } else {\n                    // string indexes are overridden\n                    $this->template_dir[$k] = rtrim($v, '/\\\\') . DS;\n                }\n            }\n        } elseif ($key !== null) {\n            // override directory at specified index\n            $this->template_dir[$key] = rtrim($template_dir, '/\\\\') . DS;\n        } else {\n            // append new directory\n            $this->template_dir[] = rtrim($template_dir, '/\\\\') . DS;\n        }\n        $this->joined_template_dir = join(DIRECTORY_SEPARATOR, $this->template_dir);\n        return $this;\n    }\n\n    /**\n    * Get template directories\n    *\n    * @param mixed index of directory to get, null to get all\n    * @return array|string list of template directories, or directory of $index\n    */\n    public function getTemplateDir($index=null)\n    {\n        if ($index !== null) {\n            return isset($this->template_dir[$index]) ? $this->template_dir[$index] : null;\n        }\n\n        return (array)$this->template_dir;\n    }\n\n    /**\n    * Set config directory\n    *\n    * @param string|array $template_dir directory(s) of configuration sources\n    * @return Smarty current Smarty instance for chaining\n    */\n    public function setConfigDir($config_dir)\n    {\n        $this->config_dir = array();\n        foreach ((array) $config_dir as $k => $v) {\n            $this->config_dir[$k] = rtrim($v, '/\\\\') . DS;\n        }\n\n        $this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir);\n        return $this;\n    }\n\n    /**\n    * Add config directory(s)\n    *\n    * @param string|array $config_dir directory(s) of config sources\n    * @param string key of the array element to assign the config dir to\n    * @return Smarty current Smarty instance for chaining\n    */\n    public function addConfigDir($config_dir, $key=null)\n    {\n        // make sure we're dealing with an array\n        $this->config_dir = (array) $this->config_dir;\n\n        if (is_array($config_dir)) {\n            foreach ($config_dir as $k => $v) {\n                if (is_int($k)) {\n                    // indexes are not merged but appended\n                    $this->config_dir[] = rtrim($v, '/\\\\') . DS;\n                } else {\n                    // string indexes are overridden\n                    $this->config_dir[$k] = rtrim($v, '/\\\\') . DS;\n                }\n            }\n        } elseif( $key !== null ) {\n            // override directory at specified index\n            $this->config_dir[$key] = rtrim($config_dir, '/\\\\') . DS;\n        } else {\n            // append new directory\n            $this->config_dir[] = rtrim($config_dir, '/\\\\') . DS;\n        }\n\n        $this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir);\n        return $this;\n    }\n\n    /**\n    * Get config directory\n    *\n    * @param mixed index of directory to get, null to get all\n    * @return array|string configuration directory\n    */\n    public function getConfigDir($index=null)\n    {\n        if ($index !== null) {\n            return isset($this->config_dir[$index]) ? $this->config_dir[$index] : null;\n        }\n\n        return (array)$this->config_dir;\n    }\n\n    /**\n    * Set plugins directory\n    *\n    * @param string|array $plugins_dir directory(s) of plugins\n    * @return Smarty current Smarty instance for chaining\n    */\n    public function setPluginsDir($plugins_dir)\n    {\n        $this->plugins_dir = array();\n        foreach ((array)$plugins_dir as $k => $v) {\n            $this->plugins_dir[$k] = rtrim($v, '/\\\\') . DS;\n        }\n\n        return $this;\n    }\n\n    /**\n    * Adds directory of plugin files\n    *\n    * @param object $smarty\n    * @param string $ |array $ plugins folder\n    * @return Smarty current Smarty instance for chaining\n    */\n    public function addPluginsDir($plugins_dir)\n    {\n        // make sure we're dealing with an array\n        $this->plugins_dir = (array) $this->plugins_dir;\n\n        if (is_array($plugins_dir)) {\n            foreach ($plugins_dir as $k => $v) {\n                if (is_int($k)) {\n                    // indexes are not merged but appended\n                    $this->plugins_dir[] = rtrim($v, '/\\\\') . DS;\n                } else {\n                    // string indexes are overridden\n                    $this->plugins_dir[$k] = rtrim($v, '/\\\\') . DS;\n                }\n            }\n        } else {\n            // append new directory\n            $this->plugins_dir[] = rtrim($plugins_dir, '/\\\\') . DS;\n        }\n\n        $this->plugins_dir = array_unique($this->plugins_dir);\n        return $this;\n    }\n\n    /**\n    * Get plugin directories\n    *\n    * @return array list of plugin directories\n    */\n    public function getPluginsDir()\n    {\n        return (array)$this->plugins_dir;\n    }\n\n    /**\n    * Set compile directory\n    *\n    * @param string $compile_dir directory to store compiled templates in\n    * @return Smarty current Smarty instance for chaining\n    */\n    public function setCompileDir($compile_dir)\n    {\n        $this->compile_dir = rtrim($compile_dir, '/\\\\') . DS;\n        if (!isset(Smarty::$_muted_directories[$this->compile_dir])) {\n            Smarty::$_muted_directories[$this->compile_dir] = null;\n        }\n        return $this;\n    }\n\n    /**\n    * Get compiled directory\n    *\n    * @return string path to compiled templates\n    */\n    public function getCompileDir()\n    {\n        return $this->compile_dir;\n    }\n\n    /**\n    * Set cache directory\n    *\n    * @param string $cache_dir directory to store cached templates in\n    * @return Smarty current Smarty instance for chaining\n    */\n    public function setCacheDir($cache_dir)\n    {\n        $this->cache_dir = rtrim($cache_dir, '/\\\\') . DS;\n        if (!isset(Smarty::$_muted_directories[$this->cache_dir])) {\n            Smarty::$_muted_directories[$this->cache_dir] = null;\n        }\n        return $this;\n    }\n\n    /**\n    * Get cache directory\n    *\n    * @return string path of cache directory\n    */\n    public function getCacheDir()\n    {\n        return $this->cache_dir;\n    }\n\n    /**\n    * Set default modifiers\n    *\n    * @param array|string $modifiers modifier or list of modifiers to set\n    * @return Smarty current Smarty instance for chaining\n    */\n    public function setDefaultModifiers($modifiers)\n    {\n        $this->default_modifiers = (array) $modifiers;\n        return $this;\n    }\n\n    /**\n    * Add default modifiers\n    *\n    * @param array|string $modifiers modifier or list of modifiers to add\n    * @return Smarty current Smarty instance for chaining\n    */\n    public function addDefaultModifiers($modifiers)\n    {\n        if (is_array($modifiers)) {\n            $this->default_modifiers = array_merge($this->default_modifiers, $modifiers);\n        } else {\n            $this->default_modifiers[] = $modifiers;\n        }\n\n        return $this;\n    }\n\n    /**\n    * Get default modifiers\n    *\n    * @return array list of default modifiers\n    */\n    public function getDefaultModifiers()\n    {\n        return $this->default_modifiers;\n    }\n\n\n    /**\n    * Set autoload filters\n    *\n    * @param array $filters filters to load automatically\n    * @param string $type \"pre\", \"output\", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types\n    * @return Smarty current Smarty instance for chaining\n    */\n    public function setAutoloadFilters($filters, $type=null)\n    {\n        if ($type !== null) {\n            $this->autoload_filters[$type] = (array) $filters;\n        } else {\n            $this->autoload_filters = (array) $filters;\n        }\n\n        return $this;\n    }\n\n    /**\n    * Add autoload filters\n    *\n    * @param array $filters filters to load automatically\n    * @param string $type \"pre\", \"output\", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types\n    * @return Smarty current Smarty instance for chaining\n    */\n    public function addAutoloadFilters($filters, $type=null)\n    {\n        if ($type !== null) {\n            if (!empty($this->autoload_filters[$type])) {\n                $this->autoload_filters[$type] = array_merge($this->autoload_filters[$type], (array) $filters);\n            } else {\n                $this->autoload_filters[$type] = (array) $filters;\n            }\n        } else {\n            foreach ((array) $filters as $key => $value) {\n                if (!empty($this->autoload_filters[$key])) {\n                    $this->autoload_filters[$key] = array_merge($this->autoload_filters[$key], (array) $value);\n                } else {\n                    $this->autoload_filters[$key] = (array) $value;\n                }\n            }\n        }\n\n        return $this;\n    }\n\n    /**\n    * Get autoload filters\n    *\n    * @param string $type type of filter to get autoloads for. Defaults to all autoload filters\n    * @return array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type was specified\n    */\n    public function getAutoloadFilters($type=null)\n    {\n        if ($type !== null) {\n            return isset($this->autoload_filters[$type]) ? $this->autoload_filters[$type] : array();\n        }\n\n        return $this->autoload_filters;\n    }\n\n    /**\n    * return name of debugging template\n    *\n    * @return string\n    */\n    public function getDebugTemplate()\n    {\n        return $this->debug_tpl;\n    }\n\n    /**\n    * set the debug template\n    *\n    * @param string $tpl_name\n    * @return Smarty current Smarty instance for chaining\n    * @throws SmartyException if file is not readable\n    */\n    public function setDebugTemplate($tpl_name)\n    {\n        if (!is_readable($tpl_name)) {\n            throw new SmartyException(\"Unknown file '{$tpl_name}'\");\n        }\n        $this->debug_tpl = $tpl_name;\n\n        return $this;\n    }\n\n    /**\n    * creates a template object\n    *\n    * @param string $template the resource handle of the template file\n    * @param mixed $cache_id cache id to be used with this template\n    * @param mixed $compile_id compile id to be used with this template\n    * @param object $parent next higher level of Smarty variables\n    * @param boolean $do_clone flag is Smarty object shall be cloned\n    * @return object template object\n    */\n    public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true)\n    {\n        if (!empty($cache_id) && (is_object($cache_id) || is_array($cache_id))) {\n            $parent = $cache_id;\n            $cache_id = null;\n        }\n        if (!empty($parent) && is_array($parent)) {\n            $data = $parent;\n            $parent = null;\n        } else {\n            $data = null;\n        }\n        // default to cache_id and compile_id of Smarty object\n        $cache_id = $cache_id === null ? $this->cache_id : $cache_id;\n        $compile_id = $compile_id === null ? $this->compile_id : $compile_id;\n        // already in template cache?\n        if ($this->allow_ambiguous_resources) {\n            $_templateId = Smarty_Resource::getUniqueTemplateName($this, $template) . $cache_id . $compile_id;\n        } else {\n            $_templateId = $this->joined_template_dir . '#' . $template . $cache_id . $compile_id;\n        }\n        if (isset($_templateId[150])) {\n            $_templateId = sha1($_templateId);\n        }\n        if ($do_clone) {\n            if (isset($this->template_objects[$_templateId])) {\n                // return cached template object\n                $tpl = clone $this->template_objects[$_templateId];\n                $tpl->smarty = clone $tpl->smarty;\n                $tpl->parent = $parent;\n                $tpl->tpl_vars = array();\n                $tpl->config_vars = array();\n            } else {\n                $tpl = new $this->template_class($template, clone $this, $parent, $cache_id, $compile_id);\n            }\n        } else {\n            if (isset($this->template_objects[$_templateId])) {\n                // return cached template object\n                $tpl = $this->template_objects[$_templateId];\n                $tpl->parent = $parent;\n                $tpl->tpl_vars = array();\n                $tpl->config_vars = array();\n            } else {\n                $tpl = new $this->template_class($template, $this, $parent, $cache_id, $compile_id);\n            }\n        }\n        // fill data if present\n        if (!empty($data) && is_array($data)) {\n            // set up variable values\n            foreach ($data as $_key => $_val) {\n                $tpl->tpl_vars[$_key] = new Smarty_variable($_val);\n            }\n        }\n        return $tpl;\n    }\n\n\n    /**\n    * Takes unknown classes and loads plugin files for them\n    * class name format: Smarty_PluginType_PluginName\n    * plugin filename format: plugintype.pluginname.php\n    *\n    * @param string $plugin_name    class plugin name to load\n    * @param bool   $check          check if already loaded\n    * @return string |boolean filepath of loaded file or false\n    */\n    public function loadPlugin($plugin_name, $check = true)\n    {\n        // if function or class exists, exit silently (already loaded)\n        if ($check && (is_callable($plugin_name) || class_exists($plugin_name, false))) {\n            return true;\n        }\n        // Plugin name is expected to be: Smarty_[Type]_[Name]\n        $_name_parts = explode('_', $plugin_name, 3);\n        // class name must have three parts to be valid plugin\n        // count($_name_parts) < 3 === !isset($_name_parts[2])\n        if (!isset($_name_parts[2]) || strtolower($_name_parts[0]) !== 'smarty') {\n            throw new SmartyException(\"plugin {$plugin_name} is not a valid name format\");\n            return false;\n        }\n        // if type is \"internal\", get plugin from sysplugins\n        if (strtolower($_name_parts[1]) == 'internal') {\n            $file = SMARTY_SYSPLUGINS_DIR . strtolower($plugin_name) . '.php';\n            if (file_exists($file)) {\n                require_once($file);\n                return $file;\n            } else {\n                return false;\n            }\n        }\n        // plugin filename is expected to be: [type].[name].php\n        $_plugin_filename = \"{$_name_parts[1]}.{$_name_parts[2]}.php\";\n\n        // loop through plugin dirs and find the plugin\n        foreach($this->getPluginsDir() as $_plugin_dir) {\n            $names = array(\n                $_plugin_dir . $_plugin_filename,\n                $_plugin_dir . strtolower($_plugin_filename),\n            );\n            foreach ($names as $file) {\n                if (file_exists($file)) {\n                    require_once($file);\n                    return $file;\n                }\n                if ($this->use_include_path && !preg_match('/^([\\/\\\\\\\\]|[a-zA-Z]:[\\/\\\\\\\\])/', $_plugin_dir)) {\n                    // try PHP include_path\n                    if (($file = Smarty_Internal_Get_Include_Path::getIncludePath($file)) !== false) {\n                        require_once($file);\n                        return $file;\n                    }\n                }\n            }\n        }\n        // no plugin loaded\n        return false;\n    }\n\n    /**\n    * Compile all template files\n    *\n    * @param string $extension file extension\n    * @param bool $force_compile force all to recompile\n    * @param int $time_limit\n    * @param int $max_errors\n    * @return integer number of template files recompiled\n    */\n    public function compileAllTemplates($extention = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null)\n    {\n        return Smarty_Internal_Utility::compileAllTemplates($extention, $force_compile, $time_limit, $max_errors, $this);\n    }\n\n    /**\n    * Compile all config files\n    *\n    * @param string $extension file extension\n    * @param bool $force_compile force all to recompile\n    * @param int $time_limit\n    * @param int $max_errors\n    * @return integer number of template files recompiled\n    */\n    public function compileAllConfig($extention = '.conf', $force_compile = false, $time_limit = 0, $max_errors = null)\n    {\n        return Smarty_Internal_Utility::compileAllConfig($extention, $force_compile, $time_limit, $max_errors, $this);\n    }\n\n    /**\n    * Delete compiled template file\n    *\n    * @param string $resource_name template name\n    * @param string $compile_id compile id\n    * @param integer $exp_time expiration time\n    * @return integer number of template files deleted\n    */\n    public function clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null)\n    {\n        return Smarty_Internal_Utility::clearCompiledTemplate($resource_name, $compile_id, $exp_time, $this);\n    }\n\n\n    /**\n    * Return array of tag/attributes of all tags used by an template\n    *\n    * @param object $templae template object\n    * @return array of tag/attributes\n    */\n    public function getTags(Smarty_Internal_Template $template)\n    {\n        return Smarty_Internal_Utility::getTags($template);\n    }\n\n    /**\n     * Run installation test\n     *\n     * @param array $errors Array to write errors into, rather than outputting them\n     * @return boolean true if setup is fine, false if something is wrong\n     */\n    public function testInstall(&$errors=null)\n    {\n        return Smarty_Internal_Utility::testInstall($this, $errors);\n    }\n\n    /**\n     * Error Handler to mute expected messages\n     *\n     * @link http://php.net/set_error_handler\n     * @param integer $errno Error level\n     * @return boolean\n     */\n    public static function mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext)\n    {\n        $_is_muted_directory = false;\n\n        // add the SMARTY_DIR to the list of muted directories\n        if (!isset(Smarty::$_muted_directories[SMARTY_DIR])) {\n            $smarty_dir = realpath(SMARTY_DIR);\n            Smarty::$_muted_directories[SMARTY_DIR] = array(\n                'file' => $smarty_dir,\n                'length' => strlen($smarty_dir),\n            );\n        }\n\n        // walk the muted directories and test against $errfile\n        foreach (Smarty::$_muted_directories as $key => &$dir) {\n            if (!$dir) {\n                // resolve directory and length for speedy comparisons\n                $file = realpath($key);\n                $dir = array(\n                    'file' => $file,\n                    'length' => strlen($file),\n                );\n            }\n            if (!strncmp($errfile, $dir['file'], $dir['length'])) {\n                $_is_muted_directory = true;\n                break;\n            }\n        }\n\n        // pass to next error handler if this error did not occur inside SMARTY_DIR\n        // or the error was within smarty but masked to be ignored\n        if (!$_is_muted_directory || ($errno && $errno & error_reporting())) {\n            if (Smarty::$_previous_error_handler) {\n                return call_user_func(Smarty::$_previous_error_handler, $errno, $errstr, $errfile, $errline, $errcontext);\n            } else {\n                return false;\n            }\n        }\n    }\n\n    /**\n     * Enable error handler to mute expected messages\n     *\n     * @return void\n     */\n    public static function muteExpectedErrors()\n    {\n        /*\n            error muting is done because some people implemented custom error_handlers using\n            http://php.net/set_error_handler and for some reason did not understand the following paragraph:\n\n                It is important to remember that the standard PHP error handler is completely bypassed for the\n                error types specified by error_types unless the callback function returns FALSE.\n                error_reporting() settings will have no effect and your error handler will be called regardless -\n                however you are still able to read the current value of error_reporting and act appropriately.\n                Of particular note is that this value will be 0 if the statement that caused the error was\n                prepended by the @ error-control operator.\n\n            Smarty deliberately uses @filemtime() over file_exists() and filemtime() in some places. Reasons include\n                - @filemtime() is almost twice as fast as using an additional file_exists()\n                - between file_exists() and filemtime() a possible race condition is opened,\n                  which does not exist using the simple @filemtime() approach.\n        */\n        $error_handler = array('Smarty', 'mutingErrorHandler');\n        $previous = set_error_handler($error_handler);\n\n        // avoid dead loops\n        if ($previous !== $error_handler) {\n            Smarty::$_previous_error_handler = $previous;\n        }\n    }\n\n    /**\n     * Disable error handler muting expected messages\n     *\n     * @return void\n     */\n    public static function unmuteExpectedErrors()\n    {\n        restore_error_handler();\n    }\n}\n\n/**\n* Smarty exception class\n* @package Smarty\n*/\nclass SmartyException extends Exception {\n}\n\n/**\n* Smarty compiler exception class\n* @package Smarty\n*/\nclass SmartyCompilerException extends SmartyException  {\n}\n\n/**\n* Autoloader\n*/\nfunction smartyAutoload($class)\n{\n    $_class = strtolower($class);\n    $_classes = array(\n        'smarty_config_source' => true,\n        'smarty_config_compiled' => true,\n        'smarty_security' => true,\n        'smarty_cacheresource' => true,\n        'smarty_cacheresource_custom' => true,\n        'smarty_cacheresource_keyvaluestore' => true,\n        'smarty_resource' => true,\n        'smarty_resource_custom' => true,\n        'smarty_resource_uncompiled' => true,\n        'smarty_resource_recompiled' => true,\n    );\n\n    if (!strncmp($_class, 'smarty_internal_', 16) || isset($_classes[$_class])) {\n        include SMARTY_SYSPLUGINS_DIR . $_class . '.php';\n    }\n}\n\n?>\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/SmartyBC.class.php",
    "content": "<?php\n/**\n * Project:     Smarty: the PHP compiling template engine\n * File:        SmartyBC.class.php\n * SVN:         $Id: SmartyBC.class.php 2504 2011-12-28 07:35:29Z liu21st $\n *\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n *\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this library; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n *\n * For questions, help, comments, discussion, etc., please join the\n * Smarty mailing list. Send a blank e-mail to\n * smarty-discussion-subscribe@googlegroups.com\n *\n * @link http://www.smarty.net/\n * @copyright 2008 New Digital Group, Inc.\n * @author Monte Ohrt <monte at ohrt dot com>\n * @author Uwe Tews\n * @author Rodney Rehm\n * @package Smarty\n */\n/**\n * @ignore\n */\nrequire(dirname(__FILE__) . '/Smarty.class.php');\n\n/**\n * Smarty Backward Compatability Wrapper Class\n *\n * @package Smarty\n */\nclass SmartyBC extends Smarty {\n\n    /**\n     * Smarty 2 BC\n     * @var string\n     */\n    public $_version = self::SMARTY_VERSION;\n\n    /**\n     * Initialize new SmartyBC object\n     *\n     * @param array $options options to set during initialization, e.g. array( 'forceCompile' => false )\n     */\n    public function __construct(array $options=array())\n    {\n        parent::__construct($options);\n        // register {php} tag\n        $this->registerPlugin('block', 'php', 'smarty_php_tag');\n    }\n\n    /**\n     * wrapper for assign_by_ref\n     *\n     * @param string $tpl_var the template variable name\n     * @param mixed  &$value  the referenced value to assign\n     */\n    public function assign_by_ref($tpl_var, &$value)\n    {\n        $this->assignByRef($tpl_var, $value);\n    }\n\n    /**\n     * wrapper for append_by_ref\n     *\n     * @param string  $tpl_var the template variable name\n     * @param mixed   &$value  the referenced value to append\n     * @param boolean $merge   flag if array elements shall be merged\n     */\n    public function append_by_ref($tpl_var, &$value, $merge = false)\n    {\n        $this->appendByRef($tpl_var, $value, $merge);\n    }\n\n    /**\n     * clear the given assigned template variable.\n     *\n     * @param string $tpl_var the template variable to clear\n     */\n    public function clear_assign($tpl_var)\n    {\n        $this->clearAssign($tpl_var);\n    }\n\n    /**\n     * Registers custom function to be used in templates\n     *\n     * @param string $function      the name of the template function\n     * @param string $function_impl the name of the PHP function to register\n     * @param bool   $cacheable\n     * @param mixed  $cache_attrs\n     */\n    public function register_function($function, $function_impl, $cacheable=true, $cache_attrs=null)\n    {\n        $this->registerPlugin('function', $function, $function_impl, $cacheable, $cache_attrs);\n    }\n\n    /**\n     * Unregisters custom function\n     *\n     * @param string $function name of template function\n     */\n    public function unregister_function($function)\n    {\n        $this->unregisterPlugin('function', $function);\n    }\n\n    /**\n     * Registers object to be used in templates\n     *\n     * @param string  $object      name of template object\n     * @param object  $object_impl the referenced PHP object to register\n     * @param array   $allowed     list of allowed methods (empty = all)\n     * @param boolean $smarty_args smarty argument format, else traditional\n     * @param array   $block_functs list of methods that are block format\n     */\n    public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())\n    {\n        settype($allowed, 'array');\n        settype($smarty_args, 'boolean');\n        $this->registerObject($object, $object_impl, $allowed, $smarty_args, $block_methods);\n    }\n\n    /**\n     * Unregisters object\n     *\n     * @param string $object name of template object\n     */\n    public function unregister_object($object)\n    {\n        $this->unregisterObject($object);\n    }\n\n    /**\n     * Registers block function to be used in templates\n     *\n     * @param string $block      name of template block\n     * @param string $block_impl PHP function to register\n     * @param bool   $cacheable\n     * @param mixed  $cache_attrs\n     */\n    public function register_block($block, $block_impl, $cacheable=true, $cache_attrs=null)\n    {\n        $this->registerPlugin('block', $block, $block_impl, $cacheable, $cache_attrs);\n    }\n\n    /**\n     * Unregisters block function\n     *\n     * @param string $block name of template function\n     */\n    public function unregister_block($block)\n    {\n        $this->unregisterPlugin('block', $block);\n    }\n\n    /**\n     * Registers compiler function\n     *\n     * @param string $function      name of template function\n     * @param string $function_impl name of PHP function to register\n     * @param bool   $cacheable\n     */\n    public function register_compiler_function($function, $function_impl, $cacheable=true)\n    {\n        $this->registerPlugin('compiler', $function, $function_impl, $cacheable);\n    }\n\n    /**\n     * Unregisters compiler function\n     *\n     * @param string $function name of template function\n     */\n    public function unregister_compiler_function($function)\n    {\n        $this->unregisterPlugin('compiler', $function);\n    }\n\n    /**\n     * Registers modifier to be used in templates\n     *\n     * @param string $modifier name of template modifier\n     * @param string $modifier_impl name of PHP function to register\n     */\n    public function register_modifier($modifier, $modifier_impl)\n    {\n        $this->registerPlugin('modifier', $modifier, $modifier_impl);\n    }\n\n    /**\n     * Unregisters modifier\n     *\n     * @param string $modifier name of template modifier\n     */\n    public function unregister_modifier($modifier)\n    {\n        $this->unregisterPlugin('modifier', $modifier);\n    }\n\n    /**\n     * Registers a resource to fetch a template\n     *\n     * @param string $type      name of resource\n     * @param array  $functions array of functions to handle resource\n     */\n    public function register_resource($type, $functions)\n    {\n        $this->registerResource($type, $functions);\n    }\n\n    /**\n     * Unregisters a resource\n     *\n     * @param string $type name of resource\n     */\n    public function unregister_resource($type)\n    {\n        $this->unregisterResource($type);\n    }\n\n    /**\n     * Registers a prefilter function to apply\n     * to a template before compiling\n     *\n     * @param callable $function\n     */\n    public function register_prefilter($function)\n    {\n        $this->registerFilter('pre', $function);\n    }\n\n    /**\n     * Unregisters a prefilter function\n     *\n     * @param callable $function\n     */\n    public function unregister_prefilter($function)\n    {\n        $this->unregisterFilter('pre', $function);\n    }\n\n    /**\n     * Registers a postfilter function to apply\n     * to a compiled template after compilation\n     *\n     * @param callable $function\n     */\n    public function register_postfilter($function)\n    {\n        $this->registerFilter('post', $function);\n    }\n\n    /**\n     * Unregisters a postfilter function\n     *\n     * @param callable $function\n     */\n    public function unregister_postfilter($function)\n    {\n        $this->unregisterFilter('post', $function);\n    }\n\n    /**\n     * Registers an output filter function to apply\n     * to a template output\n     *\n     * @param callable $function\n     */\n    public function register_outputfilter($function)\n    {\n        $this->registerFilter('output', $function);\n    }\n\n    /**\n     * Unregisters an outputfilter function\n     *\n     * @param callable $function\n     */\n    public function unregister_outputfilter($function)\n    {\n        $this->unregisterFilter('output', $function);\n    }\n\n    /**\n     * load a filter of specified type and name\n     *\n     * @param string $type filter type\n     * @param string $name filter name\n     */\n    public function load_filter($type, $name)\n    {\n        $this->loadFilter($type, $name);\n    }\n\n    /**\n     * clear cached content for the given template and cache id\n     *\n     * @param string $tpl_file   name of template file\n     * @param string $cache_id   name of cache_id\n     * @param string $compile_id name of compile_id\n     * @param string $exp_time   expiration time\n     * @return boolean\n     */\n    public function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)\n    {\n        return $this->clearCache($tpl_file, $cache_id, $compile_id, $exp_time);\n    }\n\n    /**\n     * clear the entire contents of cache (all templates)\n     *\n     * @param string $exp_time expire time\n     * @return boolean\n     */\n    public function clear_all_cache($exp_time = null)\n    {\n        return $this->clearCache(null, null, null, $exp_time);\n    }\n\n    /**\n     * test to see if valid cache exists for this template\n     *\n     * @param string $tpl_file name of template file\n     * @param string $cache_id\n     * @param string $compile_id\n     * @return boolean\n     */\n    public function is_cached($tpl_file, $cache_id = null, $compile_id = null)\n    {\n        return $this->isCached($tpl_file, $cache_id, $compile_id);\n    }\n\n    /**\n     * clear all the assigned template variables.\n     */\n    public function clear_all_assign()\n    {\n        $this->clearAllAssign();\n    }\n\n    /**\n     * clears compiled version of specified template resource,\n     * or all compiled template files if one is not specified.\n     * This function is for advanced use only, not normally needed.\n     *\n     * @param string $tpl_file\n     * @param string $compile_id\n     * @param string $exp_time\n     * @return boolean results of {@link smarty_core_rm_auto()}\n     */\n    public function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null)\n    {\n        return $this->clearCompiledTemplate($tpl_file, $compile_id, $exp_time);\n    }\n\n    /**\n     * Checks whether requested template exists.\n     *\n     * @param string $tpl_file\n     * @return boolean\n     */\n    public function template_exists($tpl_file)\n    {\n        return $this->templateExists($tpl_file);\n    }\n\n    /**\n     * Returns an array containing template variables\n     *\n     * @param string $name\n     * @return array\n     */\n    public function get_template_vars($name=null)\n    {\n        return $this->getTemplateVars($name);\n    }\n\n    /**\n     * Returns an array containing config variables\n     *\n     * @param string $name\n     * @return array\n     */\n    public function get_config_vars($name=null)\n    {\n        return $this->getConfigVars($name);\n    }\n\n    /**\n     * load configuration values\n     *\n     * @param string $file\n     * @param string $section\n     * @param string $scope\n     */\n    public function config_load($file, $section = null, $scope = 'global')\n    {\n        $this->ConfigLoad($file, $section, $scope);\n    }\n\n    /**\n     * return a reference to a registered object\n     *\n     * @param string $name\n     * @return object\n     */\n    public function get_registered_object($name)\n    {\n        return $this->getRegisteredObject($name);\n    }\n\n    /**\n     * clear configuration values\n     *\n     * @param string $var\n     */\n    public function clear_config($var = null)\n    {\n        $this->clearConfig($var);\n    }\n\n    /**\n     * trigger Smarty error\n     *\n     * @param string $error_msg\n     * @param integer $error_type\n     */\n    public function trigger_error($error_msg, $error_type = E_USER_WARNING)\n    {\n        trigger_error(\"Smarty error: $error_msg\", $error_type);\n    }\n\n}\n\n/**\n * Smarty {php}{/php} block function\n *\n * @param array   $params   parameter list\n * @param string  $content  contents of the block\n * @param object  $template template object\n * @param boolean &$repeat  repeat flag\n * @return string content re-formatted\n */\nfunction smarty_php_tag($params, $content, $template, &$repeat)\n{\n    eval($content);\n    return '';\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/debug.tpl",
    "content": "{capture name='_smarty_debug' assign=debug_output}\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n<head>\n    <title>Smarty Debug Console</title>\n<style type=\"text/css\">\n{literal}\nbody, h1, h2, td, th, p {\n    font-family: sans-serif;\n    font-weight: normal;\n    font-size: 0.9em;\n    margin: 1px;\n    padding: 0;\n}\n\nh1 {\n    margin: 0;\n    text-align: left;\n    padding: 2px;\n    background-color: #f0c040;\n    color:  black;\n    font-weight: bold;\n    font-size: 1.2em;\n }\n\nh2 {\n    background-color: #9B410E;\n    color: white;\n    text-align: left;\n    font-weight: bold;\n    padding: 2px;\n    border-top: 1px solid black;\n}\n\nbody {\n    background: black; \n}\n\np, table, div {\n    background: #f0ead8;\n} \n\np {\n    margin: 0;\n    font-style: italic;\n    text-align: center;\n}\n\ntable {\n    width: 100%;\n}\n\nth, td {\n    font-family: monospace;\n    vertical-align: top;\n    text-align: left;\n    width: 50%;\n}\n\ntd {\n    color: green;\n}\n\n.odd {\n    background-color: #eeeeee;\n}\n\n.even {\n    background-color: #fafafa;\n}\n\n.exectime {\n    font-size: 0.8em;\n    font-style: italic;\n}\n\n#table_assigned_vars th {\n    color: blue;\n}\n\n#table_config_vars th {\n    color: maroon;\n}\n{/literal}\n</style>\n</head>\n<body>\n\n<h1>Smarty Debug Console  -  {if isset($template_name)}{$template_name|debug_print_var nofilter}{else}Total Time {$execution_time|string_format:\"%.5f\"}{/if}</h1>\n\n{if !empty($template_data)}\n<h2>included templates &amp; config files (load time in seconds)</h2>\n\n<div>\n{foreach $template_data as $template}\n  <font color=brown>{$template.name}</font>\n  <span class=\"exectime\">\n   (compile {$template['compile_time']|string_format:\"%.5f\"}) (render {$template['render_time']|string_format:\"%.5f\"}) (cache {$template['cache_time']|string_format:\"%.5f\"})\n  </span>\n  <br>\n{/foreach}\n</div>\n{/if}\n\n<h2>assigned template variables</h2>\n\n<table id=\"table_assigned_vars\">\n    {foreach $assigned_vars as $vars}\n       <tr class=\"{if $vars@iteration % 2 eq 0}odd{else}even{/if}\">   \n       <th>${$vars@key|escape:'html'}</th>\n       <td>{$vars|debug_print_var nofilter}</td></tr>\n    {/foreach}\n</table>\n\n<h2>assigned config file variables (outer template scope)</h2>\n\n<table id=\"table_config_vars\">\n    {foreach $config_vars as $vars}\n       <tr class=\"{if $vars@iteration % 2 eq 0}odd{else}even{/if}\">   \n       <th>{$vars@key|escape:'html'}</th>\n       <td>{$vars|debug_print_var nofilter}</td></tr>\n    {/foreach}\n\n</table>\n</body>\n</html>\n{/capture}\n<script type=\"text/javascript\">\n{$id = $template_name|default:''|md5}\n    _smarty_console = window.open(\"\",\"console{$id}\",\"width=680,height=600,resizable,scrollbars=yes\");\n    _smarty_console.document.write(\"{$debug_output|escape:'javascript' nofilter}\");\n    _smarty_console.document.close();\n</script>\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/block.textformat.php",
    "content": "<?php\n/**\n * Smarty plugin to format text blocks\n *\n * @package Smarty\n * @subpackage PluginsBlock\n */\n\n/**\n * Smarty {textformat}{/textformat} block plugin\n *\n * Type:     block function<br>\n * Name:     textformat<br>\n * Purpose:  format text a certain way with preset styles\n *           or custom wrap/indent settings<br>\n * Params:\n * <pre>\n * - style         - string (email)\n * - indent        - integer (0)\n * - wrap          - integer (80)\n * - wrap_char     - string (\"\\n\")\n * - indent_char   - string (\" \")\n * - wrap_boundary - boolean (true)\n * </pre>\n *\n * @link http://www.smarty.net/manual/en/language.function.textformat.php {textformat}\n *       (Smarty online manual)\n * @param array                    $params   parameters\n * @param string                   $content  contents of the block\n * @param Smarty_Internal_Template $template template object\n * @param boolean                  &$repeat  repeat flag\n * @return string content re-formatted\n * @author Monte Ohrt <monte at ohrt dot com>\n */\nfunction smarty_block_textformat($params, $content, $template, &$repeat)\n{\n    if (is_null($content)) {\n        return;\n    }\n\n    $style = null;\n    $indent = 0;\n    $indent_first = 0;\n    $indent_char = ' ';\n    $wrap = 80;\n    $wrap_char = \"\\n\";\n    $wrap_cut = false;\n    $assign = null;\n\n    foreach ($params as $_key => $_val) {\n        switch ($_key) {\n            case 'style':\n            case 'indent_char':\n            case 'wrap_char':\n            case 'assign':\n                $$_key = (string)$_val;\n                break;\n\n            case 'indent':\n            case 'indent_first':\n            case 'wrap':\n                $$_key = (int)$_val;\n                break;\n\n            case 'wrap_cut':\n                $$_key = (bool)$_val;\n                break;\n\n            default:\n                trigger_error(\"textformat: unknown attribute '$_key'\");\n        }\n    }\n\n    if ($style == 'email') {\n        $wrap = 72;\n    }\n    // split into paragraphs\n    $_paragraphs = preg_split('![\\r\\n]{2}!', $content);\n    $_output = '';\n\n\n    foreach ($_paragraphs as &$_paragraph) {\n        if (!$_paragraph) {\n            continue;\n        }\n        // convert mult. spaces & special chars to single space\n        $_paragraph = preg_replace(array('!\\s+!u', '!(^\\s+)|(\\s+$)!u'), array(' ', ''), $_paragraph);\n        // indent first line\n        if ($indent_first > 0) {\n            $_paragraph = str_repeat($indent_char, $indent_first) . $_paragraph;\n        }\n        // wordwrap sentences\n        if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {\n            require_once(SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php');\n            $_paragraph = smarty_mb_wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut);\n        } else {\n            $_paragraph = wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut);\n        }\n        // indent lines\n        if ($indent > 0) {\n            $_paragraph = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraph);\n        }\n    }\n    $_output = implode($wrap_char . $wrap_char, $_paragraphs);\n    \n    if ($assign) {\n        $template->assign($assign, $_output);\n    } else {\n        return $_output;\n    }\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/function.counter.php",
    "content": "<?php\n/**\n * Smarty plugin\n * @package Smarty\n * @subpackage PluginsFunction\n */\n\n/**\n * Smarty {counter} function plugin\n *\n * Type:     function<br>\n * Name:     counter<br>\n * Purpose:  print out a counter value\n *\n * @author Monte Ohrt <monte at ohrt dot com>\n * @link http://www.smarty.net/manual/en/language.function.counter.php {counter}\n *       (Smarty online manual)\n * @param array                    $params   parameters\n * @param Smarty_Internal_Template $template template object\n * @return string|null\n */\nfunction smarty_function_counter($params, $template)\n{\n    static $counters = array();\n\n    $name = (isset($params['name'])) ? $params['name'] : 'default';\n    if (!isset($counters[$name])) {\n        $counters[$name] = array(\n            'start'=>1,\n            'skip'=>1,\n            'direction'=>'up',\n            'count'=>1\n            );\n    }\n    $counter =& $counters[$name];\n\n    if (isset($params['start'])) {\n        $counter['start'] = $counter['count'] = (int)$params['start'];\n    }\n\n    if (!empty($params['assign'])) {\n        $counter['assign'] = $params['assign'];\n    }\n\n    if (isset($counter['assign'])) {\n        $template->assign($counter['assign'], $counter['count']);\n    }\n    \n    if (isset($params['print'])) {\n        $print = (bool)$params['print'];\n    } else {\n        $print = empty($counter['assign']);\n    }\n\n    if ($print) {\n        $retval = $counter['count'];\n    } else {\n        $retval = null;\n    }\n\n    if (isset($params['skip'])) {\n        $counter['skip'] = $params['skip'];\n    }\n    \n    if (isset($params['direction'])) {\n        $counter['direction'] = $params['direction'];\n    }\n\n    if ($counter['direction'] == \"down\")\n        $counter['count'] -= $counter['skip'];\n    else\n        $counter['count'] += $counter['skip'];\n    \n    return $retval;\n    \n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/function.cycle.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsFunction\n */\n\n/**\n * Smarty {cycle} function plugin\n *\n * Type:     function<br>\n * Name:     cycle<br>\n * Date:     May 3, 2002<br>\n * Purpose:  cycle through given values<br>\n * Params:\n * <pre>\n * - name      - name of cycle (optional)\n * - values    - comma separated list of values to cycle, or an array of values to cycle\n *               (this can be left out for subsequent calls)\n * - reset     - boolean - resets given var to true\n * - print     - boolean - print var or not. default is true\n * - advance   - boolean - whether or not to advance the cycle\n * - delimiter - the value delimiter, default is \",\"\n * - assign    - boolean, assigns to template var instead of printed.\n * </pre>\n * Examples:<br>\n * <pre>\n * {cycle values=\"#eeeeee,#d0d0d0d\"}\n * {cycle name=row values=\"one,two,three\" reset=true}\n * {cycle name=row}\n * </pre>\n *\n * @link http://www.smarty.net/manual/en/language.function.cycle.php {cycle}\n *       (Smarty online manual)\n * @author Monte Ohrt <monte at ohrt dot com>\n * @author credit to Mark Priatel <mpriatel@rogers.com>\n * @author credit to Gerard <gerard@interfold.com>\n * @author credit to Jason Sweat <jsweat_php@yahoo.com>\n * @version  1.3\n * @param array                    $params   parameters\n * @param Smarty_Internal_Template $template template object\n * @return string|null\n */\n\nfunction smarty_function_cycle($params, $template)\n{\n    static $cycle_vars;\n\n    $name = (empty($params['name'])) ? 'default' : $params['name'];\n    $print = (isset($params['print'])) ? (bool)$params['print'] : true;\n    $advance = (isset($params['advance'])) ? (bool)$params['advance'] : true;\n    $reset = (isset($params['reset'])) ? (bool)$params['reset'] : false;\n\n    if (!isset($params['values'])) {\n        if(!isset($cycle_vars[$name]['values'])) {\n            trigger_error(\"cycle: missing 'values' parameter\");\n            return;\n        }\n    } else {\n        if(isset($cycle_vars[$name]['values'])\n            && $cycle_vars[$name]['values'] != $params['values'] ) {\n            $cycle_vars[$name]['index'] = 0;\n        }\n        $cycle_vars[$name]['values'] = $params['values'];\n    }\n\n    if (isset($params['delimiter'])) {\n        $cycle_vars[$name]['delimiter'] = $params['delimiter'];\n    } elseif (!isset($cycle_vars[$name]['delimiter'])) {\n        $cycle_vars[$name]['delimiter'] = ',';\n    }\n\n    if(is_array($cycle_vars[$name]['values'])) {\n        $cycle_array = $cycle_vars[$name]['values'];\n    } else {\n        $cycle_array = explode($cycle_vars[$name]['delimiter'],$cycle_vars[$name]['values']);\n    }\n\n    if(!isset($cycle_vars[$name]['index']) || $reset ) {\n        $cycle_vars[$name]['index'] = 0;\n    }\n\n    if (isset($params['assign'])) {\n        $print = false;\n        $template->assign($params['assign'], $cycle_array[$cycle_vars[$name]['index']]);\n    }\n\n    if($print) {\n        $retval = $cycle_array[$cycle_vars[$name]['index']];\n    } else {\n        $retval = null;\n    }\n\n    if($advance) {\n        if ( $cycle_vars[$name]['index'] >= count($cycle_array) -1 ) {\n            $cycle_vars[$name]['index'] = 0;\n        } else {\n            $cycle_vars[$name]['index']++;\n        }\n    }\n\n    return $retval;\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/function.fetch.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsFunction\n */\n\n/**\n * Smarty {fetch} plugin\n *\n * Type:     function<br>\n * Name:     fetch<br>\n * Purpose:  fetch file, web or ftp data and display results\n *\n * @link http://www.smarty.net/manual/en/language.function.fetch.php {fetch}\n *       (Smarty online manual)\n * @author Monte Ohrt <monte at ohrt dot com>\n * @param array                    $params   parameters\n * @param Smarty_Internal_Template $template template object\n * @return string|null if the assign parameter is passed, Smarty assigns the result to a template variable\n */\nfunction smarty_function_fetch($params, $template)\n{\n    if (empty($params['file'])) {\n        trigger_error(\"[plugin] fetch parameter 'file' cannot be empty\",E_USER_NOTICE);\n        return;\n    }\n\n    $content = '';\n    if (isset($template->smarty->security_policy) && !preg_match('!^(http|ftp)://!i', $params['file'])) {\n        if(!$template->smarty->security_policy->isTrustedResourceDir($params['file'])) {\n            return;\n        }\n\n        // fetch the file\n        if($fp = @fopen($params['file'],'r')) {\n            while(!feof($fp)) {\n                $content .= fgets ($fp,4096);\n            }\n            fclose($fp);\n        } else {\n            trigger_error('[plugin] fetch cannot read file \\'' . $params['file'] . '\\'',E_USER_NOTICE);\n            return;\n        }\n    } else {\n        // not a local file\n        if(preg_match('!^http://!i',$params['file'])) {\n            // http fetch\n            if($uri_parts = parse_url($params['file'])) {\n                // set defaults\n                $host = $server_name = $uri_parts['host'];\n                $timeout = 30;\n                $accept = \"image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*\";\n                $agent = \"Smarty Template Engine \". Smarty::SMARTY_VERSION;\n                $referer = \"\";\n                $uri = !empty($uri_parts['path']) ? $uri_parts['path'] : '/';\n                $uri .= !empty($uri_parts['query']) ? '?' . $uri_parts['query'] : '';\n                $_is_proxy = false;\n                if(empty($uri_parts['port'])) {\n                    $port = 80;\n                } else {\n                    $port = $uri_parts['port'];\n                }\n                if(!empty($uri_parts['user'])) {\n                    $user = $uri_parts['user'];\n                }\n                if(!empty($uri_parts['pass'])) {\n                    $pass = $uri_parts['pass'];\n                }\n                // loop through parameters, setup headers\n                foreach($params as $param_key => $param_value) {\n                    switch($param_key) {\n                        case \"file\":\n                        case \"assign\":\n                        case \"assign_headers\":\n                            break;\n                        case \"user\":\n                            if(!empty($param_value)) {\n                                $user = $param_value;\n                            }\n                            break;\n                        case \"pass\":\n                            if(!empty($param_value)) {\n                                $pass = $param_value;\n                            }\n                            break;\n                        case \"accept\":\n                            if(!empty($param_value)) {\n                                $accept = $param_value;\n                            }\n                            break;\n                        case \"header\":\n                            if(!empty($param_value)) {\n                                if(!preg_match('![\\w\\d-]+: .+!',$param_value)) {\n                                    trigger_error(\"[plugin] invalid header format '\".$param_value.\"'\",E_USER_NOTICE);\n                                    return;\n                                } else {\n                                    $extra_headers[] = $param_value;\n                                }\n                            }\n                            break;\n                        case \"proxy_host\":\n                            if(!empty($param_value)) {\n                                $proxy_host = $param_value;\n                            }\n                            break;\n                        case \"proxy_port\":\n                            if(!preg_match('!\\D!', $param_value)) {\n                                $proxy_port = (int) $param_value;\n                            } else {\n                                trigger_error(\"[plugin] invalid value for attribute '\".$param_key.\"'\",E_USER_NOTICE);\n                                return;\n                            }\n                            break;\n                        case \"agent\":\n                            if(!empty($param_value)) {\n                                $agent = $param_value;\n                            }\n                            break;\n                        case \"referer\":\n                            if(!empty($param_value)) {\n                                $referer = $param_value;\n                            }\n                            break;\n                        case \"timeout\":\n                            if(!preg_match('!\\D!', $param_value)) {\n                                $timeout = (int) $param_value;\n                            } else {\n                                trigger_error(\"[plugin] invalid value for attribute '\".$param_key.\"'\",E_USER_NOTICE);\n                                return;\n                            }\n                            break;\n                        default:\n                            trigger_error(\"[plugin] unrecognized attribute '\".$param_key.\"'\",E_USER_NOTICE);\n                            return;\n                    }\n                }\n                if(!empty($proxy_host) && !empty($proxy_port)) {\n                    $_is_proxy = true;\n                    $fp = fsockopen($proxy_host,$proxy_port,$errno,$errstr,$timeout);\n                } else {\n                    $fp = fsockopen($server_name,$port,$errno,$errstr,$timeout);\n                }\n\n                if(!$fp) {\n                    trigger_error(\"[plugin] unable to fetch: $errstr ($errno)\",E_USER_NOTICE);\n                    return;\n                } else {\n                    if($_is_proxy) {\n                        fputs($fp, 'GET ' . $params['file'] . \" HTTP/1.0\\r\\n\");\n                    } else {\n                        fputs($fp, \"GET $uri HTTP/1.0\\r\\n\");\n                    }\n                    if(!empty($host)) {\n                        fputs($fp, \"Host: $host\\r\\n\");\n                    }\n                    if(!empty($accept)) {\n                        fputs($fp, \"Accept: $accept\\r\\n\");\n                    }\n                    if(!empty($agent)) {\n                        fputs($fp, \"User-Agent: $agent\\r\\n\");\n                    }\n                    if(!empty($referer)) {\n                        fputs($fp, \"Referer: $referer\\r\\n\");\n                    }\n                    if(isset($extra_headers) && is_array($extra_headers)) {\n                        foreach($extra_headers as $curr_header) {\n                            fputs($fp, $curr_header.\"\\r\\n\");\n                        }\n                    }\n                    if(!empty($user) && !empty($pass)) {\n                        fputs($fp, \"Authorization: BASIC \".base64_encode(\"$user:$pass\").\"\\r\\n\");\n                    }\n\n                    fputs($fp, \"\\r\\n\");\n                    while(!feof($fp)) {\n                        $content .= fgets($fp,4096);\n                    }\n                    fclose($fp);\n                    $csplit = preg_split(\"!\\r\\n\\r\\n!\",$content,2);\n\n                    $content = $csplit[1];\n\n                    if(!empty($params['assign_headers'])) {\n                        $template->assign($params['assign_headers'],preg_split(\"!\\r\\n!\",$csplit[0]));\n                    }\n                }\n            } else {\n                trigger_error(\"[plugin fetch] unable to parse URL, check syntax\",E_USER_NOTICE);\n                return;\n            }\n        } else {\n            // ftp fetch\n            if($fp = @fopen($params['file'],'r')) {\n                while(!feof($fp)) {\n                    $content .= fgets ($fp,4096);\n                }\n                fclose($fp);\n            } else {\n                trigger_error('[plugin] fetch cannot read file \\'' . $params['file'] .'\\'',E_USER_NOTICE);\n                return;\n            }\n        }\n\n    }\n\n\n    if (!empty($params['assign'])) {\n        $template->assign($params['assign'],$content);\n    } else {\n        return $content;\n    }\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/function.html_checkboxes.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsFunction\n */\n\n/**\n * Smarty {html_checkboxes} function plugin\n *\n * File:       function.html_checkboxes.php<br>\n * Type:       function<br>\n * Name:       html_checkboxes<br>\n * Date:       24.Feb.2003<br>\n * Purpose:    Prints out a list of checkbox input types<br>\n * Examples:\n * <pre>\n * {html_checkboxes values=$ids output=$names}\n * {html_checkboxes values=$ids name='box' separator='<br>' output=$names}\n * {html_checkboxes values=$ids checked=$checked separator='<br>' output=$names}\n * </pre>\n * Params:\n * <pre>\n * - name       (optional) - string default \"checkbox\"\n * - values     (required) - array\n * - options    (optional) - associative array\n * - checked    (optional) - array default not set\n * - separator  (optional) - ie <br> or &nbsp;\n * - output     (optional) - the output next to each checkbox\n * - assign     (optional) - assign the output as an array to this variable\n * - escape     (optional) - escape the content (not value), defaults to true\n * </pre>\n *\n * @link http://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes}\n *      (Smarty online manual)\n * @author     Christopher Kvarme <christopher.kvarme@flashjab.com>\n * @author credits to Monte Ohrt <monte at ohrt dot com>\n * @version    1.0\n * @param array $params parameters\n * @param object $template template object\n * @return string\n * @uses smarty_function_escape_special_chars()\n */\nfunction smarty_function_html_checkboxes($params, $template)\n{\n    require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');\n\n    $name = 'checkbox';\n    $values = null;\n    $options = null;\n    $selected = array();\n    $separator = '';\n    $escape = true;\n    $labels = true;\n    $label_ids = false;\n    $output = null;\n\n    $extra = '';\n\n    foreach($params as $_key => $_val) {\n        switch($_key) {\n            case 'name':\n            case 'separator':\n                $$_key = (string) $_val;\n                break;\n\n            case 'escape':\n            case 'labels':\n            case 'label_ids':\n                $$_key = (bool) $_val;\n                break;\n\n            case 'options':\n                $$_key = (array) $_val;\n                break;\n\n            case 'values':\n            case 'output':\n                $$_key = array_values((array) $_val);\n                break;\n\n            case 'checked':\n            case 'selected':\n                if (is_array($_val)) {\n                    $selected = array();\n                    foreach ($_val as $_sel) {\n                        if (is_object($_sel)) {\n                            if (method_exists($_sel, \"__toString\")) {\n                                $_sel = smarty_function_escape_special_chars((string) $_sel->__toString());\n                            } else {\n                                trigger_error(\"html_checkboxes: selected attribute contains an object of class '\". get_class($_sel) .\"' without __toString() method\", E_USER_NOTICE);\n                                continue;\n                            }\n                        } else {\n                            $_sel = smarty_function_escape_special_chars((string) $_sel);\n                        }\n                        $selected[$_sel] = true;\n                    }\n                } elseif (is_object($_val)) {\n                    if (method_exists($_val, \"__toString\")) {\n                        $selected = smarty_function_escape_special_chars((string) $_val->__toString());\n                    } else {\n                        trigger_error(\"html_checkboxes: selected attribute is an object of class '\". get_class($_val) .\"' without __toString() method\", E_USER_NOTICE);\n                    }\n                } else {\n                    $selected = smarty_function_escape_special_chars((string) $_val);\n                }\n                break;\n\n            case 'checkboxes':\n                trigger_error('html_checkboxes: the use of the \"checkboxes\" attribute is deprecated, use \"options\" instead', E_USER_WARNING);\n                $options = (array) $_val;\n                break;\n\n            case 'assign':\n                break;\n\n            default:\n                if(!is_array($_val)) {\n                    $extra .= ' '.$_key.'=\"'.smarty_function_escape_special_chars($_val).'\"';\n                } else {\n                    trigger_error(\"html_checkboxes: extra attribute '$_key' cannot be an array\", E_USER_NOTICE);\n                }\n                break;\n        }\n    }\n\n    if (!isset($options) && !isset($values))\n        return ''; /* raise error here? */\n\n    $_html_result = array();\n\n    if (isset($options)) {\n        foreach ($options as $_key=>$_val) {\n            $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape);\n        }\n    } else {\n        foreach ($values as $_i=>$_key) {\n            $_val = isset($output[$_i]) ? $output[$_i] : '';\n            $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape);\n        }\n    }\n\n    if(!empty($params['assign'])) {\n        $template->assign($params['assign'], $_html_result);\n    } else {\n        return implode(\"\\n\", $_html_result);\n    }\n\n}\n\nfunction smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape=true) {\n    $_output = '';\n    \n    if (is_object($value)) {\n        if (method_exists($value, \"__toString\")) {\n            $value = (string) $value->__toString();\n        } else {\n            trigger_error(\"html_options: value is an object of class '\". get_class($value) .\"' without __toString() method\", E_USER_NOTICE);\n            return '';\n        }\n    } else {\n        $value = (string) $value;\n    }\n    \n    if (is_object($output)) {\n        if (method_exists($output, \"__toString\")) {\n            $output = (string) $output->__toString();\n        } else {\n            trigger_error(\"html_options: output is an object of class '\". get_class($output) .\"' without __toString() method\", E_USER_NOTICE);\n            return '';\n        }\n    } else {\n        $output = (string) $output;\n    }\n    \n    if ($labels) {\n        if ($label_ids) {\n            $_id = smarty_function_escape_special_chars(preg_replace('![^\\w\\-\\.]!u', '_', $name . '_' . $value));\n            $_output .= '<label for=\"' . $_id . '\">';\n        } else {\n            $_output .= '<label>';\n        } \n    }\n    \n    $name = smarty_function_escape_special_chars($name);\n    $value = smarty_function_escape_special_chars($value);\n    if ($escape) {\n        $output = smarty_function_escape_special_chars($output);\n    }\n    \n    $_output .= '<input type=\"checkbox\" name=\"' . $name . '[]\" value=\"' . $value . '\"';\n    \n    if ($labels && $label_ids) {\n        $_output .= ' id=\"' . $_id . '\"';\n    }\n    \n    if (is_array($selected)) {\n        if (isset($selected[$value])) {\n            $_output .= ' checked=\"checked\"';\n        }\n    } elseif ($value === $selected) {\n        $_output .= ' checked=\"checked\"';\n    }\n    \n    $_output .= $extra . ' />' . $output;\n    if ($labels) {\n        $_output .= '</label>';\n    }\n    \n    $_output .=  $separator;\n    return $_output;\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/function.html_image.php",
    "content": "<?php\n/**\n * Smarty plugin\n * \n * @package Smarty\n * @subpackage PluginsFunction\n */\n\n/**\n * Smarty {html_image} function plugin\n * \n * Type:     function<br>\n * Name:     html_image<br>\n * Date:     Feb 24, 2003<br>\n * Purpose:  format HTML tags for the image<br>\n * Examples: {html_image file=\"/images/masthead.gif\"}<br>\n * Output:   <img src=\"/images/masthead.gif\" width=400 height=23><br>\n * Params:\n * <pre>\n * - file        - (required) - file (and path) of image\n * - height      - (optional) - image height (default actual height)\n * - width       - (optional) - image width (default actual width)\n * - basedir     - (optional) - base directory for absolute paths, default is environment variable DOCUMENT_ROOT\n * - path_prefix - prefix for path output (optional, default empty)\n * </pre>\n * \n * @link http://www.smarty.net/manual/en/language.function.html.image.php {html_image}\n *      (Smarty online manual)\n * @author Monte Ohrt <monte at ohrt dot com> \n * @author credits to Duda <duda@big.hu> \n * @version 1.0\n * @param array                    $params   parameters\n * @param Smarty_Internal_Template $template template object\n * @return string \n * @uses smarty_function_escape_special_chars()\n */\nfunction smarty_function_html_image($params, $template)\n{\n    require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');\n \n    $alt = '';\n    $file = '';\n    $height = '';\n    $width = '';\n    $extra = '';\n    $prefix = '';\n    $suffix = '';\n    $path_prefix = '';\n    $server_vars = $_SERVER;\n    $basedir = isset($server_vars['DOCUMENT_ROOT']) ? $server_vars['DOCUMENT_ROOT'] : '';\n    foreach($params as $_key => $_val) {\n        switch ($_key) {\n            case 'file':\n            case 'height':\n            case 'width':\n            case 'dpi':\n            case 'path_prefix':\n            case 'basedir':\n                $$_key = $_val;\n                break;\n\n            case 'alt':\n                if (!is_array($_val)) {\n                    $$_key = smarty_function_escape_special_chars($_val);\n                } else {\n                    throw new SmartyException (\"html_image: extra attribute '$_key' cannot be an array\", E_USER_NOTICE);\n                } \n                break;\n\n            case 'link':\n            case 'href':\n                $prefix = '<a href=\"' . $_val . '\">';\n                $suffix = '</a>';\n                break;\n\n            default:\n                if (!is_array($_val)) {\n                    $extra .= ' ' . $_key . '=\"' . smarty_function_escape_special_chars($_val) . '\"';\n                } else {\n                    throw new SmartyException (\"html_image: extra attribute '$_key' cannot be an array\", E_USER_NOTICE);\n                } \n                break;\n        } \n    } \n\n    if (empty($file)) {\n        trigger_error(\"html_image: missing 'file' parameter\", E_USER_NOTICE);\n        return;\n    } \n\n    if (substr($file, 0, 1) == '/') {\n        $_image_path = $basedir . $file;\n    } else {\n        $_image_path = $file;\n    } \n\n    if (!isset($params['width']) || !isset($params['height'])) {\n        if (!$_image_data = @getimagesize($_image_path)) {\n            if (!file_exists($_image_path)) {\n                trigger_error(\"html_image: unable to find '$_image_path'\", E_USER_NOTICE);\n                return;\n            } else if (!is_readable($_image_path)) {\n                trigger_error(\"html_image: unable to read '$_image_path'\", E_USER_NOTICE);\n                return;\n            } else {\n                trigger_error(\"html_image: '$_image_path' is not a valid image file\", E_USER_NOTICE);\n                return;\n            } \n        } \n        if (isset($template->smarty->security_policy)) {\n            if (!$template->smarty->security_policy->isTrustedResourceDir($_image_path)) {\n                return;\n            } \n        } \n\n        if (!isset($params['width'])) {\n            $width = $_image_data[0];\n        } \n        if (!isset($params['height'])) {\n            $height = $_image_data[1];\n        } \n    } \n\n    if (isset($params['dpi'])) {\n        if (strstr($server_vars['HTTP_USER_AGENT'], 'Mac')) {\n            $dpi_default = 72;\n        } else {\n            $dpi_default = 96;\n        } \n        $_resize = $dpi_default / $params['dpi'];\n        $width = round($width * $_resize);\n        $height = round($height * $_resize);\n    } \n\n    return $prefix . '<img src=\"' . $path_prefix . $file . '\" alt=\"' . $alt . '\" width=\"' . $width . '\" height=\"' . $height . '\"' . $extra . ' />' . $suffix;\n} \n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/function.html_options.php",
    "content": "<?php\n/**\n * Smarty plugin\n * \n * @package Smarty\n * @subpackage PluginsFunction\n */\n\n/**\n * Smarty {html_options} function plugin\n * \n * Type:     function<br>\n * Name:     html_options<br>\n * Purpose:  Prints the list of <option> tags generated from\n *           the passed parameters<br>\n * Params:\n * <pre>\n * - name       (optional) - string default \"select\"\n * - values     (required) - if no options supplied) - array\n * - options    (required) - if no values supplied) - associative array\n * - selected   (optional) - string default not set\n * - output     (required) - if not options supplied) - array\n * - id         (optional) - string default not set\n * - class      (optional) - string default not set\n * </pre>\n * \n * @link http://www.smarty.net/manual/en/language.function.html.options.php {html_image}\n *      (Smarty online manual)\n * @author Monte Ohrt <monte at ohrt dot com> \n * @author Ralf Strehle (minor optimization) <ralf dot strehle at yahoo dot de>\n * @param array                    $params   parameters\n * @param Smarty_Internal_Template $template template object\n * @return string \n * @uses smarty_function_escape_special_chars()\n */\nfunction smarty_function_html_options($params, $template)\n{\n    require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');\n\n    $name = null;\n    $values = null;\n    $options = null;\n    $selected = null;\n    $output = null;\n    $id = null;\n    $class = null;\n\n    $extra = '';\n\n    foreach ($params as $_key => $_val) {\n        switch ($_key) {\n            case 'name':\n            case 'class':\n            case 'id':\n                $$_key = (string) $_val;\n                break;\n\n            case 'options':\n                $options = (array) $_val;\n                break;\n\n            case 'values':\n            case 'output':\n                $$_key = array_values((array) $_val);\n                break;\n\n            case 'selected':\n                if (is_array($_val)) {\n                    $selected = array();\n                    foreach ($_val as $_sel) {\n                        if (is_object($_sel)) {\n                            if (method_exists($_sel, \"__toString\")) {\n                                $_sel = smarty_function_escape_special_chars((string) $_sel->__toString());\n                            } else {\n                                trigger_error(\"html_options: selected attribute contains an object of class '\". get_class($_sel) .\"' without __toString() method\", E_USER_NOTICE);\n                                continue;\n                            }\n                        } else {\n                            $_sel = smarty_function_escape_special_chars((string) $_sel);\n                        }\n                        $selected[$_sel] = true;\n                    }\n                } elseif (is_object($_val)) {\n                    if (method_exists($_val, \"__toString\")) {\n                        $selected = smarty_function_escape_special_chars((string) $_val->__toString());\n                    } else {\n                        trigger_error(\"html_options: selected attribute is an object of class '\". get_class($_val) .\"' without __toString() method\", E_USER_NOTICE);\n                    }\n                } else {\n                    $selected = smarty_function_escape_special_chars((string) $_val);\n                }\n                break;\n\n            default:\n                if (!is_array($_val)) {\n                    $extra .= ' ' . $_key . '=\"' . smarty_function_escape_special_chars($_val) . '\"';\n                } else {\n                    trigger_error(\"html_options: extra attribute '$_key' cannot be an array\", E_USER_NOTICE);\n                } \n                break;\n        } \n    }\n\n    if (!isset($options) && !isset($values)) {\n        /* raise error here? */\n        return '';\n    }\n\n    $_html_result = '';\n    $_idx = 0;\n\n    if (isset($options)) {\n        foreach ($options as $_key => $_val) {\n            $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected, $id, $class, $_idx);\n        }\n    } else {\n        foreach ($values as $_i => $_key) {\n            $_val = isset($output[$_i]) ? $output[$_i] : '';\n            $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected, $id, $class, $_idx);\n        } \n    }\n\n    if (!empty($name)) {\n        $_html_class = !empty($class) ? ' class=\"'.$class.'\"' : '';\n        $_html_id = !empty($id) ? ' id=\"'.$id.'\"' : '';\n        $_html_result = '<select name=\"' . $name . '\"' . $_html_class . $_html_id . $extra . '>' . \"\\n\" . $_html_result . '</select>' . \"\\n\";\n    } \n\n    return $_html_result;\n}\n\nfunction smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, &$idx)\n{\n    if (!is_array($value)) {\n        $_key = smarty_function_escape_special_chars($key);\n        $_html_result = '<option value=\"' . $_key . '\"';\n        if (is_array($selected)) {\n            if (isset($selected[$_key])) {\n                $_html_result .= ' selected=\"selected\"';\n            }\n        } elseif ($_key === $selected) {\n            $_html_result .= ' selected=\"selected\"';\n        }\n        $_html_class = !empty($class) ? ' class=\"'.$class.' option\"' : '';\n        $_html_id = !empty($id) ? ' id=\"'.$id.'-'.$idx.'\"' : '';\n        if (is_object($value)) {\n            if (method_exists($value, \"__toString\")) {\n                $value = smarty_function_escape_special_chars((string) $value->__toString());\n            } else {\n                trigger_error(\"html_options: value is an object of class '\". get_class($value) .\"' without __toString() method\", E_USER_NOTICE);\n                return '';\n            }\n        }\n        $_html_result .= $_html_class . $_html_id . '>' . $value . '</option>' . \"\\n\";\n        $idx++;\n    } else {\n        $_idx = 0;\n        $_html_result = smarty_function_html_options_optgroup($key, $value, $selected, !empty($id) ? ($id.'-'.$idx) : null, $class, $_idx);\n        $idx++;\n    }\n    return $_html_result;\n} \n\nfunction smarty_function_html_options_optgroup($key, $values, $selected, $id, $class, &$idx)\n{\n    $optgroup_html = '<optgroup label=\"' . smarty_function_escape_special_chars($key) . '\">' . \"\\n\";\n    foreach ($values as $key => $value) {\n        $optgroup_html .= smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, $idx);\n    } \n    $optgroup_html .= \"</optgroup>\\n\";\n    return $optgroup_html;\n} \n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/function.html_radios.php",
    "content": "<?php\n/**\n * Smarty plugin\n * \n * @package Smarty\n * @subpackage PluginsFunction\n */\n\n/**\n * Smarty {html_radios} function plugin\n * \n * File:       function.html_radios.php<br>\n * Type:       function<br>\n * Name:       html_radios<br>\n * Date:       24.Feb.2003<br>\n * Purpose:    Prints out a list of radio input types<br>\n * Params:\n * <pre>\n * - name       (optional) - string default \"radio\"\n * - values     (required) - array\n * - options    (required) - associative array\n * - checked    (optional) - array default not set\n * - separator  (optional) - ie <br> or &nbsp;\n * - output     (optional) - the output next to each radio button\n * - assign     (optional) - assign the output as an array to this variable\n * - escape     (optional) - escape the content (not value), defaults to true\n * </pre>\n * Examples:\n * <pre>\n * {html_radios values=$ids output=$names}\n * {html_radios values=$ids name='box' separator='<br>' output=$names}\n * {html_radios values=$ids checked=$checked separator='<br>' output=$names}\n * </pre>\n * \n * @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios}\n *      (Smarty online manual)\n * @author Christopher Kvarme <christopher.kvarme@flashjab.com> \n * @author credits to Monte Ohrt <monte at ohrt dot com> \n * @version 1.0\n * @param array                    $params   parameters\n * @param Smarty_Internal_Template $template template object\n * @return string \n * @uses smarty_function_escape_special_chars()\n */\nfunction smarty_function_html_radios($params, $template)\n{\n    require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');\n\n    $name = 'radio';\n    $values = null;\n    $options = null;\n    $selected = null;\n    $separator = '';\n    $escape = true;\n    $labels = true;\n    $label_ids = false;\n    $output = null;\n    $extra = '';\n\n    foreach($params as $_key => $_val) {\n        switch ($_key) {\n            case 'name':\n            case 'separator':\n                $$_key = (string) $_val;\n                break;\n\n            case 'checked':\n            case 'selected':\n                if (is_array($_val)) {\n                    trigger_error('html_radios: the \"' . $_key . '\" attribute cannot be an array', E_USER_WARNING);\n                } elseif (is_object($_val)) {\n                    if (method_exists($_val, \"__toString\")) {\n                        $selected = smarty_function_escape_special_chars((string) $_val->__toString());\n                    } else {\n                        trigger_error(\"html_radios: selected attribute is an object of class '\". get_class($_val) .\"' without __toString() method\", E_USER_NOTICE);\n                    }\n                } else {\n                    $selected = (string) $_val;\n                } \n                break;\n\n            case 'escape':\n            case 'labels':\n            case 'label_ids':\n                $$_key = (bool) $_val;\n                break;\n\n            case 'options':\n                $$_key = (array) $_val;\n                break;\n\n            case 'values':\n            case 'output':\n                $$_key = array_values((array) $_val);\n                break;\n\n            case 'radios':\n                trigger_error('html_radios: the use of the \"radios\" attribute is deprecated, use \"options\" instead', E_USER_WARNING);\n                $options = (array) $_val;\n                break;\n\n            case 'assign':\n                break;\n\n            default:\n                if (!is_array($_val)) {\n                    $extra .= ' ' . $_key . '=\"' . smarty_function_escape_special_chars($_val) . '\"';\n                } else {\n                    trigger_error(\"html_radios: extra attribute '$_key' cannot be an array\", E_USER_NOTICE);\n                } \n                break;\n        } \n    } \n\n    if (!isset($options) && !isset($values)) {\n        /* raise error here? */\n        return '';\n    }\n\n    $_html_result = array();\n\n    if (isset($options)) {\n        foreach ($options as $_key => $_val) {\n            $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape);\n        }\n    } else {\n        foreach ($values as $_i => $_key) {\n            $_val = isset($output[$_i]) ? $output[$_i] : '';\n            $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape);\n        } \n    } \n\n    if (!empty($params['assign'])) {\n        $template->assign($params['assign'], $_html_result);\n    } else {\n        return implode(\"\\n\", $_html_result);\n    } \n} \n\nfunction smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape)\n{\n    $_output = '';\n    \n    if (is_object($value)) {\n        if (method_exists($value, \"__toString\")) {\n            $value = (string) $value->__toString();\n        } else {\n            trigger_error(\"html_options: value is an object of class '\". get_class($value) .\"' without __toString() method\", E_USER_NOTICE);\n            return '';\n        }\n    } else {\n        $value = (string) $value;\n    }\n    \n    if (is_object($output)) {\n        if (method_exists($output, \"__toString\")) {\n            $output = (string) $output->__toString();\n        } else {\n            trigger_error(\"html_options: output is an object of class '\". get_class($output) .\"' without __toString() method\", E_USER_NOTICE);\n            return '';\n        }\n    } else {\n        $output = (string) $output;\n    }\n    \n    if ($labels) {\n        if ($label_ids) {\n            $_id = smarty_function_escape_special_chars(preg_replace('![^\\w\\-\\.]!u', '_', $name . '_' . $value));\n            $_output .= '<label for=\"' . $_id . '\">';\n        } else {\n            $_output .= '<label>';\n        } \n    }\n    \n    $name = smarty_function_escape_special_chars($name);\n    $value = smarty_function_escape_special_chars($value);\n    if ($escape) {\n        $output = smarty_function_escape_special_chars($output);\n    }\n    \n    $_output .= '<input type=\"radio\" name=\"' . $name . '\" value=\"' . $value . '\"';\n\n    if ($labels && $label_ids) {\n        $_output .= ' id=\"' . $_id . '\"';\n    }\n\n    if ($value === $selected) {\n        $_output .= ' checked=\"checked\"';\n    }\n    \n    $_output .= $extra . ' />' . $output;\n    if ($labels) {\n        $_output .= '</label>';\n    }\n    \n    $_output .= $separator;\n    return $_output;\n} \n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/function.html_select_date.php",
    "content": "<?php\n/**\n * Smarty plugin\n * \n * @package Smarty\n * @subpackage PluginsFunction\n */\n\n/**\n * @ignore\n */\nrequire_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');\n/**\n * @ignore\n */\nrequire_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');\n\n/**\n * Smarty {html_select_date} plugin\n * \n * Type:     function<br>\n * Name:     html_select_date<br>\n * Purpose:  Prints the dropdowns for date selection.\n * \n * ChangeLog:\n * <pre>\n *            - 1.0 initial release\n *            - 1.1 added support for +/- N syntax for begin\n *              and end year values. (Monte)\n *            - 1.2 added support for yyyy-mm-dd syntax for\n *              time value. (Jan Rosier)\n *            - 1.3 added support for choosing format for\n *              month values (Gary Loescher)\n *            - 1.3.1 added support for choosing format for\n *              day values (Marcus Bointon)\n *            - 1.3.2 support negative timestamps, force year\n *              dropdown to include given date unless explicitly set (Monte)\n *            - 1.3.4 fix behaviour of 0000-00-00 00:00:00 dates to match that\n *              of 0000-00-00 dates (cybot, boots)\n *            - 2.0 complete rewrite for performance,  \n *              added attributes month_names, *_id\n * </pre>\n * \n * @link http://www.smarty.net/manual/en/language.function.html.select.date.php {html_select_date}\n *      (Smarty online manual)\n * @version 2.0\n * @author Andrei Zmievski \n * @author Monte Ohrt <monte at ohrt dot com> \n * @author Rodney Rehm\n * @param array                    $params   parameters\n * @param Smarty_Internal_Template $template template object\n * @return string \n */\nfunction smarty_function_html_select_date($params, $template)\n{\n    // generate timestamps used for month names only\n    static $_month_timestamps = null;\n    static $_current_year = null;\n    if ($_month_timestamps === null) {\n        $_current_year = date('Y');\n        $_month_timestamps = array();\n        for ($i = 1; $i <= 12; $i++) {\n            $_month_timestamps[$i] = mktime(0, 0, 0, $i, 1, 2000);\n        }\n    }\n\n    /* Default values. */\n    $prefix = \"Date_\";\n    $start_year = null;\n    $end_year = null;\n    $display_days = true;\n    $display_months = true;\n    $display_years = true;\n    $month_format = \"%B\";\n    /* Write months as numbers by default  GL */\n    $month_value_format = \"%m\";\n    $day_format = \"%02d\";\n    /* Write day values using this format MB */\n    $day_value_format = \"%d\";\n    $year_as_text = false;\n    /* Display years in reverse order? Ie. 2000,1999,.... */\n    $reverse_years = false;\n    /* Should the select boxes be part of an array when returned from PHP?\n       e.g. setting it to \"birthday\", would create \"birthday[Day]\",\n       \"birthday[Month]\" & \"birthday[Year]\". Can be combined with prefix */\n    $field_array = null;\n    /* <select size>'s of the different <select> tags.\n       If not set, uses default dropdown. */\n    $day_size = null;\n    $month_size = null;\n    $year_size = null;\n    /* Unparsed attributes common to *ALL* the <select>/<input> tags.\n       An example might be in the template: all_extra ='class =\"foo\"'. */\n    $all_extra = null;\n    /* Separate attributes for the tags. */\n    $day_extra = null;\n    $month_extra = null;\n    $year_extra = null;\n    /* Order in which to display the fields.\n       \"D\" -> day, \"M\" -> month, \"Y\" -> year. */\n    $field_order = 'MDY';\n    /* String printed between the different fields. */\n    $field_separator = \"\\n\";\n    $option_separator = \"\\n\";\n    $time = null;\n    // $all_empty = null;\n    // $day_empty = null;\n    // $month_empty = null;\n    // $year_empty = null;\n    $extra_attrs = '';\n    $all_id = null;\n    $day_id = null;\n    $month_id = null;\n    $year_id = null;\n\n    foreach ($params as $_key => $_value) {\n        switch ($_key) {\n            case 'time':\n                if (!is_array($_value) && $_value !== null) {\n                    $time = smarty_make_timestamp($_value);\n                }\n                break;\n                \n            case 'month_names':\n                if (is_array($_value) && count($_value) == 12) {\n                    $$_key = $_value;\n                } else {\n                    trigger_error(\"html_select_date: month_names must be an array of 12 strings\", E_USER_NOTICE);\n                }\n                break;\n                \n            case 'prefix':\n            case 'field_array':\n            case 'start_year':\n            case 'end_year':\n            case 'day_format':\n            case 'day_value_format':\n            case 'month_format':\n            case 'month_value_format':\n            case 'day_size':\n            case 'month_size':\n            case 'year_size':\n            case 'all_extra':\n            case 'day_extra':\n            case 'month_extra':\n            case 'year_extra':\n            case 'field_order':\n            case 'field_separator':\n            case 'option_separator':\n            case 'all_empty':\n            case 'month_empty':\n            case 'day_empty':\n            case 'year_empty':\n            case 'all_id':\n            case 'month_id':\n            case 'day_id':\n            case 'year_id':\n                $$_key = (string)$_value;\n                break;\n\n            case 'display_days':\n            case 'display_months':\n            case 'display_years':\n            case 'year_as_text':\n            case 'reverse_years':\n                $$_key = (bool)$_value;\n                break;\n\n            default:\n                if (!is_array($_value)) {\n                    $extra_attrs .= ' ' . $_key . '=\"' . smarty_function_escape_special_chars($_value) . '\"';\n                } else {\n                    trigger_error(\"html_select_date: extra attribute '$_key' cannot be an array\", E_USER_NOTICE);\n                } \n                break;\n        } \n    }\n    \n    // Note: date() is faster than strftime()\n    // Note: explode(date()) is faster than date() date() date()\n    if (isset($params['time']) && is_array($params['time'])) {\n        if (isset($params['time'][$prefix . 'Year'])) {\n            // $_REQUEST[$field_array] given\n            foreach (array('Y' => 'Year',  'm' => 'Month', 'd' => 'Day') as $_elementKey => $_elementName) {\n                $_variableName = '_' . strtolower($_elementName);\n                $$_variableName = isset($params['time'][$prefix . $_elementName])\n                    ? $params['time'][$prefix . $_elementName]\n                    : date($_elementKey);\n            }\n            $time = mktime(0, 0, 0, $_month, $_day, $_year);\n        } elseif (isset($params['time'][$field_array][$prefix . 'Year'])) {\n            // $_REQUEST given\n            foreach (array('Y' => 'Year',  'm' => 'Month', 'd' => 'Day') as $_elementKey => $_elementName) {\n                $_variableName = '_' . strtolower($_elementName);\n                $$_variableName = isset($params['time'][$field_array][$prefix . $_elementName])\n                    ? $params['time'][$field_array][$prefix . $_elementName]\n                    : date($_elementKey);\n            }\n            $time = mktime(0, 0, 0, $_month, $_day, $_year);\n        } else {\n            // no date found, use NOW\n            list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d'));\n        }\n    } elseif ($time === null) {\n        if (array_key_exists('time', $params)) {\n            $_year = $_month = $_day = $time = null;\n        } else {\n            list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d'));\n        }\n    } else {\n        list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d', $time));\n    }\n\n    // make syntax \"+N\" or \"-N\" work with $start_year and $end_year\n    // Note preg_match('!^(\\+|\\-)\\s*(\\d+)$!', $end_year, $match) is slower than trim+substr\n    foreach (array('start', 'end') as $key) {\n        $key .= '_year';\n        $t = $$key;\n        if ($t === null) {\n            $$key = (int)$_current_year;\n        } else if ($t[0] == '+') {\n            $$key = (int)($_current_year + trim(substr($t, 1)));\n        } else if ($t[0] == '-') {\n            $$key = (int)($_current_year - trim(substr($t, 1)));\n        } else {\n            $$key = (int)$$key;\n        }\n    }\n\n    // flip for ascending or descending\n    if (($start_year > $end_year && !$reverse_years) || ($start_year < $end_year && $reverse_years)) {\n        $t = $end_year;\n        $end_year = $start_year;\n        $start_year = $t;\n    }\n\n    // generate year <select> or <input>\n    if ($display_years) {\n        $_html_years = '';\n        $_extra = '';\n        $_name = $field_array ? ($field_array . '[' . $prefix . 'Year]') : ($prefix . 'Year');\n        if ($all_extra) {\n            $_extra .= ' ' . $all_extra;\n        } \n        if ($year_extra) {\n            $_extra .= ' ' . $year_extra;\n        }\n        \n        if ($year_as_text) {\n            $_html_years = '<input type=\"text\" name=\"' . $_name . '\" value=\"' . $_year . '\" size=\"4\" maxlength=\"4\"' . $_extra . $extra_attrs . ' />';\n        } else {\n            $_html_years = '<select name=\"' . $_name . '\"';\n            if ($year_id !== null || $all_id !== null) {\n                $_html_years .= ' id=\"' . smarty_function_escape_special_chars( \n                    $year_id !== null ? ( $year_id ? $year_id : $_name ) : ( $all_id ? ($all_id . $_name) : $_name ) \n                ) . '\"';\n            }\n            if ($year_size) {\n                $_html_years .= ' size=\"' . $year_size . '\"';\n            } \n            $_html_years .= $_extra . $extra_attrs . '>' . $option_separator;\n            \n            if (isset($year_empty) || isset($all_empty)) {\n                $_html_years .= '<option value=\"\">' . ( isset($year_empty) ? $year_empty : $all_empty ) . '</option>' . $option_separator;\n            }\n            \n            $op = $start_year > $end_year ? -1 : 1;\n            for ($i=$start_year; $op > 0 ? $i <= $end_year : $i >= $end_year; $i += $op) {\n                $_html_years .= '<option value=\"' . $i . '\"'\n                    . ($_year == $i ? ' selected=\"selected\"' : '')\n                    . '>' . $i . '</option>' . $option_separator;\n            }\n            \n            $_html_years .= '</select>';\n        }\n    }\n    \n    // generate month <select> or <input>\n    if ($display_months) {\n        $_html_month = '';\n        $_extra = '';\n        $_name = $field_array ? ($field_array . '[' . $prefix . 'Month]') : ($prefix . 'Month');\n        if ($all_extra) {\n            $_extra .= ' ' . $all_extra;\n        } \n        if ($month_extra) {\n            $_extra .= ' ' . $month_extra;\n        }\n        \n        $_html_months = '<select name=\"' . $_name . '\"';\n        if ($month_id !== null || $all_id !== null) {\n            $_html_months .= ' id=\"' . smarty_function_escape_special_chars( \n                $month_id !== null ? ( $month_id ? $month_id : $_name ) : ( $all_id ? ($all_id . $_name) : $_name ) \n            ) . '\"';\n        }\n        if ($month_size) {\n            $_html_months .= ' size=\"' . $month_size . '\"';\n        } \n        $_html_months .= $_extra . $extra_attrs . '>' . $option_separator;\n        \n        if (isset($month_empty) || isset($all_empty)) {\n            $_html_months .= '<option value=\"\">' . ( isset($month_empty) ? $month_empty : $all_empty ) . '</option>' . $option_separator;\n        }\n        \n        for ($i = 1; $i <= 12; $i++) {\n            $_val = sprintf('%02d', $i);\n            $_text = isset($month_names) ? smarty_function_escape_special_chars($month_names[$i]) : ($month_format == \"%m\" ? $_val : strftime($month_format, $_month_timestamps[$i]));\n            $_value = $month_value_format == \"%m\" ? $_val : strftime($month_value_format, $_month_timestamps[$i]);\n            $_html_months .= '<option value=\"' . $_value . '\"'\n                . ($_val == $_month ? ' selected=\"selected\"' : '')\n                . '>' . $_text . '</option>' . $option_separator;\n        }\n        \n        $_html_months .= '</select>';\n    }\n    \n    // generate day <select> or <input>\n    if ($display_days) {\n        $_html_day = '';\n        $_extra = '';\n        $_name = $field_array ? ($field_array . '[' . $prefix . 'Day]') : ($prefix . 'Day');\n        if ($all_extra) {\n            $_extra .= ' ' . $all_extra;\n        } \n        if ($day_extra) {\n            $_extra .= ' ' . $day_extra;\n        }\n        \n        $_html_days = '<select name=\"' . $_name . '\"';\n        if ($day_id !== null || $all_id !== null) {\n            $_html_days .= ' id=\"' . smarty_function_escape_special_chars( \n                $day_id !== null ? ( $day_id ? $day_id : $_name ) : ( $all_id ? ($all_id . $_name) : $_name ) \n            ) . '\"';\n        }\n        if ($day_size) {\n            $_html_days .= ' size=\"' . $day_size . '\"';\n        } \n        $_html_days .= $_extra . $extra_attrs . '>' . $option_separator;\n        \n        if (isset($day_empty) || isset($all_empty)) {\n            $_html_days .= '<option value=\"\">' . ( isset($day_empty) ? $day_empty : $all_empty ) . '</option>' . $option_separator;\n        }\n        \n        for ($i = 1; $i <= 31; $i++) {\n            $_val = sprintf('%02d', $i);\n            $_text = $day_format == '%02d' ? $_val : sprintf($day_format, $i);\n            $_value = $day_value_format ==  '%02d' ? $_val : sprintf($day_value_format, $i);\n            $_html_days .= '<option value=\"' . $_value . '\"'\n                . ($_val == $_day ? ' selected=\"selected\"' : '')\n                . '>' . $_text . '</option>' . $option_separator;\n        }\n        \n        $_html_days .= '</select>';\n    }\n\n    // order the fields for output\n    $_html = '';\n    for ($i=0; $i <= 2; $i++) {\n        switch ($field_order[$i]) {\n            case 'Y':\n            case 'y':\n                if (isset($_html_years)) {\n                    if ($_html) {\n                        $_html .= $field_separator;\n                    }\n                    $_html .= $_html_years;\n                }\n            break;\n            \n            case 'm':\n            case 'M':\n                if (isset($_html_months)) {\n                    if ($_html) {\n                        $_html .= $field_separator;\n                    }\n                    $_html .= $_html_months;\n                }\n            break;\n            \n            case 'd':\n            case 'D':\n                if (isset($_html_days)) {\n                    if ($_html) {\n                        $_html .= $field_separator;\n                    }\n                    $_html .= $_html_days;\n                }\n            break;\n        }\n    }\n    return $_html;\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/function.html_select_time.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsFunction\n */\n\n/**\n * @ignore\n */\nrequire_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');\n/**\n * @ignore\n */\nrequire_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');\n\n/**\n * Smarty {html_select_time} function plugin\n *\n * Type:     function<br>\n * Name:     html_select_time<br>\n * Purpose:  Prints the dropdowns for time selection\n *\n * @link http://www.smarty.net/manual/en/language.function.html.select.time.php {html_select_time}\n *          (Smarty online manual)\n * @author Roberto Berto <roberto@berto.net>\n * @author Monte Ohrt <monte AT ohrt DOT com>\n * @param array                    $params   parameters\n * @param Smarty_Internal_Template $template template object\n * @return string\n * @uses smarty_make_timestamp()\n */\nfunction smarty_function_html_select_time($params, $template)\n{\n    $prefix = \"Time_\";\n    $field_array = null;\n    $field_separator = \"\\n\";\n    $option_separator = \"\\n\";\n    $time = null;\n\n    $display_hours = true;\n    $display_minutes = true;\n    $display_seconds = true;\n    $display_meridian = true;\n\n    $hour_format = '%02d';\n    $hour_value_format = '%02d';\n    $minute_format = '%02d';\n    $minute_value_format = '%02d';\n    $second_format = '%02d';\n    $second_value_format = '%02d';\n\n    $hour_size = null;\n    $minute_size = null;\n    $second_size = null;\n    $meridian_size = null;\n\n    $all_empty = null;\n    $hour_empty = null;\n    $minute_empty = null;\n    $second_empty = null;\n    $meridian_empty = null;\n\n    $all_id = null;\n    $hour_id = null;\n    $minute_id = null;\n    $second_id = null;\n    $meridian_id = null;\n\n    $use_24_hours = true;\n    $minute_interval = 1;\n    $second_interval = 1;\n\n    $extra_attrs = '';\n    $all_extra = null;\n    $hour_extra = null;\n    $minute_extra = null;\n    $second_extra = null;\n    $meridian_extra = null;\n\n    foreach ($params as $_key => $_value) {\n        switch ($_key) {\n            case 'time':\n                if (!is_array($_value) && $_value !== null) {\n                    $time = smarty_make_timestamp($_value);\n                }\n                break;\n\n            case 'prefix':\n            case 'field_array':\n\n            case 'field_separator':\n            case 'option_separator':\n\n            case 'all_extra':\n            case 'hour_extra':\n            case 'minute_extra':\n            case 'second_extra':\n            case 'meridian_extra':\n\n            case 'all_empty':\n            case 'hour_empty':\n            case 'minute_empty':\n            case 'second_empty':\n            case 'meridian_empty':\n\n            case 'all_id':\n            case 'hour_id':\n            case 'minute_id':\n            case 'second_id':\n            case 'meridian_id':\n\n            case 'hour_format':\n            case 'hour_value_format':\n            case 'minute_format':\n            case 'minute_value_format':\n            case 'second_format':\n            case 'second_value_format':\n                $$_key = (string)$_value;\n                break;\n\n            case 'display_hours':\n            case 'display_minutes':\n            case 'display_seconds':\n            case 'display_meridian':\n            case 'use_24_hours':\n                $$_key = (bool)$_value;\n                break;\n\n            case 'minute_interval':\n            case 'second_interval':\n\n            case 'hour_size':\n            case 'minute_size':\n            case 'second_size':\n            case 'meridian_size':\n                $$_key = (int)$_value;\n                break;\n\n            default:\n                if (!is_array($_value)) {\n                    $extra_attrs .= ' ' . $_key . '=\"' . smarty_function_escape_special_chars($_value) . '\"';\n                } else {\n                    trigger_error(\"html_select_date: extra attribute '$_key' cannot be an array\", E_USER_NOTICE);\n                }\n                break;\n        }\n    }\n\n    if (isset($params['time']) && is_array($params['time'])) {\n        if (isset($params['time'][$prefix . 'Hour'])) {\n            // $_REQUEST[$field_array] given\n            foreach (array('H' => 'Hour',  'i' => 'Minute', 's' => 'Second') as $_elementKey => $_elementName) {\n                $_variableName = '_' . strtolower($_elementName);\n                $$_variableName = isset($params['time'][$prefix . $_elementName])\n                    ? $params['time'][$prefix . $_elementName]\n                    : date($_elementKey);\n            }\n            $_meridian = isset($params['time'][$prefix . 'Meridian'])\n                ? (' ' . $params['time'][$prefix . 'Meridian'])\n                : '';\n            $time = strtotime( $_hour . ':' . $_minute . ':' . $_second . $_meridian );\n            list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));\n        } elseif (isset($params['time'][$field_array][$prefix . 'Hour'])) {\n            // $_REQUEST given\n            foreach (array('H' => 'Hour',  'i' => 'Minute', 's' => 'Second') as $_elementKey => $_elementName) {\n                $_variableName = '_' . strtolower($_elementName);\n                $$_variableName = isset($params['time'][$field_array][$prefix . $_elementName])\n                    ? $params['time'][$field_array][$prefix . $_elementName]\n                    : date($_elementKey);\n            }\n            $_meridian = isset($params['time'][$field_array][$prefix . 'Meridian'])\n                ? (' ' . $params['time'][$field_array][$prefix . 'Meridian'])\n                : '';\n            $time = strtotime( $_hour . ':' . $_minute . ':' . $_second . $_meridian );\n            list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));\n        } else {\n            // no date found, use NOW\n            list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d'));\n        }\n    } elseif ($time === null) {\n        if (array_key_exists('time', $params)) {\n            $_hour = $_minute = $_second = $time = null;\n        } else {\n            list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s'));\n        }\n    } else {\n        list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));\n    }\n\n    // generate hour <select>\n    if ($display_hours) {\n        $_html_hours = '';\n        $_extra = '';\n        $_name = $field_array ? ($field_array . '[' . $prefix . 'Hour]') : ($prefix . 'Hour');\n        if ($all_extra) {\n            $_extra .= ' ' . $all_extra;\n        }\n        if ($hour_extra) {\n            $_extra .= ' ' . $hour_extra;\n        }\n\n        $_html_hours = '<select name=\"' . $_name . '\"';\n        if ($hour_id !== null || $all_id !== null) {\n            $_html_hours .= ' id=\"' . smarty_function_escape_special_chars(\n                $hour_id !== null ? ( $hour_id ? $hour_id : $_name ) : ( $all_id ? ($all_id . $_name) : $_name )\n            ) . '\"';\n        }\n        if ($hour_size) {\n            $_html_hours .= ' size=\"' . $hour_size . '\"';\n        }\n        $_html_hours .= $_extra . $extra_attrs . '>' . $option_separator;\n\n        if (isset($hour_empty) || isset($all_empty)) {\n            $_html_hours .= '<option value=\"\">' . ( isset($hour_empty) ? $hour_empty : $all_empty ) . '</option>' . $option_separator;\n        }\n\n        $start = $use_24_hours ? 0 : 1;\n        $end = $use_24_hours ? 23 : 12;\n        for ($i=$start; $i <= $end; $i++) {\n            $_val = sprintf('%02d', $i);\n            $_text = $hour_format == '%02d' ? $_val : sprintf($hour_format, $i);\n            $_value = $hour_value_format == '%02d' ? $_val : sprintf($hour_value_format, $i);\n\n            if (!$use_24_hours) {\n                $_hour12 = $_hour == 0\n                    ? 12\n                    : ($_hour <= 12 ? $_hour : $_hour -12);\n            }\n\n            $selected = $_hour !== null ? ($use_24_hours ? $_hour == $_val : $_hour12 == $_val) : null;\n            $_html_hours .= '<option value=\"' . $_value . '\"'\n                . ($selected ? ' selected=\"selected\"' : '')\n                . '>' . $_text . '</option>' . $option_separator;\n        }\n\n        $_html_hours .= '</select>';\n    }\n\n    // generate minute <select>\n    if ($display_minutes) {\n        $_html_minutes = '';\n        $_extra = '';\n        $_name = $field_array ? ($field_array . '[' . $prefix . 'Minute]') : ($prefix . 'Minute');\n        if ($all_extra) {\n            $_extra .= ' ' . $all_extra;\n        }\n        if ($minute_extra) {\n            $_extra .= ' ' . $minute_extra;\n        }\n\n        $_html_minutes = '<select name=\"' . $_name . '\"';\n        if ($minute_id !== null || $all_id !== null) {\n            $_html_minutes .= ' id=\"' . smarty_function_escape_special_chars(\n                $minute_id !== null ? ( $minute_id ? $minute_id : $_name ) : ( $all_id ? ($all_id . $_name) : $_name )\n            ) . '\"';\n        }\n        if ($minute_size) {\n            $_html_minutes .= ' size=\"' . $minute_size . '\"';\n        }\n        $_html_minutes .= $_extra . $extra_attrs . '>' . $option_separator;\n\n        if (isset($minute_empty) || isset($all_empty)) {\n            $_html_minutes .= '<option value=\"\">' . ( isset($minute_empty) ? $minute_empty : $all_empty ) . '</option>' . $option_separator;\n        }\n\n        $selected = $_minute !== null ? ($_minute - $_minute % $minute_interval) : null;\n        for ($i=0; $i <= 59; $i += $minute_interval) {\n            $_val = sprintf('%02d', $i);\n            $_text = $minute_format == '%02d' ? $_val : sprintf($minute_format, $i);\n            $_value = $minute_value_format == '%02d' ? $_val : sprintf($minute_value_format, $i);\n            $_html_minutes .= '<option value=\"' . $_value . '\"'\n                . ($selected === $i ? ' selected=\"selected\"' : '')\n                . '>' . $_text . '</option>' . $option_separator;\n        }\n\n        $_html_minutes .= '</select>';\n    }\n\n    // generate second <select>\n    if ($display_seconds) {\n        $_html_seconds = '';\n        $_extra = '';\n        $_name = $field_array ? ($field_array . '[' . $prefix . 'Second]') : ($prefix . 'Second');\n        if ($all_extra) {\n            $_extra .= ' ' . $all_extra;\n        }\n        if ($second_extra) {\n            $_extra .= ' ' . $second_extra;\n        }\n\n        $_html_seconds = '<select name=\"' . $_name . '\"';\n        if ($second_id !== null || $all_id !== null) {\n            $_html_seconds .= ' id=\"' . smarty_function_escape_special_chars(\n                $second_id !== null ? ( $second_id ? $second_id : $_name ) : ( $all_id ? ($all_id . $_name) : $_name )\n            ) . '\"';\n        }\n        if ($second_size) {\n            $_html_seconds .= ' size=\"' . $second_size . '\"';\n        }\n        $_html_seconds .= $_extra . $extra_attrs . '>' . $option_separator;\n\n        if (isset($second_empty) || isset($all_empty)) {\n            $_html_seconds .= '<option value=\"\">' . ( isset($second_empty) ? $second_empty : $all_empty ) . '</option>' . $option_separator;\n        }\n\n        $selected = $_second !== null ? ($_second - $_second % $second_interval) : null;\n        for ($i=0; $i <= 59; $i += $second_interval) {\n            $_val = sprintf('%02d', $i);\n            $_text = $second_format == '%02d' ? $_val : sprintf($second_format, $i);\n            $_value = $second_value_format == '%02d' ? $_val : sprintf($second_value_format, $i);\n            $_html_seconds .= '<option value=\"' . $_value . '\"'\n                . ($selected === $i ? ' selected=\"selected\"' : '')\n                . '>' . $_text . '</option>' . $option_separator;\n        }\n\n        $_html_seconds .= '</select>';\n    }\n\n    // generate meridian <select>\n    if ($display_meridian && !$use_24_hours) {\n        $_html_meridian = '';\n        $_extra = '';\n        $_name = $field_array ? ($field_array . '[' . $prefix . 'Meridian]') : ($prefix . 'Meridian');\n        if ($all_extra) {\n            $_extra .= ' ' . $all_extra;\n        }\n        if ($meridian_extra) {\n            $_extra .= ' ' . $meridian_extra;\n        }\n\n        $_html_meridian = '<select name=\"' . $_name . '\"';\n        if ($meridian_id !== null || $all_id !== null) {\n            $_html_meridian .= ' id=\"' . smarty_function_escape_special_chars(\n                $meridian_id !== null ? ( $meridian_id ? $meridian_id : $_name ) : ( $all_id ? ($all_id . $_name) : $_name )\n            ) . '\"';\n        }\n        if ($meridian_size) {\n            $_html_meridian .= ' size=\"' . $meridian_size . '\"';\n        }\n        $_html_meridian .= $_extra . $extra_attrs . '>' . $option_separator;\n\n        if (isset($meridian_empty) || isset($all_empty)) {\n            $_html_meridian .= '<option value=\"\">' . ( isset($meridian_empty) ? $meridian_empty : $all_empty ) . '</option>' . $option_separator;\n        }\n\n        $_html_meridian .= '<option value=\"am\"'. ($_hour < 12 ? ' selected=\"selected\"' : '') .'>AM</option>' . $option_separator\n            . '<option value=\"pm\"'. ($_hour < 12 ? '' : ' selected=\"selected\"') .'>PM</option>' . $option_separator\n            . '</select>';\n    }\n\n    $_html = '';\n    foreach (array('_html_hours', '_html_minutes', '_html_seconds', '_html_meridian') as $k) {\n        if (isset($$k)) {\n            if ($_html) {\n                $_html .= $field_separator;\n            }\n            $_html .= $$k;\n        }\n    }\n\n    return $_html;\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/function.html_table.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsFunction\n */\n\n/**\n * Smarty {html_table} function plugin\n *\n * Type:     function<br>\n * Name:     html_table<br>\n * Date:     Feb 17, 2003<br>\n * Purpose:  make an html table from an array of data<br>\n * Params:\n * <pre>\n * - loop       - array to loop through\n * - cols       - number of columns, comma separated list of column names\n *                or array of column names\n * - rows       - number of rows\n * - table_attr - table attributes\n * - th_attr    - table heading attributes (arrays are cycled)\n * - tr_attr    - table row attributes (arrays are cycled)\n * - td_attr    - table cell attributes (arrays are cycled)\n * - trailpad   - value to pad trailing cells with\n * - caption    - text for caption element\n * - vdir       - vertical direction (default: \"down\", means top-to-bottom)\n * - hdir       - horizontal direction (default: \"right\", means left-to-right)\n * - inner      - inner loop (default \"cols\": print $loop line by line,\n *                $loop will be printed column by column otherwise)\n * </pre>\n * Examples:\n * <pre>\n * {table loop=$data}\n * {table loop=$data cols=4 tr_attr='\"bgcolor=red\"'}\n * {table loop=$data cols=\"first,second,third\" tr_attr=$colors}\n * </pre>\n *\n * @author Monte Ohrt <monte at ohrt dot com>\n * @author credit to Messju Mohr <messju at lammfellpuschen dot de>\n * @author credit to boots <boots dot smarty at yahoo dot com>\n * @version 1.1\n * @link http://www.smarty.net/manual/en/language.function.html.table.php {html_table}\n *          (Smarty online manual)\n * @param array                    $params   parameters\n * @param Smarty_Internal_Template $template template object\n * @return string\n */\nfunction smarty_function_html_table($params, $template)\n{\n    $table_attr = 'border=\"1\"';\n    $tr_attr = '';\n    $th_attr = '';\n    $td_attr = '';\n    $cols = $cols_count = 3;\n    $rows = 3;\n    $trailpad = '&nbsp;';\n    $vdir = 'down';\n    $hdir = 'right';\n    $inner = 'cols';\n    $caption = '';\n    $loop = null;\n\n    if (!isset($params['loop'])) {\n        trigger_error(\"html_table: missing 'loop' parameter\",E_USER_WARNING);\n        return;\n    }\n\n    foreach ($params as $_key => $_value) {\n        switch ($_key) {\n            case 'loop':\n                $$_key = (array)$_value;\n                break;\n\n            case 'cols':\n                if (is_array($_value) && !empty($_value)) {\n                    $cols = $_value;\n                    $cols_count = count($_value);\n                } elseif (!is_numeric($_value) && is_string($_value) && !empty($_value)) {\n                    $cols = explode(',', $_value);\n                    $cols_count = count($cols);\n                } elseif (!empty($_value)) {\n                    $cols_count = (int)$_value;\n                } else {\n                    $cols_count = $cols;\n                }\n                break;\n\n            case 'rows':\n                $$_key = (int)$_value;\n                break;\n\n            case 'table_attr':\n            case 'trailpad':\n            case 'hdir':\n            case 'vdir':\n            case 'inner':\n            case 'caption':\n                $$_key = (string)$_value;\n                break;\n\n            case 'tr_attr':\n            case 'td_attr':\n            case 'th_attr':\n                $$_key = $_value;\n                break;\n        }\n    }\n\n    $loop_count = count($loop);\n    if (empty($params['rows'])) {\n        /* no rows specified */\n        $rows = ceil($loop_count / $cols_count);\n    } elseif (empty($params['cols'])) {\n        if (!empty($params['rows'])) {\n            /* no cols specified, but rows */\n            $cols_count = ceil($loop_count / $rows);\n        }\n    }\n\n    $output = \"<table $table_attr>\\n\";\n\n    if (!empty($caption)) {\n        $output .= '<caption>' . $caption . \"</caption>\\n\";\n    }\n\n    if (is_array($cols)) {\n        $cols = ($hdir == 'right') ? $cols : array_reverse($cols);\n        $output .= \"<thead><tr>\\n\";\n\n        for ($r = 0; $r < $cols_count; $r++) {\n            $output .= '<th' . smarty_function_html_table_cycle('th', $th_attr, $r) . '>';\n            $output .= $cols[$r];\n            $output .= \"</th>\\n\";\n        }\n        $output .= \"</tr></thead>\\n\";\n    }\n\n    $output .= \"<tbody>\\n\";\n    for ($r = 0; $r < $rows; $r++) {\n        $output .= \"<tr\" . smarty_function_html_table_cycle('tr', $tr_attr, $r) . \">\\n\";\n        $rx = ($vdir == 'down') ? $r * $cols_count : ($rows-1 - $r) * $cols_count;\n\n        for ($c = 0; $c < $cols_count; $c++) {\n            $x = ($hdir == 'right') ? $rx + $c : $rx + $cols_count-1 - $c;\n            if ($inner != 'cols') {\n                /* shuffle x to loop over rows*/\n                $x = floor($x / $cols_count) + ($x % $cols_count) * $rows;\n            }\n\n            if ($x < $loop_count) {\n                $output .= \"<td\" . smarty_function_html_table_cycle('td', $td_attr, $c) . \">\" . $loop[$x] . \"</td>\\n\";\n            } else {\n                $output .= \"<td\" . smarty_function_html_table_cycle('td', $td_attr, $c) . \">$trailpad</td>\\n\";\n            }\n        }\n        $output .= \"</tr>\\n\";\n    }\n    $output .= \"</tbody>\\n\";\n    $output .= \"</table>\\n\";\n\n    return $output;\n}\n\nfunction smarty_function_html_table_cycle($name, $var, $no)\n{\n    if (!is_array($var)) {\n        $ret = $var;\n    } else {\n        $ret = $var[$no % count($var)];\n    }\n\n    return ($ret) ? ' ' . $ret : '';\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/function.mailto.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsFunction\n */\n\n/**\n * Smarty {mailto} function plugin\n *\n * Type:     function<br>\n * Name:     mailto<br>\n * Date:     May 21, 2002\n * Purpose:  automate mailto address link creation, and optionally encode them.<br>\n * Params:\n * <pre>\n * - address    - (required) - e-mail address\n * - text       - (optional) - text to display, default is address\n * - encode     - (optional) - can be one of:\n *                             * none : no encoding (default)\n *                             * javascript : encode with javascript\n *                             * javascript_charcode : encode with javascript charcode\n *                             * hex : encode with hexidecimal (no javascript)\n * - cc         - (optional) - address(es) to carbon copy\n * - bcc        - (optional) - address(es) to blind carbon copy\n * - subject    - (optional) - e-mail subject\n * - newsgroups - (optional) - newsgroup(s) to post to\n * - followupto - (optional) - address(es) to follow up to\n * - extra      - (optional) - extra tags for the href link\n * </pre>\n * Examples:\n * <pre>\n * {mailto address=\"me@domain.com\"}\n * {mailto address=\"me@domain.com\" encode=\"javascript\"}\n * {mailto address=\"me@domain.com\" encode=\"hex\"}\n * {mailto address=\"me@domain.com\" subject=\"Hello to you!\"}\n * {mailto address=\"me@domain.com\" cc=\"you@domain.com,they@domain.com\"}\n * {mailto address=\"me@domain.com\" extra='class=\"mailto\"'}\n * </pre>\n *\n * @link http://www.smarty.net/manual/en/language.function.mailto.php {mailto}\n *          (Smarty online manual)\n * @version 1.2\n * @author Monte Ohrt <monte at ohrt dot com>\n * @author credits to Jason Sweat (added cc, bcc and subject functionality)\n * @param array                    $params   parameters\n * @param Smarty_Internal_Template $template template object\n * @return string\n */\nfunction smarty_function_mailto($params, $template)\n{\n    static $_allowed_encoding = array('javascript' => true, 'javascript_charcode' => true, 'hex' => true, 'none' => true);\n    $extra = '';\n\n    if (empty($params['address'])) {\n        trigger_error(\"mailto: missing 'address' parameter\",E_USER_WARNING);\n        return;\n    } else {\n        $address = $params['address'];\n    }\n\n    $text = $address;\n    // netscape and mozilla do not decode %40 (@) in BCC field (bug?)\n    // so, don't encode it.\n    $search = array('%40', '%2C');\n    $replace = array('@', ',');\n    $mail_parms = array();\n    foreach ($params as $var => $value) {\n        switch ($var) {\n            case 'cc':\n            case 'bcc':\n            case 'followupto':\n                if (!empty($value))\n                    $mail_parms[] = $var . '=' . str_replace($search, $replace, rawurlencode($value));\n                break;\n\n            case 'subject':\n            case 'newsgroups':\n                $mail_parms[] = $var . '=' . rawurlencode($value);\n                break;\n\n            case 'extra':\n            case 'text':\n                $$var = $value;\n\n            default:\n        }\n    }\n\n    if ($mail_parms) {\n        $address .= '?' . join('&', $mail_parms);\n    }\n    \n    $encode = (empty($params['encode'])) ? 'none' : $params['encode'];\n    if (!isset($_allowed_encoding[$encode])) {\n        trigger_error(\"mailto: 'encode' parameter must be none, javascript, javascript_charcode or hex\", E_USER_WARNING);\n        return;\n    }\n    // FIXME: (rodneyrehm) document.write() excues me what? 1998 has passed!\n    if ($encode == 'javascript') {\n        $string = 'document.write(\\'<a href=\"mailto:' . $address . '\" ' . $extra . '>' . $text . '</a>\\');';\n\n        $js_encode = '';\n        for ($x = 0, $_length = strlen($string); $x < $_length; $x++) {\n            $js_encode .= '%' . bin2hex($string[$x]);\n        }\n\n        return '<script type=\"text/javascript\">eval(unescape(\\'' . $js_encode . '\\'))</script>';\n    } elseif ($encode == 'javascript_charcode') {\n        $string = '<a href=\"mailto:' . $address . '\" ' . $extra . '>' . $text . '</a>';\n\n        for($x = 0, $y = strlen($string); $x < $y; $x++) {\n            $ord[] = ord($string[$x]);\n        }\n\n        $_ret = \"<script type=\\\"text/javascript\\\" language=\\\"javascript\\\">\\n\"\n            . \"{document.write(String.fromCharCode(\"\n            . implode(',', $ord)\n            . \"))\"\n            . \"}\\n\"\n            . \"</script>\\n\";\n\n        return $_ret;\n    } elseif ($encode == 'hex') {\n        preg_match('!^(.*)(\\?.*)$!', $address, $match);\n        if (!empty($match[2])) {\n            trigger_error(\"mailto: hex encoding does not work with extra attributes. Try javascript.\",E_USER_WARNING);\n            return;\n        }\n        $address_encode = '';\n        for ($x = 0, $_length = strlen($address); $x < $_length; $x++) {\n            if (preg_match('!\\w!u', $address[$x])) {\n                $address_encode .= '%' . bin2hex($address[$x]);\n            } else {\n                $address_encode .= $address[$x];\n            }\n        }\n        $text_encode = '';\n        for ($x = 0, $_length = strlen($text); $x < $_length; $x++) {\n            $text_encode .= '&#x' . bin2hex($text[$x]) . ';';\n        }\n\n        $mailto = \"&#109;&#97;&#105;&#108;&#116;&#111;&#58;\";\n        return '<a href=\"' . $mailto . $address_encode . '\" ' . $extra . '>' . $text_encode . '</a>';\n    } else {\n        // no encoding\n        return '<a href=\"mailto:' . $address . '\" ' . $extra . '>' . $text . '</a>';\n    }\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/function.math.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * This plugin is only for Smarty2 BC\n * @package Smarty\n * @subpackage PluginsFunction\n */\n\n/**\n * Smarty {math} function plugin\n *\n * Type:     function<br>\n * Name:     math<br>\n * Purpose:  handle math computations in template\n *\n * @link http://www.smarty.net/manual/en/language.function.math.php {math}\n *          (Smarty online manual)\n * @author   Monte Ohrt <monte at ohrt dot com>\n * @param array                    $params   parameters\n * @param Smarty_Internal_Template $template template object\n * @return string|null\n */\nfunction smarty_function_math($params, $template)\n{\n    static $_allowed_funcs = array(\n        'int' => true, 'abs' => true, 'ceil' => true, 'cos' => true, 'exp' => true, 'floor' => true,\n        'log' => true, 'log10' => true, 'max' => true, 'min' => true, 'pi' => true, 'pow' => true,\n        'rand' => true, 'round' => true, 'sin' => true, 'sqrt' => true, 'srand' => true ,'tan' => true\n    );\n    // be sure equation parameter is present\n    if (empty($params['equation'])) {\n        trigger_error(\"math: missing equation parameter\",E_USER_WARNING);\n        return;\n    }\n\n    $equation = $params['equation'];\n\n    // make sure parenthesis are balanced\n    if (substr_count($equation,\"(\") != substr_count($equation,\")\")) {\n        trigger_error(\"math: unbalanced parenthesis\",E_USER_WARNING);\n        return;\n    }\n\n    // match all vars in equation, make sure all are passed\n    preg_match_all(\"!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]*)!\",$equation, $match);\n\n    foreach($match[1] as $curr_var) {\n        if ($curr_var && !isset($params[$curr_var]) && !isset($_allowed_funcs[$curr_var])) {\n            trigger_error(\"math: function call $curr_var not allowed\",E_USER_WARNING);\n            return;\n        }\n    }\n\n    foreach($params as $key => $val) {\n        if ($key != \"equation\" && $key != \"format\" && $key != \"assign\") {\n            // make sure value is not empty\n            if (strlen($val)==0) {\n                trigger_error(\"math: parameter $key is empty\",E_USER_WARNING);\n                return;\n            }\n            if (!is_numeric($val)) {\n                trigger_error(\"math: parameter $key: is not numeric\",E_USER_WARNING);\n                return;\n            }\n            $equation = preg_replace(\"/\\b$key\\b/\", \" \\$params['$key'] \", $equation);\n        }\n    }\n    $smarty_math_result = null;\n    eval(\"\\$smarty_math_result = \".$equation.\";\");\n\n    if (empty($params['format'])) {\n        if (empty($params['assign'])) {\n            return $smarty_math_result;\n        } else {\n            $template->assign($params['assign'],$smarty_math_result);\n        }\n    } else {\n        if (empty($params['assign'])){\n            printf($params['format'],$smarty_math_result);\n        } else {\n            $template->assign($params['assign'],sprintf($params['format'],$smarty_math_result));\n        }\n    }\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifier.capitalize.php",
    "content": "<?php\n/**\n * Smarty plugin\n * \n * @package Smarty\n * @subpackage PluginsModifier\n */\n\n/**\n * Smarty capitalize modifier plugin\n * \n * Type:     modifier<br>\n * Name:     capitalize<br>\n * Purpose:  capitalize words in the string\n *\n * {@internal {$string|capitalize:true:true} is the fastest option for MBString enabled systems }}\n *\n * @param string  $string    string to capitalize\n * @param boolean $uc_digits also capitalize \"x123\" to \"X123\"\n * @param boolean $lc_rest   capitalize first letters, lowercase all following letters \"aAa\" to \"Aaa\"\n * @return string capitalized string\n * @author Monte Ohrt <monte at ohrt dot com> \n * @author Rodney Rehm\n */\nfunction smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = false)\n{\n    if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {\n        if ($lc_rest) {\n            // uppercase (including hyphenated words)\n            $upper_string = mb_convert_case( $string, MB_CASE_TITLE, SMARTY_RESOURCE_CHAR_SET );\n        } else {\n            // uppercase word breaks\n            $upper_string = preg_replace(\"!(^|[^\\p{L}'])([\\p{Ll}])!ueS\", \"stripslashes('\\\\1').mb_convert_case(stripslashes('\\\\2'),MB_CASE_UPPER, SMARTY_RESOURCE_CHAR_SET)\", $string);\n        }\n        // check uc_digits case\n        if (!$uc_digits) {\n            if (preg_match_all(\"!\\b([\\p{L}]*[\\p{N}]+[\\p{L}]*)\\b!u\", $string, $matches, PREG_OFFSET_CAPTURE)) {\n                foreach($matches[1] as $match) {\n                    $upper_string = substr_replace($upper_string, mb_strtolower($match[0], SMARTY_RESOURCE_CHAR_SET), $match[1], strlen($match[0]));\n                }\n            } \n        }\n        $upper_string = preg_replace(\"!((^|\\s)['\\\"])(\\w)!ue\", \"stripslashes('\\\\1').mb_convert_case(stripslashes('\\\\3'),MB_CASE_UPPER, SMARTY_RESOURCE_CHAR_SET)\", $upper_string);\n        return $upper_string;\n    }\n    \n    // lowercase first\n    if ($lc_rest) {\n        $string = strtolower($string);\n    }\n    // uppercase (including hyphenated words)\n    $upper_string = preg_replace(\"!(^|[^\\p{L}'])([\\p{Ll}])!ueS\", \"stripslashes('\\\\1').ucfirst(stripslashes('\\\\2'))\", $string); \n    // check uc_digits case\n    if (!$uc_digits) {\n        if (preg_match_all(\"!\\b([\\p{L}]*[\\p{N}]+[\\p{L}]*)\\b!u\", $string, $matches, PREG_OFFSET_CAPTURE)) {\n            foreach($matches[1] as $match) {\n                $upper_string = substr_replace($upper_string, strtolower($match[0]), $match[1], strlen($match[0]));\n            }\n        } \n    }\n    $upper_string = preg_replace(\"!((^|\\s)['\\\"])(\\w)!ue\", \"stripslashes('\\\\1').strtoupper(stripslashes('\\\\3'))\", $upper_string);\n    return $upper_string;\n} \n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifier.date_format.php",
    "content": "<?php\n/**\n * Smarty plugin\n * \n * @package Smarty\n * @subpackage PluginsModifier\n */\n\n/**\n * Smarty date_format modifier plugin\n * \n * Type:     modifier<br>\n * Name:     date_format<br>\n * Purpose:  format datestamps via strftime<br>\n * Input:<br>\n *          - string: input date string\n *          - format: strftime format for output\n *          - default_date: default date if $string is empty\n * \n * @link http://www.smarty.net/manual/en/language.modifier.date.format.php date_format (Smarty online manual)\n * @author Monte Ohrt <monte at ohrt dot com> \n * @param string $string       input date string\n * @param string $format       strftime format for output\n * @param string $default_date default date if $string is empty\n * @param string $formatter    either 'strftime' or 'auto'\n * @return string |void\n * @uses smarty_make_timestamp()\n */\nfunction smarty_modifier_date_format($string, $format = SMARTY_RESOURCE_DATE_FORMAT, $default_date = '',$formatter='auto')\n{\n    /**\n    * Include the {@link shared.make_timestamp.php} plugin\n    */\n    require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');\n    if ($string != '') {\n        $timestamp = smarty_make_timestamp($string);\n    } elseif ($default_date != '') {\n        $timestamp = smarty_make_timestamp($default_date);\n    } else {\n        return;\n    } \n    if($formatter=='strftime'||($formatter=='auto'&&strpos($format,'%')!==false)) {\n        if (DS == '\\\\') {\n            $_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T');\n            $_win_to = array('%m/%d/%y', '%b', \"\\n\", '%I:%M:%S %p', '%H:%M', \"\\t\", '%H:%M:%S');\n            if (strpos($format, '%e') !== false) {\n                $_win_from[] = '%e';\n                $_win_to[] = sprintf('%\\' 2d', date('j', $timestamp));\n            } \n            if (strpos($format, '%l') !== false) {\n                $_win_from[] = '%l';\n                $_win_to[] = sprintf('%\\' 2d', date('h', $timestamp));\n            } \n            $format = str_replace($_win_from, $_win_to, $format);\n        } \n        return strftime($format, $timestamp);\n    } else {\n        return date($format, $timestamp);\n    }\n} \n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifier.debug_print_var.php",
    "content": "<?php\n/**\n * Smarty plugin\n * \n * @package Smarty\n * @subpackage Debug\n */\n\n/**\n * Smarty debug_print_var modifier plugin\n * \n * Type:     modifier<br>\n * Name:     debug_print_var<br>\n * Purpose:  formats variable contents for display in the console\n *\n * @author Monte Ohrt <monte at ohrt dot com> \n * @param array|object $var     variable to be formatted\n * @param integer      $depth   maximum recursion depth if $var is an array\n * @param integer      $length  maximum string length if $var is a string\n * @return string \n */\nfunction smarty_modifier_debug_print_var ($var, $depth = 0, $length = 40)\n{\n    $_replace = array(\"\\n\" => '<i>\\n</i>',\n        \"\\r\" => '<i>\\r</i>',\n        \"\\t\" => '<i>\\t</i>'\n        );\n\n    switch (gettype($var)) {\n        case 'array' :\n            $results = '<b>Array (' . count($var) . ')</b>';\n            foreach ($var as $curr_key => $curr_val) {\n                $results .= '<br>' . str_repeat('&nbsp;', $depth * 2)\n                 . '<b>' . strtr($curr_key, $_replace) . '</b> =&gt; '\n                 . smarty_modifier_debug_print_var($curr_val, ++$depth, $length);\n                $depth--;\n            } \n            break;\n            \n        case 'object' :\n            $object_vars = get_object_vars($var);\n            $results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>';\n            foreach ($object_vars as $curr_key => $curr_val) {\n                $results .= '<br>' . str_repeat('&nbsp;', $depth * 2)\n                 . '<b> -&gt;' . strtr($curr_key, $_replace) . '</b> = '\n                 . smarty_modifier_debug_print_var($curr_val, ++$depth, $length);\n                $depth--;\n            } \n            break;\n            \n        case 'boolean' :\n        case 'NULL' :\n        case 'resource' :\n            if (true === $var) {\n                $results = 'true';\n            } elseif (false === $var) {\n                $results = 'false';\n            } elseif (null === $var) {\n                $results = 'null';\n            } else {\n                $results = htmlspecialchars((string) $var);\n            } \n            $results = '<i>' . $results . '</i>';\n            break;\n            \n        case 'integer' :\n        case 'float' :\n            $results = htmlspecialchars((string) $var);\n            break;\n            \n        case 'string' :\n            $results = strtr($var, $_replace);\n            if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {\n                if (mb_strlen($var, SMARTY_RESOURCE_CHAR_SET) > $length) {\n                    $results = mb_substr($var, 0, $length - 3, SMARTY_RESOURCE_CHAR_SET) . '...';\n                }\n            } else {\n                if (isset($var[$length])) {\n                    $results = substr($var, 0, $length - 3) . '...';\n                }\n            }\n\n            $results = htmlspecialchars('\"' . $results . '\"');\n            break;\n            \n        case 'unknown type' :\n        default :\n            $results = strtr((string) $var, $_replace);\n            if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {\n                if (mb_strlen($results, SMARTY_RESOURCE_CHAR_SET) > $length) {\n                    $results = mb_substr($results, 0, $length - 3, SMARTY_RESOURCE_CHAR_SET) . '...';\n                }\n            } else {\n                if (strlen($results) > $length) {\n                    $results = substr($results, 0, $length - 3) . '...';\n                }\n            }\n             \n            $results = htmlspecialchars($results);\n    } \n\n    return $results;\n} \n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifier.escape.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsModifier\n */\n\n/**\n * Smarty escape modifier plugin\n *\n * Type:     modifier<br>\n * Name:     escape<br>\n * Purpose:  escape string for output\n *\n * @link http://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online manual)\n * @author Monte Ohrt <monte at ohrt dot com>\n * @param string  $string        input string\n * @param string  $esc_type      escape type\n * @param string  $char_set      character set, used for htmlspecialchars() or htmlentities()\n * @param boolean $double_encode encode already encoded entitites again, used for htmlspecialchars() or htmlentities()\n * @return string escaped input string\n */\nfunction smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $double_encode = true)\n{\n    if (!$char_set) {\n        $char_set = SMARTY_RESOURCE_CHAR_SET;\n    }\n\n    switch ($esc_type) {\n        case 'html':\n            return htmlspecialchars($string, ENT_QUOTES, $char_set, $double_encode);\n\n        case 'htmlall':\n            if (SMARTY_MBSTRING /* ^phpunit */ && empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {\n                // mb_convert_encoding ignores htmlspecialchars()\n                $string = htmlspecialchars($string, ENT_QUOTES, $char_set, $double_encode);\n                // htmlentities() won't convert everything, so use mb_convert_encoding\n                return mb_convert_encoding($string, 'HTML-ENTITIES', $char_set);\n            }\n\n            // no MBString fallback\n            return htmlentities($string, ENT_QUOTES, $char_set, $double_encode);\n\n        case 'url':\n            return rawurlencode($string);\n\n        case 'urlpathinfo':\n            return str_replace('%2F', '/', rawurlencode($string));\n\n        case 'quotes':\n            // escape unescaped single quotes\n            return preg_replace(\"%(?<!\\\\\\\\)'%\", \"\\\\'\", $string);\n\n        case 'hex':\n            // escape every byte into hex\n            // Note that the UTF-8 encoded character ä will be represented as %c3%a4\n            $return = '';\n            $_length = strlen($string);\n            for ($x = 0; $x < $_length; $x++) {\n                $return .= '%' . bin2hex($string[$x]);\n            }\n            return $return;\n\n        case 'hexentity':\n            $return = '';\n            if (SMARTY_MBSTRING /* ^phpunit */ && empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {\n                require_once(SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php');\n                $return = '';\n                foreach (smarty_mb_to_unicode($string, SMARTY_RESOURCE_CHAR_SET) as $unicode) {\n                    $return .= '&#x' . strtoupper(dechex($unicode)) . ';';\n                }\n                return $return;\n            }\n            // no MBString fallback\n            $_length = strlen($string);\n            for ($x = 0; $x < $_length; $x++) {\n                $return .= '&#x' . bin2hex($string[$x]) . ';';\n            }\n            return $return;\n\n        case 'decentity':\n            $return = '';\n            if (SMARTY_MBSTRING /* ^phpunit */ && empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {\n                require_once(SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php');\n                $return = '';\n                foreach (smarty_mb_to_unicode($string, SMARTY_RESOURCE_CHAR_SET) as $unicode) {\n                    $return .= '&#' . $unicode . ';';\n                }\n                return $return;\n            }\n            // no MBString fallback\n            $_length = strlen($string);\n            for ($x = 0; $x < $_length; $x++) {\n                $return .= '&#' . ord($string[$x]) . ';';\n            }\n            return $return;\n\n        case 'javascript':\n            // escape quotes and backslashes, newlines, etc.\n            return strtr($string, array('\\\\' => '\\\\\\\\', \"'\" => \"\\\\'\", '\"' => '\\\\\"', \"\\r\" => '\\\\r', \"\\n\" => '\\\\n', '</' => '<\\/'));\n\n        case 'mail':\n            if (SMARTY_MBSTRING /* ^phpunit */ && empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {\n                require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php');\n                return smarty_mb_str_replace(array('@', '.'), array(' [AT] ', ' [DOT] '), $string);\n            }\n            // no MBString fallback\n            return str_replace(array('@', '.'), array(' [AT] ', ' [DOT] '), $string);\n\n        case 'nonstd':\n            // escape non-standard chars, such as ms document quotes\n            $return = '';\n            if (SMARTY_MBSTRING /* ^phpunit */ && empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {\n                require_once(SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php');\n                foreach (smarty_mb_to_unicode($string, SMARTY_RESOURCE_CHAR_SET) as $unicode) {\n                    if ($unicode >= 126) {\n                        $return .= '&#' . $unicode . ';';\n                    } else {\n                        $return .= chr($unicode);\n                    }\n                }\n                return $return;\n            }\n\n            $_length = strlen($string);\n            for ($_i = 0; $_i < $_length; $_i++) {\n                $_ord = ord(substr($string, $_i, 1));\n                // non-standard char, escape it\n                if ($_ord >= 126) {\n                    $return .= '&#' . $_ord . ';';\n                } else {\n                    $return .= substr($string, $_i, 1);\n                }\n            }\n            return $return;\n\n        default:\n            return $string;\n    }\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifier.regex_replace.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsModifier\n */\n\n/**\n * Smarty regex_replace modifier plugin\n *\n * Type:     modifier<br>\n * Name:     regex_replace<br>\n * Purpose:  regular expression search/replace\n *\n * @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php\n *          regex_replace (Smarty online manual)\n * @author Monte Ohrt <monte at ohrt dot com>\n * @param string       $string   input string\n * @param string|array $search   regular expression(s) to search for\n * @param string|array $replace  string(s) that should be replaced\n * @return string\n */\nfunction smarty_modifier_regex_replace($string, $search, $replace)\n{\n    if(is_array($search)) {\n        foreach($search as $idx => $s) {\n            $search[$idx] = _smarty_regex_replace_check($s);\n        }\n    } else {\n        $search = _smarty_regex_replace_check($search);\n    }\n    return preg_replace($search, $replace, $string);\n}\n\n/**\n * @param  string $search string(s) that should be replaced\n * @return string\n * @ignore\n */\nfunction _smarty_regex_replace_check($search)\n{\n    // null-byte injection detection\n    // anything behind the first null-byte is ignored\n    if (($pos = strpos($search,\"\\0\")) !== false) {\n        $search = substr($search,0,$pos);\n    }\n    // remove eval-modifier from $search\n    if (preg_match('!([a-zA-Z\\s]+)$!s', $search, $match) && (strpos($match[1], 'e') !== false)) {\n        $search = substr($search, 0, -strlen($match[1])) . preg_replace('![e\\s]+!', '', $match[1]);\n    }\n    return $search;\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifier.replace.php",
    "content": "<?php\n/**\n * Smarty plugin\n * @package Smarty\n * @subpackage PluginsModifier\n */\n\n/**\n * Smarty replace modifier plugin\n * \n * Type:     modifier<br>\n * Name:     replace<br>\n * Purpose:  simple search/replace\n * \n * @link http://smarty.php.net/manual/en/language.modifier.replace.php replace (Smarty online manual)\n * @author Monte Ohrt <monte at ohrt dot com> \n * @author Uwe Tews \n * @param string $string  input string\n * @param string $search  text to search for\n * @param string $replace replacement text\n * @return string \n */\nfunction smarty_modifier_replace($string, $search, $replace)\n{\n    if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {\n        require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php');\n        return smarty_mb_str_replace($search, $replace, $string);\n    }\n    \n    return str_replace($search, $replace, $string);\n} \n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifier.spacify.php",
    "content": "<?php\n/**\n * Smarty plugin\n * @package Smarty\n * @subpackage PluginsModifier\n */\n\n/**\n * Smarty spacify modifier plugin\n * \n * Type:     modifier<br>\n * Name:     spacify<br>\n * Purpose:  add spaces between characters in a string\n * \n * @link http://smarty.php.net/manual/en/language.modifier.spacify.php spacify (Smarty online manual)\n * @author Monte Ohrt <monte at ohrt dot com> \n * @param string $string       input string\n * @param string $spacify_char string to insert between characters.\n * @return string\n */\nfunction smarty_modifier_spacify($string, $spacify_char = ' ')\n{\n    // well… what about charsets besides latin and UTF-8?\n    return implode($spacify_char, preg_split('//u', $string, -1, PREG_SPLIT_NO_EMPTY));\n} \n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifier.truncate.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsModifier\n */\n \n/**\n * Smarty truncate modifier plugin\n * \n * Type:     modifier<br>\n * Name:     truncate<br>\n * Purpose:  Truncate a string to a certain length if necessary,\n *               optionally splitting in the middle of a word, and\n *               appending the $etc string or inserting $etc into the middle.\n * \n * @link http://smarty.php.net/manual/en/language.modifier.truncate.php truncate (Smarty online manual)\n * @author Monte Ohrt <monte at ohrt dot com> \n * @param string  $string      input string\n * @param integer $length      length of truncated text\n * @param string  $etc         end string\n * @param boolean $break_words truncate at word boundary\n * @param boolean $middle      truncate in the middle of text\n * @return string truncated string\n */\nfunction smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false) {\n    if ($length == 0)\n        return '';\n\n    if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {\n        if (mb_strlen($string, SMARTY_RESOURCE_CHAR_SET) > $length) {\n            $length -= min($length, mb_strlen($etc, SMARTY_RESOURCE_CHAR_SET));\n            if (!$break_words && !$middle) {\n                $string = preg_replace('/\\s+?(\\S+)?$/u', '', mb_substr($string, 0, $length + 1, SMARTY_RESOURCE_CHAR_SET));\n            } \n            if (!$middle) {\n                return mb_substr($string, 0, $length, SMARTY_RESOURCE_CHAR_SET) . $etc;\n            }\n            return mb_substr($string, 0, $length / 2, SMARTY_RESOURCE_CHAR_SET) . $etc . mb_substr($string, - $length / 2, $length, SMARTY_RESOURCE_CHAR_SET);\n        }\n        return $string;\n    }\n    \n    // no MBString fallback\n    if (isset($string[$length])) {\n        $length -= min($length, strlen($etc));\n        if (!$break_words && !$middle) {\n            $string = preg_replace('/\\s+?(\\S+)?$/', '', substr($string, 0, $length + 1));\n        } \n        if (!$middle) {\n            return substr($string, 0, $length) . $etc;\n        }\n        return substr($string, 0, $length / 2) . $etc . substr($string, - $length / 2);\n    }\n    return $string;\n} \n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.cat.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsModifierCompiler\n */\n\n/**\n * Smarty cat modifier plugin\n *\n * Type:     modifier<br>\n * Name:     cat<br>\n * Date:     Feb 24, 2003<br>\n * Purpose:  catenate a value to a variable<br>\n * Input:    string to catenate<br>\n * Example:  {$var|cat:\"foo\"}\n *\n * @link http://smarty.php.net/manual/en/language.modifier.cat.php cat\n *          (Smarty online manual)\n * @author   Uwe Tews\n * @param array $params parameters\n * @return string with compiled code\n */\nfunction smarty_modifiercompiler_cat($params, $compiler)\n{\n    return '('.implode(').(', $params).')';\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.count_characters.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsModifierCompiler\n */\n\n/**\n * Smarty count_characters modifier plugin\n *\n * Type:     modifier<br>\n * Name:     count_characteres<br>\n * Purpose:  count the number of characters in a text\n *\n * @link http://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online manual)\n * @author Uwe Tews\n * @param array $params parameters\n * @return string with compiled code\n */\nfunction smarty_modifiercompiler_count_characters($params, $compiler)\n{\n    if (!isset($params[1]) || $params[1] != 'true') {\n        return 'preg_match_all(\\'/[^\\s]/u\\',' . $params[0] . ', $tmp)';\n    }\n    if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {\n        return 'mb_strlen(' . $params[0] . ', SMARTY_RESOURCE_CHAR_SET)';\n    }\n    // no MBString fallback\n    return 'strlen(' . $params[0] . ')';\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.count_paragraphs.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsModifierCompiler\n */\n\n/**\n * Smarty count_paragraphs modifier plugin\n *\n * Type:     modifier<br>\n * Name:     count_paragraphs<br>\n * Purpose:  count the number of paragraphs in a text\n *\n * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php\n *          count_paragraphs (Smarty online manual)\n * @author Uwe Tews\n * @param array $params parameters\n * @return string with compiled code\n */\nfunction smarty_modifiercompiler_count_paragraphs($params, $compiler)\n{\n    // count \\r or \\n characters\n    return '(preg_match_all(\\'#[\\r\\n]+#\\', ' . $params[0] . ', $tmp)+1)';\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.count_sentences.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsModifierCompiler\n */\n\n/**\n * Smarty count_sentences modifier plugin\n *\n * Type:     modifier<br>\n * Name:     count_sentences\n * Purpose:  count the number of sentences in a text\n *\n * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php\n *          count_sentences (Smarty online manual)\n * @author Uwe Tews\n * @param array $params parameters\n * @return string with compiled code\n */\nfunction smarty_modifiercompiler_count_sentences($params, $compiler)\n{\n    // find periods, question marks, exclamation marks with a word before but not after.\n    return 'preg_match_all(\"#\\w[\\.\\?\\!](\\W|$)#uS\", ' . $params[0] . ', $tmp)';\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.count_words.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsModifierCompiler\n */\n\n/**\n * Smarty count_words modifier plugin\n *\n * Type:     modifier<br>\n * Name:     count_words<br>\n * Purpose:  count the number of words in a text\n *\n * @link http://www.smarty.net/manual/en/language.modifier.count.words.php count_words (Smarty online manual)\n * @author Uwe Tews\n * @param array $params parameters\n * @return string with compiled code\n*/\nfunction smarty_modifiercompiler_count_words($params, $compiler)\n{\n    if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {\n        // return 'preg_match_all(\\'#[\\w\\pL]+#u\\', ' . $params[0] . ', $tmp)';\n        // expression taken from http://de.php.net/manual/en/function.str-word-count.php#85592\n        return 'preg_match_all(\\'/\\p{L}[\\p{L}\\p{Mn}\\p{Pd}\\\\\\'\\x{2019}]*/u\\', ' . $params[0] . ', $tmp)';\n    }\n    // no MBString fallback\n    return 'str_word_count(' . $params[0] . ')';\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.default.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsModifierCompiler\n */\n\n/**\n * Smarty default modifier plugin\n *\n * Type:     modifier<br>\n * Name:     default<br>\n * Purpose:  designate default value for empty variables\n *\n * @link http://www.smarty.net/manual/en/language.modifier.default.php default (Smarty online manual)\n * @author Uwe Tews\n * @param array $params parameters\n * @return string with compiled code\n */\nfunction smarty_modifiercompiler_default ($params, $compiler)\n{\n    $output = $params[0];\n    if (!isset($params[1])) {\n        $params[1] = \"''\";\n    }\n    \n    array_shift($params);\n    foreach ($params as $param) {\n        $output = '(($tmp = @' . $output . ')===null||$tmp===\\'\\' ? ' . $param . ' : $tmp)';\n    }\n    return $output;\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.escape.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsModifierCompiler\n */\n\n/**\n * @ignore\n */\nrequire_once( SMARTY_PLUGINS_DIR .'shared.literal_compiler_param.php' );\n\n/**\n * Smarty escape modifier plugin\n *\n * Type:     modifier<br>\n * Name:     escape<br>\n * Purpose:  escape string for output\n *\n * @link http://www.smarty.net/docsv2/en/language.modifier.escape count_characters (Smarty online manual)\n * @author Rodney Rehm\n * @param array $params parameters\n * @return string with compiled code\n */\nfunction smarty_modifiercompiler_escape($params, $compiler)\n{\n    try {\n        $esc_type = smarty_literal_compiler_param($params, 1, 'html');\n        $char_set = smarty_literal_compiler_param($params, 2, SMARTY_RESOURCE_CHAR_SET);\n        $double_encode = smarty_literal_compiler_param($params, 3, true);\n\n        if (!$char_set) {\n            $char_set = SMARTY_RESOURCE_CHAR_SET;\n        }\n\n        switch ($esc_type) {\n            case 'html':\n                return 'htmlspecialchars('\n                    . $params[0] .', ENT_QUOTES, '\n                    . var_export($char_set, true) . ', '\n                    . var_export($double_encode, true) . ')';\n\n            case 'htmlall':\n                if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {\n                    return 'mb_convert_encoding(htmlspecialchars('\n                        . $params[0] .', ENT_QUOTES, '\n                        . var_export($char_set, true) . ', '\n                        . var_export($double_encode, true)\n                        . '), \"HTML-ENTITIES\", '\n                        . var_export($char_set, true) . ')';\n                }\n\n                // no MBString fallback\n                return 'htmlentities('\n                    . $params[0] .', ENT_QUOTES, '\n                    . var_export($char_set, true) . ', '\n                    . var_export($double_encode, true) . ')';\n\n            case 'url':\n                return 'rawurlencode(' . $params[0] . ')';\n\n            case 'urlpathinfo':\n                return 'str_replace(\"%2F\", \"/\", rawurlencode(' . $params[0] . '))';\n\n            case 'quotes':\n                // escape unescaped single quotes\n                return 'preg_replace(\"%(?<!\\\\\\\\\\\\\\\\)\\'%\", \"\\\\\\'\",' . $params[0] . ')';\n\n            case 'javascript':\n                // escape quotes and backslashes, newlines, etc.\n                return 'strtr(' . $params[0] . ', array(\"\\\\\\\\\" => \"\\\\\\\\\\\\\\\\\", \"\\'\" => \"\\\\\\\\\\'\", \"\\\"\" => \"\\\\\\\\\\\"\", \"\\\\r\" => \"\\\\\\\\r\", \"\\\\n\" => \"\\\\\\n\", \"</\" => \"<\\/\" ))';\n\n        }\n    } catch(SmartyException $e) {\n        // pass through to regular plugin fallback\n    }\n\n    // could not optimize |escape call, so fallback to regular plugin\n    if ($compiler->tag_nocache | $compiler->nocache) {\n        $compiler->template->required_plugins['nocache']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR .'modifier.escape.php';\n        $compiler->template->required_plugins['nocache']['escape']['modifier']['function'] = 'smarty_modifier_escape';\n    } else {\n        $compiler->template->required_plugins['compiled']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR .'modifier.escape.php';\n        $compiler->template->required_plugins['compiled']['escape']['modifier']['function'] = 'smarty_modifier_escape';\n    }\n    return 'smarty_modifier_escape(' . join( ', ', $params ) . ')';\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.from_charset.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsModifierCompiler\n */\n\n/**\n * Smarty from_charset modifier plugin\n *\n * Type:     modifier<br>\n * Name:     from_charset<br>\n * Purpose:  convert character encoding from $charset to internal encoding\n *\n * @author Rodney Rehm\n * @param array $params parameters\n * @return string with compiled code\n */\nfunction smarty_modifiercompiler_from_charset($params, $compiler)\n{\n    if (!SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {\n        // FIXME: (rodneyrehm) shouldn't this throw an error?\n        return $params[0];\n    }\n\n    if (!isset($params[1])) {\n        $params[1] = '\"ISO-8859-1\"';\n    }\n\n    return 'mb_convert_encoding(' . $params[0] . ', SMARTY_RESOURCE_CHAR_SET, ' . $params[1] . ')';\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.indent.php",
    "content": "<?php\n/**\n * Smarty plugin\n * @package Smarty\n * @subpackage PluginsModifierCompiler\n */\n\n/**\n * Smarty indent modifier plugin\n *\n * Type:     modifier<br>\n * Name:     indent<br>\n * Purpose:  indent lines of text\n *\n * @link http://www.smarty.net/manual/en/language.modifier.indent.php indent (Smarty online manual)\n * @author Uwe Tews\n * @param array $params parameters\n * @return string with compiled code\n */\n\nfunction smarty_modifiercompiler_indent($params, $compiler)\n{\n    if (!isset($params[1])) {\n        $params[1] = 4;\n    }\n    if (!isset($params[2])) {\n        $params[2] = \"' '\";\n    }\n    return 'preg_replace(\\'!^!m\\',str_repeat(' . $params[2] . ',' . $params[1] . '),' . $params[0] . ')';\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.lower.php",
    "content": "<?php\n/**\n * Smarty plugin\n * @package Smarty\n * @subpackage PluginsModifierCompiler\n */\n\n/**\n * Smarty lower modifier plugin\n *\n * Type:     modifier<br>\n * Name:     lower<br>\n * Purpose:  convert string to lowercase\n *\n * @link http://www.smarty.net/manual/en/language.modifier.lower.php lower (Smarty online manual)\n * @author Monte Ohrt <monte at ohrt dot com>\n * @author Uwe Tews\n * @param array $params parameters\n * @return string with compiled code\n */\n\nfunction smarty_modifiercompiler_lower($params, $compiler)\n{\n    if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {\n        return 'mb_strtolower(' . $params[0] . ',SMARTY_RESOURCE_CHAR_SET)' ;\n    }\n    // no MBString fallback\n    return 'strtolower(' . $params[0] . ')';\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.noprint.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsModifierCompiler\n */\n\n/**\n * Smarty noprint modifier plugin\n *\n * Type:     modifier<br>\n * Name:     noprint<br>\n * Purpose:  return an empty string\n *\n * @author   Uwe Tews\n * @param array $params parameters\n * @return string with compiled code\n */\nfunction smarty_modifiercompiler_noprint($params, $compiler)\n{\n    return \"''\";\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.string_format.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsModifierCompiler\n */\n\n/**\n * Smarty string_format modifier plugin\n *\n * Type:     modifier<br>\n * Name:     string_format<br>\n * Purpose:  format strings via sprintf\n *\n * @link http://www.smarty.net/manual/en/language.modifier.string.format.php string_format (Smarty online manual)\n * @author Uwe Tews\n * @param array $params parameters\n * @return string with compiled code\n */\nfunction smarty_modifiercompiler_string_format($params, $compiler)\n{\n    return 'sprintf(' . $params[1] . ',' . $params[0] . ')';\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.strip.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsModifierCompiler\n */\n\n/**\n * Smarty strip modifier plugin\n *\n * Type:     modifier<br>\n * Name:     strip<br>\n * Purpose:  Replace all repeated spaces, newlines, tabs\n *              with a single space or supplied replacement string.<br>\n * Example:  {$var|strip} {$var|strip:\"&nbsp;\"}<br>\n * Date:     September 25th, 2002\n *\n * @link http://www.smarty.net/manual/en/language.modifier.strip.php strip (Smarty online manual)\n * @author Uwe Tews\n * @param array $params parameters\n * @return string with compiled code\n */\n\nfunction smarty_modifiercompiler_strip($params, $compiler)\n{\n    if (!isset($params[1])) {\n        $params[1] = \"' '\";\n    }\n    return \"preg_replace('!\\s+!u', {$params[1]},{$params[0]})\";\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.strip_tags.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsModifierCompiler\n */\n\n/**\n * Smarty strip_tags modifier plugin\n *\n * Type:     modifier<br>\n * Name:     strip_tags<br>\n * Purpose:  strip html tags from text\n *\n * @link http://www.smarty.net/manual/en/language.modifier.strip.tags.php strip_tags (Smarty online manual)\n * @author Uwe Tews\n * @param array $params parameters\n * @return string with compiled code\n */\nfunction smarty_modifiercompiler_strip_tags($params, $compiler)\n{\n   if (!isset($params[1])) {\n        $params[1] = true;\n    }\n    if ($params[1] === true) {\n        return \"preg_replace('!<[^>]*?>!', ' ', {$params[0]})\";\n    } else {\n        return 'strip_tags(' . $params[0] . ')';\n    }\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.to_charset.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsModifierCompiler\n */\n\n/**\n * Smarty to_charset modifier plugin\n *\n * Type:     modifier<br>\n * Name:     to_charset<br>\n * Purpose:  convert character encoding from internal encoding to $charset\n *\n * @author Rodney Rehm\n * @param array $params parameters\n * @return string with compiled code\n */\nfunction smarty_modifiercompiler_to_charset($params, $compiler)\n{\n    if (!SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {\n        // FIXME: (rodneyrehm) shouldn't this throw an error?\n        return $params[0];\n    }\n\n    if (!isset($params[1])) {\n        $params[1] = '\"ISO-8859-1\"';\n    }\n\n    return 'mb_convert_encoding(' . $params[0] . ', ' . $params[1] . ', SMARTY_RESOURCE_CHAR_SET)';\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.unescape.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsModifierCompiler\n */\n\n/**\n * Smarty unescape modifier plugin\n *\n * Type:     modifier<br>\n * Name:     unescape<br>\n * Purpose:  unescape html entities\n *\n * @author Rodney Rehm\n * @param array $params parameters\n * @return string with compiled code\n */\nfunction smarty_modifiercompiler_unescape($params, $compiler)\n{\n    if (!isset($params[1])) {\n        $params[1] = 'html';\n    }\n    if (!isset($params[2])) {\n        $params[2] = \"SMARTY_RESOURCE_CHAR_SET\";\n    } else {\n        $params[2] = \"'\" . $params[2] . \"'\";\n    }\n\n    switch (trim($params[1], '\"\\'')) {\n        case 'entity':\n            return 'mb_convert_encoding(' . $params[0] . ', ' . $params[2] . ', \\'HTML-ENTITIES\\')';\n        case 'htmlall':\n            if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {\n                return 'mb_convert_encoding(' . $params[0] . ', ' . $params[2] . ', \\'HTML-ENTITIES\\')';\n            }\n            return 'html_entity_decode(' . $params[0] . ', ENT_QUOTES, ' . $params[2] . ')';\n\n        case 'html':\n            return 'htmlspecialchars_decode(' . $params[0] . ', ENT_QUOTES)';\n\n        default:\n            return $params[0];\n    }\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.upper.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsModifierCompiler\n */\n\n/**\n * Smarty upper modifier plugin\n * \n * Type:     modifier<br>\n * Name:     lower<br>\n * Purpose:  convert string to uppercase\n * \n * @link http://smarty.php.net/manual/en/language.modifier.upper.php lower (Smarty online manual)\n * @author Uwe Tews \n * @param array $params parameters\n * @return string with compiled code\n */\nfunction smarty_modifiercompiler_upper($params, $compiler)\n{\n    if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {\n        return 'mb_strtoupper(' . $params[0] . ',SMARTY_RESOURCE_CHAR_SET)' ;\n    }\n    // no MBString fallback\n    return 'strtoupper(' . $params[0] . ')';\n} \n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/modifiercompiler.wordwrap.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsModifierCompiler\n */\n\n/**\n * Smarty wordwrap modifier plugin\n * \n * Type:     modifier<br>\n * Name:     wordwrap<br>\n * Purpose:  wrap a string of text at a given length\n * \n * @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual)\n * @author Uwe Tews \n * @param array $params parameters\n * @return string with compiled code\n */\nfunction smarty_modifiercompiler_wordwrap($params, $compiler)\n{\n    if (!isset($params[1])) {\n        $params[1] = 80;\n    } \n    if (!isset($params[2])) {\n        $params[2] = '\"\\n\"';\n    } \n    if (!isset($params[3])) {\n        $params[3] = 'false';\n    } \n    $function = 'wordwrap';\n    if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {\n        if ($compiler->tag_nocache | $compiler->nocache) {\n            $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR .'shared.mb_wordwrap.php';\n            $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';\n        } else {\n            $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR .'shared.mb_wordwrap.php';\n            $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';\n        }\n        $function = 'smarty_mb_wordwrap';\n    }\n    return $function . '(' . $params[0] . ',' . $params[1] . ',' . $params[2] . ',' . $params[3] . ')';\n} \n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/outputfilter.trimwhitespace.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsFilter\n */\n\n/**\n * Smarty trimwhitespace outputfilter plugin\n *\n * Trim unnecessary whitespace from HTML markup.\n *\n * @author   Rodney Rehm\n * @param string                   $source input string\n * @param Smarty_Internal_Template $smarty Smarty object\n * @return string filtered output\n */\nfunction smarty_outputfilter_trimwhitespace($source, Smarty_Internal_Template $smarty)\n{\n    $store = array();\n    $_store = 0;\n    $_offset = 0;\n\n    // Unify Line-Breaks to \\n\n    $source = preg_replace(\"/\\015\\012|\\015|\\012/\", \"\\n\", $source);\n\n    // capture Internet Explorer Conditional Comments\n    if (preg_match_all('#<!--\\[[^\\]]+\\]>.*?<!\\[[^\\]]+\\]-->#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {\n        foreach ($matches as $match) {\n            $store[] = $match[0][0];\n            $_length = strlen($match[0][0]);\n            $replace = '@!@SMARTY:' . $_store . ':SMARTY@!@';\n            $source = substr_replace($source, $replace, $match[0][1] - $_offset, $_length);\n\n            $_offset += $_length - strlen($replace);\n            $_store++;\n        }\n    }\n\n    // Strip all HTML-Comments\n    $source = preg_replace( '#<!--.*?-->#ms', '', $source );\n\n    // capture html elements not to be messed with\n    $_offset = 0;\n    if (preg_match_all('#<(script|pre|textarea)[^>]*>.*?</\\\\1>#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {\n        foreach ($matches as $match) {\n            $store[] = $match[0][0];\n            $_length = strlen($match[0][0]);\n            $replace = '@!@SMARTY:' . $_store . ':SMARTY@!@';\n            $source = substr_replace($source, $replace, $match[0][1] - $_offset, $_length);\n\n            $_offset += $_length - strlen($replace);\n            $_store++;\n        }\n    }\n\n    $expressions = array(\n        // replace multiple spaces between tags by a single space\n        // can't remove them entirely, becaue that might break poorly implemented CSS display:inline-block elements\n        '#(:SMARTY@!@|>)\\s+(?=@!@SMARTY:|<)#s' => '\\1 \\2',\n        // remove spaces between attributes (but not in attribute values!)\n        '#(([a-z0-9]\\s*=\\s*([\"\\'])[^\\3]*?\\3)|<[a-z0-9_]+)\\s+([a-z/>])#is' => '\\1 \\4',\n        // note: for some very weird reason trim() seems to remove spaces inside attributes.\n        // maybe a \\0 byte or something is interfering?\n        '#^\\s+<#Ss' => '<',\n        '#>\\s+$#Ss' => '>',\n    );\n\n    $source = preg_replace( array_keys($expressions), array_values($expressions), $source );\n    // note: for some very weird reason trim() seems to remove spaces inside attributes.\n    // maybe a \\0 byte or something is interfering?\n    // $source = trim( $source );\n\n    // capture html elements not to be messed with\n    $_offset = 0;\n    if (preg_match_all('#@!@SMARTY:([0-9]+):SMARTY@!@#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {\n        foreach ($matches as $match) {\n            $store[] = $match[0][0];\n            $_length = strlen($match[0][0]);\n            $replace = array_shift($store);\n            $source = substr_replace($source, $replace, $match[0][1] + $_offset, $_length);\n\n            $_offset += strlen($replace) - $_length;\n            $_store++;\n        }\n    }\n\n    return $source;\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/shared.escape_special_chars.php",
    "content": "<?php\n/**\n * Smarty shared plugin\n *\n * @package Smarty\n * @subpackage PluginsShared\n */\n\nif (version_compare(PHP_VERSION, '5.2.3', '>=')) {\n    /**\n     * escape_special_chars common function\n     *\n     * Function: smarty_function_escape_special_chars<br>\n     * Purpose:  used by other smarty functions to escape\n     *           special chars except for already escaped ones\n     *\n     * @author   Monte Ohrt <monte at ohrt dot com>\n     * @param string $string text that should by escaped\n     * @return string\n     */\n    function smarty_function_escape_special_chars($string)\n    {\n        if (!is_array($string)) {\n            $string = htmlspecialchars($string, ENT_COMPAT, SMARTY_RESOURCE_CHAR_SET, false);\n        }\n        return $string;\n    }  \n} else {         \n    /**\n     * escape_special_chars common function\n     *\n     * Function: smarty_function_escape_special_chars<br>\n     * Purpose:  used by other smarty functions to escape\n     *           special chars except for already escaped ones\n     *\n     * @author   Monte Ohrt <monte at ohrt dot com>\n     * @param string $string text that should by escaped\n     * @return string\n     */\n    function smarty_function_escape_special_chars($string)\n    {\n        if (!is_array($string)) {\n            $string = preg_replace('!&(#?\\w+);!', '%%%SMARTY_START%%%\\\\1%%%SMARTY_END%%%', $string);\n            $string = htmlspecialchars($string);\n            $string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string); \n        }\n        return $string;\n    }                                                                                                             \n} \n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/shared.literal_compiler_param.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsShared\n */\n\n/**\n * evaluate compiler parameter\n *\n * @param array   $params  parameter array as given to the compiler function\n * @param integer $index   array index of the parameter to convert\n * @param mixed   $default value to be returned if the parameter is not present\n * @return mixed evaluated value of parameter or $default\n * @throws SmartyException if parameter is not a literal (but an expression, variable, …)\n * @author Rodney Rehm\n */\nfunction smarty_literal_compiler_param($params, $index, $default=null)\n{\n    // not set, go default\n    if (!isset($params[$index])) {\n        return $default;\n    }\n    // test if param is a literal\n    if (!preg_match('/^([\\'\"]?)[a-zA-Z0-9]+(\\\\1)$/', $params[$index])) {\n        throw new SmartyException('$param[' . $index . '] is not a literal and is thus not evaluatable at compile time');\n    }\n\n    $t = null;\n    eval(\"\\$t = \" . $params[$index] . \";\");\n    return $t;\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/shared.make_timestamp.php",
    "content": "<?php\n/**\n * Smarty shared plugin\n *\n * @package Smarty\n * @subpackage PluginsShared\n */\n\n/**\n * Function: smarty_make_timestamp<br>\n * Purpose:  used by other smarty functions to make a timestamp from a string.\n *\n * @author   Monte Ohrt <monte at ohrt dot com>\n * @param DateTime|int|string $string  date object, timestamp or string that can be converted using strtotime()\n * @return int\n */\nfunction smarty_make_timestamp($string)\n{\n    if (empty($string)) {\n        // use \"now\":\n        return time();\n    } elseif ($string instanceof DateTime) {\n        return $string->getTimestamp();\n    } elseif (strlen($string) == 14 && ctype_digit($string)) {\n        // it is mysql timestamp format of YYYYMMDDHHMMSS?\n        return mktime(substr($string, 8, 2),substr($string, 10, 2),substr($string, 12, 2),\n                       substr($string, 4, 2),substr($string, 6, 2),substr($string, 0, 4));\n    } elseif (is_numeric($string)) {\n        // it is a numeric string, we handle it as timestamp\n        return (int) $string;\n    } else {\n        // strtotime should handle it\n        $time = strtotime($string);\n        if ($time == -1 || $time === false) {\n            // strtotime() was not able to parse $string, use \"now\":\n            return time();\n        }\n        return $time;\n    }\n}\n\n?>\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/shared.mb_str_replace.php",
    "content": "<?php\n/**\n * Smarty shared plugin\n *\n * @package Smarty\n * @subpackage PluginsShared\n */\nif (!function_exists('smarty_mb_str_replace')) {\n\n    /**\n     * Multibyte string replace\n     *\n     * @param string $search  the string to be searched\n     * @param string $replace the replacement string\n     * @param string $subject the source string\n     * @param int    &$count  number of matches found\n     * @return string replaced string\n     * @author Rodney Rehm\n     */\n    function smarty_mb_str_replace($search, $replace, $subject, &$count=0)\n    {\n        if (!is_array($search) && is_array($replace)) {\n            return false;\n        }\n        if (is_array($subject)) {\n            // call mb_replace for each single string in $subject\n            foreach ($subject as &$string) {\n                $string = &smarty_mb_str_replace($search, $replace, $string, $c);\n                $count += $c;\n            }\n        } elseif (is_array($search)) {\n            if (!is_array($replace)) {\n                foreach ($search as &$string) {\n                    $subject = smarty_mb_str_replace($string, $replace, $subject, $c);\n                    $count += $c;\n                }\n            } else {\n                $n = max(count($search), count($replace));\n                while ($n--) {\n                    $subject = smarty_mb_str_replace(current($search), current($replace), $subject, $c);\n                    $count += $c;\n                    next($search);\n                    next($replace);\n                }\n            }\n        } else {\n            $parts = mb_split(preg_quote($search), $subject);\n            $count = count($parts) - 1;\n            $subject = implode($replace, $parts);\n        }\n        return $subject;\n    }\n\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/shared.mb_unicode.php",
    "content": "<?php\n/**\n * Smarty shared plugin\n *\n * @package Smarty\n * @subpackage PluginsShared\n */\n\n/**\n * convert characters to their decimal unicode equivalents\n *\n * @link http://www.ibm.com/developerworks/library/os-php-unicode/index.html#listing3 for inspiration\n * @param string $string   characters to calculate unicode of\n * @param string $encoding encoding of $string, if null mb_internal_encoding() is used\n * @return array sequence of unicodes\n * @author Rodney Rehm\n */\nfunction smarty_mb_to_unicode($string, $encoding=null) {\n    if ($encoding) {\n        $expanded = mb_convert_encoding($string, \"UTF-32BE\", $encoding);\n    } else {\n        $expanded = mb_convert_encoding($string, \"UTF-32BE\");\n    }\n    return unpack(\"N*\", $expanded);\n}\n\n/**\n * convert unicodes to the character of given encoding\n *\n * @link http://www.ibm.com/developerworks/library/os-php-unicode/index.html#listing3 for inspiration\n * @param integer|array $unicode  single unicode or list of unicodes to convert\n * @param string        $encoding encoding of returned string, if null mb_internal_encoding() is used\n * @return string unicode as character sequence in given $encoding\n * @author Rodney Rehm\n */\nfunction smarty_mb_from_unicode($unicode, $encoding=null) {\n    $t = '';\n    if (!$encoding) {\n        $encoding = mb_internal_encoding();\n    }\n    foreach((array) $unicode as $utf32be) {\n        $character = pack(\"N*\", $utf32be);\n        $t .= mb_convert_encoding($character, $encoding, \"UTF-32BE\");\n    }\n    return $t;\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/shared.mb_wordwrap.php",
    "content": "<?php\n/**\n * Smarty shared plugin\n *\n * @package Smarty\n * @subpackage PluginsShared\n */\n\nif(!function_exists('smarty_mb_wordwrap')) {\n\n    /**\n     * Wrap a string to a given number of characters\n     *\n     * @link http://php.net/manual/en/function.wordwrap.php for similarity\n     * @param string  $str   the string to wrap\n     * @param int     $width the width of the output\n     * @param string  $break the character used to break the line\n     * @param boolean $cut   ignored parameter, just for the sake of\n     * @return string wrapped string\n     * @author Rodney Rehm\n     */\n    function smarty_mb_wordwrap($str, $width=75, $break=\"\\n\", $cut=false)\n    {\n        // break words into tokens using white space as a delimiter\n        $tokens = preg_split('!(\\s)!uS', $str, -1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);\n        $length = 0;\n        $t = '';\n        $_previous = false;\n\n        foreach ($tokens as $_token) {\n            $token_length = mb_strlen($_token, SMARTY_RESOURCE_CHAR_SET);\n            $_tokens = array($_token);\n            if ($token_length > $width) {\n                // remove last space\n                $t = mb_substr($t, 0, -1, SMARTY_RESOURCE_CHAR_SET);\n                $_previous = false;\n                $length = 0;\n\n                if ($cut) {\n                    $_tokens = preg_split('!(.{' . $width . '})!uS', $_token, -1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);\n                    // broken words go on a new line\n                    $t .= $break;\n                }\n            }\n\n            foreach ($_tokens as $token) {\n                $_space = !!preg_match('!^\\s$!uS', $token);\n                $token_length = mb_strlen($token, SMARTY_RESOURCE_CHAR_SET);\n                $length += $token_length;\n\n                if ($length > $width) {\n                    // remove space before inserted break\n                    if ($_previous && $token_length < $width) {\n                        $t = mb_substr($t, 0, -1, SMARTY_RESOURCE_CHAR_SET);\n                    }\n\n                    // add the break before the token\n                    $t .= $break;\n                    $length = $token_length;\n\n                    // skip space after inserting a break\n                    if ($_space) {\n                        $length = 0;\n                        continue;\n                    }\n                } else if ($token == \"\\n\") {\n                    // hard break must reset counters\n                    $_previous = 0;\n                    $length = 0;\n                } else {\n                    // remember if we had a space or not\n                    $_previous = $_space;\n                }\n                // add the token\n                $t .= $token;\n            }\n        }\n\n        return $t;\n    }\n\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/plugins/variablefilter.htmlspecialchars.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage PluginsFilter\n */\n\n/**\n * Smarty htmlspecialchars variablefilter plugin\n *\n * @param string                   $source input string\n * @param Smarty_Internal_Template $smarty Smarty object\n * @return string filtered output\n */\nfunction smarty_variablefilter_htmlspecialchars($source, $smarty)\n{\n    return htmlspecialchars($source, ENT_QUOTES, SMARTY_RESOURCE_CHAR_SET);\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_cacheresource.php",
    "content": "<?php\n/**\n* Smarty Internal Plugin\n*\n* @package Smarty\n* @subpackage Cacher\n*/\n\n/**\n* Cache Handler API\n*\n* @package Smarty\n* @subpackage Cacher\n* @author Rodney Rehm\n*/\nabstract class Smarty_CacheResource {\n    /**\n    * cache for Smarty_CacheResource instances\n    * @var array\n    */\n    public static $resources = array();\n\n    /**\n    * resource types provided by the core\n    * @var array\n    */\n    protected static $sysplugins = array(\n        'file' => true,\n    );\n\n    /**\n    * populate Cached Object with meta data from Resource\n    *\n    * @param Smarty_Template_Cached $cached cached object\n    * @param Smarty_Internal_Template $_template template object\n    * @return void\n    */\n    public abstract function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template);\n\n    /**\n    * populate Cached Object with timestamp and exists from Resource\n    *\n    * @param Smarty_Template_Cached $source cached object\n    * @return void\n    */\n    public abstract function populateTimestamp(Smarty_Template_Cached $cached);\n\n    /**\n    * Read the cached template and process header\n    *\n    * @param Smarty_Internal_Template $_template template object\n    * @param Smarty_Template_Cached $cached cached object\n    * @return booelan true or false if the cached content does not exist\n    */\n    public abstract function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached=null);\n\n    /**\n    * Write the rendered template output to cache\n    *\n    * @param Smarty_Internal_Template $_template template object\n    * @param string $content content to cache\n    * @return boolean success\n    */\n    public abstract function writeCachedContent(Smarty_Internal_Template $_template, $content);\n\n    /**\n    * Return cached content\n    *\n    * @param Smarty_Internal_Template $_template template object\n    * @param string $content content of cache\n    */\n    public function getCachedContent(Smarty_Internal_Template $_template)\n    {\n        if ($_template->cached->handler->process($_template)) {\n            ob_start();\n            $_template->properties['unifunc']($_template);\n            return ob_get_clean();\n        }\n        return null;\n    }\n\n    /**\n    * Empty cache\n    *\n    * @param Smarty $smarty Smarty object\n    * @param integer $exp_time expiration time (number of seconds, not timestamp)\n    * @return integer number of cache files deleted\n    */\n    public abstract function clearAll(Smarty $smarty, $exp_time=null);\n\n    /**\n    * Empty cache for a specific template\n    *\n    * @param Smarty $smarty Smarty object\n    * @param string $resource_name template name\n    * @param string $cache_id cache id\n    * @param string $compile_id compile id\n    * @param integer $exp_time expiration time (number of seconds, not timestamp)\n    * @return integer number of cache files deleted\n    */\n    public abstract function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time);\n\n\n    public function locked(Smarty $smarty, Smarty_Template_Cached $cached)\n    {\n        // theoretically locking_timeout should be checked against time_limit (max_execution_time)\n        $start = microtime(true);\n        $hadLock = null;\n        while ($this->hasLock($smarty, $cached)) {\n            $hadLock = true;\n            if (microtime(true) - $start > $smarty->locking_timeout) {\n                // abort waiting for lock release\n                return false;\n            }\n            sleep(1);\n        }\n        return $hadLock;\n    }\n\n    public function hasLock(Smarty $smarty, Smarty_Template_Cached $cached)\n    {\n        // check if lock exists\n        return false;\n    }\n\n    public function acquireLock(Smarty $smarty, Smarty_Template_Cached $cached)\n    {\n        // create lock\n        return true;\n    }\n\n    public function releaseLock(Smarty $smarty, Smarty_Template_Cached $cached)\n    {\n        // release lock\n        return true;\n    }\n\n\n    /**\n    * Load Cache Resource Handler\n    *\n    * @param Smarty $smarty Smarty object\n    * @param string $type name of the cache resource\n    * @return Smarty_CacheResource Cache Resource Handler\n    */\n    public static function load(Smarty $smarty, $type = null)\n    {\n        if (!isset($type)) {\n            $type = $smarty->caching_type;\n        }\n\n        // try smarty's cache\n        if (isset($smarty->_cacheresource_handlers[$type])) {\n            return $smarty->_cacheresource_handlers[$type];\n        }\n        \n        // try registered resource\n        if (isset($smarty->registered_cache_resources[$type])) {\n            // do not cache these instances as they may vary from instance to instance\n            return $smarty->_cacheresource_handlers[$type] = $smarty->registered_cache_resources[$type];\n        }\n        // try sysplugins dir\n        if (isset(self::$sysplugins[$type])) {\n            if (!isset(self::$resources[$type])) {\n                $cache_resource_class = 'Smarty_Internal_CacheResource_' . ucfirst($type);\n                self::$resources[$type] = new $cache_resource_class();\n            }\n            return $smarty->_cacheresource_handlers[$type] = self::$resources[$type];\n        }\n        // try plugins dir\n        $cache_resource_class = 'Smarty_CacheResource_' . ucfirst($type);\n        if ($smarty->loadPlugin($cache_resource_class)) {\n            if (!isset(self::$resources[$type])) {\n                self::$resources[$type] = new $cache_resource_class();\n            }\n            return $smarty->_cacheresource_handlers[$type] = self::$resources[$type];\n        }\n        // give up\n        throw new SmartyException(\"Unable to load cache resource '{$type}'\");\n    }\n\n    /**\n    * Invalid Loaded Cache Files\n    *\n    * @param Smarty $smarty Smarty object\n    */\n    public static function invalidLoadedCache(Smarty $smarty)\n    {\n        foreach ($smarty->template_objects as $tpl) {\n            if (isset($tpl->cached)) {\n                $tpl->cached->valid = false;\n                $tpl->cached->processed = false;\n            }\n        }\n    }\n}\n\n/**\n* Smarty Resource Data Object\n*\n* Cache Data Container for Template Files\n*\n* @package Smarty\n* @subpackage TemplateResources\n* @author Rodney Rehm\n*/\nclass Smarty_Template_Cached {\n    /**\n    * Source Filepath\n    * @var string\n    */\n    public $filepath = false;\n\n    /**\n    * Source Content\n    * @var string\n    */\n    public $content = null;\n\n    /**\n    * Source Timestamp\n    * @var integer\n    */\n    public $timestamp = false;\n\n    /**\n    * Source Existance\n    * @var boolean\n    */\n    public $exists = false;\n\n    /**\n    * Cache Is Valid\n    * @var boolean\n    */\n    public $valid = false;\n\n    /**\n    * Cache was processed\n    * @var boolean\n    */\n    public $processed = false;\n\n    /**\n    * CacheResource Handler\n    * @var Smarty_CacheResource\n    */\n    public $handler = null;\n\n    /**\n    * Template Compile Id (Smarty_Internal_Template::$compile_id)\n    * @var string\n    */\n    public $compile_id = null;\n\n    /**\n    * Template Cache Id (Smarty_Internal_Template::$cache_id)\n    * @var string\n    */\n    public $cache_id = null;\n\n    /**\n    * Id for cache locking\n    * @var string\n    */\n    public $lock_id = null;\n\n    /**\n    * flag that cache is locked by this instance\n    * @var bool\n    */\n    public $is_locked = false;\n\n    /**\n    * Source Object\n    * @var Smarty_Template_Source\n    */\n    public $source = null;\n\n    /**\n    * create Cached Object container\n    *\n    * @param Smarty_Internal_Template $_template template object\n    */\n    public function __construct(Smarty_Internal_Template $_template)\n    {\n        $this->compile_id = $_template->compile_id;\n        $this->cache_id = $_template->cache_id;\n        $this->source = $_template->source;\n        $_template->cached = $this;\n        $smarty = $_template->smarty;\n\n        //\n        // load resource handler\n        //\n        $this->handler = $handler = Smarty_CacheResource::load($smarty); // Note: prone to circular references\n\n        //\n        //    check if cache is valid\n        //\n        if (!($_template->caching == Smarty::CACHING_LIFETIME_CURRENT || $_template->caching == Smarty::CACHING_LIFETIME_SAVED) || $_template->source->recompiled) {\n            $handler->populate($this, $_template);\n            return;\n        }\n        while (true) {\n            while (true) {\n                $handler->populate($this, $_template);\n                if ($this->timestamp === false || $smarty->force_compile || $smarty->force_cache) {\n                    $this->valid = false;\n                } else {\n                    $this->valid = true;\n                }\n                if ($this->valid && $_template->caching == Smarty::CACHING_LIFETIME_CURRENT && $_template->cache_lifetime >= 0 && time() > ($this->timestamp + $_template->cache_lifetime)) {\n                    // lifetime expired\n                    $this->valid = false;\n                }\n                if ($this->valid || !$_template->smarty->cache_locking) {\n                    break;\n                }\n                if (!$this->handler->locked($_template->smarty, $this)) {\n                    $this->handler->acquireLock($_template->smarty, $this);\n                    break 2;\n                }\n            }\n            if ($this->valid) {\n                if (!$_template->smarty->cache_locking || $this->handler->locked($_template->smarty, $this) === null) {\n                    // load cache file for the following checks\n                    if ($smarty->debugging) {\n                        Smarty_Internal_Debug::start_cache($_template);\n                    }\n                    if($handler->process($_template, $this) === false) {\n                        $this->valid = false;\n                    } else {\n                        $this->processed = true;\n                    }\n                    if ($smarty->debugging) {\n                        Smarty_Internal_Debug::end_cache($_template);\n                    }\n                } else {\n                    continue;\n                }\n            } else {\n                return;\n            }\n            if ($this->valid && $_template->caching === Smarty::CACHING_LIFETIME_SAVED && $_template->properties['cache_lifetime'] >= 0 && (time() > ($_template->cached->timestamp + $_template->properties['cache_lifetime']))) {\n                $this->valid = false;\n            }\n            if (!$this->valid && $_template->smarty->cache_locking) {\n                $this->handler->acquireLock($_template->smarty, $this);\n                return;\n            } else {\n                return;\n            }\n        }\n    }\n\n    /**\n    * Write this cache object to handler\n    *\n    * @param Smarty_Internal_Template $_template template object\n    * @param string $content content to cache\n    * @return boolean success\n    */\n    public function write(Smarty_Internal_Template $_template, $content)\n    {\n        if (!$_template->source->recompiled) {\n            if ($this->handler->writeCachedContent($_template, $content)) {\n                $this->timestamp = time();\n                $this->exists = true;\n                $this->valid = true;\n                if ($_template->smarty->cache_locking) {\n                    $this->handler->releaseLock($_template->smarty, $this);\n                }\n                return true;\n            }\n        }\n        return false;\n    }\n\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_cacheresource_custom.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin\n *\n * @package Smarty\n * @subpackage Cacher\n */\n\n/**\n * Cache Handler API\n *\n * @package Smarty\n * @subpackage Cacher\n * @author Rodney Rehm\n */\nabstract class Smarty_CacheResource_Custom extends Smarty_CacheResource {\n\n    /**\n     * fetch cached content and its modification time from data source\n     *\n     * @param string $id         unique cache content identifier\n     * @param string $name       template name\n     * @param string $cache_id   cache id\n     * @param string $compile_id compile id\n     * @param string $content    cached content\n     * @param integer $mtime cache modification timestamp (epoch)\n     * @return void\n     */\n    protected abstract function fetch($id, $name, $cache_id, $compile_id, &$content, &$mtime);\n\n    /**\n     * Fetch cached content's modification timestamp from data source\n     *\n     * {@internal implementing this method is optional.\n     *  Only implement it if modification times can be accessed faster than loading the complete cached content.}}\n     *\n     * @param string $id         unique cache content identifier\n     * @param string $name       template name\n     * @param string $cache_id   cache id\n     * @param string $compile_id compile id\n     * @return integer|boolean timestamp (epoch) the template was modified, or false if not found\n     */\n    protected function fetchTimestamp($id, $name, $cache_id, $compile_id)\n    {\n        return null;\n    }\n\n    /**\n     * Save content to cache\n     *\n     * @param string       $id         unique cache content identifier\n     * @param string       $name       template name\n     * @param string       $cache_id   cache id\n     * @param string       $compile_id compile id\n     * @param integer|null $exp_time   seconds till expiration or null\n     * @param string $content content to cache\n     * @return boolean success\n     */\n    protected abstract function save($id, $name, $cache_id, $compile_id, $exp_time, $content);\n\n    /**\n     * Delete content from cache\n     *\n     * @param string       $name       template name\n     * @param string       $cache_id   cache id\n     * @param string       $compile_id compile id\n     * @param integer|null $exp_time   seconds till expiration time in seconds or null\n     * @return integer number of deleted caches\n     */\n    protected abstract function delete($name, $cache_id, $compile_id, $exp_time);\n\n    /**\n     * populate Cached Object with meta data from Resource\n     *\n     * @param Smarty_Template_Cached   $cached    cached object\n     * @param Smarty_Internal_Template $_template template object\n     * @return void\n     */\n    public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template)\n    {\n        $_cache_id = isset($cached->cache_id) ? preg_replace('![^\\w\\|]+!', '_', $cached->cache_id) : null;\n        $_compile_id = isset($cached->compile_id) ? preg_replace('![^\\w\\|]+!', '_', $cached->compile_id) : null;\n\n        $cached->filepath = sha1($cached->source->filepath . $_cache_id . $_compile_id);\n        $this->populateTimestamp($cached);\n    }\n\n    /**\n     * populate Cached Object with timestamp and exists from Resource\n     *\n     * @param Smarty_Template_Cached $source cached object\n     * @return void\n     */\n    public function populateTimestamp(Smarty_Template_Cached $cached)\n    {\n        $mtime = $this->fetchTimestamp($cached->filepath, $cached->source->name, $cached->cache_id, $cached->compile_id);\n        if ($mtime !== null) {\n            $cached->timestamp = $mtime;\n            $cached->exists = !!$cached->timestamp;\n            return;\n        }\n        $timestamp = null;\n        $this->fetch($cached->filepath, $cached->source->name, $cached->cache_id, $cached->compile_id, $cached->content, $timestamp);\n        $cached->timestamp = isset($timestamp) ? $timestamp : false;\n        $cached->exists = !!$cached->timestamp;\n    }\n\n    /**\n     * Read the cached template and process the header\n     *\n     * @param Smarty_Internal_Template $_template template object\n     * @param Smarty_Template_Cached $cached cached object\n     * @return booelan true or false if the cached content does not exist\n     */\n    public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached=null)\n    {\n        if (!$cached) {\n            $cached = $_template->cached;\n        }\n        $content = $cached->content ? $cached->content : null;\n        $timestamp = $cached->timestamp ? $cached->timestamp : null;\n        if ($content === null || !$timestamp) {\n            $this->fetch(\n                $_template->cached->filepath,\n                $_template->source->name,\n                $_template->cache_id,\n                $_template->compile_id,\n                $content,\n                $timestamp\n            );\n        }\n        if (isset($content)) {\n            $_smarty_tpl = $_template;\n            eval(\"?>\" . $content);\n            return true;\n        }\n        return false;\n    }\n\n    /**\n     * Write the rendered template output to cache\n     *\n     * @param Smarty_Internal_Template $_template template object\n     * @param string                   $content   content to cache\n     * @return boolean success\n     */\n    public function writeCachedContent(Smarty_Internal_Template $_template, $content)\n    {\n        return $this->save(\n            $_template->cached->filepath,\n            $_template->source->name,\n            $_template->cache_id,\n            $_template->compile_id,\n            $_template->properties['cache_lifetime'],\n            $content\n        );\n    }\n\n    /**\n     * Empty cache\n     *\n     * @param Smarty  $smarty   Smarty object\n     * @param integer $exp_time expiration time (number of seconds, not timestamp)\n     * @return integer number of cache files deleted\n     */\n    public function clearAll(Smarty $smarty, $exp_time=null)\n    {\n        $this->cache = array();\n        return $this->delete(null, null, null, $exp_time);\n    }\n\n    /**\n     * Empty cache for a specific template\n     *\n     * @param Smarty  $smarty        Smarty object\n     * @param string  $resource_name template name\n     * @param string  $cache_id      cache id\n     * @param string  $compile_id    compile id\n     * @param integer $exp_time      expiration time (number of seconds, not timestamp)\n     * @return integer number of cache files deleted\n     */\n    public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)\n    {\n        $this->cache = array();\n        return $this->delete($resource_name, $cache_id, $compile_id, $exp_time);\n    }\n    \n    /**\n     * Check is cache is locked for this template\n     *\n     * @param Smarty $smarty Smarty object\n     * @param Smarty_Template_Cached $cached cached object\n     * @return booelan true or false if cache is locked\n     */\n    public function hasLock(Smarty $smarty, Smarty_Template_Cached $cached)\n    {\n        $id = $cached->filepath;\n        $name = $cached->source->name . '.lock';\n        \n        $mtime = $this->fetchTimestamp($id, $name, null, null);\n        if ($mtime === null) {\n            $this->fetch($id, $name, null, null, $content, $mtime);\n        }\n        \n        return $mtime && time() - $mtime < $smarty->locking_timeout;\n    }\n\n    /**\n     * Lock cache for this template\n     *\n     * @param Smarty $smarty Smarty object\n     * @param Smarty_Template_Cached $cached cached object\n     */\n    public function acquireLock(Smarty $smarty, Smarty_Template_Cached $cached)\n    {\n        $cached->is_locked = true;\n        \n        $id = $cached->filepath;\n        $name = $cached->source->name . '.lock';\n        $this->save($id, $name, null, null, $smarty->locking_timeout, '');\n    }\n\n    /**\n     * Unlock cache for this template\n     *\n     * @param Smarty $smarty Smarty object\n     * @param Smarty_Template_Cached $cached cached object\n     */\n    public function releaseLock(Smarty $smarty, Smarty_Template_Cached $cached)\n    {\n        $cached->is_locked = false;\n        \n        $id = $cached->filepath;\n        $name = $cached->source->name . '.lock';\n        $this->delete($name, null, null, null);\n    }\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_cacheresource_keyvaluestore.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin\n *\n * @package Smarty\n * @subpackage Cacher\n */\n\n/**\n * Smarty Cache Handler Base for Key/Value Storage Implementations\n *\n * This class implements the functionality required to use simple key/value stores\n * for hierarchical cache groups. key/value stores like memcache or APC do not support\n * wildcards in keys, therefore a cache group cannot be cleared like \"a|*\" - which\n * is no problem to filesystem and RDBMS implementations.\n *\n * This implementation is based on the concept of invalidation. While one specific cache\n * can be identified and cleared, any range of caches cannot be identified. For this reason\n * each level of the cache group hierarchy can have its own value in the store. These values\n * are nothing but microtimes, telling us when a particular cache group was cleared for the\n * last time. These keys are evaluated for every cache read to determine if the cache has\n * been invalidated since it was created and should hence be treated as inexistent.\n *\n * Although deep hierarchies are possible, they are not recommended. Try to keep your\n * cache groups as shallow as possible. Anything up 3-5 parents should be ok. So\n * »a|b|c« is a good depth where »a|b|c|d|e|f|g|h|i|j|k« isn't. Try to join correlating\n * cache groups: if your cache groups look somewhat like »a|b|$page|$items|$whatever«\n * consider using »a|b|c|$page-$items-$whatever« instead.\n *\n * @package Smarty\n * @subpackage Cacher\n * @author Rodney Rehm\n */\nabstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource {\n\n    /**\n     * cache for contents\n     * @var array\n     */\n    protected $contents = array();\n    /**\n     * cache for timestamps\n     * @var array\n     */\n    protected $timestamps = array();\n\n    /**\n     * populate Cached Object with meta data from Resource\n     *\n     * @param Smarty_Template_Cached   $cached    cached object\n     * @param Smarty_Internal_Template $_template template object\n     * @return void\n     */\n    public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template)\n    {\n        $cached->filepath = $_template->source->uid\n                . '#' . $this->sanitize($cached->source->name)\n                . '#' . $this->sanitize($cached->cache_id)\n                . '#' . $this->sanitize($cached->compile_id);\n\n        $this->populateTimestamp($cached);\n    }\n\n    /**\n     * populate Cached Object with timestamp and exists from Resource\n     *\n     * @param Smarty_Template_Cached $cached cached object\n     * @return void\n     */\n    public function populateTimestamp(Smarty_Template_Cached $cached)\n    {\n        if (!$this->fetch($cached->filepath, $cached->source->name, $cached->cache_id, $cached->compile_id, $content, $timestamp, $cached->source->uid)) {\n            return;\n        }\n        $cached->content = $content;\n        $cached->timestamp = (int) $timestamp;\n        $cached->exists = $cached->timestamp;\n    }\n\n    /**\n     * Read the cached template and process the header\n     *\n     * @param Smarty_Internal_Template $_template template object\n     * @param Smarty_Template_Cached $cached cached object\n     * @return booelan true or false if the cached content does not exist\n     */\n    public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached=null)\n    {\n        if (!$cached) {\n            $cached = $_template->cached;\n        }\n        $content = $cached->content ? $cached->content : null;\n        $timestamp = $cached->timestamp ? $cached->timestamp : null;\n        if ($content === null || !$timestamp) {\n            if (!$this->fetch($_template->cached->filepath, $_template->source->name, $_template->cache_id, $_template->compile_id, $content, $timestamp, $_template->source->uid)) {\n                return false;\n            }\n        }\n        if (isset($content)) {\n            $_smarty_tpl = $_template;\n            eval(\"?>\" . $content);\n            return true;\n        }\n        return false;\n    }\n\n    /**\n     * Write the rendered template output to cache\n     *\n     * @param Smarty_Internal_Template $_template template object\n     * @param string $content content to cache\n     * @return boolean success\n     */\n    public function writeCachedContent(Smarty_Internal_Template $_template, $content)\n    {\n        $this->addMetaTimestamp($content);\n        return $this->write(array($_template->cached->filepath => $content), $_template->properties['cache_lifetime']);\n    }\n\n    /**\n     * Empty cache\n     *\n     * {@internal the $exp_time argument is ignored altogether }}\n     *\n     * @param Smarty  $smarty   Smarty object\n     * @param integer $exp_time expiration time [being ignored]\n     * @return integer number of cache files deleted [always -1]\n     * @uses purge() to clear the whole store\n     * @uses invalidate() to mark everything outdated if purge() is inapplicable\n     */\n    public function clearAll(Smarty $smarty, $exp_time=null)\n    {\n        if (!$this->purge()) {\n            $this->invalidate(null);\n        }\n        return -1;\n    }\n\n    /**\n     * Empty cache for a specific template\n     *\n     * {@internal the $exp_time argument is ignored altogether}}\n     *\n     * @param Smarty  $smarty        Smarty object\n     * @param string  $resource_name template name\n     * @param string  $cache_id      cache id\n     * @param string  $compile_id    compile id\n     * @param integer $exp_time      expiration time [being ignored]\n     * @return integer number of cache files deleted [always -1]\n     * @uses buildCachedFilepath() to generate the CacheID\n     * @uses invalidate() to mark CacheIDs parent chain as outdated\n     * @uses delete() to remove CacheID from cache\n     */\n    public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)\n    {\n        $uid = $this->getTemplateUid($smarty, $resource_name, $cache_id, $compile_id);\n        $cid = $uid . '#' . $this->sanitize($resource_name) . '#' . $this->sanitize($cache_id) . '#' . $this->sanitize($compile_id);\n        $this->delete(array($cid));\n        $this->invalidate($cid, $resource_name, $cache_id, $compile_id, $uid);\n        return -1;\n    }\n    /**\n     * Get template's unique ID\n     *\n     * @param Smarty $smarty        Smarty object\n     * @param string $resource_name template name\n     * @param string $cache_id      cache id\n     * @param string $compile_id    compile id\n     * @return string filepath of cache file\n     */\n    protected function getTemplateUid(Smarty $smarty, $resource_name, $cache_id, $compile_id)\n    {\n        $uid = '';\n        if (isset($resource_name)) {\n            $tpl = new $smarty->template_class($resource_name, $smarty);\n            if ($tpl->source->exists) {\n                $uid = $tpl->source->uid;\n            }\n            \n            // remove from template cache\n            if ($smarty->allow_ambiguous_resources) {\n                $_templateId = $tpl->source->unique_resource . $tpl->cache_id . $tpl->compile_id;\n            } else {\n                $_templateId = $smarty->joined_template_dir . '#' . $resource_name . $tpl->cache_id . $tpl->compile_id;\n            }\n            if (isset($_templateId[150])) {\n                $_templateId = sha1($_templateId);\n            }\n            unset($smarty->template_objects[$_templateId]);\n        }\n        return $uid;\n    }\n\n    /**\n     * Sanitize CacheID components\n     *\n     * @param string $string CacheID component to sanitize\n     * @return string sanitized CacheID component\n     */\n    protected function sanitize($string)\n    {\n        // some poeple smoke bad weed\n        $string = trim($string, '|');\n        if (!$string) {\n            return null;\n        }\n        return preg_replace('#[^\\w\\|]+#S', '_', $string);\n    }\n\n    /**\n     * Fetch and prepare a cache object.\n     *\n     * @param string  $cid           CacheID to fetch\n     * @param string  $resource_name template name\n     * @param string  $cache_id      cache id\n     * @param string  $compile_id    compile id\n     * @param string  $content       cached content\n     * @param integer &$timestamp    cached timestamp (epoch)\n     * @param string  $resource_uid  resource's uid\n     * @return boolean success\n     */\n    protected function fetch($cid, $resource_name = null, $cache_id = null, $compile_id = null, &$content = null, &$timestamp = null, $resource_uid = null)\n    {\n        $t = $this->read(array($cid));\n        $content = !empty($t[$cid]) ? $t[$cid] : null;\n        $timestamp = null;\n\n        if ($content && ($timestamp = $this->getMetaTimestamp($content))) {\n            $invalidated = $this->getLatestInvalidationTimestamp($cid, $resource_name, $cache_id, $compile_id, $resource_uid);\n            if ($invalidated > $timestamp) {\n                $timestamp = null;\n                $content = null;\n            }\n        }\n\n        return !!$content;\n    }\n\n    /**\n     * Add current microtime to the beginning of $cache_content\n     *\n     * {@internal the header uses 8 Bytes, the first 4 Bytes are the seconds, the second 4 Bytes are the microseconds}}\n     *\n     * @param string &$content the content to be cached\n     */\n    protected function addMetaTimestamp(&$content)\n    {\n        $mt = explode(\" \", microtime());\n        $ts = pack(\"NN\", $mt[1], (int) ($mt[0] * 100000000));\n        $content = $ts . $content;\n    }\n\n    /**\n     * Extract the timestamp the $content was cached\n     *\n     * @param string &$content the cached content\n     * @return float the microtime the content was cached\n     */\n    protected function getMetaTimestamp(&$content)\n    {\n        $s = unpack(\"N\", substr($content, 0, 4));\n        $m = unpack(\"N\", substr($content, 4, 4));\n        $content = substr($content, 8);\n        return $s[1] + ($m[1] / 100000000);\n    }\n\n    /**\n     * Invalidate CacheID\n     *\n     * @param string $cid           CacheID\n     * @param string $resource_name template name\n     * @param string $cache_id      cache id\n     * @param string $compile_id    compile id\n     * @param string $resource_uid  source's uid\n     * @return void\n     */\n    protected function invalidate($cid = null, $resource_name = null, $cache_id = null, $compile_id = null, $resource_uid = null)\n    {\n        $now = microtime(true);\n        $key = null;\n        // invalidate everything\n        if (!$resource_name && !$cache_id && !$compile_id) {\n            $key = 'IVK#ALL';\n        }\n        // invalidate all caches by template\n        else if ($resource_name && !$cache_id && !$compile_id) {\n            $key = 'IVK#TEMPLATE#' . $resource_uid . '#' . $this->sanitize($resource_name);\n        }\n        // invalidate all caches by cache group\n        else if (!$resource_name && $cache_id && !$compile_id) {\n            $key = 'IVK#CACHE#' . $this->sanitize($cache_id);\n        }\n        // invalidate all caches by compile id\n        else if (!$resource_name && !$cache_id && $compile_id) {\n            $key = 'IVK#COMPILE#' . $this->sanitize($compile_id);\n        }\n        // invalidate by combination\n        else {\n            $key = 'IVK#CID#' . $cid;\n        }\n        $this->write(array($key => $now));\n    }\n\n    /**\n     * Determine the latest timestamp known to the invalidation chain\n     *\n     * @param string $cid           CacheID to determine latest invalidation timestamp of\n     * @param string $resource_name template name\n     * @param string $cache_id      cache id\n     * @param string $compile_id    compile id\n     * @param string $resource_uid  source's filepath\n     * @return float the microtime the CacheID was invalidated\n     */\n    protected function getLatestInvalidationTimestamp($cid, $resource_name = null, $cache_id = null, $compile_id = null, $resource_uid = null)\n    {\n        // abort if there is no CacheID\n        if (false && !$cid) {\n            return 0;\n        }\n        // abort if there are no InvalidationKeys to check\n        if (!($_cid = $this->listInvalidationKeys($cid, $resource_name, $cache_id, $compile_id, $resource_uid))) {\n            return 0;\n        }\n        \n        // there are no InValidationKeys\n        if (!($values = $this->read($_cid))) {\n            return 0;\n        }\n        // make sure we're dealing with floats\n        $values = array_map('floatval', $values);\n        return max($values);\n    }\n\n    /**\n     * Translate a CacheID into the list of applicable InvalidationKeys.\n     *\n     * Splits \"some|chain|into|an|array\" into array( '#clearAll#', 'some', 'some|chain', 'some|chain|into', ... )\n     *\n     * @param string $cid           CacheID to translate\n     * @param string $resource_name template name\n     * @param string $cache_id      cache id\n     * @param string $compile_id    compile id\n     * @param string $resource_uid  source's filepath\n     * @return array list of InvalidationKeys\n     * @uses $invalidationKeyPrefix to prepend to each InvalidationKey\n     */\n    protected function listInvalidationKeys($cid, $resource_name = null, $cache_id = null, $compile_id = null, $resource_uid = null)\n    {\n        $t = array('IVK#ALL');\n        $_name = $_compile = '#';\n        if ($resource_name) {\n            $_name .= $resource_uid . '#' . $this->sanitize($resource_name);\n            $t[] = 'IVK#TEMPLATE' . $_name;\n        }\n        if ($compile_id) {\n            $_compile .= $this->sanitize($compile_id);\n            $t[] = 'IVK#COMPILE' . $_compile;\n        }\n        $_name .= '#';\n        // some poeple smoke bad weed\n        $cid = trim($cache_id, '|');\n        if (!$cid) {\n            return $t;\n        }\n        $i = 0;\n        while (true) {\n            // determine next delimiter position\n            $i = strpos($cid, '|', $i);\n            // add complete CacheID if there are no more delimiters\n            if ($i === false) {\n                $t[] = 'IVK#CACHE#' . $cid;\n                $t[] = 'IVK#CID' . $_name . $cid . $_compile;\n                $t[] = 'IVK#CID' . $_name . $_compile;\n                break;\n            }\n            $part = substr($cid, 0, $i);\n            // add slice to list\n            $t[] = 'IVK#CACHE#' . $part;\n            $t[] = 'IVK#CID' . $_name . $part . $_compile;\n            // skip past delimiter position\n            $i++;\n        }\n        return $t;\n    }\n\n    /**\n     * Check is cache is locked for this template\n     *\n     * @param Smarty $smarty Smarty object\n     * @param Smarty_Template_Cached $cached cached object\n     * @return booelan true or false if cache is locked\n     */\n    public function hasLock(Smarty $smarty, Smarty_Template_Cached $cached)\n    {\n        $key = 'LOCK#' . $cached->filepath;\n        $data = $this->read(array($key));\n        return $data && time() - $data[$key] < $smarty->locking_timeout;\n    }\n\n    /**\n     * Lock cache for this template\n     *\n     * @param Smarty $smarty Smarty object\n     * @param Smarty_Template_Cached $cached cached object\n     */\n    public function acquireLock(Smarty $smarty, Smarty_Template_Cached $cached)\n    {\n        $cached->is_locked = true;\n        $key = 'LOCK#' . $cached->filepath;\n        $this->write(array($key => time()), $smarty->locking_timeout);\n    }\n\n    /**\n     * Unlock cache for this template\n     *\n     * @param Smarty $smarty Smarty object\n     * @param Smarty_Template_Cached $cached cached object\n     */\n    public function releaseLock(Smarty $smarty, Smarty_Template_Cached $cached)\n    {\n        $cached->is_locked = false;\n        $key = 'LOCK#' . $cached->filepath;\n        $this->delete(array($key));\n    }\n\n    /**\n     * Read values for a set of keys from cache\n     *\n     * @param array $keys list of keys to fetch\n     * @return array list of values with the given keys used as indexes\n     */\n    protected abstract function read(array $keys);\n\n    /**\n     * Save values for a set of keys to cache\n     *\n     * @param array $keys   list of values to save\n     * @param int   $expire expiration time\n     * @return boolean true on success, false on failure\n     */\n    protected abstract function write(array $keys, $expire=null);\n\n    /**\n     * Remove values from cache\n     *\n     * @param array $keys list of keys to delete\n     * @return boolean true on success, false on failure\n     */\n    protected abstract function delete(array $keys);\n\n    /**\n     * Remove *all* values from cache\n     *\n     * @return boolean true on success, false on failure\n     */\n    protected function purge()\n    {\n        return false;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_config_source.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin\n *\n * @package Smarty\n * @subpackage TemplateResources\n */\n\n/**\n * Smarty Resource Data Object\n *\n * Meta Data Container for Config Files\n *\n * @package Smarty\n * @subpackage TemplateResources\n * @author Rodney Rehm\n *\n * @property string $content\n * @property int    $timestamp\n * @property bool   $exists\n */\nclass Smarty_Config_Source extends Smarty_Template_Source {\n\n    /**\n     * create Config Object container\n     *\n     * @param Smarty_Resource $handler          Resource Handler this source object communicates with\n     * @param Smarty          $smarty           Smarty instance this source object belongs to\n     * @param string          $resource         full config_resource\n     * @param string          $type             type of resource\n     * @param string          $name             resource name\n     * @param string          $unique_resource  unqiue resource name\n     */\n    public function __construct(Smarty_Resource $handler, Smarty $smarty, $resource, $type, $name, $unique_resource)\n    {\n        $this->handler = $handler; // Note: prone to circular references\n\n        // Note: these may be ->config_compiler_class etc in the future\n        //$this->config_compiler_class = $handler->config_compiler_class;\n        //$this->config_lexer_class = $handler->config_lexer_class;\n        //$this->config_parser_class = $handler->config_parser_class;\n\n        $this->smarty = $smarty;\n        $this->resource = $resource;\n        $this->type = $type;\n        $this->name = $name;\n        $this->unique_resource = $unique_resource;\n    }\n\n    /**\n     * <<magic>> Generic setter.\n     *\n     * @param string $property_name valid: content, timestamp, exists\n     * @param mixed  $value         newly assigned value (not check for correct type)\n     * @throws SmartyException when the given property name is not valid\n     */\n    public function __set($property_name, $value)\n    {\n        switch ($property_name) {\n            case 'content':\n            case 'timestamp':\n            case 'exists':\n                $this->$property_name = $value;\n                break;\n\n            default:\n                throw new SmartyException(\"invalid config property '$property_name'.\");\n        }\n    }\n\n    /**\n     * <<magic>> Generic getter.\n     *\n     * @param string $property_name valid: content, timestamp, exists\n     * @throws SmartyException when the given property name is not valid\n     */\n    public function __get($property_name)\n    {\n        switch ($property_name) {\n            case 'timestamp':\n            case 'exists':\n                $this->handler->populateTimestamp($this);\n                return $this->$property_name;\n\n            case 'content':\n                return $this->content = $this->handler->getContent($this);\n\n            default:\n                throw new SmartyException(\"config property '$property_name' does not exist.\");\n        }\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_cacheresource_file.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin CacheResource File\n *\n * @package Smarty\n * @subpackage Cacher\n * @author Uwe Tews\n * @author Rodney Rehm\n */\n\n/**\n * This class does contain all necessary methods for the HTML cache on file system\n *\n * Implements the file system as resource for the HTML cache Version ussing nocache inserts.\n *\n * @package Smarty\n * @subpackage Cacher\n */\nclass Smarty_Internal_CacheResource_File extends Smarty_CacheResource {\n\n    /**\n     * populate Cached Object with meta data from Resource\n     *\n     * @param Smarty_Template_Cached   $cached    cached object\n     * @param Smarty_Internal_Template $_template template object\n     * @return void\n     */\n    public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template)\n    {\n        $_source_file_path = str_replace(':', '.', $_template->source->filepath);\n        $_cache_id = isset($_template->cache_id) ? preg_replace('![^\\w\\|]+!', '_', $_template->cache_id) : null;\n        $_compile_id = isset($_template->compile_id) ? preg_replace('![^\\w\\|]+!', '_', $_template->compile_id) : null;\n        $_filepath = $_template->source->uid;\n        // if use_sub_dirs, break file into directories\n        if ($_template->smarty->use_sub_dirs) {\n            $_filepath = substr($_filepath, 0, 2) . DS\n                . substr($_filepath, 2, 2) . DS\n                . substr($_filepath, 4, 2) . DS\n                . $_filepath;\n        }\n        $_compile_dir_sep = $_template->smarty->use_sub_dirs ? DS : '^';\n        if (isset($_cache_id)) {\n            $_cache_id = str_replace('|', $_compile_dir_sep, $_cache_id) . $_compile_dir_sep;\n        } else {\n            $_cache_id = '';\n        }\n        if (isset($_compile_id)) {\n            $_compile_id = $_compile_id . $_compile_dir_sep;\n        } else {\n            $_compile_id = '';\n        }\n        $_cache_dir = $_template->smarty->getCacheDir();\n        if ($_template->smarty->cache_locking) {\n            // create locking file name\n            // relative file name?\n            if (!preg_match('/^([\\/\\\\\\\\]|[a-zA-Z]:[\\/\\\\\\\\])/', $_cache_dir)) {\n                $_lock_dir = rtrim(getcwd(), '/\\\\') . DS . $_cache_dir;\n            } else {\n                $_lock_dir = $_cache_dir;\n            }\n            $cached->lock_id = $_lock_dir.sha1($_cache_id.$_compile_id.$_template->source->uid).'.lock';\n        }\n        $cached->filepath = $_cache_dir . $_cache_id . $_compile_id . $_filepath . '.' . basename($_source_file_path) . '.php';\n        $cached->timestamp = @filemtime($cached->filepath);\n        $cached->exists = !!$cached->timestamp;\n    }\n\n    /**\n     * populate Cached Object with timestamp and exists from Resource\n     *\n     * @param Smarty_Template_Cached $cached cached object\n     * @return void\n     */\n    public function populateTimestamp(Smarty_Template_Cached $cached)\n    {\n        $cached->timestamp = @filemtime($cached->filepath);\n        $cached->exists = !!$cached->timestamp;\n    }\n\n    /**\n     * Read the cached template and process its header\n     *\n     * @param Smarty_Internal_Template $_template template object\n     * @param Smarty_Template_Cached $cached cached object\n     * @return booelan true or false if the cached content does not exist\n     */\n    public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached=null)\n    {\n        $_smarty_tpl = $_template;\n        return @include $_template->cached->filepath;\n    }\n\n    /**\n     * Write the rendered template output to cache\n     *\n     * @param Smarty_Internal_Template $_template template object\n     * @param string                   $content   content to cache\n     * @return boolean success\n     */\n    public function writeCachedContent(Smarty_Internal_Template $_template, $content)\n    {\n        if (Smarty_Internal_Write_File::writeFile($_template->cached->filepath, $content, $_template->smarty) === true) {\n            $_template->cached->timestamp = filemtime($_template->cached->filepath);\n            $_template->cached->exists = !!$_template->cached->timestamp;\n            return true;\n        }\n        return false;\n    }\n\n    /**\n     * Empty cache\n     *\n     * @param Smarty_Internal_Template $_template template object\n     * @param integer                  $exp_time  expiration time (number of seconds, not timestamp)\n     * @return integer number of cache files deleted\n     */\n    public function clearAll(Smarty $smarty, $exp_time = null)\n    {\n        return $this->clear($smarty, null, null, null, $exp_time);\n    }\n\n    /**\n     * Empty cache for a specific template\n     *\n     * @param Smarty  $_template     template object\n     * @param string  $resource_name template name\n     * @param string  $cache_id      cache id\n     * @param string  $compile_id    compile id\n     * @param integer $exp_time      expiration time (number of seconds, not timestamp)\n     * @return integer number of cache files deleted\n    */\n    public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)\n    {\n        $_cache_id = isset($cache_id) ? preg_replace('![^\\w\\|]+!', '_', $cache_id) : null;\n        $_compile_id = isset($compile_id) ? preg_replace('![^\\w\\|]+!', '_', $compile_id) : null;\n        $_dir_sep = $smarty->use_sub_dirs ? '/' : '^';\n        $_compile_id_offset = $smarty->use_sub_dirs ? 3 : 0;\n        $_dir = $smarty->getCacheDir();\n        $_dir_length = strlen($_dir);\n        if (isset($_cache_id)) {\n            $_cache_id_parts = explode('|', $_cache_id);\n            $_cache_id_parts_count = count($_cache_id_parts);\n            if ($smarty->use_sub_dirs) {\n                foreach ($_cache_id_parts as $id_part) {\n                    $_dir .= $id_part . DS;\n                }\n            }\n        }\n        if (isset($resource_name)) {\n            $_save_stat = $smarty->caching;\n            $smarty->caching = true;\n            $tpl = new $smarty->template_class($resource_name, $smarty);\n            $smarty->caching = $_save_stat;\n\n            // remove from template cache\n            $tpl->source; // have the template registered before unset()\n            if ($smarty->allow_ambiguous_resources) {\n                $_templateId = $tpl->source->unique_resource . $tpl->cache_id . $tpl->compile_id;\n            } else {\n                $_templateId = $smarty->joined_template_dir . '#' . $resource_name . $tpl->cache_id . $tpl->compile_id;\n            }\n            if (isset($_templateId[150])) {\n                $_templateId = sha1($_templateId);\n            }\n            unset($smarty->template_objects[$_templateId]);\n\n            if ($tpl->source->exists) {\n                $_resourcename_parts = basename(str_replace('^', '/', $tpl->cached->filepath));\n            } else {\n                return 0;\n            }\n        }\n        $_count = 0;\n        $_time = time();\n        if (file_exists($_dir)) {\n            $_cacheDirs = new RecursiveDirectoryIterator($_dir);\n            $_cache = new RecursiveIteratorIterator($_cacheDirs, RecursiveIteratorIterator::CHILD_FIRST);\n            foreach ($_cache as $_file) {\n                if (substr($_file->getBasename(),0,1) == '.' || strpos($_file, '.svn') !== false) continue;\n                // directory ?\n                if ($_file->isDir()) {\n                    if (!$_cache->isDot()) {\n                        // delete folder if empty\n                        @rmdir($_file->getPathname());\n                    }\n                } else {\n                    $_parts = explode($_dir_sep, str_replace('\\\\', '/', substr((string)$_file, $_dir_length)));\n                    $_parts_count = count($_parts);\n                    // check name\n                    if (isset($resource_name)) {\n                        if ($_parts[$_parts_count-1] != $_resourcename_parts) {\n                            continue;\n                        }\n                    }\n                    // check compile id\n                    if (isset($_compile_id) && (!isset($_parts[$_parts_count-2 - $_compile_id_offset]) || $_parts[$_parts_count-2 - $_compile_id_offset] != $_compile_id)) {\n                        continue;\n                    }\n                    // check cache id\n                    if (isset($_cache_id)) {\n                        // count of cache id parts\n                        $_parts_count = (isset($_compile_id)) ? $_parts_count - 2 - $_compile_id_offset : $_parts_count - 1 - $_compile_id_offset;\n                        if ($_parts_count < $_cache_id_parts_count) {\n                            continue;\n                        }\n                        for ($i = 0; $i < $_cache_id_parts_count; $i++) {\n                            if ($_parts[$i] != $_cache_id_parts[$i]) continue 2;\n                        }\n                    }\n                    // expired ?\n                    if (isset($exp_time) && $_time - @filemtime($_file) < $exp_time) {\n                        continue;\n                    }\n                    $_count += @unlink((string) $_file) ? 1 : 0;\n                }\n            }\n        }\n        return $_count;\n    }\n\n    /**\n     * Check is cache is locked for this template\n     *\n     * @param Smarty $smarty Smarty object\n     * @param Smarty_Template_Cached $cached cached object\n     * @return booelan true or false if cache is locked\n     */\n    public function hasLock(Smarty $smarty, Smarty_Template_Cached $cached)\n    {\n        if (version_compare(PHP_VERSION, '5.3.0', '>=')) {\n            clearstatcache(true, $cached->lock_id);\n        } else {\n            clearstatcache();\n        }\n        $t = @filemtime($cached->lock_id);\n        return $t && (time() - $t < $smarty->locking_timeout);\n    }\n\n    /**\n     * Lock cache for this template\n     *\n     * @param Smarty $smarty Smarty object\n     * @param Smarty_Template_Cached $cached cached object\n     */\n    public function acquireLock(Smarty $smarty, Smarty_Template_Cached $cached)\n    {\n        $cached->is_locked = true;\n        touch($cached->lock_id);\n    }\n\n    /**\n     * Unlock cache for this template\n     *\n     * @param Smarty $smarty Smarty object\n     * @param Smarty_Template_Cached $cached cached object\n     */\n    public function releaseLock(Smarty $smarty, Smarty_Template_Cached $cached)\n    {\n        $cached->is_locked = false;\n        @unlink($cached->lock_id);\n    }\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_append.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Append\n *\n * Compiles the {append} tag\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Append Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Append extends Smarty_Internal_Compile_Assign {\n\n    /**\n     * Compiles code for the {append} tag\n     *\n     * @param array $args array with attributes from parser\n     * @param object $compiler compiler object\n     * @param array $parameter array with compilation parameter\n     * @return string compiled code\n     */\n    public function compile($args, $compiler, $parameter)\n    {\n        // the following must be assigned at runtime because it will be overwritten in parent class\n        $this->required_attributes = array('var', 'value');\n        $this->shorttag_order = array('var', 'value');\n        $this->optional_attributes = array('scope', 'index');\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n        // map to compile assign attributes\n        if (isset($_attr['index'])) {\n            $_params['smarty_internal_index'] = '[' . $_attr['index'] . ']';\n            unset($_attr['index']);\n        } else {\n            $_params['smarty_internal_index'] = '[]';\n        }\n        $_new_attr = array();\n        foreach ($_attr as $key => $value) {\n            $_new_attr[] = array($key => $value);\n        }\n        // call compile assign\n        return parent::compile($_new_attr, $compiler, $_params);\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_assign.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Assign\n *\n * Compiles the {assign} tag\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Assign Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase {\n\n    /**\n     * Compiles code for the {assign} tag\n     *\n     * @param array  $args      array with attributes from parser\n     * @param object $compiler  compiler object\n     * @param array  $parameter array with compilation parameter\n     * @return string compiled code\n     */\n    public function compile($args, $compiler, $parameter)\n    {\n        // the following must be assigned at runtime because it will be overwritten in Smarty_Internal_Compile_Append\n        $this->required_attributes = array('var', 'value');\n        $this->shorttag_order = array('var', 'value');\n        $this->optional_attributes = array('scope');\n        $_nocache = 'null';\n        $_scope = Smarty::SCOPE_LOCAL;\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n        // nocache ?\n        if ($compiler->tag_nocache || $compiler->nocache) {\n            $_nocache = 'true';\n            // create nocache var to make it know for further compiling\n            $compiler->template->tpl_vars[trim($_attr['var'], \"'\")] = new Smarty_variable(null, true);\n        }\n        // scope setup\n        if (isset($_attr['scope'])) {\n            $_attr['scope'] = trim($_attr['scope'], \"'\\\"\");\n            if ($_attr['scope'] == 'parent') {\n                $_scope = Smarty::SCOPE_PARENT;\n            } elseif ($_attr['scope'] == 'root') {\n                $_scope = Smarty::SCOPE_ROOT;\n            } elseif ($_attr['scope'] == 'global') {\n                $_scope = Smarty::SCOPE_GLOBAL;\n            } else {\n                $compiler->trigger_template_error('illegal value for \"scope\" attribute', $compiler->lex->taglineno);\n            }\n        }\n        // compiled output\n        if (isset($parameter['smarty_internal_index'])) {\n            $output = \"<?php \\$_smarty_tpl->createLocalArrayVariable($_attr[var], $_nocache, $_scope);\\n\\$_smarty_tpl->tpl_vars[$_attr[var]]->value$parameter[smarty_internal_index] = $_attr[value];\";\n        } else {\n            $output = \"<?php \\$_smarty_tpl->tpl_vars[$_attr[var]] = new Smarty_variable($_attr[value], $_nocache, $_scope);\";\n        }\n        if ($_scope == Smarty::SCOPE_PARENT) {\n            $output .= \"\\nif (\\$_smarty_tpl->parent != null) \\$_smarty_tpl->parent->tpl_vars[$_attr[var]] = clone \\$_smarty_tpl->tpl_vars[$_attr[var]];\";\n        } elseif ($_scope == Smarty::SCOPE_ROOT || $_scope == Smarty::SCOPE_GLOBAL) {\n            $output .= \"\\n\\$_ptr = \\$_smarty_tpl->parent; while (\\$_ptr != null) {\\$_ptr->tpl_vars[$_attr[var]] = clone \\$_smarty_tpl->tpl_vars[$_attr[var]]; \\$_ptr = \\$_ptr->parent; }\";\n        }\n        if ( $_scope == Smarty::SCOPE_GLOBAL) {\n            $output .= \"\\nSmarty::\\$global_tpl_vars[$_attr[var]] = clone \\$_smarty_tpl->tpl_vars[$_attr[var]];\";\n        }\n        $output .= '?>';\n        return $output;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_block.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Block\n *\n * Compiles the {block}{/block} tags\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Block Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase {\n\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $required_attributes = array('name');\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $shorttag_order = array('name', 'hide');\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $optional_attributes = array('hide');\n\n    /**\n     * Compiles code for the {block} tag\n     *\n     * @param array  $args     array with attributes from parser\n     * @param object $compiler compiler object\n     * @return boolean true\n     */\n    public function compile($args, $compiler)\n    {\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n        $save = array($_attr, $compiler->parser->current_buffer, $compiler->nocache, $compiler->smarty->merge_compiled_includes);\n        $this->openTag($compiler, 'block', $save);\n        if ($_attr['nocache'] == true) {\n            $compiler->nocache = true;\n        }\n        // set flag for {block} tag\n        $compiler->inheritance = true;\n        // must merge includes\n        $compiler->smarty->merge_compiled_includes = true;\n\n        $compiler->parser->current_buffer = new _smarty_template_buffer($compiler->parser);\n        $compiler->has_code = false;\n        return true;\n    }\n\n    /**\n     * Save or replace child block source by block name during parsing\n     *\n     * @param string $block_content     block source content\n     * @param string $block_tag         opening block tag\n     * @param object $template          template object\n     * @param string $filepath          filepath of template source\n     */\n    public static function saveBlockData($block_content, $block_tag, $template, $filepath)\n    {\n        $_rdl = preg_quote($template->smarty->right_delimiter);\n        $_ldl = preg_quote($template->smarty->left_delimiter);\n\n        if (0 == preg_match(\"!({$_ldl}block\\s+)(name=)?(\\w+|'.*'|\\\".*\\\")(\\s*?)?((append|prepend|nocache)?(\\s*)?(hide)?)?(\\s*{$_rdl})!\", $block_tag, $_match)) {\n            $error_text = 'Syntax Error in template \"' . $template->source->filepath . '\"   \"' . htmlspecialchars($block_tag) . '\" illegal options';\n            throw new SmartyCompilerException($error_text);\n        } else {\n            $_name = trim($_match[3], '\\'\"');\n            if ($_match[8] != 'hide' || isset($template->block_data[$_name])) {        // replace {$smarty.block.child}\n                if (strpos($block_content, $template->smarty->left_delimiter . '$smarty.block.child' . $template->smarty->right_delimiter) !== false) {\n                    if (isset($template->block_data[$_name])) {\n                        $block_content = str_replace($template->smarty->left_delimiter . '$smarty.block.child' . $template->smarty->right_delimiter,\n                        $template->block_data[$_name]['source'], $block_content);\n                        unset($template->block_data[$_name]);\n                    } else {\n                        $block_content = str_replace($template->smarty->left_delimiter . '$smarty.block.child' . $template->smarty->right_delimiter,\n                        '', $block_content);\n                    }\n                }\n                if (isset($template->block_data[$_name])) {\n                    if (strpos($template->block_data[$_name]['source'], '%%%%SMARTY_PARENT%%%%') !== false) {\n                        $template->block_data[$_name]['source'] =\n                        str_replace('%%%%SMARTY_PARENT%%%%', $block_content, $template->block_data[$_name]['source']);\n                    } elseif ($template->block_data[$_name]['mode'] == 'prepend') {\n                        $template->block_data[$_name]['source'] .= $block_content;\n                    } elseif ($template->block_data[$_name]['mode'] == 'append') {\n                        $template->block_data[$_name]['source'] = $block_content . $template->block_data[$_name]['source'];\n                    }\n                } else {\n                    $template->block_data[$_name]['source'] = $block_content;\n                    $template->block_data[$_name]['file'] = $filepath;\n                }\n                if ($_match[6] == 'append') {\n                    $template->block_data[$_name]['mode'] = 'append';\n                } elseif ($_match[6] == 'prepend') {\n                    $template->block_data[$_name]['mode'] = 'prepend';\n                } else {\n                    $template->block_data[$_name]['mode'] = 'replace';\n                }\n            }\n        }\n    }\n\n    /**\n     * Compile saved child block source\n     *\n     * @param object $compiler  compiler object\n     * @param string $_name     optional name of child block\n     * @return string   compiled code of schild block\n     */\n    public static function compileChildBlock($compiler, $_name = null)\n    {\n        $_output = '';\n        // if called by {$smarty.block.child} we must search the name of enclosing {block}\n        if ($_name == null) {\n            $stack_count = count($compiler->_tag_stack);\n            while (--$stack_count >= 0) {\n                if ($compiler->_tag_stack[$stack_count][0] == 'block') {\n                    $_name = trim($compiler->_tag_stack[$stack_count][1][0]['name'] ,\"'\\\"\");\n                    break;\n                }\n            }\n            // flag that child is already compile by {$smarty.block.child} inclusion\n            $compiler->template->block_data[$_name]['compiled'] = true;\n        }\n        if ($_name == null) {\n            $compiler->trigger_template_error('{$smarty.block.child} used out of context', $compiler->lex->taglineno);\n        }\n        // undefined child?\n        if (!isset($compiler->template->block_data[$_name]['source'])) {\n            return '';\n        }\n        $_tpl = new Smarty_Internal_template ('string:' . $compiler->template->block_data[$_name]['source'], $compiler->smarty, $compiler->template, $compiler->template->cache_id,\n        $compiler->template->compile_id = null, $compiler->template->caching, $compiler->template->cache_lifetime);\n        $_tpl->variable_filters = $compiler->template->variable_filters;\n        $_tpl->properties['nocache_hash'] = $compiler->template->properties['nocache_hash'];\n        $_tpl->source->filepath = $compiler->template->block_data[$_name]['file'];\n        $_tpl->allow_relative_path = true;\n        if ($compiler->nocache) {\n            $_tpl->compiler->forceNocache = 2;\n        } else {\n            $_tpl->compiler->forceNocache = 1;\n        }\n        $_tpl->compiler->suppressHeader = true;\n        $_tpl->compiler->suppressTemplatePropertyHeader = true;\n        $_tpl->compiler->suppressMergedTemplates = true;\n        if (strpos($compiler->template->block_data[$_name]['source'], '%%%%SMARTY_PARENT%%%%') !== false) {\n            $_output = str_replace('%%%%SMARTY_PARENT%%%%', $compiler->parser->current_buffer->to_smarty_php(), $_tpl->compiler->compileTemplate($_tpl));\n        } elseif ($compiler->template->block_data[$_name]['mode'] == 'prepend') {\n            $_output = $_tpl->compiler->compileTemplate($_tpl) . $compiler->parser->current_buffer->to_smarty_php();\n        } elseif ($compiler->template->block_data[$_name]['mode'] == 'append') {\n            $_output = $compiler->parser->current_buffer->to_smarty_php() . $_tpl->compiler->compileTemplate($_tpl);\n        } elseif (!empty($compiler->template->block_data[$_name])) {\n            $_output = $_tpl->compiler->compileTemplate($_tpl);\n        }\n        $compiler->template->properties['file_dependency'] = array_merge($compiler->template->properties['file_dependency'], $_tpl->properties['file_dependency']);\n        $compiler->template->properties['function'] = array_merge($compiler->template->properties['function'], $_tpl->properties['function']);\n        $compiler->merged_templates = array_merge($compiler->merged_templates, $_tpl->compiler->merged_templates);\n        $compiler->template->variable_filters = $_tpl->variable_filters;\n        if ($_tpl->has_nocache_code) {\n            $compiler->template->has_nocache_code = true;\n        }\n        foreach($_tpl->required_plugins as $code => $tmp1) {\n            foreach($tmp1 as $name => $tmp) {\n                foreach($tmp as $type => $data) {\n                    $compiler->template->required_plugins[$code][$name][$type] = $data;\n                }\n            }\n        }\n        unset($_tpl);\n        return $_output;\n    }\n\n}\n\n/**\n * Smarty Internal Plugin Compile BlockClose Class\n *\n * @package Smarty\n * @subpackage Compiler\n*/\nclass Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase {\n\n    /**\n     * Compiles code for the {/block} tag\n     *\n     * @param array  $args     array with attributes from parser\n     * @param object $compiler compiler object\n     * @return string compiled code\n     */\n    public function compile($args, $compiler)\n    {\n        $compiler->has_code = true;\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n        $saved_data = $this->closeTag($compiler, array('block'));\n        $_name = trim($saved_data[0]['name'], \"\\\"'\");\n        if (isset($compiler->template->block_data[$_name]) && !isset($compiler->template->block_data[$_name]['compiled'])) {\n            $_output = Smarty_Internal_Compile_Block::compileChildBlock($compiler, $_name);\n        } else {\n            if (isset($saved_data[0]['hide']) && !isset($compiler->template->block_data[$_name]['source'])) {\n                $_output = '';\n            } else {\n                $_output = $compiler->parser->current_buffer->to_smarty_php();\n            }\n            unset ($compiler->template->block_data[$_name]['compiled']);\n        }\n        // reset flags\n        $compiler->parser->current_buffer = $saved_data[1];\n        $compiler->nocache = $saved_data[2];\n        $compiler->smarty->merge_compiled_includes = $saved_data[3];\n        // reset flag for {block} tag\n        $compiler->inheritance = false;\n        // $_output content has already nocache code processed\n        $compiler->suppressNocacheProcessing = true;\n        return $_output;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_break.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Break\n *\n * Compiles the {break} tag\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n/**\n * Smarty Internal Plugin Compile Break Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Break extends Smarty_Internal_CompileBase {\n\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $optional_attributes = array('levels');\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $shorttag_order = array('levels');\n\n    /**\n     * Compiles code for the {break} tag\n     *\n     * @param array  $args array with attributes from parser\n     * @param object $compiler   compiler object\n     * @param array  $parameter  array with compilation parameter\n     * @return string compiled code\n     */\n    public function compile($args, $compiler, $parameter)\n    {\n        static $_is_loopy = array('for' => true, 'foreach' => true, 'while' => true, 'section' => true);\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n\n        if ($_attr['nocache'] === true) {\n            $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);\n        }\n\n        if (isset($_attr['levels'])) {\n            if (!is_numeric($_attr['levels'])) {\n                $compiler->trigger_template_error('level attribute must be a numeric constant', $compiler->lex->taglineno);\n            }\n            $_levels = $_attr['levels'];\n        } else {\n            $_levels = 1;\n        }\n        $level_count = $_levels;\n        $stack_count = count($compiler->_tag_stack) - 1;\n        while ($level_count > 0 && $stack_count >= 0) {\n            if (isset($_is_loopy[$compiler->_tag_stack[$stack_count][0]])) {\n                $level_count--;\n            }\n            $stack_count--;\n        }\n        if ($level_count != 0) {\n            $compiler->trigger_template_error(\"cannot break {$_levels} level(s)\", $compiler->lex->taglineno);\n        }\n        $compiler->has_code = true;\n        return \"<?php break {$_levels}?>\";\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_call.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Function_Call\n *\n * Compiles the calls of user defined tags defined by {function}\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Function_Call Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Call extends Smarty_Internal_CompileBase {\n\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $required_attributes = array('name');\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $shorttag_order = array('name');\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $optional_attributes = array('_any');\n\n    /**\n     * Compiles the calls of user defined tags defined by {function}\n     *\n     * @param array  $args      array with attributes from parser\n     * @param object $compiler  compiler object\n     * @param array  $parameter array with compilation parameter\n     * @return string compiled code\n     */\n    public function compile($args, $compiler)\n    {\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n        // save possible attributes\n        if (isset($_attr['assign'])) {\n            // output will be stored in a smarty variable instead of beind displayed\n            $_assign = $_attr['assign'];\n        }\n        $_name = $_attr['name'];\n        if ($compiler->compiles_template_function) {\n            $compiler->called_functions[] = trim($_name, \"'\\\"\");\n        }\n        unset($_attr['name'], $_attr['assign'], $_attr['nocache']);\n        // set flag (compiled code of {function} must be included in cache file\n        if ($compiler->nocache || $compiler->tag_nocache) {\n            $_nocache = 'true';\n        } else {\n            $_nocache = 'false';\n        }\n        $_paramsArray = array();\n        foreach ($_attr as $_key => $_value) {\n            if (is_int($_key)) {\n                $_paramsArray[] = \"$_key=>$_value\";\n            } else {\n                $_paramsArray[] = \"'$_key'=>$_value\";\n            }\n        }\n        if (isset($compiler->template->properties['function'][$_name]['parameter'])) {\n            foreach ($compiler->template->properties['function'][$_name]['parameter'] as $_key => $_value) {\n                if (!isset($_attr[$_key])) {\n                    if (is_int($_key)) {\n                        $_paramsArray[] = \"$_key=>$_value\";\n                    } else {\n                        $_paramsArray[] = \"'$_key'=>$_value\";\n                    }\n                }\n            }\n        } elseif (isset($compiler->smarty->template_functions[$_name]['parameter'])) {\n            foreach ($compiler->smarty->template_functions[$_name]['parameter'] as $_key => $_value) {\n                if (!isset($_attr[$_key])) {\n                    if (is_int($_key)) {\n                        $_paramsArray[] = \"$_key=>$_value\";\n                    } else {\n                        $_paramsArray[] = \"'$_key'=>$_value\";\n                    }\n                }\n            }\n        }\n        //varibale name?\n        if (!(strpos($_name, '$') === false)) {\n            $call_cache = $_name;\n            $call_function = '$tmp = \"smarty_template_function_\".' . $_name . '; $tmp';\n        } else {\n            $_name = trim($_name, \"'\\\"\");\n            $call_cache = \"'{$_name}'\";\n            $call_function = 'smarty_template_function_' . $_name;\n        }\n\n        $_params = 'array(' . implode(\",\", $_paramsArray) . ')';\n        $_hash = str_replace('-', '_', $compiler->template->properties['nocache_hash']);\n        // was there an assign attribute\n        if (isset($_assign)) {\n            if ($compiler->template->caching) {\n                $_output = \"<?php ob_start(); Smarty_Internal_Function_Call_Handler::call ({$call_cache},\\$_smarty_tpl,{$_params},'{$_hash}',{$_nocache}); \\$_smarty_tpl->assign({$_assign}, ob_get_clean());?>\\n\";\n            } else {\n                $_output = \"<?php ob_start(); {$call_function}(\\$_smarty_tpl,{$_params}); \\$_smarty_tpl->assign({$_assign}, ob_get_clean());?>\\n\";\n            }\n        } else {\n            if ($compiler->template->caching) {\n                $_output = \"<?php Smarty_Internal_Function_Call_Handler::call ({$call_cache},\\$_smarty_tpl,{$_params},'{$_hash}',{$_nocache});?>\\n\";\n            } else {\n                $_output = \"<?php {$call_function}(\\$_smarty_tpl,{$_params});?>\\n\";\n            }\n        }\n        return $_output;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_capture.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Capture\n *\n * Compiles the {capture} tag\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Capture Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase {\n\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $shorttag_order = array('name');\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $optional_attributes = array('name', 'assign', 'append');\n\n    /**\n     * Compiles code for the {capture} tag\n     *\n     * @param array  $args     array with attributes from parser\n     * @param object $compiler compiler object\n     * @return string compiled code\n     */\n    public function compile($args, $compiler)\n    {\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n\n        $buffer = isset($_attr['name']) ? $_attr['name'] : \"'default'\";\n        $assign = isset($_attr['assign']) ? $_attr['assign'] : 'null';\n        $append = isset($_attr['append']) ? $_attr['append'] : 'null';\n\n        $compiler->_capture_stack[] = array($buffer, $assign, $append, $compiler->nocache);\n        // maybe nocache because of nocache variables\n        $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;\n        $_output = \"<?php \\$_smarty_tpl->_capture_stack[] = array($buffer, $assign, $append); ob_start(); ?>\";\n\n        return $_output;\n    }\n\n}\n\n/**\n * Smarty Internal Plugin Compile Captureclose Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase {\n\n    /**\n     * Compiles code for the {/capture} tag\n     *\n     * @param array  $args     array with attributes from parser\n     * @param object $compiler compiler object\n     * @return string compiled code\n     */\n    public function compile($args, $compiler)\n    {\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n        // must endblock be nocache?\n        if ($compiler->nocache) {\n            $compiler->tag_nocache = true;\n        }\n\n        list($buffer, $assign, $append, $compiler->nocache) = array_pop($compiler->_capture_stack);\n\n        $_output = \"<?php list(\\$_capture_buffer, \\$_capture_assign, \\$_capture_append) = array_pop(\\$_smarty_tpl->_capture_stack);\\n\";\n        $_output .= \"if (!empty(\\$_capture_buffer)) {\\n\";\n        $_output .= \" if (isset(\\$_capture_assign)) \\$_smarty_tpl->assign(\\$_capture_assign, ob_get_contents());\\n\";\n        $_output .= \" if (isset( \\$_capture_append)) \\$_smarty_tpl->append( \\$_capture_append, ob_get_contents());\\n\";\n        $_output .= \" Smarty::\\$_smarty_vars['capture'][\\$_capture_buffer]=ob_get_clean();\\n\";\n        $_output .= \"} else \\$_smarty_tpl->capture_error();?>\";\n        return $_output;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_config_load.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Config Load\n *\n * Compiles the {config load} tag\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Config Load Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase {\n\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $required_attributes = array('file');\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $shorttag_order = array('file','section');\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $optional_attributes = array('section', 'scope');\n\n    /**\n     * Compiles code for the {config_load} tag\n     *\n     * @param array  $args     array with attributes from parser\n     * @param object $compiler compiler object\n     * @return string compiled code\n     */\n    public function compile($args, $compiler)\n    {\n        static $_is_legal_scope = array('local' => true,'parent' => true,'root' => true,'global' => true);\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n\n        if ($_attr['nocache'] === true) {\n            $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);\n        }\n\n\n        // save posible attributes\n        $conf_file = $_attr['file'];\n        if (isset($_attr['section'])) {\n            $section = $_attr['section'];\n        } else {\n            $section = 'null';\n        }\n        $scope = 'local';\n        // scope setup\n        if (isset($_attr['scope'])) {\n            $_attr['scope'] = trim($_attr['scope'], \"'\\\"\");\n            if (isset($_is_legal_scope[$_attr['scope']])) {\n                $scope = $_attr['scope'];\n           } else {\n                $compiler->trigger_template_error('illegal value for \"scope\" attribute', $compiler->lex->taglineno);\n           }\n        }\n        // create config object\n        $_output = \"<?php  \\$_config = new Smarty_Internal_Config($conf_file, \\$_smarty_tpl->smarty, \\$_smarty_tpl);\";\n        $_output .= \"\\$_config->loadConfigVars($section, '$scope'); ?>\";\n        return $_output;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_continue.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Continue\n *\n * Compiles the {continue} tag\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Continue Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Continue extends Smarty_Internal_CompileBase {\n\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $optional_attributes = array('levels');\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $shorttag_order = array('levels');\n\n    /**\n     * Compiles code for the {continue} tag\n     *\n     * @param array  $args      array with attributes from parser\n     * @param object $compiler  compiler object\n     * @param array  $parameter array with compilation parameter\n     * @return string compiled code\n     */\n    public function compile($args, $compiler, $parameter)\n    {\n        static $_is_loopy = array('for' => true, 'foreach' => true, 'while' => true, 'section' => true);\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n\n        if ($_attr['nocache'] === true) {\n            $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);\n        }\n\n        if (isset($_attr['levels'])) {\n            if (!is_numeric($_attr['levels'])) {\n                $compiler->trigger_template_error('level attribute must be a numeric constant', $compiler->lex->taglineno);\n            }\n            $_levels = $_attr['levels'];\n        } else {\n            $_levels = 1;\n        }\n        $level_count = $_levels;\n        $stack_count = count($compiler->_tag_stack) - 1;\n        while ($level_count > 0 && $stack_count >= 0) {\n            if (isset($_is_loopy[$compiler->_tag_stack[$stack_count][0]])) {\n                $level_count--;\n            }\n            $stack_count--;\n        }\n        if ($level_count != 0) {\n            $compiler->trigger_template_error(\"cannot continue {$_levels} level(s)\", $compiler->lex->taglineno);\n        }\n        $compiler->has_code = true;\n        return \"<?php continue {$_levels}?>\";\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_debug.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Debug\n *\n * Compiles the {debug} tag.\n * It opens a window the the Smarty Debugging Console.\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Debug Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Debug extends Smarty_Internal_CompileBase {\n\n    /**\n     * Compiles code for the {debug} tag\n     *\n     * @param array  $args     array with attributes from parser\n     * @param object $compiler compiler object\n     * @return string compiled code\n     */\n    public function compile($args, $compiler)\n    {\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n\n        // compile always as nocache\n        $compiler->tag_nocache = true;\n\n        // display debug template\n        $_output = \"<?php \\$_smarty_tpl->smarty->loadPlugin('Smarty_Internal_Debug'); Smarty_Internal_Debug::display_debug(\\$_smarty_tpl); ?>\";\n        return $_output;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_eval.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Eval\n *\n * Compiles the {eval} tag.\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Eval Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Eval extends Smarty_Internal_CompileBase {\n\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $required_attributes = array('var');\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $optional_attributes = array('assign');\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $shorttag_order = array('var','assign');\n\n    /**\n     * Compiles code for the {eval} tag\n     *\n     * @param array  $args     array with attributes from parser\n     * @param object $compiler compiler object\n     * @return string compiled code\n     */\n    public function compile($args, $compiler)\n    {\n        $this->required_attributes = array('var');\n        $this->optional_attributes = array('assign');\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n        if (isset($_attr['assign'])) {\n              // output will be stored in a smarty variable instead of beind displayed\n            $_assign = $_attr['assign'];\n        }\n\n        // create template object\n        $_output = \"\\$_template = new {$compiler->smarty->template_class}('eval:'.\".$_attr['var'].\", \\$_smarty_tpl->smarty, \\$_smarty_tpl);\";\n        //was there an assign attribute?\n        if (isset($_assign)) {\n            $_output .= \"\\$_smarty_tpl->assign($_assign,\\$_template->fetch());\";\n        } else {\n            $_output .= \"echo \\$_template->fetch();\";\n        }\n        return \"<?php $_output ?>\";\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_extends.php",
    "content": "<?php\n\n/**\n* Smarty Internal Plugin Compile extend\n*\n* Compiles the {extends} tag\n*\n* @package Smarty\n* @subpackage Compiler\n* @author Uwe Tews\n*/\n\n/**\n* Smarty Internal Plugin Compile extend Class\n*\n* @package Smarty\n* @subpackage Compiler\n*/\nclass Smarty_Internal_Compile_Extends extends Smarty_Internal_CompileBase {\n\n    /**\n    * Attribute definition: Overwrites base class.\n    *\n    * @var array\n    * @see Smarty_Internal_CompileBase\n    */\n    public $required_attributes = array('file');\n    /**\n    * Attribute definition: Overwrites base class.\n    *\n    * @var array\n    * @see Smarty_Internal_CompileBase\n    */\n    public $shorttag_order = array('file');\n\n    /**\n    * Compiles code for the {extends} tag\n    *\n    * @param array  $args     array with attributes from parser\n    * @param object $compiler compiler object\n    * @return string compiled code\n    */\n    public function compile($args, $compiler)\n    {\n        static $_is_stringy = array('string' => true, 'eval' => true);\n        $this->_rdl = preg_quote($compiler->smarty->right_delimiter);\n        $this->_ldl = preg_quote($compiler->smarty->left_delimiter);\n        $filepath = $compiler->template->source->filepath;\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n        if ($_attr['nocache'] === true) {\n            $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);\n        }\n\n        $_smarty_tpl = $compiler->template;\n        $include_file = null;\n        if (strpos($_attr['file'], '$_tmp') !== false) {\n            $compiler->trigger_template_error('illegal value for file attribute', $compiler->lex->taglineno);\n        }\n        eval('$include_file = ' . $_attr['file'] . ';');\n        // create template object\n        $_template = new $compiler->smarty->template_class($include_file, $compiler->smarty, $compiler->template);\n        // save file dependency\n        if (isset($_is_stringy[$_template->source->type])) {\n            $template_sha1 = sha1($include_file);\n        } else {\n            $template_sha1 = sha1($_template->source->filepath);\n        }\n        if (isset($compiler->template->properties['file_dependency'][$template_sha1])) {\n            $compiler->trigger_template_error(\"illegal recursive call of \\\"{$include_file}\\\"\", $compiler->lex->line - 1);\n        }\n        $compiler->template->properties['file_dependency'][$template_sha1] = array($_template->source->filepath, $_template->source->timestamp, $_template->source->type);\n        $_content = substr($compiler->template->source->content, $compiler->lex->counter - 1);\n        if (preg_match_all(\"!({$this->_ldl}block\\s(.+?){$this->_rdl})!\", $_content, $s) !=\n        preg_match_all(\"!({$this->_ldl}/block{$this->_rdl})!\", $_content, $c)) {\n            $compiler->trigger_template_error('unmatched {block} {/block} pairs');\n        }\n        preg_match_all(\"!{$this->_ldl}block\\s(.+?){$this->_rdl}|{$this->_ldl}/block{$this->_rdl}|{$this->_ldl}\\*([\\S\\s]*?)\\*{$this->_rdl}!\", $_content, $_result, PREG_OFFSET_CAPTURE);\n        $_result_count = count($_result[0]);\n        $_start = 0;\n        while ($_start+1 < $_result_count) {\n            $_end = 0;\n            $_level = 1;\n            if (substr($_result[0][$_start][0],0,strlen($compiler->smarty->left_delimiter)+1) == $compiler->smarty->left_delimiter.'*') {\n                $_start++;\n                continue;\n            }\n            while ($_level != 0) {\n                $_end++;\n                if (substr($_result[0][$_start + $_end][0],0,strlen($compiler->smarty->left_delimiter)+1) == $compiler->smarty->left_delimiter.'*') {\n                    continue;\n                }\n                if (!strpos($_result[0][$_start + $_end][0], '/')) {\n                    $_level++;\n                } else {\n                    $_level--;\n                }\n            }\n            $_block_content = str_replace($compiler->smarty->left_delimiter . '$smarty.block.parent' . $compiler->smarty->right_delimiter, '%%%%SMARTY_PARENT%%%%',\n            substr($_content, $_result[0][$_start][1] + strlen($_result[0][$_start][0]), $_result[0][$_start + $_end][1] - $_result[0][$_start][1] - + strlen($_result[0][$_start][0])));\n            Smarty_Internal_Compile_Block::saveBlockData($_block_content, $_result[0][$_start][0], $compiler->template, $filepath);\n            $_start = $_start + $_end + 1;\n        }\n        if ($_template->source->type == 'extends') {\n            $_template->block_data = $compiler->template->block_data;\n        }\n        $compiler->template->source->content = $_template->source->content;\n        if ($_template->source->type == 'extends') {\n            $compiler->template->block_data = $_template->block_data;\n            foreach ($_template->source->components as $key => $component) {\n                $compiler->template->properties['file_dependency'][$key] = array($component->filepath, $component->timestamp, $component->type);\n            }\n        }\n        $compiler->template->source->filepath = $_template->source->filepath;\n        $compiler->abort_and_recompile = true;\n        return '';\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_for.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile For\n *\n * Compiles the {for} {forelse} {/for} tags\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile For Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase {\n\n    /**\n     * Compiles code for the {for} tag\n     *\n     * Smarty 3 does implement two different sytaxes:\n     *\n     * - {for $var in $array}\n     * For looping over arrays or iterators\n     *\n     * - {for $x=0; $x<$y; $x++}\n     * For general loops\n     *\n     * The parser is gereration different sets of attribute by which this compiler can\n     * determin which syntax is used.\n     *\n     * @param array  $args      array with attributes from parser\n     * @param object $compiler  compiler object\n     * @param array  $parameter array with compilation parameter\n     * @return string compiled code\n     */\n    public function compile($args, $compiler, $parameter)\n    {\n        if ($parameter == 0) {\n            $this->required_attributes = array('start', 'to');\n            $this->optional_attributes = array('max', 'step');\n        } else {\n            $this->required_attributes = array('start', 'ifexp', 'var', 'step');\n            $this->optional_attributes = array();\n        }\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n\n        $output = \"<?php \";\n        if ($parameter == 1) {\n            foreach ($_attr['start'] as $_statement) {\n                $output .= \" \\$_smarty_tpl->tpl_vars[$_statement[var]] = new Smarty_Variable;\";\n                $output .= \" \\$_smarty_tpl->tpl_vars[$_statement[var]]->value = $_statement[value];\\n\";\n            }\n            $output .= \"  if ($_attr[ifexp]){ for (\\$_foo=true;$_attr[ifexp]; \\$_smarty_tpl->tpl_vars[$_attr[var]]->value$_attr[step]){\\n\";\n        } else {\n            $_statement = $_attr['start'];\n            $output .= \"\\$_smarty_tpl->tpl_vars[$_statement[var]] = new Smarty_Variable;\";\n            if (isset($_attr['step'])) {\n                $output .= \"\\$_smarty_tpl->tpl_vars[$_statement[var]]->step = $_attr[step];\";\n            } else {\n                $output .= \"\\$_smarty_tpl->tpl_vars[$_statement[var]]->step = 1;\";\n            }\n            if (isset($_attr['max'])) {\n                $output .= \"\\$_smarty_tpl->tpl_vars[$_statement[var]]->total = (int)min(ceil((\\$_smarty_tpl->tpl_vars[$_statement[var]]->step > 0 ? $_attr[to]+1 - ($_statement[value]) : $_statement[value]-($_attr[to])+1)/abs(\\$_smarty_tpl->tpl_vars[$_statement[var]]->step)),$_attr[max]);\\n\";\n            } else {\n                $output .= \"\\$_smarty_tpl->tpl_vars[$_statement[var]]->total = (int)ceil((\\$_smarty_tpl->tpl_vars[$_statement[var]]->step > 0 ? $_attr[to]+1 - ($_statement[value]) : $_statement[value]-($_attr[to])+1)/abs(\\$_smarty_tpl->tpl_vars[$_statement[var]]->step));\\n\";\n            }\n            $output .= \"if (\\$_smarty_tpl->tpl_vars[$_statement[var]]->total > 0){\\n\";\n            $output .= \"for (\\$_smarty_tpl->tpl_vars[$_statement[var]]->value = $_statement[value], \\$_smarty_tpl->tpl_vars[$_statement[var]]->iteration = 1;\\$_smarty_tpl->tpl_vars[$_statement[var]]->iteration <= \\$_smarty_tpl->tpl_vars[$_statement[var]]->total;\\$_smarty_tpl->tpl_vars[$_statement[var]]->value += \\$_smarty_tpl->tpl_vars[$_statement[var]]->step, \\$_smarty_tpl->tpl_vars[$_statement[var]]->iteration++){\\n\";\n            $output .= \"\\$_smarty_tpl->tpl_vars[$_statement[var]]->first = \\$_smarty_tpl->tpl_vars[$_statement[var]]->iteration == 1;\";\n            $output .= \"\\$_smarty_tpl->tpl_vars[$_statement[var]]->last = \\$_smarty_tpl->tpl_vars[$_statement[var]]->iteration == \\$_smarty_tpl->tpl_vars[$_statement[var]]->total;\";\n        }\n        $output .= \"?>\";\n\n        $this->openTag($compiler, 'for', array('for', $compiler->nocache));\n        // maybe nocache because of nocache variables\n        $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;\n        // return compiled code\n        return $output;\n    }\n\n}\n\n/**\n * Smarty Internal Plugin Compile Forelse Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Forelse extends Smarty_Internal_CompileBase {\n\n    /**\n     * Compiles code for the {forelse} tag\n     *\n     * @param array  $args      array with attributes from parser\n     * @param object $compiler  compiler object\n     * @param array  $parameter array with compilation parameter\n     * @return string compiled code\n     */\n    public function compile($args, $compiler, $parameter)\n    {\n        // check and get attributes\n        $_attr  = $this->getAttributes($compiler, $args);\n\n        list($openTag, $nocache) = $this->closeTag($compiler, array('for'));\n        $this->openTag($compiler, 'forelse', array('forelse', $nocache));\n        return \"<?php }} else { ?>\";\n    }\n\n}\n\n/**\n * Smarty Internal Plugin Compile Forclose Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Forclose extends Smarty_Internal_CompileBase {\n\n    /**\n     * Compiles code for the {/for} tag\n     *\n     * @param array  $args      array with attributes from parser\n     * @param object $compiler  compiler object\n     * @param array  $parameter array with compilation parameter\n     * @return string compiled code\n     */\n    public function compile($args, $compiler, $parameter)\n    {\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n        // must endblock be nocache?\n        if ($compiler->nocache) {\n            $compiler->tag_nocache = true;\n        }\n\n        list($openTag, $compiler->nocache) = $this->closeTag($compiler, array('for', 'forelse'));\n\n        if ($openTag == 'forelse') {\n            return \"<?php }  ?>\";\n        } else {\n            return \"<?php }} ?>\";\n        }\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_foreach.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Foreach\n *\n * Compiles the {foreach} {foreachelse} {/foreach} tags\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Foreach Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Foreach extends Smarty_Internal_CompileBase {\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $required_attributes = array('from', 'item');\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $optional_attributes = array('name', 'key');\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $shorttag_order = array('from','item','key','name');\n\n    /**\n     * Compiles code for the {foreach} tag\n     *\n     * @param array  $args      array with attributes from parser\n     * @param object $compiler  compiler object\n     * @param array  $parameter array with compilation parameter\n     * @return string compiled code\n     */\n    public function compile($args, $compiler, $parameter)\n    {\n        $tpl = $compiler->template;\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n\n        $from = $_attr['from'];\n        $item = $_attr['item'];\n        if (!strncmp(\"\\$_smarty_tpl->tpl_vars[$item]\", $from, strlen($item) + 24)) {\n            $compiler->trigger_template_error(\"item variable {$item} may not be the same variable as at 'from'\", $compiler->lex->taglineno);\n        }\n\n        if (isset($_attr['key'])) {\n            $key = $_attr['key'];\n        } else {\n            $key = null;\n        }\n\n        $this->openTag($compiler, 'foreach', array('foreach', $compiler->nocache, $item, $key));\n        // maybe nocache because of nocache variables\n        $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;\n\n        if (isset($_attr['name'])) {\n            $name = $_attr['name'];\n            $has_name = true;\n            $SmartyVarName = '$smarty.foreach.' . trim($name, '\\'\"') . '.';\n        } else {\n            $name = null;\n            $has_name = false;\n        }\n        $ItemVarName = '$' . trim($item, '\\'\"') . '@';\n        // evaluates which Smarty variables and properties have to be computed\n        if ($has_name) {\n            $usesSmartyFirst = strpos($tpl->source->content, $SmartyVarName . 'first') !== false;\n            $usesSmartyLast = strpos($tpl->source->content, $SmartyVarName . 'last') !== false;\n            $usesSmartyIndex = strpos($tpl->source->content, $SmartyVarName . 'index') !== false;\n            $usesSmartyIteration = strpos($tpl->source->content, $SmartyVarName . 'iteration') !== false;\n            $usesSmartyShow = strpos($tpl->source->content, $SmartyVarName . 'show') !== false;\n            $usesSmartyTotal = strpos($tpl->source->content, $SmartyVarName . 'total') !== false;\n        } else {\n            $usesSmartyFirst = false;\n            $usesSmartyLast = false;\n            $usesSmartyTotal = false;\n            $usesSmartyShow = false;\n        }\n\n        $usesPropFirst = $usesSmartyFirst || strpos($tpl->source->content, $ItemVarName . 'first') !== false;\n        $usesPropLast = $usesSmartyLast || strpos($tpl->source->content, $ItemVarName . 'last') !== false;\n        $usesPropIndex = $usesPropFirst || strpos($tpl->source->content, $ItemVarName . 'index') !== false;\n        $usesPropIteration = $usesPropLast || strpos($tpl->source->content, $ItemVarName . 'iteration') !== false;\n        $usesPropShow = strpos($tpl->source->content, $ItemVarName . 'show') !== false;\n        $usesPropTotal = $usesSmartyTotal || $usesSmartyShow || $usesPropShow || $usesPropLast || strpos($tpl->source->content, $ItemVarName . 'total') !== false;\n        // generate output code\n        $output = \"<?php \";\n        $output .= \" \\$_smarty_tpl->tpl_vars[$item] = new Smarty_Variable; \\$_smarty_tpl->tpl_vars[$item]->_loop = false;\\n\";\n        if ($key != null) {\n            $output .= \" \\$_smarty_tpl->tpl_vars[$key] = new Smarty_Variable;\\n\";\n        }\n        $output .= \" \\$_from = $from; if (!is_array(\\$_from) && !is_object(\\$_from)) { settype(\\$_from, 'array');}\\n\";\n        if ($usesPropTotal) {\n            $output .= \" \\$_smarty_tpl->tpl_vars[$item]->total= \\$_smarty_tpl->_count(\\$_from);\\n\";\n        }\n        if ($usesPropIteration) {\n            $output .= \" \\$_smarty_tpl->tpl_vars[$item]->iteration=0;\\n\";\n        }\n        if ($usesPropIndex) {\n            $output .= \" \\$_smarty_tpl->tpl_vars[$item]->index=-1;\\n\";\n        }\n        if ($usesPropShow) {\n            $output .= \" \\$_smarty_tpl->tpl_vars[$item]->show = (\\$_smarty_tpl->tpl_vars[$item]->total > 0);\\n\";\n        }\n        if ($has_name) {\n            if ($usesSmartyTotal) {\n                $output .= \" \\$_smarty_tpl->tpl_vars['smarty']->value['foreach'][$name]['total'] = \\$_smarty_tpl->tpl_vars[$item]->total;\\n\";\n            }\n            if ($usesSmartyIteration) {\n                $output .= \" \\$_smarty_tpl->tpl_vars['smarty']->value['foreach'][$name]['iteration']=0;\\n\";\n            }\n            if ($usesSmartyIndex) {\n                $output .= \" \\$_smarty_tpl->tpl_vars['smarty']->value['foreach'][$name]['index']=-1;\\n\";\n            }\n            if ($usesSmartyShow) {\n                $output .= \" \\$_smarty_tpl->tpl_vars['smarty']->value['foreach'][$name]['show']=(\\$_smarty_tpl->tpl_vars[$item]->total > 0);\\n\";\n            }\n        }\n        $output .= \"foreach (\\$_from as \\$_smarty_tpl->tpl_vars[$item]->key => \\$_smarty_tpl->tpl_vars[$item]->value){\\n\\$_smarty_tpl->tpl_vars[$item]->_loop = true;\\n\";\n        if ($key != null) {\n            $output .= \" \\$_smarty_tpl->tpl_vars[$key]->value = \\$_smarty_tpl->tpl_vars[$item]->key;\\n\";\n        }\n        if ($usesPropIteration) {\n            $output .= \" \\$_smarty_tpl->tpl_vars[$item]->iteration++;\\n\";\n        }\n        if ($usesPropIndex) {\n            $output .= \" \\$_smarty_tpl->tpl_vars[$item]->index++;\\n\";\n        }\n        if ($usesPropFirst) {\n            $output .= \" \\$_smarty_tpl->tpl_vars[$item]->first = \\$_smarty_tpl->tpl_vars[$item]->index === 0;\\n\";\n        }\n        if ($usesPropLast) {\n            $output .= \" \\$_smarty_tpl->tpl_vars[$item]->last = \\$_smarty_tpl->tpl_vars[$item]->iteration === \\$_smarty_tpl->tpl_vars[$item]->total;\\n\";\n        }\n        if ($has_name) {\n            if ($usesSmartyFirst) {\n                $output .= \" \\$_smarty_tpl->tpl_vars['smarty']->value['foreach'][$name]['first'] = \\$_smarty_tpl->tpl_vars[$item]->first;\\n\";\n            }\n            if ($usesSmartyIteration) {\n                $output .= \" \\$_smarty_tpl->tpl_vars['smarty']->value['foreach'][$name]['iteration']++;\\n\";\n            }\n            if ($usesSmartyIndex) {\n                $output .= \" \\$_smarty_tpl->tpl_vars['smarty']->value['foreach'][$name]['index']++;\\n\";\n            }\n            if ($usesSmartyLast) {\n                $output .= \" \\$_smarty_tpl->tpl_vars['smarty']->value['foreach'][$name]['last'] = \\$_smarty_tpl->tpl_vars[$item]->last;\\n\";\n            }\n        }\n        $output .= \"?>\";\n\n        return $output;\n    }\n}\n\n/**\n * Smarty Internal Plugin Compile Foreachelse Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Foreachelse extends Smarty_Internal_CompileBase {\n\n    /**\n     * Compiles code for the {foreachelse} tag\n     *\n     * @param array  $args array with attributes from parser\n     * @param object $compiler compiler object\n     * @param array  $parameter array with compilation parameter\n     * @return string compiled code\n     */\n    public function compile($args, $compiler, $parameter)\n    {\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n\n        list($openTag, $nocache, $item, $key) = $this->closeTag($compiler, array('foreach'));\n        $this->openTag($compiler, 'foreachelse', array('foreachelse', $nocache, $item, $key));\n\n        return \"<?php }\\nif (!\\$_smarty_tpl->tpl_vars[$item]->_loop) {\\n?>\";\n    }\n\n}\n\n/**\n * Smarty Internal Plugin Compile Foreachclose Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Foreachclose extends Smarty_Internal_CompileBase {\n\n    /**\n     * Compiles code for the {/foreach} tag\n     *\n     * @param array  $args      array with attributes from parser\n     * @param object $compiler  compiler object\n     * @param array  $parameter array with compilation parameter\n     * @return string compiled code\n     */\n    public function compile($args, $compiler, $parameter)\n    {\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n        // must endblock be nocache?\n        if ($compiler->nocache) {\n            $compiler->tag_nocache = true;\n        }\n\n        list($openTag, $compiler->nocache, $item, $key) = $this->closeTag($compiler, array('foreach', 'foreachelse'));\n\n        return \"<?php } ?>\";\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_function.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Function\n *\n * Compiles the {function} {/function} tags\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Function Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase {\n\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $required_attributes = array('name');\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $shorttag_order = array('name');\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $optional_attributes = array('_any');\n\n    /**\n     * Compiles code for the {function} tag\n     *\n     * @param array $args array with attributes from parser\n     * @param object $compiler compiler object\n     * @param array $parameter array with compilation parameter\n     * @return boolean true\n     */\n    public function compile($args, $compiler, $parameter)\n    {\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n\n        if ($_attr['nocache'] === true) {\n            $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);\n        }\n        unset($_attr['nocache']);\n        $save = array($_attr, $compiler->parser->current_buffer,\n            $compiler->template->has_nocache_code, $compiler->template->required_plugins);\n        $this->openTag($compiler, 'function', $save);\n        $_name = trim($_attr['name'], \"'\\\"\");\n        unset($_attr['name']);\n        // set flag that we are compiling a template function\n        $compiler->compiles_template_function = true;\n        $compiler->template->properties['function'][$_name]['parameter'] = array();\n        $_smarty_tpl = $compiler->template;\n        foreach ($_attr as $_key => $_data) {\n            eval ('$tmp='.$_data.';');\n            $compiler->template->properties['function'][$_name]['parameter'][$_key] = $tmp;\n        }\n        $compiler->smarty->template_functions[$_name]['parameter'] = $compiler->template->properties['function'][$_name]['parameter'];\n        if ($compiler->template->caching) {\n            $output = '';\n        } else {\n            $output = \"<?php if (!function_exists('smarty_template_function_{$_name}')) {\n    function smarty_template_function_{$_name}(\\$_smarty_tpl,\\$params) {\n    \\$saved_tpl_vars = \\$_smarty_tpl->tpl_vars;\n    foreach (\\$_smarty_tpl->smarty->template_functions['{$_name}']['parameter'] as \\$key => \\$value) {\\$_smarty_tpl->tpl_vars[\\$key] = new Smarty_variable(\\$value);};\n    foreach (\\$params as \\$key => \\$value) {\\$_smarty_tpl->tpl_vars[\\$key] = new Smarty_variable(\\$value);}?>\";\n        }\n        // Init temporay context\n        $compiler->template->required_plugins = array('compiled' => array(), 'nocache' => array());\n        $compiler->parser->current_buffer = new _smarty_template_buffer($compiler->parser);\n        $compiler->parser->current_buffer->append_subtree(new _smarty_tag($compiler->parser, $output));\n        $compiler->template->has_nocache_code = false;\n        $compiler->has_code = false;\n        $compiler->template->properties['function'][$_name]['compiled'] = '';\n        return true;\n    }\n\n}\n\n/**\n * Smarty Internal Plugin Compile Functionclose Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase {\n\n    /**\n     * Compiles code for the {/function} tag\n     *\n     * @param array $args array with attributes from parser\n     * @param object $compiler compiler object\n     * @param array $parameter array with compilation parameter\n     * @return boolean true\n     */\n    public function compile($args, $compiler, $parameter)\n    {\n        $_attr = $this->getAttributes($compiler, $args);\n        $saved_data = $this->closeTag($compiler, array('function'));\n        $_name = trim($saved_data[0]['name'], \"'\\\"\");\n        // build plugin include code\n        $plugins_string = '';\n        if (!empty($compiler->template->required_plugins['compiled'])) {\n            $plugins_string = '<?php ';\n            foreach($compiler->template->required_plugins['compiled'] as $tmp) {\n                foreach($tmp as $data) {\n                    $plugins_string .= \"if (!is_callable('{$data['function']}')) include '{$data['file']}';\\n\";\n                }\n            }\n            $plugins_string .= '?>';\n        }\n        if (!empty($compiler->template->required_plugins['nocache'])) {\n            $plugins_string .= \"<?php echo '/*%%SmartyNocache:{$compiler->template->properties['nocache_hash']}%%*/<?php \";\n            foreach($compiler->template->required_plugins['nocache'] as $tmp) {\n                foreach($tmp as $data) {\n                    $plugins_string .= \"if (!is_callable(\\'{$data['function']}\\')) include \\'{$data['file']}\\';\\n\";\n                }\n            }\n            $plugins_string .= \"?>/*/%%SmartyNocache:{$compiler->template->properties['nocache_hash']}%%*/';?>\\n\";\n        }\n         // remove last line break from function definition\n         $last = count($compiler->parser->current_buffer->subtrees) - 1;\n         if ($compiler->parser->current_buffer->subtrees[$last] instanceof _smarty_linebreak) {\n             unset($compiler->parser->current_buffer->subtrees[$last]);\n         }\n        // if caching save template function for possible nocache call\n        if ($compiler->template->caching) {\n            $compiler->template->properties['function'][$_name]['compiled'] .= $plugins_string\n             . $compiler->parser->current_buffer->to_smarty_php();\n            $compiler->template->properties['function'][$_name]['nocache_hash'] = $compiler->template->properties['nocache_hash'];\n            $compiler->template->properties['function'][$_name]['has_nocache_code'] = $compiler->template->has_nocache_code;\n            $compiler->template->properties['function'][$_name]['called_functions'] = $compiler->called_functions;\n            $compiler->called_functions = array();\n            $compiler->smarty->template_functions[$_name] = $compiler->template->properties['function'][$_name];\n            $compiler->has_code = false;\n            $output = true;\n        } else {\n            $output = $plugins_string . $compiler->parser->current_buffer->to_smarty_php() . \"<?php \\$_smarty_tpl->tpl_vars = \\$saved_tpl_vars;}}?>\\n\";\n        }\n        // reset flag that we are compiling a template function\n        $compiler->compiles_template_function = false;\n        // restore old compiler status\n        $compiler->parser->current_buffer = $saved_data[1];\n        $compiler->template->has_nocache_code = $compiler->template->has_nocache_code | $saved_data[2];\n        $compiler->template->required_plugins = $saved_data[3];\n        return $output;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_if.php",
    "content": "<?php\n/**\n* Smarty Internal Plugin Compile If\n*\n* Compiles the {if} {else} {elseif} {/if} tags\n*\n* @package Smarty\n* @subpackage Compiler\n* @author Uwe Tews\n*/\n\n/**\n* Smarty Internal Plugin Compile If Class\n*\n* @package Smarty\n* @subpackage Compiler\n*/\nclass Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase {\n\n    /**\n    * Compiles code for the {if} tag\n    *\n    * @param array  $args       array with attributes from parser\n    * @param object $compiler   compiler object\n    * @param array  $parameter  array with compilation parameter\n    * @return string compiled code\n    */\n    public function compile($args, $compiler, $parameter)\n    {\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n        $this->openTag($compiler, 'if', array(1, $compiler->nocache));\n        // must whole block be nocache ?\n        $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;\n\n        if (!array_key_exists(\"if condition\",$parameter)) {\n            $compiler->trigger_template_error(\"missing if condition\", $compiler->lex->taglineno);\n        }\n\n        if (is_array($parameter['if condition'])) {\n            if ($compiler->nocache) {\n                $_nocache = ',true';\n                // create nocache var to make it know for further compiling\n                if (is_array($parameter['if condition']['var'])) {\n                    $compiler->template->tpl_vars[trim($parameter['if condition']['var']['var'], \"'\")] = new Smarty_variable(null, true);\n                } else {\n                    $compiler->template->tpl_vars[trim($parameter['if condition']['var'], \"'\")] = new Smarty_variable(null, true);\n                }\n            } else {\n                $_nocache = '';\n            }\n            if (is_array($parameter['if condition']['var'])) {\n                $_output = \"<?php if (!isset(\\$_smarty_tpl->tpl_vars[\".$parameter['if condition']['var']['var'].\"]) || !is_array(\\$_smarty_tpl->tpl_vars[\".$parameter['if condition']['var']['var'].\"]->value)) \\$_smarty_tpl->createLocalArrayVariable(\".$parameter['if condition']['var']['var'].\"$_nocache);\\n\";\n                $_output .= \"if (\\$_smarty_tpl->tpl_vars[\".$parameter['if condition']['var']['var'].\"]->value\".$parameter['if condition']['var']['smarty_internal_index'].\" = \".$parameter['if condition']['value'].\"){?>\";\n            } else {\n                $_output = \"<?php if (!isset(\\$_smarty_tpl->tpl_vars[\".$parameter['if condition']['var'].\"])) \\$_smarty_tpl->tpl_vars[\".$parameter['if condition']['var'].\"] = new Smarty_Variable(null{$_nocache});\";\n                $_output .= \"if (\\$_smarty_tpl->tpl_vars[\".$parameter['if condition']['var'].\"]->value = \".$parameter['if condition']['value'].\"){?>\";\n            }\n            return $_output;\n        } else {\n            return \"<?php if ({$parameter['if condition']}){?>\";\n        }\n    }\n\n}\n\n/**\n* Smarty Internal Plugin Compile Else Class\n*\n* @package Smarty\n* @subpackage Compiler\n*/\nclass Smarty_Internal_Compile_Else extends Smarty_Internal_CompileBase {\n\n    /**\n    * Compiles code for the {else} tag\n    *\n    * @param array  $args       array with attributes from parser\n    * @param object $compiler   compiler object\n    * @param array  $parameter  array with compilation parameter\n    * @return string compiled code\n    */\n    public function compile($args, $compiler, $parameter)\n    {\n        list($nesting, $compiler->tag_nocache) = $this->closeTag($compiler, array('if', 'elseif'));\n        $this->openTag($compiler, 'else', array($nesting, $compiler->tag_nocache));\n\n        return \"<?php }else{ ?>\";\n    }\n\n}\n\n/**\n* Smarty Internal Plugin Compile ElseIf Class\n*\n* @package Smarty\n* @subpackage Compiler\n*/\nclass Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase {\n\n    /**\n    * Compiles code for the {elseif} tag\n    *\n    * @param array  $args       array with attributes from parser\n    * @param object $compiler   compiler object\n    * @param array  $parameter  array with compilation parameter\n    * @return string compiled code\n    */\n    public function compile($args, $compiler, $parameter)\n    {\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n\n        list($nesting, $compiler->tag_nocache) = $this->closeTag($compiler, array('if', 'elseif'));\n\n        if (!array_key_exists(\"if condition\",$parameter)) {\n            $compiler->trigger_template_error(\"missing elseif condition\", $compiler->lex->taglineno);\n        }\n\n        if (is_array($parameter['if condition'])) {\n            $condition_by_assign = true;\n            if ($compiler->nocache) {\n                $_nocache = ',true';\n                // create nocache var to make it know for further compiling\n                if (is_array($parameter['if condition']['var'])) {\n                    $compiler->template->tpl_vars[trim($parameter['if condition']['var']['var'], \"'\")] = new Smarty_variable(null, true);\n                } else {\n                    $compiler->template->tpl_vars[trim($parameter['if condition']['var'], \"'\")] = new Smarty_variable(null, true);\n                }\n            } else {\n                $_nocache = '';\n            }\n        } else {\n            $condition_by_assign = false;\n        }\n\n        if (empty($compiler->prefix_code)) {\n            if ($condition_by_assign) {\n                $this->openTag($compiler, 'elseif', array($nesting + 1, $compiler->tag_nocache));\n                if (is_array($parameter['if condition']['var'])) {\n                    $_output = \"<?php }else{ if (!isset(\\$_smarty_tpl->tpl_vars[\" . $parameter['if condition']['var']['var'] . \"]) || !is_array(\\$_smarty_tpl->tpl_vars[\" . $parameter['if condition']['var']['var'] . \"]->value)) \\$_smarty_tpl->createLocalArrayVariable(\" . $parameter['if condition']['var']['var'] . \"$_nocache);\\n\";\n                    $_output .= \"if (\\$_smarty_tpl->tpl_vars[\" . $parameter['if condition']['var']['var'] . \"]->value\" . $parameter['if condition']['var']['smarty_internal_index'] . \" = \" . $parameter['if condition']['value'] . \"){?>\";\n                } else {\n                    $_output = \"<?php  }else{ if (!isset(\\$_smarty_tpl->tpl_vars[\" . $parameter['if condition']['var'] . \"])) \\$_smarty_tpl->tpl_vars[\" . $parameter['if condition']['var'] . \"] = new Smarty_Variable(null{$_nocache});\";\n                    $_output .= \"if (\\$_smarty_tpl->tpl_vars[\" . $parameter['if condition']['var'] . \"]->value = \" . $parameter['if condition']['value'] . \"){?>\";\n                }\n                return $_output;\n            } else {\n                $this->openTag($compiler, 'elseif', array($nesting, $compiler->tag_nocache));\n                return \"<?php }elseif({$parameter['if condition']}){?>\";\n            }\n        } else {\n            $tmp = '';\n            foreach ($compiler->prefix_code as $code)\n            $tmp .= $code;\n            $compiler->prefix_code = array();\n            $this->openTag($compiler, 'elseif', array($nesting + 1, $compiler->tag_nocache));\n            if ($condition_by_assign) {\n                if (is_array($parameter['if condition']['var'])) {\n                    $_output = \"<?php }else{?>{$tmp}<?php  if (!isset(\\$_smarty_tpl->tpl_vars[\" . $parameter['if condition']['var']['var'] . \"]) || !is_array(\\$_smarty_tpl->tpl_vars[\" . $parameter['if condition']['var']['var'] . \"]->value)) \\$_smarty_tpl->createLocalArrayVariable(\" . $parameter['if condition']['var']['var'] . \"$_nocache);\\n\";\n                    $_output .= \"if (\\$_smarty_tpl->tpl_vars[\" . $parameter['if condition']['var']['var'] . \"]->value\" . $parameter['if condition']['var']['smarty_internal_index'] . \" = \" . $parameter['if condition']['value'] . \"){?>\";\n                } else {\n                    $_output = \"<?php }else{?>{$tmp}<?php if (!isset(\\$_smarty_tpl->tpl_vars[\" . $parameter['if condition']['var'] . \"])) \\$_smarty_tpl->tpl_vars[\" . $parameter['if condition']['var'] . \"] = new Smarty_Variable(null{$_nocache});\";\n                    $_output .= \"if (\\$_smarty_tpl->tpl_vars[\" . $parameter['if condition']['var'] . \"]->value = \" . $parameter['if condition']['value'] . \"){?>\";\n                }\n                return $_output;\n            } else {\n                return \"<?php }else{?>{$tmp}<?php if ({$parameter['if condition']}){?>\";\n            }\n        }\n    }\n\n}\n\n/**\n* Smarty Internal Plugin Compile Ifclose Class\n*\n* @package Smarty\n* @subpackage Compiler\n*/\nclass Smarty_Internal_Compile_Ifclose extends Smarty_Internal_CompileBase {\n\n    /**\n    * Compiles code for the {/if} tag\n    *\n    * @param array  $args       array with attributes from parser\n    * @param object $compiler   compiler object\n    * @param array  $parameter  array with compilation parameter\n    * @return string compiled code\n    */\n    public function compile($args, $compiler, $parameter)\n    {\n        // must endblock be nocache?\n        if ($compiler->nocache) {\n            $compiler->tag_nocache = true;\n        }\n        list($nesting, $compiler->nocache) = $this->closeTag($compiler, array('if', 'else', 'elseif'));\n        $tmp = '';\n        for ($i = 0; $i < $nesting; $i++) {\n            $tmp .= '}';\n        }\n        return \"<?php {$tmp}?>\";\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_include.php",
    "content": "<?php\n/**\n* Smarty Internal Plugin Compile Include\n*\n* Compiles the {include} tag\n*\n* @package Smarty\n* @subpackage Compiler\n* @author Uwe Tews\n*/\n\n/**\n* Smarty Internal Plugin Compile Include Class\n*\n* @package Smarty\n* @subpackage Compiler\n*/\nclass Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {\n\n    /**\n    * caching mode to create nocache code but no cache file\n    */\n    const CACHING_NOCACHE_CODE = 9999;\n    /**\n    * Attribute definition: Overwrites base class.\n    *\n    * @var array\n    * @see Smarty_Internal_CompileBase\n    */\n    public $required_attributes = array('file');\n    /**\n    * Attribute definition: Overwrites base class.\n    *\n    * @var array\n    * @see Smarty_Internal_CompileBase\n    */\n    public $shorttag_order = array('file');\n    /**\n    * Attribute definition: Overwrites base class.\n    *\n    * @var array\n    * @see Smarty_Internal_CompileBase\n    */\n    public $option_flags = array('nocache', 'inline', 'caching');\n    /**\n    * Attribute definition: Overwrites base class.\n    *\n    * @var array\n    * @see Smarty_Internal_CompileBase\n    */\n    public $optional_attributes = array('_any');\n\n    /**\n    * Compiles code for the {include} tag\n    *\n     * @param array $args array with attributes from parser\n     * @param object $compiler compiler object\n     * @param array $parameter array with compilation parameter\n     * @return string compiled code\n     */\n    public function compile($args, $compiler, $parameter)\n    {\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n        // save posible attributes\n        $include_file = $_attr['file'];\n\n        if (isset($_attr['assign'])) {\n            // output will be stored in a smarty variable instead of beind displayed\n            $_assign = $_attr['assign'];\n        }\n\n        $_parent_scope = Smarty::SCOPE_LOCAL;\n        if (isset($_attr['scope'])) {\n            $_attr['scope'] = trim($_attr['scope'], \"'\\\"\");\n            if ($_attr['scope'] == 'parent') {\n                $_parent_scope = Smarty::SCOPE_PARENT;\n            } elseif ($_attr['scope'] == 'root') {\n                $_parent_scope = Smarty::SCOPE_ROOT;\n            } elseif ($_attr['scope'] == 'global') {\n                $_parent_scope = Smarty::SCOPE_GLOBAL;\n            }\n        }\n        $_caching = 'null';\n        if ($compiler->nocache || $compiler->tag_nocache) {\n            $_caching = Smarty::CACHING_OFF;\n        }\n        // default for included templates\n        if ($compiler->template->caching && !$compiler->nocache && !$compiler->tag_nocache) {\n            $_caching = self::CACHING_NOCACHE_CODE;\n        }\n        /*\n        * if the {include} tag provides individual parameter for caching\n        * it will not be included into the common cache file and treated like\n        * a nocache section\n        */\n        if (isset($_attr['cache_lifetime'])) {\n            $_cache_lifetime = $_attr['cache_lifetime'];\n            $compiler->tag_nocache = true;\n            $_caching = Smarty::CACHING_LIFETIME_CURRENT;\n        } else {\n            $_cache_lifetime = 'null';\n        }\n        if (isset($_attr['cache_id'])) {\n            $_cache_id = $_attr['cache_id'];\n            $compiler->tag_nocache = true;\n            $_caching = Smarty::CACHING_LIFETIME_CURRENT;\n        } else {\n            $_cache_id = '$_smarty_tpl->cache_id';\n        }\n        if (isset($_attr['compile_id'])) {\n            $_compile_id = $_attr['compile_id'];\n        } else {\n            $_compile_id = '$_smarty_tpl->compile_id';\n        }\n        if ($_attr['caching'] === true) {\n            $_caching = Smarty::CACHING_LIFETIME_CURRENT;\n        }\n        if ($_attr['nocache'] === true) {\n            $compiler->tag_nocache = true;\n            $_caching = Smarty::CACHING_OFF;\n        }\n\n        $has_compiled_template = false;\n        if (($compiler->smarty->merge_compiled_includes || $_attr['inline'] === true) && !$compiler->template->source->recompiled\n            && !($compiler->template->caching && ($compiler->tag_nocache || $compiler->nocache)) && $_caching != Smarty::CACHING_LIFETIME_CURRENT) {\n            // check if compiled code can be merged (contains no variable part)\n            if (!$compiler->has_variable_string && (substr_count($include_file, '\"') == 2 or substr_count($include_file, \"'\") == 2)\n               and substr_count($include_file, '(') == 0 and substr_count($include_file, '$_smarty_tpl->') == 0) {\n                $tpl_name = null;\n                eval(\"\\$tpl_name = $include_file;\");\n                if (!isset($compiler->smarty->merged_templates_func[$tpl_name]) || $compiler->inheritance) {\n                    $tpl = new $compiler->smarty->template_class ($tpl_name, $compiler->smarty, $compiler->template, $compiler->template->cache_id, $compiler->template->compile_id);\n                    // save unique function name\n                    $compiler->smarty->merged_templates_func[$tpl_name]['func'] = $tpl->properties['unifunc'] = 'content_'.uniqid('', false);\n                    // use current nocache hash for inlined code\n                    $compiler->smarty->merged_templates_func[$tpl_name]['nocache_hash'] = $tpl->properties['nocache_hash'] = $compiler->template->properties['nocache_hash'];\n                    if ($compiler->template->caching) {\n                        // needs code for cached page but no cache file\n                        $tpl->caching = self::CACHING_NOCACHE_CODE;\n                    }\n                    // make sure whole chain gest compiled\n                    $tpl->mustCompile = true;\n                    if (!($tpl->source->uncompiled) && $tpl->source->exists) {\n                        // get compiled code\n                        $compiled_code = $tpl->compiler->compileTemplate($tpl);\n                        // release compiler object to free memory\n                        unset($tpl->compiler);\n                        // merge compiled code for {function} tags\n                        $compiler->template->properties['function'] = array_merge($compiler->template->properties['function'], $tpl->properties['function']);\n                        // merge filedependency\n                        $tpl->properties['file_dependency'][$tpl->source->uid] = array($tpl->source->filepath, $tpl->source->timestamp,$tpl->source->type);\n                        $compiler->template->properties['file_dependency'] = array_merge($compiler->template->properties['file_dependency'], $tpl->properties['file_dependency']);\n                        // remove header code\n                        $compiled_code = preg_replace(\"/(<\\?php \\/\\*%%SmartyHeaderCode:{$tpl->properties['nocache_hash']}%%\\*\\/(.+?)\\/\\*\\/%%SmartyHeaderCode%%\\*\\/\\?>\\n)/s\", '', $compiled_code);\n                        if ($tpl->has_nocache_code) {\n                            // replace nocache_hash\n                            $compiled_code = preg_replace(\"/{$tpl->properties['nocache_hash']}/\", $compiler->template->properties['nocache_hash'], $compiled_code);\n                            $compiler->template->has_nocache_code = true;\n                        }\n                        $compiler->merged_templates[$tpl->properties['unifunc']] = $compiled_code;\n                        $has_compiled_template = true;\n                    }\n                } else {\n                    $has_compiled_template = true;\n                }\n            }\n        }\n        // delete {include} standard attributes\n        unset($_attr['file'], $_attr['assign'], $_attr['cache_id'], $_attr['compile_id'], $_attr['cache_lifetime'], $_attr['nocache'], $_attr['caching'], $_attr['scope'], $_attr['inline']);\n        // remaining attributes must be assigned as smarty variable\n        if (!empty($_attr)) {\n            if ($_parent_scope == Smarty::SCOPE_LOCAL) {\n                // create variables\n                foreach ($_attr as $key => $value) {\n                    $_pairs[] = \"'$key'=>$value\";\n                }\n                $_vars = 'array('.join(',',$_pairs).')';\n                $_has_vars = true;\n            } else {\n                $compiler->trigger_template_error('variable passing not allowed in parent/global scope', $compiler->lex->taglineno);\n            }\n        } else {\n            $_vars = 'array()';\n            $_has_vars = false;\n        }\n        if ($has_compiled_template) {\n            $_hash = $compiler->smarty->merged_templates_func[$tpl_name]['nocache_hash'];\n            $_output = \"<?php /*  Call merged included template \\\"\" . $tpl_name . \"\\\" */\\n\";\n            $_output .= \"\\$_tpl_stack[] = \\$_smarty_tpl;\\n\";\n            $_output .= \" \\$_smarty_tpl = \\$_smarty_tpl->setupInlineSubTemplate($include_file, $_cache_id, $_compile_id, $_caching, $_cache_lifetime, $_vars, $_parent_scope, '$_hash');\\n\";\n            if (isset($_assign)) {\n                $_output .= 'ob_start(); ';\n            }\n            $_output .= $compiler->smarty->merged_templates_func[$tpl_name]['func']. \"(\\$_smarty_tpl);\\n\";\n            $_output .= \"\\$_smarty_tpl = array_pop(\\$_tpl_stack); \";\n            if (isset($_assign)) {\n                $_output .= \" \\$_smarty_tpl->tpl_vars[$_assign] = new Smarty_variable(ob_get_clean());\";\n            }\n            $_output .= \"/*  End of included template \\\"\" . $tpl_name . \"\\\" */?>\";\n            return $_output;\n        }\n\n        // was there an assign attribute\n        if (isset($_assign)) {\n            $_output = \"<?php \\$_smarty_tpl->tpl_vars[$_assign] = new Smarty_variable(\\$_smarty_tpl->getSubTemplate ($include_file, $_cache_id, $_compile_id, $_caching, $_cache_lifetime, $_vars, $_parent_scope));?>\\n\";;\n        } else {\n            $_output = \"<?php echo \\$_smarty_tpl->getSubTemplate ($include_file, $_cache_id, $_compile_id, $_caching, $_cache_lifetime, $_vars, $_parent_scope);?>\\n\";\n        }\n        return $_output;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_include_php.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Include PHP\n *\n * Compiles the {include_php} tag\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Insert Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase {\n\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $required_attributes = array('file');\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $shorttag_order = array('file');\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $optional_attributes = array('once', 'assign');\n\n    /**\n     * Compiles code for the {include_php} tag\n     *\n     * @param array  $args     array with attributes from parser\n     * @param object $compiler compiler object\n     * @return string compiled code\n     */\n    public function compile($args, $compiler)\n    {\n        if (!($compiler->smarty instanceof SmartyBC)) {\n            throw new SmartyException(\"{include_php} is deprecated, use SmartyBC class to enable\");\n        }\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n\n        $_output = '<?php ';\n\n        $_smarty_tpl = $compiler->template;\n        $_filepath = false;\n        eval('$_file = ' . $_attr['file'] . ';');\n        if (!isset($compiler->smarty->security_policy) && file_exists($_file)) {\n            $_filepath = $_file;\n        } else {\n            if (isset($compiler->smarty->security_policy)) {\n                $_dir = $compiler->smarty->security_policy->trusted_dir;\n            } else {\n                $_dir = $compiler->smarty->trusted_dir;\n            }\n            if (!empty($_dir)) {\n                foreach((array)$_dir as $_script_dir) {\n                    $_script_dir = rtrim($_script_dir, '/\\\\') . DS;\n                    if (file_exists($_script_dir . $_file)) {\n                        $_filepath = $_script_dir .  $_file;\n                        break;\n                    }\n                }\n            }\n        }\n        if ($_filepath == false) {\n            $compiler->trigger_template_error(\"{include_php} file '{$_file}' is not readable\", $compiler->lex->taglineno);\n        }\n\n        if (isset($compiler->smarty->security_policy)) {\n            $compiler->smarty->security_policy->isTrustedPHPDir($_filepath);\n        }\n\n        if (isset($_attr['assign'])) {\n            // output will be stored in a smarty variable instead of being displayed\n            $_assign = $_attr['assign'];\n        }\n        $_once = '_once';\n        if (isset($_attr['once'])) {\n            if ($_attr['once'] == 'false') {\n                $_once = '';\n            }\n        }\n\n        if (isset($_assign)) {\n            return \"<?php ob_start(); include{$_once} ('{$_filepath}'); \\$_smarty_tpl->assign({$_assign},ob_get_contents()); ob_end_clean();?>\";\n        } else {\n            return \"<?php include{$_once} ('{$_filepath}');?>\\n\";\n        }\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_insert.php",
    "content": "<?php\n\n/**\n * Smarty Internal Plugin Compile Insert\n *\n * Compiles the {insert} tag\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Insert Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase {\n\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $required_attributes = array('name');\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $shorttag_order = array('name');\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $optional_attributes = array('_any');\n\n    /**\n     * Compiles code for the {insert} tag\n     *\n     * @param array  $args     array with attributes from parser\n     * @param object $compiler compiler object\n     * @return string compiled code\n     */\n    public function compile($args, $compiler)\n    {\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n        // never compile as nocache code\n        $compiler->suppressNocacheProcessing = true;\n        $compiler->tag_nocache = true;\n        $_smarty_tpl = $compiler->template;\n        $_name = null;\n        $_script = null;\n\n        $_output = '<?php ';\n        // save posible attributes\n        eval('$_name = ' . $_attr['name'] . ';');\n        if (isset($_attr['assign'])) {\n            // output will be stored in a smarty variable instead of being displayed\n            $_assign = $_attr['assign'];\n            // create variable to make shure that the compiler knows about its nocache status\n            $compiler->template->tpl_vars[trim($_attr['assign'], \"'\")] = new Smarty_Variable(null, true);\n        }\n        if (isset($_attr['script'])) {\n            // script which must be included\n            $_function = \"smarty_insert_{$_name}\";\n            $_smarty_tpl = $compiler->template;\n            $_filepath = false;\n            eval('$_script = ' . $_attr['script'] . ';');\n            if (!isset($compiler->smarty->security_policy) && file_exists($_script)) {\n                $_filepath = $_script;\n            } else {\n                if (isset($compiler->smarty->security_policy)) {\n                    $_dir = $compiler->smarty->security_policy->trusted_dir;\n                } else {\n                    $_dir = $compiler->smarty->trusted_dir;\n                }\n                if (!empty($_dir)) {\n                    foreach((array)$_dir as $_script_dir) {\n                        $_script_dir = rtrim($_script_dir, '/\\\\') . DS;\n                        if (file_exists($_script_dir . $_script)) {\n                            $_filepath = $_script_dir . $_script;\n                            break;\n                        }\n                    }\n                }\n            }\n            if ($_filepath == false) {\n                $compiler->trigger_template_error(\"{insert} missing script file '{$_script}'\", $compiler->lex->taglineno);\n            }\n            // code for script file loading\n            $_output .= \"require_once '{$_filepath}' ;\";\n            require_once $_filepath;\n            if (!is_callable($_function)) {\n                $compiler->trigger_template_error(\" {insert} function '{$_function}' is not callable in script file '{$_script}'\", $compiler->lex->taglineno);\n            }\n        } else {\n            $_filepath = 'null';\n            $_function = \"insert_{$_name}\";\n            // function in PHP script ?\n            if (!is_callable($_function)) {\n                // try plugin\n                if (!$_function = $compiler->getPlugin($_name, 'insert')) {\n                    $compiler->trigger_template_error(\"{insert} no function or plugin found for '{$_name}'\", $compiler->lex->taglineno);\n                }\n            }\n        }\n        // delete {insert} standard attributes\n        unset($_attr['name'], $_attr['assign'], $_attr['script'], $_attr['nocache']);\n        // convert attributes into parameter array string\n        $_paramsArray = array();\n        foreach ($_attr as $_key => $_value) {\n            $_paramsArray[] = \"'$_key' => $_value\";\n        }\n        $_params = 'array(' . implode(\", \", $_paramsArray) . ')';\n        // call insert\n        if (isset($_assign)) {\n            if ($_smarty_tpl->caching) {\n                $_output .= \"echo Smarty_Internal_Nocache_Insert::compile ('{$_function}',{$_params}, \\$_smarty_tpl, '{$_filepath}',{$_assign});?>\";\n            } else {\n                $_output .= \"\\$_smarty_tpl->assign({$_assign} , {$_function} ({$_params},\\$_smarty_tpl), true);?>\";\n            }\n        } else {\n            $compiler->has_output = true;\n            if ($_smarty_tpl->caching) {\n                $_output .= \"echo Smarty_Internal_Nocache_Insert::compile ('{$_function}',{$_params}, \\$_smarty_tpl, '{$_filepath}');?>\";\n            } else {\n                $_output .= \"echo {$_function}({$_params},\\$_smarty_tpl);?>\";\n            }\n        }\n        return $_output;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_ldelim.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Ldelim\n *\n * Compiles the {ldelim} tag\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Ldelim Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Ldelim extends Smarty_Internal_CompileBase {\n\n    /**\n     * Compiles code for the {ldelim} tag\n     *\n     * This tag does output the left delimiter\n     * @param array  $args     array with attributes from parser\n     * @param object $compiler compiler object\n     * @return string compiled code\n     */\n    public function compile($args, $compiler)\n    {\n        $_attr = $this->getAttributes($compiler, $args);\n        if ($_attr['nocache'] === true) {\n            $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);\n        }\n        // this tag does not return compiled code\n        $compiler->has_code = true;\n        return $compiler->smarty->left_delimiter;\n    }\n\n}\n\n?>\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_nocache.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Nocache\n *\n * Compiles the {nocache} {/nocache} tags.\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Nocache Classv\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Nocache extends Smarty_Internal_CompileBase {\n\n    /**\n     * Compiles code for the {nocache} tag\n     *\n     * This tag does not generate compiled output. It only sets a compiler flag.\n     *\n     * @param array  $args     array with attributes from parser\n     * @param object $compiler compiler object\n     * @return bool\n     */\n    public function compile($args, $compiler)\n    {\n        $_attr = $this->getAttributes($compiler, $args);\n        if ($_attr['nocache'] === true) {\n            $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);\n        }\n        // enter nocache mode\n        $compiler->nocache = true;\n        // this tag does not return compiled code\n        $compiler->has_code = false;\n        return true;\n    }\n\n}\n\n/**\n * Smarty Internal Plugin Compile Nocacheclose Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Nocacheclose extends Smarty_Internal_CompileBase {\n\n    /**\n     * Compiles code for the {/nocache} tag\n     *\n     * This tag does not generate compiled output. It only sets a compiler flag.\n     *\n     * @param array  $args     array with attributes from parser\n     * @param object $compiler compiler object\n     * @return bool\n     */\n    public function compile($args, $compiler)\n    {\n        $_attr = $this->getAttributes($compiler, $args);\n        // leave nocache mode\n        $compiler->nocache = false;\n        // this tag does not return compiled code\n        $compiler->has_code = false;\n        return true;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_private_block_plugin.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Block Plugin\n *\n * Compiles code for the execution of block plugin\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Block Plugin Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_CompileBase {\n\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $optional_attributes = array('_any');\n\n    /**\n     * Compiles code for the execution of block plugin\n     *\n     * @param array  $args      array with attributes from parser\n     * @param object $compiler  compiler object\n     * @param array  $parameter array with compilation parameter\n     * @param string $tag       name of block plugin\n     * @param string $function  PHP function name\n     * @return string compiled code\n     */\n    public function compile($args, $compiler, $parameter, $tag, $function)\n    {\n        if (!isset($tag[5]) || substr($tag, -5) != 'close') {\n            // opening tag of block plugin\n            // check and get attributes\n            $_attr = $this->getAttributes($compiler, $args);\n            if ($_attr['nocache'] === true) {\n                $compiler->tag_nocache = true;\n            }\n               unset($_attr['nocache']);\n            // convert attributes into parameter array string\n            $_paramsArray = array();\n            foreach ($_attr as $_key => $_value) {\n                if (is_int($_key)) {\n                    $_paramsArray[] = \"$_key=>$_value\";\n                } else {\n                    $_paramsArray[] = \"'$_key'=>$_value\";\n                }\n            }\n            $_params = 'array(' . implode(\",\", $_paramsArray) . ')';\n\n            $this->openTag($compiler, $tag, array($_params, $compiler->nocache));\n            // maybe nocache because of nocache variables or nocache plugin\n            $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;\n            // compile code\n            $output = \"<?php \\$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \\$_block_repeat=true; echo {$function}({$_params}, null, \\$_smarty_tpl, \\$_block_repeat);while (\\$_block_repeat) { ob_start();?>\";\n        } else {\n            // must endblock be nocache?\n            if ($compiler->nocache) {\n                $compiler->tag_nocache = true;\n            }\n            // closing tag of block plugin, restore nocache\n            list($_params, $compiler->nocache) = $this->closeTag($compiler, substr($tag, 0, -5));\n            // This tag does create output\n            $compiler->has_output = true;\n            // compile code\n            if (!isset($parameter['modifier_list'])) {\n                $mod_pre = $mod_post ='';\n            } else {\n                $mod_pre = ' ob_start(); ';\n                $mod_post = 'echo '.$compiler->compileTag('private_modifier',array(),array('modifierlist'=>$parameter['modifier_list'],'value'=>'ob_get_clean()')).';';\n            }\n            $output = \"<?php \\$_block_content = ob_get_clean(); \\$_block_repeat=false;\".$mod_pre.\" echo {$function}({$_params}, \\$_block_content, \\$_smarty_tpl, \\$_block_repeat); \".$mod_post.\" } array_pop(\\$_smarty_tpl->smarty->_tag_stack);?>\";\n        }\n        return $output . \"\\n\";\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_private_function_plugin.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Function Plugin\n *\n * Compiles code for the execution of function plugin\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Function Plugin Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_CompileBase {\n\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $required_attributes = array();\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $optional_attributes = array('_any');\n\n    /**\n     * Compiles code for the execution of function plugin\n     *\n     * @param array $args array with attributes from parser\n     * @param object $compiler compiler object\n     * @param array $parameter array with compilation parameter\n     * @param string $tag name of function plugin\n     * @param string $function PHP function name\n     * @return string compiled code\n     */\n    public function compile($args, $compiler, $parameter, $tag, $function)\n    {\n        // This tag does create output\n        $compiler->has_output = true;\n\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n        if ($_attr['nocache'] === true) {\n            $compiler->tag_nocache = true;\n        }\n        unset($_attr['nocache']);\n        // convert attributes into parameter array string\n        $_paramsArray = array();\n        foreach ($_attr as $_key => $_value) {\n            if (is_int($_key)) {\n                $_paramsArray[] = \"$_key=>$_value\";\n            } else {\n                $_paramsArray[] = \"'$_key'=>$_value\";\n            }\n        }\n        $_params = 'array(' . implode(\",\", $_paramsArray) . ')';\n        // compile code\n        $output = \"<?php echo {$function}({$_params},\\$_smarty_tpl);?>\\n\";\n        return $output;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_private_modifier.php",
    "content": "<?php\n\n/**\n * Smarty Internal Plugin Compile Modifier\n *\n * Compiles code for modifier execution\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Modifier Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBase {\n\n    /**\n     * Compiles code for modifier execution\n     *\n     * @param array  $args      array with attributes from parser\n     * @param object $compiler  compiler object\n     * @param array  $parameter array with compilation parameter\n     * @return string compiled code\n     */\n    public function compile($args, $compiler, $parameter)\n    {\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n        $output = $parameter['value'];\n        // loop over list of modifiers\n        foreach ($parameter['modifierlist'] as $single_modifier) {\n            $modifier = $single_modifier[0];\n            $single_modifier[0] = $output;\n            $params = implode(',', $single_modifier);\n            // check for registered modifier\n            if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier])) {\n                $function = $compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier][0];\n                if (!is_array($function)) {\n                    $output = \"{$function}({$params})\";\n                } else {\n                    if (is_object($function[0])) {\n                        $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\\'' . $modifier . '\\'][0][0]->' . $function[1] . '(' . $params . ')';\n                    } else {\n                        $output = $function[0] . '::' . $function[1] . '(' . $params . ')';\n                    }\n                }\n            } else if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0])) {\n                $output = call_user_func($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0], $single_modifier, $compiler->smarty);\n                // check for plugin modifiercompiler\n            } else if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) {\n                // check if modifier allowed\n                if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) {\n                    $plugin = 'smarty_modifiercompiler_' . $modifier;\n                    $output = $plugin($single_modifier, $compiler);\n                }\n                // check for plugin modifier\n            } else if ($function = $compiler->getPlugin($modifier, Smarty::PLUGIN_MODIFIER)) {\n                // check if modifier allowed\n                if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) {\n                    $output = \"{$function}({$params})\";\n                }\n                // check if trusted PHP function\n            } else if (is_callable($modifier)) {\n                // check if modifier allowed\n                if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler)) {\n                    $output = \"{$modifier}({$params})\";\n                }\n            } else {\n                $compiler->trigger_template_error(\"unknown modifier \\\"\" . $modifier . \"\\\"\", $compiler->lex->taglineno);\n            }\n        }\n        return $output;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_private_object_block_function.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Object Block Function\n *\n * Compiles code for registered objects as block function\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Object Block Function Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Private_Object_Block_Function extends Smarty_Internal_CompileBase {\n\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $optional_attributes = array('_any');\n\n    /**\n     * Compiles code for the execution of block plugin\n     *\n     * @param array  $args      array with attributes from parser\n     * @param object $compiler  compiler object\n     * @param array  $parameter array with compilation parameter\n     * @param string $tag       name of block object\n     * @param string $method    name of method to call\n     * @return string compiled code\n     */\n    public function compile($args, $compiler, $parameter, $tag, $method)\n    {\n        if (!isset($tag[5]) || substr($tag, -5) != 'close') {\n            // opening tag of block plugin\n            // check and get attributes\n            $_attr = $this->getAttributes($compiler, $args);\n            if ($_attr['nocache'] === true) {\n                $compiler->tag_nocache = true;\n            }\n            unset($_attr['nocache']);\n            // convert attributes into parameter array string\n            $_paramsArray = array();\n            foreach ($_attr as $_key => $_value) {\n                if (is_int($_key)) {\n                    $_paramsArray[] = \"$_key=>$_value\";\n                } else {\n                    $_paramsArray[] = \"'$_key'=>$_value\";\n                }\n            }\n            $_params = 'array(' . implode(\",\", $_paramsArray) . ')';\n\n            $this->openTag($compiler, $tag . '->' . $method, array($_params, $compiler->nocache));\n            // maybe nocache because of nocache variables or nocache plugin\n            $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;\n            // compile code\n            $output = \"<?php \\$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}->{$method}', {$_params}); \\$_block_repeat=true; echo \\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params}, null, \\$_smarty_tpl, \\$_block_repeat);while (\\$_block_repeat) { ob_start();?>\";\n        } else {\n            $base_tag = substr($tag, 0, -5);\n            // must endblock be nocache?\n            if ($compiler->nocache) {\n                $compiler->tag_nocache = true;\n            }\n            // closing tag of block plugin, restore nocache\n            list($_params, $compiler->nocache) = $this->closeTag($compiler, $base_tag . '->' . $method);\n            // This tag does create output\n            $compiler->has_output = true;\n            // compile code\n            if (!isset($parameter['modifier_list'])) {\n                $mod_pre = $mod_post = '';\n            } else {\n                $mod_pre = ' ob_start(); ';\n                $mod_post = 'echo ' . $compiler->compileTag('private_modifier', array(), array('modifierlist' => $parameter['modifier_list'], 'value' => 'ob_get_clean()')) . ';';\n            }\n            $output = \"<?php \\$_block_content = ob_get_contents(); ob_end_clean(); \\$_block_repeat=false;\" . $mod_pre . \" echo \\$_smarty_tpl->smarty->registered_objects['{$base_tag}'][0]->{$method}({$_params}, \\$_block_content, \\$_smarty_tpl, \\$_block_repeat); \" . $mod_post . \"  } array_pop(\\$_smarty_tpl->smarty->_tag_stack);?>\";\n        }\n        return $output . \"\\n\";\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_private_object_function.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Object Funtion\n *\n * Compiles code for registered objects as function\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Object Function Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_CompileBase {\n\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $optional_attributes = array('_any');\n\n    /**\n     * Compiles code for the execution of function plugin\n     *\n     * @param array  $args      array with attributes from parser\n     * @param object $compiler  compiler object\n     * @param array  $parameter array with compilation parameter\n     * @param string $tag       name of function\n     * @param string $method    name of method to call\n     * @return string compiled code\n     */\n    public function compile($args, $compiler, $parameter, $tag, $method)\n    {\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n        if ($_attr['nocache'] === true) {\n            $compiler->tag_nocache = true;\n        }\n        unset($_attr['nocache']);\n        $_assign = null;\n        if (isset($_attr['assign'])) {\n            $_assign = $_attr['assign'];\n            unset($_attr['assign']);\n        }\n        // convert attributes into parameter array string\n        if ($compiler->smarty->registered_objects[$tag][2]) {\n            $_paramsArray = array();\n            foreach ($_attr as $_key => $_value) {\n                if (is_int($_key)) {\n                    $_paramsArray[] = \"$_key=>$_value\";\n                } else {\n                    $_paramsArray[] = \"'$_key'=>$_value\";\n                }\n            }\n            $_params = 'array(' . implode(\",\", $_paramsArray) . ')';\n            $return = \"\\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params},\\$_smarty_tpl)\";\n        } else {\n            $_params = implode(\",\", $_attr);\n            $return = \"\\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params})\";\n        }\n        if (empty($_assign)) {\n            // This tag does create output\n            $compiler->has_output = true;\n            $output = \"<?php echo {$return};?>\\n\";\n        } else {\n            $output = \"<?php \\$_smarty_tpl->assign({$_assign},{$return});?>\\n\";\n        }\n        return $output;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_private_print_expression.php",
    "content": "<?php\n/**\n* Smarty Internal Plugin Compile Print Expression\n*\n* Compiles any tag which will output an expression or variable\n*\n* @package Smarty\n* @subpackage Compiler\n* @author Uwe Tews\n*/\n\n/**\n* Smarty Internal Plugin Compile Print Expression Class\n*\n* @package Smarty\n* @subpackage Compiler\n*/\nclass Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_CompileBase {\n\n    /**\n    * Attribute definition: Overwrites base class.\n    *\n    * @var array\n    * @see Smarty_Internal_CompileBase\n    */\n    public $optional_attributes = array('assign');\n    /**\n    * Attribute definition: Overwrites base class.\n    *\n    * @var array\n    * @see Smarty_Internal_CompileBase\n    */\n    public $option_flags = array('nocache', 'nofilter');\n\n    /**\n    * Compiles code for gererting output from any expression\n    *\n    * @param array  $args      array with attributes from parser\n    * @param object $compiler  compiler object\n    * @param array  $parameter array with compilation parameter\n    * @return string compiled code\n    */\n    public function compile($args, $compiler, $parameter)\n    {\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n        // nocache option\n        if ($_attr['nocache'] === true) {\n            $compiler->tag_nocache = true;\n        }\n        // filter handling\n        if ($_attr['nofilter'] === true) {\n            $_filter = 'false';\n        } else {\n            $_filter = 'true';\n        }\n        if (isset($_attr['assign'])) {\n            // assign output to variable\n            $output = \"<?php \\$_smarty_tpl->assign({$_attr['assign']},{$parameter['value']});?>\";\n        } else {\n            // display value\n            $output = $parameter['value'];\n            // tag modifier\n            if (!empty($parameter['modifierlist'])) {\n                $output = $compiler->compileTag('private_modifier', array(), array('modifierlist' => $parameter['modifierlist'], 'value' => $output));\n            }\n            if (!$_attr['nofilter']) {\n                // default modifier\n                if (!empty($compiler->smarty->default_modifiers)) {\n                    if (empty($compiler->default_modifier_list)) {\n                        $modifierlist = array();\n                        foreach ($compiler->smarty->default_modifiers as $key => $single_default_modifier) {\n                            preg_match_all('/(\\'[^\\'\\\\\\\\]*(?:\\\\\\\\.[^\\'\\\\\\\\]*)*\\'|\"[^\"\\\\\\\\]*(?:\\\\\\\\.[^\"\\\\\\\\]*)*\"|:|[^:]+)/', $single_default_modifier, $mod_array);\n                            for ($i = 0, $count = count($mod_array[0]);$i < $count;$i++) {\n                                if ($mod_array[0][$i] != ':') {\n                                    $modifierlist[$key][] = $mod_array[0][$i];\n                                }\n                            }\n                        }\n                        $compiler->default_modifier_list  = $modifierlist;\n                    }\n                    $output = $compiler->compileTag('private_modifier', array(), array('modifierlist' => $compiler->default_modifier_list, 'value' => $output));\n                }\n                // autoescape html\n                if ($compiler->template->smarty->escape_html) {\n                    $output = \"htmlspecialchars({$output}, ENT_QUOTES, SMARTY_RESOURCE_CHAR_SET)\";\n                }\n                // loop over registerd filters\n                if (!empty($compiler->template->smarty->registered_filters[Smarty::FILTER_VARIABLE])) {\n                    foreach ($compiler->template->smarty->registered_filters[Smarty::FILTER_VARIABLE] as $key => $function) {\n                        if (!is_array($function)) {\n                            $output = \"{$function}({$output},\\$_smarty_tpl)\";\n                        } else if (is_object($function[0])) {\n                            $output = \"\\$_smarty_tpl->smarty->registered_filters[Smarty::FILTER_VARIABLE][{$key}][0]->{$function[1]}({$output},\\$_smarty_tpl)\";\n                        } else {\n                            $output = \"{$function[0]}::{$function[1]}({$output},\\$_smarty_tpl)\";\n                        }\n                    }\n                }\n                // auto loaded filters\n                if (isset($compiler->smarty->autoload_filters[Smarty::FILTER_VARIABLE])) {\n                    foreach ((array)$compiler->template->smarty->autoload_filters[Smarty::FILTER_VARIABLE] as $name) {\n                        $result = $this->compile_output_filter($compiler, $name, $output);\n                        if ($result !== false) {\n                            $output = $result;\n                        } else {\n                            // not found, throw exception\n                            throw new SmartyException(\"Unable to load filter '{$name}'\");\n                        }\n                    }\n                }\n                if (isset($compiler->template->variable_filters)) {\n                    foreach ($compiler->template->variable_filters as $filter) {\n                        if (count($filter) == 1 && ($result = $this->compile_output_filter($compiler, $filter[0], $output)) !== false) {\n                            $output = $result;\n                        } else {\n                            $output = $compiler->compileTag('private_modifier', array(), array('modifierlist' => array($filter), 'value' => $output));\n                        }\n                    }\n                }\n            }\n\n            $compiler->has_output = true;\n            $output = \"<?php echo {$output};?>\";\n        }\n        return $output;\n    }\n\n    /**\n    * @param object $compiler compiler object\n    * @param string $name     name of variable filter\n    * @param type   $output   embedded output\n    * @return string\n    */\n    private function compile_output_filter($compiler, $name, $output)\n    {\n        $plugin_name = \"smarty_variablefilter_{$name}\";\n        $path = $compiler->smarty->loadPlugin($plugin_name, false);\n        if ($path) {\n            if ($compiler->template->caching) {\n                $compiler->template->required_plugins['nocache'][$name][Smarty::FILTER_VARIABLE]['file'] = $path;\n                $compiler->template->required_plugins['nocache'][$name][Smarty::FILTER_VARIABLE]['function'] = $plugin_name;\n            } else {\n                $compiler->template->required_plugins['compiled'][$name][Smarty::FILTER_VARIABLE]['file'] = $path;\n                $compiler->template->required_plugins['compiled'][$name][Smarty::FILTER_VARIABLE]['function'] = $plugin_name;\n            }\n        } else {\n            // not found\n            return false;\n        }\n        return \"{$plugin_name}({$output},\\$_smarty_tpl)\";\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_private_registered_block.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Registered Block\n *\n * Compiles code for the execution of a registered block function\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Registered Block Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Private_Registered_Block extends Smarty_Internal_CompileBase {\n\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $optional_attributes = array('_any');\n\n    /**\n     * Compiles code for the execution of a block function\n     *\n     * @param array  $args      array with attributes from parser\n     * @param object $compiler  compiler object\n     * @param array  $parameter array with compilation parameter\n     * @param string $tag       name of block function\n     * @return string compiled code\n     */\n    public function compile($args, $compiler, $parameter, $tag)\n    {\n        if (!isset($tag[5]) || substr($tag,-5) != 'close') {\n            // opening tag of block plugin\n            // check and get attributes\n            $_attr = $this->getAttributes($compiler, $args);\n            if ($_attr['nocache']) {\n                $compiler->tag_nocache = true;\n            }\n               unset($_attr['nocache']);\n               if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$tag])) {\n                   $tag_info = $compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$tag];\n               } else {\n                   $tag_info = $compiler->default_handler_plugins[Smarty::PLUGIN_BLOCK][$tag];\n               }\n            // convert attributes into parameter array string\n            $_paramsArray = array();\n            foreach ($_attr as $_key => $_value) {\n                if (is_int($_key)) {\n                    $_paramsArray[] = \"$_key=>$_value\";\n                } elseif ($compiler->template->caching && in_array($_key,$tag_info[2])) {\n                    $_value = str_replace(\"'\",\"^#^\",$_value);\n                    $_paramsArray[] = \"'$_key'=>^#^.var_export($_value,true).^#^\";\n                } else {\n                    $_paramsArray[] = \"'$_key'=>$_value\";\n                }\n            }\n            $_params = 'array(' . implode(\",\", $_paramsArray) . ')';\n\n            $this->openTag($compiler, $tag, array($_params, $compiler->nocache));\n            // maybe nocache because of nocache variables or nocache plugin\n            $compiler->nocache = !$tag_info[1] | $compiler->nocache | $compiler->tag_nocache;\n            $function = $tag_info[0];\n            // compile code\n            if (!is_array($function)) {\n                $output = \"<?php \\$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \\$_block_repeat=true; echo {$function}({$_params}, null, \\$_smarty_tpl, \\$_block_repeat);while (\\$_block_repeat) { ob_start();?>\";\n            } else if (is_object($function[0])) {\n                $output = \"<?php \\$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \\$_block_repeat=true; echo \\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]->{$function[1]}({$_params}, null, \\$_smarty_tpl, \\$_block_repeat);while (\\$_block_repeat) { ob_start();?>\";\n            } else {\n                $output = \"<?php \\$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \\$_block_repeat=true; echo {$function[0]}::{$function[1]}({$_params}, null, \\$_smarty_tpl, \\$_block_repeat);while (\\$_block_repeat) { ob_start();?>\";\n            }\n        } else {\n            // must endblock be nocache?\n            if ($compiler->nocache) {\n                $compiler->tag_nocache = true;\n            }\n            $base_tag = substr($tag, 0, -5);\n            // closing tag of block plugin, restore nocache\n            list($_params, $compiler->nocache) = $this->closeTag($compiler, $base_tag);\n            // This tag does create output\n            $compiler->has_output = true;\n               if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$base_tag])) {\n                   $function = $compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$base_tag][0];\n               } else {\n                   $function = $compiler->default_handler_plugins[Smarty::PLUGIN_BLOCK][$base_tag][0];\n               }\n            // compile code\n            if (!isset($parameter['modifier_list'])) {\n                $mod_pre = $mod_post ='';\n            } else {\n                $mod_pre = ' ob_start(); ';\n                $mod_post = 'echo '.$compiler->compileTag('private_modifier',array(),array('modifierlist'=>$parameter['modifier_list'],'value'=>'ob_get_clean()')).';';\n            }\n            if (!is_array($function)) {\n                $output = \"<?php \\$_block_content = ob_get_clean(); \\$_block_repeat=false;\".$mod_pre.\" echo {$function}({$_params}, \\$_block_content, \\$_smarty_tpl, \\$_block_repeat);\".$mod_post.\" } array_pop(\\$_smarty_tpl->smarty->_tag_stack);?>\";\n            } else if (is_object($function[0])) {\n                $output = \"<?php \\$_block_content = ob_get_clean(); \\$_block_repeat=false;\".$mod_pre.\" echo \\$_smarty_tpl->smarty->registered_plugins['block']['{$base_tag}'][0][0]->{$function[1]}({$_params}, \\$_block_content, \\$_smarty_tpl, \\$_block_repeat); \".$mod_post.\"} array_pop(\\$_smarty_tpl->smarty->_tag_stack);?>\";\n            } else {\n                $output = \"<?php \\$_block_content = ob_get_clean(); \\$_block_repeat=false;\".$mod_pre.\" echo {$function[0]}::{$function[1]}({$_params}, \\$_block_content, \\$_smarty_tpl, \\$_block_repeat); \".$mod_post.\"} array_pop(\\$_smarty_tpl->smarty->_tag_stack);?>\";\n            }\n        }\n        return $output . \"\\n\";\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_private_registered_function.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Registered Function\n *\n * Compiles code for the execution of a registered function\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Registered Function Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Internal_CompileBase {\n\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $optional_attributes = array('_any');\n\n    /**\n     * Compiles code for the execution of a registered function\n     *\n     * @param array  $args      array with attributes from parser\n     * @param object $compiler  compiler object\n     * @param array  $parameter array with compilation parameter\n     * @param string $tag       name of function\n     * @return string compiled code\n     */\n    public function compile($args, $compiler, $parameter, $tag)\n    {\n        // This tag does create output\n        $compiler->has_output = true;\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n        if ($_attr['nocache']) {\n            $compiler->tag_nocache = true;\n        }\n        unset($_attr['nocache']);\n               if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION][$tag])) {\n                   $tag_info = $compiler->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION][$tag];\n               } else {\n                   $tag_info = $compiler->default_handler_plugins[Smarty::PLUGIN_FUNCTION][$tag];\n               }\n        // not cachable?\n        $compiler->tag_nocache =  $compiler->tag_nocache || !$tag_info[1];\n        // convert attributes into parameter array string\n        $_paramsArray = array();\n        foreach ($_attr as $_key => $_value) {\n            if (is_int($_key)) {\n                $_paramsArray[] = \"$_key=>$_value\";\n            } elseif ($compiler->template->caching && in_array($_key,$tag_info[2])) {\n                $_value = str_replace(\"'\",\"^#^\",$_value);\n                $_paramsArray[] = \"'$_key'=>^#^.var_export($_value,true).^#^\";\n            } else {\n                $_paramsArray[] = \"'$_key'=>$_value\";\n            }\n        }\n        $_params = 'array(' . implode(\",\", $_paramsArray) . ')';\n        $function = $tag_info[0];\n        // compile code\n        if (!is_array($function)) {\n            $output = \"<?php echo {$function}({$_params},\\$_smarty_tpl);?>\\n\";\n        } else if (is_object($function[0])) {\n            $output = \"<?php echo \\$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['{$tag}'][0][0]->{$function[1]}({$_params},\\$_smarty_tpl);?>\\n\";\n        } else {\n            $output = \"<?php echo {$function[0]}::{$function[1]}({$_params},\\$_smarty_tpl);?>\\n\";\n        }\n        return $output;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_private_special_variable.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Special Smarty Variable\n *\n * Compiles the special $smarty variables\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile special Smarty Variable Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_CompileBase {\n\n    /**\n     * Compiles code for the speical $smarty variables\n     *\n     * @param array  $args     array with attributes from parser\n     * @param object $compiler compiler object\n     * @return string compiled code\n     */\n    public function compile($args, $compiler, $parameter)\n    {\n        $_index = preg_split(\"/\\]\\[/\",substr($parameter, 1, strlen($parameter)-2));\n        $compiled_ref = ' ';\n        $variable = trim($_index[0], \"'\");\n        switch ($variable) {\n            case 'foreach':\n                return \"\\$_smarty_tpl->getVariable('smarty')->value$parameter\";\n            case 'section':\n                return \"\\$_smarty_tpl->getVariable('smarty')->value$parameter\";\n            case 'capture':\n                return \"Smarty::\\$_smarty_vars$parameter\";\n            case 'now':\n                return 'time()';\n            case 'cookies':\n                if (isset($compiler->smarty->security_policy) && !$compiler->smarty->security_policy->allow_super_globals) {\n                    $compiler->trigger_template_error(\"(secure mode) super globals not permitted\");\n                    break;\n                }\n                $compiled_ref = '$_COOKIE';\n                break;\n\n            case 'get':\n            case 'post':\n            case 'env':\n            case 'server':\n            case 'session':\n            case 'request':\n                if (isset($compiler->smarty->security_policy) && !$compiler->smarty->security_policy->allow_super_globals) {\n                    $compiler->trigger_template_error(\"(secure mode) super globals not permitted\");\n                    break;\n                }\n                $compiled_ref = '$_'.strtoupper($variable);\n                break;\n\n            case 'template':\n                return 'basename($_smarty_tpl->source->filepath)';\n\n            case 'current_dir':\n                return 'dirname($_smarty_tpl->source->filepath)';\n\n            case 'version':\n                $_version = Smarty::SMARTY_VERSION;\n                return \"'$_version'\";\n\n            case 'const':\n                if (isset($compiler->smarty->security_policy) && !$compiler->smarty->security_policy->allow_constants) {\n                    $compiler->trigger_template_error(\"(secure mode) constants not permitted\");\n                    break;\n                }\n                return '@' . trim($_index[1], \"'\");\n\n            case 'config':\n                return \"\\$_smarty_tpl->getConfigVariable($_index[1])\";\n            case 'ldelim':\n                $_ldelim = $compiler->smarty->left_delimiter;\n                return \"'$_ldelim'\";\n\n            case 'rdelim':\n                $_rdelim = $compiler->smarty->right_delimiter;\n                return \"'$_rdelim'\";\n\n            default:\n                $compiler->trigger_template_error('$smarty.' . trim($_index[0], \"'\") . ' is invalid');\n                break;\n        }\n        if (isset($_index[1])) {\n            array_shift($_index);\n            foreach ($_index as $_ind) {\n                $compiled_ref = $compiled_ref . \"[$_ind]\";\n            }\n        }\n        return $compiled_ref;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_rdelim.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Rdelim\n *\n * Compiles the {rdelim} tag\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Rdelim Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Rdelim extends Smarty_Internal_CompileBase {\n\n    /**\n     * Compiles code for the {rdelim} tag\n     *\n     * This tag does output the right delimiter.\n     *\n     * @param array  $args     array with attributes from parser\n     * @param object $compiler compiler object\n     * @return string compiled code\n     */\n    public function compile($args, $compiler)\n    {\n        $_attr = $this->getAttributes($compiler, $args);\n        if ($_attr['nocache'] === true) {\n            $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);\n        }\n        // this tag does not return compiled code\n        $compiler->has_code = true;\n        return $compiler->smarty->right_delimiter;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_section.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Section\n *\n * Compiles the {section} {sectionelse} {/section} tags\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Section Class\n * \n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Section extends Smarty_Internal_CompileBase {\n\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $required_attributes = array('name', 'loop');\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $shorttag_order = array('name', 'loop');\n    /**\n     * Attribute definition: Overwrites base class.\n     *\n     * @var array\n     * @see Smarty_Internal_CompileBase\n     */\n    public $optional_attributes = array('start', 'step', 'max', 'show');\n\n    /**\n     * Compiles code for the {section} tag\n     *\n     * @param array  $args     array with attributes from parser\n     * @param object $compiler compiler object\n     * @return string compiled code\n     */\n    public function compile($args, $compiler)\n    {\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n\n        $this->openTag($compiler, 'section', array('section', $compiler->nocache));\n        // maybe nocache because of nocache variables\n        $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;\n\n        $output = \"<?php \";\n\n        $section_name = $_attr['name'];\n\n        $output .= \"if (isset(\\$_smarty_tpl->tpl_vars['smarty']->value['section'][$section_name])) unset(\\$_smarty_tpl->tpl_vars['smarty']->value['section'][$section_name]);\\n\";\n        $section_props = \"\\$_smarty_tpl->tpl_vars['smarty']->value['section'][$section_name]\";\n\n        foreach ($_attr as $attr_name => $attr_value) {\n            switch ($attr_name) {\n                case 'loop':\n                    $output .= \"{$section_props}['loop'] = is_array(\\$_loop=$attr_value) ? count(\\$_loop) : max(0, (int)\\$_loop); unset(\\$_loop);\\n\";\n                    break;\n\n                case 'show':\n                    if (is_bool($attr_value))\n                        $show_attr_value = $attr_value ? 'true' : 'false';\n                    else\n                        $show_attr_value = \"(bool)$attr_value\";\n                    $output .= \"{$section_props}['show'] = $show_attr_value;\\n\";\n                    break;\n\n                case 'name':\n                    $output .= \"{$section_props}['$attr_name'] = $attr_value;\\n\";\n                    break;\n\n                case 'max':\n                case 'start':\n                    $output .= \"{$section_props}['$attr_name'] = (int)$attr_value;\\n\";\n                    break;\n\n                case 'step':\n                    $output .= \"{$section_props}['$attr_name'] = ((int)$attr_value) == 0 ? 1 : (int)$attr_value;\\n\";\n                    break;\n            }\n        }\n\n        if (!isset($_attr['show']))\n            $output .= \"{$section_props}['show'] = true;\\n\";\n\n        if (!isset($_attr['loop']))\n            $output .= \"{$section_props}['loop'] = 1;\\n\";\n\n        if (!isset($_attr['max']))\n            $output .= \"{$section_props}['max'] = {$section_props}['loop'];\\n\";\n        else\n            $output .= \"if ({$section_props}['max'] < 0)\\n\" . \"    {$section_props}['max'] = {$section_props}['loop'];\\n\";\n\n        if (!isset($_attr['step']))\n            $output .= \"{$section_props}['step'] = 1;\\n\";\n\n        if (!isset($_attr['start']))\n            $output .= \"{$section_props}['start'] = {$section_props}['step'] > 0 ? 0 : {$section_props}['loop']-1;\\n\";\n        else {\n            $output .= \"if ({$section_props}['start'] < 0)\\n\" . \"    {$section_props}['start'] = max({$section_props}['step'] > 0 ? 0 : -1, {$section_props}['loop'] + {$section_props}['start']);\\n\" . \"else\\n\" . \"    {$section_props}['start'] = min({$section_props}['start'], {$section_props}['step'] > 0 ? {$section_props}['loop'] : {$section_props}['loop']-1);\\n\";\n        }\n\n        $output .= \"if ({$section_props}['show']) {\\n\";\n        if (!isset($_attr['start']) && !isset($_attr['step']) && !isset($_attr['max'])) {\n            $output .= \"    {$section_props}['total'] = {$section_props}['loop'];\\n\";\n        } else {\n            $output .= \"    {$section_props}['total'] = min(ceil(({$section_props}['step'] > 0 ? {$section_props}['loop'] - {$section_props}['start'] : {$section_props}['start']+1)/abs({$section_props}['step'])), {$section_props}['max']);\\n\";\n        }\n        $output .= \"    if ({$section_props}['total'] == 0)\\n\" . \"        {$section_props}['show'] = false;\\n\" . \"} else\\n\" . \"    {$section_props}['total'] = 0;\\n\";\n\n        $output .= \"if ({$section_props}['show']):\\n\";\n        $output .= \"\n            for ({$section_props}['index'] = {$section_props}['start'], {$section_props}['iteration'] = 1;\n                 {$section_props}['iteration'] <= {$section_props}['total'];\n                 {$section_props}['index'] += {$section_props}['step'], {$section_props}['iteration']++):\\n\";\n        $output .= \"{$section_props}['rownum'] = {$section_props}['iteration'];\\n\";\n        $output .= \"{$section_props}['index_prev'] = {$section_props}['index'] - {$section_props}['step'];\\n\";\n        $output .= \"{$section_props}['index_next'] = {$section_props}['index'] + {$section_props}['step'];\\n\";\n        $output .= \"{$section_props}['first']      = ({$section_props}['iteration'] == 1);\\n\";\n        $output .= \"{$section_props}['last']       = ({$section_props}['iteration'] == {$section_props}['total']);\\n\";\n\n        $output .= \"?>\";\n        return $output;\n    }\n\n}\n\n/**\n * Smarty Internal Plugin Compile Sectionelse Class\n * \n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Sectionelse extends Smarty_Internal_CompileBase {\n\n    /**\n     * Compiles code for the {sectionelse} tag\n     *\n     * @param array  $args     array with attributes from parser\n     * @param object $compiler compiler object\n     * @return string compiled code\n     */\n    public function compile($args, $compiler)\n    {\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n\n        list($openTag, $nocache) = $this->closeTag($compiler, array('section'));\n        $this->openTag($compiler, 'sectionelse', array('sectionelse', $nocache));\n\n        return \"<?php endfor; else: ?>\";\n    }\n\n}\n\n/**\n * Smarty Internal Plugin Compile Sectionclose Class\n * \n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Sectionclose extends Smarty_Internal_CompileBase {\n\n    /**\n     * Compiles code for the {/section} tag\n     *\n     * @param array  $args     array with attributes from parser\n     * @param object $compiler compiler object\n     * @return string compiled code\n     */\n    public function compile($args, $compiler)\n    {\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n\n        // must endblock be nocache?\n        if ($compiler->nocache) {\n            $compiler->tag_nocache = true;\n        }\n\n        list($openTag, $compiler->nocache) = $this->closeTag($compiler, array('section', 'sectionelse'));\n\n        if ($openTag == 'sectionelse') {\n            return \"<?php endif; ?>\";\n        } else {\n            return \"<?php endfor; endif; ?>\";\n        }\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_setfilter.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile Setfilter\n *\n * Compiles code for setfilter tag\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Setfilter Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Setfilter extends Smarty_Internal_CompileBase {\n\n    /**\n     * Compiles code for setfilter tag\n     *\n     * @param array  $args      array with attributes from parser\n     * @param object $compiler  compiler object\n     * @param array  $parameter array with compilation parameter\n     * @return string compiled code\n     */\n    public function compile($args, $compiler, $parameter)\n    {\n        $compiler->variable_filter_stack[] = $compiler->template->variable_filters;\n        $compiler->template->variable_filters = $parameter['modifier_list'];\n        // this tag does not return compiled code\n        $compiler->has_code = false;\n        return true;\n    }\n\n}\n\n/**\n * Smarty Internal Plugin Compile Setfilterclose Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Setfilterclose extends Smarty_Internal_CompileBase {\n\n    /**\n     * Compiles code for the {/setfilter} tag\n     *\n     * This tag does not generate compiled output. It resets variable filter.\n     *\n     * @param array  $args     array with attributes from parser\n     * @param object $compiler compiler object\n     * @return string compiled code\n     */\n    public function compile($args, $compiler)\n    {\n        $_attr = $this->getAttributes($compiler, $args);\n        // reset variable filter to previous state\n        if (count($compiler->variable_filter_stack)) {\n            $compiler->template->variable_filters = array_pop($compiler->variable_filter_stack);\n        } else {\n            $compiler->template->variable_filters = array();\n        }\n        // this tag does not return compiled code\n        $compiler->has_code = false;\n        return true;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compile_while.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Compile While\n *\n * Compiles the {while} tag\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile While Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase {\n\n    /**\n     * Compiles code for the {while} tag\n     *\n     * @param array  $args      array with attributes from parser\n     * @param object $compiler  compiler object\n     * @param array  $parameter array with compilation parameter\n     * @return string compiled code\n     */\n    public function compile($args, $compiler, $parameter)\n    {\n        // check and get attributes\n        $_attr = $this->getAttributes($compiler, $args);\n        $this->openTag($compiler, 'while', $compiler->nocache);\n\n        if (!array_key_exists(\"if condition\",$parameter)) {\n            $compiler->trigger_template_error(\"missing while condition\", $compiler->lex->taglineno);\n        }\n\n        // maybe nocache because of nocache variables\n        $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;\n        if (is_array($parameter['if condition'])) {\n            if ($compiler->nocache) {\n                $_nocache = ',true';\n                // create nocache var to make it know for further compiling\n                if (is_array($parameter['if condition']['var'])) {\n                    $compiler->template->tpl_vars[trim($parameter['if condition']['var']['var'], \"'\")] = new Smarty_variable(null, true);\n                } else {\n                    $compiler->template->tpl_vars[trim($parameter['if condition']['var'], \"'\")] = new Smarty_variable(null, true);\n                }\n            } else {\n                $_nocache = '';\n            }\n            if (is_array($parameter['if condition']['var'])) {\n                $_output = \"<?php if (!isset(\\$_smarty_tpl->tpl_vars[\" . $parameter['if condition']['var']['var'] . \"]) || !is_array(\\$_smarty_tpl->tpl_vars[\" . $parameter['if condition']['var']['var'] . \"]->value)) \\$_smarty_tpl->createLocalArrayVariable(\" . $parameter['if condition']['var']['var'] . \"$_nocache);\\n\";\n                $_output .= \"while (\\$_smarty_tpl->tpl_vars[\" . $parameter['if condition']['var']['var'] . \"]->value\" . $parameter['if condition']['var']['smarty_internal_index'] . \" = \" . $parameter['if condition']['value'] . \"){?>\";\n            } else {\n                $_output = \"<?php if (!isset(\\$_smarty_tpl->tpl_vars[\" . $parameter['if condition']['var'] . \"])) \\$_smarty_tpl->tpl_vars[\" . $parameter['if condition']['var'] . \"] = new Smarty_Variable(null{$_nocache});\";\n                $_output .= \"while (\\$_smarty_tpl->tpl_vars[\" . $parameter['if condition']['var'] . \"]->value = \" . $parameter['if condition']['value'] . \"){?>\";\n            }\n            return $_output;\n        } else {\n            return \"<?php while ({$parameter['if condition']}){?>\";\n        }\n    }\n\n}\n\n/**\n * Smarty Internal Plugin Compile Whileclose Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Compile_Whileclose extends Smarty_Internal_CompileBase {\n\n    /**\n     * Compiles code for the {/while} tag\n     *\n     * @param array  $args     array with attributes from parser\n     * @param object $compiler compiler object\n     * @return string compiled code\n     */\n    public function compile($args, $compiler)\n    {\n        // must endblock be nocache?\n        if ($compiler->nocache) {\n            $compiler->tag_nocache = true;\n        }\n        $compiler->nocache = $this->closeTag($compiler, array('while'));\n        return \"<?php }?>\";\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_compilebase.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin CompileBase\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * This class does extend all internal compile plugins\n *\n * @package Smarty\n * @subpackage Compiler\n */\nabstract class Smarty_Internal_CompileBase {\n\n    /**\n     * Array of names of required attribute required by tag\n     *\n     * @var array\n     */\n    public $required_attributes = array();\n    /**\n     * Array of names of optional attribute required by tag\n     * use array('_any') if there is no restriction of attributes names\n     *\n     * @var array\n     */\n    public $optional_attributes = array();\n    /**\n     * Shorttag attribute order defined by its names\n     *\n     * @var array\n     */\n    public $shorttag_order = array();\n    /**\n     * Array of names of valid option flags\n     *\n     * @var array\n     */\n    public $option_flags = array('nocache');\n\n    /**\n     * This function checks if the attributes passed are valid\n     *\n     * The attributes passed for the tag to compile are checked against the list of required and\n     * optional attributes. Required attributes must be present. Optional attributes are check against\n     * the corresponding list. The keyword '_any' specifies that any attribute will be accepted\n     * as valid\n     *\n     * @param object $compiler   compiler object\n     * @param array  $attributes attributes applied to the tag\n     * @return array of mapped attributes for further processing\n     */\n    public function getAttributes($compiler, $attributes)\n    {\n        $_indexed_attr = array();\n        // loop over attributes\n        foreach ($attributes as $key => $mixed) {\n            // shorthand ?\n            if (!is_array($mixed)) {\n                // option flag ?\n                if (in_array(trim($mixed, '\\'\"'), $this->option_flags)) {\n                    $_indexed_attr[trim($mixed, '\\'\"')] = true;\n                    // shorthand attribute ?\n                } else if (isset($this->shorttag_order[$key])) {\n                    $_indexed_attr[$this->shorttag_order[$key]] = $mixed;\n                } else {\n                    // too many shorthands\n                    $compiler->trigger_template_error('too many shorthand attributes', $compiler->lex->taglineno);\n                }\n                // named attribute\n            } else {\n                $kv = each($mixed);\n                // option flag?\n                if (in_array($kv['key'], $this->option_flags)) {\n                    if (is_bool($kv['value'])) {\n                        $_indexed_attr[$kv['key']] = $kv['value'];\n                    } else if (is_string($kv['value']) && in_array(trim($kv['value'], '\\'\"'), array('true', 'false'))) {\n                        if (trim($kv['value']) == 'true') {\n                            $_indexed_attr[$kv['key']] = true;\n                        } else {\n                            $_indexed_attr[$kv['key']] = false;\n                        }\n                    } else if (is_numeric($kv['value']) && in_array($kv['value'], array(0, 1))) {\n                        if ($kv['value'] == 1) {\n                            $_indexed_attr[$kv['key']] = true;\n                        } else {\n                            $_indexed_attr[$kv['key']] = false;\n                        }\n                    } else {\n                        $compiler->trigger_template_error(\"illegal value of option flag \\\"{$kv['key']}\\\"\", $compiler->lex->taglineno);\n                    }\n                    // must be named attribute\n                } else {\n                    reset($mixed);\n                    $_indexed_attr[key($mixed)] = $mixed[key($mixed)];\n                }\n            }\n        }\n        // check if all required attributes present\n        foreach ($this->required_attributes as $attr) {\n            if (!array_key_exists($attr, $_indexed_attr)) {\n                $compiler->trigger_template_error(\"missing \\\"\" . $attr . \"\\\" attribute\", $compiler->lex->taglineno);\n            }\n        }\n        // check for unallowed attributes\n        if ($this->optional_attributes != array('_any')) {\n            $tmp_array = array_merge($this->required_attributes, $this->optional_attributes, $this->option_flags);\n            foreach ($_indexed_attr as $key => $dummy) {\n                if (!in_array($key, $tmp_array) && $key !== 0) {\n                    $compiler->trigger_template_error(\"unexpected \\\"\" . $key . \"\\\" attribute\", $compiler->lex->taglineno);\n                }\n            }\n        }\n        // default 'false' for all option flags not set\n        foreach ($this->option_flags as $flag) {\n            if (!isset($_indexed_attr[$flag])) {\n                $_indexed_attr[$flag] = false;\n            }\n        }\n\n        return $_indexed_attr;\n    }\n\n    /**\n     * Push opening tag name on stack\n     *\n     * Optionally additional data can be saved on stack\n     *\n     * @param object    $compiler   compiler object\n     * @param string    $openTag    the opening tag's name\n     * @param mixed     $data       optional data saved\n     */\n    public function openTag($compiler, $openTag, $data = null)\n    {\n        array_push($compiler->_tag_stack, array($openTag, $data));\n    }\n\n    /**\n     * Pop closing tag\n     *\n     * Raise an error if this stack-top doesn't match with expected opening tags\n     *\n     * @param object       $compiler    compiler object\n     * @param array|string $expectedTag the expected opening tag names\n     * @return mixed any type the opening tag's name or saved data\n     */\n    public function closeTag($compiler, $expectedTag)\n    {\n        if (count($compiler->_tag_stack) > 0) {\n            // get stacked info\n            list($_openTag, $_data) = array_pop($compiler->_tag_stack);\n            // open tag must match with the expected ones\n            if (in_array($_openTag, (array) $expectedTag)) {\n                if (is_null($_data)) {\n                    // return opening tag\n                    return $_openTag;\n                } else {\n                    // return restored data\n                    return $_data;\n                }\n            }\n            // wrong nesting of tags\n            $compiler->trigger_template_error(\"unclosed {\" . $_openTag . \"} tag\");\n            return;\n        }\n        // wrong nesting of tags\n        $compiler->trigger_template_error(\"unexpected closing tag\", $compiler->lex->taglineno);\n        return;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_config.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Config\n *\n * @package Smarty\n * @subpackage Config\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Config\n *\n * Main class for config variables\n *\n * @package Smarty\n * @subpackage Config\n *\n * @property Smarty_Config_Source   $source\n * @property Smarty_Config_Compiled $compiled\n * @ignore\n */\nclass Smarty_Internal_Config {\n\n    /**\n     * Samrty instance\n     *\n     * @var Smarty object\n     */\n    public $smarty = null;\n    /**\n     * Object of config var storage\n     *\n     * @var object\n     */\n    public $data = null;\n    /**\n     * Config resource\n     * @var string\n     */\n    public $config_resource = null;\n    /**\n     * Compiled config file\n     *\n     * @var string\n     */\n    public $compiled_config = null;\n    /**\n     * filepath of compiled config file\n     *\n     * @var string\n     */\n    public $compiled_filepath = null;\n    /**\n     * Filemtime of compiled config Filemtime\n     *\n     * @var int\n     */\n    public $compiled_timestamp = null;\n    /**\n     * flag if compiled config file is invalid and must be (re)compiled\n     * @var bool\n     */\n    public $mustCompile = null;\n    /**\n     * Config file compiler object\n     *\n     * @var Smarty_Internal_Config_File_Compiler object\n     */\n    public $compiler_object = null;\n\n    /**\n     * Constructor of config file object\n     *\n     * @param string $config_resource config file resource name\n     * @param Smarty $smarty Smarty instance\n     * @param object $data object for config vars storage\n     */\n    public function __construct($config_resource, $smarty, $data = null)\n    {\n        $this->data = $data;\n        $this->smarty = $smarty;\n        $this->config_resource = $config_resource;\n    }\n\n    /**\n     * Returns the compiled  filepath\n     *\n     * @return string the compiled filepath\n     */\n    public function getCompiledFilepath()\n    {\n        return $this->compiled_filepath === null ?\n                ($this->compiled_filepath = $this->buildCompiledFilepath()) :\n                $this->compiled_filepath;\n    }\n\n    /**\n     * Get file path.\n     *\n     * @return string\n     */\n    public function buildCompiledFilepath()\n    {\n        $_compile_id = isset($this->smarty->compile_id) ? preg_replace('![^\\w\\|]+!', '_', $this->smarty->compile_id) : null;\n        $_flag = (int) $this->smarty->config_read_hidden + (int) $this->smarty->config_booleanize * 2\n                + (int) $this->smarty->config_overwrite * 4;\n        $_filepath = sha1($this->source->name . $_flag);\n        // if use_sub_dirs, break file into directories\n        if ($this->smarty->use_sub_dirs) {\n            $_filepath = substr($_filepath, 0, 2) . DS\n                    . substr($_filepath, 2, 2) . DS\n                    . substr($_filepath, 4, 2) . DS\n                    . $_filepath;\n        }\n        $_compile_dir_sep = $this->smarty->use_sub_dirs ? DS : '^';\n        if (isset($_compile_id)) {\n            $_filepath = $_compile_id . $_compile_dir_sep . $_filepath;\n        }\n        $_compile_dir = $this->smarty->getCompileDir();\n        return $_compile_dir . $_filepath . '.' . basename($this->source->name) . '.config' . '.php';\n    }\n\n    /**\n     * Returns the timpestamp of the compiled file\n     *\n     * @return integer the file timestamp\n     */\n    public function getCompiledTimestamp()\n    {\n        return $this->compiled_timestamp === null\n            ? ($this->compiled_timestamp = (file_exists($this->getCompiledFilepath())) ? filemtime($this->getCompiledFilepath()) : false)\n            : $this->compiled_timestamp;\n    }\n\n    /**\n     * Returns if the current config file must be compiled\n     *\n     * It does compare the timestamps of config source and the compiled config and checks the force compile configuration\n     *\n     * @return boolean true if the file must be compiled\n     */\n    public function mustCompile()\n    {\n        return $this->mustCompile === null ?\n            $this->mustCompile = ($this->smarty->force_compile || $this->getCompiledTimestamp () === false || $this->smarty->compile_check && $this->getCompiledTimestamp () < $this->source->timestamp):\n            $this->mustCompile;\n    }\n\n    /**\n     * Returns the compiled config file\n     *\n     * It checks if the config file must be compiled or just read the compiled version\n     *\n     * @return string the compiled config file\n     */\n    public function getCompiledConfig()\n    {\n        if ($this->compiled_config === null) {\n            // see if template needs compiling.\n            if ($this->mustCompile()) {\n                $this->compileConfigSource();\n            } else {\n                $this->compiled_config = file_get_contents($this->getCompiledFilepath());\n            }\n        }\n        return $this->compiled_config;\n    }\n\n    /**\n     * Compiles the config files\n     *\n     * @throws Exception\n     */\n    public function compileConfigSource()\n    {\n        // compile template\n        if (!is_object($this->compiler_object)) {\n            // load compiler\n            $this->compiler_object = new Smarty_Internal_Config_File_Compiler($this->smarty);\n        }\n        // compile locking\n        if ($this->smarty->compile_locking) {\n            if ($saved_timestamp = $this->getCompiledTimestamp()) {\n                touch($this->getCompiledFilepath());\n            }\n        }\n        // call compiler\n        try {\n            $this->compiler_object->compileSource($this);\n        } catch (Exception $e) {\n            // restore old timestamp in case of error\n            if ($this->smarty->compile_locking && $saved_timestamp) {\n                touch($this->getCompiledFilepath(), $saved_timestamp);\n            }\n            throw $e;\n        }\n        // compiling succeded\n        // write compiled template\n        Smarty_Internal_Write_File::writeFile($this->getCompiledFilepath(), $this->getCompiledConfig(), $this->smarty);\n    }\n\n    /**\n     * load config variables\n     *\n     * @param mixed $sections array of section names, single section or null\n     * @param object $scope global,parent or local\n     */\n    public function loadConfigVars($sections = null, $scope = 'local')\n    {\n        if ($this->data instanceof Smarty_Internal_Template) {\n            $this->data->properties['file_dependency'][sha1($this->source->filepath)] = array($this->source->filepath, $this->source->timestamp, 'file');\n        }\n        if ($this->mustCompile()) {\n            $this->compileConfigSource();\n        }\n        // pointer to scope\n        if ($scope == 'local') {\n            $scope_ptr = $this->data;\n        } elseif ($scope == 'parent') {\n            if (isset($this->data->parent)) {\n                $scope_ptr = $this->data->parent;\n            } else {\n                $scope_ptr = $this->data;\n            }\n        } elseif ($scope == 'root' || $scope == 'global') {\n            $scope_ptr = $this->data;\n            while (isset($scope_ptr->parent)) {\n                $scope_ptr = $scope_ptr->parent;\n            }\n        }\n        $_config_vars = array();\n        include($this->getCompiledFilepath());\n        // copy global config vars\n        foreach ($_config_vars['vars'] as $variable => $value) {\n            if ($this->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) {\n                $scope_ptr->config_vars[$variable] = $value;\n            } else {\n                $scope_ptr->config_vars[$variable] = array_merge((array) $scope_ptr->config_vars[$variable], (array) $value);\n            }\n        }\n        // scan sections\n        if (!empty($sections)) {\n            $sections = array_flip((array) $sections);\n            foreach ($_config_vars['sections'] as $this_section => $dummy) {\n                if (isset($sections[$this_section])) {\n                    foreach ($_config_vars['sections'][$this_section]['vars'] as $variable => $value) {\n                        if ($this->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) {\n                            $scope_ptr->config_vars[$variable] = $value;\n                        } else {\n                            $scope_ptr->config_vars[$variable] = array_merge((array) $scope_ptr->config_vars[$variable], (array) $value);\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    /**\n     * set Smarty property in template context\n     *\n     * @param string $property_name property name\n     * @param mixed  $value         value\n     * @throws SmartyException if $property_name is not valid\n     */\n    public function __set($property_name, $value)\n    {\n        switch ($property_name) {\n            case 'source':\n            case 'compiled':\n                $this->$property_name = $value;\n                return;\n        }\n\n        throw new SmartyException(\"invalid config property '$property_name'.\");\n    }\n\n    /**\n     * get Smarty property in template context\n     *\n     * @param string $property_name property name\n     * @throws SmartyException if $property_name is not valid\n     */\n    public function __get($property_name)\n    {\n        switch ($property_name) {\n            case 'source':\n                if (empty($this->config_resource)) {\n                    throw new SmartyException(\"Unable to parse resource name \\\"{$this->config_resource}\\\"\");\n                }\n                $this->source = Smarty_Resource::config($this);\n                return $this->source;\n\n            case 'compiled':\n                $this->compiled = $this->source->getCompiled($this);\n                return $this->compiled;\n        }\n\n        throw new SmartyException(\"config attribute '$property_name' does not exist.\");\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_config_file_compiler.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Config File Compiler\n *\n * This is the config file compiler class. It calls the lexer and parser to\n * perform the compiling.\n *\n * @package Smarty\n * @subpackage Config\n * @author Uwe Tews\n */\n\n/**\n * Main config file compiler class\n *\n * @package Smarty\n * @subpackage Config\n */\nclass Smarty_Internal_Config_File_Compiler {\n\n    /**\n     * Lexer object\n     *\n     * @var object\n     */\n    public $lex;\n\n    /**\n     * Parser object\n     *\n     * @var object\n     */\n    public $parser;\n\n    /**\n     * Smarty object\n     *\n     * @var Smarty object\n     */\n    public $smarty;\n\n    /**\n     * Smarty object\n     *\n     * @var Smarty_Internal_Config object\n     */\n    public $config;\n\n    /**\n     * Compiled config data sections and variables\n     *\n     * @var array\n     */\n    public $config_data = array();\n\n    /**\n     * Initialize compiler\n     *\n     * @param Smarty $smarty base instance\n     */\n    public function __construct($smarty)\n    {\n        $this->smarty = $smarty;\n        $this->config_data['sections'] = array();\n        $this->config_data['vars'] = array();\n    }\n\n    /**\n     * Method to compile a Smarty template.\n     *\n     * @param  Smarty_Internal_Config $config config object\n     * @return bool true if compiling succeeded, false if it failed\n     */\n    public function compileSource(Smarty_Internal_Config $config)\n    {\n        /* here is where the compiling takes place. Smarty\n          tags in the templates are replaces with PHP code,\n          then written to compiled files. */\n        $this->config = $config;\n        // get config file source\n        $_content = $config->source->content . \"\\n\";\n        // on empty template just return\n        if ($_content == '') {\n            return true;\n        }\n        // init the lexer/parser to compile the config file\n        $lex = new Smarty_Internal_Configfilelexer($_content, $this->smarty);\n        $parser = new Smarty_Internal_Configfileparser($lex, $this);\n        if ($this->smarty->_parserdebug) $parser->PrintTrace();\n        // get tokens from lexer and parse them\n        while ($lex->yylex()) {\n            if ($this->smarty->_parserdebug) echo \"<br>Parsing  {$parser->yyTokenName[$lex->token]} Token {$lex->value} Line {$lex->line} \\n\";\n            $parser->doParse($lex->token, $lex->value);\n        }\n        // finish parsing process\n        $parser->doParse(0, 0);\n        $config->compiled_config = '<?php $_config_vars = ' . var_export($this->config_data, true) . '; ?>';\n    }\n\n    /**\n     * display compiler error messages without dying\n     *\n     * If parameter $args is empty it is a parser detected syntax error.\n     * In this case the parser is called to obtain information about exspected tokens.\n     *\n     * If parameter $args contains a string this is used as error message\n     *\n     * @param string $args individual error message or null\n     */\n    public function trigger_config_file_error($args = null)\n    {\n        $this->lex = Smarty_Internal_Configfilelexer::instance();\n        $this->parser = Smarty_Internal_Configfileparser::instance();\n        // get template source line which has error\n        $line = $this->lex->line;\n        if (isset($args)) {\n            // $line--;\n        }\n        $match = preg_split(\"/\\n/\", $this->lex->data);\n        $error_text = \"Syntax error in config file '{$this->config->source->filepath}' on line {$line} '{$match[$line-1]}' \";\n        if (isset($args)) {\n            // individual error message\n            $error_text .= $args;\n        } else {\n            // exspected token from parser\n            foreach ($this->parser->yy_get_expected_tokens($this->parser->yymajor) as $token) {\n                $exp_token = $this->parser->yyTokenName[$token];\n                if (isset($this->lex->smarty_token_names[$exp_token])) {\n                    // token type from lexer\n                    $expect[] = '\"' . $this->lex->smarty_token_names[$exp_token] . '\"';\n                } else {\n                    // otherwise internal token name\n                    $expect[] = $this->parser->yyTokenName[$token];\n                }\n            }\n            // output parser error message\n            $error_text .= ' - Unexpected \"' . $this->lex->value . '\", expected one of: ' . implode(' , ', $expect);\n        }\n        throw new SmartyCompilerException($error_text);\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_configfilelexer.php",
    "content": "<?php\n/**\n* Smarty Internal Plugin Configfilelexer\n*\n* This is the lexer to break the config file source into tokens\n* @package Smarty\n* @subpackage Config\n* @author Uwe Tews\n*/\n/**\n* Smarty Internal Plugin Configfilelexer\n*/\nclass Smarty_Internal_Configfilelexer\n{\n\n    public $data;\n    public $counter;\n    public $token;\n    public $value;\n    public $node;\n    public $line;\n    private $state = 1;\n    public $smarty_token_names = array (\t\t// Text for parser error messages\n   \t\t\t\t);\n\n\n    function __construct($data, $smarty)\n    {\n        // set instance object\n        self::instance($this);\n        $this->data = $data . \"\\n\"; //now all lines are \\n-terminated\n        $this->counter = 0;\n        $this->line = 1;\n        $this->smarty = $smarty;\n        $this->mbstring_overload = ini_get('mbstring.func_overload') & 2;\n    }\n    public static function &instance($new_instance = null)\n    {\n        static $instance = null;\n        if (isset($new_instance) && is_object($new_instance))\n            $instance = $new_instance;\n        return $instance;\n    }\n\n\n\n    private $_yy_state = 1;\n    private $_yy_stack = array();\n\n    function yylex()\n    {\n        return $this->{'yylex' . $this->_yy_state}();\n    }\n\n    function yypushstate($state)\n    {\n        array_push($this->_yy_stack, $this->_yy_state);\n        $this->_yy_state = $state;\n    }\n\n    function yypopstate()\n    {\n        $this->_yy_state = array_pop($this->_yy_stack);\n    }\n\n    function yybegin($state)\n    {\n        $this->_yy_state = $state;\n    }\n\n\n\n\n    function yylex1()\n    {\n        $tokenMap = array (\n              1 => 0,\n              2 => 0,\n              3 => 0,\n              4 => 0,\n              5 => 0,\n              6 => 0,\n              7 => 0,\n            );\n        if ($this->counter >= strlen($this->data)) {\n            return false; // end of input\n        }\n        $yy_global_pattern = \"/\\G(#|;)|\\G(\\\\[)|\\G(\\\\])|\\G(=)|\\G([ \\t\\r]+)|\\G(\\n)|\\G([0-9]*[a-zA-Z_]\\\\w*)/iS\";\n\n        do {\n            if ($this->mbstring_overload ? preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {\n                $yysubmatches = $yymatches;\n                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns\n                if (!count($yymatches)) {\n                    throw new Exception('Error: lexing failed because a rule matched' .\n                        ' an empty string.  Input \"' . substr($this->data,\n                        $this->counter, 5) . '... state START');\n                }\n                next($yymatches); // skip global match\n                $this->token = key($yymatches); // token number\n                if ($tokenMap[$this->token]) {\n                    // extract sub-patterns for passing to lex function\n                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,\n                        $tokenMap[$this->token]);\n                } else {\n                    $yysubmatches = array();\n                }\n                $this->value = current($yymatches); // token value\n                $r = $this->{'yy_r1_' . $this->token}($yysubmatches);\n                if ($r === null) {\n                    $this->counter += strlen($this->value);\n                    $this->line += substr_count($this->value, \"\\n\");\n                    // accept this token\n                    return true;\n                } elseif ($r === true) {\n                    // we have changed state\n                    // process this token in the new state\n                    return $this->yylex();\n                } elseif ($r === false) {\n                    $this->counter += strlen($this->value);\n                    $this->line += substr_count($this->value, \"\\n\");\n                    if ($this->counter >= strlen($this->data)) {\n                        return false; // end of input\n                    }\n                    // skip this token\n                    continue;\n                }            } else {\n                throw new Exception('Unexpected input at line' . $this->line .\n                    ': ' . $this->data[$this->counter]);\n            }\n            break;\n        } while (true);\n\n    } // end function\n\n\n    const START = 1;\n    function yy_r1_1($yy_subpatterns)\n    {\n\n    $this->token = Smarty_Internal_Configfileparser::TPC_COMMENTSTART;\n    $this->yypushstate(self::COMMENT);\n    }\n    function yy_r1_2($yy_subpatterns)\n    {\n\n    $this->token = Smarty_Internal_Configfileparser::TPC_OPENB;\n    $this->yypushstate(self::SECTION);\n    }\n    function yy_r1_3($yy_subpatterns)\n    {\n\n    $this->token = Smarty_Internal_Configfileparser::TPC_CLOSEB;\n    }\n    function yy_r1_4($yy_subpatterns)\n    {\n\n    $this->token = Smarty_Internal_Configfileparser::TPC_EQUAL;\n    $this->yypushstate(self::VALUE);\n    }\n    function yy_r1_5($yy_subpatterns)\n    {\n\n    return false;\n    }\n    function yy_r1_6($yy_subpatterns)\n    {\n\n    $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;\n    }\n    function yy_r1_7($yy_subpatterns)\n    {\n\n    $this->token = Smarty_Internal_Configfileparser::TPC_ID;\n    }\n\n\n\n    function yylex2()\n    {\n        $tokenMap = array (\n              1 => 0,\n              2 => 0,\n              3 => 0,\n              4 => 0,\n              5 => 0,\n              6 => 0,\n              7 => 0,\n              8 => 0,\n              9 => 0,\n            );\n        if ($this->counter >= strlen($this->data)) {\n            return false; // end of input\n        }\n        $yy_global_pattern = \"/\\G([ \\t\\r]+)|\\G(\\\\d+\\\\.\\\\d+(?=[ \\t\\r]*[\\n#;]))|\\G(\\\\d+(?=[ \\t\\r]*[\\n#;]))|\\G(\\\"\\\"\\\")|\\G('[^'\\\\\\\\]*(?:\\\\\\\\.[^'\\\\\\\\]*)*'(?=[ \\t\\r]*[\\n#;]))|\\G(\\\"[^\\\"\\\\\\\\]*(?:\\\\\\\\.[^\\\"\\\\\\\\]*)*\\\"(?=[ \\t\\r]*[\\n#;]))|\\G([a-zA-Z]+(?=[ \\t\\r]*[\\n#;]))|\\G([^\\n]+?(?=[ \\t\\r]*\\n))|\\G(\\n)/iS\";\n\n        do {\n            if ($this->mbstring_overload ? preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {\n                $yysubmatches = $yymatches;\n                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns\n                if (!count($yymatches)) {\n                    throw new Exception('Error: lexing failed because a rule matched' .\n                        ' an empty string.  Input \"' . substr($this->data,\n                        $this->counter, 5) . '... state VALUE');\n                }\n                next($yymatches); // skip global match\n                $this->token = key($yymatches); // token number\n                if ($tokenMap[$this->token]) {\n                    // extract sub-patterns for passing to lex function\n                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,\n                        $tokenMap[$this->token]);\n                } else {\n                    $yysubmatches = array();\n                }\n                $this->value = current($yymatches); // token value\n                $r = $this->{'yy_r2_' . $this->token}($yysubmatches);\n                if ($r === null) {\n                    $this->counter += strlen($this->value);\n                    $this->line += substr_count($this->value, \"\\n\");\n                    // accept this token\n                    return true;\n                } elseif ($r === true) {\n                    // we have changed state\n                    // process this token in the new state\n                    return $this->yylex();\n                } elseif ($r === false) {\n                    $this->counter += strlen($this->value);\n                    $this->line += substr_count($this->value, \"\\n\");\n                    if ($this->counter >= strlen($this->data)) {\n                        return false; // end of input\n                    }\n                    // skip this token\n                    continue;\n                }            } else {\n                throw new Exception('Unexpected input at line' . $this->line .\n                    ': ' . $this->data[$this->counter]);\n            }\n            break;\n        } while (true);\n\n    } // end function\n\n\n    const VALUE = 2;\n    function yy_r2_1($yy_subpatterns)\n    {\n\n    return false;\n    }\n    function yy_r2_2($yy_subpatterns)\n    {\n\n    $this->token = Smarty_Internal_Configfileparser::TPC_FLOAT;\n    $this->yypopstate();\n    }\n    function yy_r2_3($yy_subpatterns)\n    {\n\n    $this->token = Smarty_Internal_Configfileparser::TPC_INT;\n    $this->yypopstate();\n    }\n    function yy_r2_4($yy_subpatterns)\n    {\n\n    $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES;\n    $this->yypushstate(self::TRIPPLE);\n    }\n    function yy_r2_5($yy_subpatterns)\n    {\n\n    $this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING;\n    $this->yypopstate();\n    }\n    function yy_r2_6($yy_subpatterns)\n    {\n\n    $this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING;\n    $this->yypopstate();\n    }\n    function yy_r2_7($yy_subpatterns)\n    {\n\n    if (!$this->smarty->config_booleanize || !in_array(strtolower($this->value), Array(\"true\", \"false\", \"on\", \"off\", \"yes\", \"no\")) ) {\n        $this->yypopstate();\n        $this->yypushstate(self::NAKED_STRING_VALUE);\n        return true; //reprocess in new state\n    } else {\n        $this->token = Smarty_Internal_Configfileparser::TPC_BOOL;\n        $this->yypopstate();\n    }\n    }\n    function yy_r2_8($yy_subpatterns)\n    {\n\n    $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;\n    $this->yypopstate();\n    }\n    function yy_r2_9($yy_subpatterns)\n    {\n\n    $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;\n    $this->value = \"\";\n    $this->yypopstate();\n    }\n\n\n\n    function yylex3()\n    {\n        $tokenMap = array (\n              1 => 0,\n            );\n        if ($this->counter >= strlen($this->data)) {\n            return false; // end of input\n        }\n        $yy_global_pattern = \"/\\G([^\\n]+?(?=[ \\t\\r]*\\n))/iS\";\n\n        do {\n            if ($this->mbstring_overload ? preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {\n                $yysubmatches = $yymatches;\n                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns\n                if (!count($yymatches)) {\n                    throw new Exception('Error: lexing failed because a rule matched' .\n                        ' an empty string.  Input \"' . substr($this->data,\n                        $this->counter, 5) . '... state NAKED_STRING_VALUE');\n                }\n                next($yymatches); // skip global match\n                $this->token = key($yymatches); // token number\n                if ($tokenMap[$this->token]) {\n                    // extract sub-patterns for passing to lex function\n                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,\n                        $tokenMap[$this->token]);\n                } else {\n                    $yysubmatches = array();\n                }\n                $this->value = current($yymatches); // token value\n                $r = $this->{'yy_r3_' . $this->token}($yysubmatches);\n                if ($r === null) {\n                    $this->counter += strlen($this->value);\n                    $this->line += substr_count($this->value, \"\\n\");\n                    // accept this token\n                    return true;\n                } elseif ($r === true) {\n                    // we have changed state\n                    // process this token in the new state\n                    return $this->yylex();\n                } elseif ($r === false) {\n                    $this->counter += strlen($this->value);\n                    $this->line += substr_count($this->value, \"\\n\");\n                    if ($this->counter >= strlen($this->data)) {\n                        return false; // end of input\n                    }\n                    // skip this token\n                    continue;\n                }            } else {\n                throw new Exception('Unexpected input at line' . $this->line .\n                    ': ' . $this->data[$this->counter]);\n            }\n            break;\n        } while (true);\n\n    } // end function\n\n\n    const NAKED_STRING_VALUE = 3;\n    function yy_r3_1($yy_subpatterns)\n    {\n\n    $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;\n    $this->yypopstate();\n    }\n\n\n\n    function yylex4()\n    {\n        $tokenMap = array (\n              1 => 0,\n              2 => 0,\n              3 => 0,\n            );\n        if ($this->counter >= strlen($this->data)) {\n            return false; // end of input\n        }\n        $yy_global_pattern = \"/\\G([ \\t\\r]+)|\\G([^\\n]+?(?=[ \\t\\r]*\\n))|\\G(\\n)/iS\";\n\n        do {\n            if ($this->mbstring_overload ? preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {\n                $yysubmatches = $yymatches;\n                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns\n                if (!count($yymatches)) {\n                    throw new Exception('Error: lexing failed because a rule matched' .\n                        ' an empty string.  Input \"' . substr($this->data,\n                        $this->counter, 5) . '... state COMMENT');\n                }\n                next($yymatches); // skip global match\n                $this->token = key($yymatches); // token number\n                if ($tokenMap[$this->token]) {\n                    // extract sub-patterns for passing to lex function\n                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,\n                        $tokenMap[$this->token]);\n                } else {\n                    $yysubmatches = array();\n                }\n                $this->value = current($yymatches); // token value\n                $r = $this->{'yy_r4_' . $this->token}($yysubmatches);\n                if ($r === null) {\n                    $this->counter += strlen($this->value);\n                    $this->line += substr_count($this->value, \"\\n\");\n                    // accept this token\n                    return true;\n                } elseif ($r === true) {\n                    // we have changed state\n                    // process this token in the new state\n                    return $this->yylex();\n                } elseif ($r === false) {\n                    $this->counter += strlen($this->value);\n                    $this->line += substr_count($this->value, \"\\n\");\n                    if ($this->counter >= strlen($this->data)) {\n                        return false; // end of input\n                    }\n                    // skip this token\n                    continue;\n                }            } else {\n                throw new Exception('Unexpected input at line' . $this->line .\n                    ': ' . $this->data[$this->counter]);\n            }\n            break;\n        } while (true);\n\n    } // end function\n\n\n    const COMMENT = 4;\n    function yy_r4_1($yy_subpatterns)\n    {\n\n    return false;\n    }\n    function yy_r4_2($yy_subpatterns)\n    {\n\n    $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;\n    }\n    function yy_r4_3($yy_subpatterns)\n    {\n\n    $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;\n    $this->yypopstate();\n    }\n\n\n\n    function yylex5()\n    {\n        $tokenMap = array (\n              1 => 0,\n              2 => 0,\n            );\n        if ($this->counter >= strlen($this->data)) {\n            return false; // end of input\n        }\n        $yy_global_pattern = \"/\\G(\\\\.)|\\G(.*?(?=[\\.=[\\]\\r\\n]))/iS\";\n\n        do {\n            if ($this->mbstring_overload ? preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {\n                $yysubmatches = $yymatches;\n                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns\n                if (!count($yymatches)) {\n                    throw new Exception('Error: lexing failed because a rule matched' .\n                        ' an empty string.  Input \"' . substr($this->data,\n                        $this->counter, 5) . '... state SECTION');\n                }\n                next($yymatches); // skip global match\n                $this->token = key($yymatches); // token number\n                if ($tokenMap[$this->token]) {\n                    // extract sub-patterns for passing to lex function\n                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,\n                        $tokenMap[$this->token]);\n                } else {\n                    $yysubmatches = array();\n                }\n                $this->value = current($yymatches); // token value\n                $r = $this->{'yy_r5_' . $this->token}($yysubmatches);\n                if ($r === null) {\n                    $this->counter += strlen($this->value);\n                    $this->line += substr_count($this->value, \"\\n\");\n                    // accept this token\n                    return true;\n                } elseif ($r === true) {\n                    // we have changed state\n                    // process this token in the new state\n                    return $this->yylex();\n                } elseif ($r === false) {\n                    $this->counter += strlen($this->value);\n                    $this->line += substr_count($this->value, \"\\n\");\n                    if ($this->counter >= strlen($this->data)) {\n                        return false; // end of input\n                    }\n                    // skip this token\n                    continue;\n                }            } else {\n                throw new Exception('Unexpected input at line' . $this->line .\n                    ': ' . $this->data[$this->counter]);\n            }\n            break;\n        } while (true);\n\n    } // end function\n\n\n    const SECTION = 5;\n    function yy_r5_1($yy_subpatterns)\n    {\n\n    $this->token = Smarty_Internal_Configfileparser::TPC_DOT;\n    }\n    function yy_r5_2($yy_subpatterns)\n    {\n\n    $this->token = Smarty_Internal_Configfileparser::TPC_SECTION;\n    $this->yypopstate();\n    }\n\n\n    function yylex6()\n    {\n        $tokenMap = array (\n              1 => 0,\n              2 => 0,\n              3 => 2,\n            );\n        if ($this->counter >= strlen($this->data)) {\n            return false; // end of input\n        }\n        $yy_global_pattern = \"/\\G(\\\"\\\"\\\"(?=[ \\t\\r]*[\\n#;]))|\\G([ \\t\\r]*\\n)|\\G(([\\S\\s]*?)(?=([ \\t\\r]*\\n|\\\"\\\"\\\")))/iS\";\n\n        do {\n            if ($this->mbstring_overload ? preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {\n                $yysubmatches = $yymatches;\n                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns\n                if (!count($yymatches)) {\n                    throw new Exception('Error: lexing failed because a rule matched' .\n                        ' an empty string.  Input \"' . substr($this->data,\n                        $this->counter, 5) . '... state TRIPPLE');\n                }\n                next($yymatches); // skip global match\n                $this->token = key($yymatches); // token number\n                if ($tokenMap[$this->token]) {\n                    // extract sub-patterns for passing to lex function\n                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,\n                        $tokenMap[$this->token]);\n                } else {\n                    $yysubmatches = array();\n                }\n                $this->value = current($yymatches); // token value\n                $r = $this->{'yy_r6_' . $this->token}($yysubmatches);\n                if ($r === null) {\n                    $this->counter += strlen($this->value);\n                    $this->line += substr_count($this->value, \"\\n\");\n                    // accept this token\n                    return true;\n                } elseif ($r === true) {\n                    // we have changed state\n                    // process this token in the new state\n                    return $this->yylex();\n                } elseif ($r === false) {\n                    $this->counter += strlen($this->value);\n                    $this->line += substr_count($this->value, \"\\n\");\n                    if ($this->counter >= strlen($this->data)) {\n                        return false; // end of input\n                    }\n                    // skip this token\n                    continue;\n                }            } else {\n                throw new Exception('Unexpected input at line' . $this->line .\n                    ': ' . $this->data[$this->counter]);\n            }\n            break;\n        } while (true);\n\n    } // end function\n\n\n    const TRIPPLE = 6;\n    function yy_r6_1($yy_subpatterns)\n    {\n\n    $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES_END;\n    $this->yypopstate();\n    $this->yypushstate(self::START);\n    }\n    function yy_r6_2($yy_subpatterns)\n    {\n\n    $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_CONTENT;\n    }\n    function yy_r6_3($yy_subpatterns)\n    {\n\n    $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_CONTENT;\n    }\n\n\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_configfileparser.php",
    "content": "<?php\n/**\n* Smarty Internal Plugin Configfileparser\n*\n* This is the config file parser.\n* It is generated from the internal.configfileparser.y file\n* @package Smarty\n* @subpackage Compiler\n* @author Uwe Tews\n*/\n\nclass TPC_yyToken implements ArrayAccess\n{\n    public $string = '';\n    public $metadata = array();\n\n    function __construct($s, $m = array())\n    {\n        if ($s instanceof TPC_yyToken) {\n            $this->string = $s->string;\n            $this->metadata = $s->metadata;\n        } else {\n            $this->string = (string) $s;\n            if ($m instanceof TPC_yyToken) {\n                $this->metadata = $m->metadata;\n            } elseif (is_array($m)) {\n                $this->metadata = $m;\n            }\n        }\n    }\n\n    function __toString()\n    {\n        return $this->_string;\n    }\n\n    function offsetExists($offset)\n    {\n        return isset($this->metadata[$offset]);\n    }\n\n    function offsetGet($offset)\n    {\n        return $this->metadata[$offset];\n    }\n\n    function offsetSet($offset, $value)\n    {\n        if ($offset === null) {\n            if (isset($value[0])) {\n                $x = ($value instanceof TPC_yyToken) ?\n                    $value->metadata : $value;\n                $this->metadata = array_merge($this->metadata, $x);\n                return;\n            }\n            $offset = count($this->metadata);\n        }\n        if ($value === null) {\n            return;\n        }\n        if ($value instanceof TPC_yyToken) {\n            if ($value->metadata) {\n                $this->metadata[$offset] = $value->metadata;\n            }\n        } elseif ($value) {\n            $this->metadata[$offset] = $value;\n        }\n    }\n\n    function offsetUnset($offset)\n    {\n        unset($this->metadata[$offset]);\n    }\n}\n\nclass TPC_yyStackEntry\n{\n    public $stateno;       /* The state-number */\n    public $major;         /* The major token value.  This is the code\n                     ** number for the token at this stack level */\n    public $minor; /* The user-supplied minor token value.  This\n                     ** is the value of the token  */\n};\n\n\n#line 12 \"smarty_internal_configfileparser.y\"\nclass Smarty_Internal_Configfileparser#line 79 \"smarty_internal_configfileparser.php\"\n{\n#line 14 \"smarty_internal_configfileparser.y\"\n\n    // states whether the parse was successful or not\n    public $successful = true;\n    public $retvalue = 0;\n    private $lex;\n    private $internalError = false;\n\n    function __construct($lex, $compiler) {\n        // set instance object\n        self::instance($this);\n        $this->lex = $lex;\n        $this->smarty = $compiler->smarty;\n        $this->compiler = $compiler;\n    }\n    public static function &instance($new_instance = null)\n    {\n        static $instance = null;\n        if (isset($new_instance) && is_object($new_instance))\n            $instance = $new_instance;\n        return $instance;\n    }\n\n    private function parse_bool($str) {\n        if (in_array(strtolower($str) ,array('on','yes','true'))) {\n            $res = true;\n        } else {\n            $res = false;\n        }\n        return $res;\n    }\n\n    private static $escapes_single = Array('\\\\' => '\\\\',\n                                          '\\'' => '\\'');\n    private static function parse_single_quoted_string($qstr) {\n        $escaped_string = substr($qstr, 1, strlen($qstr)-2); //remove outer quotes\n\n        $ss = preg_split('/(\\\\\\\\.)/', $escaped_string, -1, PREG_SPLIT_DELIM_CAPTURE);\n\n        $str = \"\";\n        foreach ($ss as $s) {\n            if (strlen($s) === 2 && $s[0] === '\\\\') {\n                if (isset(self::$escapes_single[$s[1]])) {\n                    $s = self::$escapes_single[$s[1]];\n                }\n             }\n\n             $str .= $s;\n        }\n\n        return $str;\n    }\n\n    private static function parse_double_quoted_string($qstr) {\n        $inner_str = substr($qstr, 1, strlen($qstr)-2);\n        return stripcslashes($inner_str);\n    }\n\n    private static function parse_tripple_double_quoted_string($qstr) {\n        return stripcslashes($qstr);\n    }\n\n    private function set_var(Array $var, Array &$target_array) {\n        $key = $var[\"key\"];\n        $value = $var[\"value\"];\n\n        if ($this->smarty->config_overwrite || !isset($target_array['vars'][$key])) {\n            $target_array['vars'][$key] = $value;\n        } else {\n            settype($target_array['vars'][$key], 'array');\n            $target_array['vars'][$key][] = $value;\n        }\n    }\n\n    private function add_global_vars(Array $vars) {\n        if (!isset($this->compiler->config_data['vars'])) {\n      $this->compiler->config_data['vars'] = Array();\n        }\n        foreach ($vars as $var) {\n            $this->set_var($var, $this->compiler->config_data);\n        }\n    }\n\n    private function add_section_vars($section_name, Array $vars) {\n        if (!isset($this->compiler->config_data['sections'][$section_name]['vars'])) {\n            $this->compiler->config_data['sections'][$section_name]['vars'] = Array();\n        }\n        foreach ($vars as $var) {\n            $this->set_var($var, $this->compiler->config_data['sections'][$section_name]);\n        }\n    }\n#line 173 \"smarty_internal_configfileparser.php\"\n\n    const TPC_OPENB                          =  1;\n    const TPC_SECTION                        =  2;\n    const TPC_CLOSEB                         =  3;\n    const TPC_DOT                            =  4;\n    const TPC_ID                             =  5;\n    const TPC_EQUAL                          =  6;\n    const TPC_FLOAT                          =  7;\n    const TPC_INT                            =  8;\n    const TPC_BOOL                           =  9;\n    const TPC_SINGLE_QUOTED_STRING           = 10;\n    const TPC_DOUBLE_QUOTED_STRING           = 11;\n    const TPC_TRIPPLE_QUOTES                 = 12;\n    const TPC_TRIPPLE_QUOTES_END             = 13;\n    const TPC_NAKED_STRING                   = 14;\n    const TPC_TRIPPLE_CONTENT                = 15;\n    const TPC_NEWLINE                        = 16;\n    const TPC_COMMENTSTART                   = 17;\n    const YY_NO_ACTION = 61;\n    const YY_ACCEPT_ACTION = 60;\n    const YY_ERROR_ACTION = 59;\n\n    const YY_SZ_ACTTAB = 39;\nstatic public $yy_action = array(\n /*     0 */    29,   30,   34,   33,   24,    7,   19,   21,   60,    9,\n /*    10 */    16,    1,   20,   14,   15,    6,   23,   20,   14,   32,\n /*    20 */    17,   31,   18,   27,   26,    2,    3,    5,   25,   22,\n /*    30 */    35,    4,   13,   11,   10,   12,   53,   28,    8,\n    );\n    static public $yy_lookahead = array(\n /*     0 */     7,    8,    9,   10,   11,   12,    5,   14,   19,   20,\n /*    10 */     2,   22,   16,   17,   14,    3,   16,   16,   17,   13,\n /*    20 */     2,   15,    4,   24,   25,   22,   22,    3,   26,   16,\n /*    30 */    15,    6,   27,   24,   24,    1,   28,   23,   21,\n);\n    const YY_SHIFT_USE_DFLT = -8;\n    const YY_SHIFT_MAX = 19;\n    static public $yy_shift_ofst = array(\n /*     0 */    -8,    1,    1,    1,   -7,   -4,   -4,   15,   34,   -8,\n /*    10 */    -8,   -8,   18,    6,    0,   13,   24,   12,    8,   25,\n);\n    const YY_REDUCE_USE_DFLT = -12;\n    const YY_REDUCE_MAX = 11;\n    static public $yy_reduce_ofst = array(\n /*     0 */   -11,   -1,   -1,   -1,    2,   10,    9,    5,   14,   17,\n /*    10 */     3,    4,\n);\n    static public $yyExpectedTokens = array(\n        /* 0 */ array(),\n        /* 1 */ array(5, 16, 17, ),\n        /* 2 */ array(5, 16, 17, ),\n        /* 3 */ array(5, 16, 17, ),\n        /* 4 */ array(7, 8, 9, 10, 11, 12, 14, ),\n        /* 5 */ array(16, 17, ),\n        /* 6 */ array(16, 17, ),\n        /* 7 */ array(15, ),\n        /* 8 */ array(1, ),\n        /* 9 */ array(),\n        /* 10 */ array(),\n        /* 11 */ array(),\n        /* 12 */ array(2, 4, ),\n        /* 13 */ array(13, 15, ),\n        /* 14 */ array(14, 16, ),\n        /* 15 */ array(16, ),\n        /* 16 */ array(3, ),\n        /* 17 */ array(3, ),\n        /* 18 */ array(2, ),\n        /* 19 */ array(6, ),\n        /* 20 */ array(),\n        /* 21 */ array(),\n        /* 22 */ array(),\n        /* 23 */ array(),\n        /* 24 */ array(),\n        /* 25 */ array(),\n        /* 26 */ array(),\n        /* 27 */ array(),\n        /* 28 */ array(),\n        /* 29 */ array(),\n        /* 30 */ array(),\n        /* 31 */ array(),\n        /* 32 */ array(),\n        /* 33 */ array(),\n        /* 34 */ array(),\n        /* 35 */ array(),\n);\n    static public $yy_default = array(\n /*     0 */    44,   37,   41,   40,   59,   59,   59,   55,   36,   39,\n /*    10 */    44,   44,   59,   59,   59,   59,   59,   59,   59,   59,\n /*    20 */    56,   52,   58,   57,   50,   45,   43,   42,   38,   46,\n /*    30 */    47,   53,   51,   49,   48,   54,\n);\n    const YYNOCODE = 29;\n    const YYSTACKDEPTH = 100;\n    const YYNSTATE = 36;\n    const YYNRULE = 23;\n    const YYERRORSYMBOL = 18;\n    const YYERRSYMDT = 'yy0';\n    const YYFALLBACK = 0;\n    static public $yyFallback = array(\n    );\n    static function Trace($TraceFILE, $zTracePrompt)\n    {\n        if (!$TraceFILE) {\n            $zTracePrompt = 0;\n        } elseif (!$zTracePrompt) {\n            $TraceFILE = 0;\n        }\n        self::$yyTraceFILE = $TraceFILE;\n        self::$yyTracePrompt = $zTracePrompt;\n    }\n\n    static function PrintTrace()\n    {\n        self::$yyTraceFILE = fopen('php://output', 'w');\n        self::$yyTracePrompt = '<br>';\n    }\n\n    static public $yyTraceFILE;\n    static public $yyTracePrompt;\n    public $yyidx;                    /* Index of top element in stack */\n    public $yyerrcnt;                 /* Shifts left before out of the error */\n    public $yystack = array();  /* The parser's stack */\n\n    public $yyTokenName = array(\n  '$',             'OPENB',         'SECTION',       'CLOSEB',\n  'DOT',           'ID',            'EQUAL',         'FLOAT',\n  'INT',           'BOOL',          'SINGLE_QUOTED_STRING',  'DOUBLE_QUOTED_STRING',\n  'TRIPPLE_QUOTES',  'TRIPPLE_QUOTES_END',  'NAKED_STRING',  'TRIPPLE_CONTENT',\n  'NEWLINE',       'COMMENTSTART',  'error',         'start',\n  'global_vars',   'sections',      'var_list',      'section',\n  'newline',       'var',           'value',         'tripple_content',\n    );\n\n    static public $yyRuleName = array(\n /*   0 */ \"start ::= global_vars sections\",\n /*   1 */ \"global_vars ::= var_list\",\n /*   2 */ \"sections ::= sections section\",\n /*   3 */ \"sections ::=\",\n /*   4 */ \"section ::= OPENB SECTION CLOSEB newline var_list\",\n /*   5 */ \"section ::= OPENB DOT SECTION CLOSEB newline var_list\",\n /*   6 */ \"var_list ::= var_list newline\",\n /*   7 */ \"var_list ::= var_list var\",\n /*   8 */ \"var_list ::=\",\n /*   9 */ \"var ::= ID EQUAL value\",\n /*  10 */ \"value ::= FLOAT\",\n /*  11 */ \"value ::= INT\",\n /*  12 */ \"value ::= BOOL\",\n /*  13 */ \"value ::= SINGLE_QUOTED_STRING\",\n /*  14 */ \"value ::= DOUBLE_QUOTED_STRING\",\n /*  15 */ \"value ::= TRIPPLE_QUOTES tripple_content TRIPPLE_QUOTES_END\",\n /*  16 */ \"value ::= NAKED_STRING\",\n /*  17 */ \"tripple_content ::= tripple_content TRIPPLE_CONTENT\",\n /*  18 */ \"tripple_content ::= TRIPPLE_CONTENT\",\n /*  19 */ \"tripple_content ::=\",\n /*  20 */ \"newline ::= NEWLINE\",\n /*  21 */ \"newline ::= COMMENTSTART NEWLINE\",\n /*  22 */ \"newline ::= COMMENTSTART NAKED_STRING NEWLINE\",\n    );\n\n    function tokenName($tokenType)\n    {\n        if ($tokenType === 0) {\n            return 'End of Input';\n        }\n        if ($tokenType > 0 && $tokenType < count($this->yyTokenName)) {\n            return $this->yyTokenName[$tokenType];\n        } else {\n            return \"Unknown\";\n        }\n    }\n\n    static function yy_destructor($yymajor, $yypminor)\n    {\n        switch ($yymajor) {\n            default:  break;   /* If no destructor action specified: do nothing */\n        }\n    }\n\n    function yy_pop_parser_stack()\n    {\n        if (!count($this->yystack)) {\n            return;\n        }\n        $yytos = array_pop($this->yystack);\n        if (self::$yyTraceFILE && $this->yyidx >= 0) {\n            fwrite(self::$yyTraceFILE,\n                self::$yyTracePrompt . 'Popping ' . $this->yyTokenName[$yytos->major] .\n                    \"\\n\");\n        }\n        $yymajor = $yytos->major;\n        self::yy_destructor($yymajor, $yytos->minor);\n        $this->yyidx--;\n        return $yymajor;\n    }\n\n    function __destruct()\n    {\n        while ($this->yystack !== Array()) {\n            $this->yy_pop_parser_stack();\n        }\n        if (is_resource(self::$yyTraceFILE)) {\n            fclose(self::$yyTraceFILE);\n        }\n    }\n\n    function yy_get_expected_tokens($token)\n    {\n        $state = $this->yystack[$this->yyidx]->stateno;\n        $expected = self::$yyExpectedTokens[$state];\n        if (in_array($token, self::$yyExpectedTokens[$state], true)) {\n            return $expected;\n        }\n        $stack = $this->yystack;\n        $yyidx = $this->yyidx;\n        do {\n            $yyact = $this->yy_find_shift_action($token);\n            if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {\n                // reduce action\n                $done = 0;\n                do {\n                    if ($done++ == 100) {\n                        $this->yyidx = $yyidx;\n                        $this->yystack = $stack;\n                        // too much recursion prevents proper detection\n                        // so give up\n                        return array_unique($expected);\n                    }\n                    $yyruleno = $yyact - self::YYNSTATE;\n                    $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs'];\n                    $nextstate = $this->yy_find_reduce_action(\n                        $this->yystack[$this->yyidx]->stateno,\n                        self::$yyRuleInfo[$yyruleno]['lhs']);\n                    if (isset(self::$yyExpectedTokens[$nextstate])) {\n\t\t        $expected = array_merge($expected, self::$yyExpectedTokens[$nextstate]);\n                            if (in_array($token,\n                                  self::$yyExpectedTokens[$nextstate], true)) {\n                            $this->yyidx = $yyidx;\n                            $this->yystack = $stack;\n                            return array_unique($expected);\n                        }\n                    }\n                    if ($nextstate < self::YYNSTATE) {\n                        // we need to shift a non-terminal\n                        $this->yyidx++;\n                        $x = new TPC_yyStackEntry;\n                        $x->stateno = $nextstate;\n                        $x->major = self::$yyRuleInfo[$yyruleno]['lhs'];\n                        $this->yystack[$this->yyidx] = $x;\n                        continue 2;\n                    } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {\n                        $this->yyidx = $yyidx;\n                        $this->yystack = $stack;\n                        // the last token was just ignored, we can't accept\n                        // by ignoring input, this is in essence ignoring a\n                        // syntax error!\n                        return array_unique($expected);\n                    } elseif ($nextstate === self::YY_NO_ACTION) {\n                        $this->yyidx = $yyidx;\n                        $this->yystack = $stack;\n                        // input accepted, but not shifted (I guess)\n                        return $expected;\n                    } else {\n                        $yyact = $nextstate;\n                    }\n                } while (true);\n            }\n            break;\n        } while (true);\n\t$this->yyidx = $yyidx;\n\t$this->yystack = $stack;\n        return array_unique($expected);\n    }\n\n    function yy_is_expected_token($token)\n    {\n        if ($token === 0) {\n            return true; // 0 is not part of this\n        }\n        $state = $this->yystack[$this->yyidx]->stateno;\n        if (in_array($token, self::$yyExpectedTokens[$state], true)) {\n            return true;\n        }\n        $stack = $this->yystack;\n        $yyidx = $this->yyidx;\n        do {\n            $yyact = $this->yy_find_shift_action($token);\n            if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {\n                // reduce action\n                $done = 0;\n                do {\n                    if ($done++ == 100) {\n                        $this->yyidx = $yyidx;\n                        $this->yystack = $stack;\n                        // too much recursion prevents proper detection\n                        // so give up\n                        return true;\n                    }\n                    $yyruleno = $yyact - self::YYNSTATE;\n                    $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs'];\n                    $nextstate = $this->yy_find_reduce_action(\n                        $this->yystack[$this->yyidx]->stateno,\n                        self::$yyRuleInfo[$yyruleno]['lhs']);\n                    if (isset(self::$yyExpectedTokens[$nextstate]) &&\n                          in_array($token, self::$yyExpectedTokens[$nextstate], true)) {\n                        $this->yyidx = $yyidx;\n                        $this->yystack = $stack;\n                        return true;\n                    }\n                    if ($nextstate < self::YYNSTATE) {\n                        // we need to shift a non-terminal\n                        $this->yyidx++;\n                        $x = new TPC_yyStackEntry;\n                        $x->stateno = $nextstate;\n                        $x->major = self::$yyRuleInfo[$yyruleno]['lhs'];\n                        $this->yystack[$this->yyidx] = $x;\n                        continue 2;\n                    } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {\n                        $this->yyidx = $yyidx;\n                        $this->yystack = $stack;\n                        if (!$token) {\n                            // end of input: this is valid\n                            return true;\n                        }\n                        // the last token was just ignored, we can't accept\n                        // by ignoring input, this is in essence ignoring a\n                        // syntax error!\n                        return false;\n                    } elseif ($nextstate === self::YY_NO_ACTION) {\n                        $this->yyidx = $yyidx;\n                        $this->yystack = $stack;\n                        // input accepted, but not shifted (I guess)\n                        return true;\n                    } else {\n                        $yyact = $nextstate;\n                    }\n                } while (true);\n            }\n            break;\n        } while (true);\n        $this->yyidx = $yyidx;\n        $this->yystack = $stack;\n        return true;\n    }\n\n   function yy_find_shift_action($iLookAhead)\n    {\n        $stateno = $this->yystack[$this->yyidx]->stateno;\n\n        /* if ($this->yyidx < 0) return self::YY_NO_ACTION;  */\n        if (!isset(self::$yy_shift_ofst[$stateno])) {\n            // no shift actions\n            return self::$yy_default[$stateno];\n        }\n        $i = self::$yy_shift_ofst[$stateno];\n        if ($i === self::YY_SHIFT_USE_DFLT) {\n            return self::$yy_default[$stateno];\n        }\n        if ($iLookAhead == self::YYNOCODE) {\n            return self::YY_NO_ACTION;\n        }\n        $i += $iLookAhead;\n        if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||\n              self::$yy_lookahead[$i] != $iLookAhead) {\n            if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback)\n                   && ($iFallback = self::$yyFallback[$iLookAhead]) != 0) {\n                if (self::$yyTraceFILE) {\n                    fwrite(self::$yyTraceFILE, self::$yyTracePrompt . \"FALLBACK \" .\n                        $this->yyTokenName[$iLookAhead] . \" => \" .\n                        $this->yyTokenName[$iFallback] . \"\\n\");\n                }\n                return $this->yy_find_shift_action($iFallback);\n            }\n            return self::$yy_default[$stateno];\n        } else {\n            return self::$yy_action[$i];\n        }\n    }\n\n    function yy_find_reduce_action($stateno, $iLookAhead)\n    {\n        /* $stateno = $this->yystack[$this->yyidx]->stateno; */\n\n        if (!isset(self::$yy_reduce_ofst[$stateno])) {\n            return self::$yy_default[$stateno];\n        }\n        $i = self::$yy_reduce_ofst[$stateno];\n        if ($i == self::YY_REDUCE_USE_DFLT) {\n            return self::$yy_default[$stateno];\n        }\n        if ($iLookAhead == self::YYNOCODE) {\n            return self::YY_NO_ACTION;\n        }\n        $i += $iLookAhead;\n        if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||\n              self::$yy_lookahead[$i] != $iLookAhead) {\n            return self::$yy_default[$stateno];\n        } else {\n            return self::$yy_action[$i];\n        }\n    }\n\n    function yy_shift($yyNewState, $yyMajor, $yypMinor)\n    {\n        $this->yyidx++;\n        if ($this->yyidx >= self::YYSTACKDEPTH) {\n            $this->yyidx--;\n            if (self::$yyTraceFILE) {\n                fprintf(self::$yyTraceFILE, \"%sStack Overflow!\\n\", self::$yyTracePrompt);\n            }\n            while ($this->yyidx >= 0) {\n                $this->yy_pop_parser_stack();\n            }\n#line 125 \"smarty_internal_configfileparser.y\"\n\n    $this->internalError = true;\n    $this->compiler->trigger_config_file_error(\"Stack overflow in configfile parser\");\n#line 593 \"smarty_internal_configfileparser.php\"\n            return;\n        }\n        $yytos = new TPC_yyStackEntry;\n        $yytos->stateno = $yyNewState;\n        $yytos->major = $yyMajor;\n        $yytos->minor = $yypMinor;\n        array_push($this->yystack, $yytos);\n        if (self::$yyTraceFILE && $this->yyidx > 0) {\n            fprintf(self::$yyTraceFILE, \"%sShift %d\\n\", self::$yyTracePrompt,\n                $yyNewState);\n            fprintf(self::$yyTraceFILE, \"%sStack:\", self::$yyTracePrompt);\n            for($i = 1; $i <= $this->yyidx; $i++) {\n                fprintf(self::$yyTraceFILE, \" %s\",\n                    $this->yyTokenName[$this->yystack[$i]->major]);\n            }\n            fwrite(self::$yyTraceFILE,\"\\n\");\n        }\n    }\n\n    static public $yyRuleInfo = array(\n  array( 'lhs' => 19, 'rhs' => 2 ),\n  array( 'lhs' => 20, 'rhs' => 1 ),\n  array( 'lhs' => 21, 'rhs' => 2 ),\n  array( 'lhs' => 21, 'rhs' => 0 ),\n  array( 'lhs' => 23, 'rhs' => 5 ),\n  array( 'lhs' => 23, 'rhs' => 6 ),\n  array( 'lhs' => 22, 'rhs' => 2 ),\n  array( 'lhs' => 22, 'rhs' => 2 ),\n  array( 'lhs' => 22, 'rhs' => 0 ),\n  array( 'lhs' => 25, 'rhs' => 3 ),\n  array( 'lhs' => 26, 'rhs' => 1 ),\n  array( 'lhs' => 26, 'rhs' => 1 ),\n  array( 'lhs' => 26, 'rhs' => 1 ),\n  array( 'lhs' => 26, 'rhs' => 1 ),\n  array( 'lhs' => 26, 'rhs' => 1 ),\n  array( 'lhs' => 26, 'rhs' => 3 ),\n  array( 'lhs' => 26, 'rhs' => 1 ),\n  array( 'lhs' => 27, 'rhs' => 2 ),\n  array( 'lhs' => 27, 'rhs' => 1 ),\n  array( 'lhs' => 27, 'rhs' => 0 ),\n  array( 'lhs' => 24, 'rhs' => 1 ),\n  array( 'lhs' => 24, 'rhs' => 2 ),\n  array( 'lhs' => 24, 'rhs' => 3 ),\n    );\n\n    static public $yyReduceMap = array(\n        0 => 0,\n        2 => 0,\n        3 => 0,\n        20 => 0,\n        21 => 0,\n        22 => 0,\n        1 => 1,\n        4 => 4,\n        5 => 5,\n        6 => 6,\n        7 => 7,\n        8 => 8,\n        9 => 9,\n        10 => 10,\n        11 => 11,\n        12 => 12,\n        13 => 13,\n        14 => 14,\n        15 => 15,\n        16 => 16,\n        18 => 16,\n        17 => 17,\n        19 => 19,\n    );\n#line 131 \"smarty_internal_configfileparser.y\"\n    function yy_r0(){\n    $this->_retvalue = null;\n    }\n#line 668 \"smarty_internal_configfileparser.php\"\n#line 136 \"smarty_internal_configfileparser.y\"\n    function yy_r1(){\n    $this->add_global_vars($this->yystack[$this->yyidx + 0]->minor); $this->_retvalue = null;\n    }\n#line 673 \"smarty_internal_configfileparser.php\"\n#line 149 \"smarty_internal_configfileparser.y\"\n    function yy_r4(){\n    $this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor);\n    $this->_retvalue = null;\n    }\n#line 679 \"smarty_internal_configfileparser.php\"\n#line 154 \"smarty_internal_configfileparser.y\"\n    function yy_r5(){\n    if ($this->smarty->config_read_hidden) {\n        $this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor);\n    }\n    $this->_retvalue = null;\n    }\n#line 687 \"smarty_internal_configfileparser.php\"\n#line 162 \"smarty_internal_configfileparser.y\"\n    function yy_r6(){\n    $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor;\n    }\n#line 692 \"smarty_internal_configfileparser.php\"\n#line 166 \"smarty_internal_configfileparser.y\"\n    function yy_r7(){\n    $this->_retvalue = array_merge($this->yystack[$this->yyidx + -1]->minor, Array($this->yystack[$this->yyidx + 0]->minor));\n    }\n#line 697 \"smarty_internal_configfileparser.php\"\n#line 170 \"smarty_internal_configfileparser.y\"\n    function yy_r8(){\n    $this->_retvalue = Array();\n    }\n#line 702 \"smarty_internal_configfileparser.php\"\n#line 176 \"smarty_internal_configfileparser.y\"\n    function yy_r9(){\n    $this->_retvalue = Array(\"key\" => $this->yystack[$this->yyidx + -2]->minor, \"value\" => $this->yystack[$this->yyidx + 0]->minor);\n    }\n#line 707 \"smarty_internal_configfileparser.php\"\n#line 181 \"smarty_internal_configfileparser.y\"\n    function yy_r10(){\n    $this->_retvalue = (float) $this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 712 \"smarty_internal_configfileparser.php\"\n#line 185 \"smarty_internal_configfileparser.y\"\n    function yy_r11(){\n    $this->_retvalue = (int) $this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 717 \"smarty_internal_configfileparser.php\"\n#line 189 \"smarty_internal_configfileparser.y\"\n    function yy_r12(){\n    $this->_retvalue = $this->parse_bool($this->yystack[$this->yyidx + 0]->minor);\n    }\n#line 722 \"smarty_internal_configfileparser.php\"\n#line 193 \"smarty_internal_configfileparser.y\"\n    function yy_r13(){\n    $this->_retvalue = self::parse_single_quoted_string($this->yystack[$this->yyidx + 0]->minor);\n    }\n#line 727 \"smarty_internal_configfileparser.php\"\n#line 197 \"smarty_internal_configfileparser.y\"\n    function yy_r14(){\n    $this->_retvalue = self::parse_double_quoted_string($this->yystack[$this->yyidx + 0]->minor);\n    }\n#line 732 \"smarty_internal_configfileparser.php\"\n#line 201 \"smarty_internal_configfileparser.y\"\n    function yy_r15(){\n    $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[$this->yyidx + -1]->minor);\n    }\n#line 737 \"smarty_internal_configfileparser.php\"\n#line 205 \"smarty_internal_configfileparser.y\"\n    function yy_r16(){\n    $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 742 \"smarty_internal_configfileparser.php\"\n#line 210 \"smarty_internal_configfileparser.y\"\n    function yy_r17(){\n    $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor . $this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 747 \"smarty_internal_configfileparser.php\"\n#line 216 \"smarty_internal_configfileparser.y\"\n    function yy_r19(){\n    $this->_retvalue = '';\n    }\n#line 752 \"smarty_internal_configfileparser.php\"\n\n    private $_retvalue;\n\n    function yy_reduce($yyruleno)\n    {\n        $yymsp = $this->yystack[$this->yyidx];\n        if (self::$yyTraceFILE && $yyruleno >= 0\n              && $yyruleno < count(self::$yyRuleName)) {\n            fprintf(self::$yyTraceFILE, \"%sReduce (%d) [%s].\\n\",\n                self::$yyTracePrompt, $yyruleno,\n                self::$yyRuleName[$yyruleno]);\n        }\n\n        $this->_retvalue = $yy_lefthand_side = null;\n        if (array_key_exists($yyruleno, self::$yyReduceMap)) {\n            // call the action\n            $this->_retvalue = null;\n            $this->{'yy_r' . self::$yyReduceMap[$yyruleno]}();\n            $yy_lefthand_side = $this->_retvalue;\n        }\n        $yygoto = self::$yyRuleInfo[$yyruleno]['lhs'];\n        $yysize = self::$yyRuleInfo[$yyruleno]['rhs'];\n        $this->yyidx -= $yysize;\n        for($i = $yysize; $i; $i--) {\n            // pop all of the right-hand side parameters\n            array_pop($this->yystack);\n        }\n        $yyact = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, $yygoto);\n        if ($yyact < self::YYNSTATE) {\n            if (!self::$yyTraceFILE && $yysize) {\n                $this->yyidx++;\n                $x = new TPC_yyStackEntry;\n                $x->stateno = $yyact;\n                $x->major = $yygoto;\n                $x->minor = $yy_lefthand_side;\n                $this->yystack[$this->yyidx] = $x;\n            } else {\n                $this->yy_shift($yyact, $yygoto, $yy_lefthand_side);\n            }\n        } elseif ($yyact == self::YYNSTATE + self::YYNRULE + 1) {\n            $this->yy_accept();\n        }\n    }\n\n    function yy_parse_failed()\n    {\n        if (self::$yyTraceFILE) {\n            fprintf(self::$yyTraceFILE, \"%sFail!\\n\", self::$yyTracePrompt);\n        }\n        while ($this->yyidx >= 0) {\n            $this->yy_pop_parser_stack();\n        }\n    }\n\n    function yy_syntax_error($yymajor, $TOKEN)\n    {\n#line 118 \"smarty_internal_configfileparser.y\"\n\n    $this->internalError = true;\n    $this->yymajor = $yymajor;\n    $this->compiler->trigger_config_file_error();\n#line 815 \"smarty_internal_configfileparser.php\"\n    }\n\n    function yy_accept()\n    {\n        if (self::$yyTraceFILE) {\n            fprintf(self::$yyTraceFILE, \"%sAccept!\\n\", self::$yyTracePrompt);\n        }\n        while ($this->yyidx >= 0) {\n            $stack = $this->yy_pop_parser_stack();\n        }\n#line 110 \"smarty_internal_configfileparser.y\"\n\n    $this->successful = !$this->internalError;\n    $this->internalError = false;\n    $this->retvalue = $this->_retvalue;\n    //echo $this->retvalue.\"\\n\\n\";\n#line 833 \"smarty_internal_configfileparser.php\"\n    }\n\n    function doParse($yymajor, $yytokenvalue)\n    {\n        $yyerrorhit = 0;   /* True if yymajor has invoked an error */\n\n        if ($this->yyidx === null || $this->yyidx < 0) {\n            $this->yyidx = 0;\n            $this->yyerrcnt = -1;\n            $x = new TPC_yyStackEntry;\n            $x->stateno = 0;\n            $x->major = 0;\n            $this->yystack = array();\n            array_push($this->yystack, $x);\n        }\n        $yyendofinput = ($yymajor==0);\n\n        if (self::$yyTraceFILE) {\n            fprintf(self::$yyTraceFILE, \"%sInput %s\\n\",\n                self::$yyTracePrompt, $this->yyTokenName[$yymajor]);\n        }\n\n        do {\n            $yyact = $this->yy_find_shift_action($yymajor);\n            if ($yymajor < self::YYERRORSYMBOL &&\n                  !$this->yy_is_expected_token($yymajor)) {\n                // force a syntax error\n                $yyact = self::YY_ERROR_ACTION;\n            }\n            if ($yyact < self::YYNSTATE) {\n                $this->yy_shift($yyact, $yymajor, $yytokenvalue);\n                $this->yyerrcnt--;\n                if ($yyendofinput && $this->yyidx >= 0) {\n                    $yymajor = 0;\n                } else {\n                    $yymajor = self::YYNOCODE;\n                }\n            } elseif ($yyact < self::YYNSTATE + self::YYNRULE) {\n                $this->yy_reduce($yyact - self::YYNSTATE);\n            } elseif ($yyact == self::YY_ERROR_ACTION) {\n                if (self::$yyTraceFILE) {\n                    fprintf(self::$yyTraceFILE, \"%sSyntax Error!\\n\",\n                        self::$yyTracePrompt);\n                }\n                if (self::YYERRORSYMBOL) {\n                    if ($this->yyerrcnt < 0) {\n                        $this->yy_syntax_error($yymajor, $yytokenvalue);\n                    }\n                    $yymx = $this->yystack[$this->yyidx]->major;\n                    if ($yymx == self::YYERRORSYMBOL || $yyerrorhit ){\n                        if (self::$yyTraceFILE) {\n                            fprintf(self::$yyTraceFILE, \"%sDiscard input token %s\\n\",\n                                self::$yyTracePrompt, $this->yyTokenName[$yymajor]);\n                        }\n                        $this->yy_destructor($yymajor, $yytokenvalue);\n                        $yymajor = self::YYNOCODE;\n                    } else {\n                        while ($this->yyidx >= 0 &&\n                                 $yymx != self::YYERRORSYMBOL &&\n        ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE\n                              ){\n                            $this->yy_pop_parser_stack();\n                        }\n                        if ($this->yyidx < 0 || $yymajor==0) {\n                            $this->yy_destructor($yymajor, $yytokenvalue);\n                            $this->yy_parse_failed();\n                            $yymajor = self::YYNOCODE;\n                        } elseif ($yymx != self::YYERRORSYMBOL) {\n                            $u2 = 0;\n                            $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2);\n                        }\n                    }\n                    $this->yyerrcnt = 3;\n                    $yyerrorhit = 1;\n                } else {\n                    if ($this->yyerrcnt <= 0) {\n                        $this->yy_syntax_error($yymajor, $yytokenvalue);\n                    }\n                    $this->yyerrcnt = 3;\n                    $this->yy_destructor($yymajor, $yytokenvalue);\n                    if ($yyendofinput) {\n                        $this->yy_parse_failed();\n                    }\n                    $yymajor = self::YYNOCODE;\n                }\n            } else {\n                $this->yy_accept();\n                $yymajor = self::YYNOCODE;\n            }\n        } while ($yymajor != self::YYNOCODE && $this->yyidx >= 0);\n    }\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_data.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Data\n *\n * This file contains the basic classes and methodes for template and variable creation\n *\n * @package Smarty\n * @subpackage Template\n * @author Uwe Tews\n */\n\n/**\n * Base class with template and variable methodes\n *\n * @package Smarty\n * @subpackage Template\n */\nclass Smarty_Internal_Data {\n\n    /**\n     * name of class used for templates\n     *\n     * @var string\n     */\n    public $template_class = 'Smarty_Internal_Template';\n    /**\n     * template variables\n     *\n     * @var array\n     */\n    public $tpl_vars = array();\n    /**\n     * parent template (if any)\n     *\n     * @var Smarty_Internal_Template\n     */\n    public $parent = null;\n    /**\n     * configuration settings\n     *\n     * @var array\n     */\n    public $config_vars = array();\n\n    /**\n     * assigns a Smarty variable\n     *\n     * @param array|string $tpl_var the template variable name(s)\n     * @param mixed        $value   the value to assign\n     * @param boolean      $nocache if true any output of this variable will be not cached\n     * @param boolean $scope the scope the variable will have  (local,parent or root)\n     * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining\n     */\n    public function assign($tpl_var, $value = null, $nocache = false)\n    {\n        if (is_array($tpl_var)) {\n            foreach ($tpl_var as $_key => $_val) {\n                if ($_key != '') {\n                    $this->tpl_vars[$_key] = new Smarty_variable($_val, $nocache);\n                }\n            }\n        } else {\n            if ($tpl_var != '') {\n                $this->tpl_vars[$tpl_var] = new Smarty_variable($value, $nocache);\n            }\n        }\n\n        return $this;\n    }\n\n    /**\n     * assigns a global Smarty variable\n     *\n     * @param string $varname the global variable name\n     * @param mixed  $value   the value to assign\n     * @param boolean $nocache if true any output of this variable will be not cached\n     * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining\n     */\n    public function assignGlobal($varname, $value = null, $nocache = false)\n    {\n        if ($varname != '') {\n            Smarty::$global_tpl_vars[$varname] = new Smarty_variable($value, $nocache);\n        }\n\n        return $this;\n    }\n    /**\n     * assigns values to template variables by reference\n     *\n     * @param string $tpl_var the template variable name\n     * @param mixed $ &$value the referenced value to assign\n     * @param boolean $nocache if true any output of this variable will be not cached\n     * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining\n     */\n    public function assignByRef($tpl_var, &$value, $nocache = false)\n    {\n        if ($tpl_var != '') {\n            $this->tpl_vars[$tpl_var] = new Smarty_variable(null, $nocache);\n            $this->tpl_vars[$tpl_var]->value = &$value;\n        }\n\n        return $this;\n    }\n\n    /**\n     * appends values to template variables\n     *\n     * @param array|string $tpl_var the template variable name(s)\n     * @param mixed        $value   the value to append\n     * @param boolean      $merge   flag if array elements shall be merged\n     * @param boolean $nocache if true any output of this variable will be not cached\n     * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining\n     */\n    public function append($tpl_var, $value = null, $merge = false, $nocache = false)\n    {\n        if (is_array($tpl_var)) {\n            // $tpl_var is an array, ignore $value\n            foreach ($tpl_var as $_key => $_val) {\n                if ($_key != '') {\n                    if (!isset($this->tpl_vars[$_key])) {\n                        $tpl_var_inst = $this->getVariable($_key, null, true, false);\n                        if ($tpl_var_inst instanceof Undefined_Smarty_Variable) {\n                            $this->tpl_vars[$_key] = new Smarty_variable(null, $nocache);\n                        } else {\n                            $this->tpl_vars[$_key] = clone $tpl_var_inst;\n                        }\n                    }\n                    if (!(is_array($this->tpl_vars[$_key]->value) || $this->tpl_vars[$_key]->value instanceof ArrayAccess)) {\n                        settype($this->tpl_vars[$_key]->value, 'array');\n                    }\n                    if ($merge && is_array($_val)) {\n                        foreach($_val as $_mkey => $_mval) {\n                            $this->tpl_vars[$_key]->value[$_mkey] = $_mval;\n                        }\n                    } else {\n                        $this->tpl_vars[$_key]->value[] = $_val;\n                    }\n                }\n            }\n        } else {\n            if ($tpl_var != '' && isset($value)) {\n                if (!isset($this->tpl_vars[$tpl_var])) {\n                    $tpl_var_inst = $this->getVariable($tpl_var, null, true, false);\n                    if ($tpl_var_inst instanceof Undefined_Smarty_Variable) {\n                        $this->tpl_vars[$tpl_var] = new Smarty_variable(null, $nocache);\n                    } else {\n                        $this->tpl_vars[$tpl_var] = clone $tpl_var_inst;\n                    }\n                }\n                if (!(is_array($this->tpl_vars[$tpl_var]->value) || $this->tpl_vars[$tpl_var]->value instanceof ArrayAccess)) {\n                    settype($this->tpl_vars[$tpl_var]->value, 'array');\n                }\n                if ($merge && is_array($value)) {\n                    foreach($value as $_mkey => $_mval) {\n                        $this->tpl_vars[$tpl_var]->value[$_mkey] = $_mval;\n                    }\n                } else {\n                    $this->tpl_vars[$tpl_var]->value[] = $value;\n                }\n            }\n        }\n\n        return $this;\n    }\n\n    /**\n     * appends values to template variables by reference\n     *\n     * @param string $tpl_var the template variable name\n     * @param mixed  &$value  the referenced value to append\n     * @param boolean $merge  flag if array elements shall be merged\n     * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining\n     */\n    public function appendByRef($tpl_var, &$value, $merge = false)\n    {\n        if ($tpl_var != '' && isset($value)) {\n            if (!isset($this->tpl_vars[$tpl_var])) {\n                $this->tpl_vars[$tpl_var] = new Smarty_variable();\n            }\n            if (!is_array($this->tpl_vars[$tpl_var]->value)) {\n                settype($this->tpl_vars[$tpl_var]->value, 'array');\n            }\n            if ($merge && is_array($value)) {\n                foreach($value as $_key => $_val) {\n                    $this->tpl_vars[$tpl_var]->value[$_key] = &$value[$_key];\n                }\n            } else {\n                $this->tpl_vars[$tpl_var]->value[] = &$value;\n            }\n        }\n\n        return $this;\n    }\n\n    /**\n     * Returns a single or all template variables\n     *\n     * @param string  $varname        variable name or null\n     * @param string  $_ptr           optional pointer to data object\n     * @param boolean $search_parents include parent templates?\n     * @return string variable value or or array of variables\n     */\n    public function getTemplateVars($varname = null, $_ptr = null, $search_parents = true)\n    {\n        if (isset($varname)) {\n            $_var = $this->getVariable($varname, $_ptr, $search_parents, false);\n            if (is_object($_var)) {\n                return $_var->value;\n            } else {\n                return null;\n            }\n        } else {\n            $_result = array();\n            if ($_ptr === null) {\n                $_ptr = $this;\n            } while ($_ptr !== null) {\n                foreach ($_ptr->tpl_vars AS $key => $var) {\n                    if (!array_key_exists($key, $_result)) {\n                        $_result[$key] = $var->value;\n                    }\n                }\n                // not found, try at parent\n                if ($search_parents) {\n                    $_ptr = $_ptr->parent;\n                } else {\n                    $_ptr = null;\n                }\n            }\n            if ($search_parents && isset(Smarty::$global_tpl_vars)) {\n                foreach (Smarty::$global_tpl_vars AS $key => $var) {\n                    if (!array_key_exists($key, $_result)) {\n                        $_result[$key] = $var->value;\n                    }\n                }\n            }\n            return $_result;\n        }\n    }\n\n    /**\n     * clear the given assigned template variable.\n     *\n     * @param string|array $tpl_var the template variable(s) to clear\n     * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining\n     */\n    public function clearAssign($tpl_var)\n    {\n        if (is_array($tpl_var)) {\n            foreach ($tpl_var as $curr_var) {\n                unset($this->tpl_vars[$curr_var]);\n            }\n        } else {\n            unset($this->tpl_vars[$tpl_var]);\n        }\n\n        return $this;\n    }\n\n    /**\n     * clear all the assigned template variables.\n     * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining\n     */\n    public function clearAllAssign()\n    {\n        $this->tpl_vars = array();\n        return $this;\n    }\n\n    /**\n     * load a config file, optionally load just selected sections\n     *\n     * @param string $config_file filename\n     * @param mixed  $sections    array of section names, single section or null\n     * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining\n     */\n    public function configLoad($config_file, $sections = null)\n    {\n        // load Config class\n        $config = new Smarty_Internal_Config($config_file, $this->smarty, $this);\n        $config->loadConfigVars($sections);\n        return $this;\n    }\n\n    /**\n     * gets the object of a Smarty variable\n     *\n     * @param string  $variable the name of the Smarty variable\n     * @param object  $_ptr     optional pointer to data object\n     * @param boolean $search_parents search also in parent data\n     * @return object the object of the variable\n     */\n    public function getVariable($variable, $_ptr = null, $search_parents = true, $error_enable = true)\n    {\n        if ($_ptr === null) {\n            $_ptr = $this;\n        } while ($_ptr !== null) {\n            if (isset($_ptr->tpl_vars[$variable])) {\n                // found it, return it\n                return $_ptr->tpl_vars[$variable];\n            }\n            // not found, try at parent\n            if ($search_parents) {\n                $_ptr = $_ptr->parent;\n            } else {\n                $_ptr = null;\n            }\n        }\n        if (isset(Smarty::$global_tpl_vars[$variable])) {\n            // found it, return it\n            return Smarty::$global_tpl_vars[$variable];\n        }\n        if ($this->smarty->error_unassigned && $error_enable) {\n            // force a notice\n            $x = $$variable;\n        }\n        return new Undefined_Smarty_Variable;\n    }\n\n    /**\n     * gets  a config variable\n     *\n     * @param string $variable the name of the config variable\n     * @return mixed the value of the config variable\n     */\n    public function getConfigVariable($variable, $error_enable = true)\n    {\n        $_ptr = $this;\n        while ($_ptr !== null) {\n            if (isset($_ptr->config_vars[$variable])) {\n                // found it, return it\n                return $_ptr->config_vars[$variable];\n            }\n            // not found, try at parent\n            $_ptr = $_ptr->parent;\n        }\n        if ($this->smarty->error_unassigned && $error_enable) {\n            // force a notice\n            $x = $$variable;\n        }\n        return null;\n    }\n\n    /**\n     * gets  a stream variable\n     *\n     * @param string $variable the stream of the variable\n     * @return mixed the value of the stream variable\n     */\n    public function getStreamVariable($variable)\n    {\n        $_result = '';\n        $fp = fopen($variable, 'r+');\n        if ($fp) {\n            while (!feof($fp) && ($current_line = fgets($fp)) !== false ) {\n                $_result .= $current_line;\n            }\n            fclose($fp);\n            return $_result;\n        }\n\n        if ($this->smarty->error_unassigned) {\n            throw new SmartyException('Undefined stream variable \"' . $variable . '\"');\n        } else {\n            return null;\n        }\n    }\n\n    /**\n     * Returns a single or all config variables\n     *\n     * @param string $varname variable name or null\n     * @return string variable value or or array of variables\n     */\n    public function getConfigVars($varname = null, $search_parents = true)\n    {\n        $_ptr = $this;\n        $var_array = array();\n        while ($_ptr !== null) {\n            if (isset($varname)) {\n                if (isset($_ptr->config_vars[$varname])) {\n                    return $_ptr->config_vars[$varname];\n                }\n            } else {\n                $var_array = array_merge($_ptr->config_vars, $var_array);\n            }\n             // not found, try at parent\n            if ($search_parents) {\n                $_ptr = $_ptr->parent;\n            } else {\n                $_ptr = null;\n            }\n        }\n        if (isset($varname)) {\n            return '';\n        } else {\n            return $var_array;\n        }\n    }\n\n    /**\n     * Deassigns a single or all config variables\n     *\n     * @param string $varname variable name or null\n     * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining\n     */\n    public function clearConfig($varname = null)\n    {\n        if (isset($varname)) {\n            unset($this->config_vars[$varname]);\n        } else {\n            $this->config_vars = array();\n        }\n        return $this;\n    }\n\n}\n\n/**\n * class for the Smarty data object\n *\n * The Smarty data object will hold Smarty variables in the current scope\n *\n * @package Smarty\n * @subpackage Template\n */\nclass Smarty_Data extends Smarty_Internal_Data {\n\n    /**\n     * Smarty object\n     *\n     * @var Smarty\n     */\n    public $smarty = null;\n\n    /**\n     * create Smarty data object\n     *\n     * @param Smarty|array $_parent  parent template\n     * @param Smarty       $smarty   global smarty instance\n     */\n    public function __construct ($_parent = null, $smarty = null)\n    {\n        $this->smarty = $smarty;\n        if (is_object($_parent)) {\n            // when object set up back pointer\n            $this->parent = $_parent;\n        } elseif (is_array($_parent)) {\n            // set up variable values\n            foreach ($_parent as $_key => $_val) {\n                $this->tpl_vars[$_key] = new Smarty_variable($_val);\n            }\n        } elseif ($_parent != null) {\n            throw new SmartyException(\"Wrong type for template variables\");\n        }\n    }\n\n}\n\n/**\n * class for the Smarty variable object\n *\n * This class defines the Smarty variable object\n *\n * @package Smarty\n * @subpackage Template\n */\nclass Smarty_Variable {\n\n    /**\n     * template variable\n     *\n     * @var mixed\n     */\n    public $value = null;\n    /**\n     * if true any output of this variable will be not cached\n     *\n     * @var boolean\n     */\n    public $nocache = false;\n    /**\n     * the scope the variable will have  (local,parent or root)\n     *\n     * @var int\n     */\n    public $scope = Smarty::SCOPE_LOCAL;\n\n    /**\n     * create Smarty variable object\n     *\n     * @param mixed   $value   the value to assign\n     * @param boolean $nocache if true any output of this variable will be not cached\n     * @param int     $scope   the scope the variable will have  (local,parent or root)\n     */\n    public function __construct($value = null, $nocache = false, $scope = Smarty::SCOPE_LOCAL)\n    {\n        $this->value = $value;\n        $this->nocache = $nocache;\n        $this->scope = $scope;\n    }\n\n    /**\n     * <<magic>> String conversion\n     *\n     * @return string\n     */\n    public function __toString()\n    {\n        return (string) $this->value;\n    }\n\n}\n\n/**\n * class for undefined variable object\n *\n * This class defines an object for undefined variable handling\n *\n * @package Smarty\n * @subpackage Template\n */\nclass Undefined_Smarty_Variable {\n\n    /**\n     * Returns FALSE for 'nocache' and NULL otherwise.\n     *\n     * @param string $name\n     * @return bool\n     */\n    public function __get($name)\n    {\n        if ($name == 'nocache') {\n            return false;\n        } else {\n            return null;\n        }\n    }\n\n    /**\n     * Always returns an empty string.\n     *\n     * @return string\n     */\n    public function __toString()\n    {\n        return \"\";\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_debug.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Debug\n *\n * Class to collect data for the Smarty Debugging Consol\n *\n * @package Smarty\n * @subpackage Debug\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Debug Class\n *\n * @package Smarty\n * @subpackage Debug\n */\nclass Smarty_Internal_Debug extends Smarty_Internal_Data {\n\n    /**\n     * template data\n     *\n     * @var array\n     */\n    public static $template_data = array();\n\n    /**\n     * Start logging of compile time\n     *\n     * @param object $template\n     */\n    public static function start_compile($template)\n    {\n        $key = self::get_key($template);\n        self::$template_data[$key]['start_time'] = microtime(true);\n    }\n\n    /**\n     * End logging of compile time\n     *\n     * @param object $template\n     */\n    public static function end_compile($template)\n    {\n        $key = self::get_key($template);\n        self::$template_data[$key]['compile_time'] += microtime(true) - self::$template_data[$key]['start_time'];\n    }\n\n    /**\n     * Start logging of render time\n     *\n     * @param object $template\n     */\n    public static function start_render($template)\n    {\n        $key = self::get_key($template);\n        self::$template_data[$key]['start_time'] = microtime(true);\n    }\n\n    /**\n     * End logging of compile time\n     *\n     * @param object $template\n     */\n    public static function end_render($template)\n    {\n        $key = self::get_key($template);\n        self::$template_data[$key]['render_time'] += microtime(true) - self::$template_data[$key]['start_time'];\n    }\n\n    /**\n     * Start logging of cache time\n     *\n     * @param object $template cached template\n     */\n    public static function start_cache($template)\n    {\n        $key = self::get_key($template);\n        self::$template_data[$key]['start_time'] = microtime(true);\n    }\n\n    /**\n     * End logging of cache time\n     *\n     * @param object $template cached template\n     */\n    public static function end_cache($template)\n    {\n        $key = self::get_key($template);\n        self::$template_data[$key]['cache_time'] += microtime(true) - self::$template_data[$key]['start_time'];\n    }\n\n    /**\n     * Opens a window for the Smarty Debugging Consol and display the data\n     *\n     * @param Smarty_Internal_Template|Smarty $obj object to debug\n     */\n    public static function display_debug($obj)\n    {\n        // prepare information of assigned variables\n        $ptr = self::get_debug_vars($obj);\n        if ($obj instanceof Smarty) {\n            $smarty = clone $obj;\n        } else {\n            $smarty = clone $obj->smarty;\n        }\n        $_assigned_vars = $ptr->tpl_vars;\n        ksort($_assigned_vars);\n        $_config_vars = $ptr->config_vars;\n        ksort($_config_vars);\n        $smarty->registered_filters = array();\n        $smarty->autoload_filters = array();\n        $smarty->default_modifiers = array();\n        $smarty->force_compile = false;\n        $smarty->left_delimiter = '{';\n        $smarty->right_delimiter = '}';\n        $smarty->debugging = false;\n        $smarty->force_compile = false;\n        $_template = new Smarty_Internal_Template($smarty->debug_tpl, $smarty);\n        $_template->caching = false;\n        $_template->disableSecurity();\n        $_template->cache_id = null;\n        $_template->compile_id = null;\n        if ($obj instanceof Smarty_Internal_Template) {\n            $_template->assign('template_name', $obj->source->type . ':' . $obj->source->name);\n        }\n        if ($obj instanceof Smarty) {\n            $_template->assign('template_data', self::$template_data);\n        } else {\n            $_template->assign('template_data', null);\n        }\n        $_template->assign('assigned_vars', $_assigned_vars);\n        $_template->assign('config_vars', $_config_vars);\n        $_template->assign('execution_time', microtime(true) - $smarty->start_time);\n        echo $_template->fetch();\n    }\n\n    /**\n     * Recursively gets variables from all template/data scopes\n     *\n     * @param Smarty_Internal_Template|Smarty_Data $obj object to debug\n     * @return StdClass\n     */\n    public static function get_debug_vars($obj)\n    {\n        $config_vars = $obj->config_vars;\n        $tpl_vars = array();\n        foreach ($obj->tpl_vars as $key => $var) {\n            $tpl_vars[$key] = clone $var;\n            if ($obj instanceof Smarty_Internal_Template) {\n                $tpl_vars[$key]->scope = $obj->source->type . ':' . $obj->source->name;\n            } elseif ($obj instanceof Smarty_Data) {\n                $tpl_vars[$key]->scope = 'Data object';\n            } else {\n                $tpl_vars[$key]->scope = 'Smarty root';\n            }\n        }\n\n        if (isset($obj->parent)) {\n            $parent = self::get_debug_vars($obj->parent);\n            $tpl_vars = array_merge($parent->tpl_vars, $tpl_vars);\n            $config_vars = array_merge($parent->config_vars, $config_vars);\n        } else {\n            foreach (Smarty::$global_tpl_vars as $name => $var) {\n                if (!array_key_exists($name, $tpl_vars)) {\n                    $clone = clone $var;\n                    $clone->scope = 'Global';\n                    $tpl_vars[$name] = $clone;\n                }\n            }\n        }\n        return (object) array('tpl_vars' => $tpl_vars, 'config_vars' => $config_vars);\n    }\n\n    /**\n     * Return key into $template_data for template\n     *\n     * @param object $template  template object\n     * @return string   key into $template_data\n     */\n    private static function get_key($template)\n    {\n        static $_is_stringy = array('string' => true, 'eval' => true);\n        // calculate Uid if not already done\n        if ($template->source->uid == '') {\n            $template->source->filepath;\n        }\n        $key = $template->source->uid;\n        if (isset(self::$template_data[$key])) {\n            return $key;\n        } else {\n            if (isset($_is_stringy[$template->source->type])) {\n                self::$template_data[$key]['name'] = '\\''.substr($template->source->name,0,25).'...\\'';\n            } else {\n                self::$template_data[$key]['name'] = $template->source->filepath;\n            }\n            self::$template_data[$key]['compile_time'] = 0;\n            self::$template_data[$key]['render_time'] = 0;\n            self::$template_data[$key]['cache_time'] = 0;\n            return $key;\n        }\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_filter_handler.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Filter Handler\n *\n * Smarty filter handler class\n *\n * @package Smarty\n * @subpackage PluginsInternal\n * @author Uwe Tews\n */\n\n/**\n * Class for filter processing\n *\n * @package Smarty\n * @subpackage PluginsInternal\n */\nclass Smarty_Internal_Filter_Handler {\n\n    /**\n     * Run filters over content\n     *\n     * The filters will be lazy loaded if required\n     * class name format: Smarty_FilterType_FilterName\n     * plugin filename format: filtertype.filtername.php\n     * Smarty2 filter plugins could be used\n     *\n     * @param string                   $type     the type of filter ('pre','post','output') which shall run\n     * @param string                   $content  the content which shall be processed by the filters\n     * @param Smarty_Internal_Template $template template object\n     * @return string the filtered content\n     */\n    public static function runFilter($type, $content, Smarty_Internal_Template $template)\n    {\n        $output = $content;\n        // loop over autoload filters of specified type\n        if (!empty($template->smarty->autoload_filters[$type])) {\n            foreach ((array)$template->smarty->autoload_filters[$type] as $name) {\n                $plugin_name = \"Smarty_{$type}filter_{$name}\";\n                if ($template->smarty->loadPlugin($plugin_name)) {\n                    if (function_exists($plugin_name)) {\n                        // use loaded Smarty2 style plugin\n                        $output = $plugin_name($output, $template);\n                    } elseif (class_exists($plugin_name, false)) {\n                        // loaded class of filter plugin\n                        $output = call_user_func(array($plugin_name, 'execute'), $output, $template);\n                    }\n                } else {\n                    // nothing found, throw exception\n                    throw new SmartyException(\"Unable to load filter {$plugin_name}\");\n                }\n            }\n        }\n        // loop over registerd filters of specified type\n        if (!empty($template->smarty->registered_filters[$type])) {\n            foreach ($template->smarty->registered_filters[$type] as $key => $name) {\n                if (is_array($template->smarty->registered_filters[$type][$key])) {\n                    $output = call_user_func($template->smarty->registered_filters[$type][$key], $output, $template);\n                } else {\n                    $output = $template->smarty->registered_filters[$type][$key]($output, $template);\n                }\n            }\n        }\n        // return filtered output\n        return $output;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_function_call_handler.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Function Call Handler\n *\n * @package Smarty\n * @subpackage PluginsInternal\n * @author Uwe Tews\n */\n\n/**\n * This class does call function defined with the {function} tag\n *\n * @package Smarty\n * @subpackage PluginsInternal\n */\nclass Smarty_Internal_Function_Call_Handler {\n\n    /**\n     * This function handles calls to template functions defined by {function}\n     * It does create a PHP function at the first call\n     *\n     * @param string                   $_name       template function name\n     * @param Smarty_Internal_Template $_template   template object\n     * @param array                    $_params     Smarty variables passed as call parameter\n     * @param string                   $_hash       nocache hash value\n     * @param bool                     $_nocache    nocache flag\n     */\n    public static function call($_name, Smarty_Internal_Template $_template, $_params, $_hash, $_nocache)\n    {\n        if ($_nocache) {\n            $_function = \"smarty_template_function_{$_name}_nocache\";\n        } else {\n            $_function = \"smarty_template_function_{$_hash}_{$_name}\";\n        }\n        if (!is_callable($_function)) {\n            $_code = \"function {$_function}(\\$_smarty_tpl,\\$params) {\n    \\$saved_tpl_vars = \\$_smarty_tpl->tpl_vars;\n    foreach (\\$_smarty_tpl->smarty->template_functions['{$_name}']['parameter'] as \\$key => \\$value) {\\$_smarty_tpl->tpl_vars[\\$key] = new Smarty_variable(\\$value);};\n    foreach (\\$params as \\$key => \\$value) {\\$_smarty_tpl->tpl_vars[\\$key] = new Smarty_variable(\\$value);}?>\";\n            if ($_nocache) {\n                $_code .= preg_replace(array(\"!<\\?php echo \\\\'/\\*%%SmartyNocache:{$_template->smarty->template_functions[$_name]['nocache_hash']}%%\\*/|/\\*/%%SmartyNocache:{$_template->smarty->template_functions[$_name]['nocache_hash']}%%\\*/\\\\';\\?>!\",\n                        \"!\\\\\\'!\"), array('', \"'\"), $_template->smarty->template_functions[$_name]['compiled']);\n                $_template->smarty->template_functions[$_name]['called_nocache'] = true;\n            } else {\n                $_code .= preg_replace(\"/{$_template->smarty->template_functions[$_name]['nocache_hash']}/\", $_template->properties['nocache_hash'], $_template->smarty->template_functions[$_name]['compiled']);\n            }\n            $_code .= \"<?php \\$_smarty_tpl->tpl_vars = \\$saved_tpl_vars;}\";\n            eval($_code);\n        }\n        $_function($_template, $_params);\n    }\n\n}\n\n?>\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_get_include_path.php",
    "content": "<?php\n/**\n * Smarty read include path plugin\n *\n * @package Smarty\n * @subpackage PluginsInternal\n * @author Monte Ohrt\n */\n\n/**\n * Smarty Internal Read Include Path Class\n *\n * @package Smarty\n * @subpackage PluginsInternal\n */\nclass Smarty_Internal_Get_Include_Path {\n\n    /**\n     * Return full file path from PHP include_path\n     *\n     * @param string $filepath filepath\n     * @return string|boolean full filepath or false\n     */\n    public static function getIncludePath($filepath)\n    {\n        static $_include_path = null;\n\n        if ($_path_array === null) {\n            $_include_path = explode(PATH_SEPARATOR, get_include_path());\n        }\n\n        foreach ($_include_path as $_path) {\n            if (file_exists($_path . DS . $filepath)) {\n                return $_path . DS . $filepath;\n            }\n        }\n        \n        return false;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_nocache_insert.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Nocache Insert\n *\n * Compiles the {insert} tag into the cache file\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Smarty Internal Plugin Compile Insert Class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_Nocache_Insert {\n\n    /**\n     * Compiles code for the {insert} tag into cache file\n     *\n     * @param string                   $_function insert function name\n     * @param array                    $_attr     array with parameter\n     * @param Smarty_Internal_Template $_template template object\n     * @param string                   $_script   script name to load or 'null'\n     * @param string                   $_assign   optional variable name\n     * @return string compiled code\n     */\n    public static function compile($_function, $_attr, $_template, $_script, $_assign = null)\n    {\n        $_output = '<?php ';\n        if ($_script != 'null') {\n            // script which must be included\n            // code for script file loading\n            $_output .= \"require_once '{$_script}';\";\n        }\n        // call insert\n        if (isset($_assign)) {\n            $_output .= \"\\$_smarty_tpl->assign('{$_assign}' , {$_function} (\" . var_export($_attr, true) . \",\\$_smarty_tpl), true);?>\";\n        } else {\n            $_output .= \"echo {$_function}(\" . var_export($_attr, true) . \",\\$_smarty_tpl);?>\";\n        }\n        $_tpl = $_template;\n        while ($_tpl->parent instanceof Smarty_Internal_Template) {\n            $_tpl = $_tpl->parent;\n        }\n        return \"/*%%SmartyNocache:{$_tpl->properties['nocache_hash']}%%*/\" . $_output . \"/*/%%SmartyNocache:{$_tpl->properties['nocache_hash']}%%*/\";\n    }\n\n}\n\n?>\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_parsetree.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Templateparser Parsetrees\n *\n * These are classes to build parsetrees in the template parser\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Thue Kristensen\n * @author Uwe Tews\n */\n\n/**\n * @package Smarty\n * @subpackage Compiler\n * @ignore\n */\nabstract class _smarty_parsetree {\n\n    /**\n     * Parser object\n     * @var object\n     */\n    public $parser;\n    /**\n     * Buffer content\n     * @var mixed\n     */\n    public $data;\n\n    /**\n     * Return buffer\n     *\n     * @return string  buffer content\n     */\n    abstract public function to_smarty_php();\n\n}\n\n/**\n * A complete smarty tag.\n *\n * @package Smarty\n * @subpackage Compiler\n * @ignore\n */\nclass _smarty_tag extends _smarty_parsetree {\n\n    /**\n     * Saved block nesting level\n     * @var int\n     */\n    public $saved_block_nesting;\n\n    /**\n     * Create parse tree buffer for Smarty tag\n     *\n     * @param object $parser    parser object\n     * @param string $data      content\n     */\n    public function __construct($parser, $data)\n    {\n        $this->parser = $parser;\n        $this->data = $data;\n        $this->saved_block_nesting = $parser->block_nesting_level;\n    }\n\n    /**\n     * Return buffer content\n     *\n     * @return string  content\n     */\n    public function to_smarty_php()\n    {\n        return $this->data;\n    }\n\n    /**\n     * Return complied code that loads the evaluated outout of buffer content into a temporary variable\n     *\n     * @return string template code\n     */\n    public function assign_to_var()\n    {\n        $var = sprintf('$_tmp%d', ++$this->parser->prefix_number);\n        $this->parser->compiler->prefix_code[] = sprintf('<?php ob_start();?>%s<?php %s=ob_get_clean();?>', $this->data, $var);\n        return $var;\n    }\n\n}\n\n/**\n * Code fragment inside a tag.\n *\n * @package Smarty\n * @subpackage Compiler\n * @ignore\n */\nclass _smarty_code extends _smarty_parsetree {\n\n\n    /**\n     * Create parse tree buffer for code fragment\n     *\n     * @param object $parser    parser object\n     * @param string $data      content\n     */\n    public function __construct($parser, $data)\n    {\n        $this->parser = $parser;\n        $this->data = $data;\n    }\n\n    /**\n     * Return buffer content in parentheses\n     *\n     * @return string  content\n     */\n    public function to_smarty_php()\n    {\n        return sprintf(\"(%s)\", $this->data);\n    }\n\n}\n\n/**\n * Double quoted string inside a tag.\n *\n * @package Smarty\n * @subpackage Compiler\n * @ignore\n */\nclass _smarty_doublequoted extends _smarty_parsetree {\n\n    /**\n     * Create parse tree buffer for double quoted string subtrees\n     *\n     * @param object $parser    parser object\n     * @param _smarty_parsetree $subtree    parsetree buffer\n     */\n    public function __construct($parser, _smarty_parsetree $subtree)\n    {\n        $this->parser = $parser;\n        $this->subtrees[] = $subtree;\n        if ($subtree instanceof _smarty_tag) {\n            $this->parser->block_nesting_level = count($this->parser->compiler->_tag_stack);\n        }\n    }\n\n    /**\n     * Append buffer to subtree\n     *\n     * @param _smarty_parsetree $subtree  parsetree buffer\n     */\n    public function append_subtree(_smarty_parsetree $subtree)\n    {\n        $last_subtree = count($this->subtrees) - 1;\n        if ($last_subtree >= 0 && $this->subtrees[$last_subtree] instanceof _smarty_tag && $this->subtrees[$last_subtree]->saved_block_nesting < $this->parser->block_nesting_level) {\n            if ($subtree instanceof _smarty_code) {\n                $this->subtrees[$last_subtree]->data .= '<?php echo ' . $subtree->data . ';?>';\n            } elseif ($subtree instanceof _smarty_dq_content) {\n                $this->subtrees[$last_subtree]->data .= '<?php echo \"' . $subtree->data . '\";?>';\n            } else {\n                $this->subtrees[$last_subtree]->data .= $subtree->data;\n            }\n        } else {\n            $this->subtrees[] = $subtree;\n        }\n        if ($subtree instanceof _smarty_tag) {\n            $this->parser->block_nesting_level = count($this->parser->compiler->_tag_stack);\n        }\n    }\n\n    /**\n     * Merge subtree buffer content together\n     *\n     * @return string  compiled template code\n     */\n    public function to_smarty_php()\n    {\n        $code = '';\n        foreach ($this->subtrees as $subtree) {\n            if ($code !== \"\") {\n                $code .= \".\";\n            }\n            if ($subtree instanceof _smarty_tag) {\n                $more_php = $subtree->assign_to_var();\n            } else {\n                $more_php = $subtree->to_smarty_php();\n            }\n\n            $code .= $more_php;\n\n            if (!$subtree instanceof _smarty_dq_content) {\n                $this->parser->compiler->has_variable_string = true;\n            }\n        }\n        return $code;\n    }\n\n}\n\n/**\n * Raw chars as part of a double quoted string.\n *\n * @package Smarty\n * @subpackage Compiler\n * @ignore\n */\nclass _smarty_dq_content extends _smarty_parsetree {\n\n\n    /**\n     * Create parse tree buffer with string content\n     *\n     * @param object $parser  parser object\n     * @param string $data    string section\n     */\n    public function __construct($parser, $data)\n    {\n        $this->parser = $parser;\n        $this->data = $data;\n    }\n\n    /**\n     * Return content as double quoted string\n     *\n     * @return string doubled quoted string\n     */\n    public function to_smarty_php()\n    {\n        return '\"' . $this->data . '\"';\n    }\n\n}\n\n/**\n * Template element\n *\n * @package Smarty\n * @subpackage Compiler\n * @ignore\n */\nclass _smarty_template_buffer extends _smarty_parsetree {\n\n    /**\n     * Array of template elements\n     *\n     * @var array\n     */\n    public $subtrees = Array();\n\n    /**\n     * Create root of parse tree for template elements\n     *\n     * @param object $parser    parse object\n     */\n    public function __construct($parser)\n    {\n        $this->parser = $parser;\n    }\n\n    /**\n     * Append buffer to subtree\n     *\n     * @param _smarty_parsetree $subtree\n     */\n    public function append_subtree(_smarty_parsetree $subtree)\n    {\n        $this->subtrees[] = $subtree;\n    }\n\n    /**\n     * Sanitize and merge subtree buffers together\n     *\n     * @return string template code content\n     */\n    public function to_smarty_php()\n    {\n        $code = '';\n        for ($key = 0, $cnt = count($this->subtrees); $key < $cnt; $key++) {\n            if ($key + 2 < $cnt) {\n                if ($this->subtrees[$key] instanceof _smarty_linebreak && $this->subtrees[$key + 1] instanceof _smarty_tag && $this->subtrees[$key + 1]->data == '' && $this->subtrees[$key + 2] instanceof _smarty_linebreak) {\n                    $key = $key + 1;\n                    continue;\n                }\n                if (substr($this->subtrees[$key]->data, -1) == '<' && $this->subtrees[$key + 1]->data == '' && substr($this->subtrees[$key + 2]->data, -1) == '?') {\n                    $key = $key + 2;\n                    continue;\n                }\n            }\n            if (substr($code, -1) == '<') {\n                $subtree = $this->subtrees[$key]->to_smarty_php();\n                if (substr($subtree, 0, 1) == '?') {\n                    $code = substr($code, 0, strlen($code) - 1) . '<<?php ?>?' . substr($subtree, 1);\n                } elseif ($this->parser->asp_tags && substr($subtree, 0, 1) == '%') {\n                    $code = substr($code, 0, strlen($code) - 1) . '<<?php ?>%' . substr($subtree, 1);\n                } else {\n                    $code .= $subtree;\n                }\n                continue;\n            }\n            if ($this->parser->asp_tags && substr($code, -1) == '%') {\n                $subtree = $this->subtrees[$key]->to_smarty_php();\n                if (substr($subtree, 0, 1) == '>') {\n                    $code = substr($code, 0, strlen($code) - 1) . '%<?php ?>>' . substr($subtree, 1);\n                } else {\n                    $code .= $subtree;\n                }\n                continue;\n            }\n            if (substr($code, -1) == '?') {\n                $subtree = $this->subtrees[$key]->to_smarty_php();\n                if (substr($subtree, 0, 1) == '>') {\n                    $code = substr($code, 0, strlen($code) - 1) . '?<?php ?>>' . substr($subtree, 1);\n                } else {\n                    $code .= $subtree;\n                }\n                continue;\n            }\n            $code .= $this->subtrees[$key]->to_smarty_php();\n        }\n        return $code;\n    }\n\n}\n\n/**\n * template text\n *\n * @package Smarty\n * @subpackage Compiler\n * @ignore\n */\nclass _smarty_text extends _smarty_parsetree {\n\n\n    /**\n     * Create template text buffer\n     *\n     * @param object $parser    parser object\n     * @param string $data      text\n     */\n    public function __construct($parser, $data)\n    {\n        $this->parser = $parser;\n        $this->data = $data;\n    }\n\n    /**\n     * Return buffer content\n     *\n     * @return strint text\n     */\n    public function to_smarty_php()\n    {\n        return $this->data;\n    }\n\n}\n\n/**\n * template linebreaks\n *\n * @package Smarty\n * @subpackage Compiler\n * @ignore\n */\nclass _smarty_linebreak extends _smarty_parsetree {\n\n    /**\n     * Create buffer with linebreak content\n     *\n     * @param object $parser    parser object\n     * @param string  $data     linebreak string\n     */\n    public function __construct($parser, $data)\n    {\n        $this->parser = $parser;\n        $this->data = $data;\n    }\n\n    /**\n     * Return linebrak\n     *\n     * @return string linebreak\n     */\n    public function to_smarty_php()\n    {\n        return $this->data;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_resource_eval.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Resource Eval\n *\n * @package Smarty\n * @subpackage TemplateResources\n * @author Uwe Tews\n * @author Rodney Rehm\n */\n\n/**\n * Smarty Internal Plugin Resource Eval\n *\n * Implements the strings as resource for Smarty template\n *\n * {@internal unlike string-resources the compiled state of eval-resources is NOT saved for subsequent access}}\n *\n * @package Smarty\n * @subpackage TemplateResources\n */\nclass Smarty_Internal_Resource_Eval extends Smarty_Resource_Recompiled {\n\n    /**\n     * populate Source Object with meta data from Resource\n     *\n     * @param Smarty_Template_Source   $source    source object\n     * @param Smarty_Internal_Template $_template template object\n     * @return void\n     */\n    public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)\n    {\n        $source->uid = $source->filepath = sha1($source->name);\n        $source->timestamp = false;\n        $source->exists = true;\n    }\n\n    /**\n     * Load template's source from $resource_name into current template object\n     *\n     * @uses decode() to decode base64 and urlencoded template_resources\n     * @param Smarty_Template_Source $source source object\n     * @return string template source\n     */\n    public function getContent(Smarty_Template_Source $source)\n    {\n        return $this->decode($source->name);\n    }\n    \n    /**\n     * decode base64 and urlencode\n     *\n     * @param string $string template_resource to decode\n     * @return string decoded template_resource\n     */\n    protected function decode($string)\n    {\n        // decode if specified\n        if (($pos = strpos($string, ':')) !== false) {\n            if (!strncmp($string, 'base64', 6)) {\n                return base64_decode(substr($string, 7));\n            } elseif (!strncmp($string, 'urlencode', 9)) {\n                return urldecode(substr($string, 10));\n            }\n        }\n        \n        return $string;\n    }\n    \n    /**\n     * modify resource_name according to resource handlers specifications\n     *\n     * @param Smarty $smarty        Smarty instance\n     * @param string $resource_name resource_name to make unique\n     * @return string unique resource name\n     */\n    protected function buildUniqueResourceName(Smarty $smarty, $resource_name)\n    {\n        return get_class($this) . '#' .$this->decode($resource_name);\n    }\n\n    /**\n     * Determine basename for compiled filename\n     *\n     * @param Smarty_Template_Source $source source object\n     * @return string resource's basename\n     */\n    protected function getBasename(Smarty_Template_Source $source)\n    {\n        return '';\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_resource_extends.php",
    "content": "<?php\n/**\n* Smarty Internal Plugin Resource Extends\n*\n* @package Smarty\n* @subpackage TemplateResources\n* @author Uwe Tews\n* @author Rodney Rehm\n*/\n\n/**\n* Smarty Internal Plugin Resource Extends\n*\n* Implements the file system as resource for Smarty which {extend}s a chain of template files templates\n*\n* @package Smarty\n* @subpackage TemplateResources\n*/\nclass Smarty_Internal_Resource_Extends extends Smarty_Resource {\n\n    /**\n    * populate Source Object with meta data from Resource\n    *\n    * @param Smarty_Template_Source   $source    source object\n    * @param Smarty_Internal_Template $_template template object\n    */\n    public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)\n    {\n        $uid = '';\n        $sources = array();\n        $components = explode('|', $source->name);\n        $exists = true;\n        foreach ($components as $component) {\n            $s = Smarty_Resource::source(null, $source->smarty, $component);\n            if ($s->type == 'php') {\n                throw new SmartyException(\"Resource type {$s->type} cannot be used with the extends resource type\");\n            }\n            $sources[$s->uid] = $s;\n            $uid .= $s->filepath;\n            if ($_template && $_template->smarty->compile_check) {\n                $exists == $exists && $s->exists;\n            }\n        }\n        $source->components = $sources;\n        $source->filepath = $s->filepath;\n        $source->uid = sha1($uid);\n        if ($_template && $_template->smarty->compile_check) {\n            $source->timestamp = $s->timestamp;\n            $source->exists = $exists;\n        }\n        // need the template at getContent()\n        $source->template = $_template;\n    }\n\n    /**\n    * populate Source Object with timestamp and exists from Resource\n    *\n    * @param Smarty_Template_Source $source source object\n    */\n    public function populateTimestamp(Smarty_Template_Source $source)\n    {\n        $source->exists = true;\n        foreach ($source->components as $s) {\n            $source->exists == $source->exists && $s->exists;\n        }\n        $source->timestamp = $s->timestamp;\n    }\n\n    /**\n    * Load template's source from files into current template object\n    *\n    * @param Smarty_Template_Source $source source object\n    * @return string template source\n    * @throws SmartyException if source cannot be loaded\n    */\n    public function getContent(Smarty_Template_Source $source)\n    {\n        if (!$source->exists) {\n            throw new SmartyException(\"Unable to read template {$source->type} '{$source->name}'\");\n        }\n\n        $_rdl = preg_quote($source->smarty->right_delimiter);\n        $_ldl = preg_quote($source->smarty->left_delimiter);\n        $_components = array_reverse($source->components);\n        $_first = reset($_components);\n        $_last = end($_components);\n\n        foreach ($_components as $_component) {\n            // register dependency\n            if ($_component != $_first) {\n                $source->template->properties['file_dependency'][$_component->uid] = array($_component->filepath, $_component->timestamp, $_component->type);\n            }\n\n            // read content\n            $source->filepath = $_component->filepath;\n            $_content = $_component->content;\n\n            // extend sources\n            if ($_component != $_last) {\n                if (preg_match_all(\"!({$_ldl}block\\s(.+?){$_rdl})!\", $_content, $_open) !=\n                preg_match_all(\"!({$_ldl}/block{$_rdl})!\", $_content, $_close)) {\n                    throw new SmartyException(\"unmatched {block} {/block} pairs in template {$_component->type} '{$_component->name}'\");\n                }\n                preg_match_all(\"!{$_ldl}block\\s(.+?){$_rdl}|{$_ldl}/block{$_rdl}|{$_ldl}\\*([\\S\\s]*?)\\*{$_rdl}!\", $_content, $_result, PREG_OFFSET_CAPTURE);\n                $_result_count = count($_result[0]);\n                $_start = 0;\n                while ($_start+1 < $_result_count) {\n                    $_end = 0;\n                    $_level = 1;\n                    if (substr($_result[0][$_start][0],0,strlen($source->smarty->left_delimiter)+1) == $source->smarty->left_delimiter.'*') {\n                        $_start++;\n                        continue;\n                    }\n                    while ($_level != 0) {\n                        $_end++;\n                        if (substr($_result[0][$_start + $_end][0],0,strlen($source->smarty->left_delimiter)+1) == $source->smarty->left_delimiter.'*') {\n                            continue;\n                        }\n                        if (!strpos($_result[0][$_start + $_end][0], '/')) {\n                            $_level++;\n                        } else {\n                            $_level--;\n                        }\n                    }\n                    $_block_content = str_replace($source->smarty->left_delimiter . '$smarty.block.parent' . $source->smarty->right_delimiter, '%%%%SMARTY_PARENT%%%%', substr($_content, $_result[0][$_start][1] + strlen($_result[0][$_start][0]), $_result[0][$_start + $_end][1] - $_result[0][$_start][1] - + strlen($_result[0][$_start][0])));\n                    Smarty_Internal_Compile_Block::saveBlockData($_block_content, $_result[0][$_start][0], $source->template, $_component->filepath);\n                    $_start = $_start + $_end + 1;\n                }\n            } else {\n                return $_content;\n            }\n        }\n    }\n\n    /**\n    * Determine basename for compiled filename\n    *\n    * @param Smarty_Template_Source $source source object\n    * @return string resource's basename\n    */\n    public function getBasename(Smarty_Template_Source $source)\n    {\n        return str_replace(':', '.', basename($source->filepath));\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_resource_file.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Resource File\n *\n * @package Smarty\n * @subpackage TemplateResources\n * @author Uwe Tews\n * @author Rodney Rehm\n */\n\n/**\n * Smarty Internal Plugin Resource File\n *\n * Implements the file system as resource for Smarty templates\n *\n * @package Smarty\n * @subpackage TemplateResources\n */\nclass Smarty_Internal_Resource_File extends Smarty_Resource {\n\n    /**\n     * populate Source Object with meta data from Resource\n     *\n     * @param Smarty_Template_Source   $source    source object\n     * @param Smarty_Internal_Template $_template template object\n     */\n    public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)\n    {\n        $source->filepath = $this->buildFilepath($source, $_template);\n\n        if ($source->filepath !== false) {\n            if (is_object($source->smarty->security_policy)) {\n                $source->smarty->security_policy->isTrustedResourceDir($source->filepath);\n            }\n\n            $source->uid = sha1($source->filepath);\n            if ($source->smarty->compile_check && !isset($source->timestamp)) {\n                $source->timestamp = @filemtime($source->filepath);\n                $source->exists = !!$source->timestamp;\n            }\n        }\n    }\n\n    /**\n     * populate Source Object with timestamp and exists from Resource\n     *\n     * @param Smarty_Template_Source $source source object\n     */\n    public function populateTimestamp(Smarty_Template_Source $source)\n    {\n        $source->timestamp = @filemtime($source->filepath);\n        $source->exists = !!$source->timestamp;\n    }\n\n    /**\n     * Load template's source from file into current template object\n     *\n     * @param Smarty_Template_Source $source source object\n     * @return string template source\n     * @throws SmartyException if source cannot be loaded\n     */\n    public function getContent(Smarty_Template_Source $source)\n    {\n        if ($source->timestamp) {\n            return file_get_contents($source->filepath);\n        }\n        if ($source instanceof Smarty_Config_Source) {\n            throw new SmartyException(\"Unable to read config {$source->type} '{$source->name}'\");\n        }\n        throw new SmartyException(\"Unable to read template {$source->type} '{$source->name}'\");\n    }\n\n    /**\n     * Determine basename for compiled filename\n     *\n     * @param Smarty_Template_Source $source source object\n     * @return string resource's basename\n     */\n    public function getBasename(Smarty_Template_Source $source)\n    {\n        $_file = $source->name;\n        if (($_pos = strpos($_file, ']')) !== false) {\n            $_file = substr($_file, $_pos + 1);\n        }\n        return basename($_file);\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_resource_php.php",
    "content": "<?php\n\n/**\n * Smarty Internal Plugin Resource PHP\n *\n * Implements the file system as resource for PHP templates\n *\n * @package Smarty\n * @subpackage TemplateResources\n * @author Uwe Tews\n * @author Rodney Rehm\n */\nclass Smarty_Internal_Resource_PHP extends Smarty_Resource_Uncompiled {\n    /**\n     * container for short_open_tag directive's value before executing PHP templates\n     * @var string\n     */\n    protected $short_open_tag;\n\n    /**\n     * Create a new PHP Resource\n     *\n     */\n    public function __construct()\n    {\n        $this->short_open_tag = ini_get( 'short_open_tag' );\n    }\n\n    /**\n     * populate Source Object with meta data from Resource\n     *\n     * @param Smarty_Template_Source $source source object\n     * @param Smarty_Internal_Template $_template template object\n     * @return void\n     */\n    public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)\n    {\n        $source->filepath = $this->buildFilepath($source, $_template);\n\n        if ($source->filepath !== false) {\n            if (is_object($source->smarty->security_policy)) {\n                $source->smarty->security_policy->isTrustedResourceDir($source->filepath);\n            }\n\n            $source->uid = sha1($source->filepath);\n            if ($source->smarty->compile_check) {\n                $source->timestamp = @filemtime($source->filepath);\n                $source->exists = !!$source->timestamp;\n            }\n        }\n    }\n\n    /**\n     * populate Source Object with timestamp and exists from Resource\n     *\n     * @param Smarty_Template_Source $source source object\n     * @return void\n     */\n    public function populateTimestamp(Smarty_Template_Source $source)\n    {\n        $source->timestamp = @filemtime($source->filepath);\n        $source->exists = !!$source->timestamp;\n    }\n\n    /**\n     * Load template's source from file into current template object\n     *\n     * @param Smarty_Template_Source $source source object\n     * @return string template source\n     * @throws SmartyException if source cannot be loaded\n     */\n    public function getContent(Smarty_Template_Source $source)\n    {\n        if ($source->timestamp) {\n            return '';\n        }\n        throw new SmartyException(\"Unable to read template {$source->type} '{$source->name}'\");\n    }\n\n    /**\n     * Render and output the template (without using the compiler)\n     *\n     * @param Smarty_Template_Source $source source object\n     * @param Smarty_Internal_Template $_template template object\n     * @return void\n     * @throws SmartyException if template cannot be loaded or allow_php_templates is disabled\n     */\n    public function renderUncompiled(Smarty_Template_Source $source, Smarty_Internal_Template $_template)\n    {\n        $_smarty_template = $_template;\n\n        if (!$source->smarty->allow_php_templates) {\n            throw new SmartyException(\"PHP templates are disabled\");\n        }\n        if (!$source->exists) {\n            if ($_template->parent instanceof Smarty_Internal_Template) {\n                $parent_resource = \" in '{$_template->parent->template_resource}'\";\n            } else {\n                $parent_resource = '';\n            }\n            throw new SmartyException(\"Unable to load template {$source->type} '{$source->name}'{$parent_resource}\");\n        }\n\n        // prepare variables\n        extract($_template->getTemplateVars());\n\n        // include PHP template with short open tags enabled\n        ini_set( 'short_open_tag', '1' );\n        include($source->filepath);\n        ini_set( 'short_open_tag', $this->short_open_tag );\n    }\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_resource_registered.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Resource Registered\n *\n * @package Smarty\n * @subpackage TemplateResources\n * @author Uwe Tews\n * @author Rodney Rehm\n */\n\n/**\n * Smarty Internal Plugin Resource Registered\n *\n * Implements the registered resource for Smarty template\n *\n * @package Smarty\n * @subpackage TemplateResources\n * @deprecated\n */\nclass Smarty_Internal_Resource_Registered extends Smarty_Resource {\n\n    /**\n     * populate Source Object with meta data from Resource\n     *\n     * @param Smarty_Template_Source   $source    source object\n     * @param Smarty_Internal_Template $_template template object\n     * @return void\n     */\n    public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)\n    {\n        $source->filepath = $source->type . ':' . $source->name;\n        $source->uid = sha1($source->filepath);\n        if ($source->smarty->compile_check) {\n            $source->timestamp = $this->getTemplateTimestamp($source);\n            $source->exists = !!$source->timestamp;\n        }\n    }\n\n    /**\n     * populate Source Object with timestamp and exists from Resource\n     *\n     * @param Smarty_Template_Source $source source object\n     * @return void\n     */\n    public function populateTimestamp(Smarty_Template_Source $source)\n    {\n        $source->timestamp = $this->getTemplateTimestamp($source);\n        $source->exists = !!$source->timestamp;\n    }\n\n    /**\n     * Get timestamp (epoch) the template source was modified\n     *\n     * @param Smarty_Template_Source $source source object\n     * @return integer|boolean timestamp (epoch) the template was modified, false if resources has no timestamp\n     */\n    public function getTemplateTimestamp(Smarty_Template_Source $source)\n    {\n        // return timestamp\n        $time_stamp = false;\n        call_user_func_array($source->smarty->registered_resources[$source->type][0][1], array($source->name, &$time_stamp, $source->smarty));\n        return is_numeric($time_stamp) ? (int) $time_stamp : $time_stamp;\n    }\n\n    /**\n     * Load template's source by invoking the registered callback into current template object\n     *\n     * @param Smarty_Template_Source $source source object\n     * @return string template source\n     * @throws SmartyException if source cannot be loaded\n     */\n    public function getContent(Smarty_Template_Source $source)\n    {\n        // return template string\n        $t = call_user_func_array($source->smarty->registered_resources[$source->type][0][0], array($source->name, &$source->content, $source->smarty));\n        if (is_bool($t) && !$t) {\n            throw new SmartyException(\"Unable to read template {$source->type} '{$source->name}'\");\n        }\n        return $source->content;\n    }\n\n    /**\n     * Determine basename for compiled filename\n     *\n     * @param Smarty_Template_Source $source source object\n     * @return string resource's basename\n     */\n    protected function getBasename(Smarty_Template_Source $source)\n    {\n        return basename($source->name);\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_resource_stream.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Resource Stream\n *\n * Implements the streams as resource for Smarty template\n *\n * @package Smarty\n * @subpackage TemplateResources\n * @author Uwe Tews\n * @author Rodney Rehm\n */\n\n/**\n * Smarty Internal Plugin Resource Stream\n *\n * Implements the streams as resource for Smarty template\n *\n * @link http://php.net/streams\n * @package Smarty\n * @subpackage TemplateResources\n */\nclass Smarty_Internal_Resource_Stream extends Smarty_Resource_Recompiled {\n\n    /**\n     * populate Source Object with meta data from Resource\n     *\n     * @param Smarty_Template_Source   $source    source object\n     * @param Smarty_Internal_Template $_template template object\n     * @return void\n     */\n    public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)\n    {\n        $source->filepath = str_replace(':', '://', $source->resource);\n        $source->uid = false;\n        $source->content = $this->getContent($source);\n        $source->timestamp = false;\n        $source->exists = !!$source->content;\n    }\n\n    /**\n     * Load template's source from stream into current template object\n     *\n     * @param Smarty_Template_Source $source source object\n     * @return string template source\n     * @throws SmartyException if source cannot be loaded\n     */\n    public function getContent(Smarty_Template_Source $source)\n    {\n        $t = '';\n        // the availability of the stream has already been checked in Smarty_Resource::fetch()\n        $fp = fopen($source->filepath, 'r+');\n        if ($fp) {\n            while (!feof($fp) && ($current_line = fgets($fp)) !== false) {\n                $t .= $current_line;\n            }\n            fclose($fp);\n            return $t;\n        } else {\n            return false;\n        }\n    }\n    \n    /**\n     * modify resource_name according to resource handlers specifications\n     *\n     * @param Smarty $smarty        Smarty instance\n     * @param string $resource_name resource_name to make unique\n     * @return string unique resource name\n     */\n    protected function buildUniqueResourceName(Smarty $smarty, $resource_name)\n    {\n        return get_class($this) . '#' . $resource_name;\n    }\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_resource_string.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Resource String\n *\n * @package Smarty\n * @subpackage TemplateResources\n * @author Uwe Tews\n * @author Rodney Rehm\n */\n\n/**\n * Smarty Internal Plugin Resource String\n *\n * Implements the strings as resource for Smarty template\n *\n * {@internal unlike eval-resources the compiled state of string-resources is saved for subsequent access}}\n *\n * @package Smarty\n * @subpackage TemplateResources\n */\nclass Smarty_Internal_Resource_String extends Smarty_Resource {\n\n    /**\n     * populate Source Object with meta data from Resource\n     *\n     * @param Smarty_Template_Source   $source    source object\n     * @param Smarty_Internal_Template $_template template object\n     * @return void\n     */\n    public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)\n    {\n        $source->uid = $source->filepath = sha1($source->name);\n        $source->timestamp = 0;\n        $source->exists = true;\n    }\n\n    /**\n     * Load template's source from $resource_name into current template object\n     *\n     * @uses decode() to decode base64 and urlencoded template_resources\n     * @param Smarty_Template_Source $source source object\n     * @return string template source\n     */\n    public function getContent(Smarty_Template_Source $source)\n    {\n        return $this->decode($source->name);\n    }\n    \n    /**\n     * decode base64 and urlencode\n     *\n     * @param string $string template_resource to decode\n     * @return string decoded template_resource\n     */\n    protected function decode($string)\n    {\n        // decode if specified\n        if (($pos = strpos($string, ':')) !== false) {\n            if (!strncmp($string, 'base64', 6)) {\n                return base64_decode(substr($string, 7));\n            } elseif (!strncmp($string, 'urlencode', 9)) {\n                return urldecode(substr($string, 10));\n            }\n        }\n        \n        return $string;\n    }\n    \n    /**\n     * modify resource_name according to resource handlers specifications\n     *\n     * @param Smarty $smarty        Smarty instance\n     * @param string $resource_name resource_name to make unique\n     * @return string unique resource name\n     */\n    protected function buildUniqueResourceName(Smarty $smarty, $resource_name)\n    {\n        return get_class($this) . '#' .$this->decode($resource_name);\n    }\n\n    /**\n     * Determine basename for compiled filename\n     *\n     * Always returns an empty string.\n     *\n     * @param Smarty_Template_Source $source source object\n     * @return string resource's basename\n     */\n    protected function getBasename(Smarty_Template_Source $source)\n    {\n        return '';\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_smartytemplatecompiler.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Smarty Template Compiler Base\n *\n * This file contains the basic classes and methodes for compiling Smarty templates with lexer/parser\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * @ignore\n */\ninclude (\"smarty_internal_parsetree.php\");\n\n/**\n * Class SmartyTemplateCompiler\n *\n * @package Smarty\n * @subpackage Compiler\n */\nclass Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCompilerBase {\n\n    /**\n     * Lexer class name\n     *\n     * @var string\n     */\n    public $lexer_class;\n\n    /**\n     * Parser class name\n     *\n     * @var string\n     */\n    public $parser_class;\n\n    /**\n     * Lexer object\n     *\n     * @var object\n     */\n    public $lex;\n\n    /**\n     * Parser object\n     *\n     * @var object\n     */\n    public $parser;\n\n    /**\n     * Smarty object\n     *\n     * @var object\n     */\n    public $smarty;\n\n    /**\n     * array of vars which can be compiled in local scope\n     *\n     * @var array\n     */\n    public $local_var = array();\n\n    /**\n     * Initialize compiler\n     *\n     * @param string $lexer_class  class name\n     * @param string $parser_class class name\n     * @param Smarty $smarty       global instance\n     */\n    public function __construct($lexer_class, $parser_class, $smarty)\n    {\n        $this->smarty = $smarty;\n        parent::__construct();\n        // get required plugins\n        $this->lexer_class = $lexer_class;\n        $this->parser_class = $parser_class;\n    }\n\n    /**\n     * Methode to compile a Smarty template\n     *\n     * @param  mixed $_content template source\n     * @return bool true if compiling succeeded, false if it failed\n     */\n    protected function doCompile($_content)\n    {\n        /* here is where the compiling takes place. Smarty\n          tags in the templates are replaces with PHP code,\n          then written to compiled files. */\n        // init the lexer/parser to compile the template\n        $this->lex = new $this->lexer_class($_content, $this);\n        $this->parser = new $this->parser_class($this->lex, $this);\n        if ($this->smarty->_parserdebug)\n            $this->parser->PrintTrace();\n        // get tokens from lexer and parse them\n        while ($this->lex->yylex() && !$this->abort_and_recompile) {\n            if ($this->smarty->_parserdebug) {\n                echo \"<pre>Line {$this->lex->line} Parsing  {$this->parser->yyTokenName[$this->lex->token]} Token \" .\n                    htmlentities($this->lex->value) . \"</pre>\";\n            }\n            $this->parser->doParse($this->lex->token, $this->lex->value);\n        }\n\n        if ($this->abort_and_recompile) {\n            // exit here on abort\n            return false;\n        }\n        // finish parsing process\n        $this->parser->doParse(0, 0);\n        // check for unclosed tags\n        if (count($this->_tag_stack) > 0) {\n            // get stacked info\n            list($openTag, $_data) = array_pop($this->_tag_stack);\n            $this->trigger_template_error(\"unclosed {\" . $openTag . \"} tag\");\n        }\n        // return compiled code\n        // return str_replace(array(\"? >\\n<?php\",\"? ><?php\"), array('',''), $this->parser->retvalue);\n        return $this->parser->retvalue;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_template.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Template\n *\n * This file contains the Smarty template engine\n *\n * @package Smarty\n * @subpackage Template\n * @author Uwe Tews\n */\n\n/**\n * Main class with template data structures and methods\n *\n * @package Smarty\n * @subpackage Template\n *\n * @property Smarty_Template_Source   $source\n * @property Smarty_Template_Compiled $compiled\n * @property Smarty_Template_Cached   $cached\n */\nclass Smarty_Internal_Template extends Smarty_Internal_TemplateBase {\n\n    /**\n     * cache_id\n     * @var string\n     */\n    public $cache_id = null;\n    /**\n     * $compile_id\n     * @var string\n     */\n    public $compile_id = null;\n    /**\n     * caching enabled\n     * @var boolean\n     */\n    public $caching = null;\n    /**\n     * cache lifetime in seconds\n     * @var integer\n     */\n    public $cache_lifetime = null;\n    /**\n     * Template resource\n     * @var string\n     */\n    public $template_resource = null;\n    /**\n     * flag if compiled template is invalid and must be (re)compiled\n     * @var bool\n     */\n    public $mustCompile = null;\n    /**\n     * flag if template does contain nocache code sections\n     * @var bool\n     */\n    public $has_nocache_code = false;\n    /**\n     * special compiled and cached template properties\n     * @var array\n     */\n    public $properties = array('file_dependency' => array(),\n        'nocache_hash' => '',\n        'function' => array());\n    /**\n     * required plugins\n     * @var array\n     */\n    public $required_plugins = array('compiled' => array(), 'nocache' => array());\n    /**\n     * Global smarty instance\n     * @var Smarty\n     */\n    public $smarty = null;\n    /**\n     * blocks for template inheritance\n     * @var array\n     */\n    public $block_data = array();\n    /**\n     * variable filters\n     * @var array\n     */\n    public $variable_filters = array();\n    /**\n     * optional log of tag/attributes\n     * @var array\n     */\n    public $used_tags = array();\n    /**\n     * internal flag to allow relative path in child template blocks\n     * @var bool\n     */\n    public $allow_relative_path = false;\n    /**\n     * internal capture runtime stack\n     * @var array\n     */\n    public $_capture_stack = array();\n\n    /**\n     * Create template data object\n     *\n     * Some of the global Smarty settings copied to template scope\n     * It load the required template resources and cacher plugins\n     *\n     * @param string                   $template_resource template resource string\n     * @param Smarty                   $smarty            Smarty instance\n     * @param Smarty_Internal_Template $_parent           back pointer to parent object with variables or null\n     * @param mixed                    $_cache_id cache   id or null\n     * @param mixed                    $_compile_id       compile id or null\n     * @param bool                     $_caching          use caching?\n     * @param int                      $_cache_lifetime   cache life-time in seconds\n     */\n    public function __construct($template_resource, $smarty, $_parent = null, $_cache_id = null, $_compile_id = null, $_caching = null, $_cache_lifetime = null)\n    {\n        $this->smarty = &$smarty;\n        // Smarty parameter\n        $this->cache_id = $_cache_id === null ? $this->smarty->cache_id : $_cache_id;\n        $this->compile_id = $_compile_id === null ? $this->smarty->compile_id : $_compile_id;\n        $this->caching = $_caching === null ? $this->smarty->caching : $_caching;\n        if ($this->caching === true)\n            $this->caching = Smarty::CACHING_LIFETIME_CURRENT;\n        $this->cache_lifetime = $_cache_lifetime === null ? $this->smarty->cache_lifetime : $_cache_lifetime;\n        $this->parent = $_parent;\n        // Template resource\n        $this->template_resource = $template_resource;\n        // copy block data of template inheritance\n        if ($this->parent instanceof Smarty_Internal_Template) {\n            $this->block_data = $this->parent->block_data;\n        }\n    }\n\n    /**\n     * Returns if the current template must be compiled by the Smarty compiler\n     *\n     * It does compare the timestamps of template source and the compiled templates and checks the force compile configuration\n     *\n     * @return boolean true if the template must be compiled\n     */\n    public function mustCompile()\n    {\n        if (!$this->source->exists) {\n            if ($this->parent instanceof Smarty_Internal_Template) {\n                $parent_resource = \" in '$this->parent->template_resource}'\";\n            } else {\n                $parent_resource = '';\n            }\n            throw new SmartyException(\"Unable to load template {$this->source->type} '{$this->source->name}'{$parent_resource}\");\n        }\n        if ($this->mustCompile === null) {\n            $this->mustCompile = (!$this->source->uncompiled && ($this->smarty->force_compile || $this->source->recompiled || $this->compiled->timestamp === false ||\n                    ($this->smarty->compile_check && $this->compiled->timestamp < $this->source->timestamp)));\n        }\n        return $this->mustCompile;\n    }\n\n    /**\n     * Compiles the template\n     *\n     * If the template is not evaluated the compiled template is saved on disk\n     */\n    public function compileTemplateSource()\n    {\n        if (!$this->source->recompiled) {\n            $this->properties['file_dependency'] = array();\n            if ($this->source->components) {\n                // uses real resource for file dependency\n                $source = end($this->source->components);\n                $this->properties['file_dependency'][$this->source->uid] = array($this->source->filepath, $this->source->timestamp, $source->type);\n            } else {\n                $this->properties['file_dependency'][$this->source->uid] = array($this->source->filepath, $this->source->timestamp, $this->source->type);\n            }\n        }\n        if ($this->smarty->debugging) {\n            Smarty_Internal_Debug::start_compile($this);\n        }\n        // compile locking\n        if ($this->smarty->compile_locking && !$this->source->recompiled) {\n            if ($saved_timestamp = $this->compiled->timestamp) {\n                touch($this->compiled->filepath);\n            }\n        }\n        // call compiler\n        try {\n            $code = $this->compiler->compileTemplate($this);\n        } catch (Exception $e) {\n            // restore old timestamp in case of error\n            if ($this->smarty->compile_locking && !$this->source->recompiled && $saved_timestamp) {\n                touch($this->compiled->filepath, $saved_timestamp);\n            }\n            throw $e;\n        }\n        // compiling succeded\n        if (!$this->source->recompiled && $this->compiler->write_compiled_code) {\n            // write compiled template\n            $_filepath = $this->compiled->filepath;\n            if ($_filepath === false)\n                throw new SmartyException('getCompiledFilepath() did not return a destination to save the compiled template to');\n            Smarty_Internal_Write_File::writeFile($_filepath, $code, $this->smarty);\n            $this->compiled->exists = true;\n            $this->compiled->isCompiled = true;\n        }\n        if ($this->smarty->debugging) {\n            Smarty_Internal_Debug::end_compile($this);\n        }\n        // release compiler object to free memory\n        unset($this->compiler);\n    }\n\n    /**\n     * Writes the cached template output\n     *\n     * @return bool\n     */\n    public function writeCachedContent($content)\n    {\n        if ($this->source->recompiled || !($this->caching == Smarty::CACHING_LIFETIME_CURRENT || $this->caching == Smarty::CACHING_LIFETIME_SAVED)) {\n            // don't write cache file\n            return false;\n        }\n        $this->properties['cache_lifetime'] = $this->cache_lifetime;\n        $this->properties['unifunc'] = 'content_' . uniqid('', false);\n        $content = $this->createTemplateCodeFrame($content, true);\n        $_smarty_tpl = $this;\n        eval(\"?>\" . $content);\n        $this->cached->valid = true;\n        $this->cached->processed = true;\n        return $this->cached->write($this, $content);\n    }\n\n    /**\n     * Template code runtime function to get subtemplate content\n     *\n     * @param string  $template       the resource handle of the template file\n     * @param mixed   $cache_id       cache id to be used with this template\n     * @param mixed   $compile_id     compile id to be used with this template\n     * @param integer $caching        cache mode\n     * @param integer $cache_lifetime life time of cache data\n     * @param array   $vars optional  variables to assign\n     * @param int     $parent_scope   scope in which {include} should execute\n     * @returns string template content\n     */\n    public function getSubTemplate($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $parent_scope)\n    {\n        // already in template cache?\n        if ($this->smarty->allow_ambiguous_resources) {\n            $_templateId = Smarty_Resource::getUniqueTemplateName($this->smarty, $template) . $cache_id . $compile_id;\n        } else {\n            $_templateId = $this->smarty->joined_template_dir . '#' . $template . $cache_id . $compile_id;\n        }\n\n        if (isset($_templateId[150])) {\n            $_templateId = sha1($_templateId);\n        }\n        if (isset($this->smarty->template_objects[$_templateId])) {\n            // clone cached template object because of possible recursive call\n            $tpl = clone $this->smarty->template_objects[$_templateId];\n            $tpl->parent = $this;\n            $tpl->caching = $caching;\n            $tpl->cache_lifetime = $cache_lifetime;\n        } else {\n            $tpl = new $this->smarty->template_class($template, $this->smarty, $this, $cache_id, $compile_id, $caching, $cache_lifetime);\n        }\n        // get variables from calling scope\n        if ($parent_scope == Smarty::SCOPE_LOCAL) {\n            $tpl->tpl_vars = $this->tpl_vars;\n        } elseif ($parent_scope == Smarty::SCOPE_PARENT) {\n            $tpl->tpl_vars = &$this->tpl_vars;\n        } elseif ($parent_scope == Smarty::SCOPE_GLOBAL) {\n            $tpl->tpl_vars = &Smarty::$global_tpl_vars;\n        } elseif (($scope_ptr = $this->getScopePointer($parent_scope)) == null) {\n            $tpl->tpl_vars = &$this->tpl_vars;\n        } else {\n            $tpl->tpl_vars = &$scope_ptr->tpl_vars;\n        }\n        $tpl->config_vars = $this->config_vars;\n        if (!empty($data)) {\n            // set up variable values\n            foreach ($data as $_key => $_val) {\n                $tpl->tpl_vars[$_key] = new Smarty_variable($_val);\n            }\n        }\n        return $tpl->fetch(null, null, null, null, false, false, true);\n    }\n\n    /**\n     * Template code runtime function to set up an inline subtemplate\n     *\n     * @param string  $template       the resource handle of the template file\n     * @param mixed   $cache_id       cache id to be used with this template\n     * @param mixed   $compile_id     compile id to be used with this template\n     * @param integer $caching        cache mode\n     * @param integer $cache_lifetime life time of cache data\n     * @param array   $vars optional  variables to assign\n     * @param int     $parent_scope   scope in which {include} should execute\n     * @param string  $hash           nocache hash code\n     * @returns string template content\n     */\n    public function setupInlineSubTemplate($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $parent_scope, $hash)\n    {\n        $tpl = new $this->smarty->template_class($template, $this->smarty, $this, $cache_id, $compile_id, $caching, $cache_lifetime);\n        $tpl->properties['nocache_hash']  = $hash;\n        // get variables from calling scope\n        if ($parent_scope == Smarty::SCOPE_LOCAL ) {\n            $tpl->tpl_vars = $this->tpl_vars;\n        } elseif ($parent_scope == Smarty::SCOPE_PARENT) {\n            $tpl->tpl_vars = &$this->tpl_vars;\n        } elseif ($parent_scope == Smarty::SCOPE_GLOBAL) {\n            $tpl->tpl_vars = &Smarty::$global_tpl_vars;\n        } elseif (($scope_ptr = $this->getScopePointer($parent_scope)) == null) {\n            $tpl->tpl_vars = &$this->tpl_vars;\n        } else {\n            $tpl->tpl_vars = &$scope_ptr->tpl_vars;\n        }\n        $tpl->config_vars = $this->config_vars;\n        if (!empty($data)) {\n            // set up variable values\n            foreach ($data as $_key => $_val) {\n                $tpl->tpl_vars[$_key] = new Smarty_variable($_val);\n            }\n        }\n        return $tpl;\n    }\n\n\n    /**\n     * Create code frame for compiled and cached templates\n     *\n     * @param string $content   optional template content\n     * @param bool   $cache     flag for cache file\n     * @return string\n     */\n    public function createTemplateCodeFrame($content = '', $cache = false)\n    {\n        $plugins_string = '';\n        // include code for plugins\n        if (!$cache) {\n            if (!empty($this->required_plugins['compiled'])) {\n                $plugins_string = '<?php ';\n                foreach ($this->required_plugins['compiled'] as $tmp) {\n                    foreach ($tmp as $data) {\n                        $file = addslashes($data['file']);\n                        $plugins_string .= \"if (!is_callable('{$data['function']}')) include '{$file}';\\n\";\n                    }\n                }\n                $plugins_string .= '?>';\n            }\n            if (!empty($this->required_plugins['nocache'])) {\n                $this->has_nocache_code = true;\n                $plugins_string .= \"<?php echo '/*%%SmartyNocache:{$this->properties['nocache_hash']}%%*/<?php \\$_smarty = \\$_smarty_tpl->smarty; \";\n                foreach ($this->required_plugins['nocache'] as $tmp) {\n                    foreach ($tmp as $data) {\n                        $file = addslashes($data['file']);\n                        $plugins_string .= addslashes(\"if (!is_callable('{$data['function']}')) include '{$file}';\\n\");\n                    }\n                }\n                $plugins_string .= \"?>/*/%%SmartyNocache:{$this->properties['nocache_hash']}%%*/';?>\\n\";\n            }\n        }\n        // build property code\n        $this->properties['has_nocache_code'] = $this->has_nocache_code;\n        $output = '';\n        if (!$this->source->recompiled) {\n            $output = \"<?php /*%%SmartyHeaderCode:{$this->properties['nocache_hash']}%%*/\";\n            if ($this->smarty->direct_access_security) {\n                $output .= \"if(!defined('SMARTY_DIR')) exit('no direct access allowed');\\n\";\n            }\n        }\n        if ($cache) {\n            // remove compiled code of{function} definition\n            unset($this->properties['function']);\n            if (!empty($this->smarty->template_functions)) {\n                // copy code of {function} tags called in nocache mode\n                foreach ($this->smarty->template_functions as $name => $function_data) {\n                    if (isset($function_data['called_nocache'])) {\n                        foreach ($function_data['called_functions'] as $func_name) {\n                            $this->smarty->template_functions[$func_name]['called_nocache'] = true;\n                        }\n                    }\n                }\n                 foreach ($this->smarty->template_functions as $name => $function_data) {\n                    if (isset($function_data['called_nocache'])) {\n                        unset($function_data['called_nocache'], $function_data['called_functions'], $this->smarty->template_functions[$name]['called_nocache']);\n                        $this->properties['function'][$name] = $function_data;\n                    }\n                }\n            }\n        }\n        $this->properties['version'] = Smarty::SMARTY_VERSION;\n        if (!isset($this->properties['unifunc'])) {\n            $this->properties['unifunc'] = 'content_' . uniqid('', false);\n        }\n        if (!$this->source->recompiled) {\n            $output .= \"\\$_valid = \\$_smarty_tpl->decodeProperties(\" . var_export($this->properties, true) . ',' . ($cache ? 'true' : 'false') . \"); /*/%%SmartyHeaderCode%%*/?>\\n\";\n        }\n        if (!$this->source->recompiled) {\n            $output .= '<?php if ($_valid && !is_callable(\\'' . $this->properties['unifunc'] . '\\')) {function ' . $this->properties['unifunc'] . '($_smarty_tpl) {?>';\n        }\n        $output .= $plugins_string;\n        $output .= $content;\n        if (!$this->source->recompiled) {\n            $output .= '<?php }} ?>';\n        }\n        return $output;\n    }\n\n    /**\n     * This function is executed automatically when a compiled or cached template file is included\n     *\n     * - Decode saved properties from compiled template and cache files\n     * - Check if compiled or cache file is valid\n     *\n     * @param array $properties     special template properties\n     * @param bool  $cache          flag if called from cache file\n     * @return bool                 flag if compiled or cache file is valid\n     */\n    public function decodeProperties($properties, $cache = false)\n    {\n        $this->has_nocache_code = $properties['has_nocache_code'];\n        $this->properties['nocache_hash'] = $properties['nocache_hash'];\n        if (isset($properties['cache_lifetime'])) {\n            $this->properties['cache_lifetime'] = $properties['cache_lifetime'];\n        }\n        if (isset($properties['file_dependency'])) {\n            $this->properties['file_dependency'] = array_merge($this->properties['file_dependency'], $properties['file_dependency']);\n        }\n        if (!empty($properties['function'])) {\n            $this->properties['function'] = array_merge($this->properties['function'], $properties['function']);\n            $this->smarty->template_functions = array_merge($this->smarty->template_functions, $properties['function']);\n        }\n        $this->properties['version'] = (isset($properties['version'])) ? $properties['version'] : '';\n        $this->properties['unifunc'] = $properties['unifunc'];\n        // check file dependencies at compiled code\n        $is_valid = true;\n        if ($this->properties['version'] != Smarty::SMARTY_VERSION) {\n            $is_valid = false;\n        } else if (((!$cache && $this->smarty->compile_check && empty($this->compiled->_properties) && !$this->compiled->isCompiled) || $cache && ($this->smarty->compile_check === true || $this->smarty->compile_check === Smarty::COMPILECHECK_ON)) && !empty($this->properties['file_dependency'])) {\n            foreach ($this->properties['file_dependency'] as $_file_to_check) {\n                if ($_file_to_check[2] == 'file' || $_file_to_check[2] == 'php') {\n                    if ($this->source->filepath == $_file_to_check[0] && isset($this->source->timestamp)) {\n                        // do not recheck current template\n                        $mtime = $this->source->timestamp;\n                    } else {\n                        // file and php types can be checked without loading the respective resource handlers\n                        $mtime = filemtime($_file_to_check[0]);\n                    }\n                } elseif ($_file_to_check[2] == 'string') {\n                    continue;\n                } else {\n                    $source = Smarty_Resource::source(null, $this->smarty, $_file_to_check[0]);\n                    $mtime = $source->timestamp;\n                }\n                if ($mtime > $_file_to_check[1]) {\n                    $is_valid = false;\n                    break;\n                }\n            }\n        }\n        if ($cache) {\n            $this->cached->valid = $is_valid;\n        } else {\n            $this->mustCompile = !$is_valid;\n        }\n        // store data in reusable Smarty_Template_Compiled\n        if (!$cache) {\n            $this->compiled->_properties = $properties;\n        }\n        return $is_valid;\n    }\n\n    /**\n     * Template code runtime function to create a local Smarty variable for array assignments\n     *\n     * @param string $tpl_var   tempate variable name\n     * @param bool   $nocache   cache mode of variable\n     * @param int    $scope     scope of variable\n     */\n    public function createLocalArrayVariable($tpl_var, $nocache = false, $scope = Smarty::SCOPE_LOCAL)\n    {\n        if (!isset($this->tpl_vars[$tpl_var])) {\n            $this->tpl_vars[$tpl_var] = new Smarty_variable(array(), $nocache, $scope);\n        } else {\n            $this->tpl_vars[$tpl_var] = clone $this->tpl_vars[$tpl_var];\n            if ($scope != Smarty::SCOPE_LOCAL) {\n                $this->tpl_vars[$tpl_var]->scope = $scope;\n            }\n            if (!(is_array($this->tpl_vars[$tpl_var]->value) || $this->tpl_vars[$tpl_var]->value instanceof ArrayAccess)) {\n                settype($this->tpl_vars[$tpl_var]->value, 'array');\n            }\n        }\n    }\n\n    /**\n     * Template code runtime function to get pointer to template variable array of requested scope\n     *\n     * @param int $scope    requested variable scope\n     * @return array        array of template variables\n     */\n    public function &getScope($scope)\n    {\n        if ($scope == Smarty::SCOPE_PARENT && !empty($this->parent)) {\n            return $this->parent->tpl_vars;\n        } elseif ($scope == Smarty::SCOPE_ROOT && !empty($this->parent)) {\n            $ptr = $this->parent;\n            while (!empty($ptr->parent)) {\n                $ptr = $ptr->parent;\n            }\n            return $ptr->tpl_vars;\n        } elseif ($scope == Smarty::SCOPE_GLOBAL) {\n            return Smarty::$global_tpl_vars;\n        }\n        $null = null;\n        return $null;\n    }\n\n    /**\n     * Get parent or root of template parent chain\n     *\n     * @param int $scope    pqrent or root scope\n     * @return mixed object\n     */\n    public function getScopePointer($scope)\n    {\n        if ($scope == Smarty::SCOPE_PARENT && !empty($this->parent)) {\n            return $this->parent;\n        } elseif ($scope == Smarty::SCOPE_ROOT && !empty($this->parent)) {\n            $ptr = $this->parent;\n            while (!empty($ptr->parent)) {\n                $ptr = $ptr->parent;\n            }\n            return $ptr;\n        }\n        return null;\n    }\n\n    /**\n     * [util function] counts an array, arrayaccess/traversable or PDOStatement object\n     *\n     * @param mixed $value\n     * @return int the count for arrays and objects that implement countable, 1 for other objects that don't, and 0 for empty elements\n     */\n    public function _count($value)\n    {\n        if (is_array($value) === true || $value instanceof Countable) {\n            return count($value);\n        } elseif ($value instanceof IteratorAggregate) {\n            // Note: getIterator() returns a Traversable, not an Iterator\n            // thus rewind() and valid() methods may not be present\n            return iterator_count($value->getIterator());\n        } elseif ($value instanceof Iterator) {\n            return iterator_count($value);\n        } elseif ($value instanceof PDOStatement) {\n            return $value->rowCount();\n        } elseif ($value instanceof Traversable) {\n            return iterator_count($value);\n        } elseif ($value instanceof ArrayAccess) {\n            if ($value->offsetExists(0)) {\n                return 1;\n            }\n        } elseif (is_object($value)) {\n            return count($value);\n        }\n        return 0;\n    }\n\n    /**\n     * runtime error not matching capture tags\n     *\n     */\n    public function capture_error()\n    {\n        throw new SmartyException(\"Not matching {capture} open/close in \\\"{$this->template_resource}\\\"\");\n    }\n\n    /**\n    * Empty cache for this template\n    *\n    * @param integer $exp_time      expiration time\n    * @return integer number of cache files deleted\n    */\n    public function clearCache($exp_time=null)\n    {\n        Smarty_CacheResource::invalidLoadedCache($this->smarty);\n        return $this->cached->handler->clear($this->smarty, $this->template_name, $this->cache_id, $this->compile_id, $exp_time);\n    }\n\n     /**\n     * set Smarty property in template context\n     *\n     * @param string $property_name property name\n     * @param mixed  $value         value\n     */\n    public function __set($property_name, $value)\n    {\n        switch ($property_name) {\n            case 'source':\n            case 'compiled':\n            case 'cached':\n            case 'compiler':\n                $this->$property_name = $value;\n                return;\n\n            // FIXME: routing of template -> smarty attributes\n            default:\n                if (property_exists($this->smarty, $property_name)) {\n                    $this->smarty->$property_name = $value;\n                    return;\n                }\n        }\n\n        throw new SmartyException(\"invalid template property '$property_name'.\");\n    }\n\n    /**\n     * get Smarty property in template context\n     *\n     * @param string $property_name property name\n     */\n    public function __get($property_name)\n    {\n        switch ($property_name) {\n            case 'source':\n                if (empty($this->template_resource)) {\n                    throw new SmartyException(\"Unable to parse resource name \\\"{$this->template_resource}\\\"\");\n                }\n                $this->source = Smarty_Resource::source($this);\n                // cache template object under a unique ID\n                // do not cache eval resources\n                if ($this->source->type != 'eval') {\n                    if ($this->smarty->allow_ambiguous_resources) {\n                        $_templateId = $this->source->unique_resource . $this->cache_id . $this->compile_id;\n                    } else {\n                        $_templateId = $this->smarty->joined_template_dir . '#' . $this->template_resource . $this->cache_id . $this->compile_id;\n                    }\n\n                    if (isset($_templateId[150])) {\n                        $_templateId = sha1($_templateId);\n                    }\n                    $this->smarty->template_objects[$_templateId] = $this;\n                }\n                return $this->source;\n\n            case 'compiled':\n                $this->compiled = $this->source->getCompiled($this);\n                return $this->compiled;\n\n            case 'cached':\n                if (!class_exists('Smarty_Template_Cached')) {\n                    include SMARTY_SYSPLUGINS_DIR . 'smarty_cacheresource.php';\n                }\n                $this->cached = new Smarty_Template_Cached($this);\n                return $this->cached;\n\n            case 'compiler':\n                $this->smarty->loadPlugin($this->source->compiler_class);\n                $this->compiler = new $this->source->compiler_class($this->source->template_lexer_class, $this->source->template_parser_class, $this->smarty);\n                return $this->compiler;\n\n            // FIXME: routing of template -> smarty attributes\n            default:\n                if (property_exists($this->smarty, $property_name)) {\n                    return $this->smarty->$property_name;\n                }\n        }\n\n        throw new SmartyException(\"template property '$property_name' does not exist.\");\n    }\n\n    /**\n     * Template data object destrutor\n     *\n     */\n    public function __destruct()\n    {\n        if ($this->smarty->cache_locking && isset($this->cached) && $this->cached->is_locked) {\n            $this->cached->handler->releaseLock($this->smarty, $this->cached);\n        }\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_templatebase.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Smarty Template  Base\n *\n * This file contains the basic shared methodes for template handling\n *\n * @package Smarty\n * @subpackage Template\n * @author Uwe Tews\n */\n\n/**\n * Class with shared template methodes\n *\n * @package Smarty\n * @subpackage Template\n */\nabstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {\n\n    /**\n     * fetches a rendered Smarty template\n     *\n     * @param string $template          the resource handle of the template file or template object\n     * @param mixed  $cache_id          cache id to be used with this template\n     * @param mixed  $compile_id        compile id to be used with this template\n     * @param object $parent            next higher level of Smarty variables\n     * @param bool   $display           true: display, false: fetch\n     * @param bool   $merge_tpl_vars    if true parent template variables merged in to local scope\n     * @param bool   $no_output_filter  if true do not run output filter\n     * @return string rendered template output\n     */\n    public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)\n    {\n        if ($template === null && $this instanceof $this->template_class) {\n            $template = $this;\n        }\n        if (!empty($cache_id) && is_object($cache_id)) {\n            $parent = $cache_id;\n            $cache_id = null;\n        }\n        if ($parent === null && ($this instanceof Smarty || is_string($template))) {\n            $parent = $this;\n        }\n        // create template object if necessary\n        $_template = ($template instanceof $this->template_class)\n            ? $template\n            : $this->smarty->createTemplate($template, $cache_id, $compile_id, $parent, false);\n        // if called by Smarty object make sure we use current caching status\n        if ($this instanceof Smarty) {\n            $_template->caching = $this->caching;\n        }\n        // merge all variable scopes into template\n        if ($merge_tpl_vars) {\n            // save local variables\n            $save_tpl_vars = $_template->tpl_vars;\n            $save_config_vars = $_template->config_vars;\n            $ptr_array = array($_template);\n            $ptr = $_template;\n            while (isset($ptr->parent)) {\n                $ptr_array[] = $ptr = $ptr->parent;\n            }\n            $ptr_array = array_reverse($ptr_array);\n            $parent_ptr = reset($ptr_array);\n            $tpl_vars = $parent_ptr->tpl_vars;\n            $config_vars = $parent_ptr->config_vars;\n            while ($parent_ptr = next($ptr_array)) {\n                if (!empty($parent_ptr->tpl_vars)) {\n                    $tpl_vars = array_merge($tpl_vars, $parent_ptr->tpl_vars);\n                }\n                if (!empty($parent_ptr->config_vars)) {\n                    $config_vars = array_merge($config_vars, $parent_ptr->config_vars);\n                }\n            }\n            if (!empty(Smarty::$global_tpl_vars)) {\n                $tpl_vars = array_merge(Smarty::$global_tpl_vars, $tpl_vars);\n            }\n            $_template->tpl_vars = $tpl_vars;\n            $_template->config_vars = $config_vars;\n        }\n        // dummy local smarty variable\n        if (!isset($_template->tpl_vars['smarty'])) {\n            $_template->tpl_vars['smarty'] = new Smarty_Variable;\n        }\n        if (isset($this->smarty->error_reporting)) {\n            $_smarty_old_error_level = error_reporting($this->smarty->error_reporting);\n        }\n        // check URL debugging control\n        if (!$this->smarty->debugging && $this->smarty->debugging_ctrl == 'URL') {\n            if (isset($_SERVER['QUERY_STRING'])) {\n                $_query_string = $_SERVER['QUERY_STRING'];\n            } else {\n                $_query_string = '';\n            }\n            if (false !== strpos($_query_string, $this->smarty->smarty_debug_id)) {\n                if (false !== strpos($_query_string, $this->smarty->smarty_debug_id . '=on')) {\n                    // enable debugging for this browser session\n                    setcookie('SMARTY_DEBUG', true);\n                    $this->smarty->debugging = true;\n                } elseif (false !== strpos($_query_string, $this->smarty->smarty_debug_id . '=off')) {\n                    // disable debugging for this browser session\n                    setcookie('SMARTY_DEBUG', false);\n                    $this->smarty->debugging = false;\n                } else {\n                    // enable debugging for this page\n                    $this->smarty->debugging = true;\n                }\n            } else {\n                if (isset($_COOKIE['SMARTY_DEBUG'])) {\n                    $this->smarty->debugging = true;\n                }\n            }\n        }\n        // must reset merge template date\n        $_template->smarty->merged_templates_func = array();\n        // get rendered template\n        // disable caching for evaluated code\n        if ($_template->source->recompiled) {\n            $_template->caching = false;\n        }\n        // checks if template exists\n        if (!$_template->source->exists) {\n            if ($_template->parent instanceof Smarty_Internal_Template) {\n                $parent_resource = \" in '{$_template->parent->template_resource}'\";\n            } else {\n                $parent_resource = '';\n            }\n            throw new SmartyException(\"Unable to load template {$_template->source->type} '{$_template->source->name}'{$parent_resource}\");\n        }\n        // read from cache or render\n        if (!($_template->caching == Smarty::CACHING_LIFETIME_CURRENT || $_template->caching == Smarty::CACHING_LIFETIME_SAVED) || !$_template->cached->valid) {\n            // render template (not loaded and not in cache)\n            if (!$_template->source->uncompiled) {\n                $_smarty_tpl = $_template;\n                if ($_template->source->recompiled) {\n                    if ($this->smarty->debugging) {\n                        Smarty_Internal_Debug::start_compile($_template);\n                    }\n                    $code = $_template->compiler->compileTemplate($_template);\n                    if ($this->smarty->debugging) {\n                        Smarty_Internal_Debug::end_compile($_template);\n                    }\n                    if ($this->smarty->debugging) {\n                        Smarty_Internal_Debug::start_render($_template);\n                    }\n                    try {\n                        ob_start();\n                        eval(\"?>\" . $code);\n                        unset($code);\n                    } catch (Exception $e) {\n                        ob_get_clean();\n                        throw $e;\n                    }\n                } else {\n                    if (!$_template->compiled->exists || ($_template->smarty->force_compile && !$_template->compiled->isCompiled)) {\n                        $_template->compileTemplateSource();\n                    }\n                    if ($this->smarty->debugging) {\n                        Smarty_Internal_Debug::start_render($_template);\n                    }\n                    if (!$_template->compiled->loaded) {\n                        include($_template->compiled->filepath);\n                        if ($_template->mustCompile) {\n                            // recompile and load again\n                            $_template->compileTemplateSource();\n                            include($_template->compiled->filepath);\n                        }\n                        $_template->compiled->loaded = true;\n                    } else {\n                        $_template->decodeProperties($_template->compiled->_properties, false);\n                    }\n                    try {\n                        ob_start();\n                        if (empty($_template->properties['unifunc']) || !is_callable($_template->properties['unifunc'])) {\n                            throw new SmartyException(\"Invalid compiled template for '{$_template->template_resource}'\");\n                        }\n                        $_template->properties['unifunc']($_template);\n                        if (isset($_template->_capture_stack[0])) {\n                            $_template->capture_error();\n                        }\n                    } catch (Exception $e) {\n                        ob_get_clean();\n                        throw $e;\n                    }\n                }\n            } else {\n                if ($_template->source->uncompiled) {\n                    if ($this->smarty->debugging) {\n                        Smarty_Internal_Debug::start_render($_template);\n                    }\n                    try {\n                        ob_start();\n                        $_template->source->renderUncompiled($_template);\n                    } catch (Exception $e) {\n                        ob_get_clean();\n                        throw $e;\n                    }\n                } else {\n                    throw new SmartyException(\"Resource '$_template->source->type' must have 'renderUncompiled' method\");\n                }\n            }\n            $_output = ob_get_clean();\n            if (!$_template->source->recompiled && empty($_template->properties['file_dependency'][$_template->source->uid])) {\n                $_template->properties['file_dependency'][$_template->source->uid] = array($_template->source->filepath, $_template->source->timestamp, $_template->source->type);\n            }\n            if ($_template->parent instanceof Smarty_Internal_Template) {\n                $_template->parent->properties['file_dependency'] = array_merge($_template->parent->properties['file_dependency'], $_template->properties['file_dependency']);\n                foreach ($_template->required_plugins as $code => $tmp1) {\n                    foreach ($tmp1 as $name => $tmp) {\n                        foreach ($tmp as $type => $data) {\n                            $_template->parent->required_plugins[$code][$name][$type] = $data;\n                        }\n                    }\n                }\n            }\n            if ($this->smarty->debugging) {\n                Smarty_Internal_Debug::end_render($_template);\n            }\n            // write to cache when nessecary\n            if (!$_template->source->recompiled && ($_template->caching == Smarty::CACHING_LIFETIME_SAVED || $_template->caching == Smarty::CACHING_LIFETIME_CURRENT)) {\n                if ($this->smarty->debugging) {\n                    Smarty_Internal_Debug::start_cache($_template);\n                }\n                $_template->properties['has_nocache_code'] = false;\n                // get text between non-cached items\n                $cache_split = preg_split(\"!/\\*%%SmartyNocache:{$_template->properties['nocache_hash']}%%\\*\\/(.+?)/\\*/%%SmartyNocache:{$_template->properties['nocache_hash']}%%\\*/!s\", $_output);\n                // get non-cached items\n                preg_match_all(\"!/\\*%%SmartyNocache:{$_template->properties['nocache_hash']}%%\\*\\/(.+?)/\\*/%%SmartyNocache:{$_template->properties['nocache_hash']}%%\\*/!s\", $_output, $cache_parts);\n                $output = '';\n                // loop over items, stitch back together\n                foreach ($cache_split as $curr_idx => $curr_split) {\n                    // escape PHP tags in template content\n                    $output .= preg_replace('/(<%|%>|<\\?php|<\\?|\\?>)/', '<?php echo \\'$1\\'; ?>', $curr_split);\n                    if (isset($cache_parts[0][$curr_idx])) {\n                        $_template->properties['has_nocache_code'] = true;\n                        // remove nocache tags from cache output\n                        $output .= preg_replace(\"!/\\*/?%%SmartyNocache:{$_template->properties['nocache_hash']}%%\\*/!\", '', $cache_parts[0][$curr_idx]);\n                    }\n                }\n                if (!$no_output_filter && (isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output']))) {\n                    $output = Smarty_Internal_Filter_Handler::runFilter('output', $output, $_template);\n                }\n                // rendering (must be done before writing cache file because of {function} nocache handling)\n                $_smarty_tpl = $_template;\n                try {\n                    ob_start();\n                    eval(\"?>\" . $output);\n                    $_output = ob_get_clean();\n                } catch (Exception $e) {\n                    ob_get_clean();\n                    throw $e;\n                }\n                // write cache file content\n                $_template->writeCachedContent($output);\n                if ($this->smarty->debugging) {\n                    Smarty_Internal_Debug::end_cache($_template);\n                }\n            } else {\n                // var_dump('renderTemplate', $_template->has_nocache_code, $_template->template_resource, $_template->properties['nocache_hash'], $_template->parent->properties['nocache_hash'], $_output);\n                if (!empty($_template->properties['nocache_hash']) && !empty($_template->parent->properties['nocache_hash'])) {\n                    // replace nocache_hash\n                    $_output = preg_replace(\"/{$_template->properties['nocache_hash']}/\", $_template->parent->properties['nocache_hash'], $_output);\n                    $_template->parent->has_nocache_code = $_template->parent->has_nocache_code || $_template->has_nocache_code;\n                }\n            }\n        } else {\n            if ($this->smarty->debugging) {\n                Smarty_Internal_Debug::start_cache($_template);\n            }\n            try {\n                ob_start();\n                $_template->properties['unifunc']($_template);\n                if (isset($_template->_capture_stack[0])) {\n                    $_template->capture_error();\n                }\n                $_output = ob_get_clean();\n            } catch (Exception $e) {\n                ob_get_clean();\n                throw $e;\n            }\n            if ($this->smarty->debugging) {\n                Smarty_Internal_Debug::end_cache($_template);\n            }\n        }\n        if ((!$this->caching || $_template->source->recompiled) && !$no_output_filter && (isset($this->smarty->autoload_filters['output']) || isset($this->smarty->registered_filters['output']))) {\n            $_output = Smarty_Internal_Filter_Handler::runFilter('output', $_output, $_template);\n        }\n        if (isset($this->error_reporting)) {\n            error_reporting($_smarty_old_error_level);\n        }\n        // display or fetch\n        if ($display) {\n            if ($this->caching && $this->cache_modified_check) {\n                $_isCached = $_template->isCached() && !$_template->has_nocache_code;\n                $_last_modified_date = @substr($_SERVER['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_SERVER['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3);\n                if ($_isCached && $_template->cached->timestamp <= strtotime($_last_modified_date)) {\n                    switch (PHP_SAPI) {\n                        case 'cgi':         // php-cgi < 5.3\n                        case 'cgi-fcgi':    // php-cgi >= 5.3\n                        case 'fpm-fcgi':    // php-fpm >= 5.3.3\n                            header('Status: 304 Not Modified');\n                            break;\n\n                        case 'cli':\n                            if (/* ^phpunit */!empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS'])/* phpunit$ */) {\n                                $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = '304 Not Modified';\n                            }\n                            break;\n\n                        default:\n                            header('HTTP/1.1 304 Not Modified');\n                            break;\n                    }\n                } else {\n                    switch (PHP_SAPI) {\n                        case 'cli':\n                            if (/* ^phpunit */!empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS'])/* phpunit$ */) {\n                                $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = 'Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT';\n                            }\n                            break;\n\n                        default:\n                            header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT');\n                            break;\n                    }\n                    echo $_output;\n                }\n            } else {\n                echo $_output;\n            }\n            // debug output\n            if ($this->smarty->debugging) {\n                Smarty_Internal_Debug::display_debug($this);\n            }\n            if ($merge_tpl_vars) {\n                // restore local variables\n                $_template->tpl_vars = $save_tpl_vars;\n                $_template->config_vars =  $save_config_vars;\n            }\n            return;\n        } else {\n            if ($merge_tpl_vars) {\n                // restore local variables\n                $_template->tpl_vars = $save_tpl_vars;\n                $_template->config_vars =  $save_config_vars;\n            }\n            // return fetched content\n            return $_output;\n        }\n    }\n\n    /**\n     * displays a Smarty template\n     *\n     * @param string $template   the resource handle of the template file or template object\n     * @param mixed  $cache_id   cache id to be used with this template\n     * @param mixed  $compile_id compile id to be used with this template\n     * @param object $parent     next higher level of Smarty variables\n     */\n    public function display($template = null, $cache_id = null, $compile_id = null, $parent = null)\n    {\n        // display template\n        $this->fetch($template, $cache_id, $compile_id, $parent, true);\n    }\n\n    /**\n     * test if cache is valid\n     *\n     * @param string|object $template   the resource handle of the template file or template object\n     * @param mixed         $cache_id   cache id to be used with this template\n     * @param mixed         $compile_id compile id to be used with this template\n     * @param object        $parent     next higher level of Smarty variables\n     * @return boolean cache status\n     */\n    public function isCached($template = null, $cache_id = null, $compile_id = null, $parent = null)\n    {\n        if ($template === null && $this instanceof $this->template_class) {\n            return $this->cached->valid;\n        }\n        if (!($template instanceof $this->template_class)) {\n            if ($parent === null) {\n                $parent = $this;\n            }\n            $template = $this->smarty->createTemplate($template, $cache_id, $compile_id, $parent, false);\n        }\n        // return cache status of template\n        return $template->cached->valid;\n    }\n\n    /**\n     * creates a data object\n     *\n     * @param object $parent next higher level of Smarty variables\n     * @returns Smarty_Data data object\n     */\n    public function createData($parent = null)\n    {\n        return new Smarty_Data($parent, $this);\n    }\n\n    /**\n     * Registers plugin to be used in templates\n     *\n     * @param string   $type       plugin type\n     * @param string   $tag        name of template tag\n     * @param callback $callback   PHP callback to register\n     * @param boolean  $cacheable  if true (default) this fuction is cachable\n     * @param array    $cache_attr caching attributes if any\n     * @throws SmartyException when the plugin tag is invalid\n     */\n    public function registerPlugin($type, $tag, $callback, $cacheable = true, $cache_attr = null)\n    {\n        if (isset($this->smarty->registered_plugins[$type][$tag])) {\n            throw new SmartyException(\"Plugin tag \\\"{$tag}\\\" already registered\");\n        } elseif (!is_callable($callback)) {\n            throw new SmartyException(\"Plugin \\\"{$tag}\\\" not callable\");\n        } else {\n            $this->smarty->registered_plugins[$type][$tag] = array($callback, (bool) $cacheable, (array) $cache_attr);\n        }\n    }\n\n    /**\n     * Unregister Plugin\n     *\n     * @param string $type of plugin\n     * @param string $tag name of plugin\n     */\n    public function unregisterPlugin($type, $tag)\n    {\n        if (isset($this->smarty->registered_plugins[$type][$tag])) {\n            unset($this->smarty->registered_plugins[$type][$tag]);\n        }\n    }\n\n    /**\n     * Registers a resource to fetch a template\n     *\n     * @param string $type name of resource type\n     * @param Smarty_Resource|array $callback or instance of Smarty_Resource, or array of callbacks to handle resource (deprecated)\n     */\n    public function registerResource($type, $callback)\n    {\n        $this->smarty->registered_resources[$type] = $callback instanceof Smarty_Resource ? $callback : array($callback, false);\n    }\n\n    /**\n     * Unregisters a resource\n     *\n     * @param string $type name of resource type\n     */\n    public function unregisterResource($type)\n    {\n        if (isset($this->smarty->registered_resources[$type])) {\n            unset($this->smarty->registered_resources[$type]);\n        }\n    }\n\n    /**\n     * Registers a cache resource to cache a template's output\n     *\n     * @param string               $type     name of cache resource type\n     * @param Smarty_CacheResource $callback instance of Smarty_CacheResource to handle output caching\n     */\n    public function registerCacheResource($type, Smarty_CacheResource $callback)\n    {\n        $this->smarty->registered_cache_resources[$type] = $callback;\n    }\n\n    /**\n     * Unregisters a cache resource\n     *\n     * @param string $type name of cache resource type\n     */\n    public function unregisterCacheResource($type)\n    {\n        if (isset($this->smarty->registered_cache_resources[$type])) {\n            unset($this->smarty->registered_cache_resources[$type]);\n        }\n    }\n\n    /**\n     * Registers object to be used in templates\n     *\n     * @param string  $object        name of template object\n     * @param object  $object_impl   the referenced PHP object to register\n     * @param array   $allowed       list of allowed methods (empty = all)\n     * @param boolean $smarty_args   smarty argument format, else traditional\n     * @param array   $block_methods list of block-methods\n     * @param array $block_functs list of methods that are block format\n     * @throws SmartyException if any of the methods in $allowed or $block_methods are invalid\n     */\n    public function registerObject($object_name, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())\n    {\n        // test if allowed methodes callable\n        if (!empty($allowed)) {\n            foreach ((array) $allowed as $method) {\n                if (!is_callable(array($object_impl, $method))) {\n                    throw new SmartyException(\"Undefined method '$method' in registered object\");\n                }\n            }\n        }\n        // test if block methodes callable\n        if (!empty($block_methods)) {\n            foreach ((array) $block_methods as $method) {\n                if (!is_callable(array($object_impl, $method))) {\n                    throw new SmartyException(\"Undefined method '$method' in registered object\");\n                }\n            }\n        }\n        // register the object\n        $this->smarty->registered_objects[$object_name] =\n            array($object_impl, (array) $allowed, (boolean) $smarty_args, (array) $block_methods);\n    }\n\n    /**\n     * return a reference to a registered object\n     *\n     * @param string $name object name\n     * @return object\n     * @throws SmartyException if no such object is found\n     */\n    public function getRegisteredObject($name)\n    {\n        if (!isset($this->smarty->registered_objects[$name])) {\n            throw new SmartyException(\"'$name' is not a registered object\");\n        }\n        if (!is_object($this->smarty->registered_objects[$name][0])) {\n            throw new SmartyException(\"registered '$name' is not an object\");\n        }\n        return $this->smarty->registered_objects[$name][0];\n    }\n\n    /**\n     * unregister an object\n     *\n     * @param string $name object name\n     * @throws SmartyException if no such object is found\n     */\n    public function unregisterObject($name)\n    {\n        unset($this->smarty->registered_objects[$name]);\n        return;\n    }\n\n    /**\n     * Registers static classes to be used in templates\n     *\n     * @param string $class name of template class\n     * @param string $class_impl the referenced PHP class to register\n     * @throws SmartyException if $class_impl does not refer to an existing class\n     */\n    public function registerClass($class_name, $class_impl)\n    {\n        // test if exists\n        if (!class_exists($class_impl)) {\n            throw new SmartyException(\"Undefined class '$class_impl' in register template class\");\n        }\n        // register the class\n        $this->smarty->registered_classes[$class_name] = $class_impl;\n    }\n\n    /**\n     * Registers a default plugin handler\n     *\n     * @param callable $callback class/method name\n     * @throws SmartyException if $callback is not callable\n     */\n    public function registerDefaultPluginHandler($callback)\n    {\n        if (is_callable($callback)) {\n            $this->smarty->default_plugin_handler_func = $callback;\n        } else {\n            throw new SmartyException(\"Default plugin handler '$callback' not callable\");\n        }\n    }\n\n    /**\n     * Registers a default template handler\n     *\n     * @param callable $callback class/method name\n     * @throws SmartyException if $callback is not callable\n     */\n    public function registerDefaultTemplateHandler($callback)\n    {\n        if (is_callable($callback)) {\n            $this->smarty->default_template_handler_func = $callback;\n        } else {\n            throw new SmartyException(\"Default template handler '$callback' not callable\");\n        }\n    }\n\n    /**\n     * Registers a default template handler\n     *\n     * @param callable $callback class/method name\n     * @throws SmartyException if $callback is not callable\n     */\n    public function registerDefaultConfigHandler($callback)\n    {\n        if (is_callable($callback)) {\n            $this->smarty->default_config_handler_func = $callback;\n        } else {\n            throw new SmartyException(\"Default config handler '$callback' not callable\");\n        }\n    }\n\n    /**\n     * Registers a filter function\n     *\n     * @param string $type filter type\n     * @param callback $callback\n     */\n    public function registerFilter($type, $callback)\n    {\n        $this->smarty->registered_filters[$type][$this->_get_filter_name($callback)] = $callback;\n    }\n\n    /**\n     * Unregisters a filter function\n     *\n     * @param string $type filter type\n     * @param callback $callback\n     */\n    public function unregisterFilter($type, $callback)\n    {\n        $name = $this->_get_filter_name($callback);\n        if (isset($this->smarty->registered_filters[$type][$name])) {\n            unset($this->smarty->registered_filters[$type][$name]);\n        }\n    }\n\n    /**\n     * Return internal filter name\n     *\n     * @param callback $function_name\n     */\n    public function _get_filter_name($function_name)\n    {\n        if (is_array($function_name)) {\n            $_class_name = (is_object($function_name[0]) ?\n                            get_class($function_name[0]) : $function_name[0]);\n            return $_class_name . '_' . $function_name[1];\n        } else {\n            return $function_name;\n        }\n    }\n\n    /**\n     * load a filter of specified type and name\n     *\n     * @param string $type filter type\n     * @param string $name filter name\n     * @return bool\n     */\n    public function loadFilter($type, $name)\n    {\n        $_plugin = \"smarty_{$type}filter_{$name}\";\n        $_filter_name = $_plugin;\n        if ($this->smarty->loadPlugin($_plugin)) {\n            if (class_exists($_plugin, false)) {\n                $_plugin = array($_plugin, 'execute');\n            }\n            if (is_callable($_plugin)) {\n                $this->smarty->registered_filters[$type][$_filter_name] = $_plugin;\n                return true;\n            }\n        }\n        throw new SmartyException(\"{$type}filter \\\"{$name}\\\" not callable\");\n        return false;\n    }\n\n    /**\n     * unload a filter of specified type and name\n     *\n     * @param string $type filter type\n     * @param string $name filter name\n     * @return bool\n     */\n    public function unloadFilter($type, $name)\n    {\n        $_filter_name = \"smarty_{$type}filter_{$name}\";\n        if (isset($this->smarty->registered_filters[$type][$_filter_name])) {\n            unset ($this->smarty->registered_filters[$type][$_filter_name]);\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * preg_replace callback to convert camelcase getter/setter to underscore property names\n     *\n     * @param string $match match string\n     * @return string  replacemant\n     */\n    private function replaceCamelcase($match) {\n        return \"_\" . strtolower($match[1]);\n    }\n\n    /**\n     * Handle unknown class methods\n     *\n     * @param string $name unknown method-name\n     * @param array  $args argument array\n     */\n    public function __call($name, $args)\n    {\n        static $_prefixes = array('set' => true, 'get' => true);\n        static $_resolved_property_name = array();\n        static $_resolved_property_source = array();\n\n        // method of Smarty object?\n        if (method_exists($this->smarty, $name)) {\n            return call_user_func_array(array($this->smarty, $name), $args);\n        }\n        // see if this is a set/get for a property\n        $first3 = strtolower(substr($name, 0, 3));\n        if (isset($_prefixes[$first3]) && isset($name[3]) && $name[3] !== '_') {\n            if (isset($_resolved_property_name[$name])) {\n                $property_name = $_resolved_property_name[$name];\n            } else {\n                // try to keep case correct for future PHP 6.0 case-sensitive class methods\n                // lcfirst() not available < PHP 5.3.0, so improvise\n                $property_name = strtolower(substr($name, 3, 1)) . substr($name, 4);\n                // convert camel case to underscored name\n                $property_name = preg_replace_callback('/([A-Z])/', array($this,'replaceCamelcase'), $property_name);\n                $_resolved_property_name[$name] = $property_name;\n            }\n            if (isset($_resolved_property_source[$property_name])) {\n                $_is_this = $_resolved_property_source[$property_name];\n            } else {\n                $_is_this = null;\n                if (property_exists($this, $property_name)) {\n                    $_is_this = true;\n                } else if (property_exists($this->smarty, $property_name)) {\n                    $_is_this = false;\n                }\n                $_resolved_property_source[$property_name] = $_is_this;\n            }\n            if ($_is_this) {\n                if ($first3 == 'get')\n                    return $this->$property_name;\n                else\n                    return $this->$property_name = $args[0];\n            } else if ($_is_this === false) {\n                if ($first3 == 'get')\n                    return $this->smarty->$property_name;\n                else\n                    return $this->smarty->$property_name = $args[0];\n            } else {\n                throw new SmartyException(\"property '$property_name' does not exist.\");\n                return false;\n            }\n        }\n        if ($name == 'Smarty') {\n            throw new SmartyException(\"PHP5 requires you to call __construct() instead of Smarty()\");\n        }\n        // must be unknown\n        throw new SmartyException(\"Call of unknown method '$name'.\");\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_templatecompilerbase.php",
    "content": "<?php\n/**\n * Smarty Internal Plugin Smarty Template Compiler Base\n *\n * This file contains the basic classes and methodes for compiling Smarty templates with lexer/parser\n *\n * @package Smarty\n * @subpackage Compiler\n * @author Uwe Tews\n */\n\n/**\n * Main abstract compiler class\n *\n * @package Smarty\n * @subpackage Compiler\n */\nabstract class Smarty_Internal_TemplateCompilerBase {\n\n    /**\n     * hash for nocache sections\n     *\n     * @var mixed\n     */\n    private $nocache_hash = null;\n    /**\n     * suppress generation of nocache code\n     *\n     * @var bool\n     */\n    public $suppressNocacheProcessing = false;\n    /**\n     * suppress generation of merged template code\n     *\n     * @var bool\n     */\n    public $suppressMergedTemplates = false;\n    /**\n     * compile tag objects\n     *\n     * @var array\n     */\n    public static $_tag_objects = array();\n    /**\n     * tag stack\n     *\n     * @var array\n     */\n    public $_tag_stack = array();\n    /**\n     * current template\n     *\n     * @var Smarty_Internal_Template\n     */\n    public $template = null;\n    /**\n     * merged templates\n     *\n     * @var array\n     */\n    public $merged_templates = array();\n    /**\n     * flag when compiling {block}\n     *\n     * @var bool\n     */\n    public $inheritance = false;\n    /**\n     * plugins loaded by default plugin handler\n     *\n     * @var array\n     */\n    public $default_handler_plugins = array();\n    /**\n     * saved preprocessed modifier list\n     *\n     * @var mixed\n     */\n    public $default_modifier_list = null;\n    /**\n     * force compilation of complete template as nocache\n     * @var boolean\n     */\n    public $forceNocache = false;\n    /**\n     * suppress Smarty header code in compiled template\n     * @var bool\n     */\n    public $suppressHeader = false;\n    /**\n     * suppress template property header code in compiled template\n     * @var bool\n     */\n    public $suppressTemplatePropertyHeader = false;\n    /**\n     * flag if compiled template file shall we written\n     * @var bool\n     */\n    public $write_compiled_code = true;\n    /**\n     * flag if currently a template function is compiled\n     * @var bool\n     */\n    public $compiles_template_function = false;\n    /**\n     * called subfuntions from template function\n     * @var array\n     */\n    public $called_functions = array();\n    /**\n     * flags for used modifier plugins\n     * @var array\n     */\n    public $modifier_plugins = array();\n\n    /**\n     * Initialize compiler\n     */\n    public function __construct()\n    {\n        $this->nocache_hash = str_replace('.', '-', uniqid(rand(), true));\n    }\n\n    /**\n     * Method to compile a Smarty template\n     *\n     * @param  Smarty_Internal_Template $template template object to compile\n     * @return bool true if compiling succeeded, false if it failed\n     */\n    public function compileTemplate(Smarty_Internal_Template $template)\n    {\n        if (empty($template->properties['nocache_hash'])) {\n            $template->properties['nocache_hash'] = $this->nocache_hash;\n        } else {\n            $this->nocache_hash = $template->properties['nocache_hash'];\n        }\n        // flag for nochache sections\n        $this->nocache = false;\n        $this->tag_nocache = false;\n        // save template object in compiler class\n        $this->template = $template;\n        // reset has noche code flag\n        $this->template->has_nocache_code = false;\n        $this->smarty->_current_file = $saved_filepath = $this->template->source->filepath;\n        // template header code\n        $template_header = '';\n        if (!$this->suppressHeader) {\n            $template_header .= \"<?php /* Smarty version \" . Smarty::SMARTY_VERSION . \", created on \" . strftime(\"%Y-%m-%d %H:%M:%S\") . \"\\n\";\n            $template_header .= \"         compiled from \\\"\" . $this->template->source->filepath . \"\\\" */ ?>\\n\";\n        }\n\n        do {\n            // flag for aborting current and start recompile\n            $this->abort_and_recompile = false;\n            // get template source\n            $_content = $template->source->content;\n            // run prefilter if required\n            if (isset($this->smarty->autoload_filters['pre']) || isset($this->smarty->registered_filters['pre'])) {\n                $template->source->content = $_content = Smarty_Internal_Filter_Handler::runFilter('pre', $_content, $template);\n            }\n            // on empty template just return header\n            if ($_content == '') {\n                if ($this->suppressTemplatePropertyHeader) {\n                    $code = '';\n                } else {\n                    $code = $template_header . $template->createTemplateCodeFrame();\n                }\n                return $code;\n            }\n            // call compiler\n            $_compiled_code = $this->doCompile($_content);\n        } while ($this->abort_and_recompile);\n        $this->template->source->filepath = $saved_filepath;\n        // free memory\n        unset($this->parser->root_buffer, $this->parser->current_buffer, $this->parser, $this->lex, $this->template);\n        self::$_tag_objects = array();\n        // return compiled code to template object\n        $merged_code = '';\n        if (!$this->suppressMergedTemplates) {\n            foreach ($this->merged_templates as $code) {\n                $merged_code .= $code;\n            }\n        }\n        if ($this->suppressTemplatePropertyHeader) {\n            $code = $_compiled_code . $merged_code;\n        } else {\n            $code = $template_header . $template->createTemplateCodeFrame($_compiled_code) . $merged_code;\n        }\n        // run postfilter if required\n        if (isset($this->smarty->autoload_filters['post']) || isset($this->smarty->registered_filters['post'])) {\n            $code = Smarty_Internal_Filter_Handler::runFilter('post', $code, $template);\n        }\n        return $code;\n    }\n\n    /**\n     * Compile Tag\n     *\n     * This is a call back from the lexer/parser\n     * It executes the required compile plugin for the Smarty tag\n     *\n     * @param string $tag       tag name\n     * @param array  $args      array with tag attributes\n     * @param array  $parameter array with compilation parameter\n     * @return string compiled code\n     */\n    public function compileTag($tag, $args, $parameter = array())\n    {\n        // $args contains the attributes parsed and compiled by the lexer/parser\n        // assume that tag does compile into code, but creates no HTML output\n        $this->has_code = true;\n        $this->has_output = false;\n        // log tag/attributes\n        if (isset($this->smarty->get_used_tags) && $this->smarty->get_used_tags) {\n            $this->template->used_tags[] = array($tag, $args);\n        }\n        // check nocache option flag\n        if (in_array(\"'nocache'\",$args) || in_array(array('nocache'=>'true'),$args)\n        || in_array(array('nocache'=>'\"true\"'),$args) || in_array(array('nocache'=>\"'true'\"),$args)) {\n            $this->tag_nocache = true;\n        }\n        // compile the smarty tag (required compile classes to compile the tag are autoloaded)\n        if (($_output = $this->callTagCompiler($tag, $args, $parameter)) === false) {\n            if (isset($this->smarty->template_functions[$tag])) {\n                // template defined by {template} tag\n                $args['_attr']['name'] = \"'\" . $tag . \"'\";\n                $_output = $this->callTagCompiler('call', $args, $parameter);\n            }\n        }\n        if ($_output !== false) {\n            if ($_output !== true) {\n                // did we get compiled code\n                if ($this->has_code) {\n                    // Does it create output?\n                    if ($this->has_output) {\n                        $_output .= \"\\n\";\n                    }\n                    // return compiled code\n                    return $_output;\n                }\n            }\n            // tag did not produce compiled code\n            return '';\n        } else {\n            // map_named attributes\n            if (isset($args['_attr'])) {\n                foreach ($args['_attr'] as $key => $attribute) {\n                    if (is_array($attribute)) {\n                        $args = array_merge($args, $attribute);\n                    }\n                }\n            }\n            // not an internal compiler tag\n            if (strlen($tag) < 6 || substr($tag, -5) != 'close') {\n                // check if tag is a registered object\n                if (isset($this->smarty->registered_objects[$tag]) && isset($parameter['object_methode'])) {\n                    $methode = $parameter['object_methode'];\n                    if (!in_array($methode, $this->smarty->registered_objects[$tag][3]) &&\n                    (empty($this->smarty->registered_objects[$tag][1]) || in_array($methode, $this->smarty->registered_objects[$tag][1]))) {\n                        return $this->callTagCompiler('private_object_function', $args, $parameter, $tag, $methode);\n                    } elseif (in_array($methode, $this->smarty->registered_objects[$tag][3])) {\n                        return $this->callTagCompiler('private_object_block_function', $args, $parameter, $tag, $methode);\n                    } else {\n                        return $this->trigger_template_error ('unallowed methode \"' . $methode . '\" in registered object \"' . $tag . '\"', $this->lex->taglineno);\n                    }\n                }\n                // check if tag is registered\n                foreach (array(Smarty::PLUGIN_COMPILER, Smarty::PLUGIN_FUNCTION, Smarty::PLUGIN_BLOCK) as $plugin_type) {\n                    if (isset($this->smarty->registered_plugins[$plugin_type][$tag])) {\n                        // if compiler function plugin call it now\n                        if ($plugin_type == Smarty::PLUGIN_COMPILER) {\n                            $new_args = array();\n                            foreach ($args as $key => $mixed) {\n                            \tif (is_array($mixed)) {\n                                \t$new_args = array_merge($new_args, $mixed);\n                                } else {\n                                \t$new_args[$key] = $mixed;\n                                }\n                            }\n                            if (!$this->smarty->registered_plugins[$plugin_type][$tag][1]) {\n                                $this->tag_nocache = true;\n                            }\n                            $function = $this->smarty->registered_plugins[$plugin_type][$tag][0];\n                            if (!is_array($function)) {\n                                return $function($new_args, $this);\n                            } else if (is_object($function[0])) {\n                                return $this->smarty->registered_plugins[$plugin_type][$tag][0][0]->$function[1]($new_args, $this);\n                            } else {\n                                return call_user_func_array($function, array($new_args, $this));\n                            }\n                        }\n                        // compile registered function or block function\n                        if ($plugin_type == Smarty::PLUGIN_FUNCTION || $plugin_type == Smarty::PLUGIN_BLOCK) {\n                            return $this->callTagCompiler('private_registered_' . $plugin_type, $args, $parameter, $tag);\n                        }\n\n                    }\n                }\n                // check plugins from plugins folder\n                foreach ($this->smarty->plugin_search_order as $plugin_type) {\n                    if ($plugin_type == Smarty::PLUGIN_BLOCK && $this->smarty->loadPlugin('smarty_compiler_' . $tag) && (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this))) {\n                        $plugin = 'smarty_compiler_' . $tag;\n                        if (is_callable($plugin)) {\n                            // convert arguments format for old compiler plugins\n                            $new_args = array();\n                            foreach ($args as $key => $mixed) {\n                            \tif (is_array($mixed)) {\n                                \t$new_args = array_merge($new_args, $mixed);\n                                } else {\n                                \t$new_args[$key] = $mixed;\n                                }\n                            }\n                            return $plugin($new_args, $this->smarty);\n                        }\n                        if (class_exists($plugin, false)) {\n                            $plugin_object = new $plugin;\n                            if (method_exists($plugin_object, 'compile')) {\n                                return $plugin_object->compile($args, $this);\n                            }\n                        }\n                        throw new SmartyException(\"Plugin \\\"{$tag}\\\" not callable\");\n                    } else {\n                        if ($function = $this->getPlugin($tag, $plugin_type)) {\n                            if(!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this)) {\n                                return $this->callTagCompiler('private_' . $plugin_type . '_plugin', $args, $parameter, $tag, $function);\n                            }\n                        }\n                    }\n                }\n                if (is_callable($this->smarty->default_plugin_handler_func)) {\n                    $found = false;\n                    // look for already resolved tags\n                    foreach ($this->smarty->plugin_search_order as $plugin_type) {\n                        if (isset($this->default_handler_plugins[$plugin_type][$tag])) {\n                            $found = true;\n                            break;\n                        }\n                    }\n                    if (!$found) {\n                        // call default handler\n                        foreach ($this->smarty->plugin_search_order as $plugin_type) {\n                            if ($this->getPluginFromDefaultHandler($tag, $plugin_type)) {\n                                $found = true;\n                                break;\n                            }\n                        }\n                    }\n                    if ($found) {\n                        // if compiler function plugin call it now\n                        if ($plugin_type == Smarty::PLUGIN_COMPILER) {\n                            $new_args = array();\n                            foreach ($args as $mixed) {\n                                $new_args = array_merge($new_args, $mixed);\n                            }\n                            $function = $this->default_handler_plugins[$plugin_type][$tag][0];\n                            if (!is_array($function)) {\n                                return $function($new_args, $this);\n                            } else if (is_object($function[0])) {\n                                return $this->default_handler_plugins[$plugin_type][$tag][0][0]->$function[1]($new_args, $this);\n                            } else {\n                                return call_user_func_array($function, array($new_args, $this));\n                            }\n                        } else {\n                            return $this->callTagCompiler('private_registered_' . $plugin_type, $args, $parameter, $tag);\n                        }\n                    }\n                }\n            } else {\n                // compile closing tag of block function\n                $base_tag = substr($tag, 0, -5);\n                // check if closing tag is a registered object\n                if (isset($this->smarty->registered_objects[$base_tag]) && isset($parameter['object_methode'])) {\n                    $methode = $parameter['object_methode'];\n                    if (in_array($methode, $this->smarty->registered_objects[$base_tag][3])) {\n                        return $this->callTagCompiler('private_object_block_function', $args, $parameter, $tag, $methode);\n                    } else {\n                        return $this->trigger_template_error ('unallowed closing tag methode \"' . $methode . '\" in registered object \"' . $base_tag . '\"', $this->lex->taglineno);\n                    }\n                }\n                // registered block tag ?\n                if (isset($this->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$base_tag]) || isset($this->default_handler_plugins[Smarty::PLUGIN_BLOCK][$base_tag])) {\n                    return $this->callTagCompiler('private_registered_block', $args, $parameter, $tag);\n                }\n                // block plugin?\n                if ($function = $this->getPlugin($base_tag, Smarty::PLUGIN_BLOCK)) {\n                    return $this->callTagCompiler('private_block_plugin', $args, $parameter, $tag, $function);\n                }\n                if ($this->smarty->loadPlugin('smarty_compiler_' . $tag)) {\n                    $plugin = 'smarty_compiler_' . $tag;\n                    if (is_callable($plugin)) {\n                        return $plugin($args, $this->smarty);\n                    }\n                    if (class_exists($plugin, false)) {\n                        $plugin_object = new $plugin;\n                        if (method_exists($plugin_object, 'compile')) {\n                            return $plugin_object->compile($args, $this);\n                        }\n                    }\n                    throw new SmartyException(\"Plugin \\\"{$tag}\\\" not callable\");\n                }\n            }\n            $this->trigger_template_error (\"unknown tag \\\"\" . $tag . \"\\\"\", $this->lex->taglineno);\n        }\n    }\n\n    /**\n     * lazy loads internal compile plugin for tag and calls the compile methode\n     *\n     * compile objects cached for reuse.\n     * class name format:  Smarty_Internal_Compile_TagName\n     * plugin filename format: Smarty_Internal_Tagname.php\n     *\n     * @param string $tag   tag name\n     * @param array $args   list of tag attributes\n     * @param mixed $param1 optional parameter\n     * @param mixed $param2 optional parameter\n     * @param mixed $param3 optional parameter\n     * @return string compiled code\n     */\n    public function callTagCompiler($tag, $args, $param1 = null, $param2 = null, $param3 = null)\n    {\n        // re-use object if already exists\n        if (isset(self::$_tag_objects[$tag])) {\n            // compile this tag\n            return self::$_tag_objects[$tag]->compile($args, $this, $param1, $param2, $param3);\n        }\n        // lazy load internal compiler plugin\n        $class_name = 'Smarty_Internal_Compile_' . $tag;\n        if ($this->smarty->loadPlugin($class_name)) {\n            // check if tag allowed by security\n            if (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this)) {\n            // use plugin if found\n            self::$_tag_objects[$tag] = new $class_name;\n            // compile this tag\n            return self::$_tag_objects[$tag]->compile($args, $this, $param1, $param2, $param3);\n            }\n        }\n        // no internal compile plugin for this tag\n        return false;\n    }\n\n    /**\n     * Check for plugins and return function name\n     *\n     * @param string $pugin_name  name of plugin or function\n     * @param string $plugin_type type of plugin\n     * @return string call name of function\n     */\n    public function getPlugin($plugin_name, $plugin_type)\n    {\n        $function = null;\n        if ($this->template->caching && ($this->nocache || $this->tag_nocache)) {\n            if (isset($this->template->required_plugins['nocache'][$plugin_name][$plugin_type])) {\n                $function = $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['function'];\n            } else if (isset($this->template->required_plugins['compiled'][$plugin_name][$plugin_type])) {\n                $this->template->required_plugins['nocache'][$plugin_name][$plugin_type] = $this->template->required_plugins['compiled'][$plugin_name][$plugin_type];\n                $function = $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['function'];\n            }\n        } else {\n            if (isset($this->template->required_plugins['compiled'][$plugin_name][$plugin_type])) {\n                $function = $this->template->required_plugins['compiled'][$plugin_name][$plugin_type]['function'];\n            } else if (isset($this->template->required_plugins['nocache'][$plugin_name][$plugin_type])) {\n                $this->template->required_plugins['compiled'][$plugin_name][$plugin_type] = $this->template->required_plugins['nocache'][$plugin_name][$plugin_type];\n                $function = $this->template->required_plugins['compiled'][$plugin_name][$plugin_type]['function'];\n            }\n        }\n        if (isset($function)) {\n            if ($plugin_type == 'modifier') {\n                $this->modifier_plugins[$plugin_name] = true;\n            }\n            return $function;\n        }\n        // loop through plugin dirs and find the plugin\n        $function = 'smarty_' . $plugin_type . '_' . $plugin_name;\n        $file = $this->smarty->loadPlugin($function, false);\n\n        if (is_string($file)) {\n            if ($this->template->caching && ($this->nocache || $this->tag_nocache)) {\n                $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['file'] = $file;\n                $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['function'] = $function;\n            } else {\n                $this->template->required_plugins['compiled'][$plugin_name][$plugin_type]['file'] = $file;\n                $this->template->required_plugins['compiled'][$plugin_name][$plugin_type]['function'] = $function;\n            }\n            if ($plugin_type == 'modifier') {\n                $this->modifier_plugins[$plugin_name] = true;\n            }\n            return $function;\n        }\n        if (is_callable($function)) {\n            // plugin function is defined in the script\n            return $function;\n        }\n        return false;\n    }\n\n    /**\n     * Check for plugins by default plugin handler\n     *\n     * @param string $tag         name of tag\n     * @param string $plugin_type type of plugin\n     * @return boolean true if found\n     */\n    public function getPluginFromDefaultHandler($tag, $plugin_type)\n    {\n        $callback = null;\n        $script = null;\n        $result = call_user_func_array(\n            $this->smarty->default_plugin_handler_func,\n            array($tag, $plugin_type, $this->template, &$callback, &$script)\n        );\n        if ($result) {\n            if ($script !== null) {\n                if (is_file($script)) {\n                    if ($this->template->caching && ($this->nocache || $this->tag_nocache)) {\n                        $this->template->required_plugins['nocache'][$tag][$plugin_type]['file'] = $script;\n                        $this->template->required_plugins['nocache'][$tag][$plugin_type]['function'] = $callback;\n                    } else {\n                        $this->template->required_plugins['compiled'][$tag][$plugin_type]['file'] = $script;\n                        $this->template->required_plugins['compiled'][$tag][$plugin_type]['function'] = $callback;\n                    }\n                    include_once $script;\n                }  else {\n                    $this->trigger_template_error(\"Default plugin handler: Returned script file \\\"{$script}\\\" for \\\"{$tag}\\\" not found\");\n                }\n            }\n            if (!is_string($callback) && !(is_array($callback) && is_string($callback[0]) && is_string($callback[1]))) {\n                $this->trigger_template_error(\"Default plugin handler: Returned callback for \\\"{$tag}\\\" must be a static function name or array of class and function name\");\n            }\n            if (is_callable($callback)) {\n                $this->default_handler_plugins[$plugin_type][$tag] = array($callback, true, array());\n                return true;\n            } else {\n                $this->trigger_template_error(\"Default plugin handler: Returned callback for \\\"{$tag}\\\" not callable\");\n            }\n        }\n        return false;\n    }\n\n    /**\n     * Inject inline code for nocache template sections\n     *\n     * This method gets the content of each template element from the parser.\n     * If the content is compiled code and it should be not cached the code is injected\n     * into the rendered output.\n     *\n     * @param string  $content content of template element\n     * @param boolean $is_code true if content is compiled code\n     * @return string content\n     */\n    public function processNocacheCode($content, $is_code)\n    {\n        // If the template is not evaluated and we have a nocache section and or a nocache tag\n        if ($is_code && !empty($content)) {\n            // generate replacement code\n            if ((!($this->template->source->recompiled) || $this->forceNocache) && $this->template->caching && !$this->suppressNocacheProcessing &&\n            ($this->nocache || $this->tag_nocache || $this->forceNocache == 2)) {\n                $this->template->has_nocache_code = true;\n                $_output = str_replace(\"'\", \"\\'\", $content);\n                $_output = str_replace('\\\\\\\\', '\\\\\\\\\\\\\\\\', $_output);\n                $_output = str_replace(\"^#^\", \"'\", $_output);\n                $_output = \"<?php echo '/*%%SmartyNocache:{$this->nocache_hash}%%*/\" . $_output . \"/*/%%SmartyNocache:{$this->nocache_hash}%%*/';?>\\n\";\n                // make sure we include modifer plugins for nocache code\n                foreach ($this->modifier_plugins as $plugin_name => $dummy) {\n                    if (isset($this->template->required_plugins['compiled'][$plugin_name]['modifier'])) {\n                        $this->template->required_plugins['nocache'][$plugin_name]['modifier'] = $this->template->required_plugins['compiled'][$plugin_name]['modifier'];\n                    }\n                }\n            } else {\n                $_output = $content;\n            }\n        } else {\n            $_output = $content;\n        }\n        $this->modifier_plugins = array();\n        $this->suppressNocacheProcessing = false;\n        $this->tag_nocache = false;\n        return $_output;\n    }\n\n    /**\n     * display compiler error messages without dying\n     *\n     * If parameter $args is empty it is a parser detected syntax error.\n     * In this case the parser is called to obtain information about expected tokens.\n     *\n     * If parameter $args contains a string this is used as error message\n     *\n     * @param string $args individual error message or null\n     * @param string $line line-number\n     * @throws SmartyCompilerException when an unexpected token is found\n     */\n    public function trigger_template_error($args = null, $line = null)\n    {\n        // get template source line which has error\n        if (!isset($line)) {\n            $line = $this->lex->line;\n        }\n        $match = preg_split(\"/\\n/\", $this->lex->data);\n        $error_text = 'Syntax Error in template \"' . $this->template->source->filepath . '\"  on line ' . $line . ' \"' . htmlspecialchars(trim(preg_replace('![\\t\\r\\n]+!',' ',$match[$line-1]))) . '\" ';\n        if (isset($args)) {\n            // individual error message\n            $error_text .= $args;\n        } else {\n            // expected token from parser\n            $error_text .= ' - Unexpected \"' . $this->lex->value.'\"';\n            if (count($this->parser->yy_get_expected_tokens($this->parser->yymajor)) <= 4 ) {\n                foreach ($this->parser->yy_get_expected_tokens($this->parser->yymajor) as $token) {\n                    $exp_token = $this->parser->yyTokenName[$token];\n                    if (isset($this->lex->smarty_token_names[$exp_token])) {\n                        // token type from lexer\n                        $expect[] = '\"' . $this->lex->smarty_token_names[$exp_token] . '\"';\n                    } else {\n                        // otherwise internal token name\n                        $expect[] = $this->parser->yyTokenName[$token];\n                    }\n                }\n                $error_text .= ', expected one of: ' . implode(' , ', $expect);\n            }\n        }\n        throw new SmartyCompilerException($error_text);\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_templatelexer.php",
    "content": "<?php\n/**\n* Smarty Internal Plugin Templatelexer\n*\n* This is the lexer to break the template source into tokens\n* @package Smarty\n* @subpackage Compiler\n* @author Uwe Tews\n*/\n/**\n* Smarty Internal Plugin Templatelexer\n*/\nclass Smarty_Internal_Templatelexer\n{\n    public $data;\n    public $counter;\n    public $token;\n    public $value;\n    public $node;\n    public $line;\n    public $taglineno;\n    public $state = 1;\n    public $strip = false;\n    private $heredoc_id_stack = Array();\n    public $smarty_token_names = array (\t\t// Text for parser error messages\n    \t\t\t\t'IDENTITY'\t=> '===',\n    \t\t\t\t'NONEIDENTITY'\t=> '!==',\n    \t\t\t\t'EQUALS'\t=> '==',\n    \t\t\t\t'NOTEQUALS'\t=> '!=',\n    \t\t\t\t'GREATEREQUAL' => '(>=,ge)',\n    \t\t\t\t'LESSEQUAL' => '(<=,le)',\n    \t\t\t\t'GREATERTHAN' => '(>,gt)',\n    \t\t\t\t'LESSTHAN' => '(<,lt)',\n    \t\t\t\t'MOD' => '(%,mod)',\n    \t\t\t\t'NOT'\t\t\t=> '(!,not)',\n    \t\t\t\t'LAND'\t\t=> '(&&,and)',\n    \t\t\t\t'LOR'\t\t\t=> '(||,or)',\n    \t\t\t\t'LXOR'\t\t\t=> 'xor',\n    \t\t\t\t'OPENP'\t\t=> '(',\n    \t\t\t\t'CLOSEP'\t=> ')',\n    \t\t\t\t'OPENB'\t\t=> '[',\n    \t\t\t\t'CLOSEB'\t=> ']',\n    \t\t\t\t'PTR'\t\t\t=> '->',\n    \t\t\t\t'APTR'\t\t=> '=>',\n    \t\t\t\t'EQUAL'\t\t=> '=',\n    \t\t\t\t'NUMBER'\t=> 'number',\n    \t\t\t\t'UNIMATH'\t=> '+\" , \"-',\n    \t\t\t\t'MATH'\t\t=> '*\" , \"/\" , \"%',\n    \t\t\t\t'INCDEC'\t=> '++\" , \"--',\n    \t\t\t\t'SPACE'\t\t=> ' ',\n    \t\t\t\t'DOLLAR'\t=> '$',\n    \t\t\t\t'SEMICOLON' => ';',\n    \t\t\t\t'COLON'\t\t=> ':',\n    \t\t\t\t'DOUBLECOLON'\t\t=> '::',\n    \t\t\t\t'AT'\t\t=> '@',\n    \t\t\t\t'HATCH'\t\t=> '#',\n    \t\t\t\t'QUOTE'\t\t=> '\"',\n    \t\t\t\t'BACKTICK'\t\t=> '`',\n    \t\t\t\t'VERT'\t\t=> '|',\n    \t\t\t\t'DOT'\t\t\t=> '.',\n    \t\t\t\t'COMMA'\t\t=> '\",\"',\n    \t\t\t\t'ANDSYM'\t\t=> '\"&\"',\n    \t\t\t\t'QMARK'\t\t=> '\"?\"',\n    \t\t\t\t'ID'\t\t\t=> 'identifier',\n    \t\t\t\t'OTHER'\t\t=> 'text',\n    \t\t\t\t'LINEBREAK'\t\t=> 'newline',\n     \t\t\t\t'FAKEPHPSTARTTAG'\t=> 'Fake PHP start tag',\n     \t\t\t\t'PHPSTARTTAG'\t=> 'PHP start tag',\n     \t\t\t\t'PHPENDTAG'\t=> 'PHP end tag',\n \t\t\t\t\t\t'LITERALSTART'  => 'Literal start',\n \t\t\t\t\t\t'LITERALEND'    => 'Literal end',\n    \t\t\t\t'LDELSLASH' => 'closing tag',\n    \t\t\t\t'COMMENT' => 'comment',\n    \t\t\t\t'AS' => 'as',\n    \t\t\t\t'TO' => 'to',\n    \t\t\t\t);\n\n\n    function __construct($data,$compiler)\n    {\n//        $this->data = preg_replace(\"/(\\r\\n|\\r|\\n)/\", \"\\n\", $data);\n        $this->data = $data;\n        $this->counter = 0;\n        $this->line = 1;\n        $this->smarty = $compiler->smarty;\n        $this->compiler = $compiler;\n        $this->ldel = preg_quote($this->smarty->left_delimiter,'/');\n        $this->ldel_length = strlen($this->smarty->left_delimiter);\n        $this->rdel = preg_quote($this->smarty->right_delimiter,'/');\n        $this->smarty_token_names['LDEL'] =\t$this->smarty->left_delimiter;\n        $this->smarty_token_names['RDEL'] =\t$this->smarty->right_delimiter;\n        $this->mbstring_overload = ini_get('mbstring.func_overload') & 2;\n     }\n\n\n    private $_yy_state = 1;\n    private $_yy_stack = array();\n\n    function yylex()\n    {\n        return $this->{'yylex' . $this->_yy_state}();\n    }\n\n    function yypushstate($state)\n    {\n        array_push($this->_yy_stack, $this->_yy_state);\n        $this->_yy_state = $state;\n    }\n\n    function yypopstate()\n    {\n        $this->_yy_state = array_pop($this->_yy_stack);\n    }\n\n    function yybegin($state)\n    {\n        $this->_yy_state = $state;\n    }\n\n\n\n    function yylex1()\n    {\n        $tokenMap = array (\n              1 => 0,\n              2 => 0,\n              3 => 1,\n              5 => 0,\n              6 => 0,\n              7 => 0,\n              8 => 0,\n              9 => 0,\n              10 => 0,\n              11 => 0,\n              12 => 1,\n              14 => 0,\n              15 => 0,\n              16 => 0,\n              17 => 0,\n              18 => 0,\n              19 => 0,\n              20 => 0,\n              21 => 0,\n              22 => 0,\n              23 => 0,\n              24 => 2,\n              27 => 0,\n              28 => 0,\n            );\n        if ($this->counter >= strlen($this->data)) {\n            return false; // end of input\n        }\n        $yy_global_pattern = \"/\\G(\".$this->ldel.\"[$]smarty\\\\.block\\\\.child\".$this->rdel.\")|\\G(\\\\{\\\\})|\\G(\".$this->ldel.\"\\\\*([\\S\\s]*?)\\\\*\".$this->rdel.\")|\\G([\\t ]*[\\r\\n]+[\\t ]*)|\\G(\".$this->ldel.\"strip\".$this->rdel.\")|\\G(\".$this->ldel.\"\\\\s{1,}strip\\\\s{1,}\".$this->rdel.\")|\\G(\".$this->ldel.\"\\/strip\".$this->rdel.\")|\\G(\".$this->ldel.\"\\\\s{1,}\\/strip\\\\s{1,}\".$this->rdel.\")|\\G(\".$this->ldel.\"\\\\s*literal\\\\s*\".$this->rdel.\")|\\G(\".$this->ldel.\"\\\\s{1,}\\/)|\\G(\".$this->ldel.\"\\\\s*(if|elseif|else if|while)\\\\s+)|\\G(\".$this->ldel.\"\\\\s*for\\\\s+)|\\G(\".$this->ldel.\"\\\\s*foreach(?![^\\s]))|\\G(\".$this->ldel.\"\\\\s*setfilter\\\\s+)|\\G(\".$this->ldel.\"\\\\s{1,})|\\G(\".$this->ldel.\"\\/)|\\G(\".$this->ldel.\")|\\G(<\\\\?(?:php\\\\w+|=|[a-zA-Z]+)?)|\\G(\\\\?>)|\\G(<%)|\\G(%>)|\\G(([\\S\\s]*?)(?=([\\t ]*[\\r\\n]+[\\t ]*|\".$this->ldel.\"|<\\\\?|\\\\?>|<%|%>)))|\\G([\\S\\s]+)|\\G(.)/iS\";\n\n        do {\n            if ($this->mbstring_overload ? preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {\n                $yysubmatches = $yymatches;\n                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns\n                if (!count($yymatches)) {\n                    throw new Exception('Error: lexing failed because a rule matched' .\n                        ' an empty string.  Input \"' . substr($this->data,\n                        $this->counter, 5) . '... state TEXT');\n                }\n                next($yymatches); // skip global match\n                $this->token = key($yymatches); // token number\n                if ($tokenMap[$this->token]) {\n                    // extract sub-patterns for passing to lex function\n                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,\n                        $tokenMap[$this->token]);\n                } else {\n                    $yysubmatches = array();\n                }\n                $this->value = current($yymatches); // token value\n                $r = $this->{'yy_r1_' . $this->token}($yysubmatches);\n                if ($r === null) {\n                    $this->counter += strlen($this->value);\n                    $this->line += substr_count($this->value, \"\\n\");\n                    // accept this token\n                    return true;\n                } elseif ($r === true) {\n                    // we have changed state\n                    // process this token in the new state\n                    return $this->yylex();\n                } elseif ($r === false) {\n                    $this->counter += strlen($this->value);\n                    $this->line += substr_count($this->value, \"\\n\");\n                    if ($this->counter >= strlen($this->data)) {\n                        return false; // end of input\n                    }\n                    // skip this token\n                    continue;\n                }            } else {\n                throw new Exception('Unexpected input at line' . $this->line .\n                    ': ' . $this->data[$this->counter]);\n            }\n            break;\n        } while (true);\n\n    } // end function\n\n\n    const TEXT = 1;\n    function yy_r1_1($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILD;\n    }\n    function yy_r1_2($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n    }\n    function yy_r1_3($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_COMMENT;\n    }\n    function yy_r1_5($yy_subpatterns)\n    {\n\n  if ($this->strip) {\n     return false;\n  } else {\n     $this->token = Smarty_Internal_Templateparser::TP_LINEBREAK;\n  }\n    }\n    function yy_r1_6($yy_subpatterns)\n    {\n\n  $this->strip = true;\n  return false;\n    }\n    function yy_r1_7($yy_subpatterns)\n    {\n\n  if ($this->smarty->auto_literal) {\n     $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n  } else {\n    $this->strip = true;\n    return false;\n  }\n    }\n    function yy_r1_8($yy_subpatterns)\n    {\n\n  $this->strip = false;\n  return false;\n    }\n    function yy_r1_9($yy_subpatterns)\n    {\n\n  if ($this->smarty->auto_literal) {\n     $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n  } else {\n    $this->strip = false;\n    return false;\n  }\n    }\n    function yy_r1_10($yy_subpatterns)\n    {\n\n   $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;\n   $this->yypushstate(self::LITERAL);\n    }\n    function yy_r1_11($yy_subpatterns)\n    {\n\n  if ($this->smarty->auto_literal) {\n     $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n  } else {\n     $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;\n     $this->yypushstate(self::SMARTY);\n     $this->taglineno = $this->line;\n  }\n    }\n    function yy_r1_12($yy_subpatterns)\n    {\n\n  if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {\n     $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n  } else {\n     $this->token = Smarty_Internal_Templateparser::TP_LDELIF;\n     $this->yypushstate(self::SMARTY);\n     $this->taglineno = $this->line;\n  }\n    }\n    function yy_r1_14($yy_subpatterns)\n    {\n\n  if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {\n     $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n  } else {\n     $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;\n     $this->yypushstate(self::SMARTY);\n     $this->taglineno = $this->line;\n  }\n    }\n    function yy_r1_15($yy_subpatterns)\n    {\n\n  if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {\n     $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n  } else {\n     $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;\n     $this->yypushstate(self::SMARTY);\n     $this->taglineno = $this->line;\n  }\n    }\n    function yy_r1_16($yy_subpatterns)\n    {\n\n  if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {\n     $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n  } else {\n     $this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER;\n     $this->yypushstate(self::SMARTY);\n     $this->taglineno = $this->line;\n  }\n    }\n    function yy_r1_17($yy_subpatterns)\n    {\n\n  if ($this->smarty->auto_literal) {\n     $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n  } else {\n     $this->token = Smarty_Internal_Templateparser::TP_LDEL;\n     $this->yypushstate(self::SMARTY);\n     $this->taglineno = $this->line;\n  }\n    }\n    function yy_r1_18($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;\n     $this->yypushstate(self::SMARTY);\n     $this->taglineno = $this->line;\n    }\n    function yy_r1_19($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_LDEL;\n     $this->yypushstate(self::SMARTY);\n     $this->taglineno = $this->line;\n    }\n    function yy_r1_20($yy_subpatterns)\n    {\n\n  if (in_array($this->value, Array('<?', '<?=', '<?php'))) {\n    $this->token = Smarty_Internal_Templateparser::TP_PHPSTARTTAG;\n  } elseif ($this->value == '<?xml') {\n      $this->token = Smarty_Internal_Templateparser::TP_XMLTAG;\n  } else {\n    $this->token = Smarty_Internal_Templateparser::TP_FAKEPHPSTARTTAG;\n    $this->value = substr($this->value, 0, 2);\n  }\n     }\n    function yy_r1_21($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_PHPENDTAG;\n    }\n    function yy_r1_22($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_ASPSTARTTAG;\n    }\n    function yy_r1_23($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_ASPENDTAG;\n    }\n    function yy_r1_24($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n    }\n    function yy_r1_27($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n    }\n    function yy_r1_28($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n    }\n\n\n    function yylex2()\n    {\n        $tokenMap = array (\n              1 => 0,\n              2 => 0,\n              3 => 1,\n              5 => 0,\n              6 => 0,\n              7 => 0,\n              8 => 0,\n              9 => 0,\n              10 => 0,\n              11 => 0,\n              12 => 0,\n              13 => 0,\n              14 => 0,\n              15 => 0,\n              16 => 0,\n              17 => 0,\n              18 => 0,\n              19 => 0,\n              20 => 1,\n              22 => 1,\n              24 => 1,\n              26 => 0,\n              27 => 0,\n              28 => 0,\n              29 => 0,\n              30 => 0,\n              31 => 0,\n              32 => 0,\n              33 => 0,\n              34 => 0,\n              35 => 0,\n              36 => 0,\n              37 => 0,\n              38 => 0,\n              39 => 0,\n              40 => 0,\n              41 => 0,\n              42 => 0,\n              43 => 3,\n              47 => 0,\n              48 => 0,\n              49 => 0,\n              50 => 0,\n              51 => 0,\n              52 => 0,\n              53 => 0,\n              54 => 0,\n              55 => 1,\n              57 => 1,\n              59 => 0,\n              60 => 0,\n              61 => 0,\n              62 => 0,\n              63 => 0,\n              64 => 0,\n              65 => 0,\n              66 => 0,\n              67 => 0,\n              68 => 0,\n              69 => 0,\n              70 => 0,\n              71 => 0,\n              72 => 0,\n              73 => 0,\n              74 => 0,\n              75 => 0,\n              76 => 0,\n            );\n        if ($this->counter >= strlen($this->data)) {\n            return false; // end of input\n        }\n        $yy_global_pattern = \"/\\G('[^'\\\\\\\\]*(?:\\\\\\\\.[^'\\\\\\\\]*)*')|\\G(\".$this->ldel.\"\\\\s{1,}\\/)|\\G(\".$this->ldel.\"\\\\s*(if|elseif|else if|while)\\\\s+)|\\G(\".$this->ldel.\"\\\\s*for\\\\s+)|\\G(\".$this->ldel.\"\\\\s*foreach(?![^\\s]))|\\G(\".$this->ldel.\"\\\\s{1,})|\\G(\\\\s{1,}\".$this->rdel.\")|\\G(\".$this->ldel.\"\\/)|\\G(\".$this->ldel.\")|\\G(\".$this->rdel.\")|\\G(\\\\s+is\\\\s+in\\\\s+)|\\G(\\\\s+as\\\\s+)|\\G(\\\\s+to\\\\s+)|\\G(\\\\s+step\\\\s+)|\\G(\\\\s+instanceof\\\\s+)|\\G(\\\\s*===\\\\s*)|\\G(\\\\s*!==\\\\s*)|\\G(\\\\s*==\\\\s*|\\\\s+eq\\\\s+)|\\G(\\\\s*!=\\\\s*|\\\\s*<>\\\\s*|\\\\s+(ne|neq)\\\\s+)|\\G(\\\\s*>=\\\\s*|\\\\s+(ge|gte)\\\\s+)|\\G(\\\\s*<=\\\\s*|\\\\s+(le|lte)\\\\s+)|\\G(\\\\s*>\\\\s*|\\\\s+gt\\\\s+)|\\G(\\\\s*<\\\\s*|\\\\s+lt\\\\s+)|\\G(\\\\s+mod\\\\s+)|\\G(!\\\\s*|not\\\\s+)|\\G(\\\\s*&&\\\\s*|\\\\s*and\\\\s+)|\\G(\\\\s*\\\\|\\\\|\\\\s*|\\\\s*or\\\\s+)|\\G(\\\\s*xor\\\\s+)|\\G(\\\\s+is\\\\s+odd\\\\s+by\\\\s+)|\\G(\\\\s+is\\\\s+not\\\\s+odd\\\\s+by\\\\s+)|\\G(\\\\s+is\\\\s+odd)|\\G(\\\\s+is\\\\s+not\\\\s+odd)|\\G(\\\\s+is\\\\s+even\\\\s+by\\\\s+)|\\G(\\\\s+is\\\\s+not\\\\s+even\\\\s+by\\\\s+)|\\G(\\\\s+is\\\\s+even)|\\G(\\\\s+is\\\\s+not\\\\s+even)|\\G(\\\\s+is\\\\s+div\\\\s+by\\\\s+)|\\G(\\\\s+is\\\\s+not\\\\s+div\\\\s+by\\\\s+)|\\G(\\\\((int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)\\\\)\\\\s*)|\\G(\\\\s*\\\\(\\\\s*)|\\G(\\\\s*\\\\))|\\G(\\\\[\\\\s*)|\\G(\\\\s*\\\\])|\\G(\\\\s*->\\\\s*)|\\G(\\\\s*=>\\\\s*)|\\G(\\\\s*=\\\\s*)|\\G(\\\\+\\\\+|--)|\\G(\\\\s*(\\\\+|-)\\\\s*)|\\G(\\\\s*(\\\\*|\\/|%)\\\\s*)|\\G(\\\\$)|\\G(\\\\s*;)|\\G(::)|\\G(\\\\s*:\\\\s*)|\\G(@)|\\G(#)|\\G(\\\")|\\G(`)|\\G(\\\\|)|\\G(\\\\.)|\\G(\\\\s*,\\\\s*)|\\G(\\\\s*&\\\\s*)|\\G(\\\\s*\\\\?\\\\s*)|\\G(0[xX][0-9a-fA-F]+)|\\G([0-9]*[a-zA-Z_]\\\\w*)|\\G(\\\\d+)|\\G(\\\\s+)|\\G(.)/iS\";\n\n        do {\n            if ($this->mbstring_overload ? preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {\n                $yysubmatches = $yymatches;\n                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns\n                if (!count($yymatches)) {\n                    throw new Exception('Error: lexing failed because a rule matched' .\n                        ' an empty string.  Input \"' . substr($this->data,\n                        $this->counter, 5) . '... state SMARTY');\n                }\n                next($yymatches); // skip global match\n                $this->token = key($yymatches); // token number\n                if ($tokenMap[$this->token]) {\n                    // extract sub-patterns for passing to lex function\n                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,\n                        $tokenMap[$this->token]);\n                } else {\n                    $yysubmatches = array();\n                }\n                $this->value = current($yymatches); // token value\n                $r = $this->{'yy_r2_' . $this->token}($yysubmatches);\n                if ($r === null) {\n                    $this->counter += strlen($this->value);\n                    $this->line += substr_count($this->value, \"\\n\");\n                    // accept this token\n                    return true;\n                } elseif ($r === true) {\n                    // we have changed state\n                    // process this token in the new state\n                    return $this->yylex();\n                } elseif ($r === false) {\n                    $this->counter += strlen($this->value);\n                    $this->line += substr_count($this->value, \"\\n\");\n                    if ($this->counter >= strlen($this->data)) {\n                        return false; // end of input\n                    }\n                    // skip this token\n                    continue;\n                }            } else {\n                throw new Exception('Unexpected input at line' . $this->line .\n                    ': ' . $this->data[$this->counter]);\n            }\n            break;\n        } while (true);\n\n    } // end function\n\n\n    const SMARTY = 2;\n    function yy_r2_1($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;\n    }\n    function yy_r2_2($yy_subpatterns)\n    {\n\n  if ($this->smarty->auto_literal) {\n     $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n  } else {\n     $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;\n     $this->yypushstate(self::SMARTY);\n     $this->taglineno = $this->line;\n  }\n    }\n    function yy_r2_3($yy_subpatterns)\n    {\n\n  if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {\n     $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n  } else {\n     $this->token = Smarty_Internal_Templateparser::TP_LDELIF;\n     $this->yypushstate(self::SMARTY);\n     $this->taglineno = $this->line;\n  }\n    }\n    function yy_r2_5($yy_subpatterns)\n    {\n\n  if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {\n     $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n  } else {\n     $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;\n     $this->yypushstate(self::SMARTY);\n     $this->taglineno = $this->line;\n  }\n    }\n    function yy_r2_6($yy_subpatterns)\n    {\n\n  if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {\n     $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n  } else {\n     $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;\n     $this->yypushstate(self::SMARTY);\n     $this->taglineno = $this->line;\n  }\n    }\n    function yy_r2_7($yy_subpatterns)\n    {\n\n  if ($this->smarty->auto_literal) {\n     $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n  } else {\n     $this->token = Smarty_Internal_Templateparser::TP_LDEL;\n     $this->yypushstate(self::SMARTY);\n     $this->taglineno = $this->line;\n  }\n    }\n    function yy_r2_8($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_RDEL;\n  $this->yypopstate();\n    }\n    function yy_r2_9($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;\n     $this->yypushstate(self::SMARTY);\n     $this->taglineno = $this->line;\n    }\n    function yy_r2_10($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_LDEL;\n     $this->yypushstate(self::SMARTY);\n     $this->taglineno = $this->line;\n    }\n    function yy_r2_11($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_RDEL;\n     $this->yypopstate();\n    }\n    function yy_r2_12($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_ISIN;\n    }\n    function yy_r2_13($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_AS;\n    }\n    function yy_r2_14($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_TO;\n    }\n    function yy_r2_15($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_STEP;\n    }\n    function yy_r2_16($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;\n    }\n    function yy_r2_17($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_IDENTITY;\n    }\n    function yy_r2_18($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_NONEIDENTITY;\n    }\n    function yy_r2_19($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_EQUALS;\n    }\n    function yy_r2_20($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_NOTEQUALS;\n    }\n    function yy_r2_22($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_GREATEREQUAL;\n    }\n    function yy_r2_24($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_LESSEQUAL;\n    }\n    function yy_r2_26($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_GREATERTHAN;\n    }\n    function yy_r2_27($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_LESSTHAN;\n    }\n    function yy_r2_28($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_MOD;\n    }\n    function yy_r2_29($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_NOT;\n    }\n    function yy_r2_30($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_LAND;\n    }\n    function yy_r2_31($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_LOR;\n    }\n    function yy_r2_32($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_LXOR;\n    }\n    function yy_r2_33($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_ISODDBY;\n    }\n    function yy_r2_34($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_ISNOTODDBY;\n    }\n    function yy_r2_35($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_ISODD;\n    }\n    function yy_r2_36($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_ISNOTODD;\n    }\n    function yy_r2_37($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_ISEVENBY;\n    }\n    function yy_r2_38($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_ISNOTEVENBY;\n    }\n    function yy_r2_39($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_ISEVEN;\n    }\n    function yy_r2_40($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_ISNOTEVEN;\n    }\n    function yy_r2_41($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_ISDIVBY;\n    }\n    function yy_r2_42($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_ISNOTDIVBY;\n    }\n    function yy_r2_43($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_TYPECAST;\n    }\n    function yy_r2_47($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_OPENP;\n    }\n    function yy_r2_48($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_CLOSEP;\n    }\n    function yy_r2_49($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_OPENB;\n    }\n    function yy_r2_50($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_CLOSEB;\n    }\n    function yy_r2_51($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_PTR;\n    }\n    function yy_r2_52($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_APTR;\n    }\n    function yy_r2_53($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_EQUAL;\n    }\n    function yy_r2_54($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_INCDEC;\n    }\n    function yy_r2_55($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_UNIMATH;\n    }\n    function yy_r2_57($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_MATH;\n    }\n    function yy_r2_59($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_DOLLAR;\n    }\n    function yy_r2_60($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;\n    }\n    function yy_r2_61($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;\n    }\n    function yy_r2_62($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_COLON;\n    }\n    function yy_r2_63($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_AT;\n    }\n    function yy_r2_64($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_HATCH;\n    }\n    function yy_r2_65($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_QUOTE;\n  $this->yypushstate(self::DOUBLEQUOTEDSTRING);\n    }\n    function yy_r2_66($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;\n  $this->yypopstate();\n    }\n    function yy_r2_67($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_VERT;\n    }\n    function yy_r2_68($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_DOT;\n    }\n    function yy_r2_69($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_COMMA;\n    }\n    function yy_r2_70($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_ANDSYM;\n    }\n    function yy_r2_71($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_QMARK;\n    }\n    function yy_r2_72($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_HEX;\n    }\n    function yy_r2_73($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_ID;\n    }\n    function yy_r2_74($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_INTEGER;\n    }\n    function yy_r2_75($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_SPACE;\n    }\n    function yy_r2_76($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n    }\n\n\n\n    function yylex3()\n    {\n        $tokenMap = array (\n              1 => 0,\n              2 => 0,\n              3 => 0,\n              4 => 0,\n              5 => 0,\n              6 => 0,\n              7 => 0,\n              8 => 2,\n              11 => 0,\n            );\n        if ($this->counter >= strlen($this->data)) {\n            return false; // end of input\n        }\n        $yy_global_pattern = \"/\\G(\".$this->ldel.\"\\\\s*literal\\\\s*\".$this->rdel.\")|\\G(\".$this->ldel.\"\\\\s*\\/literal\\\\s*\".$this->rdel.\")|\\G([\\t ]*[\\r\\n]+[\\t ]*)|\\G(<\\\\?(?:php\\\\w+|=|[a-zA-Z]+)?)|\\G(\\\\?>)|\\G(<%)|\\G(%>)|\\G(([\\S\\s]*?)(?=([\\t ]*[\\r\\n]+[\\t ]*|\".$this->ldel.\"\\/?literal\".$this->rdel.\"|<\\\\?|<%)))|\\G(.)/iS\";\n\n        do {\n            if ($this->mbstring_overload ? preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {\n                $yysubmatches = $yymatches;\n                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns\n                if (!count($yymatches)) {\n                    throw new Exception('Error: lexing failed because a rule matched' .\n                        ' an empty string.  Input \"' . substr($this->data,\n                        $this->counter, 5) . '... state LITERAL');\n                }\n                next($yymatches); // skip global match\n                $this->token = key($yymatches); // token number\n                if ($tokenMap[$this->token]) {\n                    // extract sub-patterns for passing to lex function\n                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,\n                        $tokenMap[$this->token]);\n                } else {\n                    $yysubmatches = array();\n                }\n                $this->value = current($yymatches); // token value\n                $r = $this->{'yy_r3_' . $this->token}($yysubmatches);\n                if ($r === null) {\n                    $this->counter += strlen($this->value);\n                    $this->line += substr_count($this->value, \"\\n\");\n                    // accept this token\n                    return true;\n                } elseif ($r === true) {\n                    // we have changed state\n                    // process this token in the new state\n                    return $this->yylex();\n                } elseif ($r === false) {\n                    $this->counter += strlen($this->value);\n                    $this->line += substr_count($this->value, \"\\n\");\n                    if ($this->counter >= strlen($this->data)) {\n                        return false; // end of input\n                    }\n                    // skip this token\n                    continue;\n                }            } else {\n                throw new Exception('Unexpected input at line' . $this->line .\n                    ': ' . $this->data[$this->counter]);\n            }\n            break;\n        } while (true);\n\n    } // end function\n\n\n    const LITERAL = 3;\n    function yy_r3_1($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;\n  $this->yypushstate(self::LITERAL);\n    }\n    function yy_r3_2($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;\n  $this->yypopstate();\n    }\n    function yy_r3_3($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_LITERAL;\n    }\n    function yy_r3_4($yy_subpatterns)\n    {\n\n  if (in_array($this->value, Array('<?', '<?=', '<?php'))) {\n    $this->token = Smarty_Internal_Templateparser::TP_PHPSTARTTAG;\n   } else {\n    $this->token = Smarty_Internal_Templateparser::TP_FAKEPHPSTARTTAG;\n    $this->value = substr($this->value, 0, 2);\n   }\n    }\n    function yy_r3_5($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_PHPENDTAG;\n    }\n    function yy_r3_6($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_ASPSTARTTAG;\n    }\n    function yy_r3_7($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_ASPENDTAG;\n    }\n    function yy_r3_8($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_LITERAL;\n    }\n    function yy_r3_11($yy_subpatterns)\n    {\n\n  $this->compiler->trigger_template_error (\"missing or misspelled literal closing tag\");\n    }\n\n\n    function yylex4()\n    {\n        $tokenMap = array (\n              1 => 0,\n              2 => 1,\n              4 => 0,\n              5 => 0,\n              6 => 0,\n              7 => 0,\n              8 => 0,\n              9 => 0,\n              10 => 0,\n              11 => 0,\n              12 => 0,\n              13 => 3,\n              17 => 0,\n              18 => 0,\n            );\n        if ($this->counter >= strlen($this->data)) {\n            return false; // end of input\n        }\n        $yy_global_pattern = \"/\\G(\".$this->ldel.\"\\\\s{1,}\\/)|\\G(\".$this->ldel.\"\\\\s*(if|elseif|else if|while)\\\\s+)|\\G(\".$this->ldel.\"\\\\s*for\\\\s+)|\\G(\".$this->ldel.\"\\\\s*foreach(?![^\\s]))|\\G(\".$this->ldel.\"\\\\s{1,})|\\G(\".$this->ldel.\"\\/)|\\G(\".$this->ldel.\")|\\G(\\\")|\\G(`\\\\$)|\\G(\\\\$[0-9]*[a-zA-Z_]\\\\w*)|\\G(\\\\$)|\\G(([^\\\"\\\\\\\\]*?)((?:\\\\\\\\.[^\\\"\\\\\\\\]*?)*?)(?=(\".$this->ldel.\"|\\\\$|`\\\\$|\\\")))|\\G([\\S\\s]+)|\\G(.)/iS\";\n\n        do {\n            if ($this->mbstring_overload ? preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {\n                $yysubmatches = $yymatches;\n                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns\n                if (!count($yymatches)) {\n                    throw new Exception('Error: lexing failed because a rule matched' .\n                        ' an empty string.  Input \"' . substr($this->data,\n                        $this->counter, 5) . '... state DOUBLEQUOTEDSTRING');\n                }\n                next($yymatches); // skip global match\n                $this->token = key($yymatches); // token number\n                if ($tokenMap[$this->token]) {\n                    // extract sub-patterns for passing to lex function\n                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,\n                        $tokenMap[$this->token]);\n                } else {\n                    $yysubmatches = array();\n                }\n                $this->value = current($yymatches); // token value\n                $r = $this->{'yy_r4_' . $this->token}($yysubmatches);\n                if ($r === null) {\n                    $this->counter += strlen($this->value);\n                    $this->line += substr_count($this->value, \"\\n\");\n                    // accept this token\n                    return true;\n                } elseif ($r === true) {\n                    // we have changed state\n                    // process this token in the new state\n                    return $this->yylex();\n                } elseif ($r === false) {\n                    $this->counter += strlen($this->value);\n                    $this->line += substr_count($this->value, \"\\n\");\n                    if ($this->counter >= strlen($this->data)) {\n                        return false; // end of input\n                    }\n                    // skip this token\n                    continue;\n                }            } else {\n                throw new Exception('Unexpected input at line' . $this->line .\n                    ': ' . $this->data[$this->counter]);\n            }\n            break;\n        } while (true);\n\n    } // end function\n\n\n    const DOUBLEQUOTEDSTRING = 4;\n    function yy_r4_1($yy_subpatterns)\n    {\n\n  if ($this->smarty->auto_literal) {\n     $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n  } else {\n     $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;\n     $this->yypushstate(self::SMARTY);\n     $this->taglineno = $this->line;\n  }\n    }\n    function yy_r4_2($yy_subpatterns)\n    {\n\n  if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {\n     $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n  } else {\n     $this->token = Smarty_Internal_Templateparser::TP_LDELIF;\n     $this->yypushstate(self::SMARTY);\n     $this->taglineno = $this->line;\n  }\n    }\n    function yy_r4_4($yy_subpatterns)\n    {\n\n  if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {\n     $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n  } else {\n     $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;\n     $this->yypushstate(self::SMARTY);\n     $this->taglineno = $this->line;\n  }\n    }\n    function yy_r4_5($yy_subpatterns)\n    {\n\n  if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {\n     $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n  } else {\n     $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;\n     $this->yypushstate(self::SMARTY);\n     $this->taglineno = $this->line;\n  }\n    }\n    function yy_r4_6($yy_subpatterns)\n    {\n\n  if ($this->smarty->auto_literal) {\n     $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n  } else {\n     $this->token = Smarty_Internal_Templateparser::TP_LDEL;\n     $this->yypushstate(self::SMARTY);\n     $this->taglineno = $this->line;\n  }\n    }\n    function yy_r4_7($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;\n     $this->yypushstate(self::SMARTY);\n     $this->taglineno = $this->line;\n    }\n    function yy_r4_8($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_LDEL;\n     $this->yypushstate(self::SMARTY);\n     $this->taglineno = $this->line;\n    }\n    function yy_r4_9($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_QUOTE;\n  $this->yypopstate();\n    }\n    function yy_r4_10($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;\n  $this->value = substr($this->value,0,-1);\n  $this->yypushstate(self::SMARTY);\n  $this->taglineno = $this->line;\n    }\n    function yy_r4_11($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;\n    }\n    function yy_r4_12($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n    }\n    function yy_r4_13($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n    }\n    function yy_r4_17($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n    }\n    function yy_r4_18($yy_subpatterns)\n    {\n\n  $this->token = Smarty_Internal_Templateparser::TP_OTHER;\n    }\n\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_templateparser.php",
    "content": "<?php\n/**\n* Smarty Internal Plugin Templateparser\n*\n* This is the template parser.\n* It is generated from the internal.templateparser.y file\n* @package Smarty\n* @subpackage Compiler\n* @author Uwe Tews\n*/\n\nclass TP_yyToken implements ArrayAccess\n{\n    public $string = '';\n    public $metadata = array();\n\n    function __construct($s, $m = array())\n    {\n        if ($s instanceof TP_yyToken) {\n            $this->string = $s->string;\n            $this->metadata = $s->metadata;\n        } else {\n            $this->string = (string) $s;\n            if ($m instanceof TP_yyToken) {\n                $this->metadata = $m->metadata;\n            } elseif (is_array($m)) {\n                $this->metadata = $m;\n            }\n        }\n    }\n\n    function __toString()\n    {\n        return $this->_string;\n    }\n\n    function offsetExists($offset)\n    {\n        return isset($this->metadata[$offset]);\n    }\n\n    function offsetGet($offset)\n    {\n        return $this->metadata[$offset];\n    }\n\n    function offsetSet($offset, $value)\n    {\n        if ($offset === null) {\n            if (isset($value[0])) {\n                $x = ($value instanceof TP_yyToken) ?\n                    $value->metadata : $value;\n                $this->metadata = array_merge($this->metadata, $x);\n                return;\n            }\n            $offset = count($this->metadata);\n        }\n        if ($value === null) {\n            return;\n        }\n        if ($value instanceof TP_yyToken) {\n            if ($value->metadata) {\n                $this->metadata[$offset] = $value->metadata;\n            }\n        } elseif ($value) {\n            $this->metadata[$offset] = $value;\n        }\n    }\n\n    function offsetUnset($offset)\n    {\n        unset($this->metadata[$offset]);\n    }\n}\n\nclass TP_yyStackEntry\n{\n    public $stateno;       /* The state-number */\n    public $major;         /* The major token value.  This is the code\n                     ** number for the token at this stack level */\n    public $minor; /* The user-supplied minor token value.  This\n                     ** is the value of the token  */\n};\n\n\n#line 12 \"smarty_internal_templateparser.y\"\nclass Smarty_Internal_Templateparser#line 79 \"smarty_internal_templateparser.php\"\n{\n#line 14 \"smarty_internal_templateparser.y\"\n\n    const Err1 = \"Security error: Call to private object member not allowed\";\n    const Err2 = \"Security error: Call to dynamic object member not allowed\";\n    const Err3 = \"PHP in template not allowed. Use SmartyBC to enable it\";\n    // states whether the parse was successful or not\n    public $successful = true;\n    public $retvalue = 0;\n    private $lex;\n    private $internalError = false;\n\n    function __construct($lex, $compiler) {\n        $this->lex = $lex;\n        $this->compiler = $compiler;\n        $this->smarty = $this->compiler->smarty;\n        $this->template = $this->compiler->template;\n        $this->compiler->has_variable_string = false;\n        $this->compiler->prefix_code = array();\n        $this->prefix_number = 0;\n        $this->block_nesting_level = 0;\n        if ($this->security = isset($this->smarty->security_policy)) {\n            $this->php_handling = $this->smarty->security_policy->php_handling;\n        } else {\n            $this->php_handling = $this->smarty->php_handling;\n        }\n        $this->is_xml = false;\n        $this->asp_tags = (ini_get('asp_tags') != '0');\n        $this->current_buffer = $this->root_buffer = new _smarty_template_buffer($this);\n    }\n\n    public static function escape_start_tag($tag_text) {\n        $tag = preg_replace('/\\A<\\?(.*)\\z/', '<<?php ?>?\\1', $tag_text, -1 , $count); //Escape tag\n        return $tag;\n    }\n\n    public static function escape_end_tag($tag_text) {\n        return '?<?php ?>>';\n    }\n\n    public function compileVariable($variable) {\n        if (strpos($variable,'(') == 0) {\n            // not a variable variable\n            $var = trim($variable,'\\'');\n            $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable($var, null, true, false)->nocache;\n            $this->template->properties['variables'][$var] = $this->compiler->tag_nocache|$this->compiler->nocache;\n        }\n//       return '(isset($_smarty_tpl->tpl_vars['. $variable .'])?$_smarty_tpl->tpl_vars['. $variable .']->value:$_smarty_tpl->getVariable('. $variable .')->value)';\n        return '$_smarty_tpl->tpl_vars['. $variable .']->value';\n    }\n#line 131 \"smarty_internal_templateparser.php\"\n\n    const TP_VERT                           =  1;\n    const TP_COLON                          =  2;\n    const TP_COMMENT                        =  3;\n    const TP_PHPSTARTTAG                    =  4;\n    const TP_PHPENDTAG                      =  5;\n    const TP_ASPSTARTTAG                    =  6;\n    const TP_ASPENDTAG                      =  7;\n    const TP_FAKEPHPSTARTTAG                =  8;\n    const TP_XMLTAG                         =  9;\n    const TP_OTHER                          = 10;\n    const TP_LINEBREAK                      = 11;\n    const TP_LITERALSTART                   = 12;\n    const TP_LITERALEND                     = 13;\n    const TP_LITERAL                        = 14;\n    const TP_LDEL                           = 15;\n    const TP_RDEL                           = 16;\n    const TP_DOLLAR                         = 17;\n    const TP_ID                             = 18;\n    const TP_EQUAL                          = 19;\n    const TP_PTR                            = 20;\n    const TP_LDELIF                         = 21;\n    const TP_LDELFOR                        = 22;\n    const TP_SEMICOLON                      = 23;\n    const TP_INCDEC                         = 24;\n    const TP_TO                             = 25;\n    const TP_STEP                           = 26;\n    const TP_LDELFOREACH                    = 27;\n    const TP_SPACE                          = 28;\n    const TP_AS                             = 29;\n    const TP_APTR                           = 30;\n    const TP_LDELSETFILTER                  = 31;\n    const TP_SMARTYBLOCKCHILD               = 32;\n    const TP_LDELSLASH                      = 33;\n    const TP_INTEGER                        = 34;\n    const TP_COMMA                          = 35;\n    const TP_OPENP                          = 36;\n    const TP_CLOSEP                         = 37;\n    const TP_MATH                           = 38;\n    const TP_UNIMATH                        = 39;\n    const TP_ANDSYM                         = 40;\n    const TP_ISIN                           = 41;\n    const TP_ISDIVBY                        = 42;\n    const TP_ISNOTDIVBY                     = 43;\n    const TP_ISEVEN                         = 44;\n    const TP_ISNOTEVEN                      = 45;\n    const TP_ISEVENBY                       = 46;\n    const TP_ISNOTEVENBY                    = 47;\n    const TP_ISODD                          = 48;\n    const TP_ISNOTODD                       = 49;\n    const TP_ISODDBY                        = 50;\n    const TP_ISNOTODDBY                     = 51;\n    const TP_INSTANCEOF                     = 52;\n    const TP_QMARK                          = 53;\n    const TP_NOT                            = 54;\n    const TP_TYPECAST                       = 55;\n    const TP_HEX                            = 56;\n    const TP_DOT                            = 57;\n    const TP_SINGLEQUOTESTRING              = 58;\n    const TP_DOUBLECOLON                    = 59;\n    const TP_AT                             = 60;\n    const TP_HATCH                          = 61;\n    const TP_OPENB                          = 62;\n    const TP_CLOSEB                         = 63;\n    const TP_EQUALS                         = 64;\n    const TP_NOTEQUALS                      = 65;\n    const TP_GREATERTHAN                    = 66;\n    const TP_LESSTHAN                       = 67;\n    const TP_GREATEREQUAL                   = 68;\n    const TP_LESSEQUAL                      = 69;\n    const TP_IDENTITY                       = 70;\n    const TP_NONEIDENTITY                   = 71;\n    const TP_MOD                            = 72;\n    const TP_LAND                           = 73;\n    const TP_LOR                            = 74;\n    const TP_LXOR                           = 75;\n    const TP_QUOTE                          = 76;\n    const TP_BACKTICK                       = 77;\n    const TP_DOLLARID                       = 78;\n    const YY_NO_ACTION = 590;\n    const YY_ACCEPT_ACTION = 589;\n    const YY_ERROR_ACTION = 588;\n\n    const YY_SZ_ACTTAB = 2393;\nstatic public $yy_action = array(\n /*     0 */   211,  316,  317,  319,  318,  315,  314,  310,  309,  311,\n /*    10 */   312,  313,  320,  189,  304,  161,   38,  589,   95,  265,\n /*    20 */   317,  319,    7,  106,  289,   37,   26,   30,  146,  283,\n /*    30 */    10,  285,  250,  286,  238,  280,  287,   49,   48,   46,\n /*    40 */    45,   20,   29,  365,  366,   28,   32,  373,  374,   15,\n /*    50 */    11,  328,  323,  322,  324,  327,  231,  211,    4,  189,\n /*    60 */   329,  332,  211,  382,  383,  384,  385,  381,  380,  376,\n /*    70 */   375,  377,  281,  378,  379,  211,  360,  450,  180,  251,\n /*    80 */   117,  144,  196,   74,  135,  260,   17,  451,   26,   30,\n /*    90 */   307,  283,  299,  361,   35,  158,  225,  368,  362,  451,\n /*   100 */   343,   30,   30,  226,   44,  203,  285,    4,   47,  203,\n /*   110 */   218,  259,   49,   48,   46,   45,   20,   29,  365,  366,\n /*   120 */    28,   32,  373,  374,   15,   11,  351,  108,  176,  334,\n /*   130 */   144,  193,  337,   23,  129,  134,  371,  289,  382,  383,\n /*   140 */   384,  385,  381,  380,  376,  375,  377,  281,  378,  379,\n /*   150 */   211,  360,  372,   26,  203,  142,  283,   31,   68,  122,\n /*   160 */   242,   26,  109,  353,  283,  346,  454,  299,  361,   25,\n /*   170 */   185,  225,  368,  362,   30,  343,  239,   30,  454,  289,\n /*   180 */     4,   41,   26,  143,  165,  283,    4,   49,   48,   46,\n /*   190 */    45,   20,   29,  365,  366,   28,   32,  373,  374,   15,\n /*   200 */    11,  101,  160,  144,   26,  208,   34,  283,   31,  144,\n /*   210 */     8,  289,    4,  382,  383,  384,  385,  381,  380,  376,\n /*   220 */   375,  377,  281,  378,  379,  211,  360,  227,  203,  357,\n /*   230 */   142,  197,   19,   73,  135,  144,  211,  302,    9,  158,\n /*   240 */   340,   26,  299,  361,  283,  158,  225,  368,  362,  228,\n /*   250 */   343,  294,   30,    6,  331,  235,  330,  221,  195,  337,\n /*   260 */   126,  240,   49,   48,   46,   45,   20,   29,  365,  366,\n /*   270 */    28,   32,  373,  374,   15,   11,  211,   16,  129,  244,\n /*   280 */   249,  219,  208,  192,  337,  302,  228,    8,  382,  383,\n /*   290 */   384,  385,  381,  380,  376,  375,  377,  281,  378,  379,\n /*   300 */   163,  211,  107,  188,  105,   40,   40,  266,  277,  289,\n /*   310 */   241,  232,  289,   49,   48,   46,   45,   20,   29,  365,\n /*   320 */   366,   28,   32,  373,  374,   15,   11,  211,  168,  203,\n /*   330 */    40,    2,  278,  167,  175,  244,  242,  289,  350,  382,\n /*   340 */   383,  384,  385,  381,  380,  376,  375,  377,  281,  378,\n /*   350 */   379,  191,   47,  184,  204,  234,  169,  198,  287,  386,\n /*   360 */   203,  203,  289,  124,   49,   48,   46,   45,   20,   29,\n /*   370 */   365,  366,   28,   32,  373,  374,   15,   11,  211,  204,\n /*   380 */   182,   26,   26,   26,  283,  212,  224,  118,  131,  289,\n /*   390 */   382,  383,  384,  385,  381,  380,  376,  375,  377,  281,\n /*   400 */   378,  379,  370,  172,  244,  270,  204,  130,  211,  164,\n /*   410 */    26,  287,  289,  229,  178,   49,   48,   46,   45,   20,\n /*   420 */    29,  365,  366,   28,   32,  373,  374,   15,   11,  204,\n /*   430 */   364,  298,    5,   26,  100,   30,  247,  148,  148,   99,\n /*   440 */   159,  382,  383,  384,  385,  381,  380,  376,  375,  377,\n /*   450 */   281,  378,  379,  211,  354,  370,  360,  174,   26,  369,\n /*   460 */   142,  283,  360,   73,  135,  158,  157,  123,   24,  155,\n /*   470 */   135,   30,  299,  361,  211,  190,  225,  368,  362,  272,\n /*   480 */   343,  252,  225,  368,  362,  343,  343,  222,  223,  306,\n /*   490 */    49,   48,   46,   45,   20,   29,  365,  366,   28,   32,\n /*   500 */   373,  374,   15,   11,  129,   43,  236,    9,  269,  258,\n /*   510 */   199,  133,   33,   14,  202,  103,  382,  383,  384,  385,\n /*   520 */   381,  380,  376,  375,  377,  281,  378,  379,  211,  360,\n /*   530 */   370,  170,  262,  142,  360,   36,   73,  135,  151,  141,\n /*   540 */   289,  245,  135,  276,  211,  299,  361,  211,   44,  225,\n /*   550 */   368,  362,  287,  343,  225,  368,  362,  119,  343,  295,\n /*   560 */   216,  267,  282,  296,  211,   49,   48,   46,   45,   20,\n /*   570 */    29,  365,  366,   28,   32,  373,  374,   15,   11,  284,\n /*   580 */   181,  223,  333,  138,  302,  236,  297,    6,  127,  289,\n /*   590 */   116,  382,  383,  384,  385,  381,  380,  376,  375,  377,\n /*   600 */   281,  378,  379,  211,  360,  370,  177,   94,  142,  303,\n /*   610 */   292,   54,  122,  139,  162,  289,  150,  261,  264,  293,\n /*   620 */   299,  361,   30,  289,  225,  368,  362,  287,  343,   30,\n /*   630 */   287,   30,  132,  300,  308,  287,  158,  211,   30,  334,\n /*   640 */    49,   48,   46,   45,   20,   29,  365,  366,   28,   32,\n /*   650 */   373,  374,   15,   11,  211,  204,  166,   12,  275,  287,\n /*   660 */   273,  248,  342,   98,   97,  113,  382,  383,  384,  385,\n /*   670 */   381,  380,  376,  375,  377,  281,  378,  379,  370,  370,\n /*   680 */   370,  110,   18,  321,  324,  324,  324,  324,  324,  324,\n /*   690 */   246,   49,   48,   46,   45,   20,   29,  365,  366,   28,\n /*   700 */    32,  373,  374,   15,   11,  211,  324,  324,  324,  324,\n /*   710 */   324,  324,  324,  324,  112,  136,  104,  382,  383,  384,\n /*   720 */   385,  381,  380,  376,  375,  377,  281,  378,  379,  370,\n /*   730 */   370,  370,  324,  324,  324,  324,  324,  324,  324,  324,\n /*   740 */   324,  256,   49,   48,   46,   45,   20,   29,  365,  366,\n /*   750 */    28,   32,  373,  374,   15,   11,  211,  324,  324,  324,\n /*   760 */   324,  324,  324,  324,  324,  324,  324,  324,  382,  383,\n /*   770 */   384,  385,  381,  380,  376,  375,  377,  281,  378,  379,\n /*   780 */   351,  324,  324,   30,  324,  324,  324,  324,  324,  324,\n /*   790 */   324,  324,  324,   49,   48,   46,   45,   20,   29,  365,\n /*   800 */   366,   28,   32,  373,  374,   15,   11,  211,  324,  324,\n /*   810 */   324,  324,  324,  324,  324,  324,  324,  355,  324,  382,\n /*   820 */   383,  384,  385,  381,  380,  376,  375,  377,  281,  378,\n /*   830 */   379,  324,  324,  324,  324,  324,  324,  324,  324,  324,\n /*   840 */   324,  324,  324,  324,   49,   48,   46,   45,   20,   29,\n /*   850 */   365,  366,   28,   32,  373,  374,   15,   11,  324,  324,\n /*   860 */   324,  324,  324,  324,  324,  324,  324,  324,  324,  257,\n /*   870 */   382,  383,  384,  385,  381,  380,  376,  375,  377,  281,\n /*   880 */   378,  379,  211,  324,  324,  324,  194,  360,  211,  288,\n /*   890 */   255,  145,  324,  352,  336,  135,  324,  200,   42,   22,\n /*   900 */    27,   30,   30,  341,    7,  106,   30,  225,  368,  362,\n /*   910 */   146,  343,  324,  203,  250,  286,  238,  324,  211,   49,\n /*   920 */    48,   46,   45,   20,   29,  365,  366,   28,   32,  373,\n /*   930 */   374,   15,   11,  305,  324,  324,  324,  324,  324,   47,\n /*   940 */   324,  324,  324,  324,  324,  382,  383,  384,  385,  381,\n /*   950 */   380,  376,  375,  377,  281,  378,  379,  211,  324,  359,\n /*   960 */    39,  349,  360,  326,  348,  291,  156,  324,  352,  344,\n /*   970 */   135,  324,  201,   42,  324,   30,   30,   30,  324,    7,\n /*   980 */   106,   30,  225,  368,  362,  146,  343,  324,  324,  250,\n /*   990 */   286,  238,  324,  324,   49,   48,   46,   45,   20,   29,\n /*  1000 */   365,  366,   28,   32,  373,  374,   15,   11,  211,  324,\n /*  1010 */   324,  324,  324,  324,  324,  324,  324,  324,  324,  324,\n /*  1020 */   382,  383,  384,  385,  381,  380,  376,  375,  377,  281,\n /*  1030 */   378,  379,  324,  324,  358,   39,  349,  324,  324,  324,\n /*  1040 */   324,  324,  324,  324,  324,   49,   48,   46,   45,   20,\n /*  1050 */    29,  365,  366,   28,   32,  373,  374,   15,   11,  324,\n /*  1060 */   324,  324,  324,  324,  324,  324,  324,  324,  324,  324,\n /*  1070 */   324,  382,  383,  384,  385,  381,  380,  376,  375,  377,\n /*  1080 */   281,  378,  379,  324,   49,   48,   46,   45,   20,   29,\n /*  1090 */   365,  366,   28,   32,  373,  374,   15,   11,  324,  324,\n /*  1100 */   324,  324,  324,  324,  324,  324,  324,  324,  324,  324,\n /*  1110 */   382,  383,  384,  385,  381,  380,  376,  375,  377,  281,\n /*  1120 */   378,  379,  324,  324,  324,  324,   38,  324,  140,  207,\n /*  1130 */   324,  360,    7,  106,  290,  147,  324,  356,  146,  135,\n /*  1140 */   324,  324,  250,  286,  238,  230,   30,   13,  367,   30,\n /*  1150 */    51,  225,  368,  362,  324,  343,  360,  324,  324,  324,\n /*  1160 */   152,  324,  324,  324,  135,   50,   52,  301,  237,  363,\n /*  1170 */   324,  360,  105,    1,  254,  154,  225,  368,  362,  135,\n /*  1180 */   343,  324,   38,  324,  140,  214,  324,   96,    7,  106,\n /*  1190 */   279,  225,  368,  362,  146,  343,  347,  345,  250,  286,\n /*  1200 */   238,  230,   30,   13,  274,  324,   51,  338,   30,   30,\n /*  1210 */   360,  324,  324,  324,  121,  324,   30,   53,  135,   30,\n /*  1220 */   211,   50,   52,  301,  237,  363,  299,  361,  105,    1,\n /*  1230 */   225,  368,  362,  211,  343,  453,  324,  268,   38,  324,\n /*  1240 */   128,  214,  324,   96,    7,  106,  253,  453,  339,   30,\n /*  1250 */   146,  335,  233,  324,  250,  286,  238,  230,   30,    3,\n /*  1260 */    30,  324,   51,   30,  271,  324,  360,  324,    4,  324,\n /*  1270 */   142,   47,  324,   84,  135,  324,   30,   50,   52,  301,\n /*  1280 */   237,  363,  299,  361,  105,    1,  225,  368,  362,  324,\n /*  1290 */   343,  144,  324,  324,   38,  324,  125,   92,  324,   96,\n /*  1300 */     7,  106,  324,  324,  324,  324,  146,  324,  324,  324,\n /*  1310 */   250,  286,  238,  230,  324,   13,  324,  324,   51,  324,\n /*  1320 */   324,  324,  360,  324,  324,  324,  142,  324,  324,   89,\n /*  1330 */   135,  324,  211,   50,   52,  301,  237,  363,  299,  361,\n /*  1340 */   105,    1,  225,  368,  362,  324,  343,  456,  324,  324,\n /*  1350 */    38,  324,  126,  214,  324,   96,    7,  106,  324,  456,\n /*  1360 */   243,  324,  146,  324,  324,  324,  250,  286,  238,  230,\n /*  1370 */   324,   21,  324,  324,   51,  324,  324,  324,  360,  324,\n /*  1380 */   324,  324,  142,   47,  324,   87,  135,  324,  211,   50,\n /*  1390 */    52,  301,  237,  363,  299,  361,  105,    1,  225,  368,\n /*  1400 */   362,  324,  343,  456,  324,  324,   38,  324,  140,  210,\n /*  1410 */   324,   96,    7,  106,  324,  456,  324,  324,  146,  324,\n /*  1420 */   324,  324,  250,  286,  238,  230,  324,   13,  324,  324,\n /*  1430 */    51,  324,  324,  324,  360,  324,  324,  324,  142,   47,\n /*  1440 */   324,   63,  135,  324,  211,   50,   52,  301,  237,  363,\n /*  1450 */   299,  361,  105,    1,  225,  368,  362,  324,  343,  325,\n /*  1460 */   324,  324,   38,  324,  137,  214,  324,   96,    7,  106,\n /*  1470 */   324,   30,  324,  324,  146,  324,  324,  324,  250,  286,\n /*  1480 */   238,  230,  324,   13,  324,  324,   51,  324,  324,  324,\n /*  1490 */   360,  324,  324,  324,  142,   47,  324,   80,  135,  324,\n /*  1500 */   324,   50,   52,  301,  237,  363,  299,  361,  105,    1,\n /*  1510 */   225,  368,  362,  324,  343,  324,  324,  324,   38,  324,\n /*  1520 */   140,  206,  324,   96,    7,  106,  324,  324,  324,  324,\n /*  1530 */   146,  324,  324,  324,  250,  286,  238,  220,  324,   13,\n /*  1540 */   324,  324,   51,  324,  324,  324,  360,  324,  324,  324,\n /*  1550 */   114,  324,  324,   75,  135,  324,  324,   50,   52,  301,\n /*  1560 */   237,  363,  299,  361,  105,    1,  225,  368,  362,  324,\n /*  1570 */   343,  324,  324,  324,   38,  324,  140,  205,  324,   96,\n /*  1580 */     7,  106,  324,  324,  324,  324,  146,  324,  324,  324,\n /*  1590 */   250,  286,  238,  230,  324,   13,  324,  324,   51,  324,\n /*  1600 */   324,  324,  360,  324,  324,  324,  142,  324,  324,   77,\n /*  1610 */   135,  324,  324,   50,   52,  301,  237,  363,  299,  361,\n /*  1620 */   105,    1,  225,  368,  362,  324,  343,  324,  324,  324,\n /*  1630 */    38,  324,  140,  209,  324,   96,    7,  106,  324,  324,\n /*  1640 */   324,  324,  146,  324,  324,  324,  250,  286,  238,  230,\n /*  1650 */   324,   13,  324,  324,   51,  324,  324,  324,  360,  324,\n /*  1660 */   324,  324,  142,  324,  324,   85,  135,  324,  324,   50,\n /*  1670 */    52,  301,  237,  363,  299,  361,  105,    1,  225,  368,\n /*  1680 */   362,  324,  343,  324,  324,  324,   38,  324,  126,  213,\n /*  1690 */   324,   96,    7,  106,  324,  324,  324,  324,  146,  324,\n /*  1700 */   324,  324,  250,  286,  238,  230,  324,   21,  324,  324,\n /*  1710 */    51,  324,  324,  324,  360,  324,  324,  324,  142,  324,\n /*  1720 */   324,   71,  135,  324,  324,   50,   52,  301,  237,  363,\n /*  1730 */   299,  361,  105,  324,  225,  368,  362,  324,  343,  324,\n /*  1740 */   324,  324,   38,  324,  126,  214,  324,   96,    7,  106,\n /*  1750 */   324,  324,  324,  324,  146,  324,  324,  324,  250,  286,\n /*  1760 */   238,  230,  324,   21,  102,  186,   51,  324,  324,  324,\n /*  1770 */   324,  324,  324,  324,  289,  324,  324,   22,   27,  324,\n /*  1780 */   499,   50,   52,  301,  237,  363,  324,  499,  105,  499,\n /*  1790 */   499,  203,  499,  499,  324,  324,  324,  324,  324,  499,\n /*  1800 */     4,  499,  324,   96,  324,  324,  324,  324,  324,  324,\n /*  1810 */   324,  324,  324,  360,  324,  324,  499,  117,  324,  324,\n /*  1820 */    74,  135,  324,  144,  324,  324,  324,  499,  324,  299,\n /*  1830 */   361,  324,  324,  225,  368,  362,  324,  343,  360,  324,\n /*  1840 */   324,  499,  142,  324,  324,   66,  135,  324,  263,  324,\n /*  1850 */   324,  324,  324,  324,  299,  361,  324,  324,  225,  368,\n /*  1860 */   362,  324,  343,  324,  360,  324,  324,  324,  142,  324,\n /*  1870 */   324,   79,  135,  324,  360,  324,  324,  324,  149,  324,\n /*  1880 */   299,  361,  135,  360,  225,  368,  362,  142,  343,  324,\n /*  1890 */    81,  135,  324,  324,  225,  368,  362,  324,  343,  299,\n /*  1900 */   361,  324,  324,  225,  368,  362,  324,  343,  324,  324,\n /*  1910 */   324,  360,  324,  324,  324,  115,  324,  324,   83,  135,\n /*  1920 */   324,  324,  360,  324,  324,  324,  142,  299,  361,   72,\n /*  1930 */   135,  225,  368,  362,  324,  343,  324,  324,  299,  361,\n /*  1940 */   324,  324,  225,  368,  362,  324,  343,  324,  360,  324,\n /*  1950 */   324,  324,  142,  324,  324,   70,  135,  324,  360,  324,\n /*  1960 */   324,  324,  153,  324,  299,  361,  135,  360,  225,  368,\n /*  1970 */   362,  142,  343,  324,   68,  135,  324,  324,  225,  368,\n /*  1980 */   362,  324,  343,  299,  361,  324,  324,  225,  368,  362,\n /*  1990 */   324,  343,  324,  324,  324,  360,  324,  324,  324,  142,\n /*  2000 */   324,  324,   90,  135,  324,  324,  360,  324,  324,  324,\n /*  2010 */   142,  299,  361,   86,  135,  225,  368,  362,  324,  343,\n /*  2020 */   324,  324,  299,  361,  324,  324,  225,  368,  362,  324,\n /*  2030 */   343,  324,  360,  194,  183,  324,  142,  324,  324,   91,\n /*  2040 */   135,  324,  324,  289,  324,  324,   22,   27,  299,  361,\n /*  2050 */   324,  360,  225,  368,  362,  142,  343,  324,   61,  135,\n /*  2060 */   203,  324,  324,  324,  194,  171,  324,  299,  361,  324,\n /*  2070 */   324,  225,  368,  362,  289,  343,  324,   22,   27,  360,\n /*  2080 */   324,  324,  324,  142,  324,  324,   88,  135,  324,  324,\n /*  2090 */   360,  203,  324,  324,  142,  299,  361,   69,  135,  225,\n /*  2100 */   368,  362,  324,  343,  324,  324,  299,  361,  324,  324,\n /*  2110 */   225,  368,  362,  324,  343,  324,  360,  194,  179,  324,\n /*  2120 */   142,  324,  324,   76,  135,  324,  324,  289,  324,  324,\n /*  2130 */    22,   27,  299,  361,  324,  360,  225,  368,  362,  142,\n /*  2140 */   343,  324,   65,  135,  203,  324,  324,  324,  194,  187,\n /*  2150 */   324,  299,  361,  324,  324,  225,  368,  362,  289,  343,\n /*  2160 */   324,   22,   27,  360,  324,  324,  324,  111,  324,  324,\n /*  2170 */    64,  135,  324,  324,  360,  203,  324,  324,  142,  299,\n /*  2180 */   361,   62,  135,  225,  368,  362,  324,  343,  324,  324,\n /*  2190 */   299,  361,  324,  324,  225,  368,  362,  324,  343,  324,\n /*  2200 */   360,  194,  173,  324,  142,  324,  324,   82,  135,  324,\n /*  2210 */   324,  289,  324,  324,   22,   27,  299,  361,  324,  360,\n /*  2220 */   225,  368,  362,  142,  343,  324,   60,  135,  203,  324,\n /*  2230 */   324,  324,  324,  324,  324,  299,  361,  324,  324,  225,\n /*  2240 */   368,  362,  324,  343,  324,  324,  324,  360,  324,  324,\n /*  2250 */   324,   93,  324,  324,   57,  120,  324,  324,  360,  324,\n /*  2260 */   324,  324,  142,  299,  361,   58,  135,  225,  368,  362,\n /*  2270 */   324,  343,  324,  324,  299,  361,  324,  324,  225,  368,\n /*  2280 */   362,  324,  343,  324,  360,  324,  324,  324,  142,  324,\n /*  2290 */   324,   59,  135,  324,  324,  324,  324,  324,  324,  324,\n /*  2300 */   299,  361,  324,  360,  225,  368,  362,   93,  343,  324,\n /*  2310 */    55,  120,  324,  324,  324,  324,  324,  324,  324,  299,\n /*  2320 */   361,  324,  324,  215,  368,  362,  324,  343,  324,  324,\n /*  2330 */   324,  360,  324,  324,  324,  142,  324,  324,   56,  135,\n /*  2340 */   324,  324,  360,  324,  324,  324,  142,  299,  361,   78,\n /*  2350 */   135,  225,  368,  362,  324,  343,  324,  324,  299,  361,\n /*  2360 */   324,  324,  225,  368,  362,  324,  343,  324,  360,  324,\n /*  2370 */   324,  324,  142,  324,  324,   67,  135,  324,  324,  324,\n /*  2380 */   324,  324,  324,  324,  299,  361,  324,  324,  217,  368,\n /*  2390 */   362,  324,  343,\n    );\n    static public $yy_lookahead = array(\n /*     0 */     1,   82,   83,   84,    3,    4,    5,    6,    7,    8,\n /*    10 */     9,   10,   11,   12,   18,   89,   15,   80,   81,   82,\n /*    20 */    83,   84,   21,   22,   98,   26,   15,   28,   27,   18,\n /*    30 */    19,  116,   31,   32,   33,   24,  110,   38,   39,   40,\n /*    40 */    41,   42,   43,   44,   45,   46,   47,   48,   49,   50,\n /*    50 */    51,    4,    5,    6,    7,    8,   60,    1,   36,   12,\n /*    60 */    13,   14,    1,   64,   65,   66,   67,   68,   69,   70,\n /*    70 */    71,   72,   73,   74,   75,    1,   83,   16,   88,   57,\n /*    80 */    87,   59,   88,   90,   91,   63,   30,   16,   15,   28,\n /*    90 */    16,   18,   99,  100,   19,   20,  103,  104,  105,   28,\n /*   100 */   107,   28,   28,   30,    2,  115,  116,   36,   52,  115,\n /*   110 */   117,  118,   38,   39,   40,   41,   42,   43,   44,   45,\n /*   120 */    46,   47,   48,   49,   50,   51,   83,   88,   89,  109,\n /*   130 */    59,  111,  112,   15,   59,   17,   18,   98,   64,   65,\n /*   140 */    66,   67,   68,   69,   70,   71,   72,   73,   74,   75,\n /*   150 */     1,   83,   34,   15,  115,   87,   18,   19,   90,   91,\n /*   160 */    92,   15,  119,  120,   18,   16,   16,   99,  100,   19,\n /*   170 */    89,  103,  104,  105,   28,  107,   30,   28,   28,   98,\n /*   180 */    36,   15,   15,   17,   18,   18,   36,   38,   39,   40,\n /*   190 */    41,   42,   43,   44,   45,   46,   47,   48,   49,   50,\n /*   200 */    51,   88,   89,   59,   15,   57,   30,   18,   19,   59,\n /*   210 */    62,   98,   36,   64,   65,   66,   67,   68,   69,   70,\n /*   220 */    71,   72,   73,   74,   75,    1,   83,   60,  115,   16,\n /*   230 */    87,   97,   15,   90,   91,   59,    1,   24,   19,   20,\n /*   240 */    16,   15,   99,  100,   18,   20,  103,  104,  105,   60,\n /*   250 */   107,   16,   28,   36,   84,   20,   86,  114,  111,  112,\n /*   260 */    17,   18,   38,   39,   40,   41,   42,   43,   44,   45,\n /*   270 */    46,   47,   48,   49,   50,   51,    1,    2,   59,   91,\n /*   280 */    92,   93,   57,  111,  112,   24,   60,   62,   64,   65,\n /*   290 */    66,   67,   68,   69,   70,   71,   72,   73,   74,   75,\n /*   300 */    89,    1,   88,   89,   61,   35,   35,   37,   37,   98,\n /*   310 */    17,   18,   98,   38,   39,   40,   41,   42,   43,   44,\n /*   320 */    45,   46,   47,   48,   49,   50,   51,    1,   89,  115,\n /*   330 */    35,   35,   37,   88,   88,   91,   92,   98,   77,   64,\n /*   340 */    65,   66,   67,   68,   69,   70,   71,   72,   73,   74,\n /*   350 */    75,   23,   52,   89,  115,   29,  108,   97,  110,   63,\n /*   360 */   115,  115,   98,   35,   38,   39,   40,   41,   42,   43,\n /*   370 */    44,   45,   46,   47,   48,   49,   50,   51,    1,  115,\n /*   380 */    89,   15,   15,   15,   18,   18,   18,   95,   17,   98,\n /*   390 */    64,   65,   66,   67,   68,   69,   70,   71,   72,   73,\n /*   400 */    74,   75,  110,   89,   91,   92,  115,   36,    1,  108,\n /*   410 */    15,  110,   98,   18,  108,   38,   39,   40,   41,   42,\n /*   420 */    43,   44,   45,   46,   47,   48,   49,   50,   51,  115,\n /*   430 */   106,  106,   36,   15,   97,   28,   18,  113,  113,  108,\n /*   440 */    95,   64,   65,   66,   67,   68,   69,   70,   71,   72,\n /*   450 */    73,   74,   75,    1,   77,  110,   83,  108,   15,   18,\n /*   460 */    87,   18,   83,   90,   91,   20,   87,   17,   19,   91,\n /*   470 */    91,   28,   99,  100,    1,   23,  103,  104,  105,  100,\n /*   480 */   107,  103,  103,  104,  105,  107,  107,  114,    2,   16,\n /*   490 */    38,   39,   40,   41,   42,   43,   44,   45,   46,   47,\n /*   500 */    48,   49,   50,   51,   59,   19,   57,   19,   37,   61,\n /*   510 */    18,   17,   53,    2,   18,   95,   64,   65,   66,   67,\n /*   520 */    68,   69,   70,   71,   72,   73,   74,   75,    1,   83,\n /*   530 */   110,   89,   63,   87,   83,   25,   90,   91,   87,   17,\n /*   540 */    98,   18,   91,   16,    1,   99,  100,    1,    2,  103,\n /*   550 */   104,  105,  110,  107,  103,  104,  105,   18,  107,   16,\n /*   560 */   114,   61,   16,   34,    1,   38,   39,   40,   41,   42,\n /*   570 */    43,   44,   45,   46,   47,   48,   49,   50,   51,   16,\n /*   580 */    89,    2,   18,   17,   24,   57,   34,   36,   17,   98,\n /*   590 */    95,   64,   65,   66,   67,   68,   69,   70,   71,   72,\n /*   600 */    73,   74,   75,    1,   83,  110,   89,   18,   87,   18,\n /*   610 */    16,   90,   91,   92,   89,   98,   96,   16,   16,   16,\n /*   620 */    99,  100,   28,   98,  103,  104,  105,  110,  107,   28,\n /*   630 */   110,   28,   18,   18,   98,  110,   20,    1,   28,  109,\n /*   640 */    38,   39,   40,   41,   42,   43,   44,   45,   46,   47,\n /*   650 */    48,   49,   50,   51,    1,  115,  108,   28,  113,  110,\n /*   660 */    28,   94,  112,   95,   95,   95,   64,   65,   66,   67,\n /*   670 */    68,   69,   70,   71,   72,   73,   74,   75,  110,  110,\n /*   680 */   110,   85,   94,   13,  121,  121,  121,  121,  121,  121,\n /*   690 */    37,   38,   39,   40,   41,   42,   43,   44,   45,   46,\n /*   700 */    47,   48,   49,   50,   51,    1,  121,  121,  121,  121,\n /*   710 */   121,  121,  121,  121,   95,   95,   95,   64,   65,   66,\n /*   720 */    67,   68,   69,   70,   71,   72,   73,   74,   75,  110,\n /*   730 */   110,  110,  121,  121,  121,  121,  121,  121,  121,  121,\n /*   740 */   121,   37,   38,   39,   40,   41,   42,   43,   44,   45,\n /*   750 */    46,   47,   48,   49,   50,   51,    1,  121,  121,  121,\n /*   760 */   121,  121,  121,  121,  121,  121,  121,  121,   64,   65,\n /*   770 */    66,   67,   68,   69,   70,   71,   72,   73,   74,   75,\n /*   780 */    83,  121,  121,   28,  121,  121,  121,  121,  121,  121,\n /*   790 */   121,  121,  121,   38,   39,   40,   41,   42,   43,   44,\n /*   800 */    45,   46,   47,   48,   49,   50,   51,    1,  121,  121,\n /*   810 */   121,  121,  121,  121,  121,  121,  121,  120,  121,   64,\n /*   820 */    65,   66,   67,   68,   69,   70,   71,   72,   73,   74,\n /*   830 */    75,  121,  121,  121,  121,  121,  121,  121,  121,  121,\n /*   840 */   121,  121,  121,  121,   38,   39,   40,   41,   42,   43,\n /*   850 */    44,   45,   46,   47,   48,   49,   50,   51,  121,  121,\n /*   860 */   121,  121,  121,  121,  121,  121,  121,  121,  121,   63,\n /*   870 */    64,   65,   66,   67,   68,   69,   70,   71,   72,   73,\n /*   880 */    74,   75,    1,  121,  121,  121,   88,   83,    1,   16,\n /*   890 */    16,   87,  121,   10,   16,   91,  121,   16,   15,  101,\n /*   900 */   102,   28,   28,   16,   21,   22,   28,  103,  104,  105,\n /*   910 */    27,  107,  121,  115,   31,   32,   33,  121,    1,   38,\n /*   920 */    39,   40,   41,   42,   43,   44,   45,   46,   47,   48,\n /*   930 */    49,   50,   51,   16,  121,  121,  121,  121,  121,   52,\n /*   940 */   121,  121,  121,  121,  121,   64,   65,   66,   67,   68,\n /*   950 */    69,   70,   71,   72,   73,   74,   75,    1,  121,   76,\n /*   960 */    77,   78,   83,   16,   16,   16,   87,  121,   10,   16,\n /*   970 */    91,  121,   16,   15,  121,   28,   28,   28,  121,   21,\n /*   980 */    22,   28,  103,  104,  105,   27,  107,  121,  121,   31,\n /*   990 */    32,   33,  121,  121,   38,   39,   40,   41,   42,   43,\n /*  1000 */    44,   45,   46,   47,   48,   49,   50,   51,    1,  121,\n /*  1010 */   121,  121,  121,  121,  121,  121,  121,  121,  121,  121,\n /*  1020 */    64,   65,   66,   67,   68,   69,   70,   71,   72,   73,\n /*  1030 */    74,   75,  121,  121,   76,   77,   78,  121,  121,  121,\n /*  1040 */   121,  121,  121,  121,  121,   38,   39,   40,   41,   42,\n /*  1050 */    43,   44,   45,   46,   47,   48,   49,   50,   51,  121,\n /*  1060 */   121,  121,  121,  121,  121,  121,  121,  121,  121,  121,\n /*  1070 */   121,   64,   65,   66,   67,   68,   69,   70,   71,   72,\n /*  1080 */    73,   74,   75,  121,   38,   39,   40,   41,   42,   43,\n /*  1090 */    44,   45,   46,   47,   48,   49,   50,   51,  121,  121,\n /*  1100 */   121,  121,  121,  121,  121,  121,  121,  121,  121,  121,\n /*  1110 */    64,   65,   66,   67,   68,   69,   70,   71,   72,   73,\n /*  1120 */    74,   75,  121,  121,  121,  121,   15,  121,   17,   18,\n /*  1130 */   121,   83,   21,   22,   16,   87,  121,   16,   27,   91,\n /*  1140 */   121,  121,   31,   32,   33,   34,   28,   36,  100,   28,\n /*  1150 */    39,  103,  104,  105,  121,  107,   83,  121,  121,  121,\n /*  1160 */    87,  121,  121,  121,   91,   54,   55,   56,   57,   58,\n /*  1170 */   121,   83,   61,   62,   63,   87,  103,  104,  105,   91,\n /*  1180 */   107,  121,   15,  121,   17,   18,  121,   76,   21,   22,\n /*  1190 */    16,  103,  104,  105,   27,  107,   16,   16,   31,   32,\n /*  1200 */    33,   34,   28,   36,   16,  121,   39,   16,   28,   28,\n /*  1210 */    83,  121,  121,  121,   87,  121,   28,   90,   91,   28,\n /*  1220 */     1,   54,   55,   56,   57,   58,   99,  100,   61,   62,\n /*  1230 */   103,  104,  105,    1,  107,   16,  121,   16,   15,  121,\n /*  1240 */    17,   18,  121,   76,   21,   22,   16,   28,   16,   28,\n /*  1250 */    27,   16,   20,  121,   31,   32,   33,   34,   28,   36,\n /*  1260 */    28,  121,   39,   28,   16,  121,   83,  121,   36,  121,\n /*  1270 */    87,   52,  121,   90,   91,  121,   28,   54,   55,   56,\n /*  1280 */    57,   58,   99,  100,   61,   62,  103,  104,  105,  121,\n /*  1290 */   107,   59,  121,  121,   15,  121,   17,   18,  121,   76,\n /*  1300 */    21,   22,  121,  121,  121,  121,   27,  121,  121,  121,\n /*  1310 */    31,   32,   33,   34,  121,   36,  121,  121,   39,  121,\n /*  1320 */   121,  121,   83,  121,  121,  121,   87,  121,  121,   90,\n /*  1330 */    91,  121,    1,   54,   55,   56,   57,   58,   99,  100,\n /*  1340 */    61,   62,  103,  104,  105,  121,  107,   16,  121,  121,\n /*  1350 */    15,  121,   17,   18,  121,   76,   21,   22,  121,   28,\n /*  1360 */    29,  121,   27,  121,  121,  121,   31,   32,   33,   34,\n /*  1370 */   121,   36,  121,  121,   39,  121,  121,  121,   83,  121,\n /*  1380 */   121,  121,   87,   52,  121,   90,   91,  121,    1,   54,\n /*  1390 */    55,   56,   57,   58,   99,  100,   61,   62,  103,  104,\n /*  1400 */   105,  121,  107,   16,  121,  121,   15,  121,   17,   18,\n /*  1410 */   121,   76,   21,   22,  121,   28,  121,  121,   27,  121,\n /*  1420 */   121,  121,   31,   32,   33,   34,  121,   36,  121,  121,\n /*  1430 */    39,  121,  121,  121,   83,  121,  121,  121,   87,   52,\n /*  1440 */   121,   90,   91,  121,    1,   54,   55,   56,   57,   58,\n /*  1450 */    99,  100,   61,   62,  103,  104,  105,  121,  107,   16,\n /*  1460 */   121,  121,   15,  121,   17,   18,  121,   76,   21,   22,\n /*  1470 */   121,   28,  121,  121,   27,  121,  121,  121,   31,   32,\n /*  1480 */    33,   34,  121,   36,  121,  121,   39,  121,  121,  121,\n /*  1490 */    83,  121,  121,  121,   87,   52,  121,   90,   91,  121,\n /*  1500 */   121,   54,   55,   56,   57,   58,   99,  100,   61,   62,\n /*  1510 */   103,  104,  105,  121,  107,  121,  121,  121,   15,  121,\n /*  1520 */    17,   18,  121,   76,   21,   22,  121,  121,  121,  121,\n /*  1530 */    27,  121,  121,  121,   31,   32,   33,   34,  121,   36,\n /*  1540 */   121,  121,   39,  121,  121,  121,   83,  121,  121,  121,\n /*  1550 */    87,  121,  121,   90,   91,  121,  121,   54,   55,   56,\n /*  1560 */    57,   58,   99,  100,   61,   62,  103,  104,  105,  121,\n /*  1570 */   107,  121,  121,  121,   15,  121,   17,   18,  121,   76,\n /*  1580 */    21,   22,  121,  121,  121,  121,   27,  121,  121,  121,\n /*  1590 */    31,   32,   33,   34,  121,   36,  121,  121,   39,  121,\n /*  1600 */   121,  121,   83,  121,  121,  121,   87,  121,  121,   90,\n /*  1610 */    91,  121,  121,   54,   55,   56,   57,   58,   99,  100,\n /*  1620 */    61,   62,  103,  104,  105,  121,  107,  121,  121,  121,\n /*  1630 */    15,  121,   17,   18,  121,   76,   21,   22,  121,  121,\n /*  1640 */   121,  121,   27,  121,  121,  121,   31,   32,   33,   34,\n /*  1650 */   121,   36,  121,  121,   39,  121,  121,  121,   83,  121,\n /*  1660 */   121,  121,   87,  121,  121,   90,   91,  121,  121,   54,\n /*  1670 */    55,   56,   57,   58,   99,  100,   61,   62,  103,  104,\n /*  1680 */   105,  121,  107,  121,  121,  121,   15,  121,   17,   18,\n /*  1690 */   121,   76,   21,   22,  121,  121,  121,  121,   27,  121,\n /*  1700 */   121,  121,   31,   32,   33,   34,  121,   36,  121,  121,\n /*  1710 */    39,  121,  121,  121,   83,  121,  121,  121,   87,  121,\n /*  1720 */   121,   90,   91,  121,  121,   54,   55,   56,   57,   58,\n /*  1730 */    99,  100,   61,  121,  103,  104,  105,  121,  107,  121,\n /*  1740 */   121,  121,   15,  121,   17,   18,  121,   76,   21,   22,\n /*  1750 */   121,  121,  121,  121,   27,  121,  121,  121,   31,   32,\n /*  1760 */    33,   34,  121,   36,   88,   89,   39,  121,  121,  121,\n /*  1770 */   121,  121,  121,  121,   98,  121,  121,  101,  102,  121,\n /*  1780 */    16,   54,   55,   56,   57,   58,  121,   23,   61,   25,\n /*  1790 */    26,  115,   28,   29,  121,  121,  121,  121,  121,   35,\n /*  1800 */    36,   37,  121,   76,  121,  121,  121,  121,  121,  121,\n /*  1810 */   121,  121,  121,   83,  121,  121,   52,   87,  121,  121,\n /*  1820 */    90,   91,  121,   59,  121,  121,  121,   63,  121,   99,\n /*  1830 */   100,  121,  121,  103,  104,  105,  121,  107,   83,  121,\n /*  1840 */   121,   77,   87,  121,  121,   90,   91,  121,  118,  121,\n /*  1850 */   121,  121,  121,  121,   99,  100,  121,  121,  103,  104,\n /*  1860 */   105,  121,  107,  121,   83,  121,  121,  121,   87,  121,\n /*  1870 */   121,   90,   91,  121,   83,  121,  121,  121,   87,  121,\n /*  1880 */    99,  100,   91,   83,  103,  104,  105,   87,  107,  121,\n /*  1890 */    90,   91,  121,  121,  103,  104,  105,  121,  107,   99,\n /*  1900 */   100,  121,  121,  103,  104,  105,  121,  107,  121,  121,\n /*  1910 */   121,   83,  121,  121,  121,   87,  121,  121,   90,   91,\n /*  1920 */   121,  121,   83,  121,  121,  121,   87,   99,  100,   90,\n /*  1930 */    91,  103,  104,  105,  121,  107,  121,  121,   99,  100,\n /*  1940 */   121,  121,  103,  104,  105,  121,  107,  121,   83,  121,\n /*  1950 */   121,  121,   87,  121,  121,   90,   91,  121,   83,  121,\n /*  1960 */   121,  121,   87,  121,   99,  100,   91,   83,  103,  104,\n /*  1970 */   105,   87,  107,  121,   90,   91,  121,  121,  103,  104,\n /*  1980 */   105,  121,  107,   99,  100,  121,  121,  103,  104,  105,\n /*  1990 */   121,  107,  121,  121,  121,   83,  121,  121,  121,   87,\n /*  2000 */   121,  121,   90,   91,  121,  121,   83,  121,  121,  121,\n /*  2010 */    87,   99,  100,   90,   91,  103,  104,  105,  121,  107,\n /*  2020 */   121,  121,   99,  100,  121,  121,  103,  104,  105,  121,\n /*  2030 */   107,  121,   83,   88,   89,  121,   87,  121,  121,   90,\n /*  2040 */    91,  121,  121,   98,  121,  121,  101,  102,   99,  100,\n /*  2050 */   121,   83,  103,  104,  105,   87,  107,  121,   90,   91,\n /*  2060 */   115,  121,  121,  121,   88,   89,  121,   99,  100,  121,\n /*  2070 */   121,  103,  104,  105,   98,  107,  121,  101,  102,   83,\n /*  2080 */   121,  121,  121,   87,  121,  121,   90,   91,  121,  121,\n /*  2090 */    83,  115,  121,  121,   87,   99,  100,   90,   91,  103,\n /*  2100 */   104,  105,  121,  107,  121,  121,   99,  100,  121,  121,\n /*  2110 */   103,  104,  105,  121,  107,  121,   83,   88,   89,  121,\n /*  2120 */    87,  121,  121,   90,   91,  121,  121,   98,  121,  121,\n /*  2130 */   101,  102,   99,  100,  121,   83,  103,  104,  105,   87,\n /*  2140 */   107,  121,   90,   91,  115,  121,  121,  121,   88,   89,\n /*  2150 */   121,   99,  100,  121,  121,  103,  104,  105,   98,  107,\n /*  2160 */   121,  101,  102,   83,  121,  121,  121,   87,  121,  121,\n /*  2170 */    90,   91,  121,  121,   83,  115,  121,  121,   87,   99,\n /*  2180 */   100,   90,   91,  103,  104,  105,  121,  107,  121,  121,\n /*  2190 */    99,  100,  121,  121,  103,  104,  105,  121,  107,  121,\n /*  2200 */    83,   88,   89,  121,   87,  121,  121,   90,   91,  121,\n /*  2210 */   121,   98,  121,  121,  101,  102,   99,  100,  121,   83,\n /*  2220 */   103,  104,  105,   87,  107,  121,   90,   91,  115,  121,\n /*  2230 */   121,  121,  121,  121,  121,   99,  100,  121,  121,  103,\n /*  2240 */   104,  105,  121,  107,  121,  121,  121,   83,  121,  121,\n /*  2250 */   121,   87,  121,  121,   90,   91,  121,  121,   83,  121,\n /*  2260 */   121,  121,   87,   99,  100,   90,   91,  103,  104,  105,\n /*  2270 */   121,  107,  121,  121,   99,  100,  121,  121,  103,  104,\n /*  2280 */   105,  121,  107,  121,   83,  121,  121,  121,   87,  121,\n /*  2290 */   121,   90,   91,  121,  121,  121,  121,  121,  121,  121,\n /*  2300 */    99,  100,  121,   83,  103,  104,  105,   87,  107,  121,\n /*  2310 */    90,   91,  121,  121,  121,  121,  121,  121,  121,   99,\n /*  2320 */   100,  121,  121,  103,  104,  105,  121,  107,  121,  121,\n /*  2330 */   121,   83,  121,  121,  121,   87,  121,  121,   90,   91,\n /*  2340 */   121,  121,   83,  121,  121,  121,   87,   99,  100,   90,\n /*  2350 */    91,  103,  104,  105,  121,  107,  121,  121,   99,  100,\n /*  2360 */   121,  121,  103,  104,  105,  121,  107,  121,   83,  121,\n /*  2370 */   121,  121,   87,  121,  121,   90,   91,  121,  121,  121,\n /*  2380 */   121,  121,  121,  121,   99,  100,  121,  121,  103,  104,\n /*  2390 */   105,  121,  107,\n);\n    const YY_SHIFT_USE_DFLT = -5;\n    const YY_SHIFT_MAX = 252;\n    static public $yy_shift_ofst = array(\n /*     0 */     1, 1391, 1391, 1223, 1167, 1167, 1167, 1223, 1111, 1167,\n /*    10 */  1167, 1167, 1503, 1167, 1559, 1167, 1167, 1167, 1167, 1167,\n /*    20 */  1167, 1167, 1167, 1167, 1167, 1615, 1167, 1167, 1167, 1167,\n /*    30 */  1503, 1167, 1167, 1447, 1167, 1167, 1167, 1167, 1279, 1167,\n /*    40 */  1167, 1167, 1279, 1167, 1335, 1335, 1727, 1671, 1727, 1727,\n /*    50 */  1727, 1727, 1727,  224,   74,  149,   -1,  755,  755,  755,\n /*    60 */   956,  881,  806,  527,  326,  704,  275,  377,  653,  602,\n /*    70 */   452, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007,\n /*    80 */  1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007,\n /*    90 */  1046, 1046, 1232, 1443,  407,    1,  958,   73,  146,  225,\n /*   100 */   546,   61,   61,  443,  443,  243,  371,  407,  407,  883,\n /*   110 */    47, 1331,   11,  189, 1387, 1219,  226,   56,  138,  235,\n /*   120 */    75,  887,  219,  366,  371,  367,  366,  366,  368,  293,\n /*   130 */   371,  366,  917,  366,  366,  445,  366,  418,  366, 1248,\n /*   140 */   368,  366,  300,  395,  293,  636,  629,  636,  616,  636,\n /*   150 */   610,  636,  636,  636,  636,  616,  636,   -5,  166,  167,\n /*   160 */   601,  603,  873,  594,  148,  217,  148,  473,  947,  148,\n /*   170 */   874,  878,  948, 1235,  148,  543, 1191, 1221,  148, 1230,\n /*   180 */   563, 1188, 1121, 1118,  953,  949, 1181, 1174, 1180,  670,\n /*   190 */   632,  632,  616,  616,  636,  616,  636,  102,  102,  396,\n /*   200 */    -5,   -5,   -5,   -5,   -5, 1764,  150,   22,  118,   71,\n /*   210 */   176,   -4,  486,  144,  144,  213,  270,  261,  296,  328,\n /*   220 */   449,  271,  295,  615,  579,  560,  566,  441,  564,  396,\n /*   230 */   528,  591,  551,  589,  571,  614,  552,  529,  539,  494,\n /*   240 */   448,  492,  471,  450,  488,  469,  459,  511,  522,  510,\n /*   250 */   496,  523,  500,\n);\n    const YY_REDUCE_USE_DFLT = -86;\n    const YY_REDUCE_MAX = 204;\n    static public $yy_reduce_ofst = array(\n /*     0 */   -63,   -7, 1730,   68,  446,  373,  143,  521, 2091, 2117,\n /*    10 */  1800, 1407, 2080, 1884, 1912, 1575, 1949, 1923, 1865, 1968,\n /*    20 */  1996, 2052, 2033, 2007, 1839, 1828, 1351, 1295, 1183, 1239,\n /*    30 */  1463, 1519, 1781, 1755, 1631, 2175, 2248, 2201, 2164, 2285,\n /*    40 */  2259, 2136, 2220, 1127,  379, 1048,  451, 1073,  804,  879,\n /*    50 */  1875, 1791, 1088, 1976, 1945, 1676, 2060, 1676, 2113, 2029,\n /*    60 */   798,  798,  798,  798,  798,  798,  798,  798,  798,  798,\n /*    70 */   798,  798,  798,  798,  798,  798,  798,  798,  798,  798,\n /*    80 */   798,  798,  798,  798,  798,  798,  798,  798,  798,  798,\n /*    90 */   798,  798,   39,  113,  214,  -81,   43,  442,  -74,   20,\n /*   100 */   -10,  239,  264,  525,  517,  378,  188,  314,  291,  697,\n /*   110 */   170,   -6,  520,  248,   -6,   -6,  248,   -6,  248,  246,\n /*   120 */   172,   -6,  172,  568,  313,  495,  495,  569,  570,  324,\n /*   130 */   244,  292,  245,  420,  345,  172,  301,  495,  621,  491,\n /*   140 */   495,  619,   -6,  620,  325,   -6,  211,   -6,  147,   -6,\n /*   150 */    81,   -6,   -6,   -6,   -6,  172,   -6,   -6,  545,  549,\n /*   160 */   536,  536,  536,  536,  530,  548,  530,  540,  536,  530,\n /*   170 */   536,  536,  536,  536,  530,  540,  536,  536,  530,  536,\n /*   180 */   540,  536,  536,  536,  536,  536,  536,  536,  536,  596,\n /*   190 */   567,  588,  550,  550,  540,  550,  540,  -85,  -85,  331,\n /*   200 */   306,  349,  337,  260,  134,\n);\n    static public $yyExpectedTokens = array(\n        /* 0 */ array(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 15, 21, 22, 27, 31, 32, 33, ),\n        /* 1 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 2 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 3 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 4 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 5 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 6 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 7 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 8 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 63, 76, ),\n        /* 9 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 10 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 11 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 12 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 13 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 14 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 15 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 16 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 17 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 18 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 19 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 20 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 21 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 22 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 23 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 24 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 25 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 26 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 27 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 28 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 29 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 30 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 31 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 32 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 33 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 34 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 35 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 36 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 37 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 38 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 39 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 40 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 41 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 42 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 43 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 44 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 45 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 62, 76, ),\n        /* 46 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 76, ),\n        /* 47 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 76, ),\n        /* 48 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 76, ),\n        /* 49 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 76, ),\n        /* 50 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 76, ),\n        /* 51 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 76, ),\n        /* 52 */ array(15, 17, 18, 21, 22, 27, 31, 32, 33, 34, 36, 39, 54, 55, 56, 57, 58, 61, 76, ),\n        /* 53 */ array(1, 16, 28, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 54 */ array(1, 16, 28, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 55 */ array(1, 16, 28, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 56 */ array(1, 26, 28, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 57 */ array(1, 28, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 58 */ array(1, 28, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 59 */ array(1, 28, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 60 */ array(1, 16, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 61 */ array(1, 16, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 62 */ array(1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 63 */ array(1, 16, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 64 */ array(1, 29, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 65 */ array(1, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 66 */ array(1, 2, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 67 */ array(1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 77, ),\n        /* 68 */ array(1, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 69 */ array(1, 16, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 70 */ array(1, 23, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 71 */ array(1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 72 */ array(1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 73 */ array(1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 74 */ array(1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 75 */ array(1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 76 */ array(1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 77 */ array(1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 78 */ array(1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 79 */ array(1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 80 */ array(1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 81 */ array(1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 82 */ array(1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 83 */ array(1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 84 */ array(1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 85 */ array(1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 86 */ array(1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 87 */ array(1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 88 */ array(1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 89 */ array(1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 90 */ array(38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 91 */ array(38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, ),\n        /* 92 */ array(1, 16, 20, 28, 36, 59, ),\n        /* 93 */ array(1, 16, 28, 52, ),\n        /* 94 */ array(1, 28, ),\n        /* 95 */ array(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 15, 21, 22, 27, 31, 32, 33, ),\n        /* 96 */ array(10, 15, 21, 22, 27, 31, 32, 33, 76, 77, 78, ),\n        /* 97 */ array(15, 18, 28, 30, ),\n        /* 98 */ array(15, 18, 28, 30, ),\n        /* 99 */ array(20, 57, 62, ),\n        /* 100 */ array(1, 2, 16, ),\n        /* 101 */ array(1, 16, 28, ),\n        /* 102 */ array(1, 16, 28, ),\n        /* 103 */ array(15, 18, 28, ),\n        /* 104 */ array(15, 18, 28, ),\n        /* 105 */ array(17, 18, 61, ),\n        /* 106 */ array(17, 36, ),\n        /* 107 */ array(1, 28, ),\n        /* 108 */ array(1, 28, ),\n        /* 109 */ array(10, 15, 21, 22, 27, 31, 32, 33, 76, 77, 78, ),\n        /* 110 */ array(4, 5, 6, 7, 8, 12, 13, 14, ),\n        /* 111 */ array(1, 16, 28, 29, 52, ),\n        /* 112 */ array(15, 18, 19, 24, ),\n        /* 113 */ array(15, 18, 19, 60, ),\n        /* 114 */ array(1, 16, 28, 52, ),\n        /* 115 */ array(1, 16, 28, 52, ),\n        /* 116 */ array(15, 18, 60, ),\n        /* 117 */ array(1, 30, 52, ),\n        /* 118 */ array(15, 18, 19, ),\n        /* 119 */ array(1, 16, 20, ),\n        /* 120 */ array(19, 20, 59, ),\n        /* 121 */ array(1, 16, 52, ),\n        /* 122 */ array(19, 20, 59, ),\n        /* 123 */ array(15, 18, ),\n        /* 124 */ array(17, 36, ),\n        /* 125 */ array(15, 18, ),\n        /* 126 */ array(15, 18, ),\n        /* 127 */ array(15, 18, ),\n        /* 128 */ array(15, 18, ),\n        /* 129 */ array(17, 18, ),\n        /* 130 */ array(17, 36, ),\n        /* 131 */ array(15, 18, ),\n        /* 132 */ array(1, 16, ),\n        /* 133 */ array(15, 18, ),\n        /* 134 */ array(15, 18, ),\n        /* 135 */ array(20, 59, ),\n        /* 136 */ array(15, 18, ),\n        /* 137 */ array(15, 18, ),\n        /* 138 */ array(15, 18, ),\n        /* 139 */ array(16, 28, ),\n        /* 140 */ array(15, 18, ),\n        /* 141 */ array(15, 18, ),\n        /* 142 */ array(1, 52, ),\n        /* 143 */ array(15, 18, ),\n        /* 144 */ array(17, 18, ),\n        /* 145 */ array(1, ),\n        /* 146 */ array(28, ),\n        /* 147 */ array(1, ),\n        /* 148 */ array(20, ),\n        /* 149 */ array(1, ),\n        /* 150 */ array(28, ),\n        /* 151 */ array(1, ),\n        /* 152 */ array(1, ),\n        /* 153 */ array(1, ),\n        /* 154 */ array(1, ),\n        /* 155 */ array(20, ),\n        /* 156 */ array(1, ),\n        /* 157 */ array(),\n        /* 158 */ array(15, 17, 18, ),\n        /* 159 */ array(15, 18, 60, ),\n        /* 160 */ array(16, 28, ),\n        /* 161 */ array(16, 28, ),\n        /* 162 */ array(16, 28, ),\n        /* 163 */ array(16, 28, ),\n        /* 164 */ array(57, 62, ),\n        /* 165 */ array(15, 36, ),\n        /* 166 */ array(57, 62, ),\n        /* 167 */ array(1, 16, ),\n        /* 168 */ array(16, 28, ),\n        /* 169 */ array(57, 62, ),\n        /* 170 */ array(16, 28, ),\n        /* 171 */ array(16, 28, ),\n        /* 172 */ array(16, 28, ),\n        /* 173 */ array(16, 28, ),\n        /* 174 */ array(57, 62, ),\n        /* 175 */ array(1, 16, ),\n        /* 176 */ array(16, 28, ),\n        /* 177 */ array(16, 28, ),\n        /* 178 */ array(57, 62, ),\n        /* 179 */ array(16, 28, ),\n        /* 180 */ array(1, 16, ),\n        /* 181 */ array(16, 28, ),\n        /* 182 */ array(16, 28, ),\n        /* 183 */ array(16, 28, ),\n        /* 184 */ array(16, 28, ),\n        /* 185 */ array(16, 28, ),\n        /* 186 */ array(16, 28, ),\n        /* 187 */ array(16, 28, ),\n        /* 188 */ array(16, 28, ),\n        /* 189 */ array(13, ),\n        /* 190 */ array(28, ),\n        /* 191 */ array(28, ),\n        /* 192 */ array(20, ),\n        /* 193 */ array(20, ),\n        /* 194 */ array(1, ),\n        /* 195 */ array(20, ),\n        /* 196 */ array(1, ),\n        /* 197 */ array(2, ),\n        /* 198 */ array(2, ),\n        /* 199 */ array(36, ),\n        /* 200 */ array(),\n        /* 201 */ array(),\n        /* 202 */ array(),\n        /* 203 */ array(),\n        /* 204 */ array(),\n        /* 205 */ array(16, 23, 25, 26, 28, 29, 35, 36, 37, 52, 59, 63, 77, ),\n        /* 206 */ array(16, 19, 28, 36, 59, ),\n        /* 207 */ array(36, 57, 59, 63, ),\n        /* 208 */ array(15, 17, 18, 34, ),\n        /* 209 */ array(16, 28, 36, 59, ),\n        /* 210 */ array(30, 36, 59, ),\n        /* 211 */ array(18, 60, ),\n        /* 212 */ array(2, 19, ),\n        /* 213 */ array(36, 59, ),\n        /* 214 */ array(36, 59, ),\n        /* 215 */ array(16, 24, ),\n        /* 216 */ array(35, 37, ),\n        /* 217 */ array(24, 77, ),\n        /* 218 */ array(35, 63, ),\n        /* 219 */ array(23, 35, ),\n        /* 220 */ array(19, 57, ),\n        /* 221 */ array(35, 37, ),\n        /* 222 */ array(35, 37, ),\n        /* 223 */ array(18, ),\n        /* 224 */ array(2, ),\n        /* 225 */ array(24, ),\n        /* 226 */ array(17, ),\n        /* 227 */ array(18, ),\n        /* 228 */ array(18, ),\n        /* 229 */ array(36, ),\n        /* 230 */ array(57, ),\n        /* 231 */ array(18, ),\n        /* 232 */ array(36, ),\n        /* 233 */ array(18, ),\n        /* 234 */ array(17, ),\n        /* 235 */ array(18, ),\n        /* 236 */ array(34, ),\n        /* 237 */ array(34, ),\n        /* 238 */ array(18, ),\n        /* 239 */ array(17, ),\n        /* 240 */ array(61, ),\n        /* 241 */ array(18, ),\n        /* 242 */ array(37, ),\n        /* 243 */ array(17, ),\n        /* 244 */ array(19, ),\n        /* 245 */ array(63, ),\n        /* 246 */ array(53, ),\n        /* 247 */ array(2, ),\n        /* 248 */ array(17, ),\n        /* 249 */ array(25, ),\n        /* 250 */ array(18, ),\n        /* 251 */ array(18, ),\n        /* 252 */ array(61, ),\n        /* 253 */ array(),\n        /* 254 */ array(),\n        /* 255 */ array(),\n        /* 256 */ array(),\n        /* 257 */ array(),\n        /* 258 */ array(),\n        /* 259 */ array(),\n        /* 260 */ array(),\n        /* 261 */ array(),\n        /* 262 */ array(),\n        /* 263 */ array(),\n        /* 264 */ array(),\n        /* 265 */ array(),\n        /* 266 */ array(),\n        /* 267 */ array(),\n        /* 268 */ array(),\n        /* 269 */ array(),\n        /* 270 */ array(),\n        /* 271 */ array(),\n        /* 272 */ array(),\n        /* 273 */ array(),\n        /* 274 */ array(),\n        /* 275 */ array(),\n        /* 276 */ array(),\n        /* 277 */ array(),\n        /* 278 */ array(),\n        /* 279 */ array(),\n        /* 280 */ array(),\n        /* 281 */ array(),\n        /* 282 */ array(),\n        /* 283 */ array(),\n        /* 284 */ array(),\n        /* 285 */ array(),\n        /* 286 */ array(),\n        /* 287 */ array(),\n        /* 288 */ array(),\n        /* 289 */ array(),\n        /* 290 */ array(),\n        /* 291 */ array(),\n        /* 292 */ array(),\n        /* 293 */ array(),\n        /* 294 */ array(),\n        /* 295 */ array(),\n        /* 296 */ array(),\n        /* 297 */ array(),\n        /* 298 */ array(),\n        /* 299 */ array(),\n        /* 300 */ array(),\n        /* 301 */ array(),\n        /* 302 */ array(),\n        /* 303 */ array(),\n        /* 304 */ array(),\n        /* 305 */ array(),\n        /* 306 */ array(),\n        /* 307 */ array(),\n        /* 308 */ array(),\n        /* 309 */ array(),\n        /* 310 */ array(),\n        /* 311 */ array(),\n        /* 312 */ array(),\n        /* 313 */ array(),\n        /* 314 */ array(),\n        /* 315 */ array(),\n        /* 316 */ array(),\n        /* 317 */ array(),\n        /* 318 */ array(),\n        /* 319 */ array(),\n        /* 320 */ array(),\n        /* 321 */ array(),\n        /* 322 */ array(),\n        /* 323 */ array(),\n        /* 324 */ array(),\n        /* 325 */ array(),\n        /* 326 */ array(),\n        /* 327 */ array(),\n        /* 328 */ array(),\n        /* 329 */ array(),\n        /* 330 */ array(),\n        /* 331 */ array(),\n        /* 332 */ array(),\n        /* 333 */ array(),\n        /* 334 */ array(),\n        /* 335 */ array(),\n        /* 336 */ array(),\n        /* 337 */ array(),\n        /* 338 */ array(),\n        /* 339 */ array(),\n        /* 340 */ array(),\n        /* 341 */ array(),\n        /* 342 */ array(),\n        /* 343 */ array(),\n        /* 344 */ array(),\n        /* 345 */ array(),\n        /* 346 */ array(),\n        /* 347 */ array(),\n        /* 348 */ array(),\n        /* 349 */ array(),\n        /* 350 */ array(),\n        /* 351 */ array(),\n        /* 352 */ array(),\n        /* 353 */ array(),\n        /* 354 */ array(),\n        /* 355 */ array(),\n        /* 356 */ array(),\n        /* 357 */ array(),\n        /* 358 */ array(),\n        /* 359 */ array(),\n        /* 360 */ array(),\n        /* 361 */ array(),\n        /* 362 */ array(),\n        /* 363 */ array(),\n        /* 364 */ array(),\n        /* 365 */ array(),\n        /* 366 */ array(),\n        /* 367 */ array(),\n        /* 368 */ array(),\n        /* 369 */ array(),\n        /* 370 */ array(),\n        /* 371 */ array(),\n        /* 372 */ array(),\n        /* 373 */ array(),\n        /* 374 */ array(),\n        /* 375 */ array(),\n        /* 376 */ array(),\n        /* 377 */ array(),\n        /* 378 */ array(),\n        /* 379 */ array(),\n        /* 380 */ array(),\n        /* 381 */ array(),\n        /* 382 */ array(),\n        /* 383 */ array(),\n        /* 384 */ array(),\n        /* 385 */ array(),\n        /* 386 */ array(),\n);\n    static public $yy_default = array(\n /*     0 */   390,  571,  588,  588,  542,  542,  542,  588,  588,  588,\n /*    10 */   588,  588,  588,  588,  588,  588,  588,  588,  588,  588,\n /*    20 */   588,  588,  588,  588,  588,  588,  588,  588,  588,  588,\n /*    30 */   588,  588,  588,  588,  588,  588,  588,  588,  588,  588,\n /*    40 */   588,  588,  588,  588,  588,  588,  588,  588,  588,  588,\n /*    50 */   588,  588,  588,  588,  588,  588,  450,  450,  450,  450,\n /*    60 */   588,  588,  588,  588,  455,  588,  588,  588,  588,  588,\n /*    70 */   588,  573,  457,  541,  574,  455,  471,  460,  540,  480,\n /*    80 */   484,  432,  461,  452,  479,  483,  572,  474,  475,  476,\n /*    90 */   487,  488,  499,  463,  450,  387,  588,  450,  450,  554,\n /*   100 */   588,  507,  470,  450,  450,  588,  588,  450,  450,  588,\n /*   110 */   588,  463,  588,  515,  463,  463,  515,  463,  515,  588,\n /*   120 */   508,  463,  508,  588,  588,  588,  588,  588,  588,  588,\n /*   130 */   588,  588,  588,  588,  588,  508,  515,  588,  588,  588,\n /*   140 */   588,  588,  463,  588,  588,  467,  450,  473,  551,  490,\n /*   150 */   450,  468,  486,  491,  492,  508,  466,  549,  588,  516,\n /*   160 */   588,  588,  588,  588,  533,  515,  532,  588,  588,  513,\n /*   170 */   588,  588,  588,  588,  534,  588,  588,  588,  535,  588,\n /*   180 */   588,  588,  588,  588,  588,  588,  588,  588,  588,  405,\n /*   190 */   587,  587,  529,  555,  470,  552,  507,  543,  544,  515,\n /*   200 */   515,  515,  548,  548,  548,  465,  499,  499,  588,  499,\n /*   210 */   499,  588,  527,  485,  499,  489,  588,  489,  588,  588,\n /*   220 */   495,  588,  588,  588,  527,  489,  588,  588,  588,  527,\n /*   230 */   495,  588,  553,  588,  588,  588,  497,  588,  588,  588,\n /*   240 */   588,  588,  588,  588,  588,  588,  501,  527,  588,  458,\n /*   250 */   588,  588,  588,  435,  524,  439,  501,  523,  511,  569,\n /*   260 */   521,  415,  522,  570,  520,  388,  537,  512,  440,  462,\n /*   270 */   459,  429,  550,  586,  430,  536,  528,  538,  539,  434,\n /*   280 */   433,  565,  441,  527,  442,  547,  443,  526,  438,  449,\n /*   290 */   428,  431,  436,  437,  444,  445,  498,  496,  504,  464,\n /*   300 */   465,  494,  493,  545,  546,  446,  447,  427,  448,  397,\n /*   310 */   396,  398,  399,  400,  395,  394,  389,  391,  392,  393,\n /*   320 */   401,  402,  411,  410,  412,  413,  414,  409,  408,  403,\n /*   330 */   404,  406,  407,  509,  514,  421,  420,  530,  422,  423,\n /*   340 */   419,  418,  531,  510,  416,  417,  583,  424,  426,  581,\n /*   350 */   579,  584,  585,  578,  580,  577,  425,  582,  575,  576,\n /*   360 */   506,  469,  503,  502,  505,  477,  478,  472,  500,  517,\n /*   370 */   525,  518,  519,  481,  482,  563,  562,  564,  566,  567,\n /*   380 */   561,  560,  556,  557,  558,  559,  568,\n);\n    const YYNOCODE = 122;\n    const YYSTACKDEPTH = 100;\n    const YYNSTATE = 387;\n    const YYNRULE = 201;\n    const YYERRORSYMBOL = 79;\n    const YYERRSYMDT = 'yy0';\n    const YYFALLBACK = 0;\n    static public $yyFallback = array(\n    );\n    static function Trace($TraceFILE, $zTracePrompt)\n    {\n        if (!$TraceFILE) {\n            $zTracePrompt = 0;\n        } elseif (!$zTracePrompt) {\n            $TraceFILE = 0;\n        }\n        self::$yyTraceFILE = $TraceFILE;\n        self::$yyTracePrompt = $zTracePrompt;\n    }\n\n    static function PrintTrace()\n    {\n        self::$yyTraceFILE = fopen('php://output', 'w');\n        self::$yyTracePrompt = '<br>';\n    }\n\n    static public $yyTraceFILE;\n    static public $yyTracePrompt;\n    public $yyidx;                    /* Index of top element in stack */\n    public $yyerrcnt;                 /* Shifts left before out of the error */\n    public $yystack = array();  /* The parser's stack */\n\n    public $yyTokenName = array(\n  '$',             'VERT',          'COLON',         'COMMENT',\n  'PHPSTARTTAG',   'PHPENDTAG',     'ASPSTARTTAG',   'ASPENDTAG',\n  'FAKEPHPSTARTTAG',  'XMLTAG',        'OTHER',         'LINEBREAK',\n  'LITERALSTART',  'LITERALEND',    'LITERAL',       'LDEL',\n  'RDEL',          'DOLLAR',        'ID',            'EQUAL',\n  'PTR',           'LDELIF',        'LDELFOR',       'SEMICOLON',\n  'INCDEC',        'TO',            'STEP',          'LDELFOREACH',\n  'SPACE',         'AS',            'APTR',          'LDELSETFILTER',\n  'SMARTYBLOCKCHILD',  'LDELSLASH',     'INTEGER',       'COMMA',\n  'OPENP',         'CLOSEP',        'MATH',          'UNIMATH',\n  'ANDSYM',        'ISIN',          'ISDIVBY',       'ISNOTDIVBY',\n  'ISEVEN',        'ISNOTEVEN',     'ISEVENBY',      'ISNOTEVENBY',\n  'ISODD',         'ISNOTODD',      'ISODDBY',       'ISNOTODDBY',\n  'INSTANCEOF',    'QMARK',         'NOT',           'TYPECAST',\n  'HEX',           'DOT',           'SINGLEQUOTESTRING',  'DOUBLECOLON',\n  'AT',            'HATCH',         'OPENB',         'CLOSEB',\n  'EQUALS',        'NOTEQUALS',     'GREATERTHAN',   'LESSTHAN',\n  'GREATEREQUAL',  'LESSEQUAL',     'IDENTITY',      'NONEIDENTITY',\n  'MOD',           'LAND',          'LOR',           'LXOR',\n  'QUOTE',         'BACKTICK',      'DOLLARID',      'error',\n  'start',         'template',      'template_element',  'smartytag',\n  'literal',       'literal_elements',  'literal_element',  'value',\n  'modifierlist',  'attributes',    'expr',          'varindexed',\n  'statement',     'statements',    'optspace',      'varvar',\n  'foraction',     'modparameters',  'attribute',     'ternary',\n  'array',         'ifcond',        'lop',           'variable',\n  'function',      'doublequoted_with_quotes',  'static_class_access',  'object',\n  'arrayindex',    'indexdef',      'varvarele',     'objectchain',\n  'objectelement',  'method',        'params',        'modifier',\n  'modparameter',  'arrayelements',  'arrayelement',  'doublequoted',\n  'doublequotedcontent',\n    );\n\n    static public $yyRuleName = array(\n /*   0 */ \"start ::= template\",\n /*   1 */ \"template ::= template_element\",\n /*   2 */ \"template ::= template template_element\",\n /*   3 */ \"template ::=\",\n /*   4 */ \"template_element ::= smartytag\",\n /*   5 */ \"template_element ::= COMMENT\",\n /*   6 */ \"template_element ::= literal\",\n /*   7 */ \"template_element ::= PHPSTARTTAG\",\n /*   8 */ \"template_element ::= PHPENDTAG\",\n /*   9 */ \"template_element ::= ASPSTARTTAG\",\n /*  10 */ \"template_element ::= ASPENDTAG\",\n /*  11 */ \"template_element ::= FAKEPHPSTARTTAG\",\n /*  12 */ \"template_element ::= XMLTAG\",\n /*  13 */ \"template_element ::= OTHER\",\n /*  14 */ \"template_element ::= LINEBREAK\",\n /*  15 */ \"literal ::= LITERALSTART LITERALEND\",\n /*  16 */ \"literal ::= LITERALSTART literal_elements LITERALEND\",\n /*  17 */ \"literal_elements ::= literal_elements literal_element\",\n /*  18 */ \"literal_elements ::=\",\n /*  19 */ \"literal_element ::= literal\",\n /*  20 */ \"literal_element ::= LITERAL\",\n /*  21 */ \"literal_element ::= PHPSTARTTAG\",\n /*  22 */ \"literal_element ::= FAKEPHPSTARTTAG\",\n /*  23 */ \"literal_element ::= PHPENDTAG\",\n /*  24 */ \"literal_element ::= ASPSTARTTAG\",\n /*  25 */ \"literal_element ::= ASPENDTAG\",\n /*  26 */ \"smartytag ::= LDEL value RDEL\",\n /*  27 */ \"smartytag ::= LDEL value modifierlist attributes RDEL\",\n /*  28 */ \"smartytag ::= LDEL value attributes RDEL\",\n /*  29 */ \"smartytag ::= LDEL expr modifierlist attributes RDEL\",\n /*  30 */ \"smartytag ::= LDEL expr attributes RDEL\",\n /*  31 */ \"smartytag ::= LDEL DOLLAR ID EQUAL value RDEL\",\n /*  32 */ \"smartytag ::= LDEL DOLLAR ID EQUAL expr RDEL\",\n /*  33 */ \"smartytag ::= LDEL DOLLAR ID EQUAL expr attributes RDEL\",\n /*  34 */ \"smartytag ::= LDEL varindexed EQUAL expr attributes RDEL\",\n /*  35 */ \"smartytag ::= LDEL ID attributes RDEL\",\n /*  36 */ \"smartytag ::= LDEL ID RDEL\",\n /*  37 */ \"smartytag ::= LDEL ID PTR ID attributes RDEL\",\n /*  38 */ \"smartytag ::= LDEL ID modifierlist attributes RDEL\",\n /*  39 */ \"smartytag ::= LDEL ID PTR ID modifierlist attributes RDEL\",\n /*  40 */ \"smartytag ::= LDELIF expr RDEL\",\n /*  41 */ \"smartytag ::= LDELIF expr attributes RDEL\",\n /*  42 */ \"smartytag ::= LDELIF statement RDEL\",\n /*  43 */ \"smartytag ::= LDELIF statement attributes RDEL\",\n /*  44 */ \"smartytag ::= LDELFOR statements SEMICOLON optspace expr SEMICOLON optspace DOLLAR varvar foraction attributes RDEL\",\n /*  45 */ \"foraction ::= EQUAL expr\",\n /*  46 */ \"foraction ::= INCDEC\",\n /*  47 */ \"smartytag ::= LDELFOR statement TO expr attributes RDEL\",\n /*  48 */ \"smartytag ::= LDELFOR statement TO expr STEP expr attributes RDEL\",\n /*  49 */ \"smartytag ::= LDELFOREACH attributes RDEL\",\n /*  50 */ \"smartytag ::= LDELFOREACH SPACE value AS DOLLAR varvar attributes RDEL\",\n /*  51 */ \"smartytag ::= LDELFOREACH SPACE value AS DOLLAR varvar APTR DOLLAR varvar attributes RDEL\",\n /*  52 */ \"smartytag ::= LDELFOREACH SPACE expr AS DOLLAR varvar attributes RDEL\",\n /*  53 */ \"smartytag ::= LDELFOREACH SPACE expr AS DOLLAR varvar APTR DOLLAR varvar attributes RDEL\",\n /*  54 */ \"smartytag ::= LDELSETFILTER ID modparameters RDEL\",\n /*  55 */ \"smartytag ::= LDELSETFILTER ID modparameters modifierlist RDEL\",\n /*  56 */ \"smartytag ::= SMARTYBLOCKCHILD\",\n /*  57 */ \"smartytag ::= LDELSLASH ID RDEL\",\n /*  58 */ \"smartytag ::= LDELSLASH ID modifierlist RDEL\",\n /*  59 */ \"smartytag ::= LDELSLASH ID PTR ID RDEL\",\n /*  60 */ \"smartytag ::= LDELSLASH ID PTR ID modifierlist RDEL\",\n /*  61 */ \"attributes ::= attributes attribute\",\n /*  62 */ \"attributes ::= attribute\",\n /*  63 */ \"attributes ::=\",\n /*  64 */ \"attribute ::= SPACE ID EQUAL ID\",\n /*  65 */ \"attribute ::= SPACE ID EQUAL expr\",\n /*  66 */ \"attribute ::= SPACE ID EQUAL value\",\n /*  67 */ \"attribute ::= SPACE ID\",\n /*  68 */ \"attribute ::= SPACE expr\",\n /*  69 */ \"attribute ::= SPACE value\",\n /*  70 */ \"attribute ::= SPACE INTEGER EQUAL expr\",\n /*  71 */ \"statements ::= statement\",\n /*  72 */ \"statements ::= statements COMMA statement\",\n /*  73 */ \"statement ::= DOLLAR varvar EQUAL expr\",\n /*  74 */ \"statement ::= varindexed EQUAL expr\",\n /*  75 */ \"statement ::= OPENP statement CLOSEP\",\n /*  76 */ \"expr ::= value\",\n /*  77 */ \"expr ::= ternary\",\n /*  78 */ \"expr ::= DOLLAR ID COLON ID\",\n /*  79 */ \"expr ::= expr MATH value\",\n /*  80 */ \"expr ::= expr UNIMATH value\",\n /*  81 */ \"expr ::= expr ANDSYM value\",\n /*  82 */ \"expr ::= array\",\n /*  83 */ \"expr ::= expr modifierlist\",\n /*  84 */ \"expr ::= expr ifcond expr\",\n /*  85 */ \"expr ::= expr ISIN array\",\n /*  86 */ \"expr ::= expr ISIN value\",\n /*  87 */ \"expr ::= expr lop expr\",\n /*  88 */ \"expr ::= expr ISDIVBY expr\",\n /*  89 */ \"expr ::= expr ISNOTDIVBY expr\",\n /*  90 */ \"expr ::= expr ISEVEN\",\n /*  91 */ \"expr ::= expr ISNOTEVEN\",\n /*  92 */ \"expr ::= expr ISEVENBY expr\",\n /*  93 */ \"expr ::= expr ISNOTEVENBY expr\",\n /*  94 */ \"expr ::= expr ISODD\",\n /*  95 */ \"expr ::= expr ISNOTODD\",\n /*  96 */ \"expr ::= expr ISODDBY expr\",\n /*  97 */ \"expr ::= expr ISNOTODDBY expr\",\n /*  98 */ \"expr ::= value INSTANCEOF ID\",\n /*  99 */ \"expr ::= value INSTANCEOF value\",\n /* 100 */ \"ternary ::= OPENP expr CLOSEP QMARK DOLLAR ID COLON expr\",\n /* 101 */ \"ternary ::= OPENP expr CLOSEP QMARK expr COLON expr\",\n /* 102 */ \"value ::= variable\",\n /* 103 */ \"value ::= UNIMATH value\",\n /* 104 */ \"value ::= NOT value\",\n /* 105 */ \"value ::= TYPECAST value\",\n /* 106 */ \"value ::= variable INCDEC\",\n /* 107 */ \"value ::= HEX\",\n /* 108 */ \"value ::= INTEGER\",\n /* 109 */ \"value ::= INTEGER DOT INTEGER\",\n /* 110 */ \"value ::= INTEGER DOT\",\n /* 111 */ \"value ::= DOT INTEGER\",\n /* 112 */ \"value ::= ID\",\n /* 113 */ \"value ::= function\",\n /* 114 */ \"value ::= OPENP expr CLOSEP\",\n /* 115 */ \"value ::= SINGLEQUOTESTRING\",\n /* 116 */ \"value ::= doublequoted_with_quotes\",\n /* 117 */ \"value ::= ID DOUBLECOLON static_class_access\",\n /* 118 */ \"value ::= varindexed DOUBLECOLON static_class_access\",\n /* 119 */ \"value ::= smartytag\",\n /* 120 */ \"value ::= value modifierlist\",\n /* 121 */ \"variable ::= varindexed\",\n /* 122 */ \"variable ::= DOLLAR varvar AT ID\",\n /* 123 */ \"variable ::= object\",\n /* 124 */ \"variable ::= HATCH ID HATCH\",\n /* 125 */ \"variable ::= HATCH variable HATCH\",\n /* 126 */ \"varindexed ::= DOLLAR varvar arrayindex\",\n /* 127 */ \"arrayindex ::= arrayindex indexdef\",\n /* 128 */ \"arrayindex ::=\",\n /* 129 */ \"indexdef ::= DOT DOLLAR varvar\",\n /* 130 */ \"indexdef ::= DOT DOLLAR varvar AT ID\",\n /* 131 */ \"indexdef ::= DOT ID\",\n /* 132 */ \"indexdef ::= DOT INTEGER\",\n /* 133 */ \"indexdef ::= DOT LDEL expr RDEL\",\n /* 134 */ \"indexdef ::= OPENB ID CLOSEB\",\n /* 135 */ \"indexdef ::= OPENB ID DOT ID CLOSEB\",\n /* 136 */ \"indexdef ::= OPENB expr CLOSEB\",\n /* 137 */ \"indexdef ::= OPENB CLOSEB\",\n /* 138 */ \"varvar ::= varvarele\",\n /* 139 */ \"varvar ::= varvar varvarele\",\n /* 140 */ \"varvarele ::= ID\",\n /* 141 */ \"varvarele ::= LDEL expr RDEL\",\n /* 142 */ \"object ::= varindexed objectchain\",\n /* 143 */ \"objectchain ::= objectelement\",\n /* 144 */ \"objectchain ::= objectchain objectelement\",\n /* 145 */ \"objectelement ::= PTR ID arrayindex\",\n /* 146 */ \"objectelement ::= PTR DOLLAR varvar arrayindex\",\n /* 147 */ \"objectelement ::= PTR LDEL expr RDEL arrayindex\",\n /* 148 */ \"objectelement ::= PTR ID LDEL expr RDEL arrayindex\",\n /* 149 */ \"objectelement ::= PTR method\",\n /* 150 */ \"function ::= ID OPENP params CLOSEP\",\n /* 151 */ \"method ::= ID OPENP params CLOSEP\",\n /* 152 */ \"method ::= DOLLAR ID OPENP params CLOSEP\",\n /* 153 */ \"params ::= params COMMA expr\",\n /* 154 */ \"params ::= expr\",\n /* 155 */ \"params ::=\",\n /* 156 */ \"modifierlist ::= modifierlist modifier modparameters\",\n /* 157 */ \"modifierlist ::= modifier modparameters\",\n /* 158 */ \"modifier ::= VERT AT ID\",\n /* 159 */ \"modifier ::= VERT ID\",\n /* 160 */ \"modparameters ::= modparameters modparameter\",\n /* 161 */ \"modparameters ::=\",\n /* 162 */ \"modparameter ::= COLON value\",\n /* 163 */ \"modparameter ::= COLON array\",\n /* 164 */ \"static_class_access ::= method\",\n /* 165 */ \"static_class_access ::= method objectchain\",\n /* 166 */ \"static_class_access ::= ID\",\n /* 167 */ \"static_class_access ::= DOLLAR ID arrayindex\",\n /* 168 */ \"static_class_access ::= DOLLAR ID arrayindex objectchain\",\n /* 169 */ \"ifcond ::= EQUALS\",\n /* 170 */ \"ifcond ::= NOTEQUALS\",\n /* 171 */ \"ifcond ::= GREATERTHAN\",\n /* 172 */ \"ifcond ::= LESSTHAN\",\n /* 173 */ \"ifcond ::= GREATEREQUAL\",\n /* 174 */ \"ifcond ::= LESSEQUAL\",\n /* 175 */ \"ifcond ::= IDENTITY\",\n /* 176 */ \"ifcond ::= NONEIDENTITY\",\n /* 177 */ \"ifcond ::= MOD\",\n /* 178 */ \"lop ::= LAND\",\n /* 179 */ \"lop ::= LOR\",\n /* 180 */ \"lop ::= LXOR\",\n /* 181 */ \"array ::= OPENB arrayelements CLOSEB\",\n /* 182 */ \"arrayelements ::= arrayelement\",\n /* 183 */ \"arrayelements ::= arrayelements COMMA arrayelement\",\n /* 184 */ \"arrayelements ::=\",\n /* 185 */ \"arrayelement ::= value APTR expr\",\n /* 186 */ \"arrayelement ::= ID APTR expr\",\n /* 187 */ \"arrayelement ::= expr\",\n /* 188 */ \"doublequoted_with_quotes ::= QUOTE QUOTE\",\n /* 189 */ \"doublequoted_with_quotes ::= QUOTE doublequoted QUOTE\",\n /* 190 */ \"doublequoted ::= doublequoted doublequotedcontent\",\n /* 191 */ \"doublequoted ::= doublequotedcontent\",\n /* 192 */ \"doublequotedcontent ::= BACKTICK variable BACKTICK\",\n /* 193 */ \"doublequotedcontent ::= BACKTICK expr BACKTICK\",\n /* 194 */ \"doublequotedcontent ::= DOLLARID\",\n /* 195 */ \"doublequotedcontent ::= LDEL variable RDEL\",\n /* 196 */ \"doublequotedcontent ::= LDEL expr RDEL\",\n /* 197 */ \"doublequotedcontent ::= smartytag\",\n /* 198 */ \"doublequotedcontent ::= OTHER\",\n /* 199 */ \"optspace ::= SPACE\",\n /* 200 */ \"optspace ::=\",\n    );\n\n    function tokenName($tokenType)\n    {\n        if ($tokenType === 0) {\n            return 'End of Input';\n        }\n        if ($tokenType > 0 && $tokenType < count($this->yyTokenName)) {\n            return $this->yyTokenName[$tokenType];\n        } else {\n            return \"Unknown\";\n        }\n    }\n\n    static function yy_destructor($yymajor, $yypminor)\n    {\n        switch ($yymajor) {\n            default:  break;   /* If no destructor action specified: do nothing */\n        }\n    }\n\n    function yy_pop_parser_stack()\n    {\n        if (!count($this->yystack)) {\n            return;\n        }\n        $yytos = array_pop($this->yystack);\n        if (self::$yyTraceFILE && $this->yyidx >= 0) {\n            fwrite(self::$yyTraceFILE,\n                self::$yyTracePrompt . 'Popping ' . $this->yyTokenName[$yytos->major] .\n                    \"\\n\");\n        }\n        $yymajor = $yytos->major;\n        self::yy_destructor($yymajor, $yytos->minor);\n        $this->yyidx--;\n        return $yymajor;\n    }\n\n    function __destruct()\n    {\n        while ($this->yystack !== Array()) {\n            $this->yy_pop_parser_stack();\n        }\n        if (is_resource(self::$yyTraceFILE)) {\n            fclose(self::$yyTraceFILE);\n        }\n    }\n\n    function yy_get_expected_tokens($token)\n    {\n        $state = $this->yystack[$this->yyidx]->stateno;\n        $expected = self::$yyExpectedTokens[$state];\n        if (in_array($token, self::$yyExpectedTokens[$state], true)) {\n            return $expected;\n        }\n        $stack = $this->yystack;\n        $yyidx = $this->yyidx;\n        do {\n            $yyact = $this->yy_find_shift_action($token);\n            if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {\n                // reduce action\n                $done = 0;\n                do {\n                    if ($done++ == 100) {\n                        $this->yyidx = $yyidx;\n                        $this->yystack = $stack;\n                        // too much recursion prevents proper detection\n                        // so give up\n                        return array_unique($expected);\n                    }\n                    $yyruleno = $yyact - self::YYNSTATE;\n                    $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs'];\n                    $nextstate = $this->yy_find_reduce_action(\n                        $this->yystack[$this->yyidx]->stateno,\n                        self::$yyRuleInfo[$yyruleno]['lhs']);\n                    if (isset(self::$yyExpectedTokens[$nextstate])) {\n\t\t        $expected = array_merge($expected, self::$yyExpectedTokens[$nextstate]);\n                            if (in_array($token,\n                                  self::$yyExpectedTokens[$nextstate], true)) {\n                            $this->yyidx = $yyidx;\n                            $this->yystack = $stack;\n                            return array_unique($expected);\n                        }\n                    }\n                    if ($nextstate < self::YYNSTATE) {\n                        // we need to shift a non-terminal\n                        $this->yyidx++;\n                        $x = new TP_yyStackEntry;\n                        $x->stateno = $nextstate;\n                        $x->major = self::$yyRuleInfo[$yyruleno]['lhs'];\n                        $this->yystack[$this->yyidx] = $x;\n                        continue 2;\n                    } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {\n                        $this->yyidx = $yyidx;\n                        $this->yystack = $stack;\n                        // the last token was just ignored, we can't accept\n                        // by ignoring input, this is in essence ignoring a\n                        // syntax error!\n                        return array_unique($expected);\n                    } elseif ($nextstate === self::YY_NO_ACTION) {\n                        $this->yyidx = $yyidx;\n                        $this->yystack = $stack;\n                        // input accepted, but not shifted (I guess)\n                        return $expected;\n                    } else {\n                        $yyact = $nextstate;\n                    }\n                } while (true);\n            }\n            break;\n        } while (true);\n\t$this->yyidx = $yyidx;\n\t$this->yystack = $stack;\n        return array_unique($expected);\n    }\n\n    function yy_is_expected_token($token)\n    {\n        if ($token === 0) {\n            return true; // 0 is not part of this\n        }\n        $state = $this->yystack[$this->yyidx]->stateno;\n        if (in_array($token, self::$yyExpectedTokens[$state], true)) {\n            return true;\n        }\n        $stack = $this->yystack;\n        $yyidx = $this->yyidx;\n        do {\n            $yyact = $this->yy_find_shift_action($token);\n            if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {\n                // reduce action\n                $done = 0;\n                do {\n                    if ($done++ == 100) {\n                        $this->yyidx = $yyidx;\n                        $this->yystack = $stack;\n                        // too much recursion prevents proper detection\n                        // so give up\n                        return true;\n                    }\n                    $yyruleno = $yyact - self::YYNSTATE;\n                    $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs'];\n                    $nextstate = $this->yy_find_reduce_action(\n                        $this->yystack[$this->yyidx]->stateno,\n                        self::$yyRuleInfo[$yyruleno]['lhs']);\n                    if (isset(self::$yyExpectedTokens[$nextstate]) &&\n                          in_array($token, self::$yyExpectedTokens[$nextstate], true)) {\n                        $this->yyidx = $yyidx;\n                        $this->yystack = $stack;\n                        return true;\n                    }\n                    if ($nextstate < self::YYNSTATE) {\n                        // we need to shift a non-terminal\n                        $this->yyidx++;\n                        $x = new TP_yyStackEntry;\n                        $x->stateno = $nextstate;\n                        $x->major = self::$yyRuleInfo[$yyruleno]['lhs'];\n                        $this->yystack[$this->yyidx] = $x;\n                        continue 2;\n                    } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {\n                        $this->yyidx = $yyidx;\n                        $this->yystack = $stack;\n                        if (!$token) {\n                            // end of input: this is valid\n                            return true;\n                        }\n                        // the last token was just ignored, we can't accept\n                        // by ignoring input, this is in essence ignoring a\n                        // syntax error!\n                        return false;\n                    } elseif ($nextstate === self::YY_NO_ACTION) {\n                        $this->yyidx = $yyidx;\n                        $this->yystack = $stack;\n                        // input accepted, but not shifted (I guess)\n                        return true;\n                    } else {\n                        $yyact = $nextstate;\n                    }\n                } while (true);\n            }\n            break;\n        } while (true);\n        $this->yyidx = $yyidx;\n        $this->yystack = $stack;\n        return true;\n    }\n\n   function yy_find_shift_action($iLookAhead)\n    {\n        $stateno = $this->yystack[$this->yyidx]->stateno;\n\n        /* if ($this->yyidx < 0) return self::YY_NO_ACTION;  */\n        if (!isset(self::$yy_shift_ofst[$stateno])) {\n            // no shift actions\n            return self::$yy_default[$stateno];\n        }\n        $i = self::$yy_shift_ofst[$stateno];\n        if ($i === self::YY_SHIFT_USE_DFLT) {\n            return self::$yy_default[$stateno];\n        }\n        if ($iLookAhead == self::YYNOCODE) {\n            return self::YY_NO_ACTION;\n        }\n        $i += $iLookAhead;\n        if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||\n              self::$yy_lookahead[$i] != $iLookAhead) {\n            if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback)\n                   && ($iFallback = self::$yyFallback[$iLookAhead]) != 0) {\n                if (self::$yyTraceFILE) {\n                    fwrite(self::$yyTraceFILE, self::$yyTracePrompt . \"FALLBACK \" .\n                        $this->yyTokenName[$iLookAhead] . \" => \" .\n                        $this->yyTokenName[$iFallback] . \"\\n\");\n                }\n                return $this->yy_find_shift_action($iFallback);\n            }\n            return self::$yy_default[$stateno];\n        } else {\n            return self::$yy_action[$i];\n        }\n    }\n\n    function yy_find_reduce_action($stateno, $iLookAhead)\n    {\n        /* $stateno = $this->yystack[$this->yyidx]->stateno; */\n\n        if (!isset(self::$yy_reduce_ofst[$stateno])) {\n            return self::$yy_default[$stateno];\n        }\n        $i = self::$yy_reduce_ofst[$stateno];\n        if ($i == self::YY_REDUCE_USE_DFLT) {\n            return self::$yy_default[$stateno];\n        }\n        if ($iLookAhead == self::YYNOCODE) {\n            return self::YY_NO_ACTION;\n        }\n        $i += $iLookAhead;\n        if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||\n              self::$yy_lookahead[$i] != $iLookAhead) {\n            return self::$yy_default[$stateno];\n        } else {\n            return self::$yy_action[$i];\n        }\n    }\n\n    function yy_shift($yyNewState, $yyMajor, $yypMinor)\n    {\n        $this->yyidx++;\n        if ($this->yyidx >= self::YYSTACKDEPTH) {\n            $this->yyidx--;\n            if (self::$yyTraceFILE) {\n                fprintf(self::$yyTraceFILE, \"%sStack Overflow!\\n\", self::$yyTracePrompt);\n            }\n            while ($this->yyidx >= 0) {\n                $this->yy_pop_parser_stack();\n            }\n#line 83 \"smarty_internal_templateparser.y\"\n\n    $this->internalError = true;\n    $this->compiler->trigger_template_error(\"Stack overflow in template parser\");\n#line 1715 \"smarty_internal_templateparser.php\"\n            return;\n        }\n        $yytos = new TP_yyStackEntry;\n        $yytos->stateno = $yyNewState;\n        $yytos->major = $yyMajor;\n        $yytos->minor = $yypMinor;\n        array_push($this->yystack, $yytos);\n        if (self::$yyTraceFILE && $this->yyidx > 0) {\n            fprintf(self::$yyTraceFILE, \"%sShift %d\\n\", self::$yyTracePrompt,\n                $yyNewState);\n            fprintf(self::$yyTraceFILE, \"%sStack:\", self::$yyTracePrompt);\n            for($i = 1; $i <= $this->yyidx; $i++) {\n                fprintf(self::$yyTraceFILE, \" %s\",\n                    $this->yyTokenName[$this->yystack[$i]->major]);\n            }\n            fwrite(self::$yyTraceFILE,\"\\n\");\n        }\n    }\n\n    static public $yyRuleInfo = array(\n  array( 'lhs' => 80, 'rhs' => 1 ),\n  array( 'lhs' => 81, 'rhs' => 1 ),\n  array( 'lhs' => 81, 'rhs' => 2 ),\n  array( 'lhs' => 81, 'rhs' => 0 ),\n  array( 'lhs' => 82, 'rhs' => 1 ),\n  array( 'lhs' => 82, 'rhs' => 1 ),\n  array( 'lhs' => 82, 'rhs' => 1 ),\n  array( 'lhs' => 82, 'rhs' => 1 ),\n  array( 'lhs' => 82, 'rhs' => 1 ),\n  array( 'lhs' => 82, 'rhs' => 1 ),\n  array( 'lhs' => 82, 'rhs' => 1 ),\n  array( 'lhs' => 82, 'rhs' => 1 ),\n  array( 'lhs' => 82, 'rhs' => 1 ),\n  array( 'lhs' => 82, 'rhs' => 1 ),\n  array( 'lhs' => 82, 'rhs' => 1 ),\n  array( 'lhs' => 84, 'rhs' => 2 ),\n  array( 'lhs' => 84, 'rhs' => 3 ),\n  array( 'lhs' => 85, 'rhs' => 2 ),\n  array( 'lhs' => 85, 'rhs' => 0 ),\n  array( 'lhs' => 86, 'rhs' => 1 ),\n  array( 'lhs' => 86, 'rhs' => 1 ),\n  array( 'lhs' => 86, 'rhs' => 1 ),\n  array( 'lhs' => 86, 'rhs' => 1 ),\n  array( 'lhs' => 86, 'rhs' => 1 ),\n  array( 'lhs' => 86, 'rhs' => 1 ),\n  array( 'lhs' => 86, 'rhs' => 1 ),\n  array( 'lhs' => 83, 'rhs' => 3 ),\n  array( 'lhs' => 83, 'rhs' => 5 ),\n  array( 'lhs' => 83, 'rhs' => 4 ),\n  array( 'lhs' => 83, 'rhs' => 5 ),\n  array( 'lhs' => 83, 'rhs' => 4 ),\n  array( 'lhs' => 83, 'rhs' => 6 ),\n  array( 'lhs' => 83, 'rhs' => 6 ),\n  array( 'lhs' => 83, 'rhs' => 7 ),\n  array( 'lhs' => 83, 'rhs' => 6 ),\n  array( 'lhs' => 83, 'rhs' => 4 ),\n  array( 'lhs' => 83, 'rhs' => 3 ),\n  array( 'lhs' => 83, 'rhs' => 6 ),\n  array( 'lhs' => 83, 'rhs' => 5 ),\n  array( 'lhs' => 83, 'rhs' => 7 ),\n  array( 'lhs' => 83, 'rhs' => 3 ),\n  array( 'lhs' => 83, 'rhs' => 4 ),\n  array( 'lhs' => 83, 'rhs' => 3 ),\n  array( 'lhs' => 83, 'rhs' => 4 ),\n  array( 'lhs' => 83, 'rhs' => 12 ),\n  array( 'lhs' => 96, 'rhs' => 2 ),\n  array( 'lhs' => 96, 'rhs' => 1 ),\n  array( 'lhs' => 83, 'rhs' => 6 ),\n  array( 'lhs' => 83, 'rhs' => 8 ),\n  array( 'lhs' => 83, 'rhs' => 3 ),\n  array( 'lhs' => 83, 'rhs' => 8 ),\n  array( 'lhs' => 83, 'rhs' => 11 ),\n  array( 'lhs' => 83, 'rhs' => 8 ),\n  array( 'lhs' => 83, 'rhs' => 11 ),\n  array( 'lhs' => 83, 'rhs' => 4 ),\n  array( 'lhs' => 83, 'rhs' => 5 ),\n  array( 'lhs' => 83, 'rhs' => 1 ),\n  array( 'lhs' => 83, 'rhs' => 3 ),\n  array( 'lhs' => 83, 'rhs' => 4 ),\n  array( 'lhs' => 83, 'rhs' => 5 ),\n  array( 'lhs' => 83, 'rhs' => 6 ),\n  array( 'lhs' => 89, 'rhs' => 2 ),\n  array( 'lhs' => 89, 'rhs' => 1 ),\n  array( 'lhs' => 89, 'rhs' => 0 ),\n  array( 'lhs' => 98, 'rhs' => 4 ),\n  array( 'lhs' => 98, 'rhs' => 4 ),\n  array( 'lhs' => 98, 'rhs' => 4 ),\n  array( 'lhs' => 98, 'rhs' => 2 ),\n  array( 'lhs' => 98, 'rhs' => 2 ),\n  array( 'lhs' => 98, 'rhs' => 2 ),\n  array( 'lhs' => 98, 'rhs' => 4 ),\n  array( 'lhs' => 93, 'rhs' => 1 ),\n  array( 'lhs' => 93, 'rhs' => 3 ),\n  array( 'lhs' => 92, 'rhs' => 4 ),\n  array( 'lhs' => 92, 'rhs' => 3 ),\n  array( 'lhs' => 92, 'rhs' => 3 ),\n  array( 'lhs' => 90, 'rhs' => 1 ),\n  array( 'lhs' => 90, 'rhs' => 1 ),\n  array( 'lhs' => 90, 'rhs' => 4 ),\n  array( 'lhs' => 90, 'rhs' => 3 ),\n  array( 'lhs' => 90, 'rhs' => 3 ),\n  array( 'lhs' => 90, 'rhs' => 3 ),\n  array( 'lhs' => 90, 'rhs' => 1 ),\n  array( 'lhs' => 90, 'rhs' => 2 ),\n  array( 'lhs' => 90, 'rhs' => 3 ),\n  array( 'lhs' => 90, 'rhs' => 3 ),\n  array( 'lhs' => 90, 'rhs' => 3 ),\n  array( 'lhs' => 90, 'rhs' => 3 ),\n  array( 'lhs' => 90, 'rhs' => 3 ),\n  array( 'lhs' => 90, 'rhs' => 3 ),\n  array( 'lhs' => 90, 'rhs' => 2 ),\n  array( 'lhs' => 90, 'rhs' => 2 ),\n  array( 'lhs' => 90, 'rhs' => 3 ),\n  array( 'lhs' => 90, 'rhs' => 3 ),\n  array( 'lhs' => 90, 'rhs' => 2 ),\n  array( 'lhs' => 90, 'rhs' => 2 ),\n  array( 'lhs' => 90, 'rhs' => 3 ),\n  array( 'lhs' => 90, 'rhs' => 3 ),\n  array( 'lhs' => 90, 'rhs' => 3 ),\n  array( 'lhs' => 90, 'rhs' => 3 ),\n  array( 'lhs' => 99, 'rhs' => 8 ),\n  array( 'lhs' => 99, 'rhs' => 7 ),\n  array( 'lhs' => 87, 'rhs' => 1 ),\n  array( 'lhs' => 87, 'rhs' => 2 ),\n  array( 'lhs' => 87, 'rhs' => 2 ),\n  array( 'lhs' => 87, 'rhs' => 2 ),\n  array( 'lhs' => 87, 'rhs' => 2 ),\n  array( 'lhs' => 87, 'rhs' => 1 ),\n  array( 'lhs' => 87, 'rhs' => 1 ),\n  array( 'lhs' => 87, 'rhs' => 3 ),\n  array( 'lhs' => 87, 'rhs' => 2 ),\n  array( 'lhs' => 87, 'rhs' => 2 ),\n  array( 'lhs' => 87, 'rhs' => 1 ),\n  array( 'lhs' => 87, 'rhs' => 1 ),\n  array( 'lhs' => 87, 'rhs' => 3 ),\n  array( 'lhs' => 87, 'rhs' => 1 ),\n  array( 'lhs' => 87, 'rhs' => 1 ),\n  array( 'lhs' => 87, 'rhs' => 3 ),\n  array( 'lhs' => 87, 'rhs' => 3 ),\n  array( 'lhs' => 87, 'rhs' => 1 ),\n  array( 'lhs' => 87, 'rhs' => 2 ),\n  array( 'lhs' => 103, 'rhs' => 1 ),\n  array( 'lhs' => 103, 'rhs' => 4 ),\n  array( 'lhs' => 103, 'rhs' => 1 ),\n  array( 'lhs' => 103, 'rhs' => 3 ),\n  array( 'lhs' => 103, 'rhs' => 3 ),\n  array( 'lhs' => 91, 'rhs' => 3 ),\n  array( 'lhs' => 108, 'rhs' => 2 ),\n  array( 'lhs' => 108, 'rhs' => 0 ),\n  array( 'lhs' => 109, 'rhs' => 3 ),\n  array( 'lhs' => 109, 'rhs' => 5 ),\n  array( 'lhs' => 109, 'rhs' => 2 ),\n  array( 'lhs' => 109, 'rhs' => 2 ),\n  array( 'lhs' => 109, 'rhs' => 4 ),\n  array( 'lhs' => 109, 'rhs' => 3 ),\n  array( 'lhs' => 109, 'rhs' => 5 ),\n  array( 'lhs' => 109, 'rhs' => 3 ),\n  array( 'lhs' => 109, 'rhs' => 2 ),\n  array( 'lhs' => 95, 'rhs' => 1 ),\n  array( 'lhs' => 95, 'rhs' => 2 ),\n  array( 'lhs' => 110, 'rhs' => 1 ),\n  array( 'lhs' => 110, 'rhs' => 3 ),\n  array( 'lhs' => 107, 'rhs' => 2 ),\n  array( 'lhs' => 111, 'rhs' => 1 ),\n  array( 'lhs' => 111, 'rhs' => 2 ),\n  array( 'lhs' => 112, 'rhs' => 3 ),\n  array( 'lhs' => 112, 'rhs' => 4 ),\n  array( 'lhs' => 112, 'rhs' => 5 ),\n  array( 'lhs' => 112, 'rhs' => 6 ),\n  array( 'lhs' => 112, 'rhs' => 2 ),\n  array( 'lhs' => 104, 'rhs' => 4 ),\n  array( 'lhs' => 113, 'rhs' => 4 ),\n  array( 'lhs' => 113, 'rhs' => 5 ),\n  array( 'lhs' => 114, 'rhs' => 3 ),\n  array( 'lhs' => 114, 'rhs' => 1 ),\n  array( 'lhs' => 114, 'rhs' => 0 ),\n  array( 'lhs' => 88, 'rhs' => 3 ),\n  array( 'lhs' => 88, 'rhs' => 2 ),\n  array( 'lhs' => 115, 'rhs' => 3 ),\n  array( 'lhs' => 115, 'rhs' => 2 ),\n  array( 'lhs' => 97, 'rhs' => 2 ),\n  array( 'lhs' => 97, 'rhs' => 0 ),\n  array( 'lhs' => 116, 'rhs' => 2 ),\n  array( 'lhs' => 116, 'rhs' => 2 ),\n  array( 'lhs' => 106, 'rhs' => 1 ),\n  array( 'lhs' => 106, 'rhs' => 2 ),\n  array( 'lhs' => 106, 'rhs' => 1 ),\n  array( 'lhs' => 106, 'rhs' => 3 ),\n  array( 'lhs' => 106, 'rhs' => 4 ),\n  array( 'lhs' => 101, 'rhs' => 1 ),\n  array( 'lhs' => 101, 'rhs' => 1 ),\n  array( 'lhs' => 101, 'rhs' => 1 ),\n  array( 'lhs' => 101, 'rhs' => 1 ),\n  array( 'lhs' => 101, 'rhs' => 1 ),\n  array( 'lhs' => 101, 'rhs' => 1 ),\n  array( 'lhs' => 101, 'rhs' => 1 ),\n  array( 'lhs' => 101, 'rhs' => 1 ),\n  array( 'lhs' => 101, 'rhs' => 1 ),\n  array( 'lhs' => 102, 'rhs' => 1 ),\n  array( 'lhs' => 102, 'rhs' => 1 ),\n  array( 'lhs' => 102, 'rhs' => 1 ),\n  array( 'lhs' => 100, 'rhs' => 3 ),\n  array( 'lhs' => 117, 'rhs' => 1 ),\n  array( 'lhs' => 117, 'rhs' => 3 ),\n  array( 'lhs' => 117, 'rhs' => 0 ),\n  array( 'lhs' => 118, 'rhs' => 3 ),\n  array( 'lhs' => 118, 'rhs' => 3 ),\n  array( 'lhs' => 118, 'rhs' => 1 ),\n  array( 'lhs' => 105, 'rhs' => 2 ),\n  array( 'lhs' => 105, 'rhs' => 3 ),\n  array( 'lhs' => 119, 'rhs' => 2 ),\n  array( 'lhs' => 119, 'rhs' => 1 ),\n  array( 'lhs' => 120, 'rhs' => 3 ),\n  array( 'lhs' => 120, 'rhs' => 3 ),\n  array( 'lhs' => 120, 'rhs' => 1 ),\n  array( 'lhs' => 120, 'rhs' => 3 ),\n  array( 'lhs' => 120, 'rhs' => 3 ),\n  array( 'lhs' => 120, 'rhs' => 1 ),\n  array( 'lhs' => 120, 'rhs' => 1 ),\n  array( 'lhs' => 94, 'rhs' => 1 ),\n  array( 'lhs' => 94, 'rhs' => 0 ),\n    );\n\n    static public $yyReduceMap = array(\n        0 => 0,\n        1 => 1,\n        2 => 1,\n        4 => 4,\n        5 => 5,\n        6 => 6,\n        7 => 7,\n        8 => 8,\n        9 => 9,\n        10 => 10,\n        11 => 11,\n        12 => 12,\n        13 => 13,\n        14 => 14,\n        15 => 15,\n        18 => 15,\n        200 => 15,\n        16 => 16,\n        75 => 16,\n        17 => 17,\n        103 => 17,\n        105 => 17,\n        106 => 17,\n        127 => 17,\n        165 => 17,\n        19 => 19,\n        20 => 19,\n        46 => 19,\n        68 => 19,\n        69 => 19,\n        76 => 19,\n        77 => 19,\n        82 => 19,\n        102 => 19,\n        107 => 19,\n        108 => 19,\n        113 => 19,\n        115 => 19,\n        116 => 19,\n        123 => 19,\n        138 => 19,\n        164 => 19,\n        166 => 19,\n        182 => 19,\n        187 => 19,\n        199 => 19,\n        21 => 21,\n        22 => 21,\n        23 => 23,\n        24 => 24,\n        25 => 25,\n        26 => 26,\n        27 => 27,\n        28 => 28,\n        30 => 28,\n        29 => 29,\n        31 => 31,\n        32 => 31,\n        33 => 33,\n        34 => 34,\n        35 => 35,\n        36 => 36,\n        37 => 37,\n        38 => 38,\n        39 => 39,\n        40 => 40,\n        41 => 41,\n        43 => 41,\n        42 => 42,\n        44 => 44,\n        45 => 45,\n        47 => 47,\n        48 => 48,\n        49 => 49,\n        50 => 50,\n        51 => 51,\n        52 => 52,\n        53 => 53,\n        54 => 54,\n        55 => 55,\n        56 => 56,\n        57 => 57,\n        58 => 58,\n        59 => 59,\n        60 => 60,\n        61 => 61,\n        62 => 62,\n        71 => 62,\n        154 => 62,\n        158 => 62,\n        162 => 62,\n        163 => 62,\n        63 => 63,\n        155 => 63,\n        161 => 63,\n        64 => 64,\n        65 => 65,\n        66 => 65,\n        70 => 65,\n        67 => 67,\n        72 => 72,\n        73 => 73,\n        74 => 73,\n        78 => 78,\n        79 => 79,\n        80 => 79,\n        81 => 79,\n        83 => 83,\n        120 => 83,\n        84 => 84,\n        87 => 84,\n        98 => 84,\n        85 => 85,\n        86 => 86,\n        88 => 88,\n        89 => 89,\n        90 => 90,\n        95 => 90,\n        91 => 91,\n        94 => 91,\n        92 => 92,\n        97 => 92,\n        93 => 93,\n        96 => 93,\n        99 => 99,\n        100 => 100,\n        101 => 101,\n        104 => 104,\n        109 => 109,\n        110 => 110,\n        111 => 111,\n        112 => 112,\n        114 => 114,\n        117 => 117,\n        118 => 118,\n        119 => 119,\n        121 => 121,\n        122 => 122,\n        124 => 124,\n        125 => 125,\n        126 => 126,\n        128 => 128,\n        184 => 128,\n        129 => 129,\n        130 => 130,\n        131 => 131,\n        132 => 132,\n        133 => 133,\n        136 => 133,\n        134 => 134,\n        135 => 135,\n        137 => 137,\n        139 => 139,\n        140 => 140,\n        141 => 141,\n        142 => 142,\n        143 => 143,\n        144 => 144,\n        145 => 145,\n        146 => 146,\n        147 => 147,\n        148 => 148,\n        149 => 149,\n        150 => 150,\n        151 => 151,\n        152 => 152,\n        153 => 153,\n        156 => 156,\n        157 => 157,\n        159 => 159,\n        160 => 160,\n        167 => 167,\n        168 => 168,\n        169 => 169,\n        170 => 170,\n        171 => 171,\n        172 => 172,\n        173 => 173,\n        174 => 174,\n        175 => 175,\n        176 => 176,\n        177 => 177,\n        178 => 178,\n        179 => 179,\n        180 => 180,\n        181 => 181,\n        183 => 183,\n        185 => 185,\n        186 => 186,\n        188 => 188,\n        189 => 189,\n        190 => 190,\n        191 => 191,\n        192 => 192,\n        193 => 192,\n        195 => 192,\n        194 => 194,\n        196 => 196,\n        197 => 197,\n        198 => 198,\n    );\n#line 94 \"smarty_internal_templateparser.y\"\n    function yy_r0(){\n    $this->_retvalue = $this->root_buffer->to_smarty_php();\n    }\n#line 2145 \"smarty_internal_templateparser.php\"\n#line 102 \"smarty_internal_templateparser.y\"\n    function yy_r1(){\n    $this->current_buffer->append_subtree($this->yystack[$this->yyidx + 0]->minor);\n    }\n#line 2150 \"smarty_internal_templateparser.php\"\n#line 118 \"smarty_internal_templateparser.y\"\n    function yy_r4(){\n    if ($this->compiler->has_code) {\n        $tmp =''; foreach ($this->compiler->prefix_code as $code) {$tmp.=$code;} $this->compiler->prefix_code=array();\n        $this->_retvalue = new _smarty_tag($this, $this->compiler->processNocacheCode($tmp.$this->yystack[$this->yyidx + 0]->minor,true));\n    } else {\n        $this->_retvalue = new _smarty_tag($this, $this->yystack[$this->yyidx + 0]->minor);\n    }\n    $this->compiler->has_variable_string = false;\n    $this->block_nesting_level = count($this->compiler->_tag_stack);\n    }\n#line 2162 \"smarty_internal_templateparser.php\"\n#line 130 \"smarty_internal_templateparser.y\"\n    function yy_r5(){\n    $this->_retvalue = new _smarty_tag($this, '');\n    }\n#line 2167 \"smarty_internal_templateparser.php\"\n#line 135 \"smarty_internal_templateparser.y\"\n    function yy_r6(){\n    $this->_retvalue = new _smarty_text($this, $this->yystack[$this->yyidx + 0]->minor);\n    }\n#line 2172 \"smarty_internal_templateparser.php\"\n#line 140 \"smarty_internal_templateparser.y\"\n    function yy_r7(){\n    if ($this->php_handling == Smarty::PHP_PASSTHRU) {\n        $this->_retvalue = new _smarty_text($this, self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor));\n    } elseif ($this->php_handling == Smarty::PHP_QUOTE) {\n        $this->_retvalue = new _smarty_text($this, htmlspecialchars($this->yystack[$this->yyidx + 0]->minor, ENT_QUOTES));\n    } elseif ($this->php_handling == Smarty::PHP_ALLOW) {\n        if (!($this->smarty instanceof SmartyBC)) {\n            $this->compiler->trigger_template_error (self::Err3);\n        }\n        $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode('<?php', true));\n    } elseif ($this->php_handling == Smarty::PHP_REMOVE) {\n        $this->_retvalue = new _smarty_text($this, '');\n    }\n    }\n#line 2188 \"smarty_internal_templateparser.php\"\n#line 156 \"smarty_internal_templateparser.y\"\n    function yy_r8(){\n    if ($this->is_xml) {\n        $this->compiler->tag_nocache = true;\n        $this->is_xml = false;\n        $save = $this->template->has_nocache_code;\n        $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode(\"<?php echo '?>';?>\", $this->compiler, true));\n        $this->template->has_nocache_code = $save;\n    } elseif ($this->php_handling == Smarty::PHP_PASSTHRU) {\n        $this->_retvalue = new _smarty_text($this, '?<?php ?>>');\n    } elseif ($this->php_handling == Smarty::PHP_QUOTE) {\n        $this->_retvalue = new _smarty_text($this, htmlspecialchars('?>', ENT_QUOTES));\n    } elseif ($this->php_handling == Smarty::PHP_ALLOW) {\n        $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode('?>', true));\n    } elseif ($this->php_handling == Smarty::PHP_REMOVE) {\n        $this->_retvalue = new _smarty_text($this, '');\n    }\n    }\n#line 2207 \"smarty_internal_templateparser.php\"\n#line 175 \"smarty_internal_templateparser.y\"\n    function yy_r9(){\n    if ($this->php_handling == Smarty::PHP_PASSTHRU) {\n        $this->_retvalue = new _smarty_text($this, '<<?php ?>%');\n    } elseif ($this->php_handling == Smarty::PHP_QUOTE) {\n        $this->_retvalue = new _smarty_text($this, htmlspecialchars($this->yystack[$this->yyidx + 0]->minor, ENT_QUOTES));\n    } elseif ($this->php_handling == Smarty::PHP_ALLOW) {\n        if ($this->asp_tags) {\n            if (!($this->smarty instanceof SmartyBC)) {\n                $this->compiler->trigger_template_error (self::Err3);\n            }\n            $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode('<%', true));\n        } else {\n            $this->_retvalue = new _smarty_text($this, '<<?php ?>%');\n        }\n    } elseif ($this->php_handling == Smarty::PHP_REMOVE) {\n        if ($this->asp_tags) {\n            $this->_retvalue = new _smarty_text($this, '');\n        } else {\n            $this->_retvalue = new _smarty_text($this, '<<?php ?>%');\n        }\n    }\n    }\n#line 2231 \"smarty_internal_templateparser.php\"\n#line 199 \"smarty_internal_templateparser.y\"\n    function yy_r10(){\n    if ($this->php_handling == Smarty::PHP_PASSTHRU) {\n        $this->_retvalue = new _smarty_text($this, '%<?php ?>>');\n    } elseif ($this->php_handling == Smarty::PHP_QUOTE) {\n        $this->_retvalue = new _smarty_text($this, htmlspecialchars('%>', ENT_QUOTES));\n    } elseif ($this->php_handling == Smarty::PHP_ALLOW) {\n        if ($this->asp_tags) {\n            $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode('%>', true));\n        } else {\n            $this->_retvalue = new _smarty_text($this, '%<?php ?>>');\n        }\n    } elseif ($this->php_handling == Smarty::PHP_REMOVE) {\n        if ($this->asp_tags) {\n            $this->_retvalue = new _smarty_text($this, '');\n        } else {\n            $this->_retvalue = new _smarty_text($this, '%<?php ?>>');\n        }\n    }\n    }\n#line 2252 \"smarty_internal_templateparser.php\"\n#line 219 \"smarty_internal_templateparser.y\"\n    function yy_r11(){\n    if ($this->lex->strip) {\n        $this->_retvalue = new _smarty_text($this, preg_replace('![\\$this->yystack[$this->yyidx + 0]->minor ]*[\\r\\n]+[\\$this->yystack[$this->yyidx + 0]->minor ]*!', '', self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor)));\n    } else {\n        $this->_retvalue = new _smarty_text($this, self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor));\n    }\n    }\n#line 2261 \"smarty_internal_templateparser.php\"\n#line 228 \"smarty_internal_templateparser.y\"\n    function yy_r12(){\n    $this->compiler->tag_nocache = true;\n    $this->is_xml = true;\n    $save = $this->template->has_nocache_code;\n    $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode(\"<?php echo '<?xml';?>\", $this->compiler, true));\n    $this->template->has_nocache_code = $save;\n    }\n#line 2270 \"smarty_internal_templateparser.php\"\n#line 237 \"smarty_internal_templateparser.y\"\n    function yy_r13(){\n    if ($this->lex->strip) {\n        $this->_retvalue = new _smarty_text($this, preg_replace('![\\t ]*[\\r\\n]+[\\t ]*!', '', $this->yystack[$this->yyidx + 0]->minor));\n    } else {\n        $this->_retvalue = new _smarty_text($this, $this->yystack[$this->yyidx + 0]->minor);\n    }\n    }\n#line 2279 \"smarty_internal_templateparser.php\"\n#line 245 \"smarty_internal_templateparser.y\"\n    function yy_r14(){\n    $this->_retvalue = new _smarty_linebreak($this, $this->yystack[$this->yyidx + 0]->minor);\n    }\n#line 2284 \"smarty_internal_templateparser.php\"\n#line 250 \"smarty_internal_templateparser.y\"\n    function yy_r15(){\n    $this->_retvalue = '';\n    }\n#line 2289 \"smarty_internal_templateparser.php\"\n#line 254 \"smarty_internal_templateparser.y\"\n    function yy_r16(){\n    $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor;\n    }\n#line 2294 \"smarty_internal_templateparser.php\"\n#line 258 \"smarty_internal_templateparser.y\"\n    function yy_r17(){\n    $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 2299 \"smarty_internal_templateparser.php\"\n#line 266 \"smarty_internal_templateparser.y\"\n    function yy_r19(){\n    $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 2304 \"smarty_internal_templateparser.php\"\n#line 274 \"smarty_internal_templateparser.y\"\n    function yy_r21(){\n    $this->_retvalue = self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor);\n    }\n#line 2309 \"smarty_internal_templateparser.php\"\n#line 282 \"smarty_internal_templateparser.y\"\n    function yy_r23(){\n    $this->_retvalue = self::escape_end_tag($this->yystack[$this->yyidx + 0]->minor);\n    }\n#line 2314 \"smarty_internal_templateparser.php\"\n#line 286 \"smarty_internal_templateparser.y\"\n    function yy_r24(){\n    $this->_retvalue = '<<?php ?>%';\n    }\n#line 2319 \"smarty_internal_templateparser.php\"\n#line 290 \"smarty_internal_templateparser.y\"\n    function yy_r25(){\n    $this->_retvalue = '%<?php ?>>';\n    }\n#line 2324 \"smarty_internal_templateparser.php\"\n#line 300 \"smarty_internal_templateparser.y\"\n    function yy_r26(){\n    $this->_retvalue = $this->compiler->compileTag('private_print_expression',array(),array('value'=>$this->yystack[$this->yyidx + -1]->minor));\n    }\n#line 2329 \"smarty_internal_templateparser.php\"\n#line 304 \"smarty_internal_templateparser.y\"\n    function yy_r27(){\n    $this->_retvalue = $this->compiler->compileTag('private_print_expression',$this->yystack[$this->yyidx + -1]->minor,array('value'=>$this->yystack[$this->yyidx + -3]->minor, 'modifierlist'=>$this->yystack[$this->yyidx + -2]->minor));\n    }\n#line 2334 \"smarty_internal_templateparser.php\"\n#line 308 \"smarty_internal_templateparser.y\"\n    function yy_r28(){\n    $this->_retvalue = $this->compiler->compileTag('private_print_expression',$this->yystack[$this->yyidx + -1]->minor,array('value'=>$this->yystack[$this->yyidx + -2]->minor));\n    }\n#line 2339 \"smarty_internal_templateparser.php\"\n#line 312 \"smarty_internal_templateparser.y\"\n    function yy_r29(){\n    $this->_retvalue = $this->compiler->compileTag('private_print_expression',$this->yystack[$this->yyidx + -1]->minor,array('value'=>$this->yystack[$this->yyidx + -3]->minor,'modifierlist'=>$this->yystack[$this->yyidx + -2]->minor));\n    }\n#line 2344 \"smarty_internal_templateparser.php\"\n#line 325 \"smarty_internal_templateparser.y\"\n    function yy_r31(){\n    $this->_retvalue = $this->compiler->compileTag('assign',array(array('value'=>$this->yystack[$this->yyidx + -1]->minor),array('var'=>\"'\".$this->yystack[$this->yyidx + -3]->minor.\"'\")));\n    }\n#line 2349 \"smarty_internal_templateparser.php\"\n#line 333 \"smarty_internal_templateparser.y\"\n    function yy_r33(){\n    $this->_retvalue = $this->compiler->compileTag('assign',array_merge(array(array('value'=>$this->yystack[$this->yyidx + -2]->minor),array('var'=>\"'\".$this->yystack[$this->yyidx + -4]->minor.\"'\")),$this->yystack[$this->yyidx + -1]->minor));\n    }\n#line 2354 \"smarty_internal_templateparser.php\"\n#line 337 \"smarty_internal_templateparser.y\"\n    function yy_r34(){\n    $this->_retvalue = $this->compiler->compileTag('assign',array_merge(array(array('value'=>$this->yystack[$this->yyidx + -2]->minor),array('var'=>$this->yystack[$this->yyidx + -4]->minor['var'])),$this->yystack[$this->yyidx + -1]->minor),array('smarty_internal_index'=>$this->yystack[$this->yyidx + -4]->minor['smarty_internal_index']));\n    }\n#line 2359 \"smarty_internal_templateparser.php\"\n#line 342 \"smarty_internal_templateparser.y\"\n    function yy_r35(){\n    $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -2]->minor,$this->yystack[$this->yyidx + -1]->minor);\n    }\n#line 2364 \"smarty_internal_templateparser.php\"\n#line 346 \"smarty_internal_templateparser.y\"\n    function yy_r36(){\n    $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -1]->minor,array());\n    }\n#line 2369 \"smarty_internal_templateparser.php\"\n#line 351 \"smarty_internal_templateparser.y\"\n    function yy_r37(){\n    $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -4]->minor,$this->yystack[$this->yyidx + -1]->minor,array('object_methode'=>$this->yystack[$this->yyidx + -2]->minor));\n    }\n#line 2374 \"smarty_internal_templateparser.php\"\n#line 356 \"smarty_internal_templateparser.y\"\n    function yy_r38(){\n    $this->_retvalue = '<?php ob_start();?>'.$this->compiler->compileTag($this->yystack[$this->yyidx + -3]->minor,$this->yystack[$this->yyidx + -1]->minor).'<?php echo ';\n    $this->_retvalue .= $this->compiler->compileTag('private_modifier',array(),array('modifierlist'=>$this->yystack[$this->yyidx + -2]->minor,'value'=>'ob_get_clean()')).'?>';\n    }\n#line 2380 \"smarty_internal_templateparser.php\"\n#line 362 \"smarty_internal_templateparser.y\"\n    function yy_r39(){\n    $this->_retvalue = '<?php ob_start();?>'.$this->compiler->compileTag($this->yystack[$this->yyidx + -5]->minor,$this->yystack[$this->yyidx + -1]->minor,array('object_methode'=>$this->yystack[$this->yyidx + -3]->minor)).'<?php echo ';\n    $this->_retvalue .= $this->compiler->compileTag('private_modifier',array(),array('modifierlist'=>$this->yystack[$this->yyidx + -2]->minor,'value'=>'ob_get_clean()')).'?>';\n    }\n#line 2386 \"smarty_internal_templateparser.php\"\n#line 368 \"smarty_internal_templateparser.y\"\n    function yy_r40(){\n    $tag = trim(substr($this->yystack[$this->yyidx + -2]->minor,$this->lex->ldel_length));\n    $this->_retvalue = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,array(),array('if condition'=>$this->yystack[$this->yyidx + -1]->minor));\n    }\n#line 2392 \"smarty_internal_templateparser.php\"\n#line 373 \"smarty_internal_templateparser.y\"\n    function yy_r41(){\n    $tag = trim(substr($this->yystack[$this->yyidx + -3]->minor,$this->lex->ldel_length));\n    $this->_retvalue = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,$this->yystack[$this->yyidx + -1]->minor,array('if condition'=>$this->yystack[$this->yyidx + -2]->minor));\n    }\n#line 2398 \"smarty_internal_templateparser.php\"\n#line 378 \"smarty_internal_templateparser.y\"\n    function yy_r42(){\n    $tag = trim(substr($this->yystack[$this->yyidx + -2]->minor,$this->lex->ldel_length));\n    $this->_retvalue = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,array(),array('if condition'=>$this->yystack[$this->yyidx + -1]->minor));\n    }\n#line 2404 \"smarty_internal_templateparser.php\"\n#line 389 \"smarty_internal_templateparser.y\"\n    function yy_r44(){\n    $this->_retvalue = $this->compiler->compileTag('for',array_merge($this->yystack[$this->yyidx + -1]->minor,array(array('start'=>$this->yystack[$this->yyidx + -10]->minor),array('ifexp'=>$this->yystack[$this->yyidx + -7]->minor),array('var'=>$this->yystack[$this->yyidx + -3]->minor),array('step'=>$this->yystack[$this->yyidx + -2]->minor))),1);\n    }\n#line 2409 \"smarty_internal_templateparser.php\"\n#line 393 \"smarty_internal_templateparser.y\"\n    function yy_r45(){\n    $this->_retvalue = '='.$this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 2414 \"smarty_internal_templateparser.php\"\n#line 401 \"smarty_internal_templateparser.y\"\n    function yy_r47(){\n    $this->_retvalue = $this->compiler->compileTag('for',array_merge($this->yystack[$this->yyidx + -1]->minor,array(array('start'=>$this->yystack[$this->yyidx + -4]->minor),array('to'=>$this->yystack[$this->yyidx + -2]->minor))),0);\n    }\n#line 2419 \"smarty_internal_templateparser.php\"\n#line 405 \"smarty_internal_templateparser.y\"\n    function yy_r48(){\n    $this->_retvalue = $this->compiler->compileTag('for',array_merge($this->yystack[$this->yyidx + -1]->minor,array(array('start'=>$this->yystack[$this->yyidx + -6]->minor),array('to'=>$this->yystack[$this->yyidx + -4]->minor),array('step'=>$this->yystack[$this->yyidx + -2]->minor))),0);\n    }\n#line 2424 \"smarty_internal_templateparser.php\"\n#line 410 \"smarty_internal_templateparser.y\"\n    function yy_r49(){\n    $this->_retvalue = $this->compiler->compileTag('foreach',$this->yystack[$this->yyidx + -1]->minor);\n    }\n#line 2429 \"smarty_internal_templateparser.php\"\n#line 415 \"smarty_internal_templateparser.y\"\n    function yy_r50(){\n    $this->_retvalue = $this->compiler->compileTag('foreach',array_merge($this->yystack[$this->yyidx + -1]->minor,array(array('from'=>$this->yystack[$this->yyidx + -5]->minor),array('item'=>$this->yystack[$this->yyidx + -2]->minor))));\n    }\n#line 2434 \"smarty_internal_templateparser.php\"\n#line 419 \"smarty_internal_templateparser.y\"\n    function yy_r51(){\n    $this->_retvalue = $this->compiler->compileTag('foreach',array_merge($this->yystack[$this->yyidx + -1]->minor,array(array('from'=>$this->yystack[$this->yyidx + -8]->minor),array('item'=>$this->yystack[$this->yyidx + -2]->minor),array('key'=>$this->yystack[$this->yyidx + -5]->minor))));\n    }\n#line 2439 \"smarty_internal_templateparser.php\"\n#line 423 \"smarty_internal_templateparser.y\"\n    function yy_r52(){\n    $this->_retvalue = $this->compiler->compileTag('foreach',array_merge($this->yystack[$this->yyidx + -1]->minor,array(array('from'=>$this->yystack[$this->yyidx + -5]->minor),array('item'=>$this->yystack[$this->yyidx + -2]->minor))));\n    }\n#line 2444 \"smarty_internal_templateparser.php\"\n#line 427 \"smarty_internal_templateparser.y\"\n    function yy_r53(){\n    $this->_retvalue = $this->compiler->compileTag('foreach',array_merge($this->yystack[$this->yyidx + -1]->minor,array(array('from'=>$this->yystack[$this->yyidx + -8]->minor),array('item'=>$this->yystack[$this->yyidx + -2]->minor),array('key'=>$this->yystack[$this->yyidx + -5]->minor))));\n    }\n#line 2449 \"smarty_internal_templateparser.php\"\n#line 432 \"smarty_internal_templateparser.y\"\n    function yy_r54(){\n    $this->_retvalue = $this->compiler->compileTag('setfilter',array(),array('modifier_list'=>array(array_merge(array($this->yystack[$this->yyidx + -2]->minor),$this->yystack[$this->yyidx + -1]->minor))));\n    }\n#line 2454 \"smarty_internal_templateparser.php\"\n#line 436 \"smarty_internal_templateparser.y\"\n    function yy_r55(){\n    $this->_retvalue = $this->compiler->compileTag('setfilter',array(),array('modifier_list'=>array_merge(array(array_merge(array($this->yystack[$this->yyidx + -3]->minor),$this->yystack[$this->yyidx + -2]->minor)),$this->yystack[$this->yyidx + -1]->minor)));\n    }\n#line 2459 \"smarty_internal_templateparser.php\"\n#line 441 \"smarty_internal_templateparser.y\"\n    function yy_r56(){\n    $this->_retvalue = SMARTY_INTERNAL_COMPILE_BLOCK::compileChildBlock($this->compiler);\n    }\n#line 2464 \"smarty_internal_templateparser.php\"\n#line 447 \"smarty_internal_templateparser.y\"\n    function yy_r57(){\n    $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -1]->minor.'close',array());\n    }\n#line 2469 \"smarty_internal_templateparser.php\"\n#line 451 \"smarty_internal_templateparser.y\"\n    function yy_r58(){\n    $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -2]->minor.'close',array(),array('modifier_list'=>$this->yystack[$this->yyidx + -1]->minor));\n    }\n#line 2474 \"smarty_internal_templateparser.php\"\n#line 456 \"smarty_internal_templateparser.y\"\n    function yy_r59(){\n    $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -3]->minor.'close',array(),array('object_methode'=>$this->yystack[$this->yyidx + -1]->minor));\n    }\n#line 2479 \"smarty_internal_templateparser.php\"\n#line 460 \"smarty_internal_templateparser.y\"\n    function yy_r60(){\n    $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -4]->minor.'close',array(),array('object_methode'=>$this->yystack[$this->yyidx + -2]->minor, 'modifier_list'=>$this->yystack[$this->yyidx + -1]->minor));\n    }\n#line 2484 \"smarty_internal_templateparser.php\"\n#line 468 \"smarty_internal_templateparser.y\"\n    function yy_r61(){\n    $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor;\n    $this->_retvalue[] = $this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 2490 \"smarty_internal_templateparser.php\"\n#line 474 \"smarty_internal_templateparser.y\"\n    function yy_r62(){\n    $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor);\n    }\n#line 2495 \"smarty_internal_templateparser.php\"\n#line 479 \"smarty_internal_templateparser.y\"\n    function yy_r63(){\n    $this->_retvalue = array();\n    }\n#line 2500 \"smarty_internal_templateparser.php\"\n#line 484 \"smarty_internal_templateparser.y\"\n    function yy_r64(){\n    if (preg_match('~^true$~i', $this->yystack[$this->yyidx + 0]->minor)) {\n        $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor=>'true');\n    } elseif (preg_match('~^false$~i', $this->yystack[$this->yyidx + 0]->minor)) {\n        $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor=>'false');\n    } elseif (preg_match('~^null$~i', $this->yystack[$this->yyidx + 0]->minor)) {\n        $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor=>'null');\n    } else {\n        $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor=>\"'\".$this->yystack[$this->yyidx + 0]->minor.\"'\");\n    }\n    }\n#line 2513 \"smarty_internal_templateparser.php\"\n#line 496 \"smarty_internal_templateparser.y\"\n    function yy_r65(){\n    $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor=>$this->yystack[$this->yyidx + 0]->minor);\n    }\n#line 2518 \"smarty_internal_templateparser.php\"\n#line 504 \"smarty_internal_templateparser.y\"\n    function yy_r67(){\n    $this->_retvalue = \"'\".$this->yystack[$this->yyidx + 0]->minor.\"'\";\n    }\n#line 2523 \"smarty_internal_templateparser.php\"\n#line 529 \"smarty_internal_templateparser.y\"\n    function yy_r72(){\n    $this->yystack[$this->yyidx + -2]->minor[]=$this->yystack[$this->yyidx + 0]->minor;\n    $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor;\n    }\n#line 2529 \"smarty_internal_templateparser.php\"\n#line 534 \"smarty_internal_templateparser.y\"\n    function yy_r73(){\n    $this->_retvalue = array('var' => $this->yystack[$this->yyidx + -2]->minor, 'value'=>$this->yystack[$this->yyidx + 0]->minor);\n    }\n#line 2534 \"smarty_internal_templateparser.php\"\n#line 562 \"smarty_internal_templateparser.y\"\n    function yy_r78(){\n    $this->_retvalue = '$_smarty_tpl->getStreamVariable(\\''. $this->yystack[$this->yyidx + -2]->minor .'://'. $this->yystack[$this->yyidx + 0]->minor . '\\')';\n    }\n#line 2539 \"smarty_internal_templateparser.php\"\n#line 567 \"smarty_internal_templateparser.y\"\n    function yy_r79(){\n    $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor . trim($this->yystack[$this->yyidx + -1]->minor) . $this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 2544 \"smarty_internal_templateparser.php\"\n#line 586 \"smarty_internal_templateparser.y\"\n    function yy_r83(){\n    $this->_retvalue = $this->compiler->compileTag('private_modifier',array(),array('value'=>$this->yystack[$this->yyidx + -1]->minor,'modifierlist'=>$this->yystack[$this->yyidx + 0]->minor));\n    }\n#line 2549 \"smarty_internal_templateparser.php\"\n#line 592 \"smarty_internal_templateparser.y\"\n    function yy_r84(){\n    $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 2554 \"smarty_internal_templateparser.php\"\n#line 596 \"smarty_internal_templateparser.y\"\n    function yy_r85(){\n    $this->_retvalue = 'in_array('.$this->yystack[$this->yyidx + -2]->minor.','.$this->yystack[$this->yyidx + 0]->minor.')';\n    }\n#line 2559 \"smarty_internal_templateparser.php\"\n#line 600 \"smarty_internal_templateparser.y\"\n    function yy_r86(){\n    $this->_retvalue = 'in_array('.$this->yystack[$this->yyidx + -2]->minor.',(array)'.$this->yystack[$this->yyidx + 0]->minor.')';\n    }\n#line 2564 \"smarty_internal_templateparser.php\"\n#line 608 \"smarty_internal_templateparser.y\"\n    function yy_r88(){\n    $this->_retvalue = '!('.$this->yystack[$this->yyidx + -2]->minor.' % '.$this->yystack[$this->yyidx + 0]->minor.')';\n    }\n#line 2569 \"smarty_internal_templateparser.php\"\n#line 612 \"smarty_internal_templateparser.y\"\n    function yy_r89(){\n    $this->_retvalue = '('.$this->yystack[$this->yyidx + -2]->minor.' % '.$this->yystack[$this->yyidx + 0]->minor.')';\n    }\n#line 2574 \"smarty_internal_templateparser.php\"\n#line 616 \"smarty_internal_templateparser.y\"\n    function yy_r90(){\n    $this->_retvalue = '!(1 & '.$this->yystack[$this->yyidx + -1]->minor.')';\n    }\n#line 2579 \"smarty_internal_templateparser.php\"\n#line 620 \"smarty_internal_templateparser.y\"\n    function yy_r91(){\n    $this->_retvalue = '(1 & '.$this->yystack[$this->yyidx + -1]->minor.')';\n    }\n#line 2584 \"smarty_internal_templateparser.php\"\n#line 624 \"smarty_internal_templateparser.y\"\n    function yy_r92(){\n    $this->_retvalue = '!(1 & '.$this->yystack[$this->yyidx + -2]->minor.' / '.$this->yystack[$this->yyidx + 0]->minor.')';\n    }\n#line 2589 \"smarty_internal_templateparser.php\"\n#line 628 \"smarty_internal_templateparser.y\"\n    function yy_r93(){\n    $this->_retvalue = '(1 & '.$this->yystack[$this->yyidx + -2]->minor.' / '.$this->yystack[$this->yyidx + 0]->minor.')';\n    }\n#line 2594 \"smarty_internal_templateparser.php\"\n#line 652 \"smarty_internal_templateparser.y\"\n    function yy_r99(){\n    $this->prefix_number++;\n    $this->compiler->prefix_code[] = '<?php $_tmp'.$this->prefix_number.'='.$this->yystack[$this->yyidx + 0]->minor.';?>';\n    $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + -1]->minor.'$_tmp'.$this->prefix_number;\n    }\n#line 2601 \"smarty_internal_templateparser.php\"\n#line 661 \"smarty_internal_templateparser.y\"\n    function yy_r100(){\n    $this->_retvalue = $this->yystack[$this->yyidx + -6]->minor.' ? '. $this->compileVariable(\"'\".$this->yystack[$this->yyidx + -2]->minor.\"'\") . ' : '.$this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 2606 \"smarty_internal_templateparser.php\"\n#line 665 \"smarty_internal_templateparser.y\"\n    function yy_r101(){\n    $this->_retvalue = $this->yystack[$this->yyidx + -5]->minor.' ? '.$this->yystack[$this->yyidx + -2]->minor.' : '.$this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 2611 \"smarty_internal_templateparser.php\"\n#line 680 \"smarty_internal_templateparser.y\"\n    function yy_r104(){\n    $this->_retvalue = '!'.$this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 2616 \"smarty_internal_templateparser.php\"\n#line 701 \"smarty_internal_templateparser.y\"\n    function yy_r109(){\n    $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'.'.$this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 2621 \"smarty_internal_templateparser.php\"\n#line 705 \"smarty_internal_templateparser.y\"\n    function yy_r110(){\n    $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.'.';\n    }\n#line 2626 \"smarty_internal_templateparser.php\"\n#line 709 \"smarty_internal_templateparser.y\"\n    function yy_r111(){\n    $this->_retvalue = '.'.$this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 2631 \"smarty_internal_templateparser.php\"\n#line 714 \"smarty_internal_templateparser.y\"\n    function yy_r112(){\n    if (preg_match('~^true$~i', $this->yystack[$this->yyidx + 0]->minor)) {\n        $this->_retvalue = 'true';\n    } elseif (preg_match('~^false$~i', $this->yystack[$this->yyidx + 0]->minor)) {\n        $this->_retvalue = 'false';\n    } elseif (preg_match('~^null$~i', $this->yystack[$this->yyidx + 0]->minor)) {\n        $this->_retvalue = 'null';\n    } else {\n        $this->_retvalue = \"'\".$this->yystack[$this->yyidx + 0]->minor.\"'\";\n    }\n    }\n#line 2644 \"smarty_internal_templateparser.php\"\n#line 732 \"smarty_internal_templateparser.y\"\n    function yy_r114(){\n    $this->_retvalue = \"(\". $this->yystack[$this->yyidx + -1]->minor .\")\";\n    }\n#line 2649 \"smarty_internal_templateparser.php\"\n#line 747 \"smarty_internal_templateparser.y\"\n    function yy_r117(){\n    if (!$this->security || isset($this->smarty->registered_classes[$this->yystack[$this->yyidx + -2]->minor]) || $this->smarty->security_policy->isTrustedStaticClass($this->yystack[$this->yyidx + -2]->minor, $this->compiler)) {\n        if (isset($this->smarty->registered_classes[$this->yystack[$this->yyidx + -2]->minor])) {\n            $this->_retvalue = $this->smarty->registered_classes[$this->yystack[$this->yyidx + -2]->minor].'::'.$this->yystack[$this->yyidx + 0]->minor;\n        } else {\n            $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'::'.$this->yystack[$this->yyidx + 0]->minor;\n        }\n    } else {\n        $this->compiler->trigger_template_error (\"static class '\".$this->yystack[$this->yyidx + -2]->minor.\"' is undefined or not allowed by security setting\");\n    }\n    }\n#line 2662 \"smarty_internal_templateparser.php\"\n#line 759 \"smarty_internal_templateparser.y\"\n    function yy_r118(){\n    if ($this->yystack[$this->yyidx + -2]->minor['var'] == '\\'smarty\\'') {\n        $this->_retvalue =  $this->compiler->compileTag('private_special_variable',array(),$this->yystack[$this->yyidx + -2]->minor['smarty_internal_index']).'::'.$this->yystack[$this->yyidx + 0]->minor;\n    } else {\n        $this->_retvalue = $this->compileVariable($this->yystack[$this->yyidx + -2]->minor['var']).$this->yystack[$this->yyidx + -2]->minor['smarty_internal_index'].'::'.$this->yystack[$this->yyidx + 0]->minor;\n    }\n    }\n#line 2671 \"smarty_internal_templateparser.php\"\n#line 768 \"smarty_internal_templateparser.y\"\n    function yy_r119(){\n    $this->prefix_number++;\n    $this->compiler->prefix_code[] = '<?php ob_start();?>'.$this->yystack[$this->yyidx + 0]->minor.'<?php $_tmp'.$this->prefix_number.'=ob_get_clean();?>';\n    $this->_retvalue = '$_tmp'.$this->prefix_number;\n    }\n#line 2678 \"smarty_internal_templateparser.php\"\n#line 783 \"smarty_internal_templateparser.y\"\n    function yy_r121(){\n    if ($this->yystack[$this->yyidx + 0]->minor['var'] == '\\'smarty\\'') {\n        $smarty_var = $this->compiler->compileTag('private_special_variable',array(),$this->yystack[$this->yyidx + 0]->minor['smarty_internal_index']);\n        $this->_retvalue = $smarty_var;\n    } else {\n        // used for array reset,next,prev,end,current\n        $this->last_variable = $this->yystack[$this->yyidx + 0]->minor['var'];\n        $this->last_index = $this->yystack[$this->yyidx + 0]->minor['smarty_internal_index'];\n        $this->_retvalue = $this->compileVariable($this->yystack[$this->yyidx + 0]->minor['var']).$this->yystack[$this->yyidx + 0]->minor['smarty_internal_index'];\n    }\n    }\n#line 2691 \"smarty_internal_templateparser.php\"\n#line 796 \"smarty_internal_templateparser.y\"\n    function yy_r122(){\n    $this->_retvalue = '$_smarty_tpl->tpl_vars['. $this->yystack[$this->yyidx + -2]->minor .']->'.$this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 2696 \"smarty_internal_templateparser.php\"\n#line 806 \"smarty_internal_templateparser.y\"\n    function yy_r124(){\n    $this->_retvalue = '$_smarty_tpl->getConfigVariable(\\''. $this->yystack[$this->yyidx + -1]->minor .'\\')';\n    }\n#line 2701 \"smarty_internal_templateparser.php\"\n#line 810 \"smarty_internal_templateparser.y\"\n    function yy_r125(){\n    $this->_retvalue = '$_smarty_tpl->getConfigVariable('. $this->yystack[$this->yyidx + -1]->minor .')';\n    }\n#line 2706 \"smarty_internal_templateparser.php\"\n#line 814 \"smarty_internal_templateparser.y\"\n    function yy_r126(){\n    $this->_retvalue = array('var'=>$this->yystack[$this->yyidx + -1]->minor, 'smarty_internal_index'=>$this->yystack[$this->yyidx + 0]->minor);\n    }\n#line 2711 \"smarty_internal_templateparser.php\"\n#line 827 \"smarty_internal_templateparser.y\"\n    function yy_r128(){\n    return;\n    }\n#line 2716 \"smarty_internal_templateparser.php\"\n#line 833 \"smarty_internal_templateparser.y\"\n    function yy_r129(){\n    $this->_retvalue = '['.$this->compileVariable($this->yystack[$this->yyidx + 0]->minor).']';\n    }\n#line 2721 \"smarty_internal_templateparser.php\"\n#line 837 \"smarty_internal_templateparser.y\"\n    function yy_r130(){\n    $this->_retvalue = '['.$this->compileVariable($this->yystack[$this->yyidx + -2]->minor).'->'.$this->yystack[$this->yyidx + 0]->minor.']';\n    }\n#line 2726 \"smarty_internal_templateparser.php\"\n#line 841 \"smarty_internal_templateparser.y\"\n    function yy_r131(){\n    $this->_retvalue = \"['\". $this->yystack[$this->yyidx + 0]->minor .\"']\";\n    }\n#line 2731 \"smarty_internal_templateparser.php\"\n#line 845 \"smarty_internal_templateparser.y\"\n    function yy_r132(){\n    $this->_retvalue = \"[\". $this->yystack[$this->yyidx + 0]->minor .\"]\";\n    }\n#line 2736 \"smarty_internal_templateparser.php\"\n#line 849 \"smarty_internal_templateparser.y\"\n    function yy_r133(){\n    $this->_retvalue = \"[\". $this->yystack[$this->yyidx + -1]->minor .\"]\";\n    }\n#line 2741 \"smarty_internal_templateparser.php\"\n#line 854 \"smarty_internal_templateparser.y\"\n    function yy_r134(){\n    $this->_retvalue = '['.$this->compiler->compileTag('private_special_variable',array(),'[\\'section\\'][\\''.$this->yystack[$this->yyidx + -1]->minor.'\\'][\\'index\\']').']';\n    }\n#line 2746 \"smarty_internal_templateparser.php\"\n#line 858 \"smarty_internal_templateparser.y\"\n    function yy_r135(){\n    $this->_retvalue = '['.$this->compiler->compileTag('private_special_variable',array(),'[\\'section\\'][\\''.$this->yystack[$this->yyidx + -3]->minor.'\\'][\\''.$this->yystack[$this->yyidx + -1]->minor.'\\']').']';\n    }\n#line 2751 \"smarty_internal_templateparser.php\"\n#line 868 \"smarty_internal_templateparser.y\"\n    function yy_r137(){\n    $this->_retvalue = '[]';\n    }\n#line 2756 \"smarty_internal_templateparser.php\"\n#line 881 \"smarty_internal_templateparser.y\"\n    function yy_r139(){\n    $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.'.'.$this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 2761 \"smarty_internal_templateparser.php\"\n#line 886 \"smarty_internal_templateparser.y\"\n    function yy_r140(){\n    $this->_retvalue = '\\''.$this->yystack[$this->yyidx + 0]->minor.'\\'';\n    }\n#line 2766 \"smarty_internal_templateparser.php\"\n#line 891 \"smarty_internal_templateparser.y\"\n    function yy_r141(){\n    $this->_retvalue = '('.$this->yystack[$this->yyidx + -1]->minor.')';\n    }\n#line 2771 \"smarty_internal_templateparser.php\"\n#line 898 \"smarty_internal_templateparser.y\"\n    function yy_r142(){\n    if ($this->yystack[$this->yyidx + -1]->minor['var'] == '\\'smarty\\'') {\n        $this->_retvalue =  $this->compiler->compileTag('private_special_variable',array(),$this->yystack[$this->yyidx + -1]->minor['smarty_internal_index']).$this->yystack[$this->yyidx + 0]->minor;\n    } else {\n        $this->_retvalue = $this->compileVariable($this->yystack[$this->yyidx + -1]->minor['var']).$this->yystack[$this->yyidx + -1]->minor['smarty_internal_index'].$this->yystack[$this->yyidx + 0]->minor;\n    }\n    }\n#line 2780 \"smarty_internal_templateparser.php\"\n#line 907 \"smarty_internal_templateparser.y\"\n    function yy_r143(){\n    $this->_retvalue  = $this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 2785 \"smarty_internal_templateparser.php\"\n#line 912 \"smarty_internal_templateparser.y\"\n    function yy_r144(){\n    $this->_retvalue  = $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 2790 \"smarty_internal_templateparser.php\"\n#line 917 \"smarty_internal_templateparser.y\"\n    function yy_r145(){\n    if ($this->security && substr($this->yystack[$this->yyidx + -1]->minor,0,1) == '_') {\n        $this->compiler->trigger_template_error (self::Err1);\n    }\n    $this->_retvalue = '->'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 2798 \"smarty_internal_templateparser.php\"\n#line 924 \"smarty_internal_templateparser.y\"\n    function yy_r146(){\n    if ($this->security) {\n        $this->compiler->trigger_template_error (self::Err2);\n    }\n    $this->_retvalue = '->{'.$this->compileVariable($this->yystack[$this->yyidx + -1]->minor).$this->yystack[$this->yyidx + 0]->minor.'}';\n    }\n#line 2806 \"smarty_internal_templateparser.php\"\n#line 931 \"smarty_internal_templateparser.y\"\n    function yy_r147(){\n    if ($this->security) {\n        $this->compiler->trigger_template_error (self::Err2);\n    }\n    $this->_retvalue = '->{'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + 0]->minor.'}';\n    }\n#line 2814 \"smarty_internal_templateparser.php\"\n#line 938 \"smarty_internal_templateparser.y\"\n    function yy_r148(){\n    if ($this->security) {\n        $this->compiler->trigger_template_error (self::Err2);\n    }\n    $this->_retvalue = '->{\\''.$this->yystack[$this->yyidx + -4]->minor.'\\'.'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + 0]->minor.'}';\n    }\n#line 2822 \"smarty_internal_templateparser.php\"\n#line 946 \"smarty_internal_templateparser.y\"\n    function yy_r149(){\n    $this->_retvalue = '->'.$this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 2827 \"smarty_internal_templateparser.php\"\n#line 954 \"smarty_internal_templateparser.y\"\n    function yy_r150(){\n    if (!$this->security || $this->smarty->security_policy->isTrustedPhpFunction($this->yystack[$this->yyidx + -3]->minor, $this->compiler)) {\n        if (strcasecmp($this->yystack[$this->yyidx + -3]->minor,'isset') === 0 || strcasecmp($this->yystack[$this->yyidx + -3]->minor,'empty') === 0 || strcasecmp($this->yystack[$this->yyidx + -3]->minor,'array') === 0 || is_callable($this->yystack[$this->yyidx + -3]->minor)) {\n            $func_name = strtolower($this->yystack[$this->yyidx + -3]->minor);\n            if ($func_name == 'isset') {\n                if (count($this->yystack[$this->yyidx + -1]->minor) == 0) {\n                    $this->compiler->trigger_template_error ('Illegal number of paramer in \"isset()\"');\n                }\n                $par = implode(',',$this->yystack[$this->yyidx + -1]->minor);\n                if (strncasecmp($par,'$_smarty_tpl->getConfigVariable',strlen('$_smarty_tpl->getConfigVariable')) === 0) {\n                    $this->prefix_number++;\n                    $this->compiler->prefix_code[] = '<?php $_tmp'.$this->prefix_number.'='.str_replace(')',', false)',$par).';?>';\n                    $isset_par = '$_tmp'.$this->prefix_number;\n                } else {\n                    $isset_par=str_replace(\"')->value\",\"',null,true,false)->value\",$par);\n                }\n                $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor . \"(\". $isset_par .\")\";\n            } elseif (in_array($func_name,array('empty','reset','current','end','prev','next'))){\n                if (count($this->yystack[$this->yyidx + -1]->minor) != 1) {\n                    $this->compiler->trigger_template_error ('Illegal number of paramer in \"empty()\"');\n                }\n                if ($func_name == 'empty') {\n                    $this->_retvalue = $func_name.'('.str_replace(\"')->value\",\"',null,true,false)->value\",$this->yystack[$this->yyidx + -1]->minor[0]).')';\n                } else {\n                    $this->_retvalue = $func_name.'('.$this->yystack[$this->yyidx + -1]->minor[0].')';\n                }\n            } else {\n                $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor . \"(\". implode(',',$this->yystack[$this->yyidx + -1]->minor) .\")\";\n            }\n        } else {\n            $this->compiler->trigger_template_error (\"unknown function \\\"\" . $this->yystack[$this->yyidx + -3]->minor . \"\\\"\");\n        }\n    }\n    }\n#line 2863 \"smarty_internal_templateparser.php\"\n#line 992 \"smarty_internal_templateparser.y\"\n    function yy_r151(){\n    if ($this->security && substr($this->yystack[$this->yyidx + -3]->minor,0,1) == '_') {\n        $this->compiler->trigger_template_error (self::Err1);\n    }\n    $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor . \"(\". implode(',',$this->yystack[$this->yyidx + -1]->minor) .\")\";\n    }\n#line 2871 \"smarty_internal_templateparser.php\"\n#line 999 \"smarty_internal_templateparser.y\"\n    function yy_r152(){\n    if ($this->security) {\n        $this->compiler->trigger_template_error (self::Err2);\n    }\n    $this->prefix_number++;\n    $this->compiler->prefix_code[] = '<?php $_tmp'.$this->prefix_number.'='.$this->compileVariable(\"'\".$this->yystack[$this->yyidx + -3]->minor.\"'\").';?>';\n    $this->_retvalue = '$_tmp'.$this->prefix_number.'('. implode(',',$this->yystack[$this->yyidx + -1]->minor) .')';\n    }\n#line 2881 \"smarty_internal_templateparser.php\"\n#line 1010 \"smarty_internal_templateparser.y\"\n    function yy_r153(){\n    $this->_retvalue = array_merge($this->yystack[$this->yyidx + -2]->minor,array($this->yystack[$this->yyidx + 0]->minor));\n    }\n#line 2886 \"smarty_internal_templateparser.php\"\n#line 1027 \"smarty_internal_templateparser.y\"\n    function yy_r156(){\n    $this->_retvalue = array_merge($this->yystack[$this->yyidx + -2]->minor,array(array_merge($this->yystack[$this->yyidx + -1]->minor,$this->yystack[$this->yyidx + 0]->minor)));\n    }\n#line 2891 \"smarty_internal_templateparser.php\"\n#line 1031 \"smarty_internal_templateparser.y\"\n    function yy_r157(){\n    $this->_retvalue = array(array_merge($this->yystack[$this->yyidx + -1]->minor,$this->yystack[$this->yyidx + 0]->minor));\n    }\n#line 2896 \"smarty_internal_templateparser.php\"\n#line 1039 \"smarty_internal_templateparser.y\"\n    function yy_r159(){\n    $this->_retvalue =  array($this->yystack[$this->yyidx + 0]->minor);\n    }\n#line 2901 \"smarty_internal_templateparser.php\"\n#line 1047 \"smarty_internal_templateparser.y\"\n    function yy_r160(){\n    $this->_retvalue = array_merge($this->yystack[$this->yyidx + -1]->minor,$this->yystack[$this->yyidx + 0]->minor);\n    }\n#line 2906 \"smarty_internal_templateparser.php\"\n#line 1081 \"smarty_internal_templateparser.y\"\n    function yy_r167(){\n    $this->_retvalue = '$'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 2911 \"smarty_internal_templateparser.php\"\n#line 1086 \"smarty_internal_templateparser.y\"\n    function yy_r168(){\n    $this->_retvalue = '$'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 2916 \"smarty_internal_templateparser.php\"\n#line 1092 \"smarty_internal_templateparser.y\"\n    function yy_r169(){\n    $this->_retvalue = '==';\n    }\n#line 2921 \"smarty_internal_templateparser.php\"\n#line 1096 \"smarty_internal_templateparser.y\"\n    function yy_r170(){\n    $this->_retvalue = '!=';\n    }\n#line 2926 \"smarty_internal_templateparser.php\"\n#line 1100 \"smarty_internal_templateparser.y\"\n    function yy_r171(){\n    $this->_retvalue = '>';\n    }\n#line 2931 \"smarty_internal_templateparser.php\"\n#line 1104 \"smarty_internal_templateparser.y\"\n    function yy_r172(){\n    $this->_retvalue = '<';\n    }\n#line 2936 \"smarty_internal_templateparser.php\"\n#line 1108 \"smarty_internal_templateparser.y\"\n    function yy_r173(){\n    $this->_retvalue = '>=';\n    }\n#line 2941 \"smarty_internal_templateparser.php\"\n#line 1112 \"smarty_internal_templateparser.y\"\n    function yy_r174(){\n    $this->_retvalue = '<=';\n    }\n#line 2946 \"smarty_internal_templateparser.php\"\n#line 1116 \"smarty_internal_templateparser.y\"\n    function yy_r175(){\n    $this->_retvalue = '===';\n    }\n#line 2951 \"smarty_internal_templateparser.php\"\n#line 1120 \"smarty_internal_templateparser.y\"\n    function yy_r176(){\n    $this->_retvalue = '!==';\n    }\n#line 2956 \"smarty_internal_templateparser.php\"\n#line 1124 \"smarty_internal_templateparser.y\"\n    function yy_r177(){\n    $this->_retvalue = '%';\n    }\n#line 2961 \"smarty_internal_templateparser.php\"\n#line 1128 \"smarty_internal_templateparser.y\"\n    function yy_r178(){\n    $this->_retvalue = '&&';\n    }\n#line 2966 \"smarty_internal_templateparser.php\"\n#line 1132 \"smarty_internal_templateparser.y\"\n    function yy_r179(){\n    $this->_retvalue = '||';\n    }\n#line 2971 \"smarty_internal_templateparser.php\"\n#line 1136 \"smarty_internal_templateparser.y\"\n    function yy_r180(){\n    $this->_retvalue = ' XOR ';\n    }\n#line 2976 \"smarty_internal_templateparser.php\"\n#line 1143 \"smarty_internal_templateparser.y\"\n    function yy_r181(){\n    $this->_retvalue = 'array('.$this->yystack[$this->yyidx + -1]->minor.')';\n    }\n#line 2981 \"smarty_internal_templateparser.php\"\n#line 1151 \"smarty_internal_templateparser.y\"\n    function yy_r183(){\n    $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.','.$this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 2986 \"smarty_internal_templateparser.php\"\n#line 1159 \"smarty_internal_templateparser.y\"\n    function yy_r185(){\n    $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'=>'.$this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 2991 \"smarty_internal_templateparser.php\"\n#line 1163 \"smarty_internal_templateparser.y\"\n    function yy_r186(){\n    $this->_retvalue = '\\''.$this->yystack[$this->yyidx + -2]->minor.'\\'=>'.$this->yystack[$this->yyidx + 0]->minor;\n    }\n#line 2996 \"smarty_internal_templateparser.php\"\n#line 1175 \"smarty_internal_templateparser.y\"\n    function yy_r188(){\n    $this->_retvalue = \"''\";\n    }\n#line 3001 \"smarty_internal_templateparser.php\"\n#line 1179 \"smarty_internal_templateparser.y\"\n    function yy_r189(){\n    $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor->to_smarty_php();\n    }\n#line 3006 \"smarty_internal_templateparser.php\"\n#line 1184 \"smarty_internal_templateparser.y\"\n    function yy_r190(){\n    $this->yystack[$this->yyidx + -1]->minor->append_subtree($this->yystack[$this->yyidx + 0]->minor);\n    $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor;\n    }\n#line 3012 \"smarty_internal_templateparser.php\"\n#line 1189 \"smarty_internal_templateparser.y\"\n    function yy_r191(){\n    $this->_retvalue = new _smarty_doublequoted($this, $this->yystack[$this->yyidx + 0]->minor);\n    }\n#line 3017 \"smarty_internal_templateparser.php\"\n#line 1193 \"smarty_internal_templateparser.y\"\n    function yy_r192(){\n    $this->_retvalue = new _smarty_code($this, $this->yystack[$this->yyidx + -1]->minor);\n    }\n#line 3022 \"smarty_internal_templateparser.php\"\n#line 1201 \"smarty_internal_templateparser.y\"\n    function yy_r194(){\n    $this->_retvalue = new _smarty_code($this, '$_smarty_tpl->tpl_vars[\\''. substr($this->yystack[$this->yyidx + 0]->minor,1) .'\\']->value');\n    }\n#line 3027 \"smarty_internal_templateparser.php\"\n#line 1209 \"smarty_internal_templateparser.y\"\n    function yy_r196(){\n    $this->_retvalue = new _smarty_code($this, '('.$this->yystack[$this->yyidx + -1]->minor.')');\n    }\n#line 3032 \"smarty_internal_templateparser.php\"\n#line 1213 \"smarty_internal_templateparser.y\"\n    function yy_r197(){\n    $this->_retvalue = new _smarty_tag($this, $this->yystack[$this->yyidx + 0]->minor);\n    }\n#line 3037 \"smarty_internal_templateparser.php\"\n#line 1217 \"smarty_internal_templateparser.y\"\n    function yy_r198(){\n    $this->_retvalue = new _smarty_dq_content($this, $this->yystack[$this->yyidx + 0]->minor);\n    }\n#line 3042 \"smarty_internal_templateparser.php\"\n\n    private $_retvalue;\n\n    function yy_reduce($yyruleno)\n    {\n        $yymsp = $this->yystack[$this->yyidx];\n        if (self::$yyTraceFILE && $yyruleno >= 0\n              && $yyruleno < count(self::$yyRuleName)) {\n            fprintf(self::$yyTraceFILE, \"%sReduce (%d) [%s].\\n\",\n                self::$yyTracePrompt, $yyruleno,\n                self::$yyRuleName[$yyruleno]);\n        }\n\n        $this->_retvalue = $yy_lefthand_side = null;\n        if (array_key_exists($yyruleno, self::$yyReduceMap)) {\n            // call the action\n            $this->_retvalue = null;\n            $this->{'yy_r' . self::$yyReduceMap[$yyruleno]}();\n            $yy_lefthand_side = $this->_retvalue;\n        }\n        $yygoto = self::$yyRuleInfo[$yyruleno]['lhs'];\n        $yysize = self::$yyRuleInfo[$yyruleno]['rhs'];\n        $this->yyidx -= $yysize;\n        for($i = $yysize; $i; $i--) {\n            // pop all of the right-hand side parameters\n            array_pop($this->yystack);\n        }\n        $yyact = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, $yygoto);\n        if ($yyact < self::YYNSTATE) {\n            if (!self::$yyTraceFILE && $yysize) {\n                $this->yyidx++;\n                $x = new TP_yyStackEntry;\n                $x->stateno = $yyact;\n                $x->major = $yygoto;\n                $x->minor = $yy_lefthand_side;\n                $this->yystack[$this->yyidx] = $x;\n            } else {\n                $this->yy_shift($yyact, $yygoto, $yy_lefthand_side);\n            }\n        } elseif ($yyact == self::YYNSTATE + self::YYNRULE + 1) {\n            $this->yy_accept();\n        }\n    }\n\n    function yy_parse_failed()\n    {\n        if (self::$yyTraceFILE) {\n            fprintf(self::$yyTraceFILE, \"%sFail!\\n\", self::$yyTracePrompt);\n        }\n        while ($this->yyidx >= 0) {\n            $this->yy_pop_parser_stack();\n        }\n    }\n\n    function yy_syntax_error($yymajor, $TOKEN)\n    {\n#line 76 \"smarty_internal_templateparser.y\"\n\n    $this->internalError = true;\n    $this->yymajor = $yymajor;\n    $this->compiler->trigger_template_error();\n#line 3105 \"smarty_internal_templateparser.php\"\n    }\n\n    function yy_accept()\n    {\n        if (self::$yyTraceFILE) {\n            fprintf(self::$yyTraceFILE, \"%sAccept!\\n\", self::$yyTracePrompt);\n        }\n        while ($this->yyidx >= 0) {\n            $stack = $this->yy_pop_parser_stack();\n        }\n#line 68 \"smarty_internal_templateparser.y\"\n\n    $this->successful = !$this->internalError;\n    $this->internalError = false;\n    $this->retvalue = $this->_retvalue;\n    //echo $this->retvalue.\"\\n\\n\";\n#line 3123 \"smarty_internal_templateparser.php\"\n    }\n\n    function doParse($yymajor, $yytokenvalue)\n    {\n        $yyerrorhit = 0;   /* True if yymajor has invoked an error */\n\n        if ($this->yyidx === null || $this->yyidx < 0) {\n            $this->yyidx = 0;\n            $this->yyerrcnt = -1;\n            $x = new TP_yyStackEntry;\n            $x->stateno = 0;\n            $x->major = 0;\n            $this->yystack = array();\n            array_push($this->yystack, $x);\n        }\n        $yyendofinput = ($yymajor==0);\n\n        if (self::$yyTraceFILE) {\n            fprintf(self::$yyTraceFILE, \"%sInput %s\\n\",\n                self::$yyTracePrompt, $this->yyTokenName[$yymajor]);\n        }\n\n        do {\n            $yyact = $this->yy_find_shift_action($yymajor);\n            if ($yymajor < self::YYERRORSYMBOL &&\n                  !$this->yy_is_expected_token($yymajor)) {\n                // force a syntax error\n                $yyact = self::YY_ERROR_ACTION;\n            }\n            if ($yyact < self::YYNSTATE) {\n                $this->yy_shift($yyact, $yymajor, $yytokenvalue);\n                $this->yyerrcnt--;\n                if ($yyendofinput && $this->yyidx >= 0) {\n                    $yymajor = 0;\n                } else {\n                    $yymajor = self::YYNOCODE;\n                }\n            } elseif ($yyact < self::YYNSTATE + self::YYNRULE) {\n                $this->yy_reduce($yyact - self::YYNSTATE);\n            } elseif ($yyact == self::YY_ERROR_ACTION) {\n                if (self::$yyTraceFILE) {\n                    fprintf(self::$yyTraceFILE, \"%sSyntax Error!\\n\",\n                        self::$yyTracePrompt);\n                }\n                if (self::YYERRORSYMBOL) {\n                    if ($this->yyerrcnt < 0) {\n                        $this->yy_syntax_error($yymajor, $yytokenvalue);\n                    }\n                    $yymx = $this->yystack[$this->yyidx]->major;\n                    if ($yymx == self::YYERRORSYMBOL || $yyerrorhit ){\n                        if (self::$yyTraceFILE) {\n                            fprintf(self::$yyTraceFILE, \"%sDiscard input token %s\\n\",\n                                self::$yyTracePrompt, $this->yyTokenName[$yymajor]);\n                        }\n                        $this->yy_destructor($yymajor, $yytokenvalue);\n                        $yymajor = self::YYNOCODE;\n                    } else {\n                        while ($this->yyidx >= 0 &&\n                                 $yymx != self::YYERRORSYMBOL &&\n        ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE\n                              ){\n                            $this->yy_pop_parser_stack();\n                        }\n                        if ($this->yyidx < 0 || $yymajor==0) {\n                            $this->yy_destructor($yymajor, $yytokenvalue);\n                            $this->yy_parse_failed();\n                            $yymajor = self::YYNOCODE;\n                        } elseif ($yymx != self::YYERRORSYMBOL) {\n                            $u2 = 0;\n                            $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2);\n                        }\n                    }\n                    $this->yyerrcnt = 3;\n                    $yyerrorhit = 1;\n                } else {\n                    if ($this->yyerrcnt <= 0) {\n                        $this->yy_syntax_error($yymajor, $yytokenvalue);\n                    }\n                    $this->yyerrcnt = 3;\n                    $this->yy_destructor($yymajor, $yytokenvalue);\n                    if ($yyendofinput) {\n                        $this->yy_parse_failed();\n                    }\n                    $yymajor = self::YYNOCODE;\n                }\n            } else {\n                $this->yy_accept();\n                $yymajor = self::YYNOCODE;\n            }\n        } while ($yymajor != self::YYNOCODE && $this->yyidx >= 0);\n    }\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_utility.php",
    "content": "<?php\n/**\n * Project:     Smarty: the PHP compiling template engine\n * File:        smarty_internal_utility.php\n * SVN:         $Id: smarty_internal_utility.php 2504 2011-12-28 07:35:29Z liu21st $\n *\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n *\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this library; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n *\n * For questions, help, comments, discussion, etc., please join the\n * Smarty mailing list. Send a blank e-mail to\n * smarty-discussion-subscribe@googlegroups.com\n *\n * @link http://www.smarty.net/\n * @copyright 2008 New Digital Group, Inc.\n * @author Monte Ohrt <monte at ohrt dot com>\n * @author Uwe Tews\n * @package Smarty\n * @subpackage PluginsInternal\n * @version 3-SVN$Rev: 3286 $\n */\n\n\n/**\n * Utility class\n *\n * @package Smarty\n * @subpackage Security\n */\nclass Smarty_Internal_Utility {\n\n    /**\n     * private constructor to prevent calls creation of new instances\n     */\n    private final function __construct()\n    {\n        // intentionally left blank\n    }\n\n    /**\n     * Compile all template files\n     *\n     * @param string $extension     template file name extension\n     * @param bool   $force_compile force all to recompile\n     * @param int    $time_limit    set maximum execution time\n     * @param int    $max_errors    set maximum allowed errors\n     * @param Smarty $smarty        Smarty instance\n     * @return integer number of template files compiled\n     */\n    public static function compileAllTemplates($extention, $force_compile, $time_limit, $max_errors, Smarty $smarty)\n    {\n        // switch off time limit\n        if (function_exists('set_time_limit')) {\n            @set_time_limit($time_limit);\n        }\n        $smarty->force_compile = $force_compile;\n        $_count = 0;\n        $_error_count = 0;\n        // loop over array of template directories\n        foreach($smarty->getTemplateDir() as $_dir) {\n            $_compileDirs = new RecursiveDirectoryIterator($_dir);\n            $_compile = new RecursiveIteratorIterator($_compileDirs);\n            foreach ($_compile as $_fileinfo) {\n                if (substr($_fileinfo->getBasename(),0,1) == '.' || strpos($_fileinfo, '.svn') !== false) continue;\n                $_file = $_fileinfo->getFilename();\n                if (!substr_compare($_file, $extention, - strlen($extention)) == 0) continue;\n                if ($_fileinfo->getPath() == substr($_dir, 0, -1)) {\n                   $_template_file = $_file;\n                } else {\n                   $_template_file = substr($_fileinfo->getPath(), strlen($_dir)) . DS . $_file;\n                }\n                echo '<br>', $_dir, '---', $_template_file;\n                flush();\n                $_start_time = microtime(true);\n                try {\n                    $_tpl = $smarty->createTemplate($_template_file,null,null,null,false);\n                    if ($_tpl->mustCompile()) {\n                        $_tpl->compileTemplateSource();\n                        echo ' compiled in  ', microtime(true) - $_start_time, ' seconds';\n                        flush();\n                    } else {\n                        echo ' is up to date';\n                        flush();\n                    }\n                }\n                catch (Exception $e) {\n                    echo 'Error: ', $e->getMessage(), \"<br><br>\";\n                    $_error_count++;\n                }\n                // free memory\n                $smarty->template_objects = array();\n                $_tpl->smarty->template_objects = array();\n                $_tpl = null;\n                if ($max_errors !== null && $_error_count == $max_errors) {\n                    echo '<br><br>too many errors';\n                    exit();\n                }\n            }\n        }\n        return $_count;\n    }\n\n    /**\n     * Compile all config files\n     *\n     * @param string $extension     config file name extension\n     * @param bool   $force_compile force all to recompile\n     * @param int    $time_limit    set maximum execution time\n     * @param int    $max_errors    set maximum allowed errors\n     * @param Smarty $smarty        Smarty instance\n     * @return integer number of config files compiled\n     */\n    public static function compileAllConfig($extention, $force_compile, $time_limit, $max_errors, Smarty $smarty)\n    {\n        // switch off time limit\n        if (function_exists('set_time_limit')) {\n            @set_time_limit($time_limit);\n        }\n        $smarty->force_compile = $force_compile;\n        $_count = 0;\n        $_error_count = 0;\n        // loop over array of template directories\n        foreach($smarty->getConfigDir() as $_dir) {\n            $_compileDirs = new RecursiveDirectoryIterator($_dir);\n            $_compile = new RecursiveIteratorIterator($_compileDirs);\n            foreach ($_compile as $_fileinfo) {\n                if (substr($_fileinfo->getBasename(),0,1) == '.' || strpos($_fileinfo, '.svn') !== false) continue;\n                $_file = $_fileinfo->getFilename();\n                if (!substr_compare($_file, $extention, - strlen($extention)) == 0) continue;\n                if ($_fileinfo->getPath() == substr($_dir, 0, -1)) {\n                    $_config_file = $_file;\n                } else {\n                    $_config_file = substr($_fileinfo->getPath(), strlen($_dir)) . DS . $_file;\n                }\n                echo '<br>', $_dir, '---', $_config_file;\n                flush();\n                $_start_time = microtime(true);\n                try {\n                    $_config = new Smarty_Internal_Config($_config_file, $smarty);\n                    if ($_config->mustCompile()) {\n                        $_config->compileConfigSource();\n                        echo ' compiled in  ', microtime(true) - $_start_time, ' seconds';\n                        flush();\n                    } else {\n                        echo ' is up to date';\n                        flush();\n                    }\n                }\n                catch (Exception $e) {\n                    echo 'Error: ', $e->getMessage(), \"<br><br>\";\n                    $_error_count++;\n                }\n                if ($max_errors !== null && $_error_count == $max_errors) {\n                    echo '<br><br>too many errors';\n                    exit();\n                }\n            }\n        }\n        return $_count;\n    }\n\n    /**\n     * Delete compiled template file\n     *\n     * @param string  $resource_name template name\n     * @param string  $compile_id    compile id\n     * @param integer $exp_time      expiration time\n     * @param Smarty  $smarty        Smarty instance\n     * @return integer number of template files deleted\n     */\n    public static function clearCompiledTemplate($resource_name, $compile_id, $exp_time, Smarty $smarty)\n    {\n        $_compile_dir = $smarty->getCompileDir();\n        $_compile_id = isset($compile_id) ? preg_replace('![^\\w\\|]+!', '_', $compile_id) : null;\n        $_dir_sep = $smarty->use_sub_dirs ? DS : '^';\n        if (isset($resource_name)) {\n            $_save_stat = $smarty->caching;\n            $smarty->caching = false;\n            $tpl = new $smarty->template_class($resource_name, $smarty);\n            $smarty->caching = $_save_stat;\n\n            // remove from template cache\n            $tpl->source; // have the template registered before unset()\n            if ($smarty->allow_ambiguous_resources) {\n                $_templateId = $tpl->source->unique_resource . $tpl->cache_id . $tpl->compile_id;\n            } else {\n                $_templateId = $smarty->joined_template_dir . '#' . $resource_name . $tpl->cache_id . $tpl->compile_id;\n            }\n            if (isset($_templateId[150])) {\n                $_templateId = sha1($_templateId);\n            }\n            unset($smarty->template_objects[$_templateId]);\n\n            if ($tpl->source->exists) {\n                 $_resource_part_1 = basename(str_replace('^', '/', $tpl->compiled->filepath));\n                 $_resource_part_1_length = strlen($_resource_part_1);\n            } else {\n                return 0;\n            }\n\n            $_resource_part_2 = str_replace('.php','.cache.php',$_resource_part_1);\n            $_resource_part_2_length = strlen($_resource_part_2);\n        } else {\n            $_resource_part = '';\n        }\n        $_dir = $_compile_dir;\n        if ($smarty->use_sub_dirs && isset($_compile_id)) {\n            $_dir .= $_compile_id . $_dir_sep;\n        }\n        if (isset($_compile_id)) {\n            $_compile_id_part = $_compile_dir . $_compile_id . $_dir_sep;\n            $_compile_id_part_length = strlen($_compile_id_part);\n        }\n        $_count = 0;\n        try {\n            $_compileDirs = new RecursiveDirectoryIterator($_dir);\n        // NOTE: UnexpectedValueException thrown for PHP >= 5.3\n        } catch (Exception $e) {\n            return 0;\n        }\n        $_compile = new RecursiveIteratorIterator($_compileDirs, RecursiveIteratorIterator::CHILD_FIRST);\n        foreach ($_compile as $_file) {\n            if (substr($_file->getBasename(), 0, 1) == '.' || strpos($_file, '.svn') !== false)\n                continue;\n\n            $_filepath = (string) $_file;\n\n            if ($_file->isDir()) {\n                if (!$_compile->isDot()) {\n                    // delete folder if empty\n                    @rmdir($_file->getPathname());\n                }\n            } else {\n                $unlink = false;\n                if ((!isset($_compile_id) || (isset($_filepath[$_compile_id_part_length]) && !strncmp($_filepath, $_compile_id_part, $_compile_id_part_length)))\n                    && (!isset($resource_name)\n                        || (isset($_filepath[$_resource_part_1_length])\n                            && substr_compare($_filepath, $_resource_part_1, -$_resource_part_1_length, $_resource_part_1_length) == 0)\n                        || (isset($_filepath[$_resource_part_2_length])\n                            && substr_compare($_filepath, $_resource_part_2, -$_resource_part_2_length, $_resource_part_2_length) == 0))) {\n                    if (isset($exp_time)) {\n                        if (time() - @filemtime($_filepath) >= $exp_time) {\n                            $unlink = true;\n                        }\n                    } else {\n                        $unlink = true;\n                    }\n                }\n\n                if ($unlink && @unlink($_filepath)) {\n                    $_count++;\n                }\n            }\n        }\n        // clear compiled cache\n        Smarty_Resource::$sources = array();\n        Smarty_Resource::$compileds = array();\n        return $_count;\n    }\n\n    /**\n     * Return array of tag/attributes of all tags used by an template\n     *\n     * @param Smarty_Internal_Template $templae template object\n     * @return array of tag/attributes\n     */\n    public static function getTags(Smarty_Internal_Template $template)\n    {\n        $template->smarty->get_used_tags = true;\n        $template->compileTemplateSource();\n        return $template->used_tags;\n    }\n\n\n    /**\n     * diagnose Smarty setup\n     *\n     * If $errors is secified, the diagnostic report will be appended to the array, rather than being output.\n     *\n     * @param Smarty $smarty  Smarty instance to test\n     * @param array  $errors array to push results into rather than outputting them\n     * @return bool status, true if everything is fine, false else\n     */\n    public static function testInstall(Smarty $smarty, &$errors=null)\n    {\n        $status = true;\n\n        if ($errors === null) {\n            echo \"<PRE>\\n\";\n            echo \"Smarty Installation test...\\n\";\n            echo \"Testing template directory...\\n\";\n        }\n\n        // test if all registered template_dir are accessible\n        foreach($smarty->getTemplateDir() as $template_dir) {\n            $_template_dir = $template_dir;\n            $template_dir = realpath($template_dir);\n            // resolve include_path or fail existance\n            if (!$template_dir) {\n                if ($smarty->use_include_path && !preg_match('/^([\\/\\\\\\\\]|[a-zA-Z]:[\\/\\\\\\\\])/', $_template_dir)) {\n                    // try PHP include_path\n                    if (($template_dir = Smarty_Internal_Get_Include_Path::getIncludePath($_template_dir)) !== false) {\n                        if ($errors === null) {\n                            echo \"$template_dir is OK.\\n\";\n                        }\n\n                        continue;\n                    } else {\n                        $status = false;\n                        $message = \"FAILED: $_template_dir does not exist (and couldn't be found in include_path either)\";\n                        if ($errors === null) {\n                            echo $message . \".\\n\";\n                        } else {\n                            $errors['template_dir'] = $message;\n                        }\n\n                        continue;\n                    }\n                } else {\n                    $status = false;\n                    $message = \"FAILED: $_template_dir does not exist\";\n                    if ($errors === null) {\n                        echo $message . \".\\n\";\n                    } else {\n                        $errors['template_dir'] = $message;\n                    }\n\n                    continue;\n                }\n            }\n\n            if (!is_dir($template_dir)) {\n                $status = false;\n                $message = \"FAILED: $template_dir is not a directory\";\n                if ($errors === null) {\n                    echo $message . \".\\n\";\n                } else {\n                    $errors['template_dir'] = $message;\n                }\n            } elseif (!is_readable($template_dir)) {\n                $status = false;\n                $message = \"FAILED: $template_dir is not readable\";\n                if ($errors === null) {\n                    echo $message . \".\\n\";\n                } else {\n                    $errors['template_dir'] = $message;\n                }\n            } else {\n                if ($errors === null) {\n                    echo \"$template_dir is OK.\\n\";\n                }\n            }\n        }\n\n\n        if ($errors === null) {\n            echo \"Testing compile directory...\\n\";\n        }\n\n        // test if registered compile_dir is accessible\n        $__compile_dir = $smarty->getCompileDir();\n        $_compile_dir = realpath($__compile_dir);\n        if (!$_compile_dir) {\n            $status = false;\n            $message = \"FAILED: {$__compile_dir} does not exist\";\n            if ($errors === null) {\n                echo $message . \".\\n\";\n            } else {\n                $errors['compile_dir'] = $message;\n            }\n        } elseif (!is_dir($_compile_dir)) {\n            $status = false;\n            $message = \"FAILED: {$_compile_dir} is not a directory\";\n            if ($errors === null) {\n                echo $message . \".\\n\";\n            } else {\n                $errors['compile_dir'] = $message;\n            }\n        } elseif (!is_readable($_compile_dir)) {\n            $status = false;\n            $message = \"FAILED: {$_compile_dir} is not readable\";\n            if ($errors === null) {\n                echo $message . \".\\n\";\n            } else {\n                $errors['compile_dir'] = $message;\n            }\n        } elseif (!is_writable($_compile_dir)) {\n            $status = false;\n            $message = \"FAILED: {$_compile_dir} is not writable\";\n            if ($errors === null) {\n                echo $message . \".\\n\";\n            } else {\n                $errors['compile_dir'] = $message;\n            }\n        } else {\n            if ($errors === null) {\n                echo \"{$_compile_dir} is OK.\\n\";\n            }\n        }\n\n\n        if ($errors === null) {\n            echo \"Testing plugins directory...\\n\";\n        }\n\n        // test if all registered plugins_dir are accessible\n        // and if core plugins directory is still registered\n        $_core_plugins_dir = realpath(dirname(__FILE__) .'/../plugins');\n        $_core_plugins_available = false;\n        foreach($smarty->getPluginsDir() as $plugin_dir) {\n            $_plugin_dir = $plugin_dir;\n            $plugin_dir = realpath($plugin_dir);\n            // resolve include_path or fail existance\n            if (!$plugin_dir) {\n                if ($smarty->use_include_path && !preg_match('/^([\\/\\\\\\\\]|[a-zA-Z]:[\\/\\\\\\\\])/', $_plugin_dir)) {\n                    // try PHP include_path\n                    if (($plugin_dir = Smarty_Internal_Get_Include_Path::getIncludePath($_plugin_dir)) !== false) {\n                        if ($errors === null) {\n                            echo \"$plugin_dir is OK.\\n\";\n                        }\n\n                        continue;\n                    } else {\n                        $status = false;\n                        $message = \"FAILED: $_plugin_dir does not exist (and couldn't be found in include_path either)\";\n                        if ($errors === null) {\n                            echo $message . \".\\n\";\n                        } else {\n                            $errors['plugins_dir'] = $message;\n                        }\n\n                        continue;\n                    }\n                } else {\n                    $status = false;\n                    $message = \"FAILED: $_plugin_dir does not exist\";\n                    if ($errors === null) {\n                        echo $message . \".\\n\";\n                    } else {\n                        $errors['plugins_dir'] = $message;\n                    }\n\n                    continue;\n                }\n            }\n\n            if (!is_dir($plugin_dir)) {\n                $status = false;\n                $message = \"FAILED: $plugin_dir is not a directory\";\n                if ($errors === null) {\n                    echo $message . \".\\n\";\n                } else {\n                    $errors['plugins_dir'] = $message;\n                }\n            } elseif (!is_readable($plugin_dir)) {\n                $status = false;\n                $message = \"FAILED: $plugin_dir is not readable\";\n                if ($errors === null) {\n                    echo $message . \".\\n\";\n                } else {\n                    $errors['plugins_dir'] = $message;\n                }\n            } elseif ($_core_plugins_dir && $_core_plugins_dir == realpath($plugin_dir)) {\n                $_core_plugins_available = true;\n                if ($errors === null) {\n                    echo \"$plugin_dir is OK.\\n\";\n                }\n            } else {\n                if ($errors === null) {\n                    echo \"$plugin_dir is OK.\\n\";\n                }\n            }\n        }\n        if (!$_core_plugins_available) {\n            $status = false;\n            $message = \"WARNING: Smarty's own libs/plugins is not available\";\n            if ($errors === null) {\n                echo $message . \".\\n\";\n            } elseif (!isset($errors['plugins_dir'])) {\n                $errors['plugins_dir'] = $message;\n            }\n        }\n\n        if ($errors === null) {\n            echo \"Testing cache directory...\\n\";\n        }\n\n\n        // test if all registered cache_dir is accessible\n        $__cache_dir = $smarty->getCacheDir();\n        $_cache_dir = realpath($__cache_dir);\n        if (!$_cache_dir) {\n            $status = false;\n            $message = \"FAILED: {$__cache_dir} does not exist\";\n            if ($errors === null) {\n                echo $message . \".\\n\";\n            } else {\n                $errors['cache_dir'] = $message;\n            }\n        } elseif (!is_dir($_cache_dir)) {\n            $status = false;\n            $message = \"FAILED: {$_cache_dir} is not a directory\";\n            if ($errors === null) {\n                echo $message . \".\\n\";\n            } else {\n                $errors['cache_dir'] = $message;\n            }\n        } elseif (!is_readable($_cache_dir)) {\n            $status = false;\n            $message = \"FAILED: {$_cache_dir} is not readable\";\n            if ($errors === null) {\n                echo $message . \".\\n\";\n            } else {\n                $errors['cache_dir'] = $message;\n            }\n        } elseif (!is_writable($_cache_dir)) {\n            $status = false;\n            $message = \"FAILED: {$_cache_dir} is not writable\";\n            if ($errors === null) {\n                echo $message . \".\\n\";\n            } else {\n                $errors['cache_dir'] = $message;\n            }\n        } else {\n            if ($errors === null) {\n                echo \"{$_cache_dir} is OK.\\n\";\n            }\n        }\n\n\n        if ($errors === null) {\n            echo \"Testing configs directory...\\n\";\n        }\n\n        // test if all registered config_dir are accessible\n        foreach($smarty->getConfigDir() as $config_dir) {\n            $_config_dir = $config_dir;\n            $config_dir = realpath($config_dir);\n            // resolve include_path or fail existance\n            if (!$config_dir) {\n                if ($smarty->use_include_path && !preg_match('/^([\\/\\\\\\\\]|[a-zA-Z]:[\\/\\\\\\\\])/', $_config_dir)) {\n                    // try PHP include_path\n                    if (($config_dir = Smarty_Internal_Get_Include_Path::getIncludePath($_config_dir)) !== false) {\n                        if ($errors === null) {\n                            echo \"$config_dir is OK.\\n\";\n                        }\n\n                        continue;\n                    } else {\n                        $status = false;\n                        $message = \"FAILED: $_config_dir does not exist (and couldn't be found in include_path either)\";\n                        if ($errors === null) {\n                            echo $message . \".\\n\";\n                        } else {\n                            $errors['config_dir'] = $message;\n                        }\n\n                        continue;\n                    }\n                } else {\n                    $status = false;\n                    $message = \"FAILED: $_config_dir does not exist\";\n                    if ($errors === null) {\n                        echo $message . \".\\n\";\n                    } else {\n                        $errors['config_dir'] = $message;\n                    }\n\n                    continue;\n                }\n            }\n\n            if (!is_dir($config_dir)) {\n                $status = false;\n                $message = \"FAILED: $config_dir is not a directory\";\n                if ($errors === null) {\n                    echo $message . \".\\n\";\n                } else {\n                    $errors['config_dir'] = $message;\n                }\n            } elseif (!is_readable($config_dir)) {\n                $status = false;\n                $message = \"FAILED: $config_dir is not readable\";\n                if ($errors === null) {\n                    echo $message . \".\\n\";\n                } else {\n                    $errors['config_dir'] = $message;\n                }\n            } else {\n                if ($errors === null) {\n                    echo \"$config_dir is OK.\\n\";\n                }\n            }\n        }\n\n\n        if ($errors === null) {\n            echo \"Testing sysplugin files...\\n\";\n        }\n        // test if sysplugins are available\n        $source = SMARTY_SYSPLUGINS_DIR;\n        if (is_dir($source)) {\n            $expected = array(\n                \"smarty_cacheresource.php\" => true,\n                \"smarty_cacheresource_custom.php\" => true,\n                \"smarty_cacheresource_keyvaluestore.php\" => true,\n                \"smarty_config_source.php\" => true,\n                \"smarty_internal_cacheresource_file.php\" => true,\n                \"smarty_internal_compile_append.php\" => true,\n                \"smarty_internal_compile_assign.php\" => true,\n                \"smarty_internal_compile_block.php\" => true,\n                \"smarty_internal_compile_break.php\" => true,\n                \"smarty_internal_compile_call.php\" => true,\n                \"smarty_internal_compile_capture.php\" => true,\n                \"smarty_internal_compile_config_load.php\" => true,\n                \"smarty_internal_compile_continue.php\" => true,\n                \"smarty_internal_compile_debug.php\" => true,\n                \"smarty_internal_compile_eval.php\" => true,\n                \"smarty_internal_compile_extends.php\" => true,\n                \"smarty_internal_compile_for.php\" => true,\n                \"smarty_internal_compile_foreach.php\" => true,\n                \"smarty_internal_compile_function.php\" => true,\n                \"smarty_internal_compile_if.php\" => true,\n                \"smarty_internal_compile_include.php\" => true,\n                \"smarty_internal_compile_include_php.php\" => true,\n                \"smarty_internal_compile_insert.php\" => true,\n                \"smarty_internal_compile_ldelim.php\" => true,\n                \"smarty_internal_compile_nocache.php\" => true,\n                \"smarty_internal_compile_private_block_plugin.php\" => true,\n                \"smarty_internal_compile_private_function_plugin.php\" => true,\n                \"smarty_internal_compile_private_modifier.php\" => true,\n                \"smarty_internal_compile_private_object_block_function.php\" => true,\n                \"smarty_internal_compile_private_object_function.php\" => true,\n                \"smarty_internal_compile_private_print_expression.php\" => true,\n                \"smarty_internal_compile_private_registered_block.php\" => true,\n                \"smarty_internal_compile_private_registered_function.php\" => true,\n                \"smarty_internal_compile_private_special_variable.php\" => true,\n                \"smarty_internal_compile_rdelim.php\" => true,\n                \"smarty_internal_compile_section.php\" => true,\n                \"smarty_internal_compile_setfilter.php\" => true,\n                \"smarty_internal_compile_while.php\" => true,\n                \"smarty_internal_compilebase.php\" => true,\n                \"smarty_internal_config.php\" => true,\n                \"smarty_internal_config_file_compiler.php\" => true,\n                \"smarty_internal_configfilelexer.php\" => true,\n                \"smarty_internal_configfileparser.php\" => true,\n                \"smarty_internal_data.php\" => true,\n                \"smarty_internal_debug.php\" => true,\n                \"smarty_internal_filter_handler.php\" => true,\n                \"smarty_internal_function_call_handler.php\" => true,\n                \"smarty_internal_get_include_path.php\" => true,\n                \"smarty_internal_nocache_insert.php\" => true,\n                \"smarty_internal_parsetree.php\" => true,\n                \"smarty_internal_resource_eval.php\" => true,\n                \"smarty_internal_resource_extends.php\" => true,\n                \"smarty_internal_resource_file.php\" => true,\n                \"smarty_internal_resource_registered.php\" => true,\n                \"smarty_internal_resource_stream.php\" => true,\n                \"smarty_internal_resource_string.php\" => true,\n                \"smarty_internal_smartytemplatecompiler.php\" => true,\n                \"smarty_internal_template.php\" => true,\n                \"smarty_internal_templatebase.php\" => true,\n                \"smarty_internal_templatecompilerbase.php\" => true,\n                \"smarty_internal_templatelexer.php\" => true,\n                \"smarty_internal_templateparser.php\" => true,\n                \"smarty_internal_utility.php\" => true,\n                \"smarty_internal_write_file.php\" => true,\n                \"smarty_resource.php\" => true,\n                \"smarty_resource_custom.php\" => true,\n                \"smarty_resource_recompiled.php\" => true,\n                \"smarty_resource_uncompiled.php\" => true,\n                \"smarty_security.php\" => true,\n            );\n            $iterator = new DirectoryIterator($source);\n            foreach ($iterator as $file) {\n                if (!$file->isDot()) {\n                    $filename = $file->getFilename();\n                    if (isset($expected[$filename])) {\n                        unset($expected[$filename]);\n                    }\n                }\n            }\n            if ($expected) {\n                $status = false;\n                $message = \"FAILED: files missing from libs/sysplugins: \". join(', ', array_keys($expected));\n                if ($errors === null) {\n                    echo $message . \".\\n\";\n                } else {\n                    $errors['sysplugins'] = $message;\n                }\n            } elseif ($errors === null) {\n                echo \"... OK\\n\";\n            }\n        } else {\n            $status = false;\n            $message = \"FAILED: \". SMARTY_SYSPLUGINS_DIR .' is not a directory';\n            if ($errors === null) {\n                echo $message . \".\\n\";\n            } else {\n                $errors['sysplugins_dir_constant'] = $message;\n            }\n        }\n\n        if ($errors === null) {\n            echo \"Testing plugin files...\\n\";\n        }\n        // test if core plugins are available\n        $source = SMARTY_PLUGINS_DIR;\n        if (is_dir($source)) {\n            $expected = array(\n                \"block.textformat.php\" => true,\n                \"function.counter.php\" => true,\n                \"function.cycle.php\" => true,\n                \"function.fetch.php\" => true,\n                \"function.html_checkboxes.php\" => true,\n                \"function.html_image.php\" => true,\n                \"function.html_options.php\" => true,\n                \"function.html_radios.php\" => true,\n                \"function.html_select_date.php\" => true,\n                \"function.html_select_time.php\" => true,\n                \"function.html_table.php\" => true,\n                \"function.mailto.php\" => true,\n                \"function.math.php\" => true,\n                \"modifier.capitalize.php\" => true,\n                \"modifier.date_format.php\" => true,\n                \"modifier.debug_print_var.php\" => true,\n                \"modifier.escape.php\" => true,\n                \"modifier.regex_replace.php\" => true,\n                \"modifier.replace.php\" => true,\n                \"modifier.spacify.php\" => true,\n                \"modifier.truncate.php\" => true,\n                \"modifiercompiler.cat.php\" => true,\n                \"modifiercompiler.count_characters.php\" => true,\n                \"modifiercompiler.count_paragraphs.php\" => true,\n                \"modifiercompiler.count_sentences.php\" => true,\n                \"modifiercompiler.count_words.php\" => true,\n                \"modifiercompiler.default.php\" => true,\n                \"modifiercompiler.escape.php\" => true,\n                \"modifiercompiler.from_charset.php\" => true,\n                \"modifiercompiler.indent.php\" => true,\n                \"modifiercompiler.lower.php\" => true,\n                \"modifiercompiler.noprint.php\" => true,\n                \"modifiercompiler.string_format.php\" => true,\n                \"modifiercompiler.strip.php\" => true,\n                \"modifiercompiler.strip_tags.php\" => true,\n                \"modifiercompiler.to_charset.php\" => true,\n                \"modifiercompiler.unescape.php\" => true,\n                \"modifiercompiler.upper.php\" => true,\n                \"modifiercompiler.wordwrap.php\" => true,\n                \"outputfilter.trimwhitespace.php\" => true,\n                \"shared.escape_special_chars.php\" => true,\n                \"shared.literal_compiler_param.php\" => true,\n                \"shared.make_timestamp.php\" => true,\n                \"shared.mb_str_replace.php\" => true,\n                \"shared.mb_unicode.php\" => true,\n                \"shared.mb_wordwrap.php\" => true,\n                \"variablefilter.htmlspecialchars.php\" => true,\n            );\n            $iterator = new DirectoryIterator($source);\n            foreach ($iterator as $file) {\n                if (!$file->isDot()) {\n                    $filename = $file->getFilename();\n                    if (isset($expected[$filename])) {\n                        unset($expected[$filename]);\n                    }\n                }\n            }\n            if ($expected) {\n                $status = false;\n                $message = \"FAILED: files missing from libs/plugins: \". join(', ', array_keys($expected));\n                if ($errors === null) {\n                    echo $message . \".\\n\";\n                } else {\n                    $errors['plugins'] = $message;\n                }\n            } elseif ($errors === null) {\n                echo \"... OK\\n\";\n            }\n        } else {\n            $status = false;\n            $message = \"FAILED: \". SMARTY_PLUGINS_DIR .' is not a directory';\n            if ($errors === null) {\n                echo $message . \".\\n\";\n            } else {\n                $errors['plugins_dir_constant'] = $message;\n            }\n        }\n\n        if ($errors === null) {\n            echo \"Tests complete.\\n\";\n            echo \"</PRE>\\n\";\n        }\n\n        return $status;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_internal_write_file.php",
    "content": "<?php\n/**\n * Smarty write file plugin\n *\n * @package Smarty\n * @subpackage PluginsInternal\n * @author Monte Ohrt\n */\n\n/**\n * Smarty Internal Write File Class\n *\n * @package Smarty\n * @subpackage PluginsInternal\n */\nclass Smarty_Internal_Write_File {\n\n    /**\n     * Writes file in a safe way to disk\n     *\n     * @param string $_filepath complete filepath\n     * @param string $_contents file content\n     * @param Smarty $smarty    smarty instance\n     * @return boolean true\n     */\n    public static function writeFile($_filepath, $_contents, Smarty $smarty)\n    {\n        $_error_reporting = error_reporting();\n        error_reporting($_error_reporting & ~E_NOTICE & ~E_WARNING);\n        if ($smarty->_file_perms !== null) {\n            $old_umask = umask(0);\n        }\n\n        $_dirpath = dirname($_filepath);\n        // if subdirs, create dir structure\n        if ($_dirpath !== '.' && !file_exists($_dirpath)) {\n            mkdir($_dirpath, $smarty->_dir_perms === null ? 0777 : $smarty->_dir_perms, true);\n        }\n\n        // write to tmp file, then move to overt file lock race condition\n        $_tmp_file = $_dirpath . DS . uniqid('wrt');\n        if (!file_put_contents($_tmp_file, $_contents)) {\n            error_reporting($_error_reporting);\n            throw new SmartyException(\"unable to write file {$_tmp_file}\");\n            return false;\n        }\n\n        // remove original file\n        @unlink($_filepath);\n\n        // rename tmp file\n        $success = rename($_tmp_file, $_filepath);\n        if (!$success) {\n            error_reporting($_error_reporting);\n            throw new SmartyException(\"unable to write file {$_filepath}\");\n            return false;\n        }\n\n        if ($smarty->_file_perms !== null) {\n            // set file permissions\n            chmod($_filepath, $smarty->_file_perms);\n            umask($old_umask);\n        }\n        error_reporting($_error_reporting);\n        return true;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_resource.php",
    "content": "<?php\n/**\n * Smarty Resource Plugin\n *\n * @package Smarty\n * @subpackage TemplateResources\n * @author Rodney Rehm\n */\n\n/**\n * Smarty Resource Plugin\n *\n * Base implementation for resource plugins\n *\n * @package Smarty\n * @subpackage TemplateResources\n */\nabstract class Smarty_Resource {\n    /**\n     * cache for Smarty_Template_Source instances\n     * @var array\n     */\n    public static $sources = array();\n    /**\n     * cache for Smarty_Template_Compiled instances\n     * @var array\n     */\n    public static $compileds = array();\n    /**\n     * cache for Smarty_Resource instances\n     * @var array\n     */\n    public static $resources = array();\n    /**\n     * resource types provided by the core\n     * @var array\n     */\n    protected static $sysplugins = array(\n        'file' => true,\n        'string' => true,\n        'extends' => true,\n        'stream' => true,\n        'eval' => true,\n        'php' => true\n    );\n\n    /**\n     * Name of the Class to compile this resource's contents with\n     * @var string\n     */\n    public $compiler_class = 'Smarty_Internal_SmartyTemplateCompiler';\n\n    /**\n     * Name of the Class to tokenize this resource's contents with\n     * @var string\n     */\n    public $template_lexer_class = 'Smarty_Internal_Templatelexer';\n\n    /**\n     * Name of the Class to parse this resource's contents with\n     * @var string\n     */\n    public $template_parser_class = 'Smarty_Internal_Templateparser';\n\n    /**\n     * Load template's source into current template object\n     *\n     * {@internal The loaded source is assigned to $_template->source->content directly.}}\n     *\n     * @param Smarty_Template_Source $source source object\n     * @return string template source\n     * @throws SmartyException if source cannot be loaded\n     */\n    public abstract function getContent(Smarty_Template_Source $source);\n\n    /**\n     * populate Source Object with meta data from Resource\n     *\n     * @param Smarty_Template_Source   $source source object\n     * @param Smarty_Internal_Template $_template     template object\n     */\n    public abstract function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null);\n\n    /**\n     * populate Source Object with timestamp and exists from Resource\n     *\n     * @param Smarty_Template_Source $source source object\n     */\n    public function populateTimestamp(Smarty_Template_Source $source)\n    {\n        // intentionally left blank\n    }\n    \n    \n    /**\n     * modify resource_name according to resource handlers specifications\n     *\n     * @param Smarty $smarty        Smarty instance\n     * @param string $resource_name resource_name to make unique\n     * @return string unique resource name\n     */\n    protected function buildUniqueResourceName(Smarty $smarty, $resource_name)\n    {\n        return get_class($this) . '#' . $smarty->joined_template_dir . '#' . $resource_name;\n    }\n    \n    /**\n     * populate Compiled Object with compiled filepath\n     *\n     * @param Smarty_Template_Compiled $compiled  compiled object\n     * @param Smarty_Internal_Template $_template template object\n     */\n    public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template)\n    {\n        $_compile_id = isset($_template->compile_id) ? preg_replace('![^\\w\\|]+!', '_', $_template->compile_id) : null;\n        $_filepath = $compiled->source->uid;\n        // if use_sub_dirs, break file into directories\n        if ($_template->smarty->use_sub_dirs) {\n            $_filepath = substr($_filepath, 0, 2) . DS\n             . substr($_filepath, 2, 2) . DS\n             . substr($_filepath, 4, 2) . DS\n             . $_filepath;\n        }\n        $_compile_dir_sep = $_template->smarty->use_sub_dirs ? DS : '^';\n        if (isset($_compile_id)) {\n            $_filepath = $_compile_id . $_compile_dir_sep . $_filepath;\n        }\n        // caching token\n        if ($_template->caching) {\n            $_cache = '.cache';\n        } else {\n            $_cache = '';\n        }\n        $_compile_dir = $_template->smarty->getCompileDir();\n        // set basename if not specified\n        $_basename = $this->getBasename($compiled->source);\n        if ($_basename === null) {\n            $_basename = basename( preg_replace('![^\\w\\/]+!', '_', $compiled->source->name) );\n        }\n        // separate (optional) basename by dot\n        if ($_basename) {\n            $_basename = '.' . $_basename;\n        }\n\n        $compiled->filepath = $_compile_dir . $_filepath . '.' . $compiled->source->type . $_basename . $_cache . '.php';\n    }\n\n    /**\n     * build template filepath by traversing the template_dir array\n     *\n     * @param Smarty_Template_Source   $source    source object\n     * @param Smarty_Internal_Template $_template template object\n     * @return string fully qualified filepath\n     * @throws SmartyException if default template handler is registered but not callable\n     */\n    protected function buildFilepath(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)\n    {\n        $file = $source->name;\n        if ($source instanceof Smarty_Config_Source) {\n            $_directories = $source->smarty->getConfigDir();\n            $_default_handler = $source->smarty->default_config_handler_func;\n        } else {\n            $_directories = $source->smarty->getTemplateDir();\n            $_default_handler = $source->smarty->default_template_handler_func;\n        }\n\n        // go relative to a given template?\n        $_file_is_dotted = $file[0] == '.' && ($file[1] == '.' || $file[1] == '/' || $file[1] == \"\\\\\");\n        if ($_template && $_template->parent instanceof Smarty_Internal_Template && $_file_is_dotted) {\n            if ($_template->parent->source->type != 'file' && $_template->parent->source->type != 'extends' && !$_template->parent->allow_relative_path) {\n                throw new SmartyException(\"Template '{$file}' cannot be relative to template of resource type '{$_template->parent->source->type}'\");\n            }\n            $file = dirname($_template->parent->source->filepath) . DS . $file;\n            $_file_exact_match = true;\n            if (!preg_match('/^([\\/\\\\\\\\]|[a-zA-Z]:[\\/\\\\\\\\])/', $file)) {\n                // the path gained from the parent template is relative to the current working directory\n                // as expansions (like include_path) have already been done\n                $file = getcwd() . DS . $file;\n            }\n        }\n\n        // resolve relative path\n        if (!preg_match('/^([\\/\\\\\\\\]|[a-zA-Z]:[\\/\\\\\\\\])/', $file)) {\n            $_was_relative_prefix = $file[0] == '.' ? substr($file, 0, strpos($file, '|')) : null;\n            $_path = DS . trim($file, '/\\\\');\n            $_was_relative = true;\n        } else {\n            $_path = $file;\n        }\n        // don't we all just love windows?\n        $_path = str_replace('\\\\', '/', $_path);\n        // resolve simples\n        $_path = preg_replace('#(/\\./(\\./)*)|/{2,}#', '/', $_path);\n        // resolve parents\n        while (true) {\n            $_parent = strpos($_path, '/../');\n            if ($_parent === false) {\n                break;\n            } else if ($_parent === 0) {\n                $_path = substr($_path, 3);\n                break;\n            }\n            $_pos = strrpos($_path, '/', $_parent - strlen($_path) - 1);\n            if ($_pos === false) {\n                // don't we all just love windows?\n                $_pos = $_parent;\n            }\n            $_path = substr_replace($_path, '', $_pos, $_parent + 3 - $_pos);\n        }\n        if (DS != '/') {\n            // don't we all just love windows?\n            $_path = str_replace('/', '\\\\', $_path);\n        }\n        // revert to relative\n        if (isset($_was_relative)) {\n            if (isset($_was_relative_prefix)){\n                $_path = $_was_relative_prefix . $_path;\n            } else {\n                $_path = substr($_path, 1);\n            }\n        }\n\n        // this is only required for directories\n        $file = rtrim($_path, '/\\\\');\n\n        // files relative to a template only get one shot\n        if (isset($_file_exact_match)) {\n            return $this->fileExists($source, $file) ? $file : false;\n        }\n\n        // template_dir index?\n        if (preg_match('#^\\[(?P<key>[^\\]]+)\\](?P<file>.+)$#', $file, $match)) {\n            $_directory = null;\n            // try string indexes\n            if (isset($_directories[$match['key']])) {\n                $_directory = $_directories[$match['key']];\n            } else if (is_numeric($match['key'])) {\n                // try numeric index\n                $match['key'] = (int) $match['key'];\n                if (isset($_directories[$match['key']])) {\n                    $_directory = $_directories[$match['key']];\n                } else {\n                    // try at location index\n                    $keys = array_keys($_directories);\n                    $_directory = $_directories[$keys[$match['key']]];\n                }\n            }\n\n            if ($_directory) {\n                $_file = substr($file, strpos($file, ']') + 1);\n                $_filepath = $_directory . $_file;\n                if ($this->fileExists($source, $_filepath)) {\n                    return $_filepath;\n                }\n            }\n        }\n\n        // relative file name?\n        if (!preg_match('/^([\\/\\\\\\\\]|[a-zA-Z]:[\\/\\\\\\\\])/', $file)) {\n            foreach ($_directories as $_directory) {\n                $_filepath = $_directory . $file;\n                if ($this->fileExists($source, $_filepath)) {\n                    return $_filepath;\n                }\n                if ($source->smarty->use_include_path && !preg_match('/^([\\/\\\\\\\\]|[a-zA-Z]:[\\/\\\\\\\\])/', $_directory)) {\n                    // try PHP include_path\n                    if (($_filepath = Smarty_Internal_Get_Include_Path::getIncludePath($_filepath)) !== false) {\n                        return $_filepath;\n                    }\n                }\n            }\n        }\n\n        // try absolute filepath\n        if ($this->fileExists($source, $file)) {\n            return $file;\n        }\n\n        // no tpl file found\n        if ($_default_handler) {\n            if (!is_callable($_default_handler)) {\n                if ($source instanceof Smarty_Config_Source) {\n                    throw new SmartyException(\"Default config handler not callable\");\n                } else {\n                    throw new SmartyException(\"Default template handler not callable\");\n                }\n            }\n            $_return = call_user_func_array($_default_handler,\n                array($source->type, $source->name, &$_content, &$_timestamp, $source->smarty));\n            if (is_string($_return)) {\n                $source->timestamp = @filemtime($_return);\n                $source->exists = !!$source->timestamp;\n                return $_return;\n            } elseif ($_return === true) {\n                $source->content = $_content;\n                $source->timestamp = $_timestamp;\n                $source->exists = true;\n                return $_filepath;\n            }\n        }\n\n        // give up\n        return false;\n    }\n\n    /**\n     * test is file exists and save timestamp\n     *\n     * @param Smarty_Template_Source   $source    source object\n     * @param string $file file name\n     * @return bool  true if file exists\n     */\n    protected function fileExists(Smarty_Template_Source $source, $file)\n    {\n        $source->timestamp = @filemtime($file);\n        return $source->exists = !!$source->timestamp;\n\n    }\n\n    /**\n     * Determine basename for compiled filename\n     *\n     * @param Smarty_Template_Source $source source object\n     * @return string resource's basename\n     */\n    protected function getBasename(Smarty_Template_Source $source)\n    {\n        return null;\n    }\n\n    /**\n     * Load Resource Handler\n     *\n     * @param Smarty $smarty    smarty object\n     * @param string $type      name of the resource\n     * @return Smarty_Resource Resource Handler\n     */\n    public static function load(Smarty $smarty, $type)\n    {\n        // try smarty's cache\n        if (isset($smarty->_resource_handlers[$type])) {\n            return $smarty->_resource_handlers[$type];\n        }\n\n        // try registered resource\n        if (isset($smarty->registered_resources[$type])) {\n            if ($smarty->registered_resources[$type] instanceof Smarty_Resource) {\n                $smarty->_resource_handlers[$type] = $smarty->registered_resources[$type];\n                // note registered to smarty is not kept unique!\n                return $smarty->_resource_handlers[$type];\n            }\n            \n            if (!isset(self::$resources['registered'])) {\n                self::$resources['registered'] = new Smarty_Internal_Resource_Registered();\n            }\n            if (!isset($smarty->_resource_handlers[$type])) {\n                $smarty->_resource_handlers[$type] = self::$resources['registered'];\n            }\n            \n            return $smarty->_resource_handlers[$type];\n        }\n\n        // try sysplugins dir\n        if (isset(self::$sysplugins[$type])) {\n            if (!isset(self::$resources[$type])) {\n                $_resource_class = 'Smarty_Internal_Resource_' . ucfirst($type);\n                self::$resources[$type] = new $_resource_class();\n            }\n            return $smarty->_resource_handlers[$type] = self::$resources[$type];\n        }\n\n        // try plugins dir\n        $_resource_class = 'Smarty_Resource_' . ucfirst($type);\n        if ($smarty->loadPlugin($_resource_class)) {\n            if (isset(self::$resources[$type])) {\n                return $smarty->_resource_handlers[$type] = self::$resources[$type];\n            }\n            \n            if (class_exists($_resource_class, false)) {\n                self::$resources[$type] = new $_resource_class();\n                return $smarty->_resource_handlers[$type] = self::$resources[$type];\n            } else {\n                $smarty->registerResource($type, array(\n                    \"smarty_resource_{$type}_source\",\n                    \"smarty_resource_{$type}_timestamp\",\n                    \"smarty_resource_{$type}_secure\",\n                    \"smarty_resource_{$type}_trusted\"\n                ));\n\n                // give it another try, now that the resource is registered properly\n                return self::load($smarty, $type);\n            }\n        }\n\n        // try streams\n        $_known_stream = stream_get_wrappers();\n        if (in_array($type, $_known_stream)) {\n            // is known stream\n            if (is_object($smarty->security_policy)) {\n                $smarty->security_policy->isTrustedStream($type);\n            }\n            if (!isset(self::$resources['stream'])) {\n                self::$resources['stream'] = new Smarty_Internal_Resource_Stream();\n            }\n            return $smarty->_resource_handlers[$type] = self::$resources['stream'];\n        }\n\n        // TODO: try default_(template|config)_handler\n\n        // give up\n        throw new SmartyException(\"Unkown resource type '{$type}'\");\n    }\n    \n    /**\n     * extract resource_type and resource_name from template_resource and config_resource\n     *\n     * @note \"C:/foo.tpl\" was forced to file resource up till Smarty 3.1.3 (including).\n     * @param string  $resource_name    template_resource or config_resource to parse\n     * @param string  $default_resource the default resource_type defined in $smarty\n     * @param string &$name             the parsed resource name\n     * @param string &$type             the parsed resource type\n     * @return void\n     */\n    protected static function parseResourceName($resource_name, $default_resource, &$name, &$type)\n    {\n        $parts = explode(':', $resource_name, 2);\n        if (!isset($parts[1]) || !isset($parts[0][1])) {\n            // no resource given, use default\n            // or single character before the colon is not a resource type, but part of the filepath\n            $type = $default_resource;\n            $name = $resource_name;\n        } else {\n            $type = $parts[0];\n            $name = $parts[1];\n        }\n    }\n    \n    \n    /**\n     * modify resource_name according to resource handlers specifications\n     *\n     * @param Smarty $smarty        Smarty instance\n     * @param string $resource_name resource_name to make unique\n     * @return string unique resource name\n     */\n     \n    /**\n     * modify template_resource according to resource handlers specifications\n     *\n     * @param string $smarty            Smarty instance \n     * @param string $template_resource template_resource to extracate resource handler and name of\n     * @return string unique resource name\n     */\n    public static function getUniqueTemplateName($smarty, $template_resource)\n    {\n        self::parseResourceName($template_resource, $smarty->default_resource_type, $name, $type);\n        // TODO: optimize for Smarty's internal resource types\n        $resource = Smarty_Resource::load($smarty, $type);\n        return $resource->buildUniqueResourceName($smarty, $name);\n    }\n    \n    /**\n     * initialize Source Object for given resource\n     *\n     * Either [$_template] or [$smarty, $template_resource] must be specified\n     *\n     * @param Smarty_Internal_Template $_template         template object\n     * @param Smarty                   $smarty            smarty object\n     * @param string                   $template_resource resource identifier\n     * @return Smarty_Template_Source Source Object\n     */\n    public static function source(Smarty_Internal_Template $_template=null, Smarty $smarty=null, $template_resource=null)\n    {\n        if ($_template) {\n            $smarty = $_template->smarty;\n            $template_resource = $_template->template_resource;\n        }\n        \n        // parse resource_name, load resource handler, identify unique resource name\n        self::parseResourceName($template_resource, $smarty->default_resource_type, $name, $type);\n        $resource = Smarty_Resource::load($smarty, $type);\n        $unique_resource_name = $resource->buildUniqueResourceName($smarty, $name);\n\n        // check runtime cache\n        $_cache_key = 'template|' . $unique_resource_name;\n        if (isset(self::$sources[$_cache_key])) {\n            return self::$sources[$_cache_key];\n        }\n        \n        // create source\n        $source = new Smarty_Template_Source($resource, $smarty, $template_resource, $type, $name, $unique_resource_name);\n        $resource->populate($source, $_template);\n\n        // runtime cache\n        self::$sources[$_cache_key] = $source;\n        return $source;\n    }\n\n    /**\n     * initialize Config Source Object for given resource\n     *\n     * @param Smarty_Internal_Config $_config config object\n     * @return Smarty_Config_Source Source Object\n     */\n    public static function config(Smarty_Internal_Config $_config)\n    {\n        static $_incompatible_resources = array('eval' => true, 'string' => true, 'extends' => true, 'php' => true);\n        $config_resource = $_config->config_resource;\n        $smarty = $_config->smarty;\n        \n        // parse resource_name\n        self::parseResourceName($config_resource, $smarty->default_config_type, $name, $type);\n        \n        // make sure configs are not loaded via anything smarty can't handle\n        if (isset($_incompatible_resources[$type])) {\n            throw new SmartyException (\"Unable to use resource '{$type}' for config\");\n        }\n\n        // load resource handler, identify unique resource name\n        $resource = Smarty_Resource::load($smarty, $type);\n        $unique_resource_name = $resource->buildUniqueResourceName($smarty, $name);\n        \n        // check runtime cache\n        $_cache_key = 'config|' . $unique_resource_name;\n        if (isset(self::$sources[$_cache_key])) {\n            return self::$sources[$_cache_key];\n        }\n        \n        // create source\n        $source = new Smarty_Config_Source($resource, $smarty, $config_resource, $type, $name, $unique_resource_name);\n        $resource->populate($source, null);\n        \n        // runtime cache\n        self::$sources[$_cache_key] = $source;\n        return $source;\n    }\n\n}\n\n/**\n * Smarty Resource Data Object\n *\n * Meta Data Container for Template Files\n *\n * @package Smarty\n * @subpackage TemplateResources\n * @author Rodney Rehm\n *\n * @property integer $timestamp Source Timestamp\n * @property boolean $exists    Source Existance\n * @property boolean $template  Extended Template reference\n * @property string  $content   Source Content\n */\nclass Smarty_Template_Source {\n\n    /**\n     * Name of the Class to compile this resource's contents with\n     * @var string\n     */\n    public $compiler_class = null;\n\n    /**\n     * Name of the Class to tokenize this resource's contents with\n     * @var string\n     */\n    public $template_lexer_class = null;\n\n    /**\n     * Name of the Class to parse this resource's contents with\n     * @var string\n     */\n    public $template_parser_class = null;\n\n    /**\n     * Unique Template ID\n     * @var string\n     */\n    public $uid = null;\n\n    /**\n     * Template Resource (Smarty_Internal_Template::$template_resource)\n     * @var string\n     */\n    public $resource = null;\n\n    /**\n     * Resource Type\n     * @var string\n     */\n    public $type = null;\n\n    /**\n     * Resource Name\n     * @var string\n     */\n    public $name = null;\n    \n    /**\n     * Unique Resource Name\n     * @var string\n     */\n    public $unique_resource = null;\n\n    /**\n     * Source Filepath\n     * @var string\n     */\n    public $filepath = null;\n\n    /**\n     * Source is bypassing compiler\n     * @var boolean\n     */\n    public $uncompiled = null;\n\n    /**\n     * Source must be recompiled on every occasion\n     * @var boolean\n     */\n    public $recompiled = null;\n\n    /**\n     * The Components an extended template is made of\n     * @var array\n     */\n    public $components = null;\n\n    /**\n     * Resource Handler\n     * @var Smarty_Resource\n     */\n    public $handler = null;\n\n    /**\n     * Smarty instance\n     * @var Smarty\n     */\n    public $smarty = null;\n\n    /**\n     * create Source Object container\n     *\n     * @param Smarty_Resource $handler          Resource Handler this source object communicates with\n     * @param Smarty          $smarty           Smarty instance this source object belongs to\n     * @param string          $resource         full template_resource\n     * @param string          $type             type of resource\n     * @param string          $name             resource name\n     * @param string          $unique_resource  unqiue resource name\n     */\n    public function __construct(Smarty_Resource $handler, Smarty $smarty, $resource, $type, $name, $unique_resource)\n    {\n        $this->handler = $handler; // Note: prone to circular references\n\n        $this->compiler_class = $handler->compiler_class;\n        $this->template_lexer_class = $handler->template_lexer_class;\n        $this->template_parser_class = $handler->template_parser_class;\n        $this->uncompiled = $this->handler instanceof Smarty_Resource_Uncompiled;\n        $this->recompiled = $this->handler instanceof Smarty_Resource_Recompiled;\n\n        $this->smarty = $smarty;\n        $this->resource = $resource;\n        $this->type = $type;\n        $this->name = $name;\n        $this->unique_resource = $unique_resource;\n    }\n\n    /**\n     * get a Compiled Object of this source\n     *\n     * @param Smarty_Internal_Template $_template template objet\n     * @return Smarty_Template_Compiled compiled object\n     */\n    public function getCompiled(Smarty_Internal_Template $_template)\n    {\n        // check runtime cache\n        $_cache_key = $this->unique_resource . '#' . $_template->compile_id;\n        if (isset(Smarty_Resource::$compileds[$_cache_key])) {\n            return Smarty_Resource::$compileds[$_cache_key];\n        }\n\n        $compiled = new Smarty_Template_Compiled($this);\n        $this->handler->populateCompiledFilepath($compiled, $_template);\n        $compiled->timestamp = @filemtime($compiled->filepath);\n        $compiled->exists = !!$compiled->timestamp;\n\n        // runtime cache\n        Smarty_Resource::$compileds[$_cache_key] = $compiled;\n\n        return $compiled;\n    }\n\n    /**\n     * render the uncompiled source\n     *\n     * @param Smarty_Internal_Template $_template template object\n     */\n    public function renderUncompiled(Smarty_Internal_Template $_template)\n    {\n        return $this->handler->renderUncompiled($this, $_template);\n    }\n\n    /**\n     * <<magic>> Generic Setter.\n     *\n     * @param string $property_name valid: timestamp, exists, content, template\n     * @param mixed  $value        new value (is not checked)\n     * @throws SmartyException if $property_name is not valid\n     */\n    public function __set($property_name, $value)\n    {\n        switch ($property_name) {\n            // regular attributes\n            case 'timestamp':\n            case 'exists':\n            case 'content':\n            // required for extends: only\n            case 'template':\n                $this->$property_name = $value;\n                break;\n\n            default:\n                throw new SmartyException(\"invalid source property '$property_name'.\");\n        }\n    }\n\n    /**\n     * <<magic>> Generic getter.\n     *\n     * @param string $property_name valid: timestamp, exists, content\n     * @return mixed\n     * @throws SmartyException if $property_name is not valid\n     */\n    public function __get($property_name)\n    {\n        switch ($property_name) {\n            case 'timestamp':\n            case 'exists':\n                $this->handler->populateTimestamp($this);\n                return $this->$property_name;\n\n            case 'content':\n                return $this->content = $this->handler->getContent($this);\n\n            default:\n                throw new SmartyException(\"source property '$property_name' does not exist.\");\n        }\n    }\n\n}\n\n/**\n * Smarty Resource Data Object\n *\n * Meta Data Container for Template Files\n *\n * @package Smarty\n * @subpackage TemplateResources\n * @author Rodney Rehm\n *\n * @property string $content compiled content\n */\nclass Smarty_Template_Compiled {\n\n    /**\n     * Compiled Filepath\n     * @var string\n     */\n    public $filepath = null;\n\n    /**\n     * Compiled Timestamp\n     * @var integer\n     */\n    public $timestamp = null;\n\n    /**\n     * Compiled Existance\n     * @var boolean\n     */\n    public $exists = false;\n\n    /**\n     * Compiled Content Loaded\n     * @var boolean\n     */\n    public $loaded = false;\n\n    /**\n     * Template was compiled\n     * @var boolean\n     */\n    public $isCompiled = false;\n\n    /**\n     * Source Object\n     * @var Smarty_Template_Source\n     */\n    public $source = null;\n\n    /**\n     * Metadata properties\n     *\n     * populated by Smarty_Internal_Template::decodeProperties()\n     * @var array\n     */\n    public $_properties = null;\n\n    /**\n     * create Compiled Object container\n     *\n     * @param Smarty_Template_Source $source source object this compiled object belongs to\n     */\n    public function __construct(Smarty_Template_Source $source)\n    {\n        $this->source = $source;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_resource_custom.php",
    "content": "<?php\n/**\n * Smarty Resource Plugin\n *\n * @package Smarty\n * @subpackage TemplateResources\n * @author Rodney Rehm\n */\n\n/**\n * Smarty Resource Plugin\n *\n * Wrapper Implementation for custom resource plugins\n *\n * @package Smarty\n * @subpackage TemplateResources\n */\nabstract class Smarty_Resource_Custom extends Smarty_Resource {\n\n    /**\n     * fetch template and its modification time from data source\n     *\n     * @param string  $name    template name\n     * @param string  &$source template source\n     * @param integer &$mtime  template modification timestamp (epoch)\n     */\n    protected abstract function fetch($name, &$source, &$mtime);\n\n    /**\n     * Fetch template's modification timestamp from data source\n     *\n     * {@internal implementing this method is optional.\n     *  Only implement it if modification times can be accessed faster than loading the complete template source.}}\n     *\n     * @param string $name template name\n     * @return integer|boolean timestamp (epoch) the template was modified, or false if not found\n     */\n    protected function fetchTimestamp($name)\n    {\n        return null;\n    }\n\n    /**\n     * populate Source Object with meta data from Resource\n     *\n     * @param Smarty_Template_Source   $source    source object\n     * @param Smarty_Internal_Template $_template template object\n     */\n    public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)\n    {\n        $source->filepath = strtolower($source->type . ':' . $source->name);\n        $source->uid = sha1($source->type . ':' . $source->name);\n\n        $mtime = $this->fetchTimestamp($source->name);\n        if ($mtime !== null) {\n            $source->timestamp = $mtime;\n        } else {\n            $this->fetch($source->name, $content, $timestamp);\n            $source->timestamp = isset($timestamp) ? $timestamp : false;\n            if( isset($content) )\n                $source->content = $content;\n        }\n        $source->exists = !!$source->timestamp;\n    }\n\n    /**\n     * Load template's source into current template object\n     *\n     * @param Smarty_Template_Source $source source object\n     * @return string template source\n     * @throws SmartyException if source cannot be loaded\n     */\n    public function getContent(Smarty_Template_Source $source)\n    {\n        $this->fetch($source->name, $content, $timestamp);\n        if (isset($content)) {\n            return $content;\n        }\n\n        throw new SmartyException(\"Unable to read template {$source->type} '{$source->name}'\");\n    }\n\n    /**\n     * Determine basename for compiled filename\n     *\n     * @param Smarty_Template_Source $source source object\n     * @return string resource's basename\n     */\n    protected function getBasename(Smarty_Template_Source $source)\n    {\n        return basename($source->name);\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_resource_recompiled.php",
    "content": "<?php\n/**\n * Smarty Resource Plugin\n *\n * @package Smarty\n * @subpackage TemplateResources\n * @author Rodney Rehm\n */\n\n/**\n * Smarty Resource Plugin\n *\n * Base implementation for resource plugins that don't compile cache\n *\n * @package Smarty\n * @subpackage TemplateResources\n */\nabstract class Smarty_Resource_Recompiled extends Smarty_Resource {\n\n    /**\n     * populate Compiled Object with compiled filepath\n     *\n     * @param Smarty_Template_Compiled $compiled compiled object\n     * @param Smarty_Internal_Template $_template template object\n     * @return void\n     */\n    public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template)\n    {\n        $compiled->filepath = false;\n        $compiled->timestamp = false;\n        $compiled->exists = false;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_resource_uncompiled.php",
    "content": "<?php\n/**\n * Smarty Resource Plugin\n *\n * @package Smarty\n * @subpackage TemplateResources\n * @author Rodney Rehm\n */\n\n/**\n * Smarty Resource Plugin\n *\n * Base implementation for resource plugins that don't use the compiler\n *\n * @package Smarty\n * @subpackage TemplateResources\n */\nabstract class Smarty_Resource_Uncompiled extends Smarty_Resource {\n\n    /**\n     * Render and output the template (without using the compiler)\n     *\n     * @param Smarty_Template_Source   $source    source object\n     * @param Smarty_Internal_Template $_template template object\n     * @throws SmartyException on failure\n     */\n    public abstract function renderUncompiled(Smarty_Template_Source $source, Smarty_Internal_Template $_template);\n\n    /**\n     * populate compiled object with compiled filepath\n     *\n     * @param Smarty_Template_Compiled $compiled  compiled object\n     * @param Smarty_Internal_Template $_template template object (is ignored)\n     */\n    public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template)\n    {\n        $compiled->filepath = false;\n        $compiled->timestamp = false;\n        $compiled->exists = false;\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/Smarty/sysplugins/smarty_security.php",
    "content": "<?php\n/**\n * Smarty plugin\n *\n * @package Smarty\n * @subpackage Security\n * @author Uwe Tews\n */\n \n/*\n * FIXME: Smarty_Security API\n *      - getter and setter instead of public properties would allow cultivating an internal cache properly\n *      - current implementation of isTrustedResourceDir() assumes that Smarty::$template_dir and Smarty::$config_dir are immutable\n *        the cache is killed every time either of the variables change. That means that two distinct Smarty objects with differing\n *        $template_dir or $config_dir should NOT share the same Smarty_Security instance, \n *        as this would lead to (severe) performance penalty! how should this be handled? \n */\n\n/**\n * This class does contain the security settings\n */\nclass Smarty_Security {\n\n    /**\n     * This determines how Smarty handles \"<?php ... ?>\" tags in templates.\n     * possible values:\n     * <ul>\n     *   <li>Smarty::PHP_PASSTHRU -> echo PHP tags as they are</li>\n     *   <li>Smarty::PHP_QUOTE    -> escape tags as entities</li>\n     *   <li>Smarty::PHP_REMOVE   -> remove php tags</li>\n     *   <li>Smarty::PHP_ALLOW    -> execute php tags</li>\n     * </ul>\n     *\n     * @var integer\n     */\n    public $php_handling = Smarty::PHP_PASSTHRU;\n    /**\n     * This is the list of template directories that are considered secure.\n     * $template_dir is in this list implicitly.\n     *\n     * @var array\n     */\n    public $secure_dir = array();\n    /**\n     * This is an array of directories where trusted php scripts reside.\n     * {@link $security} is disabled during their inclusion/execution.\n     *\n     * @var array\n     */\n    public $trusted_dir = array();\n    /**\n     * This is an array of trusted static classes.\n     *\n     * If empty access to all static classes is allowed.\n     * If set to 'none' none is allowed.\n     * @var array\n     */\n    public $static_classes = array();\n    /**\n     * This is an array of trusted PHP functions.\n     *\n     * If empty all functions are allowed.\n     * To disable all PHP functions set $php_functions = null.\n     * @var array\n     */\n    public $php_functions = array(\n        'isset', 'empty',\n        'count', 'sizeof',\n        'in_array', 'is_array',\n        'time',\n        'nl2br',\n    );\n    /**\n     * This is an array of trusted PHP modifers.\n     *\n     * If empty all modifiers are allowed.\n     * To disable all modifier set $modifiers = null.\n     * @var array\n     */\n    public $php_modifiers = array(\n        'escape',\n        'count'\n    );\n    /**\n     * This is an array of allowed tags.\n     *\n     * If empty no restriction by allowed_tags.\n     * @var array\n     */\n    public $allowed_tags = array();\n    /**\n     * This is an array of disabled tags.\n     *\n     * If empty no restriction by disabled_tags.\n     * @var array\n     */\n    public $disabled_tags = array();\n    /**\n     * This is an array of allowed modifier plugins.\n     *\n     * If empty no restriction by allowed_modifiers.\n     * @var array\n     */\n    public $allowed_modifiers = array();\n    /**\n     * This is an array of disabled modifier plugins.\n     *\n     * If empty no restriction by disabled_modifiers.\n     * @var array\n     */\n    public $disabled_modifiers = array();\n    /**\n     * This is an array of trusted streams.\n     *\n     * If empty all streams are allowed.\n     * To disable all streams set $streams = null.\n     * @var array\n     */\n    public $streams = array('file');\n    /**\n     * + flag if constants can be accessed from template\n     * @var boolean\n     */\n    public $allow_constants = true;\n    /**\n     * + flag if super globals can be accessed from template\n     * @var boolean\n     */\n    public $allow_super_globals = true;\n\n    /**\n     * Cache for $resource_dir lookups\n     * @var array\n     */\n    protected $_resource_dir = null;\n    /**\n     * Cache for $template_dir lookups\n     * @var array\n     */\n    protected $_template_dir = null;\n    /**\n     * Cache for $config_dir lookups\n     * @var array\n     */\n    protected $_config_dir = null;\n    /**\n     * Cache for $secure_dir lookups\n     * @var array\n     */\n    protected $_secure_dir = null;\n    /**\n     * Cache for $php_resource_dir lookups\n     * @var array\n     */\n    protected $_php_resource_dir = null;\n    /**\n     * Cache for $trusted_dir lookups\n     * @var array\n     */\n    protected $_trusted_dir = null;\n    \n    \n    /**\n     * @param Smarty $smarty\n     */\n    public function __construct($smarty)\n    {\n        $this->smarty = $smarty;\n    }\n    \n    /**\n     * Check if PHP function is trusted.\n     *\n     * @param string $function_name\n     * @param object $compiler compiler object\n     * @return boolean true if function is trusted\n     * @throws SmartyCompilerException if php function is not trusted\n     */\n    public function isTrustedPhpFunction($function_name, $compiler)\n    {\n        if (isset($this->php_functions) && (empty($this->php_functions) || in_array($function_name, $this->php_functions))) {\n            return true;\n        }\n\n        $compiler->trigger_template_error(\"PHP function '{$function_name}' not allowed by security setting\");\n        return false; // should not, but who knows what happens to the compiler in the future?\n    }\n\n    /**\n     * Check if static class is trusted.\n     *\n     * @param string $class_name\n     * @param object $compiler compiler object\n     * @return boolean true if class is trusted\n     * @throws SmartyCompilerException if static class is not trusted\n     */\n    public function isTrustedStaticClass($class_name, $compiler)\n    {\n        if (isset($this->static_classes) && (empty($this->static_classes) || in_array($class_name, $this->static_classes))) {\n            return true;\n        }\n\n        $compiler->trigger_template_error(\"access to static class '{$class_name}' not allowed by security setting\");\n        return false; // should not, but who knows what happens to the compiler in the future?\n    }\n\n    /**\n     * Check if PHP modifier is trusted.\n     *\n     * @param string $modifier_name\n     * @param object $compiler compiler object\n     * @return boolean true if modifier is trusted\n     * @throws SmartyCompilerException if modifier is not trusted\n     */\n    public function isTrustedPhpModifier($modifier_name, $compiler)\n    {\n        if (isset($this->php_modifiers) && (empty($this->php_modifiers) || in_array($modifier_name, $this->php_modifiers))) {\n            return true;\n        }\n\n        $compiler->trigger_template_error(\"modifier '{$modifier_name}' not allowed by security setting\");\n        return false; // should not, but who knows what happens to the compiler in the future?\n    }\n\n    /**\n     * Check if tag is trusted.\n     *\n     * @param string $tag_name\n     * @param object $compiler compiler object\n     * @return boolean true if tag is trusted\n     * @throws SmartyCompilerException if modifier is not trusted\n     */\n    public function isTrustedTag($tag_name, $compiler)\n    {\n        // check for internal always required tags\n        if (in_array($tag_name, array('assign', 'call', 'private_filter', 'private_block_plugin', 'private_function_plugin', 'private_object_block_function',\n                    'private_object_function', 'private_registered_function', 'private_registered_block', 'private_special_variable', 'private_print_expression', 'private_modifier'))) {\n            return true;\n        }\n        // check security settings\n        if (empty($this->allowed_tags)) {\n            if (empty($this->disabled_tags) || !in_array($tag_name, $this->disabled_tags)) {\n                return true;\n            } else {\n                $compiler->trigger_template_error(\"tag '{$tag_name}' disabled by security setting\", $compiler->lex->taglineno);\n            }\n        } else if (in_array($tag_name, $this->allowed_tags) && !in_array($tag_name, $this->disabled_tags)) {\n            return true;\n        } else {\n            $compiler->trigger_template_error(\"tag '{$tag_name}' not allowed by security setting\", $compiler->lex->taglineno);\n        }\n        return false; // should not, but who knows what happens to the compiler in the future?\n    }\n\n    /**\n     * Check if modifier plugin is trusted.\n     *\n     * @param string $modifier_name\n     * @param object $compiler compiler object\n     * @return boolean true if tag is trusted\n     * @throws SmartyCompilerException if modifier is not trusted\n     */\n    public function isTrustedModifier($modifier_name, $compiler)\n    {\n        // check for internal always allowed modifier\n        if (in_array($modifier_name, array('default'))) {\n            return true;\n        }\n        // check security settings\n        if (empty($this->allowed_modifiers)) {\n            if (empty($this->disabled_modifiers) || !in_array($modifier_name, $this->disabled_modifiers)) {\n                return true;\n            } else {\n                $compiler->trigger_template_error(\"modifier '{$modifier_name}' disabled by security setting\", $compiler->lex->taglineno);\n            }\n        } else if (in_array($modifier_name, $this->allowed_modifiers) && !in_array($modifier_name, $this->disabled_modifiers)) {\n            return true;\n        } else {\n            $compiler->trigger_template_error(\"modifier '{$modifier_name}' not allowed by security setting\", $compiler->lex->taglineno);\n        }\n        return false; // should not, but who knows what happens to the compiler in the future?\n    }\n\n    /**\n     * Check if stream is trusted.\n     *\n     * @param string $stream_name\n     * @return boolean true if stream is trusted\n     * @throws SmartyException if stream is not trusted\n     */\n    public function isTrustedStream($stream_name)\n    {\n        if (isset($this->streams) && (empty($this->streams) || in_array($stream_name, $this->streams))) {\n            return true;\n        }\n\n        throw new SmartyException(\"stream '{$stream_name}' not allowed by security setting\");\n    }\n\n    /**\n     * Check if directory of file resource is trusted.\n     *\n     * @param string $filepath\n     * @return boolean true if directory is trusted\n     * @throws SmartyException if directory is not trusted\n     */\n    public function isTrustedResourceDir($filepath)\n    {\n        $_template = false;\n        $_config = false;\n        $_secure = false;\n\n        $_template_dir = $this->smarty->getTemplateDir();\n        $_config_dir = $this->smarty->getConfigDir();\n\n        // check if index is outdated\n        if ((!$this->_template_dir || $this->_template_dir !== $_template_dir)\n                || (!$this->_config_dir || $this->_config_dir !== $_config_dir)\n                || (!empty($this->secure_dir) && (!$this->_secure_dir || $this->_secure_dir !== $this->secure_dir))\n        ) {\n            $this->_resource_dir = array();\n            $_template = true;\n            $_config = true;\n            $_secure = !empty($this->secure_dir);\n        }\n\n        // rebuild template dir index\n        if ($_template) {\n            $this->_template_dir = $_template_dir;\n            foreach ($_template_dir as $directory) {\n                $directory = realpath($directory);\n                $this->_resource_dir[$directory] = true;\n            }\n        }\n\n        // rebuild config dir index\n        if ($_config) {\n            $this->_config_dir = $_config_dir;\n            foreach ($_config_dir as $directory) {\n                $directory = realpath($directory);\n                $this->_resource_dir[$directory] = true;\n            }\n        }\n\n        // rebuild secure dir index\n        if ($_secure) {\n            $this->_secure_dir = $this->secure_dir;\n            foreach ((array) $this->secure_dir as $directory) {\n                $directory = realpath($directory);\n                $this->_resource_dir[$directory] = true;\n            }\n        }\n\n        $_filepath = realpath($filepath);\n        $directory = dirname($_filepath);\n        $_directory = array();\n        while (true) {\n            // remember the directory to add it to _resource_dir in case we're successful\n            $_directory[] = $directory;\n            // test if the directory is trusted\n            if (isset($this->_resource_dir[$directory])) {\n                // merge sub directories of current $directory into _resource_dir to speed up subsequent lookups\n                $this->_resource_dir = array_merge($this->_resource_dir, $_directory);\n                return true;\n            }\n            // abort if we've reached root\n            if (($pos = strrpos($directory, DS)) === false || !isset($directory[1])) {\n                break;\n            }\n            // bubble up one level\n            $directory = substr($directory, 0, $pos);\n        }\n\n        // give up\n        throw new SmartyException(\"directory '{$_filepath}' not allowed by security setting\");\n    }\n\n    /**\n     * Check if directory of file resource is trusted.\n     *\n     * @param string $filepath\n     * @return boolean true if directory is trusted\n     * @throws SmartyException if PHP directory is not trusted\n     */\n    public function isTrustedPHPDir($filepath)\n    {\n        if (empty($this->trusted_dir)) {\n            throw new SmartyException(\"directory '{$filepath}' not allowed by security setting (no trusted_dir specified)\");\n        }\n\n        // check if index is outdated\n        if (!$this->_trusted_dir || $this->_trusted_dir !== $this->trusted_dir) {\n            $this->_php_resource_dir = array();\n\n            $this->_trusted_dir = $this->trusted_dir;\n            foreach ((array) $this->trusted_dir as $directory) {\n                $directory = realpath($directory);\n                $this->_php_resource_dir[$directory] = true;\n            }\n        }\n\n        $_filepath = realpath($filepath);\n        $directory = dirname($_filepath);\n        $_directory = array();\n        while (true) {\n            // remember the directory to add it to _resource_dir in case we're successful\n            $_directory[] = $directory;\n            // test if the directory is trusted\n            if (isset($this->_php_resource_dir[$directory])) {\n                // merge sub directories of current $directory into _resource_dir to speed up subsequent lookups\n                $this->_php_resource_dir = array_merge($this->_php_resource_dir, $_directory);\n                return true;\n            }\n            // abort if we've reached root\n            if (($pos = strrpos($directory, DS)) === false || !isset($directory[2])) {\n                break;\n            }\n            // bubble up one level\n            $directory = substr($directory, 0, $pos);\n        }\n\n        throw new SmartyException(\"directory '{$_filepath}' not allowed by security setting\");\n    }\n\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/TemplateLite/class.compiler.php",
    "content": "<?php\n/*\n * Project:\ttemplate_lite, a smarter template engine\n * File:\tclass.compiler.php\n * Author:\tPaul Lockaby <paul@paullockaby.com>, Mark Dickenson <akapanamajack@sourceforge.net>\n * Copyright:\t2003,2004,2005 by Paul Lockaby, 2005,2006 Mark Dickenson\n *\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n *\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this library; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n *\n * The latest version of template_lite can be obtained from:\n * http://templatelite.sourceforge.net\n *\n */\n\nclass Template_Lite_Compiler extends Template_Lite {\n\t// public configuration variables\n\tvar $left_delimiter\t\t\t= \"\";\n\tvar $right_delimiter\t\t\t= \"\";\n\tvar $plugins_dir\t\t\t= \"\";\n\tvar $template_dir\t\t= \"\";\n\tvar $reserved_template_varname = \"\";\n\tvar $default_modifiers\t\t= array();\n\n\tvar $php_extract_vars\t\t=\ttrue;\t// Set this to false if you do not want the $this->_tpl variables to be extracted for use by PHP code inside the template.\n\n\t// private internal variables\n\tvar $_vars\t\t\t=\tarray();\t// stores all internal assigned variables\n\tvar $_confs\t\t\t=\tarray();\t// stores all internal config variables\n\tvar $_plugins\t\t\t=\tarray();\t// stores all internal plugins\n\tvar $_linenum\t\t\t=\t0;\t\t// the current line number in the file we are processing\n\tvar $_file\t\t\t=\t\"\";\t\t// the current file we are processing\n\tvar $_literal\t\t\t=\tarray();\t// stores all literal blocks\n\tvar $_foreachelse_stack\t\t=\tarray();\n\tvar $_for_stack\t\t\t=\t0;\n\tvar $_sectionelse_stack\t =   array();\t// keeps track of whether section had 'else' part\n\tvar $_switch_stack\t\t=\tarray();\n\tvar $_tag_stack\t\t\t=\tarray();\n\tvar $_require_stack\t\t=\tarray();\t// stores all files that are \"required\" inside of the template\n\tvar $_php_blocks\t\t=\tarray();\t// stores all of the php blocks\n\tvar $_error_level\t\t=\tnull;\n\tvar $_sl_md5\t\t\t=\t'39fc70570b8b60cbc1b85839bf242aff';\n\n\tvar $_db_qstr_regexp\t\t=\tnull;\t\t// regexps are setup in the constructor\n\tvar $_si_qstr_regexp\t\t=\tnull;\n\tvar $_qstr_regexp\t\t=\tnull;\n\tvar $_func_regexp\t\t=\tnull;\n\tvar $_var_bracket_regexp\t=\tnull;\n\tvar $_dvar_regexp\t\t=\tnull;\n\tvar $_cvar_regexp\t\t=\tnull;\n\tvar $_svar_regexp\t\t=\tnull;\n\tvar $_mod_regexp\t\t=\tnull;\n\tvar $_var_regexp\t\t=\tnull;\n    var $_obj_params_regexp     =   null;\n\tvar $_templatelite_vars\t\t=\tarray();\n\n\tfunction Template_Lite_compiler()\n\t{\n\t\t// matches double quoted strings:\n\t\t// \"foobar\"\n\t\t// \"foo\\\"bar\"\n\t\t// \"foobar\" . \"foo\\\"bar\"\n\t\t$this->_db_qstr_regexp = '\"[^\"\\\\\\\\]*(?:\\\\\\\\.[^\"\\\\\\\\]*)*\"';\n\n\t\t// matches single quoted strings:\n\t\t// 'foobar'\n\t\t// 'foo\\'bar'\n\t\t$this->_si_qstr_regexp = '\\'[^\\'\\\\\\\\]*(?:\\\\\\\\.[^\\'\\\\\\\\]*)*\\'';\n\n\t\t// matches single or double quoted strings\n\t\t$this->_qstr_regexp = '(?:' . $this->_db_qstr_regexp . '|' . $this->_si_qstr_regexp . ')';\n\n\t\t// matches bracket portion of vars\n\t\t// [0]\n\t\t// [foo]\n\t\t// [$bar]\n\t\t// [#bar#]\n\t\t$this->_var_bracket_regexp = '\\[[\\$|\\#]?\\w+\\#?\\]';\n//\t\t$this->_var_bracket_regexp = '\\[\\$?[\\w\\.]+\\]';\n\n\t\t// matches section vars:\n\t\t// %foo.bar%\n\t\t$this->_svar_regexp = '\\%\\w+\\.\\w+\\%';\n\n\t\t// matches $ vars (not objects):\n\t\t// $foo\n\t\t// $foo[0]\n\t\t// $foo[$bar]\n\t\t// $foo[5][blah]\n//\t\t$this->_dvar_regexp = '\\$[a-zA-Z0-9_]{1,}(?:' . $this->_var_bracket_regexp . ')*(?:' . $this->_var_bracket_regexp . ')*';\n\t\t$this->_dvar_regexp = '\\$[a-zA-Z0-9_]{1,}(?:' . $this->_var_bracket_regexp . ')*(?:\\.\\$?\\w+(?:' . $this->_var_bracket_regexp . ')*)*';\n\n\t\t// matches config vars:\n\t\t// #foo#\n\t\t// #foobar123_foo#\n\t\t$this->_cvar_regexp = '\\#[a-zA-Z0-9_]{1,}(?:' . $this->_var_bracket_regexp . ')*(?:' . $this->_var_bracket_regexp . ')*\\#';\n\n\t\t// matches valid variable syntax:\n\t\t// $foo\n\t\t// 'text'\n\t\t// \"text\"\n\t\t$this->_var_regexp = '(?:(?:' . $this->_dvar_regexp . '|' . $this->_cvar_regexp . ')|' . $this->_qstr_regexp . ')';\n\n\t\t// matches valid modifier syntax:\n\t\t// |foo\n\t\t// |@foo\n\t\t// |foo:\"bar\"\n\t\t// |foo:$bar\n\t\t// |foo:\"bar\":$foobar\n\t\t// |foo|bar\n\t\t$this->_mod_regexp = '(?:\\|@?[0-9a-zA-Z_]+(?::(?>-?\\w+|' . $this->_dvar_regexp . '|' . $this->_qstr_regexp .'))*)';\t\t\n\n\t\t// matches valid function name:\n\t\t// foo123\n\t\t// _foo_bar\n\t\t$this->_func_regexp = '[a-zA-Z_]+';\n//\t\t$this->_func_regexp = '[a-zA-Z_]\\w*';\n\n\t}\n\n\tfunction _compile_file($file_contents)\n\t{\n\t\t$ldq = preg_quote($this->left_delimiter);\n\t\t$rdq = preg_quote($this->right_delimiter);\n\t\t$_match\t\t= array();\t\t// a temp variable for the current regex match\n\t\t$tags\t\t= array();\t\t// all original tags\n\t\t$text\t\t= array();\t\t// all original text\n\t\t$compiled_text\t= '<?php /* '.$this->_version.' '.strftime(\"%Y-%m-%d %H:%M:%S %Z\").' */ ?>'.\"\\n\\n\"; // stores the compiled result\n\t\t$compiled_tags\t= array();\t\t// all tags and stuff\n\n\t\t$this->_require_stack = array();\n\n\t\t$this->_load_filters();\n\n\t\tif (count($this->_plugins['prefilter']) > 0)\n\t\t{\n\t\t\tforeach ($this->_plugins['prefilter'] as $function)\n\t\t\t{\n\t\t\t\tif ($function === false)\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$file_contents = $function($file_contents, $this);\n\t\t\t}\n\t\t}\n\n\t\t// remove all comments\n\t\t$file_contents = preg_replace(\"!{$ldq}\\*.*?\\*{$rdq}!se\",\"\",$file_contents);\n\n\t\t// replace all php start and end tags\n\t\t$file_contents = preg_replace('%(<\\?(?!php|=|$))%i', '<?php echo \\'\\\\1\\'?>'.\"\\n\", $file_contents);\n\n\t\t// remove literal blocks\n\t\tpreg_match_all(\"!{$ldq}\\s*literal\\s*{$rdq}(.*?){$ldq}\\s*/literal\\s*{$rdq}!s\", $file_contents, $_match);\n\t\t$this->_literal = $_match[1];\n\t\t$file_contents = preg_replace(\"!{$ldq}\\s*literal\\s*{$rdq}(.*?){$ldq}\\s*/literal\\s*{$rdq}!s\", stripslashes($ldq . \"literal\" . $rdq), $file_contents);\n\n\t\t// remove php blocks\n\t\tpreg_match_all(\"!{$ldq}\\s*php\\s*{$rdq}(.*?){$ldq}\\s*/php\\s*{$rdq}!s\", $file_contents, $_match);\n\t\t$this->_php_blocks = $_match[1];\n\t\t$file_contents = preg_replace(\"!{$ldq}\\s*php\\s*{$rdq}(.*?){$ldq}\\s*/php\\s*{$rdq}!s\", stripslashes($ldq . \"php\" . $rdq), $file_contents);\n\n\t\t// gather all template tags\n\t\tpreg_match_all(\"!{$ldq}\\s*(.*?)\\s*{$rdq}!s\", $file_contents, $_match);\n\t\t$tags = $_match[1];\n\n\t\t// put all of the non-template tag text blocks into an array, using the template tags as delimiters\n\t\t$text = preg_split(\"!{$ldq}.*?{$rdq}!s\", $file_contents);\n\n\t\t// compile template tags\n\t\t$count_tags = count($tags);\n\t\tfor ($i = 0, $for_max = $count_tags; $i < $for_max; $i++)\n\t\t{\n\t\t\t$this->_linenum += substr_count($text[$i], \"\\n\");\n\t\t\t$compiled_tags[] = $this->_compile_tag($tags[$i]);\n\t\t\t$this->_linenum += substr_count($tags[$i], \"\\n\");\n\t\t}\n\n\t\t// build the compiled template by replacing and interleaving text blocks and compiled tags\n\t\t$count_compiled_tags = count($compiled_tags);\n\t\tfor ($i = 0, $for_max = $count_compiled_tags; $i < $for_max; $i++)\n\t\t{\n\t\t\tif ($compiled_tags[$i] == '') {\n\t\t\t\t$text[$i+1] = preg_replace('~^(\\r\\n|\\r|\\n)~', '', $text[$i+1]);\n\t\t\t}\n\t\t\t$compiled_text .= $text[$i].$compiled_tags[$i];\n\t\t}\n\t\t$compiled_text .= $text[$i];\n\n\t\tforeach ($this->_require_stack as $key => $value)\n\t\t{\n\t\t\t$compiled_text = '<?php require_once(\\''. $this->_get_plugin_dir($key) . $key . '\\'); $this->register_' . $value[0] . '(\"' . $value[1] . '\", \"' . $value[2] . '\"); ?>' . $compiled_text;\n\t\t}\n\n\t\t// remove unnecessary close/open tags\n\t\t$compiled_text = preg_replace('!\\?>\\n?<\\?php!', '', $compiled_text);\n\n\t\tif (count($this->_plugins['postfilter']) > 0)\n\t\t{\n\t\t\tforeach ($this->_plugins['postfilter'] as $function)\n\t\t\t{\n\t\t\t\tif ($function === false)\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$compiled_text = $function($compiled_text, $this);\n\t\t\t}\n\t\t}\n\n\t\treturn $compiled_text;\n\t}\n\n\tfunction _compile_tag($tag)\n\t{\n\t\t$_match\t\t= array();\t\t// stores the tags\n\t\t$_result\t= \"\";\t\t\t// the compiled tag\n\t\t$_variable\t= \"\";\t\t\t// the compiled variable\n\n\t\t// extract the tag command, modifier and arguments\n\t\tpreg_match_all('/(?:(' . $this->_var_regexp . '|' . $this->_svar_regexp . '|\\/?' . $this->_func_regexp . ')(' . $this->_mod_regexp . '*)(?:\\s*[,\\.]\\s*)?)(?:\\s+(.*))?/xs', $tag, $_match);\n\n\t\tif ($_match[1][0]{0} == '$' || ($_match[1][0]{0} == '#' && $_match[1][0]{strlen($_match[1][0]) - 1} == '#') || $_match[1][0]{0} == \"'\" || $_match[1][0]{0} == '\"' || $_match[1][0]{0} == '%')\n\t\t{\n\t\t\t$_result = $this->_parse_variables($_match[1], $_match[2]);\n\t\t\treturn \"<?php echo $_result; ?>\\n\";\n\t\t}\n\t\t// process a function\n\t\t$tag_command = $_match[1][0];\n\t\t$tag_modifiers = !empty($_match[2][0]) ? $_match[2][0] : null;\n\t\t$tag_arguments = !empty($_match[3][0]) ? $_match[3][0] : null;\n\t\t$_result = $this->_parse_function($tag_command, $tag_modifiers, $tag_arguments);\n\t\treturn $_result;\n\t}\n\n\tfunction _parse_function($function, $modifiers, $arguments)\n\t{\n\t\tswitch ($function) {\n\t\t\tcase 'include':\n\t\t\t\tif (!function_exists('compile_include'))\n\t\t\t\t{\n\t\t\t\t\trequire_once(TEMPLATE_LITE_DIR . \"internal/compile.include.php\");\n\t\t\t\t}\n\t\t\t\treturn compile_include($arguments, $this);\n\t\t\t\tbreak;\n\t\t\tcase 'insert':\n\t\t\t\t$_args = $this->_parse_arguments($arguments);\n\t\t\t\tif (!isset($_args['name']))\n\t\t\t\t{\n\t\t\t\t\t$this->trigger_error(\"missing 'name' attribute in 'insert'\", E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t\t}\n\t\t\t\tforeach ($_args as $key => $value)\n\t\t\t\t{\n\t\t\t\t\tif (is_bool($value))\n\t\t\t\t\t{\n\t\t\t\t\t\t$value = $value ? 'true' : 'false';\n\t\t\t\t\t}\n\t\t\t\t\t$arg_list[] = \"'$key' => $value\";\n\t\t\t\t}\n\t\t\t\treturn '<?php echo $this->_run_insert(array(' . implode(', ', (array)$arg_list) . ')); ?>';\n\t\t\t\tbreak;\n\t\t\tcase 'ldelim':\n\t\t\t\treturn $this->left_delimiter;\n\t\t\t\tbreak;\n\t\t\tcase 'rdelim':\n\t\t\t\treturn $this->right_delimiter;\n\t\t\t\tbreak;\n\t\t\tcase 'literal':\n\t\t\t\tlist (,$literal) = each($this->_literal);\n\t\t\t\t$this->_linenum += substr_count($literal, \"\\n\");\n\t\t\t\treturn \"<?php echo '\" . str_replace(\"'\", \"\\'\", str_replace(\"\\\\\", \"\\\\\\\\\", $literal)) . \"'; ?>\\n\";\n\t\t\t\tbreak;\n\t\t\tcase 'php':\n\t\t\t\tlist (,$php_block) = each($this->_php_blocks);\n\t\t\t\t$this->_linenum += substr_count($php_block, \"\\n\");\n\t\t\t\t$php_extract = '';\n\t\t\t\tif($this->php_extract_vars)\n\t\t\t\t{\n\t\t\t\t\tif (strnatcmp(PHP_VERSION, '4.3.0') >= 0)\n\t\t\t\t\t{\n\t\t\t\t\t\t$php_extract = '<?php extract($this->_vars, EXTR_REFS); ?>' . \"\\n\";\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$php_extract = '<?php extract($this->_vars); ?>' . \"\\n\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn $php_extract . '<?php '.$php_block.' ?>';\n\t\t\t\tbreak;\n\t\t\tcase 'foreach':\n\t\t\t\tarray_push($this->_foreachelse_stack, false);\n\t\t\t\t$_args = $this->_parse_arguments($arguments);\n\t\t\t\tif (!isset($_args['from']))\n\t\t\t\t{\n\t\t\t\t\t$this->trigger_error(\"missing 'from' attribute in 'foreach'\", E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t\t}\n\t\t\t\tif (!isset($_args['value']) && !isset($_args['item']))\n\t\t\t\t{\n\t\t\t\t\t$this->trigger_error(\"missing 'value' attribute in 'foreach'\", E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t\t}\n\t\t\t\tif (isset($_args['value']))\n\t\t\t\t{\n\t\t\t\t\t$_args['value'] = $this->_dequote($_args['value']);\n\t\t\t\t}\n\t\t\t\telseif (isset($_args['item']))\n\t\t\t\t{\n\t\t\t\t\t$_args['value'] = $this->_dequote($_args['item']);\n\t\t\t\t}\n\t\t\t\tisset($_args['key']) ? $_args['key'] = \"\\$this->_vars['\".$this->_dequote($_args['key']).\"'] => \" : $_args['key'] = '';\n\t\t\t\t$_result = '<?php if (count((array)' . $_args['from'] . ')): foreach ((array)' . $_args['from'] . ' as ' . $_args['key'] . '$this->_vars[\\'' . $_args['value'] . '\\']): ?>';\n\t\t\t\treturn $_result;\n\t\t\t\tbreak;\n\t\t\tcase 'foreachelse':\n\t\t\t\t$this->_foreachelse_stack[count($this->_foreachelse_stack)-1] = true;\n\t\t\t\treturn \"<?php endforeach; else: ?>\";\n\t\t\t\tbreak;\n\t\t\tcase '/foreach':\n\t\t\t\tif (array_pop($this->_foreachelse_stack))\n\t\t\t\t{\n\t\t\t\t\treturn \"<?php endif; ?>\";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treturn \"<?php endforeach; endif; ?>\";\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'for':\n\t\t\t\t$this->_for_stack++;\n\t\t\t\t$_args = $this->_parse_arguments($arguments);\n\t\t\t\tif (!isset($_args['start']))\n\t\t\t\t{\n\t\t\t\t\t$this->trigger_error(\"missing 'start' attribute in 'for'\", E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t\t}\n\t\t\t\tif (!isset($_args['stop']))\n\t\t\t\t{\n\t\t\t\t\t$this->trigger_error(\"missing 'stop' attribute in 'for'\", E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t\t}\n\t\t\t\tif (!isset($_args['step']))\n\t\t\t\t{\n\t\t\t\t\t$_args['step'] = 1;\n\t\t\t\t}\n\t\t\t\t$_result = '<?php for($for' . $this->_for_stack . ' = ' . $_args['start'] . '; ((' . $_args['start'] . ' < ' . $_args['stop'] . ') ? ($for' . $this->_for_stack . ' < ' . $_args['stop'] . ') : ($for' . $this->_for_stack . ' > ' . $_args['stop'] . ')); $for' . $this->_for_stack . ' += ((' . $_args['start'] . ' < ' . $_args['stop'] . ') ? ' . $_args['step'] . ' : -' . $_args['step'] . ')): ?>';\n\t\t\t\tif (isset($_args['value']))\n\t\t\t\t{\n\t\t\t\t\t$_result .= '<?php $this->assign(\\'' . $this->_dequote($_args['value']) . '\\', $for' . $this->_for_stack . '); ?>';\n\t\t\t\t}\n\t\t\t\treturn $_result;\n\t\t\t\tbreak;\n\t\t\tcase '/for':\n\t\t\t\t$this->_for_stack--;\n\t\t\t\treturn \"<?php endfor; ?>\";\n\t\t\t\tbreak;\n\t\t\tcase 'section':\n\t\t\t\tarray_push($this->_sectionelse_stack, false);\n\t\t\t\tif (!function_exists('compile_section_start'))\n\t\t\t\t{\n\t\t\t\t\trequire_once(TEMPLATE_LITE_DIR . \"internal/compile.section_start.php\");\n\t\t\t\t}\n\t\t\t\treturn compile_section_start($arguments, $this);\n\t\t\t\tbreak;\n\t\t\tcase 'sectionelse':\n\t\t\t\t$this->_sectionelse_stack[count($this->_sectionelse_stack)-1] = true;\n\t\t\t\treturn \"<?php endfor; else: ?>\";\n\t\t\t\tbreak;\n\t\t\tcase '/section':\n\t\t\t\tif (array_pop($this->_sectionelse_stack))\n\t\t\t\t{\n\t\t\t\t\treturn \"<?php endif; ?>\";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treturn \"<?php endfor; endif; ?>\";\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'while':\n\t\t\t\t$_args = $this->_compile_if($arguments, false, true);\n\t\t\t\treturn '<?php while(' . $_args . '): ?>';\n\t\t\t\tbreak;\n\t\t\tcase '/while':\n\t\t\t\treturn \"<?php endwhile; ?>\";\n\t\t\t\tbreak;\n\t\t\tcase 'if':\n\t\t\t\treturn $this->_compile_if($arguments);\n\t\t\t\tbreak;\n\t\t\tcase 'else':\n\t\t\t\treturn \"<?php else: ?>\";\n\t\t\t\tbreak;\n\t\t\tcase 'elseif':\n\t\t\t\treturn $this->_compile_if($arguments, true);\n\t\t\t\tbreak;\n\t\t\tcase '/if':\n\t\t\t\treturn \"<?php endif; ?>\";\n\t\t\t\tbreak;\n\t\t\tcase 'assign':\n\t\t\t\t$_args = $this->_parse_arguments($arguments);\n\t\t\t\tif (!isset($_args['var']))\n\t\t\t\t{\n\t\t\t\t\t$this->trigger_error(\"missing 'var' attribute in 'assign'\", E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t\t}\n\t\t\t\tif (!isset($_args['value']))\n\t\t\t\t{\n\t\t\t\t\t$this->trigger_error(\"missing 'value' attribute in 'assign'\", E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t\t}\n\t\t\t\treturn '<?php $this->assign(\\'' . $this->_dequote($_args['var']) . '\\', ' . $_args['value'] . '); ?>';\n\t\t\t\tbreak;\n\t\t\tcase 'switch':\n\t\t\t\t$_args = $this->_parse_arguments($arguments);\n\t\t\t\tif (!isset($_args['from']))\n\t\t\t\t{\n\t\t\t\t\t$this->trigger_error(\"missing 'from' attribute in 'switch'\", E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t\t}\n\t\t\t\tarray_push($this->_switch_stack, array(\"matched\" => false, \"var\" => $this->_dequote($_args['from'])));\n\t\t\t\treturn;\n\t\t\t\tbreak;\n\t\t\tcase '/switch':\n\t\t\t\tarray_pop($this->_switch_stack);\n\t\t\t\treturn '<?php break; endswitch; ?>';\n\t\t\t\tbreak;\n\t\t\tcase 'case':\n\t\t\t\tif (count($this->_switch_stack) > 0)\n\t\t\t\t{\n\t\t\t\t\t$_result = \"<?php \";\n\t\t\t\t\t$_args = $this->_parse_arguments($arguments);\n\t\t\t\t\t$_index = count($this->_switch_stack) - 1;\n\t\t\t\t\tif (!$this->_switch_stack[$_index][\"matched\"])\n\t\t\t\t\t{\n\t\t\t\t\t\t$_result .= 'switch(' . $this->_switch_stack[$_index][\"var\"] . '): ';\n\t\t\t\t\t\t$this->_switch_stack[$_index][\"matched\"] = true;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$_result .= 'break; ';\n\t\t\t\t\t}\n\t\t\t\t\tif (!empty($_args['value']))\n\t\t\t\t\t{\n\t\t\t\t\t\t$_result .= 'case '.$_args['value'].': ';\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$_result .= 'default: ';\n\t\t\t\t\t}\n\t\t\t\t\treturn $_result . ' ?>';\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$this->trigger_error(\"unexpected 'case', 'case' can only be in a 'switch'\", E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'config_load':\n\t\t\t\t$_args = $this->_parse_arguments($arguments);\n\t\t\t\tif (empty($_args['file']))\n\t\t\t\t{\n\t\t\t\t\t$this->trigger_error(\"missing 'file' attribute in 'config_load' tag\", E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t\t}\n\t\t\t\tisset($_args['section']) ? null : $_args['section'] = 'null';\n\t\t\t\tisset($_args['var']) ? null : $_args['var'] = 'null';\n\t\t\t\treturn '<?php $this->config_load(' . $_args['file'] . ', ' . $_args['section'] . ', ' . $_args['var'] . '); ?>';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$_result = \"\";\n\t\t\t\tif ($this->_compile_compiler_function($function, $arguments, $_result))\n\t\t\t\t{\n\t\t\t\t\treturn $_result;\n\t\t\t\t}\n\t\t\t\telse if ($this->_compile_custom_block($function, $modifiers, $arguments, $_result))\n\t\t\t\t{\n\t\t\t\t\treturn $_result;\n\t\t\t\t}\n\t\t\t\telseif ($this->_compile_custom_function($function, $modifiers, $arguments, $_result))\n\t\t\t\t{\n\t\t\t\t\treturn $_result;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$this->trigger_error($function.\" function does not exist\", E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tfunction _compile_compiler_function($function, $arguments, &$_result)\n\t{\n\t\tif ($function = $this->_plugin_exists($function, \"compiler\"))\n\t\t{\n\t\t\t$_args = $this->_parse_arguments($arguments);\n\t\t\t$_result = '<?php ' . $function($_args, $this) . ' ?>';\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tfunction _compile_custom_function($function, $modifiers, $arguments, &$_result)\n\t{\n\t\tif (!function_exists('compile_compile_custom_function'))\n\t\t{\n\t\t\trequire_once(TEMPLATE_LITE_DIR . \"internal/compile.compile_custom_function.php\");\n\t\t}\n\t\treturn compile_compile_custom_function($function, $modifiers, $arguments, $_result, $this);\n\t}\n\n\tfunction _compile_custom_block($function, $modifiers, $arguments, &$_result)\n\t{\n\t\tif (!function_exists('compile_compile_custom_block'))\n\t\t{\n\t\t\trequire_once(TEMPLATE_LITE_DIR . \"internal/compile.compile_custom_block.php\");\n\t\t}\n\t\treturn compile_compile_custom_block($function, $modifiers, $arguments, $_result, $this);\n\t}\n\n\tfunction _compile_if($arguments, $elseif = false, $while = false)\n\t{\n\t\tif (!function_exists('compile_compile_if'))\n\t\t{\n\t\t\trequire_once(TEMPLATE_LITE_DIR . \"internal/compile.compile_if.php\");\n\t\t}\n\t\treturn compile_compile_if($arguments, $elseif, $while, $this);\n\t}\n\n\tfunction _parse_is_expr($is_arg, $_arg)\n\t{\n\t\tif (!function_exists('compile_parse_is_expr'))\n\t\t{\n\t\t\trequire_once(TEMPLATE_LITE_DIR . \"internal/compile.parse_is_expr.php\");\n\t\t}\n\t\treturn compile_parse_is_expr($is_arg, $_arg, $this);\n\t}\n\n\tfunction _compile_config($variable)\n\t{\n\t\tif (!function_exists('compile_compile_config'))\n\t\t{\n\t\t\trequire_once(TEMPLATE_LITE_DIR . \"internal/compile.compile_config.php\");\n\t\t}\n\t\treturn compile_compile_config($variable, $this);\n\t}\n\n\tfunction _dequote($string)\n\t{\n\t\tif (($string{0} == \"'\" || $string{0} == '\"') && $string{strlen($string)-1} == $string{0})\n\t\t{\n\t\t\treturn substr($string, 1, -1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn $string;\n\t\t}\n\t}\n\n\tfunction _parse_arguments($arguments)\n\t{\n\t\t$_match\t\t= array();\n\t\t$_result\t= array();\n\t\t$_variables\t= array();\n\t\tpreg_match_all('/(?:' . $this->_qstr_regexp . ' | (?>[^\"\\'=\\s]+))+|[=]/x', $arguments, $_match);\n\t\t/*\n\t\t   Parse state:\n\t\t\t 0 - expecting attribute name\n\t\t\t 1 - expecting '='\n\t\t\t 2 - expecting attribute value (not '=')\n\t\t*/\n\t\t$state = 0;\n\t\tforeach($_match[0] as $value)\n\t\t{\n\t\t\tswitch($state) {\n\t\t\t\tcase 0:\n\t\t\t\t\t// valid attribute name\n\t\t\t\t\tif (is_string($value))\n\t\t\t\t\t{\n\t\t\t\t\t\t$a_name = $value;\n\t\t\t\t\t\t$state = 1;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$this->trigger_error(\"invalid attribute name: '$token'\", E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tif ($value == '=')\n\t\t\t\t\t{\n\t\t\t\t\t\t$state = 2;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$this->trigger_error(\"expecting '=' after '$last_value'\", E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\tif ($value != '=')\n\t\t\t\t\t{\n\t\t\t\t\t\tif ($value == 'yes' || $value == 'on' || $value == 'true')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$value = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telseif ($value == 'no' || $value == 'off' || $value == 'false')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$value = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telseif ($value == 'null')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$value = null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif(!preg_match_all('/(?:(' . $this->_var_regexp . '|' . $this->_svar_regexp . ')(' . $this->_mod_regexp . '*))(?:\\s+(.*))?/xs', $value, $_variables))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$_result[$a_name] = $value;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$_result[$a_name] = $this->_parse_variables($_variables[1], $_variables[2]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$state = 0;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$this->trigger_error(\"'=' cannot be an attribute value\", E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\t$last_value = $value;\n\t\t}\n\t\tif($state != 0)\n\t\t{\n\t\t\tif($state == 1)\n\t\t\t{\n\t\t\t\t$this->trigger_error(\"expecting '=' after attribute name '$last_value'\", E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->trigger_error(\"missing attribute value\", E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t}\n\t\t}\n\t\treturn $_result;\n\t}\n\n\tfunction _parse_variables($variables, $modifiers)\n\t{\n\t\t$_result = \"\";\n\t\tforeach($variables as $key => $value)\n\t\t{\n\t\t\t$tag_variable = trim($variables[$key]);\n\t\t\tif(!empty($this->default_modifiers) && !preg_match('!(^|\\|)templatelite:nodefaults($|\\|)!',$modifiers[$key]))\n\t\t\t{\n\t\t\t\t$_default_mod_string = implode('|',(array)$this->default_modifiers);\n\t\t\t\t$modifiers[$key] = empty($modifiers[$key]) ? $_default_mod_string : $_default_mod_string . '|' . $modifiers[$key];\n\t\t\t}\n\t\t\tif (empty($modifiers[$key]))\n\t\t\t{\n\t\t\t\t$_result .= $this->_parse_variable($tag_variable).'.';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$_result .= $this->_parse_modifier($this->_parse_variable($tag_variable), $modifiers[$key]).'.';\n\t\t\t}\n\t\t}\n\t\treturn substr($_result, 0, -1);\n\t}\n\n\tfunction _parse_variable($variable)\n\t{\n\t\t// replace variable with value\n\t\tif ($variable{0} == \"\\$\")\n\t\t{\n\t\t\t// replace the variable\n\t\t\treturn $this->_compile_variable($variable);\n\t\t}\n\t\telseif ($variable{0} == '#')\n\t\t{\n\t\t\t// replace the config variable\n\t\t\treturn $this->_compile_config($variable);\n\t\t}\n\t\telseif ($variable{0} == '\"')\n\t\t{\n\t\t\t// expand the quotes to pull any variables out of it\n\t\t\t// fortunately variables inside of a quote aren't fancy, no modifiers, no quotes\n\t\t\t//   just get everything from the $ to the ending space and parse it\n\t\t\t// if the $ is escaped, then we won't expand it\n\t\t\t$_result = \"\";\n\t\t\tpreg_match_all('/(?:[^\\\\\\]' . $this->_dvar_regexp . ')/', substr($variable, 1, -1), $_expand);  // old match \n//\t\t\tpreg_match_all('/(?:[^\\\\\\]' . $this->_dvar_regexp . '[^\\\\\\])/', $variable, $_expand);\n\t\t\t$_expand = array_unique($_expand[0]);\n\t\t\tforeach($_expand as $key => $value)\n\t\t\t{\n\t\t\t\t$_expand[$key] = trim($value);\n\t\t\t\tif (strpos($_expand[$key], '$') > 0)\n\t\t\t\t{\n\t\t\t\t\t$_expand[$key] = substr($_expand[$key], strpos($_expand[$key], '$'));\n\t\t\t\t}\n\t\t\t}\n\t\t\t$_result = $variable;\n\t\t\tforeach($_expand as $value)\n\t\t\t{\n\t\t\t\t$value = trim($value);\n\t\t\t\t$_result = str_replace($value, '\" . ' . $this->_parse_variable($value) . ' . \"', $_result);\n\t\t\t}\n\t\t\t$_result = str_replace(\"`\", \"\", $_result);\n\t\t\treturn $_result;\n\t\t}\n\t\telseif ($variable{0} == \"'\")\n\t\t{\n\t\t\t// return the value just as it is\n\t\t\treturn $variable;\n\t\t}\n\t\telseif ($variable{0} == \"%\")\n\t\t{\n\t\t\treturn $this->_parse_section_prop($variable);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// return it as is; i believe that there was a reason before that i did not just return it as is,\n\t\t\t// but i forgot what that reason is ...\n\t\t\t// the reason i return the variable 'as is' right now is so that unquoted literals are allowed\n\t\t\treturn $variable;\n\t\t}\n\t}\n\n\tfunction _parse_section_prop($section_prop_expr)\n\t{\n\t\t$parts = explode('|', $section_prop_expr, 2);\n\t\t$var_ref = $parts[0];\n\t\t$modifiers = isset($parts[1]) ? $parts[1] : '';\n\n\t\tpreg_match('!%(\\w+)\\.(\\w+)%!', $var_ref, $match);\n\t\t$section_name = $match[1];\n\t\t$prop_name = $match[2];\n\n\t\t$output = \"\\$this->_sections['$section_name']['$prop_name']\";\n\n\t\t$this->_parse_modifier($output, $modifiers);\n\n\t\treturn $output;\n\t}\n\n\tfunction _compile_variable($variable)\n\t{\n\t\t$_result\t= \"\";\n\n\t\t// remove the $\n\t\t$variable = substr($variable, 1);\n\n\t\t// get [foo] and .foo and (...) pieces\n\t\tpreg_match_all('!(?:^\\w+)|(?:' . $this->_var_bracket_regexp . ')|\\.\\$?\\w+|\\S+!', $variable, $_match);\n\t\t$variable = $_match[0];\n\t\t$var_name = array_shift($variable);\n\n\t\tif ($var_name == $this->reserved_template_varname)\n\t\t{\n\t\t\tif ($variable[0]{0} == '[' || $variable[0]{0} == '.')\n\t\t\t{\n\t\t\t\t$find = array(\"[\", \"]\", \".\");\n\t\t\t\tswitch(strtoupper(str_replace($find, \"\", $variable[0])))\n\t\t\t\t{\n\t\t\t\t\tcase 'GET':\n\t\t\t\t\t\t$_result = \"\\$_GET\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'POST':\n\t\t\t\t\t\t$_result = \"\\$_POST\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'COOKIE':\n\t\t\t\t\t\t$_result = \"\\$_COOKIE\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'ENV':\n\t\t\t\t\t\t$_result = \"\\$_ENV\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'SERVER':\n\t\t\t\t\t\t$_result = \"\\$_SERVER\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'SESSION':\n\t\t\t\t\t\t$_result = \"\\$_SESSION\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'NOW':\n\t\t\t\t\t\t$_result = \"time()\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'SECTION':\n\t\t\t\t\t\t$_result = \"\\$this->_sections\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'LDELIM':\n\t\t\t\t\t\t$_result = \"\\$this->left_delimiter\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'RDELIM':\n\t\t\t\t\t\t$_result = \"\\$this->right_delimiter\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'VERSION':\n\t\t\t\t\t\t$_result = \"\\$this->_version\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'CONFIG':\n\t\t\t\t\t\t$_result = \"\\$this->_confs\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'TEMPLATE':\n\t\t\t\t\t\t$_result = \"\\$this->_file\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'CONST':\n\t\t\t\t\t\t$constant = str_replace($find, \"\", $_match[0][2]);\n\t\t\t\t\t\t$_result = \"constant('$constant')\";\n\t\t\t\t\t\t$variable = array();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t$_var_name = str_replace($find, \"\", $variable[0]);\n\t\t\t\t\t\t$_result = \"\\$this->_templatelite_vars['$_var_name']\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tarray_shift($variable);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->trigger_error('$' . $var_name.implode('', $variable) . ' is an invalid $templatelite reference', E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$_result = \"\\$this->_vars['$var_name']\";\n\t\t}\n\n\t\tforeach ($variable as $var)\n\t\t{\n\t\t\tif ($var{0} == '[')\n\t\t\t{\n\t\t\t\t$var = substr($var, 1, -1);\n\t\t\t\tif (is_numeric($var))\n\t\t\t\t{\n\t\t\t\t\t$_result .= \"[$var]\";\n\t\t\t\t}\n\t\t\t\telseif ($var{0} == '$')\n\t\t\t\t{\n\t\t\t\t\t$_result .= \"[\" . $this->_compile_variable($var) . \"]\";\n\t\t\t\t}\n\t\t\t\telseif ($var{0} == '#')\n\t\t\t\t{\n\t\t\t\t\t$_result .= \"[\" . $this->_compile_config($var) . \"]\";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n//\t\t\t\t\t$_result .= \"['$var']\";\n\t\t\t\t\t$parts = explode('.', $var);\n\t\t\t\t\t$section = $parts[0];\n\t\t\t\t\t$section_prop = isset($parts[1]) ? $parts[1] : 'index';\n\t\t\t\t\t$_result .= \"[\\$this->_sections['$section']['$section_prop']]\";\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if ($var{0} == '.')\n\t\t\t{\n   \t\t\t\tif ($var{1} == '$')\n\t\t\t\t{\n\t   \t\t\t\t$_result .= \"[\\$this->_TPL['\" . substr($var, 2) . \"']]\";\n\t\t\t\t}\n\t\t   \t\telse\n\t\t\t\t{\n\t\t\t   \t\t$_result .= \"['\" . substr($var, 1) . \"']\";\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (substr($var,0,2) == '->')\n\t\t\t{\n\t\t\t\tif(substr($var,2,2) == '__')\n\t\t\t\t{\n\t\t\t\t\t$this->trigger_error('call to internal object members is not allowed', E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t\t}\n\t\t\t\telse if (substr($var, 2, 1) == '$')\n\t\t\t\t{\n\t\t\t\t\t$_output .= '->{(($var=$this->_TPL[\\''.substr($var,3).'\\']) && substr($var,0,2)!=\\'__\\') ? $_var : $this->trigger_error(\"cannot access property \\\\\"$var\\\\\"\")}';\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->trigger_error('$' . $var_name.implode('', $variable) . ' is an invalid reference', E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t}\n\t\t}\n\t\treturn $_result;\n\t}\n\n\tfunction _parse_modifier($variable, $modifiers)\n\t{\n\t\t$_match\t\t= array();\n\t\t$_mods\t\t= array();\t\t// stores all modifiers\n\t\t$_args\t\t= array();\t\t// modifier arguments\n\n\t\tpreg_match_all('!\\|(@?\\w+)((?>:(?:'. $this->_qstr_regexp . '|[^|]+))*)!', '|' . $modifiers, $_match);\n\t\tlist(, $_mods, $_args) = $_match;\n\n\t\t$count_mods = count($_mods);\n\t\tfor ($i = 0, $for_max = $count_mods; $i < $for_max; $i++)\n\t\t{\n\t\t\tpreg_match_all('!:(' . $this->_qstr_regexp . '|[^:]+)!', $_args[$i], $_match);\n\t\t\t$_arg = $_match[1];\n\n\t\t\tif ($_mods[$i]{0} == '@')\n\t\t\t{\n\t\t\t\t$_mods[$i] = substr($_mods[$i], 1);\n\t\t\t\t$_map_array = 0;\n\t\t\t} else {\n\t\t\t\t$_map_array = 1;\n\t\t\t}\n\n\t\t\tforeach($_arg as $key => $value)\n\t\t\t{\n\t\t\t\t$_arg[$key] = $this->_parse_variable($value);\n\t\t\t}\n\n\t\t\tif ($this->_plugin_exists($_mods[$i], \"modifier\") || function_exists($_mods[$i]))\n\t\t\t{\n\t\t\t\tif (count($_arg) > 0)\n\t\t\t\t{\n\t\t\t\t\t$_arg = ', '.implode(', ', $_arg);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$_arg = '';\n\t\t\t\t}\n\n\t\t\t\t$php_function = \"PHP\";\n\t\t\t\tif ($this->_plugin_exists($_mods[$i], \"modifier\"))\n\t\t\t\t{\n\t\t\t\t\t$php_function = \"plugin\";\n\t\t\t\t}\n\t\t\t\t$variable = \"\\$this->_run_modifier($variable, '$_mods[$i]', '$php_function', $_map_array$_arg)\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$variable = \"\\$this->trigger_error(\\\"'\" . $_mods[$i] . \"' modifier does not exist\\\", E_USER_NOTICE, __FILE__, __LINE__);\";\n\t\t\t}\n\t\t}\n\t\treturn $variable;\n\t}\n\n\tfunction _plugin_exists($function, $type)\n\t{\n\t\t// check for object functions\n\t\tif (isset($this->_plugins[$type][$function]) && is_array($this->_plugins[$type][$function]) && is_object($this->_plugins[$type][$function][0]) && method_exists($this->_plugins[$type][$function][0], $this->_plugins[$type][$function][1]))\n\t\t{\n\t\t\treturn '$this->_plugins[\\'' . $type . '\\'][\\'' . $function . '\\'][0]->' . $this->_plugins[$type][$function][1];\n\t\t}\n\t\t// check for standard functions\n\t\tif (isset($this->_plugins[$type][$function]) && function_exists($this->_plugins[$type][$function]))\n\t\t{\n\t\t\treturn $this->_plugins[$type][$function];\n\t\t}\n\t\t// check for a plugin in the plugin directory\n\t\tif (file_exists($this->_get_plugin_dir($type . '.' . $function . '.php') . $type . '.' . $function . '.php'))\n\t\t{\n\t\t\trequire_once($this->_get_plugin_dir($type . '.' . $function . '.php') . $type . '.' . $function . '.php');\n\t\t\tif (function_exists('tpl_' . $type . '_' . $function))\n\t\t\t{\n\t\t\t\t$this->_require_stack[$type . '.' . $function . '.php'] = array($type, $function, 'tpl_' . $type . '_' . $function);\n\t\t\t\treturn ('tpl_' . $type . '_' . $function);\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tfunction _load_filters()\n\t{\n\t\tif (count($this->_plugins['prefilter']) > 0)\n\t\t{\n\t\t\tforeach ($this->_plugins['prefilter'] as $filter_name => $prefilter)\n\t\t\t{\n\t\t\t\tif (!function_exists($prefilter))\n\t\t\t\t{\n\t\t\t\t\t@include_once( $this->_get_plugin_dir(\"prefilter.\" . $filter_name . \".php\") . \"prefilter.\" . $filter_name . \".php\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (count($this->_plugins['postfilter']) > 0)\n\t\t{\n\t\t\tforeach ($this->_plugins['postfilter'] as $filter_name => $postfilter)\n\t\t\t{\n\t\t\t\tif (!function_exists($postfilter))\n\t\t\t\t{\n\t\t\t\t\t@include_once( $this->_get_plugin_dir(\"postfilter.\" . $filter_name . \".php\") . \"postfilter.\" . $filter_name . \".php\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n?>\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/TemplateLite/class.config.php",
    "content": "<?php\n/*\n * Project:\ttemplate_lite, a smarter template engine\n * File:\tclass.config.php\n * Author:\tPaul Lockaby <paul@paullockaby.com>, Mark Dickenson <akapanamajack@sourceforge.net>\n * Copyright:\t2003,2004,2005 by Paul Lockaby, 2005,2006 Mark Dickenson\n *\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n *\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this library; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n *\n * The latest version of template_lite can be obtained from:\n * http://templatelite.sourceforge.net\n *\n */\n\nclass config {\n\tvar $overwrite \t\t\t= false;\t// overwrite variables of the same name? if false, an array will be created\n\tvar $booleanize\t\t\t= true;\t\t// turn true/false, yes/no, on/off, into 1/0\n\tvar $fix_new_lines\t\t= true;\t\t// turns \\r\\n into \\n?\n\tvar $read_hidden\t\t= true;\t\t// read hidden sections?\n\n\tvar $_db_qstr_regexp\t\t= null;\n\tvar $_bool_true_regexp\t\t= null;\n\tvar $_bool_false_regexp\t\t= null;\n\tvar $_qstr_regexp\t\t= null;\n\n\tfunction config()\n\t{\n\t\t$this->_db_qstr_regexp = '\"[^\"\\\\\\\\]*(?:\\\\\\\\.[^\"\\\\\\\\]*)*\"';\n\t\t$this->_bool_true_regexp = 'true|yes|on';\n\t\t$this->_bool_false_regexp = 'false|no|off';\n\t\t$this->_qstr_regexp = '(?:' . $this->_db_qstr_regexp . '|' . $this->_bool_true_regexp . '|' . $this->_bool_false_regexp . ')';\n\t}\n\n\tfunction config_load($file, $section_name = null, $var_name = null)\n\t{\n\t\t$_result = array();\n\t\t$contents = file_get_contents($file);\n\t\tif (empty($contents))\n\t\t{\n\t\t\tdie(\"Could not open $file\");\n\t\t}\n\n\t\t// insert new line into beginning of file\n\t\t$contents = \"\\n\" . $contents;\n\t\t// fix new-lines\n\t\tif ($this->fix_new_lines)\n\t\t{\n\t\t\t$contents = str_replace(\"\\r\\n\",\"\\n\",$contents);\n\t\t}\n\n\t\t// match globals\n\t\tif (preg_match(\"/^(.*?)(\\n\\[|\\Z)/s\", $contents, $match))\n\t\t{\n\t\t\t$_result[\"globals\"] = $this->_parse_config_section($match[1]);\n\t\t}\n\n\t\t// match sections\n\t\tif (preg_match_all(\"/^\\[(.*?)\\]/m\", $contents, $match))\n\t\t{\n\t\t\tforeach ($match[1] as $section)\n\t\t\t{\n\t\t\t\tif ($section{0} == '.' && !$this->read_hidden)\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tpreg_match(\"/\\[\".preg_quote($section).\"\\](.*?)(\\n\\[|\\Z)/s\",$contents,$match);\n\t\t\t\tif ($section{0} == '.')\n\t\t\t\t{\n\t\t\t\t\t$section = substr($section, 1);\n\t\t\t\t}\n\t\t\t\t$_result[$section] = $this->_parse_config_section($match[1]);\n\t\t\t}\n\t\t}\n\n\n\t\tif (!empty($var_name))\n\t\t{\n\t\t\tif (empty($section_name))\n\t\t\t{\n\t\t\t\treturn $_result[\"globals\"][$var_name];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(isset($_result[$section_name][$var_name]))\n\t\t\t\t{\n\t\t\t\t\treturn $_result[$section_name][$var_name];\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treturn array();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (empty($section_name))\n\t\t\t{\n\t\t\t\treturn $_result;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(isset($_result[$section_name]))\n\t\t\t\t{\n\t\t\t\t\treturn $_result[$section_name];\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treturn array();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction _parse_config_section($body)\n\t{\n\t\t$_result = array();\n\t\tpreg_match_all('!(\\n\\s*[a-zA-Z0-9_]+)\\s*=\\s*(' . $this->_qstr_regexp . ')!s', $body, $ini);\n\t\t$keys = $ini[1];\n\t\t$values = $ini[2];\n\t\tfor($i = 0, $for_max = count($ini[0]); $i < $for_max; $i++)\n\t\t{\n\t\t\tif ($this->booleanize)\n\t\t\t{\n\t\t\t\tif (preg_match('/^(' . $this->_bool_true_regexp . ')$/i', $values[$i]))\n\t\t\t\t{\n\t\t\t\t\t$values[$i] = true;\n\t\t\t\t}\n\t\t\t\telseif (preg_match('/^(' . $this->_bool_false_regexp . ')$/i', $values[$i]))\n\t\t\t\t{\n\t\t\t\t\t$values[$i] = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!is_numeric($values[$i]) && !is_bool($values[$i]))\n\t\t\t{\n\t\t\t\t$values[$i] = str_replace(\"\\n\",'',stripslashes(substr($values[$i], 1, -1)));\n\t\t\t}\n\t\t\tif ($this->overwrite || !isset($_result[trim($keys[$i])]))\n\t\t\t{\n\t\t\t\t$_result[trim($keys[$i])] = $values[$i];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (!is_array($_result[trim($keys[$i])]))\n\t\t\t\t{\n\t\t\t\t\t$_result[trim($keys[$i])] = array($_result[trim($keys[$i])]);\n\t\t\t\t}\n\t\t\t\t$_result[trim($keys[$i])][] = $values[$i];\n\t\t\t}\n\t\t}\n\t\treturn $_result;\n\t}\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/TemplateLite/class.template.php",
    "content": "<?php\n/*\n * Project:\ttemplate_lite, a smarter template engine\n * File:\tclass.template.php\n * Author:\tPaul Lockaby <paul@paullockaby.com>, Mark Dickenson <akapanamajack@sourceforge.net>\n * Copyright:\t2003,2004,2005 by Paul Lockaby, 2005,2006 Mark Dickenson\n *\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n *\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this library; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n *\n * The latest version of template_lite can be obtained from:\n * http://templatelite.sourceforge.net\n *\n */\n\nif (!defined('TEMPLATE_LITE_DIR')) {\n\tdefine('TEMPLATE_LITE_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);\n}\n\nclass Template_Lite {\n\t// public configuration variables\n\tvar $left_delimiter\t\t\t= \"{\";\t\t// the left delimiter for template tags\n\tvar $right_delimiter\t\t\t= \"}\";\t\t// the right delimiter for template tags\n\tvar $cache\t\t\t= false;\t// whether or not to allow caching of files\n\tvar $force_compile\t\t= false;\t// force a compile regardless of saved state\n\tvar $template_dir\t\t= \"templates\";\t// where the templates are to be found\n\tvar $plugins_dir\t\t\t= array(\"plugins\");\t// where the plugins are to be found\n\tvar $compile_dir\t\t= \"compiled\";\t// the directory to store the compiled files in\n\tvar $config_dir\t\t\t= \"templates\";\t// where the config files are\n\tvar $cache_dir\t\t\t= \"cached\";\t// where cache files are stored\n\tvar $config_overwrite\t\t= false;\n\tvar $config_booleanize\t\t= true;\n\tvar $config_fix_new_lines\t= true;\n\tvar $config_read_hidden\t\t= true;\n\tvar $cache_lifetime\t\t= 0;\t\t// how long the file in cache should be considered \"fresh\"\n\tvar $encode_file_name\t\t=\ttrue;\t// Set this to false if you do not want the name of the compiled/cached file to be md5 encoded.\n\tvar $php_extract_vars\t\t=\tfalse;\t// Set this to true if you want the $this->_tpl variables to be extracted for use by PHP code inside the template.\n\tvar $reserved_template_varname = \"templatelite\";\n\tvar $default_modifiers\t\t= array();\n\tvar $debugging\t   =  false;\n\n\tvar $compiler_file        =    'class.compiler.php';\n\tvar $compiler_class        =   'Template_Lite_Compiler';\n\tvar $config_class          =   'config';\n\n\t// gzip output configuration\n\tvar $send_now\t\t\t=  1;\n\tvar $force_compression\t=  0;\n\tvar $compression_level\t=  9;\n\tvar $enable_gzip\t\t=  1;\n\n\t// private internal variables\n\tvar $_vars\t\t= array();\t// stores all internal assigned variables\n\tvar $_confs\t\t= array();\t// stores all internal config variables\n\tvar $_plugins\t\t= array(\t   'modifier'\t  => array(),\n\t\t\t\t\t\t\t\t\t   'function'\t  => array(),\n\t\t\t\t\t\t\t\t\t   'block'\t\t => array(),\n\t\t\t\t\t\t\t\t\t   'compiler'\t  => array(),\n\t\t\t\t\t\t\t\t\t   'resource'\t  => array(),\n\t\t\t\t\t\t\t\t\t   'prefilter'\t => array(),\n\t\t\t\t\t\t\t\t\t   'postfilter'\t=> array(),\n\t\t\t\t\t\t\t\t\t   'outputfilter'  => array());\n\tvar $_linenum\t\t= 0;\t\t// the current line number in the file we are processing\n\tvar $_file\t\t= \"\";\t\t// the current file we are processing\n\tvar $_config_obj\t= null;\n\tvar $_compile_obj\t= null;\n\tvar $_cache_id\t\t= null;\n\tvar $_cache_dir\t\t= \"\";\t\t// stores where this specific file is going to be cached\n\tvar $_cache_info\t= array('config' => array(), 'template' => array());\n\tvar $_sl_md5\t\t= '39fc70570b8b60cbc1b85839bf242aff';\n\tvar $_version\t\t= 'V2.10 Template Lite 4 January 2007  (c) 2005-2007 Mark Dickenson. All rights reserved. Released LGPL.';\n\tvar $_version_date\t= \"2007-01-04 10:34:21\";\n\tvar $_config_module_loaded = false;\n\tvar $_templatelite_debug_info\t= array();\n\tvar $_templatelite_debug_loop\t= false;\n\tvar $_templatelite_debug_dir\t= \"\";\n\tvar $_inclusion_depth\t  = 0;\n\tvar $_null = null;\n\tvar $_resource_type = 1;\n\tvar $_resource_time;\n\tvar $_sections = array();\n\tvar $_foreach = array();\n\n\tfunction Template_Lite()\n\t{\n\t\t$this->_version_date = strtotime($this->_version_date);\n\t}\n\n\tfunction load_filter($type, $name)\n\t{\n\t\tswitch ($type)\n\t\t{\n\t\t\tcase 'output':\n\t\t\t\tinclude_once( $this->_get_plugin_dir($type . \"filter.\" . $name . \".php\") . $type . \"filter.\" . $name . \".php\");\n\t\t\t\t$this->_plugins['outputfilter'][$name] = \"template_\" . $type . \"filter_\" . $name;\n\t\t\t   break;\n\t\t\tcase 'pre':\n\t\t\tcase 'post':\n\t\t\t\tif (!isset($this->_plugins[$type . 'filter'][$name]))\n\t\t\t\t{\n\t\t\t\t\t$this->_plugins[$type . 'filter'][$name] = \"template_\" . $type . \"filter_\" . $name;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tfunction assign($key, $value = null)\n\t{\n\t\tif (is_array($key))\n\t\t{\n\t\t\tforeach($key as $var => $val)\n\t\t\t\tif ($var != \"\")\n\t\t\t\t{\n\t\t\t\t\t$this->_vars[$var] = $val;\n\t\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ($key != \"\")\n\t\t\t{\n\t\t\t\t$this->_vars[$key] = $value;\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction assign_by_ref($key, $value = null)\n\t{\n\t\tif ($key != '')\n\t\t{\n\t\t\t$this->_vars[$key] = &$value;\n\t\t}\n\t}\n\n\tfunction assign_config($key, $value = null)\n\t{\n\t\tif (is_array($key))\n\t\t{\n\t\t\tforeach($key as $var => $val)\n\t\t\t{\n\t\t\t\tif ($var != \"\")\n\t\t\t\t{\n\t\t\t\t\t$this->_confs[$var] = $val;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ($key != \"\")\n\t\t\t{\n\t\t\t\t$this->_confs[$key] = $value;\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction append($key, $value=null, $merge=false)\n\t{\n\t\tif (is_array($key))\n\t\t{\n\t\t\tforeach ($key as $_key => $_value)\n\t\t\t{\n\t\t\t\tif ($_key != '')\n\t\t\t\t{\n\t\t\t\t\tif(!@is_array($this->_vars[$_key]))\n\t\t\t\t\t{\n\t\t\t\t\t\tsettype($this->_vars[$_key],'array');\n\t\t\t\t\t}\n\t\t\t\t\tif($merge && is_array($_value))\n\t\t\t\t\t{\n\t\t\t\t\t\tforeach($_value as $_mergekey => $_mergevalue)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$this->_vars[$_key][$_mergekey] = $_mergevalue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$this->_vars[$_key][] = $_value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ($key != '' && isset($value))\n\t\t\t{\n\t\t\t\tif(!@is_array($this->_vars[$key]))\n\t\t\t\t{\n\t\t\t\t\tsettype($this->_vars[$key],'array');\n\t\t\t\t}\n\t\t\t\tif($merge && is_array($value))\n\t\t\t\t{\n\t\t\t\t\tforeach($value as $_mergekey => $_mergevalue)\n\t\t\t\t\t{\n\t\t\t\t\t\t$this->_vars[$key][$_mergekey] = $_mergevalue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$this->_vars[$key][] = $value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction append_by_ref($key, &$value, $merge=false)\n\t{\n\t\tif ($key != '' && isset($value))\n\t\t{\n\t\t\tif(!@is_array($this->_vars[$key]))\n\t\t\t{\n\t\t\t\tsettype($this->_vars[$key],'array');\n\t\t\t}\n\t\t\tif ($merge && is_array($value))\n\t\t\t{\n\t\t\t\tforeach($value as $_key => $_val)\n\t\t\t\t{\n\t\t\t\t\t$this->_vars[$key][$_key] = &$value[$_key];\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->_vars[$key][] = &$value;\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction clear_assign($key = null)\n\t{\n\t\tif ($key == null)\n\t\t{\n\t\t\t$this->_vars = array();\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (is_array($key))\n\t\t\t{\n\t\t\t\tforeach($key as $index => $value)\n\t\t\t\t{\n\t\t\t\t\tif (in_array($value, $this->_vars))\n\t\t\t\t\t{\n\t\t\t\t\t\tunset($this->_vars[$index]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (in_array($key, $this->_vars))\n\t\t\t\t{\n\t\t\t\t\tunset($this->_vars[$index]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction clear_all_assign()\n\t{\n\t\t$this->_vars = array();\n\t}\n\n\tfunction clear_config($key = null)\n\t{\n\t\tif ($key == null)\n\t\t{\n\t\t\t$this->_conf = array();\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (is_array($key))\n\t\t\t{\n\t\t\t\tforeach($key as $index => $value)\n\t\t\t\t{\n\t\t\t\t\tif (in_array($value, $this->_conf))\n\t\t\t\t\t{\n\t\t\t\t\t\tunset($this->_conf[$index]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (in_array($key, $this->_conf))\n\t\t\t\t{\n\t\t\t\t\tunset($this->_conf[$key]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction &get_template_vars($key = null)\n\t{\n\t\tif ($key == null)\n\t\t{\n\t\t\treturn $this->_vars;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (isset($this->_vars[$key]))\n\t\t\t{\n\t\t\t\treturn $this->_vars[$key];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn $this->_null;\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction &get_config_vars($key = null)\n\t{\n\t\tif ($key == null)\n\t\t{\n\t\t\treturn $this->_confs;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (isset($this->_confs[$key]))\n\t\t\t{\n\t\t\t\treturn $this->_confs[$key];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn $this->_null;\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction clear_compiled_tpl($file = null)\n\t{\n\t\t$this->_destroy_dir($file, null, $this->_get_dir($this->compile_dir));\n\t}\n\n\tfunction clear_cache($file = null, $cache_id = null, $compile_id = null, $exp_time = null)\n\t{\n\t\tif (!$this->cache)\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\t$this->_destroy_dir($file, $cache_id, $this->_get_dir($this->cache_dir));\n\t}\n\n\tfunction clear_all_cache($exp_time = null)\n\t{\n\t\t$this->clear_cache();\n\t}\n\n\tfunction is_cached($file, $cache_id = null)\n\t{\n\t\tif (!$this->force_compile && $this->cache && $this->_is_cached($file, $cache_id))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tfunction register_modifier($modifier, $implementation)\n\t{\n\t\t$this->_plugins['modifier'][$modifier] = $implementation;\n\t}\n\n\tfunction unregister_modifier($modifier)\n\t{\n\t\tunset($this->_plugins['modifier'][$modifier]);\n\t}\n\n\tfunction register_function($function, $implementation)\n\t{\n\t\t$this->_plugins['function'][$function] = $implementation;\n\t}\n\n\tfunction unregister_function($function)\n\t{\n\t\tunset($this->_plugins['function'][$function]);\n\t}\n\n\tfunction register_block($function, $implementation)\n\t{\n\t\t$this->_plugins['block'][$function] = $implementation;\n\t}\n\n\tfunction unregister_block($function)\n\t{\n\t\tunset($this->_plugins['block'][$function]);\n\t}\n\n\tfunction register_compiler($function, $implementation)\n\t{\n\t\t$this->_plugins['compiler'][$function] = $implementation;\n\t}\n\n\tfunction unregister_compiler($function)\n\t{\n\t\tunset($this->_plugins['compiler'][$function]);\n\t}\n\n\tfunction register_prefilter($function)\n\t{\n\t\t$_name = (is_array($function)) ? $function[1] : $function;\n\t\t$this->_plugins['prefilter'][$_name] = $_name;\n\t}\n\n\tfunction unregister_prefilter($function)\n\t{\n\t\tunset($this->_plugins['prefilter'][$function]);\n\t}\n\n\tfunction register_postfilter($function)\n\t{\n\t\t$_name = (is_array($function)) ? $function[1] : $function;\n\t\t$this->_plugins['postfilter'][$_name] = $_name;\n\t}\n\n\tfunction unregister_postfilter($function)\n\t{\n\t\tunset($this->_plugins['postfilter'][$function]);\n\t}\n\n\tfunction register_outputfilter($function)\n\t{\n\t\t$_name = (is_array($function)) ? $function[1] : $function;\n\t\t$this->_plugins['outputfilter'][$_name] = $_name;\n\t}\n\n\tfunction unregister_outputfilter($function)\n\t{\n\t\tunset($this->_plugins['outputfilter'][$function]);\n\t}\n\n\tfunction register_resource($type, $functions)\n\t{\n\t\tif (count($functions) == 4)\n\t\t{\n\t\t\t$this->_plugins['resource'][$type] = $functions;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->trigger_error(\"malformed function-list for '$type' in register_resource\");\n\t\t}\n\t}\n\n\tfunction unregister_resource($type)\n\t{\n\t\tunset($this->_plugins['resource'][$type]);\n\t}\n\n\tfunction template_exists($file)\n\t{\n\t\tif (file_exists($this->_get_dir($this->template_dir).$file))\n\t\t{\n\t\t\t$this->_resource_time = filemtime($this->_get_dir($this->template_dir).$file);\n\t\t\t$this->_resource_type = 1;\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (file_exists($file))\n\t\t\t{\n\t\t\t\t$this->_resource_time = filemtime($file);\n\t\t\t\t$this->_resource_type = \"file\";\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tfunction _get_resource($file)\n\t{\n\t\t$_resource_name = explode(':', trim($file));\n\n\t\tif (count($_resource_name) == 1 || $_resource_name[0] == \"file\")\n        {\n\t\t\tif($_resource_name[0] == \"file\")\n\t\t\t{\n\t\t\t\t$file = substr($file, 5);\n\t\t\t}\n\n\t\t\t$exists = $this->template_exists($file);\n\n\t\t\tif (!$exists)\n\t\t\t{\n\t\t\t\t$this->trigger_error(\"file '$file' does not exist\", E_USER_ERROR);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->_resource_type = $_resource_name[0];\n\t\t\t$file = substr($file, strlen($this->_resource_type) + 1);\n\t\t\t$exists = isset($this->_plugins['resource'][$this->_resource_type]) && call_user_func_array($this->_plugins['resource'][$this->_resource_type][1], array($file, &$resource_timestamp, &$this));\n\n\t\t\tif (!$exists)\n\t\t\t{\n\t\t\t\t$this->trigger_error(\"file '$file' does not exist\", E_USER_ERROR);\n\t\t\t}\n\t\t\t$this->_resource_time = $resource_timestamp;\n\t\t}\n\t\treturn $file;\n\t}\n\n\tfunction display($file, $cache_id = null)\n\t{\n\t\t$this->fetch($file, $cache_id, true);\n\t}\n\n\tfunction fetch($file, $cache_id = null, $display = false)\n\t{\n\t\t$file = $this->_get_resource($file);\n\n\t\tif ($this->debugging)\n\t\t{\n\t\t\t$this->_templatelite_debug_info[] = array('type'\t  => 'template',\n\t\t\t\t\t\t\t\t\t\t\t\t'filename'  => $file,\n\t\t\t\t\t\t\t\t\t\t\t\t'depth'\t => 0,\n\t\t\t\t\t\t\t\t\t\t\t\t'exec_time' => array_sum(explode(' ', microtime())) );\n\t\t\t$included_tpls_idx = count($this->_templatelite_debug_info) - 1;\n\t\t}\n\n\t\t$this->_cache_id = $cache_id;\n\t\t$this->template_dir = $this->_get_dir($this->template_dir);\n\t\t$this->compile_dir = $this->_get_dir($this->compile_dir);\n\t\tif ($this->cache)\n\t\t{\n\t\t\t$this->_cache_dir = $this->_build_dir($this->cache_dir, $this->_cache_id);\n\t\t}\n\n\t\t$name = ($this->encode_file_name) ? md5((($this->_resource_type == 1) ? $this->template_dir.$file : $this->_resource_type . \"_\" . $file)).'.php' : str_replace(\".\", \"_\", str_replace(\"/\", \"_\", $this->_resource_type . \"_\" . $file)).'.php';\n\n\t\t$this->_error_level = $this->debugging ? error_reporting() : error_reporting(error_reporting() & ~E_NOTICE);\n//\t\t$this->_error_level = error_reporting(E_ALL);\n\n\t\tif (!$this->force_compile && $this->cache && $this->_is_cached($file, $cache_id))\n\t\t{\n\t\t\tob_start();\n\t\t\tinclude($this->_cache_dir.$name);\n\t\t\t$output = ob_get_contents();\n\t\t\tob_end_clean();\n\t\t\t$output = substr($output, strpos($output, \"\\n\") + 1);\n\t\t}\n\t\telse\n\t\t{\n\n\t\t\t$output = $this->_fetch_compile($file, $cache_id);\n\n\t\t\tif ($this->cache)\n\t\t\t{\n\t\t\t\t$f = fopen($this->_cache_dir.$name, \"w\");\n\t\t\t\tfwrite($f, serialize($this->_cache_info) . \"\\n$output\");\n\t\t\t\tfclose($f);\n\t\t\t}\n\t\t}\n\n\t\tif (strpos($output, $this->_sl_md5) !== false)\n\t\t{\n\t\t\tpreg_match_all('!' . $this->_sl_md5 . '{_run_insert (.*)}' . $this->_sl_md5 . '!U',$output,$_match);\n\t\t\tforeach($_match[1] as $value)\n\t\t\t{\n\t\t\t\t$arguments = unserialize($value);\n\t\t\t\t$output = str_replace($this->_sl_md5 . '{_run_insert ' . $value . '}' . $this->_sl_md5, call_user_func_array('insert_' . $arguments['name'], array((array)$arguments, $this)), $output);\n\t\t\t}\n\t\t}\n\n\t\tforeach ($this->_plugins['outputfilter'] as $function)\n\t\t{\n\t\t\t$output = $function($output, $this);\n\t\t}\n\n\t\terror_reporting($this->_error_level);\n\n\t\tif ($this->debugging)\n\t\t{\n\t\t\t$this->_templatelite_debug_info[$included_tpls_idx]['exec_time'] = array_sum(explode(' ', microtime())) - $this->_templatelite_debug_info[$included_tpls_idx]['exec_time'];\n\t\t}\n\n\t\tif ($display)\n\t\t{\n\t\t\techo $output;\n\t\t\tif($this->debugging && !$this->_templatelite_debug_loop)\n\t\t\t{\n\t\t\t\t$this->debugging = false;\n\t\t\t\tif(!function_exists(\"template_generate_debug_output\"))\n\t\t\t\t{\n\t\t\t\t\trequire_once(TEMPLATE_LITE_DIR . \"internal/template.generate_debug_output.php\");\n\t\t\t\t}\n\t\t\t\t$debug_output = template_generate_debug_output($this);\n\t\t\t\t$this->debugging = true;\n\t\t\t\techo $debug_output;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn $output;\n\t\t}\n\t}\n\n\tfunction config_load($file, $section_name = null, $var_name = null)\n\t{\n\t\trequire_once(TEMPLATE_LITE_DIR . \"internal/template.config_loader.php\");\n\t}\n\n\tfunction _is_cached($file, $cache_id)\n\t{\n\t\t$this->_cache_dir = $this->_get_dir($this->cache_dir, $cache_id);\n\t\t$this->config_dir = $this->_get_dir($this->config_dir);\n\t\t$this->template_dir = $this->_get_dir($this->template_dir);\n\n\t\t$file = $this->_get_resource($file);\n\n\t\t$name = ($this->encode_file_name) ? md5((($this->_resource_type == 1) ? $this->template_dir.$file : $this->_resource_type . \"_\" . $file)).'.php' : str_replace(\".\", \"_\", str_replace(\"/\", \"_\", $this->_resource_type . \"_\" . $file)).'.php';\n\n\t\tif (file_exists($this->_cache_dir.$name) && (((time() - filemtime($this->_cache_dir.$name)) < $this->cache_lifetime) || $this->cache_lifetime == -1) && (filemtime($this->_cache_dir.$name) > $this->_resource_time))\n\t\t{\n\t\t\t$fh = fopen($this->_cache_dir.$name, \"r\");\n\t\t\tif (!feof($fh) && ($line = fgets($fh, filesize($this->_cache_dir.$name))))\n\t\t\t{\n\t\t\t\t$includes = unserialize($line);\n\t\t\t\tif (isset($includes['template']))\n\t\t\t\t{\n\t\t\t\t\tforeach($includes['template'] as $value)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!(file_exists($this->template_dir.$value) && (filemtime($this->_cache_dir.$name) > filemtime($this->template_dir.$value))))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (isset($includes['config']))\n\t\t\t\t{\n\t\t\t\t\tforeach($includes['config'] as $value)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!(file_exists($this->config_dir.$value) && (filemtime($this->_cache_dir.$name) > filemtime($this->config_dir.$value))))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfclose($fh);\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tfunction _fetch_compile_include($_templatelite_include_file, $_templatelite_include_vars)\n\t{\n\t\tif(!function_exists(\"template_fetch_compile_include\"))\n\t\t{\n\t\t\trequire_once(TEMPLATE_LITE_DIR . \"internal/template.fetch_compile_include.php\");\n\t\t}\n\t\treturn template_fetch_compile_include($_templatelite_include_file, $_templatelite_include_vars, $this);\n\t}\n\n\tfunction _fetch_compile($file)\n\t{\n\t\t$this->template_dir = $this->_get_dir($this->template_dir);\n\n\t\t$name = ($this->encode_file_name) ? md5((($this->_resource_type == 1) ? $this->template_dir.$file : $this->_resource_type . \"_\" . $file)).'.php' : str_replace(\".\", \"_\", str_replace(\"/\", \"_\", $this->_resource_type . \"_\" . $file)).'.php';\n\n\t\tif ($this->cache)\n\t\t{\n\t\t\tarray_push($this->_cache_info['template'], $file);\n\t\t}\n\n\t\tif (!$this->force_compile && file_exists($this->compile_dir.'c_'.$name)\n\t\t && (filemtime($this->compile_dir.'c_'.$name) > $this->_resource_time)\n\t\t && (filemtime($this->compile_dir.'c_'.$name) > $this->_version_date))\n\t\t{\n\t\t\tob_start();\n\t\t\tinclude($this->compile_dir.'c_'.$name);\n\t\t\t$output = ob_get_contents();\n\t\t\tob_end_clean();\n\t\t\terror_reporting($this->_error_level);\n\t\t\treturn $output;\n\t\t}\n\n\t\t$file_contents = \"\";\n\t\tif($this->_resource_type == 1)\n\t\t{\n\t\t\t$f = fopen($this->template_dir . $file, \"r\");\n\t\t\t$size = filesize($this->template_dir . $file);\n\t\t\tif ($size > 0)\n\t\t\t{\n\t\t\t\t$file_contents = fread($f, $size);\n\t\t\t}\n\t\t}\n\t\telse\n\t\tif($this->_resource_type == \"file\")\n\t\t{\n\t\t\t$f = fopen($file, \"r\");\n\t\t\t$size = filesize($file);\n\t\t\tif ($size > 0)\n\t\t\t{\n\t\t\t\t$file_contents = fread($f, $size);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcall_user_func_array($this->_plugins['resource'][$this->_resource_type][0], array($file, &$file_contents, &$this));\n\t\t}\n\n\t\t$this->_file = $file;\n\t\tfclose($f);\n\n\t\tif (!is_object($this->_compile_obj))\n\t\t{\n\t\t\tif (file_exists(TEMPLATE_LITE_DIR . $this->compiler_file)) {\n\t\t\t\trequire_once(TEMPLATE_LITE_DIR . $this->compiler_file);\n\t\t\t} else {\n\t\t\t\trequire_once($this->compiler_file);\n\t\t\t}\n\t\t\t$this->_compile_obj = new $this->compiler_class;\n\t\t}\n\t\t$this->_compile_obj->left_delimiter = $this->left_delimiter;\n\t\t$this->_compile_obj->right_delimiter = $this->right_delimiter;\n\t\t$this->_compile_obj->plugins_dir = &$this->plugins_dir;\n\t\t$this->_compile_obj->template_dir = &$this->template_dir;\n\t\t$this->_compile_obj->_vars = &$this->_vars;\n\t\t$this->_compile_obj->_confs = &$this->_confs;\n\t\t$this->_compile_obj->_plugins = &$this->_plugins;\n\t\t$this->_compile_obj->_linenum = &$this->_linenum;\n\t\t$this->_compile_obj->_file = &$this->_file;\n\t\t$this->_compile_obj->php_extract_vars = &$this->php_extract_vars;\n\t\t$this->_compile_obj->reserved_template_varname = &$this->reserved_template_varname;\n\t\t$this->_compile_obj->default_modifiers = $this->default_modifiers;\n\n\t\t$output = $this->_compile_obj->_compile_file($file_contents);\n\n\t\t$f = fopen($this->compile_dir.'c_'.$name, \"w\");\n\t\tfwrite($f, $output);\n\t\tfclose($f);\n\n\t\tob_start();\n\t\teval(' ?>' . $output . '<?php ');\n\t\t$output = ob_get_contents();\n\t\tob_end_clean();\n\t\treturn $output;\n\t}\n\n\tfunction _run_modifier()\n\t{\n\t\t$arguments = func_get_args();\n\t\tlist($variable, $modifier, $php_function, $_map_array) = array_splice($arguments, 0, 4);\n\t\tarray_unshift($arguments, $variable);\n\t\tif ($_map_array && is_array($variable))\n\t\t{\n\t\t\tforeach($variable as $key => $value)\n\t\t\t{\n\t\t\t\tif($php_function == \"PHP\")\n\t\t\t\t{\n\t\t\t\t\t$variable[$key] = call_user_func_array($modifier, $arguments);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$variable[$key] = call_user_func_array($this->_plugins[\"modifier\"][$modifier], $arguments);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif($php_function == \"PHP\")\n\t\t\t{\n\t\t\t\t$variable = call_user_func_array($modifier, $arguments);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$variable = call_user_func_array($this->_plugins[\"modifier\"][$modifier], $arguments);\n\t\t\t}\n\t\t}\n\t\treturn $variable;\n\t}\n\n\tfunction _run_insert($arguments)\n\t{\n\t\tif ($this->cache)\n\t\t{\n\t\t\treturn $this->_sl_md5 . '{_run_insert ' . serialize((array)$arguments) . '}' . $this->_sl_md5;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (!function_exists('insert_' . $arguments['name']))\n\t\t\t{\n\t\t\t\t$this->trigger_error(\"function 'insert_\" . $arguments['name'] . \"' does not exist in 'insert'\", E_USER_ERROR);\n\t\t\t}\n\t\t\tif (isset($arguments['assign']))\n\t\t\t{\n\t\t\t\t$this->assign($arguments['assign'], call_user_func_array('insert_' . $arguments['name'], array((array)$arguments, $this)));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn call_user_func_array('insert_' . $arguments['name'], array((array)$arguments, $this));\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction _get_dir($dir, $id = null)\n\t{\n\t\tif (empty($dir))\n\t\t{\n\t\t\t$dir = '.';\n\t\t}\n\t\tif (substr($dir, -1) != DIRECTORY_SEPARATOR)\n\t\t{\n\t\t\t$dir .= DIRECTORY_SEPARATOR;\n\t\t}\n\t\tif (!empty($id))\n\t\t{\n\t\t\t$_args = explode('|', $id);\n\t\t\tif (count($_args) == 1 && empty($_args[0]))\n\t\t\t{\n\t\t\t\treturn $dir;\n\t\t\t}\n\t\t\tforeach($_args as $value)\n\t\t\t{\n\t\t\t\t$dir .= $value.DIRECTORY_SEPARATOR;\n\t\t\t}\n\t\t}\n\t\treturn $dir;\n\t}\n\n\tfunction _get_plugin_dir($plugin_name)\n\t{\n\t\tstatic $_path_array = null;\n\n\t\t$plugin_dir_path = \"\";\n\t\t$_plugin_dir_list = is_array($this->plugins_dir) ? $this->plugins_dir : (array)$this->plugins_dir;\n\t\tforeach ($_plugin_dir_list as $_plugin_dir)\n\t\t{\n\t\t\tif (!preg_match(\"/^([\\/\\\\\\\\]|[a-zA-Z]:[\\/\\\\\\\\])/\", $_plugin_dir))\n\t\t\t{\n\t\t\t\t// path is relative\n\t\t\t\tif (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . $_plugin_dir . DIRECTORY_SEPARATOR . $plugin_name))\n\t\t\t\t{\n\t\t\t\t\t$plugin_dir_path = dirname(__FILE__) . DIRECTORY_SEPARATOR . $_plugin_dir . DIRECTORY_SEPARATOR;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// path is absolute\n\t\t\t\tif(!isset($_path_array))\n\t\t\t\t{\n\t\t\t\t\t$_ini_include_path = ini_get('include_path');\n\n\t\t\t\t\tif(strstr($_ini_include_path,';'))\n\t\t\t\t\t{\n\t\t\t\t\t\t// windows pathnames\n\t\t\t\t\t\t$_path_array = explode(';',$_ini_include_path);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$_path_array = explode(':',$_ini_include_path);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif(!in_array($_plugin_dir,$_path_array))\n\t\t\t\t{\n\t\t\t\t\tarray_unshift($_path_array,$_plugin_dir);\n\t\t\t\t}\n\n\t\t\t\tforeach ($_path_array as $_include_path)\n\t\t\t\t{\n\t\t\t\t\tif (file_exists($_include_path . DIRECTORY_SEPARATOR . $plugin_name))\n\t\t\t\t\t{\n\t\t\t\t\t\t$plugin_dir_path = $_include_path . DIRECTORY_SEPARATOR;\n\t\t\t\t\t\tbreak 2;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $plugin_dir_path;\n\t}\n\n//\tfunction _parse_resource_link($resource_link)\n//\t{\n//\t\t$stuffing = \"file:/this/is/the/time_5-23.tpl\";\n//\t\t$stuffing_data = explode(\":\", $stuffing);\n//\t\tpreg_match_all('/(?:([0-9a-z._-]+))/i', $stuffing, $stuff);\n//\t\tprint_r($stuff);\n//\t\techo \"<br>Path: \" . str_replace($stuff[0][count($stuff[0]) - 1], \"\", $stuffing);\n//\t\techo \"<br>Filename: \" . $stuff[0][count($stuff[0]) - 1];\n//\t}\n\n\tfunction _build_dir($dir, $id)\n\t{\n\t\tif(!function_exists(\"template_build_dir\"))\n\t\t{\n\t\t\trequire_once(TEMPLATE_LITE_DIR . \"internal/template.build_dir.php\");\n\t\t}\n\t\treturn template_build_dir($dir, $id, $this);\n\t}\n\n\tfunction _destroy_dir($file, $id, $dir)\n\t{\n\t\tif(!function_exists(\"template_destroy_dir\"))\n\t\t{\n\t\t\trequire_once(TEMPLATE_LITE_DIR . \"internal/template.destroy_dir.php\");\n\t\t}\n\t\treturn template_destroy_dir($file, $id, $dir, $this);\n\t}\n\n\tfunction trigger_error($error_msg, $error_type = E_USER_ERROR, $file = null, $line = null)\n\t{\n\t\tif(isset($file) && isset($line))\n\t\t{\n\t\t\t$info = ' ('.basename($file).\", line $line)\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$info = null;\n\t\t}\n\t\ttrigger_error('TPL: [in ' . $this->_file . ' line ' . $this->_linenum . \"]: syntax error: $error_msg$info\", $error_type);\n\t}\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/TemplateLite/internal/compile.compile_config.php",
    "content": "<?php\n/**\n * Template Lite compile config variables - template internal module\n *\n * Type:\t template\n * Name:\t compile_config\n */\n\nfunction compile_compile_config($variable, &$object)\n{\n\t$_result\t= \"\";\n\n\t// remove the beginning and ending #\n\t$variable = substr($variable, 1, -1);\n\n\t// get [foo] and .foo and (...) pieces\t\t\t\n\tpreg_match_all('!(?:^\\w+)|(?:' . $object->_var_bracket_regexp . ')|\\.\\$?\\w+|\\S+!', $variable, $_match);\n\t$variable = $_match[0];\n\t$var_name = array_shift($variable);\n\n\t$_result = \"\\$this->_confs['$var_name']\";\n\tforeach ($variable as $var)\n\t{\n\t\tif ($var{0} == '[')\n\t\t{\n\t\t\t$var = substr($var, 1, -1);\n\t\t\tif (is_numeric($var))\n\t\t\t{\n\t\t\t\t$_result .= \"[$var]\";\n\t\t\t}\n\t\t\telseif ($var{0} == '$')\n\t\t\t{\n\t\t\t\t$_result .= \"[\" . $object->_compile_variable($var) . \"]\";\n\t\t\t}\n\t\t\telseif ($var{0} == '#')\n\t\t\t{\n\t\t\t\t$_result .= \"[\" . $object->_compile_config($var) . \"]\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$_result .= \"['$var']\";\n\t\t\t}\n\t   }\n\t   else if ($var{0} == '.')\n\t   {\n  \t\t\t\tif ($var{1} == '$')\n\t\t\t{\n   \t\t\t\t$_result .= \"[\\$this->_TPL['\" . substr($var, 2) . \"']]\";\n\t\t\t}\n\t   \t\telse\n\t\t\t{\n\t\t   \t\t$_result .= \"['\" . substr($var, 1) . \"']\";\n\t\t\t}\n\t\t}\n\t\telse if (substr($var,0,2) == '->')\n\t\t{\n\t\t\tif(substr($var,2,2) == '__')\n\t\t\t{\n\t\t\t\t$object->trigger_error('call to internal object members is not allowed', E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t}\n\t\t\telse if (substr($var, 2, 1) == '$')\n\t\t\t{\n\t\t\t\t$_output .= '->{(($var=$this->_TPL[\\''.substr($var,3).'\\']) && substr($var,0,2)!=\\'__\\') ? $_var : $this->trigger_error(\"cannot access property \\\\\"$var\\\\\"\")}';\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$object->trigger_error('#' . $var_name.implode('', $variable) . '# is an invalid reference', E_USER_ERROR, __FILE__, __LINE__);\n\t\t}\n\t}\n\treturn $_result;\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/TemplateLite/internal/compile.compile_custom_block.php",
    "content": "<?php\n/**\n * Template Lite compile custom block - template internal module\n *\n * Type:\t template\n * Name:\t compile_custom_block\n */\n\nfunction compile_compile_custom_block($function, $modifiers, $arguments, &$_result, &$object)\n{\n\tif ($function{0} == '/')\n\t{\n\t\t$start_tag = false;\n\t\t$function = substr($function, 1);\n\t}\n\telse\n\t{\n\t\t$start_tag = true;\n\t}\n\n\tif ($function = $object->_plugin_exists($function, \"block\"))\n\t{\n\t\tif ($start_tag)\n\t\t{\n\t\t\t$_args = $object->_parse_arguments($arguments);\n\t\t\tforeach($_args as $key => $value)\n\t\t\t{\n\t\t\t\tif (is_bool($value))\n\t\t\t\t{\n\t\t\t\t\t$value = $value ? 'true' : 'false';\n\t\t\t\t}\n\t\t\t\tif (is_null($value))\n\t\t\t\t{\n\t\t\t\t\t$value = 'null';\n\t\t\t\t}\n\t\t\t\t$_args[$key] = \"'$key' => $value\";\n\t\t\t}\n\t\t\t$_result = \"<?php \\$this->_tag_stack[] = array('$function', array(\".implode(',', (array)$_args).\")); \";\n\t\t\t$_result .= $function . '(array(' . implode(',', (array)$_args) .'), null, $this); ';\n\t\t\t$_result .= 'ob_start(); ?>';\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$_result .= '<?php $this->_block_content = ob_get_contents(); ob_end_clean(); ';\n\t\t\t$_result .= '$this->_block_content = ' . $function . '($this->_tag_stack[count($this->_tag_stack) - 1][1], $this->_block_content, $this); ';\n\t\t\tif (!empty($modifiers))\n\t\t\t{\n\t\t\t\t$_result .= '$this->_block_content = ' . $object->_parse_modifier('$this->_block_content', $modifiers) . '; ';\n\t\t\t}\n\t\t\t$_result .= 'echo $this->_block_content; array_pop($this->_tag_stack); ?>';\n\t\t}\n\t\treturn true;\n\t}\n\telse\n\t{\n\t\treturn false;\n\t}\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/TemplateLite/internal/compile.compile_custom_function.php",
    "content": "<?php\n/**\n * Template Lite compile custom function - template internal module\n *\n * Type:\t template\n * Name:\t compile_custom_function\n */\n\nfunction compile_compile_custom_function($function, $modifiers, $arguments, &$_result, &$object)\n{\n\tif ($function = $object->_plugin_exists($function, \"function\"))\n\t{\n\t\t$_args = $object->_parse_arguments($arguments);\n\t\tforeach($_args as $key => $value)\n\t\t{\n\t\t\tif (is_bool($value))\n\t\t\t{\n\t\t\t\t$value = $value ? 'true' : 'false';\n\t\t\t}\n\t\t\tif (is_null($value))\n\t\t\t{\n\t\t\t\t$value = 'null';\n\t\t\t}\n\t\t\t$_args[$key] = \"'$key' => $value\";\n\t\t}\n\t\t$_result = '<?php echo ';\n\t\tif (!empty($modifiers))\n\t\t{\n\t\t\t$_result .= $object->_parse_modifier($function . '(array(' . implode(',', (array)$_args) . '), $this)', $modifiers) . '; ';\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$_result .= $function . '(array(' . implode(',', (array)$_args) . '), $this);';\n\t\t}\n\t\t$_result .= '?>';\n\t\treturn true;\n\t}\n\telse\n\t{\n\t\treturn false;\n\t}\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/TemplateLite/internal/compile.compile_if.php",
    "content": "<?php\n/**\n * Template Lite compile IF tag - template internal module\n *\n * Type:\t template\n * Name:\t compile_parse_is_expr\n */\n\nfunction compile_compile_if($arguments, $elseif, $while, &$object)\n{\n\t$_result\t= \"\";\n\t$_match\t\t= array();\n\t$_args\t\t= array();\n\t$_is_arg_stack\t= array();\n\n\t// extract arguments from the equation\n\tpreg_match_all('/(?>(' . $object->_var_regexp . '|\\/?' . $object->_svar_regexp . '|\\/?' . $object->_func_regexp . ')(?:' . $object->_mod_regexp . '*)?|\\-?0[xX][0-9a-fA-F]+|\\-?\\d+(?:\\.\\d+)?|\\.\\d+|!==|===|==|!=|<>|<<|>>|<=|>=|\\&\\&|\\|\\||\\(|\\)|,|\\!|\\^|=|\\&|\\~|<|>|\\%|\\+|\\-|\\/|\\*|\\@|\\b\\w+\\b|\\S+)/x', $arguments, $_match);\n\t$_args = $_match[0];\n\n\t// make sure we have balanced parenthesis\n\t$_args_count = array_count_values($_args);\n\tif(isset($_args_count['(']) && $_args_count['('] != $_args_count[')'])\n\t{\n\t\t$object->trigger_error(\"unbalanced parenthesis in if statement\", E_USER_ERROR, __FILE__, __LINE__);\n\t}\n\n\t$count_args = count($_args);\n\tfor ($i = 0, $for_max = $count_args; $i < $for_max; $i++)\n\t{\n\t\t$_arg = &$_args[$i];\n\t\tswitch (strtolower($_arg))\n\t\t{\n\t\t\tcase '!':\n\t\t\tcase '%':\n\t\t\tcase '!==':\n\t\t\tcase '==':\n\t\t\tcase '===':\n\t\t\tcase '>':\n\t\t\tcase '<':\n\t\t\tcase '!=':\n\t\t\tcase '<>':\n\t\t\tcase '<<':\n\t\t\tcase '>>':\n\t\t\tcase '<=':\n\t\t\tcase '>=':\n\t\t\tcase '&&':\n\t\t\tcase '||':\n\t\t\tcase '^':\n\t\t\tcase '&':\n\t\t\tcase '~':\n\t\t\tcase ')':\n\t\t\tcase ',':\n\t\t\tcase '+':\n\t\t\tcase '-':\n\t\t\tcase '*':\n\t\t\tcase '/':\n\t\t\tcase '@':\n\t\t\t\tbreak;\n\t\t\tcase 'eq':\n\t\t\t\t$_arg = '==';\n\t\t\t\tbreak;\n\t\t\tcase 'ne':\n\t\t\tcase 'neq':\n\t\t\t\t$_arg = '!=';\n\t\t\t\tbreak;\n\t\t\tcase 'lt':\n\t\t\t\t$_arg = '<';\n\t\t\t\tbreak;\n\t\t\tcase 'le':\n\t\t\tcase 'lte':\n\t\t\t\t$_arg = '<=';\n\t\t\t\tbreak;\n\t\t\tcase 'gt':\n\t\t\t\t$_arg = '>';\n\t\t\t\tbreak;\n\t\t\tcase 'ge':\n\t\t\tcase 'gte':\n\t\t\t\t$_arg = '>=';\n\t\t\t\tbreak;\n\t\t\tcase 'and':\n\t\t\t\t$_arg = '&&';\n\t\t\t\tbreak;\n\t\t\tcase 'or':\n\t\t\t\t$_arg = '||';\n\t\t\t\tbreak;\n\t\t\tcase 'not':\n\t\t\t\t$_arg = '!';\n\t\t\t\tbreak;\n\t\t\tcase 'mod':\n\t\t\t\t$_arg = '%';\n\t\t\t\tbreak;\n\t\t\tcase '(':\n\t\t\t\tarray_push($_is_arg_stack, $i);\n\t\t\t\tbreak;\n\t\t\tcase 'is':\n\t\t\t\tif ($_args[$i-1] == ')')\n\t\t\t\t{\n\t\t\t\t\t$is_arg_start = array_pop($is_arg_stack);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$_is_arg_count = count($_args);\n\t\t\t\t\t$is_arg = implode(' ', array_slice($_args, $is_arg_start, $i - $is_arg_start));\n\t\t\t\t\t$_arg_tokens = $object->_parse_is_expr($is_arg, array_slice($_args, $i+1));\n\t\t\t\t\tarray_splice($_args, $is_arg_start, count($_args), $_arg_tokens);\n\t\t\t\t\t$i = $_is_arg_count - count($_args);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tpreg_match('/(?:(' . $object->_var_regexp . '|' . $object->_svar_regexp . '|' . $object->_func_regexp . ')(' . $object->_mod_regexp . '*)(?:\\s*[,\\.]\\s*)?)(?:\\s+(.*))?/xs', $_arg, $_match);\n\t\t\t\tif (isset($_match[0]{0}) && ($_match[0]{0} == '$' || ($_match[0]{0} == '#' && $_match[0]{strlen($_match[0]) - 1} == '#') || $_match[0]{0} == \"'\" || $_match[0]{0} == '\"' || $_match[0]{0} == '%'))\n\t\t\t\t{\n\t\t\t\t\t// process a variable\n\t\t\t\t\t$_arg = $object->_parse_variables(array($_match[1]), array($_match[2]));\n\t\t\t\t}\n\t\t\t\telseif (is_numeric($_arg))\n\t\t\t\t{\n\t\t\t\t\t// pass the number through\n\t\t\t\t}\n\t\t\t\telseif (function_exists($_match[0]) || $_match[0] == \"empty\" || $_match[0] == \"isset\" || $_match[0] == \"unset\" || strtolower($_match[0]) == \"true\" || strtolower($_match[0]) == \"false\" || strtolower($_match[0]) == \"null\")\n\t\t\t\t{\n\t\t\t\t\t// pass the function through\n\t\t\t\t}\n\t\t\t\telseif (empty($_arg))\n\t\t\t\t{\n\t\t\t\t\t// pass the empty argument through\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$object->trigger_error(\"unidentified token '$_arg'\", E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tif($while)\n\t{\n\t\treturn implode(' ', $_args);\n\t}\n\telse\n\t{\n\t\tif ($elseif)\n\t\t{\n\t\t\treturn '<?php elseif ('.implode(' ', $_args).'): ?>';\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn '<?php if ('.implode(' ', $_args).'): ?>';\n\t\t}\n\t}\n\treturn $_result;\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/TemplateLite/internal/compile.generate_compiler_debug_output.php",
    "content": "<?php\n/**\n * Template Lite generate_debug_output template internal module\n *\n * Type:\t template\n * Name:\t generate_debug_output\n */\n\nfunction generate_compiler_debug_output(&$object)\n{\n    $debug_output = \"\\$assigned_vars = \\$this->_vars;\\n\";\n    $debug_output .= \"ksort(\\$assigned_vars);\\n\";\n    $debug_output .= \"if (@is_array(\\$this->_config[0])) {\\n\";\n    $debug_output .= \"    \\$config_vars = \\$this->_config[0];\\n\";\n    $debug_output .= \"    ksort(\\$config_vars);\\n\";\n    $debug_output .= \"    \\$this->assign('_debug_config_keys', array_keys(\\$config_vars));\\n\";\n    $debug_output .= \"    \\$this->assign('_debug_config_vals', array_values(\\$config_vars));\\n\";\n    $debug_output .= \"}   \\n\";\n\t\n    $debug_output .= \"\\$included_templates = \\$this->_templatelite_debug_info;\\n\";\n\n    $debug_output .= \"\\$this->assign('_debug_keys', array_keys(\\$assigned_vars));\\n\";\n    $debug_output .= \"\\$this->assign('_debug_vals', array_values(\\$assigned_vars));\\n\";\n    $debug_output .= \"\\$this->assign('_debug_tpls', \\$included_templates);\\n\";\n\n\t$debug_output .= \"\\$this->_templatelite_debug_loop = true;\\n\";\n\t$debug_output .= \"\\$this->_templatelite_debug_dir = \\$this->template_dir;\\n\";\n\t$debug_output .= \"\\$this->template_dir = TEMPLATE_LITE_DIR . 'internal/';\\n\";\n\t$debug_output .= \"echo \\$this->_fetch_compile('debug.tpl');\\n\";\n\t$debug_output .= \"\\$this->template_dir = \\$this->_templatelite_debug_dir;\\n\";\n\t$debug_output .= \"\\$this->_templatelite_debug_loop = false; \\n\";\n\treturn $debug_output;\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/TemplateLite/internal/compile.include.php",
    "content": "<?php\n/**\n * Template Lite\n *\n * Type:\t compile\n * Name:\t section_start\n */\n\nfunction compile_include($arguments, &$object)\n{\n\t$_args = $object->_parse_arguments($arguments);\n\n\t$arg_list = array();\n\tif (empty($_args['file']))\n\t{\n\t\t$object->trigger_error(\"missing 'file' attribute in include tag\", E_USER_ERROR, __FILE__, __LINE__);\n\t}\n\n\tforeach ($_args as $arg_name => $arg_value)\n\t{\n\t\tif ($arg_name == 'file')\n\t\t{\n\t\t\t$include_file = $arg_value;\n\t\t\tcontinue;\n\t\t}\n\t\telse if ($arg_name == 'assign')\n\t\t{\n\t\t\t$assign_var = $arg_value;\n\t\t\tcontinue;\n\t\t}\n\t\tif (is_bool($arg_value))\n\t\t{\n\t\t\t$arg_value = $arg_value ? 'true' : 'false';\n\t\t}\n\t\t$arg_list[] = \"'$arg_name' => $arg_value\";\n\t}\n\n\tif (isset($assign_var))\n\t{\n\t\t$output = '<?php $_templatelite_tpl_vars = $this->_vars;' .\n\t\t\t\"\\n\\$this->assign(\" . $assign_var . \", \\$this->_fetch_compile_include(\" . $include_file . \", array(\".implode(',', (array)$arg_list).\")));\\n\" .\n\t\t\t\"\\$this->_vars = \\$_templatelite_tpl_vars;\\n\" .\n\t\t\t\"unset(\\$_templatelite_tpl_vars);\\n\" .\n\t\t\t' ?>';\n\t}\n\telse\n\t{\n\t\t$output = '<?php $_templatelite_tpl_vars = $this->_vars;' .\n\t\t\t\"\\necho \\$this->_fetch_compile_include(\" . $include_file . \", array(\".implode(',', (array)$arg_list).\"));\\n\" .\n\t\t\t\"\\$this->_vars = \\$_templatelite_tpl_vars;\\n\" .\n\t\t\t\"unset(\\$_templatelite_tpl_vars);\\n\" .\n\t\t\t' ?>';\n\t}\n\treturn $output;\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/TemplateLite/internal/compile.parse_is_expr.php",
    "content": "<?php\n/**\n * Template Lite compile IS exprenssion in IF tag - template internal module\n *\n * Type:\t template\n * Name:\t compile_parse_is_expr\n */\n\nfunction compile_parse_is_expr($is_arg, $_args, &$object)\n{\n\t$expr_end = 0;\n\t$negate_expr = false;\n\n\tif (($first_arg = array_shift($_args)) == 'not') {\n\t\t$negate_expr = true;\n\t\t$expr_type = array_shift($_args);\n\t}\n\telse\n\t{\n\t\t$expr_type = $first_arg;\n\t}\n\n\tswitch ($expr_type) {\n\t\tcase 'even':\n\t\t\tif (isset($_args[$expr_end]) && $_args[$expr_end] == 'by')\n\t\t\t{\n\t\t\t\t$expr_end++;\n\t\t\t\t$expr_arg = $_args[$expr_end++];\n\t\t\t\t$expr = \"!(1 & ($is_arg / \" . $object->_parse_variable($expr_arg) . \"))\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$expr = \"!(1 & $is_arg)\";\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase 'odd':\n\t\t\tif (isset($_args[$expr_end]) && $_args[$expr_end] == 'by')\n\t\t\t{\n\t\t\t\t$expr_end++;\n\t\t\t\t$expr_arg = $_args[$expr_end++];\n\t\t\t\t$expr = \"(1 & ($is_arg / \" . $object->_parse_variable($expr_arg) . \"))\";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$expr = \"(1 & $is_arg)\";\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 'div':\n\t\t\t\tif (@$_args[$expr_end] == 'by')\n\t\t\t\t{\n\t\t\t\t\t$expr_end++;\n\t\t\t\t\t$expr_arg = $_args[$expr_end++];\n\t\t\t\t\t$expr = \"!($is_arg % \" . $object->_parse_variable($expr_arg) . \")\";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$object->trigger_error(\"expecting 'by' after 'div'\", E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t\t}\n\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\t$object->trigger_error(\"unknown 'is' expression - '$expr_type'\", E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t\tbreak;\n\t\t}\n\n\tif ($negate_expr) {\n\t\t$expr = \"!($expr)\";\n\t}\n\n\tarray_splice($_args, 0, $expr_end, $expr);\n\n\treturn $_args;\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/TemplateLite/internal/compile.section_start.php",
    "content": "<?php\n/**\n * Template Lite section_start compile plugin converted from Smarty\n *\n * Type:\t compile\n * Name:\t section_start\n */\n\nfunction compile_section_start($arguments, &$object)\n{\n\t$attrs = $object->_parse_arguments($arguments);\n\t$arg_list = array();\n\n\t$output = '<?php ';\n\t$section_name = $attrs['name'];\n\tif (empty($section_name))\n\t{\n\t\t$object->trigger_error(\"missing section name\", E_USER_ERROR, __FILE__, __LINE__);\n\t}\n\n\t$output .= \"if (isset(\\$this->_sections['$section_name'])) unset(\\$this->_sections['$section_name']);\\n\";\n\t$section_props = \"\\$this->_sections['$section_name']\";\n\n\tforeach ($attrs as $attr_name => $attr_value)\n\t{\n\t\tswitch ($attr_name)\n\t\t{\n\t\t\tcase 'loop':\n\t\t\t\t$output .= \"{$section_props}['loop'] = is_array($attr_value) ? count($attr_value) : max(0, (int)$attr_value);\\n\";\n\t\t\t\tbreak;\n\n\t\t\tcase 'show':\n\t\t\t\tif (is_bool($attr_value))\n\t\t\t\t{\n\t\t\t\t\t$show_attr_value = $attr_value ? 'true' : 'false';\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$show_attr_value = \"(bool)$attr_value\";\n\t\t\t\t}\n\t\t\t\t$output .= \"{$section_props}['show'] = $show_attr_value;\\n\";\n\t\t\t\tbreak;\n\n\t\t\tcase 'name':\n\t\t\t\t$output .= \"{$section_props}['$attr_name'] = '$attr_value';\\n\";\n\t\t\t\tbreak;\n\n\t\t\tcase 'max':\n\t\t\tcase 'start':\n\t\t\t\t$output .= \"{$section_props}['$attr_name'] = (int)$attr_value;\\n\";\n\t\t\t\tbreak;\n\n\t\t\tcase 'step':\n\t\t\t\t$output .= \"{$section_props}['$attr_name'] = ((int)$attr_value) == 0 ? 1 : (int)$attr_value;\\n\";\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\t$object->trigger_error(\"unknown section attribute - '$attr_name'\", E_USER_ERROR, __FILE__, __LINE__);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (!isset($attrs['show']))\n\t{\n\t\t$output .= \"{$section_props}['show'] = true;\\n\";\n\t}\n\n\tif (!isset($attrs['loop']))\n\t{\n\t\t$output .= \"{$section_props}['loop'] = 1;\\n\";\n\t}\n\n\tif (!isset($attrs['max']))\n\t{\n\t\t$output .= \"{$section_props}['max'] = {$section_props}['loop'];\\n\";\n\t}\n\telse\n\t{\n\t\t$output .= \"if ({$section_props}['max'] < 0)\\n\" .\n\t\t\t\t\t\"\t{$section_props}['max'] = {$section_props}['loop'];\\n\";\n\t}\n\n\tif (!isset($attrs['step']))\n\t{\n\t\t$output .= \"{$section_props}['step'] = 1;\\n\";\n\t}\n\n\tif (!isset($attrs['start']))\n\t{\n\t\t$output .= \"{$section_props}['start'] = {$section_props}['step'] > 0 ? 0 : {$section_props}['loop']-1;\\n\";\n\t}\n\telse\n\t{\n\t\t$output .= \"if ({$section_props}['start'] < 0)\\n\" .\n\t\t\t\t   \"\t{$section_props}['start'] = max({$section_props}['step'] > 0 ? 0 : -1, {$section_props}['loop'] + {$section_props}['start']);\\n\" .\n\t\t\t\t   \"else\\n\" .\n\t\t\t\t   \"\t{$section_props}['start'] = min({$section_props}['start'], {$section_props}['step'] > 0 ? {$section_props}['loop'] : {$section_props}['loop']-1);\\n\";\n\t}\n\n\t$output .= \"if ({$section_props}['show']) {\\n\";\n\tif (!isset($attrs['start']) && !isset($attrs['step']) && !isset($attrs['max']))\n\t{\n\t\t$output .= \"\t{$section_props}['total'] = {$section_props}['loop'];\\n\";\n\t}\n\telse\n\t{\n\t\t$output .= \"\t{$section_props}['total'] = min(ceil(({$section_props}['step'] > 0 ? {$section_props}['loop'] - {$section_props}['start'] : {$section_props}['start']+1)/abs({$section_props}['step'])), {$section_props}['max']);\\n\";\n\t}\n\t$output .= \"\tif ({$section_props}['total'] == 0)\\n\" .\n\t\t\t   \"\t\t{$section_props}['show'] = false;\\n\" .\n\t\t\t   \"} else\\n\" .\n\t\t\t   \"\t{$section_props}['total'] = 0;\\n\";\n\n\t$output .= \"if ({$section_props}['show']):\\n\";\n\t$output .= \"\n\t\tfor ({$section_props}['index'] = {$section_props}['start'], {$section_props}['iteration'] = 1;\n\t\t\t {$section_props}['iteration'] <= {$section_props}['total'];\n\t\t\t {$section_props}['index'] += {$section_props}['step'], {$section_props}['iteration']++):\\n\";\n\t$output .= \"{$section_props}['rownum'] = {$section_props}['iteration'];\\n\";\n\t$output .= \"{$section_props}['index_prev'] = {$section_props}['index'] - {$section_props}['step'];\\n\";\n\t$output .= \"{$section_props}['index_next'] = {$section_props}['index'] + {$section_props}['step'];\\n\";\n\t$output .= \"{$section_props}['first']\t  = ({$section_props}['iteration'] == 1);\\n\";\n\t$output .= \"{$section_props}['last']\t   = ({$section_props}['iteration'] == {$section_props}['total']);\\n\";\n\n\t$output .= \"?>\";\n\n\treturn $output;\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/TemplateLite/internal/debug.tpl",
    "content": "{* templatelite debug console *}\n\n{if isset($_templatelite_debug_output) and $_templatelite_debug_output eq \"html\"}\n\t<table border=0 width=100%>\n\t<tr bgcolor=#cccccc><th colspan=2>Template Lite Debug Console</th></tr>\n\t<tr bgcolor=#cccccc><td colspan=2><b>Included templates & config files (load time in seconds):</b></td></tr>\n\t{foreach key=key value=templates from=$_debug_tpls}\n\t\t<tr bgcolor={if $key % 2}#eeeeee{else}#fafafa{/if}>\n\t\t<td colspan=2><tt>{for start=0 stop=$_debug_tpls[$key].depth}&nbsp;&nbsp;&nbsp;{/for}\n\t\t<font color={if $_debug_tpls[$key].type eq \"template\"}brown{elseif $_debug_tpls[$key].type eq \"insert\"}black{else}green{/if}>\n\t\t{$_debug_tpls[$key].filename}</font>{if isset($_debug_tpls[$key].exec_time)} \n\t\t<font size=-1><i>({$_debug_tpls[$key].exec_time|string_format:\"%.5f\"} seconds){if $key eq 0} (total){/if}\n\t\t</i></font>{/if}</tt></td></tr>\n\t{foreachelse}\n\t\t<tr bgcolor=#eeeeee><td colspan=2><tt><i>No template assigned</i></tt></td></tr>\t\n\t{/foreach}\n\t<tr bgcolor=#cccccc><td colspan=2><b>Assigned template variables:</b></td></tr>\n\t{foreach key=key value=vars from=$_debug_keys}\n\t\t<tr bgcolor={if $key % 2}#eeeeee{else}#fafafa{/if}>\n\t\t<td valign=top><tt><font color=blue>{ldelim}${$_debug_keys[$key]}{rdelim}</font></tt></td>\n\t\t<td nowrap><tt><font color=green>{$_debug_vals[$key]|@debug_print_var}</font></tt></td></tr>\n\t{foreachelse}\n\t\t<tr bgcolor=#eeeeee><td colspan=2><tt><i>No template variables assigned</i></tt></td></tr>\t\n\t{/foreach}\n\t<tr bgcolor=#cccccc><td colspan=2><b>Assigned config file variables (outer template scope):</b></td></tr>\n\t{foreach key=key value=config_vars from=$_debug_config_keys}\n\t\t<tr bgcolor={if $key % 2}#eeeeee{else}#fafafa{/if}>\n\t\t<td valign=top><tt><font color=maroon>{ldelim}#{$_debug_config_keys[$key]}#{rdelim}</font></tt></td>\n\t\t<td><tt><font color=green>{$_debug_config_vals[$key]|@debug_print_var}</font></tt></td></tr>\n\t{foreachelse}\n\t\t<tr bgcolor=#eeeeee><td colspan=2><tt><i>No config vars assigned</i></tt></td></tr>\t\n\t{/foreach}\n\t</table>\n{else}\n<SCRIPT language=javascript>\n\tif( self.name == '' ) {ldelim}\n\t   var title = 'Console';\n\t{rdelim}\n\telse {ldelim}\n\t   var title = 'Console_' + self.name;\n\t{rdelim}\n\t_templatelite_console = window.open(\"\",title.value,\"width=680,height=600,resizable,scrollbars=yes\");\n\t_templatelite_console.document.write(\"<HTML><TITLE>Template Lite Debug Console_\"+self.name+\"</TITLE><BODY bgcolor=#ffffff>\");\n\t_templatelite_console.document.write(\"<table border=0 width=100%>\");\n\t_templatelite_console.document.write(\"<tr bgcolor=#cccccc><th colspan=2>Template Lite Debug Console</th></tr>\");\n\t_templatelite_console.document.write(\"<tr bgcolor=#cccccc><td colspan=2><b>Included templates & config files (load time in seconds):</b></td></tr>\");\n\t{foreach key=key value=templates from=$_debug_tpls}\n\t\t_templatelite_console.document.write(\"<tr bgcolor={if $key % 2}#eeeeee{else}#fafafa{/if}>\");\n\t\t_templatelite_console.document.write(\"<td colspan=2><tt>{for start=0 stop=$_debug_tpls[$key].depth}&nbsp;&nbsp;&nbsp;{/for}\");\n\t\t_templatelite_console.document.write(\"<font color={if $_debug_tpls[$key].type eq \"template\"}brown{elseif $_debug_tpls[$key].type eq \"insert\"}black{else}green{/if}>\");\n\t\t_templatelite_console.document.write(\"{$_debug_tpls[$key].filename}</font>{if isset($_debug_tpls[$key].exec_time)} \");\n\t\t_templatelite_console.document.write(\"<font size=-1><i>({$_debug_tpls[$key].exec_time|string_format:\"%.5f\"} seconds){if $key eq 0} (total){/if}\");\n\t\t_templatelite_console.document.write(\"</i></font>{/if}</tt></td></tr>\");\n\t{foreachelse}\n\t\t_templatelite_console.document.write(\"<tr bgcolor=#eeeeee><td colspan=2><tt><i>No template assigned</i></tt></td></tr>\t\");\n\t{/foreach}\n\t_templatelite_console.document.write(\"<tr bgcolor=#cccccc><td colspan=2><b>Assigned template variables:</b></td></tr>\");\n\t{foreach key=key value=vars from=$_debug_keys}\n\t\t_templatelite_console.document.write(\"<tr bgcolor={if $key % 2}#eeeeee{else}#fafafa{/if}>\");\n\t\t_templatelite_console.document.write(\"<td valign=top><tt><font color=blue>{ldelim}${$_debug_keys[$key]}{rdelim}</font></tt></td>\");\n\t\t_templatelite_console.document.write(\"<td nowrap><tt><font color=green>{$_debug_vals[$key]|@debug_print_var}</font></tt></td></tr>\");\n\t{foreachelse}\n\t\t_templatelite_console.document.write(\"<tr bgcolor=#eeeeee><td colspan=2><tt><i>No template variables assigned</i></tt></td></tr>\");\n\t{/foreach}\n\t_templatelite_console.document.write(\"<tr bgcolor=#cccccc><td colspan=2><b>Assigned config file variables (outer template scope):</b></td></tr>\");\n\t{foreach key=key value=config_vars from=$_debug_config_keys}\n\t\t_templatelite_console.document.write(\"<tr bgcolor={if $key % 2}#eeeeee{else}#fafafa{/if}>\");\n\t\t_templatelite_console.document.write(\"<td valign=top><tt><font color=maroon>{ldelim}#{$_debug_config_keys[$key]}#{rdelim}</font></tt></td>\");\n\t\t_templatelite_console.document.write(\"<td><tt><font color=green>{$_debug_config_vals[$key]|@debug_print_var}</font></tt></td></tr>\");\n\t{foreachelse}\n\t\t_templatelite_console.document.write(\"<tr bgcolor=#eeeeee><td colspan=2><tt><i>No config vars assigned</i></tt></td></tr>\");\n\t{/foreach}\n\t_templatelite_console.document.write(\"</table>\");\n\t_templatelite_console.document.write(\"</BODY></HTML>\");\n\t_templatelite_console.document.close();\n</SCRIPT>\n{/if}"
  },
  {
    "path": "ThinkPHP/Library/Vendor/TemplateLite/internal/template.build_dir.php",
    "content": "<?php\n/**\n * Template Lite template_build_dir template internal module\n *\n * Type:\t template\n * Name:\t template_build_dir\n */\n\nfunction template_build_dir($dir, $id, &$object)\n{\n\t$_args = explode('|', $id);\n\tif (count($_args) == 1 && empty($_args[0]))\n\t{\n\t\treturn $object->_get_dir($dir);\n\t}\n\t$_result = $object->_get_dir($dir);\n\tforeach($_args as $value)\n\t{\n\t\t$_result .= $value.DIRECTORY_SEPARATOR;\n\t\tif (!is_dir($_result))\n\t\t{\n\t\t\t@mkdir($_result, 0777);\n\t\t}\n\t}\n\treturn $_result;\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/TemplateLite/internal/template.config_loader.php",
    "content": "<?php\n/**\n * Template Lite config_load template internal module\n *\n * Type:\t template\n * Name:\t config_load\n */\n\n$this->_config_module_loaded = true;\n$this->template_dir = $this->_get_dir($this->template_dir);\n$this->config_dir = $this->_get_dir($this->config_dir);\n$this->compile_dir = $this->_get_dir($this->compile_dir);\n$name = ($this->encode_file_name) ? md5($this->template_dir . $file . $section_name . $var_name).'.php' : str_replace(\".\", \"_\", str_replace(\"/\", \"_\", $file.\"_\".$section_name.\"_\".$var_name)).'.php';\n\nif ($this->debugging)\n{\n\t$debug_start_time = array_sum(explode(' ', microtime()));\n}\n\nif ($this->cache)\n{\n\tarray_push($this->_cache_info['config'], $file);\n}\n\nif (!$this->force_compile && file_exists($this->compile_dir.'c_'.$name) && (filemtime($this->compile_dir.'c_'.$name) > filemtime($this->config_dir.$file)))\n{\n\tinclude($this->compile_dir.'c_'.$name);\n\treturn true;\n}\n\nif (!is_object($this->_config_obj))\n{\n\trequire_once(TEMPLATE_LITE_DIR . \"class.config.php\");\n\t$this->_config_obj = new $this->config_class;\n\t$this->_config_obj->overwrite = $this->config_overwrite;\n\t$this->_config_obj->booleanize = $this->config_booleanize;\n\t$this->_config_obj->fix_new_lines = $this->config_fix_new_lines;\n\t$this->_config_obj->read_hidden = $this->config_read_hidden;\n}\n\nif (!($_result = $this->_config_obj->config_load($this->config_dir.$file, $section_name, $var_name)))\n{\n\treturn false;\n}\n\nif (!empty($var_name) || !empty($section_name))\n{\n\t$output = \"\\$this->_confs = \" . var_export($_result, true) . \";\";\n}\nelse\n{\n\t// must shift of the bottom level of the array to get rid of the section labels\n\t$_temp = array();\n\tforeach($_result as $value)\n\t{\n\t\t$_temp = array_merge($_temp, $value);\n\t}\n\t$output = \"\\$this->_confs = \" . var_export($_temp, true) . \";\";\n}\n\n$f = fopen($this->compile_dir.'c_'.$name, \"w\");\nfwrite($f, '<?php ' . $output . ' ?>');\nfclose($f);\neval($output);\n\nif ($this->debugging)\n{\n\t$this->_templatelite_debug_info[] = array('type'\t  => 'config',\n\t\t\t\t\t\t\t\t\t\t'filename'  => $file.' ['.$section_name.'] '.$var_name,\n\t\t\t\t\t\t\t\t\t\t'depth'\t => 0,\n\t\t\t\t\t\t\t\t\t\t'exec_time' => array_sum(explode(' ', microtime())) - $debug_start_time );\n}\n\nreturn true;\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/TemplateLite/internal/template.destroy_dir.php",
    "content": "<?php\n/**\n * Template Lite template_destroy_dir template internal module\n *\n * Type:\t template\n * Name:\t template_destroy_dir\n */\n\nfunction template_destroy_dir($file, $id, $dir, &$object)\n{\n\tif ($file == null && $id == null)\n\t{\n\t\tif (is_dir($dir))\n\t\t{\n\t\t\tif($d = opendir($dir))\n\t\t\t{\n\t\t\t\twhile(($f = readdir($d)) !== false)\n\t\t\t\t{\n\t\t\t\t\tif ($f != '.' && $f != '..')\n\t\t\t\t\t{\n\t\t\t\t\t\ttemplate_rm_dir($dir.$f.DIRECTORY_SEPARATOR);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tif ($id == null)\n\t\t{\n\t\t\t$object->template_dir = $object->_get_dir($object->template_dir);\n\n\t\t\t$name = ($object->encode_file_name) ? md5($object->template_dir.$file).'.php' : str_replace(\".\", \"_\", str_replace(\"/\", \"_\", $file)).'.php';\n\t\t\t@unlink($dir.$name);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$_args = \"\";\n\t\t\tforeach(explode('|', $id) as $value)\n\t\t\t{\n\t\t\t\t$_args .= $value.DIRECTORY_SEPARATOR;\n\t\t\t}\n\t\t\ttemplate_rm_dir($dir.DIRECTORY_SEPARATOR.$_args);\n\t\t}\n\t}\n}\n\nfunction template_rm_dir($dir)\n{\n\tif (is_file(substr($dir, 0, -1)))\n\t{\n\t\t@unlink(substr($dir, 0, -1));\n\t\treturn;\n\t}\n\tif ($d = opendir($dir))\n\t{\n\t\twhile(($f = readdir($d)) !== false)\n\t\t{\n\t\t\tif ($f != '.' && $f != '..')\n\t\t\t{\n\t\t\t\ttemplate_rm_dir($dir.$f.DIRECTORY_SEPARATOR, $object);\n\t\t\t}\n\t\t}\n\t\t@rmdir($dir.$f);\n\t}\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/TemplateLite/internal/template.fetch_compile_include.php",
    "content": "<?php\n/**\n * Template Lite template_fetch_compile_include template internal module\n *\n * Type:\t template\n * Name:\t template_fetch_compile_include\n */\n\nfunction template_fetch_compile_include($_templatelite_include_file, $_templatelite_include_vars, &$object)\n{\n\tif ($object->debugging)\n\t{\n\t\t$object->_templatelite_debug_info[] = array('type'\t  => 'template',\n\t\t\t\t\t\t\t\t\t\t\t'filename'  => $_templatelite_include_file,\n\t\t\t\t\t\t\t\t\t\t\t'depth'\t => ++$object->_inclusion_depth,\n\t\t\t\t\t\t\t\t\t\t\t'exec_time' => array_sum(explode(' ', microtime())) );\n\t\t$included_tpls_idx = count($object->_templatelite_debug_info) - 1;\n\t}\n\n\t$object->_vars = array_merge($object->_vars, $_templatelite_include_vars);\n\t$_templatelite_include_file = $object->_get_resource($_templatelite_include_file);\n\tif(isset($object->_confs[0]))\n\t{\n\t\tarray_unshift($object->_confs, $object->_confs[0]);\n\t\t$_compiled_output = $object->_fetch_compile($_templatelite_include_file);\n\t\tarray_shift($object->_confs);\n\t}\n\telse\n\t{\n\t\t$_compiled_output = $object->_fetch_compile($_templatelite_include_file);\n\t}\n\n\t$object->_inclusion_depth--;\n\n\tif ($object->debugging)\n\t{\n\t\t$object->_templatelite_debug_info[$included_tpls_idx]['exec_time'] = array_sum(explode(' ', microtime())) - $object->_templatelite_debug_info[$included_tpls_idx]['exec_time'];\n\t}\n\treturn $_compiled_output;\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/TemplateLite/internal/template.generate_debug_output.php",
    "content": "<?php\n/**\n * Template Lite template_generate_debug_output template internal module\n *\n * Type:\t template\n * Name:\t template_generate_debug_output\n */\n\nfunction template_generate_debug_output(&$object)\n{\n    $assigned_vars = $object->_vars;\n    ksort($assigned_vars);\n    if (@is_array($object->_config[0]))\n\t{\n        $config_vars = $object->_config[0];\n        ksort($config_vars);\n        $object->assign(\"_debug_config_keys\", array_keys($config_vars));\n        $object->assign(\"_debug_config_vals\", array_values($config_vars));\n    }   \n\n    $included_templates = $object->_templatelite_debug_info;\n\n    $object->assign(\"_debug_keys\", array_keys($assigned_vars));\n    $object->assign(\"_debug_vals\", array_values($assigned_vars));\n    $object->assign(\"_debug_tpls\", $included_templates);\n    $object->assign(\"_templatelite_debug_output\", \"\");\n\n\t$object->_templatelite_debug_loop = true;\n\t$object->_templatelite_debug_dir = $object->template_dir;\n\t$object->template_dir = TEMPLATE_LITE_DIR . \"internal/\";\n\t$debug_output = $object->fetch(\"debug.tpl\");\n\t$object->template_dir = $object->_templatelite_debug_dir;\n\t$object->_templatelite_debug_loop = false;\n\treturn $debug_output;\n}\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/jsonRPC/jsonRPCClient.php",
    "content": "<?php\n/*\n\t\t\t\t\tCOPYRIGHT\n\nCopyright 2007 Sergio Vaccaro <sergio@inservibile.org>\n\nThis file is part of JSON-RPC PHP.\n\nJSON-RPC PHP is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2 of the License, or\n(at your option) any later version.\n\nJSON-RPC PHP is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with JSON-RPC PHP; if not, write to the Free Software\nFoundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\n*/\n\n/**\n * The object of this class are generic jsonRPC 1.0 clients\n * http://json-rpc.org/wiki/specification\n *\n * @author sergio <jsonrpcphp@inservibile.org>\n */\nclass jsonRPCClient {\n\t\n\t/**\n\t * Debug state\n\t *\n\t * @var boolean\n\t */\n\tprivate $debug;\n\t\n\t/**\n\t * The server URL\n\t *\n\t * @var string\n\t */\n\tprivate $url;\n\t/**\n\t * The request id\n\t *\n\t * @var integer\n\t */\n\tprivate $id;\n\t/**\n\t * If true, notifications are performed instead of requests\n\t *\n\t * @var boolean\n\t */\n\tprivate $notification = false;\n\t\n\t/**\n\t * Takes the connection parameters\n\t *\n\t * @param string $url\n\t * @param boolean $debug\n\t */\n\tpublic function __construct($url,$debug = false) {\n\t\t// server URL\n\t\t$this->url = $url;\n\t\t// proxy\n\t\tempty($proxy) ? $this->proxy = '' : $this->proxy = $proxy;\n\t\t// debug state\n\t\tempty($debug) ? $this->debug = false : $this->debug = true;\n\t\t// message id\n\t\t$this->id = 1;\n\t}\n\t\n\t/**\n\t * Sets the notification state of the object. In this state, notifications are performed, instead of requests.\n\t *\n\t * @param boolean $notification\n\t */\n\tpublic function setRPCNotification($notification) {\n\t\tempty($notification) ?\n\t\t\t\t\t\t\t$this->notification = false\n\t\t\t\t\t\t\t:\n\t\t\t\t\t\t\t$this->notification = true;\n\t}\n\t\n\t/**\n\t * Performs a jsonRCP request and gets the results as an array\n\t *\n\t * @param string $method\n\t * @param array $params\n\t * @return array\n\t */\n\tpublic function __call($method,$params) {\n\t\t\n\t\t// check\n\t\tif (!is_scalar($method)) {\n\t\t\tthrow new Exception('Method name has no scalar value');\n\t\t}\n\t\t\n\t\t// check\n\t\tif (is_array($params)) {\n\t\t\t// no keys\n\t\t\t$params = array_values($params);\n\t\t} else {\n\t\t\tthrow new Exception('Params must be given as array');\n\t\t}\n\t\t\n\t\t// sets notification or request task\n\t\tif ($this->notification) {\n\t\t\t$currentId = NULL;\n\t\t} else {\n\t\t\t$currentId = $this->id;\n\t\t}\n\t\t\n\t\t// prepares the request\n\t\t$request = array(\n\t\t\t\t\t\t'method' => $method,\n\t\t\t\t\t\t'params' => $params,\n\t\t\t\t\t\t'id' => $currentId\n\t\t\t\t\t\t);\n\t\t$request = json_encode($request);\n\t\t$this->debug && $this->debug.='***** Request *****'.\"\\n\".$request.\"\\n\".'***** End Of request *****'.\"\\n\\n\";\n\t\t\n\t\t// performs the HTTP POST\n\t\t$opts = array ('http' => array (\n\t\t\t\t\t\t\t'method'  => 'POST',\n\t\t\t\t\t\t\t'header'  => 'Content-type: application/json',\n\t\t\t\t\t\t\t'content' => $request\n\t\t\t\t\t\t\t));\n\t\t$context  = stream_context_create($opts);\n\t\tif ($fp = fopen($this->url, 'r', false, $context)) {\n\t\t\t$response = '';\n\t\t\twhile($row = fgets($fp)) {\n\t\t\t\t$response.= trim($row).\"\\n\";\n\t\t\t}\n\t\t\t$this->debug && $this->debug.='***** Server response *****'.\"\\n\".$response.'***** End of server response *****'.\"\\n\";\n\t\t\t$response = json_decode($response,true);\n\t\t} else {\n\t\t\tthrow new Exception('Unable to connect to '.$this->url);\n\t\t}\n\t\t\n\t\t// debug output\n\t\tif ($this->debug) {\n\t\t\techo nl2br($debug);\n\t\t}\n\t\t\n\t\t// final checks and return\n\t\tif (!$this->notification) {\n\t\t\t// check\n\t\t\tif ($response['id'] != $currentId) {\n\t\t\t\tthrow new Exception('Incorrect response id (request id: '.$currentId.', response id: '.$response['id'].')');\n\t\t\t}\n\t\t\tif (!is_null($response['error'])) {\n\t\t\t\tthrow new Exception('Request error: '.$response['error']);\n\t\t\t}\n\t\t\t\n\t\t\treturn $response['result'];\n\t\t\t\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/jsonRPC/jsonRPCServer.php",
    "content": "<?php\n/*\n\t\t\t\t\tCOPYRIGHT\n\nCopyright 2007 Sergio Vaccaro <sergio@inservibile.org>\n\nThis file is part of JSON-RPC PHP.\n\nJSON-RPC PHP is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2 of the License, or\n(at your option) any later version.\n\nJSON-RPC PHP is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with JSON-RPC PHP; if not, write to the Free Software\nFoundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\n*/\n\n/**\n * This class build a json-RPC Server 1.0\n * http://json-rpc.org/wiki/specification\n *\n * @author sergio <jsonrpcphp@inservibile.org>\n */\nclass jsonRPCServer {\n\t/**\n\t * This function handle a request binding it to a given object\n\t *\n\t * @param object $object\n\t * @return boolean\n\t */\n\tpublic static function handle($object) {\n\t\t\n\t\t// checks if a JSON-RCP request has been received\n\t\tif (\n\t\t\t$_SERVER['REQUEST_METHOD'] != 'POST' || \n\t\t\tempty($_SERVER['CONTENT_TYPE']) ||\n\t\t\t$_SERVER['CONTENT_TYPE'] != 'application/json'\n\t\t\t) {\n\t\t\t// This is not a JSON-RPC request\n\t\t\treturn false;\n\t\t}\n\t\t\t\t\n\t\t// reads the input data\n\t\t$request = json_decode(file_get_contents('php://input'),true);\n\t\t\n\t\t// executes the task on local object\n\t\ttry {\n\t\t\tif ($result = @call_user_func_array(array($object,$request['method']),$request['params'])) {\n\t\t\t\t$response = array (\n\t\t\t\t\t\t\t\t\t'id' => $request['id'],\n\t\t\t\t\t\t\t\t\t'result' => $result,\n\t\t\t\t\t\t\t\t\t'error' => NULL\n\t\t\t\t\t\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t$response = array (\n\t\t\t\t\t\t\t\t\t'id' => $request['id'],\n\t\t\t\t\t\t\t\t\t'result' => NULL,\n\t\t\t\t\t\t\t\t\t'error' => 'unknown method or incorrect parameters'\n\t\t\t\t\t\t\t\t\t);\n\t\t\t}\n\t\t} catch (Exception $e) {\n\t\t\t$response = array (\n\t\t\t\t\t\t\t\t'id' => $request['id'],\n\t\t\t\t\t\t\t\t'result' => NULL,\n\t\t\t\t\t\t\t\t'error' => $e->getMessage()\n\t\t\t\t\t\t\t\t);\n\t\t}\n\t\t\n\t\t// output the response\n\t\tif (!empty($request['id'])) { // notifications don't want response\n\t\t\theader('content-type: text/javascript');\n\t\t\techo json_encode($response);\n\t\t}\n\t\t\n\t\t// finish\n\t\treturn true;\n\t}\n}\n?>\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/bigint.php",
    "content": "<?php\n/**********************************************************\\\n|                                                          |\n| The implementation of PHPRPC Protocol 3.0                |\n|                                                          |\n| bigint.php                                               |\n|                                                          |\n| Release 3.0.1                                            |\n| Copyright by Team-PHPRPC                                 |\n|                                                          |\n| WebSite:  http://www.phprpc.org/                         |\n|           http://www.phprpc.net/                         |\n|           http://www.phprpc.com/                         |\n|           http://sourceforge.net/projects/php-rpc/       |\n|                                                          |\n| Authors:  Ma Bingyao <andot@ujn.edu.cn>                  |\n|                                                          |\n| This file may be distributed and/or modified under the   |\n| terms of the GNU General Public License (GPL) version    |\n| 2.0 as published by the Free Software Foundation and     |\n| appearing in the included file LICENSE.                  |\n|                                                          |\n\\**********************************************************/\n\n/* Big integer expansion library.\n *\n * Copyright: Ma Bingyao <andot@ujn.edu.cn>\n *            mgccl <mgcclx@gmail.com>\n * Version: 3.0.1\n * LastModified: Apr 12, 2010\n * This library is free.  You can redistribute it and/or modify it under GPL.\n */\n\nif (extension_loaded('gmp')) {\n    function bigint_dec2num($dec) {\n        return gmp_init($dec);\n    }\n    function bigint_num2dec($num) {\n        return gmp_strval($num);\n    }\n    function bigint_str2num($str) {\n        return gmp_init(\"0x\".bin2hex($str));\n    }\n    function bigint_num2str($num) {\n        $str = gmp_strval($num, 16);\n        $len = strlen($str);\n        if ($len % 2 == 1) {\n            $str = '0'.$str;\n        }\n        return pack(\"H*\", $str);\n    }\n    function bigint_random($n, $s) {\n        $result = gmp_init(0);\n        for ($i = 0; $i < $n; $i++) {\n            if (mt_rand(0, 1)) {\n                gmp_setbit($result, $i);\n            }\n        }\n        if ($s) {\n            gmp_setbit($result, $n - 1);\n        }\n        return $result;\n    }\n    function bigint_powmod($x, $y, $m) {\n        return gmp_powm($x, $y, $m);\n    }\n}\nelse if (extension_loaded('big_int')) {\n    function bigint_dec2num($dec) {\n        return bi_from_str($dec);\n    }\n    function bigint_num2dec($num) {\n        return bi_to_str($num);\n    }\n    function bigint_str2num($str) {\n        return bi_from_str(bin2hex($str), 16);\n    }\n    function bigint_num2str($num) {\n        $str = bi_to_str($num, 16);\n        $len = strlen($str);\n        if ($len % 2 == 1) {\n            $str = '0'.$str;\n        }\n        return pack(\"H*\", $str);\n    }\n    function bigint_random($n, $s) {\n        $result = bi_rand($n);\n        if ($s) {\n            $result = bi_set_bit($result, $n - 1);\n        }\n        return $result;\n    }\n    function bigint_powmod($x, $y, $m) {\n        return bi_powmod($x, $y, $m);\n    }\n}\nelse if (extension_loaded('bcmath')) {\n    function bigint_dec2num($dec) {\n        return $dec;\n    }\n    function bigint_num2dec($num) {\n        return $num;\n    }\n    function bigint_str2num($str) {\n        bcscale(0);\n        $len = strlen($str);\n        $result = '0';\n        $m = '1';\n        for ($i = 0; $i < $len; $i++) {\n            $result = bcadd(bcmul($m, ord($str{$len - $i - 1})), $result);\n            $m = bcmul($m, '256');\n        }\n        return $result;\n    }\n    function bigint_num2str($num) {\n        bcscale(0);\n        $str = \"\";\n        while (bccomp($num, '0') == 1) {\n           $str = chr(bcmod($num, '256')) . $str;\n           $num = bcdiv($num, '256');\n        }\n        return $str;\n    }\n    // author of bcmath bigint_random: mgccl <mgcclx@gmail.com>\n    function bigint_pow($b, $e) {\n        if ($b == 2) {\n            $a[96] = '79228162514264337593543950336';\n            $a[128] = '340282366920938463463374607431768211456';\n            $a[160] = '1461501637330902918203684832716283019655932542976';\n            $a[192] = '6277101735386680763835789423207666416102355444464034512896';\n            $a[256] = '115792089237316195423570985008687907853269984665640564039457584007913129639936';\n            $a[512] = '13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084096';\n            $a[768] = '1552518092300708935148979488462502555256886017116696611139052038026050952686376886330878408828646477950487730697131073206171580044114814391444287275041181139204454976020849905550265285631598444825262999193716468750892846853816057856';\n            $a[1024] = '179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216';\n            $a[1356] = '1572802244866018108182967249994981337399178505432223228293716677435703277129801955281491139254988030713172834803458459525011536776047399098682525970017006610187370020027540826048617586909475175880278263391147764612823746132583281588112028234096933800670620569966257212339315820309710495898777306979706509398705741430192541287726011814541176060679505247297118998085067003005943214893171428950699778511718055936';\n            $a[2048] = '32317006071311007300714876688669951960444102669715484032130345427524655138867890893197201411522913463688717960921898019494119559150490921095088152386448283120630877367300996091750197750389652106796057638384067568276792218642619756161838094338476170470581645852036305042887575891541065808607552399123930385521914333389668342420684974786564569494856176035326322058077805659331026192708460314150258592864177116725943603718461857357598351152301645904403697613233287231227125684710820209725157101726931323469678542580656697935045997268352998638215525166389437335543602135433229604645318478604952148193555853611059596230656';\n            $a[3072] = '5809605995369958062859502533304574370686975176362895236661486152287203730997110225737336044533118407251326157754980517443990529594540047121662885672187032401032111639706440498844049850989051627200244765807041812394729680540024104827976584369381522292361208779044769892743225751738076979568811309579125511333093243519553784816306381580161860200247492568448150242515304449577187604136428738580990172551573934146255830366405915000869643732053218566832545291107903722831634138599586406690325959725187447169059540805012310209639011750748760017095360734234945757416272994856013308616958529958304677637019181594088528345061285863898271763457294883546638879554311615446446330199254382340016292057090751175533888161918987295591531536698701292267685465517437915790823154844634780260102891718032495396075041899485513811126977307478969074857043710716150121315922024556759241239013152919710956468406379442914941614357107914462567329693696';\n            $a[4096] = '1044388881413152506691752710716624382579964249047383780384233483283953907971557456848826811934997558340890106714439262837987573438185793607263236087851365277945956976543709998340361590134383718314428070011855946226376318839397712745672334684344586617496807908705803704071284048740118609114467977783598029006686938976881787785946905630190260940599579453432823469303026696443059025015972399867714215541693835559885291486318237914434496734087811872639496475100189041349008417061675093668333850551032972088269550769983616369411933015213796825837188091833656751221318492846368125550225998300412344784862595674492194617023806505913245610825731835380087608622102834270197698202313169017678006675195485079921636419370285375124784014907159135459982790513399611551794271106831134090584272884279791554849782954323534517065223269061394905987693002122963395687782878948440616007412945674919823050571642377154816321380631045902916136926708342856440730447899971901781465763473223850267253059899795996090799469201774624817718449867455659250178329070473119433165550807568221846571746373296884912819520317457002440926616910874148385078411929804522981857338977648103126085903001302413467189726673216491511131602920781738033436090243804708340403154190336';\n            $a[8192] = '1090748135619415929462984244733782862448264161996232692431832786189721331849119295216264234525201987223957291796157025273109870820177184063610979765077554799078906298842192989538609825228048205159696851613591638196771886542609324560121290553901886301017900252535799917200010079600026535836800905297805880952350501630195475653911005312364560014847426035293551245843928918752768696279344088055617515694349945406677825140814900616105920256438504578013326493565836047242407382442812245131517757519164899226365743722432277368075027627883045206501792761700945699168497257879683851737049996900961120515655050115561271491492515342105748966629547032786321505730828430221664970324396138635251626409516168005427623435996308921691446181187406395310665404885739434832877428167407495370993511868756359970390117021823616749458620969857006263612082706715408157066575137281027022310927564910276759160520878304632411049364568754920967322982459184763427383790272448438018526977764941072715611580434690827459339991961414242741410599117426060556483763756314527611362658628383368621157993638020878537675545336789915694234433955666315070087213535470255670312004130725495834508357439653828936077080978550578912967907352780054935621561090795845172954115972927479877527738560008204118558930004777748727761853813510493840581861598652211605960308356405941821189714037868726219481498727603653616298856174822413033485438785324024751419417183012281078209729303537372804574372095228703622776363945290869806258422355148507571039619387449629866808188769662815778153079393179093143648340761738581819563002994422790754955061288818308430079648693232179158765918035565216157115402992120276155607873107937477466841528362987708699450152031231862594203085693838944657061346236704234026821102958954951197087076546186622796294536451620756509351018906023773821539532776208676978589731966330308893304665169436185078350641568336944530051437491311298834367265238595404904273455928723949525227184617404367854754610474377019768025576605881038077270707717942221977090385438585844095492116099852538903974655703943973086090930596963360767529964938414598185705963754561497355827813623833288906309004288017321424808663962671333528009232758350873059614118723781422101460198615747386855096896089189180441339558524822867541113212638793675567650340362970031930023397828465318547238244232028015189689660418822976000815437610652254270163595650875433851147123214227266605403581781469090806576468950587661997186505665475715792896';\n            return (isset($a[$e]) ? $a[$e] : bcpow(2, $e));\n        }\n        return bcpow($b, $e);\n    }\n    function bigint_random($n, $s) {\n        bcscale(0);\n        $t = bigint_pow(2, $n);\n        if ($s == 1) {\n            $m = bcdiv($t, 2);\n            $t = bcsub($m, 1);\n        }\n        else {\n            $m = 0;\n            $t = bcsub($t, 1);\n        }\n        $l = strlen($t);\n        $n = (int) ($l / 9) + 1;\n        $r = '';\n        while($n) {\n            $r .= substr('000000000' . mt_rand(0, 999999999), -9);\n            --$n;\n        }\n        $r = substr($r, 0, $l);\n        while (bccomp($r, $t) == 1) $r = substr($r, 1, $l) . mt_rand(0, 9);\n        return bcadd($r, $m);\n    }\n    if (!function_exists('bcpowmod')) {\n        function bcpowmod($x, $y, $modulus, $scale = 0) {\n            $t = '1';\n            while (bccomp($y, '0')) {\n                if (bccomp(bcmod($y, '2'), '0')) {\n                    $t = bcmod(bcmul($t, $x), $modulus);\n                    $y = bcsub($y, '1');\n                }\n\n                $x = bcmod(bcmul($x, $x), $modulus);\n                $y = bcdiv($y, '2');\n            }\n            return $t;\n        }\n    }\n    function bigint_powmod($x, $y, $m) {\n        return bcpowmod($x, $y, $m);\n    }\n}\nelse {\n    function bigint_mul($a, $b) {\n        $n = count($a);\n        $m = count($b);\n        $nm = $n + $m;\n        $c = array_fill(0, $nm, 0);\n        for ($i = 0; $i < $n; $i++) {\n            for ($j = 0; $j < $m; $j++) {\n                $c[$i + $j] += $a[$i] * $b[$j];\n                $c[$i + $j + 1] += ($c[$i + $j] >> 15) & 0x7fff;\n                $c[$i + $j] &= 0x7fff;\n            }\n        }\n        return $c;\n    }\n    function bigint_div($a, $b, $is_mod = 0) {\n        $n = count($a);\n        $m = count($b);\n        $c = array();\n        $d = floor(0x8000 / ($b[$m - 1] + 1));\n        $a = bigint_mul($a, array($d));\n        $b = bigint_mul($b, array($d));\n        for ($j = $n - $m; $j >= 0; $j--) {\n            $tmp = $a[$j + $m] * 0x8000 + $a[$j + $m - 1];\n            $rr = $tmp % $b[$m - 1];\n            $qq = round(($tmp - $rr) / $b[$m - 1]);\n            if (($qq == 0x8000) || (($m > 1) && ($qq * $b[$m - 2] > 0x8000 * $rr + $a[$j + $m - 2]))) {\n                $qq--;\n                $rr += $b[$m - 1];\n                if (($rr < 0x8000) && ($qq * $b[$m - 2] > 0x8000 * $rr + $a[$j + $m - 2])) $qq--;\n            }\n            for ($i = 0; $i < $m; $i++) {\n                $tmp = $i + $j;\n                $a[$tmp] -= $b[$i] * $qq;\n                $a[$tmp + 1] += floor($a[$tmp] / 0x8000);\n                $a[$tmp] &= 0x7fff;\n            }\n            $c[$j] = $qq;\n            if ($a[$tmp + 1] < 0) {\n                $c[$j]--;\n                for ($i = 0; $i < $m; $i++) {\n                    $tmp = $i + $j;\n                    $a[$tmp] += $b[$i];\n                    if ($a[$tmp] > 0x7fff) {\n                        $a[$tmp + 1]++;\n                        $a[$tmp] &= 0x7fff;\n                    }\n                }\n            }\n        }\n        if (!$is_mod) return $c;\n        $b = array();\n        for ($i = 0; $i < $m; $i++) $b[$i] = $a[$i];\n        return bigint_div($b, array($d));\n    }\n    function bigint_zerofill($str, $num) {\n        return str_pad($str, $num, '0', STR_PAD_LEFT);\n    }\n    function bigint_dec2num($dec) {\n        $n = strlen($dec);\n        $a = array(0);\n        $n += 4 - ($n % 4);\n        $dec = bigint_zerofill($dec, $n);\n        $n >>= 2;\n        for ($i = 0; $i < $n; $i++) {\n            $a = bigint_mul($a, array(10000));\n            $a[0] += (int)substr($dec, 4 * $i, 4);\n            $m = count($a);\n            $j = 0;\n            $a[$m] = 0;\n            while ($j < $m && $a[$j] > 0x7fff) {\n                $a[$j++] &= 0x7fff;\n                $a[$j]++;\n            }\n            while ((count($a) > 1) && (!$a[count($a) - 1])) array_pop($a);\n        }\n        return $a;\n    }\n    function bigint_num2dec($num) {\n        $n = count($num) << 1;\n        $b = array();\n        for ($i = 0; $i < $n; $i++) {\n            $tmp = bigint_div($num, array(10000), 1);\n            $b[$i] = bigint_zerofill($tmp[0], 4);\n            $num = bigint_div($num, array(10000));\n        }\n        while ((count($b) > 1) && !(int)$b[count($b) - 1]) array_pop($b);\n        $n = count($b) - 1;\n        $b[$n] = (int)$b[$n];\n        $b = join('', array_reverse($b));\n        return $b;\n    }\n    function bigint_str2num($str) {\n        $n = strlen($str);\n        $n += 15 - ($n % 15);\n        $str = str_pad($str, $n, chr(0), STR_PAD_LEFT);\n        $j = 0;\n        $result = array();\n        for ($i = 0; $i < $n; $i++) {\n            $result[$j++] = (ord($str{$i++}) << 7) | (ord($str{$i}) >> 1);\n            $result[$j++] = ((ord($str{$i++}) & 0x01) << 14) | (ord($str{$i++}) << 6) | (ord($str{$i}) >> 2);\n            $result[$j++] = ((ord($str{$i++}) & 0x03) << 13) | (ord($str{$i++}) << 5) | (ord($str{$i}) >> 3);\n            $result[$j++] = ((ord($str{$i++}) & 0x07) << 12) | (ord($str{$i++}) << 4) | (ord($str{$i}) >> 4);\n            $result[$j++] = ((ord($str{$i++}) & 0x0f) << 11) | (ord($str{$i++}) << 3) | (ord($str{$i}) >> 5);\n            $result[$j++] = ((ord($str{$i++}) & 0x1f) << 10) | (ord($str{$i++}) << 2) | (ord($str{$i}) >> 6);\n            $result[$j++] = ((ord($str{$i++}) & 0x3f) << 9) | (ord($str{$i++}) << 1) | (ord($str{$i}) >> 7);\n            $result[$j++] = ((ord($str{$i++}) & 0x7f) << 8) | ord($str{$i});\n        }\n        $result = array_reverse($result);\n        $i = count($result) - 1;\n        while ($result[$i] == 0) {\n            array_pop($result);\n            $i--;\n        }\n        return $result;\n    }\n    function bigint_num2str($num) {\n        ksort($num, SORT_NUMERIC);\n        $n = count($num);\n        $n += 8 - ($n % 8);\n        $num = array_reverse(array_pad($num, $n, 0));\n        $s = '';\n        for ($i = 0; $i < $n; $i++) {\n            $s .= chr($num[$i] >> 7);\n            $s .= chr((($num[$i++] & 0x7f) << 1) | ($num[$i] >> 14));\n            $s .= chr(($num[$i] >> 6) & 0xff);\n            $s .= chr((($num[$i++] & 0x3f) << 2) | ($num[$i] >> 13));\n            $s .= chr(($num[$i] >> 5) & 0xff);\n            $s .= chr((($num[$i++] & 0x1f) << 3) | ($num[$i] >> 12));\n            $s .= chr(($num[$i] >> 4) & 0xff);\n            $s .= chr((($num[$i++] & 0x0f) << 4) | ($num[$i] >> 11));\n            $s .= chr(($num[$i] >> 3) & 0xff);\n            $s .= chr((($num[$i++] & 0x07) << 5) | ($num[$i] >> 10));\n            $s .= chr(($num[$i] >> 2) & 0xff);\n            $s .= chr((($num[$i++] & 0x03) << 6) | ($num[$i] >> 9));\n            $s .= chr(($num[$i] >> 1) & 0xff);\n            $s .= chr((($num[$i++] & 0x01) << 7) | ($num[$i] >> 8));\n            $s .= chr($num[$i] & 0xff);\n        }\n        return ltrim($s, chr(0));\n    }\n\n    function bigint_random($n, $s) {\n        $lowBitMasks = array(0x0000, 0x0001, 0x0003, 0x0007,\n                             0x000f, 0x001f, 0x003f, 0x007f,\n                             0x00ff, 0x01ff, 0x03ff, 0x07ff,\n                             0x0fff, 0x1fff, 0x3fff);\n        $r = $n % 15;\n        $q = floor($n / 15);\n        $result = array();\n        for ($i = 0; $i < $q; $i++) {\n            $result[$i] = mt_rand(0, 0x7fff);\n        }\n        if ($r != 0) {\n            $result[$q] = mt_rand(0, $lowBitMasks[$r]);\n            if ($s) {\n                $result[$q] |= 1 << ($r - 1);\n            }\n        }\n        else if ($s) {\n            $result[$q - 1] |= 0x4000;\n        }\n        return $result;\n    }\n    function bigint_powmod($x, $y, $m) {\n        $n = count($y);\n        $p = array(1);\n        for ($i = 0; $i < $n - 1; $i++) {\n            $tmp = $y[$i];\n            for ($j = 0; $j < 0xf; $j++) {\n                if ($tmp & 1) $p = bigint_div(bigint_mul($p, $x), $m, 1);\n                $tmp >>= 1;\n                $x = bigint_div(bigint_mul($x, $x), $m, 1);\n            }\n        }\n        $tmp = $y[$i];\n        while ($tmp) {\n            if ($tmp & 1) $p = bigint_div(bigint_mul($p, $x), $m, 1);\n            $tmp >>= 1;\n            $x = bigint_div(bigint_mul($x, $x), $m, 1);\n        }\n        return $p;\n    }\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/compat.php",
    "content": "<?php\n/**********************************************************\\\n|                                                          |\n| The implementation of PHPRPC Protocol 3.0                |\n|                                                          |\n| compat.php                                               |\n|                                                          |\n| Release 3.0.1                                            |\n| Copyright by Team-PHPRPC                                 |\n|                                                          |\n| WebSite:  http://www.phprpc.org/                         |\n|           http://www.phprpc.net/                         |\n|           http://www.phprpc.com/                         |\n|           http://sourceforge.net/projects/php-rpc/       |\n|                                                          |\n| Authors:  Ma Bingyao <andot@ujn.edu.cn>                  |\n|                                                          |\n| This file may be distributed and/or modified under the   |\n| terms of the GNU General Public License (GPL) version    |\n| 2.0 as published by the Free Software Foundation and     |\n| appearing in the included file LICENSE.                  |\n|                                                          |\n\\**********************************************************/\n\n/* Provides missing functionality for older versions of PHP.\n *\n * Copyright: Ma Bingyao <andot@ujn.edu.cn>\n * Version: 1.5\n * LastModified: Apr 12, 2010\n * This library is free.  You can redistribute it and/or modify it under GPL.\n */\n\nrequire_once(\"phprpc_date.php\");\n\nif (!function_exists('file_get_contents')) {\n    function file_get_contents($filename, $incpath = false, $resource_context = null) {\n        if (false === $fh = fopen($filename, 'rb', $incpath)) {\n            user_error('file_get_contents() failed to open stream: No such file or directory',\n                E_USER_WARNING);\n            return false;\n        }\n        clearstatcache();\n        if ($fsize = @filesize($filename)) {\n            $data = fread($fh, $fsize);\n        }\n        else {\n            $data = '';\n            while (!feof($fh)) {\n                $data .= fread($fh, 8192);\n            }\n        }\n        fclose($fh);\n        return $data;\n    }\n}\n\nif (!function_exists('ob_get_clean')) {\n    function ob_get_clean() {\n        $contents = ob_get_contents();\n        if ($contents !== false) ob_end_clean();\n        return $contents;\n    }\n}\n\n/**\n3 more bugs found and fixed:\n1. failed to work when the gz contained a filename - FIXED\n2. failed to work on 64-bit architecture (checksum) - FIXED\n3. failed to work when the gz contained a comment - cannot verify.\nReturns some errors (not all!) and filename.\n*/\nif (!function_exists('gzdecode')) {\n    function gzdecode($data, &$filename = '', &$error = '', $maxlength = null) {\n        $len = strlen($data);\n        if ($len < 18 || strcmp(substr($data, 0, 2), \"\\x1f\\x8b\")) {\n            $error = \"Not in GZIP format.\";\n            return null;  // Not GZIP format (See RFC 1952)\n        }\n        $method = ord(substr($data, 2, 1));  // Compression method\n        $flags  = ord(substr($data, 3, 1));  // Flags\n        if ($flags & 31 != $flags) {\n            $error = \"Reserved bits not allowed.\";\n            return null;\n        }\n        // NOTE: $mtime may be negative (PHP integer limitations)\n        $mtime = unpack(\"V\", substr($data, 4, 4));\n        $mtime = $mtime[1];\n        $xfl   = substr($data, 8, 1);\n        $os    = substr($data, 8, 1);\n        $headerlen = 10;\n        $extralen  = 0;\n        $extra     = \"\";\n        if ($flags & 4) {\n            // 2-byte length prefixed EXTRA data in header\n            if ($len - $headerlen - 2 < 8) {\n                return false;  // invalid\n            }\n            $extralen = unpack(\"v\", substr($data, 8, 2));\n            $extralen = $extralen[1];\n            if ($len - $headerlen - 2 - $extralen < 8) {\n                return false;  // invalid\n            }\n            $extra = substr($data, 10, $extralen);\n            $headerlen += 2 + $extralen;\n        }\n        $filenamelen = 0;\n        $filename = \"\";\n        if ($flags & 8) {\n            // C-style string\n            if ($len - $headerlen - 1 < 8) {\n                return false; // invalid\n            }\n            $filenamelen = strpos(substr($data, $headerlen), chr(0));\n            if ($filenamelen === false || $len - $headerlen - $filenamelen - 1 < 8) {\n                return false; // invalid\n            }\n            $filename = substr($data, $headerlen, $filenamelen);\n            $headerlen += $filenamelen + 1;\n        }\n        $commentlen = 0;\n        $comment = \"\";\n        if ($flags & 16) {\n            // C-style string COMMENT data in header\n            if ($len - $headerlen - 1 < 8) {\n                return false;    // invalid\n            }\n            $commentlen = strpos(substr($data, $headerlen), chr(0));\n            if ($commentlen === false || $len - $headerlen - $commentlen - 1 < 8) {\n                return false;    // Invalid header format\n            }\n            $comment = substr($data, $headerlen, $commentlen);\n            $headerlen += $commentlen + 1;\n        }\n        $headercrc = \"\";\n        if ($flags & 2) {\n            // 2-bytes (lowest order) of CRC32 on header present\n            if ($len - $headerlen - 2 < 8) {\n                return false;    // invalid\n            }\n            $calccrc = crc32(substr($data, 0, $headerlen)) & 0xffff;\n            $headercrc = unpack(\"v\", substr($data, $headerlen, 2));\n            $headercrc = $headercrc[1];\n            if ($headercrc != $calccrc) {\n                $error = \"Header checksum failed.\";\n                return false;    // Bad header CRC\n            }\n            $headerlen += 2;\n        }\n        // GZIP FOOTER\n        $datacrc = unpack(\"V\", substr($data, -8, 4));\n        $datacrc = sprintf('%u', $datacrc[1] & 0xFFFFFFFF);\n        $isize = unpack(\"V\", substr($data, -4));\n        $isize = $isize[1];\n        // decompression:\n        $bodylen = $len - $headerlen - 8;\n        if ($bodylen < 1) {\n            // IMPLEMENTATION BUG!\n            return null;\n        }\n        $body = substr($data, $headerlen, $bodylen);\n        $data = \"\";\n        if ($bodylen > 0) {\n            switch ($method) {\n            case 8:\n                // Currently the only supported compression method:\n                $data = gzinflate($body, $maxlength);\n                break;\n            default:\n                $error = \"Unknown compression method.\";\n                return false;\n            }\n        }  // zero-byte body content is allowed\n        // Verifiy CRC32\n        $crc   = sprintf(\"%u\", crc32($data));\n        $crcOK = $crc == $datacrc;\n        $lenOK = $isize == strlen($data);\n        if (!$lenOK || !$crcOK) {\n            $error = ( $lenOK ? '' : 'Length check FAILED. ') . ( $crcOK ? '' : 'Checksum FAILED.');\n            return false;\n        }\n        return $data;\n    }\n}\nif (version_compare(phpversion(), \"5\", \"<\")) {\n    function serialize_fix($v) {\n        return str_replace('O:11:\"phprpc_date\":7:{', 'O:11:\"PHPRPC_Date\":7:{', serialize($v));\n    }\n}\nelse {\n    function serialize_fix($v) {\n        return serialize($v);\n    }\n}\n\nfunction declare_empty_class($classname) {\n    static $callback = null;\n    $classname = preg_replace('/[^a-zA-Z0-9\\_]/', '', $classname);\n    if ($callback===null) {\n        $callback = $classname;\n        return;\n    }\n    if ($callback) {\n        call_user_func($callback, $classname);\n    }\n    if (!class_exists($classname)) {\n        if (version_compare(phpversion(), \"5\", \"<\")) {\n            eval('class ' . $classname . ' { }');\n        }\n        else {\n            eval('\n    class ' . $classname . ' {\n        private function __get($name) {\n            $vars = (array)$this;\n            $protected_name = \"\\0*\\0$name\";\n            $private_name = \"\\0'.$classname.'\\0$name\";\n            if (array_key_exists($name, $vars)) {\n                return $this->$name;\n            }\n            else if (array_key_exists($protected_name, $vars)) {\n                return $vars[$protected_name];\n            }\n            else if (array_key_exists($private_name, $vars)) {\n                return $vars[$private_name];\n            }\n            else {\n                $keys = array_keys($vars);\n                $keys = array_values(preg_grep(\"/^\\\\\\\\x00.*?\\\\\\\\x00\".$name.\"$/\", $keys));\n                if (isset($keys[0])) {\n                    return $vars[$keys[0]];\n                }\n                else {\n                    return NULL;\n                }\n            }\n        }\n    }');\n        }\n    }\n}\ndeclare_empty_class(ini_get('unserialize_callback_func'));\nini_set('unserialize_callback_func', 'declare_empty_class');\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/dhparams/1024.dhp",
    "content": "a:50:{i:0;a:2:{s:1:\"p\";s:309:\"129568058281196283485969852045082973240479662299833649655915078881064134837274587910680098630145331833314073809374103784577764371196941250131234226069290860531036282954125295253065782312888837858123565769812895344947719425674132117445174120829192037368513888110324906224313165146847550484828304476957369485661\";s:1:\"g\";s:308:\"74412411029812389060767064911429672552248323538380131684788386010483894594411356094583336355490245501438293594829741708592904979946709371629796413585578141928082616135469461600898538625232411795670398765206603348868016930193300395280159142433716706006511660846845763458752473756129210341944622900425176170770\";}i:1;a:2:{s:1:\"p\";s:309:\"146193716869508619647305139679263213856542375804651729246358043697244513997202825507519324367123148648281879781307709063806446534378531476829417062359168328754542266700915025319077860004928830404502692827043033744869104026437533251268433855993485126622032912525153084481026752912774722114259386768298899564303\";s:1:\"g\";s:308:\"69665008455351035902394440968350840909694548939696068493230686992883959134340037657032165407927257240961367927202156451938187477478359634699944054421395915668737939732656947241547267360211113199573477019756112574891965201688300035561288642801756915210306669313742136966503710236246509657858186512804588405518\";}i:2;a:2:{s:1:\"p\";s:308:\"95970011504465972968216025516056735009523168150391746798863350750628487022016558740903123981082492162615783238679595252201525891309321115574038283300200553527545213133632613244817126822324712292522172514337488336034824554888257812134279471335077413101896300746428316633744784706951717209185447418443121828621\";s:1:\"g\";s:308:\"32001234390591214193376879256032978095845138099384488396534938726527801485162551386074446838732561408327325537297587819822423354587910793955894800881058361532317172632826489329393036463815876353502280065088397376255064545313409639353330402859010245535643271582946371682731202352698451064261945530458419829640\";}i:3;a:2:{s:1:\"p\";s:309:\"107367948657744622403351910382294871172660886134042766184588950504191167376012553664832448482914453405627212505369017275057422865739635860055799977469867384589433510482716878025125735208146717913693754643825156388993040417089240042847866172996856390845604134659166867638714932484445695129717762215323852506223\";s:1:\"g\";s:308:\"35432052256872063868380956371395369446567951518895107007371489162979699703174160026603508244941666811604433385191485350533989707755652344700251327330272344163390347214659013791982459809652840042138137711943397019067880567618517864203333641800939772871309165704182113537048788646733770754235738140765119642861\";}i:4;a:2:{s:1:\"p\";s:309:\"165076179689180236399041719787853905509559840110034542544821025282142300182647737111192078636521696281849625331314634684082301307117056917096084810635909894266458257170816689088720750305011783930982287890608917322401215758373776087180348344303687659936705613789033223734686153637245444289163498175528538355183\";s:1:\"g\";s:307:\"7257097778465434411970060755441602617276464732216022873078841090902519498242797047568465618978053870338781634251702056843711528548879065633440550225057048183819140181212548735400876351188282105313257390821504822836725204187551346143027851261294592312829247674258710064400797532984515687719153634209645797992\";}i:5;a:2:{s:1:\"p\";s:309:\"138802088285708272974606443360541903346755775272625641090315912444740167056631682245175130288849653779718099745685973721625582881257253471469912033588275732534407812075504114028885001344754657979521240743598222852482713324944422564190132042911693426108095636266310291976312275051127638653255600619607748768161\";s:1:\"g\";s:308:\"68417768739254288613606538235899747640172953332166946096752518553591767961690284351247936702095359234884835162554920982218175460417056547752295163372680384373462615386345790712015724670852234108269209123765999335189635261342502383470729223332462342297600651014620539252087004543259974622328979031296782522180\";}i:6;a:2:{s:1:\"p\";s:309:\"143440408822834063256304001072379447612928758831014798604598968475998050944779945738610267109704057122027136269142323992275612512625193416837116502688466400091418946141409771130888652460438203432957802868229911319337716618772433262235445217129634258191904843258295950976235881931957544024858700764228870924421\";s:1:\"g\";s:308:\"61885916543751673602854962504624587475387355618874847004083364702999025366671327986702041494614967630576074420375515923449100469967023926671469204064186238960923581265396747860313554113531614635769731691080040797055303045109323006390999930220320481566672724416853132332620783770495166761662347109658807273598\";}i:7;a:2:{s:1:\"p\";s:309:\"157252810195046895262106972751573106014543521514519685514526312280470173673406217073362718196542447054177557777738853814564750348460292213548574898522849672157043162206681839289942712907178681480637456651237911559217788828984121397898667057591070954484991528199933918709759507489576582524237672309515073016337\";s:1:\"g\";s:308:\"88226515089489108825617534479543271381941380524155142801992166781725218337072902847660176074387609831777431786756574825615371213334332751708239568948591365196022411207206473125172401071031742000701493998811906302094840062532406089297779300213805172292794534054882548609113290200502606862814087039389398551133\";}i:8;a:2:{s:1:\"p\";s:309:\"114985530386639637192010327425709343494853838706808117399040944819410823551476787051890386585662495343435908127066317727387347589667037619326044414841194906165233165057587169819071837348100721622631027068393757028075105078368224325215567994990905693082132591256895393626358055498114303429757135090165754244597\";s:1:\"g\";s:308:\"91954658886623204543428135320064913668075738156343770210065195276894435619024576837084985906949383771834865278634709820758891770161134832009386328837080524363696464802456836386619858686421228303195226824855233384173023438331596052943262733993003608039164968687338024645722948542213129080275663447923469190543\";}i:9;a:2:{s:1:\"p\";s:309:\"109636871523409279767790340972634754329051398909884556956779733482149548929953420172455820185754193594396218755018820210816939914164446953253105835196134775430129532317887497749035659147652091944602377709986911544686721669749555303104118253472318080141451307479645737852211400120068770412867048403875625444929\";s:1:\"g\";s:308:\"37818248395638490196506083616037424071497042139318912208572715518335166153504034280853968065109925945696374241300596948545678886278292730681088749422984938877674324593818392935665057102238497543046661120593623474923808390078589110389438482877938086514382910775723604677940765395739691577027916901419974181668\";}i:10;a:2:{s:1:\"p\";s:309:\"171730493569370019376800099225484177890965402584439879262134362090208780017825875746914723522867989271423524805865035183047449735154919305905173130906979533370250036154805449250313007756615641578776997081126674385739513158578666666475902928085117932562730012747788409809904847316965666667562299267227963953209\";s:1:\"g\";s:309:\"108416022315624195962025023721429686956214474671377630577595792182130934651146546536934806785055934780756022131579568185897105910304336666966603269784935938299676652324388066306399902577207000810316610396941802565186861722182315811374339068009895153890079993046590210907050629248793523019275731677163852103278\";}i:11;a:2:{s:1:\"p\";s:309:\"122106850849876812974026248474577243429513625504577859983625726463984009864701112373037766966449574405643986501924059709161200764018639946475182619842398415505427880887419201361794547676397333516971649037394750916047253475385290090455656437086867354170238521151796557315029217026885863606073266370855712820719\";s:1:\"g\";s:308:\"24735148417562057840168476236802864525918787478183767549255404873115071566410820342975609285551159637301964099270689346814428231138259200159783611910129880506577636334045758775993631403235839108647573874932088398186329326859338337177512287828022266115337530677346513192023934283754416757903570244925408141124\";}i:12;a:2:{s:1:\"p\";s:308:\"98563064041855485547203709600999976616419318617005972312351844359425573674247265938234295573987429665676307716147248366503793293946473843863821094112041842163433187820029643571486513623012617552199332014038456603155834453649363234466831889556280793416223207898261294552530862813499919423410866004801362984157\";s:1:\"g\";s:308:\"59438969191433206885160654546800973338113955254155498154081588424773915117978710991458854168836846149574281831646696983304381311140860938963799520039261884497369538383372456178914971487015682793424582209855322967460266300754823895771337403292656106744806123861995705604402095631107844241722972208149696069901\";}i:13;a:2:{s:1:\"p\";s:309:\"178284570928419116251879511232308570183768336425183537983900704602870837188332981934665351235828833856090429560178119229215140472009400606724448162311527189376668655398871211015154270102539242482291841778242319866102591751437519616120511427151657963001938761731491181176323677631190765849664845153959486560283\";s:1:\"g\";s:309:\"148866999117635919417654566555696301710898017486560869603508728720369000308011510499499432872896469950541973497581527050700259381170969069051888183343314713029719431048716245290397673569650907200574767862492308652304273160426175251156907772789224555079381452284087020498494077430745587197689507967768857105956\";}i:14;a:2:{s:1:\"p\";s:309:\"116738580923175563597852946259942668774376741851243739225112168154299319378570097819002752583211279288010166314376092749452022693090749405496712595173427088219917593978092666816371487183342540185349140910668072044197068187531521505601089090756898828738261874761402398001673390547712523143844149045116052320447\";s:1:\"g\";s:308:\"40034019056813540582152025088875031301471554203237488324792191579491686866385133449374555241477936777633651939990968648667228424361281957258281751622971833684652653172758624480857897678112312636724089024553363699426562753044909465441006363024563493791311183967053810493340062539118031062536501032727371656556\";}i:15;a:2:{s:1:\"p\";s:309:\"126416923016504794892262733817762961386741581091282927102847048681387859009976911891213445835335683685961824220040945930186942069653866470565058006364859508113271188926837922616983429432971047367039856437192480727203019675679406394279531743601364712279259153955168108639232674771097755353305522755827224808783\";s:1:\"g\";s:309:\"115217983612815221807881039047616510833937677746347677762674420215129457029965858858381020879648451528607840750667922014522507961901103522126616783107408227640178996788031640423168737789746950166860880632363377442064306092590337543542962209423238876035647879264300565404605950968938772318148521663749673131099\";}i:16;a:2:{s:1:\"p\";s:309:\"143625235691679173790886628527372299203036999068004043049293157737498971333598566984526746417282853572231806173640623863668011175162069116291184420978114679218220215343843707983230876997357140567082288451238414474598947943184854685135804783998570746961957854573146698096808752435056693051401194762660928100291\";s:1:\"g\";s:307:\"2811906146542542544508099935802560496259761014277619841236735465830246544879946190087219311700423280133249036896828576018583549158462866232998364790129911777154099906740274868660919875297049045056201762749104047808011371830286824154334564178537171875355764504606152138545087944095720124720892297463471228703\";}i:17;a:2:{s:1:\"p\";s:309:\"121993314148770027219037424907576269470769429753193286495985674269623203562674630388975936634497963788324829621047210948121667489694438986232246907066349832212292491390918321554381941982921602817218049875411538677739007395791700194829322235503670960059494915298990576486708275549417539146086251251624135349939\";s:1:\"g\";s:308:\"76136756831073177744226997691236148872628027575601681328786412569385300051842743182050455179596968765127239279852680795886929553043311383681954887233978473067877172753495304640131160100079991048334006169655578631036144643965635995290531840054826540373743555549720623816740175043396340429759474512569110591151\";}i:18;a:2:{s:1:\"p\";s:309:\"124507994067600742618074869849502068365304040789212000487597154884662225035334860191210068989342872209246000032800019976883544484524411784905306951476799686163700601896271250346743329785269061645715826764256180887461136011848692557042253327916990782493758819566513663718823981060679554727596357143528871317029\";s:1:\"g\";s:308:\"35482091456711296536619960625191304461320385791007440302280000459820091544274446698718600582729456595724243302196867721560781247921581506087934961217320172517820436375036025679986744433993300325533389319578275768579785520050047676029798921290638765091850128922108253967600366949053220716093204424923866639659\";}i:19;a:2:{s:1:\"p\";s:309:\"109064911958670773649835739607804087660086265501176811018327103461487668225519906223353251760111190939688515131932304441638992866400411226029802671305803598781894196659707854750685867585938708782669538095831227041248283200630619059108032196443898570993622064280958838616123797547223348352709177595311511599127\";s:1:\"g\";s:308:\"19319085215957110536116059458132145601846897698032302263421502982575340197281074377754938122814767436026933811580737427951112223724536263615505177029727037084943699236718859061711113087160230654888547614277944690686053963024350436971089168545071233076652921578379142066648762537208150629974955548551496035508\";}i:20;a:2:{s:1:\"p\";s:309:\"152906937544903906500158994700987429025320104102810683664637770214766670911595774070719831089658199116354030446402893709562506135087569908102297576309390792224913162999986166517633590115811057491043292747990827411008636071214350838529749370926702854124191129277803120854478952648197409338821905891673530410583\";s:1:\"g\";s:308:\"91187914216528946835934502389977046892487031834663291019963344959483826794791886459334460883860381266880371274752391802612238136138804906007128976482853796298630067218594097450162858199508629386035676253140564960068420655423166899188074787874980346006766017039274380084312606630473497196077651554580178899620\";}i:21;a:2:{s:1:\"p\";s:309:\"120086911902590349366454763756514126237708714726873488009496335335637189915037279805404346623857583026128779203569864388549114527319559676012081995869302301188337042796528657367058068666482059979304786341533831397236939898922005010598725616120953311774451680404822020000603731144436784446124165276717107943767\";s:1:\"g\";s:307:\"4424877313153692455459160010045442376627290942868240892963899133364693215888804616996451658036573295042389069650630298172240061707271934897152643400497308474473895781338189295452861594891955327070306932371961613259631255464856486062618144044590877854971649831663385524916482609955557119733681027235051394932\";}i:22;a:2:{s:1:\"p\";s:309:\"114348651836506523500945935233374922736007775412847938214326113685832510534729952115503013208770982688991421802461695224699078655218430623713975694946030893977655752146594815185747948759946130185443646234087578887495356406232198663781066104307878855072887544156539853609255635001994884140842596116557739719339\";s:1:\"g\";s:307:\"3057093897497336474088939848688661425207560147177357671574081687524315743030139763595840116604296424154647944641166825852937323648159223225785426718349765948296485966934692317251464598254426752313531074560614623259760117723367044048992743223355384969321694573041256516497658853328140689287015483841963198485\";}i:23;a:2:{s:1:\"p\";s:309:\"151327650171178840752159959652360320262504680172183688626941326142323285313387175965893936843422387583059747539217294800332826680621899964529924259987091710340379569950289775771095947259209635172546634980224610800461576519968535309440918178046872340066339103756730010311335921411262306273623820892604544491083\";s:1:\"g\";s:308:\"93698947898542625080224999126897954039977816399726641263795164630099055943251781086266175948233460340162387832326085867234397994791219403143430000582587477992357941677427763758041941957575706031515765338579564903757662164614536867472674838978395200565535988130855861706547826534924631265525304939324782653714\";}i:24;a:2:{s:1:\"p\";s:308:\"93521349632285344521892805711041617086177867320264156006082942266085555239430140082892856429101554903795878410700096375285554712092378461187415152844263072615812187854557693901260441992278421683913551405640379450072927340627546240607073580365588955121454018383348564233577572631416908081675968109054718213651\";s:1:\"g\";s:308:\"72771444498359995710897378671512916022955775236629004788865109476298715383451615148812465275461129578179286998456555171089504695435937979981487681863800662090010955930732523942155243068394783205736383507489827275947913244113978685677151547805378500227336458209605695806261274104663472071017000731176318137622\";}i:25;a:2:{s:1:\"p\";s:309:\"154538027567571020051211849456110781402373992733880648830768917597755638265440933232881652059213857800411025814190629364180958088042486785080095848649421973721170250640044907161165782781498829401355213704798178816875963125988553036855252471477479214335533104910682313679864758691208754871335938134146570244233\";s:1:\"g\";s:309:\"151878268383910627178775626075769783354408670111552691713603803262208268504534598144185757441663543391767524850440098706725577284510706316706784129116482666131665290402058351722910804879096297592649548518592704064553732795220929615663992939631806717400234044169768626282218689487288304150755186241724898111829\";}i:26;a:2:{s:1:\"p\";s:309:\"101653566005311023925476332074740680760986376640227033128030649304832500364833045686179637239812634502064069571359223433072628429786421692593933101196289496232554055527830367596771381014857286540650623892767418966585533940466064017851317632676358364053937566259716232595107740160572362341096507417302692903861\";s:1:\"g\";s:308:\"74513607929035958667614526386443731970505034893688087329791851500228238599981508473298612939972711716486678692030303405741746145559282283162063549999965122587859070966516041155490470664682457776474615008916731802079841562892122761530124749566709348258961907082769282945089628529694000014717122454967698917460\";}i:27;a:2:{s:1:\"p\";s:308:\"95013960730537646945707930117033259716425250443303065109257923132885025742351896240153856832266522610218042023001720718571959026083577683594238991046216761447273850529095670800239812482889546714995990857314170023607531299056678286770352047754090948625051516504247244141244971934385607741647807871939423643417\";s:1:\"g\";s:307:\"8865118845127243015967838648938431880490166248417614215833772532595068334088382421370444972119810353915368575955429426679051753997676166286454497698339421653032306173169181980560322753725269776395160793563057913381832550741293157158306307662293960121073170223223526549325156207936691130571839423818348804874\";}i:28;a:2:{s:1:\"p\";s:309:\"165171568680967123886817133609555478777376451381185880118392760161526195696056154677234447980800025307869740068307389118220255165799524209662639178475579984315366245832285858100155088238540583941028875367935393602555119105296112422147861581513097413687377533516651030313147659549849822429529620533241957376461\";s:1:\"g\";s:309:\"125035932268322111740442907189656967999398670741804679117991185625792797440733765792321494160564108005199651911011206634432661255852804587565419942716241432891303926297868064874944963552504922882417912648147956818566297482440510358827099695306382023608097107907616454643867088476820708208837260972148368028666\";}i:29;a:2:{s:1:\"p\";s:309:\"149426789853068576691755408517052689479631486303474855851435537819356576423401695805659694193339781938404097894957535566502875170679660046587328388332483673210946843879963235153300984461866198864922318697292136026813009299028730482141451343653633845072186024898362005994170295241610203348654612524541396422397\";s:1:\"g\";s:308:\"73049073326296538965204086376153534487090415894032911283800130298629512997442525640837238968619479480629231884187445441225287944042744290713844591778499386520701583015778604634989765861327662774146166059025009694822186345094204748823299314036557275575979692921442204327068917190507323721173826594618769385979\";}i:30;a:2:{s:1:\"p\";s:309:\"135576329950386319783588278542132482993509697780105687913763037715299072538393798842105766084812653813647207393906971415039384965453861783642420021499035478002876073188931021393616989459213349405347142133542309416134384844351939543623768121011240069777383730773881088056874192238013050626270026174182267430717\";s:1:\"g\";s:308:\"60290997726824005308014865952860150036003597394047065883797290775765998303031531128172348476104602100923880751224159249009015002013080863909428509827722962421722642840399830757903808956875244743719288448455233739472345388057408045449495018163568905120714599842949385074246992032986074584000551188391542767463\";}i:31;a:2:{s:1:\"p\";s:309:\"159065776098323310441379296801791022455112191137870334479728771028751912269616629460900852200402421009307482473450428015915046824869147855243477769734130917997450446203411540494770348199589203378022151536992114137202513049016111036147137494187423144663693903693069118404837384424743130353522620387505597979359\";s:1:\"g\";s:308:\"43262178902448634370560334233060164330909659542673106272550614113862676255101507573561918404933225250124875942010295679192073921803863446466704825450009940939748827765323598689766356218791822315938651724944088733794097890759186493099112538275600413748100124980228285409612371429943359045997493847309113094420\";}i:32;a:2:{s:1:\"p\";s:309:\"160394941658450930276801031843077823785507821874720567147511483933208719668066705194765948461937550873363758297677780099637494770481353160979298177536248116532480392143334998523558523755864576621025753190170092723744034008237711325789361465741779607652217503455195004836525957182459455212695365562397642327793\";s:1:\"g\";s:308:\"80547204427645310086317970329606761433064424399921493097938200607767280488068285659681897406984483932897624033557910172823554540190625306750715210905207903368482988268690529944147507714249162654641932802591997206826192545609133886659250269751768696058736169665371823013501660148951330528409739051259717561690\";}i:33;a:2:{s:1:\"p\";s:309:\"177204881539784382588587844818041975965303560543162630455910056438154838593138830187319688900891313579137735937814467432633223178967482608482890993831012978464354436059856781658299553545037014282810727108082122588695746040219389387811199278574283486984537788675106695657576082357971493731577296175232034436141\";s:1:\"g\";s:308:\"69235053132347779619993662979522806857339437477106976840223821553847294669711048050675068877860119501392090174568568049659762185187804664573479845315366181247065012559547353319817063459644529835997237851200186729133930957640120723326425914499963919940154634598957978320326819438511948953408983404730431346679\";}i:34;a:2:{s:1:\"p\";s:309:\"170632450386449252892177651707784510677816625351105295529973803089643511952292071117487088243581854585627834705143965097010002760714509270510175372080209246944381024402704210823368565134636107733496734242350149868764032016679575323249886774833276221888180845935536877312614375117430059888272016549986096298381\";s:1:\"g\";s:308:\"24472385768968026997798980591786418974391665216646569808610375270769405972123783498459702414787564780388487976158770080827973184539797280411107573023349088116818340517293319973443760108032296957122632603976045312015768310687201612205589952908786210188329173621466708105183429140807264065028128471662573361600\";}i:35;a:2:{s:1:\"p\";s:309:\"106658122355520675039628277711696683144582739154934203137085123160221461841008030522414574684630155853821380331921319540272434071011591133318016562285627539130389090569115783107308483014499994503494308836196758225421785889774862524445335359696266057221770535448860053645733764498088036270185537882385482831183\";s:1:\"g\";s:308:\"39783652361002485670275466730672530969147764387968401456017775771979782025778665517161604038096192323204967577144624873089805078877923323600555536296131983877118252913078053205536795585717846083877586544103441059828092151865494642451758943378392029454891361242185344072415082423303093417563841046684352151448\";}i:36;a:2:{s:1:\"p\";s:309:\"103044743450356815717280629987073025863731845223317680836739897408078663728915414987974010186550546586595930233874188379117304132766900332673653606876214967343386204242329787067659113843205186608833761820128296608284953666985708091388382863740453928554110827130493742351284285532384147373799262231569250856959\";s:1:\"g\";s:308:\"90090058479749571428201045607912930124405620381996502603882386590496176073989569208448372732705389891721609719648629186673350918601783194334467381010968712369734326596190517082744138100466263787508381087402925634188635370622908873072815732169546219741518638971435909681793234308560167890325451296165583963178\";}i:37;a:2:{s:1:\"p\";s:309:\"125388209275868954338919318322433241106530307022343221377908573761945875896771826464040700182523361756959326040847908815078631193501532095938945095221093193286494713316096166068936244486440645154697824243384714912745011963991559904054699172169083499465381741721552580299869624834814200547479930954834702869467\";s:1:\"g\";s:308:\"88667109474041919409913794223971780303805302466161109886012349328724495178758113804709357734253441488703362846364137262391434253925210240752446097480963427198378575051635750668392116625679462417025783392797833504899554705232341840759599879188837609823053497744463005858819123144669211197475473256421788902998\";}i:38;a:2:{s:1:\"p\";s:309:\"143949768931086061604940118166532662934380945231267334574786086591887870050187582969268702068457305227173986915861510012707751007961140008160896148194781758723093984226682835875932742978257118050540576674378910935190769292316700539205182480917522964863427122871625517021839596567122012919478156411734686915977\";s:1:\"g\";s:309:\"138466632730009703263604483957935077591344930459555672237159749136157934320422889392131771025368995584492516955806991516958678527504262618479774885187067450769695885037834750726818277199698417657533016521761911424894327191784411447815745375877220891536113807184440318107567817825269486823752156243704505549697\";}i:39;a:2:{s:1:\"p\";s:309:\"175420727176478352783121714923416552881222745068680163347615288184223170132146515858071589662128422601876827315329015908922123050339231472535066426849260567046474903451891613375732255710996752666666429634222976593100111925186060523566568836985586751950683018244960710294161130739354264999973915392300513010669\";s:1:\"g\";s:309:\"102214296436553733388725636282118899490816111744922220769692374117300143278361415759909106009565248076781429421870924605232528811484830856869108078614870493726394947463288917149234179718831259015495904087236508316630128687330799396156049244218724291725012201270174939120336334613215053968238776073474709467334\";}i:40;a:2:{s:1:\"p\";s:309:\"159794800055348506571008906374836701462998540886533040353197135807163688421982933759743988362547882565601903919320227504216575700066744239387795654881352389673948479450887254384341226868981920609707096127165751516392484968378483701427198667309154393238401926688124380137237516707820272504228443061371360165201\";s:1:\"g\";s:309:\"125545954061807909213440974725673246010848665665902291111413828394758575587589962734315460601269956757971755540646548110374935166026100201454535822567189177241543789524176158023868303335124684764707826312875234354490525831170982282949580832090899553475185463231422993237487770186065056142320929583755264509339\";}i:41;a:2:{s:1:\"p\";s:309:\"100539882750827218683038523645435201793549230666573329915693212453304697477172915665745340230392862173855829201370306578877441376204178128180077679525298804707605907524492059908201893059201739409946592544808266797888266407195817995198097047681246712771143508501927477035153907568921002415521626713210871346043\";s:1:\"g\";s:308:\"35502053686226969950955336189827903558684377002850015450754413739937497087878601307174154780066555396845534338310205261283992241970794651452902383865029730265568871805501296029304576201222119877387937815777937271202653885649169466455244309442119655722851543473700201461896508440245001817562486228545596343608\";}i:42;a:2:{s:1:\"p\";s:309:\"163883088092169708750236298536140720039687203494799123680434192685621955270090430640683485012985988431013394323683780842964037507442368800026594927494950463285267496279525753657775606544352907707733174181132340012100157483379593750752972189141532209198932176506722571756928339227587633423995901120004952354761\";s:1:\"g\";s:308:\"21165897458274279623174933098408694536958819285248101600565840156627556793518769244526228428619827425694586345400323334844888827367491379029972237832974198947482513794112611577346475499184088771263690674973716665704216023869046245629889113229885861874638379352584818782358324175120814914412282487903605785953\";}i:43;a:2:{s:1:\"p\";s:309:\"158310278732715787022902619395810013339735267417224324445908572573513416852425846360209440725706619854191344489651342220702140566155238540802871753904947103638583986388285621112626977421886423502443003940413306887906083091475336779687502256926095204824702267835164082066519548090177807665844915376119641694361\";s:1:\"g\";s:308:\"10843632849807178081621701225073955336720497461666456417094069730548352280008748877225736209050583172763152571705900002329657804689214917415555838692658283058931020733361636160389821172444581043732406612290988648168803751381009032812842751877417489545282283613937636557019594975816844435163566172375045198580\";}i:44;a:2:{s:1:\"p\";s:309:\"153347735020776109672598090634216407499745284347480917300658818545198675701611122459685722367884460242515317436949386602816072625929743971764067680916616908761905707081856774209123031494295472642947392714965504325544410178836879029320131059764623341098464482119547364444225790414659989577180817023099747806219\";s:1:\"g\";s:309:\"122954310235084188725866074640958827281122476177323936387469275802984759490453353855653375904411138407476003678979649372393814463080666349613725044716044211530706906010081396524233937871139226812356391818759073899430860506374698518561365425436590854680442478600581253443022679747914324251713532666663803955266\";}i:45;a:2:{s:1:\"p\";s:309:\"105119383111574947555756749613427034115871685365338216999216182362104799407352348214405998777527422827499905338598543186574235633401319346122740730194104928531642469747870053113686583094237980081517574187423239107189826416021743315549437633596207434042084300173060678340091298306743614170285022383892833272317\";s:1:\"g\";s:308:\"67178980779596302685699276457331133093242115605891944037453156935974692034220792130263273292844686981258966134995193845401621693196880186953298375654676956749648419727313952831168688324511752698322454731426431593820106946644202118100133887201187978438871644005504337273486695678858525227931317595656959050814\";}i:46;a:2:{s:1:\"p\";s:309:\"103032591117379756539799688773679250452536252275580478745302392328252396825436802273785825761894063424135369686372016268918702883198596320220024055090905544130543248384556888996699089102078751994102466915262697550823095429698807867041857056199662639242062280833453801650111530359676277918138500762149217203791\";s:1:\"g\";s:308:\"77132801423319304165796207386958946320042494252108286515106992435042926191729318949722863127204416805833659339064969009910067600668843619911038984483433433617169906588079273102517397432168428053712322220890666083309668099651430019267046493644946772357567590144667581996075280334527222547528339859786299081931\";}i:47;a:2:{s:1:\"p\";s:309:\"102085155627955815095542920619146526387782679507307151846526493529130800012104779480514121921687848167194688460305927109149559545461691767269495772073701759547274290545646610000657936697419432724419115249685635339910931149030927018431690660081084386412665095805815028555042991555828923349280187447568942620549\";s:1:\"g\";s:308:\"27454324351455464224886256988337512968951014643818071525638765600705727743455262346758378628869548773191699219835696316409465156796657956179447196850180340548717017879359249274532768288404896887877489800526718802490569932601316656411893344856428111523823705865338040702336541777735189187460764613244420564133\";}i:48;a:2:{s:1:\"p\";s:309:\"139300783541692859595840908230318717324833616486825199849963109829727143946631572973434050282537779419439403310172134664925360812720995043013071012554656861162082506619208677576419320741818481236877774498337260619037804797461901823273337809052154052894849643006097478216997712928420055709178233445255308361101\";s:1:\"g\";s:309:\"110543956085772475876488567113525531945490203248111771432474506376282741746886768658898900409682098825014100780195520527561919350237842066983251165229178651412242741196039787820589590428519549154581837021452969522343352353534257888745437891875564792402023341678616463369894744400700376676910140567752536422210\";}i:49;a:2:{s:1:\"p\";s:309:\"140481282042623513171757047048340154221489789742748447730567837747883807070388996878704463331184460145505583061254384935268451450084968799400716266246866822185422597411114352295673685607245117959083546383457343144702896784371346366101512480777183669620433643591158243003892756293342479583829460630913480276589\";s:1:\"g\";s:308:\"75251167460967282352429912701249403706989070317963542102818801005423115111161788531265287611693282776684802138420198727319983028866819384860839081670321428144683302615744779867229499830239463688840840537403755994658696002903600035111943070257625695218188008419573921013401986992437874454517822788002411777111\";}}"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/dhparams/128.dhp",
    "content": "a:150:{i:0;a:2:{s:1:\"p\";s:39:\"292056242036581752787140391622158091519\";s:1:\"g\";s:38:\"92195130631865270616756943775010543543\";}i:1;a:2:{s:1:\"p\";s:39:\"306974919588773364832090085053788336623\";s:1:\"g\";s:39:\"114777600433746811424326551581233247669\";}i:2;a:2:{s:1:\"p\";s:39:\"293639007200039809639032425563054392623\";s:1:\"g\";s:39:\"142581017277461467135688328294730434355\";}i:3;a:2:{s:1:\"p\";s:39:\"196846296865248186540320570524502677427\";s:1:\"g\";s:39:\"151521785256606845258315346858388704159\";}i:4;a:2:{s:1:\"p\";s:39:\"214058314731091729962462647631129015047\";s:1:\"g\";s:39:\"157657285759615277755120995221831770183\";}i:5;a:2:{s:1:\"p\";s:39:\"211544627828281195628005482334918005743\";s:1:\"g\";s:39:\"164526962259030671035597644393561273977\";}i:6;a:2:{s:1:\"p\";s:39:\"264374153248813750338546404933838455927\";s:1:\"g\";s:39:\"161889252888199530110939775462329045141\";}i:7;a:2:{s:1:\"p\";s:39:\"250744024384599107683215360741111008699\";s:1:\"g\";s:39:\"118285577307522764878235247551273436525\";}i:8;a:2:{s:1:\"p\";s:39:\"203253285951672991854853186118633154923\";s:1:\"g\";s:39:\"109635202434828818623372966675160073683\";}i:9;a:2:{s:1:\"p\";s:39:\"297230087236684619171820155222807526239\";s:1:\"g\";s:39:\"151698002932284917728519787908419298293\";}i:10;a:2:{s:1:\"p\";s:39:\"183928564855833010909727349867640971323\";s:1:\"g\";s:39:\"162553618575521753939201816833697743889\";}i:11;a:2:{s:1:\"p\";s:39:\"282116071387851542448859292585051222447\";s:1:\"g\";s:38:\"96195080035033034987512884449304800701\";}i:12;a:2:{s:1:\"p\";s:39:\"323821345162263657163869210284973385427\";s:1:\"g\";s:39:\"165647931357595553282108059453854618133\";}i:13;a:2:{s:1:\"p\";s:39:\"325782265605496815296945192046960828803\";s:1:\"g\";s:39:\"146673523487430798803433071896683677919\";}i:14;a:2:{s:1:\"p\";s:39:\"292656882446135308138325253216560626763\";s:1:\"g\";s:39:\"133750897967258475364439141350154768333\";}i:15;a:2:{s:1:\"p\";s:39:\"326502508934692287898138354588749827579\";s:1:\"g\";s:38:\"95055028992751783265751636323610219169\";}i:16;a:2:{s:1:\"p\";s:39:\"238737081982465824552117175513390104503\";s:1:\"g\";s:39:\"149717268104904047668959026140422455329\";}i:17;a:2:{s:1:\"p\";s:39:\"325520862010996140507951562729031642939\";s:1:\"g\";s:39:\"160750290369379144250044243773210944781\";}i:18;a:2:{s:1:\"p\";s:39:\"284660075545249738683462999870017380547\";s:1:\"g\";s:38:\"93610554989070752708257914727841862017\";}i:19;a:2:{s:1:\"p\";s:39:\"216624906373462199236239231733765471247\";s:1:\"g\";s:39:\"147533447450211848127450101532248247737\";}i:20;a:2:{s:1:\"p\";s:39:\"310957194217588922918999164668665752919\";s:1:\"g\";s:39:\"149940487727634664074703848896592397309\";}i:21;a:2:{s:1:\"p\";s:39:\"223668363326959021386397963580036366123\";s:1:\"g\";s:39:\"107617531844346373239590352039307075491\";}i:22;a:2:{s:1:\"p\";s:39:\"215978097038720595934062824264229612527\";s:1:\"g\";s:39:\"159683714362048234485774830980270810467\";}i:23;a:2:{s:1:\"p\";s:39:\"254574157135387128396125954269859179739\";s:1:\"g\";s:39:\"152701269536030391318337642370271369325\";}i:24;a:2:{s:1:\"p\";s:39:\"285631418265701142797921983323494263559\";s:1:\"g\";s:39:\"146069911336721121221056226300966199857\";}i:25;a:2:{s:1:\"p\";s:39:\"338159277198626832869677887277616180423\";s:1:\"g\";s:39:\"115921496078116668896708740833402711065\";}i:26;a:2:{s:1:\"p\";s:39:\"216947143156151209031346105444363017339\";s:1:\"g\";s:39:\"138824874907565129063997286858881153973\";}i:27;a:2:{s:1:\"p\";s:39:\"276066866652515571839979520442563284323\";s:1:\"g\";s:39:\"128901507729551455645968559013908755883\";}i:28;a:2:{s:1:\"p\";s:39:\"285669464286230064035191348420068105563\";s:1:\"g\";s:39:\"133687329906681409517596983499858741779\";}i:29;a:2:{s:1:\"p\";s:39:\"191091625204338316951536541367974663739\";s:1:\"g\";s:39:\"115858048207727468438106103077246560679\";}i:30;a:2:{s:1:\"p\";s:39:\"337515161669050885294632549226272979259\";s:1:\"g\";s:39:\"120854804811508331843161695166187664953\";}i:31;a:2:{s:1:\"p\";s:39:\"174917215197953698624444001586175836407\";s:1:\"g\";s:39:\"139145545032511871649890757539716139745\";}i:32;a:2:{s:1:\"p\";s:39:\"286385113219804783667463282575249335643\";s:1:\"g\";s:39:\"148416238100899996847378967300424921461\";}i:33;a:2:{s:1:\"p\";s:39:\"209708268755657765718168447424437273947\";s:1:\"g\";s:38:\"89390121362982706116847582116053792661\";}i:34;a:2:{s:1:\"p\";s:39:\"225466796807811837787826426622847748483\";s:1:\"g\";s:39:\"119671516376904551623274021751719706435\";}i:35;a:2:{s:1:\"p\";s:39:\"230641118913675753332052029881543537319\";s:1:\"g\";s:39:\"106904796246200906002843413808899345201\";}i:36;a:2:{s:1:\"p\";s:39:\"320356446694223075350802268074194516883\";s:1:\"g\";s:39:\"110058673619329486246922731333508660107\";}i:37;a:2:{s:1:\"p\";s:39:\"196818317043011000998928174914246107563\";s:1:\"g\";s:39:\"113324249626145305887996118612518826373\";}i:38;a:2:{s:1:\"p\";s:39:\"224525332386128175478101630046930189763\";s:1:\"g\";s:39:\"108794399937298102548174167123976936181\";}i:39;a:2:{s:1:\"p\";s:39:\"240020159051805416566835088425214246683\";s:1:\"g\";s:39:\"122682169319663959002558338806306526673\";}i:40;a:2:{s:1:\"p\";s:39:\"194462122760796075851727083710896064019\";s:1:\"g\";s:39:\"125773984560640978959501682731083867083\";}i:41;a:2:{s:1:\"p\";s:39:\"185409874317812986685079176545573532819\";s:1:\"g\";s:38:\"99333837867312477025526770551684789929\";}i:42;a:2:{s:1:\"p\";s:39:\"249577380183382163061926592594820452239\";s:1:\"g\";s:39:\"145358444229966857167759564629611560067\";}i:43;a:2:{s:1:\"p\";s:39:\"175893673428733191813784481998618328243\";s:1:\"g\";s:39:\"132841634307591201423154416956579429157\";}i:44;a:2:{s:1:\"p\";s:39:\"307677647975104863327346573139531157887\";s:1:\"g\";s:39:\"165281368579891364595473211906122097919\";}i:45;a:2:{s:1:\"p\";s:39:\"325531007121336077474467231244998934603\";s:1:\"g\";s:39:\"113453603821265113678470265129170917013\";}i:46;a:2:{s:1:\"p\";s:39:\"291853334277762332165460454523197195883\";s:1:\"g\";s:39:\"112304674628631114572271595370414970737\";}i:47;a:2:{s:1:\"p\";s:39:\"321095002670328264904742293131676711247\";s:1:\"g\";s:39:\"111234333539460488850936780994186665521\";}i:48;a:2:{s:1:\"p\";s:39:\"327904717403107858772768435620257823703\";s:1:\"g\";s:39:\"135928358598869100491972026891044903849\";}i:49;a:2:{s:1:\"p\";s:39:\"184167219998611207248355443296589162623\";s:1:\"g\";s:39:\"157493611435172681271008684759507092185\";}i:50;a:2:{s:1:\"p\";s:39:\"214547513104198035614282222084852692283\";s:1:\"g\";s:39:\"143129048934951872319248661290580415565\";}i:51;a:2:{s:1:\"p\";s:39:\"180935587267248385659347192451794341139\";s:1:\"g\";s:38:\"87403976648407948326670717447739794827\";}i:52;a:2:{s:1:\"p\";s:39:\"263818812910108424430492542012743121123\";s:1:\"g\";s:39:\"150521173398666971792260292936530681753\";}i:53;a:2:{s:1:\"p\";s:39:\"297105925338731622311494789834838923367\";s:1:\"g\";s:39:\"105412171901317536491270709831194772423\";}i:54;a:2:{s:1:\"p\";s:39:\"243477408509935222548750912761663403707\";s:1:\"g\";s:39:\"144281761591161263922410500392425300369\";}i:55;a:2:{s:1:\"p\";s:39:\"299510309907221406889358192415160524359\";s:1:\"g\";s:38:\"89872008322088932958761182838622988425\";}i:56;a:2:{s:1:\"p\";s:39:\"304910526413244884233459829695367833307\";s:1:\"g\";s:39:\"161607538803038797936035617030686594595\";}i:57;a:2:{s:1:\"p\";s:39:\"203291411173723738334374535456283611867\";s:1:\"g\";s:38:\"89443086632858787787237362893463069233\";}i:58;a:2:{s:1:\"p\";s:39:\"205944278815676907758242117465652266619\";s:1:\"g\";s:39:\"108018077395004037033024244150011486699\";}i:59;a:2:{s:1:\"p\";s:39:\"296687706241624223629592967033355602527\";s:1:\"g\";s:38:\"96745488554386356827679857768107368081\";}i:60;a:2:{s:1:\"p\";s:39:\"293550116043549804890822649451111414703\";s:1:\"g\";s:39:\"158806215400749784831080725121944668243\";}i:61;a:2:{s:1:\"p\";s:39:\"263428134653217195777465522428064821807\";s:1:\"g\";s:39:\"118547891080671339398050662124658121383\";}i:62;a:2:{s:1:\"p\";s:39:\"325923864457460442868064053037621833547\";s:1:\"g\";s:39:\"150617615016200927618807658935974292457\";}i:63;a:2:{s:1:\"p\";s:39:\"196476504632822117192236200421668858239\";s:1:\"g\";s:39:\"160523445701389768553272859591184805705\";}i:64;a:2:{s:1:\"p\";s:39:\"176583442445218673933803855316690739563\";s:1:\"g\";s:39:\"132111065569185005904201982609461776533\";}i:65;a:2:{s:1:\"p\";s:39:\"208026268064317066201094177474542461779\";s:1:\"g\";s:39:\"129201867469581710101028427020543597815\";}i:66;a:2:{s:1:\"p\";s:39:\"334723033531927024498400970288217064519\";s:1:\"g\";s:39:\"127487291993357723200673873414989528691\";}i:67;a:2:{s:1:\"p\";s:39:\"233829356466320610519071132649157616807\";s:1:\"g\";s:38:\"94860858528074519022402472317646994195\";}i:68;a:2:{s:1:\"p\";s:39:\"188691996182260359105060338959757354147\";s:1:\"g\";s:39:\"162385010597491525627389624230217003233\";}i:69;a:2:{s:1:\"p\";s:39:\"226897261159415273301339620896213232363\";s:1:\"g\";s:39:\"156442352209872496712773155991679649819\";}i:70;a:2:{s:1:\"p\";s:39:\"236583358352137488729569337157796756399\";s:1:\"g\";s:39:\"152581941462805442071888683283182954713\";}i:71;a:2:{s:1:\"p\";s:39:\"201191190567504115316899173583099194503\";s:1:\"g\";s:39:\"103194169583174226029359181901898862399\";}i:72;a:2:{s:1:\"p\";s:39:\"283922273486502260013681112736384903039\";s:1:\"g\";s:39:\"135753190954064714225129600901141433767\";}i:73;a:2:{s:1:\"p\";s:39:\"223678587798519865477081555130490930887\";s:1:\"g\";s:39:\"137587074669296278642987846569068217767\";}i:74;a:2:{s:1:\"p\";s:39:\"223668244430177551435115121204793146587\";s:1:\"g\";s:39:\"156320667147688293051263750282389084613\";}i:75;a:2:{s:1:\"p\";s:39:\"194289571790886902139380720985511224443\";s:1:\"g\";s:39:\"107945851243046988533476937950371933915\";}i:76;a:2:{s:1:\"p\";s:39:\"278775692009590991350111858729107596627\";s:1:\"g\";s:39:\"129657043560683363524105717085311868437\";}i:77;a:2:{s:1:\"p\";s:39:\"319979086847889596207807729864047286663\";s:1:\"g\";s:39:\"145322816086479761996731697936810408423\";}i:78;a:2:{s:1:\"p\";s:39:\"198304778645918608926012835033912241723\";s:1:\"g\";s:38:\"92721662469836619760966684666997323119\";}i:79;a:2:{s:1:\"p\";s:39:\"248958430506627478869847133684906264999\";s:1:\"g\";s:39:\"163946236115509075218677438118567021097\";}i:80;a:2:{s:1:\"p\";s:39:\"211126209972926688870595842369993071207\";s:1:\"g\";s:39:\"108563592364604435542369366145242235593\";}i:81;a:2:{s:1:\"p\";s:39:\"239692691796226521380036414431702787147\";s:1:\"g\";s:39:\"137476683692977742290483495678290382501\";}i:82;a:2:{s:1:\"p\";s:39:\"252311610716959305132008843115717379139\";s:1:\"g\";s:39:\"123328978402999139145213144352371439599\";}i:83;a:2:{s:1:\"p\";s:39:\"174047087138041833610836860678128035299\";s:1:\"g\";s:39:\"170009271577662203836398662496227735453\";}i:84;a:2:{s:1:\"p\";s:39:\"231348363522122086066280667498528389519\";s:1:\"g\";s:39:\"141093524922727559438821864373557385467\";}i:85;a:2:{s:1:\"p\";s:39:\"248864664933152526411279596376158030567\";s:1:\"g\";s:39:\"123889374381029290108579278155184768689\";}i:86;a:2:{s:1:\"p\";s:39:\"224462201405966083242230789750023192919\";s:1:\"g\";s:39:\"158021232799967127661274365236078929611\";}i:87;a:2:{s:1:\"p\";s:39:\"245879376734021512682830793285031923579\";s:1:\"g\";s:39:\"158046576746250718282268617313434731959\";}i:88;a:2:{s:1:\"p\";s:39:\"253637925905658982372489538655726599363\";s:1:\"g\";s:39:\"149864317488110155844324751701060009647\";}i:89;a:2:{s:1:\"p\";s:39:\"279412238023962995721371699198188829207\";s:1:\"g\";s:39:\"155598915764501153026223926768958705767\";}i:90;a:2:{s:1:\"p\";s:39:\"304106342193803880773594320966748339927\";s:1:\"g\";s:38:\"92322047090452031206421560601306928951\";}i:91;a:2:{s:1:\"p\";s:39:\"322913290480087002459462604003828469603\";s:1:\"g\";s:38:\"92524856578633519411437518532800131563\";}i:92;a:2:{s:1:\"p\";s:39:\"277089057388309352780642604697631788919\";s:1:\"g\";s:39:\"105249705735663037159358894119941901753\";}i:93;a:2:{s:1:\"p\";s:39:\"280236513995939039844557210758532708147\";s:1:\"g\";s:39:\"158306374689206241016162477506012836773\";}i:94;a:2:{s:1:\"p\";s:39:\"234719020513353193747658715815920552619\";s:1:\"g\";s:38:\"91223745999232718078741004083061517243\";}i:95;a:2:{s:1:\"p\";s:39:\"209990000707927251175406243525264022623\";s:1:\"g\";s:39:\"125642114179469428756488157507005128403\";}i:96;a:2:{s:1:\"p\";s:39:\"275737100760368939576948745650805280043\";s:1:\"g\";s:39:\"167145628416726604176821531341460996895\";}i:97;a:2:{s:1:\"p\";s:39:\"213783951740539117048794197148144657227\";s:1:\"g\";s:39:\"109417094981752227864776346864591549789\";}i:98;a:2:{s:1:\"p\";s:39:\"318677936852074604097023986317860558759\";s:1:\"g\";s:39:\"115037656438911641363193487524231340943\";}i:99;a:2:{s:1:\"p\";s:39:\"222750162478363691468158822602615735239\";s:1:\"g\";s:39:\"113556306002604103800443505592028066063\";}i:100;a:2:{s:1:\"p\";s:39:\"239051669069722927531642869778838542343\";s:1:\"g\";s:39:\"159620246209558910663028687970469241585\";}i:101;a:2:{s:1:\"p\";s:39:\"308867039809658627190349828399950839963\";s:1:\"g\";s:39:\"111777033404344242825393328519333723859\";}i:102;a:2:{s:1:\"p\";s:39:\"191578329058918619482978110290472855563\";s:1:\"g\";s:38:\"96920536616578690169019365830583899443\";}i:103;a:2:{s:1:\"p\";s:39:\"325447228570210752496684536118034998379\";s:1:\"g\";s:39:\"129437827816980982882065741607934187687\";}i:104;a:2:{s:1:\"p\";s:39:\"199496827021205922362423961503975322443\";s:1:\"g\";s:38:\"95449372423705665601914584672984436985\";}i:105;a:2:{s:1:\"p\";s:39:\"238204010443217252139505257991989127187\";s:1:\"g\";s:38:\"91317591567351091929487842436160672987\";}i:106;a:2:{s:1:\"p\";s:39:\"210575582741342359714046308724434638407\";s:1:\"g\";s:39:\"142543190721741958237717199151161265865\";}i:107;a:2:{s:1:\"p\";s:39:\"193835921830776847504350847922101912943\";s:1:\"g\";s:39:\"151813485796154943234684032504099327579\";}i:108;a:2:{s:1:\"p\";s:39:\"178427490906676735864591330886670926819\";s:1:\"g\";s:39:\"146413567376325921761866049795179195397\";}i:109;a:2:{s:1:\"p\";s:39:\"299716072306325255352875980371073738499\";s:1:\"g\";s:39:\"157210887501582163921135958059988460769\";}i:110;a:2:{s:1:\"p\";s:39:\"174501134484857074197927837838115864819\";s:1:\"g\";s:39:\"146752211101339794211955770327266075471\";}i:111;a:2:{s:1:\"p\";s:39:\"263141644198405815082265954631245057027\";s:1:\"g\";s:38:\"89010976094266637055743371326639574349\";}i:112;a:2:{s:1:\"p\";s:39:\"176466451619066725947852784079425521863\";s:1:\"g\";s:39:\"152509734985991674456496918102451358687\";}i:113;a:2:{s:1:\"p\";s:39:\"292682206572230534435344520034906633599\";s:1:\"g\";s:39:\"142874105165878163065284219612333009551\";}i:114;a:2:{s:1:\"p\";s:39:\"201328074386089494127672485138355071347\";s:1:\"g\";s:39:\"139056812479572385637122227340971141837\";}i:115;a:2:{s:1:\"p\";s:39:\"229826790296235981066004577347766874047\";s:1:\"g\";s:39:\"124485556392824999787963979933226961505\";}i:116;a:2:{s:1:\"p\";s:39:\"332795007680636342427162437048877824483\";s:1:\"g\";s:39:\"132371062218285402701784934167045475545\";}i:117;a:2:{s:1:\"p\";s:39:\"264128365565511611517695773592609678303\";s:1:\"g\";s:39:\"114615254022882630385756450073964824147\";}i:118;a:2:{s:1:\"p\";s:39:\"268698717748706869710939835298615927267\";s:1:\"g\";s:39:\"117152896705025823674979508347665141611\";}i:119;a:2:{s:1:\"p\";s:39:\"302105198709942553044124021979667091103\";s:1:\"g\";s:39:\"115210049253772003791162765412858545515\";}i:120;a:2:{s:1:\"p\";s:39:\"244101232788334692748605391991798485199\";s:1:\"g\";s:39:\"106653638158862023536690078428324579011\";}i:121;a:2:{s:1:\"p\";s:39:\"230273108057481536883566583583109559023\";s:1:\"g\";s:39:\"100481439316995264801026403022097167371\";}i:122;a:2:{s:1:\"p\";s:39:\"322984349144126882101119659857800338459\";s:1:\"g\";s:39:\"159007973907722446137944813244793447289\";}i:123;a:2:{s:1:\"p\";s:39:\"336551506278300215412128472087071431523\";s:1:\"g\";s:38:\"94575518869614444784555444648323179985\";}i:124;a:2:{s:1:\"p\";s:39:\"325853084786159562250150213907913293147\";s:1:\"g\";s:39:\"165854802536055673479990720116207791091\";}i:125;a:2:{s:1:\"p\";s:39:\"267169176591038828428461564163619391419\";s:1:\"g\";s:39:\"156305369077672218039563577497885459563\";}i:126;a:2:{s:1:\"p\";s:39:\"239647394471266396711562577661521640079\";s:1:\"g\";s:39:\"135150945658333061448039765686757664557\";}i:127;a:2:{s:1:\"p\";s:39:\"310272220468352202006936575621174675363\";s:1:\"g\";s:39:\"149183267477594191196034583076725103145\";}i:128;a:2:{s:1:\"p\";s:39:\"282045133469485047888914986480632943019\";s:1:\"g\";s:39:\"125711764274064417833132422105222333643\";}i:129;a:2:{s:1:\"p\";s:39:\"234599771405208353221227496890421334027\";s:1:\"g\";s:39:\"114241200628618711658613583227486232613\";}i:130;a:2:{s:1:\"p\";s:39:\"228152795513450511034942449472495573367\";s:1:\"g\";s:39:\"168398706283838543234401695778589281927\";}i:131;a:2:{s:1:\"p\";s:39:\"212097593073542307065347538486191261919\";s:1:\"g\";s:39:\"149940368580113076918890078852679018041\";}i:132;a:2:{s:1:\"p\";s:39:\"297412983264745482861745631486523413147\";s:1:\"g\";s:39:\"125354297262324596636132561377813415813\";}i:133;a:2:{s:1:\"p\";s:39:\"294153649598454137023569177048904340663\";s:1:\"g\";s:39:\"119618232671986101725255082853317991993\";}i:134;a:2:{s:1:\"p\";s:39:\"175487816341984471056566550210858970703\";s:1:\"g\";s:39:\"140601690952468213621103178853863520569\";}i:135;a:2:{s:1:\"p\";s:39:\"176180359739294489581394694681108500843\";s:1:\"g\";s:38:\"98077114592993318593790787139676895321\";}i:136;a:2:{s:1:\"p\";s:39:\"279572267891227674183294094072204319543\";s:1:\"g\";s:39:\"141474017873114223498048340610357082035\";}i:137;a:2:{s:1:\"p\";s:39:\"239629442130765299778978223853239788839\";s:1:\"g\";s:38:\"88754684643523546470289505769224285729\";}i:138;a:2:{s:1:\"p\";s:39:\"311261240312331479969447936407219323047\";s:1:\"g\";s:39:\"151343131310288676643199151763364576911\";}i:139;a:2:{s:1:\"p\";s:39:\"273396005392900911093204799067494731419\";s:1:\"g\";s:39:\"106778038879588069377890944288814468931\";}i:140;a:2:{s:1:\"p\";s:39:\"261721287666608603538123341686220061467\";s:1:\"g\";s:39:\"138711968008728462202723866189802040861\";}i:141;a:2:{s:1:\"p\";s:39:\"215937395349495995166858415892962367759\";s:1:\"g\";s:39:\"155398583112088458001793075753882872685\";}i:142;a:2:{s:1:\"p\";s:39:\"212936571128682845071308878878059010067\";s:1:\"g\";s:39:\"101442737521645273653232103903447910079\";}i:143;a:2:{s:1:\"p\";s:39:\"298838175786452844147867416306769452987\";s:1:\"g\";s:39:\"160565315644879191178274475105507742033\";}i:144;a:2:{s:1:\"p\";s:39:\"316176852999320912845222134672775131119\";s:1:\"g\";s:38:\"87523304206694080898971766076264143747\";}i:145;a:2:{s:1:\"p\";s:39:\"202013126308834551658071627160007872163\";s:1:\"g\";s:38:\"91110917788528883796996360661218204029\";}i:146;a:2:{s:1:\"p\";s:39:\"310457373590695815028028265615601682987\";s:1:\"g\";s:39:\"164392575017790858253925716306682762491\";}i:147;a:2:{s:1:\"p\";s:39:\"233494437113899933858624559487545643707\";s:1:\"g\";s:39:\"147087009669715116027793726225269012183\";}i:148;a:2:{s:1:\"p\";s:39:\"175158366760549586270815259855245814027\";s:1:\"g\";s:39:\"137880202528675896604634215375162273381\";}i:149;a:2:{s:1:\"p\";s:39:\"200440310559660779805280958200078988363\";s:1:\"g\";s:39:\"142805624090912627846213953550472112815\";}}"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/dhparams/1536.dhp",
    "content": "a:30:{i:0;a:2:{s:1:\"p\";s:463:\"1484321112960587045156307044653452978091514252781732555377115872744370782753532223710520596651771862094580430622810781137079954026654443009773353316487869110581614335387257791372300366363986959520162727301094381504710539122423215449953773749566665075390663795515064927524541364929410161593571002665960511042368404720007227185351442857133729332461681414076545413251514012799785726764386304857603161524569772320497781834398411353556378812114248426854017223765792447\";s:1:\"g\";s:462:\"635774037287666756005286201992926844882049694229071109060527214859683349345634244908520777317972311779819169417124227454944478231493944538362566784762524159848118679198133615209134587519203999139059358147991164119330583496102138414754471736404205776201609984433151539366053179678590829297151308903314368108491194375955538280261511309639674764255718253005505707839857874962943779665415343296052187866967481027372096404738753403721555758189272826817559193637462120\";}i:1;a:2:{s:1:\"p\";s:463:\"1319436802072744870627529725982335407106255106838769259080484192948822006093801447135658971621913672383780818570900869846109477900474351617379125755158877287287443914503331845436479622427887788221295041360592939442869830231851542580082543738933690647798111929121232075109013051084277527846507106765265691741993543124300304586965031520186535035306131873674243292213566694074549356897012038902793605597813873772107032094774604447038888760851123996389333697066500089\";s:1:\"g\";s:463:\"1094948501651870927866408997875807332362132368280764746635102906522376980935616408160803921204390676267735235340675683774918584046129467358536658452112779035005246945500990564970828900915876183847784477372105600610181992912866134280979202520819598729274804910027149270482786962118597828865094775152221808068814764597063219931910461862798242682996856821691502783024562237507266046103319637879315130332069878279043189748255613212869917119499585630902196048518389141\";}i:2;a:2:{s:1:\"p\";s:463:\"1640222121300873590885740903711612856053216234718072467371799710030209040805232294429104366467106949818620126839460635110688960840211274066511897330827987110967763711157204318410155927749323139656115284192624456851102305115967064988358305606231181648345630705027165974291804661428533435957993527621517312013100947564241032286994712995946793397929587066127500563005307122895245755325339947878136458621529441597532795180908459053645027157995663081045092178737236951\";s:1:\"g\";s:463:\"1091699155014785793699927849492118315207217763778609939374849137247626111244977609635966506015908867479947153952351409289738203198557207594461117445750302094758880324908956395448076571856589921995881773374725119459511313687786646810555589375887009649909789659937861969554238484131951359065310736811264948846669566484058857698917573131819117850621387652382598432460267007035050505884971612126049437914803225531487958278531161911691953811685277239553704185614100254\";}i:3;a:2:{s:1:\"p\";s:463:\"2042201993843598159468568251727021381151204860153180105899105583856572114957522535810934397491695695827381512620409599315961608902985092050021488412358853723928122649403442200573138328100885455439417892396869322127744220101094644670053440714135390977909178803486242950685670919693087337352955059110458693240470974292348857021512713811450682539944478562513964203257401079664973633503395515416018593081165879055440039280270143172237165005252136496925734559160180063\";s:1:\"g\";s:463:\"1500442284667586192076348842045301367167296162953592222959388230854684580797148712288866802146615945078966804943095812267797017849054865779802801614224624014374538152627740263805739007646764205976963263146061122561909911419750642286362084298710720418238017005026967541716370169549583274076872905500601850314761635440475203807971054187862037414097487067989205898779614632989928913601024677346758843158175861275923151746018118718105464617356557647207655221747328074\";}i:4;a:2:{s:1:\"p\";s:463:\"1637153014024763059444878705223203780681858093138911571751979728838657707993054069819608775778753857062986551340167861371895956608008303443247254570296681365466843835598991865198789305509785381105738587250553832156097575877088631555130354903285869176634617910439198251693833897364578795592212671604970740451504483168483241814403323016500573560687048758004696815940230413780398956047311381874244761196793125330727878608765576917373701666692053785475387091211014381\";s:1:\"g\";s:462:\"253146196079304316266434733768872749372301038198365665590883109674350222564840862236916235404732761220504241323463873735246003784699325498867656640778717821729675220766842521488720124623809011690475912948904742512957103216664404537195645503873467006909218174832003149223675383918994291709588651481979088751673955939897523459289418812245730766260986806015360755507568343631994201583412347069821756072284985530614961162489684943738005917848451625837740216654238218\";}i:5;a:2:{s:1:\"p\";s:463:\"1219739395129421980986817581093875899847343408305888101989901813253982523812274106436433323689615865668476392367734814970480804904428414841429633998030501300762701392560716063753422306285174523408337113228268818879405961220480195573703497617321463271891741904278861642257906422159298231098658985526457662170038010292931860549511504497994128931079950747868651823087004354747165956919277426382129565650723679401668983210698395935172256570765605609849286691377452069\";s:1:\"g\";s:462:\"170749392644970811287030749108243672722681483625922470846523134882486580425232339780276174257909030458715830716692588702557598044687908844893420066097048011582288383239010520033914489804041483203577102579487035826567669554277956785062140672417410620876815360564263566630149415924467405717903800222598776815469568149017143892771598944636450610659476217733997741232959262233276018211413849373069396149673782042636144584577674185171593340362723828343131348119216530\";}i:6;a:2:{s:1:\"p\";s:463:\"1823795465713565701278315869400723495457475261130852713977770426795435140015065407392713025910005837170602206359208592843713477109036614911956946724377495049413103985503099433241790626512151502197550302263168341159195533492294383405632570116732818018836333704092194728943213064115454736812855110357810165024286142395540987558177053133376862609281101196043894433574854253390690930850852001602168837076660408735360137300780178764720747999733920473649502672753029133\";s:1:\"g\";s:463:\"1442839829947671234369496200676072588081612459677607985530300351859499357749262146238588298044263018187404783155947200807580123587074809026438733937831837276863552797962633391437862262487983073076526197006774206392599749277196760629805690702748736444555470229978387347874033267703600471989608673950742255064321002547976555706582185670106509022326628674460174579619942903604626192360640005219137811717889441546118271454105656302351748483598142884252491906462551344\";}i:7;a:2:{s:1:\"p\";s:463:\"2330987243466161089189453913980054878244548203271516593454871586865008572865835925509538466874454336703982083570636604988092181165159923670888163875699666429239768275554084525673152372358619029724159564367314059390020704727416486501641650913127442368735560126459032806262580912363799758293882503234653435264501039310901361922396293916077012477020084343090921096158915280800532439667442662661436491373212982496729726298927418474654567058464055252208378074662306911\";s:1:\"g\";s:462:\"386680618508384973423672062850508522397135947113284374965100744322646472653484962944409055998358573494424314461090206662182780860368561763485570382561152186069945568506098043823478071525306398614029486640941099890329530883797789468233801063149372300345673355594678489190792290553970578096255571413645141468699974372196819473802551597223213318243705334542362861643744710123296535080834831744256642683094762389663106543125584931608216839951706680087663895979524043\";}i:8;a:2:{s:1:\"p\";s:463:\"1262620669861477839190844459069625161157458691447808343984704184159371136895931239924491606146944991489400086233879378957339498118133191256004545753457451547013077389884363597994672087814969621667075874313137230455646979150907696693252095577556652543710779314562280787859056548289029664793556128094449637512640549596088042279135346001711726938677020098004905539793932511494769831294545941118419853855421666428039455145569228072097189891576088267457892585617327537\";s:1:\"g\";s:462:\"526663796116646673994851998981201669178713058539445963858436667089710552476905374236164705691170375947481081607610541303274006827378957464313549841097789508218946402515689199903038313446510101310473849351954858966871650717674123149287955406174093369789719324626912240862929635523839987379204148425806480078269046549263204392631011143098816027493919238398815279095074992826115644273740497748876160953621171789407359553722390062142143510560327171403556962711579228\";}i:9;a:2:{s:1:\"p\";s:463:\"1802806247618212052847139445190286650067259060192535756510698193625342451183591635366213416695234519378646880682633767718314783369603831326194387419926531041225952412795286571196321300818787263025582858179591437678991886851088704122896117267126236018088255041959547292291014433680944304432469776645236818313507336442478521079624340532244747798364495759367518444452373370920933200025543833730541849004863942871483124484895889874086358389451367377636915283155601279\";s:1:\"g\";s:463:\"1284641594416543525662036145628946288335762230298381205343844315244784563257207376136770309765261982199619179919538857693102793738277562060812035117250208559853314039706519792948991125592723028835849628618414032901893842763449637332613735729524022145278901762445067158581783058804762286976909689060845327084055603617159850945703843763012315352891860697254579455882005066597307381839438396573376674188203126522446102248606816032797012113930789171978183813977343611\";}i:10;a:2:{s:1:\"p\";s:463:\"1582811987242397018030371731694457345235827088681427679697116889089464714688234072738746320838265451104885880125066461941990856320096604611671565283402794876779139028522997427206721007041029858890516120432680771700972923994634541796145230018505355925572838476051871410554406298275632980176315170349424989011480109942413662675414441427096441297934858425355818410353360190492203797797818306162889687552448049037239909742012439530936824490474509059846737144151122589\";s:1:\"g\";s:462:\"904005487385713022379621349592992471612880301537581879253733082184761289667473824498027399895869972592947693035054381286316769789684527733801483110012752797833748591601744372689718751357647506175043276817062912956835261917728246198019654354323587119778378183866021920352464303862458402855590059151030218669892369596629436855331014343306882939528512800958166479957444885999360235000004595914301695408522151397314039624683984435249704259386328592373210860823431745\";}i:11;a:2:{s:1:\"p\";s:463:\"1751567140177216355913464714923925382303386077987286661087016520920361085694926448713658621586777889815549014628902654175565156184204401359255645222938554308180406673877599066706797648397605589808600115965605825074379462812206558724269393890032645033281680588349893461463965184465169874061908663284055226215854545962327006625887546931982197079318292414797922218674375886474872777173052121315637184932090274167091399081333368914449195411820479987084002907490075763\";s:1:\"g\";s:463:\"1728933896829190229135447673930534573193230270896317083457020113596793657167810111090059614779411353579891050636265959009334790354242367021222694211284484143733427402392439443059568114957827430341392137236643159465739007046315676182953770441979720779755837087984309128307509317093013153746661996696823485906207481328520018097291489862365101433457635101786564648836715943624165952560449579601292473841876104693571448114740692851519203213185026138219553941381566465\";}i:12;a:2:{s:1:\"p\";s:463:\"2151630423012647537844703576294810579565336708199678266911187790505880932879424817434691270964383838946482745460110687378195032802933406049645640068316727857023948732325344487226996291312649936737107355368206848804098606231594113432864566561818799062515941354699429199159774308376691772761126331126068157104422783733539530755190226719384389650570576991103463111113686035442716666605835661122272855402177927187769060522635806443701402511727404912236646468773112033\";s:1:\"g\";s:463:\"2121000333525367470091854954993095574153670551827036751868266597572256874667759117352446133965472453043969463344538546533166991278117936837955676339645546669209260506924224811209384588096653947044134595805874397580120514968802999183663119396415206905026521518610277469511452527761346355780035751949172413793085089893406122320590054677391074249022019433205414681586553029386620571667778599880374927413315499007958756221913701138872501077944472074702822713887024468\";}i:13;a:2:{s:1:\"p\";s:463:\"2205070084150365578520443567286113338063494441182286711879349386447420617550082998305163124583124659968411565696253507239750319335503844156433325217320099646707812531275013377115385880286002737298380907436927575080574058027459561347795249533536110306336676674626272337164368057238635634936325623385295555008743962525297432660594530824633717776372520550493992724995773138869871133949848960548326013413861077038851781317075929760883962338374431825689935375843218653\";s:1:\"g\";s:463:\"2164986491453150181997307394732315140614298464027330379977238121790004601675170871987978031576748094029228652746235016225704766983618671573830403937213847957627426849730795717992909097124266785777500451244045698059566929616174668460223079201751303173880459434689685322490463699023678343346462747706418014566753958287780845925077591239643442031042118280194530297714211983675755199763003168178308438929299250986345700682377534935196768002884135000786173463676024879\";}i:14;a:2:{s:1:\"p\";s:463:\"1521251664255354648387650579429147645003851430901308819073432965199333067089633939765298667366222286385404882515876653909529252398129005889801425507724811977996173982929147187904902391198280960871297119665598540835597034200064446205943817755106610845073388515419027205081211825491636302401445316595226697481153192188703355175647181368777041455082796264978831047550011469827974208535580950629540118699486070742792447196201207794623773356284583460065990997086238511\";s:1:\"g\";s:462:\"965193605452145797059670328874441819155298622619297053175552499937680640644666445940944882855932307148639941581084597423672394906108044956969878533384135603691286438773265879206361085382287378400275018398045193374212541331042637252930194708676430354898774667565187596063250380298789522845687589570438674857628002717877707884455323523299181393442629310322092655889918930430566295027767644067297428030033271832881357044821777678830457933953075655243142288927175592\";}i:15;a:2:{s:1:\"p\";s:463:\"2359088529688849695976172882354276186572333793676129238480483310356338119512834416470889516824103143013456265231779354325107949482185103514573493123174776224113354923823459005285100692068081219492746850787514937711005894611615247331157020496376924834185574122667041507752735016917771570908300383091007334114696800556196459897399050681446783294994048701546990851161672721128777031448669634022236634171162072443925053239893879803599386757951784662290977479728876099\";s:1:\"g\";s:462:\"531712821169676924995279008450573863171422718303644923801999592407585710289327315712811203262677550193268920385621678284963439199695456438890216930330152156118253891030820312933931857809080143365111231914817537856093519081740430912993465432826979612678871678391441229601885573783843423731588207120032647787887396014960941864835572694180911866701771212825132326338693544497332820354308355809281971835819585009137470469515712697555045631883330889364226786485235267\";}i:16;a:2:{s:1:\"p\";s:463:\"2263415250426790488990021998541593923985939453932066947986968571160941622802612177769141891039473489070175302867802751596946353154172125528234191468643981304299429091395959809710836541720420021923806062020453686237371369098960991935904732896776305367149806546520869591216966307337101655332797619207182444936519569732492987788087886323058898445366441139143155332695122745405143154390717222686607255170420221316368625610824961565878490680157211889540793859511314029\";s:1:\"g\";s:463:\"1592300040248123484343304872412609674278233000042429776065779160677830870546995470357954916165832640025797321967048755775627713204352714564717585266051163773689777402235485084734939182825652015026616241954245365070589307618851173791011445842933302480677887284019554610611546717089545421534402349743077171151964768597699449831915488170530900787436161510470323524667270065908642393725707849007244393660272712704257485664362080753091384435793689644134869046685439697\";}i:17;a:2:{s:1:\"p\";s:463:\"2140021758751023276840079207042484968828483938990224910948092870606013654041680930240672408316776269908489537157093230523921913791933713307571209743090663930053524182963000614494056181878721267909181559101467357866435493815183307483633613451238642152941855619490861935672760757676221198639329013244377526408249320935076623838134966951658604802937666471551992167087938734246741266040666007877163204679608400933144213094457105599599278002366948889603083533991484951\";s:1:\"g\";s:463:\"1100233131056620948296063080261400071657894915014156851614190078061725775652724042802252052520540922949797249690960522349654067595799262331593777556819278792085357168985669988636673921131639681240048032250759952721270517316659925423462247942806786822053233647319893585509026604836599081906066169311006342005206909012755218672694523070884738297514453530775609726869693934264786610643627147185023994300750387486846804192790799167713142235625081920945676492185259837\";}i:18;a:2:{s:1:\"p\";s:463:\"1551038949501222691978272893261175182106190568814977369412264479269203984617935284649271672983221996009702717185850835368097716239680362427876850240608711832907992991904207080846078476339794107796679682792702952426396050690103152939322069717802959355097917068461854377217432372587859666863879175341220281173708131767332774632477155184400678077766817498132455212226304905057355970071577431782390842748315762830917398894909591248369951918144444569327038256791412189\";s:1:\"g\";s:463:\"1122743139630282153879868251492800292369119837055724070863937958954275141004659287445630535750518696420133153588928570581644864109649651087502307048496388930886123022314248669533791822102495449596897585018024718364807118889886919617488854825417330211828450024519870873403366339898166468075791590348995064663082411049461483459672090493049746342023873181820458364596806245316113771672923399540575780554223789112003339156911840140412416044701352663673472942552084352\";}i:19;a:2:{s:1:\"p\";s:463:\"1356275386127542659017850102084213162793783886645454180765334717833233223399711893326242349980495053147731601929882665213599239957578370346016474113462672990475517633062742504791277452523124568556338228152297085410743499668547067578837155876739204833738979418284421167514815201003427454456488029773197444587939264563226841204796270250197007137759631209198185435416640354634993592234914740333637656688867749691551325073441320772525747422461099343214212606226782837\";s:1:\"g\";s:462:\"196158088095289507282635289372105179799925532380890601501328888911791240059921911676135260880026187732965333332154750913555772522540516226362849912153957919289972463443703634672828466780953764986723451520741685547186167518702308476173818830280887990050604198896217462931059031114540897431967632771864183496847755209674316498138796078477827464190973060848610335479452576965859000719469049864951119151409590349552233657722495217934957865156668731479214259056401619\";}i:20;a:2:{s:1:\"p\";s:463:\"1791472286915428465800935822692265439238355517646096021981341373610022332512685662672947071726756151791966985572565143427965511257073988222706151587711707922926145814850587537844646412281461515307166194779513849936528281689522221763047607949743506742487857989673563402712460260035284340298722075617413469890846240032571221443912374997991636958525327747208883933428540123519800669703170185597472417427612584127771897699916422137284895495208176450975703263813324361\";s:1:\"g\";s:462:\"812472889838316626876044476525910659797355846637807902006476703903476420879104141089450116597850471591854168698938145448631879864081920890692042259147592692842192344636910396472895957516670523402513152790835262569312900065055814220909837365727450527054620162030353510549825571076047117901301818937913974245991960708251362745962177597540916436370662595856237213188011429189642229756130467882589450794829062521138060916740805890466164921142302272783761185243603093\";}i:21;a:2:{s:1:\"p\";s:463:\"1366833399447889457775990207973615802619259554875634153621347812296968814287533898166660206284964915570047939236738102337370803059310419972815705036689363773719211310818018266452632959459163662445386701608870658012250012908275516846937941749608216814626236706133229312021626209945109912604144285299956864973471892748876868743616995712656203256727782738514688441353283479027877383331448042965099734616412228147115211289999408629682850400139227689027478749749643129\";s:1:\"g\";s:462:\"907557415940991513285090149273768674738060366453456203997124609929673130784634611327985434585529146305092377176336004581435837526756015176571782139094736301097343760037832143538056782557460948471665233952196990668005720646728143894341643654773015046788101057446846122595778433416647442456793837598177060389929898700066416155469357326609097459960392457609590714208063472803992682255477495194457805322420281681213623504075777095465460597665129371748683785603721006\";}i:22;a:2:{s:1:\"p\";s:463:\"2235728210829391857071877580387511359891390738738547942772210596588328209288888619866661081922620605650811252760893976945841607232634557684199493942964002252162424504613619431329645308417700225310454244837374950644090517139907683618729560064949837356919805580405898545089057377346475412311999128342123657940599847558896191574146322896441284187120358475517988223178353246518708051100480174846708707357073697915628723229994725004763047252056120943361187825791150229\";s:1:\"g\";s:462:\"637312041409355177411974853221109947515744101798389146528774548932214498916777092630192887092630101160548857054003728871186609001785761461978704016797748424302136028903368917925007154954833444321746626415766303651171977419175936950344617277881927411604172961404838392604376361557623813071848677171881812344396160401179223323005436600038362498640753349274380695107444847658991166255571478370115034110598577092991547493707110073804159767315333427952395510117923986\";}i:23;a:2:{s:1:\"p\";s:463:\"1230402277951024128207424741876734394235328971165405947947309299701490787264435301233695030361940893216739801304221858099834185444907555321212424523500469201287869965553274789652940874658275644861206255728959954319026799091669216522927588979607033270355519456618530483628821237748037726704478448642599776349590126053959737752737091372398004324976961760898043643776494456825641032767428880516321734928192412624057914470785381494106990379306675385876696847389286223\";s:1:\"g\";s:462:\"338337574239177317877461820340406296118689570674139174934980557907797512993831045015071764512723465929820824827380230251055682801255297225194129788221954886452049216535615519736643436909474283900148561820437578555501524700402534304860476771494314549265082281559541403101063023463350081318114948129018156823637901049100325822416263781450628275355097055535634266452391214951018991141462795558102155975109587453970354234061405806819338677858746939660250096487381222\";}i:24;a:2:{s:1:\"p\";s:463:\"1911767397217174389580635454501278451662399330679149216825063753986107516887627348972329152716670344012835523361399914204681188251842967025811126913965113226481849273439748670394027983781685504896105459795325034776516327708392082217034648247322633497779699909897101710745541317469488983418685560845904692510588194960780198750170837577339091255717698429947336017783990981810701228856804637301843263146401004874083727217362581520156327048282377140355341630648456103\";s:1:\"g\";s:463:\"1268080483672427216958224975801292383587547866099684747810305400482861740550272965009363034958263517021319762496237599899200861869592948185998662594716738084240326115111554194231937679759491622552543609081009157285370194938894887072173502498902751488787514342330471293536467270061388282245612044342368852132279034623689831591544404552563026490733134267915461931000181987531966569228462873362813573826868674356654050782457393475684373296479964951832380516920006289\";}i:25;a:2:{s:1:\"p\";s:463:\"2384935185013046067220035179863998606999812912034904502807061575246271675961542850429667517360449796538685788629608299911037304799677705521562064126448310662928476680131793925576111182979091807631918029238440547258773202993568005355415069181820061179910375968834527608205575122828826565040222250604808188617658493902058160064391648525420926805258250520000765029746606323909864960353779235018441612552606347709443678131979120380997560640005810607751789857065091451\";s:1:\"g\";s:462:\"230062907685243780452883658835151462600168821285212753199061160240952213288476497310814110927786162764424336746127033997732663996065843294573577068538063140935014911132098778420167116292666336310665075633034800774149967367198046709558691946018417849690027139977567315959230391862191299426094157615629906301773814641864682077331169324528132423969523713789011223825672691018959906797878940942325987433373308932869795904147206530299908785287056288995547797933032443\";}i:26;a:2:{s:1:\"p\";s:463:\"1663344306655279209292925933415166673010218801912608607453659111186281765127963906747334142803861207045175907185341633566803131965665187241347507240355184503320145325035527549916946203208831099788683360925692343298292440438383759779170710699485403197390947453941054427159513193680633041344238030245452902236794214288355312770188493677390972819610775968168652115902497717012047496016490638636145149167033047041445335801731491846790475339025877805955311338540934627\";s:1:\"g\";s:463:\"1348517767365160364561068532904450579389328908173180354117747600022821268147921395670753439266957892637547548008485068735206283651393859868620973098249719756384276748664816488024695266868296400105329740343009341872599721665814103616635578948648432158793708382891711073045093444826262905305696088996707838189289814208503263563885857974203581050042104854142464557342916467428964426721186094462371984492943151324037650392852237078007527006264829593973374800503511630\";}i:27;a:2:{s:1:\"p\";s:463:\"1848896919173844897115484621965301937359468417329851937907613498405516616011344671755604661971819633223199683969701205993540557973998057014209439444926623445981416341404885878413044311920287373049322289489438247126578629730258903184306797687934935350338100288227740150503007566329840870600743965247269417726969943195718972903432914079036061575699149971862372213649397422747198211710272236417380710992790034751870619005138531869354200728018277815675987411571131107\";s:1:\"g\";s:462:\"429289696470275857775530951197073972688947870516364972269559535627701213069259530612419679756895227063669544280791154240670740796327818039237257228266226324946015459066054920164656517497021576366860242621801116329987278409508133315146909097111808932821633739861288491142391412283558567587612085914476484689127470974041956005153680024608674762079992623386827477985783098347117926214711810179658634316931882010723029050458260674735096275563410284828547714615788587\";}i:28;a:2:{s:1:\"p\";s:463:\"1890627014913175910326850340749681958428380980658681063341993939499758659173497200321459369998720011914355660203102403990377765814366385664710421582183545804000705271168997410589122642202301568560127610873466167697468942968722497122944122708091225065758185048845958631514107208078217188714984825957124996155345718832704656526384220047044919842429499771982984326066654442486078088122441757917824305647778599411466539066279681960968021776697929069992812086995172789\";s:1:\"g\";s:463:\"1034169370222927208782825986578728083410858536450578282698009964268185939867622641861765948506913540342157742240963716977855562177703039976409349173614991743536434594022269319553704422130919086785254310146515389889792593033954067278811337387826083570183292948307563695335501352996895214719576396591180371565611649224388919323192934331934511203267468141351305137769380687345028766066767615175846034605155402960198555165557055819821481579985055010194120972583631597\";}i:29;a:2:{s:1:\"p\";s:463:\"1353376715698694849416351054567317097442253008810215280534973591952340453592336519345747889023649593465096755863361196728613726954884457107103432300908272357398779044553771760203942803845422237037780075398705912790942805326030680104878331383092211642487952263739901176183050028520343734351006071449564249238382691445895174993577066686591254578612760844748234214169371540250401278015897965301864679606231139850512645245671839049032702402176156740309810593611782337\";s:1:\"g\";s:462:\"305210523129475840536236800901702737664215769845725796264865453089967287991947101293919245527199033267819594245571745616219504679083065675697898466435089350029442525196013314642200460699909921210419450041030462063057375054885732135352452147932369599618025917306836513163880414992131359626837644091776191785661118303776333488611066656526575787363225807387004783769682322145335656768853220570786204450747084576926149782903428402575178991488369822354375043423248544\";}}"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/dhparams/160.dhp",
    "content": "a:100:{i:0;a:2:{s:1:\"p\";s:49:\"1305369760393067573903784608000086685092429430939\";s:1:\"g\";s:48:\"474563639061072388724737904946142937816029120423\";}i:1;a:2:{s:1:\"p\";s:49:\"1144635340808941051501659871557102316521726101183\";s:1:\"g\";s:48:\"619759652154730913011023153136163766014870982079\";}i:2;a:2:{s:1:\"p\";s:48:\"988955281135516012494592134176727394285740835259\";s:1:\"g\";s:48:\"661721534235998300528018590812024177782995358121\";}i:3;a:2:{s:1:\"p\";s:48:\"831054466535764214539847067184849497020622445943\";s:1:\"g\";s:48:\"602568635360210647114201968475098190709943951119\";}i:4;a:2:{s:1:\"p\";s:49:\"1273451162499824010415840310357006535387759756083\";s:1:\"g\";s:48:\"388940627425287673610018679790118209342077054037\";}i:5;a:2:{s:1:\"p\";s:49:\"1194158228146097682568743682506593014684819848887\";s:1:\"g\";s:48:\"580787644966973602366617775052430689914269385029\";}i:6;a:2:{s:1:\"p\";s:49:\"1250825835634860199205277909400801107314922391847\";s:1:\"g\";s:48:\"581587982876966650518121867963233577479897748201\";}i:7;a:2:{s:1:\"p\";s:49:\"1133337270744463694484988529020735933451408606039\";s:1:\"g\";s:48:\"631442441351111432384530483916287036387111747321\";}i:8;a:2:{s:1:\"p\";s:48:\"804221707628161205330927629041516333589063181087\";s:1:\"g\";s:48:\"631006589253137060927543237371342862321104607941\";}i:9;a:2:{s:1:\"p\";s:49:\"1002191724199846857337324294157355803232206888867\";s:1:\"g\";s:48:\"483655550172758115887335144054596363427233334927\";}i:10;a:2:{s:1:\"p\";s:49:\"1394184516879107196137044604429830692800149361183\";s:1:\"g\";s:48:\"683437286820195951723981107586029551808106506279\";}i:11;a:2:{s:1:\"p\";s:48:\"961405043336466250012279555201953463057072208663\";s:1:\"g\";s:48:\"548079459627278793375356546007540397027073822501\";}i:12;a:2:{s:1:\"p\";s:49:\"1386832263378811893090905015568465530933732830547\";s:1:\"g\";s:48:\"604192202606404180885679845081675292033551734613\";}i:13;a:2:{s:1:\"p\";s:48:\"783786288502740985223534835310606558783982116919\";s:1:\"g\";s:48:\"500926370623902489501579323312356666918032852369\";}i:14;a:2:{s:1:\"p\";s:48:\"782621235048592548743271821187900290544473673119\";s:1:\"g\";s:48:\"596692264293782688278359189116397439489932369599\";}i:15;a:2:{s:1:\"p\";s:49:\"1367746360017583392658813834721766340000578997379\";s:1:\"g\";s:48:\"538797978419712469408715343382303371532760124217\";}i:16;a:2:{s:1:\"p\";s:49:\"1135354155681947332382326494639504774124357656419\";s:1:\"g\";s:48:\"602214275291935588667865684153452385069344891247\";}i:17;a:2:{s:1:\"p\";s:48:\"790833869591119782666903580768794672968217564203\";s:1:\"g\";s:48:\"584158672869014766593166474252578740731182247631\";}i:18;a:2:{s:1:\"p\";s:49:\"1097291211491744018366481025948305908720865493439\";s:1:\"g\";s:48:\"439509359160916576695841620747699133810064517915\";}i:19;a:2:{s:1:\"p\";s:48:\"918692550503510060358872429607147446953066891283\";s:1:\"g\";s:48:\"654945249942805992787768128395123781115962625817\";}i:20;a:2:{s:1:\"p\";s:49:\"1332092254872377835477605844037036203458943086819\";s:1:\"g\";s:48:\"423679953504051996511091129522726961838960898025\";}i:21;a:2:{s:1:\"p\";s:48:\"933877274777927890528040884397656631578329276887\";s:1:\"g\";s:48:\"608217136583914041823260551340788541238317810097\";}i:22;a:2:{s:1:\"p\";s:48:\"859725203063513692512603341846423987592762126743\";s:1:\"g\";s:48:\"440919501974522445512311709528159976986712491187\";}i:23;a:2:{s:1:\"p\";s:48:\"837664251768125986868150132183481466127924307047\";s:1:\"g\";s:48:\"555285975589793727593496223597124870607008893367\";}i:24;a:2:{s:1:\"p\";s:49:\"1327569384563655583886043185949541133884438458323\";s:1:\"g\";s:48:\"613130346337979086911714027415445562125235878865\";}i:25;a:2:{s:1:\"p\";s:49:\"1428411692032230775295758088618237721277667517983\";s:1:\"g\";s:48:\"535225122050760327826451080434600817792628009249\";}i:26;a:2:{s:1:\"p\";s:49:\"1223896787241177872573145930611964429377687205323\";s:1:\"g\";s:48:\"595494123131028191906314657449402679736765235803\";}i:27;a:2:{s:1:\"p\";s:49:\"1086048631695619847613317770068005258168656629899\";s:1:\"g\";s:48:\"572284264033707549413957863779727001669628388815\";}i:28;a:2:{s:1:\"p\";s:48:\"822022638232373521110350304334064578294406009867\";s:1:\"g\";s:48:\"657635385587761135663653068076150080262596376919\";}i:29;a:2:{s:1:\"p\";s:48:\"874932399873633702319139314690832967223336821143\";s:1:\"g\";s:48:\"599534542056608408276116956516745768064851371255\";}i:30;a:2:{s:1:\"p\";s:48:\"843427967333716318343697147670009659629329073039\";s:1:\"g\";s:48:\"535889566902096730048601747743521871868718255559\";}i:31;a:2:{s:1:\"p\";s:49:\"1024009511101153299776517092199472217626850026127\";s:1:\"g\";s:48:\"466596086730216509212034465709587270534916154537\";}i:32;a:2:{s:1:\"p\";s:49:\"1320980696430805902000359363849168914081628941619\";s:1:\"g\";s:48:\"610718039359114569724584449995403893298609474271\";}i:33;a:2:{s:1:\"p\";s:49:\"1092432640209269431497453399910526986961082646847\";s:1:\"g\";s:48:\"463049212539097020105319388432709824833485998251\";}i:34;a:2:{s:1:\"p\";s:49:\"1379609959417773161390936687752808731631732084783\";s:1:\"g\";s:48:\"523798400483215508398847538082598935117370208797\";}i:35;a:2:{s:1:\"p\";s:48:\"921078024075785201943929096178126751669361769839\";s:1:\"g\";s:48:\"490512063141551178776615087664624573070816149093\";}i:36;a:2:{s:1:\"p\";s:48:\"989183702275163955646438143208065558843002781563\";s:1:\"g\";s:48:\"634089170820543168467541507246098164427596903717\";}i:37;a:2:{s:1:\"p\";s:49:\"1275967997029234336396643206755914224132707033899\";s:1:\"g\";s:48:\"640788943520119214196146942744877589585775435683\";}i:38;a:2:{s:1:\"p\";s:48:\"931840992701647448146789164397900838241044885903\";s:1:\"g\";s:48:\"534315128594159356486413265871709172887173141369\";}i:39;a:2:{s:1:\"p\";s:48:\"942069618564062766077167557363733874684068976927\";s:1:\"g\";s:48:\"485898747279783894692037240129360297792095013363\";}i:40;a:2:{s:1:\"p\";s:49:\"1001789339197699052355670128971121065627297992007\";s:1:\"g\";s:48:\"595155718255698292695322354602201327756898470131\";}i:41;a:2:{s:1:\"p\";s:49:\"1375600571680089498740013276064864072342162854983\";s:1:\"g\";s:48:\"498415279224520972219426394139746930392949512579\";}i:42;a:2:{s:1:\"p\";s:49:\"1303779257813293468830624797057168306311850997203\";s:1:\"g\";s:48:\"403451059131446434613889922097963893429478142833\";}i:43;a:2:{s:1:\"p\";s:48:\"800005908639641965569689452284039674108265369227\";s:1:\"g\";s:48:\"402323816163796613170618111976343104099001279247\";}i:44;a:2:{s:1:\"p\";s:48:\"844583281698326903788926899664249893532888110447\";s:1:\"g\";s:48:\"517528430635008553688766531790077155586957536869\";}i:45;a:2:{s:1:\"p\";s:49:\"1094285529414095396966242208681559809227871496263\";s:1:\"g\";s:48:\"551358249287881329263799188692784095718943179907\";}i:46;a:2:{s:1:\"p\";s:48:\"983660711222388249045315062345897636170761443663\";s:1:\"g\";s:48:\"530552213889630252659015358537515844230369285207\";}i:47;a:2:{s:1:\"p\";s:49:\"1351013775227766136479340311908217998210575835363\";s:1:\"g\";s:48:\"610369552440185821513978440751416631043249970137\";}i:48;a:2:{s:1:\"p\";s:49:\"1354563829742534304843697230885200452462665538439\";s:1:\"g\";s:48:\"406800662086513110930754334679064364192661267367\";}i:49;a:2:{s:1:\"p\";s:49:\"1398563347597624601077663460163417305420541555143\";s:1:\"g\";s:48:\"619655395370666441364849115839740936961386486543\";}i:50;a:2:{s:1:\"p\";s:49:\"1387517700339083788987800628137655557973366876907\";s:1:\"g\";s:48:\"538444384733151203412364008770185341348899980491\";}i:51;a:2:{s:1:\"p\";s:48:\"846173836479196853651659824753744331267546831199\";s:1:\"g\";s:48:\"650935589280629646805939830602148789608779985997\";}i:52;a:2:{s:1:\"p\";s:48:\"798285016588165120883258650093433041877186987219\";s:1:\"g\";s:48:\"441529709876893173588604889016439199867969459331\";}i:53;a:2:{s:1:\"p\";s:48:\"809397346401439086740185140566814806808684379967\";s:1:\"g\";s:48:\"538236957911425614153489245348547397710621101513\";}i:54;a:2:{s:1:\"p\";s:48:\"809952999200455191901540837089805778142345835223\";s:1:\"g\";s:48:\"487385441754309571397412911571477016204651475301\";}i:55;a:2:{s:1:\"p\";s:49:\"1237709265001243211076717714981240635777036971019\";s:1:\"g\";s:48:\"618784272482379871992008983619376563093070592813\";}i:56;a:2:{s:1:\"p\";s:49:\"1025700231883796313398360726901170861727266024483\";s:1:\"g\";s:48:\"598151296213247324217168913027595200303295217225\";}i:57;a:2:{s:1:\"p\";s:48:\"793327128551442023767444463890995300870522218687\";s:1:\"g\";s:48:\"539794565569805340039859573323545355484274999091\";}i:58;a:2:{s:1:\"p\";s:49:\"1147402390250712399306262523075499402015636746759\";s:1:\"g\";s:48:\"626507572659492347430889119427988244627761972155\";}i:59;a:2:{s:1:\"p\";s:48:\"757314137648932572630417643460920752998094447203\";s:1:\"g\";s:48:\"529283349041682923530633778652165533595093720655\";}i:60;a:2:{s:1:\"p\";s:49:\"1361950860510200593841383238144379709182596697347\";s:1:\"g\";s:48:\"584714604603156245090438264122564252115723640809\";}i:61;a:2:{s:1:\"p\";s:48:\"776225946963506180259175310291119749813149477423\";s:1:\"g\";s:48:\"383570041528464505301304825748078346935105119677\";}i:62;a:2:{s:1:\"p\";s:49:\"1095615178700277152695831820099513466482620295507\";s:1:\"g\";s:48:\"539625950517641194035243952302416933336756627853\";}i:63;a:2:{s:1:\"p\";s:49:\"1347136297248479737442676121297888888430630212907\";s:1:\"g\";s:48:\"566059213942829857928591483029870033388619728299\";}i:64;a:2:{s:1:\"p\";s:49:\"1093293569259645131193126647642958931622598722387\";s:1:\"g\";s:48:\"594343997827841315653770570204548979906235062547\";}i:65;a:2:{s:1:\"p\";s:48:\"887602414535217945702184615603540100183295065747\";s:1:\"g\";s:48:\"662347294674167895627463959587876305268045160149\";}i:66;a:2:{s:1:\"p\";s:49:\"1010557038806704847526311588973776853554356024247\";s:1:\"g\";s:48:\"532893541909339954576938979713865521494468007783\";}i:67;a:2:{s:1:\"p\";s:48:\"829844939396446076032841069668619300178067878587\";s:1:\"g\";s:48:\"631998266108121979610799989316873576683309167661\";}i:68;a:2:{s:1:\"p\";s:49:\"1046494928460345758716197297416292696746658575579\";s:1:\"g\";s:48:\"615891927105300226068825732290141791815544028735\";}i:69;a:2:{s:1:\"p\";s:48:\"834135728048076165111266946917275399239031768439\";s:1:\"g\";s:48:\"389213395234196335590445606749808103986455524927\";}i:70;a:2:{s:1:\"p\";s:49:\"1154700011458848510187096294835728566622120955159\";s:1:\"g\";s:48:\"548503798393624074154942230942131583774664088813\";}i:71;a:2:{s:1:\"p\";s:48:\"978672053754186026248750553289218329620184542299\";s:1:\"g\";s:48:\"641055835629088201611166793394301543897343093531\";}i:72;a:2:{s:1:\"p\";s:49:\"1070102503643189144647061857723130426933962673999\";s:1:\"g\";s:48:\"711869563468284271638708344931033641934315745625\";}i:73;a:2:{s:1:\"p\";s:49:\"1323812811328381869130694828828061281852276002319\";s:1:\"g\";s:48:\"487053656886806410763695828754103165927486554599\";}i:74;a:2:{s:1:\"p\";s:49:\"1169329801421612423199318261807267948752947753967\";s:1:\"g\";s:48:\"408680246627811380564801297727106398902783872371\";}i:75;a:2:{s:1:\"p\";s:49:\"1384652955769809627275543328404332791741666272363\";s:1:\"g\";s:48:\"449672474457280124868466963066446412571192105159\";}i:76;a:2:{s:1:\"p\";s:49:\"1350000196205739429961458014370965793276931747667\";s:1:\"g\";s:48:\"505425622396261383117666278099826061597545042231\";}i:77;a:2:{s:1:\"p\";s:48:\"894705447065273442961638823541618192797889809703\";s:1:\"g\";s:48:\"510741338778056615339728592753920772472096642561\";}i:78;a:2:{s:1:\"p\";s:48:\"891337116692625714018605359651236312842104375007\";s:1:\"g\";s:48:\"413522626116106665014504432665726545091134259373\";}i:79;a:2:{s:1:\"p\";s:49:\"1297939713670228460811861978176871752377877828999\";s:1:\"g\";s:48:\"647298056544131270364838136232559701869206992523\";}i:80;a:2:{s:1:\"p\";s:48:\"976351259950759294642978741592083950506931483539\";s:1:\"g\";s:48:\"481165731343196004629915370853114428787031678927\";}i:81;a:2:{s:1:\"p\";s:48:\"980764218473209598929377503670805572400056847187\";s:1:\"g\";s:48:\"462874955150610793645950273938064092414395927293\";}i:82;a:2:{s:1:\"p\";s:49:\"1078402246449839832492595497686341465770525338447\";s:1:\"g\";s:48:\"510022575873437628725501442440267016121819348391\";}i:83;a:2:{s:1:\"p\";s:48:\"822926078477097486444962323277458446756022978259\";s:1:\"g\";s:48:\"589910875783545994219126942930975255660655801503\";}i:84;a:2:{s:1:\"p\";s:49:\"1431038025067691058996244066273531476107919268967\";s:1:\"g\";s:48:\"646932847368644396052277873258548552204273847065\";}i:85;a:2:{s:1:\"p\";s:48:\"748914983317514213116978697376736239495039622199\";s:1:\"g\";s:48:\"380231440226574322623857841433603704817502783043\";}i:86;a:2:{s:1:\"p\";s:48:\"746072024360294846456065926995318746311968317499\";s:1:\"g\";s:48:\"447450101636477251499694410520804920618515586095\";}i:87;a:2:{s:1:\"p\";s:49:\"1187131965479053580515236709652828301619620145103\";s:1:\"g\";s:48:\"497069754034640342738232452898528527704513730253\";}i:88;a:2:{s:1:\"p\";s:48:\"960772791831553183940713554045441733504839855479\";s:1:\"g\";s:48:\"467189892742053032374040989028169931254382194485\";}i:89;a:2:{s:1:\"p\";s:48:\"744720969935722391016885990661932354762971107847\";s:1:\"g\";s:48:\"672892260298249149453889871675067812728254959745\";}i:90;a:2:{s:1:\"p\";s:49:\"1284138085754206095984621825714666759051533360447\";s:1:\"g\";s:48:\"670680653213753375576284488437938207972423819365\";}i:91;a:2:{s:1:\"p\";s:49:\"1219703410168163907606714523859829978847615579703\";s:1:\"g\";s:48:\"677566000162233783460796007673293061475277168933\";}i:92;a:2:{s:1:\"p\";s:48:\"758709279959164862900864570318174449302613241339\";s:1:\"g\";s:48:\"452090953215317329319057610469368245672033968833\";}i:93;a:2:{s:1:\"p\";s:49:\"1071627691050988181827045931713008063023490617507\";s:1:\"g\";s:48:\"395161002059489287272140658032643593929127864197\";}i:94;a:2:{s:1:\"p\";s:48:\"747205427461860752092585693183163490214259858423\";s:1:\"g\";s:48:\"417612284638201080293586217380241875657446616109\";}i:95;a:2:{s:1:\"p\";s:49:\"1006525224732904380987702972930703364127273860867\";s:1:\"g\";s:48:\"577545982783186527062549787160719734065840781741\";}i:96;a:2:{s:1:\"p\";s:48:\"913028069291155898874907016169442803156338579159\";s:1:\"g\";s:48:\"382328749628965365180053208087496476372826871403\";}i:97;a:2:{s:1:\"p\";s:49:\"1180257192448033707067808765981766151872541980359\";s:1:\"g\";s:48:\"614672147155176708479881170756885404265660714751\";}i:98;a:2:{s:1:\"p\";s:49:\"1131049454834123578538951980844254468954332837143\";s:1:\"g\";s:48:\"516237691590580412638232604519378047537778117673\";}i:99;a:2:{s:1:\"p\";s:49:\"1237424753161543304728304439687733366979209986923\";s:1:\"g\";s:48:\"443245341306104571668320672937798146976581923033\";}}"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/dhparams/192.dhp",
    "content": "a:80:{i:0;a:2:{s:1:\"p\";s:58:\"5079153797574224533127650903566678124394292110246160120503\";s:1:\"g\";s:58:\"1775655624786036047244981958605679297671494641475669966087\";}i:1;a:2:{s:1:\"p\";s:58:\"5280951490903349944274113198979805160361532116756714331587\";s:1:\"g\";s:58:\"2750563206691870569645796674371212328334419605349825272301\";}i:2;a:2:{s:1:\"p\";s:58:\"4908566683395613935027848474793864939536478635831425790279\";s:1:\"g\";s:58:\"2217539231350728286886430339426948674052631001859542132203\";}i:3;a:2:{s:1:\"p\";s:58:\"5703624436271395096304848287817139341138468504063713187679\";s:1:\"g\";s:58:\"3022750833775105018689926348454114058182309558353388910967\";}i:4;a:2:{s:1:\"p\";s:58:\"3408373670273337858591681243643970689646571912179487614519\";s:1:\"g\";s:58:\"1758856341362672700409627738845335577349659073518321527443\";}i:5;a:2:{s:1:\"p\";s:58:\"4287320311873603445306168782852197886252881409583514378587\";s:1:\"g\";s:58:\"2443195977736559684026176246109530132630326857948446510283\";}i:6;a:2:{s:1:\"p\";s:58:\"4761797641028563107617146852177956262274271252575050657847\";s:1:\"g\";s:58:\"1967905564901738530971339075129813513598845172896595290077\";}i:7;a:2:{s:1:\"p\";s:58:\"3404255621100712761608995448456580112050385881116515218743\";s:1:\"g\";s:58:\"3120045944636737237456921814814946983811560917318686693791\";}i:8;a:2:{s:1:\"p\";s:58:\"3518512132339784039367856376100548636855822828484663862139\";s:1:\"g\";s:58:\"2936406192235066242230149165110575455148803961090995968809\";}i:9;a:2:{s:1:\"p\";s:58:\"4520842854376900535800877686817612397649559103675227962403\";s:1:\"g\";s:58:\"1874657377100137046702279108249554882052905843093324820341\";}i:10;a:2:{s:1:\"p\";s:58:\"6203733978483113711573047161762684887620736693334966038399\";s:1:\"g\";s:58:\"2281917699991259331857077643208127496786819947163020051699\";}i:11;a:2:{s:1:\"p\";s:58:\"5214094012046521402304871473025167219554075012879966514639\";s:1:\"g\";s:58:\"3088934086307430848999804849857781760708880102815101369475\";}i:12;a:2:{s:1:\"p\";s:58:\"5265787227241273761511382896841225398989161548919690936399\";s:1:\"g\";s:58:\"1712679489582782094723102988233060994358404878702641326991\";}i:13;a:2:{s:1:\"p\";s:58:\"5067782971873137269486362087896632172119409421624139384687\";s:1:\"g\";s:58:\"1957215522412301847352896019837878268005516128183054332167\";}i:14;a:2:{s:1:\"p\";s:58:\"3879943934531405521219894064328899150202248043781792741163\";s:1:\"g\";s:58:\"2689322241684381372458698909603283328674743428685220509813\";}i:15;a:2:{s:1:\"p\";s:58:\"4120056568851266360689374732995900645396167325280679087463\";s:1:\"g\";s:58:\"2739056964678871613984984850786368930553006484449754894415\";}i:16;a:2:{s:1:\"p\";s:58:\"5290823285697561402595250303494270872946043138293779317867\";s:1:\"g\";s:58:\"2999800290205863127707463942846916629036584233489088821049\";}i:17;a:2:{s:1:\"p\";s:58:\"4696296982773151008599445288256643884813021679236448495543\";s:1:\"g\";s:58:\"2408594073193339386366580971829213213076930843022656561407\";}i:18;a:2:{s:1:\"p\";s:58:\"3998268366250968840287647928335220016278201614040738565227\";s:1:\"g\";s:58:\"2595910859797751097123521430486225763957170171506802652187\";}i:19;a:2:{s:1:\"p\";s:58:\"5105069304661883494321382458240500613472126523513595557707\";s:1:\"g\";s:58:\"2825214821736761039502493498877270698148881800422346821893\";}i:20;a:2:{s:1:\"p\";s:58:\"5939529852124350341005590253411362002186693503432217871263\";s:1:\"g\";s:58:\"3137030337042042092888657799036721412663511814250070150533\";}i:21;a:2:{s:1:\"p\";s:58:\"3735981060035319331704321434148243550135576868950902098459\";s:1:\"g\";s:58:\"2989931789688807377997994070703231972926299933593627385837\";}i:22;a:2:{s:1:\"p\";s:58:\"5230792378968521455498964433594802701706868629126441715183\";s:1:\"g\";s:58:\"2992268420669971207665248346210532238175082330707685959423\";}i:23;a:2:{s:1:\"p\";s:58:\"5749526646585270332971754516348605824542707999962994742387\";s:1:\"g\";s:58:\"2573170301376768608263799013605480737285869306043252438563\";}i:24;a:2:{s:1:\"p\";s:58:\"3699527020894248790756291220971126715267429809359417078203\";s:1:\"g\";s:58:\"2021241263496862637571247756030282715635367895206297981837\";}i:25;a:2:{s:1:\"p\";s:58:\"5427626576291640178697581041470814432676853894644639708223\";s:1:\"g\";s:58:\"1848499510997690637725982471703590963955757498487817240199\";}i:26;a:2:{s:1:\"p\";s:58:\"5452425390533601550543539501601743784582084084867811688443\";s:1:\"g\";s:58:\"2199548899998832053779931991591849993353619475860404941523\";}i:27;a:2:{s:1:\"p\";s:58:\"5878470339621492376906133148257205717408902857792669244327\";s:1:\"g\";s:58:\"2910743244761101832680480464052389046853832954372521194003\";}i:28;a:2:{s:1:\"p\";s:58:\"3587801443783379284860115673588846335881679053068010151367\";s:1:\"g\";s:58:\"2315160945585969381035789749922662556153810767582805204681\";}i:29;a:2:{s:1:\"p\";s:58:\"5653795417450857251329458236472236527706349566486470589027\";s:1:\"g\";s:58:\"2802943059453712266640356788067020589920472674707906596571\";}i:30;a:2:{s:1:\"p\";s:58:\"3457732635912905545926589910894036857464442278032296155323\";s:1:\"g\";s:58:\"1903129017479274520911249166986172071538526145448641719123\";}i:31;a:2:{s:1:\"p\";s:58:\"3273859658245405519746765698873884234918875187826838068579\";s:1:\"g\";s:58:\"2929782824160658072753520803173577956848457241680756520565\";}i:32;a:2:{s:1:\"p\";s:58:\"4761700036076133445360827240122621071147714758522838080359\";s:1:\"g\";s:58:\"3119507520206605362692770863344057997665729918422544613457\";}i:33;a:2:{s:1:\"p\";s:58:\"4405233922665692538904792642661732972090380014017234871299\";s:1:\"g\";s:58:\"2156108555163829703349347996634361253078629587693591085311\";}i:34;a:2:{s:1:\"p\";s:58:\"5434930531607967663872622555642175923042733006024997147363\";s:1:\"g\";s:58:\"2390628958788389539882354377548156413067155083898369544581\";}i:35;a:2:{s:1:\"p\";s:58:\"4344406185108632577312980841629309659365783238791736671263\";s:1:\"g\";s:58:\"2647210942852956042972151850238629788613813461130912113809\";}i:36;a:2:{s:1:\"p\";s:58:\"5278098580436144905030665703594552427147893589111423504363\";s:1:\"g\";s:58:\"2814874609333584535379357984744374068073324062962155810123\";}i:37;a:2:{s:1:\"p\";s:58:\"5508427450523598806685760544636322560098559536697021132747\";s:1:\"g\";s:58:\"2761184507918258267367204938499934170019870825853641891507\";}i:38;a:2:{s:1:\"p\";s:58:\"3197969999493675106847802004872388076312076345632578632803\";s:1:\"g\";s:58:\"2764533290029322821411173465515504778592964392854621620083\";}i:39;a:2:{s:1:\"p\";s:58:\"3568017303357088501066971162950692936521340156006663981979\";s:1:\"g\";s:58:\"2462095370676111544085426676206766871866947565184370207309\";}i:40;a:2:{s:1:\"p\";s:58:\"5008365436214491146872187578253187471375499980831929272867\";s:1:\"g\";s:58:\"2004937842465852411676297045663569672559418220307277093907\";}i:41;a:2:{s:1:\"p\";s:58:\"3660373588674338114259459300737035072550434338346265097359\";s:1:\"g\";s:58:\"2991636412905001507296739812030759919233136578804181824709\";}i:42;a:2:{s:1:\"p\";s:58:\"6157975818295494991242524096807318074150442170944799777487\";s:1:\"g\";s:58:\"1912881834041571656233505839143523520426242139511439944719\";}i:43;a:2:{s:1:\"p\";s:58:\"5337235345895474227895552498603823319310250209297678658503\";s:1:\"g\";s:58:\"2004866565219588730716376725495942807885729550763014887077\";}i:44;a:2:{s:1:\"p\";s:58:\"4371864179460543040008442352670502630060546908322397366867\";s:1:\"g\";s:58:\"1935388976841885638579286522024434829194894520675959876927\";}i:45;a:2:{s:1:\"p\";s:58:\"3414083549094939748645823179851604517084752156079674932167\";s:1:\"g\";s:58:\"1816546965247162148701261384470515149792513541950434437581\";}i:46;a:2:{s:1:\"p\";s:58:\"5536741182273059380739258337848493476934305752266586238483\";s:1:\"g\";s:58:\"2634952255041246307511360974017554325693333324673254108479\";}i:47;a:2:{s:1:\"p\";s:58:\"5775171283053461281137695211327289107677094643699899519647\";s:1:\"g\";s:58:\"3031757045742291978953154643467910261283123063435248617143\";}i:48;a:2:{s:1:\"p\";s:58:\"3660370278097827798512899847051044607487572010565769322563\";s:1:\"g\";s:58:\"1871171166775120299644215319226940768117395474691743314505\";}i:49;a:2:{s:1:\"p\";s:58:\"5912814201192481980980973291370859137726857826993424267459\";s:1:\"g\";s:58:\"1957331954178238262489699534050120077442696109610799864601\";}i:50;a:2:{s:1:\"p\";s:58:\"5184758634017280989737969096729809423029735654784172479563\";s:1:\"g\";s:58:\"2747826512297974451893717897444511651643434922118473813467\";}i:51;a:2:{s:1:\"p\";s:58:\"5016554360555320960358874145319693037228385506831515688167\";s:1:\"g\";s:58:\"1784356253939847363273820130798312708011366157682845326497\";}i:52;a:2:{s:1:\"p\";s:58:\"4824111221728894496275833910627403059802694666016696093139\";s:1:\"g\";s:58:\"2662092108701388387028814515342811320842361286171226121265\";}i:53;a:2:{s:1:\"p\";s:58:\"3542653376711233154532437989275009789150906759425833977107\";s:1:\"g\";s:58:\"2993413985944641497043043994022562701684915788578786069553\";}i:54;a:2:{s:1:\"p\";s:58:\"4187665199221743303574139512590690486755802614141320341839\";s:1:\"g\";s:58:\"2510543985310768653707854276415093099545041552566817022349\";}i:55;a:2:{s:1:\"p\";s:58:\"4346276948576799819411680068399983993443471275733281789763\";s:1:\"g\";s:58:\"2442402785838021648812881999905665222333408565418673938453\";}i:56;a:2:{s:1:\"p\";s:58:\"5941963164742000720764400502847295414251200623156896167063\";s:1:\"g\";s:58:\"3109075742957968243564487898153518334570588261995161851867\";}i:57;a:2:{s:1:\"p\";s:58:\"4968360668694082055763517916799832503511627402142244841019\";s:1:\"g\";s:58:\"1631103685513385955188695844999787805548545198875281032329\";}i:58;a:2:{s:1:\"p\";s:58:\"5352110123307966463863605353613413090377648808052386739639\";s:1:\"g\";s:58:\"2750049649165087696925391766691408509531457761506337220083\";}i:59;a:2:{s:1:\"p\";s:58:\"3492541419748637892497432009505335534778776020683091511999\";s:1:\"g\";s:58:\"3049208593127223291568667028585263138784341270026974399485\";}i:60;a:2:{s:1:\"p\";s:58:\"4861492597654350078184874961008205492784601986955728398347\";s:1:\"g\";s:58:\"1749429043719289142747830392455920053316428401625067853441\";}i:61;a:2:{s:1:\"p\";s:58:\"3409541503404917386768832654354691273018080275627195068863\";s:1:\"g\";s:58:\"2845917921644585587482900072159268135689400842569349846455\";}i:62;a:2:{s:1:\"p\";s:58:\"5001587109106537100754211008462547142888306106754962133079\";s:1:\"g\";s:58:\"1736190567706663129392257076867802867666208577891613530111\";}i:63;a:2:{s:1:\"p\";s:58:\"4671631568303408929313557979933219261990730864997882387607\";s:1:\"g\";s:58:\"1583827872809517491425531274727857065425946452716427187595\";}i:64;a:2:{s:1:\"p\";s:58:\"6146891969648692994042239520945566269789751886818035128903\";s:1:\"g\";s:58:\"2727147900282056053406651420169531118678689909616560664319\";}i:65;a:2:{s:1:\"p\";s:58:\"4691567770908195706485352720805469781946194453032677202383\";s:1:\"g\";s:58:\"2236768896068337176672581634512929610734819856751870275011\";}i:66;a:2:{s:1:\"p\";s:58:\"3872368398279580027726321029226746610541428160314301688863\";s:1:\"g\";s:58:\"1608040030265058297534235316667763045728366641295263678285\";}i:67;a:2:{s:1:\"p\";s:58:\"3203632401065450194024989211370201773029103146907460791907\";s:1:\"g\";s:58:\"3108490534046256038320616158880085899798273995837799898229\";}i:68;a:2:{s:1:\"p\";s:58:\"6073671011810509460429303954978560171127887337149697533643\";s:1:\"g\";s:58:\"2957181103947316246707372225424441718695563269317354251891\";}i:69;a:2:{s:1:\"p\";s:58:\"5074938515907596155271435330326725395033521551806939456543\";s:1:\"g\";s:58:\"2485585061148875179271778918652789326197814093765863878501\";}i:70;a:2:{s:1:\"p\";s:58:\"3597117650406458524784844736459676469944049182578914376967\";s:1:\"g\";s:58:\"2257773347341600753179198090802149292787501545042330325401\";}i:71;a:2:{s:1:\"p\";s:58:\"3692791074237392866630655248999144283662143204054214329563\";s:1:\"g\";s:58:\"2534194325117231881996721493067203343094197216768153045559\";}i:72;a:2:{s:1:\"p\";s:58:\"6135290864129465394143806935986184464296313272645041006623\";s:1:\"g\";s:58:\"2285613745291849023050799771859696833587607166899781802297\";}i:73;a:2:{s:1:\"p\";s:58:\"5106945177113923512700853358787168136230226375108347673543\";s:1:\"g\";s:58:\"2936475085379719192967479751088291541575787778419060330529\";}i:74;a:2:{s:1:\"p\";s:58:\"5181718537893973578476916094185424173615729216146516666819\";s:1:\"g\";s:58:\"1865764650967895204996751102080042379553463091437317170481\";}i:75;a:2:{s:1:\"p\";s:58:\"3531421829504016980971043040659044882221181410827188828199\";s:1:\"g\";s:58:\"1754788776989782747965652935525104074154211520611110481407\";}i:76;a:2:{s:1:\"p\";s:58:\"4161793909460184982769028720635087392704116618587096387343\";s:1:\"g\";s:58:\"1981894828271550034470871640268847167031481222081314887149\";}i:77;a:2:{s:1:\"p\";s:58:\"4649508772336796680142675195864617980598769529445092576119\";s:1:\"g\";s:58:\"2060260193469253389049874052470270879843305419455903720777\";}i:78;a:2:{s:1:\"p\";s:58:\"3794461735620721528002956624730277693135123278831773787983\";s:1:\"g\";s:58:\"2189746373719240792072113566225714440698072247775237220387\";}i:79;a:2:{s:1:\"p\";s:58:\"4259297905676945125094110840005802642699827572246773326227\";s:1:\"g\";s:58:\"2109550980417331068335665282608229962431326830969146948525\";}}"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/dhparams/2048.dhp",
    "content": "a:20:{i:0;a:2:{s:1:\"p\";s:617:\"26119538730417652824386042875531065645936518917298962859898441526145920544648057315613454013347891735147825801670444929736964945371870320839420114081211312040311426747341924926796064326790154135416828824406498127049192207991150849791263466384758021041373648403002021019670485486194422368037809226590462008768240610399792452398657398016040828114270291337378645720426235644484515722968943627611602608942224415247853186618238500673174946668053663930012369427127054431907175454668091517702372418355188739885994249239971879046563843965996805199808782303607940929503059770051997236902131942802683449268228989972965647643569\";s:1:\"g\";s:617:\"21692939338493471757047070972142857798654655518644033814839259110511954364805167016395345229599656727059168581562814761049085679655778308409884937999942260287379782711541364254190475889453590033170167544793765866452374932516116637879718064465014425017927830556064617293664040306920668006143308702764719183733796439597113613238493154190242995109778425085299465944352613372309093551104453581823748016505746665915971846990430996971870763550674830590105744057158734865757657025005213833571438489370197722184401250800148831017627655890275298519934855829463439326391192412757063584883487921219859606832338748797027614904402\";}i:1;a:2:{s:1:\"p\";s:617:\"17494852415029253500263451635519645209848793831494844994025633838817687049071127640459187917644787835777597552920325283395311336348831223620733928313170193589173111165038138057869913225151019592978760413756939078573486040073633063605591180413506497786330721001074819795357862986504220202400959786152850399991084732854557124231380109637676272229893604175498706260833666050908881082936323794606250012464077347589487455541114492420426914154675480402370321252743256114353020297093701386337644658626048585971064205107100595069003802366933563435053584207760412338330625134515253507734839954484610005303585268020855550319783\";s:1:\"g\";s:616:\"2357536766000763120599640303735871022142042544950223627657783713207355119762671384828323528942597724321262315162871435756768680295649894617172738865491552395499945910352628711737711459272586894150019111123607450240818973582127295016918052347511023159480848100006890622723727515688121279961377206539154059916280008591560324035228208297543602421189229162987642842188359302005359697956742412268879330969306518512079332500066243775980282601895703673233538458812861112392269922097185505956010310178122235450911471276428561302761444822273287825322542011844279562807283571980685665180825337747868563602172878452348907437991\";}i:2;a:2:{s:1:\"p\";s:617:\"25780867781251628440065459712673652906933462699778652742815597485375302663371634433740749781750744136364458591061494303870283828393634179033789064740550017980781317260925771538480299931323791768420861462236431178976601993346954114130438797677012654484168409283271118338570398965911311009082335022460593522080995913669261644367315202030128086666255165421549254127930200196693366384905335244383579750798169063385118039839822333156433252043549232431896238765093602816646193711914401964588912145258045516400610180499330382140474862865622175503314183207026529522245115643165204301739301808240344047865206921844783110493619\";s:1:\"g\";s:617:\"22913453542498739351587679639664856992870400001370134675523784914387955771143444917571437755672602988500046796113264805842672819918732572442945319891001413155624746874608973595637299150443023015326933062381925416214430378088998324213270254493852316912687655115745315976037232162037286469731505569162296708698849815888917345038284831130181824975228023218421467353208181389358811631765874415954696258724127120397639098550964799825663331326239274792397246407429506415811807258362151079599569033578071919173833344990717848768176043897116549506982186347999780034352488975732137271158144830900377154823625267922843930480163\";}i:3;a:2:{s:1:\"p\";s:617:\"17108582037564624674917207799802832391965005846368564001912347974821312076704202022935078231527320828683510069559020007567337030036847653897258184670166659043776952835342581597567057883537012431671450166955634401920313853950838958877425157189757276240508367052156667477216311297002905488180123637261690402759380674542437629380601702878071821789801803270225500263470954518609603257770968427427507711325567168791246523926693942270053153316006073740979789299514536832553631600448872021864884160673857409747182631139916196743438986143545276713429020032900149638305213353651861654548990616900439392404675443312771396640963\";s:1:\"g\";s:616:\"5975220509433032675041067739982972692919188487073925726726373313534662751942478165577276960038244273703352381665589951065977292053614500099134443316919840135540845038879240858995341120504930299860699717125398702129847883991122790294702383642451156914176785997702247519476072621264654943534650803561957687965391725682747412106679696055298814300614513661600544039166554398548785771944233727265781414899110258870106277094923042460709047677122331805345608634843554102871371939362771130643332944065664751524937870301121933464463246140428792009737393899405409293013771077653754980109244592589837015805450647805669046754032\";}i:4;a:2:{s:1:\"p\";s:617:\"30717950753282822134060274292481360551691413121828212175823741839241549781801345288079837278336315658072275041792278917609278903215044319053321254942912283926424925303165388602101369690100151597114979236011549040048767798924665432539893102285148132138243288344387551553735318445920954909506524809009977259661816549852869076545111065438920376549122286806153480198930510896590461984138938291299620745126683744010164416765756555097048566964051391776874919866198779721078725961148626312942109765123843522548437856492683402243565586864304705385604772276167357697786949526357219442530907854345605378292997710443788101928509\";s:1:\"g\";s:617:\"10664565789660490202298837070717675886736269910227069585599819283749390051779567448569637299937235265670862351367215197727816605187136471289814225238589787798288892630743957045107552613020882669254784592049108026598927346597271935204885557927508364640631111649815601503280096710752780360644355184069964880671356047707747432831698299934227246554005301084080880453975468135327329091037112567370668621377232969391777852701506421877424723612998254707022420880929038255877994522028632025963236345524733702080124131982159125526983451439267827560813655547710499889559501382446978742844869796195915570043693514343922418952540\";}i:5;a:2:{s:1:\"p\";s:617:\"17824540401688806758789771896071225083587012319363998191617936849653181551389106695047499662667967291625581739247113239792813655844528068687604946381553759091614945221410205365009632299490330030743034592873488196530343761271503174068102203374839746210075299309889318599726887738428054051601011972157572579321140979949387997453722974702415785332940537370596257985385177683159554405404123424672225807041157719414211000240941151112149989476447852776665859451162933640847402800234226474660637032612891723759060756931730283712399193482935639272951418485408140391847864492821971660080653487293932836946944136521465404250497\";s:1:\"g\";s:617:\"16270475540244008116184585752778689991248014144157341857630851928118586042015777493384925564647551896410840985215558245916363762734559266526213847217597869257247057011178185341066439942025102868024300290055851586251224372269673506910096840729969115630538026953603715119989120184962065253802795940639181332522689973724641004788079105051116542692460473554873410716389242666154728393218313118118406398989884581832628532396195574914320097464158289655615576483587557151914583877087002898507007877917751525353738520926876932264221223270925546352675517006263788102948929514039399067600275172739530270181974973828950452821163\";}i:6;a:2:{s:1:\"p\";s:617:\"26296541223964919760168059530334570885931534159346927274646606919982025952484337186039418912581476534463653561216509719479381053176684855749980449821690634103712306845089639450245895681254698231346381048999674311066168967221836809132774033058479473511929613700963171492882041969658471628084862296614689763559416767420597105445926395306014712602368798792070456787547357402852952716350973192781222867061265663188204551121616232196786533549406074301166048247937522415623504126765142089891926736558098921482439332224715081568035947703433373054349275731306378072487032600877157066181584066648043385348780258366341381039503\";s:1:\"g\";s:617:\"20245064513421081672907499417270373165374993596361839579769428949180631359713525104278983408046767381549351368804724075603972313718652589273580418726681940935429978945328837517669894683202567520983954981482700658614407104539781496091529019707970808126673481202951901341090515405122549648668564031419070573673075692741103463991210517062086632857878380093746773630605663125442075610285516428487568040493243899961471715606477290256637803334729918901038097438118954412644360440903940454111104955970051371388583374743634476943068102699066226605163496367446957915588429891698437584852521630657930214723677944070438116045469\";}i:7;a:2:{s:1:\"p\";s:617:\"24022994888213612729867097153159489863796760878636990746219660205649898621390642573759009418891804310813653013832818801183450912563726218725349021897580704338568278000019615459132633821605975626413805907014019193876676494728190737866777588109580505401823207283091078285105989405265851649576741649994378038616418347053183638209158265693304947428873206654237011507823308167792632150344918598864834554245939189283437720190979383402835863441249830065088109408522132789686163566158101743287893869880671902412445418124423229540545176428391408627743403931489063787699934557486715229490493258244148224520887812506822249429539\";s:1:\"g\";s:617:\"15678480265412800733944492186437037182707529884326735097121447410399826968420553856830859651354914793482794886843456562720138670995286947463967042610750193460296792282058991180863764589693616599436896718205171675944873415284970267586420972091500234700259041314722311096697012899487002459357488089950393843625900001981078241171710748533509781217310128183350756575104004773859267324503648554413357662859641282012089994022788874891032192582004035250870868552993001550637269383026801304603350993608652909153403397051874534815752300653963021337866508400173775688584459109409363861081393338196432750140305711090376705911521\";}i:8;a:2:{s:1:\"p\";s:617:\"17083955432364090280533366102746720945982105621761336600070465958323396972881469403519543155239819620859194370028989288057523170198820482837073270689355245228512567098603210383977491443914341618615645725451024486051612004217893492714245981039604396229635631751833639174614993002993629374228068268504356303017948571496867771413891972482336248648581356279979915549622011422496674683139397429048285638804862404243827650990125026074135379573526469868687788484267220583145333135102887002688284926311346027425969194262182288607685222886823791242675124535943766023129987374186943906004265733055482162823032404897008638709489\";s:1:\"g\";s:617:\"12261234691674641709407438861728481101674950650359345083238884715719434368649199286826020022876464290948119474546308321123254175100004821757208768631686271471283892085404640045175987297679723014286459620532482282374024512847784380353023734692492663279003858305861949005817377728600448722524457618798241008130944601573891808345338306588166841117840949087313506761214152652649864023892781683429143355875872143036089635390231181686164167199603978001780011953093051148910850001653642083816866537367199013814853150666286608827942041850714980974747352884836972297673635076130465096348662086839526317882823690060833316121518\";}i:9;a:2:{s:1:\"p\";s:617:\"25204476138284467855670453742205091544206927935811391970379875845925341542816814592972482175517776292877803060312282683057673887280171863404039620181938052133263739488514572047094655954023089583401121552716825102824245089603523869015914976008594784258015509292801626580908040067127059423251656372753685608747171457530204828520955350885774522412118938249637383726640228002691450698618877022629430660597324647064876949362319041249591609232234716766223276932543328705703598431803088575036192723955330976791603168213443104658956110289005145211221506492748124722595764125541652261925897188877632144503729500847899162487293\";s:1:\"g\";s:617:\"24470380828092171830607640675307269842934271351057990119472060393765189808175375460336691328427923943061209748614966054260866042030491028094628330791617270491451679586070624647214669151124663462616816618278458332102224612471875661847572035426271967106152871750183790750472633379980457073939646744071844097027505130835932272606999975749253911402372736522468536931939555983440411944997387444842287619087631352802755805134214227572364500740868338334180446779244274684101127564951437506337872796885243225511197939032115243566176064416399644452111639287953151152283661969561179612761064215331184337200817410228013012815215\";}i:10;a:2:{s:1:\"p\";s:617:\"22849460047804632398448747334192571885220871329972534210954947581951666060547985334167486681856357757460114635134954573658082358845539735278580423082123931373208796139732802045985276620997127798853678505071244613000934377737859392412691661273736740375485316991267484188256664287312744138816442964815805473226385201474782318459805435125108038706696302574616946459702959134346029698514766348904241077025385404804431202010332555268586051143130818532183288892073337677669462830398135627462917042631034659974404647502885769859349150518263217937151139653745940505432896722087326115128679012867920678944411418261860631429193\";s:1:\"g\";s:617:\"13348138446721657089630012558844652910382267316024344211317185221773269246392374758072029526288163619976687471148401063666650529131734387772547277912767019892091405085546024081290166317121965135731523404800558013020137490216776128824652409837770063691312561489888304473140055749560988718836503040853002145255793919808930722368419221663001775239907136704227153865398879262468691524381141127515887196789195504406217373337864420211704031143442387747687436399787007564064433407818094211670914708907567291746261122103561160648080311292253951964886079196911189940359203107056306519670126645661147468673028841078212599422387\";}i:11;a:2:{s:1:\"p\";s:617:\"31338823808328910030039189736747412767934749985120979774750656232315188517412996431869533670874523236506095344486318916128738510547271487301629733012645126112498494837873510962613906720395105423345696133501168531267479752944739576745897553250620501347859376611724762320770615408466753235707776687064856460812255814585002695810118730421429331410377462334339309659699186654268542620852088199397227812555782980142369915873664366261623799237710733709363641919324417365535560523680225962259801453373866070142295896144627383558885424151975989188203272862741597698359922271892774527924814448590085332431320643929061731101951\";s:1:\"g\";s:616:\"9244265426989189771814939991669243957748740903183842164268478744253017075992473802044696109071297007354420472625602806611080450814213109420239453967309288617745014104035838027804629485250918376876630332625045211500185584005538683904806015146917080419014138452138676952964670289110065893199216408172970617769948958057624438113114785977222898946940751719007529545723841152648078690343209939496342721851948377226748909719230993095239015507357234175387231426890464735514048452739457488549618437769362624641802065425556060699697034837970299896246378714455325609840424540997999174950970499493632310488630948722459761331238\";}i:12;a:2:{s:1:\"p\";s:617:\"16720011003255706113542533606567817550154977290327341685222505526573898977078683119417076323927302182238875008774846510300284799199809076765861588224343304072595369156757416312139864889452521559749463663197267698729151348390397049479376093343572901918439800962638271229803825595288317054627390900627955191106470683028331619882250925001777457287598880159325943026403028710302505474738862997006103128487776056340534495054468394659034381740575225073994349667872488974021301049946013876074350344727733532691108462203697035662350166633970402791313885464164756357492157962521289407696476321940071562093155602895661489660727\";s:1:\"g\";s:616:\"8392549857641312164454309373940435723590421663279978069555127083582677257780262498752161403608771364645564865559596200803263820963402481442852937071497875582873453734524770401215851485463814913260581874888729922114937703348851445066316990994716597429391207315680448738459977536648358752488744579272567717490797318379401666836389388815269231571648020465125802739997512741984174379317449696467694331951860453172686792834397700517360054637428943005447586488819050418799440935988665824222808271742893820938468194415642476156380577849705310979308145356389925732064483915429084436934935530619828894853018765861416844776438\";}i:13;a:2:{s:1:\"p\";s:617:\"18875760971083209961885190059598721536385876257385725374837530129382586086243382935243973016095834416470415049985931441352969506342859331487451321440644185970762508184028359569305280339801922408612236736096586209436455066098437157049757171836542290377568267264629176969075668301397417797762391880806604540802358357273422189043950195254062471915353959389101213594915524766080852049810468225847178041179462795804709284087874701166025765058651052595190693164918437491064045608634977527209186371829864710057268355405434016180724414588828894423442390301185665478042155226826512674948772583334977420644109748745496717956161\";s:1:\"g\";s:616:\"7831956897688961168585556861828822320686818447121831468325331650719661818670456229905256692890429862578945073402841774396892137360518705835947989741723445501270103038310934960720438693310516616091846310929399159391021583737179951182014058853520535002225341000259003057782221326379046777635654033845038695143831406214163177624050429118303678368949300283954340675165271848269749284009942183037928288215934744269230891498878411296154350712230783593506210329194220505403024776317988240018183929230323644668404305143872615370553030474103851064003677655379017189993119048579440984740754303375459978660957509505078490657995\";}i:14;a:2:{s:1:\"p\";s:617:\"28395820039579334836161387898649960674439247233622326211768280334782373271489931817979170890916055413302754245705557686741053065719308409823785829762995052524756698071971324411047312398267937917755702206261019714309083266666414013819615504480631886547648812227018792688441405307391232086908175633468071220469138604413592100312699652255608890441454528772318259437737566237789142089147587149245666808919002145823882578568437856570025104248895416549110129209195950707772095941939502533593689204857946981366537873479013251033128358611814923150665511824175891786378056975816035141738553582850943558631898695157518195312479\";s:1:\"g\";s:617:\"16427696982631268353903581225487755231705825946830980554789105372858716026038249111748904084081293969196895304847211869328781733531414281143425893004105097751232768970984365526090081727509403174570678697235610442079339105174193043899078868617483572838448847050555823164133758660962030044720163750716900891345546349794702104874846983027182159351657363294959859277476894577221808034066234414030408976510603071601513517363788768298684299375453231513250932016545163534328516215349904742837283723209984958135686659791911743400514495756511965490801110027623968106155034268853690378943253875810016843764682678137792177387441\";}i:15;a:2:{s:1:\"p\";s:617:\"16895876560966846422580484060632250344028279991597239700516020270083505598828800684402957155723638097932477009949561754503437018270655438745051104890013072510900387354248033926081481144447977165881754984892587524293467054670099323627271126243617375076230412683004370870720615709833281491587978704142630411596015418966637316097621942031121320633348486629505904113642825954743114590462937823539960421789947873999540484355570332714664178766388598601416594705788731741720803815778148149915425982758373977150668814201314016383576950334588270980042692711517774085697988618241677212947115800722377405490644578427754272325391\";s:1:\"g\";s:617:\"12562425989524907011004691194930986388586219858834665734575703272928936583401256775823265404348532608420240136127635564158186788142328847636504871057962904215117688239061667196573670142209844922877950379017542816985916147729138565271594417564432973234862372784752905433168074513343092968302846347041479914197331038856875369435991929275281451056919524358717865600391488606051625691960488484376362242765534345818340338768105915246819027304718641846705039474566934921726821449830829026173348866560596158471286618187646399500911928214808061786090706638481164230762304017836419687357912810324817426437138236086098747016365\";}i:16;a:2:{s:1:\"p\";s:617:\"23592516043230669381503209490463912141922639479894331542046867222724097666751148038610606011023871126488378139347032265001525086624363691819566899874833940140774643220129869846896515297232189140046162539824550174277368181841675294015687041610499572801215455220349891926229111228496773169280096432503725426296044037202286060887783039639522594117165502962065742480408868757768838322362817278441563946363935999706919254014616515903798417454432404825037513060873405178641053793336989996203721941343359406537926727709530631693065497367776349495501129472988620241004182664916330461587088288889551735860187055513147589776493\";s:1:\"g\";s:617:\"17357673844145177985350497915290742733468722287987801951177917367151312063340417933200596968143253358846521516037627485604196935838705991263693782128577977709815774507145803116356994495454865663246386089298609158258807885879398788921730122192063919930212770027132626149464443611825908303647374448825352684868098359426367908573139014507718513977629877766985377237524984172786250947660639174591036609831051955804915387372318428626310296812710753916023514838653465725580626928490042758170754692218386311983461067928388581645238515980737145748441346604551781747077785610383458653905239486828967469096880969795814241762575\";}i:17;a:2:{s:1:\"p\";s:617:\"21562752817967258993738108906070579852039284843199885400956208534323430625671418204128340587893746628147431644603790908199613136574754933913669343614603320177523451846097320277092600327653947194375390514003381380358695023465638052714820184091922966583876523596682349437357201109301308068214108864523456588480732651538356551882147183933343705677706433918043334160712384815884738870777020254836544550884904493519865517553323545274678672504574933053194683269178875640249625236659968381130308537583795589786484046391067710957489457666862306475754083459177269427077232481488264522791483632575447236274170676788449453054921\";s:1:\"g\";s:617:\"13279794357248225509268913538229148538165475069688936294580710760692619281482036517026872782539307727254420990210098545082069190602873006562154189669783694568358461408837175649218652220054674691087268179615232683465153579526387421315074008948599907085908216891149444162354267958924947208835973759341257881529439709224745462220138240933234290694196662053395846738948018071824632382236962943562507267190805674962625665753157699500275526405757056345749165899750806752377097857904380121265291644313347878017446362553944043862600781821033710406992613690878474651267128632826192153111804588684259077012631873975836172554671\";}i:18;a:2:{s:1:\"p\";s:617:\"23417496789833357562672978663019776511350475549993441033999842954607242935212201031177981126608192726681624256142944646964904043397803054432307081104126067134609549096882870571668507906471183209340875647777583501325231659669003773894230363951801663030831715910008600763835254655919490884334756073413369232416903958581403112233968734299630803767064369833523088084720247752560471992092988134943153629918414448683818715382811469577322425419540944846275781757188812631747645756254548348427432379275629846811194041724729581004054697881971598136398819432205891530514514726611596081712980455525677515953671132309404250071199\";s:1:\"g\";s:617:\"20801071262499851595618900578716319162176934003597174772636998352276398183882683316341580810228964692272006726151949111073090755703941623831598136461709241110761094009335679988218697376766403851957621931308873298652901263458555140525167016139424806902200273871261469449585864822112230671772272721833668808110440729098213448660334235171526815362020901986446409677613239293176635891891319223839386130383508566659068285370921370541204738605732883427996902307444317957800998331868014970214411060587106746040466748722317070439516836852348646076122345442869711806916396726025974030365623397644963075893322652883715123188707\";}i:19;a:2:{s:1:\"p\";s:617:\"26655296424058595179986310167103331472267584754721747665583558010617583798047063548558461532129138907195342606110500349726687564826777141466985678647752168685567480284858181931720530105350597193647594741653262467426123591472855807433972434979985325772504767253260906629707641042348493651989852298534933743195004975569908108431911918638926288237978982598438700759037925271408599142662922835078178738643272649728478247566871859792919842613041352050717122901728364945875378901071105043291927088234618466029720808811991185259823221295116563650637764805660046730198012519725055260313657762658163200991646911578427368876981\";s:1:\"g\";s:616:\"3450823033011284474361537763550411076975443192933065649612167536169211540041636498142282627876628156505178333636935643072260250740502145734190044105686943952320477597940678735631410435736451636301010458696341853562923909108829395191132711128551212911250649213549680593026315051719575199856616040525994791083856219112881366064925789959328272385929709200935493143170907071110731944588385661252268822128197419702714537239233622482980084952685844765339934318859731546823250794044127845644768022363051861287357902125164259399180047661173479655586363283681496036348778999849460527637675466013111833098388040937586686177315\";}}"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/dhparams/256.dhp",
    "content": "a:50:{i:0;a:2:{s:1:\"p\";s:77:\"73832814678298170902979872884647941029284901545874925549746124366827544612339\";s:1:\"g\";s:77:\"51476058807219506610998206277345283936107915931731587440850063953203701691435\";}i:1;a:2:{s:1:\"p\";s:77:\"76972593405890136659846148581539967395400916262754679122033512090683295261283\";s:1:\"g\";s:77:\"40536177953614732865121461574338976193053929823454386769938537329223229736419\";}i:2;a:2:{s:1:\"p\";s:77:\"90678222772517737182669060100267690524517282587753173849354776070207136203987\";s:1:\"g\";s:77:\"51295217023324020085270197655410071441653549099982249142115152656556847133535\";}i:3;a:2:{s:1:\"p\";s:78:\"112035122549801288782735656181280913656716016217876691011809129186010432958739\";s:1:\"g\";s:77:\"54371647042380146023378995284862875333915973077834564744526683766342076225283\";}i:4;a:2:{s:1:\"p\";s:77:\"62194158582069859477188305359117210570164466813769290906395340312924423091867\";s:1:\"g\";s:77:\"45661079503690430027932894824979383218303184398768700725140595279401162955627\";}i:5;a:2:{s:1:\"p\";s:78:\"109887746949716562289488448980116120835960943658798588241040366306248937186427\";s:1:\"g\";s:77:\"40672948438740970862493667894582355273445817592820961034026786923017405088605\";}i:6;a:2:{s:1:\"p\";s:77:\"82856294712020982243609092866618447605083422559355627663514629271554457332707\";s:1:\"g\";s:77:\"34416040662169956671456751385517722858193479998165430251652844004160138167335\";}i:7;a:2:{s:1:\"p\";s:77:\"91504228250396371847303553559751396185779666715439286732407466045990416051879\";s:1:\"g\";s:77:\"39857698433618226727810093242453642286951247805632328011233975273133854259843\";}i:8;a:2:{s:1:\"p\";s:77:\"78914515436533736321800021501068621041000513624431796114155043029970882928863\";s:1:\"g\";s:77:\"37699575057133597258692445612773858685876622718395748221455772617196222142535\";}i:9;a:2:{s:1:\"p\";s:77:\"99887264459001756020085033457071600892669533881405206061916150024685965253607\";s:1:\"g\";s:77:\"38578248010462555085958074389688939528012418780656386569766828292349114252043\";}i:10;a:2:{s:1:\"p\";s:77:\"71982351514272312570866502020135229955879457662805899747226636086639670593607\";s:1:\"g\";s:77:\"54577099835257042103340960450024007160493073561557576008109301120391117266123\";}i:11;a:2:{s:1:\"p\";s:78:\"111348005627100700173841228663272359096490475124040160395478639652684669000219\";s:1:\"g\";s:77:\"31457852095708016675951983917720277445060540653267088126635758197134362138891\";}i:12;a:2:{s:1:\"p\";s:77:\"92953401211845673182089220656569865148723807400500147073569037899535512033323\";s:1:\"g\";s:77:\"41697366699394586852286014598140272134473146487972754852099109223623378584697\";}i:13;a:2:{s:1:\"p\";s:78:\"115301894620266352952032164020027501572840286962376521701145557816371554998767\";s:1:\"g\";s:77:\"32871160431857151288198737173860718706139469895659824990992316603505757759857\";}i:14;a:2:{s:1:\"p\";s:77:\"96343471923498879084781358157613313091411861663579598008154784412360514421723\";s:1:\"g\";s:77:\"55471240482349354180574404954922529811817125590976473056110888054444317488871\";}i:15;a:2:{s:1:\"p\";s:77:\"60729504492067278584961924278016428606161139264005501826188762335152973539579\";s:1:\"g\";s:77:\"56444400025969977990713140047023590088408912184719130874280347851728019320481\";}i:16;a:2:{s:1:\"p\";s:78:\"113900325385355187838261275529566875388679911394853338488557608315621335675047\";s:1:\"g\";s:77:\"30375972193127924942262888540925064582100876646765197303659879193919125525653\";}i:17;a:2:{s:1:\"p\";s:77:\"81095496549283199450987632777601843345505533571552820491363946821274768596407\";s:1:\"g\";s:77:\"51869176606892317236374313168422430251338346091156761852451813909920509557627\";}i:18;a:2:{s:1:\"p\";s:78:\"101594484068704391452871318220948198964937558656012060633086457558349057524139\";s:1:\"g\";s:77:\"36521940857765148936706502186673044141636067645496695747248640910066892220227\";}i:19;a:2:{s:1:\"p\";s:78:\"113344409968890085710229548598885666582507318886231068563168211690913303412443\";s:1:\"g\";s:77:\"32565192853647007661066738760059232931455020519838477513190586740622229447869\";}i:20;a:2:{s:1:\"p\";s:78:\"100865157741942714006835672578320572215808688934162933948109189253969530975559\";s:1:\"g\";s:77:\"31353399506013880294099022097074882435311645322088758615920268562945159134875\";}i:21;a:2:{s:1:\"p\";s:77:\"58987748040478408081756831145947205673749409643180447005095787056716058221367\";s:1:\"g\";s:77:\"54681552249621678212318335368320692079388532771163109014194315264322059702023\";}i:22;a:2:{s:1:\"p\";s:77:\"66835016684038007440000941566894284049036931784409949699003105152793759605219\";s:1:\"g\";s:77:\"50881796590678410195198715025013574158095573900962476288005944437157669965905\";}i:23;a:2:{s:1:\"p\";s:77:\"68569773570402015506975522611411067971033537591125717654141616891912891462379\";s:1:\"g\";s:77:\"32084061487875388589170475560472261801957843058408561030464427927344624397317\";}i:24;a:2:{s:1:\"p\";s:77:\"89041088472716011536983496934725702392491528482708037595583928300741866320783\";s:1:\"g\";s:77:\"38064663462733312563721773041650262730115051360751432386782313487662169550555\";}i:25;a:2:{s:1:\"p\";s:77:\"63506885046592167433260234006962661577294376048832300254801217057060187778567\";s:1:\"g\";s:77:\"49889663046133352178991367103241000151089916129350960530695272841039003186923\";}i:26;a:2:{s:1:\"p\";s:78:\"112849893518043495404513869737282700616865089034331683427155137156329228907867\";s:1:\"g\";s:77:\"51198963761086864384430773699594339100576142234411897622813713340298644162715\";}i:27;a:2:{s:1:\"p\";s:77:\"81379543081685837790443157894616584141037060815155365981883579985363608950463\";s:1:\"g\";s:77:\"42614776409195525157609422485492905089299192373448738791332101819922775909431\";}i:28;a:2:{s:1:\"p\";s:77:\"73245936509718941037107456038166801410799170427973092989082747001086626266419\";s:1:\"g\";s:77:\"50625914415280232833987886929254839755338573972368676118496496226311022209679\";}i:29;a:2:{s:1:\"p\";s:78:\"113777768884465651623652520617441431650397695440681571689213021935525307889207\";s:1:\"g\";s:77:\"53230261964441050208664489018248680823016821086100228556881376058274887677429\";}i:30;a:2:{s:1:\"p\";s:77:\"64182686965111979612624371637207151576388157490672453099264795411237003991127\";s:1:\"g\";s:77:\"42739113605751145415527077990412533655324276070946090181609734493453094017981\";}i:31;a:2:{s:1:\"p\";s:77:\"64389758512247996595870401541350246623588091081581706581580796562736474659979\";s:1:\"g\";s:77:\"35027570949311106951646776724538831430146702160360275048978033699268366887959\";}i:32;a:2:{s:1:\"p\";s:77:\"80171209426362772759848178439308899617715023764855386038084235620615003353847\";s:1:\"g\";s:77:\"43695422597465267267136734648314440541023062173689900067656462758471318476127\";}i:33;a:2:{s:1:\"p\";s:77:\"78661796419493527928157412810459909523754144396497390147701511341329482510003\";s:1:\"g\";s:77:\"49752898964251876428709802877726537855856916332152631351710777602902687301333\";}i:34;a:2:{s:1:\"p\";s:78:\"115526308257340400930726289164227427500977970696409840065400171497064778851303\";s:1:\"g\";s:77:\"57455831142226363977301804360103763384570180363822590025633870121824156777509\";}i:35;a:2:{s:1:\"p\";s:77:\"99895854914975530338182226257990200078997854990974668036162249218262310892223\";s:1:\"g\";s:77:\"35234291282377508941734996504627025488242912267279150273638077828536817312337\";}i:36;a:2:{s:1:\"p\";s:77:\"89463065045661035231551266606118011957564752892942638731336758478484586730727\";s:1:\"g\";s:77:\"34476840145197409328284674202809241607868307470606051731302010755191365289489\";}i:37;a:2:{s:1:\"p\";s:77:\"64624582433843940196782532037106474516282625858188798258052359753710163749987\";s:1:\"g\";s:77:\"51907637552590521292421620324219346043776599340727611728777487195410015119421\";}i:38;a:2:{s:1:\"p\";s:77:\"78551241184092016983148992408241606401944659592242270145850487925990724687479\";s:1:\"g\";s:77:\"46347657232133823282496986294357257279901578280128017968110374222063339245955\";}i:39;a:2:{s:1:\"p\";s:78:\"110454815842135026622014358618557565054874733818955200746804642117317104098319\";s:1:\"g\";s:77:\"36484417303211228180239343081660681048447119211446094732347020240865174121193\";}i:40;a:2:{s:1:\"p\";s:78:\"108632820637647054517954687133925163880485688322613052629730339391168797942159\";s:1:\"g\";s:77:\"40936112635569071530887793547822555014118053761125242378490069684895929829529\";}i:41;a:2:{s:1:\"p\";s:77:\"77384308083436791525512502830035429654641530154237012658177043914982366384567\";s:1:\"g\";s:77:\"55266239559717320485762938784631604896441023536093197675797124339337266057181\";}i:42;a:2:{s:1:\"p\";s:77:\"91486076718429369045114077207029983275174180496205286263890757368244392884903\";s:1:\"g\";s:77:\"48796657615906031864159766245092760843396983449401480155814650683131578645867\";}i:43;a:2:{s:1:\"p\";s:77:\"72102224509363634446570802115759927713162729477388965613331493695110367533179\";s:1:\"g\";s:77:\"41338353646772388776408143300172508262741803968432848378357177766068794408805\";}i:44;a:2:{s:1:\"p\";s:77:\"94893543718943583226837269269711919605950724153318813366438966165684305916159\";s:1:\"g\";s:77:\"38199282927838495009291933322760804607026986374974299862170665602978303904209\";}i:45;a:2:{s:1:\"p\";s:77:\"80059845045249334967430326313246226499113423192254298079034172260496369580447\";s:1:\"g\";s:77:\"45202772573555806321013920339438762194895562399493007564473327311269546531823\";}i:46;a:2:{s:1:\"p\";s:77:\"64583990953768472760679459616315123765296280162588354436500849819674609757387\";s:1:\"g\";s:77:\"44955507918033524308531963911022162716703307186357435333598757289790265527719\";}i:47;a:2:{s:1:\"p\";s:77:\"83254860662706746455845571422799438616170338867584794032169432243745310866483\";s:1:\"g\";s:77:\"45685643686930303771863160720615786661752116869179660967345997698324429835601\";}i:48;a:2:{s:1:\"p\";s:78:\"111129822697130897903264343602791707637087284640784825057418415411648814509787\";s:1:\"g\";s:77:\"33126138893831271012720592684933302917306863243253992047196592803506800432571\";}i:49;a:2:{s:1:\"p\";s:78:\"112628096381776405952312106536719522382375429360429462017871313236853832958303\";s:1:\"g\";s:77:\"51091975906557044918432083900571651694499066453285507781185412784968687363375\";}}"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/dhparams/3072.dhp",
    "content": "a:15:{i:0;a:2:{s:1:\"p\";s:925:\"4315132667335984456963558712492060257344696532540937013667412533700786332247247258786444946331529425538693841794686692621963051684018984641660725584842468599352742337722223201982634595644711492725368912027507353121978199347820593108558415379514513595105258771165222489083806690898826212723823447178708312310015373887298513452146950026717495376030244091940242203446809569885630514161505356898334636153936070047367220821769019996145996674921856277925251065184565233969540332955418598061766148428574177493374340178989369402930754868614979883166971458256934371493708837542870985695478010233708013626835966959313713197362623356634272123467707869487094589087968990428445989462460406369348689022330895916889128558466106229221162192180749978628677142243021374310742307679557586483044238163020079196922979237255175192476288945150100440813256326420527963791569079099711040208151967784056080661234151722826312967586919459049069544595121\";s:1:\"g\";s:925:\"2350119018539224581317183252415847335247362909293949583819480136047741271969210563596649306799079103843283712608283697540038743924120135958735013054518494349752063516955891717508379841175911890322417721338576512047885798171488037467431031588786174344182791056606242306674694663506097118828767635753167597448122585958034103275031127729578917036246768917035692891012572814906540367640104398319921957224941616190939982690849656828763901639933734397922127816773424555700200021019174059057777026847966427467057235198647389332182881908470536626080808572135189622957429698028030428044157396315681162976893222692006884962413038607537527910664266091051241366061457243810458757721091006903760284025909160005959237519051794063104050293099371887370635729203845201869557256890658540204361928706031866241870843244741068763076973016656112599802181801697016020371090086607874674384529955316111291655883982681716521633771282897455399026015616\";}i:1;a:2:{s:1:\"p\";s:925:\"3661665842190298063828176732846293640919222353827795349002605449065557880062145536666215271148836094458623660611328032195792228919690193380500724986215448719904848955793022993600439169495143330203461054069338359490025694157088096493504605335762051029513597551864863947693713477128581978728520431114298665949113705627108090586184073139382258224813404010706205790642551006296863042075254071665147777776707740858091301988442189198081921256690114717697424548845597164325066843431117108985133946191000161228877154348382442536080406753876146079547573447857543506316262040659783540306099921979385195412728403628469824785302447054055747600216083577156808284736341326726682474972377807552581603315824036960973343372464052392517539250145685441328689733886997264420951036267016242264588569127122203684662610471625628303236191647272486039447610039980545441951351603094273112696986635159781389581049218077713772074296953986550297559008921\";s:1:\"g\";s:925:\"2330013033015140718105580780000814417623950544622555681637035317524295725985949517727962022017580560547563293597480791009886152631504784946677322944135615155582592846014602079733324813222482088145642952216221395168852932599656493754737300222260887305133391964292346610726404829045255391259296098591725039219968328706584519797363720774340423627001446486074699770450134070947337857854387198789919314090619138465361996989373011459061160925315340539701819845358607233491365039690895811239620227497070217116286298965147073584201527403505009593615264975257954666738146127058521902348882467540296125841019084888051918146042420278637339312514698888677245842128922453684441718030263138973029024870038115729105821493725577229509289318197508146609933674599620814192772205023194161979027879633561410655349209310980358414894722460169598481382405650803898146510326139881914420114730680235864699472699337179513801157570860074154514000403217\";}i:2;a:2:{s:1:\"p\";s:925:\"4620590045169368554532593574486202350245249389315730607028389240974807061808989952188740674157236839851469650650497483374139797687030615339039402226480050369784359208554913778269157347633279686389091589520171218211153475774540415272645552458706556134264327307561935711474110720994428353060180736512077595956321907309914463979874348215571655054910359837251879109577142329727462223158307264068910944642564267328731048817042467565187797605740572389597584518183277729416430429630091936961437746628672624310534088245570212333926703546043476499624595458682817300820597092118377346583224950405123201291176579571288281289104180962553921641572678604773303321625513910966201143598343781696119013034400887449687812871458717959883805006700972858977252426902453658446267639459438200247621387492006492376809433765553636040874894552140340528827784386517413645617181947670553072125045523316044242271231323303187364368484947845489395421734929\";s:1:\"g\";s:925:\"4366118718728026129585368339757372747812283277679825792704429091458791780869289357307128615576667018996813659099222894673691023756762981972867802440998213988459504727363294037678614751628490500713830852051760642762831242205244282977478949802790510566492875314319012587861033111945258477032234584165020634787063563060226904559488259306239403942858014394292642228798899319433517328106045603152714304240613974941203373109764879019335121960200008382571226974231358956539289857770194403260628288818158346951295856345578190002005441993276348035896883906778534112627726343274478915237297608006692168477579982259987288186346003808143068013463951511936961124877635383555597808864932642690164727423911499878793170724403696380993997906824723746511442380237096215284266757159081815684624425650789580133463950720950707773341517945032379999366468344661073766262067221609371947035046592874149724312790523190033822151871604750768215833346301\";}i:3;a:2:{s:1:\"p\";s:925:\"2938996187439733278190929622522349944345060330946373463011322239057071445903273028665349335001895437955186644060767951101216675384067312297743697834773338556625400217742556174036456199954355031134394408805378315265066615370777047296269669781228365702751437327044218920674379042960278113164522885597710245635397480146223856309389521917307236756459113545853621634950936911142251242228542261800588746461446890339913379337949235490176799076102212171841211590921810552092147568351052877446522006565330079402644310865663450779556049843233202465628767590866799950861383808769840495381903661354708277489471381562306610182683334111925952147645515746482205266484657014142278865721433985338001729049063402403614948416123352207951387320155475974153744398545712952250022395899483389410938264851959185383988391347681515064735631000919755110370081239209119611210717600091760641914294069945948628410388786450298574688846037117458099372003627\";s:1:\"g\";s:925:\"2188180360592475474255511510558254820951280142973747406967025596302429430733726484610414308155762329822727719986011952045080143567144989598532990383934540349664426078338531224748892840652053289950123010405619591397905078626903456138814817195006903802298782223061589795938940654403773897504364770149759015558282613426827768639469348445280997717425425821254531982205265979720559293842189517050726819531061697207390209500076548816157640005607651402255706562491859135623242147151448088299859950249040363472544692449982136960186451329556524342413573462314348428383404582280827585580746192926542393278725777224013196865983526484755349857827193710465770127820637602199711325838042273973465637657021369104329753017416777442203610305126338263203859718497497033721924008342606583384236874030750708458957210268975685066365072240616441632985559271286231364010642310503874912295276279464065613912114646430165631609556704960606196917356495\";}i:4;a:2:{s:1:\"p\";s:925:\"3204962240800723816455471772500630089000997534792113265087913534933976812754741314152333161722136535323947418298993649955012010494800707515359305183271567204804336793561943241504957646985792902563473357563351154295683729740121421751902177385001324509438971655716930862114523297055235704266831648792801588667356727807779911488187335905720474875954132537802816473672247617675497279606357395091411459187790088423865644531157986398649668993393419306383003614731055174134147265802542990950181076842959362090886536566361672744257109196212197301596711897255025124713698133763282484725224264158953521633609828865037504253513222648530444623441214553533356064814153695805473899049725283546166491312381083067579387836842892134578905238980750575603676463825053338003879697106285582414982603208225997483259925008443212949824045922036211598364431099546267769245715271619696571301564489744087831121278703474351166052668283302487804660723399\";s:1:\"g\";s:925:\"2478210824019551512320915125791813539617224957203021574806979249207018870886399224961077393046503339639638016501910140228410535010543227950645082702730670128355633599633043853389737970884200828312283306402427477457013888098152394453630875646221684016198476297387503877720665978254224708974837278936309165678785757023904855038581289350871058547109434639163447822004571482221163644264512696822041373244545734333000574397644794101152145506432007404691930795867589553966229970199464105294872145069453531632860004871327511300984654195341632795521954496300167312104321888325452986799014818028629496909381762367856301721729884500546156599040930590095260641171169582643120839660452666595703196302210006721682874519760535561899529892956153506747158975716774130631381604630449687840599933523401758295813794558297239292235091793389815370710029502740492588285871904916835615638686399306444319652719565021842372271724191724564878652899605\";}i:5;a:2:{s:1:\"p\";s:925:\"3858495699596293898688375773110502441666969420477863823398805799498715509641562514051656731242905221702517081547027427844096728462563747228147262855326430782781133768087051811345578632161234632529176390004908409005592450781741043991144437364416255263991536844100492335985214082240310081219687923906385177494626411448945508588432558284500479260995206412930429039508366816784869690714512146751344758083063138616759346381314079908598351217466487073343070055106516938750299547561712449231665818370557327336756144407998326862734127162566508972390201780064268781728836864341723391269404459991801391241300508727898273827505495076344038735675175327462642474409362152783304320466458748710388940666897294271020065195620828010332760249112589154219333978627293681202156105282137065180043669859728816043574692794562625562528990196961932065149331559939634377062532299875002483921931262911101879746604320555198841530133860397746299378909171\";s:1:\"g\";s:925:\"2886770992828075697537865453212345955877233763458923987749867122711936037323569999431920041463158985162167680556614923476438031572260453739278044543413267437317254963067126570493942182096870591545209873122677040821918637446656321776278694479543818356320243755830549186685055812353557718440720576848387587878449845543328582856033075009617490657544568050050627565735736537270305317220182851115960039436216682573899064906440041083076258169673094384007249539021638076358510803567039584750818577942782544780707619050944193479637205469754870583309276257546564407814918646615385884198525006539391582468689218016193841581859343402584321850321179203289140890633308745187336976456718386359814499595610986638615944560401277989413598915531901666808033711396337479563958570717739601600436466348932010006348163460342190614134424271117916987578687455994528258348706062007249333872007231347444454900634426076055451830224745288581360845627478\";}i:6;a:2:{s:1:\"p\";s:925:\"5130943436634738151705983389375848779869639921630081642526416959069902317114236046229660665455811266490019114464604946115159213191020031168168934260240370208638654661224411266801294059930023003906358110167332559834781729140290434226060866720241002885723300338170136670588251919750642109993266694093638580072006610971738091420452065294660969649783031963891317158100456532483035292435217535729908840133045505215372042519294173893500103351214593883943376369844040124039643965754086308458900341243079112441910048778603970492763910684557407948355396339668534357389653826573386393829228181277223985599852219898165629315031588362818823320107829227064897785017442539383052775003927202548433739462447033947909704568378992953469486988508785729088846061201035920027461970780780005619342436344516177296666848839057209008013560985064308437927467930182007480635819670195139144192726361522119994919747844325562336361309373139438239770340527\";s:1:\"g\";s:924:\"260934354532320981603346232635496122387716858013756396769540150915775328937528977396744326608481588479441907495821544047901506468212289539823406565234667220744710916377135092907432145546725586575114564276697681144703692013998160742003993464829802606364074051703138197052383691108529469174089994578471577368442017913387128969303763416195571202078647334505305658123832338834320953526264258001677880912206470170147306962815949002226615725629876836187127422017883188599155347419412766452003248835237735383926323738507826527365200159082942467837860566008919490947094664770207577205258215568849415857873018813254495827577038620419781260925766984307393735044861803885064315173715497646285752656365376330908367814242240442396593775595814974738181268072163021064089047877008188717956674409081793607850233146167883025620608270429316190958126029128628146623463833608957824959491480916435770824635224049032746305841209922133966435713575\";}i:7;a:2:{s:1:\"p\";s:925:\"3998840508039755798914320501014490629633052238467381119305554316434989486292068483947090716493975560622301669729373235071025195401078218707185420229393875101630399207091215056995992392328139307281469826040928322742255751493207399051987012084305120865669683305722438138119183724588731142858758353815441063774921032770684639251029994539546020279344296398617212421068732532036375421965908920123116181078143585688105962725633632132975138406008174984532184852949383093432062210148181318477580417338770460510155595650601653410411127159435659493085820168746161620985855719309306349364850268313653433450566430609172187269909560999133704305458710444090927702514998592430411602512950950677351211101786937984336899535946914086866004703969257088260831279147313068118927684780067602116963127114169381639014582713965741737756250918519458049220786586497590905817765259053986430610205459529957290191421398536494800885250298043501610812086059\";s:1:\"g\";s:925:\"2057658023315995837814244302674473620221265305450883707220933348948320037525210388745649180389426087096994265870161669866990950147659456065103511412373045200462918715811677244100468295446635609971623835314211125623908520420064733901198155337704396419102815759539371784037536019669543759503815444881029800352829496591835802768152878613096427522151951742326629173003090596367204419211777304661019230236712647127510964074174767247775500850831099969972081398582452465813485109958498709530160165023164241692106229959616650039604984445666426834802188289028501595761306529808221137567116017979084922372919440488146672329182636452142505034221383623140884633533656641179188863902408723787496018605874598641384694800760826997534273409829898340972241507784345241343119164153030997554682570323583980126844499905435883099703450893660347945613657017744862281043902594543525498698273068656471269751607765332642113390293039115043238564103012\";}i:8;a:2:{s:1:\"p\";s:925:\"3052587646542902635517226086530951609778282038835979836249050671063535821665881064115534194204580934832939396328177556330734842749443237143248792953029921041776669549143453117786515142880425148009081292117059998939563969347201402547392105917250085128493129385727535383102647220914444263467589044844337906239611382825797699113671584199753687591287631042586031195659928551456680508412407670669265264088757923152615347875842767338023502709093266175409535257184444620178546734871467900590765277006865565930758293589914804946915189387085191740529942130147830492793703181070245326162092621723033190789966782425551751916096436898391698804721111476077819753921137870698340323664493890573693833039924707736103693436805757466587652144690484910903191505956908906533026489365552879965712849384865313762910366975745166199472841164150446248515130746369706711873108862393430213900655618183304463659316938365139115981162958182988581222516927\";s:1:\"g\";s:925:\"1528970316478521813353997032259747601735191992648561865246322395311799713363100683965723354220895113167576481333105953735058063391855371198236588067407381815001036506237172664629862905959335540447703914728848630930034014414897925940698068311756073899855838490954565219020692805027055726873359828123353015856374380126481052959369002908628607232632399137305471086503099495978391740843530399808236564911758061281813986256460744423707435462682152330795942459476567607367164628721363594929691377187884244564552802877253956518878163768915048398159522668854881683427429061145351151903554349930235654986427715339756801878218559049944808960309764150281309751390601707948395300869715492190359748972888505045582622937580005700313037128036774300920485981598441497630716284566747825244929014090865919371992307502418429354359868713615948277531724520475602562297248371114923521826670568579338836795789101865793989006496968085530346267918952\";}i:9;a:2:{s:1:\"p\";s:925:\"5531849879715624114545398644990869738005678685505540581620042935370633299520260313401427768894146216872345400617660584943174470760956880835234467871497601411655568407303235347829600176104883692713487675318046495160134259363627993949633466784575181041587431530962681787466582441133960809822774283217984130286952934282805180703291046761605129877507724814121136198583199545178203257717235268348901238327943885189227904444196292052543399633947624052389642080706804402135633670642032342495348069576043782932720813101062926203420693682305253390383204671688886280531577438389453577025982803872867504594741277557443656199282929180417954184489501788428410224813973812875429988763466872540945881435267196803982267101116870704184342151713958770562162236127406870017210783442933149316190678070324462159427454290303869639001018013226081887979930030978578604010432508341116317743577984812733454143165340372816341180317379877319200301319667\";s:1:\"g\";s:925:\"2917203507661957440212871046481478943727282842611244779763790996317687687796653644637232299359266378464863671571808560817232238482565725501100973646925473408457779074219592120515053181961738402943826605763153695887609945228222137505734408414619308585763571774670754039876344991582623796377907891591585728148008903192190841789422084781332813849714793603695928341589810634401241616185097559026709733935153380643027522004141273257092132215475778754534758221475473429898883941849856488515465149480083332210865241632308051267913594510037802419825916838542556176217263933025009075909913259028976931672933709617760701659850089187121050442463220999583880976029754820397051904842386028835760327721598037944871605455638114393194929619554005022189733574969109237418204065654064456677392819888022252866367583881778675828738176280257941491838252446519301369815272120687557955763759094560889666704564956244599447217316300475463318513732796\";}i:10;a:2:{s:1:\"p\";s:925:\"3780562069767071462751322994770531351248326639139746208661386875034130015506630130354418097645520065657264914599050724477554706479661847220716768382857055005905302806412621168013005582588626824922052982755725555701387925243647831685319030524024371191569096439197899084877369353216936786922609541760719345429409766670866201565199261221853312704476568218496413509455308603318378296585201025188261985236431551746143598777692007988149131442040972036431906297580587606656327482072932384415225423905971270901365306034795404320749074843351064279683995518828679129623086949200669166019135890040877501907773598692818560350813670479817846008080880279105959456444566616656244687337953491906818279020434273168222187571812479012408132683674329632467563988095817585564356500304964862642571724722567217202489476816879092879112960700569233233874053585011615125908594694514165251341082992440179577254889736354944330288242522604298568218134263\";s:1:\"g\";s:925:\"1133287961193943111940342976118103953191957737288544130733159585583521695386538531116451012469637228291577079786129597894401720014158983191228672539807231618254286238108067446684551660646160650174057287185737727852149737778835119754106612692045654868897144051639321003403494071891433447103764027502646743853264024332835367920307722291151158519944255275084346803184632183174584156874227281521959717127362792889493841915783229452311712061737832597541029083298577988701022878289226661362663559803846378086132409935377291038042135005772565193607513077196748107849775169080596426552738120866831206312518873271453348551519887940616728190459956271984259492893170174757364668932703190921245410930261770880416605148022192685817806998238703799851284384393863608999974068468543901987557271301629525606959098052879304707973115293685698041864520817193468017063053778347860274934684964825463007204444869127699425044400604879544466093146713\";}i:11;a:2:{s:1:\"p\";s:925:\"3068095411998188584974295316826692234024209804719859764484108486572281679715071972548018617288096813401480545524367104865019364141719603211985383019388112559693792867918673138698433559285788103941407025538360390102089759681221369654397361044046355244026937545760739874039629458690284054831150144185217308188816082422196756222298053288160968786145333347037314844621246589018144013343953044545365352430766116812302013752255034493601043513298413210051345468193554254405709248085595245129593291443750091309171217758403287393835473936600741503786458631805856224113637086263988893632533383451766915290972161134332112947134792182158732064375840274215592185596628615489952577220097912306990091072175658705356067742048210386333029866371918286690399669681268420581708391550751044332001829026704722537807437823148325746846108596888514608080975020725871152050625645593846665828851876972185832543501226148782144492486632994901478570353477\";s:1:\"g\";s:924:\"159646077674815541181898471066991220537923963782148392287829832362514240966969525519270080706227499541479736397774272092871694088307637303456504900062713028949632514722351864440063698772176239061729207464996707945061729052663143361100233236046404449925208877350949615956983649392618970848410825873036033300136570007232661091399138793011759863976689419880440899963172456623782321164251274211971525927466329495674836200825606797638605022890014528854855363018329634481021113432968961232928182204812380173656975430286379350298654148640494598755820163775986641678506596595022674979754860369451813519030992570439885496972635686145130069609803924536847652164217943217391745627063861047656164990738165079744545323407641370244403751048259215795551277457068123515482374905320163065825080982452050801388367845963408590818221498979145321370138496712399590229047470037324389568512410801751728974904386709610858450879303893490586965176715\";}i:12;a:2:{s:1:\"p\";s:925:\"3367777398549863878345148780352792636611560568521571798049082045574910180885005793793126728459986561469235955566557139518336437368333358883318717635927678803535695555323846136098940080055660899782228359404434364204499739606477885672504384363680596103574952129514920432473116170872538969443310045437643992750804155246600739318381291924919382044092161074120741040663613761033649123287522847647043591147210241686928207042782865374261029266594448565161093433189705423188761808597916029005700389907296602885569165456302470201268341211857068535407463170382217821960728467862059761591092988384122498077996964718801898349667875615762194002904054620568439838282971943978910671633779795730872091204472155035861162792711306166527620004280453286569709407237219146368163001733562186610372433135202274242049506939264129559752737618658036336838247421419934890192209984634346973630788615414331951553807993311827232462663277269893274834815771\";s:1:\"g\";s:924:\"282566234821537490920271629731450751791326010830798582697602986370304196814692766945954814860495621040028265936431536156879768298268960424693075179327931900024792860752655474492139099296487961820716320660945382657603902779098216755977959044903615939284313278343537748123737565833900347186254806630856242758854544959974682405386328237045158616666490226285723259258560242438631173878709623850577125771772686579589896392478577404691200860585558677662940672521119454346512864214396333163525262056860462309077414777119126023696154521154184782004242582268895380068841711410787973048412003387723653218024570006248657732179556204944548185385219665849088495644860518610339322248090941354949187351195497168258030226507789218244254891196207707938136301397036071407986259710377170196867939904460166199673807049914536675707863908920489544130315256957639292300855511885137578488817087453901342539712110297865118918707118619415424775167895\";}i:13;a:2:{s:1:\"p\";s:925:\"3535384272507739371390456127135809600186371214324741418254646290954611392001303754670712294728733042167012780609017296164756809496173833266096270418632868985081715544299268631523609112391637166781088782274258141895327019496527187074403033663813523275310386981896554353497215916757908905790000167941188609984283480670859772957173439728154801756764969458163972781505343070182164319814653992820925111164323411776021534453827602054973434524749158514070173127495515407230002708401984918054805901149617888660796149248646762329259738670964578005232274408294658881682648095451587024978642353217735565744329057331274791772257390900108305959207275594924505491121911140571784508204909027105532907233569037974155947733655073558194831009338166409805336375694237481350665052137267368520421694282722206354086277014005346758155612783267077100275255177466584853168927390561841803896678741077551600950305942328420975221043027695073323234751603\";s:1:\"g\";s:925:\"1119627094127766829772500517036991083568576798245595498908286128578771869310573796614318558965773296738305720838059734422117498175277568498453999381892211638822962310789626180531534551448940276333857738877417497428774052153210839843293436387816119465485788462895141683934018108493106429309515246847317086612993115379179025962781724441313149237529166235928244893851718231946382751850142392414570892539596941566408655018573202199515090796201983901641953539712987904042812508073257182740282233206806436874681946401374885573281075164038391538943538739188358560267747478564509764088420575072117739801179730824156119304707225171826233403806127524192427836830907025371222786328472434381076462861211218005577398906174154337267095852996974622601430030358592190085397222144581217030220082685020732184769583309535060349556169532211738543599588804873402286879771608421072017103605372843541753819986226059435555938653678169271805135072704\";}i:14;a:2:{s:1:\"p\";s:925:\"4562194176144915101277745005681642835798897873495474402608365237746498633370539910997482478061801133410931468922790595608494725996965036959348492966696919596490096103508729764011492174796198191791155909955522446405625791491856359473844755837078803270025112823181994772241566047803179666255388737745465556951461374666502425494234403038996248077021695256107962233981604735599024291065871109632150139360918869800254974719289688500762129016450664740707011409451726661221355954521623690646442803371069043169161235234437004307481376146993512198303964849240704679431973961042676250710936961739893678332170744300669566464498778887300216296271182576972042027189458709055591030587939226922668108333380026928880780276365283307970658783557815994186092589841511323470715371300115114933930080499531110461367639031194670553552560568219145338631131587315044373227862105549876394176147796261524892767754722603204009262024345120417781993357987\";s:1:\"g\";s:925:\"1783063526443200787273402874050505315277582361331137583023716558174565654507897825561438236925691082458055937563291294701190532975370225129732306964365080034548430202086336886848043161734619160097756477070297570704155217306045516212846557646681696236719960634662894256288317478659187183031232562007126356278206248186444217073475086995834637378490918740251676685852817074972991205125364956751685343096061867387727716656368534256629567828308240954068285866099855203072022472167988681527977696446376869763607960806831605221190526541560948897865708484402569295854151464572749555731165228888295734781820361816426917777384572381759890872795386961361866080348000867683127021931442615911255342253637272123698141261912663138878997606751018377263447620039560096755190075892714993610328525690603097687100475706668399890981671741816861639279982388272019437387929568855179248661068150537105516997412483935882350464469157999820932346920856\";}}"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/dhparams/4096.dhp",
    "content": "a:10:{i:0;a:2:{s:1:\"p\";s:1233:\"583497364515534144620769172000044730923697202031727504127123210239564479942377515134918927524784673980579074340461063538391526339824976232063025052904924470995749954074102702957089466315511530623356782205508248825740639624859740089902822135926045166645045437903927933697296195582696814881142738510663498379289235009495727479310527226263007320787605409676476477501993212002640038117065851293829333612131166916933716569722193363513937135458901235668624388058292432629862283052489837307563350505877460138509873965637006792230289674917658023203501223032739662361448420491881958859596930485891068704262657955024300362541802845350103517222898174052640851695040454504836166630292948661375262574940854275967111471071853533381721303713908516806907549838677153020196484939843082018694927379607360137717235291722860519561948094257242530620881851290634352815110863032193710545113797755493485240688912927875280880745272135687311489219235308680262020676069196477067527653004361116497758712463399308993868628203477781594080634974306163916058933220903803140690960293459749358282932918972189491185206934138125324705008321948673334974315329955486619636903641180912157388909885148546517263298358704668849000317658586232775537242080876793052575872164717\";s:1:\"g\";s:1233:\"127968319472475344331077898173865318243419891774158869711828718403058272519395942847739630843783440496570407521226003155993983926846566690798874858577718455391682455892223888282652593207801696315984482994206748236808639469753159247631285968088512433340338448500647218310014726139052545519914995413409746565031526159760387848380067349701191760120575688747503588506736225221765446130332518196101187986453740722500270894816925266412425389536471469381597650467785082390406765429913443213494185648481561518743324935186205282661338295676001165228783434910786281187086626642658036158298936580926944325449474152492970083106102594548633509876112245624678116554682380902585210405140435485164389739462713596222796737961866604089345760320729771435028743520537401721331612703333892591161293038864926815371098779656090361303929418714804579407604727579892304347250984412867344708385548522005435390223733841611446899929639968855580274150749251312698516786442922382658632826376729122687489867685434294153633514532824081517876628181473257432770817442813124369799504124961040791138045479518041848867260535046612877228124634309948497345074597014995577791207765501863118075962822337166339167526666330102483819574318799006786826531261489174152125772534202\";}i:1;a:2:{s:1:\"p\";s:1233:\"644095053480099091939297858118510986022393648400040771848173413661472143191699322140393580778380090670032891398559036461541070211706428701541351601818900768330398818096052423231077739122485148413641340967644528288501235057628326779619886675978303145968323618694464033676551692515615682460530416294904707165146157144987891911761808025802411091538918844009954268729819844953069874476050900529268165258481055331546080631033547922767585983393765655588560322256827506194710671637768772870769834318509381421150469657835696842562300393152113399655413282551477993943983874755875008370601615893956270286590833324338386236912861203288076957651978605993345863806728255193575092771952494482786247355235879276588474691115246553942882015825194543304753856233378559305533559337703203990700312254477385660339915073329148910781131702800669269692100691711240004144672213498457817651708910320204007053298973019806994514666211161604549258750171462260682389646997128719501642785472857904319090448452035015310192384694472666994345420665249463182056689421284257367184727426519626237050683000133883319859749913454557109977645943797147207761088834575973395913233371630670280400262776509177911655348771924491186387978628358113653228880012165121850781835748133\";s:1:\"g\";s:1232:\"89768691123282200273250835302117971048482773917025710167907764833444870099082491710125785724737126849201414977998097793428716907619355631215464414042029665794351873443581002311352342070262811635855982355133446221245675640049081025694562439753757674961542906344974660712521171173708467699171410627857113329247881584047267375568447173390760619832999450149891575517887784502344444374191979674278777530444755493588772031447750816361643891131010868034955637938063643040258792797050121847588179905543200414522189803497522647940506521080392705055063912326461962382542669924669626783892289923537801933181809583637334195726536873813665338365672744499977500454824015782399115735050243010932135563292304832389356097634421958844359608592817067687298260497048355701221546321392944037624125460251388411565536044959602093101251148713082901120310712110250945846908369537893593889855910577138915381937493103881427691939365101855663162968517484827254803505472068266675648883873179408126913733762685173740771676195913722840849674515884752692489338505861489008608258410033759076296295109067248910573099437033937947587453092321168613438797472805045901054080309928241664811040669679366909370512498557773486141885686117459727194901102461845307908569317600\";}i:2;a:2:{s:1:\"p\";s:1233:\"532066646043903430528531198799450191282175598742954618921250001448735653262660514078933937412646564856328300432618349074670575210471137479308656599676782686029867744041341499987217319442585733211108770872807629457693551738273743163912712947991902397196643426249471123290349309622852982951431128523211363481720767632275409727094997652747425555700771203910408057673037946948980015289661972528916471071786814695958220834200499919631633188207596644932186099425834405442983403992952942254049551275570962621513810901783576680109840078393906038555579747674469371579619364205996024551188123841158209735986236108133045601317981547026784181436533153185277324288880485646894594421478688603459165479261860263389086018757182921909991153043223366670612538754356707473045271074357478392653202116322497521243644316279469134695450721130875739701496153521607873295760755658643712384624306497896190995965732533939539036696648605012419766798899358151978186058585681072604170889939882081887687877039553196786539987847117171555789374202715508790677648591509775834020846216973047985050084777424619778972017460676420407835912828488139160909012797820681272024981216651882886167197915950461158262571666050162064889928434160092071622433349237717394286981570903\";s:1:\"g\";s:1232:\"88019875487376264806598595177212842685348996819137453891069396270876361332627678497976776584898521161583263213197650880795825901107200678516836793986000818559956235836401420020977196840780591296240289055489684623759281051849436675569974566414464349186834037665098011067297024633109006155906972081508954416530556429749768193864239792490253166528742357729061562213019250198539794737195535209094996535044158932610816334246967178866460038531092201721314640872055917692442887757298906896573704281644069767924051562056098464867189799317199958325251056019942124663808656713656134457210444039223292181732025000379136084470942258525079649944952250491152670202869296763020890767014531251289534932496252825710973791866862020857292162810797821091684253912935784170079547394373669953308727375174305241288914357603751765176389654002208740589896011833020113850756049943560630211773283686863803328093696753873577409164572030208865429768237857155625447721967446539430209254438537200859359258164821236947828318320963877520932615943026573345162336913924436395993083326298556575480690128602849466373950375115049719716275590942926575038366658317860397980294415354782753673696615563230160745561136671629331140944061868442787441624612522802729893757283467\";}i:3;a:2:{s:1:\"p\";s:1233:\"624640865987867767216987778458789932847491075900224719877838311942749587191696555082537209810057247919185478634348223780741315957546909458090180531717911688191999329526846600555962065000508819021170102714756948429438721648737316448601804780420441612158994209226255131770594803399997288996003939416523946117016867530503628253748816823450873875385453973144581900301687739073722987515945552803443310402531595814541545187577977368505796408386197398340547063464250373460631392626155464052978092560822082540325765365576339965842818719306496724608929188363903261414902415556654006254232801406980895747585041808294354531554348429999919862150877020145670979592596848846447075213356249432578869930774335639823617193789610082309896552192367995866012240549883616345621459568480420037929052913195278081936958815044325239544082449262392188319862353535913518387672568198494110767287509097955588954933063386463158308071591805893477233574065816771174268570465832008357759812349254524175799285519545046477977667617505357579209790247796018912987245094247419473335965201710883238258536291075156906339370737434861404241686509780076365867254408634199338970593379961068090472072015144456114974956845793333134680626115671837639002307409714290088642141822749\";s:1:\"g\";s:1232:\"35191597041194826078562114780735309741604982985754459309396498875763019560692191173444976369639938166654451464209462496790872478339726389561848827197210702807234266970285528968148481205090704325620718921392127415038829344379920313399999013610665878283652899909643113809669797186334512616600176863374919988913482054118933708571797485328542935271364769590869366320928740568596567333625016938554865984246979429032911993244701343036076327077895570105943801518710651167585799950694909721052593057462356318582261615716693241644865070852894386957557579428336821004901863993150157499885441315836629140378243424067292782630058302855623369897584166680378736284119663412143881742140461361306675672118375561684500807533830524476726884266191054694962751113539655435727972521329610732240909280735708228480750930150226583351737696182711639764958097426099554995921762324764968387367006643004037013593837742552778489101189681998263134753899520604701313718970176018289465390649251732561908034755392979210100206706354006448135056428690542195439592042574114357901559386110762176368326458844181123228590640318361686697305408158142536747065528132296806468209807840457105675518612470245610776694393440418377981015311170038436924081564055374311557417607093\";}i:4;a:2:{s:1:\"p\";s:1233:\"779953292877005240445360456315811451093989451217452508030860903937948632517232564194001045906512442404742197613232702463671198472445385875490629026457545647187005442021788241311030738017425249356890025141343078528260496749924672452406075112878301736302556131136239278896535599312350677308329009917219230134305610628444344974394549039153542562509186659886824632357316157354854634051235545971442610744661953164839483107009009346767308487792275155082094139336899974160251049700780808146182664975496208843797554327815374841177775475470753571939373950219057601827618515306432330286536605787954416979600982555100385472096930721178791752512391165009133875211243325504566536842828926470993456873318478637441852889757460147342402972838846960221083308995652368217350359415335244963047436742701143102588024677465021067291625650479124825035107916165897366503641946561566575735977405500547013903880111234392336910724291341358824517576159101324393315463915516386113738376991694655518288249372828957784415843462949902880245560891397892739131312020213605637230016009180022550903701034602194339314782797872803409177330851533187493953193297474038559751525473131866371264573532977654516287334052810240609848244155997212833756639636272174820013396312043\";s:1:\"g\";s:1233:\"294584733932594868401273947792664024465639212321256126491249920101434779155955057195485698239924329017461116880418431580860690198256687586504932112771781527472902014259770658191419896802154650562294560755398906238871084453999743924751028154628422747846829629577342744556227521070771812923096114099805415935489724190764717281018532343462505964115811767991916636980116921636821712757318995497860585675395280337515465551865043288028388574578233488702804947437573881111837814063218842724966602537516781639806659721586014263202580079042963974436751247205517597185932576168824250675087889692132232635851385770662503832152064206896620142668420989011972190212487528435737892772025331837080715980029846159723498651207016895785824663915902233384231216633900413873894642363848877283294953641356035768665921262293701560382755702158565436541711046082853970334353019909184715426280874888137220636901674190665606039457943452297962490049336271214221544690306494924629862233459637759750174777290138782233739753168070900498570457956229850707058644987113995715716956163428588853996972713370837440713495127681927259759778516099666631791678009695621161317044066516618587362656131183202101424543589024791455207942352815475983543287919183904371032203398339\";}i:5;a:2:{s:1:\"p\";s:1233:\"873380532309522498799467076047576421250122925013979664660390100404370691501616536937612181194210215385094308810935516453355032436029463448084830096699391779359746245438975644149556989758362910981654674205999214419876320686094257700096069549948049688283122733439454755828610162659438827932114026255697266960943047298243914159409829140192254875858839248819066768167056622706529514987599954487323063574290224195367474347078198738515038011001166838478656586521264779718412671705536875203786037169126817703863736311251017581772657197321869901340255518927881204882068953687123405069334086588782698178808285142618320087139859152633355749618171526326904396259187880016434290866497808868783791697806208073482750736837746588717407322376245045837690624895530548374670357643053563615977343334778531626732690936180455182800428340931549713296236365125878591019218639946060377486219755483934599502713465029361440021225215190440316806913581079429713281130920337109109968340294505380581259509433693746584299063405276989634968695476794323908106754680577112440836162750947562118744950062391998865341718636027261902570877972713001428190326234549687999438140714044285074849887079302464721442624737482631924677458635638691593298803949298092379596527831341\";s:1:\"g\";s:1233:\"758266979649634750053202088910057283279263674287329988444340052724311389269193009783562375537401202888776496447338931775147711904920703696827537283963175676021760865387600870343858294395979209162411359873732107330784778462979646046298376965266583951503187441920319736964543046884576005781229328830643625640871783366283976625042564380610348916186645415586569404224977599824833363040472887288347263098569508253342424423209373267649416084905412233426458631222763815788848444066371125839088516151679822191407136660334337085286564713698597688507583147689563443525745241725604049001370465316856947442952510085242436423219864605864763869175481815324893258776941928679506214789932269935689301480992417308141107873076609787962472466286175746092824143957343107665553282526810645239903262112859746320942900955250909496627942784608117271955850658074366406923494387446533368326132090056539030150773913311392872050216434914799631303309024899984742422197090631532551201284028292062615924708408971882417466702084021943910519367667033612963460400727150084937048056426226974685862850060010300637268188682632116677120260511128669920683716643222316216784775954581071726728409507558648533136253212792396324990814732244668277612263108239074228022837043532\";}i:6;a:2:{s:1:\"p\";s:1233:\"820540721170757832244069162337471103623476021288701868127073481020518513764059295767556478640853661563409236622968593726091778348462161731928507571220398659730404245516726938439362479434547886117679293434155700084261057742021144960140652439772307624387556511736993557966682791065844618716738649097502276329615062219346852005641718697097097782883420200607919883986913139144488591155433090758531204379002847725666813781986224875075525417662853261153741581543945607777600697564688846706055314188654847180395320729670567990844583186709378281514284364374502984746208421004209976855078742522453310734735737052136742501777211668640816493194978901543793480749997538280229075960668940280718549909630114855675970884623264971311921109961141316437324535007215935055397677052785648645456667555930612714054437409386635240482069841343284036219292970440424707137408141216995364660839297129208485540357564963189115710411734704844257579489044129249646178130436474309823211871068594090095315504146217773952155598284329651162900872622016533557355773655411235665998996830829344059040931938851410102323668534202404592220853769884490376176406448321479680685841476647314282691628643791285643103333090834485277249291561189117394793678546127171798204363654999\";s:1:\"g\";s:1233:\"118438406554222995490123100896296072284476073031088381488498100505936955217546145811103101447658588862960079461001008094514531078825948036459975111330154054589791767944033714605441782562062020628113612970028611082098688775801631829875718508746607497972977201262883699047004148818835420663835134558082957066615924062809011642757377022828878035666649119894745815340510628666091903865601281505273374757023093390516848399591138012630325640069208002561071381333590271743989866484109505989403140432055596491271598758797334321842809180542487085303934698164071964097112522597852061996053697857136401134388466996155470013029782309435510931657620253973452521674683005646717477525282015675525891059896139716992911364488297600566543965925779727906128807922294910498484009364961002440413479277055779323055505652009751985075907895769541993201483122796667893573417690154430534732977024551262494631887093900032773648298216606625817339752505700287724821088277921064166742115930436091595435627279838726210384248484480417510561899496786492261565385112614452310735454140962760476036700738713148978258062283302094173393505567783695903421445729783145650782376241212257460283721766165927127583979756408547158718516467907168314631126296626106399012896760922\";}i:7;a:2:{s:1:\"p\";s:1233:\"548880106916124787718235316361844096017242216603144403144526114223097660636847718806216931324619711022631163106062959212363723195381526736692774612020061813829653306315587138945343717432435992013532097990394527621633009800856598983072366070314358447119040980012948724628709116117189707683723307181824637091772814755053282879511298615833481306573426566522411619387127602920750040423798107009014518741868275044792965816427462488022038905991612182102118898508410762260881010537117030246596093467647073714239550895596975301156766220816241309120866613668394836626003142720617951812627374838731012619830807432088483035236114552081985134001686616174564504848954594625921009676332389570256971117088453225374248443883042402429145636745540299177416612931459661220551034168122804916804973490302014018421895277362958656026655451235268564523782734034433508796366066821960530130189148245225555293455679309843404439477749993477957986644877057108538055208598606328427797655589145872355278700781305267826336108224166381248845658241915723389086597462010302103075341521420559474409270384789400219607597088319673340147157104022103303355849529821376234368920767987306905602181039769947710244590335945964599542795685010716255387218781537486891263221112927\";s:1:\"g\";s:1232:\"20223802225175087390897343320850575259412414582365900258163921641616379893820296366341965682900284907062971541417669673457029912905561753659662613613090408043698061279146209902763900423769234184733822405191473776496356217897290585702815784533532924728422271924212069389174850591443519005141285468141936966795748739746034248358086369040187336416304433089873610665670760525566546042619321022059403832424205289997775771777077392551377964858245304204808213786438590268481000586378941835211494995867689519660734121997341333890748026237318380388536238585862179559150130910003868306933185293566103091846923761609579853197184300628029650990023543293857997327465196890887099397843846926207481876351313608621717072924306713736639971952766086054530863325280899405617010066755700194504014455444107107295775375562685525186934121122525113890027141897356852125711989263516247264495095845712242968433910070550732088599140024829886653846928059492507359211886677228369134480549783244558011064095569606042620727213670092676737971036510295651529169480281747758154694909538028297129220048405979644814548919795425345058267606850114959452152274444230498221536709933406148397862354884914628348944049381266955798315160936114361289570654433854369533954705453\";}i:8;a:2:{s:1:\"p\";s:1233:\"859827209309634451406960567644664073608247843009655590438711626451994237792146991300287173183043087832637627357885878113425166419391451008964253017859106980949574755089062271358548272263403399922978216835737548298249861310607947556415556034302868558998860823948248446165422188547363376777494491479001516098330954311057697326851394720625724257100394328957986761641854606124802840570257773148816822354261738259531039998883429898993869241428003530214497814160450219313370173133235288963953099531623951947942169808487031628056100171564239864604031521909623635333747729708835356234693587117939763260100382872254128184803886900010111804500416269361475869077112596601699591963646940856023853064774037109855507020286576768786457719852203457601105292701917411355358360008180915826892620146216804079957668181231970467450738195144959372918201556192737905591268849748076849450465624438990383848388275522080203010234806683065220626452401491930502782559647732413722125655004274543457237315659249933066729897683797374439150414939169958117731633454400030620745723935086781132522371020701818644268478312923624781333343945370055592257510945893105577926435083566227773496745193530155189970622341845201168222461416348334380933548210599367604096086090031\";s:1:\"g\";s:1233:\"230387772378953200845430198621167578746427053857106869552960647982050572318224374962229729318382112349267315650146357511077064239693374841128343219797847769239939047378499174746908607350206935258194400647418437285235785666209175674200174882847856952420858925389347085326991590694347827200509909061693873973915463890445184012205857463974897571179795852429001622101699601936358287818840162748385632350581228272919083408646468775495034986097390583012810402185490450971630710284503910731398608923153350898329021751448849831559422869933412530221683796013852820003288717846727373190487598011276739172626606757714413110493418580840734528671851885868087367383538346546521370562466473234525297808335768819817289553483678988238007207218147310439910350927886998040664415744527590859368946235772414353195300301484941043822716434443980686904246525697288828638259424314558719281240513234226046446424926580782853900132686543224891646005449948001898781977906166963632765136243677729469730024277517040955568038819858727398039755661112182198876426968341181157078405926004559691091955506127027570276433391539963453802988248330864677240591327448955479631777762550975509046811958142442397739295068221957839946052657640258744394034254689987292652633118456\";}i:9;a:2:{s:1:\"p\";s:1233:\"888312033166526127955988426442422678810001433938919113768864201691207447938480718447651596351146287878452273934665645649043859986405865705632170182974121295125900973569951205769031511097530139546014516646694527186005154450959470448708609704385453144250688731002305363223573960088284188348397281059466430645442685657932089330915980881062245603052940096217287240951726953877714773688854411975063331656887351628173396825718989000406598772820517406925327492499704674327124273792263395692578753695346195761559571297125107450248914179643699672490810996603297769572128091365013688121379583975298121444209456702623405799745174906419004760101184026174045940728766575978641441869213635347993806018811545320063737880875998517629287431368427977011917627530837172234644438473851135151107087912257495260349195961101296828898638793317970645342060752102752379914647648982128417274843039283608661648219026592816346785321387167878817414981419419109227388794463755064739517746832189499096571596122425045771877069000145569547426530405158751547675856005170654409360257831905487455222746315928001559373872546190045505532925733851120210509137898153408570417636527268501290792622044295041907691504394440632534766052125617415332728563802110065175938856406169\";s:1:\"g\";s:1233:\"179940007155666987540991580117873048905237006140702783008925780163608019168731404115337759870972800567200300584668821703145485990166058723838370280255537348989331971098418891506333674538143418541493307265504601442115644860526047208656065911053559381591829532675505389980301754938963454618057645963093135745943859171388965425195072355354734862364577087825126597061480149259128737757766041549277714314756340773240381942891036795710496353770795880255238193193675461414418611062068106108271650728114837783741653035474438882611428736402606930331744059645109969995029237833676333163067205389180550109628679575668654874209389529098631801939745991166555358616979680709353058264948062368326747488955208117566150951474211785455860405703903272401304341357674522616532901106765444186621390538280943833741378449548964875421462545231416352716424331619372720208068714785982701636016598679429739914643836865937850288574299335867496560628657668315502567636043263564061553699381494881150855325182573643444832676577058036350069847284842579105276011204912451316096773591061234269638903316146162987031233087675096574076556129770577395455575930879255275337135879635066597533030050445119968176495966420634121515158768748603982389691514447198255614191166257\";}}"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/dhparams/512.dhp",
    "content": "a:100:{i:0;a:2:{s:1:\"p\";s:155:\"12635450358293578591800910479487777169852570312773787057842183813945647605523761696818335430966522345697375443936716089896542284956173599541622185697564549\";s:1:\"g\";s:154:\"1090854334822591173512321403882655677941000410006358584565839627906165764285596682714148816933751400742491135486102083999660532436748158623509010992217103\";}i:1;a:2:{s:1:\"p\";s:154:\"8330760522092340606922532684920340313503428366729540863298817169536290179928809471721822951210171987458145792759861910013392392898179284657620886263899271\";s:1:\"g\";s:154:\"6322863474611806100787478309308593694232218046926780926157713238112945658789791537699650366897949272407498804399412240425281933264987477691262814155841388\";}i:2;a:2:{s:1:\"p\";s:154:\"8467874047342751270076186270294407678529363428805356804220110177077751064916093040050731559077353309166409798407787828591262171218833842208747332259453521\";s:1:\"g\";s:154:\"5298156252329153668622137014101607775181856989956252615676334754324796406326471396781499484185229408185326895046610970301850604221548807384662295609490180\";}i:3;a:2:{s:1:\"p\";s:155:\"10026784872744220323680724914118782861052640191389047036503601439573675679926077705354387433852018744814013072404781629568137348655795687816934596058584847\";s:1:\"g\";s:152:\"10063798484541132819515158210832792982361584205561672291343208772351650842776011486282636652726979910012481237423361696310602577790362811857800630406902\";}i:4;a:2:{s:1:\"p\";s:154:\"7500541218184559328485097477496345783681177646248979806799560614429932165977127468017169371472813198043940205643917781543605453184159881626674120202563821\";s:1:\"g\";s:154:\"1020503261486206285757006767534006757324059372861763647088747846559779377341132189129602840152879970678542409250058810084771680171886011520305323008135467\";}i:5;a:2:{s:1:\"p\";s:154:\"9421424414532091516477140058802411356679254508253599986943994499257134018040507972559527177142254594456040810388699415500836699209428775701629705371860561\";s:1:\"g\";s:154:\"6848477778913663314918103728441691200537498044773698707353425996552338816856928517120881637989820983228451343864443751233482918115252865173481588049824707\";}i:6;a:2:{s:1:\"p\";s:155:\"12625090184529797788931372343452146117342437828850959777918103886810506314889293815712889526766165497221632236033223851827026122988601152832751089193361883\";s:1:\"g\";s:155:\"10727140325921866071434631280644720707882009137514697813586556234846801257052393459470630845660422299001774260577487303758752061121714260768222777853141984\";}i:7;a:2:{s:1:\"p\";s:155:\"12898044345941449918247148733336961514367567256908845520876783894282207825874366689032248149016261412283181183189727919676912955124747513289770528539211973\";s:1:\"g\";s:155:\"10413358542022125014673481723329455076572467663802388402671853913744650796933624754409034882623123290639423561484943927800989572190732045719446742609758671\";}i:8;a:2:{s:1:\"p\";s:154:\"6777052041803887915352631631866770331853268073456153981835163788577587447533080824375565106867410180683860624984416024143310816156045498552624818782848227\";s:1:\"g\";s:154:\"4744373199110323775270810304030071313547127720868525858779013596635157802120581249858087010372177600991104126554407085337043555855358684723544564659511053\";}i:9;a:2:{s:1:\"p\";s:154:\"9769160763507178719431472328465896638866070854349262585438598729016988304121111106981091374450169009893186974644229636740814505506061744049970923730299363\";s:1:\"g\";s:154:\"5306950778367740573813655888374071857932353520721926940261594787573952929063307075086373819957150491162555430648336446419164220175136517200280804575851945\";}i:10;a:2:{s:1:\"p\";s:154:\"9423922356452712235926431203949703505484363837432274466344263270397520246404630427344391380890647616716224065056313395456217365823611766528652509334779731\";s:1:\"g\";s:154:\"7284089318298927178369679475673984622736731890983895175801568163798062623992936160960700756266264018534324483109833512513653743438058543564254601022875131\";}i:11;a:2:{s:1:\"p\";s:155:\"12158697138595912393903417958876572941964664917580175572374295322020219160425436741258520156480547924156012167437702643658539038327940197818126321370919717\";s:1:\"g\";s:155:\"10485764511219481318245074108282617920786103320852119973254883572198484400820180431398785006356928094262884549838937090554887145629516730528770021601199635\";}i:12;a:2:{s:1:\"p\";s:155:\"11288262951687963487272915907738107756098899363507394921290195349495485564247336439679451732281925028547373038129368449917374094191854311957106769832324739\";s:1:\"g\";s:155:\"10795654841855911955259186695756995006845641223782829032357886836809228255968988341551185869422037966120448459311717587218376381600148084639558977870096502\";}i:13;a:2:{s:1:\"p\";s:154:\"8258013926861608902693666790435473901190984397470193086801654424096172395830149441450824019934937921913900532126490754455661483636320695940894486309100319\";s:1:\"g\";s:154:\"3008616177637279133031542021757712428009438095597380460281736563913664528107115803598843251661751953577080050168764629090444516020745052468254714596181839\";}i:14;a:2:{s:1:\"p\";s:155:\"11160199081808027573810092136307692486080233663688728390187641807815696851217963593844145812064574876563510827726742554179620355048682142887956081871867257\";s:1:\"g\";s:154:\"1619837079954439123886151787080634070642968038154229204074646704930777938542872128065694227567105405734861674388284235427031786560892701529567221392315960\";}i:15;a:2:{s:1:\"p\";s:155:\"13374835067080888087044052135412597686006650587670271902738259960071812996976288241935082708129322038538611064744176497997876042066574823204776272831138301\";s:1:\"g\";s:155:\"13340606588501124076628104969616489544340701319544045041774387943804131532921423414596496104136847181815135596116949133855703919233075041766993096626479925\";}i:16;a:2:{s:1:\"p\";s:155:\"10259417180829818855720989528633519911845188087062317995276209738349065624107483004472651091961152483138484988620800791800438426039507470091955049905098653\";s:1:\"g\";s:154:\"1049652929312544377789554948223774743652295892011706941762476151999449680073160873173568005327063467021157128914200838440820265756300864573046947221185244\";}i:17;a:2:{s:1:\"p\";s:155:\"12197220246712313066260567471862904022363676477669859142286893009035744818051867274541212248368880572818329283821354454749617732729091957316225342433619041\";s:1:\"g\";s:154:\"9195882220497133783800026095688409134361538650124393293576388284972490669069409211646836028007865847926082128016363741865516430294771664900425136610454335\";}i:18;a:2:{s:1:\"p\";s:154:\"9407346240609426328525325968151151707707014342802748859768109084981503050961487104011635924975034655436053968429389536104159388654521942683831677615143401\";s:1:\"g\";s:153:\"269136289076872637342985277973758915672118214120214013887252427702020902794047992188076991724974378053740684811995916618340797583549069883395774393139072\";}i:19;a:2:{s:1:\"p\";s:154:\"7198840437082474958207241444655495440658341081388025505383172136119655067017904561231782672226505829024686555846885360605543609008217831214021594962047499\";s:1:\"g\";s:154:\"5788294064840240997000762465796620865513656066684696204990143434694734867188136493805370539272824995064240621448505859749288014816751791686163112546388721\";}i:20;a:2:{s:1:\"p\";s:154:\"6866194853453717341652339305994187321675925277246174296458603441198214649943543117403779339651067547283653344557161527531330217059862310916864636517316593\";s:1:\"g\";s:154:\"5759497540822961789157724255057129836025195265915136491003288014804506784127978064787500439359522257641902804614292542461889892712639086813735742843987220\";}i:21;a:2:{s:1:\"p\";s:155:\"13177952285079954289288219353117192697114703824741144116451428873571791737905505015012885197099252856045557518662942292101548687388076187108958765866077683\";s:1:\"g\";s:154:\"9673226746946894107616895821956872413994230660337172037720955022401762991975117923943964348541091994823989550807194860840353142963521466169754804620360804\";}i:22;a:2:{s:1:\"p\";s:154:\"9726690844491319103464486780397647954048751456431741632228743401184876861409583494228681662837684390382414485868883077196073018443343045173438676499145757\";s:1:\"g\";s:154:\"5966967110739915435125301545444105458697696178343475816618093998403883224416672950999788756580845547713539753295669176121976165846909930535567762639907762\";}i:23;a:2:{s:1:\"p\";s:154:\"7538490325284511136438120514170901332660801432732962496569525567553027443874560165216900989420584310969224440183000809313672232345892876810847904438727641\";s:1:\"g\";s:154:\"7398588641647314497767960339642029855458293475276281320039206004717386057103164853206187216154556795890067697653797260673588174257620930150234941115115435\";}i:24;a:2:{s:1:\"p\";s:154:\"8227511957622243129017210866215270808821806440628186306320707299109228484124050243443975192083115132467163269110566007486521957831863442617410859421555047\";s:1:\"g\";s:154:\"4645421224570784791175061679645751599175479926670667316335993032125249320593256905424556589769574858326427536748350447673974863425217426168147452888822540\";}i:25;a:2:{s:1:\"p\";s:155:\"12969731233552734399451955813691983006489496437250879046404503333930582291424470873903975608202652169345016278675568320752211824525170925811649178464352817\";s:1:\"g\";s:153:\"938872877916962648295701614574225970657013623191360283377917514779152480150022786122976960582953179872490158223294764793608858216085744934431578995451202\";}i:26;a:2:{s:1:\"p\";s:154:\"7065101156612109850175396041310880729801403367529402357084968849490927526243609086812440603700483174051775685576622326237843679578065068993344357800448217\";s:1:\"g\";s:154:\"4937530350574774053213016732051414773210465511366329302510484430930527647927154764700569414698805939709289334712316369800090809356945979615643622500590944\";}i:27;a:2:{s:1:\"p\";s:154:\"9253655433153614643720842168059271343705755485679437008857639916129766802372631673001875065759695231827514244486797815745404273060777672453756043236262029\";s:1:\"g\";s:154:\"1154118437300934998774227250622044065593929966410917431580654245142293172499153040764142683392788982103025598341743372297052182135492043939517398219789131\";}i:28;a:2:{s:1:\"p\";s:155:\"10848941227439606569547554892393736362241960615699022840700246817110328822098080048132085826242837084787893781138643085998469452494458843729328332326851689\";s:1:\"g\";s:154:\"6902859949879581005679923246898018564599068520211447542005819640293730028077262822771725498401630419852070831081835541856719611229878798733541142943533883\";}i:29;a:2:{s:1:\"p\";s:154:\"9200077333219147793521004610524679062674643522045639269053512698250176480683986701289170789423917221585133322649795623553739174854764029015889572200454847\";s:1:\"g\";s:154:\"8977651412120081362159327030461431226433763741949269801239273477011043868326857881822604759965174367075681004085055927709618738280729348684607803671789563\";}i:30;a:2:{s:1:\"p\";s:154:\"9845889841943809768314162240613991788670164846635075878467926914087289824203165472268700243871440856079801440647968535378326278137434266496758552114149441\";s:1:\"g\";s:153:\"768380127191918588451951538282124996101009829676972691355190870417233807246391392262749483247926691107794065287711515912136355133371195330982913655254406\";}i:31;a:2:{s:1:\"p\";s:155:\"10851556038116464699070134743443581537292976439813478958179597826025549256396071124532860998691993456204739775754896353442062816032468483695456073098224443\";s:1:\"g\";s:154:\"7154655821774317099112947480129446469943441624481944724248657240117509097398430349434092257615286785331672319149988169019804485357174356309508341925581460\";}i:32;a:2:{s:1:\"p\";s:155:\"10869657909548234771846150650291496878012840512716551698067888848900961777039246759408527968486607410691927237604274521227153796970138251173504729332398789\";s:1:\"g\";s:155:\"10291105559439086106068351955856024921898095091811071928018974509667715608106121602415100275088724582034560187196479349479678559477870893719603456159195978\";}i:33;a:2:{s:1:\"p\";s:155:\"10573437696614927150153411773598147086432503243232815275356047074061503243825728675078417236624432478965385334323514782803366272650302790803029448946823233\";s:1:\"g\";s:154:\"7936375668886672118414744836005695357413671975252348835029285378278952434975164206158622984806431933596144888246146817078922796519730755404856725404012843\";}i:34;a:2:{s:1:\"p\";s:155:\"13143171580350380026719039436106973235892599539038891512396032568425711518490270801218225503291537102818964594215730219661054646928963320816487254976744691\";s:1:\"g\";s:154:\"1836103769949406432524468270712251041529485560856485759774657103122616493367981405292392684433227262493977758149124464359857054953465532851417935109678443\";}i:35;a:2:{s:1:\"p\";s:154:\"7817302659432711774678271020951750661333508545555444370199324820069061693710307039108112542055446182951630431053517684537459614899603725855479805738841609\";s:1:\"g\";s:154:\"7757617168595337488906483183749388091400069439975888530757208331533789508118297894470372310437202386279701677376282517267115753765256668381319564910810130\";}i:36;a:2:{s:1:\"p\";s:155:\"10267638897003329507809180547127091069117459439131395063369822073974994025258244541686493148512939652836981483431348406971826886416596041868882198252892619\";s:1:\"g\";s:154:\"6318982256606638444633601562064159489075575174603097104256876934574261058223900542813762735674188095550436482427083800544277529320265932517969479395835823\";}i:37;a:2:{s:1:\"p\";s:155:\"12782270167325061135937860317489559265180586717318292561188420849531526268171146656351667953024693325314361045908253754108944361348578267392530709664122899\";s:1:\"g\";s:154:\"6991882797209611054389481268465012367881121070327860241481617497353801116278255059623760999675401035064358235967669879053837015278936160705861718207391121\";}i:38;a:2:{s:1:\"p\";s:154:\"6731746378775926601744707878575045310304903984312892750608776725022937461467670920174839890356560754884661025202766992467602158995844691889008414344224541\";s:1:\"g\";s:154:\"3107823960825199229883719178521718215890020223638296208432989834142924789012938848961473436854962539008488662480251097171768707780434454808586850672001591\";}i:39;a:2:{s:1:\"p\";s:155:\"12936328803238672147187839312904518164662082232222521593614447250268808716877423911517851087146464538417134244477088458475508392413636215020245161324258907\";s:1:\"g\";s:154:\"7447543722174178404892869118079799709872555147821056050425166323624947980165009189566361641678758361204234599663455436346048698885722709733355889383997433\";}i:40;a:2:{s:1:\"p\";s:154:\"6805235710264138935232477664965736357729175546690091123374832408969916363561953404703570650183363313073842129895601843542765271167068143846210532109518801\";s:1:\"g\";s:153:\"241967790688726611630572098692470914343503786718983020603841862948415175119950819174453647688760067799745498226298934246248652993245529368369008676676018\";}i:41;a:2:{s:1:\"p\";s:155:\"11925844197021754713938625724053020079683404084430371438453593710522808327354502713382757227379820472738869202369687644194388842222036179834354431378938783\";s:1:\"g\";s:154:\"7528176863391682294380713557224125923359959500435147592233747105062733195022505163011428173748825139929898679320548103280305894663549403454721549617429358\";}i:42;a:2:{s:1:\"p\";s:154:\"9382690276990287517827126224244262351114680532057242635224428485844700880422684769081831064853813380043190717893849784787292907965292841355010043199008079\";s:1:\"g\";s:154:\"4417964586244527620278956236372028881588988136518683014571128129892304376472643463030713416286758895907125650825241924308538473496809076762137861615651529\";}i:43;a:2:{s:1:\"p\";s:154:\"9471154462532162517766328483693871604313875211507659394402991024218819931898363174393334319225827831532975054544822369032247496657955428463380077541101259\";s:1:\"g\";s:154:\"5965538882821744183392517506266542138569200983176623099845801353014368375173891122156750085268413198483559096542177405738857144779702351290712050408559721\";}i:44;a:2:{s:1:\"p\";s:155:\"13072215397944695079140981714451652254088635540701039783436079695923305049093068379991778701466866177972543194919692105571905528567819232740033043049638673\";s:1:\"g\";s:155:\"10905047221675573837388440719936929080266693676579154214910634308080954138288436777167832801892265852331340567765314113894641600068009717791667699348623183\";}i:45;a:2:{s:1:\"p\";s:154:\"7480285736902516363853550609483667417682147640058517333104942696093838232353278893275640726749652243578126305790444323950427003985719449351376634278699607\";s:1:\"g\";s:154:\"5759202574113108282378074864789677515288689767373583038782636582841406886112443573385070089778091622751224484977426735366091834116401247133594381805961184\";}i:46;a:2:{s:1:\"p\";s:155:\"11210622732047339404024840714095057225603221198681717167542047064110330442742534046349520884675080911296315861922768327935094937187075265506822940835040491\";s:1:\"g\";s:154:\"9937445355915956411250765024373279892128473056016564280984522288370978119816479851683244809355434342145980557652327529849111557653417852722522293792146120\";}i:47;a:2:{s:1:\"p\";s:155:\"11801310588884178766890310177272733983571198144791811277406602857753312000312219119681403573834767631910269527394416551781151894475252738903890058726926057\";s:1:\"g\";s:153:\"115233390078503737760155084175025767812358241323488230712385298533454103554091397194104748384437484257038379362772264874126271752877697308310940114682694\";}i:48;a:2:{s:1:\"p\";s:155:\"11529048347164441615241543804181726496687154791825255459491001491738712611956789755646436546778690115202840049658389496893606046846968559040105761862357833\";s:1:\"g\";s:154:\"8676718751750512425139622349225124856609904480931707180008538338879230401203724388724735695303409750333477100875898619258877552431088298574108470256276651\";}i:49;a:2:{s:1:\"p\";s:154:\"8827072361630078640503677481298714879520924565274494318798943013516047380949992422868188730738867101711789222674209108748980222387508987065854715881696721\";s:1:\"g\";s:153:\"710141650554525884265578176992152766513903299812535725888133858445135487452789266334613419128201502959244491496639163675200761790924208942231383545162770\";}i:50;a:2:{s:1:\"p\";s:154:\"8630916941594181725869358635738342312528620650119957199177838952748463935323817770626013179178189281017124138873993517599531749107153800962022777179165821\";s:1:\"g\";s:154:\"1986336010793498690402481692272896313437282310385967728046494523738961523190690879475912743848248541173027205997086416780584203636037838333529483182130644\";}i:51;a:2:{s:1:\"p\";s:155:\"11212951383442456895282126037644720256410394797566689500132827435994463195592391547284657499757312898540967392508953032317946768141214910975547388177983241\";s:1:\"g\";s:154:\"9102763753785975341238925269544891354476061894654740774463306793322852969775784700232809270884694129158803996346082108913891287705031439828185656228063664\";}i:52;a:2:{s:1:\"p\";s:155:\"12767327655173767525498878790016442622970607684484683803036559177746978436941358536992037285959314311977766975796863190178719754731248258583037178093445689\";s:1:\"g\";s:154:\"2321508310733831420610044896604432882237136641393324233389255445534691813740197943289557007047153528108310525898070249540038163869248765133282278627312806\";}i:53;a:2:{s:1:\"p\";s:154:\"9392193574475555116112128582962411207901765366075980992046837483678270815467145329834399000077307436597284520617068141836081640163188636250835029441308703\";s:1:\"g\";s:154:\"2053414734576510953913507168402536572703774315964363121175715888088663285442201329865875872679876866070636146795229156844380127153406257025394411611466483\";}i:54;a:2:{s:1:\"p\";s:155:\"10376053565026787172160955177540422890317275023121997466989774697279488503166878624289513515797363103732517258578762034755462542106414254692746603234671043\";s:1:\"g\";s:154:\"3091638708604907776624878044604867414422955026474038166435429554732769040827969143023705222880907519792943547859810547871406751310288694469049761930481334\";}i:55;a:2:{s:1:\"p\";s:155:\"12127207345651068820086441964683009352696585515224185465037336419371181638231683584846771580814035091125796069601976365004662474480234541458668882739890721\";s:1:\"g\";s:154:\"4438836866160593665451702269753991637431308452920369244447683669705293185053449743730564137227007292403789550790345961175603642284391097450268685443319770\";}i:56;a:2:{s:1:\"p\";s:154:\"7611469932440564952211781130439214876690796015869296504681999249251840940704296297777681008004821652510091526923191561988463222032574639564147602004747471\";s:1:\"g\";s:154:\"2159962031347381166014669527596408113229438638278373884502632954091486600988300593639831501800781269214755396360742040873940950396505283507866134558622775\";}i:57;a:2:{s:1:\"p\";s:155:\"10333552284492177347867767760312106573829849938537225897708798295607254551687795282788443586091756110932272161971955610887088234617195976811351238892296089\";s:1:\"g\";s:154:\"9432120129743475799160225256016334679238139039814424474076543995916056734666699428293793667992690869643795593704757276260398200754011455643399669925569067\";}i:58;a:2:{s:1:\"p\";s:154:\"9186129481949759777879325927009938672103591565760527415665011657111222110694633491007638694742477745970521733215626485356625921552251305212419767357335373\";s:1:\"g\";s:154:\"2964982199072437563747659648788199572625987178442645806407700614788045759520791282226234744641146133332755273683835703308793243169629688414830111305979008\";}i:59;a:2:{s:1:\"p\";s:155:\"10797613104193760920872576604739145039329493525174523870041853152276384156721978899427111721321741929488686066256034450841507862907390410840826008764757899\";s:1:\"g\";s:154:\"6035241474954122155355449752310815638886484205153452965392586944818152870488968107547112916728102929919731151220028636538954686722015297434712965657407685\";}i:60;a:2:{s:1:\"p\";s:155:\"10869947620920150461498689213804104931914857611354385578667238439616260825731378948972250757311923193938060849629181090857995395344904289508598143935730533\";s:1:\"g\";s:153:\"481312849012587203492378145862322149972797039844724273303827814567785210878799018651223527634096916030584780553484801818224446855755022386359742338412793\";}i:61;a:2:{s:1:\"p\";s:154:\"9231592881895960498562751568063478751369509815551906815114331855768090862166893258661806160199329317482836122183454449679798480059718481696000432015512777\";s:1:\"g\";s:154:\"2829892719013480169078067114400764737378051603195046862786323332593085589593735084661704693548639293287833918450999392896600385474647941243068301494417304\";}i:62;a:2:{s:1:\"p\";s:155:\"11535970726511268187759588980352242649579274403126372273895202586422537522913796551110927374939006827092569052666629425089018374179426876981117710901583973\";s:1:\"g\";s:153:\"720418139015023065849163498841056558473934556153974761688050291079916546264726704214062787471591074325994224916038425383512487158259629457204721553853210\";}i:63;a:2:{s:1:\"p\";s:154:\"9861250489623369880082921468628592177502408573205130594265711247497202978021917937037715397969536963237006852718089567889086256038105803931322547406120933\";s:1:\"g\";s:154:\"7928607398515301999160672014700122456116839205946040598055281578888827533359690175257847840316486463480345797985196608946959190295352354947490060567259474\";}i:64;a:2:{s:1:\"p\";s:154:\"7037162688438216114665334358856972752028696375118432431917708234857066416666136221875422755517254911565532179808653486394916493658234167039740176267876757\";s:1:\"g\";s:154:\"2561520364124680347691025622126585934254249847396300180215790279361782291723253986299677678320409185303548420368698893869095720049051592101538317786377366\";}i:65;a:2:{s:1:\"p\";s:154:\"7839643405862034358064924109902483930026968378388305680529567643551318111486398801706102322537326685360160402095895265466777644277194315986891593712906963\";s:1:\"g\";s:154:\"1754075447965545218123602315590932259411312929973677438266981091131327486934951256423337377824430217299559456308536359696603306575468489620694606039087055\";}i:66;a:2:{s:1:\"p\";s:155:\"12276557742146258743545700501290339960587405224847731100110687472244791172620101100818159279506090655569815738514019088680091703230258555911540799511122167\";s:1:\"g\";s:154:\"9763861375914985702545750159977496193065161335864817824882497327027580874802416052039447133239579968682408646209369969884977946436819534940176606699371008\";}i:67;a:2:{s:1:\"p\";s:155:\"12230683487619319961944453143151691985882065041735379665065641906865391780863710859120672643315553046872854392378120553560533025057025603898136116862293441\";s:1:\"g\";s:154:\"6820995666984101001799315333640660517853397812362325663701783101362074754987943224840937197351438492534345149997665796889093780332154865629423497020827741\";}i:68;a:2:{s:1:\"p\";s:155:\"11000033292226348930593094035262737806366027110884679994121757708192645734655143882773568769558594544920179117149359550596513178815154309868775410035186063\";s:1:\"g\";s:154:\"4136862529753947481457983021388601715848766598496715256706293038171121046049608132082841396600193873750375804495745944144901236241777071843379368664154275\";}i:69;a:2:{s:1:\"p\";s:154:\"7932184591100186238463385027146880324850417985223577208693360112110160571988870890366119973622332640258222800907861231078259268751127722069064114137860677\";s:1:\"g\";s:154:\"1554704138876266517226317671429037357546114985405447916960643643463787594693776634564098027315293480200461149296363025299708818954818475510231838798211630\";}i:70;a:2:{s:1:\"p\";s:154:\"7247101322282048034402027899872237624187875581686127113817087170324333761059623129858201374439632028757144826193998183802269340811926184660871601027538329\";s:1:\"g\";s:153:\"419876311823553421268573169216133898499120781788412225525682613256066295537141806360606590621846965864647042488385611805166485002563960603496293345101151\";}i:71;a:2:{s:1:\"p\";s:155:\"11142911398132179783773554123504917208536218755896547125640354767247161949984883149299386304638615888680135284173520903886505390416092111250431821534935139\";s:1:\"g\";s:154:\"9421238208594055151718951084399404180843115860565558346086952546158235884494503159881996700939897153949279617132763495108273288888130277440160448079145244\";}i:72;a:2:{s:1:\"p\";s:154:\"8422680718159927137259727024146506754367065291787361031410637379107607885590191645491292131243858308336644590049873216313480699042782181741026895310726173\";s:1:\"g\";s:154:\"3037225857906067024969405118120869481652099716781816854621639587769381797676248760487654420923330399046475888790029324331786276809507475888474809786093936\";}i:73;a:2:{s:1:\"p\";s:154:\"7528768306671922054208185893735786263892447977854351454834071543608211520188226424532595091748227597163991455896141393802353880913727252686305028424161729\";s:1:\"g\";s:154:\"3931350151921122314780347621781962310133031238916497178404726881167123558977180174914812344106371470279071072405540448395936097566056878790069126677394020\";}i:74;a:2:{s:1:\"p\";s:155:\"12030526433315035140469306931173541509436590353351614316003049833737604937265864191109079597264155746863781242435386938773196553243129970574108647558122719\";s:1:\"g\";s:154:\"5262551105713048931818840437133090849709297129874432211503996380201846241562025926981819972075908236266338069212044270892600622047959414321970797115421273\";}i:75;a:2:{s:1:\"p\";s:154:\"9080171192643214261502891314642398886325946367848695539813162167683393701564678191652727167179846621803625336395576968061663125749886477301402476057199011\";s:1:\"g\";s:153:\"709789037747438551471403268717923397174465497703413510328687265086023430744334341908605956975980410030779626052223052305886135189506754645049360807055388\";}i:76;a:2:{s:1:\"p\";s:155:\"13357314213295536619231005838964463646886546298482519410136443596212432187577086765634310652333808405384086750529280259788935338817609169763288472875576053\";s:1:\"g\";s:154:\"3008308424927763972465840465972683289043134099712501524187518687952997991630181328065646578654263728776643235789250693981259674530838112112997801930783959\";}i:77;a:2:{s:1:\"p\";s:155:\"13306050297284487023040709070162991797222204615032140186218147999553682592488789343049675744599654166735159045082795547527989076358395782301307563843028977\";s:1:\"g\";s:155:\"10586434249601338827897130612953689058628048902344954419096716484144284946171236587914481571624702816408228904538974499497771977827631330618983799976606289\";}i:78;a:2:{s:1:\"p\";s:154:\"9366504107760787554107889797349668086646215031128274756817605248155100041596743704559665807463008332333531511834473256899818275789020152578564909838966939\";s:1:\"g\";s:154:\"1296890521931304524803874647584175069243347320269646405477433715522011568052186590990840829333541256081030481999426230636941661307954606245382960948452042\";}i:79;a:2:{s:1:\"p\";s:155:\"12370801442581130353098080816654066418563119020397739942200418473089819692358661047391874663049174382551577117787540448439844491154738143099045780558055617\";s:1:\"g\";s:154:\"6842040296510517190110590627840671391670907107513510853159788693248967480920130462096308897538750871495832060995658519648610074675887202669120166694080542\";}i:80;a:2:{s:1:\"p\";s:155:\"11077894732742539228461178737611889036810177914415299462002747018598080996762211677501351595137719755735664120371063604922683564552553799605879666676828107\";s:1:\"g\";s:154:\"6225665728035878018071502041848578377966752563525174352306433083719321102952407547688689903755913174694857601501432370542759467220859644790183397797684019\";}i:81;a:2:{s:1:\"p\";s:155:\"13145416241730004319539031165266146823267243986800900249243141299249692643707823654148739035496268454712317187086057636031267290835062035878246528419253971\";s:1:\"g\";s:155:\"11050160386771600486586208130647596663138967212707349660963449143590468628618046744668548025343868972693894338641508038837575295198723184300502415519901282\";}i:82;a:2:{s:1:\"p\";s:155:\"11611568192755848405358023732007679695516806149908855592995993275357312141733012806119815203057519665797881047495560403615048245840900249485135048857817973\";s:1:\"g\";s:154:\"2172894898451447223505998543289583996691401210736051190210176057916495037526136335918007793521262073068109566941968675779870206983436603928903594965384965\";}i:83;a:2:{s:1:\"p\";s:155:\"11081251290209313486762589003942067507294386109493000614708203861884888898398271826165859824008399524198445364973890440885137811409580589713737316428932921\";s:1:\"g\";s:154:\"2341203960244595837213070499094603366869960798002532578372599738831741047504816215572635049607899579047269831194426528602744165709752396574329560197504887\";}i:84;a:2:{s:1:\"p\";s:154:\"9794529356504350260404907807235199976002130997823212274470101635208030092724642485892237240499775678153498741626506100441198709272408997435145522469814611\";s:1:\"g\";s:154:\"4344904416955182816773869473067344211044878507239085540617345084857514867492182044106545330382179727507839983152349813760661281772974710240204268429761579\";}i:85;a:2:{s:1:\"p\";s:154:\"8179725484707820411949587770938632194412056798385983337040993681088549942564780789402826043416929282601970567097871918694564510170940044087117293841610513\";s:1:\"g\";s:154:\"1968397542995586956640270479775802044571639049081148217555793019585806722702582989925336399488001038506518632099733588396335941761339893103671679996093428\";}i:86;a:2:{s:1:\"p\";s:155:\"12087064726834740661902750716902641652260658517688573518871909700616089898549798686986902911827362620660139382723084805850119084200144363662168266918678043\";s:1:\"g\";s:155:\"10143128949548754892164655340639862222487020558978119369114321136539759978238238549616976854216342914704256587847974237107728402138497359582900931753150340\";}i:87;a:2:{s:1:\"p\";s:154:\"7029682085043851174454067777276288756188737504360927396230568096724183584772341319344047251994723113430875282707294543179001234168984646917770014120959747\";s:1:\"g\";s:154:\"4793425727317897442176619553703271341958074640466020143773480645279277087286489116954664501609095871678716832290085599924471974813175615478171487329912038\";}i:88;a:2:{s:1:\"p\";s:155:\"11751944887853172690320837788719217620434712863775635748903292970090933885012275919749911820430855929141981640859493347105230323356063850671233945242412501\";s:1:\"g\";s:154:\"9582409285060411792170252952646051889530300334780762047880884513762363910409695547459901317732986407473204516314483633161449064045710936889521255288095464\";}i:89;a:2:{s:1:\"p\";s:154:\"6857242503272628812624198660871703450024969140119354771706428426493307506557602183087871260836964690607891275115676620226659587257083437212153260711770279\";s:1:\"g\";s:154:\"4154176614636529038047455462840427597900131364691514918565903217730506684392008642129862713125121528379202819818759480813600225543386651723083282463528910\";}i:90;a:2:{s:1:\"p\";s:155:\"13115086998220969838551534574336259426013013813655672434628036372288827799419576677363079570500421375377429272681906309654330290360291887877051639171311351\";s:1:\"g\";s:154:\"6891448071394823240466483662164181607435055970033730150995462293778784684581116262176470853429712481202017088873582225144821918813814521448443862620219142\";}i:91;a:2:{s:1:\"p\";s:154:\"8510893906328846244399198669826810612145463386143494241344898024159008867802113613038506831355149788338718550470445775096341446065194196232469619078573713\";s:1:\"g\";s:154:\"4719394317458501452628803829232227857042955736811107024588547171771101148737656411606180861478202429084115956817397010715814289972388887344042708309814233\";}i:92;a:2:{s:1:\"p\";s:154:\"8196571472465634150710357092777366857982237408029060560236952461265863131959217332523315458373970512148516043820292260787541295332849890579530595347949703\";s:1:\"g\";s:154:\"3437715159187221214391366230360038167885711577338021347106416964488193295288404157463558405404279208235567951416122490240147818951965891782937248453137469\";}i:93;a:2:{s:1:\"p\";s:154:\"8450294490269241183361812103611893228339652390157337597894872109035465793517753716542229018535050043417505545852639183614639954904116126769099901623714911\";s:1:\"g\";s:154:\"2888014306503502758072496640166596674896406120299827826475830676072466087934865509880125697107944254828014207864859572201140883165205473601065103936013655\";}i:94;a:2:{s:1:\"p\";s:155:\"11703024906185298810265683615912076101571205851245019004095853861674944958540779094519988491697428205927709507267814990927761125062629298343090366806859713\";s:1:\"g\";s:155:\"11125881782324660340685567056782318502630553007218646702194031293015361721973968471899663504370476122752833733771740023378392848654883871239424202536963707\";}i:95;a:2:{s:1:\"p\";s:155:\"11633995063491596974992159233441627337491540537056061974579863559637399000043290646127303473958433521042069509695166002929024179229815912787160500228543933\";s:1:\"g\";s:154:\"5779716859933543679336004575891528709661168013484215512953570366477029110037380705269852102039382480691593905861950267640597260471662190053628708944293792\";}i:96;a:2:{s:1:\"p\";s:155:\"10667411102370081426209854218278625522500220146272991772930143668007669641923818842838987021376423579429682884160787015271663155792992067237050696610802803\";s:1:\"g\";s:154:\"3279140280644715139321247161992749403889139000835115394739495331799618231418338265792754929717649735647981445732899278350937379309464302481950856909469903\";}i:97;a:2:{s:1:\"p\";s:155:\"12262245462256089092233173409023375655175021466746738975484018042510893911713337463824358605982014894541303198417182824980800641603290435497640012365351457\";s:1:\"g\";s:154:\"6330963621362363210369473585040347344278962099805211292047845261983817579073921701279060419242132775223605691558296991488834271200429761204699646704066949\";}i:98;a:2:{s:1:\"p\";s:154:\"8411654103823275724025827646019581791360301812783543923051336819177700468260635956242747720616517561011101815431131324637960310731981069286216133688130173\";s:1:\"g\";s:154:\"1684947649509417239135260806264943252268526876769637194735757909661839491299132255354516845127033345104113796896495486662449701718944268945929267825040670\";}i:99;a:2:{s:1:\"p\";s:154:\"7994373833628150530849560920652401745121012535777349068601400269551607703280823889354692441372173043657158510740536487181611790985457287325461732674487519\";s:1:\"g\";s:154:\"2448220787443437832886976788088760055780466231459849980968718478131876017940927162384725064179838850731540842678866145729291113545181168269781059181980456\";}}"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/dhparams/768.dhp",
    "content": "a:80:{i:0;a:2:{s:1:\"p\";s:232:\"1175701041445302708884945410438770138623067783317783382134975004979727959704321238474087887774649148807392806869952586373772996619822483837057669783131284061360637806319674004728682099113918536008368232973412864321898274530817968189\";s:1:\"g\";s:231:\"241059629172068314126293770290309301680725940677268507448005614612902261835370942874314458647451521037890594260859348356283043421942966080214069747884768462092667557211293978755476816099194220284716669499047268771469853565628917328\";}i:1;a:2:{s:1:\"p\";s:232:\"1160463397158849527701815009148900197203162958966145645294147435088801477477484675803756332910607813978135261745343212153393703549631957403377304943392443243634274835161523289211102958000522891895552407402369897099778261147415171269\";s:1:\"g\";s:231:\"980156576150670554745272209446093662673949888301777582456786615364967955309470589404357349856716186753632817170498703268152900072938066234439475476067541450491769594850768658457448054108176835484453712576430139797796209265772663336\";}i:2;a:2:{s:1:\"p\";s:231:\"869999655052790320182350879045566736728057927646570055315646015266889408464221761823392111747178285002452996028958821825296263253477667770414607110824676682799212933666255993136017460383512392289933438630148121391233061157366871701\";s:1:\"g\";s:231:\"531763689104538271465553319393201608727104812448097152771133836552981504434572817723821778434687427886222311184464695443966276476945314413633593925811893001531543956477544738605170657319973614928713461347939896531084690457109650538\";}i:3;a:2:{s:1:\"p\";s:232:\"1104471889917750884804303993065688883460119170192152304973430999181490471008618869217014529124101277320656445061298881090946549506374431201142490220604127775680178415983020357612677183004453511304179415112545948191905746719765023971\";s:1:\"g\";s:231:\"719561347460516300588925619954785617290282281788521291729567441358628645361645381334837281113198173842448560915544949877434810676286698239725433272740122624262661895167489136995799620964581060100972409665350810198636958786254747490\";}i:4;a:2:{s:1:\"p\";s:232:\"1349145662078107774697800025503472204512905629848848700956023551865702249533990270152932113986569777681227891868121513976119300639330914333691142005444358532420890176900408029727790838187380605103464551821327354724729985768270850191\";s:1:\"g\";s:231:\"817085937396555832326475670220555563843648577688094711201174384260146179381647529871294528787843636664507424097114669660596077372446980941338825278574512780193224362876869434622142663392849627956987124787736307353546621253742287509\";}i:5;a:2:{s:1:\"p\";s:232:\"1170084364716675098903795547318887975237486234252129979677466784031218735736488597399497927160715706835015347990348654937293942669164759764598645992563931384215893539087431665099853189753569853096609453066475645389548368518437588197\";s:1:\"g\";s:231:\"498080361880592469439063638713191901297721661284941285022996514959223564776280647472546017014715813809968461324738999250055959772268068142135772249196678702445566155036883056146139967731957697436506541599654345718063563028972250369\";}i:6;a:2:{s:1:\"p\";s:232:\"1147544738129335691604098236730065784788828984596526639862250998945585078140238290443084080683130116915329899951133515821647678968164144342335104557165878713295306253892140879535183775025459645089161687541667257366152969117453678941\";s:1:\"g\";s:231:\"412298807319586531927775096039364269362622496539129056371296014789130977236073468174577767813493223094260356964839594735360408897706250447147501482137328257143660304924424450171953125212533826943218368301407163603147920282182596717\";}i:7;a:2:{s:1:\"p\";s:232:\"1251459840625677580659022626732309463308468834562009677880364632310999147527635865483353995214612742318909034188785280532570232794971791642859147218442516084809570095064546523413155269683156065581632009652278258806379535582737762439\";s:1:\"g\";s:231:\"369275760058498636550821251653721941442653004141698753680557607690072573886381652126744134536579494435975916488308172082808894369383211230497977817487039647983869030944776494172985030680988398447132958596730936802066575679222110687\";}i:8;a:2:{s:1:\"p\";s:232:\"1535344116805682251385675308663093365934297896066448534028022589326515570217831815544787810722606137484824036899107844848252172542880816122541957184557662658297375641247937132253125479510107374276342886367827644575164585705594531127\";s:1:\"g\";s:231:\"202836557466759687825659737460642134720697159050648974083932411076616195737116617071191469532222258845229927616307896158504996120614481673047823109046745202089921378952041816061571352779203853628752794105619209196352667523917697914\";}i:9;a:2:{s:1:\"p\";s:231:\"801113943908138806999867337723460760488142199250918895058021150316660815957495356670553887727269523631199056949598706103957872673978280763594133212715877891856789747790840641401586443741231064114368395492185857995949962876303129819\";s:1:\"g\";s:231:\"694309839379795774267237792764059999533089749547084673316777130906803928668917048001170478345436377296099759955259854815454970932669888732648849422308339634969926182612207089556708827147823506521805267697148146750261179747100470567\";}i:10;a:2:{s:1:\"p\";s:232:\"1436624515829922564180170325068347664639760966514249926047688645549597081524232509986327946145949801557430435901646275377697865257323915842905395151585185690389154314744548082422917984187888469919698940546837871940455457802508004277\";s:1:\"g\";s:231:\"205325877335834092709861971701407633902492068979291865149734239121982052938975442395908996863058497445726401815399250375047854878980218929298866937343194631341284412844415869883011288058945445382098951175546809496258592828861049123\";}i:11;a:2:{s:1:\"p\";s:231:\"799258661369648923916854481905584467963020662311600047520263122726594370519134294878197242897014434488291639184983931668610540662986407313612714348657216832542836246974474679372913895615147392935709768202139559220362017676087042633\";s:1:\"g\";s:231:\"357496241504622526695256924227070348312584166065591818310495130471771371727676319252239046969554923144431824429107063633022798934376238009863920419615976338892569518919491671554567567595071601125434766044367945437812431577687923968\";}i:12;a:2:{s:1:\"p\";s:232:\"1051408107621350416126926966389976088507487923772801072190786195092112727024301845321543595601559395183495596751958829496260061355920165832559530362684335151735209162390479085930229489502392686579399803214956499703143786196204087613\";s:1:\"g\";s:231:\"403603290181277813589663904398385576089358601023743478467711998534924767309275480053287177322410214951726276870415986964145557802768512709681770978620460340923362599910613902980015730554712218603641991712678463309015038515702944505\";}i:13;a:2:{s:1:\"p\";s:232:\"1383051313976534974297187974892829648111401197280398169875907668864794188173011090159574779998626193323101562395390896954895253755334899465699105444492348571629049556431145697351760735250630906738856446907072009269784313512185855579\";s:1:\"g\";s:232:\"1199735749926534010840481862177421035685177726400143336339476245380207334625197545055011590389537565182644918991313407815516855958991889145001076248919695783887819360092481535762046310624503499974634928082949333536057916703190347670\";}i:14;a:2:{s:1:\"p\";s:231:\"910410410031466046008336894253730842559542140395295979211229205768982423176207332543996039251025283987942650159091803684000366302121506053327876979040128253072248521267759503496367422588289312994916213434282179649133744633212663987\";s:1:\"g\";s:231:\"395333968233767507918263855813385365725937802861175996425345239417614560831767568032540531242363110450207527777984721790110784642570120251382701537646699019465645659295689919040974065325120806449585538344380252947524183463505710118\";}i:15;a:2:{s:1:\"p\";s:232:\"1529776512580798243176095530405074419290713556314880892947927990554803460910611713935840752123509682810306593293156433397002521425768945733982728045250387111578481164344007611587021198066250169964931138878655459215861198402408752241\";s:1:\"g\";s:232:\"1519445383034831931517483004442912436628806433888857538825450472920479943253898537957628551027851368648480607418026659708334282843471559480798797256421924871804179230900235354724271167196448484462496628734555064125761767269533924788\";}i:16;a:2:{s:1:\"p\";s:232:\"1055268106948316845820037199650696972262803907698438854383595488438595533496939565236257936526517867592674209529034768116657200825044331454286057391906528610312326048723296678566840409480856556538022261783249175274722313496460997393\";s:1:\"g\";s:231:\"206199432446954854501155354593104258705023646498347422866452068277855761599832823029544119042795306106607255641870488124946938722987479414009442558427811133307239255777567609322375398053036527630800505594868640804750267329497212019\";}i:17;a:2:{s:1:\"p\";s:231:\"927107232904572327802253196907414522890401198741432957033542471901660060735503741345053740426201523001385615965320925417307275335888742645568035113779553434911899954660857153019756367569217075991771367419354564510954569387686781801\";s:1:\"g\";s:231:\"151190234644925654338468905080174282428312425171620491840896135001550552505285467270405831837663599636842153464661142497087602166399039180218595856073426378582252819789107700342324125115418517879031733765651876530588736801131823295\";}i:18;a:2:{s:1:\"p\";s:232:\"1230406903627596355429630307357961966927902661330733966048912828726210489203733166524900751937788479926740629911174130814981095818248169716756507268089985544967870065234054865704635592765032821889963045586853603924313034646459830073\";s:1:\"g\";s:231:\"668999769164149606396391905469702907438198195801890018257916180836998246805109153504822600959837956452433436824239329746422896185329845719328738674560224401963220334020504352748647213145516787548177208958659785899244375716592236867\";}i:19;a:2:{s:1:\"p\";s:232:\"1343141590028980421073350570601903280290621008374784318649055603896772206627855071664874368580315902485143692539969771358809943653645023853698628652795134155359182055321034854859987485434971478105676770508757702487134643905697728033\";s:1:\"g\";s:232:\"1062492326293435934559743139342998676882453034582556699457385659062085223848520214771625029649875938957628105282196786328457477581581392517919765722570685022794786407108203606530037801222131349049104920985866100522223483258865794132\";}i:20;a:2:{s:1:\"p\";s:232:\"1098403501638594864875213493901656255041240203343882113522482831939345936346184333653406769548850735726528069984539165555039980566126422074768571246067148292089464329701721589403155070691338254029973734622567828509785817071950605917\";s:1:\"g\";s:231:\"310707833062544531467216844645561943098962370578916742760756974233153684446241745616739754688573566249846346213810020620706035698631735705193177208634153280990743680897033291523201037446504027887000748503867934381496920835149838635\";}i:21;a:2:{s:1:\"p\";s:232:\"1043838138616929138101811508697535923531994446448500728653891901609619113945535663253153367104375297723741585045382617087805586145467240001020812882375523417325765257159570623394415973410607015885926973240245828769638767158939735823\";s:1:\"g\";s:231:\"211284959053982880949257420097104560359997038327161027485101114225857008653586904671967082110943338617508039824126355934406108355113694160236445963650468176887494420082682469687380851945881864137800975727598046593748961975872182006\";}i:22;a:2:{s:1:\"p\";s:231:\"909481145780067907589091924270230177315783422840482719065855137220873943019392515645706882821956626647690572635519707871148396286852157642254684138616573098568906464473751784860772188993297829955265667930698434525595917268839160831\";s:1:\"g\";s:231:\"411306373730682918768088046461658053886047523482256086504433211926229153450331574028979947269836313494655588335578201035994494545773927011311403549789887334144260346261933762436411397706540542779238658495048143846325391633700408339\";}i:23;a:2:{s:1:\"p\";s:231:\"998772161604674730427208474561632709989449061544052364704570742358230797373567794007176639781433176998472046787230276993430790779126524790324206509581430785260876043040417441909101570474744218186298119505360616581421482343304505361\";s:1:\"g\";s:231:\"184733937063612803361298769841757157417723900158741181107006790853944625842943795481039244412016877898192770990773813962037207347519355631352186315162236644592559703304341212558034558069171398380113273099853523626005475129103034636\";}i:24;a:2:{s:1:\"p\";s:232:\"1211631790987909065279106290645741658732666570591761876339218049687009689063703460852927094478436804703232418641595286790833128247242322236659720330399908817197999763125434214867786755513779482406322331051070406373162250047920250789\";s:1:\"g\";s:231:\"133464538617751712105475405020034283166510480141148453432578028498474033289040983933470799356156378878000022691320750490030719324585709132852224359186694804553298879192734852754173248762941163867013509089588026892511564829994204431\";}i:25;a:2:{s:1:\"p\";s:232:\"1480888488064451833774956808070244282669247589809971713206520764621641705446162614681155410627412992481879670199414987542533382624645029313151496617517954653413410026066284178008253584891588852045810626847039641755473089536554922773\";s:1:\"g\";s:231:\"913189690685537274491321511987396961330148258005655893526179749241633423973343337308946510334297747881793256525675559159610647568566050735753323597640433431964439800847620009583803481087410232791728210821760728996331203279213947272\";}i:26;a:2:{s:1:\"p\";s:232:\"1226836596566030285671888769672320821039004799655006554366618638637080790239128907289006853315149550819913671825983025640271041255260358294952167094606385035928653956687684571574517682208206011184632341554573212143424439340894536707\";s:1:\"g\";s:232:\"1165167826252532206764102608676934821873844628569091073440126408824517260489370607025426954145855274315912579810136126737938857566389260232456536101214898786965422243604428182899785175865041677120867451350549315484291937166136764004\";}i:27;a:2:{s:1:\"p\";s:232:\"1299126867636766047256602510774249303897946838507797326381539542959828986746355819063983912580034597435296309466632887629584754859249612032021106825967545400294837414879858419551447679126128541532092139202509474234237614792211320507\";s:1:\"g\";s:231:\"557454771562979112928503109388852680893435316641935992058431451772623760588666541249846163311300085316181790874633653741197111690133694320561807770330887656762203562703745220895210253776537073041329766823041746432316834986737922878\";}i:28;a:2:{s:1:\"p\";s:232:\"1126348355679296469364456200534190821415558122462203950222173903971316162001039245110015744494619630001307006082897548431481233236573807001400784395505656822302868325141067593935428572148431711769877790056770349398782273732033932543\";s:1:\"g\";s:231:\"992021673708868582769366906807993213154273305041047666103200722689673139917893393228140356075089227443283350105873567260204733321860706890148864345986528697202036125039604459943243445725478860982681407323820119155437657100371338526\";}i:29;a:2:{s:1:\"p\";s:232:\"1008634401758053187128277736528417410192034136519415574669256634516119096233828450468977538112572526973392323180933841232544505680400539244347395331585330307268440666331715982213274229183991204285522535330619906085375274079227768459\";s:1:\"g\";s:229:\"8760572556759866083474396024852617365462326797230737921542173365405997497535302354545906342115080155661950187754873201977061047090180215735138055522021787946051807192598998411896616854579180955223805032820165391468693386400272571\";}i:30;a:2:{s:1:\"p\";s:232:\"1166978258595089617844403001173506915012122138015839804357937568870367230913358081275686767951974838107971386291410611977806257745948360325814106870379818730302342961515325103533493599551258196409588500690548494831769467819283926657\";s:1:\"g\";s:231:\"812710962266620243090428292895471184148359621440469875551097327425018412500712903590238262376264809756735213909943793204442223237431481867379981948700612089289422272562312522419823664998813366865358855830307271676644906505385900486\";}i:31;a:2:{s:1:\"p\";s:232:\"1302298468784249119897859605635105295493385466221287850101629491320472840125840398596019110842184371846880449698083893020753859720550094093407591344533647559507312410611357312646674683805014786093994912628676036696224037212157184447\";s:1:\"g\";s:231:\"554178797388666049055219638833783155765529248078367747326034365212425526271152990752929505555825569368390318252869310697577810339822779922460591657816810807115780260523476282093078547455605388274840263108672842888701583560113414480\";}i:32;a:2:{s:1:\"p\";s:232:\"1442931000879495418147830571703209032868629219398975970234579619558717538766726952628317588601304783460127319543298710724327794361540627879606358857914590949147783774965728031895515384676429380074454381434982743851365372673084575821\";s:1:\"g\";s:232:\"1243370638952605893651352051161751789940342061323296322682621985360092310205841028660332063743955170031003140637380278930009235738429325643370078390617842484869594029175229248055914742953616388093671357850175664014116837534257901300\";}i:33;a:2:{s:1:\"p\";s:232:\"1148631939654604996206773214574552575711307896990934696385104190030217192296044952385521649166190675676640218110404003177982075271795264830578900777976949290319265960261829395103171222603537402278457239415980314123796770451452349777\";s:1:\"g\";s:231:\"448023484821032996636639996750542199189362181239231401153219754636555491419612590302217492863117647800708873851242669804470761410341377037489017852304408246918090055485282225739486541777100726481671909427004627146773220357766465353\";}i:34;a:2:{s:1:\"p\";s:232:\"1393523907386733639196096063316267020192297325243477671179771572687950474193652521299745572736639931999553943306828133031329380137072125223794530447655767869824129331827371927406431824314926409286092407615670679430786622997473343069\";s:1:\"g\";s:231:\"158382239332012361059586498468810507761951071253874327107989888294225407513544700530720873616427478949372862299790858389591473207674049859637536330846828044918745064598396795657590498426743196990965328660346415613444898158459599150\";}i:35;a:2:{s:1:\"p\";s:232:\"1222102521241577470283074206070854512365381505703044952665199901251711264414931392126084324385248931164740262398980646038543572389444975748645047292454791849985041434539105121366323608243589248572317936672902512257895791961279944753\";s:1:\"g\";s:231:\"169474809564989953084527210878254013750630191626979057975836242572371875202170178801841933921565732612820027939995759973638573492141523255284416678413548269429265856232357410256501085766083506944544506248899177627896120912756013303\";}i:36;a:2:{s:1:\"p\";s:232:\"1538598708742095545080369228198463718092167812089180539057575039024868762502691630260434517572758932344173922950898274079386406523439552919172580086565148679698253538312693842622352860900237758454513286076544847373869014109979321933\";s:1:\"g\";s:231:\"487925873109303632774725988789554372098246151110994418866475560449103780481232838975655743841665990844058650418668869837797071102539887131618290573262237167406538025787225706255030517039749286358613977923363625043888262053791745638\";}i:37;a:2:{s:1:\"p\";s:232:\"1097899884450506484051905559182453553026916821622290305706630776055467106423904840844285706479146578446144665891581111216357975998894809415473529916388666801399881277039020074770237098134085307809567159080620682178430449377712188961\";s:1:\"g\";s:231:\"713299421426006881519029802202576054402261377160137162915585056231624159229306230285934068619440801936519514470570753298571802541176133350536243875118339091016873336372808782754280946665027375040616208507565862750376128043447148301\";}i:38;a:2:{s:1:\"p\";s:232:\"1444512863731935483894008702225378125585842694087894886366183274520771087738191267827986626161760688063530784261619654246386352435824102332177609005234887329162299752906328015345611754396942570774934472072201469346813666592126095319\";s:1:\"g\";s:230:\"71022242294633908238161350667189909739686489589295601215049118314301866007824223582964959139713235801443895454852929563171050201408606095135442608708015241740051890609221031027343612271279397254089991308258936096567240934245572172\";}i:39;a:2:{s:1:\"p\";s:232:\"1273921505529135134619471445603766730070275266833637077209371997021121191847495299878557836242176015913055701620097068240553902757712424908402825274359798411845571574397305804394784399551447648769938063688585195177797469676117292707\";s:1:\"g\";s:231:\"172283541835681082917921474708343318584309604663465791287861400143479265703505789482265599399730053181227908951029046784839847417910485792238689678397452497349792694795337120509247353125741777608749797251283134349847071985419946945\";}i:40;a:2:{s:1:\"p\";s:232:\"1391094208269651754228863172916777407766029968601221814793322964684263639354664514894064147017556309431689085598248754658855730462315479244796403513137082524919056979840050289629913330468113348066024861551070516586953578831954940287\";s:1:\"g\";s:232:\"1064795025524333155217046316426725709816790957250825507504827677074388754937495371228984429697045350593451967952162867994241570961967536898334578217100559209235672050677519860167586961789899607637975559733514499823460278430037576476\";}i:41;a:2:{s:1:\"p\";s:232:\"1326936468445641417245559449259189655277275904688276735759218876459280665414495776416728982820158299493847435395556882477708348526659451871434133327657573829220249539269158877916024342331304627334533741000563961956005708488896022881\";s:1:\"g\";s:231:\"560160325520918160311489004538756330652584142975803146221680066558825151966681835216098707623810048671320310293566100399843705481307636868232976533478296776776351705941749079437351750375489046635461241491940079270860197965945416491\";}i:42;a:2:{s:1:\"p\";s:232:\"1218560238812030632047384946207677724376675891003367919894642606676193534699851752823852750039116695047951403361183030635500544410234555075253604602470552567206345873731073012853104591337510965587671909822763481187950084516458148541\";s:1:\"g\";s:232:\"1116212605793882361334980508554999764613524510673113925014454336067379611972575174811960004123114872049074376846221629670991490051690110183964326474055506681823977538787010733251705995435908223148341012046785733295266820798998534733\";}i:43;a:2:{s:1:\"p\";s:232:\"1217497188427651645518008010219704097963219997072947918220282510627445392004815995384575298457524395356495753067496167745895373477700386523537698186007914458939259790774208461717994689738008876315744224012847133799009218346684830859\";s:1:\"g\";s:231:\"770511130507901438600412006983112284630991371571710484001330082877838444871356535886313179170160624860637206210159889225802967508583219897305328840950801900907190541603972767759028215668443657472137164937170393059374657350234172588\";}i:44;a:2:{s:1:\"p\";s:232:\"1384805737644402001602699295819222115889640213864823739426626748938803637018791449954061797401595116354246963498875102004687010135881571778446362154004089583318355206463990307092106845161235823666584330910755849289622581381706219763\";s:1:\"g\";s:231:\"300549098900728120997184377962666801713866244121245602255994692891031308924882229511798285554574949183744241271474954854124567793780282055959022388578786674058503642047846767669358674513850356363710515458249831883431353751436640473\";}i:45;a:2:{s:1:\"p\";s:232:\"1492587067635046724641688792619770082885080916623128596190835123187399555409237704094491882424098429004582220181182619740784070606699855534865664985479518843768489466772177132445303667209841765020506725096570944526583342827976693139\";s:1:\"g\";s:232:\"1325875501024611168460651086120280057597417113099909975171178841675907943309975119263343672690373708947175682795213117068208929462717160334883318825145705113989022565051297121267153447173858992622609588411242729579874123397975266138\";}i:46;a:2:{s:1:\"p\";s:231:\"906847226862001776111816505493768281038044494397978048283918521997355784196400638087866270344123622589898850349070632444514905302691870958199771371762471423025985936761842533697767348529899029836077448253984658354566967653666300291\";s:1:\"g\";s:231:\"736322087778788782539692146029647707897059850806268174498405656773634130296338358454597944410361988992697524598389896851941261557414721510027421303659079837206638916639575833006393233205754151775657992256732326725637747229302979816\";}i:47;a:2:{s:1:\"p\";s:231:\"890185901266080927782491491465517354612445249578323933865882607342218018045827339044063305815560761455409394432525412061214187429139579299492400591506581665066538172120639471965430764234311453555561931633194236909247720214805118073\";s:1:\"g\";s:231:\"124603950693163204561006130618370613293543114866078188752893479503564944442854829116472795873813395868608031842115370116074318303022427922128279623081129104975610062908095108555177761931096196714149047005610934112009256489171764836\";}i:48;a:2:{s:1:\"p\";s:232:\"1022859944913338265513498287914025160760413428632788273312840355167309743967660343293231033751474736710985228291770444169425283751203244350644086644312399632846696705942260278260962694665474670638153088334885364597590329213855838821\";s:1:\"g\";s:226:\"9300900657434489047696932947576507254742485851137640945740833346773894336289041369843665650418554527779923950617936614501875553729924367471021774760018370202907818481345597919412260900264979732317184833567650883567557893375062\";}i:49;a:2:{s:1:\"p\";s:231:\"847503998296101285006099790915650900236373726614141033690527723241117720398089645943375054063733472277302479655583554156249145819849151070540753896248678323721722706542142778548044002424582998724519091068547416460817463290942699611\";s:1:\"g\";s:231:\"331234074300921661629671326001536898454736192468494763379095145727215648933648617862566547316445817232073025874507971645175373540892437914378209189920515870658932521438504082293358796446613855932588162795845812833576149004264344863\";}i:50;a:2:{s:1:\"p\";s:231:\"776854996694680870329679766090923197499320601174183889649293954753262824403489810262166219938884720481651530046864995498795712155925117242820332769004044593138155353839210071553589166493553905531071130000245175488500608606205250473\";s:1:\"g\";s:231:\"122615309163484352435178123040514525950693264760022890223935351486389853053969215583729800598436270172453250408297048292547495756555972940864549104698760360917270926737887015081447655824274035565458153166275374845431297392097414896\";}i:51;a:2:{s:1:\"p\";s:232:\"1014670995663321290921359608373778357137361583080950879880689089887602978213452338329707495620559212973320829485461881514443972718327580018986415671475880393790411550869335287644265510938928754450088809257531645018845849163898576281\";s:1:\"g\";s:231:\"226285175444234122973784619180694638633082167482716005469342385327449875897886239234305738740923272773737253575122862208019661137330217557014525226385441537374271233018325429043614739444592408722828918457330769483139912858752454089\";}i:52;a:2:{s:1:\"p\";s:232:\"1513169936271423788180663828796897482214859916394590058813086550258563947455823332252203732874362687681400458889518212204992499000169381984431868914565922342454309296824550072503920915320186996860296769236804812815276715833511954449\";s:1:\"g\";s:232:\"1245465226405785393052937621442782210068505909794754716840697886490038597351985032447069389595318254694322269386159967688303058763948595197780433162530139509421500448636935611542180856628655340298116911739813872332241561279520583037\";}i:53;a:2:{s:1:\"p\";s:231:\"856013253876479059165623628305975849448863358527134908680506386730475791772900044328912984363736340417917938534652131715858635313983806851931477692304414025858982778155821878443831228714625883654404089352024899372025088563084316869\";s:1:\"g\";s:231:\"552321690037661308598423371621414370654966204550026610831501356822096243392290173211006773925495007312637920045552352583841618385583528133106087248629846785238349605708729343227241184823126680553458580263594415232887609278033875784\";}i:54;a:2:{s:1:\"p\";s:232:\"1334480887559536589949159249692733945384620792290589721623105750400119965602313717796597363544359710470206140367740972924185775527922974878933291445658045025445697156766756880651352317344857640429287980516377747569226931211212491243\";s:1:\"g\";s:231:\"831886041645277013617989310710106338581632774794225204139049756217555884181929382441547915129521121883033469509223234782099800019424095140055702151953921493983956381659390147459758077951959258488692700947152076829209345127239827417\";}i:55;a:2:{s:1:\"p\";s:232:\"1409778745614943123059960637458872383143362660474711587361838099172264328103771279599449433452471625362257540153827777349113762556225898756006249367026194953264828964987050273980148263779979224131073491468700936532944198371641899977\";s:1:\"g\";s:231:\"209776098029275436626677833731169078886117278885071715114505435642385983294326851305920611380028615674022483844583563627952192347687309821075096153883293433371184894010144321609833671939957316414645692604141259818517456628329910873\";}i:56;a:2:{s:1:\"p\";s:231:\"987430516189578827941284205088054611661620082263300587768516778434122699181082412846271052727003571281820389873181317063990985395433365942896367875649986698124817476989968806919034781078588254781147833741809007727914947756658579719\";s:1:\"g\";s:231:\"698200987352603681412105271807898748738354178489091119603323819681401784039318713333863338169737494530635558313935752562046668296212183293510873749175392352219364557252076204906131397081041002324767066945164857926826022730881675404\";}i:57;a:2:{s:1:\"p\";s:231:\"911040560362970417223048893768139389628988085687664013086009222099987221610406175395791423343767969898453296762333521288463623371559741795220949359469991966317300173096203451768448458436821759854332302902207049123095122563165328307\";s:1:\"g\";s:231:\"812594270498848930761688601344147752029772770381862776843635538689863728582355800020232123686093611039261541242167974286295835132480307822937387971672370687322097986874325541469317368635346834600976441766125378899144114323921195586\";}i:58;a:2:{s:1:\"p\";s:231:\"842219267974145775932989123792894671784125999773632266618794032004279619619519039224988473356968580745314383284533399642966645022341924016346852389496721864434033649276503114432343392698641490910905241779155079674669501466846833029\";s:1:\"g\";s:231:\"782544487507669192797122586247172939394023717046277995090644632052579755536328116096809168402110105266197800519534245921413986378461638788404319078240480929658281653750321747004440253112416813029050528374146052783221176298960313565\";}i:59;a:2:{s:1:\"p\";s:232:\"1525092809935288563055571570345820919524510847559774771965057561434975140299144568375358794076795210329084288787580378624089653481424466572254329602363278560207486423630141957923693225949486458225166351939026738254383383758746550647\";s:1:\"g\";s:231:\"263159922809445009879913179233924861644960413198762736113157873838038016723475464951892708348898454780740614412260641141522795265620349407440290686043887300757338238371334215462378864319590332417281238178704191943671667823961166359\";}i:60;a:2:{s:1:\"p\";s:232:\"1028460944421678739403869648025955612818770271689302644136310102933827246458867980827164258058168388339497134835171980844721573217633367276896282397205968182286615164389206641861298761008845793572995845616202743253555140748983244893\";s:1:\"g\";s:231:\"819672765703199092579137249865392990239671440769336584897585625379019575251829873924916934853746122876727468334182965088796386124896485109134891396778358088857805529756796787244840685815947720996926500076399919959153319935883154000\";}i:61;a:2:{s:1:\"p\";s:232:\"1116618938793971635251620742212333252084112686089695775091783024606337481417063400046973984308140430505905270470079059953893854704527630489326325210312207750227881050817557461457444716365677910986604362917828660471351341858494096857\";s:1:\"g\";s:231:\"886495389264431043361764083003188433619726956091423072234161147317167112643474214952357022594163640185279213659123211404675499610319150780444047197146211575454186803578750421194177193308281034306938461424526451109993556092290605627\";}i:62;a:2:{s:1:\"p\";s:231:\"797968355931248443337687572785194531681078668525894869616504982246134880136103339282591195913229534010078819186752873549484555106465378939218557464942306392378439519858664609681412161147401140973953299911521409960106976112377369951\";s:1:\"g\";s:231:\"640761121637205911582584925273104207639077147629241246006735106298865340150464943301800944597332710902710744600875720127926074244717989293323153036139147904419148401305887127992654239622527132611342941954632024239990149310032901493\";}i:63;a:2:{s:1:\"p\";s:232:\"1149737784597196134539684844606836077174184511853637046817912791784871386886645941003768607272989916774461791399081844778712220484980184567429117869606255891575455994880709403094980089125184082083924323339390199617654884285790410503\";s:1:\"g\";s:232:\"1039603101125034957436037513842799552783264469564219071603467222335050285123983992701815389502802987632956762276871132501712957623514952496732752114440497953627338896088394375658021187362290850795614408283008309971686190025693722153\";}i:64;a:2:{s:1:\"p\";s:232:\"1329797930634761192880862076059880539596186910848560549671049265461292267955242454490202990291540780566466579950852416159337549496195757247640919986667450812966261394943118725669861905621692926696165004880010479874148373172971610213\";s:1:\"g\";s:231:\"635837337839928249217276793990419059939905043474162074919430227356353695989613476295402258138887032051601585713030286174494298044263992707036482422495872394392828704770207161110057952905919230753270304119362774387785321873795683546\";}i:65;a:2:{s:1:\"p\";s:232:\"1448623913900261434798685222085379218669160577429273882531357393528490254936279125033819527984087800012125045586904590500187521846246409655319426639918743490196370521969556745886851634696767082843480238683377832803357594808338808789\";s:1:\"g\";s:232:\"1242441591251870653887844129258287272477292810570170069081695319311953376562545356798018649099374884003456979182728581452667824918519630973802906602011582350683406354751790448752315826286714466252353285493390468597894860032976159350\";}i:66;a:2:{s:1:\"p\";s:232:\"1529668939507791128869844490648290764124365901674422927387106692234341029103618077258533057496186461743031022527500511541916188830355814266429015729983198098357862460965845074171515400861687303837201652935516988746262569004563481137\";s:1:\"g\";s:231:\"360660974134492254118200341405376185297344709314085805544303296461805947453282575608141632805937006031503783222427477376904080696378020878384062503501827900451149127843292557616537602904756471733366682875566612490823990596275677543\";}i:67;a:2:{s:1:\"p\";s:231:\"964349802834715627091836311947560216190347334606515569347370133774200574976490727345212588410713504041991155364894697098411252472334205496527965699231720356863841683017206080615358842110850143586011962642589946348492970286665407969\";s:1:\"g\";s:231:\"929730835796228663589459296460175286247231890720354407494506948655435307304668112405072832284354983725176870181434323215671241174830416791009058499007576373683247657428144973843695554591048285334385411320546482122096833997170957438\";}i:68;a:2:{s:1:\"p\";s:232:\"1200697114919552440328212662493330951577090633392906181267524661711427686156563810555704977987849019161562995566572698389243095893050851873199166970487411925149684342035613532992590627108705912648804940551798506465761008844124620843\";s:1:\"g\";s:231:\"210840229717284786647061522612464250122170021966599147979091696189226789454714560674351814215640043731623851038273701713941465042304615442622261378902191416557966885769781607850757337283990327310991779274500108940892706318414163737\";}i:69;a:2:{s:1:\"p\";s:232:\"1505605269824790243792831609706828893984166952005042857668330387295629646099176754803575647869364684706773658989884573187558931362886298063556945978444360603261808118452381586301369212317883353307812109682258121601862761142502891243\";s:1:\"g\";s:232:\"1084946940052009414079442134492764126131699233360610931749616742969406318399538846909634709781884746606435633696011708795848205691494703339546378266099151348812964157880959214875332081239995818554049622469426669215553286217171990197\";}i:70;a:2:{s:1:\"p\";s:231:\"816293659194156584393426852964866212253294848481848239113280525200956078812795725547016870053079733390521590030205302119472344262085862246534098409593188906922670398233793986685054688205359526482886045473996570950709767907766332287\";s:1:\"g\";s:231:\"125543207479359049664289679776762548350219021118060184776896419904091327416143098271532647423069203715703939418436750054904161036732607263073370671224895462307089820071515048928316155155106995471046247116304202948872057424249829306\";}i:71;a:2:{s:1:\"p\";s:231:\"937909358947516337782226369107329834813267396990696800064373114984017087896265925553479913936810219544596193425124759913401224821463162739445133029127703779747659708487741259835192876317663968642084022533197690267855480324556527529\";s:1:\"g\";s:231:\"578517033963429110326177951658909289407442324189047815722917009976102126212418383103468613086046773738909381129731628643776381606497183416474147511436721740867586571298578391173413176636727370915614428453897927588536871545070706826\";}i:72;a:2:{s:1:\"p\";s:231:\"911550272168591326631587048781719864290181926192452902515376445349683296263628887572901987291151834516528416694948433228654143979995488104146391642798141995369742621984998796392603683788185226673225012070762425265022227280304690457\";s:1:\"g\";s:231:\"435611523987279849779799983928466846964355559414907696183238122605651893912177175547925756858491577574088472465417508238273767046169709657388574379877072876851067175453958959942263115528642058698110491508470757333448223479152968166\";}i:73;a:2:{s:1:\"p\";s:232:\"1402332241612496649303040369601818876241754896465490665184937776221374345017898846195563177922807182568607634848789855347331333564677335684945270608142923662833369689062726669830621769891269806986781199834351242524607209182727362697\";s:1:\"g\";s:231:\"788295437611846442150468706453593520179759913221608649431645370830934491660511057392020327584205620415434194214357441850022798625239262202825957968879464188504280320734830085023023361870953080951460626858564454404757439725700161728\";}i:74;a:2:{s:1:\"p\";s:232:\"1385588118482316945637342314640019438423845714093498454736894992477851611815122782181701750401675268595756082471037251485773810390075324501594034728931640633416343793046633227949070383016793194462388968861476522738244028507831412807\";s:1:\"g\";s:232:\"1051407953951842293497025880784993624653296083738495150909318042975954326467188611760483303718017506605889424046908175461440744704653882860969939760977844939897006735758164931979823290042430064727472581445761138927834062800381857331\";}i:75;a:2:{s:1:\"p\";s:231:\"978710653878765138245032780973262837628048824442834741766271800856407798633040866018143219855860066364565173258532133152860794957108413774041864442703022361098911014546932838970841896265536654441302583704650549691544524094461072893\";s:1:\"g\";s:231:\"828596696507489340388194242739437030691368481839839233808126012449055532045083652206448595030469705312890921141157727976947093518174537867725716826615058275916344778889368940911120325529008412131628881439241085844298695161516320553\";}i:76;a:2:{s:1:\"p\";s:232:\"1207869050442265806743029955005671272145050338468895879407536822447006913893944092569221761456800766031110931886064737811279146170983187046931749573257412308812343263137605940218514764728941135936260457381443965473446727029606288087\";s:1:\"g\";s:231:\"901689553109755299724889749491986982699260680669362599014476634410057613935478700557783089065666154315108435551124047123019756359394197131705864747694817007428554108935506622319753907531599531406412261181040137293635457527629166928\";}i:77;a:2:{s:1:\"p\";s:232:\"1253843053454842191496073929229960442713137064902092063097530760375305147828977522103815652822832423852327957157323143291242551095036701741131995598289925801806713520933881311587031812516333248233614882790453878318165294686629013069\";s:1:\"g\";s:231:\"792544431306829255892236222953864313824441744771937100881849165125912187035049340690583274721296595436406556486333849801845868860653775711166921783066039453091902252131197402979987834131940589379261131585088009418040811296418479470\";}i:78;a:2:{s:1:\"p\";s:231:\"888292115983090727383050041245510071901205022923621728740399250824091752574901194082071159280092849203038477423626851997364728759797869144784736703853891927718345111493348065946995574844270360480831713923673933284454590573945117963\";s:1:\"g\";s:230:\"33696947092788556772122343063346211890011409922110209522470356049181924373620706813436426151964317250350038187149729733343587721985790920558911543375733639941083283192766726820247487603481905775948491707522483335714118785605159459\";}i:79;a:2:{s:1:\"p\";s:232:\"1065050883104106794605549148848582174187670490934739354153582360382562310727039426519192822266718204976225715166151783557831632711336128952563917986548082358394005487114249579063266368998061115536978960094975378583758814372365078093\";s:1:\"g\";s:231:\"502815052869438460385725830457308481580545642069196745882872961945446262964900004194947659458399804093287259814745811856081827167061262636484787575169488738796518181394798689913840456698243916045055951843096761093530731109148515060\";}}"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/dhparams/96.dhp",
    "content": "a:200:{i:0;a:2:{s:1:\"p\";s:29:\"47738868853409368611448259423\";s:1:\"g\";s:29:\"35731344447278389373151857379\";}i:1;a:2:{s:1:\"p\";s:29:\"54398515560371522763020384303\";s:1:\"g\";s:29:\"20945390328056174207502186797\";}i:2;a:2:{s:1:\"p\";s:29:\"67021188426992950294948561547\";s:1:\"g\";s:29:\"36939587946899170933046198189\";}i:3;a:2:{s:1:\"p\";s:29:\"39859896287770890834674542079\";s:1:\"g\";s:29:\"19966841823306563175123220931\";}i:4;a:2:{s:1:\"p\";s:29:\"76657699145424535679587536947\";s:1:\"g\";s:29:\"20742767732542452380807121413\";}i:5;a:2:{s:1:\"p\";s:29:\"65654697177391396856160066287\";s:1:\"g\";s:29:\"35809879532657391287512652743\";}i:6;a:2:{s:1:\"p\";s:29:\"71927430958542190463081134799\";s:1:\"g\";s:29:\"26380996146846587208902265941\";}i:7;a:2:{s:1:\"p\";s:29:\"73851341904947983664623532507\";s:1:\"g\";s:29:\"39064041849461247852710130779\";}i:8;a:2:{s:1:\"p\";s:29:\"75150031586910716586432162263\";s:1:\"g\";s:29:\"35111296103975510649443456551\";}i:9;a:2:{s:1:\"p\";s:29:\"48280401911664030048950789063\";s:1:\"g\";s:29:\"38708265162164817606775753013\";}i:10;a:2:{s:1:\"p\";s:29:\"46486903440519245437076708207\";s:1:\"g\";s:29:\"36853353883341331838222365225\";}i:11;a:2:{s:1:\"p\";s:29:\"71350463299297291211905999367\";s:1:\"g\";s:29:\"30011679077810814610369448397\";}i:12;a:2:{s:1:\"p\";s:29:\"49244741619315455361043774787\";s:1:\"g\";s:29:\"24808662195374590974786927029\";}i:13;a:2:{s:1:\"p\";s:29:\"75868764131932808789305748303\";s:1:\"g\";s:29:\"23008143271859447381803035283\";}i:14;a:2:{s:1:\"p\";s:29:\"43420198456255910520716195903\";s:1:\"g\";s:29:\"31396179578286978229414861957\";}i:15;a:2:{s:1:\"p\";s:29:\"65808217191785471358210112163\";s:1:\"g\";s:29:\"23010755437237062565991743601\";}i:16;a:2:{s:1:\"p\";s:29:\"46342915312221934564147401683\";s:1:\"g\";s:29:\"32030125422857259700058924785\";}i:17;a:2:{s:1:\"p\";s:29:\"64829190293054464121774784203\";s:1:\"g\";s:29:\"36833856892751915776286945241\";}i:18;a:2:{s:1:\"p\";s:29:\"45607701182765248395197208983\";s:1:\"g\";s:29:\"21399768901521056627247192929\";}i:19;a:2:{s:1:\"p\";s:29:\"44017242699060517442490417347\";s:1:\"g\";s:29:\"34633247284653303079399909831\";}i:20;a:2:{s:1:\"p\";s:29:\"53625999794377826447198971007\";s:1:\"g\";s:29:\"32287604526928583732085092887\";}i:21;a:2:{s:1:\"p\";s:29:\"63810410075798796194546009783\";s:1:\"g\";s:29:\"33103148562186353466279530571\";}i:22;a:2:{s:1:\"p\";s:29:\"55031538359753114159858892227\";s:1:\"g\";s:29:\"23141307673487499531413743651\";}i:23;a:2:{s:1:\"p\";s:29:\"69434150571492934132889103167\";s:1:\"g\";s:29:\"30086360725418560877456120447\";}i:24;a:2:{s:1:\"p\";s:29:\"74441928984373159899495560039\";s:1:\"g\";s:29:\"34511570476422028933751385293\";}i:25;a:2:{s:1:\"p\";s:29:\"59997318947177039408737791407\";s:1:\"g\";s:29:\"37250192862910145086661507129\";}i:26;a:2:{s:1:\"p\";s:29:\"64196128255368851154005218607\";s:1:\"g\";s:29:\"34000495373771857887090742069\";}i:27;a:2:{s:1:\"p\";s:29:\"59826698978200053030157188599\";s:1:\"g\";s:29:\"19964494685757012065098346707\";}i:28;a:2:{s:1:\"p\";s:29:\"62765736078018217621299172847\";s:1:\"g\";s:29:\"24033335135747484383237117689\";}i:29;a:2:{s:1:\"p\";s:29:\"51371314509993113368964576327\";s:1:\"g\";s:29:\"19894806293471511838941838425\";}i:30;a:2:{s:1:\"p\";s:29:\"62760444033308002378100678207\";s:1:\"g\";s:29:\"30291867805192457401765510895\";}i:31;a:2:{s:1:\"p\";s:29:\"53582209453070233186745035043\";s:1:\"g\";s:29:\"23236665247142302972696051523\";}i:32;a:2:{s:1:\"p\";s:29:\"58994643014783385857138676539\";s:1:\"g\";s:29:\"19937877643250391176571531199\";}i:33;a:2:{s:1:\"p\";s:29:\"48263329442960242226140798283\";s:1:\"g\";s:29:\"21427830008975221643678133239\";}i:34;a:2:{s:1:\"p\";s:29:\"62366601843842296162395153527\";s:1:\"g\";s:29:\"35945985312870131030534711981\";}i:35;a:2:{s:1:\"p\";s:29:\"72347374730426653226589947339\";s:1:\"g\";s:29:\"30316686633846692480439000229\";}i:36;a:2:{s:1:\"p\";s:29:\"66889481667385002256595238959\";s:1:\"g\";s:29:\"21467091715498685802445826655\";}i:37;a:2:{s:1:\"p\";s:29:\"57562601577612410905954202807\";s:1:\"g\";s:29:\"34758405076210401215630410679\";}i:38;a:2:{s:1:\"p\";s:29:\"63417186170491909088356422467\";s:1:\"g\";s:29:\"27136886202422383743778098461\";}i:39;a:2:{s:1:\"p\";s:29:\"76651191206554712261477581379\";s:1:\"g\";s:29:\"25399251868035504726174067835\";}i:40;a:2:{s:1:\"p\";s:29:\"39742911256893192535752596183\";s:1:\"g\";s:29:\"29759759175624969510221105241\";}i:41;a:2:{s:1:\"p\";s:29:\"53063241966256162112521986887\";s:1:\"g\";s:29:\"35220272870226041301738969745\";}i:42;a:2:{s:1:\"p\";s:29:\"64221489119473367767687041863\";s:1:\"g\";s:29:\"25840669648472436001824430091\";}i:43;a:2:{s:1:\"p\";s:29:\"60401269853569313228801931947\";s:1:\"g\";s:29:\"22842216079852083701198138345\";}i:44;a:2:{s:1:\"p\";s:29:\"50500264110803784895147849703\";s:1:\"g\";s:29:\"24516065342693939347117828967\";}i:45;a:2:{s:1:\"p\";s:29:\"61164830232419619474067092239\";s:1:\"g\";s:29:\"26352350231033249314852022313\";}i:46;a:2:{s:1:\"p\";s:29:\"51716169310525088129202326267\";s:1:\"g\";s:29:\"26869080532546514878512382181\";}i:47;a:2:{s:1:\"p\";s:29:\"62926434851243291755574116583\";s:1:\"g\";s:29:\"24702135412242925509885609547\";}i:48;a:2:{s:1:\"p\";s:29:\"63865341648786748578166981199\";s:1:\"g\";s:29:\"23148109461305702871386177549\";}i:49;a:2:{s:1:\"p\";s:29:\"72789069432219090760968655247\";s:1:\"g\";s:29:\"31725421034580831033290406407\";}i:50;a:2:{s:1:\"p\";s:29:\"70756969409504536529184861863\";s:1:\"g\";s:29:\"28734343666595496719979874355\";}i:51;a:2:{s:1:\"p\";s:29:\"50630182889501928368854656923\";s:1:\"g\";s:29:\"34567091595676569937103243609\";}i:52;a:2:{s:1:\"p\";s:29:\"45952510148678487096747574079\";s:1:\"g\";s:29:\"37518021674485079101709627061\";}i:53;a:2:{s:1:\"p\";s:29:\"42882857287768186855451631287\";s:1:\"g\";s:29:\"20526360990737333692515113039\";}i:54;a:2:{s:1:\"p\";s:29:\"50265722213854880338572192803\";s:1:\"g\";s:29:\"22320422205561467172183532507\";}i:55;a:2:{s:1:\"p\";s:29:\"52651538115728879925737034179\";s:1:\"g\";s:29:\"36248623767834351043173573133\";}i:56;a:2:{s:1:\"p\";s:29:\"71243579853974324810676006923\";s:1:\"g\";s:29:\"28678521167624470859587537987\";}i:57;a:2:{s:1:\"p\";s:29:\"44881273335703542822440685359\";s:1:\"g\";s:29:\"27890696956822713079463093069\";}i:58;a:2:{s:1:\"p\";s:29:\"54067724646431918836093765487\";s:1:\"g\";s:29:\"38671671346100133896621817829\";}i:59;a:2:{s:1:\"p\";s:29:\"77981751845097915350841714947\";s:1:\"g\";s:29:\"34109084447631028515541501111\";}i:60;a:2:{s:1:\"p\";s:29:\"41299579464656790538826461979\";s:1:\"g\";s:29:\"31559494063913514065552276299\";}i:61;a:2:{s:1:\"p\";s:29:\"43809367168096446620100258383\";s:1:\"g\";s:29:\"31617324402125986291976766901\";}i:62;a:2:{s:1:\"p\";s:29:\"41629110951264885953120606759\";s:1:\"g\";s:29:\"38406161804958433253138577097\";}i:63;a:2:{s:1:\"p\";s:29:\"63026171442062660193639618179\";s:1:\"g\";s:29:\"29507934963099337261103958697\";}i:64;a:2:{s:1:\"p\";s:29:\"76474084729118955201130431203\";s:1:\"g\";s:29:\"32171898945197339371170458907\";}i:65;a:2:{s:1:\"p\";s:29:\"78323059288301101312881667667\";s:1:\"g\";s:29:\"22199981962969777045604457961\";}i:66;a:2:{s:1:\"p\";s:29:\"48377222972554009039385650679\";s:1:\"g\";s:29:\"32614444658520497932785811087\";}i:67;a:2:{s:1:\"p\";s:29:\"49886103871936238106545100479\";s:1:\"g\";s:29:\"21092123691132028297201513947\";}i:68;a:2:{s:1:\"p\";s:29:\"43221299503205009879216909999\";s:1:\"g\";s:29:\"31490999503942396032305773621\";}i:69;a:2:{s:1:\"p\";s:29:\"72675669525257658331735232279\";s:1:\"g\";s:29:\"21625394843226904733988215413\";}i:70;a:2:{s:1:\"p\";s:29:\"60912699550998182788325971487\";s:1:\"g\";s:29:\"37125028105990641824493370751\";}i:71;a:2:{s:1:\"p\";s:29:\"41376435625834360066302056723\";s:1:\"g\";s:29:\"29184639342437770947343070079\";}i:72;a:2:{s:1:\"p\";s:29:\"75911859552795531794906334383\";s:1:\"g\";s:29:\"25591480945916785626340759655\";}i:73;a:2:{s:1:\"p\";s:29:\"65759239204590801774612362339\";s:1:\"g\";s:29:\"26155114179438446049102644089\";}i:74;a:2:{s:1:\"p\";s:29:\"65527216814120877501471071123\";s:1:\"g\";s:29:\"27930568859450263902637044387\";}i:75;a:2:{s:1:\"p\";s:29:\"70810182985925809810433127539\";s:1:\"g\";s:29:\"31957160993262417032979556405\";}i:76;a:2:{s:1:\"p\";s:29:\"57492899402310837998263313603\";s:1:\"g\";s:29:\"35724553374810107964858445377\";}i:77;a:2:{s:1:\"p\";s:29:\"43758636413285999568429004427\";s:1:\"g\";s:29:\"30488837552241539903120979149\";}i:78;a:2:{s:1:\"p\";s:29:\"56692097963982709200889953419\";s:1:\"g\";s:29:\"26271804900529999524482515699\";}i:79;a:2:{s:1:\"p\";s:29:\"77974047092081361669361958459\";s:1:\"g\";s:29:\"39126929749021168284193878989\";}i:80;a:2:{s:1:\"p\";s:29:\"78229682156975988879624724559\";s:1:\"g\";s:29:\"27911368145178527289382607881\";}i:81;a:2:{s:1:\"p\";s:29:\"62126252016749015886820739027\";s:1:\"g\";s:29:\"34055396134921086870545958899\";}i:82;a:2:{s:1:\"p\";s:29:\"67563355896875957624545837703\";s:1:\"g\";s:29:\"37486398928881331284746874917\";}i:83;a:2:{s:1:\"p\";s:29:\"50132370870533665921627496387\";s:1:\"g\";s:29:\"26059455883840798859750499105\";}i:84;a:2:{s:1:\"p\";s:29:\"39725206923751271728960689383\";s:1:\"g\";s:29:\"24609684584536618635376545477\";}i:85;a:2:{s:1:\"p\";s:29:\"51792948921405546760270684967\";s:1:\"g\";s:29:\"25995693514438136367087526063\";}i:86;a:2:{s:1:\"p\";s:29:\"55288338303675688577407630103\";s:1:\"g\";s:29:\"24223163922736270455212400515\";}i:87;a:2:{s:1:\"p\";s:29:\"52150198885087539120531512267\";s:1:\"g\";s:29:\"28166775980799901204464193159\";}i:88;a:2:{s:1:\"p\";s:29:\"64967370257521870837395382187\";s:1:\"g\";s:29:\"30197948617065071104206085765\";}i:89;a:2:{s:1:\"p\";s:29:\"57267259723766408733673540247\";s:1:\"g\";s:29:\"23386967103059011857791870243\";}i:90;a:2:{s:1:\"p\";s:29:\"52627911824296402395179157203\";s:1:\"g\";s:29:\"33293309894237358066888235147\";}i:91;a:2:{s:1:\"p\";s:29:\"71861809192052150172370739147\";s:1:\"g\";s:29:\"31044213605020388625039824137\";}i:92;a:2:{s:1:\"p\";s:29:\"70254513909085824681053192543\";s:1:\"g\";s:29:\"28798349198845097401709269813\";}i:93;a:2:{s:1:\"p\";s:29:\"41403540291961233368774818919\";s:1:\"g\";s:29:\"28798985963850612805220493955\";}i:94;a:2:{s:1:\"p\";s:29:\"48430431805183902912293107223\";s:1:\"g\";s:29:\"31404742280166410839686792815\";}i:95;a:2:{s:1:\"p\";s:29:\"51473404191184755474663299999\";s:1:\"g\";s:29:\"33843389600977412378505334397\";}i:96;a:2:{s:1:\"p\";s:29:\"70565571849996199202961193307\";s:1:\"g\";s:29:\"21716627740009390905807789193\";}i:97;a:2:{s:1:\"p\";s:29:\"78437005746991951735505214167\";s:1:\"g\";s:29:\"26924323797938784922617646411\";}i:98;a:2:{s:1:\"p\";s:29:\"43843055850061764331501276463\";s:1:\"g\";s:29:\"31987298334225618123314578601\";}i:99;a:2:{s:1:\"p\";s:29:\"53682770566445504403330150107\";s:1:\"g\";s:29:\"38927064063740890597015961647\";}i:100;a:2:{s:1:\"p\";s:29:\"48994954423636463292887914919\";s:1:\"g\";s:29:\"32652856528784949016397405041\";}i:101;a:2:{s:1:\"p\";s:29:\"44897157586817342996019100247\";s:1:\"g\";s:29:\"38840533683921393467308020649\";}i:102;a:2:{s:1:\"p\";s:29:\"67538483715108583872805797647\";s:1:\"g\";s:29:\"29919536376822345692569617879\";}i:103;a:2:{s:1:\"p\";s:29:\"50717592467559574799527034903\";s:1:\"g\";s:29:\"21517893190499507102203033779\";}i:104;a:2:{s:1:\"p\";s:29:\"70772395177637170507552342367\";s:1:\"g\";s:29:\"39434308756454820138634504439\";}i:105;a:2:{s:1:\"p\";s:29:\"53445905772090528659325390647\";s:1:\"g\";s:29:\"22551665344611641752027006601\";}i:106;a:2:{s:1:\"p\";s:29:\"52474468077274345269151992383\";s:1:\"g\";s:29:\"33352638404672259758390964327\";}i:107;a:2:{s:1:\"p\";s:29:\"67114005106800452560101178583\";s:1:\"g\";s:29:\"33084264118243593357598139587\";}i:108;a:2:{s:1:\"p\";s:29:\"58754852803087648151383432619\";s:1:\"g\";s:29:\"29086302567025374338700003541\";}i:109;a:2:{s:1:\"p\";s:29:\"63212231552431384571059657007\";s:1:\"g\";s:29:\"35530559402100927792425660111\";}i:110;a:2:{s:1:\"p\";s:29:\"42196611473333337298462210787\";s:1:\"g\";s:29:\"24592858785758227363491641241\";}i:111;a:2:{s:1:\"p\";s:29:\"44047438903651919269497203819\";s:1:\"g\";s:29:\"33075102551287629845592080029\";}i:112;a:2:{s:1:\"p\";s:29:\"52434265050670307985847764863\";s:1:\"g\";s:29:\"29887639044793235583920349563\";}i:113;a:2:{s:1:\"p\";s:29:\"54506429692472361223143536003\";s:1:\"g\";s:29:\"27693480481313114708529170763\";}i:114;a:2:{s:1:\"p\";s:29:\"72845129316148286033002738187\";s:1:\"g\";s:29:\"22179932387795580737090272661\";}i:115;a:2:{s:1:\"p\";s:29:\"71067088953897971478659333927\";s:1:\"g\";s:29:\"21865125582832109553224763593\";}i:116;a:2:{s:1:\"p\";s:29:\"50765915006154815563652014379\";s:1:\"g\";s:29:\"24925324101591485419008597689\";}i:117;a:2:{s:1:\"p\";s:29:\"41796273330675329512689479027\";s:1:\"g\";s:29:\"34498285623103961201616530779\";}i:118;a:2:{s:1:\"p\";s:29:\"71667652951249290315789870947\";s:1:\"g\";s:29:\"28597584821952440893599410119\";}i:119;a:2:{s:1:\"p\";s:29:\"40661876296207694113479633203\";s:1:\"g\";s:29:\"34618495347559751713231561811\";}i:120;a:2:{s:1:\"p\";s:29:\"75584625760448598854619320747\";s:1:\"g\";s:29:\"33825371145156064291302499673\";}i:121;a:2:{s:1:\"p\";s:29:\"72900646949748701155153254023\";s:1:\"g\";s:29:\"39056661372189487534797810227\";}i:122;a:2:{s:1:\"p\";s:29:\"39725262448989342209900586647\";s:1:\"g\";s:29:\"27012300571607327239173217505\";}i:123;a:2:{s:1:\"p\";s:29:\"70291076132593834744489638659\";s:1:\"g\";s:29:\"28287870352495913858579279891\";}i:124;a:2:{s:1:\"p\";s:29:\"68223492838054012745867773019\";s:1:\"g\";s:29:\"29812634632059772397466036447\";}i:125;a:2:{s:1:\"p\";s:29:\"53346092907654611928569785007\";s:1:\"g\";s:29:\"20380231076764775013716891749\";}i:126;a:2:{s:1:\"p\";s:29:\"42269250412327988046698168879\";s:1:\"g\";s:29:\"22359387614414132557852459585\";}i:127;a:2:{s:1:\"p\";s:29:\"57320431477944067979431873019\";s:1:\"g\";s:29:\"36389842917475191481639469737\";}i:128;a:2:{s:1:\"p\";s:29:\"53385052160780507951010260483\";s:1:\"g\";s:29:\"24906742945156753228249405845\";}i:129;a:2:{s:1:\"p\";s:29:\"77319125713145958575993682839\";s:1:\"g\";s:29:\"32250111047089288670189735029\";}i:130;a:2:{s:1:\"p\";s:29:\"75162993662684965129714771847\";s:1:\"g\";s:29:\"25661752946886423597912692337\";}i:131;a:2:{s:1:\"p\";s:29:\"45405625268025110880402518087\";s:1:\"g\";s:29:\"36319773469129114154499369695\";}i:132;a:2:{s:1:\"p\";s:29:\"59088448884756478306290294419\";s:1:\"g\";s:29:\"32191641691724471525681426191\";}i:133;a:2:{s:1:\"p\";s:29:\"48391361101895671980136152047\";s:1:\"g\";s:29:\"28674669966387337925758056971\";}i:134;a:2:{s:1:\"p\";s:29:\"60566037922797273575059507943\";s:1:\"g\";s:29:\"34215739467127691572238119127\";}i:135;a:2:{s:1:\"p\";s:29:\"59514789385135504034490479963\";s:1:\"g\";s:29:\"34710883816976378062106378581\";}i:136;a:2:{s:1:\"p\";s:29:\"72245746528041664913295702167\";s:1:\"g\";s:29:\"38377548355684432345447431019\";}i:137;a:2:{s:1:\"p\";s:29:\"77057467563788368450273635347\";s:1:\"g\";s:29:\"24241201973162188054931592279\";}i:138;a:2:{s:1:\"p\";s:29:\"43584371382806814935291636579\";s:1:\"g\";s:29:\"36659077432871194105682472635\";}i:139;a:2:{s:1:\"p\";s:29:\"53005996620921200751055268363\";s:1:\"g\";s:29:\"39257201959355896039903321299\";}i:140;a:2:{s:1:\"p\";s:29:\"42597100015430501275680415787\";s:1:\"g\";s:29:\"32728428281570006218679496853\";}i:141;a:2:{s:1:\"p\";s:29:\"57712518549539943687407899799\";s:1:\"g\";s:29:\"28523188239456579421576097165\";}i:142;a:2:{s:1:\"p\";s:29:\"57597321462679122556677087827\";s:1:\"g\";s:29:\"24238811025555864703506297729\";}i:143;a:2:{s:1:\"p\";s:29:\"52694154096382067677036327499\";s:1:\"g\";s:29:\"33003354138724083947013916347\";}i:144;a:2:{s:1:\"p\";s:29:\"49168587190281246808731914159\";s:1:\"g\";s:29:\"24787429202019511436089021743\";}i:145;a:2:{s:1:\"p\";s:29:\"64119909108206836355870531579\";s:1:\"g\";s:29:\"32491957206216938161091275705\";}i:146;a:2:{s:1:\"p\";s:29:\"50467793876433382124768013347\";s:1:\"g\";s:29:\"25130214130640956081967953409\";}i:147;a:2:{s:1:\"p\";s:29:\"58411160562120944539229614679\";s:1:\"g\";s:29:\"26984522061879150564144369855\";}i:148;a:2:{s:1:\"p\";s:29:\"40009347006163207215081987803\";s:1:\"g\";s:29:\"35770013420048480039829342671\";}i:149;a:2:{s:1:\"p\";s:29:\"70624660658773357720766101463\";s:1:\"g\";s:29:\"35824369666376333976531890557\";}i:150;a:2:{s:1:\"p\";s:29:\"64341975464068240469532696503\";s:1:\"g\";s:29:\"32530921439798458540338308785\";}i:151;a:2:{s:1:\"p\";s:29:\"50960275061167921310203607999\";s:1:\"g\";s:29:\"32132617625550502941234012677\";}i:152;a:2:{s:1:\"p\";s:29:\"56797267799962419081951774167\";s:1:\"g\";s:29:\"34288942257253430908202805755\";}i:153;a:2:{s:1:\"p\";s:29:\"58074017368865007334964216003\";s:1:\"g\";s:29:\"35729271862311203945689979405\";}i:154;a:2:{s:1:\"p\";s:29:\"40223717844890578002433478807\";s:1:\"g\";s:29:\"29589708703140870455838217981\";}i:155;a:2:{s:1:\"p\";s:29:\"46164472770902986360821507539\";s:1:\"g\";s:29:\"33305967083143761363730485247\";}i:156;a:2:{s:1:\"p\";s:29:\"51440898823119489454011434939\";s:1:\"g\";s:29:\"23297809258485493478497527275\";}i:157;a:2:{s:1:\"p\";s:29:\"69137161537503320226750697643\";s:1:\"g\";s:29:\"29057927675001690950633562415\";}i:158;a:2:{s:1:\"p\";s:29:\"70368416471670772916685973187\";s:1:\"g\";s:29:\"26999604070693000537404791371\";}i:159;a:2:{s:1:\"p\";s:29:\"63337430803646519385776522267\";s:1:\"g\";s:29:\"39568994791668376175953012565\";}i:160;a:2:{s:1:\"p\";s:29:\"44701686190263648211731573419\";s:1:\"g\";s:29:\"37932575585630911059257354979\";}i:161;a:2:{s:1:\"p\";s:29:\"67061963534677418365284083843\";s:1:\"g\";s:29:\"34424441366959344012129849399\";}i:162;a:2:{s:1:\"p\";s:29:\"73686066909490063572068902667\";s:1:\"g\";s:29:\"28555084362370984960397877705\";}i:163;a:2:{s:1:\"p\";s:29:\"67527858922200909359786778983\";s:1:\"g\";s:29:\"30749239501627454371477786151\";}i:164;a:2:{s:1:\"p\";s:29:\"61043739066730320355165466543\";s:1:\"g\";s:29:\"21595545896109312433802159723\";}i:165;a:2:{s:1:\"p\";s:29:\"45334723448893279488516029423\";s:1:\"g\";s:29:\"37137146908205066290903839065\";}i:166;a:2:{s:1:\"p\";s:29:\"56308214005582002693555810227\";s:1:\"g\";s:29:\"24843791296725163102719345885\";}i:167;a:2:{s:1:\"p\";s:29:\"67533150567370173925041652007\";s:1:\"g\";s:29:\"30782893351115458792404891185\";}i:168;a:2:{s:1:\"p\";s:29:\"77141896439196678834655501223\";s:1:\"g\";s:29:\"36061461453268822310804404211\";}i:169;a:2:{s:1:\"p\";s:29:\"53464136308124898869051497703\";s:1:\"g\";s:29:\"21070840867138524281210954559\";}i:170;a:2:{s:1:\"p\";s:29:\"43906866776363067808866128183\";s:1:\"g\";s:29:\"31371970727448398345771909917\";}i:171;a:2:{s:1:\"p\";s:29:\"42951929549489979042061459067\";s:1:\"g\";s:29:\"35303481350375126063754180319\";}i:172;a:2:{s:1:\"p\";s:29:\"55584206157809351576484752699\";s:1:\"g\";s:29:\"27521324978891503871880098457\";}i:173;a:2:{s:1:\"p\";s:29:\"64082684138871018024834206363\";s:1:\"g\";s:29:\"35430132693162906364375555257\";}i:174;a:2:{s:1:\"p\";s:29:\"72274680235256183639513224187\";s:1:\"g\";s:29:\"39323298720223462507539214629\";}i:175;a:2:{s:1:\"p\";s:29:\"50270465159644897332267799847\";s:1:\"g\";s:29:\"32162138971239505380120254023\";}i:176;a:2:{s:1:\"p\";s:29:\"71172742562279238052232728379\";s:1:\"g\";s:29:\"28087698829250168062118773909\";}i:177;a:2:{s:1:\"p\";s:29:\"58279975107815369320968409643\";s:1:\"g\";s:29:\"37477871871950017488642962513\";}i:178;a:2:{s:1:\"p\";s:29:\"76149833977762808075325714263\";s:1:\"g\";s:29:\"33495819233171658198843244729\";}i:179;a:2:{s:1:\"p\";s:29:\"78903549728711268080275522043\";s:1:\"g\";s:29:\"35575753121439896828664997439\";}i:180;a:2:{s:1:\"p\";s:29:\"50246227352468831277581528819\";s:1:\"g\";s:29:\"22165161926944506968934210845\";}i:181;a:2:{s:1:\"p\";s:29:\"40366543204773291628848006179\";s:1:\"g\";s:29:\"37491409231401195990400236255\";}i:182;a:2:{s:1:\"p\";s:29:\"52485686141888680631881366979\";s:1:\"g\";s:29:\"25008339028119954369958601375\";}i:183;a:2:{s:1:\"p\";s:29:\"75310123834070506632175194923\";s:1:\"g\";s:29:\"24911739307945577462298528211\";}i:184;a:2:{s:1:\"p\";s:29:\"43287453884743355180493459983\";s:1:\"g\";s:29:\"37431226064016553223888614739\";}i:185;a:2:{s:1:\"p\";s:29:\"72668048134235584782124599179\";s:1:\"g\";s:29:\"36083914805133754503902359713\";}i:186;a:2:{s:1:\"p\";s:29:\"42587035483492360208542295483\";s:1:\"g\";s:29:\"29425547602658008334973977237\";}i:187;a:2:{s:1:\"p\";s:29:\"48660742813847790093577802723\";s:1:\"g\";s:29:\"22181696030381210296639395281\";}i:188;a:2:{s:1:\"p\";s:29:\"43358224144805388273357480587\";s:1:\"g\";s:29:\"39214031095936595183935153561\";}i:189;a:2:{s:1:\"p\";s:29:\"78569919398561957497150141427\";s:1:\"g\";s:29:\"27386092272055272984209278553\";}i:190;a:2:{s:1:\"p\";s:29:\"71756187727640118653252286707\";s:1:\"g\";s:29:\"23705829101416778657726552921\";}i:191;a:2:{s:1:\"p\";s:29:\"51779331839710276181002026347\";s:1:\"g\";s:29:\"25380613792873774698286228915\";}i:192;a:2:{s:1:\"p\";s:29:\"57342881303922666441386957279\";s:1:\"g\";s:29:\"20848819641117789823622350199\";}i:193;a:2:{s:1:\"p\";s:29:\"70002251023023159545354683883\";s:1:\"g\";s:29:\"36610934624864460295158944359\";}i:194;a:2:{s:1:\"p\";s:29:\"44910825886538421594132535403\";s:1:\"g\";s:29:\"30512121148739912553086530975\";}i:195;a:2:{s:1:\"p\";s:29:\"75997480947050915451016792487\";s:1:\"g\";s:29:\"25177189795127991088001819331\";}i:196;a:2:{s:1:\"p\";s:29:\"71210454010817147751246783827\";s:1:\"g\";s:29:\"24081482543177517821419798409\";}i:197;a:2:{s:1:\"p\";s:29:\"48178222020174159336951481379\";s:1:\"g\";s:29:\"23875634060583990786793373517\";}i:198;a:2:{s:1:\"p\";s:29:\"41053972333108758025596811307\";s:1:\"g\";s:29:\"23250518637280344226689511927\";}i:199;a:2:{s:1:\"p\";s:29:\"65532547845146082502279866959\";s:1:\"g\";s:29:\"21702436153057868635835641145\";}}"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/dhparams.php",
    "content": "<?php\n/**********************************************************\\\n|                                                          |\n| The implementation of PHPRPC Protocol 3.0                |\n|                                                          |\n| dhparams.php                                             |\n|                                                          |\n| Release 3.0.1                                            |\n| Copyright by Team-PHPRPC                                 |\n|                                                          |\n| WebSite:  http://www.phprpc.org/                         |\n|           http://www.phprpc.net/                         |\n|           http://www.phprpc.com/                         |\n|           http://sourceforge.net/projects/php-rpc/       |\n|                                                          |\n| Authors:  Ma Bingyao <andot@ujn.edu.cn>                  |\n|                                                          |\n| This file may be distributed and/or modified under the   |\n| terms of the GNU General Public License (GPL) version    |\n| 2.0 as published by the Free Software Foundation and     |\n| appearing in the included file LICENSE.                  |\n|                                                          |\n\\**********************************************************/\n\n/* Diffie-Hellman Parameters for PHPRPC.\n *\n * Copyright: Ma Bingyao <andot@ujn.edu.cn>\n * Version: 1.2\n * LastModified: Apr 12, 2010\n * This library is free.  You can redistribute it and/or modify it under GPL.\n */\nclass DHParams {\n    var $len;\n    var $dhParams;\n    function getNearest($n, $a) {\n        $j = 0;\n        $m = abs($a[0] - $n);\n        for ($i = 1; $i < count($a); $i++) {\n            $t = abs($a[$i] - $n);\n            if ($m > $t) {\n                $m = $t;\n                $j = $i;\n            }\n        }\n        return $a[$j];\n    }\n    function DHParams($len = 128) {\n        if (extension_loaded('gmp')) {\n            $a = array(96, 128, 160, 192, 256, 512, 768, 1024, 1536, 2048, 3072, 4096);\n        }\n        else if (extension_loaded('big_int')) {\n            $a = array(96, 128, 160, 192, 256, 512, 768, 1024, 1536);\n        }\n        else if (extension_loaded('bcmath')) {\n            $a = array(96, 128, 160, 192, 256, 512);\n        }\n        else {\n            $a = array(96, 128, 160);\n        }\n        $this->len = $this->getNearest($len, $a);\n        $dhParams = unserialize(file_get_contents(\"dhparams/{$this->len}.dhp\", true));\n        $this->dhParams = $dhParams[mt_rand(0, count($dhParams) - 1)];\n    }\n    function getL() {\n        return $this->len;\n    }\n    function getP() {\n        return $this->dhParams['p'];\n    }\n    function getG() {\n        return $this->dhParams['g'];\n    }\n    function getDHParams() {\n        return $this->dhParams;\n    }\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/CREDITS",
    "content": "XXTEA PHP extension\nMa Bingyao (andot@coolcode.cn)\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/INSTALL",
    "content": "Installing of XXTEA PHP package.\n\nThere are many ways to build the package. Below you can find details for most\nuseful ways of package building:\n\n1. with PHP\n2. with phpize utility\n3. under Windows using Microsoft Visual C (.NET or VC6)\n\n-----------------------------------------------------------------------------\nWay 1: Building the package with PHP\n-----------------------------------------------------------------------------\n\n1.  Create ext/xxtea folder in the php-source-folder. Copy all files\n    from the package into created folder.\n\n2.  Run\n        ./buildconf\n    to rebuild PHP's configure script.\n\n3.  Compile php with option:\n    --enable-xxtea to build bundled into PHP module\n    --enable-xxtea=shared to build dinamycally loadable module\n\n-----------------------------------------------------------------------------\nWay 2: Building the package with phpize utility\n-----------------------------------------------------------------------------\n\n1.  Unpack contents of the package.\n\n2.  Run\n        phpize\n    script, which will prepare environment for building XXTEA package.\n\n3.  Run \n        ./configure --enable-xxtea=shared\n    to generate makefile\n\n4.  Run\n        make\n    to build XXTEA extension library. It will be placed into\n    ./modules folder.\n\n5.  Run\n        make install\n    to install XXTEA extension library into PHP\n\n-----------------------------------------------------------------------------\nWay 3: Building the package under Windows using Microsoft Visual C (.NET or VC6)\n-----------------------------------------------------------------------------\n1.  Create ext/xxtea folder in the php-source-folder. Copy all files\n    from the package into created folder.\n\n2.  Copy php4ts.lib (for PHP4) or php5ts.lib (for PHP5) static library from\n    your version of PHP into ext/xxtea folder.\n\n3.  Open php_xxtea.sln - solution file under MSVC.NET or php_xxtea.dsw - \n    workspace file under MSVC6. Try to build Release_php4 (for PHP4) or Release_php5\n    (for PHP5) configuration.\n\n4.  Copy php_xxtea.dll from ext/xxtea/Release_php4 or ext/xxtea/Release_php5\n    into {extension_dir} folder. Path to {extension_dir} can be found in php.ini\n\n5.  Add line\n        extension=php_xxtea.dll\n    into php.ini\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/LICENSE",
    "content": "-------------------------------------------------------------------- \n                  The PHP License, version 3.01\nCopyright (c) 1999 - 2006 The PHP Group. All rights reserved.\n-------------------------------------------------------------------- \n\nRedistribution and use in source and binary forms, with or without\nmodification, is permitted provided that the following conditions\nare met:\n\n  1. Redistributions of source code must retain the above copyright\n     notice, this list of conditions and the following disclaimer.\n \n  2. Redistributions in binary form must reproduce the above copyright\n     notice, this list of conditions and the following disclaimer in\n     the documentation and/or other materials provided with the\n     distribution.\n \n  3. The name \"PHP\" must not be used to endorse or promote products\n     derived from this software without prior written permission. For\n     written permission, please contact group@php.net.\n  \n  4. Products derived from this software may not be called \"PHP\", nor\n     may \"PHP\" appear in their name, without prior written permission\n     from group@php.net.  You may indicate that your software works in\n     conjunction with PHP by saying \"Foo for PHP\" instead of calling\n     it \"PHP Foo\" or \"phpfoo\"\n \n  5. The PHP Group may publish revised and/or new versions of the\n     license from time to time. Each version will be given a\n     distinguishing version number.\n     Once covered code has been published under a particular version\n     of the license, you may always continue to use it under the terms\n     of that version. You may also choose to use such covered code\n     under the terms of any subsequent version of the license\n     published by the PHP Group. No one other than the PHP Group has\n     the right to modify the terms applicable to covered code created\n     under this License.\n\n  6. Redistributions of any form whatsoever must retain the following\n     acknowledgment:\n     \"This product includes PHP software, freely available from\n     <http://www.php.net/software/>\".\n\nTHIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND \nANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A \nPARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE PHP\nDEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \nINDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR \nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\nHOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\nSTRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\nOF THE POSSIBILITY OF SUCH DAMAGE.\n\n-------------------------------------------------------------------- \n\nThis software consists of voluntary contributions made by many\nindividuals on behalf of the PHP Group.\n\nThe PHP Group can be contacted via Email at group@php.net.\n\nFor more information on the PHP Group and the PHP project, \nplease see <http://www.php.net>.\n\nPHP includes the Zend Engine, freely available at\n<http://www.zend.com>.\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/README",
    "content": "XXTEA PHP extension\n\nWhat is it?\n-----------------------------------------------\nThis extension based on xxtea library, which provides a set of functions\nfor encrypt or decrypt data with XXTEA algorithm.\n\n\n\nHow to install it?\n-----------------------------------------------\nSee INSTALL for installation instructions.\n\n\n\nHow to use it?\n-----------------------------------------------\nstring xxtea_encrypt(string data, string key)\n\nEncrypt data using XXTEA algorithm. The key is a 16 bytes(128 bits) string.\n\nstring xxtea_decrypt(string data, string key)\n\nDecrypt data using XXTEA algorithm. The key is a 16 bytes(128 bits) string.\n\nstring xxtea_info()\n\nGet the version information."
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/config.m4",
    "content": "PHP_ARG_ENABLE(xxtea, xxtea module,\n[  --enable-xxtea          Enable xxtea module.])\n\nif test \"$PHP_XXTEA\" != \"no\"; then\n  PHP_NEW_EXTENSION(xxtea, php_xxtea.c xxtea.c, $ext_shared)\n  AC_DEFINE(HAVE_XXTEA, 1, [Have XXTEA library])\nfi\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/config.w32",
    "content": "ARG_ENABLE(\"xxtea\", \"xxtea module\", \"no\");\n\nif (PHP_XXTEA != \"no\") {\n    EXTENSION(\"xxtea\", \"php_xxtea.c xxtea.c\");\n}\n\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/php_xxtea.c",
    "content": "/***********************************************************************\n\n    Copyright 2006-2007 Ma Bingyao\n\n    These sources is free software. Redistributions of source code must\n    retain the above copyright notice. Redistributions in binary form\n    must reproduce the above copyright notice. You can redistribute it\n    freely. You can use it with any free or commercial software.\n\n    These sources is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY. Without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n        You may contact the author by:\n           e-mail:  andot@coolcode.cn\n\n*************************************************************************/\n#ifdef HAVE_CONFIG_H\n#include \"config.h\"\n#endif\n\n#include \"php.h\"\n\n#if HAVE_XXTEA\n#include \"php_xxtea.h\"\n#include \"ext/standard/info.h\" /* for phpinfo() functions */\n#include \"xxtea.h\"\n\n/* compiled function list so Zend knows what's in this module */\nzend_function_entry xxtea_functions[] =\n{\n    ZEND_FE(xxtea_encrypt, NULL)\n    ZEND_FE(xxtea_decrypt, NULL)\n    ZEND_FE(xxtea_info, NULL)\n    {NULL, NULL, NULL}\n};\n\n/* compiled module information */\nzend_module_entry xxtea_module_entry =\n{\n    STANDARD_MODULE_HEADER,\n    XXTEA_MODULE_NAME,\n    xxtea_functions,\n    ZEND_MINIT(xxtea),\n    ZEND_MSHUTDOWN(xxtea),\n    NULL,\n    NULL,\n    ZEND_MINFO(xxtea),\n    XXTEA_VERSION,\n    STANDARD_MODULE_PROPERTIES\n};\n\n/* implement standard \"stub\" routine to introduce ourselves to Zend */\n#if defined(COMPILE_DL_XXTEA)\nZEND_GET_MODULE(xxtea)\n#endif\n\nstatic xxtea_long *xxtea_to_long_array(unsigned char *data, xxtea_long len, int include_length, xxtea_long *ret_len) {\n    xxtea_long i, n, *result;\n\tn = len >> 2;\n    n = (((len & 3) == 0) ? n : n + 1);\n    if (include_length) {\n        result = (xxtea_long *)emalloc((n + 1) << 2);\n        result[n] = len;\n\t    *ret_len = n + 1;\n\t} else {\n        result = (xxtea_long *)emalloc(n << 2);\n\t    *ret_len = n;\n    }\n\tmemset(result, 0, n << 2);\n\tfor (i = 0; i < len; i++) {\n        result[i >> 2] |= (xxtea_long)data[i] << ((i & 3) << 3);\n    }\n    return result;\n}\n\nstatic unsigned char *xxtea_to_byte_array(xxtea_long *data, xxtea_long len, int include_length, xxtea_long *ret_len) {\n    xxtea_long i, n, m;\n    unsigned char *result;\n    n = len << 2;\n    if (include_length) {\n        m = data[len - 1];\n        if ((m < n - 7) || (m > n - 4)) return NULL;\n        n = m;\n    }\n    result = (unsigned char *)emalloc(n + 1);\n\tfor (i = 0; i < n; i++) {\n        result[i] = (unsigned char)((data[i >> 2] >> ((i & 3) << 3)) & 0xff);\n    }\n\tresult[n] = '\\0';\n\t*ret_len = n;\n\treturn result;\n}\n\nstatic unsigned char *php_xxtea_encrypt(unsigned char *data, xxtea_long len, unsigned char *key, xxtea_long *ret_len) {\n    unsigned char *result;\n    xxtea_long *v, *k, v_len, k_len;\n    v = xxtea_to_long_array(data, len, 1, &v_len);\n    k = xxtea_to_long_array(key, 16, 0, &k_len);\n    xxtea_long_encrypt(v, v_len, k);\n    result = xxtea_to_byte_array(v, v_len, 0, ret_len);\n    efree(v);\n    efree(k);\n    return result;\n}\n\nstatic unsigned char *php_xxtea_decrypt(unsigned char *data, xxtea_long len, unsigned char *key, xxtea_long *ret_len) {\n    unsigned char *result;\n    xxtea_long *v, *k, v_len, k_len;\n    v = xxtea_to_long_array(data, len, 0, &v_len);\n    k = xxtea_to_long_array(key, 16, 0, &k_len);\n    xxtea_long_decrypt(v, v_len, k);\n    result = xxtea_to_byte_array(v, v_len, 1, ret_len);\n    efree(v);\n    efree(k);\n    return result;\n}\n\n/* {{{ proto string xxtea_encrypt(string data, string key)\n   Encrypt string using XXTEA algorithm */\nZEND_FUNCTION(xxtea_encrypt)\n{\n    unsigned char *data, *key;\n    unsigned char *result;\n    xxtea_long data_len, key_len, ret_length;\n\n    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"ss\", &data, &data_len, &key, &key_len) == FAILURE) {\n        return;\n    }\n\tif (data_len == 0) RETVAL_STRINGL(NULL, 0, 0);\n    if (key_len != 16) RETURN_FALSE;\n    result = php_xxtea_encrypt(data, data_len, key, &ret_length);\n    if (result != NULL) {\n        RETVAL_STRINGL((char *)result, ret_length, 0);\n    } else {\n        RETURN_FALSE;\n    }\n}\n/* }}} */\n\n\n/* {{{ proto string xxtea_decrypt(string data, string key)\n   Decrypt string using XXTEA algorithm */\nZEND_FUNCTION(xxtea_decrypt)\n{\n    unsigned char *data, *key;\n    unsigned char *result;\n    xxtea_long data_len, key_len, ret_length;\n\n    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"ss\", &data, &data_len, &key, &key_len) == FAILURE) {\n        return;\n    }\n\tif (data_len == 0) RETVAL_STRINGL(NULL, 0, 0);\n    if (key_len != 16) RETURN_FALSE;\n    result = php_xxtea_decrypt(data, data_len, key, &ret_length);\n    if (result != NULL) {\n\t\tRETVAL_STRINGL((char *)result, ret_length, 0);\n    } else {\n        RETURN_FALSE;\n    }\n}\n/* }}} */\n\nZEND_MINIT_FUNCTION(xxtea)\n{\n    return SUCCESS;\n}\n\nZEND_MSHUTDOWN_FUNCTION(xxtea)\n{\n    return SUCCESS;\n}\n\nZEND_MINFO_FUNCTION(xxtea)\n{\n    php_info_print_table_start();\n    php_info_print_table_row(2, \"xxtea support\", \"enabled\");\n    php_info_print_table_row(2, \"xxtea module version\", XXTEA_VERSION);\n\tphp_info_print_table_row(2, \"xxtea author\", XXTEA_AUTHOR);\n    php_info_print_table_row(2, \"xxtea homepage\", XXTEA_HOMEPAGE);\n\tphp_info_print_table_end();\n}\n\nZEND_FUNCTION(xxtea_info)\n{\n    array_init(return_value);\n    add_assoc_string(return_value, \"ext_version\", XXTEA_VERSION, 1);\n    add_assoc_string(return_value, \"ext_build_date\", XXTEA_BUILD_DATE, 1);\n\tadd_assoc_string(return_value, \"ext_author\", XXTEA_AUTHOR, 1);\n    add_assoc_string(return_value, \"ext_homepage\", XXTEA_HOMEPAGE, 1);\n}\n\n#endif /* if HAVE_XXTEA */\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/php_xxtea.dsp",
    "content": "# Microsoft Developer Studio Project File - Name=\"php_xxtea\" - Package Owner=<4>\n# Microsoft Developer Studio Generated Build File, Format Version 6.00\n# ** DO NOT EDIT **\n\n# TARGTYPE \"Win32 (x86) Dynamic-Link Library\" 0x0102\n\nCFG=php_xxtea - Win32 Debug_php5\n!MESSAGE This is not a valid makefile. To build this project using NMAKE,\n!MESSAGE use the Export Makefile command and run\n!MESSAGE \n!MESSAGE NMAKE /f \"php_xxtea.mak\".\n!MESSAGE \n!MESSAGE You can specify a configuration when running NMAKE\n!MESSAGE by defining the macro CFG on the command line. For example:\n!MESSAGE \n!MESSAGE NMAKE /f \"php_xxtea.mak\" CFG=\"php_xxtea - Win32 Debug_php5\"\n!MESSAGE \n!MESSAGE Possible choices for configuration are:\n!MESSAGE \n!MESSAGE \"php_xxtea - Win32 Debug_php5\" (based on \"Win32 (x86) Dynamic-Link Library\")\n!MESSAGE \"php_xxtea - Win32 Release_php5\" (based on \"Win32 (x86) Dynamic-Link Library\")\n!MESSAGE \"php_xxtea - Win32 Debug_php4\" (based on \"Win32 (x86) Dynamic-Link Library\")\n!MESSAGE \"php_xxtea - Win32 Release_php4\" (based on \"Win32 (x86) Dynamic-Link Library\")\n!MESSAGE \n\n# Begin Project\n# PROP AllowPerConfigDependencies 0\n# PROP Scc_ProjName \"\"\n# PROP Scc_LocalPath \"\"\nCPP=cl.exe\nMTL=midl.exe\nRSC=rc.exe\n\n!IF  \"$(CFG)\" == \"php_xxtea - Win32 Debug_php5\"\n\n# PROP BASE Use_MFC 0\n# PROP BASE Use_Debug_Libraries 1\n# PROP BASE Output_Dir \"Debug_php5\"\n# PROP BASE Intermediate_Dir \"Debug_php5\"\n# PROP BASE Target_Dir \"\"\n# PROP Use_MFC 0\n# PROP Use_Debug_Libraries 1\n# PROP Output_Dir \"Debug_php5\"\n# PROP Intermediate_Dir \"Debug_php5\"\n# PROP Target_Dir \"\"\n# ADD BASE CPP /nologo /MTd /I \"../..\" /I \"../../main\" /I \"../../Zend\" /I \"../../TSRM\" /ZI /W3 /Od /D \"HAVE_XXTEA\" /D \"COMPILE_DL_XXTEA\" /D \"ZTS\" /D \"NDEBUG\" /D \"ZEND_WIN32\" /D \"PHP_WIN32\" /D \"WIN32\" /D \"ZEND_DEBUG=1\" /D \"_MBCS\" /Gm /GZ /c /GX \n# ADD CPP /nologo /MTd /I \"../..\" /I \"../../main\" /I \"../../Zend\" /I \"../../TSRM\" /ZI /W3 /Od /D \"HAVE_XXTEA\" /D \"COMPILE_DL_XXTEA\" /D \"ZTS\" /D \"NDEBUG\" /D \"ZEND_WIN32\" /D \"PHP_WIN32\" /D \"WIN32\" /D \"ZEND_DEBUG=1\" /D \"_MBCS\" /Gm /GZ /c /GX \n# ADD BASE MTL /nologo /win32 \n# ADD MTL /nologo /win32 \n# ADD BASE RSC /l 1033 \n# ADD RSC /l 1033 \nBSC32=bscmake.exe\n# ADD BASE BSC32 /nologo \n# ADD BSC32 /nologo \nLINK32=link.exe\n# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /out:\"Debug_php5\\php_xxtea.dll\" /incremental:yes /libpath:\"../../Release_TS\" /debug /pdb:\"Debug_php5\\php_xxtea.pdb\" /pdbtype:sept /subsystem:windows /implib:\"$(OutDir)/php_xxtea.lib\" /machine:ix86 \n# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /out:\"Debug_php5\\php_xxtea.dll\" /incremental:yes /libpath:\"../../Release_TS\" /debug /pdb:\"Debug_php5\\php_xxtea.pdb\" /pdbtype:sept /subsystem:windows /implib:\"$(OutDir)/php_xxtea.lib\" /machine:ix86 \n\n!ELSEIF  \"$(CFG)\" == \"php_xxtea - Win32 Release_php5\"\n\n# PROP BASE Use_MFC 0\n# PROP BASE Use_Debug_Libraries 0\n# PROP BASE Output_Dir \"Release_php5\"\n# PROP BASE Intermediate_Dir \"Release_php5\"\n# PROP BASE Target_Dir \"\"\n# PROP Use_MFC 0\n# PROP Use_Debug_Libraries 0\n# PROP Output_Dir \"Release_php5\"\n# PROP Intermediate_Dir \"Release_php5\"\n# PROP Target_Dir \"\"\n# ADD BASE CPP /nologo /MD /I \"../..\" /I \"../../main\" /I \"../../Zend\" /I \"../../TSRM\" /W3 /O1 /Og /Oi /Os /Oy /GT /G6 /GA /D \"HAVE_XXTEA\" /D \"COMPILE_DL_XXTEA\" /D \"ZTS\" /D \"NDEBUG\" /D \"ZEND_WIN32\" /D \"PHP_WIN32\" /D \"WIN32\" /D \"ZEND_DEBUG=0\" /D \"_MBCS\" /GF /Gy /TC /c /GX \n# ADD CPP /nologo /MD /I \"../..\" /I \"../../main\" /I \"../../Zend\" /I \"../../TSRM\" /W3 /O1 /Og /Oi /Os /Oy /GT /G6 /GA /D \"HAVE_XXTEA\" /D \"COMPILE_DL_XXTEA\" /D \"ZTS\" /D \"NDEBUG\" /D \"ZEND_WIN32\" /D \"PHP_WIN32\" /D \"WIN32\" /D \"ZEND_DEBUG=0\" /D \"_MBCS\" /GF /Gy /TC /c /GX \n# ADD BASE MTL /nologo /win32 \n# ADD MTL /nologo /win32 \n# ADD BASE RSC /l 1033 \n# ADD RSC /l 1033 \nBSC32=bscmake.exe\n# ADD BASE BSC32 /nologo \n# ADD BSC32 /nologo \nLINK32=link.exe\n# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /out:\"Release_php5\\php_xxtea.dll\" /incremental:no /libpath:\"../../Release_TS\" /pdbtype:sept /subsystem:windows /opt:ref /opt:icf /implib:\"$(OutDir)/php_xxtea.lib\" /machine:ix86 \n# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /out:\"Release_php5\\php_xxtea.dll\" /incremental:no /libpath:\"../../Release_TS\" /pdbtype:sept /subsystem:windows /opt:ref /opt:icf /implib:\"$(OutDir)/php_xxtea.lib\" /machine:ix86 \n\n!ELSEIF  \"$(CFG)\" == \"php_xxtea - Win32 Debug_php4\"\n\n# PROP BASE Use_MFC 0\n# PROP BASE Use_Debug_Libraries 1\n# PROP BASE Output_Dir \"Debug_php4\"\n# PROP BASE Intermediate_Dir \"Debug_php4\"\n# PROP BASE Target_Dir \"\"\n# PROP Use_MFC 0\n# PROP Use_Debug_Libraries 1\n# PROP Output_Dir \"Debug_php4\"\n# PROP Intermediate_Dir \"Debug_php4\"\n# PROP Target_Dir \"\"\n# ADD BASE CPP /nologo /MTd /I \"../..\" /I \"../../main\" /I \"../../Zend\" /I \"../../TSRM\" /ZI /W3 /Od /D \"HAVE_XXTEA\" /D \"COMPILE_DL_XXTEA\" /D \"ZTS\" /D \"NDEBUG\" /D \"ZEND_WIN32\" /D \"PHP_WIN32\" /D \"WIN32\" /D \"ZEND_DEBUG=1\" /D \"_MBCS\" /Gm /GZ /c /GX \n# ADD CPP /nologo /MTd /I \"../..\" /I \"../../main\" /I \"../../Zend\" /I \"../../TSRM\" /ZI /W3 /Od /D \"HAVE_XXTEA\" /D \"COMPILE_DL_XXTEA\" /D \"ZTS\" /D \"NDEBUG\" /D \"ZEND_WIN32\" /D \"PHP_WIN32\" /D \"WIN32\" /D \"ZEND_DEBUG=1\" /D \"_MBCS\" /Gm /GZ /c /GX \n# ADD BASE MTL /nologo /win32 \n# ADD MTL /nologo /win32 \n# ADD BASE RSC /l 1033 \n# ADD RSC /l 1033 \nBSC32=bscmake.exe\n# ADD BASE BSC32 /nologo \n# ADD BSC32 /nologo \nLINK32=link.exe\n# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /out:\"Debug_php4\\php_xxtea.dll\" /incremental:yes /libpath:\"../../Release_TS\" /debug /pdb:\"Debug_php4\\php_xxtea.pdb\" /pdbtype:sept /subsystem:windows /implib:\"$(OutDir)/php_xxtea.lib\" /machine:ix86 \n# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /out:\"Debug_php4\\php_xxtea.dll\" /incremental:yes /libpath:\"../../Release_TS\" /debug /pdb:\"Debug_php4\\php_xxtea.pdb\" /pdbtype:sept /subsystem:windows /implib:\"$(OutDir)/php_xxtea.lib\" /machine:ix86 \n\n!ELSEIF  \"$(CFG)\" == \"php_xxtea - Win32 Release_php4\"\n\n# PROP BASE Use_MFC 0\n# PROP BASE Use_Debug_Libraries 0\n# PROP BASE Output_Dir \"Release_php4\"\n# PROP BASE Intermediate_Dir \"Release_php4\"\n# PROP BASE Target_Dir \"\"\n# PROP Use_MFC 0\n# PROP Use_Debug_Libraries 0\n# PROP Output_Dir \"Release_php4\"\n# PROP Intermediate_Dir \"Release_php4\"\n# PROP Target_Dir \"\"\n# ADD BASE CPP /nologo /MD /I \"../..\" /I \"../../main\" /I \"../../Zend\" /I \"../../TSRM\" /W3 /O1 /Og /Oi /Os /Oy /GT /G6 /GA /D \"HAVE_XXTEA\" /D \"COMPILE_DL_XXTEA\" /D \"ZTS\" /D \"NDEBUG\" /D \"ZEND_WIN32\" /D \"PHP_WIN32\" /D \"WIN32\" /D \"ZEND_DEBUG=0\" /D \"_MBCS\" /GF /Gy /TC /c /GX \n# ADD CPP /nologo /MD /I \"../..\" /I \"../../main\" /I \"../../Zend\" /I \"../../TSRM\" /W3 /O1 /Og /Oi /Os /Oy /GT /G6 /GA /D \"HAVE_XXTEA\" /D \"COMPILE_DL_XXTEA\" /D \"ZTS\" /D \"NDEBUG\" /D \"ZEND_WIN32\" /D \"PHP_WIN32\" /D \"WIN32\" /D \"ZEND_DEBUG=0\" /D \"_MBCS\" /GF /Gy /TC /c /GX \n# ADD BASE MTL /nologo /win32 \n# ADD MTL /nologo /win32 \n# ADD BASE RSC /l 1033 \n# ADD RSC /l 1033 \nBSC32=bscmake.exe\n# ADD BASE BSC32 /nologo \n# ADD BSC32 /nologo \nLINK32=link.exe\n# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /out:\"Release_php4\\php_xxtea.dll\" /incremental:no /libpath:\"../../Release_TS\" /pdbtype:sept /subsystem:windows /opt:ref /opt:icf /implib:\"$(OutDir)/php_xxtea.lib\" /machine:ix86 \n# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /out:\"Release_php4\\php_xxtea.dll\" /incremental:no /libpath:\"../../Release_TS\" /pdbtype:sept /subsystem:windows /opt:ref /opt:icf /implib:\"$(OutDir)/php_xxtea.lib\" /machine:ix86 \n\n!ENDIF\n\n# Begin Target\n\n# Name \"php_xxtea - Win32 Debug_php5\"\n# Name \"php_xxtea - Win32 Release_php5\"\n# Name \"php_xxtea - Win32 Debug_php4\"\n# Name \"php_xxtea - Win32 Release_php4\"\n# Begin Group \"Source Files\"\n\n# PROP Default_Filter \"cpp;c;cxx;def;odl;idl;hpj;bat;asm\"\n# Begin Source File\n\nSOURCE=php_xxtea.c\n# End Source File\n# Begin Group \"lib_xxtea\"\n\n# PROP Default_Filter \"\"\n# Begin Source File\n\nSOURCE=xxtea.c\n# End Source File\n# End Group\n# End Group\n# Begin Group \"Header Files\"\n\n# PROP Default_Filter \"h;hpp;hxx;hm;inl;inc\"\n# Begin Source File\n\nSOURCE=php_xxtea.h\n# End Source File\n# Begin Group \"lib_xxtea\"\n\n# PROP Default_Filter \"\"\n# Begin Source File\n\nSOURCE=xxtea.h\n# End Source File\n# End Group\n# End Group\n# Begin Group \"Resource Files\"\n\n# PROP Default_Filter \"rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe\"\n# End Group\n# End Target\n# End Project\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/php_xxtea.h",
    "content": "/***********************************************************************\n\n    Copyright 2006-2007 Ma Bingyao\n\n    These sources is free software. Redistributions of source code must\n    retain the above copyright notice. Redistributions in binary form\n    must reproduce the above copyright notice. You can redistribute it\n    freely. You can use it with any free or commercial software.\n\n    These sources is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY. Without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n        You may contact the author by:\n           e-mail:  andot@coolcode.cn\n\n*************************************************************************/\n\n#ifndef PHP_XXTEA_H\n#define PHP_XXTEA_H\n\n#ifdef HAVE_CONFIG_H\n#include \"config.h\"\n#endif\n\n#if HAVE_XXTEA\nextern zend_module_entry xxtea_module_entry;\n#define phpext_xxtea_ptr &xxtea_module_entry\n\n#define XXTEA_MODULE_NAME        \"xxtea\"\n#define XXTEA_BUILD_DATE         __DATE__ \" \" __TIME__\n#define XXTEA_VERSION            \"1.0.3\"\n#define XXTEA_AUTHOR             \"Ma Bingyao\"\n#define XXTEA_HOMEPAGE           \"http://www.coolcode.cn/?p=209\"\n\nZEND_MINIT_FUNCTION(xxtea);\nZEND_MSHUTDOWN_FUNCTION(xxtea);\nZEND_MINFO_FUNCTION(xxtea);\n\n/* declaration of functions to be exported */\nZEND_FUNCTION(xxtea_encrypt);\nZEND_FUNCTION(xxtea_decrypt);\nZEND_FUNCTION(xxtea_info);\n\n#else /* if HAVE_XXTEA */\n#define phpext_xxtea_ptr NULL\n#endif\n\n#endif /* ifndef PHP_XXTEA_H */\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/php_xxtea.sln",
    "content": "Microsoft Visual Studio Solution File, Format Version 9.00\n# Visual Studio 2005\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"php_xxtea\", \"php_xxtea.vcproj\", \"{71165FA5-1EBC-4021-AA17-0CCBC7CD5204}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug_php4|Win32 = Debug_php4|Win32\n\t\tDebug_php5|Win32 = Debug_php5|Win32\n\t\tRelease_php4|Win32 = Release_php4|Win32\n\t\tRelease_php5|Win32 = Release_php5|Win32\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{71165FA5-1EBC-4021-AA17-0CCBC7CD5204}.Debug_php4|Win32.ActiveCfg = Debug_php4|Win32\n\t\t{71165FA5-1EBC-4021-AA17-0CCBC7CD5204}.Debug_php4|Win32.Build.0 = Debug_php4|Win32\n\t\t{71165FA5-1EBC-4021-AA17-0CCBC7CD5204}.Debug_php5|Win32.ActiveCfg = Debug_php5|Win32\n\t\t{71165FA5-1EBC-4021-AA17-0CCBC7CD5204}.Debug_php5|Win32.Build.0 = Debug_php5|Win32\n\t\t{71165FA5-1EBC-4021-AA17-0CCBC7CD5204}.Release_php4|Win32.ActiveCfg = Release_php4|Win32\n\t\t{71165FA5-1EBC-4021-AA17-0CCBC7CD5204}.Release_php4|Win32.Build.0 = Release_php4|Win32\n\t\t{71165FA5-1EBC-4021-AA17-0CCBC7CD5204}.Release_php5|Win32.ActiveCfg = Release_php5|Win32\n\t\t{71165FA5-1EBC-4021-AA17-0CCBC7CD5204}.Release_php5|Win32.Build.0 = Release_php5|Win32\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/php_xxtea.vcproj",
    "content": "<?xml version=\"1.0\" encoding=\"gb2312\"?>\n<VisualStudioProject\n\tProjectType=\"Visual C++\"\n\tVersion=\"8.00\"\n\tName=\"php_xxtea\"\n\tProjectGUID=\"{71165FA5-1EBC-4021-AA17-0CCBC7CD5204}\"\n\t>\n\t<Platforms>\n\t\t<Platform\n\t\t\tName=\"Win32\"\n\t\t/>\n\t</Platforms>\n\t<ToolFiles>\n\t</ToolFiles>\n\t<Configurations>\n\t\t<Configuration\n\t\t\tName=\"Debug_php5|Win32\"\n\t\t\tOutputDirectory=\".\\Debug_php5\"\n\t\t\tIntermediateDirectory=\".\\Debug_php5\"\n\t\t\tConfigurationType=\"2\"\n\t\t\tInheritedPropertySheets=\"$(VCInstallDir)VCProjectDefaults\\UpgradeFromVC60.vsprops\"\n\t\t\tUseOfMFC=\"0\"\n\t\t\tATLMinimizesCRunTimeLibraryUsage=\"false\"\n\t\t\tCharacterSet=\"2\"\n\t\t\t>\n\t\t\t<Tool\n\t\t\t\tName=\"VCPreBuildEventTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCCustomBuildTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCMIDLTool\"\n\t\t\t\tSuppressStartupBanner=\"true\"\n\t\t\t\tTargetEnvironment=\"1\"\n\t\t\t\tTypeLibraryName=\".\\Debug_php5/php_xxtea.tlb\"\n\t\t\t\tHeaderFileName=\"\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCCLCompilerTool\"\n\t\t\t\tOptimization=\"0\"\n\t\t\t\tAdditionalIncludeDirectories=\"../..,../../main,../../Zend,../../TSRM\"\n\t\t\t\tPreprocessorDefinitions=\"HAVE_XXTEA;COMPILE_DL_XXTEA;ZTS;NDEBUG;ZEND_WIN32;PHP_WIN32;WIN32;ZEND_DEBUG=1\"\n\t\t\t\tMinimalRebuild=\"true\"\n\t\t\t\tBasicRuntimeChecks=\"3\"\n\t\t\t\tRuntimeLibrary=\"1\"\n\t\t\t\tPrecompiledHeaderFile=\".\\Debug_php5/php_xxtea.pch\"\n\t\t\t\tAssemblerListingLocation=\".\\Debug_php5/\"\n\t\t\t\tObjectFile=\".\\Debug_php5/\"\n\t\t\t\tProgramDataBaseFileName=\".\\Debug_php5/\"\n\t\t\t\tWarningLevel=\"3\"\n\t\t\t\tSuppressStartupBanner=\"true\"\n\t\t\t\tDebugInformationFormat=\"4\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCManagedResourceCompilerTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCResourceCompilerTool\"\n\t\t\t\tCulture=\"1033\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCPreLinkEventTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCLinkerTool\"\n\t\t\t\tAdditionalDependencies=\"odbc32.lib odbccp32.lib php5ts.lib\"\n\t\t\t\tOutputFile=\"Debug_php5\\php_xxtea.dll\"\n\t\t\t\tLinkIncremental=\"2\"\n\t\t\t\tSuppressStartupBanner=\"true\"\n\t\t\t\tAdditionalLibraryDirectories=\"../../Release_TS\"\n\t\t\t\tGenerateDebugInformation=\"true\"\n\t\t\t\tProgramDatabaseFile=\"Debug_php5\\php_xxtea.pdb\"\n\t\t\t\tSubSystem=\"2\"\n\t\t\t\tImportLibrary=\"$(OutDir)/php_xxtea.lib\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCALinkTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCManifestTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCXDCMakeTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCBscMakeTool\"\n\t\t\t\tSuppressStartupBanner=\"true\"\n\t\t\t\tOutputFile=\".\\Debug_php5/php_xxtea.bsc\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCFxCopTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCAppVerifierTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCWebDeploymentTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCPostBuildEventTool\"\n\t\t\t/>\n\t\t</Configuration>\n\t\t<Configuration\n\t\t\tName=\"Release_php4|Win32\"\n\t\t\tOutputDirectory=\".\\Release_php4\"\n\t\t\tIntermediateDirectory=\".\\Release_php4\"\n\t\t\tConfigurationType=\"2\"\n\t\t\tInheritedPropertySheets=\"$(VCInstallDir)VCProjectDefaults\\UpgradeFromVC60.vsprops\"\n\t\t\tUseOfMFC=\"0\"\n\t\t\tATLMinimizesCRunTimeLibraryUsage=\"false\"\n\t\t\tCharacterSet=\"2\"\n\t\t\t>\n\t\t\t<Tool\n\t\t\t\tName=\"VCPreBuildEventTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCCustomBuildTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCMIDLTool\"\n\t\t\t\tSuppressStartupBanner=\"true\"\n\t\t\t\tTargetEnvironment=\"1\"\n\t\t\t\tTypeLibraryName=\".\\Release_php4/php_xxtea.tlb\"\n\t\t\t\tHeaderFileName=\"\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCCLCompilerTool\"\n\t\t\t\tAdditionalOptions=\"/GT /GA \"\n\t\t\t\tOptimization=\"4\"\n\t\t\t\tEnableIntrinsicFunctions=\"true\"\n\t\t\t\tFavorSizeOrSpeed=\"2\"\n\t\t\t\tOmitFramePointers=\"true\"\n\t\t\t\tAdditionalIncludeDirectories=\"../..,../../main,../../Zend,../../TSRM\"\n\t\t\t\tPreprocessorDefinitions=\"HAVE_XXTEA;COMPILE_DL_XXTEA;ZTS;NDEBUG;ZEND_WIN32;PHP_WIN32;WIN32;ZEND_DEBUG=0\"\n\t\t\t\tStringPooling=\"true\"\n\t\t\t\tRuntimeLibrary=\"2\"\n\t\t\t\tEnableFunctionLevelLinking=\"true\"\n\t\t\t\tPrecompiledHeaderFile=\".\\Release_php4/php_xxtea.pch\"\n\t\t\t\tAssemblerListingLocation=\".\\Release_php4/\"\n\t\t\t\tObjectFile=\".\\Release_php4/\"\n\t\t\t\tProgramDataBaseFileName=\".\\Release_php4/\"\n\t\t\t\tWarningLevel=\"3\"\n\t\t\t\tSuppressStartupBanner=\"true\"\n\t\t\t\tCompileAs=\"1\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCManagedResourceCompilerTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCResourceCompilerTool\"\n\t\t\t\tCulture=\"1033\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCPreLinkEventTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCLinkerTool\"\n\t\t\t\tAdditionalDependencies=\"odbc32.lib odbccp32.lib php4ts.lib\"\n\t\t\t\tOutputFile=\"Release_php4\\php_xxtea.dll\"\n\t\t\t\tLinkIncremental=\"1\"\n\t\t\t\tSuppressStartupBanner=\"true\"\n\t\t\t\tAdditionalLibraryDirectories=\"../../Release_TS\"\n\t\t\t\tProgramDatabaseFile=\".\\Release_php4/php_xxtea.pdb\"\n\t\t\t\tSubSystem=\"2\"\n\t\t\t\tOptimizeReferences=\"2\"\n\t\t\t\tEnableCOMDATFolding=\"2\"\n\t\t\t\tImportLibrary=\"$(OutDir)/php_xxtea.lib\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCALinkTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCManifestTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCXDCMakeTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCBscMakeTool\"\n\t\t\t\tSuppressStartupBanner=\"true\"\n\t\t\t\tOutputFile=\".\\Release_php4/php_xxtea.bsc\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCFxCopTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCAppVerifierTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCWebDeploymentTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCPostBuildEventTool\"\n\t\t\t/>\n\t\t</Configuration>\n\t\t<Configuration\n\t\t\tName=\"Release_php5|Win32\"\n\t\t\tOutputDirectory=\".\\Release_php5\"\n\t\t\tIntermediateDirectory=\".\\Release_php5\"\n\t\t\tConfigurationType=\"2\"\n\t\t\tInheritedPropertySheets=\"$(VCInstallDir)VCProjectDefaults\\UpgradeFromVC60.vsprops\"\n\t\t\tUseOfMFC=\"0\"\n\t\t\tATLMinimizesCRunTimeLibraryUsage=\"false\"\n\t\t\tCharacterSet=\"2\"\n\t\t\t>\n\t\t\t<Tool\n\t\t\t\tName=\"VCPreBuildEventTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCCustomBuildTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCMIDLTool\"\n\t\t\t\tSuppressStartupBanner=\"true\"\n\t\t\t\tTargetEnvironment=\"1\"\n\t\t\t\tTypeLibraryName=\".\\Release_php5/php_xxtea.tlb\"\n\t\t\t\tHeaderFileName=\"\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCCLCompilerTool\"\n\t\t\t\tAdditionalOptions=\"/GT /GA \"\n\t\t\t\tOptimization=\"4\"\n\t\t\t\tEnableIntrinsicFunctions=\"true\"\n\t\t\t\tFavorSizeOrSpeed=\"2\"\n\t\t\t\tOmitFramePointers=\"true\"\n\t\t\t\tAdditionalIncludeDirectories=\"../..,../../main,../../Zend,../../TSRM\"\n\t\t\t\tPreprocessorDefinitions=\"HAVE_XXTEA;COMPILE_DL_XXTEA;ZTS;NDEBUG;ZEND_WIN32;PHP_WIN32;WIN32;ZEND_DEBUG=0\"\n\t\t\t\tStringPooling=\"true\"\n\t\t\t\tRuntimeLibrary=\"2\"\n\t\t\t\tEnableFunctionLevelLinking=\"true\"\n\t\t\t\tPrecompiledHeaderFile=\".\\Release_php5/php_xxtea.pch\"\n\t\t\t\tAssemblerListingLocation=\".\\Release_php5/\"\n\t\t\t\tObjectFile=\".\\Release_php5/\"\n\t\t\t\tProgramDataBaseFileName=\".\\Release_php5/\"\n\t\t\t\tWarningLevel=\"3\"\n\t\t\t\tSuppressStartupBanner=\"true\"\n\t\t\t\tCompileAs=\"1\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCManagedResourceCompilerTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCResourceCompilerTool\"\n\t\t\t\tCulture=\"1033\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCPreLinkEventTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCLinkerTool\"\n\t\t\t\tAdditionalDependencies=\"odbc32.lib odbccp32.lib php5ts.lib\"\n\t\t\t\tOutputFile=\"Release_php5\\php_xxtea.dll\"\n\t\t\t\tLinkIncremental=\"1\"\n\t\t\t\tSuppressStartupBanner=\"true\"\n\t\t\t\tAdditionalLibraryDirectories=\"../../Release_TS\"\n\t\t\t\tProgramDatabaseFile=\".\\Release_php5/php_xxtea.pdb\"\n\t\t\t\tSubSystem=\"2\"\n\t\t\t\tOptimizeReferences=\"2\"\n\t\t\t\tEnableCOMDATFolding=\"2\"\n\t\t\t\tImportLibrary=\"$(OutDir)/php_xxtea.lib\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCALinkTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCManifestTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCXDCMakeTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCBscMakeTool\"\n\t\t\t\tSuppressStartupBanner=\"true\"\n\t\t\t\tOutputFile=\".\\Release_php5/php_xxtea.bsc\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCFxCopTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCAppVerifierTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCWebDeploymentTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCPostBuildEventTool\"\n\t\t\t/>\n\t\t</Configuration>\n\t\t<Configuration\n\t\t\tName=\"Debug_php4|Win32\"\n\t\t\tOutputDirectory=\".\\Debug_php4\"\n\t\t\tIntermediateDirectory=\".\\Debug_php4\"\n\t\t\tConfigurationType=\"2\"\n\t\t\tInheritedPropertySheets=\"$(VCInstallDir)VCProjectDefaults\\UpgradeFromVC60.vsprops\"\n\t\t\tUseOfMFC=\"0\"\n\t\t\tATLMinimizesCRunTimeLibraryUsage=\"false\"\n\t\t\tCharacterSet=\"2\"\n\t\t\t>\n\t\t\t<Tool\n\t\t\t\tName=\"VCPreBuildEventTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCCustomBuildTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCMIDLTool\"\n\t\t\t\tSuppressStartupBanner=\"true\"\n\t\t\t\tTargetEnvironment=\"1\"\n\t\t\t\tTypeLibraryName=\".\\Debug_php4/php_xxtea.tlb\"\n\t\t\t\tHeaderFileName=\"\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCCLCompilerTool\"\n\t\t\t\tOptimization=\"0\"\n\t\t\t\tAdditionalIncludeDirectories=\"../..,../../main,../../Zend,../../TSRM\"\n\t\t\t\tPreprocessorDefinitions=\"HAVE_XXTEA;COMPILE_DL_XXTEA;ZTS;NDEBUG;ZEND_WIN32;PHP_WIN32;WIN32;ZEND_DEBUG=1\"\n\t\t\t\tMinimalRebuild=\"true\"\n\t\t\t\tBasicRuntimeChecks=\"3\"\n\t\t\t\tRuntimeLibrary=\"1\"\n\t\t\t\tPrecompiledHeaderFile=\".\\Debug_php4/php_xxtea.pch\"\n\t\t\t\tAssemblerListingLocation=\".\\Debug_php4/\"\n\t\t\t\tObjectFile=\".\\Debug_php4/\"\n\t\t\t\tProgramDataBaseFileName=\".\\Debug_php4/\"\n\t\t\t\tWarningLevel=\"3\"\n\t\t\t\tSuppressStartupBanner=\"true\"\n\t\t\t\tDebugInformationFormat=\"4\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCManagedResourceCompilerTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCResourceCompilerTool\"\n\t\t\t\tCulture=\"1033\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCPreLinkEventTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCLinkerTool\"\n\t\t\t\tAdditionalDependencies=\"odbc32.lib odbccp32.lib php4ts.lib\"\n\t\t\t\tOutputFile=\"Debug_php4\\php_xxtea.dll\"\n\t\t\t\tLinkIncremental=\"2\"\n\t\t\t\tSuppressStartupBanner=\"true\"\n\t\t\t\tAdditionalLibraryDirectories=\"../../Release_TS\"\n\t\t\t\tGenerateDebugInformation=\"true\"\n\t\t\t\tProgramDatabaseFile=\"Debug_php4\\php_xxtea.pdb\"\n\t\t\t\tSubSystem=\"2\"\n\t\t\t\tImportLibrary=\"$(OutDir)/php_xxtea.lib\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCALinkTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCManifestTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCXDCMakeTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCBscMakeTool\"\n\t\t\t\tSuppressStartupBanner=\"true\"\n\t\t\t\tOutputFile=\".\\Debug_php4/php_xxtea.bsc\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCFxCopTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCAppVerifierTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCWebDeploymentTool\"\n\t\t\t/>\n\t\t\t<Tool\n\t\t\t\tName=\"VCPostBuildEventTool\"\n\t\t\t/>\n\t\t</Configuration>\n\t</Configurations>\n\t<References>\n\t</References>\n\t<Files>\n\t\t<Filter\n\t\t\tName=\"Source Files\"\n\t\t\tFilter=\"cpp;c;cxx;def;odl;idl;hpj;bat;asm\"\n\t\t\t>\n\t\t\t<File\n\t\t\t\tRelativePath=\"php_xxtea.c\"\n\t\t\t\t>\n\t\t\t\t<FileConfiguration\n\t\t\t\t\tName=\"Debug_php5|Win32\"\n\t\t\t\t\t>\n\t\t\t\t\t<Tool\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"\"\n\t\t\t\t\t\tPreprocessorDefinitions=\"\"\n\t\t\t\t\t/>\n\t\t\t\t</FileConfiguration>\n\t\t\t\t<FileConfiguration\n\t\t\t\t\tName=\"Release_php4|Win32\"\n\t\t\t\t\t>\n\t\t\t\t\t<Tool\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"\"\n\t\t\t\t\t\tPreprocessorDefinitions=\"\"\n\t\t\t\t\t/>\n\t\t\t\t</FileConfiguration>\n\t\t\t\t<FileConfiguration\n\t\t\t\t\tName=\"Release_php5|Win32\"\n\t\t\t\t\t>\n\t\t\t\t\t<Tool\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"\"\n\t\t\t\t\t\tPreprocessorDefinitions=\"\"\n\t\t\t\t\t/>\n\t\t\t\t</FileConfiguration>\n\t\t\t\t<FileConfiguration\n\t\t\t\t\tName=\"Debug_php4|Win32\"\n\t\t\t\t\t>\n\t\t\t\t\t<Tool\n\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n\t\t\t\t\t\tAdditionalIncludeDirectories=\"\"\n\t\t\t\t\t\tPreprocessorDefinitions=\"\"\n\t\t\t\t\t/>\n\t\t\t\t</FileConfiguration>\n\t\t\t</File>\n\t\t\t<Filter\n\t\t\t\tName=\"lib_xxtea\"\n\t\t\t\t>\n\t\t\t\t<File\n\t\t\t\t\tRelativePath=\"xxtea.c\"\n\t\t\t\t\t>\n\t\t\t\t\t<FileConfiguration\n\t\t\t\t\t\tName=\"Debug_php5|Win32\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t<Tool\n\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n\t\t\t\t\t\t\tAdditionalIncludeDirectories=\"\"\n\t\t\t\t\t\t\tPreprocessorDefinitions=\"\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FileConfiguration>\n\t\t\t\t\t<FileConfiguration\n\t\t\t\t\t\tName=\"Release_php4|Win32\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t<Tool\n\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n\t\t\t\t\t\t\tAdditionalIncludeDirectories=\"\"\n\t\t\t\t\t\t\tPreprocessorDefinitions=\"\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FileConfiguration>\n\t\t\t\t\t<FileConfiguration\n\t\t\t\t\t\tName=\"Release_php5|Win32\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t<Tool\n\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n\t\t\t\t\t\t\tAdditionalIncludeDirectories=\"\"\n\t\t\t\t\t\t\tPreprocessorDefinitions=\"\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FileConfiguration>\n\t\t\t\t\t<FileConfiguration\n\t\t\t\t\t\tName=\"Debug_php4|Win32\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t<Tool\n\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n\t\t\t\t\t\t\tAdditionalIncludeDirectories=\"\"\n\t\t\t\t\t\t\tPreprocessorDefinitions=\"\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FileConfiguration>\n\t\t\t\t</File>\n\t\t\t</Filter>\n\t\t</Filter>\n\t\t<Filter\n\t\t\tName=\"Header Files\"\n\t\t\tFilter=\"h;hpp;hxx;hm;inl;inc\"\n\t\t\t>\n\t\t\t<File\n\t\t\t\tRelativePath=\"php_xxtea.h\"\n\t\t\t\t>\n\t\t\t</File>\n\t\t\t<Filter\n\t\t\t\tName=\"lib_xxtea\"\n\t\t\t\t>\n\t\t\t\t<File\n\t\t\t\t\tRelativePath=\"xxtea.h\"\n\t\t\t\t\t>\n\t\t\t\t</File>\n\t\t\t</Filter>\n\t\t</Filter>\n\t\t<Filter\n\t\t\tName=\"Resource Files\"\n\t\t\tFilter=\"rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe\"\n\t\t\t>\n\t\t</Filter>\n\t</Files>\n\t<Globals>\n\t</Globals>\n</VisualStudioProject>\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/test/test.php",
    "content": "<?php\necho xxtea_decrypt(xxtea_encrypt(\"\", \"\"), \"\");\necho xxtea_decrypt(xxtea_encrypt(\"1\", \"\"), \"\");\necho xxtea_decrypt(xxtea_encrypt(\"1\", \"1\"), \"1\");\necho xxtea_decrypt(xxtea_encrypt(\"12222222222222\", \"2222222222222222\"), \"2222222222222222\");\necho xxtea_decrypt(xxtea_encrypt(\"12222222222222\", \"22222222222\"), \"22222222222\");\nprint_r(xxtea_info());\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/xxtea.c",
    "content": "/***********************************************************************\n\n    Copyright 2006-2007 Ma Bingyao\n\n    These sources is free software. Redistributions of source code must\n    retain the above copyright notice. Redistributions in binary form\n    must reproduce the above copyright notice. You can redistribute it\n    freely. You can use it with any free or commercial software.\n\n    These sources is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY. Without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n        You may contact the author by:\n           e-mail:  andot@coolcode.cn\n\n*************************************************************************/\n#include \"xxtea.h\"\n\nvoid xxtea_long_encrypt(xxtea_long *v, xxtea_long len, xxtea_long *k) {\n    xxtea_long n = len - 1;\n    xxtea_long z = v[n], y = v[0], p, q = 6 + 52 / (n + 1), sum = 0, e;\n    if (n < 1) {\n        return;\n    }\n    while (0 < q--) {\n        sum += XXTEA_DELTA;\n        e = sum >> 2 & 3;\n        for (p = 0; p < n; p++) {\n            y = v[p + 1];\n            z = v[p] += XXTEA_MX;\n        }\n        y = v[0];\n        z = v[n] += XXTEA_MX;\n    }\n}\n\nvoid xxtea_long_decrypt(xxtea_long *v, xxtea_long len, xxtea_long *k) {\n    xxtea_long n = len - 1;\n    xxtea_long z = v[n], y = v[0], p, q = 6 + 52 / (n + 1), sum = q * XXTEA_DELTA, e;\n    if (n < 1) {\n        return;\n    }\n    while (sum != 0) {\n        e = sum >> 2 & 3;\n        for (p = n; p > 0; p--) {\n            z = v[p - 1];\n            y = v[p] -= XXTEA_MX;\n        }\n        z = v[n];\n        y = v[0] -= XXTEA_MX;\n        sum -= XXTEA_DELTA;\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/pecl/xxtea/xxtea.h",
    "content": "/***********************************************************************\n\n    Copyright 2006-2007 Ma Bingyao\n\n    These sources is free software. Redistributions of source code must\n    retain the above copyright notice. Redistributions in binary form\n    must reproduce the above copyright notice. You can redistribute it\n    freely. You can use it with any free or commercial software.\n\n    These sources is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY. Without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n        You may contact the author by:\n           e-mail:  andot@coolcode.cn\n\n*************************************************************************/\n\n#ifndef XXTEA_H\n#define XXTEA_H\n\n#include <stddef.h> /* for size_t & NULL declarations */\n\n#if defined(_MSC_VER)\n\ntypedef unsigned __int32 xxtea_long;\n\n#else\n\n#if defined(__FreeBSD__) && __FreeBSD__ < 5\n/* FreeBSD 4 doesn't have stdint.h file */\n#include <inttypes.h>\n#else\n#include <stdint.h>\n#endif\n\ntypedef uint32_t xxtea_long;\n\n#endif /* end of if defined(_MSC_VER) */\n\n#define XXTEA_MX (z >> 5 ^ y << 2) + (y >> 3 ^ z << 4) ^ (sum ^ y) + (k[p & 3 ^ e] ^ z)\n#define XXTEA_DELTA 0x9e3779b9\n\nvoid xxtea_long_encrypt(xxtea_long *v, xxtea_long len, xxtea_long *k);\nvoid xxtea_long_decrypt(xxtea_long *v, xxtea_long len, xxtea_long *k);\n\n#endif\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/phprpc_client.php",
    "content": "<?php\n/**********************************************************\\\n|                                                          |\n| The implementation of PHPRPC Protocol 3.0                |\n|                                                          |\n| phprpc_client.php                                        |\n|                                                          |\n| Release 3.0.1                                            |\n| Copyright by Team-PHPRPC                                 |\n|                                                          |\n| WebSite:  http://www.phprpc.org/                         |\n|           http://www.phprpc.net/                         |\n|           http://www.phprpc.com/                         |\n|           http://sourceforge.net/projects/php-rpc/       |\n|                                                          |\n| Authors:  Ma Bingyao <andot@ujn.edu.cn>                  |\n|                                                          |\n| This file may be distributed and/or modified under the   |\n| terms of the GNU General Public License (GPL) version    |\n| 2.0 as published by the Free Software Foundation and     |\n| appearing in the included file LICENSE.                  |\n|                                                          |\n\\**********************************************************/\n\n/* PHPRPC Client for PHP.\n *\n * Copyright: Ma Bingyao <andot@ujn.edu.cn>\n * Version: 3.0\n * LastModified: Apr 12, 2010\n * This library is free.  You can redistribute it and/or modify it under GPL.\n *\n/*\n * Interfaces\n *\n * $rpc_client = new PHPRPC_Client();\n * $rpc_client->setProxy(NULL);\n * $rpc_client->useService('http://www.phprpc.org/server.php');\n * $rpc_client->setKeyLength(1024);\n * $rpc_client->setEncryptMode(3);\n * $args = array(1, 2);\n * echo $rpc_client->invoke('add', &$args);\n * echo \"<br />\";\n * $n = 3;\n * $args = array(&$n);\n * echo $rpc_client->invoke('inc', &$args, true);\n * echo \"<br />\";\n * echo $rpc_client->sub(3, 2);\n * echo \"<br />\";\n * // error handle\n * $result = $rpc_client->mul(1, 2);  // no mul function\n * if (is_a($result, \"PHPRPC_Error\")) {\n *     echo $result->toString();\n * }\n */\n\n\n$_PHPRPC_COOKIES = array();\n$_PHPRPC_COOKIE = '';\n$_PHPRPC_SID = 0;\n\nif (defined('KEEP_PHPRPC_COOKIE_IN_SESSION')) {\n    if (isset($_SESSION['phprpc_cookies']) and isset($_SESSION['phprpc_cookie'])) {\n        $_PHPRPC_COOKIES = $_SESSION['phprpc_cookies'];\n        $_PHPRPC_COOKIE = $_SESSION['phprpc_cookie'];\n    }\n    function keep_phprpc_cookie_in_session() {\n        global $_PHPRPC_COOKIES, $_PHPRPC_COOKIE;\n        $_SESSION['phprpc_cookies'] = $_PHPRPC_COOKIES;\n        $_SESSION['phprpc_cookie'] = $_PHPRPC_COOKIE;\n    }\n    register_shutdown_function('keep_phprpc_cookie_in_session');\n}\n\nclass PHPRPC_Error {\n    var $Number;\n    var $Message;\n    function PHPRPC_Error($errno, $errstr) {\n        $this->Number = $errno;\n        $this->Message = $errstr;\n    }\n    function toString() {\n        return $this->Number . \":\" . $this->Message;\n    }\n    function __toString() {\n        return $this->toString();\n    }\n    function getNumber() {\n        return $this->Number;\n    }\n    function getMessage() {\n        return $this->Message;\n    }\n}\n\nclass _PHPRPC_Client {\n    var $_server;\n    var $_timeout;\n    var $_output;\n    var $_warning;\n    var $_proxy;\n    var $_key;\n    var $_keylen;\n    var $_encryptMode;\n    var $_charset;\n    var $_socket;\n    var $_clientid;\n    var $_http_version;\n    var $_keep_alive;\n    // Public Methods\n    function _PHPRPC_Client($serverURL = '') {\n        global $_PHPRPC_SID;\n        require_once('compat.php');\n        //register_shutdown_function(array(&$this, \"_disconnect\"));\n        $this->_proxy = NULL;\n        $this->_timeout = 30;\n        $this->_clientid = 'php' . rand(1 << 30, 1 << 31) . time() . $_PHPRPC_SID;\n        $_PHPRPC_SID++;\n        $this->_socket = false;\n        if ($serverURL != '') {\n            $this->useService($serverURL);\n        }\n    }\n    function useService($serverURL, $username = NULL, $password = NULL) {\n        $this->_disconnect();\n        $this->_http_version = \"1.1\";\n        $this->_keep_alive = true;\n        $this->_server = array();\n        $this->_key = NULL;\n        $this->_keylen = 128;\n        $this->_encryptMode = 0;\n        $this->_charset = 'utf-8';\n        $urlparts = parse_url($serverURL);\n        if (!isset($urlparts['host'])) {\n            if (isset($_SERVER[\"HTTP_HOST\"])) {\n                $urlparts['host'] = $_SERVER[\"HTTP_HOST\"];\n            }\n            else if (isset($_SERVER[\"SERVER_NAME\"])) {\n                $urlparts['host'] = $_SERVER[\"SERVER_NAME\"];\n            }\n            else {\n                $urlparts['host'] = \"localhost\";\n            }\n            if (!isset($_SERVER[\"HTTPS\"]) ||\n                $_SERVER[\"HTTPS\"] == \"off\"  ||\n                $_SERVER[\"HTTPS\"] == \"\") {\n                $urlparts['scheme'] = \"http\";\n            }\n            else {\n                $urlparts['scheme'] = \"https\";\n            }\n            $urlparts['port'] = $_SERVER[\"SERVER_PORT\"];\n        }\n\n        if (!isset($urlparts['port'])) {\n            if ($urlparts['scheme'] == \"https\") {\n                $urlparts['port'] = 443;\n            }\n            else {\n                $urlparts['port'] = 80;\n            }\n        }\n\n        if (!isset($urlparts['path'])) {\n            $urlparts['path'] = \"/\";\n        }\n        else if (($urlparts['path']{0} != '/') && ($_SERVER[\"PHP_SELF\"]{0} == '/')) {\n            $urlparts['path'] = substr($_SERVER[\"PHP_SELF\"], 0, strrpos($_SERVER[\"PHP_SELF\"], '/') + 1) . $urlparts['path'];\n        }\n\n        if (isset($urlparts['query'])) {\n            $urlparts['path'] .= '?' . $urlparts['query'];\n        }\n\n        if (!isset($urlparts['user']) || !is_null($username)) {\n            $urlparts['user'] = $username;\n        }\n\n        if (!isset($urlparts['pass']) || !is_null($password)) {\n            $urlparts['pass'] = $password;\n        }\n\n        $this->_server['scheme'] = $urlparts['scheme'];\n        $this->_server['host'] = $urlparts['host'];\n        $this->_server['port'] = $urlparts['port'];\n        $this->_server['path'] = $urlparts['path'];\n        $this->_server['user'] = $urlparts['user'];\n        $this->_server['pass'] = $urlparts['pass'];\n    }\n    function setProxy($host, $port = NULL, $username = NULL, $password = NULL) {\n        if (is_null($host)) {\n            $this->_proxy = NULL;\n        }\n        else {\n            if (is_null($port)) {\n                $urlparts = parse_url($host);\n                if (isset($urlparts['host'])) {\n                    $host = $urlparts['host'];\n                }\n                if (isset($urlparts['port'])) {\n                    $port = $urlparts['port'];\n                }\n                else {\n                    $port = 80;\n                }\n                if (isset($urlparts['user']) && is_null($username)) {\n                    $username = $urlparts['user'];\n                }\n                if (isset($urlparts['pass']) && is_null($password)) {\n                    $password = $urlparts['pass'];\n                }\n            }\n            $this->_proxy = array();\n            $this->_proxy['host'] = $host;\n            $this->_proxy['port'] = $port;\n            $this->_proxy['user'] = $username;\n            $this->_proxy['pass'] = $password;\n        }\n    }\n    function setKeyLength($keylen) {\n        if (!is_null($this->_key)) {\n            return false;\n        }\n        else {\n            $this->_keylen = $keylen;\n            return true;\n        }\n    }\n    function getKeyLength() {\n        return $this->_keylen;\n    }\n    function setEncryptMode($encryptMode) {\n        if (($encryptMode >= 0) && ($encryptMode <= 3)) {\n            $this->_encryptMode = (int)($encryptMode);\n            return true;\n        }\n        else {\n            $this->_encryptMode = 0;\n            return false;\n        }\n    }\n    function getEncryptMode() {\n        return $this->_encryptMode;\n    }\n    function setCharset($charset) {\n        $this->_charset = $charset;\n    }\n    function getCharset() {\n        return $this->_charset;\n    }\n    function setTimeout($timeout) {\n        $this->_timeout = $timeout;\n    }\n    function getTimeout() {\n        return $this->_timeout;\n    }\n    function invoke($funcname, &$args, $byRef = false) {\n        $result = $this->_key_exchange();\n        if (is_a($result, 'PHPRPC_Error')) {\n            return $result;\n        }\n        $request = \"phprpc_func=$funcname\";\n        if (count($args) > 0) {\n            $request .= \"&phprpc_args=\" . base64_encode($this->_encrypt(serialize_fix($args), 1));\n        }\n        $request .= \"&phprpc_encrypt={$this->_encryptMode}\";\n        if (!$byRef) {\n            $request .= \"&phprpc_ref=false\";\n        }\n        $request = str_replace('+', '%2B', $request);\n        $result = $this->_post($request);\n        if (is_a($result, 'PHPRPC_Error')) {\n            return $result;\n        }\n        $phprpc_errno = 0;\n        $phprpc_errstr = NULL;\n        if (isset($result['phprpc_errno'])) {\n            $phprpc_errno = intval($result['phprpc_errno']);\n        }\n        if (isset($result['phprpc_errstr'])) {\n            $phprpc_errstr = base64_decode($result['phprpc_errstr']);\n        }\n        $this->_warning = new PHPRPC_Error($phprpc_errno, $phprpc_errstr);\n        if (array_key_exists('phprpc_output', $result)) {\n            $this->_output = base64_decode($result['phprpc_output']);\n            if ($this->_server['version'] >= 3) {\n                $this->_output = $this->_decrypt($this->_output, 3);\n            }\n        }\n        else {\n            $this->_output = '';\n        }\n        if (array_key_exists('phprpc_result', $result)) {\n            if (array_key_exists('phprpc_args', $result)) {\n                $arguments = unserialize($this->_decrypt(base64_decode($result['phprpc_args']), 1));\n                for ($i = 0; $i < count($arguments); $i++) {\n                    $args[$i] = $arguments[$i];\n                }\n            }\n            $result = unserialize($this->_decrypt(base64_decode($result['phprpc_result']), 2));\n        }\n        else {\n            $result = $this->_warning;\n        }\n        return $result;\n    }\n\n    function getOutput() {\n        return $this->_output;\n    }\n\n    function getWarning() {\n        return $this->_warning;\n    }\n\n    function _connect() {\n        if (is_null($this->_proxy)) {\n            $host = (($this->_server['scheme'] == \"https\") ? \"ssl://\" : \"\") . $this->_server['host'];\n            $this->_socket = @pfsockopen($host, $this->_server['port'], $errno, $errstr, $this->_timeout);\n        }\n        else {\n            $host = (($this->_server['scheme'] == \"https\") ? \"ssl://\" : \"\") . $this->_proxy['host'];\n            $this->_socket = @pfsockopen($host, $this->_proxy['port'], $errno, $errstr, $this->_timeout);\n        }\n        if ($this->_socket === false) {\n            return new PHPRPC_Error($errno, $errstr);\n        }\n        stream_set_write_buffer($this->_socket, 0);\n        socket_set_timeout($this->_socket, $this->_timeout);\n        return true;\n    }\n\n    function _disconnect() {\n        if ($this->_socket !== false) {\n            fclose($this->_socket);\n            $this->_socket = false;\n        }\n    }\n\n    function _socket_read($size) {\n        $content = \"\";\n        while (!feof($this->_socket) && ($size > 0)) {\n            $str = fread($this->_socket, $size);\n            $content .= $str;\n            $size -= strlen($str);\n        }\n        return $content;\n    }\n    function _post($request_body) {\n        global $_PHPRPC_COOKIE;\n        $request_body = 'phprpc_id=' . $this->_clientid . '&' . $request_body;\n        if ($this->_socket === false) {\n            $error = $this->_connect();\n            if (is_a($error, 'PHPRPC_Error')) {\n                return $error;\n            }\n        }\n        if (is_null($this->_proxy)) {\n            $url = $this->_server['path'];\n            $connection = \"Connection: \" . ($this->_keep_alive ? 'Keep-Alive' : 'Close') . \"\\r\\n\" .\n                          \"Cache-Control: no-cache\\r\\n\";\n        }\n        else {\n            $url = \"{$this->_server['scheme']}://{$this->_server['host']}:{$this->_server['port']}{$this->_server['path']}\";\n            $connection = \"Proxy-Connection: \" . ($this->_keep_alive ? 'keep-alive' : 'close') . \"\\r\\n\";\n            if (!is_null($this->_proxy['user'])) {\n                $connection .= \"Proxy-Authorization: Basic \" . base64_encode($this->_proxy['user'] . \":\" . $this->_proxy['pass']) . \"\\r\\n\";\n            }\n        }\n        $auth = '';\n        if (!is_null($this->_server['user'])) {\n            $auth = \"Authorization: Basic \" . base64_encode($this->_server['user'] . \":\" . $this->_server['pass']) . \"\\r\\n\";\n        }\n        $cookie = '';\n        if ($_PHPRPC_COOKIE) {\n            $cookie = \"Cookie: \" . $_PHPRPC_COOKIE . \"\\r\\n\";\n        }\n        $content_len = strlen($request_body);\n        $request =\n            \"POST $url HTTP/{$this->_http_version}\\r\\n\" .\n            \"Host: {$this->_server['host']}:{$this->_server['port']}\\r\\n\" .\n            \"User-Agent: PHPRPC Client 3.0 for PHP\\r\\n\" .\n            $auth .\n            $connection .\n            $cookie .\n            \"Accept: */*\\r\\n\" .\n            \"Accept-Encoding: gzip,deflate\\r\\n\" .\n            \"Content-Type: application/x-www-form-urlencoded; charset={$this->_charset}\\r\\n\" .\n            \"Content-Length: {$content_len}\\r\\n\" .\n            \"\\r\\n\" .\n            $request_body;\n        fputs($this->_socket, $request, strlen($request));\n        while (!feof($this->_socket)) {\n            $line = fgets($this->_socket);\n            if (preg_match('/HTTP\\/(\\d\\.\\d)\\s+(\\d+)([^(\\r|\\n)]*)(\\r\\n|$)/i', $line, $match)) {\n                $this->_http_version = $match[1];\n                $status = (int)$match[2];\n                $status_message = trim($match[3]);\n                if ($status != 100 && $status != 200) {\n                    $this->_disconnect();\n                    return new PHPRPC_Error($status, $status_message);\n                }\n            }\n            else {\n                $this->_disconnect();\n                return new PHPRPC_Error(E_ERROR, \"Illegal HTTP server.\");\n            }\n            $header = array();\n            while (!feof($this->_socket) && (($line = fgets($this->_socket)) != \"\\r\\n\")) {\n                $line = explode(':', $line, 2);\n                $header[strtolower($line[0])][] =trim($line[1]);\n            }\n            if ($status == 100) continue;\n            $response_header = $this->_parseHeader($header);\n            if (is_a($response_header, 'PHPRPC_Error')) {\n                $this->_disconnect();\n                return $response_header;\n            }\n            break;\n        }\n        $response_body = '';\n        if (isset($response_header['transfer_encoding']) && (strtolower($response_header['transfer_encoding']) == 'chunked')) {\n            $s = fgets($this->_socket);\n            if ($s == \"\") {\n                $this->_disconnect();\n                return array();\n            }\n            $chunk_size = (int)hexdec($s);\n            while ($chunk_size > 0) {\n                $response_body .= $this->_socket_read($chunk_size);\n                if (fgets($this->_socket) != \"\\r\\n\") {\n                    $this->_disconnect();\n                    return new PHPRPC_Error(1, \"Response is incorrect.\");\n                }\n                $chunk_size = (int)hexdec(fgets($this->_socket));\n            }\n            fgets($this->_socket);\n        }\n        elseif (isset($response_header['content_length']) && !is_null($response_header['content_length'])) {\n            $response_body = $this->_socket_read($response_header['content_length']);\n        }\n        else {\n            while (!feof($this->_socket)) {\n                $response_body .= fread($this->_socket, 4096);\n            }\n            $this->_keep_alive = false;\n            $this->_disconnect();\n        }\n        if (isset($response_header['content_encoding']) && (strtolower($response_header['content_encoding']) == 'gzip')) {\n            $response_body = gzdecode($response_body);\n        }\n        if (!$this->_keep_alive) $this->_disconnect();\n        if ($this->_keep_alive && strtolower($response_header['connection']) == 'close') {\n            $this->_keep_alive = false;\n            $this->_disconnect();\n        }\n        return $this->_parseBody($response_body);\n    }\n    function _parseHeader($header) {\n        global $_PHPRPC_COOKIE, $_PHPRPC_COOKIES;\n        if (preg_match('/PHPRPC Server\\/([^,]*)(,|$)/i', implode(',', $header['x-powered-by']), $match)) {\n            $this->_server['version'] = (float)$match[1];\n        }\n        else {\n            return new PHPRPC_Error(E_ERROR, \"Illegal PHPRPC server.\");\n        }\n        if (preg_match('/text\\/plain\\; charset\\=([^,;]*)([,;]|$)/i', $header['content-type'][0], $match)) {\n            $this->_charset = $match[1];\n        }\n        if (isset($header['set-cookie'])) {\n            foreach ($header['set-cookie'] as $cookie) {\n                foreach (preg_split('/[;,]\\s?/', $cookie) as $c) {\n                    list($name, $value) = explode('=', $c, 2);\n                    if (!in_array($name, array('domain', 'expires', 'path', 'secure'))) {\n                        $_PHPRPC_COOKIES[$name] = $value;\n                    }\n                }\n            }\n            $cookies = array();\n            foreach ($_PHPRPC_COOKIES as $name => $value) {\n                $cookies[] = \"$name=$value\";\n            }\n            $_PHPRPC_COOKIE = join('; ', $cookies);\n        }\n        if (isset($header['content-length'])) {\n            $content_length = (int)$header['content-length'][0];\n        }\n        else {\n            $content_length = NULL;\n        }\n        $transfer_encoding = isset($header['transfer-encoding']) ? $header['transfer-encoding'][0] : '';\n        $content_encoding = isset($header['content-encoding']) ? $header['content-encoding'][0] : '';\n        $connection = isset($header['connection']) ? $header['connection'][0] : 'close';\n        return array('transfer_encoding' => $transfer_encoding,\n                     'content_encoding' => $content_encoding,\n                     'content_length' => $content_length,\n                     'connection' => $connection);\n    }\n    function _parseBody($body) {\n        $body = explode(\";\\r\\n\", $body);\n        $result = array();\n        $n = count($body);\n        for ($i = 0; $i < $n; $i++) {\n            $p = strpos($body[$i], '=');\n            if ($p !== false) {\n                $l = substr($body[$i], 0, $p);\n                $r = substr($body[$i], $p + 1);\n                $result[$l] = trim($r, '\"');\n            }\n        }\n        return $result;\n    }\n    function _key_exchange() {\n        if (!is_null($this->_key) || ($this->_encryptMode == 0)) return true;\n        $request = \"phprpc_encrypt=true&phprpc_keylen={$this->_keylen}\";\n        $result = $this->_post($request);\n        if (is_a($result, 'PHPRPC_Error')) {\n            return $result;\n        }\n        if (array_key_exists('phprpc_keylen', $result)) {\n            $this->_keylen = (int)$result['phprpc_keylen'];\n        }\n        else {\n            $this->_keylen = 128;\n        }\n        if (array_key_exists('phprpc_encrypt', $result)) {\n            $encrypt = unserialize(base64_decode($result['phprpc_encrypt']));\n            require_once('bigint.php');\n            require_once('xxtea.php');\n            $x = bigint_random($this->_keylen - 1, true);\n            $key = bigint_powmod(bigint_dec2num($encrypt['y']), $x, bigint_dec2num($encrypt['p']));\n            if ($this->_keylen == 128) {\n                $key = bigint_num2str($key);\n            }\n            else {\n                $key = pack('H*', md5(bigint_num2dec($key)));\n            }\n            $this->_key = str_pad($key, 16, \"\\0\", STR_PAD_LEFT);\n            $encrypt = bigint_num2dec(bigint_powmod(bigint_dec2num($encrypt['g']), $x, bigint_dec2num($encrypt['p'])));\n            $request = \"phprpc_encrypt=$encrypt\";\n            $result = $this->_post($request);\n            if (is_a($result, 'PHPRPC_Error')) {\n                return $result;\n            }\n        }\n        else {\n            $this->_key = NULL;\n            $this->_encryptMode = 0;\n        }\n        return true;\n    }\n    function _encrypt($str, $level) {\n        if (!is_null($this->_key) && ($this->_encryptMode >= $level)) {\n            $str = xxtea_encrypt($str, $this->_key);\n        }\n        return $str;\n    }\n    function _decrypt($str, $level) {\n        if (!is_null($this->_key) && ($this->_encryptMode >= $level)) {\n            $str = xxtea_decrypt($str, $this->_key);\n        }\n        return $str;\n    }\n}\n\nif (function_exists(\"overload\") && version_compare(phpversion(), \"5\", \"<\")) {\n    eval('\n    class PHPRPC_Client extends _PHPRPC_Client {\n        function __call($function, $arguments, &$return) {\n            $return = $this->invoke($function, $arguments);\n            return true;\n        }\n    }\n    overload(\"phprpc_client\");\n    ');\n}\nelse {\n    class PHPRPC_Client extends _PHPRPC_Client {\n        function __call($function, $arguments) {\n            return $this->invoke($function, $arguments);\n        }\n    }\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/phprpc_date.php",
    "content": "<?php\n/**********************************************************\\\n|                                                          |\n| The implementation of PHPRPC Protocol 3.0                |\n|                                                          |\n| phprpc_date.php                                          |\n|                                                          |\n| Release 3.0.1                                            |\n| Copyright by Team-PHPRPC                                 |\n|                                                          |\n| WebSite:  http://www.phprpc.org/                         |\n|           http://www.phprpc.net/                         |\n|           http://www.phprpc.com/                         |\n|           http://sourceforge.net/projects/php-rpc/       |\n|                                                          |\n| Authors:  Ma Bingyao <andot@ujn.edu.cn>                  |\n|                                                          |\n| This file may be distributed and/or modified under the   |\n| terms of the GNU General Public License (GPL) version    |\n| 2.0 as published by the Free Software Foundation and     |\n| appearing in the included file LICENSE.                  |\n|                                                          |\n\\**********************************************************/\n\n/* PHPRPC_Date Class for PHP.\n *\n * Copyright: Ma Bingyao <andot@ujn.edu.cn>\n * Version: 1.2\n * LastModified: Apr 12, 2010\n * This library is free.  You can redistribute it and/or modify it under GPL.\n */\n\nclass PHPRPC_Date {\n\n// public fields\n\n    var $year = 1;\n    var $month = 1;\n    var $day = 1;\n    var $hour = 0;\n    var $minute = 0;\n    var $second = 0;\n    var $millisecond = 0;\n\n// constructor\n\n    function PHPRPC_Date() {\n        $num = func_num_args();\n        $time = false;\n        if ($num == 0) {\n            $time = getdate();\n        }\n        if ($num == 1) {\n            $arg = func_get_arg(0);\n            if (is_int($arg)) {\n                $time = getdate($arg);\n            }\n            elseif (is_string($arg)) {\n                $time = getdate(strtotime($arg));\n            }\n        }\n        if (is_array($time)) {\n            $this->year = $time['year'];\n            $this->month = $time['mon'];\n            $this->day = $time['mday'];\n            $this->hour = $time['hours'];\n            $this->minute = $time['minutes'];\n            $this->second = $time['seconds'];\n        }\n    }\n\n// public instance methods\n\n    function addMilliseconds($milliseconds) {\n        if (!is_int($milliseconds)) return false;\n        if ($milliseconds == 0) return true;\n        $millisecond = $this->millisecond + $milliseconds;\n        $milliseconds = $millisecond % 1000;\n        if ($milliseconds < 0) {\n            $milliseconds += 1000;\n        }\n        $seconds = (int)(($millisecond - $milliseconds) / 1000);\n        $millisecond = (int)$milliseconds;\n        if ($this->addSeconds($seconds)) {\n            $this->millisecond = (int)$milliseconds;\n            return true;\n        }\n        else {\n            return false;\n        }\n    }\n\n    function addSeconds($seconds) {\n        if (!is_int($seconds)) return false;\n        if ($seconds == 0) return true;\n        $second = $this->second + $seconds;\n        $seconds = $second % 60;\n        if ($seconds < 0) {\n            $seconds += 60;\n        }\n        $minutes = (int)(($second - $seconds) / 60);\n        if ($this->addMinutes($minutes)) {\n            $this->second = (int)$seconds;\n            return true;\n        }\n        else {\n            return false;\n        }\n    }\n\n    function addMinutes($minutes) {\n        if (!is_int($minutes)) return false;\n        if ($minutes == 0) return true;\n        $minute = $this->minute + $minutes;\n        $minutes = $minute % 60;\n        if ($minutes < 0) {\n            $minutes += 60;\n        }\n        $hours = (int)(($minute - $minutes) / 60);\n        if ($this->addHours($hours)) {\n            $this->minute = (int)$minutes;\n            return true;\n        }\n        else {\n            return false;\n        }\n    }\n\n    function addHours($hours) {\n        if (!is_int($hours)) return false;\n        if ($hours == 0) return true;\n        $hour = $this->hour + $hours;\n        $hours = $hour % 24;\n        if ($hours < 0) {\n            $hours += 24;\n        }\n        $days = (int)(($hour - $hours) / 24);\n        if ($this->addDays($days)) {\n            $this->hour = (int)$hours;\n            return true;\n        }\n        else {\n            return false;\n        }\n    }\n\n    function addDays($days) {\n        if (!is_int($days)) return false;\n        $year = $this->year;\n        if ($days == 0) return true;\n        if ($days >= 146097 || $days <= -146097) {\n            $remainder = $days % 146097;\n            if ($remainder < 0) {\n                $remainder += 146097;\n            }\n            $years = 400 * (int)(($days - $remainder) / 146097);\n            $year += $years;\n            if ($year < 1 || $year > 9999) return false;\n            $days = $remainder;\n        }\n        if ($days >= 36524 || $days <= -36524) {\n            $remainder = $days % 36524;\n            if ($remainder < 0) {\n                $remainder += 36524;\n            }\n            $years = 100 * (int)(($days - $remainder) / 36524);\n            $year += $years;\n            if ($year < 1 || $year > 9999) return false;\n            $days = $remainder;\n        }\n        if ($days >= 1461 || $days <= -1461) {\n            $remainder = $days % 1461;\n            if ($remainder < 0) {\n                $remainder += 1461;\n            }\n            $years = 4 * (int)(($days - $remainder) / 1461);\n            $year += $years;\n            if ($year < 1 || $year > 9999) return false;\n            $days = $remainder;\n        }\n        $month = $this->month;\n        while ($days >= 365) {\n            if ($year >= 9999) return false;\n            if ($month <= 2) {\n                if ((($year % 4) == 0) ? (($year % 100) == 0) ? (($year % 400) == 0) : true : false) {\n                    $days -= 366;\n                }\n                else {\n                    $days -= 365;\n                }\n                $year++;\n            }\n            else {\n                $year++;\n                if ((($year % 4) == 0) ? (($year % 100) == 0) ? (($year % 400) == 0) : true : false) {\n                    $days -= 366;\n                }\n                else {\n                    $days -= 365;\n                }\n            }\n        }\n        while ($days < 0) {\n            if ($year <= 1) return false;\n            if ($month <= 2) {\n                $year--;\n                if ((($year % 4) == 0) ? (($year % 100) == 0) ? (($year % 400) == 0) : true : false) {\n                    $days += 366;\n                }\n                else {\n                    $days += 365;\n                }\n            }\n            else {\n                if ((($year % 4) == 0) ? (($year % 100) == 0) ? (($year % 400) == 0) : true : false) {\n                    $days += 366;\n                }\n                else {\n                    $days += 365;\n                }\n                $year--;\n            }\n        }\n        $daysInMonth = cal_days_in_month(CAL_GREGORIAN, $month, $year);\n        $day = $this->day;\n        while ($day + $days > $daysInMonth) {\n            $days -= $daysInMonth - $day + 1;\n            $month++;\n            if ($month > 12) {\n                if ($year >= 9999) return false;\n                $year++;\n                $month = 1;\n            }\n            $day = 1;\n            $daysInMonth = cal_days_in_month(CAL_GREGORIAN, $month, $year);\n        }\n        $day += $days;\n        $this->year = $year;\n        $this->month = $month;\n        $this->day = $day;\n        return true;\n    }\n\n    function addMonths($months) {\n        if (!is_int($months)) return false;\n        if ($months == 0) return true;\n        $month = $this->month + $months;\n        $months = ($month - 1) % 12 + 1;\n        if ($months < 1) {\n            $months += 12;\n        }\n        $years = (int)(($month - $months) / 12);\n        if ($this->addYears($years)) {\n            $daysInMonth = cal_days_in_month(CAL_GREGORIAN, $months, $this->year);\n            if ($this->day > $daysInMonth) {\n                $months++;\n                $this->day -= $daysInMonth;\n            }\n            $this->month = (int)$months;\n            return true;\n        }\n        else {\n            return false;\n        }\n    }\n\n    function addYears($years) {\n        if (!is_int($years)) return false;\n        if ($years == 0) return true;\n        $year = $this->year + $years;\n        if ($year < 1 || $year > 9999) return false;\n        $this->year = $year;\n        return true;\n    }\n\n    function after($when) {\n        if (!is_a($when, 'PHPRPC_Date')) {\n            $when = PHPRPC_Date::parse($when);\n        }\n        if ($this->year < $when->year) return false;\n        if ($this->year > $when->year) return true;\n        if ($this->month < $when->month) return false;\n        if ($this->month > $when->month) return true;\n        if ($this->day < $when->day) return false;\n        if ($this->day > $when->day) return true;\n        if ($this->hour < $when->hour) return false;\n        if ($this->hour > $when->hour) return true;\n        if ($this->minute < $when->minute) return false;\n        if ($this->minute > $when->minute) return true;\n        if ($this->second < $when->second) return false;\n        if ($this->second > $when->second) return true;\n        if ($this->millisecond < $when->millisecond) return false;\n        if ($this->millisecond > $when->millisecond) return true;\n        return false;\n    }\n\n    function before($when) {\n        if (!is_a($when, 'PHPRPC_Date')) {\n            $when = new PHPRPC_Date($when);\n        }\n        if ($this->year < $when->year) return true;\n        if ($this->year > $when->year) return false;\n        if ($this->month < $when->month) return true;\n        if ($this->month > $when->month) return false;\n        if ($this->day < $when->day) return true;\n        if ($this->day > $when->day) return false;\n        if ($this->hour < $when->hour) return true;\n        if ($this->hour > $when->hour) return false;\n        if ($this->minute < $when->minute) return true;\n        if ($this->minute > $when->minute) return false;\n        if ($this->second < $when->second) return true;\n        if ($this->second > $when->second) return false;\n        if ($this->millisecond < $when->millisecond) return true;\n        if ($this->millisecond > $when->millisecond) return false;\n        return false;\n    }\n\n    function equals($when) {\n        if (!is_a($when, 'PHPRPC_Date')) {\n            $when = new PHPRPC_Date($when);\n        }\n        return (($this->year == $when->year) &&\n            ($this->month == $when->month) &&\n            ($this->day == $when->day) &&\n            ($this->hour == $when->hour) &&\n            ($this->minute == $when->minute) &&\n            ($this->second == $when->second) &&\n            ($this->millisecond == $when->millisecond));\n    }\n\n    function set() {\n        $num = func_num_args();\n        $args = func_get_args();\n        if ($num >= 3) {\n            if (!PHPRPC_Date::isValidDate($args[0], $args[1], $args[2])) {\n                return false;\n            }\n            $this->year  = (int)$args[0];\n            $this->month = (int)$args[1];\n            $this->day   = (int)$args[2];\n            if ($num == 3) {\n                return true;\n            }\n        }\n        if ($num >= 6) {\n            if (!PHPRPC_Date::isValidTime($args[3], $args[4], $args[5])) {\n                return false;\n            }\n            $this->hour   = (int)$args[3];\n            $this->minute = (int)$args[4];\n            $this->second = (int)$args[5];\n            if ($num == 6) {\n                return true;\n            }\n        }\n        if (($num == 7) && ($args[6] >= 0 && $args[6] <= 999)) {\n            $this->millisecond = (int)$args[6];\n            return true;\n        }\n        return false;\n    }\n\n    function time() {\n        return mktime($this->hour, $this->minute, $this->second, $this->month, $this->day, $this->year);\n    }\n\n    function toString() {\n        return sprintf('%04d-%02d-%02d %02d:%02d:%02d.%03d',\n            $this->year, $this->month, $this->day,\n            $this->hour, $this->minute, $this->second,\n            $this->millisecond);\n    }\n\n// magic method for PHP 5\n\n    function __toString() {\n        return $this->toString();\n    }\n\n// public instance & static methods\n\n    function dayOfWeek() {\n        $num = func_num_args();\n        if ($num == 3) {\n            $args = func_get_args();\n            $y = $args[0];\n            $m = $args[1];\n            $d = $args[2];\n        }\n        else {\n            $y = $this->year;\n            $m = $this->month;\n            $d = $this->day;\n        }\n        $d += $m < 3 ? $y-- : $y - 2;\n        return ((int)(23 * $m / 9) + $d + 4 + (int)($y / 4) - (int)($y / 100) + (int)($y / 400)) % 7;\n    }\n\n    function dayOfYear() {\n        static $daysToMonth365 = array(0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365);\n        static $daysToMonth366 = array(0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366);\n        $num = func_num_args();\n        if ($num == 3) {\n            $args = func_get_args();\n            $y = $args[0];\n            $m = $args[1];\n            $d = $args[2];\n        }\n        else {\n            $y = $this->year;\n            $m = $this->month;\n            $d = $this->day;\n        }\n        $days = PHPRPC_Date::isLeapYear($y) ? $daysToMonth365 : $daysToMonth366;\n        return $days[$m - 1] + $d;\n    }\n\n// public static methods\n\n    function now() {\n        $date = new PHPRPC_Date();\n        return $date;\n    }\n\n    function today() {\n        $date = PHPRPC_Date::now();\n        $date->hour = 0;\n        $date->minute = 0;\n        $date->second = 0;\n        return $date;\n    }\n\n    function parse($dt) {\n        if (is_a($dt, 'PHPRPC_Date')) {\n            return $dt;\n        }\n        if (is_int($dt)) {\n            return new PHPRPC_Date($dt);\n        }\n        $shortFormat = '(\\d|\\d{2}|\\d{3}|\\d{4})-([1-9]|0[1-9]|1[012])-([1-9]|0[1-9]|[12]\\d|3[01])';\n        if (preg_match(\"/^$shortFormat$/\", $dt, $match)) {\n            $year   = intval($match[1]);\n            $month  = intval($match[2]);\n            $day    = intval($match[3]);\n            if (PHPRPC_Date::isValidDate($year, $month, $day)) {\n                $date = new PHPRPC_Date(false);\n                $date->year  = $year;\n                $date->month = $month;\n                $date->day   = $day;\n                return $date;\n            }\n            else {\n                return false;\n            }\n        }\n        $longFormat = $shortFormat . ' (\\d|0\\d|1\\d|2[0-3]):(\\d|[0-5]\\d):(\\d|[0-5]\\d)';\n        if (preg_match(\"/^$longFormat$/\", $dt, $match)) {\n            $year   = intval($match[1]);\n            $month  = intval($match[2]);\n            $day    = intval($match[3]);\n            if (PHPRPC_Date::isValidDate($year, $month, $day)) {\n                $date = new PHPRPC_Date(false);\n                $date->year  = $year;\n                $date->month = $month;\n                $date->day   = $day;\n                $date->hour   = intval($match[4]);\n                $date->minute = intval($match[5]);\n                $date->second = intval($match[6]);\n                return $date;\n            }\n            else {\n                return false;\n            }\n        }\n        $fullFormat = $longFormat . '\\.(\\d|\\d{2}|\\d{3})';\n        if (preg_match(\"/^$fullFormat$/\", $dt, $match)) {\n            $year   = intval($match[1]);\n            $month  = intval($match[2]);\n            $day    = intval($match[3]);\n            if (PHPRPC_Date::isValidDate($year, $month, $day)) {\n                $date = new PHPRPC_Date(false);\n                $date->year  = $year;\n                $date->month = $month;\n                $date->day   = $day;\n                $date->hour        = intval($match[4]);\n                $date->minute      = intval($match[5]);\n                $date->second      = intval($match[6]);\n                $date->millisecond = intval($match[7]);\n                return $date;\n            }\n            else {\n                return false;\n            }\n        }\n        return false;\n    }\n\n    function isLeapYear($year) {\n        return (($year % 4) == 0) ? (($year % 100) == 0) ? (($year % 400) == 0) : true : false;\n    }\n\n    function daysInMonth($year, $month) {\n        if (($month < 1) || ($month > 12)) {\n            return false;\n        }\n        return cal_days_in_month(CAL_GREGORIAN, $month, $year);\n    }\n\n    function isValidDate($year, $month, $day) {\n        if (($year >= 1) && ($year <= 9999)) {\n            return checkdate($month, $day, $year);\n        }\n        return false;\n    }\n\n    function isValidTime($hour, $minute, $second) {\n        return !(($hour < 0) || ($hour > 23) ||\n            ($minute < 0) || ($minute > 59) ||\n            ($second < 0) || ($second > 59));\n    }\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/phprpc_server.php",
    "content": "<?php\n/**********************************************************\\\n|                                                          |\n| The implementation of PHPRPC Protocol 3.0                |\n|                                                          |\n| phprpc_server.php                                        |\n|                                                          |\n| Release 3.0.1                                            |\n| Copyright by Team-PHPRPC                                 |\n|                                                          |\n| WebSite:  http://www.phprpc.org/                         |\n|           http://www.phprpc.net/                         |\n|           http://www.phprpc.com/                         |\n|           http://sourceforge.net/projects/php-rpc/       |\n|                                                          |\n| Authors:  Ma Bingyao <andot@ujn.edu.cn>                  |\n|                                                          |\n| This file may be distributed and/or modified under the   |\n| terms of the GNU General Public License (GPL) version    |\n| 2.0 as published by the Free Software Foundation and     |\n| appearing in the included file LICENSE.                  |\n|                                                          |\n\\**********************************************************/\n\n/* PHPRPC Server for PHP.\n *\n * Copyright: Ma Bingyao <andot@ujn.edu.cn>\n * Version: 3.0\n * LastModified: Apr 12, 2010\n * This library is free.  You can redistribute it and/or modify it under GPL.\n *\n/*\n * Interfaces\n *\n * function add($a, $b) {\n *     return $a + $b;\n * }\n * function sub($a, $b) {\n *     return $a - $b;\n * }\n * function inc(&$n) {\n *     return $n++;\n * }\n * include('phprpc_server.php');\n * $server = new PHPRPC_Server();\n * $server->add(array('add', 'sub'));\n * $server->add('inc');\n * $server->setCharset('UTF-8');\n * $server->setDebugMode(true);\n * $server->start();\n *\n */\n\nclass PHPRPC_Server {\n    var $callback;\n    var $charset;\n    var $encode;\n    var $ref;\n    var $encrypt;\n    var $enableGZIP;\n    var $debug;\n    var $keylen;\n    var $key;\n    var $errno;\n    var $errstr;\n    var $functions;\n    var $cid;\n    var $buffer;\n    // Private Methods\n    function addJsSlashes($str, $flag) {\n        if ($flag) {\n            $str = addcslashes($str, \"\\0..\\006\\010..\\012\\014..\\037\\042\\047\\134\\177..\\377\");\n        }\n        else {\n            $str = addcslashes($str, \"\\0..\\006\\010..\\012\\014..\\037\\042\\047\\134\\177\");\n        }\n        return str_replace(array(chr(7), chr(11)), array('\\007', '\\013'), $str);\n    }\n    function encodeString($str, $flag = true) {\n        if ($this->encode) {\n            return base64_encode($str);\n        }\n        else {\n            return $this->addJsSlashes($str, $flag);\n        }\n    }\n    function encryptString($str, $level) {\n        if ($this->encrypt >= $level) {\n            $str = xxtea_encrypt($str, $this->key);\n        }\n        return $str;\n    }\n    function decryptString($str, $level) {\n        if ($this->encrypt >= $level) {\n            $str = xxtea_decrypt($str, $this->key);\n        }\n        return $str;\n    }\n    function sendHeader() {\n        header(\"HTTP/1.1 200 OK\");\n        header(\"Content-Type: text/plain; charset={$this->charset}\");\n        header(\"X-Powered-By: PHPRPC Server/3.0\");\n        header('P3P: CP=\"CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV\"');\n        header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');\n        header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');\n    }\n    function getRequestURL() {\n        if (!isset($_SERVER['HTTPS']) ||\n            $_SERVER['HTTPS'] == 'off'  ||\n            $_SERVER['HTTPS'] == '') {\n            $scheme = 'http';\n        }\n        else {\n            $scheme = 'https';\n        }\n        $host = $_SERVER['SERVER_NAME'];\n        $port = $_SERVER['SERVER_PORT'];\n        $path = $_SERVER['SCRIPT_NAME'];\n        return $scheme . '://' . $host . (($port == 80) ? '' : ':' . $port) . $path;\n    }\n    function sendURL() {\n        if (SID != \"\") {\n            $url = $this->getRequestURL();\n            if (count($_GET) > 0) {\n                $url .= '?' . strip_tags(SID);\n                foreach ($_GET as $key => $value) {\n                    if (strpos(strtolower($key), 'phprpc_') !== 0) {\n                        $url .= '&' . $key . '=' . urlencode($value);\n                    }\n                }\n            }\n            $this->buffer .= \"phprpc_url=\\\"\" . $this->encodeString($url) . \"\\\";\\r\\n\";\n        }\n    }\n    function gzip($buffer) {\n        $len = strlen($buffer);\n        if ($this->enableGZIP && strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip,deflate')) {\n            $gzbuffer = gzencode($buffer);\n            $gzlen = strlen($gzbuffer);\n            if ($len > $gzlen) {\n                header(\"Content-Length: $gzlen\");\n                header(\"Content-Encoding: gzip\");\n                return $gzbuffer;\n            }\n        }\n        header(\"Content-Length: $len\");\n        return $buffer;\n    }\n    function sendCallback() {\n        $this->buffer .= $this->callback;\n        echo $this->gzip($this->buffer);\n        ob_end_flush();\n        restore_error_handler();\n        if (function_exists('restore_exception_handler')) {\n            restore_exception_handler();\n        }\n        exit();\n    }\n    function sendFunctions() {\n        $this->buffer .= \"phprpc_functions=\\\"\" . $this->encodeString(serialize_fix(array_keys($this->functions))) . \"\\\";\\r\\n\";\n        $this->sendCallback();\n    }\n    function sendOutput($output) {\n        if ($this->encrypt >= 3) {\n            $this->buffer .= \"phprpc_output=\\\"\" . $this->encodeString(xxtea_encrypt($output, $this->key)) . \"\\\";\\r\\n\";\n        }\n        else {\n            $this->buffer .= \"phprpc_output=\\\"\" . $this->encodeString($output, false) . \"\\\";\\r\\n\";\n        }\n    }\n    function sendError($output = NULL) {\n        if (is_null($output)) {\n            $output = ob_get_clean();\n        }\n        $this->buffer .= \"phprpc_errno=\\\"{$this->errno}\\\";\\r\\n\";\n        $this->buffer .= \"phprpc_errstr=\\\"\" . $this->encodeString($this->errstr, false) . \"\\\";\\r\\n\";\n        $this->sendOutput($output);\n        $this->sendCallback();\n    }\n    function fatalErrorHandler($buffer) {\n        if (preg_match('/<b>(.*?) error<\\/b>:(.*?)<br/', $buffer, $match)) {\n            if ($match[1] == 'Fatal') {\n                $errno = E_ERROR;\n            }\n            else {\n                $errno = E_COMPILE_ERROR;\n            }\n            if ($this->debug) {\n                $errstr = preg_replace('/<.*?>/', '', $match[2]);\n            }\n            else {\n                $errstr = preg_replace('/ in <b>.*<\\/b>$/', '', $match[2]);\n            }\n\n            $buffer = \"phprpc_errno=\\\"{$errno}\\\";\\r\\n\" .\n                      \"phprpc_errstr=\\\"\" . $this->encodeString(trim($errstr), false) . \"\\\";\\r\\n\" .\n                      \"phprpc_output=\\\"\\\";\\r\\n\" .\n                       $this->callback;\n            $buffer = $this->gzip($buffer);\n        }\n        return $buffer;\n    }\n    function errorHandler($errno, $errstr, $errfile, $errline) {\n        if ($this->debug) {\n            $errstr .= \" in $errfile on line $errline\";\n        }\n        if (($errno == E_ERROR) or ($errno == E_CORE_ERROR) or\n            ($errno == E_COMPILE_ERROR) or ($errno == E_USER_ERROR)) {\n            $this->errno = $errno;\n            $this->errstr = $errstr;\n            $this->sendError();\n        }\n        else {\n            if (($errno == E_NOTICE) or ($errno == E_USER_NOTICE)) {\n                if ($this->errno == 0) {\n                    $this->errno = $errno;\n                    $this->errstr = $errstr;\n                }\n            }\n            else {\n                if (($this->errno == 0) or\n                    ($this->errno == E_NOTICE) or\n                    ($this->errno == E_USER_NOTICE)) {\n                    $this->errno = $errno;\n                    $this->errstr = $errstr;\n                }\n            }\n        }\n        return true;\n    }\n    function exceptionHandler($exception) {\n        $this->errno = $exception->getCode();\n        $this->errstr = $exception->getMessage();\n        if ($this->debug) {\n            $this->errstr .= \"\\nfile: \" . $exception->getFile() .\n                             \"\\nline: \" . $exception->getLine() .\n                             \"\\ntrace: \" . $exception->getTraceAsString();\n        }\n        $this->sendError();\n    }\n    function initErrorHandler() {\n        $this->errno = 0;\n        $this->errstr = \"\";\n        set_error_handler(array(&$this, 'errorHandler'));\n        if (function_exists('set_exception_handler')) {\n            set_exception_handler(array(&$this, 'exceptionHandler'));\n        }\n    }\n    function call($function, &$args) {\n        if ($this->ref) {\n            $arguments = array();\n            for ($i = 0; $i < count($args); $i++) {\n                $arguments[$i] = &$args[$i];\n            }\n        }\n        else {\n            $arguments = $args;\n        }\n        return call_user_func_array($function, $arguments);\n    }\n    function getRequest($name) {\n        $result = $_REQUEST[$name];\n        if (get_magic_quotes_gpc()) {\n            $result = stripslashes($result);\n        }\n        return $result;\n    }\n    function getBooleanRequest($name) {\n        $var = true;\n        if (isset($_REQUEST[$name])) {\n            $var = strtolower($this->getRequest($name));\n            if ($var == \"false\") {\n                $var = false;\n            }\n        }\n        return $var;\n    }\n    function initEncode() {\n        $this->encode = $this->getBooleanRequest('phprpc_encode');\n    }\n    function initRef() {\n        $this->ref = $this->getBooleanRequest('phprpc_ref');\n    }\n    function initCallback() {\n        if (isset($_REQUEST['phprpc_callback'])) {\n            $this->callback = base64_decode($this->getRequest('phprpc_callback'));\n        }\n        else {\n            $this->callback = \"\";\n        }\n    }\n    function initKeylen() {\n        if (isset($_REQUEST['phprpc_keylen'])) {\n            $this->keylen = (int)$this->getRequest('phprpc_keylen');\n        }\n        else if (isset($_SESSION[$this->cid])) {\n            $session = unserialize(base64_decode($_SESSION[$this->cid]));\n            if (isset($session['keylen'])) {\n                $this->keylen = $session['keylen'];                \n            }\n            else {\n                $this->keylen = 128;\n            }\n        }\n        else {\n            $this->keylen = 128;\n        }\n    }\n    function initClientID() {\n        $this->cid = 0;\n        if (isset($_REQUEST['phprpc_id'])) {\n            $this->cid = $this->getRequest('phprpc_id');\n        }\n        $this->cid = \"phprpc_\" . $this->cid;\n    }\n    function initEncrypt() {\n        $this->encrypt = false;\n        if (isset($_REQUEST['phprpc_encrypt'])) {\n            $this->encrypt = $this->getRequest('phprpc_encrypt');\n            if ($this->encrypt === \"true\") $this->encrypt = true;\n            if ($this->encrypt === \"false\") $this->encrypt = false;\n        }\n    }\n    function initKey() {\n        if ($this->encrypt == 0) {\n            return;\n        }\n        else if (isset($_SESSION[$this->cid])) {\n            $session = unserialize(base64_decode($_SESSION[$this->cid]));\n            if (isset($session['key'])) {\n                $this->key = $session['key'];\n                require_once('xxtea.php');\n                return;\n            }\n        }\n        $this->errno = E_ERROR;\n        $this->errstr = \"Can't find the key for decryption.\";\n        $this->encrypt = 0;\n        $this->sendError();\n    }\n    function getArguments() {\n        if (isset($_REQUEST['phprpc_args'])) {\n            $arguments = unserialize($this->decryptString(base64_decode($this->getRequest('phprpc_args')), 1));\n            ksort($arguments);\n        }\n        else {\n            $arguments = array();\n        }\n        return $arguments;\n    }\n    function callFunction() {\n        $this->initKey();\n        $function = strtolower($this->getRequest('phprpc_func'));\n        if (array_key_exists($function, $this->functions)) {\n            $function = $this->functions[$function];\n            $arguments = $this->getArguments();\n            $result = $this->encodeString($this->encryptString(serialize_fix($this->call($function, $arguments)), 2));\n            $output = ob_get_clean();\n            $this->buffer .= \"phprpc_result=\\\"$result\\\";\\r\\n\";\n            if ($this->ref) {\n                $arguments = $this->encodeString($this->encryptString(serialize_fix($arguments), 1));\n                $this->buffer .= \"phprpc_args=\\\"$arguments\\\";\\r\\n\";\n            }\n        }\n        else {\n            $this->errno = E_ERROR;\n            $this->errstr = \"Can't find this function $function().\";\n            $output = ob_get_clean();\n        }\n        $this->sendError($output);\n    }\n    function keyExchange() {\n        require_once('bigint.php');\n        $this->initKeylen();\n        if (isset($_SESSION[$this->cid])) {\n            $session = unserialize(base64_decode($_SESSION[$this->cid]));\n        }\n        else {\n            $session = array();\n        }        \n        if ($this->encrypt === true) {\n            require_once('dhparams.php');\n            $DHParams = new DHParams($this->keylen);\n            $this->keylen = $DHParams->getL();\n            $encrypt = $DHParams->getDHParams();\n            $x = bigint_random($this->keylen - 1, true);\n            $session['x'] = bigint_num2dec($x);\n            $session['p'] = $encrypt['p'];\n            $session['keylen'] = $this->keylen;\n            $encrypt['y'] = bigint_num2dec(bigint_powmod(bigint_dec2num($encrypt['g']), $x, bigint_dec2num($encrypt['p'])));\n            $this->buffer .= \"phprpc_encrypt=\\\"\" . $this->encodeString(serialize_fix($encrypt)) . \"\\\";\\r\\n\";\n            if ($this->keylen != 128) {\n                $this->buffer .= \"phprpc_keylen=\\\"{$this->keylen}\\\";\\r\\n\";\n            }\n            $this->sendURL();\n        }\n        else {\n            $y = bigint_dec2num($this->encrypt);\n            $x = bigint_dec2num($session['x']);\n            $p = bigint_dec2num($session['p']);\n            $key = bigint_powmod($y, $x, $p);\n            if ($this->keylen == 128) {\n                $key = bigint_num2str($key);\n            }\n            else {\n                $key = pack('H*', md5(bigint_num2dec($key)));\n            }\n            $session['key'] = str_pad($key, 16, \"\\0\", STR_PAD_LEFT);\n        }\n        $_SESSION[$this->cid] = base64_encode(serialize($session));\n        $this->sendCallback();\n    }\n    function initSession() {\n        @ob_start();\n        ob_implicit_flush(0);\n        session_start();\n    }\n    function initOutputBuffer() {\n        @ob_start(array(&$this, \"fatalErrorHandler\"));\n        ob_implicit_flush(0);\n        $this->buffer = \"\";\n    }\n    // Public Methods\n    function PHPRPC_Server() {\n        require_once('compat.php');\n        $this->functions = array();\n        $this->charset = 'UTF-8';\n        $this->debug = false;\n        $this->enableGZIP = false;\n    }\n    function add($functions, $obj = NULL, $aliases = NULL) {\n        if (is_null($functions) || (gettype($functions) != gettype($aliases) && !is_null($aliases))) {\n            return false;\n        }\n        if (is_object($functions)) {\n            $obj = $functions;\n            $functions = get_class_methods(get_class($obj));\n            $aliases = $functions;\n        }\n        if (is_null($aliases)) {\n            $aliases = $functions;\n        }\n        if (is_string($functions)) {\n            if (is_null($obj)) {\n                $this->functions[strtolower($aliases)] = $functions;\n            }\n            else if (is_object($obj)) {\n                $this->functions[strtolower($aliases)] = array(&$obj, $functions);\n            }\n            else if (is_string($obj)) {\n                $this->functions[strtolower($aliases)] = array($obj, $functions);\n            }\n        }\n        else {\n            if (count($functions) != count($aliases)) {\n                return false;\n            }\n            foreach ($functions as $key => $function) {\n                $this->add($function, $obj, $aliases[$key]);\n            }\n        }\n        return true;\n    }\n    function setCharset($charset) {\n        $this->charset = $charset;\n    }\n    function setDebugMode($debug) {\n        $this->debug = $debug;\n    }\n    function setEnableGZIP($enableGZIP) {\n        $this->enableGZIP = $enableGZIP;\n    }\n    function start() {\n        while(ob_get_length() !== false) @ob_end_clean();\n        $this->initOutputBuffer();\n        $this->sendHeader();\n        $this->initErrorHandler();\n        $this->initEncode();\n        $this->initCallback();\n        $this->initRef();\n        $this->initClientID();\n        $this->initEncrypt();\n        if (isset($_REQUEST['phprpc_func'])) {\n            $this->callFunction();\n        }\n        else if ($this->encrypt != false) {\n            $this->keyExchange();\n        }\n        else {\n            $this->sendFunctions();\n        }\n    }\n}\n\nPHPRPC_Server::initSession();\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/phpRPC/xxtea.php",
    "content": "<?php\n/**********************************************************\\\n|                                                          |\n| The implementation of PHPRPC Protocol 3.0                |\n|                                                          |\n| xxtea.php                                                |\n|                                                          |\n| Release 3.0.1                                            |\n| Copyright by Team-PHPRPC                                 |\n|                                                          |\n| WebSite:  http://www.phprpc.org/                         |\n|           http://www.phprpc.net/                         |\n|           http://www.phprpc.com/                         |\n|           http://sourceforge.net/projects/php-rpc/       |\n|                                                          |\n| Authors:  Ma Bingyao <andot@ujn.edu.cn>                  |\n|                                                          |\n| This file may be distributed and/or modified under the   |\n| terms of the GNU General Public License (GPL) version    |\n| 2.0 as published by the Free Software Foundation and     |\n| appearing in the included file LICENSE.                  |\n|                                                          |\n\\**********************************************************/\n\n/* XXTEA encryption arithmetic library.\n *\n * Copyright: Ma Bingyao <andot@ujn.edu.cn>\n * Version: 1.6\n * LastModified: Apr 12, 2010\n * This library is free.  You can redistribute it and/or modify it under GPL.\n */\nif (!extension_loaded('xxtea')) {\n    function long2str($v, $w) {\n        $len = count($v);\n        $n = ($len - 1) << 2;\n        if ($w) {\n            $m = $v[$len - 1];\n            if (($m < $n - 3) || ($m > $n)) return false;\n            $n = $m;\n        }\n        $s = array();\n        for ($i = 0; $i < $len; $i++) {\n            $s[$i] = pack(\"V\", $v[$i]);\n        }\n        if ($w) {\n            return substr(join('', $s), 0, $n);\n        }\n        else {\n            return join('', $s);\n        }\n    }\n\n    function str2long($s, $w) {\n        $v = unpack(\"V*\", $s. str_repeat(\"\\0\", (4 - strlen($s) % 4) & 3));\n        $v = array_values($v);\n        if ($w) {\n            $v[count($v)] = strlen($s);\n        }\n        return $v;\n    }\n\n    function int32($n) {\n        while ($n >= 2147483648) $n -= 4294967296;\n        while ($n <= -2147483649) $n += 4294967296;\n        return (int)$n;\n    }\n\n    function xxtea_encrypt($str, $key) {\n        if ($str == \"\") {\n            return \"\";\n        }\n        $v = str2long($str, true);\n        $k = str2long($key, false);\n        if (count($k) < 4) {\n            for ($i = count($k); $i < 4; $i++) {\n                $k[$i] = 0;\n            }\n        }\n        $n = count($v) - 1;\n\n        $z = $v[$n];\n        $y = $v[0];\n        $delta = 0x9E3779B9;\n        $q = floor(6 + 52 / ($n + 1));\n        $sum = 0;\n        while (0 < $q--) {\n            $sum = int32($sum + $delta);\n            $e = $sum >> 2 & 3;\n            for ($p = 0; $p < $n; $p++) {\n                $y = $v[$p + 1];\n                $mx = int32((($z >> 5 & 0x07ffffff) ^ $y << 2) + (($y >> 3 & 0x1fffffff) ^ $z << 4)) ^ int32(($sum ^ $y) + ($k[$p & 3 ^ $e] ^ $z));\n                $z = $v[$p] = int32($v[$p] + $mx);\n            }\n            $y = $v[0];\n            $mx = int32((($z >> 5 & 0x07ffffff) ^ $y << 2) + (($y >> 3 & 0x1fffffff) ^ $z << 4)) ^ int32(($sum ^ $y) + ($k[$p & 3 ^ $e] ^ $z));\n            $z = $v[$n] = int32($v[$n] + $mx);\n        }\n        return long2str($v, false);\n    }\n\n    function xxtea_decrypt($str, $key) {\n        if ($str == \"\") {\n            return \"\";\n        }\n        $v = str2long($str, false);\n        $k = str2long($key, false);\n        if (count($k) < 4) {\n            for ($i = count($k); $i < 4; $i++) {\n                $k[$i] = 0;\n            }\n        }\n        $n = count($v) - 1;\n\n        $z = $v[$n];\n        $y = $v[0];\n        $delta = 0x9E3779B9;\n        $q = floor(6 + 52 / ($n + 1));\n        $sum = int32($q * $delta);\n        while ($sum != 0) {\n            $e = $sum >> 2 & 3;\n            for ($p = $n; $p > 0; $p--) {\n                $z = $v[$p - 1];\n                $mx = int32((($z >> 5 & 0x07ffffff) ^ $y << 2) + (($y >> 3 & 0x1fffffff) ^ $z << 4)) ^ int32(($sum ^ $y) + ($k[$p & 3 ^ $e] ^ $z));\n                $y = $v[$p] = int32($v[$p] - $mx);\n            }\n            $z = $v[$n];\n            $mx = int32((($z >> 5 & 0x07ffffff) ^ $y << 2) + (($y >> 3 & 0x1fffffff) ^ $z << 4)) ^ int32(($sum ^ $y) + ($k[$p & 3 ^ $e] ^ $z));\n            $y = $v[0] = int32($v[0] - $mx);\n            $sum = int32($sum - $delta);\n        }\n        return long2str($v, true);\n    }\n}\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/spyc/COPYING",
    "content": "The MIT License\n\nCopyright (c) 2011 Vladimir Andersen\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE."
  },
  {
    "path": "ThinkPHP/Library/Vendor/spyc/README.md",
    "content": "**Spyc** is a YAML loader/dumper written in pure PHP. Given a YAML document, Spyc will return an array that\nyou can use however you see fit. Given an array, Spyc will return a string which contains a YAML document \nbuilt from your data.\n\n**YAML** is an amazingly human friendly and strikingly versatile data serialization language which can be used \nfor log files, config files, custom protocols, the works. For more information, see http://www.yaml.org.\n\nSpyc supports YAML 1.0 specification.\n\n## Using Spyc\n\nUsing Spyc is trivial:\n\n```\n<?php\nrequire_once \"spyc.php\";\n$Data = Spyc::YAMLLoad('spyc.yaml');\n```\n\nor (if you prefer functional syntax)\n\n```\n<?php\nrequire_once \"spyc.php\";\n$Data = spyc_load_file('spyc.yaml');\n```\n\n## Donations, anyone?\n\nIf you find Spyc useful, I'm accepting Bitcoin donations (who doesn't these days?) at 193bEkLP7zMrNLZm9UdUet4puGD5mQiLai\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/spyc/Spyc.php",
    "content": "<?php\n/**\n   * Spyc -- A Simple PHP YAML Class\n   * @version 0.5.1\n   * @author Vlad Andersen <vlad.andersen@gmail.com>\n   * @author Chris Wanstrath <chris@ozmm.org>\n   * @link http://code.google.com/p/spyc/\n   * @copyright Copyright 2005-2006 Chris Wanstrath, 2006-2011 Vlad Andersen\n   * @license http://www.opensource.org/licenses/mit-license.php MIT License\n   * @package Spyc\n   */\n\nif (!function_exists('spyc_load')) {\n  /**\n   * Parses YAML to array.\n   * @param string $string YAML string.\n   * @return array\n   */\n  function spyc_load ($string) {\n    return Spyc::YAMLLoadString($string);\n  }\n}\n\nif (!function_exists('spyc_load_file')) {\n  /**\n   * Parses YAML to array.\n   * @param string $file Path to YAML file.\n   * @return array\n   */\n  function spyc_load_file ($file) {\n    return Spyc::YAMLLoad($file);\n  }\n}\n\nif (!function_exists('spyc_dump')) {\n  /**\n   * Dumps array to YAML.\n   * @param array $data Array.\n   * @return string\n   */\n  function spyc_dump ($data) {\n    return Spyc::YAMLDump($data, false, false, true);\n  }\n}\n\n/**\n   * The Simple PHP YAML Class.\n   *\n   * This class can be used to read a YAML file and convert its contents\n   * into a PHP array.  It currently supports a very limited subsection of\n   * the YAML spec.\n   *\n   * Usage:\n   * <code>\n   *   $Spyc  = new Spyc;\n   *   $array = $Spyc->load($file);\n   * </code>\n   * or:\n   * <code>\n   *   $array = Spyc::YAMLLoad($file);\n   * </code>\n   * or:\n   * <code>\n   *   $array = spyc_load_file($file);\n   * </code>\n   * @package Spyc\n   */\nclass Spyc {\n\n  // SETTINGS\n\n  const REMPTY = \"\\0\\0\\0\\0\\0\";\n\n  /**\n   * Setting this to true will force YAMLDump to enclose any string value in\n   * quotes.  False by default.\n   *\n   * @var bool\n   */\n  public $setting_dump_force_quotes = false;\n\n  /**\n   * Setting this to true will forse YAMLLoad to use syck_load function when\n   * possible. False by default.\n   * @var bool\n   */\n  public $setting_use_syck_is_possible = false;\n\n\n\n  /**#@+\n  * @access private\n  * @var mixed\n  */\n  private $_dumpIndent;\n  private $_dumpWordWrap;\n  private $_containsGroupAnchor = false;\n  private $_containsGroupAlias = false;\n  private $path;\n  private $result;\n  private $LiteralPlaceHolder = '___YAML_Literal_Block___';\n  private $SavedGroups = array();\n  private $indent;\n  /**\n   * Path modifier that should be applied after adding current element.\n   * @var array\n   */\n  private $delayedPath = array();\n\n  /**#@+\n  * @access public\n  * @var mixed\n  */\n  public $_nodeId;\n\n/**\n * Load a valid YAML string to Spyc.\n * @param string $input\n * @return array\n */\n  public function load ($input) {\n    return $this->__loadString($input);\n  }\n\n /**\n * Load a valid YAML file to Spyc.\n * @param string $file\n * @return array\n */\n  public function loadFile ($file) {\n    return $this->__load($file);\n  }\n\n  /**\n     * Load YAML into a PHP array statically\n     *\n     * The load method, when supplied with a YAML stream (string or file),\n     * will do its best to convert YAML in a file into a PHP array.  Pretty\n     * simple.\n     *  Usage:\n     *  <code>\n     *   $array = Spyc::YAMLLoad('lucky.yaml');\n     *   print_r($array);\n     *  </code>\n     * @access public\n     * @return array\n     * @param string $input Path of YAML file or string containing YAML\n     */\n  public static function YAMLLoad($input) {\n    $Spyc = new Spyc;\n    return $Spyc->__load($input);\n  }\n\n  /**\n     * Load a string of YAML into a PHP array statically\n     *\n     * The load method, when supplied with a YAML string, will do its best\n     * to convert YAML in a string into a PHP array.  Pretty simple.\n     *\n     * Note: use this function if you don't want files from the file system\n     * loaded and processed as YAML.  This is of interest to people concerned\n     * about security whose input is from a string.\n     *\n     *  Usage:\n     *  <code>\n     *   $array = Spyc::YAMLLoadString(\"---\\n0: hello world\\n\");\n     *   print_r($array);\n     *  </code>\n     * @access public\n     * @return array\n     * @param string $input String containing YAML\n     */\n  public static function YAMLLoadString($input) {\n    $Spyc = new Spyc;\n    return $Spyc->__loadString($input);\n  }\n\n  /**\n     * Dump YAML from PHP array statically\n     *\n     * The dump method, when supplied with an array, will do its best\n     * to convert the array into friendly YAML.  Pretty simple.  Feel free to\n     * save the returned string as nothing.yaml and pass it around.\n     *\n     * Oh, and you can decide how big the indent is and what the wordwrap\n     * for folding is.  Pretty cool -- just pass in 'false' for either if\n     * you want to use the default.\n     *\n     * Indent's default is 2 spaces, wordwrap's default is 40 characters.  And\n     * you can turn off wordwrap by passing in 0.\n     *\n     * @access public\n     * @return string\n     * @param array $array PHP array\n     * @param int $indent Pass in false to use the default, which is 2\n     * @param int $wordwrap Pass in 0 for no wordwrap, false for default (40)\n     * @param int $no_opening_dashes Do not start YAML file with \"---\\n\"\n     */\n  public static function YAMLDump($array, $indent = false, $wordwrap = false, $no_opening_dashes = false) {\n    $spyc = new Spyc;\n    return $spyc->dump($array, $indent, $wordwrap, $no_opening_dashes);\n  }\n\n\n  /**\n     * Dump PHP array to YAML\n     *\n     * The dump method, when supplied with an array, will do its best\n     * to convert the array into friendly YAML.  Pretty simple.  Feel free to\n     * save the returned string as tasteful.yaml and pass it around.\n     *\n     * Oh, and you can decide how big the indent is and what the wordwrap\n     * for folding is.  Pretty cool -- just pass in 'false' for either if\n     * you want to use the default.\n     *\n     * Indent's default is 2 spaces, wordwrap's default is 40 characters.  And\n     * you can turn off wordwrap by passing in 0.\n     *\n     * @access public\n     * @return string\n     * @param array $array PHP array\n     * @param int $indent Pass in false to use the default, which is 2\n     * @param int $wordwrap Pass in 0 for no wordwrap, false for default (40)\n     */\n  public function dump($array,$indent = false,$wordwrap = false, $no_opening_dashes = false) {\n    // Dumps to some very clean YAML.  We'll have to add some more features\n    // and options soon.  And better support for folding.\n\n    // New features and options.\n    if ($indent === false or !is_numeric($indent)) {\n      $this->_dumpIndent = 2;\n    } else {\n      $this->_dumpIndent = $indent;\n    }\n\n    if ($wordwrap === false or !is_numeric($wordwrap)) {\n      $this->_dumpWordWrap = 40;\n    } else {\n      $this->_dumpWordWrap = $wordwrap;\n    }\n\n    // New YAML document\n    $string = \"\";\n    if (!$no_opening_dashes) $string = \"---\\n\";\n\n    // Start at the base of the array and move through it.\n    if ($array) {\n      $array = (array)$array;\n      $previous_key = -1;\n      foreach ($array as $key => $value) {\n        if (!isset($first_key)) $first_key = $key;\n        $string .= $this->_yamlize($key,$value,0,$previous_key, $first_key, $array);\n        $previous_key = $key;\n      }\n    }\n    return $string;\n  }\n\n  /**\n     * Attempts to convert a key / value array item to YAML\n     * @access private\n     * @return string\n     * @param $key The name of the key\n     * @param $value The value of the item\n     * @param $indent The indent of the current node\n     */\n  private function _yamlize($key,$value,$indent, $previous_key = -1, $first_key = 0, $source_array = null) {\n    if (is_array($value)) {\n      if (empty ($value))\n        return $this->_dumpNode($key, array(), $indent, $previous_key, $first_key, $source_array);\n      // It has children.  What to do?\n      // Make it the right kind of item\n      $string = $this->_dumpNode($key, self::REMPTY, $indent, $previous_key, $first_key, $source_array);\n      // Add the indent\n      $indent += $this->_dumpIndent;\n      // Yamlize the array\n      $string .= $this->_yamlizeArray($value,$indent);\n    } elseif (!is_array($value)) {\n      // It doesn't have children.  Yip.\n      $string = $this->_dumpNode($key, $value, $indent, $previous_key, $first_key, $source_array);\n    }\n    return $string;\n  }\n\n  /**\n     * Attempts to convert an array to YAML\n     * @access private\n     * @return string\n     * @param $array The array you want to convert\n     * @param $indent The indent of the current level\n     */\n  private function _yamlizeArray($array,$indent) {\n    if (is_array($array)) {\n      $string = '';\n      $previous_key = -1;\n      foreach ($array as $key => $value) {\n        if (!isset($first_key)) $first_key = $key;\n        $string .= $this->_yamlize($key, $value, $indent, $previous_key, $first_key, $array);\n        $previous_key = $key;\n      }\n      return $string;\n    } else {\n      return false;\n    }\n  }\n\n  /**\n     * Returns YAML from a key and a value\n     * @access private\n     * @return string\n     * @param $key The name of the key\n     * @param $value The value of the item\n     * @param $indent The indent of the current node\n     */\n  private function _dumpNode($key, $value, $indent, $previous_key = -1, $first_key = 0, $source_array = null) {\n    // do some folding here, for blocks\n    if (is_string ($value) && ((strpos($value,\"\\n\") !== false || strpos($value,\": \") !== false || strpos($value,\"- \") !== false ||\n      strpos($value,\"*\") !== false || strpos($value,\"#\") !== false || strpos($value,\"<\") !== false || strpos($value,\">\") !== false || strpos ($value, '  ') !== false ||\n      strpos($value,\"[\") !== false || strpos($value,\"]\") !== false || strpos($value,\"{\") !== false || strpos($value,\"}\") !== false) || strpos($value,\"&\") !== false || strpos($value, \"'\") !== false || strpos($value, \"!\") === 0 ||\n      substr ($value, -1, 1) == ':')\n    ) {\n      $value = $this->_doLiteralBlock($value,$indent);\n    } else {\n      $value  = $this->_doFolding($value,$indent);\n    }\n\n    if ($value === array()) $value = '[ ]';\n    if ($value === \"\") $value = '\"\"';\n    if (self::isTranslationWord($value)) {\n      $value = $this->_doLiteralBlock($value, $indent);\n    }\n    if (trim ($value) != $value)\n       $value = $this->_doLiteralBlock($value,$indent);\n\n    if (is_bool($value)) {\n       $value = $value ? \"true\" : \"false\";\n    }\n\n    if ($value === null) $value = 'null';\n    if ($value === \"'\" . self::REMPTY . \"'\") $value = null;\n\n    $spaces = str_repeat(' ',$indent);\n\n    //if (is_int($key) && $key - 1 == $previous_key && $first_key===0) {\n    if (is_array ($source_array) && array_keys($source_array) === range(0, count($source_array) - 1)) {\n      // It's a sequence\n      $string = $spaces.'- '.$value.\"\\n\";\n    } else {\n      // if ($first_key===0)  throw new Exception('Keys are all screwy.  The first one was zero, now it\\'s \"'. $key .'\"');\n      // It's mapped\n      if (strpos($key, \":\") !== false || strpos($key, \"#\") !== false) { $key = '\"' . $key . '\"'; }\n      $string = rtrim ($spaces.$key.': '.$value).\"\\n\";\n    }\n    return $string;\n  }\n\n  /**\n     * Creates a literal block for dumping\n     * @access private\n     * @return string\n     * @param $value\n     * @param $indent int The value of the indent\n     */\n  private function _doLiteralBlock($value,$indent) {\n    if ($value === \"\\n\") return '\\n';\n    if (strpos($value, \"\\n\") === false && strpos($value, \"'\") === false) {\n      return sprintf (\"'%s'\", $value);\n    }\n    if (strpos($value, \"\\n\") === false && strpos($value, '\"') === false) {\n      return sprintf ('\"%s\"', $value);\n    }\n    $exploded = explode(\"\\n\",$value);\n    $newValue = '|';\n    $indent  += $this->_dumpIndent;\n    $spaces   = str_repeat(' ',$indent);\n    foreach ($exploded as $line) {\n      $newValue .= \"\\n\" . $spaces . ($line);\n    }\n    return $newValue;\n  }\n\n  /**\n     * Folds a string of text, if necessary\n     * @access private\n     * @return string\n     * @param $value The string you wish to fold\n     */\n  private function _doFolding($value,$indent) {\n    // Don't do anything if wordwrap is set to 0\n\n    if ($this->_dumpWordWrap !== 0 && is_string ($value) && strlen($value) > $this->_dumpWordWrap) {\n      $indent += $this->_dumpIndent;\n      $indent = str_repeat(' ',$indent);\n      $wrapped = wordwrap($value,$this->_dumpWordWrap,\"\\n$indent\");\n      $value   = \">\\n\".$indent.$wrapped;\n    } else {\n      if ($this->setting_dump_force_quotes && is_string ($value) && $value !== self::REMPTY)\n        $value = '\"' . $value . '\"';\n      if (is_numeric($value) && is_string($value))\n        $value = '\"' . $value . '\"';\n    }\n\n\n    return $value;\n  }\n\n  private function isTrueWord($value) {\n    $words = self::getTranslations(array('true', 'on', 'yes', 'y'));\n    return in_array($value, $words, true);\n  }\n\n  private function isFalseWord($value) {\n    $words = self::getTranslations(array('false', 'off', 'no', 'n'));\n    return in_array($value, $words, true);\n  }\n\n  private function isNullWord($value) {\n    $words = self::getTranslations(array('null', '~'));\n    return in_array($value, $words, true);\n  }\n\n  private function isTranslationWord($value) {\n    return (\n      self::isTrueWord($value)  ||\n      self::isFalseWord($value) ||\n      self::isNullWord($value)\n    );\n  }\n\n  /**\n     * Coerce a string into a native type\n     * Reference: http://yaml.org/type/bool.html\n     * TODO: Use only words from the YAML spec.\n     * @access private\n     * @param $value The value to coerce\n     */\n  private function coerceValue(&$value) {\n    if (self::isTrueWord($value)) {\n      $value = true;\n    } else if (self::isFalseWord($value)) {\n      $value = false;\n    } else if (self::isNullWord($value)) {\n      $value = null;\n    }\n  }\n\n  /**\n     * Given a set of words, perform the appropriate translations on them to\n     * match the YAML 1.1 specification for type coercing.\n     * @param $words The words to translate\n     * @access private\n     */\n  private static function getTranslations(array $words) {\n    $result = array();\n    foreach ($words as $i) {\n      $result = array_merge($result, array(ucfirst($i), strtoupper($i), strtolower($i)));\n    }\n    return $result;\n  }\n\n// LOADING FUNCTIONS\n\n  private function __load($input) {\n    $Source = $this->loadFromSource($input);\n    return $this->loadWithSource($Source);\n  }\n\n  private function __loadString($input) {\n    $Source = $this->loadFromString($input);\n    return $this->loadWithSource($Source);\n  }\n\n  private function loadWithSource($Source) {\n    if (empty ($Source)) return array();\n    if ($this->setting_use_syck_is_possible && function_exists ('syck_load')) {\n      $array = syck_load (implode (\"\\n\", $Source));\n      return is_array($array) ? $array : array();\n    }\n\n    $this->path = array();\n    $this->result = array();\n\n    $cnt = count($Source);\n    for ($i = 0; $i < $cnt; $i++) {\n      $line = $Source[$i];\n\n      $this->indent = strlen($line) - strlen(ltrim($line));\n      $tempPath = $this->getParentPathByIndent($this->indent);\n      $line = self::stripIndent($line, $this->indent);\n      if (self::isComment($line)) continue;\n      if (self::isEmpty($line)) continue;\n      $this->path = $tempPath;\n\n      $literalBlockStyle = self::startsLiteralBlock($line);\n      if ($literalBlockStyle) {\n        $line = rtrim ($line, $literalBlockStyle . \" \\n\");\n        $literalBlock = '';\n        $line .= ' '.$this->LiteralPlaceHolder;\n        $literal_block_indent = strlen($Source[$i+1]) - strlen(ltrim($Source[$i+1]));\n        while (++$i < $cnt && $this->literalBlockContinues($Source[$i], $this->indent)) {\n          $literalBlock = $this->addLiteralLine($literalBlock, $Source[$i], $literalBlockStyle, $literal_block_indent);\n        }\n        $i--;\n      }\n\n      // Strip out comments\n      if (strpos ($line, '#')) {\n          $line = preg_replace('/\\s*#([^\"\\']+)$/','',$line);\n      }\n\n      while (++$i < $cnt && self::greedilyNeedNextLine($line)) {\n        $line = rtrim ($line, \" \\n\\t\\r\") . ' ' . ltrim ($Source[$i], \" \\t\");\n      }\n      $i--;\n\n      $lineArray = $this->_parseLine($line);\n\n      if ($literalBlockStyle)\n        $lineArray = $this->revertLiteralPlaceHolder ($lineArray, $literalBlock);\n\n      $this->addArray($lineArray, $this->indent);\n\n      foreach ($this->delayedPath as $indent => $delayedPath)\n        $this->path[$indent] = $delayedPath;\n\n      $this->delayedPath = array();\n\n    }\n    return $this->result;\n  }\n\n  private function loadFromSource ($input) {\n    if (!empty($input) && strpos($input, \"\\n\") === false && file_exists($input))\n      $input = file_get_contents($input);\n\n    return $this->loadFromString($input);\n  }\n\n  private function loadFromString ($input) {\n    $lines = explode(\"\\n\",$input);\n    foreach ($lines as $k => $_) {\n      $lines[$k] = rtrim ($_, \"\\r\");\n    }\n    return $lines;\n  }\n\n  /**\n     * Parses YAML code and returns an array for a node\n     * @access private\n     * @return array\n     * @param string $line A line from the YAML file\n     */\n  private function _parseLine($line) {\n    if (!$line) return array();\n    $line = trim($line);\n    if (!$line) return array();\n\n    $array = array();\n\n    $group = $this->nodeContainsGroup($line);\n    if ($group) {\n      $this->addGroup($line, $group);\n      $line = $this->stripGroup ($line, $group);\n    }\n\n    if ($this->startsMappedSequence($line))\n      return $this->returnMappedSequence($line);\n\n    if ($this->startsMappedValue($line))\n      return $this->returnMappedValue($line);\n\n    if ($this->isArrayElement($line))\n     return $this->returnArrayElement($line);\n\n    if ($this->isPlainArray($line))\n     return $this->returnPlainArray($line);\n\n\n    return $this->returnKeyValuePair($line);\n\n  }\n\n  /**\n     * Finds the type of the passed value, returns the value as the new type.\n     * @access private\n     * @param string $value\n     * @return mixed\n     */\n  private function _toType($value) {\n    if ($value === '') return \"\";\n    $first_character = $value[0];\n    $last_character = substr($value, -1, 1);\n\n    $is_quoted = false;\n    do {\n      if (!$value) break;\n      if ($first_character != '\"' && $first_character != \"'\") break;\n      if ($last_character != '\"' && $last_character != \"'\") break;\n      $is_quoted = true;\n    } while (0);\n\n    if ($is_quoted) {\n      $value = str_replace('\\n', \"\\n\", $value);\n      return strtr(substr ($value, 1, -1), array ('\\\\\"' => '\"', '\\'\\'' => '\\'', '\\\\\\'' => '\\''));\n    }\n\n    if (strpos($value, ' #') !== false && !$is_quoted)\n      $value = preg_replace('/\\s+#(.+)$/','',$value);\n\n    if ($first_character == '[' && $last_character == ']') {\n      // Take out strings sequences and mappings\n      $innerValue = trim(substr ($value, 1, -1));\n      if ($innerValue === '') return array();\n      $explode = $this->_inlineEscape($innerValue);\n      // Propagate value array\n      $value  = array();\n      foreach ($explode as $v) {\n        $value[] = $this->_toType($v);\n      }\n      return $value;\n    }\n\n    if (strpos($value,': ')!==false && $first_character != '{') {\n      $array = explode(': ',$value);\n      $key   = trim($array[0]);\n      array_shift($array);\n      $value = trim(implode(': ',$array));\n      $value = $this->_toType($value);\n      return array($key => $value);\n    }\n\n    if ($first_character == '{' && $last_character == '}') {\n      $innerValue = trim(substr ($value, 1, -1));\n      if ($innerValue === '') return array();\n      // Inline Mapping\n      // Take out strings sequences and mappings\n      $explode = $this->_inlineEscape($innerValue);\n      // Propagate value array\n      $array = array();\n      foreach ($explode as $v) {\n        $SubArr = $this->_toType($v);\n        if (empty($SubArr)) continue;\n        if (is_array ($SubArr)) {\n          $array[key($SubArr)] = $SubArr[key($SubArr)]; continue;\n        }\n        $array[] = $SubArr;\n      }\n      return $array;\n    }\n\n    if ($value == 'null' || $value == 'NULL' || $value == 'Null' || $value == '' || $value == '~') {\n      return null;\n    }\n\n    if ( is_numeric($value) && preg_match ('/^(-|)[1-9]+[0-9]*$/', $value) ){\n      $intvalue = (int)$value;\n      if ($intvalue != PHP_INT_MAX)\n        $value = $intvalue;\n      return $value;\n    }\n\n    if (is_numeric($value) && preg_match('/^0[xX][0-9a-fA-F]+$/', $value)) {\n      // Hexadecimal value.\n      return hexdec($value);\n    }\n\n    $this->coerceValue($value);\n\n    if (is_numeric($value)) {\n      if ($value === '0') return 0;\n      if (rtrim ($value, 0) === $value)\n        $value = (float)$value;\n      return $value;\n    }\n\n    return $value;\n  }\n\n  /**\n     * Used in inlines to check for more inlines or quoted strings\n     * @access private\n     * @return array\n     */\n  private function _inlineEscape($inline) {\n    // There's gotta be a cleaner way to do this...\n    // While pure sequences seem to be nesting just fine,\n    // pure mappings and mappings with sequences inside can't go very\n    // deep.  This needs to be fixed.\n\n    $seqs = array();\n    $maps = array();\n    $saved_strings = array();\n    $saved_empties = array();\n\n    // Check for empty strings\n    $regex = '/(\"\")|(\\'\\')/';\n    if (preg_match_all($regex,$inline,$strings)) {\n      $saved_empties = $strings[0];\n      $inline  = preg_replace($regex,'YAMLEmpty',$inline);\n    }\n    unset($regex);\n\n    // Check for strings\n    $regex = '/(?:(\")|(?:\\'))((?(1)[^\"]+|[^\\']+))(?(1)\"|\\')/';\n    if (preg_match_all($regex,$inline,$strings)) {\n      $saved_strings = $strings[0];\n      $inline  = preg_replace($regex,'YAMLString',$inline);\n    }\n    unset($regex);\n\n    // echo $inline;\n\n    $i = 0;\n    do {\n\n    // Check for sequences\n    while (preg_match('/\\[([^{}\\[\\]]+)\\]/U',$inline,$matchseqs)) {\n      $seqs[] = $matchseqs[0];\n      $inline = preg_replace('/\\[([^{}\\[\\]]+)\\]/U', ('YAMLSeq' . (count($seqs) - 1) . 's'), $inline, 1);\n    }\n\n    // Check for mappings\n    while (preg_match('/{([^\\[\\]{}]+)}/U',$inline,$matchmaps)) {\n      $maps[] = $matchmaps[0];\n      $inline = preg_replace('/{([^\\[\\]{}]+)}/U', ('YAMLMap' . (count($maps) - 1) . 's'), $inline, 1);\n    }\n\n    if ($i++ >= 10) break;\n\n    } while (strpos ($inline, '[') !== false || strpos ($inline, '{') !== false);\n\n    $explode = explode(',',$inline);\n    $explode = array_map('trim', $explode);\n    $stringi = 0; $i = 0;\n\n    while (1) {\n\n    // Re-add the sequences\n    if (!empty($seqs)) {\n      foreach ($explode as $key => $value) {\n        if (strpos($value,'YAMLSeq') !== false) {\n          foreach ($seqs as $seqk => $seq) {\n            $explode[$key] = str_replace(('YAMLSeq'.$seqk.'s'),$seq,$value);\n            $value = $explode[$key];\n          }\n        }\n      }\n    }\n\n    // Re-add the mappings\n    if (!empty($maps)) {\n      foreach ($explode as $key => $value) {\n        if (strpos($value,'YAMLMap') !== false) {\n          foreach ($maps as $mapk => $map) {\n            $explode[$key] = str_replace(('YAMLMap'.$mapk.'s'), $map, $value);\n            $value = $explode[$key];\n          }\n        }\n      }\n    }\n\n\n    // Re-add the strings\n    if (!empty($saved_strings)) {\n      foreach ($explode as $key => $value) {\n        while (strpos($value,'YAMLString') !== false) {\n          $explode[$key] = preg_replace('/YAMLString/',$saved_strings[$stringi],$value, 1);\n          unset($saved_strings[$stringi]);\n          ++$stringi;\n          $value = $explode[$key];\n        }\n      }\n    }\n\n\n    // Re-add the empties\n    if (!empty($saved_empties)) {\n      foreach ($explode as $key => $value) {\n        while (strpos($value,'YAMLEmpty') !== false) {\n          $explode[$key] = preg_replace('/YAMLEmpty/', '', $value, 1);\n          $value = $explode[$key];\n        }\n      }\n    }\n\n    $finished = true;\n    foreach ($explode as $key => $value) {\n      if (strpos($value,'YAMLSeq') !== false) {\n        $finished = false; break;\n      }\n      if (strpos($value,'YAMLMap') !== false) {\n        $finished = false; break;\n      }\n      if (strpos($value,'YAMLString') !== false) {\n        $finished = false; break;\n      }\n      if (strpos($value,'YAMLEmpty') !== false) {\n        $finished = false; break;\n      }\n    }\n    if ($finished) break;\n\n    $i++;\n    if ($i > 10)\n      break; // Prevent infinite loops.\n    }\n\n\n    return $explode;\n  }\n\n  private function literalBlockContinues ($line, $lineIndent) {\n    if (!trim($line)) return true;\n    if (strlen($line) - strlen(ltrim($line)) > $lineIndent) return true;\n    return false;\n  }\n\n  private function referenceContentsByAlias ($alias) {\n    do {\n      if (!isset($this->SavedGroups[$alias])) { echo \"Bad group name: $alias.\"; break; }\n      $groupPath = $this->SavedGroups[$alias];\n      $value = $this->result;\n      foreach ($groupPath as $k) {\n        $value = $value[$k];\n      }\n    } while (false);\n    return $value;\n  }\n\n  private function addArrayInline ($array, $indent) {\n      $CommonGroupPath = $this->path;\n      if (empty ($array)) return false;\n\n      foreach ($array as $k => $_) {\n        $this->addArray(array($k => $_), $indent);\n        $this->path = $CommonGroupPath;\n      }\n      return true;\n  }\n\n  private function addArray ($incoming_data, $incoming_indent) {\n\n   // print_r ($incoming_data);\n\n    if (count ($incoming_data) > 1)\n      return $this->addArrayInline ($incoming_data, $incoming_indent);\n\n    $key = key ($incoming_data);\n    $value = isset($incoming_data[$key]) ? $incoming_data[$key] : null;\n    if ($key === '__!YAMLZero') $key = '0';\n\n    if ($incoming_indent == 0 && !$this->_containsGroupAlias && !$this->_containsGroupAnchor) { // Shortcut for root-level values.\n      if ($key || $key === '' || $key === '0') {\n        $this->result[$key] = $value;\n      } else {\n        $this->result[] = $value; end ($this->result); $key = key ($this->result);\n      }\n      $this->path[$incoming_indent] = $key;\n      return;\n    }\n\n\n\n    $history = array();\n    // Unfolding inner array tree.\n    $history[] = $_arr = $this->result;\n    foreach ($this->path as $k) {\n      $history[] = $_arr = $_arr[$k];\n    }\n\n    if ($this->_containsGroupAlias) {\n      $value = $this->referenceContentsByAlias($this->_containsGroupAlias);\n      $this->_containsGroupAlias = false;\n    }\n\n\n    // Adding string or numeric key to the innermost level or $this->arr.\n    if (is_string($key) && $key == '<<') {\n      if (!is_array ($_arr)) { $_arr = array (); }\n\n      $_arr = array_merge ($_arr, $value);\n    } else if ($key || $key === '' || $key === '0') {\n      if (!is_array ($_arr))\n        $_arr = array ($key=>$value);\n      else\n        $_arr[$key] = $value;\n    } else {\n      if (!is_array ($_arr)) { $_arr = array ($value); $key = 0; }\n      else { $_arr[] = $value; end ($_arr); $key = key ($_arr); }\n    }\n\n    $reverse_path = array_reverse($this->path);\n    $reverse_history = array_reverse ($history);\n    $reverse_history[0] = $_arr;\n    $cnt = count($reverse_history) - 1;\n    for ($i = 0; $i < $cnt; $i++) {\n      $reverse_history[$i+1][$reverse_path[$i]] = $reverse_history[$i];\n    }\n    $this->result = $reverse_history[$cnt];\n\n    $this->path[$incoming_indent] = $key;\n\n    if ($this->_containsGroupAnchor) {\n      $this->SavedGroups[$this->_containsGroupAnchor] = $this->path;\n      if (is_array ($value)) {\n        $k = key ($value);\n        if (!is_int ($k)) {\n          $this->SavedGroups[$this->_containsGroupAnchor][$incoming_indent + 2] = $k;\n        }\n      }\n      $this->_containsGroupAnchor = false;\n    }\n\n  }\n\n  private static function startsLiteralBlock ($line) {\n    $lastChar = substr (trim($line), -1);\n    if ($lastChar != '>' && $lastChar != '|') return false;\n    if ($lastChar == '|') return $lastChar;\n    // HTML tags should not be counted as literal blocks.\n    if (preg_match ('#<.*?>$#', $line)) return false;\n    return $lastChar;\n  }\n\n  private static function greedilyNeedNextLine($line) {\n    $line = trim ($line);\n    if (!strlen($line)) return false;\n    if (substr ($line, -1, 1) == ']') return false;\n    if ($line[0] == '[') return true;\n    if (preg_match ('#^[^:]+?:\\s*\\[#', $line)) return true;\n    return false;\n  }\n\n  private function addLiteralLine ($literalBlock, $line, $literalBlockStyle, $indent = -1) {\n    $line = self::stripIndent($line, $indent);\n    if ($literalBlockStyle !== '|') {\n        $line = self::stripIndent($line);\n    }\n    $line = rtrim ($line, \"\\r\\n\\t \") . \"\\n\";\n    if ($literalBlockStyle == '|') {\n      return $literalBlock . $line;\n    }\n    if (strlen($line) == 0)\n      return rtrim($literalBlock, ' ') . \"\\n\";\n    if ($line == \"\\n\" && $literalBlockStyle == '>') {\n      return rtrim ($literalBlock, \" \\t\") . \"\\n\";\n    }\n    if ($line != \"\\n\")\n      $line = trim ($line, \"\\r\\n \") . \" \";\n    return $literalBlock . $line;\n  }\n\n   function revertLiteralPlaceHolder ($lineArray, $literalBlock) {\n     foreach ($lineArray as $k => $_) {\n      if (is_array($_))\n        $lineArray[$k] = $this->revertLiteralPlaceHolder ($_, $literalBlock);\n      else if (substr($_, -1 * strlen ($this->LiteralPlaceHolder)) == $this->LiteralPlaceHolder)\n\t       $lineArray[$k] = rtrim ($literalBlock, \" \\r\\n\");\n     }\n     return $lineArray;\n   }\n\n  private static function stripIndent ($line, $indent = -1) {\n    if ($indent == -1) $indent = strlen($line) - strlen(ltrim($line));\n    return substr ($line, $indent);\n  }\n\n  private function getParentPathByIndent ($indent) {\n    if ($indent == 0) return array();\n    $linePath = $this->path;\n    do {\n      end($linePath); $lastIndentInParentPath = key($linePath);\n      if ($indent <= $lastIndentInParentPath) array_pop ($linePath);\n    } while ($indent <= $lastIndentInParentPath);\n    return $linePath;\n  }\n\n\n  private function clearBiggerPathValues ($indent) {\n\n\n    if ($indent == 0) $this->path = array();\n    if (empty ($this->path)) return true;\n\n    foreach ($this->path as $k => $_) {\n      if ($k > $indent) unset ($this->path[$k]);\n    }\n\n    return true;\n  }\n\n\n  private static function isComment ($line) {\n    if (!$line) return false;\n    if ($line[0] == '#') return true;\n    if (trim($line, \" \\r\\n\\t\") == '---') return true;\n    return false;\n  }\n\n  private static function isEmpty ($line) {\n    return (trim ($line) === '');\n  }\n\n\n  private function isArrayElement ($line) {\n    if (!$line || !is_scalar($line)) return false;\n    if (substr($line, 0, 2) != '- ') return false;\n    if (strlen ($line) > 3)\n      if (substr($line,0,3) == '---') return false;\n\n    return true;\n  }\n\n  private function isHashElement ($line) {\n    return strpos($line, ':');\n  }\n\n  private function isLiteral ($line) {\n    if ($this->isArrayElement($line)) return false;\n    if ($this->isHashElement($line)) return false;\n    return true;\n  }\n\n\n  private static function unquote ($value) {\n    if (!$value) return $value;\n    if (!is_string($value)) return $value;\n    if ($value[0] == '\\'') return trim ($value, '\\'');\n    if ($value[0] == '\"') return trim ($value, '\"');\n    return $value;\n  }\n\n  private function startsMappedSequence ($line) {\n    return (substr($line, 0, 2) == '- ' && substr ($line, -1, 1) == ':');\n  }\n\n  private function returnMappedSequence ($line) {\n    $array = array();\n    $key         = self::unquote(trim(substr($line,1,-1)));\n    $array[$key] = array();\n    $this->delayedPath = array(strpos ($line, $key) + $this->indent => $key);\n    return array($array);\n  }\n\n  private function checkKeysInValue($value) {\n    if (strchr('[{\"\\'', $value[0]) === false) {\n      if (strchr($value, ': ') !== false) {\n          throw new Exception('Too many keys: '.$value);\n      }\n    }\n  }\n\n  private function returnMappedValue ($line) {\n    $this->checkKeysInValue($line);\n    $array = array();\n    $key         = self::unquote (trim(substr($line,0,-1)));\n    $array[$key] = '';\n    return $array;\n  }\n\n  private function startsMappedValue ($line) {\n    return (substr ($line, -1, 1) == ':');\n  }\n\n  private function isPlainArray ($line) {\n    return ($line[0] == '[' && substr ($line, -1, 1) == ']');\n  }\n\n  private function returnPlainArray ($line) {\n    return $this->_toType($line);\n  }\n\n  private function returnKeyValuePair ($line) {\n    $array = array();\n    $key = '';\n    if (strpos ($line, ': ')) {\n      // It's a key/value pair most likely\n      // If the key is in double quotes pull it out\n      if (($line[0] == '\"' || $line[0] == \"'\") && preg_match('/^([\"\\'](.*)[\"\\'](\\s)*:)/',$line,$matches)) {\n        $value = trim(str_replace($matches[1],'',$line));\n        $key   = $matches[2];\n      } else {\n        // Do some guesswork as to the key and the value\n        $explode = explode(': ', $line);\n        $key     = trim(array_shift($explode));\n        $value   = trim(implode(': ', $explode));\n        $this->checkKeysInValue($value);\n      }\n      // Set the type of the value.  Int, string, etc\n      $value = $this->_toType($value);\n      if ($key === '0') $key = '__!YAMLZero';\n      $array[$key] = $value;\n    } else {\n      $array = array ($line);\n    }\n    return $array;\n\n  }\n\n\n  private function returnArrayElement ($line) {\n     if (strlen($line) <= 1) return array(array()); // Weird %)\n     $array = array();\n     $value   = trim(substr($line,1));\n     $value   = $this->_toType($value);\n     if ($this->isArrayElement($value)) {\n       $value = $this->returnArrayElement($value);\n     }\n     $array[] = $value;\n     return $array;\n  }\n\n\n  private function nodeContainsGroup ($line) {\n    $symbolsForReference = 'A-z0-9_\\-';\n    if (strpos($line, '&') === false && strpos($line, '*') === false) return false; // Please die fast ;-)\n    if ($line[0] == '&' && preg_match('/^(&['.$symbolsForReference.']+)/', $line, $matches)) return $matches[1];\n    if ($line[0] == '*' && preg_match('/^(\\*['.$symbolsForReference.']+)/', $line, $matches)) return $matches[1];\n    if (preg_match('/(&['.$symbolsForReference.']+)$/', $line, $matches)) return $matches[1];\n    if (preg_match('/(\\*['.$symbolsForReference.']+$)/', $line, $matches)) return $matches[1];\n    if (preg_match ('#^\\s*<<\\s*:\\s*(\\*[^\\s]+).*$#', $line, $matches)) return $matches[1];\n    return false;\n\n  }\n\n  private function addGroup ($line, $group) {\n    if ($group[0] == '&') $this->_containsGroupAnchor = substr ($group, 1);\n    if ($group[0] == '*') $this->_containsGroupAlias = substr ($group, 1);\n    //print_r ($this->path);\n  }\n\n  private function stripGroup ($line, $group) {\n    $line = trim(str_replace($group, '', $line));\n    return $line;\n  }\n}\n\n// Enable use of Spyc from command line\n// The syntax is the following: php Spyc.php spyc.yaml\n\ndo {\n  if (PHP_SAPI != 'cli') break;\n  if (empty ($_SERVER['argc']) || $_SERVER['argc'] < 2) break;\n  if (empty ($_SERVER['PHP_SELF']) || FALSE === strpos ($_SERVER['PHP_SELF'], 'Spyc.php') ) break;\n  $file = $argv[1];\n  echo json_encode (spyc_load_file ($file));\n} while (0);\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/spyc/composer.json",
    "content": "{\n    \"name\": \"mustangostang/spyc\",\n    \"description\": \"A simple YAML loader/dumper class for PHP\",\n    \"type\": \"library\",\n    \"keywords\": [\n        \"spyc\",\n        \"yaml\",\n        \"yml\"\n    ],\n    \"homepage\": \"https://github.com/mustangostang/spyc/\",\n    \"authors\" : [{\n        \"name\": \"mustangostang\",\n        \"email\": \"vlad.andersen@gmail.com\"\n    }],\n    \"license\": \"MIT\",\n    \"require\": {\n        \"php\": \">=5.3.1\"\n    },\n    \"autoload\": {\n        \"files\": [ \"Spyc.php\" ]\n    },\n    \"extra\": {\n        \"branch-alias\": {\n            \"dev-master\": \"0.5.x-dev\"\n        }\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/spyc/examples/yaml-dump.php",
    "content": "<?php\n\n#\n#    S P Y C\n#      a simple php yaml class\n#\n# Feel free to dump an array to YAML, and then to load that YAML back into an\n# array.  This is a good way to test the limitations of the parser and maybe\n# learn some basic YAML.\n#\n\ninclude('../Spyc.php');\n\n$array[] = 'Sequence item';\n$array['The Key'] = 'Mapped value';\n$array[] = array('A sequence','of a sequence');\n$array[] = array('first' => 'A sequence','second' => 'of mapped values');\n$array['Mapped'] = array('A sequence','which is mapped');\n$array['A Note'] = 'What if your text is too long?';\n$array['Another Note'] = 'If that is the case, the dumper will probably fold your text by using a block.  Kinda like this.';\n$array['The trick?'] = 'The trick is that we overrode the default indent, 2, to 4 and the default wordwrap, 40, to 60.';\n$array['Old Dog'] = \"And if you want\\n to preserve line breaks, \\ngo ahead!\";\n$array['key:withcolon'] = \"Should support this to\";\n\n$yaml = Spyc::YAMLDump($array,4,60);\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/spyc/examples/yaml-load.php",
    "content": "<?php\n\n#\n#    S P Y C\n#      a simple php yaml class\n#\n# license: [MIT License, http://www.opensource.org/licenses/mit-license.php]\n#\n\ninclude('../Spyc.php');\n\n$array = Spyc::YAMLLoad('../spyc.yaml');\n\necho '<pre><a href=\"spyc.yaml\">spyc.yaml</a> loaded into PHP:<br/>';\nprint_r($array);\necho '</pre>';\n\n\necho '<pre>YAML Data dumped back:<br/>';\necho Spyc::YAMLDump($array);\necho '</pre>';\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/spyc/php4/5to4.php",
    "content": "<?php\n\nphp5to4 (\"../spyc.php\", 'spyc-latest.php4');\n\nfunction php5to4 ($src, $dest) {\n  $code = file_get_contents ($src);\n  $code = preg_replace ('#(public|private|protected)\\s+\\$#i', 'var \\$', $code);\n  $code = preg_replace ('#(public|private|protected)\\s+static\\s+\\$#i', 'var \\$', $code);\n  $code = preg_replace ('#(public|private|protected)\\s+function#i', 'function', $code);\n  $code = preg_replace ('#(public|private|protected)\\s+static\\s+function#i', 'function', $code);\n  $code = preg_replace ('#throw new Exception\\\\(([^)]*)\\\\)#i', 'trigger_error($1,E_USER_ERROR)', $code);\n  $code = str_replace ('self::', '$this->', $code);\n  $f = fopen ($dest, 'w');\n  fwrite($f, $code);\n  fclose ($f);\n  print \"Written to $dest.\\n\";\n}"
  },
  {
    "path": "ThinkPHP/Library/Vendor/spyc/php4/spyc.php4",
    "content": "<?php\n/**\n   * Spyc -- A Simple PHP YAML Class\n   * @version 0.4.5\n   * @author Vlad Andersen <vlad.andersen@gmail.com>\n   * @author Chris Wanstrath <chris@ozmm.org>\n   * @link http://code.google.com/p/spyc/\n   * @copyright Copyright 2005-2006 Chris Wanstrath, 2006-2009 Vlad Andersen\n   * @license http://www.opensource.org/licenses/mit-license.php MIT License\n   * @package Spyc\n   */\n\nif (!function_exists('spyc_load')) {\n  /**\n   * Parses YAML to array.\n   * @param string $string YAML string.\n   * @return array\n   */\n  function spyc_load ($string) {\n    return Spyc::YAMLLoadString($string);\n  }\n}\n\nif (!function_exists('spyc_load_file')) {\n  /**\n   * Parses YAML to array.\n   * @param string $file Path to YAML file.\n   * @return array\n   */\n  function spyc_load_file ($file) {\n    return Spyc::YAMLLoad($file);\n  }\n}\n\n/**\n   * The Simple PHP YAML Class.\n   *\n   * This class can be used to read a YAML file and convert its contents\n   * into a PHP array.  It currently supports a very limited subsection of\n   * the YAML spec.\n   *\n   * Usage:\n   * <code>\n   *   $Spyc  = new Spyc;\n   *   $array = $Spyc->load($file);\n   * </code>\n   * or:\n   * <code>\n   *   $array = Spyc::YAMLLoad($file);\n   * </code>\n   * or:\n   * <code>\n   *   $array = spyc_load_file($file);\n   * </code>\n   * @package Spyc\n   */\nclass Spyc {\n\n  // SETTINGS\n\n  /**\n   * Setting this to true will force YAMLDump to enclose any string value in\n   * quotes.  False by default.\n   * \n   * @var bool\n   */\n  var $setting_dump_force_quotes = false;\n\n  /**\n   * Setting this to true will forse YAMLLoad to use syck_load function when\n   * possible. False by default.\n   * @var bool\n   */\n  var $setting_use_syck_is_possible = false;\n\n\n\n  /**#@+\n  * @access private\n  * @var mixed\n  */\n  var $_dumpIndent;\n  var $_dumpWordWrap;\n  var $_containsGroupAnchor = false;\n  var $_containsGroupAlias = false;\n  var $path;\n  var $result;\n  var $LiteralPlaceHolder = '___YAML_Literal_Block___';\n  var $SavedGroups = array();\n  var $indent;\n  /**\n   * Path modifier that should be applied after adding current element.\n   * @var array\n   */\n  var $delayedPath = array();\n\n  /**#@+\n  * @access public\n  * @var mixed\n  */\n  var $_nodeId;\n\n/**\n * Load a valid YAML string to Spyc.\n * @param string $input\n * @return array\n */\n  function load ($input) {\n    return $this->__loadString($input);\n  }\n\n /**\n * Load a valid YAML file to Spyc.\n * @param string $file\n * @return array\n */\n  function loadFile ($file) {\n    return $this->__load($file);\n  }\n\n  /**\n     * Load YAML into a PHP array statically\n     *\n     * The load method, when supplied with a YAML stream (string or file),\n     * will do its best to convert YAML in a file into a PHP array.  Pretty\n     * simple.\n     *  Usage:\n     *  <code>\n     *   $array = Spyc::YAMLLoad('lucky.yaml');\n     *   print_r($array);\n     *  </code>\n     * @access public\n     * @return array\n     * @param string $input Path of YAML file or string containing YAML\n     */\n  function YAMLLoad($input) {\n    $Spyc = new Spyc;\n    return $Spyc->__load($input);\n  }\n\n  /**\n     * Load a string of YAML into a PHP array statically\n     *\n     * The load method, when supplied with a YAML string, will do its best \n     * to convert YAML in a string into a PHP array.  Pretty simple.\n     *\n     * Note: use this function if you don't want files from the file system\n     * loaded and processed as YAML.  This is of interest to people concerned\n     * about security whose input is from a string.\n     *\n     *  Usage:\n     *  <code>\n     *   $array = Spyc::YAMLLoadString(\"---\\n0: hello world\\n\");\n     *   print_r($array);\n     *  </code>\n     * @access public\n     * @return array\n     * @param string $input String containing YAML\n     */\n  function YAMLLoadString($input) {\n    $Spyc = new Spyc;\n    return $Spyc->__loadString($input);\n  }\n\n  /**\n     * Dump YAML from PHP array statically\n     *\n     * The dump method, when supplied with an array, will do its best\n     * to convert the array into friendly YAML.  Pretty simple.  Feel free to\n     * save the returned string as nothing.yaml and pass it around.\n     *\n     * Oh, and you can decide how big the indent is and what the wordwrap\n     * for folding is.  Pretty cool -- just pass in 'false' for either if\n     * you want to use the default.\n     *\n     * Indent's default is 2 spaces, wordwrap's default is 40 characters.  And\n     * you can turn off wordwrap by passing in 0.\n     *\n     * @access public\n     * @return string\n     * @param array $array PHP array\n     * @param int $indent Pass in false to use the default, which is 2\n     * @param int $wordwrap Pass in 0 for no wordwrap, false for default (40)\n     */\n  function YAMLDump($array,$indent = false,$wordwrap = false) {\n    $spyc = new Spyc;\n    return $spyc->dump($array,$indent,$wordwrap);\n  }\n\n\n  /**\n     * Dump PHP array to YAML\n     *\n     * The dump method, when supplied with an array, will do its best\n     * to convert the array into friendly YAML.  Pretty simple.  Feel free to\n     * save the returned string as tasteful.yaml and pass it around.\n     *\n     * Oh, and you can decide how big the indent is and what the wordwrap\n     * for folding is.  Pretty cool -- just pass in 'false' for either if\n     * you want to use the default.\n     *\n     * Indent's default is 2 spaces, wordwrap's default is 40 characters.  And\n     * you can turn off wordwrap by passing in 0.\n     *\n     * @access public\n     * @return string\n     * @param array $array PHP array\n     * @param int $indent Pass in false to use the default, which is 2\n     * @param int $wordwrap Pass in 0 for no wordwrap, false for default (40)\n     */\n  function dump($array,$indent = false,$wordwrap = false) {\n    // Dumps to some very clean YAML.  We'll have to add some more features\n    // and options soon.  And better support for folding.\n\n    // New features and options.\n    if ($indent === false or !is_numeric($indent)) {\n      $this->_dumpIndent = 2;\n    } else {\n      $this->_dumpIndent = $indent;\n    }\n\n    if ($wordwrap === false or !is_numeric($wordwrap)) {\n      $this->_dumpWordWrap = 40;\n    } else {\n      $this->_dumpWordWrap = $wordwrap;\n    }\n\n    // New YAML document\n    $string = \"---\\n\";\n\n    // Start at the base of the array and move through it.\n    if ($array) {\n      $array = (array)$array;\n      $first_key = key($array);\n      \n      $previous_key = -1;\n      foreach ($array as $key => $value) {\n        $string .= $this->_yamlize($key,$value,0,$previous_key, $first_key);\n        $previous_key = $key;\n      }\n    }\n    return $string;\n  }\n\n  /**\n     * Attempts to convert a key / value array item to YAML\n     * @access private\n     * @return string\n     * @param $key The name of the key\n     * @param $value The value of the item\n     * @param $indent The indent of the current node\n     */\n  function _yamlize($key,$value,$indent, $previous_key = -1, $first_key = 0) {\n    if (is_array($value)) {\n      if (empty ($value))\n        return $this->_dumpNode($key, array(), $indent, $previous_key, $first_key);\n      // It has children.  What to do?\n      // Make it the right kind of item\n      $string = $this->_dumpNode($key, NULL, $indent, $previous_key, $first_key);\n      // Add the indent\n      $indent += $this->_dumpIndent;\n      // Yamlize the array\n      $string .= $this->_yamlizeArray($value,$indent);\n    } elseif (!is_array($value)) {\n      // It doesn't have children.  Yip.\n      $string = $this->_dumpNode($key, $value, $indent, $previous_key, $first_key);\n    }\n    return $string;\n  }\n\n  /**\n     * Attempts to convert an array to YAML\n     * @access private\n     * @return string\n     * @param $array The array you want to convert\n     * @param $indent The indent of the current level\n     */\n  function _yamlizeArray($array,$indent) {\n    if (is_array($array)) {\n      $string = '';\n      $previous_key = -1;\n      $first_key = key($array);\n      foreach ($array as $key => $value) {\n        $string .= $this->_yamlize($key, $value, $indent, $previous_key, $first_key);\n        $previous_key = $key;\n      }\n      return $string;\n    } else {\n      return false;\n    }\n  }\n\n  /**\n     * Returns YAML from a key and a value\n     * @access private\n     * @return string\n     * @param $key The name of the key\n     * @param $value The value of the item\n     * @param $indent The indent of the current node\n     */\n  function _dumpNode($key, $value, $indent, $previous_key = -1, $first_key = 0) {\n    // do some folding here, for blocks\n    if (is_string ($value) && ((strpos($value,\"\\n\") !== false || strpos($value,\": \") !== false || strpos($value,\"- \") !== false ||\n      strpos($value,\"*\") !== false || strpos($value,\"#\") !== false || strpos($value,\"<\") !== false || strpos($value,\">\") !== false ||\n      strpos($value,\"[\") !== false || strpos($value,\"]\") !== false || strpos($value,\"{\") !== false || strpos($value,\"}\") !== false) || substr ($value, -1, 1) == ':')) {\n      $value = $this->_doLiteralBlock($value,$indent);\n    } else {\n      $value  = $this->_doFolding($value,$indent);\n      if (is_bool($value)) {\n        $value = ($value) ? \"true\" : \"false\";\n      }\n    }\n\n    if ($value === array()) $value = '[ ]';\n\n    $spaces = str_repeat(' ',$indent);\n\n    if (is_int($key) && $key - 1 == $previous_key && $first_key===0) {\n      // It's a sequence\n      $string = $spaces.'- '.$value.\"\\n\";\n    } else {\n      if ($first_key===0)  throw new Exception('Keys are all screwy.  The first one was zero, now it\\'s \"'. $key .'\"');\n      // It's mapped\n      if (strpos($key, \":\") !== false) { $key = '\"' . $key . '\"'; }\n      $string = $spaces.$key.': '.$value.\"\\n\";\n    }\n    return $string;\n  }\n\n  /**\n     * Creates a literal block for dumping\n     * @access private\n     * @return string\n     * @param $value\n     * @param $indent int The value of the indent\n     */\n  function _doLiteralBlock($value,$indent) {\n    if (strpos($value, \"\\n\") === false && strpos($value, \"'\") === false) {\n      return sprintf (\"'%s'\", $value);\n    }\n    if (strpos($value, \"\\n\") === false && strpos($value, '\"') === false) {\n      return sprintf ('\"%s\"', $value);\n    }\n    $exploded = explode(\"\\n\",$value);\n    $newValue = '|';\n    $indent  += $this->_dumpIndent;\n    $spaces   = str_repeat(' ',$indent);\n    foreach ($exploded as $line) {\n      $newValue .= \"\\n\" . $spaces . trim($line);\n    }\n    return $newValue;\n  }\n\n  /**\n     * Folds a string of text, if necessary\n     * @access private\n     * @return string\n     * @param $value The string you wish to fold\n     */\n  function _doFolding($value,$indent) {\n    // Don't do anything if wordwrap is set to 0\n\n    if ($this->_dumpWordWrap !== 0 && is_string ($value) && strlen($value) > $this->_dumpWordWrap) {\n      $indent += $this->_dumpIndent;\n      $indent = str_repeat(' ',$indent);\n      $wrapped = wordwrap($value,$this->_dumpWordWrap,\"\\n$indent\");\n      $value   = \">\\n\".$indent.$wrapped;\n    } else {\n      if ($this->setting_dump_force_quotes && is_string ($value))\n        $value = '\"' . $value . '\"';\n    }\n\n\n    return $value;\n  }\n\n// LOADING FUNCTIONS\n\n  function __load($input) {\n    $Source = $this->loadFromSource($input);\n    return $this->loadWithSource($Source);\n  }\n\n  function __loadString($input) {\n    $Source = $this->loadFromString($input);\n    return $this->loadWithSource($Source);\n  }\n\n  function loadWithSource($Source) {\n    if (empty ($Source)) return array();\n    if ($this->setting_use_syck_is_possible && function_exists ('syck_load')) {\n      $array = syck_load (implode ('', $Source));\n      return is_array($array) ? $array : array();\n    }\n\n    $this->path = array();\n    $this->result = array();\n\n    $cnt = count($Source);\n    for ($i = 0; $i < $cnt; $i++) {\n      $line = $Source[$i];\n      \n      $this->indent = strlen($line) - strlen(ltrim($line));\n      $tempPath = $this->getParentPathByIndent($this->indent);\n      $line = $this->stripIndent($line, $this->indent);\n      if ($this->isComment($line)) continue;\n      if ($this->isEmpty($line)) continue;\n      $this->path = $tempPath;\n\n      $literalBlockStyle = $this->startsLiteralBlock($line);\n      if ($literalBlockStyle) {\n        $line = rtrim ($line, $literalBlockStyle . \" \\n\");\n        $literalBlock = '';\n        $line .= $this->LiteralPlaceHolder;\n\n        while (++$i < $cnt && $this->literalBlockContinues($Source[$i], $this->indent)) {\n          $literalBlock = $this->addLiteralLine($literalBlock, $Source[$i], $literalBlockStyle);\n        }\n        $i--;\n      }\n\n      while (++$i < $cnt && $this->greedilyNeedNextLine($line)) {\n        $line = rtrim ($line, \" \\n\\t\\r\") . ' ' . ltrim ($Source[$i], \" \\t\");\n      }\n      $i--;\n\n\n\n      if (strpos ($line, '#')) {\n        if (strpos ($line, '\"') === false && strpos ($line, \"'\") === false)\n          $line = preg_replace('/\\s+#(.+)$/','',$line);\n      }\n\n      $lineArray = $this->_parseLine($line);\n\n      if ($literalBlockStyle)\n        $lineArray = $this->revertLiteralPlaceHolder ($lineArray, $literalBlock);\n\n      $this->addArray($lineArray, $this->indent);\n\n      foreach ($this->delayedPath as $indent => $delayedPath)\n        $this->path[$indent] = $delayedPath;\n\n      $this->delayedPath = array();\n\n    }\n    return $this->result;\n  }\n\n  function loadFromSource ($input) {\n    if (!empty($input) && strpos($input, \"\\n\") === false && file_exists($input))\n    return file($input);\n\n    return $this->loadFromString($input);\n  }\n\n  function loadFromString ($input) {\n    $lines = explode(\"\\n\",$input);\n    foreach ($lines as $k => $_) {\n      $lines[$k] = rtrim ($_, \"\\r\");\n    }\n    return $lines;\n  }\n\n  /**\n     * Parses YAML code and returns an array for a node\n     * @access private\n     * @return array\n     * @param string $line A line from the YAML file\n     */\n  function _parseLine($line) {\n    if (!$line) return array();\n    $line = trim($line);\n\n    if (!$line) return array();\n    $array = array();\n\n    $group = $this->nodeContainsGroup($line);\n    if ($group) {\n      $this->addGroup($line, $group);\n      $line = $this->stripGroup ($line, $group);\n    }\n\n    if ($this->startsMappedSequence($line))\n      return $this->returnMappedSequence($line);\n\n    if ($this->startsMappedValue($line))\n      return $this->returnMappedValue($line);\n\n    if ($this->isArrayElement($line))\n     return $this->returnArrayElement($line);\n\n    if ($this->isPlainArray($line))\n     return $this->returnPlainArray($line); \n     \n     \n    return $this->returnKeyValuePair($line);\n\n  }\n\n  /**\n     * Finds the type of the passed value, returns the value as the new type.\n     * @access private\n     * @param string $value\n     * @return mixed\n     */\n  function _toType($value) {\n    if ($value === '') return null;\n    $first_character = $value[0];\n    $last_character = substr($value, -1, 1);\n\n    $is_quoted = false;\n    do {\n      if (!$value) break;\n      if ($first_character != '\"' && $first_character != \"'\") break;\n      if ($last_character != '\"' && $last_character != \"'\") break;\n      $is_quoted = true;\n    } while (0);\n\n    if ($is_quoted)\n      return strtr(substr ($value, 1, -1), array ('\\\\\"' => '\"', '\\'\\'' => '\\'', '\\\\\\'' => '\\''));\n    \n    if (strpos($value, ' #') !== false)\n      $value = preg_replace('/\\s+#(.+)$/','',$value);\n\n    if ($first_character == '[' && $last_character == ']') {\n      // Take out strings sequences and mappings\n      $innerValue = trim(substr ($value, 1, -1));\n      if ($innerValue === '') return array();\n      $explode = $this->_inlineEscape($innerValue);\n      // Propagate value array\n      $value  = array();\n      foreach ($explode as $v) {\n        $value[] = $this->_toType($v);\n      }\n      return $value;\n    }\n\n    if (strpos($value,': ')!==false && $first_character != '{') {\n      $array = explode(': ',$value);\n      $key   = trim($array[0]);\n      array_shift($array);\n      $value = trim(implode(': ',$array));\n      $value = $this->_toType($value);\n      return array($key => $value);\n    }\n    \n    if ($first_character == '{' && $last_character == '}') {\n      $innerValue = trim(substr ($value, 1, -1));\n      if ($innerValue === '') return array();\n      // Inline Mapping\n      // Take out strings sequences and mappings\n      $explode = $this->_inlineEscape($innerValue);\n      // Propagate value array\n      $array = array();\n      foreach ($explode as $v) {\n        $SubArr = $this->_toType($v);\n        if (empty($SubArr)) continue;\n        if (is_array ($SubArr)) {\n          $array[key($SubArr)] = $SubArr[key($SubArr)]; continue;\n        }\n        $array[] = $SubArr;\n      }\n      return $array;\n    }\n\n    if ($value == 'null' || $value == 'NULL' || $value == 'Null' || $value == '' || $value == '~') {\n      return null;\n    }\n\n    if (intval($first_character) > 0 && preg_match ('/^[1-9]+[0-9]*$/', $value)) {\n      $intvalue = (int)$value;\n      if ($intvalue != PHP_INT_MAX)\n        $value = $intvalue;\n      return $value;\n    }\n\n    if (in_array($value,\n                 array('true', 'on', '+', 'yes', 'y', 'True', 'TRUE', 'On', 'ON', 'YES', 'Yes', 'Y'))) {\n      return true;\n    }\n\n    if (in_array(strtolower($value),\n                 array('false', 'off', '-', 'no', 'n'))) {\n      return false;\n    }\n\n    if (is_numeric($value)) {\n      if ($value === '0') return 0;\n      if (trim ($value, 0) === $value)\n        $value = (float)$value;\n      return $value;\n    }\n    \n    return $value;\n  }\n\n  /**\n     * Used in inlines to check for more inlines or quoted strings\n     * @access private\n     * @return array\n     */\n  function _inlineEscape($inline) {\n    // There's gotta be a cleaner way to do this...\n    // While pure sequences seem to be nesting just fine,\n    // pure mappings and mappings with sequences inside can't go very\n    // deep.  This needs to be fixed.\n\n    $seqs = array();\n    $maps = array();\n    $saved_strings = array();\n\n    // Check for strings\n    $regex = '/(?:(\")|(?:\\'))((?(1)[^\"]+|[^\\']+))(?(1)\"|\\')/';\n    if (preg_match_all($regex,$inline,$strings)) {\n      $saved_strings = $strings[0];\n      $inline  = preg_replace($regex,'YAMLString',$inline);\n    }\n    unset($regex);\n\n    $i = 0;\n    do {\n\n    // Check for sequences\n    while (preg_match('/\\[([^{}\\[\\]]+)\\]/U',$inline,$matchseqs)) {\n      $seqs[] = $matchseqs[0];\n      $inline = preg_replace('/\\[([^{}\\[\\]]+)\\]/U', ('YAMLSeq' . (count($seqs) - 1) . 's'), $inline, 1);\n    }\n\n    // Check for mappings\n    while (preg_match('/{([^\\[\\]{}]+)}/U',$inline,$matchmaps)) {\n      $maps[] = $matchmaps[0];\n      $inline = preg_replace('/{([^\\[\\]{}]+)}/U', ('YAMLMap' . (count($maps) - 1) . 's'), $inline, 1);\n    }\n\n    if ($i++ >= 10) break;\n\n    } while (strpos ($inline, '[') !== false || strpos ($inline, '{') !== false);\n\n    $explode = explode(', ',$inline);\n    $stringi = 0; $i = 0;\n\n    while (1) {\n\n    // Re-add the sequences\n    if (!empty($seqs)) {\n      foreach ($explode as $key => $value) {\n        if (strpos($value,'YAMLSeq') !== false) {\n          foreach ($seqs as $seqk => $seq) {\n            $explode[$key] = str_replace(('YAMLSeq'.$seqk.'s'),$seq,$value);\n            $value = $explode[$key];\n          }\n        }\n      }\n    }\n\n    // Re-add the mappings\n    if (!empty($maps)) {\n      foreach ($explode as $key => $value) {\n        if (strpos($value,'YAMLMap') !== false) {\n          foreach ($maps as $mapk => $map) {\n            $explode[$key] = str_replace(('YAMLMap'.$mapk.'s'), $map, $value);\n            $value = $explode[$key];\n          }\n        }\n      }\n    }\n\n\n    // Re-add the strings\n    if (!empty($saved_strings)) {\n      foreach ($explode as $key => $value) {\n        while (strpos($value,'YAMLString') !== false) {\n          $explode[$key] = preg_replace('/YAMLString/',$saved_strings[$stringi],$value, 1);\n          unset($saved_strings[$stringi]);\n          ++$stringi;\n          $value = $explode[$key];\n        }\n      }\n    }\n\n    $finished = true;\n    foreach ($explode as $key => $value) {\n      if (strpos($value,'YAMLSeq') !== false) {\n        $finished = false; break;\n      }\n      if (strpos($value,'YAMLMap') !== false) {\n        $finished = false; break;\n      }\n      if (strpos($value,'YAMLString') !== false) {\n        $finished = false; break;\n      }\n    }\n    if ($finished) break;\n\n    $i++;\n    if ($i > 10) \n      break; // Prevent infinite loops.\n    }\n\n    return $explode;\n  }\n\n  function literalBlockContinues ($line, $lineIndent) {\n    if (!trim($line)) return true;\n    if (strlen($line) - strlen(ltrim($line)) > $lineIndent) return true;\n    return false;\n  }\n\n  function referenceContentsByAlias ($alias) {\n    do {\n      if (!isset($this->SavedGroups[$alias])) { echo \"Bad group name: $alias.\"; break; }\n      $groupPath = $this->SavedGroups[$alias];\n      $value = $this->result;\n      foreach ($groupPath as $k) {\n        $value = $value[$k];\n      }\n    } while (false);\n    return $value;\n  }\n\n  function addArrayInline ($array, $indent) {\n      $CommonGroupPath = $this->path;\n      if (empty ($array)) return false;\n      \n      foreach ($array as $k => $_) {\n        $this->addArray(array($k => $_), $indent);\n        $this->path = $CommonGroupPath;\n      }\n      return true;\n  }\n\n  function addArray ($incoming_data, $incoming_indent) {\n\n   // print_r ($incoming_data);\n\n    if (count ($incoming_data) > 1)\n      return $this->addArrayInline ($incoming_data, $incoming_indent);\n    \n    $key = key ($incoming_data);\n    $value = isset($incoming_data[$key]) ? $incoming_data[$key] : null;\n    if ($key === '__!YAMLZero') $key = '0';\n\n    if ($incoming_indent == 0 && !$this->_containsGroupAlias && !$this->_containsGroupAnchor) { // Shortcut for root-level values.\n      if ($key || $key === '' || $key === '0') {\n        $this->result[$key] = $value;\n      } else {\n        $this->result[] = $value; end ($this->result); $key = key ($this->result);\n      }\n      $this->path[$incoming_indent] = $key;\n      return;\n    }\n\n\n    \n    $history = array();\n    // Unfolding inner array tree.\n    $history[] = $_arr = $this->result;\n    foreach ($this->path as $k) {\n      $history[] = $_arr = $_arr[$k];\n    }\n\n    if ($this->_containsGroupAlias) {\n      $value = $this->referenceContentsByAlias($this->_containsGroupAlias);\n      $this->_containsGroupAlias = false;\n    }\n\n\n    // Adding string or numeric key to the innermost level or $this->arr.\n    if (is_string($key) && $key == '<<') {\n      if (!is_array ($_arr)) { $_arr = array (); }\n      $_arr = array_merge ($_arr, $value);\n    } else if ($key || $key === '' || $key === '0') {\n      $_arr[$key] = $value;\n    } else {\n      if (!is_array ($_arr)) { $_arr = array ($value); $key = 0; }\n      else { $_arr[] = $value; end ($_arr); $key = key ($_arr); }\n    }\n\n    $reverse_path = array_reverse($this->path);\n    $reverse_history = array_reverse ($history);\n    $reverse_history[0] = $_arr;\n    $cnt = count($reverse_history) - 1;\n    for ($i = 0; $i < $cnt; $i++) {\n      $reverse_history[$i+1][$reverse_path[$i]] = $reverse_history[$i];\n    }\n    $this->result = $reverse_history[$cnt];\n\n    $this->path[$incoming_indent] = $key;\n\n    if ($this->_containsGroupAnchor) {\n      $this->SavedGroups[$this->_containsGroupAnchor] = $this->path;\n      if (is_array ($value)) {\n        $k = key ($value);\n        if (!is_int ($k)) {\n          $this->SavedGroups[$this->_containsGroupAnchor][$incoming_indent + 2] = $k;\n        }\n      }\n      $this->_containsGroupAnchor = false;\n    }\n\n  }\n\n  function startsLiteralBlock ($line) {\n    $lastChar = substr (trim($line), -1);\n    if ($lastChar != '>' && $lastChar != '|') return false;\n    if ($lastChar == '|') return $lastChar;\n    // HTML tags should not be counted as literal blocks.\n    if (preg_match ('#<.*?>$#', $line)) return false;\n    return $lastChar;\n  }\n\n  function greedilyNeedNextLine($line) {\n    $line = trim ($line);\n    if (!strlen($line)) return false;\n    if (substr ($line, -1, 1) == ']') return false;\n    if ($line[0] == '[') return true;\n    if (preg_match ('#^[^:]+?:\\s*\\[#', $line)) return true;\n    return false;\n  }\n\n  function addLiteralLine ($literalBlock, $line, $literalBlockStyle) {\n    $line = $this->stripIndent($line);\n    $line = rtrim ($line, \"\\r\\n\\t \") . \"\\n\";\n    if ($literalBlockStyle == '|') {\n      return $literalBlock . $line;\n    }\n    if (strlen($line) == 0)\n      return rtrim($literalBlock, ' ') . \"\\n\";\n    if ($line == \"\\n\" && $literalBlockStyle == '>') {\n      return rtrim ($literalBlock, \" \\t\") . \"\\n\";\n    }\n    if ($line != \"\\n\")\n      $line = trim ($line, \"\\r\\n \") . \" \";\n    return $literalBlock . $line;\n  }\n\n   function revertLiteralPlaceHolder ($lineArray, $literalBlock) {\n     foreach ($lineArray as $k => $_) {\n      if (is_array($_))\n        $lineArray[$k] = $this->revertLiteralPlaceHolder ($_, $literalBlock);\n      else if (substr($_, -1 * strlen ($this->LiteralPlaceHolder)) == $this->LiteralPlaceHolder)\n\t       $lineArray[$k] = rtrim ($literalBlock, \" \\r\\n\");\n     }\n     return $lineArray;\n   }\n\n  function stripIndent ($line, $indent = -1) {\n    if ($indent == -1) $indent = strlen($line) - strlen(ltrim($line));\n    return substr ($line, $indent);\n  }\n\n  function getParentPathByIndent ($indent) {\n    if ($indent == 0) return array();\n    $linePath = $this->path;\n    do {\n      end($linePath); $lastIndentInParentPath = key($linePath);\n      if ($indent <= $lastIndentInParentPath) array_pop ($linePath);\n    } while ($indent <= $lastIndentInParentPath);\n    return $linePath;\n  }\n\n\n  function clearBiggerPathValues ($indent) {\n\n\n    if ($indent == 0) $this->path = array();\n    if (empty ($this->path)) return true;\n\n    foreach ($this->path as $k => $_) {\n      if ($k > $indent) unset ($this->path[$k]);\n    }\n\n    return true;\n  }\n\n\n  function isComment ($line) {\n    if (!$line) return false;\n    if ($line[0] == '#') return true;\n    if (trim($line, \" \\r\\n\\t\") == '---') return true;\n    return false;\n  }\n\n  function isEmpty ($line) {\n    return (trim ($line) === '');\n  }\n\n\n  function isArrayElement ($line) {\n    if (!$line) return false;\n    if ($line[0] != '-') return false;\n    if (strlen ($line) > 3)\n      if (substr($line,0,3) == '---') return false;\n    \n    return true;\n  }\n\n  function isHashElement ($line) {\n    return strpos($line, ':');\n  }\n\n  function isLiteral ($line) {\n    if ($this->isArrayElement($line)) return false;\n    if ($this->isHashElement($line)) return false;\n    return true;\n  }\n\n\n  function unquote ($value) {\n    if (!$value) return $value;\n    if (!is_string($value)) return $value;\n    if ($value[0] == '\\'') return trim ($value, '\\'');\n    if ($value[0] == '\"') return trim ($value, '\"');\n    return $value;\n  }\n\n  function startsMappedSequence ($line) {\n    return ($line[0] == '-' && substr ($line, -1, 1) == ':');\n  }\n\n  function returnMappedSequence ($line) {\n    $array = array();\n    $key         = $this->unquote(trim(substr($line,1,-1)));\n    $array[$key] = array();\n    $this->delayedPath = array(strpos ($line, $key) + $this->indent => $key);\n    return array($array);\n  }\n\n  function returnMappedValue ($line) {\n    $array = array();\n    $key         = $this->unquote (trim(substr($line,0,-1)));\n    $array[$key] = '';\n    return $array;\n  }\n\n  function startsMappedValue ($line) {\n    return (substr ($line, -1, 1) == ':');\n  }\n  \n  function isPlainArray ($line) {\n    return ($line[0] == '[' && substr ($line, -1, 1) == ']');\n  }\n  \n  function returnPlainArray ($line) {\n    return $this->_toType($line); \n  }  \n\n  function returnKeyValuePair ($line) {\n    $array = array();\n    $key = '';\n    if (strpos ($line, ':')) {\n      // It's a key/value pair most likely\n      // If the key is in double quotes pull it out\n      if (($line[0] == '\"' || $line[0] == \"'\") && preg_match('/^([\"\\'](.*)[\"\\'](\\s)*:)/',$line,$matches)) {\n        $value = trim(str_replace($matches[1],'',$line));\n        $key   = $matches[2];\n      } else {\n        // Do some guesswork as to the key and the value\n        $explode = explode(':',$line);\n        $key     = trim($explode[0]);\n        array_shift($explode);\n        $value   = trim(implode(':',$explode));\n      }\n      // Set the type of the value.  Int, string, etc\n      $value = $this->_toType($value);\n      if ($key === '0') $key = '__!YAMLZero';\n      $array[$key] = $value;\n    } else {\n      $array = array ($line);\n    }\n    return $array;\n\n  }\n\n\n  function returnArrayElement ($line) {\n     if (strlen($line) <= 1) return array(array()); // Weird %)\n     $array = array();\n     $value   = trim(substr($line,1));\n     $value   = $this->_toType($value);\n     $array[] = $value;\n     return $array;\n  }\n\n\n  function nodeContainsGroup ($line) {    \n    $symbolsForReference = 'A-z0-9_\\-';\n    if (strpos($line, '&') === false && strpos($line, '*') === false) return false; // Please die fast ;-)\n    if ($line[0] == '&' && preg_match('/^(&['.$symbolsForReference.']+)/', $line, $matches)) return $matches[1];\n    if ($line[0] == '*' && preg_match('/^(\\*['.$symbolsForReference.']+)/', $line, $matches)) return $matches[1];\n    if (preg_match('/(&['.$symbolsForReference.']+)$/', $line, $matches)) return $matches[1];\n    if (preg_match('/(\\*['.$symbolsForReference.']+$)/', $line, $matches)) return $matches[1];\n    if (preg_match ('#^\\s*<<\\s*:\\s*(\\*[^\\s]+).*$#', $line, $matches)) return $matches[1];\n    return false;\n\n  }\n\n  function addGroup ($line, $group) {\n    if ($group[0] == '&') $this->_containsGroupAnchor = substr ($group, 1);\n    if ($group[0] == '*') $this->_containsGroupAlias = substr ($group, 1);\n    //print_r ($this->path);\n  }\n\n  function stripGroup ($line, $group) {\n    $line = trim(str_replace($group, '', $line));\n    return $line;\n  }\n}\n\n// Enable use of Spyc from command line\n// The syntax is the following: php spyc.php spyc.yaml\n\ndefine ('SPYC_FROM_COMMAND_LINE', false);\n\ndo {\n  if (!SPYC_FROM_COMMAND_LINE) break;\n  if (empty ($_SERVER['argc']) || $_SERVER['argc'] < 2) break;\n  if (empty ($_SERVER['PHP_SELF']) || $_SERVER['PHP_SELF'] != 'spyc.php') break;\n  $file = $argv[1];\n  printf (\"Spyc loading file: %s\\n\", $file);\n  print_r (spyc_load_file ($file));\n} while (0);"
  },
  {
    "path": "ThinkPHP/Library/Vendor/spyc/php4/test.php4",
    "content": "<?php\n#\n#    S P Y C\n#      a simple php yaml class\n#   v0.3\n#\n# author: [chris wanstrath, chris@ozmm.org]\n# websites: [http://www.yaml.org, http://spyc.sourceforge.net/]\n# license: [MIT License, http://www.opensource.org/licenses/mit-license.php]\n# copyright: (c) 2005-2006 Chris Wanstrath\n#\n# We're gonna load a file into memory and see if we get what we expect.\n# If not, we're gonna complain.\n#\n# Pretty lo-fi.  Let's see if we can't get some unit testing going in the next,\n# I dunno, 20 months?  Alright.  Go team.\n#\n\nerror_reporting(E_ALL);\n\ninclude('spyc.php4');\n\n$yaml = Spyc::YAMLLoad('../spyc.yaml');\n\n// print_r ($yaml);\n\n# Added in .2\nif ($yaml[1040] != \"Ooo, a numeric key!\")\n\tdie('Key: 1040 failed');\n\n# Test mappings / types\nif ($yaml['String'] != \"Anyone's name, really.\")\n\tdie('Key: String failed');\n\nif ($yaml['Int'] !== 13)\n\tdie('Key: Int failed');\n\nif ($yaml['True'] !== true)\n\tdie('Key: True failed');\n\nif ($yaml['False'] !== false)\n\tdie('Key: False failed');\n\nif ($yaml['Zero'] !== 0)\n\tdie('Key: Zero failed');\n\nif (isset($yaml['Null']))\n\tdie('Key: Null failed');\n\nif ($yaml['Float'] !== 5.34)\n\tdie('Key: Float failed');\n\n\n# Test sequences\nif ($yaml[0] != \"PHP Class\")\n\tdie('Sequence 0 failed');\n\nif ($yaml[1] != \"Basic YAML Loader\")\n\tdie('Sequence 1 failed');\n\nif ($yaml[2] != \"Very Basic YAML Dumper\")\n\tdie('Sequence 2 failed');\n\n# A sequence of a sequence\nif ($yaml[3] != array(\"YAML is so easy to learn.\",\n\t\t\t\t\t\t\t\t\t\t\t\"Your config files will never be the same.\"))\n\tdie('Sequence 3 failed');\n\n# Sequence of mappings\nif ($yaml[4] != array(\"cpu\" => \"1.5ghz\", \"ram\" => \"1 gig\",\n\t\t\t\t\t\t\t\t\t\t\t\"os\" => \"os x 10.4.1\"))\n\tdie('Sequence 4 failed');\n\n# Mapped sequence\nif ($yaml['domains'] != array(\"yaml.org\", \"php.net\"))\n\tdie(\"Key: 'domains' failed\");\n\n# A sequence like this.\nif ($yaml[5] != array(\"program\" => \"Adium\", \"platform\" => \"OS X\",\n\t\t\t\t\t\t\t\t\t\t\t\"type\" => \"Chat Client\"))\n\tdie('Sequence 5 failed');\n\n# A folded block as a mapped value\nif ($yaml['no time'] != \"There isn't any time for your tricks!\\nDo you understand?\")\n\tdie(\"Key: 'no time' failed\");\n\n# A literal block as a mapped value\nif ($yaml['some time'] != \"There is nothing but time\\nfor your tricks.\")\n\tdie(\"Key: 'some time' failed\");\n\n# Crazy combinations\nif ($yaml['databases'] != array( array(\"name\" => \"spartan\", \"notes\" =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarray( \"Needs to be backed up\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \"Needs to be normalized\" ),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \"type\" => \"mysql\" )))\n  die(\"Key: 'databases' failed\");\n\n# You can be a bit tricky\nif ($yaml[\"if: you'd\"] != \"like\")\n\tdie(\"Key: 'if: you\\'d' failed\");\n\n# Inline sequences\nif ($yaml[6] != array(\"One\", \"Two\", \"Three\", \"Four\"))\n\tdie(\"Sequence 6 failed\");\n\n# Nested Inline Sequences\nif ($yaml[7] != array(\"One\", array(\"Two\", \"And\", \"Three\"), \"Four\", \"Five\"))\n\tdie(\"Sequence 7 failed\");\n\n# Nested Nested Inline Sequences\nif ($yaml[8] != array( \"This\", array(\"Is\", \"Getting\", array(\"Ridiculous\", \"Guys\")),\n\t\t\t\t\t\t\t\t\t\"Seriously\", array(\"Show\", \"Mercy\")))\n\tdie(\"Sequence 8 failed\");\n\n# Inline mappings\nif ($yaml[9] != array(\"name\" => \"chris\", \"age\" => \"young\", \"brand\" => \"lucky strike\"))\n\tdie(\"Sequence 9 failed\");\n\n# Nested inline mappings\nif ($yaml[10] != array(\"name\" => \"mark\", \"age\" => \"older than chris\",\n\t\t\t\t\t\t\t\t\t\t\t \"brand\" => array(\"marlboro\", \"lucky strike\")))\n\tdie(\"Sequence 10 failed\");\n\n# References -- they're shaky, but functional\nif ($yaml['dynamic languages'] != array('Perl', 'Python', 'PHP', 'Ruby'))\n\tdie(\"Key: 'dynamic languages' failed\");\n\nif ($yaml['compiled languages'] != array('C/C++', 'Java'))\n\tdie(\"Key: 'compiled languages' failed\");\n\nif ($yaml['all languages'] != array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarray('Perl', 'Python', 'PHP', 'Ruby'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarray('C/C++', 'Java')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ))\n\tdie(\"Key: 'all languages' failed\");\n\n# Added in .2.2: Escaped quotes\nif ($yaml[11] != \"you know, this shouldn't work.  but it does.\")\n\tdie(\"Sequence 11 failed.\");\n\nif ($yaml[12] != \"that's my value.\")\n\tdie(\"Sequence 12 failed.\");\n\nif ($yaml[13] != \"again, that's my value.\")\n\tdie(\"Sequence 13 failed.\");\n\nif ($yaml[14] != \"here's to \\\"quotes\\\", boss.\")\n\tdie(\"Sequence 14 failed.\");\n\nif ($yaml[15] != array( 'name' => \"Foo, Bar's\", 'age' => 20))\n\tdie(\"Sequence 15 failed.\");\n\nif ($yaml[16] != array( 0 => \"a\", 1 => array (0 => 1, 1 => 2), 2 => \"b\"))\n\tdie(\"Sequence 16 failed.\");\n\nif ($yaml['endloop'] != \"Does this line in the end indeed make Spyc go to an infinite loop?\")\n\tdie(\"[endloop] failed.\");\n\n\nprint \"spyc.yaml parsed correctly\\n\";\n\n?>"
  },
  {
    "path": "ThinkPHP/Library/Vendor/spyc/spyc.yaml",
    "content": "#\n#    S P Y C\n#      a simple php yaml class\n#\n# authors: [vlad andersen (vlad.andersen@gmail.com), chris wanstrath (chris@ozmm.org)]\n# websites: [http://www.yaml.org, http://spyc.sourceforge.net/]\n# license: [MIT License, http://www.opensource.org/licenses/mit-license.php]\n# copyright: (c) 2005-2006 Chris Wanstrath, 2006-2014 Vlad Andersen\n#\n# spyc.yaml - A file containing the YAML that Spyc understands.\n\n---\n\n# Mappings - with proper types\nString: Anyone's name, really.\nInt: 13\nBadHex: f0xf3\nHex: 0xf3\nTrue: true\nFalse: false\nZero: 0\nNull: NULL\nNotNull: 'null'\nNotTrue: 'y'\nNotBoolTrue: 'true'\nNotInt: '5'\nFloat: 5.34\nNegative: -90\nSmallFloat: 0.7\nNewLine: \\n\nQuotedNewLine: \"\\n\"\n\n# A sequence\n- PHP Class\n- Basic YAML Loader\n- Very Basic YAML Dumper\n\n# A sequence of a sequence\n-\n  - YAML is so easy to learn.\n  - Your config files will never be the same.\n\n# Sequence of mappings\n-\n  cpu: 1.5ghz\n  ram: 1 gig\n  os : os x 10.4.1\n\n# Mapped sequence\ndomains:\n  - yaml.org\n  - php.net\n\n# A sequence like this.\n- program: Adium\n  platform: OS X\n  type: Chat Client\n\n# A folded block as a mapped value\nno time: >\n  There isn't any time\n  for your tricks!\n\n  Do you understand?\n\n# A literal block as a mapped value\nsome time: |\n  There is nothing but time\n  for your tricks.\n\n# Crazy combinations\ndatabases:\n  - name: spartan\n    notes:\n      - Needs to be backed up\n      - Needs to be normalized\n    type: mysql\n\n# You can be a bit tricky\n\"if: you'd\": like\n\n# Inline sequences\n- [One, Two, Three, Four]\n\n# Nested Inline Sequences\n- [One, [Two, And, Three], Four, Five]\n\n# Nested Nested Inline Sequences\n- [This, [Is, Getting, [Ridiculous, Guys]], Seriously, [Show, Mercy]]\n\n# Inline mappings\n- {name: chris, age: young, brand: lucky strike}\n\n# Nested inline mappings\n- {name: mark, age: older than chris, brand: [marlboro, lucky strike]}\n\n# References -- they're shaky, but functional\ndynamic languages: &DLANGS\n  - Perl\n  - Python\n  - PHP\n  - Ruby\ncompiled languages: &CLANGS\n  - C/C++\n  - Java\nall languages:\n  - *DLANGS\n  - *CLANGS\n\n# Added in .2.2: Escaped quotes\n- you know, this shouldn't work.  but it does.\n- 'that''s my value.'\n- 'again, that\\'s my value.'\n- \"here's to \\\"quotes\\\", boss.\"\n\n# added in .2.3\n- {name: \"Foo, Bar's\", age: 20}\n\n# Added in .2.4: bug [ 1418193 ] Quote Values in Nested Arrays\n- [a, ['1', \"2\"], b]\n\n# Add in .5.2: Quoted new line values.\n- \"First line\\nSecond line\\nThird line\"\n\n# Added in .2.4: malformed YAML\nall\n  javascripts:     [dom1.js, dom.js]\n\n# Added in .2\n1040: Ooo, a numeric key! # And working comments? Wow! Colons in comments: a menace (0.3).\n\nhash_1: Hash #and a comment\nhash_2: \"Hash #and a comment\"\n\"hash#3\": \"Hash (#) can appear in key too\"\n\nfloat_test: 1.0\nfloat_test_with_quotes: '1.0'\nfloat_inverse_test: 001\n\na_really_large_number: 115792089237316195423570985008687907853269984665640564039457584007913129639936 # 2^256\n\nint array: [ 1, 2, 3 ]\n\narray on several lines:\n  [ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9,\n    10, 11, 12, 13, 14, 15, 16, 17, 18, 19 ]\n\nmorelesskey: \"<value>\"\n\narray_of_zero: [0]\nsophisticated_array_of_zero: {rx: {tx: [0]} }\n\nswitches:\n  - { row: 0, col: 0, func: {tx: [0, 1]} }\n\nempty_sequence: [ ]\nempty_hash: { }\n\nspecial_characters: \"[{]]{{]]\"\n\nasterisks: \"*\"\n\nempty_key:\n  :\n    key: value\n\ntrailing_colon: \"foo:\"\n\nmultiline_items:\n  - type: SomeItem\n    values: [blah, blah, blah,\n      blah]\n    ints: [2, 54, 12,\n      2143]\n\nmany_lines: |\n  A quick\n  fox\n\n\n  jumped\n  over\n\n\n\n\n\n  a lazy\n\n\n\n  dog\n\n\nwerte:\n  1: nummer 1\n  0: Stunde 0\n\nnoindent_records:\n- record1: value1\n- record2: value2\n\n\"a:1\": [1000]\n\"a:2\":\n  - 2000\na:3: [3000]\n\ncomplex_unquoted_key:\n  a:b:''test': value\n\narray with commas:\n  [\"0\",\"1\"]\n\ninvoice: [\"Something\", \"\", '', \"Something else\"]\nquotes: ['Something', \"Nothing\", 'Anything', \"Thing\"]\n\n# [Endloop]\nendloop: |\n  Does this line in the end indeed make Spyc go to an infinite loop?\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/spyc/tests/DumpTest.php",
    "content": "<?php\n\nrequire_once (\"../Spyc.php\");\n\nclass DumpTest extends PHPUnit_Framework_TestCase {\n\n    private $files_to_test = array();\n\n    public function setUp() {\n      $this->files_to_test = array ('../spyc.yaml', 'failing1.yaml', 'indent_1.yaml', 'quotes.yaml');\n    }\n\n    public function testShortSyntax() {\n      $dump = spyc_dump(array ('item1', 'item2', 'item3'));\n      $awaiting = \"- item1\\n- item2\\n- item3\\n\";\n      $this->assertEquals ($awaiting, $dump);\n    }\n\n    public function testDump() {\n      foreach ($this->files_to_test as $file) {\n        $yaml = spyc_load(file_get_contents($file));\n        $dump = Spyc::YAMLDump ($yaml);\n        $yaml_after_dump = Spyc::YAMLLoad ($dump);\n        $this->assertEquals ($yaml, $yaml_after_dump);\n      }\n    }\n\n    public function testDumpWithQuotes() {\n      $Spyc = new Spyc();\n      $Spyc->setting_dump_force_quotes = true;\n      foreach ($this->files_to_test as $file) {\n        $yaml = $Spyc->load(file_get_contents($file));\n        $dump = $Spyc->dump ($yaml);\n        $yaml_after_dump = Spyc::YAMLLoad ($dump);\n        $this->assertEquals ($yaml, $yaml_after_dump);\n      }\n    }\n\n    public function testDumpArrays() {\n      $dump = Spyc::YAMLDump(array ('item1', 'item2', 'item3'));\n      $awaiting = \"---\\n- item1\\n- item2\\n- item3\\n\";\n      $this->assertEquals ($awaiting, $dump);\n    }\n\n    public function testNull() {\n        $dump = Spyc::YAMLDump(array('a' => 1, 'b' => null, 'c' => 3));\n        $awaiting = \"---\\na: 1\\nb: null\\nc: 3\\n\";\n        $this->assertEquals ($awaiting, $dump);\n    }\n\n    public function testNext() {\n        $array = array(\"aaa\", \"bbb\", \"ccc\");\n        #set arrays internal pointer to next element\n        next($array);\n        $dump = Spyc::YAMLDump($array);\n        $awaiting = \"---\\n- aaa\\n- bbb\\n- ccc\\n\";\n        $this->assertEquals ($awaiting, $dump);\n    }\n\n    public function testDumpingMixedArrays() {\n        $array = array();\n        $array[] = 'Sequence item';\n        $array['The Key'] = 'Mapped value';\n        $array[] = array('A sequence','of a sequence');\n        $array[] = array('first' => 'A sequence','second' => 'of mapped values');\n        $array['Mapped'] = array('A sequence','which is mapped');\n        $array['A Note'] = 'What if your text is too long?';\n        $array['Another Note'] = 'If that is the case, the dumper will probably fold your text by using a block.  Kinda like this.';\n        $array['The trick?'] = 'The trick is that we overrode the default indent, 2, to 4 and the default wordwrap, 40, to 60.';\n        $array['Old Dog'] = \"And if you want\\n to preserve line breaks, \\ngo ahead!\";\n        $array['key:withcolon'] = \"Should support this to\";\n\n        $yaml = Spyc::YAMLDump($array,4,60);\n    }\n\n    public function testMixed() {\n        $dump = Spyc::YAMLDump(array(0 => 1, 'b' => 2, 1 => 3));\n        $awaiting = \"---\\n0: 1\\nb: 2\\n1: 3\\n\";\n        $this->assertEquals ($awaiting, $dump);\n    }\n\n    public function testDumpNumerics() {\n      $dump = Spyc::YAMLDump(array ('404', '405', '500'));\n      $awaiting = \"---\\n- \\\"404\\\"\\n- \\\"405\\\"\\n- \\\"500\\\"\\n\";\n      $this->assertEquals ($awaiting, $dump);\n    }\n\n    public function testDumpAsterisks() {\n      $dump = Spyc::YAMLDump(array ('*'));\n      $awaiting = \"---\\n- '*'\\n\";\n      $this->assertEquals ($awaiting, $dump);\n    }\n\n    public function testDumpAmpersands() {\n      $dump = Spyc::YAMLDump(array ('some' => '&foo'));\n      $awaiting = \"---\\nsome: '&foo'\\n\";\n      $this->assertEquals ($awaiting, $dump);\n    }\n\n    public function testDumpExclamations() {\n      $dump = Spyc::YAMLDump(array ('some' => '!foo'));\n      $awaiting = \"---\\nsome: '!foo'\\n\";\n      $this->assertEquals ($awaiting, $dump);\n    }\n\n    public function testDumpExclamations2() {\n      $dump = Spyc::YAMLDump(array ('some' => 'foo!'));\n      $awaiting = \"---\\nsome: foo!\\n\";\n      $this->assertEquals ($awaiting, $dump);\n    }\n\n    public function testDumpApostrophes() {\n      $dump = Spyc::YAMLDump(array ('some' => \"'Biz' pimpt bedrijventerreinen\"));\n      $awaiting = \"---\\nsome: \\\"'Biz' pimpt bedrijventerreinen\\\"\\n\";\n      $this->assertEquals ($awaiting, $dump);\n    }\n\n    public function testDumpNumericHashes() {\n      $dump = Spyc::YAMLDump(array (\"titel\"=> array(\"0\" => \"\", 1 => \"Dr.\", 5 => \"Prof.\", 6 => \"Prof. Dr.\")));\n      $awaiting = \"---\\ntitel:\\n  0: \\\"\\\"\\n  1: Dr.\\n  5: Prof.\\n  6: Prof. Dr.\\n\";\n      $this->assertEquals ($awaiting, $dump);\n    }\n\n    public function testEmpty() {\n      $dump = Spyc::YAMLDump(array(\"foo\" => array()));\n      $awaiting = \"---\\nfoo: [ ]\\n\";\n      $this->assertEquals ($awaiting, $dump);\n    }\n\n    public function testHashesInKeys() {\n      $dump = Spyc::YAMLDump(array ('#color' => '#ffffff'));\n      $awaiting = \"---\\n\\\"#color\\\": '#ffffff'\\n\";\n      $this->assertEquals ($awaiting, $dump);\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/spyc/tests/IndentTest.php",
    "content": "<?php\n\nrequire_once (\"../Spyc.php\");\n\nclass IndentTest extends PHPUnit_Framework_TestCase {\n\n    protected $Y;\n\n    protected function setUp() {\n      $this->Y = Spyc::YAMLLoad(\"indent_1.yaml\");\n    }\n\n    public function testIndent_1() {\n      $this->assertEquals (array ('child_1' => 2, 'child_2' => 0, 'child_3' => 1), $this->Y['root']);\n    }\n\n    public function testIndent_2() {\n      $this->assertEquals (array ('child_1' => 1, 'child_2' => 2), $this->Y['root2']);\n    }\n\n    public function testIndent_3() {\n      $this->assertEquals (array (array ('resolutions' => array (1024 => 768, 1920 => 1200), 'producer' => 'Nec')), $this->Y['display']);\n    }\n\n    public function testIndent_4() {\n      $this->assertEquals (array (\n          array ('resolutions' => array (1024 => 768)),\n          array ('resolutions' => array (1920 => 1200)),\n        ), $this->Y['displays']);\n    }\n\n    public function testIndent_5() {\n      $this->assertEquals (array (array (\n        'row' => 0,\n        'col' => 0,\n        'headsets_affected' => array (\n            array (\n              'ports' => array (0),\n              'side' => 'left',\n            )\n        ),\n        'switch_function' => array (\n          'ics_ptt' => true\n        )\n      )), $this->Y['nested_hashes_and_seqs']);\n    }\n\n    public function testIndent_6() {\n      $this->assertEquals (array (\n        'h' => array (\n          array ('a' => 'b', 'a1' => 'b1'),\n          array ('c' => 'd')\n        )\n      ), $this->Y['easier_nest']);\n    }\n\n    public function testIndent_space() {\n      $this->assertEquals (\"By four\\n  spaces\", $this->Y['one_space']);\n    }\n\n    public function testListAndComment() {\n      $this->assertEquals (array ('one', 'two', 'three'), $this->Y['list_and_comment']);\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/spyc/tests/ParseTest.php",
    "content": "<?php\n\nrequire_once (\"../Spyc.php\");\n\nclass ParseTest extends PHPUnit_Framework_TestCase {\n\n    protected $yaml;\n\n    protected function setUp() {\n      $this->yaml = spyc_load_file('../spyc.yaml');\n    }\n\n    public function testMergeHashKeys() {\n      $Expected =  array (\n        array ('step' => array('instrument' => 'Lasik 2000', 'pulseEnergy' => 5.4, 'pulseDuration' => 12, 'repetition' => 1000, 'spotSize' => '1mm')),\n        array ('step' => array('instrument' => 'Lasik 2000', 'pulseEnergy' => 5.4, 'pulseDuration' => 12, 'repetition' => 1000, 'spotSize' => '2mm')),\n      );\n      $Actual = spyc_load_file ('indent_1.yaml');\n      $this->assertEquals ($Expected, $Actual['steps']);\n    }\n\n    public function testDeathMasks() {\n      $Expected = array ('sad' => 2, 'magnificent' => 4);\n      $Actual = spyc_load_file ('indent_1.yaml');\n      $this->assertEquals ($Expected, $Actual['death masks are']);\n    }\n\n    public function testDevDb() {\n      $Expected = array ('adapter' => 'mysql', 'host' => 'localhost', 'database' => 'rails_dev');\n      $Actual = spyc_load_file ('indent_1.yaml');\n      $this->assertEquals ($Expected, $Actual['development']);\n    }\n\n    public function testNumericKey() {\n      $this->assertEquals (\"Ooo, a numeric key!\", $this->yaml[1040]);\n    }\n\n    public function testMappingsString() {\n      $this->assertEquals (\"Anyone's name, really.\", $this->yaml['String']);\n    }\n\n    public function testMappingsInt() {\n      $this->assertSame (13, $this->yaml['Int']);\n    }\n\n    public function testMappingsHex() {\n      $this->assertSame (243, $this->yaml['Hex']);\n      $this->assertSame ('f0xf3', $this->yaml['BadHex']);\n    }\n\n    public function testMappingsBooleanTrue() {\n      $this->assertSame (true, $this->yaml['True']);\n    }\n\n    public function testMappingsBooleanFalse() {\n      $this->assertSame (false, $this->yaml['False']);\n    }\n\n    public function testMappingsZero() {\n      $this->assertSame (0, $this->yaml['Zero']);\n    }\n\n    public function testMappingsNull() {\n      $this->assertSame (null, $this->yaml['Null']);\n    }\n\n    public function testMappingsNotNull() {\n      $this->assertSame ('null', $this->yaml['NotNull']);\n    }\n\n    public function testMappingsFloat() {\n      $this->assertSame (5.34, $this->yaml['Float']);\n    }\n\n    public function testMappingsNegative() {\n      $this->assertSame (-90, $this->yaml['Negative']);\n    }\n\n    public function testMappingsSmallFloat() {\n      $this->assertSame (0.7, $this->yaml['SmallFloat']);\n    }\n\n    public function testNewline() {\n      $this->assertSame ('\\n', $this->yaml['NewLine']);\n    }\n\n    public function testQuotedNewline() {\n      $this->assertSame (\"\\n\", $this->yaml['QuotedNewLine']);\n    }\n\n    public function testSeq0() {\n      $this->assertEquals (\"PHP Class\", $this->yaml[0]);\n    }\n\n    public function testSeq1() {\n      $this->assertEquals (\"Basic YAML Loader\", $this->yaml[1]);\n    }\n\n    public function testSeq2() {\n      $this->assertEquals (\"Very Basic YAML Dumper\", $this->yaml[2]);\n    }\n\n    public function testSeq3() {\n      $this->assertEquals (array(\"YAML is so easy to learn.\",\n\t\t\t\t\t\t\t\t\t\t\t\"Your config files will never be the same.\"), $this->yaml[3]);\n    }\n\n    public function testSeqMap() {\n      $this->assertEquals (array(\"cpu\" => \"1.5ghz\", \"ram\" => \"1 gig\",\n\t\t\t\t\t\t\t\t\t\t\t\"os\" => \"os x 10.4.1\"), $this->yaml[4]);\n    }\n\n    public function testMappedSequence() {\n      $this->assertEquals (array(\"yaml.org\", \"php.net\"), $this->yaml['domains']);\n    }\n\n    public function testAnotherSequence() {\n      $this->assertEquals (array(\"program\" => \"Adium\", \"platform\" => \"OS X\",\n\t\t\t\t\t\t\t\t\t\t\t\"type\" => \"Chat Client\"), $this->yaml[5]);\n    }\n\n    public function testFoldedBlock() {\n      $this->assertEquals (\"There isn't any time for your tricks!\\nDo you understand?\", $this->yaml['no time']);\n    }\n\n    public function testLiteralAsMapped() {\n      $this->assertEquals (\"There is nothing but time\\nfor your tricks.\", $this->yaml['some time']);\n    }\n\n    public function testCrazy() {\n      $this->assertEquals (array( array(\"name\" => \"spartan\", \"notes\" =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarray( \"Needs to be backed up\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \"Needs to be normalized\" ),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \"type\" => \"mysql\" )), $this->yaml['databases']);\n    }\n\n    public function testColons() {\n      $this->assertEquals (\"like\", $this->yaml[\"if: you'd\"]);\n    }\n\n    public function testInline() {\n      $this->assertEquals (array(\"One\", \"Two\", \"Three\", \"Four\"), $this->yaml[6]);\n    }\n\n    public function testNestedInline() {\n      $this->assertEquals (array(\"One\", array(\"Two\", \"And\", \"Three\"), \"Four\", \"Five\"), $this->yaml[7]);\n    }\n\n    public function testNestedNestedInline() {\n      $this->assertEquals (array( \"This\", array(\"Is\", \"Getting\", array(\"Ridiculous\", \"Guys\")),\n\t\t\t\t\t\t\t\t\t\"Seriously\", array(\"Show\", \"Mercy\")), $this->yaml[8]);\n    }\n\n    public function testInlineMappings() {\n      $this->assertEquals (array(\"name\" => \"chris\", \"age\" => \"young\", \"brand\" => \"lucky strike\"), $this->yaml[9]);\n    }\n\n    public function testNestedInlineMappings() {\n      $this->assertEquals (array(\"name\" => \"mark\", \"age\" => \"older than chris\",\n\t\t\t\t\t\t\t\t\t\t\t \"brand\" => array(\"marlboro\", \"lucky strike\")), $this->yaml[10]);\n    }\n\n    public function testReferences() {\n      $this->assertEquals (array('Perl', 'Python', 'PHP', 'Ruby'), $this->yaml['dynamic languages']);\n    }\n\n    public function testReferences2() {\n      $this->assertEquals (array('C/C++', 'Java'), $this->yaml['compiled languages']);\n    }\n\n    public function testReferences3() {\n      $this->assertEquals (array(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarray('Perl', 'Python', 'PHP', 'Ruby'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarray('C/C++', 'Java')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ), $this->yaml['all languages']);\n    }\n\n    public function testEscapedQuotes() {\n      $this->assertEquals (\"you know, this shouldn't work.  but it does.\", $this->yaml[11]);\n    }\n\n    public function testEscapedQuotes_2() {\n      $this->assertEquals ( \"that's my value.\", $this->yaml[12]);\n    }\n\n    public function testEscapedQuotes_3() {\n      $this->assertEquals (\"again, that's my value.\", $this->yaml[13]);\n    }\n\n    public function testQuotes() {\n      $this->assertEquals (\"here's to \\\"quotes\\\", boss.\", $this->yaml[14]);\n    }\n\n    public function testQuoteSequence() {\n      $this->assertEquals ( array( 'name' => \"Foo, Bar's\", 'age' => 20), $this->yaml[15]);\n    }\n\n    public function testShortSequence() {\n      $this->assertEquals (array( 0 => \"a\", 1 => array (0 => 1, 1 => 2), 2 => \"b\"), $this->yaml[16]);\n    }\n\n    public function testQuotedNewlines() {\n      $this->assertEquals (\"First line\\nSecond line\\nThird line\", $this->yaml[17]);\n    }\n\n    public function testHash_1() {\n      $this->assertEquals (\"Hash\", $this->yaml['hash_1']);\n    }\n\n    public function testHash_2() {\n      $this->assertEquals ('Hash #and a comment', $this->yaml['hash_2']);\n    }\n\n    public function testHash_3() {\n      $this->assertEquals ('Hash (#) can appear in key too', $this->yaml['hash#3']);\n    }\n\n    public function testEndloop() {\n      $this->assertEquals (\"Does this line in the end indeed make Spyc go to an infinite loop?\", $this->yaml['endloop']);\n    }\n\n    public function testReallyLargeNumber() {\n      $this->assertEquals ('115792089237316195423570985008687907853269984665640564039457584007913129639936', $this->yaml['a_really_large_number']);\n    }\n\n    public function testFloatWithZeros() {\n      $this->assertSame ('1.0', $this->yaml['float_test']);\n    }\n\n    public function testFloatWithQuotes() {\n      $this->assertSame ('1.0', $this->yaml['float_test_with_quotes']);\n    }\n\n    public function testFloatInverse() {\n      $this->assertEquals ('001', $this->yaml['float_inverse_test']);\n    }\n\n    public function testIntArray() {\n      $this->assertEquals (array (1, 2, 3), $this->yaml['int array']);\n    }\n\n    public function testArrayOnSeveralLines() {\n      $this->assertEquals (array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19), $this->yaml['array on several lines']);\n    }\n\n    public function testArrayWithCommas() {\n      $this->assertEquals(array (0, 1), $this->yaml['array with commas']);\n    }\n\n    public function testmoreLessKey() {\n      $this->assertEquals ('<value>', $this->yaml['morelesskey']);\n    }\n\n    public function testArrayOfZero() {\n      $this->assertSame (array(0), $this->yaml['array_of_zero']);\n    }\n\n    public function testSophisticatedArrayOfZero() {\n      $this->assertSame (array('rx' => array ('tx' => array (0))), $this->yaml['sophisticated_array_of_zero']);\n    }\n\n    public function testSwitches() {\n      $this->assertEquals (array (array ('row' => 0, 'col' => 0, 'func' => array ('tx' => array(0, 1)))), $this->yaml['switches']);\n    }\n\n    public function testEmptySequence() {\n      $this->assertSame (array(), $this->yaml['empty_sequence']);\n    }\n\n    public function testEmptyHash() {\n      $this->assertSame (array(), $this->yaml['empty_hash']);\n    }\n\n    public function testEmptykey() {\n      $this->assertSame (array('' => array ('key' => 'value')), $this->yaml['empty_key']);\n    }\n\n    public function testMultilines() {\n      $this->assertSame (array(array('type' => 'SomeItem', 'values' => array ('blah', 'blah', 'blah', 'blah'), 'ints' => array(2, 54, 12, 2143))), $this->yaml['multiline_items']);\n    }\n\n    public function testManyNewlines() {\n      $this->assertSame ('A quick\nfox\n\n\njumped\nover\n\n\n\n\n\na lazy\n\n\n\ndog', $this->yaml['many_lines']);\n    }\n\n    public function testWerte() {\n      $this->assertSame (array ('1' => 'nummer 1', '0' => 'Stunde 0'), $this->yaml['werte']);\n    }\n\n    /* public function testNoIndent() {\n      $this->assertSame (array(\n        array ('record1'=>'value1'),\n        array ('record2'=>'value2')\n      )\n      , $this->yaml['noindent_records']);\n    } */\n\n    public function testColonsInKeys() {\n      $this->assertSame (array (1000), $this->yaml['a:1']);\n    }\n\n    public function testColonsInKeys2() {\n      $this->assertSame (array (2000), $this->yaml['a:2']);\n    }\n\n    public function testUnquotedColonsInKeys() {\n        $this->assertSame (array (3000), $this->yaml['a:3']);\n    }\n\n    public function testComplicatedKeyWithColon() {\n        $this->assertSame(array(\"a:b:''test'\" => 'value'), $this->yaml['complex_unquoted_key']);\n    }\n\n    public function testKeysInMappedValueException() {\n        $this->setExpectedException('Exception');\n        Spyc::YAMLLoad('x: y: z:');\n    }\n\n    public function testKeysInValueException() {\n        $this->setExpectedException('Exception');\n        Spyc::YAMLLoad('x: y: z');\n    }\n\n    public function testSpecialCharacters() {\n      $this->assertSame ('[{]]{{]]', $this->yaml['special_characters']);\n    }\n\n    public function testAngleQuotes() {\n      $Quotes = Spyc::YAMLLoad('quotes.yaml');\n      $this->assertEquals (array ('html_tags' => array ('<br>', '<p>'), 'html_content' => array ('<p>hello world</p>', 'hello<br>world'), 'text_content' => array ('hello world')),\n          $Quotes);\n    }\n\n    public function testFailingColons() {\n      $Failing = Spyc::YAMLLoad('failing1.yaml');\n      $this->assertSame (array ('MyObject' => array ('Prop1' => array ('key1:val1'))),\n          $Failing);\n    }\n\n    public function testQuotesWithComments() {\n      $Expected = 'bar';\n      $Actual = spyc_load_file ('comments.yaml');\n      $this->assertEquals ($Expected, $Actual['foo']);\n    }\n\n    public function testArrayWithComments() {\n      $Expected = array ('x', 'y', 'z');\n      $Actual = spyc_load_file ('comments.yaml');\n      $this->assertEquals ($Expected, $Actual['arr']);\n    }\n\n    public function testAfterArrayWithKittens() {\n      $Expected = 'kittens';\n      $Actual = spyc_load_file ('comments.yaml');\n      $this->assertEquals ($Expected, $Actual['bar']);\n    }\n\n    // Plain characters http://www.yaml.org/spec/1.2/spec.html#id2789510\n    public function testKai() {\n      $Expected = array('-example' => 'value');\n      $Actual = spyc_load_file ('indent_1.yaml');\n      $this->assertEquals ($Expected, $Actual['kai']);\n    }\n\n    public function testKaiList() {\n      $Expected = array ('-item', '-item', '-item');\n      $Actual = spyc_load_file ('indent_1.yaml');\n      $this->assertEquals ($Expected, $Actual['kai_list_of_items']);\n    }\n\n    public function testDifferentQuoteTypes() {\n      $expected = array ('Something', \"\", \"\", \"Something else\");\n      $this->assertSame ($expected, $this->yaml['invoice']);\n    }\n\n    public function testDifferentQuoteTypes2() {\n      $expected = array ('Something', \"Nothing\", \"Anything\", \"Thing\");\n      $this->assertSame ($expected, $this->yaml['quotes']);\n    }\n\n    // Separation spaces http://www.yaml.org/spec/1.2/spec.html#id2778394\n    public function testMultipleArrays() {\n      $expected = array(array(array('x')));\n      $this->assertSame($expected, Spyc::YAMLLoad(\"- - - x\"));\n    }\n}\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/spyc/tests/RoundTripTest.php",
    "content": "<?php\n\nrequire_once (\"../Spyc.php\");\n\nfunction roundTrip($a) { return Spyc::YAMLLoad(Spyc::YAMLDump(array('x' => $a))); }\n\n\nclass RoundTripTest extends PHPUnit_Framework_TestCase {\n\n    protected function setUp() {\n    }\n\n    public function testNull() {\n      $this->assertEquals (array ('x' => null), roundTrip (null));\n    }\n\n    public function testY() {\n      $this->assertEquals (array ('x' => 'y'), roundTrip ('y'));\n    }\n    \n    public function testExclam() {\n      $this->assertEquals (array ('x' => '!yeah'), roundTrip ('!yeah'));\n    }\n\n    public function test5() {\n      $this->assertEquals (array ('x' => '5'), roundTrip ('5'));\n    }\n\n    public function testSpaces() {\n      $this->assertEquals (array ('x' => 'x '), roundTrip ('x '));\n    }\n    \n    public function testApostrophes() {\n      $this->assertEquals (array ('x' => \"'biz'\"), roundTrip (\"'biz'\"));\n    }\n\n    public function testNewLines() {\n      $this->assertEquals (array ('x' => \"\\n\"), roundTrip (\"\\n\"));\n    }\n\n    public function testHashes() {\n      $this->assertEquals (array ('x' => array (\"#color\" => '#fff')), roundTrip (array (\"#color\" => '#fff')));\n    }\n\n    public function testPreserveString() {\n      $result1 = roundTrip ('0');\n      $result2 = roundTrip ('true');\n      $this->assertTrue (is_string ($result1['x']));\n      $this->assertTrue (is_string ($result2['x']));\n    }\n\n    public function testPreserveBool() {\n      $result = roundTrip (true);\n      $this->assertTrue (is_bool ($result['x']));\n    }\n\n    public function testPreserveInteger() {\n      $result = roundTrip (0);\n      $this->assertTrue (is_int ($result['x']));\n    }\n\n    public function testWordWrap() {\n      $this->assertEquals (array ('x' => \"aaaaaaaaaaaaaaaaaaaaaaaaaaaa  bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\"), roundTrip (\"aaaaaaaaaaaaaaaaaaaaaaaaaaaa  bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\"));\n    }\n\n    public function testABCD() {\n      $this->assertEquals (array ('a', 'b', 'c', 'd'), Spyc::YAMLLoad(Spyc::YAMLDump(array('a', 'b', 'c', 'd'))));\n    }\n    \n    public function testABCD2() {\n        $a = array('a', 'b', 'c', 'd'); // Create a simple list\n        $b = Spyc::YAMLDump($a);        // Dump the list as YAML\n        $c = Spyc::YAMLLoad($b);        // Load the dumped YAML\n        $d = Spyc::YAMLDump($c);        // Re-dump the data\n        $this->assertSame($b, $d);\n    }\n   \n}\n"
  },
  {
    "path": "ThinkPHP/Library/Vendor/spyc/tests/comments.yaml",
    "content": "foo: 'bar' #Comment\narr: ['x', 'y', 'z'] # Comment here\nbar: kittens"
  },
  {
    "path": "ThinkPHP/Library/Vendor/spyc/tests/failing1.yaml",
    "content": "MyObject:\n  Prop1: {key1:val1}"
  },
  {
    "path": "ThinkPHP/Library/Vendor/spyc/tests/indent_1.yaml",
    "content": "root:\n  child_1: 2\n\n  child_2: 0\n  child_3: 1\n\nroot2:\n  child_1: 1\n# A comment\n  child_2: 2\n\ndisplays:\n  - resolutions:\n      1024: 768\n  - resolutions:\n      1920: 1200\n\ndisplay:\n  - resolutions:\n      1024: 768\n      1920: 1200\n    producer: \"Nec\"\n\nnested_hashes_and_seqs:\n - { row: 0, col: 0, headsets_affected: [{ports: [0], side: left}], switch_function: {ics_ptt: true} }\n\neasier_nest: { h: [{a: b, a1: b1}, {c: d}] }\n\none_space: |\n    By four\n      spaces\n\nsteps:\n  - step: &id001\n      instrument:      Lasik 2000\n      pulseEnergy:     5.4\n      pulseDuration:   12\n      repetition:      1000\n      spotSize:        1mm\n  - step:\n      <<: *id001\n      spotSize:       2mm\n\ndeath masks are:\n   sad: 2\n   <<: {magnificent: 4}\n\nlogin: &login\n   adapter: mysql\n   host: localhost\n\ndevelopment:\n   database: rails_dev\n   <<: *login\n\n\"key\": \"value:\"\ncolon_only: \":\"\n\nlist_and_comment: [one, two, three] # comment\nkai:\n  -example: value\nkai_list_of_items:\n  - -item\n  - '-item'\n  -item"
  },
  {
    "path": "ThinkPHP/Library/Vendor/spyc/tests/quotes.yaml",
    "content": "html_tags:\n  - <br>\n  - <p>\nhtml_content:\n  - <p>hello world</p>\n  - hello<br>world\ntext_content:\n  - hello world"
  },
  {
    "path": "ThinkPHP/Mode/Api/App.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * ThinkPHP API模式 应用程序类\n */\nclass App {\n\n    /**\n     * 应用程序初始化\n     * @access public\n     * @return void\n     */\n    static public function init() {\n        // 定义当前请求的系统常量\n        define('NOW_TIME',      $_SERVER['REQUEST_TIME']);\n        define('REQUEST_METHOD',$_SERVER['REQUEST_METHOD']);\n        define('IS_GET',        REQUEST_METHOD =='GET' ? true : false);\n        define('IS_POST',       REQUEST_METHOD =='POST' ? true : false);\n        define('IS_PUT',        REQUEST_METHOD =='PUT' ? true : false);\n        define('IS_DELETE',     REQUEST_METHOD =='DELETE' ? true : false);\n        define('IS_AJAX',       ((isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') || !empty($_POST[C('VAR_AJAX_SUBMIT')]) || !empty($_GET[C('VAR_AJAX_SUBMIT')])) ? true : false);\n\n        // URL调度\n        Dispatcher::dispatch();\n\n        if(C('REQUEST_VARS_FILTER')){\n\t\t\t// 全局安全过滤\n\t\t\tarray_walk_recursive($_GET,\t\t'think_filter');\n\t\t\tarray_walk_recursive($_POST,\t'think_filter');\n\t\t\tarray_walk_recursive($_REQUEST,\t'think_filter');\n\t\t}\n\n        // 日志目录转换为绝对路径\n        C('LOG_PATH',realpath(LOG_PATH).'/');\n        // TMPL_EXCEPTION_FILE 改为绝对地址\n        C('TMPL_EXCEPTION_FILE',realpath(C('TMPL_EXCEPTION_FILE')));\n        return ;\n    }\n\n    /**\n     * 执行应用程序\n     * @access public\n     * @return void\n     */\n    static public function exec() {\n    \n        if(!preg_match('/^[A-Za-z](\\/|\\w)*$/',CONTROLLER_NAME)){ // 安全检测\n            $module  =  false;\n        }else{\n            //创建控制器实例\n            $module  =  A(CONTROLLER_NAME);\n        }\n\n        if(!$module) {\n            // 是否定义Empty控制器\n            $module = A('Empty');\n            if(!$module){\n                E(L('_CONTROLLER_NOT_EXIST_').':'.CONTROLLER_NAME);\n            }\n        }\n\n        // 获取当前操作名 支持动态路由\n        $action     =   ACTION_NAME;\n\n        try{\n            if(!preg_match('/^[A-Za-z](\\w)*$/',$action)){\n                // 非法操作\n                throw new \\ReflectionException();\n            }\n            //执行当前操作\n            $method =   new \\ReflectionMethod($module, $action);\n            if($method->isPublic() && !$method->isStatic()) {\n                $class  =   new \\ReflectionClass($module);\n                // URL参数绑定检测\n                if(C('URL_PARAMS_BIND') && $method->getNumberOfParameters()>0){\n                    switch($_SERVER['REQUEST_METHOD']) {\n                        case 'POST':\n                            $vars    =  array_merge($_GET,$_POST);\n                            break;\n                        case 'PUT':\n                            parse_str(file_get_contents('php://input'), $vars);\n                            break;\n                        default:\n                            $vars  =  $_GET;\n                    }\n                    $params =  $method->getParameters();\n                    $paramsBindType     =   C('URL_PARAMS_BIND_TYPE');\n                    foreach ($params as $param){\n                        $name = $param->getName();\n                        if( 1 == $paramsBindType && !empty($vars) ){\n                            $args[] =   array_shift($vars);\n                        }elseif( 0 == $paramsBindType && isset($vars[$name])){\n                            $args[] =   $vars[$name];\n                        }elseif($param->isDefaultValueAvailable()){\n                            $args[] =   $param->getDefaultValue();\n                        }else{\n                            E(L('_PARAM_ERROR_').':'.$name);\n                        }   \n                    }\n\t\t\t\t\tarray_walk_recursive($args,'think_filter');\n                    $method->invokeArgs($module,$args);\n                }else{\n                    $method->invoke($module);\n                }\n            }else{\n                // 操作方法不是Public 抛出异常\n                throw new \\ReflectionException();\n            }\n        } catch (\\ReflectionException $e) { \n            // 方法调用发生异常后 引导到__call方法处理\n            $method = new \\ReflectionMethod($module,'__call');\n            $method->invokeArgs($module,array($action,''));\n        }\n        return ;\n    }\n\n    /**\n     * 运行应用实例 入口文件使用的快捷方法\n     * @access public\n     * @return void\n     */\n    static public function run() {\n        App::init();\n        // Session初始化\n        if(!IS_CLI){\n            session(C('SESSION_OPTIONS'));\n        }\n        // 记录应用初始化时间\n        G('initTime');\n        App::exec();\n        return ;\n    }\n\n}"
  },
  {
    "path": "ThinkPHP/Mode/Api/Controller.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * ThinkPHP API模式控制器基类\n */\nabstract class Controller {\n\n   /**\n     * 架构函数\n     * @access public\n     */\n    public function __construct() {\n        //控制器初始化\n        if(method_exists($this,'_initialize'))\n            $this->_initialize();\n    }\n\n    /**\n     * 魔术方法 有不存在的操作的时候执行\n     * @access public\n     * @param string $method 方法名\n     * @param array $args 参数\n     * @return mixed\n     */\n    public function __call($method,$args) {\n        if( 0 === strcasecmp($method,ACTION_NAME.C('ACTION_SUFFIX'))) {\n            if(method_exists($this,'_empty')) {\n                // 如果定义了_empty操作 则调用\n                $this->_empty($method,$args);\n            }else{\n                E(L('_ERROR_ACTION_').':'.ACTION_NAME);\n            }\n        }else{\n            E(__CLASS__.':'.$method.L('_METHOD_NOT_EXIST_'));\n            return;\n        }\n    }\n\n    /**\n     * Ajax方式返回数据到客户端\n     * @access protected\n     * @param mixed $data 要返回的数据\n     * @param String $type AJAX返回数据格式\n     * @return void\n     */\n    protected function ajaxReturn($data,$type='') {\n        if(empty($type)) $type  =   C('DEFAULT_AJAX_RETURN');\n        switch (strtoupper($type)){\n            case 'JSON' :\n                // 返回JSON数据格式到客户端 包含状态信息\n                header('Content-Type:application/json; charset=utf-8');\n                exit(json_encode($data));\n            case 'XML'  :\n                // 返回xml格式数据\n                header('Content-Type:text/xml; charset=utf-8');\n                exit(xml_encode($data));\n            case 'JSONP':\n                // 返回JSON数据格式到客户端 包含状态信息\n                header('Content-Type:application/json; charset=utf-8');\n                $handler  =   isset($_GET[C('VAR_JSONP_HANDLER')]) ? $_GET[C('VAR_JSONP_HANDLER')] : C('DEFAULT_JSONP_HANDLER');\n                exit($handler.'('.json_encode($data).');');  \n            case 'EVAL' :\n                // 返回可执行的js脚本\n                header('Content-Type:text/html; charset=utf-8');\n                exit($data);            \n        }\n    }\n\n    /**\n     * Action跳转(URL重定向） 支持指定模块和延时跳转\n     * @access protected\n     * @param string $url 跳转的URL表达式\n     * @param array $params 其它URL参数\n     * @param integer $delay 延时跳转的时间 单位为秒\n     * @param string $msg 跳转提示信息\n     * @return void\n     */\n    protected function redirect($url,$params=array(),$delay=0,$msg='') {\n        $url    =   U($url,$params);\n        redirect($url,$delay,$msg);\n    }\n\n}"
  },
  {
    "path": "ThinkPHP/Mode/Api/Dispatcher.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * ThinkPHP API模式的Dispatcher类\n * 完成URL解析、路由和调度\n */\nclass Dispatcher {\n\n    /**\n     * URL映射到控制器\n     * @access public\n     * @return void\n     */\n    static public function dispatch() {\n        $varPath        =   C('VAR_PATHINFO');\n        $varModule      =   C('VAR_MODULE');\n        $varController  =   C('VAR_CONTROLLER');\n        $varAction      =   C('VAR_ACTION');\n        $urlCase        =   C('URL_CASE_INSENSITIVE');\n        if(isset($_GET[$varPath])) { // 判断URL里面是否有兼容模式参数\n            $_SERVER['PATH_INFO'] = $_GET[$varPath];\n            unset($_GET[$varPath]);\n        }elseif(IS_CLI){ // CLI模式下 index.php module/controller/action/params/...\n            $_SERVER['PATH_INFO'] = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : '';\n        }\n\n        // 开启子域名部署\n        if(C('APP_SUB_DOMAIN_DEPLOY')) {\n            $rules      = C('APP_SUB_DOMAIN_RULES');\n            if(isset($rules[$_SERVER['HTTP_HOST']])) { // 完整域名或者IP配置\n                define('APP_DOMAIN',$_SERVER['HTTP_HOST']); // 当前完整域名\n                $rule = $rules[APP_DOMAIN];\n            }else{\n                if(strpos(C('APP_DOMAIN_SUFFIX'),'.')){ // com.cn net.cn \n                    $domain = array_slice(explode('.', $_SERVER['HTTP_HOST']), 0, -3);\n                }else{\n                    $domain = array_slice(explode('.', $_SERVER['HTTP_HOST']), 0, -2);                    \n                }\n                if(!empty($domain)) {\n                    $subDomain = implode('.', $domain);\n                    define('SUB_DOMAIN',$subDomain); // 当前完整子域名\n                    $domain2   = array_pop($domain); // 二级域名\n                    if($domain) { // 存在三级域名\n                        $domain3 = array_pop($domain);\n                    }\n                    if(isset($rules[$subDomain])) { // 子域名\n                        $rule = $rules[$subDomain];\n                    }elseif(isset($rules['*.' . $domain2]) && !empty($domain3)){ // 泛三级域名\n                        $rule = $rules['*.' . $domain2];\n                        $panDomain = $domain3;\n                    }elseif(isset($rules['*']) && !empty($domain2) && 'www' != $domain2 ){ // 泛二级域名\n                        $rule      = $rules['*'];\n                        $panDomain = $domain2;\n                    }\n                }                \n            }\n\n            if(!empty($rule)) {\n                // 子域名部署规则 '子域名'=>array('模块名[/控制器名]','var1=a&var2=b');\n                if(is_array($rule)){\n                    list($rule,$vars) = $rule;\n                }\n                $array      =   explode('/',$rule);\n                // 模块绑定\n                define('BIND_MODULE',array_shift($array));\n                // 控制器绑定         \n                if(!empty($array)) {\n                    $controller  =   array_shift($array);\n                    if($controller){\n                        define('BIND_CONTROLLER',$controller);\n                    }\n                }\n                if(isset($vars)) { // 传入参数\n                    parse_str($vars,$parms);\n                    if(isset($panDomain)){\n                        $pos = array_search('*', $parms);\n                        if(false !== $pos) {\n                            // 泛域名作为参数\n                            $parms[$pos] = $panDomain;\n                        }                         \n                    }                   \n                    $_GET   =  array_merge($_GET,$parms);\n                }\n            }\n        }\n        // 分析PATHINFO信息\n        if(!isset($_SERVER['PATH_INFO'])) {\n            $types   =  explode(',',C('URL_PATHINFO_FETCH'));\n            foreach ($types as $type){\n                if(!empty($_SERVER[$type])) {\n                    $_SERVER['PATH_INFO'] = (0 === strpos($_SERVER[$type],$_SERVER['SCRIPT_NAME']))?\n                        substr($_SERVER[$type], strlen($_SERVER['SCRIPT_NAME']))   :  $_SERVER[$type];\n                    break;\n                }\n            }\n        }\n        if(empty($_SERVER['PATH_INFO'])) {\n            $_SERVER['PATH_INFO'] = '';\n        }\n        $depr = C('URL_PATHINFO_DEPR');\n        define('MODULE_PATHINFO_DEPR',  $depr);\n        define('__INFO__',trim($_SERVER['PATH_INFO'],'/'));\n        // URL后缀\n        define('__EXT__', strtolower(pathinfo($_SERVER['PATH_INFO'],PATHINFO_EXTENSION)));\n\n        $_SERVER['PATH_INFO'] = __INFO__;\n\n        if (__INFO__ && C('MULTI_MODULE') && !defined('BIND_MODULE')){ // 获取模块名\n            $paths      =   explode($depr,__INFO__,2);\n            $allowList  =   C('MODULE_ALLOW_LIST'); // 允许的模块列表\n            $module     =   preg_replace('/\\.' . __EXT__ . '$/i', '',$paths[0]);\n            if( empty($allowList) || (is_array($allowList) && in_array_case($module, $allowList))){\n                $_GET[$varModule]       =   $module;\n                $_SERVER['PATH_INFO']   =   isset($paths[1])?$paths[1]:'';\n            }\n        }\n\n        // 获取模块名称\n        define('MODULE_NAME', defined('BIND_MODULE')? BIND_MODULE : self::getModule($varModule));\n        \n        // 检测模块是否存在\n        if( MODULE_NAME && (defined('BIND_MODULE') || !in_array_case(MODULE_NAME,C('MODULE_DENY_LIST')) ) && is_dir(APP_PATH.MODULE_NAME)){\n            // 定义当前模块路径\n            define('MODULE_PATH', APP_PATH.MODULE_NAME.'/');\n            // 定义当前模块的模版缓存路径\n            C('CACHE_PATH',CACHE_PATH.MODULE_NAME.'/');\n\n            // 加载模块配置文件\n            if(is_file(MODULE_PATH.'Conf/config.php'))\n                C(include MODULE_PATH.'Conf/config.php');\n            // 加载模块别名定义\n            if(is_file(MODULE_PATH.'Conf/alias.php'))\n                Think::addMap(include MODULE_PATH.'Conf/alias.php');\n            // 加载模块函数文件\n            if(is_file(MODULE_PATH.'Common/function.php'))\n                include MODULE_PATH.'Common/function.php';\n        }else{\n            E(L('_MODULE_NOT_EXIST_').':'.MODULE_NAME);\n        }\n\n        if('' != $_SERVER['PATH_INFO'] && (!C('URL_ROUTER_ON') ||  !Route::check()) ){   // 检测路由规则 如果没有则按默认规则调度URL\n            // 检查禁止访问的URL后缀\n            if(C('URL_DENY_SUFFIX') && preg_match('/\\.('.trim(C('URL_DENY_SUFFIX'),'.').')$/i', $_SERVER['PATH_INFO'])){\n                send_http_status(404);\n                exit;\n            }\n            \n            // 去除URL后缀\n            $_SERVER['PATH_INFO'] = preg_replace(C('URL_HTML_SUFFIX')? '/\\.('.trim(C('URL_HTML_SUFFIX'),'.').')$/i' : '/\\.'.__EXT__.'$/i', '', $_SERVER['PATH_INFO']);\n\n            $depr   =   C('URL_PATHINFO_DEPR');\n            $paths  =   explode($depr,trim($_SERVER['PATH_INFO'],$depr));\n\n            if(!defined('BIND_CONTROLLER')) {// 获取控制器\n                $_GET[$varController]   =   array_shift($paths);\n            }\n            // 获取操作\n            if(!defined('BIND_ACTION')){\n                $_GET[$varAction]  =   array_shift($paths);\n            }\n            // 解析剩余的URL参数\n            $var  =  array();\n            if(C('URL_PARAMS_BIND') && 1 == C('URL_PARAMS_BIND_TYPE')){\n                // URL参数按顺序绑定变量\n                $var    =   $paths;\n            }else{\n                preg_replace_callback('/(\\w+)\\/([^\\/]+)/', function($match) use(&$var){$var[$match[1]]=strip_tags($match[2]);}, implode('/',$paths));\n            }\n            $_GET   =  array_merge($var,$_GET);\n        }\n        // 获取控制器和操作名\n        define('CONTROLLER_NAME',   defined('BIND_CONTROLLER')? BIND_CONTROLLER : self::getController($varController,$urlCase));\n        define('ACTION_NAME',       defined('BIND_ACTION')? BIND_ACTION : self::getAction($varAction,$urlCase));\n        //保证$_REQUEST正常取值\n        $_REQUEST = array_merge($_POST,$_GET);\n    }\n\n    /**\n     * 获得实际的控制器名称\n     */\n    static private function getController($var,$urlCase) {\n        $controller = (!empty($_GET[$var])? $_GET[$var]:C('DEFAULT_CONTROLLER'));\n        unset($_GET[$var]);\n        if($urlCase) {\n            // URL地址不区分大小写\n            // 智能识别方式 user_type 识别到 UserTypeController 控制器\n            $controller = parse_name($controller,1);\n        }\n        return strip_tags(ucfirst($controller));\n    }\n\n    /**\n     * 获得实际的操作名称\n     */\n    static private function getAction($var,$urlCase) {\n        $action   = !empty($_POST[$var]) ?\n            $_POST[$var] :\n            (!empty($_GET[$var])?$_GET[$var]:C('DEFAULT_ACTION'));\n        unset($_POST[$var],$_GET[$var]);\n        return strip_tags($urlCase?strtolower($action):$action);\n    }\n\n    /**\n     * 获得实际的模块名称\n     */\n    static private function getModule($var) {\n        $module   = (!empty($_GET[$var])?$_GET[$var]:C('DEFAULT_MODULE'));\n        unset($_GET[$var]);\n        if($maps = C('URL_MODULE_MAP')) {\n            if(isset($maps[strtolower($module)])) {\n                // 记录当前别名\n                define('MODULE_ALIAS',strtolower($module));\n                // 获取实际的模块名\n                return   ucfirst($maps[MODULE_ALIAS]);\n            }elseif(array_search(strtolower($module),$maps)){\n                // 禁止访问原始模块\n                return   '';\n            }\n        }\n        return strip_tags(ucfirst(strtolower($module)));\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Mode/Api/functions.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\n/**\n * Think API模式函数库\n */\n\n/**\n * 获取和设置配置参数 支持批量定义\n * @param string|array $name 配置变量\n * @param mixed $value 配置值\n * @param mixed $default 默认值\n * @return mixed\n */\nfunction C($name=null, $value=null,$default=null) {\n    static $_config = array();\n    // 无参数时获取所有\n    if (empty($name)) {\n        return $_config;\n    }\n    // 优先执行设置获取或赋值\n    if (is_string($name)) {\n        if (!strpos($name, '.')) {\n            $name = strtolower($name);\n            if (is_null($value))\n                return isset($_config[$name]) ? $_config[$name] : $default;\n            $_config[$name] = $value;\n            return;\n        }\n        // 二维数组设置和获取支持\n        $name = explode('.', $name);\n        $name[0]   =  strtolower($name[0]);\n        if (is_null($value))\n            return isset($_config[$name[0]][$name[1]]) ? $_config[$name[0]][$name[1]] : $default;\n        $_config[$name[0]][$name[1]] = $value;\n        return;\n    }\n    // 批量设置\n    if (is_array($name)){\n        $_config = array_merge($_config, array_change_key_case($name));\n        return;\n    }\n    return null; // 避免非法参数\n}\n\n/**\n * 加载配置文件 支持格式转换 仅支持一级配置\n * @param string $file 配置文件名\n * @param string $parse 配置解析方法 有些格式需要用户自己解析\n * @return void\n */\nfunction load_config($file,$parse=CONF_PARSE){\n    $ext  = pathinfo($file,PATHINFO_EXTENSION);\n    switch($ext){\n        case 'php':\n            return include $file;\n        case 'ini':\n            return parse_ini_file($file);\n        case 'yaml':\n            return yaml_parse_file($file);\n        case 'xml': \n            return (array)simplexml_load_file($file);\n        case 'json':\n            return json_decode(file_get_contents($file), true);\n        default:\n            if(function_exists($parse)){\n                return $parse($file);\n            }else{\n                E(L('_NOT_SUPPORT_').':'.$ext);\n            }\n    }\n}\n\n/**\n * 抛出异常处理\n * @param string $msg 异常消息\n * @param integer $code 异常代码 默认为0\n * @return void\n */\nfunction E($msg, $code=0) {\n    throw new Think\\Exception($msg, $code);\n}\n\n/**\n * 记录和统计时间（微秒）和内存使用情况\n * 使用方法:\n * <code>\n * G('begin'); // 记录开始标记位\n * // ... 区间运行代码\n * G('end'); // 记录结束标签位\n * echo G('begin','end',6); // 统计区间运行时间 精确到小数后6位\n * echo G('begin','end','m'); // 统计区间内存使用情况\n * 如果end标记位没有定义，则会自动以当前作为标记位\n * 其中统计内存使用需要 MEMORY_LIMIT_ON 常量为true才有效\n * </code>\n * @param string $start 开始标签\n * @param string $end 结束标签\n * @param integer|string $dec 小数位或者m\n * @return mixed\n */\nfunction G($start,$end='',$dec=4) {\n    static $_info       =   array();\n    static $_mem        =   array();\n    if(is_float($end)) { // 记录时间\n        $_info[$start]  =   $end;\n    }elseif(!empty($end)){ // 统计时间和内存使用\n        if(!isset($_info[$end])) $_info[$end]       =  microtime(TRUE);\n        if(MEMORY_LIMIT_ON && $dec=='m'){\n            if(!isset($_mem[$end])) $_mem[$end]     =  memory_get_usage();\n            return number_format(($_mem[$end]-$_mem[$start])/1024);\n        }else{\n            return number_format(($_info[$end]-$_info[$start]),$dec);\n        }\n\n    }else{ // 记录时间和内存使用\n        $_info[$start]  =  microtime(TRUE);\n        if(MEMORY_LIMIT_ON) $_mem[$start]           =  memory_get_usage();\n    }\n}\n\n/**\n * 获取和设置语言定义(不区分大小写)\n * @param string|array $name 语言变量\n * @param string $value 语言值\n * @return mixed\n */\nfunction L($name=null, $value=null) {\n    static $_lang = array();\n    // 空参数返回所有定义\n    if (empty($name))\n        return $_lang;\n    // 判断语言获取(或设置)\n    // 若不存在,直接返回全大写$name\n    if (is_string($name)) {\n        $name = strtoupper($name);\n        if (is_null($value))\n            return isset($_lang[$name]) ? $_lang[$name] : $name;\n        $_lang[$name] = $value; // 语言定义\n        return;\n    }\n    // 批量定义\n    if (is_array($name))\n        $_lang = array_merge($_lang, array_change_key_case($name, CASE_UPPER));\n    return;\n}\n\n/**\n * 添加和获取页面Trace记录\n * @param string $value 变量\n * @param string $label 标签\n * @param string $level 日志级别\n * @param boolean $record 是否记录日志\n * @return void\n */\nfunction trace($value='[think]',$label='',$level='DEBUG',$record=false) {\n    return Think\\Think::trace($value,$label,$level,$record);\n}\n\n/**\n * 编译文件\n * @param string $filename 文件名\n * @return string\n */\nfunction compile($filename) {\n    $content    =   php_strip_whitespace($filename);\n    $content    =   trim(substr($content, 5));\n    // 替换预编译指令\n    $content    =   preg_replace('/\\/\\/\\[RUNTIME\\](.*?)\\/\\/\\[\\/RUNTIME\\]/s', '', $content);\n    if(0===strpos($content,'namespace')){\n        $content    =   preg_replace('/namespace\\s(.*?);/','namespace \\\\1{',$content,1);\n    }else{\n        $content    =   'namespace {'.$content;\n    }\n    if ('?>' == substr($content, -2))\n        $content    = substr($content, 0, -2);\n    return $content.'}';\n}\n\n/**\n * 获取输入参数 支持过滤和默认值\n * 使用方法:\n * <code>\n * I('id',0); 获取id参数 自动判断get或者post\n * I('post.name','','htmlspecialchars'); 获取$_POST['name']\n * I('get.'); 获取$_GET\n * </code>\n * @param string $name 变量的名称 支持指定类型\n * @param mixed $default 不存在的时候默认值\n * @param mixed $filter 参数过滤方法\n * @param mixed $datas 要获取的额外数据源\n * @return mixed\n */\nfunction I($name,$default='',$filter=null,$datas=null) {\n\tif(strpos($name,'/')){ // 指定修饰符\n\t\tlist($name,$type) \t=\texplode('/',$name,2);\n\t}\n    if(strpos($name,'.')) { // 指定参数来源\n        list($method,$name) =   explode('.',$name,2);\n    }else{ // 默认为自动判断\n        $method =   'param';\n    }\n    switch(strtolower($method)) {\n        case 'get'     :   $input =& $_GET;break;\n        case 'post'    :   $input =& $_POST;break;\n        case 'put'     :   parse_str(file_get_contents('php://input'), $input);break;\n        case 'param'   :\n            switch($_SERVER['REQUEST_METHOD']) {\n                case 'POST':\n                    $input  =  $_POST;\n                    break;\n                case 'PUT':\n                    parse_str(file_get_contents('php://input'), $input);\n                    break;\n                default:\n                    $input  =  $_GET;\n            }\n            break;\n        case 'path'    :   \n            $input  =   array();\n            if(!empty($_SERVER['PATH_INFO'])){\n                $depr   =   C('URL_PATHINFO_DEPR');\n                $input  =   explode($depr,trim($_SERVER['PATH_INFO'],$depr));            \n            }\n            break;\n        case 'request' :   $input =& $_REQUEST;   break;\n        case 'session' :   $input =& $_SESSION;   break;\n        case 'cookie'  :   $input =& $_COOKIE;    break;\n        case 'server'  :   $input =& $_SERVER;    break;\n        case 'globals' :   $input =& $GLOBALS;    break;\n        case 'data'    :   $input =& $datas;      break;\n        default:\n            return NULL;\n    }\n    if(''==$name) { // 获取全部变量\n        $data       =   $input;\n        $filters    =   isset($filter)?$filter:C('DEFAULT_FILTER');\n        if($filters) {\n            if(is_string($filters)){\n                $filters    =   explode(',',$filters);\n            }\n            foreach($filters as $filter){\n                $data   =   array_map_recursive($filter,$data); // 参数过滤\n            }\n        }\n    }elseif(isset($input[$name])) { // 取值操作\n        $data       =   $input[$name];\n        $filters    =   isset($filter)?$filter:C('DEFAULT_FILTER');\n        if($filters) {\n            if(is_string($filters)){\n                $filters    =   explode(',',$filters);\n            }elseif(is_int($filters)){\n                $filters    =   array($filters);\n            }\n            \n            foreach($filters as $filter){\n                if(function_exists($filter)) {\n                    $data   =   is_array($data) ? array_map_recursive($filter,$data) : $filter($data); // 参数过滤\n                }elseif(0===strpos($filter,'/')){\n                \t// 支持正则验证\n                \tif(1 !== preg_match($filter,(string)$data)){\n                \t\treturn   isset($default) ? $default : NULL;\n                \t}\n                }else{\n                    $data   =   filter_var($data,is_int($filter) ? $filter : filter_id($filter));\n                    if(false === $data) {\n                        return   isset($default) ? $default : NULL;\n                    }\n                }\n            }\n        }\n        if(!empty($type)){\n        \tswitch(strtolower($type)){\n        \t\tcase 's':   // 字符串\n        \t\t\t$data \t=\t(string)$data;\n        \t\t\tbreak;\n        \t\tcase 'a':\t// 数组\n        \t\t\t$data \t=\t(array)$data;\n        \t\t\tbreak;\n        \t\tcase 'd':\t// 数字\n        \t\t\t$data \t=\t(int)$data;\n        \t\t\tbreak;\n        \t\tcase 'f':\t// 浮点\n        \t\t\t$data \t=\t(float)$data;\n        \t\t\tbreak;\n        \t\tcase 'b':\t// 布尔\n        \t\t\t$data \t=\t(boolean)$data;\n        \t\t\tbreak;\n        \t}\n        }\n    }else{ // 变量默认值\n        $data       =    isset($default)?$default:NULL;\n    }\n    is_array($data) && array_walk_recursive($data,'think_filter');\n    return $data;\n}\n\nfunction array_map_recursive($filter, $data) {\n     $result = array();\n     foreach ($data as $key => $val) {\n         $result[$key] = is_array($val)\n             ? array_map_recursive($filter, $val)\n             : call_user_func($filter, $val);\n     }\n     return $result;\n }\n\n/**\n * 设置和获取统计数据\n * 使用方法:\n * <code>\n * N('db',1); // 记录数据库操作次数\n * N('read',1); // 记录读取次数\n * echo N('db'); // 获取当前页面数据库的所有操作次数\n * echo N('read'); // 获取当前页面读取次数\n * </code>\n * @param string $key 标识位置\n * @param integer $step 步进值\n * @return mixed\n */\nfunction N($key, $step=0,$save=false) {\n    static $_num    = array();\n    if (!isset($_num[$key])) {\n        $_num[$key] = (false !== $save)? S('N_'.$key) :  0;\n    }\n    if (empty($step))\n        return $_num[$key];\n    else\n        $_num[$key] = $_num[$key] + (int) $step;\n    if(false !== $save){ // 保存结果\n        S('N_'.$key,$_num[$key],$save);\n    }\n}\n\n/**\n * 字符串命名风格转换\n * type 0 将Java风格转换为C的风格 1 将C风格转换为Java的风格\n * @param string $name 字符串\n * @param integer $type 转换类型\n * @return string\n */\nfunction parse_name($name, $type=0) {\n    if ($type) {\n        return ucfirst(preg_replace_callback('/_([a-zA-Z])/', function($match){return strtoupper($match[1]);}, $name));\n    } else {\n        return strtolower(trim(preg_replace(\"/[A-Z]/\", \"_\\\\0\", $name), \"_\"));\n    }\n}\n\n/**\n * 优化的require_once\n * @param string $filename 文件地址\n * @return boolean\n */\nfunction require_cache($filename) {\n    static $_importFiles = array();\n    if (!isset($_importFiles[$filename])) {\n        if (file_exists_case($filename)) {\n            require $filename;\n            $_importFiles[$filename] = true;\n        } else {\n            $_importFiles[$filename] = false;\n        }\n    }\n    return $_importFiles[$filename];\n}\n\n/**\n * 区分大小写的文件存在判断\n * @param string $filename 文件地址\n * @return boolean\n */\nfunction file_exists_case($filename) {\n    if (is_file($filename)) {\n        if (IS_WIN && APP_DEBUG) {\n            if (basename(realpath($filename)) != basename($filename))\n                return false;\n        }\n        return true;\n    }\n    return false;\n}\n\n/**\n * 导入所需的类库 同java的Import 本函数有缓存功能\n * @param string $class 类库命名空间字符串\n * @param string $baseUrl 起始路径\n * @param string $ext 导入的文件扩展名\n * @return boolean\n */\nfunction import($class, $baseUrl = '', $ext=EXT) {\n    static $_file = array();\n    $class = str_replace(array('.', '#'), array('/', '.'), $class);\n    if (isset($_file[$class . $baseUrl]))\n        return true;\n    else\n        $_file[$class . $baseUrl] = true;\n    $class_strut     = explode('/', $class);\n    if (empty($baseUrl)) {\n        if ('@' == $class_strut[0] || MODULE_NAME == $class_strut[0]) {\n            //加载当前模块的类库\n            $baseUrl = MODULE_PATH;\n            $class   = substr_replace($class, '', 0, strlen($class_strut[0]) + 1);\n        }elseif (in_array($class_strut[0],array('Think','Org','Behavior','Com','Vendor')) || is_dir(LIB_PATH.$class_strut[0])) {\n            // 系统类库包和第三方类库包\n            $baseUrl = LIB_PATH;\n        }else { // 加载其他模块的类库\n            $baseUrl = APP_PATH;\n        }\n    }\n    if (substr($baseUrl, -1) != '/')\n        $baseUrl    .= '/';\n    $classfile       = $baseUrl . $class . $ext;\n    if (!class_exists(basename($class),false)) {\n        // 如果类不存在 则导入类库文件\n        return require_cache($classfile);\n    }\n}\n\n/**\n * 基于命名空间方式导入函数库\n * load('@.Util.Array')\n * @param string $name 函数库命名空间字符串\n * @param string $baseUrl 起始路径\n * @param string $ext 导入的文件扩展名\n * @return void\n */\nfunction load($name, $baseUrl='', $ext='.php') {\n    $name = str_replace(array('.', '#'), array('/', '.'), $name);\n    if (empty($baseUrl)) {\n        if (0 === strpos($name, '@/')) {//加载当前模块函数库\n            $baseUrl    =   MODULE_PATH.'Common/';\n            $name       =   substr($name, 2);\n        } else { //加载其他模块函数库\n            $array      =   explode('/', $name);\n            $baseUrl    =   APP_PATH . array_shift($array).'/Common/';\n            $name       =   implode('/',$array);\n        }\n    }\n    if (substr($baseUrl, -1) != '/')\n        $baseUrl       .= '/';\n    require_cache($baseUrl . $name . $ext);\n}\n\n/**\n * 快速导入第三方框架类库 所有第三方框架的类库文件统一放到 系统的Vendor目录下面\n * @param string $class 类库\n * @param string $baseUrl 基础目录\n * @param string $ext 类库后缀\n * @return boolean\n */\nfunction vendor($class, $baseUrl = '', $ext='.php') {\n    if (empty($baseUrl))\n        $baseUrl = VENDOR_PATH;\n    return import($class, $baseUrl, $ext);\n}\n\n/**\n * D函数用于实例化模型类 格式 [资源://][模块/]模型\n * @param string $name 资源地址\n * @param string $layer 模型层名称\n * @return Model\n */\nfunction D($name='',$layer='') {\n    if(empty($name)) return new Think\\Model;\n    static $_model  =   array();\n    $layer          =   $layer? : C('DEFAULT_M_LAYER');\n    if(isset($_model[$name.$layer]))\n        return $_model[$name.$layer];\n    $class          =   parse_res_name($name,$layer);\n    if(class_exists($class)) {\n        $model      =   new $class(basename($name));\n    }elseif(false === strpos($name,'/')){\n        // 自动加载公共模块下面的模型\n        $class      =   '\\\\Common\\\\'.$layer.'\\\\'.$name.$layer;\n        $model      =   class_exists($class)? new $class($name) : new Think\\Model($name);\n    }else {\n        Think\\Log::record('D方法实例化没找到模型类'.$class,Think\\Log::NOTICE);\n        $model      =   new Think\\Model(basename($name));\n    }\n    $_model[$name.$layer]  =  $model;\n    return $model;\n}\n\n/**\n * M函数用于实例化一个没有模型文件的Model\n * @param string $name Model名称 支持指定基础模型 例如 MongoModel:User\n * @param string $tablePrefix 表前缀\n * @param mixed $connection 数据库连接信息\n * @return Model\n */\nfunction M($name='', $tablePrefix='',$connection='') {\n    static $_model  = array();\n    if(strpos($name,':')) {\n        list($class,$name)    =  explode(':',$name);\n    }else{\n        $class      =   'Think\\\\Model';\n    }\n    $guid           =   (is_array($connection)?implode('',$connection):$connection).$tablePrefix . $name . '_' . $class;\n    if (!isset($_model[$guid]))\n        $_model[$guid] = new $class($name,$tablePrefix,$connection);\n    return $_model[$guid];\n}\n\n/**\n * 解析资源地址并导入类库文件\n * 例如 module/controller addon://module/behavior\n * @param string $name 资源地址 格式：[扩展://][模块/]资源名\n * @param string $layer 分层名称\n * @return string\n */\nfunction parse_res_name($name,$layer,$level=1){\n    if(strpos($name,'://')) {// 指定扩展资源\n        list($extend,$name)  =   explode('://',$name);\n    }else{\n        $extend  =   '';\n    }\n    if(strpos($name,'/') && substr_count($name, '/')>=$level){ // 指定模块\n        list($module,$name) =  explode('/',$name,2);\n    }else{\n        $module =   MODULE_NAME;\n    }\n    $array  =   explode('/',$name);\n    $class  =   $module.'\\\\'.$layer;\n    foreach($array as $name){\n        $class  .=   '\\\\'.parse_name($name, 1);\n    }\n    // 导入资源类库\n    if($extend){ // 扩展资源\n        $class      =   $extend.'\\\\'.$class;\n    }\n    return $class.$layer;\n}\n\n/**\n * A函数用于实例化控制器 格式：[资源://][模块/]控制器\n * @param string $name 资源地址\n * @param string $layer 控制层名称\n * @param integer $level 控制器层次\n * @return Controller|false\n */\nfunction A($name,$layer='',$level='') {\n    static $_action = array();\n    $layer  =   $layer? : C('DEFAULT_C_LAYER');\n    $level  =   $level? : ($layer == C('DEFAULT_C_LAYER')?C('CONTROLLER_LEVEL'):1);\n    if(isset($_action[$name.$layer]))\n        return $_action[$name.$layer];\n    $class  =   parse_res_name($name,$layer,$level);\n    if(class_exists($class)) {\n        $action             =   new $class();\n        $_action[$name.$layer]     =   $action;\n        return $action;\n    }else {\n        return false;\n    }\n}\n\n/**\n * 远程调用控制器的操作方法 URL 参数格式 [资源://][模块/]控制器/操作\n * @param string $url 调用地址\n * @param string|array $vars 调用参数 支持字符串和数组\n * @param string $layer 要调用的控制层名称\n * @return mixed\n */\nfunction R($url,$vars=array(),$layer='') {\n    $info   =   pathinfo($url);\n    $action =   $info['basename'];\n    $module =   $info['dirname'];\n    $class  =   A($module,$layer);\n    if($class){\n        if(is_string($vars)) {\n            parse_str($vars,$vars);\n        }\n        return call_user_func_array(array(&$class,$action.C('ACTION_SUFFIX')),$vars);\n    }else{\n        return false;\n    }\n}\n\n/**\n * 执行某个行为\n * @param string $name 行为名称\n * @param Mixed $params 传入的参数\n * @return void\n */\nfunction B($name, &$params=NULL) {\n    if(strpos($name,'/')){\n        list($name,$tag) = explode('/',$name);\n    }else{\n        $tag     =   'run';\n    }\n    return \\Think\\Hook::exec($name,$tag,$params);\n}\n\n/**\n * 去除代码中的空白和注释\n * @param string $content 代码内容\n * @return string\n */\nfunction strip_whitespace($content) {\n    $stripStr   = '';\n    //分析php源码\n    $tokens     = token_get_all($content);\n    $last_space = false;\n    for ($i = 0, $j = count($tokens); $i < $j; $i++) {\n        if (is_string($tokens[$i])) {\n            $last_space = false;\n            $stripStr  .= $tokens[$i];\n        } else {\n            switch ($tokens[$i][0]) {\n                //过滤各种PHP注释\n                case T_COMMENT:\n                case T_DOC_COMMENT:\n                    break;\n                //过滤空格\n                case T_WHITESPACE:\n                    if (!$last_space) {\n                        $stripStr  .= ' ';\n                        $last_space = true;\n                    }\n                    break;\n                case T_START_HEREDOC:\n                    $stripStr .= \"<<<THINK\\n\";\n                    break;\n                case T_END_HEREDOC:\n                    $stripStr .= \"THINK;\\n\";\n                    for($k = $i+1; $k < $j; $k++) {\n                        if(is_string($tokens[$k]) && $tokens[$k] == ';') {\n                            $i = $k;\n                            break;\n                        } else if($tokens[$k][0] == T_CLOSE_TAG) {\n                            break;\n                        }\n                    }\n                    break;\n                default:\n                    $last_space = false;\n                    $stripStr  .= $tokens[$i][1];\n            }\n        }\n    }\n    return $stripStr;\n}\n\n/**\n * 浏览器友好的变量输出\n * @param mixed $var 变量\n * @param boolean $echo 是否输出 默认为True 如果为false 则返回输出字符串\n * @param string $label 标签 默认为空\n * @param boolean $strict 是否严谨 默认为true\n * @return void|string\n */\nfunction dump($var, $echo=true, $label=null, $strict=true) {\n    $label = ($label === null) ? '' : rtrim($label) . ' ';\n    if (!$strict) {\n        if (ini_get('html_errors')) {\n            $output = print_r($var, true);\n            $output = '<pre>' . $label . htmlspecialchars($output, ENT_QUOTES) . '</pre>';\n        } else {\n            $output = $label . print_r($var, true);\n        }\n    } else {\n        ob_start();\n        var_dump($var);\n        $output = ob_get_clean();\n        if (!extension_loaded('xdebug')) {\n            $output = preg_replace('/\\]\\=\\>\\n(\\s+)/m', '] => ', $output);\n            $output = '<pre>' . $label . htmlspecialchars($output, ENT_QUOTES) . '</pre>';\n        }\n    }\n    if ($echo) {\n        echo($output);\n        return null;\n    }else\n        return $output;\n}\n\n/**\n * URL重定向\n * @param string $url 重定向的URL地址\n * @param integer $time 重定向的等待时间（秒）\n * @param string $msg 重定向前的提示信息\n * @return void\n */\nfunction redirect($url, $time=0, $msg='') {\n    //多行URL地址支持\n    $url        = str_replace(array(\"\\n\", \"\\r\"), '', $url);\n    if (empty($msg))\n        $msg    = \"系统将在{$time}秒之后自动跳转到{$url}！\";\n    if (!headers_sent()) {\n        // redirect\n        if (0 === $time) {\n            header('Location: ' . $url);\n        } else {\n            header(\"refresh:{$time};url={$url}\");\n            echo($msg);\n        }\n        exit();\n    } else {\n        $str    = \"<meta http-equiv='Refresh' content='{$time};URL={$url}'>\";\n        if ($time != 0)\n            $str .= $msg;\n        exit($str);\n    }\n}\n\n/**\n * 缓存管理\n * @param mixed $name 缓存名称，如果为数组表示进行缓存设置\n * @param mixed $value 缓存值\n * @param mixed $options 缓存参数\n * @return mixed\n */\nfunction S($name,$value='',$options=null) {\n    static $cache   =   '';\n    if(is_array($options) && empty($cache)){\n        // 缓存操作的同时初始化\n        $type       =   isset($options['type'])?$options['type']:'';\n        $cache      =   Think\\Cache::getInstance($type,$options);\n    }elseif(is_array($name)) { // 缓存初始化\n        $type       =   isset($name['type'])?$name['type']:'';\n        $cache      =   Think\\Cache::getInstance($type,$name);\n        return $cache;\n    }elseif(empty($cache)) { // 自动初始化\n        $cache      =   Think\\Cache::getInstance();\n    }\n    if(''=== $value){ // 获取缓存\n        return $cache->get($name);\n    }elseif(is_null($value)) { // 删除缓存\n        return $cache->rm($name);\n    }else { // 缓存数据\n        if(is_array($options)) {\n            $expire     =   isset($options['expire'])?$options['expire']:NULL;\n        }else{\n            $expire     =   is_numeric($options)?$options:NULL;\n        }\n        return $cache->set($name, $value, $expire);\n    }\n}\n\n/**\n * 快速文件数据读取和保存 针对简单类型数据 字符串、数组\n * @param string $name 缓存名称\n * @param mixed $value 缓存值\n * @param string $path 缓存路径\n * @return mixed\n */\nfunction F($name, $value='', $path=DATA_PATH) {\n    static $_cache  =   array();\n    $filename       =   $path . $name . '.php';\n    if ('' !== $value) {\n        if (is_null($value)) {\n            // 删除缓存\n            if(false !== strpos($name,'*')){\n                return false; // TODO \n            }else{\n                unset($_cache[$name]);\n                return Think\\Storage::unlink($filename,'F');\n            }\n        } else {\n            Think\\Storage::put($filename,serialize($value),'F');\n            // 缓存数据\n            $_cache[$name]  =   $value;\n            return ;\n        }\n    }\n    // 获取缓存数据\n    if (isset($_cache[$name]))\n        return $_cache[$name];\n    if (Think\\Storage::has($filename,'F')){\n        $value      =   unserialize(Think\\Storage::read($filename,'F'));\n        $_cache[$name]  =   $value;\n    } else {\n        $value          =   false;\n    }\n    return $value;\n}\n\n/**\n * 根据PHP各种类型变量生成唯一标识号\n * @param mixed $mix 变量\n * @return string\n */\nfunction to_guid_string($mix) {\n    if (is_object($mix)) {\n        return spl_object_hash($mix);\n    } elseif (is_resource($mix)) {\n        $mix = get_resource_type($mix) . strval($mix);\n    } else {\n        $mix = serialize($mix);\n    }\n    return md5($mix);\n}\n\n/**\n * XML编码\n * @param mixed $data 数据\n * @param string $root 根节点名\n * @param string $item 数字索引的子节点名\n * @param string $attr 根节点属性\n * @param string $id   数字索引子节点key转换的属性名\n * @param string $encoding 数据编码\n * @return string\n */\nfunction xml_encode($data, $root='think', $item='item', $attr='', $id='id', $encoding='utf-8') {\n    if(is_array($attr)){\n        $_attr = array();\n        foreach ($attr as $key => $value) {\n            $_attr[] = \"{$key}=\\\"{$value}\\\"\";\n        }\n        $attr = implode(' ', $_attr);\n    }\n    $attr   = trim($attr);\n    $attr   = empty($attr) ? '' : \" {$attr}\";\n    $xml    = \"<?xml version=\\\"1.0\\\" encoding=\\\"{$encoding}\\\"?>\";\n    $xml   .= \"<{$root}{$attr}>\";\n    $xml   .= data_to_xml($data, $item, $id);\n    $xml   .= \"</{$root}>\";\n    return $xml;\n}\n\n/**\n * 数据XML编码\n * @param mixed  $data 数据\n * @param string $item 数字索引时的节点名称\n * @param string $id   数字索引key转换为的属性名\n * @return string\n */\nfunction data_to_xml($data, $item='item', $id='id') {\n    $xml = $attr = '';\n    foreach ($data as $key => $val) {\n        if(is_numeric($key)){\n            $id && $attr = \" {$id}=\\\"{$key}\\\"\";\n            $key  = $item;\n        }\n        $xml    .=  \"<{$key}{$attr}>\";\n        $xml    .=  (is_array($val) || is_object($val)) ? data_to_xml($val, $item, $id) : $val;\n        $xml    .=  \"</{$key}>\";\n    }\n    return $xml;\n}\n\n/**\n * session管理函数\n * @param string|array $name session名称 如果为数组则表示进行session设置\n * @param mixed $value session值\n * @return mixed\n */\nfunction session($name,$value='') {\n    $prefix   =  C('SESSION_PREFIX');\n    if(is_array($name)) { // session初始化 在session_start 之前调用\n        if(isset($name['prefix'])) C('SESSION_PREFIX',$name['prefix']);\n        if(C('VAR_SESSION_ID') && isset($_REQUEST[C('VAR_SESSION_ID')])){\n            session_id($_REQUEST[C('VAR_SESSION_ID')]);\n        }elseif(isset($name['id'])) {\n            session_id($name['id']);\n        }\n        if('common' != APP_MODE){ // 其它模式可能不支持\n            ini_set('session.auto_start', 0);\n        }\n        if(isset($name['name']))            session_name($name['name']);\n        if(isset($name['path']))            session_save_path($name['path']);\n        if(isset($name['domain']))          ini_set('session.cookie_domain', $name['domain']);\n        if(isset($name['expire']))          ini_set('session.gc_maxlifetime', $name['expire']);\n        if(isset($name['use_trans_sid']))   ini_set('session.use_trans_sid', $name['use_trans_sid']?1:0);\n        if(isset($name['use_cookies']))     ini_set('session.use_cookies', $name['use_cookies']?1:0);\n        if(isset($name['cache_limiter']))   session_cache_limiter($name['cache_limiter']);\n        if(isset($name['cache_expire']))    session_cache_expire($name['cache_expire']);\n        if(isset($name['type']))            C('SESSION_TYPE',$name['type']);\n        if(C('SESSION_TYPE')) { // 读取session驱动\n            $type   =   C('SESSION_TYPE');\n            $class  =   strpos($type,'\\\\')? $type : 'Think\\\\Session\\\\Driver\\\\'. ucwords(strtolower($type));\n            $hander =   new $class();\n            session_set_save_handler(\n                array(&$hander,\"open\"), \n                array(&$hander,\"close\"), \n                array(&$hander,\"read\"), \n                array(&$hander,\"write\"), \n                array(&$hander,\"destroy\"), \n                array(&$hander,\"gc\")); \n        }\n        // 启动session\n        if(C('SESSION_AUTO_START'))  session_start();\n    }elseif('' === $value){ \n        if(0===strpos($name,'[')) { // session 操作\n            if('[pause]'==$name){ // 暂停session\n                session_write_close();\n            }elseif('[start]'==$name){ // 启动session\n                session_start();\n            }elseif('[destroy]'==$name){ // 销毁session\n                $_SESSION =  array();\n                session_unset();\n                session_destroy();\n            }elseif('[regenerate]'==$name){ // 重新生成id\n                session_regenerate_id();\n            }\n        }elseif(0===strpos($name,'?')){ // 检查session\n            $name   =  substr($name,1);\n            if(strpos($name,'.')){ // 支持数组\n                list($name1,$name2) =   explode('.',$name);\n                return $prefix?isset($_SESSION[$prefix][$name1][$name2]):isset($_SESSION[$name1][$name2]);\n            }else{\n                return $prefix?isset($_SESSION[$prefix][$name]):isset($_SESSION[$name]);\n            }\n        }elseif(is_null($name)){ // 清空session\n            if($prefix) {\n                unset($_SESSION[$prefix]);\n            }else{\n                $_SESSION = array();\n            }\n        }elseif($prefix){ // 获取session\n            if(strpos($name,'.')){\n                list($name1,$name2) =   explode('.',$name);\n                return isset($_SESSION[$prefix][$name1][$name2])?$_SESSION[$prefix][$name1][$name2]:null;  \n            }else{\n                return isset($_SESSION[$prefix][$name])?$_SESSION[$prefix][$name]:null;                \n            }            \n        }else{\n            if(strpos($name,'.')){\n                list($name1,$name2) =   explode('.',$name);\n                return isset($_SESSION[$name1][$name2])?$_SESSION[$name1][$name2]:null;  \n            }else{\n                return isset($_SESSION[$name])?$_SESSION[$name]:null;\n            }            \n        }\n    }elseif(is_null($value)){ // 删除session\n        if($prefix){\n            unset($_SESSION[$prefix][$name]);\n        }else{\n            unset($_SESSION[$name]);\n        }\n    }else{ // 设置session\n        if($prefix){\n            if (!is_array($_SESSION[$prefix])) {\n                $_SESSION[$prefix] = array();\n            }\n            $_SESSION[$prefix][$name]   =  $value;\n        }else{\n            $_SESSION[$name]  =  $value;\n        }\n    }\n}\n\n/**\n * Cookie 设置、获取、删除\n * @param string $name cookie名称\n * @param mixed $value cookie值\n * @param mixed $options cookie参数\n * @return mixed\n */\nfunction cookie($name, $value='', $option=null) {\n    // 默认设置\n    $config = array(\n        'prefix'    =>  C('COOKIE_PREFIX'), // cookie 名称前缀\n        'expire'    =>  C('COOKIE_EXPIRE'), // cookie 保存时间\n        'path'      =>  C('COOKIE_PATH'), // cookie 保存路径\n        'domain'    =>  C('COOKIE_DOMAIN'), // cookie 有效域名\n    );\n    // 参数设置(会覆盖黙认设置)\n    if (!is_null($option)) {\n        if (is_numeric($option))\n            $option = array('expire' => $option);\n        elseif (is_string($option))\n            parse_str($option, $option);\n        $config     = array_merge($config, array_change_key_case($option));\n    }\n    // 清除指定前缀的所有cookie\n    if (is_null($name)) {\n        if (empty($_COOKIE))\n            return;\n        // 要删除的cookie前缀，不指定则删除config设置的指定前缀\n        $prefix = empty($value) ? $config['prefix'] : $value;\n        if (!empty($prefix)) {// 如果前缀为空字符串将不作处理直接返回\n            foreach ($_COOKIE as $key => $val) {\n                if (0 === stripos($key, $prefix)) {\n                    setcookie($key, '', time() - 3600, $config['path'], $config['domain']);\n                    unset($_COOKIE[$key]);\n                }\n            }\n        }\n        return;\n    }\n    $name = $config['prefix'] . $name;\n    if ('' === $value) {\n        if(isset($_COOKIE[$name])){\n            $value =    $_COOKIE[$name];\n            if(0===strpos($value,'think:')){\n                $value  =   substr($value,6);\n                return array_map('urldecode',json_decode(MAGIC_QUOTES_GPC?stripslashes($value):$value,true));\n            }else{\n                return $value;\n            }\n        }else{\n            return null;\n        }\n    } else {\n        if (is_null($value)) {\n            setcookie($name, '', time() - 3600, $config['path'], $config['domain']);\n            unset($_COOKIE[$name]); // 删除指定cookie\n        } else {\n            // 设置cookie\n            if(is_array($value)){\n                $value  = 'think:'.json_encode(array_map('urlencode',$value));\n            }\n            $expire = !empty($config['expire']) ? time() + intval($config['expire']) : 0;\n            setcookie($name, $value, $expire, $config['path'], $config['domain']);\n            $_COOKIE[$name] = $value;\n        }\n    }\n}\n\n/**\n * 加载动态扩展文件\n * @return void\n */\nfunction load_ext_file($path) {\n    // 加载自定义外部文件\n    if(C('LOAD_EXT_FILE')) {\n        $files      =  explode(',',C('LOAD_EXT_FILE'));\n        foreach ($files as $file){\n            $file   = $path.'Common/'.$file.'.php';\n            if(is_file($file)) include $file;\n        }\n    }\n    // 加载自定义的动态配置文件\n    if(C('LOAD_EXT_CONFIG')) {\n        $configs    =  C('LOAD_EXT_CONFIG');\n        if(is_string($configs)) $configs =  explode(',',$configs);\n        foreach ($configs as $key=>$config){\n            $file   = $path.'Conf/'.$config.'.php';\n            if(is_file($file)) {\n                is_numeric($key)?C(include $file):C($key,include $file);\n            }\n        }\n    }\n}\n\n/**\n * 获取客户端IP地址\n * @param integer $type 返回类型 0 返回IP地址 1 返回IPV4地址数字\n * @return mixed\n */\nfunction get_client_ip($type = 0) {\n    $type       =  $type ? 1 : 0;\n    static $ip  =   NULL;\n    if ($ip !== NULL) return $ip[$type];\n    if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {\n        $arr    =   explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);\n        $pos    =   array_search('unknown',$arr);\n        if(false !== $pos) unset($arr[$pos]);\n        $ip     =   trim($arr[0]);\n    }elseif (isset($_SERVER['HTTP_CLIENT_IP'])) {\n        $ip     =   $_SERVER['HTTP_CLIENT_IP'];\n    }elseif (isset($_SERVER['REMOTE_ADDR'])) {\n        $ip     =   $_SERVER['REMOTE_ADDR'];\n    }\n    // IP地址合法验证\n    $long = sprintf(\"%u\",ip2long($ip));\n    $ip   = $long ? array($ip, $long) : array('0.0.0.0', 0);\n    return $ip[$type];\n}\n\n/**\n * 发送HTTP状态\n * @param integer $code 状态码\n * @return void\n */\nfunction send_http_status($code) {\n    static $_status = array(\n        // Success 2xx\n        200 => 'OK',\n        // Redirection 3xx\n        301 => 'Moved Permanently',\n        302 => 'Moved Temporarily ',  // 1.1\n        // Client Error 4xx\n        400 => 'Bad Request',\n        403 => 'Forbidden',\n        404 => 'Not Found',\n        // Server Error 5xx\n        500 => 'Internal Server Error',\n        503 => 'Service Unavailable',\n    );\n    if(isset($_status[$code])) {\n        header('HTTP/1.1 '.$code.' '.$_status[$code]);\n        // 确保FastCGI模式下正常\n        header('Status:'.$code.' '.$_status[$code]);\n    }\n}\n\n// 不区分大小写的in_array实现\nfunction in_array_case($value,$array){\n    return in_array(strtolower($value),array_map('strtolower',$array));\n}\n\nfunction think_filter(&$value){\n\t// TODO 其他安全过滤\n\n\t// 过滤查询特殊字符\n    if(preg_match('/^(EXP|NEQ|GT|EGT|LT|ELT|OR|XOR|LIKE|NOTLIKE|NOT BETWEEN|NOTBETWEEN|BETWEEN|NOTIN|NOT IN|IN)$/i',$value)){\n        $value .= ' ';\n    }\n}"
  },
  {
    "path": "ThinkPHP/Mode/Lite/App.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * ThinkPHP 应用程序类 执行应用过程管理\n */\nclass App {\n\n    /**\n     * 应用程序初始化\n     * @access public\n     * @return void\n     */\n    static public function init() {\n\n        // 日志目录转换为绝对路径 默认情况下存储到公共模块下面\n        C('LOG_PATH',   realpath(LOG_PATH).'/Common/');\n\n        // 定义当前请求的系统常量\n        define('NOW_TIME',      $_SERVER['REQUEST_TIME']);\n        define('REQUEST_METHOD',$_SERVER['REQUEST_METHOD']);\n        define('IS_GET',        REQUEST_METHOD =='GET' ? true : false);\n        define('IS_POST',       REQUEST_METHOD =='POST' ? true : false);\n        define('IS_PUT',        REQUEST_METHOD =='PUT' ? true : false);\n        define('IS_DELETE',     REQUEST_METHOD =='DELETE' ? true : false);\n\n        // URL调度\n        Dispatcher::dispatch();\n\n        if(C('REQUEST_VARS_FILTER')){\n\t\t\t// 全局安全过滤\n\t\t\tarray_walk_recursive($_GET,\t\t'think_filter');\n\t\t\tarray_walk_recursive($_POST,\t'think_filter');\n\t\t\tarray_walk_recursive($_REQUEST,\t'think_filter');\n\t\t}\n\n        define('IS_AJAX',       ((isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') || !empty($_POST[C('VAR_AJAX_SUBMIT')]) || !empty($_GET[C('VAR_AJAX_SUBMIT')])) ? true : false);\n\n        // TMPL_EXCEPTION_FILE 改为绝对地址\n        C('TMPL_EXCEPTION_FILE',realpath(C('TMPL_EXCEPTION_FILE')));\n        return ;\n    }\n\n    /**\n     * 执行应用程序\n     * @access public\n     * @return void\n     */\n    static public function exec() {\n    \n        if(!preg_match('/^[A-Za-z](\\/|\\w)*$/',CONTROLLER_NAME)){ // 安全检测\n            $module  =  false;\n        }else{\n            //创建控制器实例\n            $module  =  controller(CONTROLLER_NAME);                \n        }\n\n        if(!$module) {\n            // 是否定义Empty控制器\n            $module = A('Empty');\n            if(!$module){\n                E(L('_CONTROLLER_NOT_EXIST_').':'.CONTROLLER_NAME);\n            }\n        }\n\n        // 获取当前操作名 支持动态路由\n        $action    =   ACTION_NAME.C('ACTION_SUFFIX');  \n\n        try{\n            if(!preg_match('/^[A-Za-z](\\w)*$/',$action)){\n                // 非法操作\n                throw new \\ReflectionException();\n            }\n            //执行当前操作\n            $method =   new \\ReflectionMethod($module, $action);\n            if($method->isPublic() && !$method->isStatic()) {\n                $class  =   new \\ReflectionClass($module);\n                // URL参数绑定检测\n                if($method->getNumberOfParameters()>0 && C('URL_PARAMS_BIND')){\n                    switch($_SERVER['REQUEST_METHOD']) {\n                        case 'POST':\n                            $vars    =  array_merge($_GET,$_POST);\n                            break;\n                        case 'PUT':\n                            parse_str(file_get_contents('php://input'), $vars);\n                            break;\n                        default:\n                            $vars  =  $_GET;\n                    }\n                    $params =  $method->getParameters();\n                    $paramsBindType     =   C('URL_PARAMS_BIND_TYPE');\n                    foreach ($params as $param){\n                        $name = $param->getName();\n                        if( 1 == $paramsBindType && !empty($vars) ){\n                            $args[] =   array_shift($vars);\n                        }elseif( 0 == $paramsBindType && isset($vars[$name])){\n                            $args[] =   $vars[$name];\n                        }elseif($param->isDefaultValueAvailable()){\n                            $args[] =   $param->getDefaultValue();\n                        }else{\n                            E(L('_PARAM_ERROR_').':'.$name);\n                        }   \n                    }\n                    // 开启绑定参数过滤机制\n                    if(C('URL_PARAMS_SAFE')){\n                        $filters     =   C('URL_PARAMS_FILTER')?:C('DEFAULT_FILTER');\n                        if($filters) {\n                            $filters    =   explode(',',$filters);\n                            foreach($filters as $filter){\n                                $args   =   array_map_recursive($filter,$args); // 参数过滤\n                            }\n                        }                        \n                    }\n\t\t\t\t\tarray_walk_recursive($args,'think_filter');\n                    $method->invokeArgs($module,$args);\n                }else{\n                    $method->invoke($module);\n                }\n            }else{\n                // 操作方法不是Public 抛出异常\n                throw new \\ReflectionException();\n            }\n        } catch (\\ReflectionException $e) { \n            // 方法调用发生异常后 引导到__call方法处理\n            $method = new \\ReflectionMethod($module,'__call');\n            $method->invokeArgs($module,array($action,''));\n        }\n        return ;\n    }\n\n    /**\n     * 运行应用实例 入口文件使用的快捷方法\n     * @access public\n     * @return void\n     */\n    static public function run() {\n        App::init();\n        // Session初始化\n        if(!IS_CLI){\n            session(C('SESSION_OPTIONS'));\n        }\n        // 记录应用初始化时间\n        G('initTime');\n        App::exec();\n        return ;\n    }\n\n}"
  },
  {
    "path": "ThinkPHP/Mode/Lite/Controller.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * ThinkPHP 控制器基类 抽象类\n */\nabstract class Controller {\n\n    /**\n     * 视图实例对象\n     * @var view\n     * @access protected\n     */    \n    protected $view     =  null;\n\n    /**\n     * 控制器参数\n     * @var config\n     * @access protected\n     */      \n    protected $config   =   array();\n\n   /**\n     * 架构函数 取得模板对象实例\n     * @access public\n     */\n    public function __construct() {\n        //实例化视图类\n        $this->view     = Think::instance('Think\\View');\n        //控制器初始化\n        if(method_exists($this,'_initialize'))\n            $this->_initialize();\n    }\n\n    /**\n     * 模板显示 调用内置的模板引擎显示方法，\n     * @access protected\n     * @param string $templateFile 指定要调用的模板文件\n     * 默认为空 由系统自动定位模板文件\n     * @param string $charset 输出编码\n     * @param string $contentType 输出类型\n     * @param string $content 输出内容\n     * @param string $prefix 模板缓存前缀\n     * @return void\n     */\n    protected function display($templateFile='',$charset='',$contentType='',$content='',$prefix='') {\n        $this->view->display($templateFile,$charset,$contentType,$content,$prefix);\n    }\n\n    /**\n     * 输出内容文本可以包括Html 并支持内容解析\n     * @access protected\n     * @param string $content 输出内容\n     * @param string $charset 模板输出字符集\n     * @param string $contentType 输出类型\n     * @param string $prefix 模板缓存前缀\n     * @return mixed\n     */\n    protected function show($content,$charset='',$contentType='',$prefix='') {\n        $this->view->display('',$charset,$contentType,$content,$prefix);\n    }\n\n    /**\n     *  获取输出页面内容\n     * 调用内置的模板引擎fetch方法，\n     * @access protected\n     * @param string $templateFile 指定要调用的模板文件\n     * 默认为空 由系统自动定位模板文件\n     * @param string $content 模板输出内容\n     * @param string $prefix 模板缓存前缀* \n     * @return string\n     */\n    protected function fetch($templateFile='',$content='',$prefix='') {\n        return $this->view->fetch($templateFile,$content,$prefix);\n    }\n\n    /**\n     * 模板主题设置\n     * @access protected\n     * @param string $theme 模版主题\n     * @return Action\n     */\n    protected function theme($theme){\n        $this->view->theme($theme);\n        return $this;\n    }\n\n    /**\n     * 模板变量赋值\n     * @access protected\n     * @param mixed $name 要显示的模板变量\n     * @param mixed $value 变量的值\n     * @return Action\n     */\n    protected function assign($name,$value='') {\n        $this->view->assign($name,$value);\n        return $this;\n    }\n\n    public function __set($name,$value) {\n        $this->assign($name,$value);\n    }\n\n    /**\n     * 取得模板显示变量的值\n     * @access protected\n     * @param string $name 模板显示变量\n     * @return mixed\n     */\n    public function get($name='') {\n        return $this->view->get($name);      \n    }\n\n    public function __get($name) {\n        return $this->get($name);\n    }\n\n    /**\n     * 检测模板变量的值\n     * @access public\n     * @param string $name 名称\n     * @return boolean\n     */\n    public function __isset($name) {\n        return $this->get($name);\n    }\n\n    /**\n     * 魔术方法 有不存在的操作的时候执行\n     * @access public\n     * @param string $method 方法名\n     * @param array $args 参数\n     * @return mixed\n     */\n    public function __call($method,$args) {\n        if( 0 === strcasecmp($method,ACTION_NAME.C('ACTION_SUFFIX'))) {\n            if(method_exists($this,'_empty')) {\n                // 如果定义了_empty操作 则调用\n                $this->_empty($method,$args);\n            }elseif(file_exists_case($this->view->parseTemplate())){\n                // 检查是否存在默认模版 如果有直接输出模版\n                $this->display();\n            }else{\n                E(L('_ERROR_ACTION_').':'.ACTION_NAME);\n            }\n        }else{\n            E(__CLASS__.':'.$method.L('_METHOD_NOT_EXIST_'));\n            return;\n        }\n    }\n\n    /**\n     * 操作错误跳转的快捷方法\n     * @access protected\n     * @param string $message 错误信息\n     * @param string $jumpUrl 页面跳转地址\n     * @param mixed $ajax 是否为Ajax方式 当数字时指定跳转时间\n     * @return void\n     */\n    protected function error($message='',$jumpUrl='',$ajax=false) {\n        $this->dispatchJump($message,0,$jumpUrl,$ajax);\n    }\n\n    /**\n     * 操作成功跳转的快捷方法\n     * @access protected\n     * @param string $message 提示信息\n     * @param string $jumpUrl 页面跳转地址\n     * @param mixed $ajax 是否为Ajax方式 当数字时指定跳转时间\n     * @return void\n     */\n    protected function success($message='',$jumpUrl='',$ajax=false) {\n        $this->dispatchJump($message,1,$jumpUrl,$ajax);\n    }\n\n    /**\n     * Ajax方式返回数据到客户端\n     * @access protected\n     * @param mixed $data 要返回的数据\n     * @param String $type AJAX返回数据格式\n     * @param int $json_option 传递给json_encode的option参数\n     * @return void\n     */\n    protected function ajaxReturn($data,$type='',$json_option=0) {\n        if(empty($type)) $type  =   C('DEFAULT_AJAX_RETURN');\n        switch (strtoupper($type)){\n            case 'JSON' :\n                // 返回JSON数据格式到客户端 包含状态信息\n                header('Content-Type:application/json; charset=utf-8');\n                $data       =   json_encode($data,$json_option);\n                break;\n            case 'JSONP':\n                // 返回JSON数据格式到客户端 包含状态信息\n                header('Content-Type:application/json; charset=utf-8');\n                $handler    =   isset($_GET[C('VAR_JSONP_HANDLER')]) ? $_GET[C('VAR_JSONP_HANDLER')] : C('DEFAULT_JSONP_HANDLER');\n                $data       =   $handler.'('.json_encode($data,$json_option).');'; \n                break;\n            case 'EVAL' :\n                // 返回可执行的js脚本\n                header('Content-Type:text/html; charset=utf-8');\n                break;      \n        }\n        exit($data);\n    }\n\n    /**\n     * Action跳转(URL重定向） 支持指定模块和延时跳转\n     * @access protected\n     * @param string $url 跳转的URL表达式\n     * @param array $params 其它URL参数\n     * @param integer $delay 延时跳转的时间 单位为秒\n     * @param string $msg 跳转提示信息\n     * @return void\n     */\n    protected function redirect($url,$params=array(),$delay=0,$msg='') {\n        $url    =   U($url,$params);\n        redirect($url,$delay,$msg);\n    }\n\n    /**\n     * 默认跳转操作 支持错误导向和正确跳转\n     * 调用模板显示 默认为public目录下面的success页面\n     * 提示页面为可配置 支持模板标签\n     * @param string $message 提示信息\n     * @param Boolean $status 状态\n     * @param string $jumpUrl 页面跳转地址\n     * @param mixed $ajax 是否为Ajax方式 当数字时指定跳转时间\n     * @access private\n     * @return void\n     */\n    private function dispatchJump($message,$status=1,$jumpUrl='',$ajax=false) {\n        if(true === $ajax || IS_AJAX) {// AJAX提交\n            $data           =   is_array($ajax)?$ajax:array();\n            $data['info']   =   $message;\n            $data['status'] =   $status;\n            $data['url']    =   $jumpUrl;\n            $this->ajaxReturn($data);\n        }\n        if(is_int($ajax)) $this->assign('waitSecond',$ajax);\n        if(!empty($jumpUrl)) $this->assign('jumpUrl',$jumpUrl);\n        // 提示标题\n        $this->assign('msgTitle',$status? L('_OPERATION_SUCCESS_') : L('_OPERATION_FAIL_'));\n        //如果设置了关闭窗口，则提示完毕后自动关闭窗口\n        if($this->get('closeWin'))    $this->assign('jumpUrl','javascript:window.close();');\n        $this->assign('status',$status);   // 状态\n        //保证输出不受静态缓存影响\n        C('HTML_CACHE_ON',false);\n        if($status) { //发送成功信息\n            $this->assign('message',$message);// 提示信息\n            // 成功操作后默认停留1秒\n            if(!isset($this->waitSecond))    $this->assign('waitSecond','1');\n            // 默认操作成功自动返回操作前页面\n            if(!isset($this->jumpUrl)) $this->assign(\"jumpUrl\",$_SERVER[\"HTTP_REFERER\"]);\n            $this->display(C('TMPL_ACTION_SUCCESS'));\n        }else{\n            $this->assign('error',$message);// 提示信息\n            //发生错误时候默认停留3秒\n            if(!isset($this->waitSecond))    $this->assign('waitSecond','3');\n            // 默认发生错误的话自动返回上页\n            if(!isset($this->jumpUrl)) $this->assign('jumpUrl',\"javascript:history.back(-1);\");\n            $this->display(C('TMPL_ACTION_ERROR'));\n            // 中止执行  避免出错后继续执行\n            exit ;\n        }\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Mode/Lite/Dispatcher.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * ThinkPHP内置的Dispatcher类\n * 完成URL解析、路由和调度\n */\nclass Dispatcher {\n\n    /**\n     * URL映射到控制器\n     * @access public\n     * @return void\n     */\n    static public function dispatch() {\n        $varPath        =   C('VAR_PATHINFO');\n        $varModule      =   C('VAR_MODULE');\n        $varController  =   C('VAR_CONTROLLER');\n        $varAction      =   C('VAR_ACTION');\n        $urlCase        =   C('URL_CASE_INSENSITIVE');\n        if(isset($_GET[$varPath])) { // 判断URL里面是否有兼容模式参数\n            $_SERVER['PATH_INFO'] = $_GET[$varPath];\n            unset($_GET[$varPath]);\n        }elseif(IS_CLI){ // CLI模式下 index.php module/controller/action/params/...\n            $_SERVER['PATH_INFO'] = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : '';\n        }\n\n        // 开启子域名部署\n        if(C('APP_SUB_DOMAIN_DEPLOY')) {\n            $rules      = C('APP_SUB_DOMAIN_RULES');\n            if(isset($rules[$_SERVER['HTTP_HOST']])) { // 完整域名或者IP配置\n                define('APP_DOMAIN',$_SERVER['HTTP_HOST']); // 当前完整域名\n                $rule = $rules[APP_DOMAIN];\n            }else{\n                if(strpos(C('APP_DOMAIN_SUFFIX'),'.')){ // com.cn net.cn \n                    $domain = array_slice(explode('.', $_SERVER['HTTP_HOST']), 0, -3);\n                }else{\n                    $domain = array_slice(explode('.', $_SERVER['HTTP_HOST']), 0, -2);                    \n                }\n                if(!empty($domain)) {\n                    $subDomain = implode('.', $domain);\n                    define('SUB_DOMAIN',$subDomain); // 当前完整子域名\n                    $domain2   = array_pop($domain); // 二级域名\n                    if($domain) { // 存在三级域名\n                        $domain3 = array_pop($domain);\n                    }\n                    if(isset($rules[$subDomain])) { // 子域名\n                        $rule = $rules[$subDomain];\n                    }elseif(isset($rules['*.' . $domain2]) && !empty($domain3)){ // 泛三级域名\n                        $rule = $rules['*.' . $domain2];\n                        $panDomain = $domain3;\n                    }elseif(isset($rules['*']) && !empty($domain2) && 'www' != $domain2 ){ // 泛二级域名\n                        $rule      = $rules['*'];\n                        $panDomain = $domain2;\n                    }\n                }                \n            }\n\n            if(!empty($rule)) {\n                // 子域名部署规则 '子域名'=>array('模块名','var1=a&var2=b');\n                if(is_array($rule)){\n                    list($rule,$vars) = $rule;\n                }\n                $array      =   explode('/',$rule);\n                // 模块绑定\n                define('BIND_MODULE',array_shift($array));\n\n                if(isset($vars)) { // 传入参数\n                    parse_str($vars,$parms);\n                    if(isset($panDomain)){\n                        $pos = array_search('*', $parms);\n                        if(false !== $pos) {\n                            // 泛域名作为参数\n                            $parms[$pos] = $panDomain;\n                        }                         \n                    }                   \n                    $_GET   =  array_merge($_GET,$parms);\n                }\n            }\n        }\n        // 分析PATHINFO信息\n        if(!isset($_SERVER['PATH_INFO'])) {\n            $types   =  explode(',',C('URL_PATHINFO_FETCH'));\n            foreach ($types as $type){\n                if(0===strpos($type,':')) {// 支持函数判断\n                    $_SERVER['PATH_INFO'] =   call_user_func(substr($type,1));\n                    break;\n                }elseif(!empty($_SERVER[$type])) {\n                    $_SERVER['PATH_INFO'] = (0 === strpos($_SERVER[$type],$_SERVER['SCRIPT_NAME']))?\n                        substr($_SERVER[$type], strlen($_SERVER['SCRIPT_NAME']))   :  $_SERVER[$type];\n                    break;\n                }\n            }\n        }\n\n        $depr = C('URL_PATHINFO_DEPR');\n        define('MODULE_PATHINFO_DEPR',  $depr);\n\n        if(empty($_SERVER['PATH_INFO'])) {\n            $_SERVER['PATH_INFO'] = '';\n            define('__INFO__','');\n            define('__EXT__','');\n        }else{\n            define('__INFO__',trim($_SERVER['PATH_INFO'],'/'));\n            // URL后缀\n            define('__EXT__', strtolower(pathinfo($_SERVER['PATH_INFO'],PATHINFO_EXTENSION)));\n            $_SERVER['PATH_INFO'] = __INFO__;     \n            if(!defined('BIND_MODULE') && (!C('URL_ROUTER_ON') || !Route::check())){\n                if (__INFO__ ){ // 获取模块名\n                    $paths      =   explode($depr,__INFO__,2);\n                    $allowList  =   C('MODULE_ALLOW_LIST'); // 允许的模块列表\n                    $module     =   preg_replace('/\\.' . __EXT__ . '$/i', '',$paths[0]);\n                    if( empty($allowList) || (is_array($allowList) && in_array_case($module, $allowList))){\n                        $_GET[$varModule]       =   $module;\n                        $_SERVER['PATH_INFO']   =   isset($paths[1])?$paths[1]:'';\n                    }\n                }\n            }             \n        }\n\n        // URL常量\n        define('__SELF__',strip_tags($_SERVER[C('URL_REQUEST_URI')]));\n\n        // 获取模块名称\n        define('MODULE_NAME', defined('BIND_MODULE')? BIND_MODULE : self::getModule($varModule));\n        \n        // 检测模块是否存在\n        if( MODULE_NAME && (defined('BIND_MODULE') || !in_array_case(MODULE_NAME,C('MODULE_DENY_LIST')) ) && is_dir(APP_PATH.MODULE_NAME)){\n            // 定义当前模块路径\n            define('MODULE_PATH', APP_PATH.MODULE_NAME.'/');\n            // 定义当前模块的模版缓存路径\n            C('CACHE_PATH',CACHE_PATH.MODULE_NAME.'/');\n            // 定义当前模块的日志目录\n            C('LOG_PATH',  realpath(LOG_PATH).'/'.MODULE_NAME.'/');\n\n            // 加载模块配置文件\n            if(is_file(MODULE_PATH.'Conf/config'.CONF_EXT))\n                C(load_config(MODULE_PATH.'Conf/config'.CONF_EXT));\n\n            // 加载模块别名定义\n            if(is_file(MODULE_PATH.'Conf/alias.php'))\n                Think::addMap(include MODULE_PATH.'Conf/alias.php');\n\n            // 加载模块函数文件\n            if(is_file(MODULE_PATH.'Common/function.php'))\n                include MODULE_PATH.'Common/function.php';\n        }else{\n            E(L('_MODULE_NOT_EXIST_').':'.MODULE_NAME);\n        }\n\n        if(!defined('__APP__')){\n\t        $urlMode        =   C('URL_MODEL');\n\t        if($urlMode == URL_COMPAT ){// 兼容模式判断\n\t            define('PHP_FILE',_PHP_FILE_.'?'.$varPath.'=');\n\t        }elseif($urlMode == URL_REWRITE ) {\n\t            $url    =   dirname(_PHP_FILE_);\n\t            if($url == '/' || $url == '\\\\')\n\t                $url    =   '';\n\t            define('PHP_FILE',$url);\n\t        }else {\n\t            define('PHP_FILE',_PHP_FILE_);\n\t        }\n\t        // 当前应用地址\n\t        define('__APP__',strip_tags(PHP_FILE));\n\t    }\n        // 模块URL地址\n        $moduleName    =   defined('MODULE_ALIAS')? MODULE_ALIAS : MODULE_NAME;\n        define('__MODULE__',defined('BIND_MODULE') ? __APP__ : __APP__.'/'.($urlCase ? strtolower($moduleName) : $moduleName));\n\n        if('' != $_SERVER['PATH_INFO'] && (!C('URL_ROUTER_ON') ||  !Route::check()) ){   // 检测路由规则 如果没有则按默认规则调度URL\n            // 检查禁止访问的URL后缀\n            if(C('URL_DENY_SUFFIX') && preg_match('/\\.('.trim(C('URL_DENY_SUFFIX'),'.').')$/i', $_SERVER['PATH_INFO'])){\n                send_http_status(404);\n                exit;\n            }\n            \n            // 去除URL后缀\n            $_SERVER['PATH_INFO'] = preg_replace(C('URL_HTML_SUFFIX')? '/\\.('.trim(C('URL_HTML_SUFFIX'),'.').')$/i' : '/\\.'.__EXT__.'$/i', '', $_SERVER['PATH_INFO']);\n\n            $depr   =   C('URL_PATHINFO_DEPR');\n            $paths  =   explode($depr,trim($_SERVER['PATH_INFO'],$depr));\n\n            $_GET[$varController]   =   array_shift($paths);\n            // 获取操作\n            $_GET[$varAction]  =   array_shift($paths);\n\n            // 解析剩余的URL参数\n            $var  =  array();\n            if(C('URL_PARAMS_BIND') && 1 == C('URL_PARAMS_BIND_TYPE')){\n                // URL参数按顺序绑定变量\n                $var    =   $paths;\n            }else{\n                preg_replace_callback('/(\\w+)\\/([^\\/]+)/', function($match) use(&$var){$var[$match[1]]=strip_tags($match[2]);}, implode('/',$paths));\n            }\n            $_GET   =  array_merge($var,$_GET);\n        }\n        // 获取控制器和操作名\n        define('CONTROLLER_NAME',   self::getController($varController,$urlCase));\n        define('ACTION_NAME',       self::getAction($varAction,$urlCase));\n\n        // 当前控制器的UR地址\n        define('__CONTROLLER__',__MODULE__.$depr.( $urlCase ? parse_name(CONTROLLER_NAME) : CONTROLLER_NAME ) );\n\n        // 当前操作的URL地址\n        define('__ACTION__',__CONTROLLER__.$depr.ACTION_NAME);\n\n        //保证$_REQUEST正常取值\n        $_REQUEST = array_merge($_POST,$_GET);\n    }\n\n    /**\n     * 获得实际的控制器名称\n     */\n    static private function getController($var,$urlCase) {\n        $controller = (!empty($_GET[$var])? $_GET[$var]:C('DEFAULT_CONTROLLER'));\n        unset($_GET[$var]);\n        if($urlCase) {\n            // URL地址不区分大小写\n            // 智能识别方式 user_type 识别到 UserTypeController 控制器\n            $controller = parse_name($controller,1);\n        }\n        return strip_tags(ucfirst($controller));\n    }\n\n    /**\n     * 获得实际的操作名称\n     */\n    static private function getAction($var,$urlCase) {\n        $action   = !empty($_POST[$var]) ?\n            $_POST[$var] :\n            (!empty($_GET[$var])?$_GET[$var]:C('DEFAULT_ACTION'));\n        unset($_POST[$var],$_GET[$var]);\n        return strip_tags( $urlCase? strtolower($action) : $action );\n    }\n\n    /**\n     * 获得实际的模块名称\n     */\n    static private function getModule($var) {\n        $module   = (!empty($_GET[$var])?$_GET[$var]:C('DEFAULT_MODULE'));\n        unset($_GET[$var]);\n        if($maps = C('URL_MODULE_MAP')) {\n            if(isset($maps[strtolower($module)])) {\n                // 记录当前别名\n                define('MODULE_ALIAS',strtolower($module));\n                // 获取实际的模块名\n                return   ucfirst($maps[MODULE_ALIAS]);\n            }elseif(array_search(strtolower($module),$maps)){\n                // 禁止访问原始模块\n                return   '';\n            }\n        }\n        return strip_tags(ucfirst($module));\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Mode/Lite/Model.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * ThinkPHP Model模型类\n * 实现了ORM和ActiveRecords模式\n */\nclass Model {\n\n    // 当前数据库操作对象\n    protected $db               =   null;\n\t// 数据库对象池\n\tprivate   $_db\t\t\t\t=\tarray();\n    // 主键名称\n    protected $pk               =   'id';\n    // 主键是否自动增长\n    protected $autoinc          =   false;    \n    // 数据表前缀\n    protected $tablePrefix      =   null;\n    // 模型名称\n    protected $name             =   '';\n    // 数据库名称\n    protected $dbName           =   '';\n    //数据库配置\n    protected $connection       =   '';\n    // 数据表名（不包含表前缀）\n    protected $tableName        =   '';\n    // 实际数据表名（包含表前缀）\n    protected $trueTableName    =   '';\n    // 最近错误信息\n    protected $error            =   '';\n    // 字段信息\n    protected $fields           =   array();\n    // 数据信息\n    protected $data             =   array();\n    // 查询表达式参数\n    protected $options          =   array();\n    protected $_validate        =   array();  // 自动验证定义\n    protected $_auto            =   array();  // 自动完成定义\n    protected $_map             =   array();  // 字段映射定义\n    protected $_scope           =   array();  // 命名范围定义\n    // 是否自动检测数据表字段信息\n    protected $autoCheckFields  =   true;\n    // 是否批处理验证\n    protected $patchValidate    =   false;\n    // 链操作方法列表\n    protected $methods          =   array('strict','order','alias','having','group','lock','distinct','auto','filter','validate','result','token','index','force');\n\n    /**\n     * 架构函数\n     * 取得DB类的实例对象 字段检查\n     * @access public\n     * @param string $name 模型名称\n     * @param string $tablePrefix 表前缀\n     * @param mixed $connection 数据库连接信息\n     */\n    public function __construct($name='',$tablePrefix='',$connection='') {\n        // 模型初始化\n        $this->_initialize();\n        // 获取模型名称\n        if(!empty($name)) {\n            if(strpos($name,'.')) { // 支持 数据库名.模型名的 定义\n                list($this->dbName,$this->name) = explode('.',$name);\n            }else{\n                $this->name   =  $name;\n            }\n        }elseif(empty($this->name)){\n            $this->name =   $this->getModelName();\n        }\n        // 设置表前缀\n        if(is_null($tablePrefix)) {// 前缀为Null表示没有前缀\n            $this->tablePrefix = '';\n        }elseif('' != $tablePrefix) {\n            $this->tablePrefix = $tablePrefix;\n        }elseif(!isset($this->tablePrefix)){\n            $this->tablePrefix = C('DB_PREFIX');\n        }\n\n        // 数据库初始化操作\n        // 获取数据库操作对象\n        // 当前模型有独立的数据库连接信息\n        $this->db(0,empty($this->connection)?$connection:$this->connection,true);\n    }\n\n    /**\n     * 自动检测数据表信息\n     * @access protected\n     * @return void\n     */\n    protected function _checkTableInfo() {\n        // 如果不是Model类 自动记录数据表信息\n        // 只在第一次执行记录\n        if(empty($this->fields)) {\n            // 如果数据表字段没有定义则自动获取\n            if(C('DB_FIELDS_CACHE')) {\n                $db   =  $this->dbName?:C('DB_NAME');\n                $fields = F('_fields/'.strtolower($db.'.'.$this->tablePrefix.$this->name));\n                if($fields) {\n                    $this->fields   =   $fields;\n                    if(!empty($fields['_pk'])){\n                        $this->pk       =   $fields['_pk'];\n                    }\n                    return ;\n                }\n            }\n            // 每次都会读取数据表信息\n            $this->flush();\n        }\n    }\n\n    /**\n     * 获取字段信息并缓存\n     * @access public\n     * @return void\n     */\n    public function flush() {\n        // 缓存不存在则查询数据表信息\n        $this->db->setModel($this->name);\n        $fields =   $this->db->getFields($this->getTableName());\n        if(!$fields) { // 无法获取字段信息\n            return false;\n        }\n        $this->fields   =   array_keys($fields);\n        unset($this->fields['_pk']);\n        foreach ($fields as $key=>$val){\n            // 记录字段类型\n            $type[$key]     =   $val['type'];\n            if($val['primary']) {\n                  // 增加复合主键支持\n                if (isset($this->fields['_pk']) && $this->fields['_pk'] != null) {\n                    if (is_string($this->fields['_pk'])) {\n                        $this->pk   =   array($this->fields['_pk']);\n                        $this->fields['_pk']   =   $this->pk;\n                    }\n                    $this->pk[]   =   $key;\n                    $this->fields['_pk'][]   =   $key;\n                } else {\n                    $this->pk   =   $key;\n                    $this->fields['_pk']   =   $key;\n                }\n                if($val['autoinc']) $this->autoinc   =   true;\n            }\n        }\n        // 记录字段类型信息\n        $this->fields['_type'] =  $type;\n\n        // 2008-3-7 增加缓存开关控制\n        if(C('DB_FIELDS_CACHE')){\n            // 永久缓存数据表信息\n            $db   =  $this->dbName?:C('DB_NAME');\n            F('_fields/'.strtolower($db.'.'.$this->tablePrefix.$this->name),$this->fields);\n        }\n    }\n\n    /**\n     * 设置数据对象的值\n     * @access public\n     * @param string $name 名称\n     * @param mixed $value 值\n     * @return void\n     */\n    public function __set($name,$value) {\n        // 设置数据对象属性\n        $this->data[$name]  =   $value;\n    }\n\n    /**\n     * 获取数据对象的值\n     * @access public\n     * @param string $name 名称\n     * @return mixed\n     */\n    public function __get($name) {\n        return isset($this->data[$name])?$this->data[$name]:null;\n    }\n\n    /**\n     * 检测数据对象的值\n     * @access public\n     * @param string $name 名称\n     * @return boolean\n     */\n    public function __isset($name) {\n        return isset($this->data[$name]);\n    }\n\n    /**\n     * 销毁数据对象的值\n     * @access public\n     * @param string $name 名称\n     * @return void\n     */\n    public function __unset($name) {\n        unset($this->data[$name]);\n    }\n\n    /**\n     * 利用__call方法实现一些特殊的Model方法\n     * @access public\n     * @param string $method 方法名称\n     * @param array $args 调用参数\n     * @return mixed\n     */\n    public function __call($method,$args) {\n        if(in_array(strtolower($method),$this->methods,true)) {\n            // 连贯操作的实现\n            $this->options[strtolower($method)] =   $args[0];\n            return $this;\n        }elseif(in_array(strtolower($method),array('count','sum','min','max','avg'),true)){\n            // 统计查询的实现\n            $field =  isset($args[0])?$args[0]:'*';\n            return $this->getField(strtoupper($method).'('.$field.') AS tp_'.$method);\n        }elseif(strtolower(substr($method,0,5))=='getby') {\n            // 根据某个字段获取记录\n            $field   =   parse_name(substr($method,5));\n            $where[$field] =  $args[0];\n            return $this->where($where)->find();\n        }elseif(strtolower(substr($method,0,10))=='getfieldby') {\n            // 根据某个字段获取记录的某个值\n            $name   =   parse_name(substr($method,10));\n            $where[$name] =$args[0];\n            return $this->where($where)->getField($args[1]);\n        }elseif(isset($this->_scope[$method])){// 命名范围的单独调用支持\n            return $this->scope($method,$args[0]);\n        }else{\n            E(__CLASS__.':'.$method.L('_METHOD_NOT_EXIST_'));\n            return;\n        }\n    }\n    // 回调方法 初始化模型\n    protected function _initialize() {}\n\n    /**\n     * 对保存到数据库的数据进行处理\n     * @access protected\n     * @param mixed $data 要操作的数据\n     * @return boolean\n     */\n     protected function _facade($data) {\n\n        // 检查数据字段合法性\n        if(!empty($this->fields)) {\n            if(!empty($this->options['field'])) {\n                $fields =   $this->options['field'];\n                unset($this->options['field']);\n                if(is_string($fields)) {\n                    $fields =   explode(',',$fields);\n                }    \n            }else{\n                $fields =   $this->fields;\n            }        \n            foreach ($data as $key=>$val){\n                if(!in_array($key,$fields,true)){\n                    if(!empty($this->options['strict'])){\n                        E(L('_DATA_TYPE_INVALID_').':['.$key.'=>'.$val.']');\n                    }\n                    unset($data[$key]);\n                }elseif(is_scalar($val)) {\n                    // 字段类型检查 和 强制转换\n                    $this->_parseType($data,$key);\n                }\n            }\n        }\n       \n        // 安全过滤\n        if(!empty($this->options['filter'])) {\n            $data = array_map($this->options['filter'],$data);\n            unset($this->options['filter']);\n        }\n        $this->_before_write($data);\n        return $data;\n     }\n\n    // 写入数据前的回调方法 包括新增和更新\n    protected function _before_write(&$data) {}\n\n    /**\n     * 新增数据\n     * @access public\n     * @param mixed $data 数据\n     * @param array $options 表达式\n     * @param boolean $replace 是否replace\n     * @return mixed\n     */\n    public function add($data='',$options=array(),$replace=false) {\n        if(empty($data)) {\n            // 没有传递数据，获取当前数据对象的值\n            if(!empty($this->data)) {\n                $data           =   $this->data;\n                // 重置数据\n                $this->data     = array();\n            }else{\n                $this->error    = L('_DATA_TYPE_INVALID_');\n                return false;\n            }\n        }\n        // 数据处理\n        $data       =   $this->_facade($data);\n        // 分析表达式\n        $options    =   $this->_parseOptions($options);\n        if(false === $this->_before_insert($data,$options)) {\n            return false;\n        }\n        // 写入数据到数据库\n        $result = $this->db->insert($data,$options,$replace);\n        if(false !== $result && is_numeric($result)) {\n            $pk     =   $this->getPk();\n              // 增加复合主键支持\n            if (is_array($pk)) return $result;\n            $insertId   =   $this->getLastInsID();\n            if($insertId) {\n                // 自增主键返回插入ID\n                $data[$pk]  = $insertId;\n                if(false === $this->_after_insert($data,$options)) {\n                    return false;\n                }\n                return $insertId;\n            }\n            if(false === $this->_after_insert($data,$options)) {\n                return false;\n            }\n        }\n        return $result;\n    }\n    // 插入数据前的回调方法\n    protected function _before_insert(&$data,$options) {}\n    // 插入成功后的回调方法\n    protected function _after_insert($data,$options) {}\n\n    public function addAll($dataList,$options=array(),$replace=false){\n        if(empty($dataList)) {\n            $this->error = L('_DATA_TYPE_INVALID_');\n            return false;\n        }\n        // 数据处理\n        foreach ($dataList as $key=>$data){\n            $dataList[$key] = $this->_facade($data);\n        }\n        // 分析表达式\n        $options =  $this->_parseOptions($options);\n        // 写入数据到数据库\n        $result = $this->db->insertAll($dataList,$options,$replace);\n        if(false !== $result ) {\n            $insertId   =   $this->getLastInsID();\n            if($insertId) {\n                return $insertId;\n            }\n        }\n        return $result;\n    }\n\n    /**\n     * 保存数据\n     * @access public\n     * @param mixed $data 数据\n     * @param array $options 表达式\n     * @return boolean\n     */\n    public function save($data='',$options=array()) {\n        if(empty($data)) {\n            // 没有传递数据，获取当前数据对象的值\n            if(!empty($this->data)) {\n                $data           =   $this->data;\n                // 重置数据\n                $this->data     =   array();\n            }else{\n                $this->error    =   L('_DATA_TYPE_INVALID_');\n                return false;\n            }\n        }\n        // 数据处理\n        $data       =   $this->_facade($data);\n        if(empty($data)){\n            // 没有数据则不执行\n            $this->error    =   L('_DATA_TYPE_INVALID_');\n            return false;\n        }\n        // 分析表达式\n        $options    =   $this->_parseOptions($options);\n        $pk         =   $this->getPk();\n        if(!isset($options['where']) ) {\n            // 如果存在主键数据 则自动作为更新条件\n            if (is_string($pk) && isset($data[$pk])) {\n                $where[$pk]     =   $data[$pk];\n                unset($data[$pk]);\n            } elseif (is_array($pk)) {\n                // 增加复合主键支持\n                foreach ($pk as $field) {\n                    if(isset($data[$field])) {\n                        $where[$field]      =   $data[$field];\n                    } else {\n                           // 如果缺少复合主键数据则不执行\n                        $this->error        =   L('_OPERATION_WRONG_');\n                        return false;\n                    }\n                    unset($data[$field]);\n                }\n            }\n            if(!isset($where)){\n                // 如果没有任何更新条件则不执行\n                $this->error        =   L('_OPERATION_WRONG_');\n                return false;\n            }else{\n                $options['where']   =   $where;\n            }\n        }\n\n        if(is_array($options['where']) && isset($options['where'][$pk])){\n            $pkValue    =   $options['where'][$pk];\n        }\n        if(false === $this->_before_update($data,$options)) {\n            return false;\n        }\n        $result     =   $this->db->update($data,$options);\n        if(false !== $result && is_numeric($result)) {\n            if(isset($pkValue)) $data[$pk]   =  $pkValue;\n            $this->_after_update($data,$options);\n        }\n        return $result;\n    }\n    // 更新数据前的回调方法\n    protected function _before_update(&$data,$options) {}\n    // 更新成功后的回调方法\n    protected function _after_update($data,$options) {}\n\n    /**\n     * 删除数据\n     * @access public\n     * @param mixed $options 表达式\n     * @return mixed\n     */\n    public function delete($options=array()) {\n        $pk   =  $this->getPk();\n        if(empty($options) && empty($this->options['where'])) {\n            // 如果删除条件为空 则删除当前数据对象所对应的记录\n            if(!empty($this->data) && isset($this->data[$pk]))\n                return $this->delete($this->data[$pk]);\n            else\n                return false;\n        }\n        if(is_numeric($options)  || is_string($options)) {\n            // 根据主键删除记录\n            if(strpos($options,',')) {\n                $where[$pk]     =  array('IN', $options);\n            }else{\n                $where[$pk]     =  $options;\n            }\n            $options            =  array();\n            $options['where']   =  $where;\n        }\n        // 根据复合主键删除记录\n        if (is_array($options) && (count($options) > 0) && is_array($pk)) {\n            $count = 0;\n            foreach (array_keys($options) as $key) {\n                if (is_int($key)) $count++; \n            } \n            if ($count == count($pk)) {\n                $i = 0;\n                foreach ($pk as $field) {\n                    $where[$field] = $options[$i];\n                    unset($options[$i++]);\n                }\n                $options['where']  =  $where;\n            } else {\n                return false;\n            }\n        }\n        // 分析表达式\n        $options =  $this->_parseOptions($options);\n        if(empty($options['where'])){\n            // 如果条件为空 不进行删除操作 除非设置 1=1\n            return false;\n        }        \n        if(is_array($options['where']) && isset($options['where'][$pk])){\n            $pkValue            =  $options['where'][$pk];\n        }\n\n        if(false === $this->_before_delete($options)) {\n            return false;\n        }        \n        $result  =    $this->db->delete($options);\n        if(false !== $result && is_numeric($result)) {\n            $data = array();\n            if(isset($pkValue)) $data[$pk]   =  $pkValue;\n            $this->_after_delete($data,$options);\n        }\n        // 返回删除记录个数\n        return $result;\n    }\n    // 删除数据前的回调方法\n    protected function _before_delete($options) {}    \n    // 删除成功后的回调方法\n    protected function _after_delete($data,$options) {}\n\n    /**\n     * 查询数据集\n     * @access public\n     * @param array $options 表达式参数\n     * @return mixed\n     */\n    public function select($options=array()) {\n        $pk   =  $this->getPk();\n        if(is_string($options) || is_numeric($options)) {\n            // 根据主键查询\n            if(strpos($options,',')) {\n                $where[$pk]     =  array('IN',$options);\n            }else{\n                $where[$pk]     =  $options;\n            }\n            $options            =  array();\n            $options['where']   =  $where;\n        }elseif (is_array($options) && (count($options) > 0) && is_array($pk)) {\n            // 根据复合主键查询\n            $count = 0;\n            foreach (array_keys($options) as $key) {\n                if (is_int($key)) $count++; \n            } \n            if ($count == count($pk)) {\n                $i = 0;\n                foreach ($pk as $field) {\n                    $where[$field] = $options[$i];\n                    unset($options[$i++]);\n                }\n                $options['where']  =  $where;\n            } else {\n                return false;\n            }\n        } elseif(false === $options){ // 用于子查询 不查询只返回SQL\n            $options            =  array();\n            // 分析表达式\n            $options            =  $this->_parseOptions($options);\n            return  '( '.$this->fetchSql(true)->select($options).' )';\n        }\n        // 分析表达式\n        $options    =  $this->_parseOptions($options);\n        // 判断查询缓存\n        if(isset($options['cache'])){\n            $cache  =   $options['cache'];\n            $key    =   is_string($cache['key'])?$cache['key']:md5(serialize($options));\n            $data   =   S($key,'',$cache);\n            if(false !== $data){\n                return $data;\n            }\n        }        \n        $resultSet  = $this->db->select($options);\n        if(false === $resultSet) {\n            return false;\n        }\n        if(empty($resultSet)) { // 查询结果为空\n            return null;\n        }\n\n        if(is_string($resultSet)){\n            return $resultSet;\n        }\n\n        $resultSet  =   array_map(array($this,'_read_data'),$resultSet);\n        $this->_after_select($resultSet,$options);\n        if(isset($options['index'])){ // 对数据集进行索引\n            $index  =   explode(',',$options['index']);\n            foreach ($resultSet as $result){\n                $_key   =  $result[$index[0]];\n                if(isset($index[1]) && isset($result[$index[1]])){\n                    $cols[$_key] =  $result[$index[1]];\n                }else{\n                    $cols[$_key] =  $result;\n                }\n            }\n            $resultSet  =   $cols;\n        }\n        if(isset($cache)){\n            S($key,$resultSet,$cache);\n        }\n        return $resultSet;\n    }\n    // 查询成功后的回调方法\n    protected function _after_select(&$resultSet,$options) {}\n\n    /**\n     * 分析表达式\n     * @access protected\n     * @param array $options 表达式参数\n     * @return array\n     */\n    protected function _parseOptions($options=array()) {\n        if(is_array($options))\n            $options =  array_merge($this->options,$options);\n\n        if(!isset($options['table'])){\n            // 自动获取表名\n            $options['table']   =   $this->getTableName();\n            $fields             =   $this->fields;\n        }else{\n            // 指定数据表 则重新获取字段列表 但不支持类型检测\n            $fields             =   $this->getDbFields();\n        }\n\n        // 数据表别名\n        if(!empty($options['alias'])) {\n            $options['table']  .=   ' '.$options['alias'];\n        }\n        // 记录操作的模型名称\n        $options['model']       =   $this->name;\n\n        // 字段类型验证\n        if(isset($options['where']) && is_array($options['where']) && !empty($fields) && !isset($options['join'])) {\n            // 对数组查询条件进行字段类型检查\n            foreach ($options['where'] as $key=>$val){\n                $key            =   trim($key);\n                if(in_array($key,$fields,true)){\n                    if(is_scalar($val)) {\n                        $this->_parseType($options['where'],$key);\n                    }\n                }elseif(!is_numeric($key) && '_' != substr($key,0,1) && false === strpos($key,'.') && false === strpos($key,'(') && false === strpos($key,'|') && false === strpos($key,'&')){\n                    if(!empty($this->options['strict'])){\n                        E(L('_ERROR_QUERY_EXPRESS_').':['.$key.'=>'.$val.']');\n                    } \n                    unset($options['where'][$key]);\n                }\n            }\n        }\n        // 查询过后清空sql表达式组装 避免影响下次查询\n        $this->options  =   array();\n        // 表达式过滤\n        $this->_options_filter($options);\n        return $options;\n    }\n    // 表达式过滤回调方法\n    protected function _options_filter(&$options) {}\n\n    /**\n     * 数据类型检测\n     * @access protected\n     * @param mixed $data 数据\n     * @param string $key 字段名\n     * @return void\n     */\n    protected function _parseType(&$data,$key) {\n        if(!isset($this->options['bind'][':'.$key]) && isset($this->fields['_type'][$key])){\n            $fieldType = strtolower($this->fields['_type'][$key]);\n            if(false !== strpos($fieldType,'enum')){\n                // 支持ENUM类型优先检测\n            }elseif(false === strpos($fieldType,'bigint') && false !== strpos($fieldType,'int')) {\n                $data[$key]   =  intval($data[$key]);\n            }elseif(false !== strpos($fieldType,'float') || false !== strpos($fieldType,'double')){\n                $data[$key]   =  floatval($data[$key]);\n            }elseif(false !== strpos($fieldType,'bool')){\n                $data[$key]   =  (bool)$data[$key];\n            }\n        }\n    }\n\n    /**\n     * 数据读取后的处理\n     * @access protected\n     * @param array $data 当前数据\n     * @return array\n     */\n    protected function _read_data($data) {\n        // 检查字段映射\n        if(!empty($this->_map) && C('READ_DATA_MAP')) {\n            foreach ($this->_map as $key=>$val){\n                if(isset($data[$val])) {\n                    $data[$key] =   $data[$val];\n                    unset($data[$val]);\n                }\n            }\n        }\n        return $data;\n    }\n\n    /**\n     * 查询数据\n     * @access public\n     * @param mixed $options 表达式参数\n     * @return mixed\n     */\n    public function find($options=array()) {\n        if(is_numeric($options) || is_string($options)) {\n            $where[$this->getPk()]  =   $options;\n            $options                =   array();\n            $options['where']       =   $where;\n        }\n        // 根据复合主键查找记录\n        $pk  =  $this->getPk();\n        if (is_array($options) && (count($options) > 0) && is_array($pk)) {\n            // 根据复合主键查询\n            $count = 0;\n            foreach (array_keys($options) as $key) {\n                if (is_int($key)) $count++; \n            } \n            if ($count == count($pk)) {\n                $i = 0;\n                foreach ($pk as $field) {\n                    $where[$field] = $options[$i];\n                    unset($options[$i++]);\n                }\n                $options['where']  =  $where;\n            } else {\n                return false;\n            }\n        }\n        // 总是查找一条记录\n        $options['limit']   =   1;\n        // 分析表达式\n        $options            =   $this->_parseOptions($options);\n        // 判断查询缓存\n        if(isset($options['cache'])){\n            $cache  =   $options['cache'];\n            $key    =   is_string($cache['key'])?$cache['key']:md5(serialize($options));\n            $data   =   S($key,'',$cache);\n            if(false !== $data){\n                $this->data     =   $data;\n                return $data;\n            }\n        }\n        $resultSet          =   $this->db->select($options);\n        if(false === $resultSet) {\n            return false;\n        }\n        if(empty($resultSet)) {// 查询结果为空\n            return null;\n        }\n        if(is_string($resultSet)){\n            return $resultSet;\n        }\n\n        // 读取数据后的处理\n        $data   =   $this->_read_data($resultSet[0]);\n        $this->_after_find($data,$options);\n        $this->data     =   $data;\n        if(isset($cache)){\n            S($key,$data,$cache);\n        }\n        return $this->data;\n    }\n    // 查询成功的回调方法\n    protected function _after_find(&$result,$options) {}\n\n    /**\n     * 设置记录的某个字段值\n     * 支持使用数据库字段和方法\n     * @access public\n     * @param string|array $field  字段名\n     * @param string $value  字段值\n     * @return boolean\n     */\n    public function setField($field,$value='') {\n        if(is_array($field)) {\n            $data           =   $field;\n        }else{\n            $data[$field]   =   $value;\n        }\n        return $this->save($data);\n    }\n\n    /**\n     * 字段值增长\n     * @access public\n     * @param string $field  字段名\n     * @param integer $step  增长值\n     * @param integer $lazyTime  延时时间(s)\n     * @return boolean\n     */\n    public function setInc($field,$step=1) {\n        return $this->setField($field,array('exp',$field.'+'.$step));\n    }\n\n    /**\n     * 字段值减少\n     * @access public\n     * @param string $field  字段名\n     * @param integer $step  减少值\n     * @param integer $lazyTime  延时时间(s)\n     * @return boolean\n     */\n    public function setDec($field,$step=1) {\n        return $this->setField($field,array('exp',$field.'-'.$step));\n    }\n\n    /**\n     * 获取一条记录的某个字段值\n     * @access public\n     * @param string $field  字段名\n     * @param string $spea  字段数据间隔符号 NULL返回数组\n     * @return mixed\n     */\n    public function getField($field,$sepa=null) {\n        $options['field']       =   $field;\n        $options                =   $this->_parseOptions($options);\n        // 判断查询缓存\n        if(isset($options['cache'])){\n            $cache  =   $options['cache'];\n            $key    =   is_string($cache['key'])?$cache['key']:md5($sepa.serialize($options));\n            $data   =   S($key,'',$cache);\n            if(false !== $data){\n                return $data;\n            }\n        }        \n        $field                  =   trim($field);\n        if(strpos($field,',') && false !== $sepa) { // 多字段\n            if(!isset($options['limit'])){\n                $options['limit']   =   is_numeric($sepa)?$sepa:'';\n            }\n            $resultSet          =   $this->db->select($options);\n            if(!empty($resultSet)) {\n                $_field         =   explode(',', $field);\n                $field          =   array_keys($resultSet[0]);\n                $key1           =   array_shift($field);\n                $key2           =   array_shift($field);\n                $cols           =   array();\n                $count          =   count($_field);\n                foreach ($resultSet as $result){\n                    $name   =  $result[$key1];\n                    if(2==$count) {\n                        $cols[$name]   =  $result[$key2];\n                    }else{\n                        $cols[$name]   =  is_string($sepa)?implode($sepa,array_slice($result,1)):$result;\n                    }\n                }\n                if(isset($cache)){\n                    S($key,$cols,$cache);\n                }\n                return $cols;\n            }\n        }else{   // 查找一条记录\n            // 返回数据个数\n            if(true !== $sepa) {// 当sepa指定为true的时候 返回所有数据\n                $options['limit']   =   is_numeric($sepa)?$sepa:1;\n            }\n            $result = $this->db->select($options);\n            if(!empty($result)) {\n                if(true !== $sepa && 1==$options['limit']) {\n                    $data   =   reset($result[0]);\n                    if(isset($cache)){\n                        S($key,$data,$cache);\n                    }            \n                    return $data;\n                }\n                foreach ($result as $val){\n                    $array[]    =   $val[$field];\n                }\n                if(isset($cache)){\n                    S($key,$array,$cache);\n                }                \n                return $array;\n            }\n        }\n        return null;\n    }\n\n    /**\n     * 创建数据对象 但不保存到数据库\n     * @access public\n     * @param mixed $data 创建数据\n     * @return mixed\n     */\n     public function create($data='') {\n        // 如果没有传值默认取POST数据\n        if(empty($data)) {\n            $data   =   I('post.');\n        }elseif(is_object($data)){\n            $data   =   get_object_vars($data);\n        }\n        // 验证数据\n        if(empty($data) || !is_array($data)) {\n            $this->error = L('_DATA_TYPE_INVALID_');\n            return false;\n        }\n\n        // 检测提交字段的合法性\n        if(isset($this->options['field'])) { // $this->field('field1,field2...')->create()\n            $fields =   $this->options['field'];\n            unset($this->options['field']);\n        }\n        if(isset($fields)) {\n            if(is_string($fields)) {\n                $fields =   explode(',',$fields);\n            }\n        }\n\n        // 验证完成生成数据对象\n        if($this->autoCheckFields) { // 开启字段检测 则过滤非法字段数据\n            $fields =   $this->getDbFields();\n            foreach ($data as $key=>$val){\n                if(!in_array($key,$fields)) {\n                    unset($data[$key]);\n                }elseif(MAGIC_QUOTES_GPC && is_string($val)){\n                    $data[$key] =   stripslashes($val);\n                }\n            }\n        }\n\n        // 赋值当前数据对象\n        $this->data =   $data;\n        // 返回创建的数据以供其他调用\n        return $data;\n     }\n\n    /**\n     * 使用正则验证数据\n     * @access public\n     * @param string $value  要验证的数据\n     * @param string $rule 验证规则\n     * @return boolean\n     */\n    public function regex($value,$rule) {\n        $validate = array(\n            'require'   =>  '/\\S+/',\n            'email'     =>  '/^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$/',\n            'url'       =>  '/^http(s?):\\/\\/(?:[A-za-z0-9-]+\\.)+[A-za-z]{2,4}(:\\d+)?(?:[\\/\\?#][\\/=\\?%\\-&~`@[\\]\\':+!\\.#\\w]*)?$/',\n            'currency'  =>  '/^\\d+(\\.\\d+)?$/',\n            'number'    =>  '/^\\d+$/',\n            'zip'       =>  '/^\\d{6}$/',\n            'integer'   =>  '/^[-\\+]?\\d+$/',\n            'double'    =>  '/^[-\\+]?\\d+(\\.\\d+)?$/',\n            'english'   =>  '/^[A-Za-z]+$/',\n        );\n        // 检查是否有内置的正则表达式\n        if(isset($validate[strtolower($rule)]))\n            $rule       =   $validate[strtolower($rule)];\n        return preg_match($rule,$value)===1;\n    }\n\n    /**\n     * 验证数据 支持 in between equal length regex expire ip_allow ip_deny\n     * @access public\n     * @param string $value 验证数据\n     * @param mixed $rule 验证表达式\n     * @param string $type 验证方式 默认为正则验证\n     * @return boolean\n     */\n    public function check($value,$rule,$type='regex'){\n        $type   =   strtolower(trim($type));\n        switch($type) {\n            case 'in': // 验证是否在某个指定范围之内 逗号分隔字符串或者数组\n            case 'notin':\n                $range   = is_array($rule)? $rule : explode(',',$rule);\n                return $type == 'in' ? in_array($value ,$range) : !in_array($value ,$range);\n            case 'between': // 验证是否在某个范围\n            case 'notbetween': // 验证是否不在某个范围            \n                if (is_array($rule)){\n                    $min    =    $rule[0];\n                    $max    =    $rule[1];\n                }else{\n                    list($min,$max)   =  explode(',',$rule);\n                }\n                return $type == 'between' ? $value>=$min && $value<=$max : $value<$min || $value>$max;\n            case 'equal': // 验证是否等于某个值\n            case 'notequal': // 验证是否等于某个值            \n                return $type == 'equal' ? $value == $rule : $value != $rule;\n            case 'length': // 验证长度\n                $length  =  mb_strlen($value,'utf-8'); // 当前数据长度\n                if(strpos($rule,',')) { // 长度区间\n                    list($min,$max)   =  explode(',',$rule);\n                    return $length >= $min && $length <= $max;\n                }else{// 指定长度\n                    return $length == $rule;\n                }\n            case 'expire':\n                list($start,$end)   =  explode(',',$rule);\n                if(!is_numeric($start)) $start   =  strtotime($start);\n                if(!is_numeric($end)) $end   =  strtotime($end);\n                return NOW_TIME >= $start && NOW_TIME <= $end;\n            case 'ip_allow': // IP 操作许可验证\n                return in_array(get_client_ip(),explode(',',$rule));\n            case 'ip_deny': // IP 操作禁止验证\n                return !in_array(get_client_ip(),explode(',',$rule));\n            case 'regex':\n            default:    // 默认使用正则验证 可以使用验证类中定义的验证名称\n                // 检查附加规则\n                return $this->regex($value,$rule);\n        }\n    }\n\n    /**\n     * SQL查询\n     * @access public\n     * @param string $sql  SQL指令\n     * @return mixed\n     */\n    public function query($sql) {\n        return $this->db->query($sql);\n    }\n\n    /**\n     * 执行SQL语句\n     * @access public\n     * @param string $sql  SQL指令\n     * @return false | integer\n     */\n    public function execute($sql) {\n        return $this->db->execute($sql);\n    }\n\n    /**\n     * 切换当前的数据库连接\n     * @access public\n     * @param integer $linkNum  连接序号\n     * @param mixed $config  数据库连接信息\n     * @param boolean $force 强制重新连接\n     * @return Model\n     */\n    public function db($linkNum='',$config='',$force=false) {\n        if('' === $linkNum && $this->db) {\n            return $this->db;\n        }\n\n        if(!isset($this->_db[$linkNum]) || $force ) {\n            // 创建一个新的实例\n            if(!empty($config) && is_string($config) && false === strpos($config,'/')) { // 支持读取配置参数\n                $config  =  C($config);\n            }\n            $this->_db[$linkNum]            =    Db::getInstance($config);\n        }elseif(NULL === $config){\n            $this->_db[$linkNum]->close(); // 关闭数据库连接\n            unset($this->_db[$linkNum]);\n            return ;\n        }\n\n        // 切换数据库连接\n        $this->db   =    $this->_db[$linkNum];\n        $this->_after_db();\n        // 字段检测\n        if(!empty($this->name) && $this->autoCheckFields)    $this->_checkTableInfo();\n        return $this;\n    }\n    // 数据库切换后回调方法\n    protected function _after_db() {}\n\n    /**\n     * 得到当前的数据对象名称\n     * @access public\n     * @return string\n     */\n    public function getModelName() {\n        if(empty($this->name)){\n            $name = substr(get_class($this),0,-strlen(C('DEFAULT_M_LAYER')));\n            if ( $pos = strrpos($name,'\\\\') ) {//有命名空间\n                $this->name = substr($name,$pos+1);\n            }else{\n                $this->name = $name;\n            }\n        }\n        return $this->name;\n    }\n\n    /**\n     * 得到完整的数据表名\n     * @access public\n     * @return string\n     */\n    public function getTableName() {\n        if(empty($this->trueTableName)) {\n            $tableName  = !empty($this->tablePrefix) ? $this->tablePrefix : '';\n            if(!empty($this->tableName)) {\n                $tableName .= $this->tableName;\n            }else{\n                $tableName .= parse_name($this->name);\n            }\n            $this->trueTableName    =   strtolower($tableName);\n        }\n        return (!empty($this->dbName)?$this->dbName.'.':'').$this->trueTableName;\n    }\n\n    /**\n     * 启动事务\n     * @access public\n     * @return void\n     */\n    public function startTrans() {\n        $this->commit();\n        $this->db->startTrans();\n        return ;\n    }\n\n    /**\n     * 提交事务\n     * @access public\n     * @return boolean\n     */\n    public function commit() {\n        return $this->db->commit();\n    }\n\n    /**\n     * 事务回滚\n     * @access public\n     * @return boolean\n     */\n    public function rollback() {\n        return $this->db->rollback();\n    }\n\n    /**\n     * 返回模型的错误信息\n     * @access public\n     * @return string\n     */\n    public function getError(){\n        return $this->error;\n    }\n\n    /**\n     * 返回数据库的错误信息\n     * @access public\n     * @return string\n     */\n    public function getDbError() {\n        return $this->db->getError();\n    }\n\n    /**\n     * 返回最后插入的ID\n     * @access public\n     * @return string\n     */\n    public function getLastInsID() {\n        return $this->db->getLastInsID();\n    }\n\n    /**\n     * 返回最后执行的sql语句\n     * @access public\n     * @return string\n     */\n    public function getLastSql() {\n        return $this->db->getLastSql($this->name);\n    }\n    // 鉴于getLastSql比较常用 增加_sql 别名\n    public function _sql(){\n        return $this->getLastSql();\n    }\n\n    /**\n     * 获取主键名称\n     * @access public\n     * @return string\n     */\n    public function getPk() {\n        return $this->pk;\n    }\n\n    /**\n     * 获取数据表字段信息\n     * @access public\n     * @return array\n     */\n    public function getDbFields(){\n        if(isset($this->options['table'])) {// 动态指定表名\n            if(is_array($this->options['table'])){\n                $table  =   key($this->options['table']);\n            }else{\n                $table  =   $this->options['table'];\n            }\n            $fields     =   $this->db->getFields($table);\n            return  $fields ? array_keys($fields) : false;\n        }\n        if($this->fields) {\n            $fields     =  $this->fields;\n            unset($fields['_type'],$fields['_pk']);\n            return $fields;\n        }\n        return false;\n    }\n\n    /**\n     * 设置数据对象值\n     * @access public\n     * @param mixed $data 数据\n     * @return Model\n     */\n    public function data($data=''){\n        if('' === $data && !empty($this->data)) {\n            return $this->data;\n        }\n        if(is_object($data)){\n            $data   =   get_object_vars($data);\n        }elseif(is_string($data)){\n            parse_str($data,$data);\n        }elseif(!is_array($data)){\n            E(L('_DATA_TYPE_INVALID_'));\n        }\n        $this->data = $data;\n        return $this;\n    }\n\n    /**\n     * 指定当前的数据表\n     * @access public\n     * @param mixed $table\n     * @return Model\n     */\n    public function table($table) {\n        $prefix =   $this->tablePrefix;\n        if(is_array($table)) {\n            $this->options['table'] =   $table;\n        }elseif(!empty($table)) {\n            //将__TABLE_NAME__替换成带前缀的表名\n            $table  = preg_replace_callback(\"/__([A-Z0-9_-]+)__/sU\", function($match) use($prefix){ return $prefix.strtolower($match[1]);}, $table);\n            $this->options['table'] =   $table;\n        }\n        return $this;\n    }\n\n    /**\n     * USING支持 用于多表删除\n     * @access public\n     * @param mixed $using\n     * @return Model\n     */\n    public function using($using){\n        $prefix =   $this->tablePrefix;\n        if(is_array($using)) {\n            $this->options['using'] =   $using;\n        }elseif(!empty($using)) {\n            //将__TABLE_NAME__替换成带前缀的表名\n            $using  = preg_replace_callback(\"/__([A-Z0-9_-]+)__/sU\", function($match) use($prefix){ return $prefix.strtolower($match[1]);}, $using);\n            $this->options['using'] =   $using;\n        }\n        return $this;\n    }\n\n    /**\n     * 查询SQL组装 join\n     * @access public\n     * @param mixed $join\n     * @param string $type JOIN类型\n     * @return Model\n     */\n    public function join($join,$type='INNER') {\n        $prefix =   $this->tablePrefix;\n        if(is_array($join)) {\n            foreach ($join as $key=>&$_join){\n                $_join  =   preg_replace_callback(\"/__([A-Z0-9_-]+)__/sU\", function($match) use($prefix){ return $prefix.strtolower($match[1]);}, $_join);\n                $_join  =   false !== stripos($_join,'JOIN')? $_join : $type.' JOIN ' .$_join;\n            }\n            $this->options['join']      =   $join;\n        }elseif(!empty($join)) {\n            //将__TABLE_NAME__字符串替换成带前缀的表名\n            $join  = preg_replace_callback(\"/__([A-Z0-9_-]+)__/sU\", function($match) use($prefix){ return $prefix.strtolower($match[1]);}, $join);\n            $this->options['join'][]    =   false !== stripos($join,'JOIN')? $join : $type.' JOIN '.$join;\n        }\n        return $this;\n    }\n\n    /**\n     * 查询SQL组装 union\n     * @access public\n     * @param mixed $union\n     * @param boolean $all\n     * @return Model\n     */\n    public function union($union,$all=false) {\n        if(empty($union)) return $this;\n        if($all) {\n            $this->options['union']['_all']  =   true;\n        }\n        if(is_object($union)) {\n            $union   =  get_object_vars($union);\n        }\n        // 转换union表达式\n        if(is_string($union) ) {\n            $prefix =   $this->tablePrefix;\n            //将__TABLE_NAME__字符串替换成带前缀的表名\n            $options  = preg_replace_callback(\"/__([A-Z0-9_-]+)__/sU\", function($match) use($prefix){ return $prefix.strtolower($match[1]);}, $union);\n        }elseif(is_array($union)){\n            if(isset($union[0])) {\n                $this->options['union']  =  array_merge($this->options['union'],$union);\n                return $this;\n            }else{\n                $options =  $union;\n            }\n        }else{\n            E(L('_DATA_TYPE_INVALID_'));\n        }\n        $this->options['union'][]  =   $options;\n        return $this;\n    }\n\n    /**\n     * 查询缓存\n     * @access public\n     * @param mixed $key\n     * @param integer $expire\n     * @param string $type\n     * @return Model\n     */\n    public function cache($key=true,$expire=null,$type=''){\n        // 增加快捷调用方式 cache(10) 等同于 cache(true, 10)\n        if(is_numeric($key) && is_null($expire)){\n            $expire = $key;\n            $key    = true;\n        }\n        if(false !== $key)\n            $this->options['cache']  =  array('key'=>$key,'expire'=>$expire,'type'=>$type);\n        return $this;\n    }\n\n    /**\n     * 指定查询字段 支持字段排除\n     * @access public\n     * @param mixed $field\n     * @param boolean $except 是否排除\n     * @return Model\n     */\n    public function field($field,$except=false){\n        if(true === $field) {// 获取全部字段\n            $fields     =  $this->getDbFields();\n            $field      =  $fields?:'*';\n        }elseif($except) {// 字段排除\n            if(is_string($field)) {\n                $field  =  explode(',',$field);\n            }\n            $fields     =  $this->getDbFields();\n            $field      =  $fields?array_diff($fields,$field):$field;\n        }\n        $this->options['field']   =   $field;\n        return $this;\n    }\n\n    /**\n     * 调用命名范围\n     * @access public\n     * @param mixed $scope 命名范围名称 支持多个 和直接定义\n     * @param array $args 参数\n     * @return Model\n     */\n    public function scope($scope='',$args=NULL){\n        if('' === $scope) {\n            if(isset($this->_scope['default'])) {\n                // 默认的命名范围\n                $options    =   $this->_scope['default'];\n            }else{\n                return $this;\n            }\n        }elseif(is_string($scope)){ // 支持多个命名范围调用 用逗号分割\n            $scopes         =   explode(',',$scope);\n            $options        =   array();\n            foreach ($scopes as $name){\n                if(!isset($this->_scope[$name])) continue;\n                $options    =   array_merge($options,$this->_scope[$name]);\n            }\n            if(!empty($args) && is_array($args)) {\n                $options    =   array_merge($options,$args);\n            }\n        }elseif(is_array($scope)){ // 直接传入命名范围定义\n            $options        =   $scope;\n        }\n        \n        if(is_array($options) && !empty($options)){\n            $this->options  =   array_merge($this->options,array_change_key_case($options));\n        }\n        return $this;\n    }\n\n    /**\n     * 指定查询条件 支持安全过滤\n     * @access public\n     * @param mixed $where 条件表达式\n     * @param mixed $parse 预处理参数\n     * @return Model\n     */\n    public function where($where,$parse=null){\n        if(!is_null($parse) && is_string($where)) {\n            if(!is_array($parse)) {\n                $parse = func_get_args();\n                array_shift($parse);\n            }\n            $parse = array_map(array($this->db,'escapeString'),$parse);\n            $where =   vsprintf($where,$parse);\n        }elseif(is_object($where)){\n            $where  =   get_object_vars($where);\n        }\n        if(is_string($where) && '' != $where){\n            $map    =   array();\n            $map['_string']   =   $where;\n            $where  =   $map;\n        }        \n        if(isset($this->options['where'])){\n            $this->options['where'] =   array_merge($this->options['where'],$where);\n        }else{\n            $this->options['where'] =   $where;\n        }\n        \n        return $this;\n    }\n\n    /**\n     * 指定查询数量\n     * @access public\n     * @param mixed $offset 起始位置\n     * @param mixed $length 查询数量\n     * @return Model\n     */\n    public function limit($offset,$length=null){\n        if(is_null($length) && strpos($offset,',')){\n            list($offset,$length)   =   explode(',',$offset);\n        }\n        $this->options['limit']     =   intval($offset).( $length? ','.intval($length) : '' );\n        return $this;\n    }\n\n    /**\n     * 指定分页\n     * @access public\n     * @param mixed $page 页数\n     * @param mixed $listRows 每页数量\n     * @return Model\n     */\n    public function page($page,$listRows=null){\n        if(is_null($listRows) && strpos($page,',')){\n            list($page,$listRows)   =   explode(',',$page);\n        }\n        $this->options['page']      =   array(intval($page),intval($listRows));\n        return $this;\n    }\n\n    /**\n     * 查询注释\n     * @access public\n     * @param string $comment 注释\n     * @return Model\n     */\n    public function comment($comment){\n        $this->options['comment'] =   $comment;\n        return $this;\n    }\n\n    /**\n     * 获取执行的SQL语句\n     * @access public\n     * @param boolean $fetch 是否返回sql\n     * @return Model\n     */\n    public function fetchSql($fetch){\n        $this->options['fetch_sql'] =   $fetch;\n        return $this;\n    }\n\n    /**\n     * 参数绑定\n     * @access public\n     * @param string $key  参数名\n     * @param mixed $value  绑定的变量及绑定参数\n     * @return Model\n     */\n    public function bind($key,$value=false) {\n        if(is_array($key)){\n            $this->options['bind'] =    $key;\n        }else{\n            $num =  func_num_args();\n            if($num>2){\n                $params =   func_get_args();\n                array_shift($params);\n                $this->options['bind'][$key] =  $params;\n            }else{\n                $this->options['bind'][$key] =  $value;\n            }        \n        }\n        return $this;\n    }\n\n    /**\n     * 设置模型的属性值\n     * @access public\n     * @param string $name 名称\n     * @param mixed $value 值\n     * @return Model\n     */\n    public function setProperty($name,$value) {\n        if(property_exists($this,$name))\n            $this->$name = $value;\n        return $this;\n    }\n\n}\n"
  },
  {
    "path": "ThinkPHP/Mode/Lite/View.class.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\nnamespace Think;\n/**\n * ThinkPHP 视图类\n */\nclass View {\n    /**\n     * 模板输出变量\n     * @var tVar\n     * @access protected\n     */ \n    protected $tVar     =   array();\n\n    /**\n     * 模板主题\n     * @var theme\n     * @access protected\n     */ \n    protected $theme    =   '';\n\n    /**\n     * 模板变量赋值\n     * @access public\n     * @param mixed $name\n     * @param mixed $value\n     */\n    public function assign($name,$value=''){\n        if(is_array($name)) {\n            $this->tVar   =  array_merge($this->tVar,$name);\n        }else {\n            $this->tVar[$name] = $value;\n        }\n    }\n\n    /**\n     * 取得模板变量的值\n     * @access public\n     * @param string $name\n     * @return mixed\n     */\n    public function get($name=''){\n        if('' === $name) {\n            return $this->tVar;\n        }\n        return isset($this->tVar[$name])?$this->tVar[$name]:false;\n    }\n\n    /**\n     * 加载模板和页面输出 可以返回输出内容\n     * @access public\n     * @param string $templateFile 模板文件名\n     * @param string $charset 模板输出字符集\n     * @param string $contentType 输出类型\n     * @param string $content 模板输出内容\n     * @param string $prefix 模板缓存前缀\n     * @return mixed\n     */\n    public function display($templateFile='',$charset='',$contentType='',$content='',$prefix='') {\n        G('viewStartTime');\n        // 解析并获取模板内容\n        $content = $this->fetch($templateFile,$content,$prefix);\n        // 输出模板内容\n        $this->render($content,$charset,$contentType);\n    }\n\n    /**\n     * 输出内容文本可以包括Html\n     * @access private\n     * @param string $content 输出内容\n     * @param string $charset 模板输出字符集\n     * @param string $contentType 输出类型\n     * @return mixed\n     */\n    private function render($content,$charset='',$contentType=''){\n        if(empty($charset))  $charset = C('DEFAULT_CHARSET');\n        if(empty($contentType)) $contentType = C('TMPL_CONTENT_TYPE');\n        // 网页字符编码\n        header('Content-Type:'.$contentType.'; charset='.$charset);\n        header('Cache-control: '.C('HTTP_CACHE_CONTROL'));  // 页面缓存控制\n        header('X-Powered-By:ThinkPHP');\n        // 输出模板文件\n        echo $content;\n    }\n\n    /**\n     * 解析和获取模板内容 用于输出\n     * @access public\n     * @param string $templateFile 模板文件名\n     * @param string $content 模板输出内容\n     * @param string $prefix 模板缓存前缀\n     * @return string\n     */\n    public function fetch($templateFile='',$content='',$prefix='') {\n        if(empty($content)) {\n            $templateFile   =   $this->parseTemplate($templateFile);\n            // 模板文件不存在直接返回\n            if(!is_file($templateFile)) E(L('_TEMPLATE_NOT_EXIST_').':'.$templateFile);\n        }else{\n            defined('THEME_PATH') or    define('THEME_PATH', $this->getThemePath());\n        }\n        // 页面缓存\n        ob_start();\n        ob_implicit_flush(0);\n        if('php' == strtolower(C('TMPL_ENGINE_TYPE'))) { // 使用PHP原生模板\n            $_content   =   $content;\n            // 模板阵列变量分解成为独立变量\n            extract($this->tVar, EXTR_OVERWRITE);\n            // 直接载入PHP模板\n            empty($_content)?include $templateFile:eval('?>'.$_content);\n        }else{\n            // 视图解析标签\n            $params = array('var'=>$this->tVar,'file'=>$templateFile,'content'=>$content,'prefix'=>$prefix);\n            $_content           =   !empty($content)?:$templateFile;\n            if((!empty($content) && $this->checkContentCache($content,$prefix)) ||  $this->checkCache($templateFile,$prefix)) { // 缓存有效\n                //载入模版缓存文件\n                Storage::load(C('CACHE_PATH').$prefix.md5($_content).C('TMPL_CACHFILE_SUFFIX'),$this->tVar);\n            }else{\n                $tpl = Think::instance('Think\\\\Template');\n                // 编译并加载模板文件\n                $tpl->fetch($_content,$this->tVar,$prefix);\n            }            \n        }\n        // 获取并清空缓存\n        $content = ob_get_clean();\n        // 内容过滤标签\n        // 系统默认的特殊变量替换\n        $replace =  array(\n            '__ROOT__'      =>  __ROOT__,       // 当前网站地址\n            '__APP__'       =>  __APP__,        // 当前应用地址\n            '__MODULE__'    =>  __MODULE__,\n            '__ACTION__'    =>  __ACTION__,     // 当前操作地址\n            '__SELF__'      =>  __SELF__,       // 当前页面地址\n            '__CONTROLLER__'=>  __CONTROLLER__,\n            '__URL__'       =>  __CONTROLLER__,\n            '__PUBLIC__'    =>  __ROOT__.'/Public',// 站点公共目录\n        );\n        // 允许用户自定义模板的字符串替换\n        if(is_array(C('TMPL_PARSE_STRING')) )\n            $replace =  array_merge($replace,C('TMPL_PARSE_STRING'));\n        $content = str_replace(array_keys($replace),array_values($replace),$content);\n        // 输出模板文件\n        return $content;\n    }\n\n    /**\n     * 检查缓存文件是否有效\n     * 如果无效则需要重新编译\n     * @access public\n     * @param string $tmplTemplateFile  模板文件名\n     * @return boolean\n     */\n    protected function checkCache($tmplTemplateFile,$prefix='') {\n        if (!C('TMPL_CACHE_ON')) // 优先对配置设定检测\n            return false;\n        $tmplCacheFile = C('CACHE_PATH').$prefix.md5($tmplTemplateFile).C('TMPL_CACHFILE_SUFFIX');\n        if(!Storage::has($tmplCacheFile)){\n            return false;\n        }elseif (filemtime($tmplTemplateFile) > Storage::get($tmplCacheFile,'mtime')) {\n            // 模板文件如果有更新则缓存需要更新\n            return false;\n        }elseif (C('TMPL_CACHE_TIME') != 0 && time() > Storage::get($tmplCacheFile,'mtime')+C('TMPL_CACHE_TIME')) {\n            // 缓存是否在有效期\n            return false;\n        }\n        // 开启布局模板\n        if(C('LAYOUT_ON')) {\n            $layoutFile  =  THEME_PATH.C('LAYOUT_NAME').C('TMPL_TEMPLATE_SUFFIX');\n            if(filemtime($layoutFile) > Storage::get($tmplCacheFile,'mtime')) {\n                return false;\n            }\n        }\n        // 缓存有效\n        return true;\n    }\n\n    /**\n     * 检查缓存内容是否有效\n     * 如果无效则需要重新编译\n     * @access public\n     * @param string $tmplContent  模板内容\n     * @return boolean\n     */\n    protected function checkContentCache($tmplContent,$prefix='') {\n        if(Storage::has(C('CACHE_PATH').$prefix.md5($tmplContent).C('TMPL_CACHFILE_SUFFIX'))){\n            return true;\n        }else{\n            return false;\n        }\n    }  \n\n    /**\n     * 自动定位模板文件\n     * @access protected\n     * @param string $template 模板文件规则\n     * @return string\n     */\n    public function parseTemplate($template='') {\n        if(is_file($template)) {\n            return $template;\n        }\n        $depr       =   C('TMPL_FILE_DEPR');\n        $template   =   str_replace(':', $depr, $template);\n\n        // 获取当前模块\n        $module   =  MODULE_NAME;\n        if(strpos($template,'@')){ // 跨模块调用模版文件\n            list($module,$template)  =   explode('@',$template);\n        }\n        // 获取当前主题的模版路径\n        defined('THEME_PATH') or    define('THEME_PATH', $this->getThemePath($module));\n\n        // 分析模板文件规则\n        if('' == $template) {\n            // 如果模板文件名为空 按照默认规则定位\n            $template = CONTROLLER_NAME . $depr . ACTION_NAME;\n        }elseif(false === strpos($template, $depr)){\n            $template = CONTROLLER_NAME . $depr . $template;\n        }\n        $file   =   THEME_PATH.$template.C('TMPL_TEMPLATE_SUFFIX');\n        if(C('TMPL_LOAD_DEFAULTTHEME') && THEME_NAME != C('DEFAULT_THEME') && !is_file($file)){\n            // 找不到当前主题模板的时候定位默认主题中的模板\n            $file   =   dirname(THEME_PATH).'/'.C('DEFAULT_THEME').'/'.$template.C('TMPL_TEMPLATE_SUFFIX');\n        }\n        return $file;\n    }\n\n    /**\n     * 获取当前的模板路径\n     * @access protected\n     * @param  string $module 模块名\n     * @return string\n     */\n    protected function getThemePath($module=MODULE_NAME){\n        // 获取当前主题名称\n        $theme = $this->getTemplateTheme();\n        // 获取当前主题的模版路径\n        $tmplPath   =   C('VIEW_PATH'); // 模块设置独立的视图目录\n        if(!$tmplPath){ \n            // 定义TMPL_PATH 则改变全局的视图目录到模块之外\n            $tmplPath   =   defined('TMPL_PATH')? TMPL_PATH.$module.'/' : APP_PATH.$module.'/'.C('DEFAULT_V_LAYER').'/';\n        }\n        return $tmplPath.$theme;\n    }\n\n    /**\n     * 设置当前输出的模板主题\n     * @access public\n     * @param  mixed $theme 主题名称\n     * @return View\n     */\n    public function theme($theme){\n        $this->theme = $theme;\n        return $this;\n    }\n\n    /**\n     * 获取当前的模板主题\n     * @access private\n     * @return string\n     */\n    private function getTemplateTheme() {\n        if($this->theme) { // 指定模板主题\n            $theme = $this->theme;\n        }else{\n            /* 获取模板主题名称 */\n            $theme =  C('DEFAULT_THEME');\n            if(C('TMPL_DETECT_THEME')) {// 自动侦测模板主题\n                $t = C('VAR_TEMPLATE');\n                if (isset($_GET[$t])){\n                    $theme = $_GET[$t];\n                }elseif(cookie('think_template')){\n                    $theme = cookie('think_template');\n                }\n                if(!in_array($theme,explode(',',C('THEME_LIST')))){\n                    $theme =  C('DEFAULT_THEME');\n                }\n                cookie('think_template',$theme,864000);\n            }\n        }\n        defined('THEME_NAME') || define('THEME_NAME',   $theme);                  // 当前模板主题名称\n        return $theme?$theme . '/':'';\n    }\n\n}"
  },
  {
    "path": "ThinkPHP/Mode/Lite/convention.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\n/**\n * ThinkPHP惯例配置文件\n * 该文件请不要修改，如果要覆盖惯例配置的值，可在应用配置文件中设定和惯例不符的配置项\n * 配置名称大小写任意，系统会统一转换成小写\n * 所有配置参数都可以在生效前动态改变\n */\ndefined('THINK_PATH') or exit();\nreturn  array(\n    /* 应用设定 */\n    'APP_SUB_DOMAIN_DEPLOY' =>  false,   // 是否开启子域名部署\n    'APP_SUB_DOMAIN_RULES'  =>  array(), // 子域名部署规则\n    'APP_DOMAIN_SUFFIX'     =>  '', // 域名后缀 如果是com.cn net.cn 之类的后缀必须设置    \n    'ACTION_SUFFIX'         =>  '', // 操作方法后缀\n    'MULTI_MODULE'          =>  true, // 是否允许多模块 如果为false 则必须设置 DEFAULT_MODULE\n    'MODULE_DENY_LIST'      =>  array('Common','Runtime'),\n\n    /* Cookie设置 */\n    'COOKIE_EXPIRE'         =>  0,       // Cookie有效期\n    'COOKIE_DOMAIN'         =>  '',      // Cookie有效域名\n    'COOKIE_PATH'           =>  '/',     // Cookie路径\n    'COOKIE_PREFIX'         =>  '',      // Cookie前缀 避免冲突\n    'COOKIE_SECURE'         =>  false,   // Cookie安全传输\n    'COOKIE_HTTPONLY'       =>  '',      // Cookie httponly设置\n\n    /* 默认设定 */\n    'DEFAULT_M_LAYER'       =>  'Model', // 默认的模型层名称\n    'DEFAULT_C_LAYER'       =>  'Controller', // 默认的控制器层名称\n    'DEFAULT_V_LAYER'       =>  'View', // 默认的视图层名称\n    'DEFAULT_LANG'          =>  'zh-cn', // 默认语言\n    'DEFAULT_THEME'         =>  '',\t// 默认模板主题名称\n    'DEFAULT_MODULE'        =>  'Home',  // 默认模块\n    'DEFAULT_CONTROLLER'    =>  'Index', // 默认控制器名称\n    'DEFAULT_ACTION'        =>  'index', // 默认操作名称\n    'DEFAULT_CHARSET'       =>  'utf-8', // 默认输出编码\n    'DEFAULT_TIMEZONE'      =>  'PRC',\t// 默认时区\n    'DEFAULT_AJAX_RETURN'   =>  'JSON',  // 默认AJAX 数据返回格式,可选JSON XML ...\n    'DEFAULT_JSONP_HANDLER' =>  'jsonpReturn', // 默认JSONP格式返回的处理方法\n    'DEFAULT_FILTER'        =>  'htmlspecialchars', // 默认参数过滤方法 用于I函数...\n\n    /* 数据库设置 */\n    'DB_TYPE'               =>  '',     // 数据库类型\n    'DB_HOST'               =>  '', // 服务器地址\n    'DB_NAME'               =>  '',          // 数据库名\n    'DB_USER'               =>  '',      // 用户名\n    'DB_PWD'                =>  '',          // 密码\n    'DB_PORT'               =>  '',        // 端口\n    'DB_PREFIX'             =>  '',    // 数据库表前缀\n    'DB_PARAMS'          \t=>  array(), // 数据库连接参数    \n    'DB_DEBUG'  \t\t\t=>  TRUE, // 数据库调试模式 开启后可以记录SQL日志\n    'DB_FIELDS_CACHE'       =>  true,        // 启用字段缓存\n    'DB_CHARSET'            =>  'utf8',      // 数据库编码默认采用utf8\n    'DB_DEPLOY_TYPE'        =>  0, // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)\n    'DB_RW_SEPARATE'        =>  false,       // 数据库读写是否分离 主从式有效\n    'DB_MASTER_NUM'         =>  1, // 读写分离后 主服务器数量\n    'DB_SLAVE_NO'           =>  '', // 指定从服务器序号\n\n    /* 数据缓存设置 */\n    'DATA_CACHE_TIME'       =>  0,      // 数据缓存有效期 0表示永久缓存\n    'DATA_CACHE_COMPRESS'   =>  false,   // 数据缓存是否压缩缓存\n    'DATA_CACHE_CHECK'      =>  false,   // 数据缓存是否校验缓存\n    'DATA_CACHE_PREFIX'     =>  '',     // 缓存前缀\n    'DATA_CACHE_TYPE'       =>  'File',  // 数据缓存类型,支持:File|Db|Apc|Memcache|Shmop|Sqlite|Xcache|Apachenote|Eaccelerator\n    'DATA_CACHE_PATH'       =>  TEMP_PATH,// 缓存路径设置 (仅对File方式缓存有效)\n    'DATA_CACHE_KEY'        =>  '',\t// 缓存文件KEY (仅对File方式缓存有效)    \n    'DATA_CACHE_SUBDIR'     =>  false,    // 使用子目录缓存 (自动根据缓存标识的哈希创建子目录)\n    'DATA_PATH_LEVEL'       =>  1,        // 子目录缓存级别\n\n    /* 错误设置 */\n    'ERROR_MESSAGE'         =>  '页面错误！请稍后再试～',//错误显示信息,非调试模式有效\n    'ERROR_PAGE'            =>  '',\t// 错误定向页面\n    'SHOW_ERROR_MSG'        =>  false,    // 显示错误信息\n    'TRACE_MAX_RECORD'      =>  100,    // 每个级别的错误信息 最大记录数\n\n    /* 日志设置 */\n    'LOG_RECORD'            =>  false,   // 默认不记录日志\n    'LOG_TYPE'              =>  'File', // 日志记录类型 默认为文件方式\n    'LOG_LEVEL'             =>  'EMERG,ALERT,CRIT,ERR',// 允许记录的日志级别\n    'LOG_FILE_SIZE'         =>  2097152,\t// 日志文件大小限制\n    'LOG_EXCEPTION_RECORD'  =>  false,    // 是否记录异常信息日志\n\n    /* SESSION设置 */\n    'SESSION_AUTO_START'    =>  false,    // 是否自动开启Session\n    'SESSION_OPTIONS'       =>  array(), // session 配置数组 支持type name id path expire domain 等参数\n    'SESSION_TYPE'          =>  '', // session hander类型 默认无需设置 除非扩展了session hander驱动\n    'SESSION_PREFIX'        =>  '', // session 前缀\n    //'VAR_SESSION_ID'      =>  'session_id',     //sessionID的提交变量\n\n    /* 模板引擎设置 */\n    'TMPL_CONTENT_TYPE'     =>  'text/html', // 默认模板输出类型\n    'TMPL_ACTION_ERROR'     =>  THINK_PATH.'Tpl/dispatch_jump.tpl', // 默认错误跳转对应的模板文件\n    'TMPL_ACTION_SUCCESS'   =>  THINK_PATH.'Tpl/dispatch_jump.tpl', // 默认成功跳转对应的模板文件\n    'TMPL_EXCEPTION_FILE'   =>  THINK_PATH.'Tpl/think_exception.tpl',// 异常页面的模板文件\n    'TMPL_DETECT_THEME'     =>  false,       // 自动侦测模板主题\n    'TMPL_TEMPLATE_SUFFIX'  =>  '.html',     // 默认模板文件后缀\n    'TMPL_FILE_DEPR'        =>  '/', //模板文件CONTROLLER_NAME与ACTION_NAME之间的分割符\n    // 布局设置\n    'TMPL_ENGINE_TYPE'      =>  'Think',     // 默认模板引擎 以下设置仅对使用Think模板引擎有效\n    'TMPL_CACHFILE_SUFFIX'  =>  '.php',      // 默认模板缓存后缀\n    'TMPL_DENY_FUNC_LIST'   =>  'echo,exit',    // 模板引擎禁用函数\n    'TMPL_DENY_PHP'         =>  false, // 默认模板引擎是否禁用PHP原生代码\n    'TMPL_L_DELIM'          =>  '{',            // 模板引擎普通标签开始标记\n    'TMPL_R_DELIM'          =>  '}',            // 模板引擎普通标签结束标记\n    'TMPL_VAR_IDENTIFY'     =>  'array',     // 模板变量识别。留空自动判断,参数为'obj'则表示对象\n    'TMPL_STRIP_SPACE'      =>  true,       // 是否去除模板文件里面的html空格与换行\n    'TMPL_CACHE_ON'         =>  true,        // 是否开启模板编译缓存,设为false则每次都会重新编译\n    'TMPL_CACHE_PREFIX'     =>  '',         // 模板缓存前缀标识，可以动态改变\n    'TMPL_CACHE_TIME'       =>  0,         // 模板缓存有效期 0 为永久，(以数字为值，单位:秒)\n    'TMPL_LAYOUT_ITEM'      =>  '{__CONTENT__}', // 布局模板的内容替换标识\n    'LAYOUT_ON'             =>  false, // 是否启用布局\n    'LAYOUT_NAME'           =>  'layout', // 当前布局名称 默认为layout\n\n    // Think模板引擎标签库相关设定\n    'TAGLIB_BEGIN'          =>  '<',  // 标签库标签开始标记\n    'TAGLIB_END'            =>  '>',  // 标签库标签结束标记\n    'TAGLIB_LOAD'           =>  true, // 是否使用内置标签库之外的其它标签库，默认自动检测\n    'TAGLIB_BUILD_IN'       =>  'cx', // 内置标签库名称(标签使用不必指定标签库名称),以逗号分隔 注意解析顺序\n    'TAGLIB_PRE_LOAD'       =>  '',   // 需要额外加载的标签库(须指定标签库名称)，多个以逗号分隔 \n    \n    /* URL设置 */\n    'URL_CASE_INSENSITIVE'  =>  true,   // 默认false 表示URL区分大小写 true则表示不区分大小写\n    'URL_MODEL'             =>  1,       // URL访问模式,可选参数0、1、2、3,代表以下四种模式：\n    // 0 (普通模式); 1 (PATHINFO 模式); 2 (REWRITE  模式); 3 (兼容模式)  默认为PATHINFO 模式\n    'URL_PATHINFO_DEPR'     =>  '/',\t// PATHINFO模式下，各参数之间的分割符号\n    'URL_PATHINFO_FETCH'    =>  'ORIG_PATH_INFO,REDIRECT_PATH_INFO,REDIRECT_URL', // 用于兼容判断PATH_INFO 参数的SERVER替代变量列表\n    'URL_REQUEST_URI'       =>  'REQUEST_URI', // 获取当前页面地址的系统变量 默认为REQUEST_URI\n    'URL_HTML_SUFFIX'       =>  'html',  // URL伪静态后缀设置\n    'URL_DENY_SUFFIX'       =>  'ico|png|gif|jpg', // URL禁止访问的后缀设置\n    'URL_PARAMS_BIND'       =>  true, // URL变量绑定到Action方法参数\n    'URL_PARAMS_BIND_TYPE'  =>  0, // URL变量绑定的类型 0 按变量名绑定 1 按变量顺序绑定\n    'URL_PARAMS_FILTER'     =>  false, // URL变量绑定过滤\n    'URL_PARAMS_FILTER_TYPE'=>  '', // URL变量绑定过滤方法 如果为空 调用DEFAULT_FILTER\n    'URL_ROUTER_ON'         =>  false,   // 是否开启URL路由\n    'URL_ROUTE_RULES'       =>  array(), // 默认路由规则 针对模块\n    'URL_MAP_RULES'         =>  array(), // URL映射定义规则\n\n    /* 系统变量名称设置 */\n    'VAR_MODULE'            =>  'm',     // 默认模块获取变量\n    'VAR_ADDON'             =>  'addon',     // 默认的插件控制器命名空间变量\n    'VAR_CONTROLLER'        =>  'c',    // 默认控制器获取变量\n    'VAR_ACTION'            =>  'a',    // 默认操作获取变量\n    'VAR_AJAX_SUBMIT'       =>  'ajax',  // 默认的AJAX提交变量\n    'VAR_JSONP_HANDLER'     =>  'callback',\n    'VAR_PATHINFO'          =>  's',    // 兼容模式PATHINFO获取变量例如 ?s=/module/action/id/1 后面的参数取决于URL_PATHINFO_DEPR\n    'VAR_TEMPLATE'          =>  't',    // 默认模板切换变量\n    'VAR_AUTO_STRING'\t\t=>\tfalse,\t// 输入变量是否自动强制转换为字符串 如果开启则数组变量需要手动传入变量修饰符获取变量\n\n    'HTTP_CACHE_CONTROL'    =>  'private',  // 网页缓存控制\n    'CHECK_APP_DIR'         =>  true,       // 是否检查应用目录是否创建\n    'FILE_UPLOAD_TYPE'      =>  'Local',    // 文件上传方式\n    'DATA_CRYPT_TYPE'       =>  'Think',    // 数据加密方式\n\n);\n"
  },
  {
    "path": "ThinkPHP/Mode/Lite/functions.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\n/**\n * Think 系统函数库\n */\n\n/**\n * 获取和设置配置参数 支持批量定义\n * @param string|array $name 配置变量\n * @param mixed $value 配置值\n * @param mixed $default 默认值\n * @return mixed\n */\nfunction C($name=null, $value=null,$default=null) {\n    static $_config = array();\n    // 无参数时获取所有\n    if (empty($name)) {\n        return $_config;\n    }\n    // 优先执行设置获取或赋值\n    if (is_string($name)) {\n        if (!strpos($name, '.')) {\n            $name = strtoupper($name);\n            if (is_null($value))\n                return isset($_config[$name]) ? $_config[$name] : $default;\n            $_config[$name] = $value;\n            return null;\n        }\n        // 二维数组设置和获取支持\n        $name = explode('.', $name);\n        $name[0]   =  strtoupper($name[0]);\n        if (is_null($value))\n            return isset($_config[$name[0]][$name[1]]) ? $_config[$name[0]][$name[1]] : $default;\n        $_config[$name[0]][$name[1]] = $value;\n        return null;\n    }\n    // 批量设置\n    if (is_array($name)){\n        $_config = array_merge($_config, array_change_key_case($name,CASE_UPPER));\n        return null;\n    }\n    return null; // 避免非法参数\n}\n\n/**\n * 加载配置文件 支持格式转换 仅支持一级配置\n * @param string $file 配置文件名\n * @param string $parse 配置解析方法 有些格式需要用户自己解析\n * @return array\n */\nfunction load_config($file,$parse=CONF_PARSE){\n    $ext  = pathinfo($file,PATHINFO_EXTENSION);\n    switch($ext){\n        case 'php':\n            return include $file;\n        case 'ini':\n            return parse_ini_file($file);\n        case 'yaml':\n            return yaml_parse_file($file);\n        case 'xml': \n            return (array)simplexml_load_file($file);\n        case 'json':\n            return json_decode(file_get_contents($file), true);\n        default:\n            if(function_exists($parse)){\n                return $parse($file);\n            }else{\n                E(L('_NOT_SUPPORT_').':'.$ext);\n            }\n    }\n}\n\n/**\n * 解析yaml文件返回一个数组\n * @param string $file 配置文件名\n * @return array\n */\nif (!function_exists('yaml_parse_file')) {\n    function yaml_parse_file($file) {\n        vendor('spyc.Spyc');\n        return Spyc::YAMLLoad($file);\n    }\n}\n\n/**\n * 抛出异常处理\n * @param string $msg 异常消息\n * @param integer $code 异常代码 默认为0\n * @throws Think\\Exception\n * @return void\n */\nfunction E($msg, $code=0) {\n    throw new Think\\Exception($msg, $code);\n}\n\n/**\n * 记录和统计时间（微秒）和内存使用情况\n * 使用方法:\n * <code>\n * G('begin'); // 记录开始标记位\n * // ... 区间运行代码\n * G('end'); // 记录结束标签位\n * echo G('begin','end',6); // 统计区间运行时间 精确到小数后6位\n * echo G('begin','end','m'); // 统计区间内存使用情况\n * 如果end标记位没有定义，则会自动以当前作为标记位\n * 其中统计内存使用需要 MEMORY_LIMIT_ON 常量为true才有效\n * </code>\n * @param string $start 开始标签\n * @param string $end 结束标签\n * @param integer|string $dec 小数位或者m\n * @return mixed\n */\nfunction G($start,$end='',$dec=4) {\n    static $_info       =   array();\n    static $_mem        =   array();\n    if(is_float($end)) { // 记录时间\n        $_info[$start]  =   $end;\n    }elseif(!empty($end)){ // 统计时间和内存使用\n        if(!isset($_info[$end])) {\n            $_info[$end]       =  microtime(true);\n        }\n        if($dec=='m'){\n            if(!isset($_mem[$end])) $_mem[$end]     =  memory_get_usage();\n            return number_format(($_mem[$end]-$_mem[$start])/1024);\n        }else{\n            return number_format(($_info[$end]-$_info[$start]),$dec);\n        }\n\n    }else{ // 记录时间和内存使用\n        $_info[$start]  =  microtime(true);\n        $_mem[$start]   =  memory_get_usage();\n    }\n    return null;\n}\n\n/**\n * 获取和设置语言定义(不区分大小写)\n * @param string|array $name 语言变量\n * @param mixed $value 语言值或者变量\n * @return mixed\n */\nfunction L($name=null, $value=null) {\n    static $_lang = array();\n    // 空参数返回所有定义\n    if (empty($name)){\n        return $_lang;\n    }\n    // 判断语言获取(或设置)\n    // 若不存在,直接返回全大写$name\n    if (is_string($name)) {\n        $name   =   strtoupper($name);\n        if (is_null($value)){\n            return isset($_lang[$name]) ? $_lang[$name] : $name;\n        }elseif(is_array($value)){\n            // 支持变量\n            $replace = array_keys($value);\n            foreach($replace as &$v){\n                $v = '{$'.$v.'}';\n            }\n            return str_replace($replace,$value,isset($_lang[$name]) ? $_lang[$name] : $name);        \n        }\n        $_lang[$name] = $value; // 语言定义\n        return null;\n    }\n    // 批量定义\n    if (is_array($name)){\n        $_lang = array_merge($_lang, array_change_key_case($name, CASE_UPPER));\n    }\n    return null;\n}\n\n/**\n * 添加和获取页面Trace记录\n * @param string $value 变量\n * @param string $label 标签\n * @param string $level 日志级别\n * @param boolean $record 是否记录日志\n * @return void|array\n */\nfunction trace($value='[think]',$label='',$level='DEBUG',$record=false) {\n    return Think\\Think::trace($value,$label,$level,$record);\n}\n\n/**\n * 编译文件\n * @param string $filename 文件名\n * @return string\n */\nfunction compile($filename) {\n    $content    =   php_strip_whitespace($filename);\n    $content    =   trim(substr($content, 5));\n    // 替换预编译指令\n    $content    =   preg_replace('/\\/\\/\\[RUNTIME\\](.*?)\\/\\/\\[\\/RUNTIME\\]/s', '', $content);\n    if(0===strpos($content,'namespace')){\n        $content    =   preg_replace('/namespace\\s(.*?);/','namespace \\\\1{',$content,1);\n    }else{\n        $content    =   'namespace {'.$content;\n    }\n    if ('?>' == substr($content, -2)){\n        $content    = substr($content, 0, -2);\n    }\n    return $content.'}';\n}\n\n/**\n * 获取模版文件 格式 资源://模块@主题/控制器/操作\n * @param string $template 模版资源地址\n * @param string $layer 视图层（目录）名称\n * @return string\n */\nfunction T($template='',$layer=''){\n\n    // 解析模版资源地址\n    if(false === strpos($template,'://')){\n        $template   =   'http://'.str_replace(':', '/',$template);\n    }\n    $info   =   parse_url($template);\n    $file   =   $info['host'].(isset($info['path'])?$info['path']:'');\n    $module =   isset($info['user'])?$info['user'].'/':MODULE_NAME.'/';\n    $extend =   $info['scheme'];\n    $layer  =   $layer?$layer:C('DEFAULT_V_LAYER');\n\n    // 获取当前主题的模版路径\n    $auto   =   C('AUTOLOAD_NAMESPACE');\n    if($auto && isset($auto[$extend])){ // 扩展资源\n        $baseUrl    =   $auto[$extend].$module.$layer.'/';\n    }elseif(C('VIEW_PATH')){ \n        // 改变模块视图目录\n        $baseUrl    =   C('VIEW_PATH');\n    }elseif(defined('TMPL_PATH')){ \n        // 指定全局视图目录\n        $baseUrl    =   TMPL_PATH.$module;\n    }else{\n        $baseUrl    =   APP_PATH.$module.$layer.'/';\n    }\n\n    // 获取主题\n    $theme  =   substr_count($file,'/')<2 ? C('DEFAULT_THEME') : '';\n\n    // 分析模板文件规则\n    $depr   =   C('TMPL_FILE_DEPR');\n    if('' == $file) {\n        // 如果模板文件名为空 按照默认规则定位\n        $file = CONTROLLER_NAME . $depr . ACTION_NAME;\n    }elseif(false === strpos($file, '/')){\n        $file = CONTROLLER_NAME . $depr . $file;\n    }elseif('/' != $depr){\n        $file   =   substr_count($file,'/')>1 ? substr_replace($file,$depr,strrpos($file,'/'),1) : str_replace('/', $depr, $file);\n    }\n    return $baseUrl.($theme?$theme.'/':'').$file.C('TMPL_TEMPLATE_SUFFIX');\n}\n\n/**\n * 获取输入参数 支持过滤和默认值\n * 使用方法:\n * <code>\n * I('id',0); 获取id参数 自动判断get或者post\n * I('post.name','','htmlspecialchars'); 获取$_POST['name']\n * I('get.'); 获取$_GET\n * </code>\n * @param string $name 变量的名称 支持指定类型\n * @param mixed $default 不存在的时候默认值\n * @param mixed $filter 参数过滤方法\n * @param mixed $datas 要获取的额外数据源\n * @return mixed\n */\nfunction I($name,$default='',$filter=null,$datas=null) {\n\tif(strpos($name,'/')){ // 指定修饰符\n\t\tlist($name,$type) \t=\texplode('/',$name,2);\n\t}elseif(C('VAR_AUTO_STRING')){ // 默认强制转换为字符串\n        $type   =   's';\n    }\n    if(strpos($name,'.')) { // 指定参数来源\n        list($method,$name) =   explode('.',$name,2);\n    }else{ // 默认为自动判断\n        $method =   'param';\n    }\n    switch(strtolower($method)) {\n        case 'get'     :   $input =& $_GET;break;\n        case 'post'    :   $input =& $_POST;break;\n        case 'put'     :   parse_str(file_get_contents('php://input'), $input);break;\n        case 'param'   :\n            switch($_SERVER['REQUEST_METHOD']) {\n                case 'POST':\n                    $input  =  $_POST;\n                    break;\n                case 'PUT':\n                    parse_str(file_get_contents('php://input'), $input);\n                    break;\n                default:\n                    $input  =  $_GET;\n            }\n            break;\n        case 'path'    :   \n            $input  =   array();\n            if(!empty($_SERVER['PATH_INFO'])){\n                $depr   =   C('URL_PATHINFO_DEPR');\n                $input  =   explode($depr,trim($_SERVER['PATH_INFO'],$depr));            \n            }\n            break;\n        case 'request' :   $input =& $_REQUEST;   break;\n        case 'session' :   $input =& $_SESSION;   break;\n        case 'cookie'  :   $input =& $_COOKIE;    break;\n        case 'server'  :   $input =& $_SERVER;    break;\n        case 'globals' :   $input =& $GLOBALS;    break;\n        case 'data'    :   $input =& $datas;      break;\n        default:\n            return NULL;\n    }\n    if(''==$name) { // 获取全部变量\n        $data       =   $input;\n        $filters    =   isset($filter)?$filter:C('DEFAULT_FILTER');\n        if($filters) {\n            if(is_string($filters)){\n                $filters    =   explode(',',$filters);\n            }\n            foreach($filters as $filter){\n                $data   =   array_map_recursive($filter,$data); // 参数过滤\n            }\n        }\n    }elseif(isset($input[$name])) { // 取值操作\n        $data       =   $input[$name];\n        $filters    =   isset($filter)?$filter:C('DEFAULT_FILTER');\n        if($filters) {\n            if(is_string($filters)){\n                $filters    =   explode(',',$filters);\n            }elseif(is_int($filters)){\n                $filters    =   array($filters);\n            }\n            \n            foreach($filters as $filter){\n                if(function_exists($filter)) {\n                    $data   =   is_array($data) ? array_map_recursive($filter,$data) : $filter($data); // 参数过滤\n                }elseif(0===strpos($filter,'/')){\n                \t// 支持正则验证\n                \tif(1 !== preg_match($filter,(string)$data)){\n                \t\treturn   isset($default) ? $default : NULL;\n                \t}\n                }else{\n                    $data   =   filter_var($data,is_int($filter) ? $filter : filter_id($filter));\n                    if(false === $data) {\n                        return   isset($default) ? $default : NULL;\n                    }\n                }\n            }\n        }\n        if(!empty($type)){\n        \tswitch(strtolower($type)){\n        \t\tcase 'a':\t// 数组\n        \t\t\t$data \t=\t(array)$data;\n        \t\t\tbreak;\n        \t\tcase 'd':\t// 数字\n        \t\t\t$data \t=\t(int)$data;\n        \t\t\tbreak;\n        \t\tcase 'f':\t// 浮点\n        \t\t\t$data \t=\t(float)$data;\n        \t\t\tbreak;\n        \t\tcase 'b':\t// 布尔\n        \t\t\t$data \t=\t(boolean)$data;\n        \t\t\tbreak;\n                case 's':   // 字符串\n                default:\n                    $data   =   (string)$data;\n        \t}\n        }\n    }else{ // 变量默认值\n        $data       =    isset($default)?$default:NULL;\n    }\n    is_array($data) && array_walk_recursive($data,'think_filter');\n    return $data;\n}\n\nfunction array_map_recursive($filter, $data) {\n    $result = array();\n    foreach ($data as $key => $val) {\n        $result[$key] = is_array($val)\n         ? array_map_recursive($filter, $val)\n         : call_user_func($filter, $val);\n    }\n    return $result;\n }\n\n/**\n * 设置和获取统计数据\n * 使用方法:\n * <code>\n * N('db',1); // 记录数据库操作次数\n * N('read',1); // 记录读取次数\n * echo N('db'); // 获取当前页面数据库的所有操作次数\n * echo N('read'); // 获取当前页面读取次数\n * </code>\n * @param string $key 标识位置\n * @param integer $step 步进值\n * @param boolean $save 是否保存结果\n * @return mixed\n */\nfunction N($key, $step=0,$save=false) {\n    static $_num    = array();\n    if (!isset($_num[$key])) {\n        $_num[$key] = (false !== $save)? S('N_'.$key) :  0;\n    }\n    if (empty($step)){\n        return $_num[$key];\n    }else{\n        $_num[$key] = $_num[$key] + (int)$step;\n    }\n    if(false !== $save){ // 保存结果\n        S('N_'.$key,$_num[$key],$save);\n    }\n    return null;\n}\n\n/**\n * 字符串命名风格转换\n * type 0 将Java风格转换为C的风格 1 将C风格转换为Java的风格\n * @param string $name 字符串\n * @param integer $type 转换类型\n * @return string\n */\nfunction parse_name($name, $type=0) {\n    if ($type) {\n        return ucfirst(preg_replace_callback('/_([a-zA-Z])/', function($match){return strtoupper($match[1]);}, $name));\n    } else {\n        return strtolower(trim(preg_replace(\"/[A-Z]/\", \"_\\\\0\", $name), \"_\"));\n    }\n}\n\n/**\n * 优化的require_once\n * @param string $filename 文件地址\n * @return boolean\n */\nfunction require_cache($filename) {\n    static $_importFiles = array();\n    if (!isset($_importFiles[$filename])) {\n        if (file_exists_case($filename)) {\n            require $filename;\n            $_importFiles[$filename] = true;\n        } else {\n            $_importFiles[$filename] = false;\n        }\n    }\n    return $_importFiles[$filename];\n}\n\n/**\n * 区分大小写的文件存在判断\n * @param string $filename 文件地址\n * @return boolean\n */\nfunction file_exists_case($filename) {\n    if (is_file($filename)) {\n        if (IS_WIN && APP_DEBUG) {\n            if (basename(realpath($filename)) != basename($filename))\n                return false;\n        }\n        return true;\n    }\n    return false;\n}\n\n/**\n * 导入所需的类库 同java的Import 本函数有缓存功能\n * @param string $class 类库命名空间字符串\n * @param string $baseUrl 起始路径\n * @param string $ext 导入的文件扩展名\n * @return boolean\n */\nfunction import($class, $baseUrl = '', $ext=EXT) {\n    static $_file = array();\n    $class = str_replace(array('.', '#'), array('/', '.'), $class);\n    if (isset($_file[$class . $baseUrl]))\n        return true;\n    else\n        $_file[$class . $baseUrl] = true;\n    $class_strut     = explode('/', $class);\n    if (empty($baseUrl)) {\n        if ('@' == $class_strut[0] || MODULE_NAME == $class_strut[0]) {\n            //加载当前模块的类库\n            $baseUrl = MODULE_PATH;\n            $class   = substr_replace($class, '', 0, strlen($class_strut[0]) + 1);\n        }elseif ('Common' == $class_strut[0]) {\n            //加载公共模块的类库\n            $baseUrl = COMMON_PATH;\n            $class   = substr($class, 7);\n        }elseif (in_array($class_strut[0],array('Think','Org','Behavior','Com','Vendor')) || is_dir(LIB_PATH.$class_strut[0])) {\n            // 系统类库包和第三方类库包\n            $baseUrl = LIB_PATH;\n        }else { // 加载其他模块的类库\n            $baseUrl = APP_PATH;\n        }\n    }\n    if (substr($baseUrl, -1) != '/')\n        $baseUrl    .= '/';\n    $classfile       = $baseUrl . $class . $ext;\n    if (!class_exists(basename($class),false)) {\n        // 如果类不存在 则导入类库文件\n        return require_cache($classfile);\n    }\n    return null;\n}\n\n/**\n * 基于命名空间方式导入函数库\n * load('@.Util.Array')\n * @param string $name 函数库命名空间字符串\n * @param string $baseUrl 起始路径\n * @param string $ext 导入的文件扩展名\n * @return void\n */\nfunction load($name, $baseUrl='', $ext='.php') {\n    $name = str_replace(array('.', '#'), array('/', '.'), $name);\n    if (empty($baseUrl)) {\n        if (0 === strpos($name, '@/')) {//加载当前模块函数库\n            $baseUrl    =   MODULE_PATH.'Common/';\n            $name       =   substr($name, 2);\n        } else { //加载其他模块函数库\n            $array      =   explode('/', $name);\n            $baseUrl    =   APP_PATH . array_shift($array).'/Common/';\n            $name       =   implode('/',$array);\n        }\n    }\n    if (substr($baseUrl, -1) != '/'){\n        $baseUrl       .= '/';\n    }\n    require_cache($baseUrl . $name . $ext);\n}\n\n/**\n * 快速导入第三方框架类库 所有第三方框架的类库文件统一放到 系统的Vendor目录下面\n * @param string $class 类库\n * @param string $baseUrl 基础目录\n * @param string $ext 类库后缀\n * @return boolean\n */\nfunction vendor($class, $baseUrl = '', $ext='.php') {\n    if (empty($baseUrl)){\n        $baseUrl = VENDOR_PATH;\n    }\n    return import($class, $baseUrl, $ext);\n}\n\n/**\n * 实例化模型类 格式 [资源://][模块/]模型\n * @param string $name 资源地址\n * @param string $layer 模型层名称\n * @return Think\\Model\n */\nfunction D($name='',$layer='') {\n    if(empty($name)) return new Think\\Model;\n    static $_model  =   array();\n    $layer          =   $layer? : 'Model';\n    if(isset($_model[$name.$layer])){\n        return $_model[$name.$layer];\n    }\n    $class          =   parse_res_name($name,$layer);\n    if(class_exists($class)) {\n        $model      =   new $class(basename($name));\n    }elseif(false === strpos($name,'/')){\n        // 自动加载公共模块下面的模型\n        $class      =   '\\\\Common\\\\'.$layer.'\\\\'.$name.$layer;\n        $model      =   class_exists($class)? new $class($name) : new Think\\Model($name);\n    }else {\n        $model      =   new Think\\Model(basename($name));\n    }\n    $_model[$name.$layer]  =  $model;\n    return $model;\n}\n\n/**\n * 实例化一个没有模型文件的Model\n * @param string $name Model名称 支持指定基础模型 例如 MongoModel:User\n * @param string $tablePrefix 表前缀\n * @param mixed $connection 数据库连接信息\n * @return Think\\Model\n */\nfunction M($name='', $tablePrefix='',$connection='') {\n    static $_model  = array();\n    if(strpos($name,':')) {\n        list($class,$name)    =  explode(':',$name);\n    }else{\n        $class      =   'Think\\\\Model';\n    }\n    $guid           =   (is_array($connection)?implode('',$connection):$connection).$tablePrefix . $name . '_' . $class;\n    if (!isset($_model[$guid])){\n        $_model[$guid] = new $class($name,$tablePrefix,$connection);\n    }\n    return $_model[$guid];\n}\n\n/**\n * 解析资源地址并导入类库文件\n * 例如 module/controller addon://module/behavior\n * @param string $name 资源地址 格式：[扩展://][模块/]资源名\n * @param string $layer 分层名称\n * @return string\n */\nfunction parse_res_name($name,$layer){\n    if(strpos($name,'://')) {// 指定扩展资源\n        list($extend,$name)  =   explode('://',$name);\n    }else{\n        $extend  =   '';\n    }\n    if(strpos($name,'/')){ // 指定模块\n        list($module,$name) =  explode('/',$name,2);\n    }else{\n        $module =   defined('MODULE_NAME') ? MODULE_NAME : '' ;\n    }\n    $array  =   explode('/',$name);\n    $class  =   $module.'\\\\'.$layer;\n    foreach($array as $name){\n        $class  .=   '\\\\'.parse_name($name, 1);\n    }\n    // 导入资源类库\n    if($extend){ // 扩展资源\n        $class      =   $extend.'\\\\'.$class;\n    }\n\n    return $class.$layer;\n}\n\n/**\n * 用于实例化访问控制器\n * @param string $name 控制器名\n * @return Think\\Controller|false\n */\nfunction controller($name){\n    $class  =   MODULE_NAME .'\\\\Controller';\n    $array  =   explode('/',$name);\n    foreach($array as $name){\n        $class  .=   '\\\\'.parse_name($name, 1);\n    }\n    $class .=   $layer;\n\n    if(class_exists($class)) {\n        return new $class();\n    }else {\n        return false;\n    }\n}\n\n/**\n * 实例化多层控制器 格式：[资源://][模块/]控制器\n * @param string $name 资源地址\n * @param string $layer 控制层名称\n * @return Think\\Controller|false\n */\nfunction A($name,$layer='') {\n    static $_action = array();\n    $layer  =   $layer? : 'Controller';\n    if(isset($_action[$name.$layer])){\n        return $_action[$name.$layer];\n    }\n    \n    $class  =   parse_res_name($name,$layer);\n    if(class_exists($class)) {\n        $action             =   new $class();\n        $_action[$name.$layer]     =   $action;\n        return $action;\n    }else {\n        return false;\n    }\n}\n\n\n/**\n * 远程调用控制器的操作方法 URL 参数格式 [资源://][模块/]控制器/操作\n * @param string $url 调用地址\n * @param string|array $vars 调用参数 支持字符串和数组\n * @param string $layer 要调用的控制层名称\n * @return mixed\n */\nfunction R($url,$vars=array(),$layer='') {\n    $info   =   pathinfo($url);\n    $action =   $info['basename'];\n    $module =   $info['dirname'];\n    $class  =   A($module,$layer);\n    if($class){\n        if(is_string($vars)) {\n            parse_str($vars,$vars);\n        }\n        return call_user_func_array(array(&$class,$action.C('ACTION_SUFFIX')),$vars);\n    }else{\n        return false;\n    }\n}\n\n/**\n * 处理标签扩展\n * @param string $tag 标签名称\n * @param mixed $params 传入参数\n * @return void\n */\nfunction tag($tag, &$params=NULL) {\n    \\Think\\Hook::listen($tag,$params);\n}\n\n/**\n * 执行某个行为\n * @param string $name 行为名称\n * @param string $tag 标签名称（行为类无需传入） \n * @param Mixed $params 传入的参数\n * @return void\n */\nfunction B($name, $tag='',&$params=NULL) {\n    if(''==$tag){\n        $name   .=  'Behavior';\n    }\n    return \\Think\\Hook::exec($name,$tag,$params);\n}\n\n/**\n * 去除代码中的空白和注释\n * @param string $content 代码内容\n * @return string\n */\nfunction strip_whitespace($content) {\n    $stripStr   = '';\n    //分析php源码\n    $tokens     = token_get_all($content);\n    $last_space = false;\n    for ($i = 0, $j = count($tokens); $i < $j; $i++) {\n        if (is_string($tokens[$i])) {\n            $last_space = false;\n            $stripStr  .= $tokens[$i];\n        } else {\n            switch ($tokens[$i][0]) {\n                //过滤各种PHP注释\n                case T_COMMENT:\n                case T_DOC_COMMENT:\n                    break;\n                //过滤空格\n                case T_WHITESPACE:\n                    if (!$last_space) {\n                        $stripStr  .= ' ';\n                        $last_space = true;\n                    }\n                    break;\n                case T_START_HEREDOC:\n                    $stripStr .= \"<<<THINK\\n\";\n                    break;\n                case T_END_HEREDOC:\n                    $stripStr .= \"THINK;\\n\";\n                    for($k = $i+1; $k < $j; $k++) {\n                        if(is_string($tokens[$k]) && $tokens[$k] == ';') {\n                            $i = $k;\n                            break;\n                        } else if($tokens[$k][0] == T_CLOSE_TAG) {\n                            break;\n                        }\n                    }\n                    break;\n                default:\n                    $last_space = false;\n                    $stripStr  .= $tokens[$i][1];\n            }\n        }\n    }\n    return $stripStr;\n}\n\n/**\n * 浏览器友好的变量输出\n * @param mixed $var 变量\n * @param boolean $echo 是否输出 默认为True 如果为false 则返回输出字符串\n * @param string $label 标签 默认为空\n * @param boolean $strict 是否严谨 默认为true\n * @return void|string\n */\nfunction dump($var, $echo=true, $label=null, $strict=true) {\n    $label = ($label === null) ? '' : rtrim($label) . ' ';\n    if (!$strict) {\n        if (ini_get('html_errors')) {\n            $output = print_r($var, true);\n            $output = '<pre>' . $label . htmlspecialchars($output, ENT_QUOTES) . '</pre>';\n        } else {\n            $output = $label . print_r($var, true);\n        }\n    } else {\n        ob_start();\n        var_dump($var);\n        $output = ob_get_clean();\n        if (!extension_loaded('xdebug')) {\n            $output = preg_replace('/\\]\\=\\>\\n(\\s+)/m', '] => ', $output);\n            $output = '<pre>' . $label . htmlspecialchars($output, ENT_QUOTES) . '</pre>';\n        }\n    }\n    if ($echo) {\n        echo($output);\n        return null;\n    }else\n        return $output;\n}\n\n/**\n * 设置当前页面的布局\n * @param string|false $layout 布局名称 为false的时候表示关闭布局\n * @return void\n */\nfunction layout($layout) {\n    if(false !== $layout) {\n        // 开启布局\n        C('LAYOUT_ON',true);\n        if(is_string($layout)) { // 设置新的布局模板\n            C('LAYOUT_NAME',$layout);\n        }\n    }else{// 临时关闭布局\n        C('LAYOUT_ON',false);\n    }\n}\n\n/**\n * URL组装 支持不同URL模式\n * @param string $url URL表达式，格式：'[模块/控制器/操作#锚点@域名]?参数1=值1&参数2=值2...'\n * @param string|array $vars 传入的参数，支持数组和字符串\n * @param string|boolean $suffix 伪静态后缀，默认为true表示获取配置值\n * @param boolean $domain 是否显示域名\n * @return string\n */\nfunction U($url='',$vars='',$suffix=true,$domain=false) {\n    // 解析URL\n    $info   =  parse_url($url);\n    $url    =  !empty($info['path'])?$info['path']:ACTION_NAME;\n    if(isset($info['fragment'])) { // 解析锚点\n        $anchor =   $info['fragment'];\n        if(false !== strpos($anchor,'?')) { // 解析参数\n            list($anchor,$info['query']) = explode('?',$anchor,2);\n        }        \n        if(false !== strpos($anchor,'@')) { // 解析域名\n            list($anchor,$host)    =   explode('@',$anchor, 2);\n        }\n    }elseif(false !== strpos($url,'@')) { // 解析域名\n        list($url,$host)    =   explode('@',$info['path'], 2);\n    }\n    // 解析子域名\n    if(isset($host)) {\n        $domain = $host.(strpos($host,'.')?'':strstr($_SERVER['HTTP_HOST'],'.'));\n    }elseif($domain===true){\n        $domain = $_SERVER['HTTP_HOST'];\n        if(C('APP_SUB_DOMAIN_DEPLOY') ) { // 开启子域名部署\n            $domain = $domain=='localhost'?'localhost':'www'.strstr($_SERVER['HTTP_HOST'],'.');\n            // '子域名'=>array('模块[/控制器]');\n            foreach (C('APP_SUB_DOMAIN_RULES') as $key => $rule) {\n                $rule   =   is_array($rule)?$rule[0]:$rule;\n                if(false === strpos($key,'*') && 0=== strpos($url,$rule)) {\n                    $domain = $key.strstr($domain,'.'); // 生成对应子域名\n                    $url    =  substr_replace($url,'',0,strlen($rule));\n                    break;\n                }\n            }\n        }\n    }\n\n    // 解析参数\n    if(is_string($vars)) { // aaa=1&bbb=2 转换成数组\n        parse_str($vars,$vars);\n    }elseif(!is_array($vars)){\n        $vars = array();\n    }\n    if(isset($info['query'])) { // 解析地址里面参数 合并到vars\n        parse_str($info['query'],$params);\n        $vars = array_merge($params,$vars);\n    }\n    \n    // URL组装\n    $depr       =   C('URL_PATHINFO_DEPR');\n    $urlCase    =   C('URL_CASE_INSENSITIVE');\n    if($url) {\n        if(0=== strpos($url,'/')) {// 定义路由\n            $route      =   true;\n            $url        =   substr($url,1);\n            if('/' != $depr) {\n                $url    =   str_replace('/',$depr,$url);\n            }\n        }else{\n            if('/' != $depr) { // 安全替换\n                $url    =   str_replace('/',$depr,$url);\n            }\n            // 解析模块、控制器和操作\n            $url        =   trim($url,$depr);\n            $path       =   explode($depr,$url);\n            $var        =   array();\n            $varModule      =   C('VAR_MODULE');\n            $varController  =   C('VAR_CONTROLLER');\n            $varAction      =   C('VAR_ACTION');\n            $var[$varAction]       =   !empty($path)?array_pop($path):ACTION_NAME;\n            $var[$varController]   =   !empty($path)?array_pop($path):CONTROLLER_NAME;\n            if($urlCase) {\n                $var[$varController]   =   parse_name($var[$varController]);\n            }\n            $module =   '';\n            \n            if(!empty($path)) {\n                $var[$varModule]    =   implode($depr,$path);\n            }else{\n                if(C('MULTI_MODULE')) {\n                    if(MODULE_NAME != C('DEFAULT_MODULE') || !C('MODULE_ALLOW_LIST')){\n                        $var[$varModule]=   MODULE_NAME;\n                    }\n                }\n            }\n            if($maps = C('URL_MODULE_MAP')) {\n                if($_module = array_search(strtolower($var[$varModule]),$maps)){\n                    $var[$varModule] = $_module;\n                }\n            }\n            if(isset($var[$varModule])){\n                $module =   $var[$varModule];\n                unset($var[$varModule]);\n            }\n            \n        }\n    }\n\n    if(C('URL_MODEL') == 0) { // 普通模式URL转换\n        $url        =   __APP__.'?'.C('VAR_MODULE').\"={$module}&\".http_build_query(array_reverse($var));\n        if($urlCase){\n            $url    =   strtolower($url);\n        }        \n        if(!empty($vars)) {\n            $vars   =   http_build_query($vars);\n            $url   .=   '&'.$vars;\n        }\n    }else{ // PATHINFO模式或者兼容URL模式\n        if(isset($route)) {\n            $url    =   __APP__.'/'.rtrim($url,$depr);\n        }else{\n            $module =   (defined('BIND_MODULE') && BIND_MODULE==$module )? '' : $module;\n            $url    =   __APP__.'/'.($module?$module.MODULE_PATHINFO_DEPR:'').implode($depr,array_reverse($var));\n        }\n        if($urlCase){\n            $url    =   strtolower($url);\n        }\n        if(!empty($vars)) { // 添加参数\n            foreach ($vars as $var => $val){\n                if('' !== trim($val))   $url .= $depr . $var . $depr . urlencode($val);\n            }                \n        }\n        if($suffix) {\n            $suffix   =  $suffix===true?C('URL_HTML_SUFFIX'):$suffix;\n            if($pos = strpos($suffix, '|')){\n                $suffix = substr($suffix, 0, $pos);\n            }\n            if($suffix && '/' != substr($url,-1)){\n                $url  .=  '.'.ltrim($suffix,'.');\n            }\n        }\n    }\n    if(isset($anchor)){\n        $url  .= '#'.$anchor;\n    }\n    if($domain) {\n        $url   =  (is_ssl()?'https://':'http://').$domain.$url;\n    }\n    return $url;\n}\n\n/**\n * 渲染输出Widget\n * @param string $name Widget名称\n * @param array $data 传入的参数\n * @return void\n */\nfunction W($name, $data=array()) {\n    return R($name,$data,'Widget');\n}\n\n/**\n * 判断是否SSL协议\n * @return boolean\n */\nfunction is_ssl() {\n    if(isset($_SERVER['HTTPS']) && ('1' == $_SERVER['HTTPS'] || 'on' == strtolower($_SERVER['HTTPS']))){\n        return true;\n    }elseif(isset($_SERVER['SERVER_PORT']) && ('443' == $_SERVER['SERVER_PORT'] )) {\n        return true;\n    }\n    return false;\n}\n\n/**\n * URL重定向\n * @param string $url 重定向的URL地址\n * @param integer $time 重定向的等待时间（秒）\n * @param string $msg 重定向前的提示信息\n * @return void\n */\nfunction redirect($url, $time=0, $msg='') {\n    //多行URL地址支持\n    $url        = str_replace(array(\"\\n\", \"\\r\"), '', $url);\n    if (empty($msg))\n        $msg    = \"系统将在{$time}秒之后自动跳转到{$url}！\";\n    if (!headers_sent()) {\n        // redirect\n        if (0 === $time) {\n            header('Location: ' . $url);\n        } else {\n            header(\"refresh:{$time};url={$url}\");\n            echo($msg);\n        }\n        exit();\n    } else {\n        $str    = \"<meta http-equiv='Refresh' content='{$time};URL={$url}'>\";\n        if ($time != 0)\n            $str .= $msg;\n        exit($str);\n    }\n}\n\n/**\n * 缓存管理\n * @param mixed $name 缓存名称，如果为数组表示进行缓存设置\n * @param mixed $value 缓存值\n * @param mixed $options 缓存参数\n * @return mixed\n */\nfunction S($name,$value='',$options=null) {\n    static $cache   =   '';\n    if(is_array($options) && empty($cache)){\n        // 缓存操作的同时初始化\n        $type       =   isset($options['type'])?$options['type']:'';\n        $cache      =   Think\\Cache::getInstance($type,$options);\n    }elseif(is_array($name)) { // 缓存初始化\n        $type       =   isset($name['type'])?$name['type']:'';\n        $cache      =   Think\\Cache::getInstance($type,$name);\n        return $cache;\n    }elseif(empty($cache)) { // 自动初始化\n        $cache      =   Think\\Cache::getInstance();\n    }\n    if(''=== $value){ // 获取缓存\n        return $cache->get($name);\n    }elseif(is_null($value)) { // 删除缓存\n        return $cache->rm($name);\n    }else { // 缓存数据\n        if(is_array($options)) {\n            $expire     =   isset($options['expire'])?$options['expire']:NULL;\n        }else{\n            $expire     =   is_numeric($options)?$options:NULL;\n        }\n        return $cache->set($name, $value, $expire);\n    }\n}\n\n/**\n * 快速文件数据读取和保存 针对简单类型数据 字符串、数组\n * @param string $name 缓存名称\n * @param mixed $value 缓存值\n * @param string $path 缓存路径\n * @return mixed\n */\nfunction F($name, $value='', $path=DATA_PATH) {\n    static $_cache  =   array();\n    $filename       =   $path . $name . '.php';\n    if ('' !== $value) {\n        if (is_null($value)) {\n            // 删除缓存\n            if(false !== strpos($name,'*')){\n                return false; // TODO \n            }else{\n                unset($_cache[$name]);\n                return Think\\Storage::unlink($filename,'F');\n            }\n        } else {\n            Think\\Storage::put($filename,serialize($value),'F');\n            // 缓存数据\n            $_cache[$name]  =   $value;\n            return null;\n        }\n    }\n    // 获取缓存数据\n    if (isset($_cache[$name]))\n        return $_cache[$name];\n    if (Think\\Storage::has($filename,'F')){\n        $value      =   unserialize(Think\\Storage::read($filename,'F'));\n        $_cache[$name]  =   $value;\n    } else {\n        $value          =   false;\n    }\n    return $value;\n}\n\n/**\n * 根据PHP各种类型变量生成唯一标识号\n * @param mixed $mix 变量\n * @return string\n */\nfunction to_guid_string($mix) {\n    if (is_object($mix)) {\n        return spl_object_hash($mix);\n    } elseif (is_resource($mix)) {\n        $mix = get_resource_type($mix) . strval($mix);\n    } else {\n        $mix = serialize($mix);\n    }\n    return md5($mix);\n}\n\n/**\n * session管理函数\n * @param string|array $name session名称 如果为数组则表示进行session设置\n * @param mixed $value session值\n * @return mixed\n */\nfunction session($name='',$value='') {\n    $prefix   =  C('SESSION_PREFIX');\n    if(is_array($name)) { // session初始化 在session_start 之前调用\n        if(isset($name['prefix'])) C('SESSION_PREFIX',$name['prefix']);\n        if(C('VAR_SESSION_ID') && isset($_REQUEST[C('VAR_SESSION_ID')])){\n            session_id($_REQUEST[C('VAR_SESSION_ID')]);\n        }elseif(isset($name['id'])) {\n            session_id($name['id']);\n        }\n        if('common' != APP_MODE){ // 其它模式可能不支持\n            ini_set('session.auto_start', 0);\n        }\n        if(isset($name['name']))            session_name($name['name']);\n        if(isset($name['path']))            session_save_path($name['path']);\n        if(isset($name['domain']))          ini_set('session.cookie_domain', $name['domain']);\n        if(isset($name['expire']))          ini_set('session.gc_maxlifetime', $name['expire']);\n        if(isset($name['use_trans_sid']))   ini_set('session.use_trans_sid', $name['use_trans_sid']?1:0);\n        if(isset($name['use_cookies']))     ini_set('session.use_cookies', $name['use_cookies']?1:0);\n        if(isset($name['cache_limiter']))   session_cache_limiter($name['cache_limiter']);\n        if(isset($name['cache_expire']))    session_cache_expire($name['cache_expire']);\n        if(isset($name['type']))            C('SESSION_TYPE',$name['type']);\n        if(C('SESSION_TYPE')) { // 读取session驱动\n            $type   =   C('SESSION_TYPE');\n            $class  =   strpos($type,'\\\\')? $type : 'Think\\\\Session\\\\Driver\\\\'. ucwords(strtolower($type));\n            $hander =   new $class();\n            session_set_save_handler(\n                array(&$hander,\"open\"), \n                array(&$hander,\"close\"), \n                array(&$hander,\"read\"), \n                array(&$hander,\"write\"), \n                array(&$hander,\"destroy\"), \n                array(&$hander,\"gc\")); \n        }\n        // 启动session\n        if(C('SESSION_AUTO_START'))  session_start();\n    }elseif('' === $value){ \n        if(''===$name){\n            // 获取全部的session\n            return $prefix ? $_SESSION[$prefix] : $_SESSION;\n        }elseif(0===strpos($name,'[')) { // session 操作\n            if('[pause]'==$name){ // 暂停session\n                session_write_close();\n            }elseif('[start]'==$name){ // 启动session\n                session_start();\n            }elseif('[destroy]'==$name){ // 销毁session\n                $_SESSION =  array();\n                session_unset();\n                session_destroy();\n            }elseif('[regenerate]'==$name){ // 重新生成id\n                session_regenerate_id();\n            }\n        }elseif(0===strpos($name,'?')){ // 检查session\n            $name   =  substr($name,1);\n            if(strpos($name,'.')){ // 支持数组\n                list($name1,$name2) =   explode('.',$name);\n                return $prefix?isset($_SESSION[$prefix][$name1][$name2]):isset($_SESSION[$name1][$name2]);\n            }else{\n                return $prefix?isset($_SESSION[$prefix][$name]):isset($_SESSION[$name]);\n            }\n        }elseif(is_null($name)){ // 清空session\n            if($prefix) {\n                unset($_SESSION[$prefix]);\n            }else{\n                $_SESSION = array();\n            }\n        }elseif($prefix){ // 获取session\n            if(strpos($name,'.')){\n                list($name1,$name2) =   explode('.',$name);\n                return isset($_SESSION[$prefix][$name1][$name2])?$_SESSION[$prefix][$name1][$name2]:null;  \n            }else{\n                return isset($_SESSION[$prefix][$name])?$_SESSION[$prefix][$name]:null;                \n            }            \n        }else{\n            if(strpos($name,'.')){\n                list($name1,$name2) =   explode('.',$name);\n                return isset($_SESSION[$name1][$name2])?$_SESSION[$name1][$name2]:null;  \n            }else{\n                return isset($_SESSION[$name])?$_SESSION[$name]:null;\n            }            \n        }\n    }elseif(is_null($value)){ // 删除session\n        if(strpos($name,'.')){\n            list($name1,$name2) =   explode('.',$name);\n            if($prefix){\n                unset($_SESSION[$prefix][$name1][$name2]);\n            }else{\n                unset($_SESSION[$name1][$name2]);\n            }\n        }else{\n            if($prefix){\n                unset($_SESSION[$prefix][$name]);\n            }else{\n                unset($_SESSION[$name]);\n            }\n        }\n    }else{ // 设置session\n\t\tif(strpos($name,'.')){\n\t\t\tlist($name1,$name2) =   explode('.',$name);\n\t\t\tif($prefix){\n\t\t\t\t$_SESSION[$prefix][$name1][$name2]   =  $value;\n\t\t\t}else{\n\t\t\t\t$_SESSION[$name1][$name2]  =  $value;\n\t\t\t}\n\t\t}else{\n\t\t\tif($prefix){\n\t\t\t\t$_SESSION[$prefix][$name]   =  $value;\n\t\t\t}else{\n\t\t\t\t$_SESSION[$name]  =  $value;\n\t\t\t}\n\t\t}\n    }\n    return null;\n}\n\n/**\n * Cookie 设置、获取、删除\n * @param string $name cookie名称\n * @param mixed $value cookie值\n * @param mixed $option cookie参数\n * @return mixed\n */\nfunction cookie($name='', $value='', $option=null) {\n    // 默认设置\n    $config = array(\n        'prefix'    =>  C('COOKIE_PREFIX'), // cookie 名称前缀\n        'expire'    =>  C('COOKIE_EXPIRE'), // cookie 保存时间\n        'path'      =>  C('COOKIE_PATH'), // cookie 保存路径\n        'domain'    =>  C('COOKIE_DOMAIN'), // cookie 有效域名\n        'secure'    =>  C('COOKIE_SECURE'), //  cookie 启用安全传输\n        'httponly'  =>  C('COOKIE_HTTPONLY'), // httponly设置\n    );\n    // 参数设置(会覆盖黙认设置)\n    if (!is_null($option)) {\n        if (is_numeric($option))\n            $option = array('expire' => $option);\n        elseif (is_string($option))\n            parse_str($option, $option);\n        $config     = array_merge($config, array_change_key_case($option));\n    }\n    if(!empty($config['httponly'])){\n        ini_set(\"session.cookie_httponly\", 1);\n    }\n    // 清除指定前缀的所有cookie\n    if (is_null($name)) {\n        if (empty($_COOKIE))\n            return null;\n        // 要删除的cookie前缀，不指定则删除config设置的指定前缀\n        $prefix = empty($value) ? $config['prefix'] : $value;\n        if (!empty($prefix)) {// 如果前缀为空字符串将不作处理直接返回\n            foreach ($_COOKIE as $key => $val) {\n                if (0 === stripos($key, $prefix)) {\n                    setcookie($key, '', time() - 3600, $config['path'], $config['domain'],$config['secure'],$config['httponly']);\n                    unset($_COOKIE[$key]);\n                }\n            }\n        }\n        return null;\n    }elseif('' === $name){\n        // 获取全部的cookie\n        return $_COOKIE;\n    }\n    $name = $config['prefix'] . str_replace('.', '_', $name);\n    if ('' === $value) {\n        if(isset($_COOKIE[$name])){\n            $value =    $_COOKIE[$name];\n            if(0===strpos($value,'think:')){\n                $value  =   substr($value,6);\n                return array_map('urldecode',json_decode(MAGIC_QUOTES_GPC?stripslashes($value):$value,true));\n            }else{\n                return $value;\n            }\n        }else{\n            return null;\n        }\n    } else {\n        if (is_null($value)) {\n            setcookie($name, '', time() - 3600, $config['path'], $config['domain'],$config['secure'],$config['httponly']);\n            unset($_COOKIE[$name]); // 删除指定cookie\n        } else {\n            // 设置cookie\n            if(is_array($value)){\n                $value  = 'think:'.json_encode(array_map('urlencode',$value));\n            }\n            $expire = !empty($config['expire']) ? time() + intval($config['expire']) : 0;\n            setcookie($name, $value, $expire, $config['path'], $config['domain'],$config['secure'],$config['httponly']);\n            $_COOKIE[$name] = $value;\n        }\n    }\n    return null;\n}\n\n/**\n * 发送HTTP状态\n * @param integer $code 状态码\n * @return void\n */\nfunction send_http_status($code) {\n    static $_status = array(\n            // Informational 1xx\n            100 => 'Continue',\n            101 => 'Switching Protocols',\n            // Success 2xx\n            200 => 'OK',\n            201 => 'Created',\n            202 => 'Accepted',\n            203 => 'Non-Authoritative Information',\n            204 => 'No Content',\n            205 => 'Reset Content',\n            206 => 'Partial Content',\n            // Redirection 3xx\n            300 => 'Multiple Choices',\n            301 => 'Moved Permanently',\n            302 => 'Moved Temporarily ',  // 1.1\n            303 => 'See Other',\n            304 => 'Not Modified',\n            305 => 'Use Proxy',\n            // 306 is deprecated but reserved\n            307 => 'Temporary Redirect',\n            // Client Error 4xx\n            400 => 'Bad Request',\n            401 => 'Unauthorized',\n            402 => 'Payment Required',\n            403 => 'Forbidden',\n            404 => 'Not Found',\n            405 => 'Method Not Allowed',\n            406 => 'Not Acceptable',\n            407 => 'Proxy Authentication Required',\n            408 => 'Request Timeout',\n            409 => 'Conflict',\n            410 => 'Gone',\n            411 => 'Length Required',\n            412 => 'Precondition Failed',\n            413 => 'Request Entity Too Large',\n            414 => 'Request-URI Too Long',\n            415 => 'Unsupported Media Type',\n            416 => 'Requested Range Not Satisfiable',\n            417 => 'Expectation Failed',\n            // Server Error 5xx\n            500 => 'Internal Server Error',\n            501 => 'Not Implemented',\n            502 => 'Bad Gateway',\n            503 => 'Service Unavailable',\n            504 => 'Gateway Timeout',\n            505 => 'HTTP Version Not Supported',\n            509 => 'Bandwidth Limit Exceeded'\n    );\n    if(isset($_status[$code])) {\n        header('HTTP/1.1 '.$code.' '.$_status[$code]);\n        // 确保FastCGI模式下正常\n        header('Status:'.$code.' '.$_status[$code]);\n    }\n}\n\nfunction think_filter(&$value){\n\t// TODO 其他安全过滤\n\n\t// 过滤查询特殊字符\n    if(preg_match('/^(EXP|NEQ|GT|EGT|LT|ELT|OR|XOR|LIKE|NOTLIKE|NOT BETWEEN|NOTBETWEEN|BETWEEN|NOTIN|NOT IN|IN)$/i',$value)){\n        $value .= ' ';\n    }\n}\n\n// 不区分大小写的in_array实现\nfunction in_array_case($value,$array){\n    return in_array(strtolower($value),array_map('strtolower',$array));\n}\n"
  },
  {
    "path": "ThinkPHP/Mode/Sae/convention.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: luofei614 <weibo.com/luofei614>\n// +----------------------------------------------------------------------\n\n/**\n * SAE模式惯例配置文件\n * 该文件请不要修改，如果要覆盖惯例配置的值，可在应用配置文件中设定和惯例不符的配置项\n * 配置名称大小写任意，系统会统一转换成小写\n * 所有配置参数都可以在生效前动态改变\n */\ndefined('THINK_PATH') or exit();\n$st =   new SaeStorage();\nreturn array(\n    //SAE下固定mysql配置\n    'DB_TYPE'           =>  'mysql',     // 数据库类型\n    'DB_DEPLOY_TYPE'    =>  1,\n    'DB_RW_SEPARATE'    =>  true,\n    'DB_HOST'           =>  SAE_MYSQL_HOST_M.','.SAE_MYSQL_HOST_S, // 服务器地址\n    'DB_NAME'           =>  SAE_MYSQL_DB,        // 数据库名\n    'DB_USER'           =>  SAE_MYSQL_USER,    // 用户名\n    'DB_PWD'            =>  SAE_MYSQL_PASS,         // 密码\n    'DB_PORT'           =>  SAE_MYSQL_PORT,        // 端口\n    //更改模板替换变量，让普通能在所有平台下显示\n    'TMPL_PARSE_STRING' =>  array(\n        // __PUBLIC__/upload  -->  /Public/upload -->http://appname-public.stor.sinaapp.com/upload\n        '/Public/upload'    =>  $st->getUrl('public','upload')\n    ),\n    'LOG_TYPE'          =>  'Sae',\n    'DATA_CACHE_TYPE'   =>  'Memcachesae',\n    'CHECK_APP_DIR'     =>  false,\n    'FILE_UPLOAD_TYPE'  =>  'Sae',\n);\n"
  },
  {
    "path": "ThinkPHP/Mode/api.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n      \n/**\n * ThinkPHP API模式定义\n */\nreturn array(\n    // 配置文件\n    'config'    =>  array(\n        THINK_PATH.'Conf/convention.php',   // 系统惯例配置\n        CONF_PATH.'config'.CONF_EXT,      // 应用公共配置\n    ),\n\n    // 别名定义\n    'alias'     =>  array(\n        'Think\\Exception'         => CORE_PATH . 'Exception'.EXT,\n        'Think\\Model'             => CORE_PATH . 'Model'.EXT,\n        'Think\\Db'                => CORE_PATH . 'Db'.EXT,\n        'Think\\Cache'             => CORE_PATH . 'Cache'.EXT,\n        'Think\\Cache\\Driver\\File' => CORE_PATH . 'Cache/Driver/File'.EXT,\n        'Think\\Storage'           => CORE_PATH . 'Storage'.EXT,\n    ),\n\n    // 函数和类文件\n    'core'      =>  array(\n        MODE_PATH.'Api/functions.php',\n        COMMON_PATH.'Common/function.php',\n        MODE_PATH . 'Api/App'.EXT,\n        MODE_PATH . 'Api/Dispatcher'.EXT,\n        MODE_PATH . 'Api/Controller'.EXT,\n        CORE_PATH . 'Behavior'.EXT,\n    ),\n    // 行为扩展定义\n    'tags'  =>  array(\n    ),\n);\n"
  },
  {
    "path": "ThinkPHP/Mode/common.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n      \n/**\n * ThinkPHP 普通模式定义\n */\nreturn array(\n    // 配置文件\n    'config'    =>  array(\n        THINK_PATH.'Conf/convention.php',   // 系统惯例配置\n        CONF_PATH.'config'.CONF_EXT,      // 应用公共配置\n    ),\n\n    // 别名定义\n    'alias'     =>  array(\n        'Think\\Log'               => CORE_PATH . 'Log'.EXT,\n        'Think\\Log\\Driver\\File'   => CORE_PATH . 'Log/Driver/File'.EXT,\n        'Think\\Exception'         => CORE_PATH . 'Exception'.EXT,\n        'Think\\Model'             => CORE_PATH . 'Model'.EXT,\n        'Think\\Db'                => CORE_PATH . 'Db'.EXT,\n        'Think\\Template'          => CORE_PATH . 'Template'.EXT,\n        'Think\\Cache'             => CORE_PATH . 'Cache'.EXT,\n        'Think\\Cache\\Driver\\File' => CORE_PATH . 'Cache/Driver/File'.EXT,\n        'Think\\Storage'           => CORE_PATH . 'Storage'.EXT,\n    ),\n\n    // 函数和类文件\n    'core'      =>  array(\n        THINK_PATH.'Common/functions.php',\n        COMMON_PATH.'Common/function.php',\n        CORE_PATH . 'Hook'.EXT,\n        CORE_PATH . 'App'.EXT,\n        CORE_PATH . 'Dispatcher'.EXT,\n        //CORE_PATH . 'Log'.EXT,\n        CORE_PATH . 'Route'.EXT,\n        CORE_PATH . 'Controller'.EXT,\n        CORE_PATH . 'View'.EXT,\n        BEHAVIOR_PATH . 'BuildLiteBehavior'.EXT,\n        BEHAVIOR_PATH . 'ParseTemplateBehavior'.EXT,\n        BEHAVIOR_PATH . 'ContentReplaceBehavior'.EXT,\n    ),\n    // 行为扩展定义\n    'tags'  =>  array(\n        'app_init'     =>  array(\n            'Behavior\\BuildLiteBehavior', // 生成运行Lite文件\n        ),        \n        'app_begin'     =>  array(\n            'Behavior\\ReadHtmlCacheBehavior', // 读取静态缓存\n        ),\n        'app_end'       =>  array(\n            'Behavior\\ShowPageTraceBehavior', // 页面Trace显示\n        ),\n        'view_parse'    =>  array(\n            'Behavior\\ParseTemplateBehavior', // 模板解析 支持PHP、内置模板引擎和第三方模板引擎\n        ),\n        'template_filter'=> array(\n            'Behavior\\ContentReplaceBehavior', // 模板输出替换\n        ),\n        'view_filter'   =>  array(\n            'Behavior\\WriteHtmlCacheBehavior', // 写入静态缓存\n        ),\n    ),\n);\n"
  },
  {
    "path": "ThinkPHP/Mode/lite.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n      \n/**\n * ThinkPHP Lite模式定义\n */\nreturn array(\n    // 配置文件\n    'config'    =>  array(\n        MODE_PATH.'Lite/convention.php', // 系统惯例配置\n        CONF_PATH.'config'.CONF_EXT,      // 应用公共配置\n    ),\n\n    // 别名定义\n    'alias'     =>  array(\n        'Think\\Exception'         => CORE_PATH . 'Exception'.EXT,\n        'Think\\Model'             => CORE_PATH . 'Model'.EXT,\n        'Think\\Db'                => CORE_PATH . 'Db'.EXT,\n        'Think\\Cache'             => CORE_PATH . 'Cache'.EXT,\n        'Think\\Cache\\Driver\\File' => CORE_PATH . 'Cache/Driver/File'.EXT,\n        'Think\\Storage'           => CORE_PATH . 'Storage'.EXT,\n    ),\n\n    // 函数和类文件\n    'core'      =>  array(\n        MODE_PATH.'Lite/functions.php',\n        COMMON_PATH.'Common/function.php',\n        CORE_PATH . 'Hook'.EXT,\n        CORE_PATH . 'App'.EXT,\n        CORE_PATH . 'Dispatcher'.EXT,\n        //CORE_PATH . 'Log'.EXT,\n        CORE_PATH . 'Route'.EXT,\n        CORE_PATH . 'Controller'.EXT,\n        CORE_PATH . 'View'.EXT,\n    ),\n    // 行为扩展定义\n    'tags'  =>  array(\n    ),\n);\n"
  },
  {
    "path": "ThinkPHP/Mode/sae.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: luofei614 <weibo.com/luofei614>\n// +----------------------------------------------------------------------\n      \n/**\n * ThinkPHP SAE应用模式定义文件\n */\nreturn array(\n    // 配置文件\n    'config'    =>  array(\n        THINK_PATH.'Conf/convention.php',   // 系统惯例配置\n        CONF_PATH.'config'.CONF_EXT,      // 应用公共配置\n        MODE_PATH.'Sae/convention.php',//[sae] sae的惯例配置\n    ),\n\n    // 别名定义\n    'alias'     =>  array(\n        'Think\\Log'               => CORE_PATH . 'Log'.EXT,\n        'Think\\Log\\Driver\\File'   => CORE_PATH . 'Log/Driver/File'.EXT,\n        'Think\\Exception'         => CORE_PATH . 'Exception'.EXT,\n        'Think\\Model'             => CORE_PATH . 'Model'.EXT,\n        'Think\\Db'                => CORE_PATH . 'Db'.EXT,\n        'Think\\Template'          => CORE_PATH . 'Template'.EXT,\n        'Think\\Cache'             => CORE_PATH . 'Cache'.EXT,\n        'Think\\Cache\\Driver\\File' => CORE_PATH . 'Cache/Driver/File'.EXT,\n        'Think\\Storage'           => CORE_PATH . 'Storage'.EXT,\n    ),\n\n    // 函数和类文件\n    'core'      =>  array(\n        THINK_PATH.'Common/functions.php',\n        COMMON_PATH.'Common/function.php',\n        CORE_PATH . 'Hook'.EXT,\n        CORE_PATH . 'App'.EXT,\n        CORE_PATH . 'Dispatcher'.EXT,\n        //CORE_PATH . 'Log'.EXT,\n        CORE_PATH . 'Route'.EXT,\n        CORE_PATH . 'Controller'.EXT,\n        CORE_PATH . 'View'.EXT,\n        BEHAVIOR_PATH . 'ParseTemplateBehavior'.EXT,\n        BEHAVIOR_PATH . 'ContentReplaceBehavior'.EXT,\n    ),\n    // 行为扩展定义\n    'tags'  =>  array(\n        'app_begin'     =>  array(\n            'Behavior\\ReadHtmlCacheBehavior', // 读取静态缓存\n        ),\n        'app_end'       =>  array(\n            'Behavior\\ShowPageTraceBehavior', // 页面Trace显示\n        ),\n        'view_parse'    =>  array(\n            'Behavior\\ParseTemplateBehavior', // 模板解析 支持PHP、内置模板引擎和第三方模板引擎\n        ),\n        'template_filter'=> array(\n            'Behavior\\ContentReplaceBehavior', // 模板输出替换\n        ),\n        'view_filter'   =>  array(\n            'Behavior\\WriteHtmlCacheBehavior', // 写入静态缓存\n        ),\n    ),\n);\n"
  },
  {
    "path": "ThinkPHP/ThinkPHP.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\n//----------------------------------\n// ThinkPHP公共入口文件\n//----------------------------------\n\n// 记录开始运行时间\n$GLOBALS['_beginTime'] = microtime(TRUE);\n// 记录内存初始使用\ndefine('MEMORY_LIMIT_ON',function_exists('memory_get_usage'));\nif(MEMORY_LIMIT_ON) $GLOBALS['_startUseMems'] = memory_get_usage();\n\n// 版本信息\nconst THINK_VERSION     =   '3.2.3';\n\n// URL 模式定义\nconst URL_COMMON        =   0;  //普通模式\nconst URL_PATHINFO      =   1;  //PATHINFO模式\nconst URL_REWRITE       =   2;  //REWRITE模式\nconst URL_COMPAT        =   3;  // 兼容模式\n\n// 类文件后缀\nconst EXT               =   '.class.php'; \n\n// 系统常量定义\ndefined('THINK_PATH')   or define('THINK_PATH',     __DIR__.'/');\ndefined('APP_PATH')     or define('APP_PATH',       dirname($_SERVER['SCRIPT_FILENAME']).'/');\ndefined('APP_STATUS')   or define('APP_STATUS',     ''); // 应用状态 加载对应的配置文件\ndefined('APP_DEBUG')    or define('APP_DEBUG',      false); // 是否调试模式\n\nif(function_exists('saeAutoLoader')){// 自动识别SAE环境\n    defined('APP_MODE')     or define('APP_MODE',      'sae');\n    defined('STORAGE_TYPE') or define('STORAGE_TYPE',  'Sae');\n}else{\n    defined('APP_MODE')     or define('APP_MODE',       'common'); // 应用模式 默认为普通模式    \n    defined('STORAGE_TYPE') or define('STORAGE_TYPE',   'File'); // 存储类型 默认为File    \n}\n\ndefined('RUNTIME_PATH') or define('RUNTIME_PATH',   APP_PATH.'Runtime/');   // 系统运行时目录\ndefined('LIB_PATH')     or define('LIB_PATH',       realpath(THINK_PATH.'Library').'/'); // 系统核心类库目录\ndefined('CORE_PATH')    or define('CORE_PATH',      LIB_PATH.'Think/'); // Think类库目录\ndefined('BEHAVIOR_PATH')or define('BEHAVIOR_PATH',  LIB_PATH.'Behavior/'); // 行为类库目录\ndefined('MODE_PATH')    or define('MODE_PATH',      THINK_PATH.'Mode/'); // 系统应用模式目录\ndefined('VENDOR_PATH')  or define('VENDOR_PATH',    LIB_PATH.'Vendor/'); // 第三方类库目录\ndefined('COMMON_PATH')  or define('COMMON_PATH',    APP_PATH.'Common/'); // 应用公共目录\ndefined('CONF_PATH')    or define('CONF_PATH',      COMMON_PATH.'Conf/'); // 应用配置目录\ndefined('LANG_PATH')    or define('LANG_PATH',      COMMON_PATH.'Lang/'); // 应用语言目录\ndefined('HTML_PATH')    or define('HTML_PATH',      APP_PATH.'Html/'); // 应用静态目录\ndefined('LOG_PATH')     or define('LOG_PATH',       RUNTIME_PATH.'Logs/'); // 应用日志目录\ndefined('TEMP_PATH')    or define('TEMP_PATH',      RUNTIME_PATH.'Temp/'); // 应用缓存目录\ndefined('DATA_PATH')    or define('DATA_PATH',      RUNTIME_PATH.'Data/'); // 应用数据目录\ndefined('CACHE_PATH')   or define('CACHE_PATH',     RUNTIME_PATH.'Cache/'); // 应用模板缓存目录\ndefined('CONF_EXT')     or define('CONF_EXT',       '.php'); // 配置文件后缀\ndefined('CONF_PARSE')   or define('CONF_PARSE',     '');    // 配置文件解析方法\ndefined('ADDON_PATH')   or define('ADDON_PATH',     APP_PATH.'Addon');\n\n// 系统信息\nif(version_compare(PHP_VERSION,'5.4.0','<')) {\n    ini_set('magic_quotes_runtime',0);\n    define('MAGIC_QUOTES_GPC',get_magic_quotes_gpc()? true : false);\n}else{\n    define('MAGIC_QUOTES_GPC',false);\n}\ndefine('IS_CGI',(0 === strpos(PHP_SAPI,'cgi') || false !== strpos(PHP_SAPI,'fcgi')) ? 1 : 0 );\ndefine('IS_WIN',strstr(PHP_OS, 'WIN') ? 1 : 0 );\ndefine('IS_CLI',PHP_SAPI=='cli'? 1   :   0);\n\nif(!IS_CLI) {\n    // 当前文件名\n    if(!defined('_PHP_FILE_')) {\n        if(IS_CGI) {\n            //CGI/FASTCGI模式下\n            $_temp  = explode('.php',$_SERVER['PHP_SELF']);\n            define('_PHP_FILE_',    rtrim(str_replace($_SERVER['HTTP_HOST'],'',$_temp[0].'.php'),'/'));\n        }else {\n            define('_PHP_FILE_',    rtrim($_SERVER['SCRIPT_NAME'],'/'));\n        }\n    }\n    if(!defined('__ROOT__')) {\n        $_root  =   rtrim(dirname(_PHP_FILE_),'/');\n        define('__ROOT__',  (($_root=='/' || $_root=='\\\\')?'':$_root));\n    }\n}\n\n// 加载核心Think类\nrequire CORE_PATH.'Think'.EXT;\n// 应用初始化 \nThink\\Think::start();"
  },
  {
    "path": "ThinkPHP/Tpl/dispatch_jump.tpl",
    "content": "<?php\n    if(C('LAYOUT_ON')) {\n        echo '{__NOLAYOUT__}';\n    }\n?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<title>跳转提示</title>\n<style type=\"text/css\">\n*{ padding: 0; margin: 0; }\nbody{ background: #fff; font-family: '微软雅黑'; color: #333; font-size: 16px; }\n.system-message{ padding: 24px 48px; }\n.system-message h1{ font-size: 100px; font-weight: normal; line-height: 120px; margin-bottom: 12px; }\n.system-message .jump{ padding-top: 10px}\n.system-message .jump a{ color: #333;}\n.system-message .success,.system-message .error{ line-height: 1.8em; font-size: 36px }\n.system-message .detail{ font-size: 12px; line-height: 20px; margin-top: 12px; display:none}\n</style>\n</head>\n<body>\n<div class=\"system-message\">\n<?php if(isset($message)) {?>\n<h1>:)</h1>\n<p class=\"success\"><?php echo($message); ?></p>\n<?php }else{?>\n<h1>:(</h1>\n<p class=\"error\"><?php echo($error); ?></p>\n<?php }?>\n<p class=\"detail\"></p>\n<p class=\"jump\">\n页面自动 <a id=\"href\" href=\"<?php echo($jumpUrl); ?>\">跳转</a> 等待时间： <b id=\"wait\"><?php echo($waitSecond); ?></b>\n</p>\n</div>\n<script type=\"text/javascript\">\n(function(){\nvar wait = document.getElementById('wait'),href = document.getElementById('href').href;\nvar interval = setInterval(function(){\n\tvar time = --wait.innerHTML;\n\tif(time <= 0) {\n\t\tlocation.href = href;\n\t\tclearInterval(interval);\n\t};\n}, 1000);\n})();\n</script>\n</body>\n</html>\n"
  },
  {
    "path": "ThinkPHP/Tpl/page_trace.tpl",
    "content": "<div id=\"think_page_trace\" style=\"position: fixed;bottom:0;right:0;font-size:14px;width:100%;z-index: 999999;color: #000;text-align:left;font-family:'微软雅黑';\">\n<div id=\"think_page_trace_tab\" style=\"display: none;background:white;margin:0;height: 250px;\">\n<div id=\"think_page_trace_tab_tit\" style=\"height:30px;padding: 6px 12px 0;border-bottom:1px solid #ececec;border-top:1px solid #ececec;font-size:16px\">\n\t<?php foreach($trace as $key => $value){ ?>\n    <span style=\"color:#000;padding-right:12px;height:30px;line-height: 30px;display:inline-block;margin-right:3px;cursor: pointer;font-weight:700\"><?php echo $key ?></span>\n    <?php } ?>\n</div>\n<div id=\"think_page_trace_tab_cont\" style=\"overflow:auto;height:212px;padding: 0; line-height: 24px\">\n\t\t<?php foreach($trace as $info) { ?>\n    <div style=\"display:none;\">\n    <ol style=\"padding: 0; margin:0\">\n\t<?php \n\tif(is_array($info)){\n\t\tforeach ($info as $k=>$val){\n\t\techo '<li style=\"border-bottom:1px solid #EEE;font-size:14px;padding:0 12px\">' . (is_numeric($k) ? '' : $k.' : ') . htmlentities($val,ENT_COMPAT,'utf-8') .'</li>';\n\t    }\n\t}\n    ?>\n    </ol>\n    </div>\n    <?php } ?>\n</div>\n</div>\n<div id=\"think_page_trace_close\" style=\"display:none;text-align:right;height:15px;position:absolute;top:10px;right:12px;cursor: pointer;\"><img style=\"vertical-align:top;\" src=\"data:image/gif;base64,R0lGODlhDwAPAJEAAAAAAAMDA////wAAACH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4wLWMwNjAgNjEuMTM0Nzc3LCAyMDEwLzAyLzEyLTE3OjMyOjAwICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IFdpbmRvd3MiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MUQxMjc1MUJCQUJDMTFFMTk0OUVGRjc3QzU4RURFNkEiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MUQxMjc1MUNCQUJDMTFFMTk0OUVGRjc3QzU4RURFNkEiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDoxRDEyNzUxOUJBQkMxMUUxOTQ5RUZGNzdDNThFREU2QSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDoxRDEyNzUxQUJBQkMxMUUxOTQ5RUZGNzdDNThFREU2QSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgH//v38+/r5+Pf29fTz8vHw7+7t7Ovq6ejn5uXk4+Lh4N/e3dzb2tnY19bV1NPS0dDPzs3My8rJyMfGxcTDwsHAv769vLu6ubi3trW0s7KxsK+urayrqqmop6alpKOioaCfnp2cm5qZmJeWlZSTkpGQj46NjIuKiYiHhoWEg4KBgH9+fXx7enl4d3Z1dHNycXBvbm1sa2ppaGdmZWRjYmFgX15dXFtaWVhXVlVUU1JRUE9OTUxLSklIR0ZFRENCQUA/Pj08Ozo5ODc2NTQzMjEwLy4tLCsqKSgnJiUkIyIhIB8eHRwbGhkYFxYVFBMSERAPDg0MCwoJCAcGBQQDAgEAACH5BAAAAAAALAAAAAAPAA8AAAIdjI6JZqotoJPR1fnsgRR3C2jZl3Ai9aWZZooV+RQAOw==\" /></div>\n</div>\n<div id=\"think_page_trace_open\" style=\"height:30px;float:right;text-align: right;overflow:hidden;position:fixed;bottom:0;right:0;color:#000;line-height:30px;cursor:pointer;\"><div style=\"background:#232323;color:#FFF;padding:0 6px;float:right;line-height:30px;font-size:14px\"><?php echo G('beginTime','viewEndTime').'s ';?></div><img width=\"30\" style=\"\" title=\"ShowPageTrace\" src=\"data:image/png;base64,<?php echo \\Think\\App::logo() ?>\"></div>\n<script type=\"text/javascript\">\n(function(){\nvar tab_tit  = document.getElementById('think_page_trace_tab_tit').getElementsByTagName('span');\nvar tab_cont = document.getElementById('think_page_trace_tab_cont').getElementsByTagName('div');\nvar open     = document.getElementById('think_page_trace_open');\nvar close    = document.getElementById('think_page_trace_close').childNodes[0];\nvar trace    = document.getElementById('think_page_trace_tab');\nvar cookie   = document.cookie.match(/thinkphp_show_page_trace=(\\d\\|\\d)/);\nvar history  = (cookie && typeof cookie[1] != 'undefined' && cookie[1].split('|')) || [0,0];\nopen.onclick = function(){\n\ttrace.style.display = 'block';\n\tthis.style.display = 'none';\n\tclose.parentNode.style.display = 'block';\n\thistory[0] = 1;\n\tdocument.cookie = 'thinkphp_show_page_trace='+history.join('|')\n}\nclose.onclick = function(){\n\ttrace.style.display = 'none';\nthis.parentNode.style.display = 'none';\n\topen.style.display = 'block';\n\thistory[0] = 0;\n\tdocument.cookie = 'thinkphp_show_page_trace='+history.join('|')\n}\nfor(var i = 0; i < tab_tit.length; i++){\n\ttab_tit[i].onclick = (function(i){\n\t\treturn function(){\n\t\t\tfor(var j = 0; j < tab_cont.length; j++){\n\t\t\t\ttab_cont[j].style.display = 'none';\n\t\t\t\ttab_tit[j].style.color = '#999';\n\t\t\t}\n\t\t\ttab_cont[i].style.display = 'block';\n\t\t\ttab_tit[i].style.color = '#000';\n\t\t\thistory[1] = i;\n\t\t\tdocument.cookie = 'thinkphp_show_page_trace='+history.join('|')\n\t\t}\n\t})(i)\n}\nparseInt(history[0]) && open.click();\n(tab_tit[history[1]] || tab_tit[0]).click();\n})();\n</script>\n"
  },
  {
    "path": "ThinkPHP/Tpl/think_exception.tpl",
    "content": "<?php\n    if(C('LAYOUT_ON')) {\n        echo '{__NOLAYOUT__}';\n    }\n?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>\n<meta content=\"text/html; charset=utf-8\" http-equiv=\"Content-Type\">\n<title>系统发生错误</title>\n<style type=\"text/css\">\n*{ padding: 0; margin: 0; }\nhtml{ overflow-y: scroll; }\nbody{ background: #fff; font-family: '微软雅黑'; color: #333; font-size: 16px; }\nimg{ border: 0; }\n.error{ padding: 24px 48px; }\n.face{ font-size: 100px; font-weight: normal; line-height: 120px; margin-bottom: 12px; }\nh1{ font-size: 32px; line-height: 48px; }\n.error .content{ padding-top: 10px}\n.error .info{ margin-bottom: 12px; }\n.error .info .title{ margin-bottom: 3px; }\n.error .info .title h3{ color: #000; font-weight: 700; font-size: 16px; }\n.error .info .text{ line-height: 24px; }\n.copyright{ padding: 12px 48px; color: #999; }\n.copyright a{ color: #000; text-decoration: none; }\n</style>\n</head>\n<body>\n<div class=\"error\">\n<p class=\"face\">:(</p>\n<h1><?php echo strip_tags($e['message']);?></h1>\n<div class=\"content\">\n<?php if(isset($e['file'])) {?>\n\t<div class=\"info\">\n\t\t<div class=\"title\">\n\t\t\t<h3>错误位置</h3>\n\t\t</div>\n\t\t<div class=\"text\">\n\t\t\t<p>FILE: <?php echo $e['file'] ;?> &#12288;LINE: <?php echo $e['line'];?></p>\n\t\t</div>\n\t</div>\n<?php }?>\n<?php if(isset($e['trace'])) {?>\n\t<div class=\"info\">\n\t\t<div class=\"title\">\n\t\t\t<h3>TRACE</h3>\n\t\t</div>\n\t\t<div class=\"text\">\n\t\t\t<p><?php echo nl2br($e['trace']);?></p>\n\t\t</div>\n\t</div>\n<?php }?>\n</div>\n</div>\n<div class=\"copyright\">\n<p><a title=\"官方网站\" href=\"http://www.thinkphp.cn\">ThinkPHP</a><sup><?php echo THINK_VERSION ?></sup> { Fast & Simple OOP PHP Framework } -- [ WE CAN DO IT JUST THINK ]</p>\n</div>\n</body>\n</html>\n"
  },
  {
    "path": "index.php",
    "content": "<?php\n// +----------------------------------------------------------------------\n// | ThinkPHP [ WE CAN DO IT JUST THINK ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n// +----------------------------------------------------------------------\n// | Author: liu21st <liu21st@gmail.com>\n// +----------------------------------------------------------------------\n\n// 应用入口文件\n\n// 检测PHP环境\nif(version_compare(PHP_VERSION,'5.3.0', '<'))  die('require PHP > 5.3.0 !');\n\n// 开启调试模式 建议开发阶段开启 部署阶段注释或者设为false\ndefine('APP_DEBUG', true);\n\n// 定义应用目录\ndefine('APP_PATH', './Application/');\ndefine('RUNTIME_PATH', './Runtime/');\n\n// 引入ThinkPHP入口文件\nrequire './ThinkPHP/ThinkPHP.php';\n\n// 亲^_^ 后面不需要任何代码了 就是如此简单\n"
  },
  {
    "path": "readme.md",
    "content": "Wechat SDK"
  },
  {
    "path": "requirements.apt",
    "content": "php5-mcrypt\n"
  },
  {
    "path": "tsuru.yml",
    "content": "hooks:\r\n  build:\r\n    - sudo php5enmod mcrypt"
  }
]