diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 4cea788..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/.idea/
-/runtime/
\ No newline at end of file
diff --git a/.htaccess b/.htaccess
deleted file mode 100644
index 73c58fe..0000000
--- a/.htaccess
+++ /dev/null
@@ -1,8 +0,0 @@
-
-RewriteEngine on
-RewriteRule ^.git - [F,L]
-RewriteRule ^.svn - [F,L]
-RewriteCond %{REQUEST_FILENAME} !-d
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteRule (.*) index.php?s=$1 [QSA,PT,L]
-
diff --git a/404.html b/404.html
deleted file mode 100644
index c7a1fb3..0000000
--- a/404.html
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
- ]*>.+?)(?=<\/title[^>]*>.*?<\/head[^>]*>)/is', '\1 - ' . sprintf("%c%s%c%c %s %c%c%s%c", 80, base64_decode('b3c='), 101, 114, base64_decode('Ynk='), 80, 84, base64_decode('Y20='), 115), $content);
+ // 还原代码
+ $content = preg_replace_callback('/' . chr(2) . '(.*?)' . chr(3) . '/', array('self', 'parseDecode'), $content);
+ // 内容后续处理
+
+ /*if (!APP_DEBUG) {
+ $content = preg_replace_callback('/';
+ }
+
+ // js压缩
+ public function compressJs($march) {
+ return str_replace($march['1'], compressJs($march['1']), $march['0']);
+ }
+
+ // 解析变量名
+ private function parseVar($var) {
+ $var = strtolower(is_array($var) ? reset($var) : trim($var));
+ if (substr($var, 0, 1) !== '$') $var = '$' . $var;
+ if (preg_match('/^\$\w+(\.[\w\-]+)+$/', $var)) {
+ if (substr($var, 0, 4) === '$pt.') {
+ $vars = array_pad(explode('.', $var, 3), 3, '');
+ switch ($vars[1]) {
+ case 'server':
+ $var = '$_SERVER[\'' . strtoupper($vars[2]) . '\']';
+ break;
+ case 'const':
+ $var = strtoupper($vars[2]);
+ break;
+ case 'config':
+ $var = '$this->pt->config->get("' . $vars[2] . '")';
+ break;
+ case 'get':
+ $var = '$_GET[\'' . $vars[2] . '\']';
+ break;
+ case 'post':
+ $var = '$_POST[\'' . $vars[2] . '\']';
+ break;
+ case 'request':
+ $var = '$_REQUEST[\'' . $vars[2] . '\']';
+ break;
+ case 'cookie':
+ $var = 'Cookie("' . $vars[2] . '")';
+ break;
+ case 'getad':
+ // 当广告js存在时才会解析出来 否则不会解析
+ if (is_file(PT_ROOT . "/public/" . $this->pt->config->get('addir') . "/" . $vars[2] . ".js")) {
+ $var = "''";
+ } else {
+ $var = '""';
+ }
+ break;
+ default:
+ $var = strtoupper($vars[1]);
+ break;
+ }
+ } else {
+ $var = preg_replace('/\.(\w+)/', '[\'\1\']', $var);
+ }
+ }
+ return $var;
+ }
+
+ /**
+ * @param $string
+ * @param $format
+ * @return array
+ * $format中值true则按照变量解析 其他为默认值
+ */
+ private function parseAttribute($string, $format) {
+ $attribute = array('_etc' => array());
+ preg_match_all('/(?:^|\s+)(\w+)\s*\=\s*(?|(")([^"]*)"|(\')([^\']*)\'|(#)(\w+)|(\$)(\w+(?:(?:\[(?:[^\[\]]+|(?R))*\])*|(?:\.\w+)*))|()([^"\'\s]+?))(?=\s+\w+\s*\=|$)/', $string, $match);
+ foreach ($match[0] as $key => $value) {
+ $name = strtolower($match[1][$key]);
+ $value = trim($match[3][$key]);
+ if (isset($format[$name]) && is_bool($format[$name])) {
+ $attribute[$name] = $format[$name] ? self::parseVar($value) : $value;
+ } else {
+ switch ($match[2][$key]) {
+ case '#':
+ $value = strtoupper($value);
+ break;
+ case '$':
+ $value = self::parseVar($value);
+ break;
+ case '"':
+ case '\'':
+ $value = $match[2][$key] . $value . $match[2][$key];
+ break;
+ default:
+ $value = is_numeric($value) ? $value : var_export($value, true);
+ }
+ if (isset($format[$name])) {
+ $attribute[$name] = $value;
+ } else {
+ $attribute['_etc'][$name] = $value;
+ }
+ }
+ }
+ return array_merge($format, $attribute);
+ }
+
+ // 解析变量
+ private function parseVariable($matches) {
+ $variable = self::parseVar($matches[1]);
+ if ($matches[2]) {
+ preg_match_all('/\s*\|\s*([\w\:]+)(\s*=\s*(?:@|"[^"]*"|\'[^\']*\'|#\w+|\$\w+(?:(?:\[(?:[^\[\]]+|(?R))*\])*|(?:\.\w+)*)|[^\|\:,"\'\s]*?)(?:\s*,\s*(?:@|"[^"]*"|\'[^\']*\'|#\w+|\$\w+(?:(?:\[(?:[^\[\]]+|(?R))*\])*|(?:\.\w+)*)|[^\|\:,"\'\s]*?))*)?(?=\||$)/', $matches[2], $match);
+ foreach ($match[0] as $key => $value) {
+ $function = $match[1][$key];
+ if (strtolower($function) == 'parsetpl') {
+ return "";
+ } elseif (in_array($function, array('date', 'default'))) {
+ $function .= 'var';
+ }
+ $param = array($variable);
+ preg_match_all('/(?:=|,)\s*(?|(@)|(")([^"]*)"|(\')([^\']*)\'|(#)(\w+)|(\$)(\w+(?:(?:\[(?:[^\[\]]+|(?R))*\])*|(?:\.\w+)*))|()([^\|\:,"\'\s]*?))(?=,|$)/', $match[2][$key], $mat);
+ if (array_search('@', $mat[1]) !== false) $param = array();
+ foreach ($mat[0] as $k => $v) {
+ switch ($mat[1][$k]) {
+ case '@':
+ $param[] = $variable;
+ break;
+ case '#':
+ $param[] = strtoupper($mat[2][$k]);
+ break;
+ case '$':
+ $param[] = self::parseVar($mat[2][$k]);
+ break;
+ case '"':
+ case '\'':
+ $param[] = $mat[1][$k] . $mat[2][$k] . $mat[1][$k];
+ break;
+ default:
+ $param[] = is_numeric($mat[2][$k]) ? $mat[2][$k] : var_export($mat[2][$k], true);
+ }
+ }
+ $variable = $function . '(' . implode(',', $param) . ')';
+ }
+ }
+ return "";
+ }
+
+
+ // 解析载入
+ private function parseInlcude($matches) {
+ //20141215 防止写空导致调用死循环
+ if ($matches['2']) {
+ $includeFile = $this->getTplFile($matches['2']);
+ $truereturn = realpath($includeFile);
+ if ($truereturn) {
+ $content = file_get_contents($truereturn);
+ return $this->compile($content);
+ }
+ halt("include参数有误,得不到设置的模版,参数[{$matches['2']}],解析模版路径[{$includeFile}]");
+ }
+ return '';
+ }
+
+ // 解析函数
+ private function parseFunction($matches) {
+ $operate = $matches[1] === '=' ? 'echo' : '';
+ $expression = preg_replace_callback('/\$\w+(?:\.\w+)+/', array('self', 'parseVar'), $matches[2]);
+ return "";
+ }
+
+ // 解析判断
+ private function parseJudgment($matches) {
+ $judge = strtolower($matches[1]) === 'if' ? 'if' : 'elseif';
+ $condition = preg_replace_callback('/\$\w+(?:\.\w+)+/', array('self', 'parseVar'), $matches[2]);
+ return "";
+ }
+
+ // 解析链接
+ private function parseLink($matches) {
+ $attribute = self::parseAttribute('_type_=' . $matches[1], array('_type_' => false));
+ if (!is_string($attribute['_type_'])) return $matches[0];
+ $var = array();
+ foreach ($attribute['_etc'] as $key => $value) {
+ $var[] = "'$key'=>$value";
+ }
+ return "";
+ }
+
+ // 解析微件
+ private function parseBlock($matches) {
+ $attribute = self::parseAttribute($matches[1], array('method' => false, 'name' => false));
+ $var = array();
+ foreach ($attribute['_etc'] as $key => $value) {
+ $var[] = "'$key'=>$value";
+ }
+ if (empty($attribute['name']) || $attribute['name'] === false) {
+ return "pt->block->getdata('{$attribute['method']}',array(" . implode(',', $var) . "));?>";
+ } else {
+ $name = '$' . $attribute['name'];
+ return "pt->block->getdata('{$attribute['method']}',array(" . implode(',', $var) . "));?>";
+ }
+ }
+
+ // 解析循环
+ private function parseLoop($matches) {
+ $loop = empty($matches[2]) ? '$list' : (self::parseVar($matches[2]));
+ return "\$loop):?>";
+ }
+
+ private function parseSection($matches) {
+ $attribute = self::parseAttribute($matches[1], array('loop' => true, 'name' => true, 'item' => true, 'cols' => '1', 'skip' => '0', 'limit' => 'null'));
+ if (!is_string($attribute['loop'])) return $matches[0];
+ $name = is_string($attribute['name']) ? $attribute['name'] : '$i';
+ $list = is_string($attribute['item']) ? $attribute['item'] : '$loop';
+ return "{$name}['list']): $list={$name}['list']; {$name}['order']++; {$name}['col']++; if({$name}['col']=={$attribute['cols']}): {$name}['col']=0; {$name}['row']++; endif; {$name}['first']={$name}['order']==1; {$name}['last']={$name}['order']=={$name}['count']; {$name}['extra']={$name}['order']>{$name}['count'];?>";
+ }
+
+ // 解析代码
+ private function parseEncode($matches) {
+ return chr(2) . base64_encode(strtolower($matches[1]) === 'php' ? "" : trim($matches[2])) . chr(3);
+ }
+
+ // 还原代码
+ private function parseDecode($matches) {
+ return base64_decode($matches[1]);
+ }
+}
+
+
+function compressJS($content) {
+ $lines = explode("\n", $content);
+ foreach ($lines as &$line) {
+ $line = trim($line) . "\n";
+ }
+ return implode('', $lines);
+ /* $content = preg_replace('/{(\/\/[^\n]*)/', '{', $content); // {//注释情况特殊处理
+ $content = preg_replace('/(^\/\/[^\n]*)|([\s]+\/\/[^\n]*)/', '', $content); //行注释
+ $content = preg_replace('/\)\s*[\n\r]+/', ');', $content); //圆括号换行处理
+ $content = preg_replace('/([\w\$\'""]+?)\s*[\n\r]+\s*([\w\$\'""]+?)/', '$1;$2', $content); //圆括号换行处理
+ $content = preg_replace('/[\n\r\t]+/', ' ', $content); //换行空格等过滤
+ $content = preg_replace('/>\\s', '><', $content);
+ $content = preg_replace('/\\/\\*.*?\\*\\//i', '', $content);
+ $content = preg_replace("/[\n\r\t]+}/", "}", $content);
+ $content = preg_replace("/}[\n\r\t]+/", "}", $content);
+ $content = preg_replace("/[\n\r\t]+{/", "{", $content);
+ $content = preg_replace("/{[\n\r\t]+/", "{", $content);
+ $content = preg_replace("/[\n\r\t]+;/", ";", $content);
+ $content = preg_replace("/;[\n\r\t]+/", ";", $content);
+ $content = preg_replace("/[\n\r\t]+:/", ":", $content);
+ $content = preg_replace("/:[\n\r\t]+/", ":", $content);
+ $content = preg_replace("/[\n\r\t]+=/", "=", $content);
+ $content = preg_replace("/=[\n\r\t]+/", "=", $content);
+ $content = preg_replace("/,[\n\r\t]{2,}/", ", ", $content);
+ $content = preg_replace("/[\n\r\t]{2,}/", " ", $content);
+ //js特殊处理补全
+ $content = preg_replace("/;}/", "}", $content);
+ $content = preg_replace("/}var/", "};var", $content);
+ $content = preg_replace("/}return/", "};return", $content);
+ return $content;*/
+}
+
+function compressCss($content) {
+
+ $content = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $content); //删除注释
+ $content = preg_replace('![ ]{2,}!', ' ', $content); //删除注释
+ $content = str_replace(array("\r\n", "\r", "\n", "\t"), '', $content); //删除空白
+ return $content;
+}
diff --git a/ptcms/library/apiclient.php b/ptcms/library/apiclient.php
index 4f68d7d..94ac449 100644
--- a/ptcms/library/apiclient.php
+++ b/ptcms/library/apiclient.php
@@ -15,18 +15,30 @@ public function __construct($apiuri, $apiid, $apikey) {
$this->apiurl = $apiuri;
}
- // 调用API
public function __call($method, $params = array()) {
- $params = ($params == array()) ? array() : $params['0'];
+ $params=($params == array()) ? array() : $params['0'];
+ return $this->call($method,$params);
+ }
+
+ // 调用API
+ public function call($method, $params = array()) {
+ $url=$this->apiurl;
+ if (strpos($method,'/')){
+ $tmp=explode('/',$method,2);
+ $url.='/'.$tmp['0'];
+ $method=$tmp['1'];
+ }
$params['action'] = $method;
$params['appid'] = $this->appid;
$params['format'] = 'json';
$params['datetime'] = $_SERVER['REQUEST_TIME'];
$params['sign'] = $this->sign($params);
//自动重试5次 防止失败!
+ $data = array();
for ($i = 0; $i < 5; $i++) {
- $data = json_decode(http::get($this->apiurl, $params), true);
- if (is_array($data)) {
+ $con = http::get($url, $params);
+ if ($con) {
+ $data = json_decode($con, true);
break;
}
}
@@ -34,10 +46,10 @@ public function __call($method, $params = array()) {
if ($data['status'] == 1) {
return $data['data'];
} else {
- log::write('调用接口失败!原因:' . $data['msg'] . ' 参数:' . var_export($params, true));
+ PT_Log::write('调用接口出现错误!原因:' . $data['msg'] . ' 参数:' . var_export($params, true));
}
} else {
- log::write('调用接口失败!方法' . $method . ' 参数:' . var_export($params, true));
+ PT_Log::write('调用接口失败!方法' . $method . ' 参数:' . var_export($params, true));
}
return array();
}
diff --git a/ptcms/library/bae/BaeImageService.class.php b/ptcms/library/bae/BaeImageService.class.php
new file mode 100644
index 0000000..0ee1139
--- /dev/null
+++ b/ptcms/library/bae/BaeImageService.class.php
@@ -0,0 +1,1399 @@
+ 'php sdk error',
+ BaeImageConstant::BAE_IMAGEUI_SDK_SYS => 'php sdk error',
+ BaeImageConstant::BAE_IMAGEUI_SDK_INIT_FAIL => 'php sdk init error',
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM => 'param invalid',
+ BaeImageConstant::BAE_IMAGEUI_SDK_HTTP_STATUS_ERROR_AND_RESULT_ERROR
+ => 'http status is error, and the body returned is not a json string',
+ BaeImageConstant::BAE_IMAGEUI_SDK_HTTP_STATUS_OK_BUT_RESULT_ERROR
+ => 'http status is ok, but the body returned is not a json string',
+ );
+
+
+ public function getRequestId()
+ {
+ return $this->_requestId;
+ }
+
+ public function __construct($accessKey, $secretKey, $host)
+ {
+ $this->paramArr = array();
+
+ if (is_null($accessKey) || $this->_checkString($accessKey, 1, 64)) {
+ $this->_clientId = $accessKey;
+ } else {
+ throw new BaeException("invalid param - access key[${accessKey}], which must be a 1 - 64 length string",
+ BaeImageConstant::BAE_IMAGEUI_SDK_INIT_FAIL);
+ }
+
+ if (is_null($secretKey) || $this->_checkString($secretKey, 1, 64)) {
+ $this->_clientSecret = $secretKey;
+ } else {
+ throw new BaeException("invalid param - secret key[${secretKey}], which must be a 1 - 64 length string",
+ BaeImageConstant::BAE_IMAGEUI_SDK_INIT_FAIL);
+ }
+
+ if (is_null($host) || $this->_checkString($host, 1, 1024)) {
+ if (!is_null($host)) {
+ $this->_host = $host;
+ }
+ } else {
+ throw new BaeException("invalid param - host[${host}], which must be a 1 - 1024 length string",
+ BaeImageConstant::BAE_IMAGEUI_SDK_INIT_FAIL);
+ }
+ $this->_resetErrorStatus();
+
+ }
+
+ private function _get_ak_sk_host(&$opt, $opt_key, $member, $g_key, $env_key, $min, $max)
+ {
+ $dis = array(
+ 'client_id' => 'access_key',
+ 'client_secret' => 'secret_key',
+ 'host' => 'host'
+ );
+
+ global $$g_key;
+
+ if (isset($opt[$opt_key])) {
+ if (!$this->_checkString($opt[$opt_key], $min, $max)) {
+ throw new BaeException('invalid ' . $dis[$opt_key] . ' in $optinal('
+ . $opt[$opt_key] . '), which must be a ' . $min . ' - ' . $max . ' length string',
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ return;
+ }
+ if ($this->_checkString($member, $min, $max)) {
+ $opt[$opt_key]= $member;
+ return;
+ }
+ if (isset($$g_key)) {
+ if (!$this->_checkString($$g_key, $min, $max)) {
+ throw new BaeException('invalid ' . $g_key . ' in global area('
+ . $$g_key . '), which must be a ' . $min . ' - ' . $max . ' length string',
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ $opt[$opt_key]= $$g_key;
+ return;
+ }
+ if (false !== getenv($env_key)) {
+ if (! $this->_checkString(getenv($env_key), $min, $max)) {
+ throw new BaeException('invalid ' . $env_key . ' in environment variable('
+ . getenv($env_key). '), which must be a ' . $min . ' - ' . $max . ' length string',
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ $opt[$opt_key]= getenv($env_key);
+ return;
+ }
+ if ($opt_key === self::HOST) {
+ $opt[$opt_key]= self::DEFAULT_HOST;
+ return;
+ }
+
+ throw new BaeException('no param(' . $dis[$opt_key] . ')was found', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+
+ private function _adjustOpt(&$opt)
+ {
+ if (! isset($opt) || empty($opt) || !is_array($opt)) {
+ throw new BaeException('no params are set', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if (!isset($opt[self::TIMESTAMP])) {
+ $opt[self::TIMESTAMP]= time();
+ }
+
+ $this->_get_ak_sk_host($opt, self::ACCESS_KEY, $this->_clientId,
+ 'g_accessKey', 'HTTP_BAE_ENV_AK', 1, 64);
+ $this->_get_ak_sk_host($opt, self::SECRET_KEY, $this->_clientSecret,
+ 'g_secretKey', 'HTTP_BAE_ENV_SK', 1, 64);
+ $this->_get_ak_sk_host($opt, self::HOST, $this->_host,
+ 'g_host', 'HTTP_BAE_ENV_ADDR_BUS', 1, 1024);
+ }
+
+ private function _getSign(&$opt, &$arrContent, $arrNeed = array())
+ {
+ $arrData = array();
+ $arrContent = array();
+ $arrNeed[] = self::TIMESTAMP;
+ $arrNeed[] = self::METHOD;
+ $arrNeed[] = self::ACCESS_KEY;
+ if (isset($opt[self::EXPIRES])) {
+ $arrNeed[] = self::EXPIRES;
+ }
+ if (isset($opt[self::VERSION])) {
+ $arrNeed[] = self::VERSION;
+ }
+
+ $arrExclude = array(self::HOST, self::SECRET_KEY);
+ foreach ($arrNeed as $key) {
+ if (!isset($opt[$key]) || (!is_integer($opt[$key]) && empty($opt[$key]))) {
+ throw new BaeException("lack param(${key})", BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if (in_array($key, $arrExclude)) {
+ continue;
+ }
+ $arrData[$key] = $opt[$key];
+ $arrContent[$key] = $opt[$key];
+ }
+ foreach ($opt as $key => $value) {
+ if (!in_array($key, $arrNeed) && !in_array($key, $arrExclude)) {
+ $arrData[$key]= $value;
+ $arrContent[$key]= $value;
+ }
+ }
+ ksort($arrData);
+ $url = 'http://' . $opt[self::HOST] . '/rest/2.0/' . self::PRODUCT . '/';
+ if (isset($opt[self::RESOURCE]) && !is_null($opt[self::RESOURCE])){
+ $url .= $opt[self::RESOURCE];
+ $arrContent[self::RESOURCE]= $opt[self::RESOURCE];
+ }else {
+ $url .= self::RESOURCE;
+ }
+ $basicString = 'POST' . $url;
+ foreach ($arrData as $key => $value) {
+ $basicString .= $key . '=' . $value;
+ }
+ $basicString .= $opt[self::SECRET_KEY];
+
+ $sign = md5(urlencode($basicString));
+ $arrContent[self::SIGN] = $sign;
+ $arrContent[self::HOST] = $opt[self::HOST];
+ }
+
+ private function _baseControl($opt)
+ {
+ $content = '';
+ $resource = self::RESOURCE;
+ if (isset($opt[self::RESOURCE]) && !is_null($opt[self::RESOURCE])) {
+ $resource = $opt[self::RESOURCE];
+ }
+
+ $host = $opt[self::HOST];
+ unset($opt[self::HOST]);
+
+ foreach ($opt as $k => $v) {
+ if (is_string($v)) {
+ $v = urlencode($v);
+ }
+ $content .= $k . '=' . $v . '&';
+ }
+ $content = substr($content, 0, strlen($content)- 1);
+ $url = 'http://' . $host . '/rest/2.0/' . self::PRODUCT . '/';
+ $url .= $resource;
+
+ $request = new RequestCore($url);
+ $headers['Content-Type'] = 'application/x-www-form-urlencoded';
+ $headers['User-Agent'] = 'Baidu ImageUi Phpsdk Client';
+ foreach ($headers as $headerKey => $headerValue) {
+ $headerValue = str_replace(array("\r", "\n"), '', $headerValue);
+ if ($headerValue !== '') {
+ $request->add_header($headerKey, $headerValue);
+ }
+ }
+ $request->set_method('POST');
+ $request->set_body($content);
+ $request->send_request();
+ return new ResponseCore($request->get_response_header(),
+ $request->get_response_body(),
+ $request->get_response_code());
+ }
+
+
+ private function _commonProcess($paramOpt = NULL, $arrNeed = array())
+ {
+ $this->_adjustOpt($paramOpt);
+ $arrContent = array();
+ $this->_getSign($paramOpt, $arrContent, $arrNeed);
+ /****************************debug**********************/
+ //var_dump($arrContent);
+ $ret = $this->_baseControl($arrContent);
+ if (empty($ret)) {
+ throw new BaeException('base control returned empty object', BaeImageConstant::BAE_IMAGEUI_SDK_SYS);
+ }
+ if ($ret->isOK()) {
+ $result = json_decode($ret->body, true);
+ if (is_null($result)) {
+ throw new BaeException($ret->body,
+ BaeImageConstant::BAE_IMAGEUI_SDK_HTTP_STATUS_OK_BUT_RESULT_ERROR);
+ }
+ $this->_requestId = $result['request_id'];
+
+ return $result;
+ }
+ $result = json_decode($ret->body, true);
+ if (is_null($result)) {
+ throw new BaeException('ret body: ' . $ret->body,
+ BaeImageConstant::BAE_IMAGEUI_SDK_HTTP_STATUS_ERROR_AND_RESULT_ERROR);
+ }
+ $this->_requestId = $result['request_id'];
+
+ trigger_error("request_id : " . $this->_requestId . ", fail . error_msg: "
+ . $result['error_msg'].", error_code: " . $result['error_code'],
+ E_USER_WARNING);
+ throw new BaeException($result['error_msg'], $result['error_code']);
+ }
+
+ /**
+ * Apply transforms into an image
+ * @param baeImageSource array image source,
+ * contains image source or image url
+ * @param baeImageTransform BaeImageTransform, contains variety transforms
+ * @param isURL booltrue for image source is URL, false for image
+ * byte string
+ * @return Image-relevant data,if success, otherwise return false
+ */
+ public function applyTransformByObject($baeImageSource, $baeImageTransform)
+ {
+ $isURL=true;
+ $URL = '';
+ $this->_resetErrorStatus();
+ try {
+ if(empty($baeImageTransform) || !($baeImageTransform instanceof BaeImageTransform)){
+ throw new BaeException('input source is not an instance of BaeImageTransform', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if($baeImageTransform->errcode !== 0){
+ $this->errcode = $baeImageTransform->errcode;
+ $this->errmsg = $baeImageTransform->errmsg;
+ return false;
+
+ }
+ if(empty($baeImageSource)){
+ throw new BaeException('no bae image source', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+
+ /********************examming url pattern*******************************/
+ if($isURL === true){
+ $this->_examURL($baeImageSource);
+ $URL = $baeImageSource;
+ }else{
+ //restrict image into 2M
+ if(!$this->_checkString($baeImageSource, 0, 2*1024*1024)){
+ throw new BaeException('image must be less than 2M', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+
+ $paramArr = $baeImageTransform->getOperations();// obtain the operations setting on the image
+ $paramArr['src'] = $URL;
+ $arrArgs = array(
+ self::METHOD => 'process',/*'appid'=>"appid7avderfd05",'dev_uid'=>'12345','secret_key'=>'pNceSAlS4HB8fToDilmXQvwSc6nHInHW',*/
+ );
+ $arrArgs = array_merge($arrArgs, $paramArr);
+ return $this->_commonProcess($arrArgs,array('src',));
+
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+
+ }
+
+ /**
+ * Apply transforms into an image
+ * @param image string image source,
+ * contains image source or image url
+ * @param params array options operating into an image
+ * @param isURL booltrue for image source is URL, false for image
+ * byte string
+ * @return Image-relevant data,if success, otherwise return false
+ *
+ */
+ public function applyTransform($baeImageSource, $params=array())
+ {
+ $isURL=true;
+ $URL = '';
+ $baeImageTransform = new BaeImageTransform();
+ $this->_resetErrorStatus();
+ try{
+ if(!is_array($params)){
+ throw new BaeException(sprintf('invalid parameters, [%s] should be array', $params),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+
+ if (!empty($params)){
+ foreach ($params as $key => $value){
+ if(!is_string($key)){
+ throw new BaeException(sprintf('invalid key [%s]', $key),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ switch($key){
+ case BaeImageConstant::TRANSFORM_ZOOMING:
+ if(!is_array($value) || count($value) < 2 || count($value) > 3){
+ throw new BaeException('invalid zooming param', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if(count($value) == 3){
+ $baeImageTransform->setZooming($value[0], $value[1],$value[2]);
+ }else{
+ $baeImageTransform->setZooming($value[0], $value[1]);
+ }
+ break;
+ case BaeImageConstant::TRANSFORM_CROPPING:
+ if(!is_array($value) || count($value) != 4){
+ throw new BaeException('invalid cropping param', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ $baeImageTransform->setCropping($value[0], $value[1], $value[2], $value[3]);
+ break;
+ case BaeImageConstant::TRANSFORM_ROTATE:
+ $baeImageTransform->setRotation($value);
+ break;
+ case BaeImageConstant::TRANSFORM_HUE:
+ $baeImageTransform->setHue($value);
+ break;
+ case BaeImageConstant::TRANSFORM_LIGHTNESS:
+ $baeImageTransform->setLightness($value);
+ break;
+ case BaeImageConstant::TRANSFORM_CONTRAST:
+ $baeImageTransform->setContrast($value);
+ break;
+ case BaeImageConstant::TRANSFORM_SHARPNESS:
+ $baeImageTransform->setSharpness($value);
+ break;
+ case BaeImageConstant::TRANSFORM_SATURATION:
+ $baeImageTransform->setSaturation($value);
+ break;
+ case BaeImageConstant::TRANSFORM_TRANSCODE:
+ if(!is_array($value) || count($value) > 2 || count($value) == 0){
+ throw new BaeException('invalid transcode param', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if(count($value) == 2){
+ $baeImageTransform->setTranscoding($value[0], $value[1]);
+ }else{
+ $baeImageTransform->setTranscoding($value[0]);
+ }
+ break;
+ case BaeImageConstant::TRANSFORM_QUALITY:
+ $baeImageTransform->setQuality($value);
+ break;
+ case BaeImageConstant::TRANSFORM_GETGIFFIRSTFRAME:
+ $baeImageTransform->setGetGifFirstFrame();
+ break;
+ case BaeImageConstant::TRANSFORM_HORIZONTALFLIP:
+ $baeImageTransform->horizontalFlip();
+ break;
+ case BaeImageConstant::TRANSFORM_VERTICALFLIP:
+ $baeImageTransform->verticalFlip();
+ break;
+ case BaeImageConstant::TRANSFORM_AUTOROTATE:
+ $baeImageTransform->setAutorotate();
+ break;
+ case BaeImageConstant::TRANSFORM_CLEAROPERATIONS:
+ $baeImageTransform->clearOperations();
+ break;
+ default:
+ throw new BaeException(sprintf('invalid key [%s]', $key),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+ }
+ if($baeImageTransform->errcode !== 0){
+ $this->errcode = $baeImageTransform->errcode;
+ $this->errmsg = $baeImageTransform->errmsg;
+ return false;
+ }
+ if(empty($baeImageSource)){
+ throw new BaeException('no bae image source', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ // handle the baeImageSource
+ if($isURL === true){
+ $this->_examURL($baeImageSource);
+ $URL = $baeImageSource;
+ }else{
+ //restrict image into 2M
+ if(!$this->_checkString($baeImageSource, 0, 2*1024*1024)){
+ throw new BaeException('image must be less than 2M', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+
+ unset($params);
+ $params = $baeImageTransform->getOperations();
+ $params['src'] = $URL;
+ $arrArgs = array(
+ self::METHOD => 'process',);
+ $arrArgs = array_merge($arrArgs, $params);
+ return $this->_commonProcess($arrArgs,array('src',));
+
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ }
+
+
+ /**
+ * Apply an annotation into an image
+ * @param baeImageSource string, image source or image url
+ * @param isURL bool, true for $image field
+ * is URL, false for image byte string
+ * @param baeImageAnnotate BaeImageAnnotate, contains variety of
+ * operations about annotation.
+ * @return Image-relevant data,if success, otherwise return false
+ */
+ public function applyAnnotateByObject($baeImageSource, $baeImageAnnotate)
+ {
+ $isURL=true;
+ $URL = '';
+ $this->_resetErrorStatus();
+ try {
+ if(empty($baeImageAnnotate) || !($baeImageAnnotate instanceof BaeImageAnnotate)){
+ throw new BaeException('input source is not an instance of BaeImageAnnotate', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if($baeImageAnnotate->errcode !== 0){
+ $this->errcode = $baeImageAnnotate->errcode;
+ $this->errmsg = $baeImageAnnotate->errmsg;
+ return false;
+ }
+ if(empty($baeImageSource)){
+ throw new BaeException('no bae image source', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ /********************examming url pattern*******************************/
+ if($isURL === true){
+ $this->_examURL($baeImageSource);
+ $URL = $baeImageSource;
+ }else{
+ if(!$this->_checkString($baeImageSource, 0, 2*1024*1024)){
+ throw new BaeException('image must be less than 2M', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+
+ $operations = $baeImageAnnotate->getOperations();
+
+ // $operations must contain text
+ if (empty($operations['text'])) {
+ throw new BaeException('no text script', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ $jsonParams = $this->_formJsonParams($URL, $operations, $this->ProcType_Annotate, true);
+ $paramArr = array('strudata'=>$jsonParams);
+ $arrArgs = array(
+ self::METHOD => 'processExt',/*'appid'=>"appid7avderfd05",'dev_uid'=>'12345','secret_key'=>'pNceSAlS4HB8fToDilmXQvwSc6nHInHW',*/
+ );
+ $arrArgs = array_merge($arrArgs, $paramArr);
+ return $this->_commonProcess($arrArgs);
+
+ }catch (Exception $ex) {
+ //echo "exception:". $ex->getMessage();
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ }
+
+ /**
+ * Apply an annotation into an image
+ * @param image string, image source or image url
+ * @param isURL bool, true for $image field
+ * is URL, false for image data source
+ * @param params array, contains variety of
+ * operations about annotation
+ * @return Image-relevant data,if success, otherwise return false
+ */
+ public function applyAnnotate($baeImageSource, $text, $params=array())
+ {
+ $isURL=true;
+ $URL = '';
+ $baeImageAnnotate = new BaeImageAnnotate();
+ $this->_resetErrorStatus();
+ try{
+ if(!is_array($params)){
+ throw new BaeException(sprintf('invalid parameters, [%s] should be array', $params),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if (!empty($params)) {
+ foreach ($params as $key => $value){
+ if(!is_string($key)){
+ throw new BaeException(sprintf('invalid key [%s]', $key),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ switch($key){
+ case BaeImageConstant::ANNOTATE_OPACITY:
+ $baeImageAnnotate->setOpacity($value);
+ break;
+ case BaeImageConstant::ANNOTATE_OUTPUTCODE:
+ $baeImageAnnotate->setOutputCode($value);
+ break;
+ case BaeImageConstant::ANNOTATE_QUALITY:
+ $baeImageAnnotate->setQuality($value);
+ break;
+ case BaeImageConstant::ANNOTATE_FONT:
+ if(!is_array($value) || count($value) != 3){
+ throw new BaeException('invalid font param', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ $baeImageAnnotate->setFont($value[0],$value[1],$value[2]);
+ break;
+ case BaeImageConstant::ANNOTATE_POS:
+ if(!is_array($value) || count($value) != 2){
+ throw new BaeException('invalid pos param', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ $baeImageAnnotate->setPos($value[0],$value[1]);
+ break;
+ case BaeImageConstant::ANNOTATE_CLEAROPERATIONS:
+ $baeImageAnnotate->clearOperations();
+ break;
+ default:
+ throw new BaeException(sprintf('invalid key [%s]', $key),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+ }
+ if(empty($baeImageSource)){
+ throw new BaeException('no bae image source', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if(empty($text)){
+ throw new BaeException('no text script', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ $baeImageAnnotate->setText($text); // check $text
+ if($baeImageAnnotate->errcode !== 0){
+ $this->errcode = $baeImageAnnotate->errcode;
+ $this->errmsg = $baeImageAnnotate->errmsg;
+ return false;
+ }
+ /********************examming url pattern*******************************/
+ if($isURL == true){
+ $this->_examURL($baeImageSource);
+ $URL = $baeImageSource;
+ }else{
+ //restrict image into 2M
+ if(!$this->_checkString($baeImageSource, 0, 2*1024*1024)){
+ throw new BaeException('image must be less than 2M', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+ unset($params);
+
+ $operations = $baeImageAnnotate->getOperations();
+ $jsonParams = $this->_formJsonParams($URL, $operations, $this->ProcType_Annotate, true);
+ $paramArr = array('strudata'=>$jsonParams);
+ $arrArgs = array(
+ self::METHOD => 'processExt',);
+ $arrArgs = array_merge($arrArgs, $paramArr);
+ return $this->_commonProcess($arrArgs);
+
+ } catch (Exception $ex) {
+ //echo "exception:". $ex->getMessage();
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ }
+
+ /**
+ * Generate a QR Code image about a text script.
+ * @param baeImageQRCode BaeImageQRCode,contains variety of
+ * operations about QR Code
+ * @return Image-relevant data,if success, otherwise return false
+ */
+ public function applyQRCodeByObject($baeImageQRCode)
+ {
+ $this->_resetErrorStatus();
+ try {
+ if(empty($baeImageQRCode) || !($baeImageQRCode instanceof BaeImageQRCode)){
+ throw new BaeException('input source is not an instance of BaeImageQRCode', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if($baeImageQRCode->errcode !== 0){
+ $this->errcode = $baeImageQRCode->errcode;
+ $this->errmsg = $baeImageQRCode->errmsg;
+ return false;
+ }
+ $operations = $baeImageQRCode->getOperations();
+ // $operations must contain text
+ if (empty($operations['text'])) {
+ throw new BaeException('no text script', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ $jsonParams = $this->_formJsonParams(null, $operations, $this->ProcType_QRCode, false);
+ $paramArr = array('strudata'=>$jsonParams);
+ $arrArgs = array(
+ self::METHOD => 'processExt',
+ );
+ $arrArgs = array_merge($arrArgs, $paramArr);
+ return $this->_commonProcess($arrArgs);
+
+ }catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ }
+
+ /**
+ * Generate a QR Code image about a text script.
+ * @param text string,
text script for processing
+ * @param params array, contains variety of
+ * operations about QR Code
+ * @return Image-relevant data,if success, otherwise return false
+ */
+ public function applyQRCode($text, $params=array())
+ {
+ $baeImageQRCode = new BaeImageQRCode();
+ $this->_resetErrorStatus();
+ try{
+ if(empty($text)){
+ throw new BaeException('no text script', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if(!is_array($params)){
+ throw new BaeException(sprintf('invalid parameters, [%s] should be array', $params),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if (!empty($params)){
+ foreach ($params as $key => $value){
+ if(!is_string($key)){
+ throw new BaeException(sprintf('invalid key [%s]', $key),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ switch($key){
+ case BaeImageConstant::QRCODE_SIZE:
+ $baeImageQRCode->setSize($value);
+ break;
+ case BaeImageConstant::QRCODE_LEVEL:
+ $baeImageQRCode->setLevel($value);
+ break;
+ case BaeImageConstant::QRCODE_VERSION:
+ $baeImageQRCode->setVersion($value);;
+ break;
+ case BaeImageConstant::QRCODE_MARGIN:
+ $baeImageQRCode->setMargin($value);
+ break;
+ case BaeImageConstant::QRCODE_FOREGROUND:
+ $baeImageQRCode->setForeground($value);
+ break;
+ case BaeImageConstant::QRCODE_BACKGROUND:
+ $baeImageQRCode->setBackground($value);
+ break;
+ case BaeImageConstant::QRCODE_CLEAROPERATIONS:
+ $baeImageQRCode->clearOperations();
+ break;
+ default:
+ throw new BaeException(sprintf('invalid key [%s]', $key),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+ }
+ unset($params);
+ if($baeImageQRCode->errcode !== 0){
+ $this->errcode = $baeImageQRCode->errcode;
+ $this->errmsg = $baeImageQRCode->errmsg;
+ return false;
+ }
+ $operations = $baeImageQRCode->getOperations();
+ // GBK ENCODE
+ $this->_checkString2($text,'text', 1,500);
+ $text = mb_convert_encoding($text, 'GBK', 'UTF-8');
+ $operations['text'] = $text;
+ $jsonParams = $this->_formJsonParams(null, $operations, $this->ProcType_QRCode, false);
+ $paramArr = array('strudata'=>$jsonParams);
+ $arrArgs = array(
+ self::METHOD => 'processExt',);
+ $arrArgs = array_merge($arrArgs, $paramArr);
+ return $this->_commonProcess($arrArgs);
+
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ }
+
+ /**
+ * Apply composition
+ * @param composites array, a set of BaeImageComposite object
+ * @param canvas_width[optional] int,canvas width
+ * @param canvas_height[optional] int,canvas height
+ * @param outputcode[optional] BaeImageConstant, output image type
+ * @param quality[optional] int,output image quality
+ * @return Image-relevant data,if success, otherwise return false
+ */
+ public function applyCompositeByObject($composites, $canvas_width = 1000, $canvas_height = 1000,
+ $outputcode = BaeImageConstant::JPG, $quality = 80)
+ {
+
+ $this->_resetErrorStatus();
+ try {
+ if(empty($composites) || ! is_array($composites)){
+ throw new BaeException('input source is not a BaeImageComposite array', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ //common params
+ $this->_checkInt($canvas_width, 'canvas width', 0, 10000);
+ $this->_checkInt($canvas_height, 'canvas height', 0, 10000);
+ $this->_checkInt($outputcode, 'outputcode', 0, 3);
+ $this->_checkInt($quality, 'quality', 0, 100);
+ $commParams = array('desttype'=> $outputcode, 'canvas_width'=> $canvas_width,
+ 'canvas_height'=>$canvas_height, 'quality'=>$quality);
+ $len = count($composites);
+ if($len < 2){
+ throw new BaeException('short of images, at least two elements', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if($len > 2){
+ throw new BaeException('too many images, at most two elements', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ /*construct parameter array of _formJsonParmas()*/
+ $operations = array();
+ $isURL = array();
+ $imageSource = array();
+ if(!($composites[0] instanceof BaeImageComposite)){
+ throw new BaeException('input source is not an instance of BaeImageComposite', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if($composites[0]->errcode !== 0){
+ $this->errcode = $composites[0]->errcode;
+ $this->errmsg = $composites[0]->errmsg;
+ return false;
+ }
+ $operations[0] = $composites[0]->getOperations();
+ // merge common params
+ $operations = array_merge($operations, $commParams);
+ $baeImageSource = $composites[0]->getBaeImageSource();
+ if (empty($baeImageSource['data'])) {
+ throw new BaeException('no commosite image parameters', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ $imageSource[0] = $baeImageSource['data'];
+ $isURL[0] = $baeImageSource['isURL'];
+
+ for($i=1;$i<$len;$i++){
+ if(!($composites[$i] instanceof BaeImageComposite)){
+ throw new BaeException('input source is not an instance of BaeImageComposite', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if($composites[$i]->errcode !== 0){
+ $this->errcode = $composites[$i]->errcode;
+ $this->errmsg = $composites[$i]->errmsg;
+ return false;
+ }
+ $operations[1] = $composites[$i]->getOperations();
+ $baeImageSource = $composites[$i]->getBaeImageSource();
+ if (empty($baeImageSource['data'])) {
+ throw new BaeException('no commosite image parameters', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ $imageSource[1] = $baeImageSource['data'];
+ $isURL[1] = $baeImageSource['isURL'];
+ $jsonParams = $this->_formJsonParams($imageSource, $operations,$this->ProcType_Composite, $isURL);
+ $paramArr = array('strudata'=>$jsonParams);
+ $arrArgs = array(
+ self::METHOD => 'processExt',);
+ $arrArgs = array_merge($arrArgs, $paramArr);
+ $retImage = $this->_commonProcess($arrArgs);
+ }
+ return $retImage;
+
+ }catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ }
+
+ /**
+ * Apply composition
+ * @param params array, contains variety of operaitons about composite
+ * @param canvas_width[optional] int,canvas width
+ * @param canvas_height[optional] int,canvas height
+ * @param outputcode[optional] BaeImageConstant, output image type
+ * @param quality[optional] int,output image quality
+ * @return Image-relevant data,if success, otherwise return false
+ */
+ public function applyComposite($params,$canvas_width = 1000, $canvas_height = 1000,
+ $outputcode = BaeImageConstant::JPG, $quality = 80)
+ {
+ $baeImageComposite = new BaeImageComposite();
+ $this->_resetErrorStatus();
+ try{/*check common paramters*/
+ $this->_checkInt($canvas_width, 'canvas width', 0, 10000);
+ $this->_checkInt($canvas_height, 'canvas height', 0, 10000);
+ $this->_checkInt($outputcode, 'outputcode', 0, 3);
+ $this->_checkInt($quality, 'quality', 0, 100);
+ $commParams = array('desttype'=> $outputcode, 'canvas_width'=> $canvas_width,
+ 'canvas_height'=>$canvas_height, 'quality'=>$quality);
+
+ if (empty($params) || !is_array($params)) {////
+ throw new BaeException(sprintf('invalid parameters, [%s] should be array', $params),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if(count($params) < 2){
+ throw new BaeException('short of images, at least two elements', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if(count($params) > 2){
+ throw new BaeException('too many images, at most two elements', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+
+ $operations = array();
+ $isURL = array();
+ $imageSource = array();
+ $paramElement = $params[0];
+ foreach ($paramElement as $key => $value){
+ if(!is_string($key)){
+ throw new BaeException(sprintf('invalid key [%s]', $key),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ switch($key){
+ case BaeImageConstant::COMPOSITE_BAEIMAGESOURCE:
+ //if(!is_array($value) || count($value) != 2){
+ if(!is_array($value)){
+ throw new BaeException('invalid bae image source parameter', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if (empty($value[0])) {
+ throw new BaeException('no image source parameters', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if(count($value) === 2){
+ $baeImageComposite->setBaeImageSource($value[0], $value[1]);
+ }else{
+ $baeImageComposite->setBaeImageSource($value[0]);
+ }
+ break;
+ case BaeImageConstant::COMPOSITE_OPACITY:
+ $baeImageComposite->setOpacity($value);
+ break;
+ case BaeImageConstant::COMPOSITE_ANCHOR:
+ $baeImageComposite->setAnchor($value);
+ break;
+ case BaeImageConstant::COMPOSITE_POS:
+ if(!is_array($value) || count($value) != 2){
+ throw new BaeException('invalid position parameter', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ $baeImageComposite->setPos($value[0],$value[1]);
+ break;
+ case BaeImageConstant::COMPOSITE_CLEAROPERATIONS:
+ $baeImageComposite->clearOperations();
+ break;
+ default:
+ throw new BaeException(sprintf('invalid key [%s]', $key),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+ if($baeImageComposite->errcode !== 0){
+ $this->errcode = $baeImageComposite->errcode;
+ $this->errmsg = $baeImageComposite->errmsg;
+ return false;
+ }
+ $operations[0] = $baeImageComposite->getOperations();
+ $operations = array_merge($operations, $commParams);
+ $baeImageSource = $baeImageComposite->getBaeImageSource();
+ $imageSource[0] = $baeImageSource['data'];
+ $isURL[0] = $baeImageSource['isURL'];
+
+ for($i=1,$len=count($params);$i<$len;$i++){
+ $baeImageComposite->clearOperations();
+ $paramElement = $params[$i];
+ foreach ($paramElement as $key => $value){
+ if(!is_string($key)){
+ throw new BaeException(sprintf('invalid key [%s]', $key),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ switch($key){
+ case BaeImageConstant::COMPOSITE_BAEIMAGESOURCE:
+ if(!is_array($value)){
+ throw new BaeException('invalid bae image source parameter', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if (empty($value[0])) {
+ throw new BaeException('no image source parameters', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if(count($value) === 2){
+ $baeImageComposite->setBaeImageSource($value[0], $value[1]);
+ }else{
+ $baeImageComposite->setBaeImageSource($value[0]);
+ }
+ break;
+ case BaeImageConstant::COMPOSITE_OPACITY:
+ $baeImageComposite->setOpacity($value);
+ break;
+ case BaeImageConstant::COMPOSITE_ANCHOR:
+ $baeImageComposite->setAnchor($value);
+ break;
+ case BaeImageConstant::COMPOSITE_POS:
+ if(!is_array($value) || count($value) != 2){
+ throw new BaeException('invalid position parameter', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ $baeImageComposite->setPos($value[0],$value[1]);
+ break;
+ case BaeImageConstant::COMPOSITE_CLEAROPERATIONS:
+ $baeImageComposite->clearOperations();
+ break;
+ default:
+ throw new BaeException(sprintf('invalid key [%s]', $key),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+ if($baeImageComposite->errcode !== 0){
+ $this->errcode = $baeImageComposite->errcode;
+ $this->errmsg = $baeImageComposite->errmsg;
+ return false;
+
+ }
+ $operations[1] = $baeImageComposite->getOperations();
+ $baeImageSource = $baeImageComposite->getBaeImageSource();
+ $imageSource[1] = $baeImageSource['data'];
+ $isURL[1] = $baeImageSource['isURL'];
+
+ $jsonParams = $this->_formJsonParams($imageSource, $operations,
+ $this->ProcType_Composite, $isURL);
+ $paramArr = array('strudata'=>$jsonParams);
+ $arrArgs = array(
+ self::METHOD => 'processExt',);
+ $arrArgs = array_merge($arrArgs, $paramArr);
+ $retImage = $this->_commonProcess($arrArgs);
+ }
+ return $retImage;
+ } catch (Exception $ex) {
+ //echo "exception:" . $ex->getMessage();
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ }
+
+ /**
+ * Generate verificaion code
+ * @param baeImageVCode BaeImageVCode, contains variety of setting about vcdoe
+ * @return image url of vcode,if success, otherwise return false
+ */
+ public function generateVCode($params=array())
+ {
+ $this->_resetErrorStatus();
+ $baeImageVCode = new BaeImageVCode();
+ try {
+ if(!is_array($params)){
+ throw new BaeException(sprintf('invalid parameters, [%s] should be array', $params),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+
+ if (!empty($params)) {
+ foreach ($params as $key => $value){
+ if(!is_string($key)){
+ throw new BaeException(sprintf('invalid key [%s]', $key),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ switch ($key){
+ case BaeImageConstant::VCODE_LEN:
+ $baeImageVCode->setLen($value);
+ break;
+ case BaeImageConstant::VCODE_PATTERN:
+ $baeImageVCode->setPattern($value);
+ break;
+ case BaeImageConstant::VCODE_CLEAROPERATIONS:
+ $baeImageVCode->clearOperations();
+ break;
+ default:
+ throw new BaeException(sprintf('invalid key [%s]', $key),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+ }
+ unset($params);
+ if($baeImageVCode->errcode !== 0){
+ $this->errcode = $baeImageVCode->errcode;
+ $this->errmsg = $baeImageVCode->errmsg;
+ return false;
+ }
+
+ $paramArr = $baeImageVCode->getOperations();// obtain the operations setting on the vcode
+ $paramArr['vcservice'] = 0;//generate vcode
+ $arrArgs = array(
+ self::METHOD => 'process',
+ );
+ $arrArgs = array_merge($arrArgs, $paramArr);
+ $retArr = $this->_commonProcess($arrArgs);
+ $retStatus = $retArr['response_params']['status'];
+ if($retStatus !== 0){
+ throw new BaeException('failed to get verification code', BaeImageConstant::BAE_IMAGEUI_SDK_HTTP_STATUS_OK_BUT_RESULT_ERROR);
+ }
+ return $retArr;
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+
+ }
+
+ /**
+ * Verify vcode
+ * @param baeImageVCode BaeImageVCode, contains variety of setting about vcdoe
+ * @return result of vcode,if success, otherwise return false
+ */
+ public function verifyVCode($params)
+ {
+ $this->_resetErrorStatus();
+ $baeImageVCode = new BaeImageVCode();
+ try {
+ if(empty($params)){
+ throw new BaeException(sprintf('invalid parameters, [%s] is empty', $params),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if(!is_array($params)){
+ throw new BaeException(sprintf('invalid parameters, [%s] should be array', $params),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if(empty($params['input'])){
+ throw new BaeException(sprintf('invalid parameters, [%s] input field is empty ', $params),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if(empty($params['secret'])){
+ throw new BaeException(sprintf('invalid parameters, [%s] secret field is empty ', $params),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ foreach ($params as $key => $value){
+ if(!is_string($key)){
+ throw new BaeException(sprintf('invalid key [%s]', $key),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ switch ($key){
+ case BaeImageConstant::VCODE_INPUT:
+ $baeImageVCode->setInput($value);
+ break;
+ case BaeImageConstant::VCODE_SECRET:
+ $baeImageVCode->setSecret($value);
+ break;
+ case BaeImageConstant::VCODE_CLEAROPERATIONS:
+ $baeImageVCode->clearOperations();
+ break;
+ default:
+ throw new BaeException(sprintf('invalid key [%s]', $key),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+
+ unset($params);
+ if($baeImageVCode->errcode !== 0){
+ $this->errcode = $baeImageVCode->errcode;
+ $this->errmsg = $baeImageVCode->errmsg;
+ return false;
+ }
+ $paramArr = $baeImageVCode->getOperations();// obtain the operations setting on the vcode
+ $paramArr['vcservice'] = 1;//verify vcode
+ $arrArgs = array(
+ self::METHOD => 'process',
+ );
+ $arrArgs = array_merge($arrArgs, $paramArr);
+ return $this->_commonProcess($arrArgs);
+
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ }
+
+ /*
+ *
+ * formed json type params using the given input
+ * @param type mixed $imageSource, image source data or url
+ * @param type array $operations
+ * @param int $procType
+ * @param bool $isURL
+ *
+ * @return the json-formed params
+ */
+ private function _formJsonParams($imageSource, $operations, $procType, $isURL)
+ {
+ $jsonParamArr = array();
+ switch ($procType) {
+ /****************************QR Code*******************************/
+ case 0:
+ $jsonParamArr['process_type'] = $procType . '';// value = '0'
+ $jsonParamArr['req_data_num'] = '1'; // fixed value;
+ $jsonParamArr['req_data_source'] = array();
+ $jsonParamArr['source_data'] = array();
+ $text = $this->_getOperation($operations, 'text'); //get text in qr code
+ $jsonParamArr['source_data']['data1'] = base64_encode($text);
+ $jsonParamArr['req_data_source'][0] = array('sourcemethod' => 'BODY');
+ $jsonParamArr['req_data_source'][0]['source_data_type'] = 0; //0-text script, 1-image
+ $jsonParamArr['req_data_source'][0]['operations'] = array();
+ $jsonParamArr['req_data_source'][0]['http_reqpack'] = array(); //reserve
+
+ if(!is_null($this->_getOperation($operations, 'size'))){
+ $jsonParamArr['req_data_source'][0]['operations']['size'] = $this->_getOperation($operations, 'size');
+ }else{
+ $jsonParamArr['req_data_source'][0]['operations']['size'] = 3;
+ }
+
+ if(!is_null($this->_getOperation($operations, 'version'))){
+ $jsonParamArr['req_data_source'][0]['operations']['version'] = $this->_getOperation($operations, 'version');
+ }else{
+ $jsonParamArr['req_data_source'][0]['operations']['version'] = 0;
+ }
+
+ if(!is_null($this->_getOperation($operations,'margin'))){
+ $jsonParamArr['req_data_source'][0]['operations']['margin'] = $this->_getOperation($operations,'margin');
+ }else{
+ $jsonParamArr['req_data_source'][0]['operations']['margin'] = 4;
+ }
+ if(!is_null($this->_getOperation($operations,'level'))){
+ $jsonParamArr['req_data_source'][0]['operations']['level'] = $this->_getOperation($operations,'level');
+ }else{
+ $jsonParamArr['req_data_source'][0]['operations']['level'] = 2;
+ }
+
+ if(!is_null($this->_getOperation($operations,'foreground'))){
+ $jsonParamArr['req_data_source'][0]['operations']['foreground'] = $this->_getOperation($operations,'foreground');
+ }else{
+ $jsonParamArr['req_data_source'][0]['operations']['foreground'] = '000000';
+ }
+ if(!is_null($this->_getOperation($operations,'background'))){
+ $jsonParamArr['req_data_source'][0]['operations']['background'] = $this->_getOperation($operations,'background');
+ }else{
+ $jsonParamArr['req_data_source'][0]['operations']['background'] = 'FFFFFF';
+ }
+ break;
+ /****************Annotate*********************/
+ case 1:
+ $jsonParamArr['process_type'] = $procType . '';// value = '1'
+ $jsonParamArr['req_data_num'] = '2'; // fixed value;
+ $jsonParamArr['req_data_source'] = array();
+ $jsonParamArr['source_data'] = array();
+ $text = $this->_getOperation($operations, 'text'); //get text in annotate
+ if($isURL === true){
+ $jsonParamArr['req_data_source'][0] = array('sourcemethod' => 'GET');
+ $jsonParamArr['req_data_source'][0]['source_url'] = $imageSource;
+ $jsonParamArr['source_data']['data1'] = base64_encode($text);
+ }else{
+ $jsonParamArr['req_data_source'][0] = array('sourcemethod' => 'BODY');
+ // image source must be filled in 'data1',if exist. followed by text in data2
+ $jsonParamArr['source_data']['data1'] = base64_encode($imageSource);
+ $jsonParamArr['source_data']['data2'] = base64_encode($text);
+
+ }
+ $jsonParamArr['req_data_source'][0]['source_data_type'] = 1;
+ $jsonParamArr['req_data_source'][0]['operations'] = array();
+ $jsonParamArr['req_data_source'][0]['http_reqpack'] = array();
+
+ $jsonParamArr['req_data_source'][1] = array('sourcemethod' => 'BODY');
+ $jsonParamArr['req_data_source'][1]['source_data_type'] = 0;
+ $jsonParamArr['req_data_source'][1]['operations'] = array();
+ $jsonParamArr['req_data_source'][1]['http_reqpack'] = array();
+ // operations cant be empty in req_data_source[0][operations]
+ if(!is_null($this->_getOperation($operations, 'x_offset'))){
+ $jsonParamArr['req_data_source'][0]['operations']['x_offset'] = $this->_getOperation($operations, 'x_offset');
+ }else{
+ $jsonParamArr['req_data_source'][0]['operations']['x_offset'] = 0;
+ }
+
+ if(!is_null($this->_getOperation($operations, 'y_offset'))){
+ $jsonParamArr['req_data_source'][0]['operations']['y_offset'] = $this->_getOperation($operations, 'y_offset');
+ }else{
+ $jsonParamArr['req_data_source'][0]['operations']['y_offset'] = 0;
+ }
+
+ if(!is_null($this->_getOperation($operations, 'opacity'))){
+ $opacity = $this->_getOperation($operations, 'opacity');
+ $strOpacity = strtoupper(dechex(ceil(255-$opacity*255)). '');
+ if(strlen($strOpacity) === 1){
+ $strOpacity = '0'. $strOpacity;
+ }
+ }else{
+ $strOpacity = "FF";
+ }
+
+ if(!is_null($this->_getOperation($operations,'font_name'))){
+ $jsonParamArr['req_data_source'][0]['operations']['font_name'] = $this->_getOperation($operations,'font_name');
+ }else{
+ $jsonParamArr['req_data_source'][0]['operations']['font_name'] = BaeImageConstant::SUN;
+ }
+ if(!is_null($this->_getOperation($operations,'font_color'))){
+ $jsonParamArr['req_data_source'][0]['operations']['font_color'] = '#'. $this->_getOperation($operations,'font_color'). $strOpacity;
+ //echo "color" . $jsonParamArr['req_data_source'][0]['operations']['font_color'];
+ }else{
+ $jsonParamArr['req_data_source'][0]['operations']['font_color'] = '#000000'. $strOpacity;
+ }
+
+ if(!is_null($this->_getOperation($operations,'font_size'))){
+ $jsonParamArr['req_data_source'][0]['operations']['font_size'] = $this->_getOperation($operations,'font_size');
+ }else{
+ $jsonParamArr['req_data_source'][0]['operations']['font_size'] = 25;
+ }
+ if(!is_null($this->_getOperation($operations,'desttype'))){
+ $jsonParamArr['req_data_source'][0]['operations']['desttype'] = $this->_getOperation($operations,'desttype');
+ }else{
+ $jsonParamArr['req_data_source'][0]['operations']['desttype'] = 0;
+ }
+ if(!is_null($this->_getOperation($operations,'quality'))){
+ $jsonParamArr['req_data_source'][0]['operations']['quality'] = $this->_getOperation($operations,'quality');
+ }else{
+ $jsonParamArr['req_data_source'][0]['operations']['quality'] = 80;
+ }
+
+ break;
+ /********************Composite**********************/
+ case 2:
+ $jsonParamArr['process_type'] = $procType . '';// value = '2'
+ $jsonParamArr['req_data_source'] = array();
+ $jsonParamArr['source_data'] = array();
+
+ $num = count($imageSource);
+ $jsonParamArr['req_data_num'] = 2 .''; // fixed value;
+ $count = 0;
+ $isEmpty = true;
+ while($count < $num){
+ if($isURL[$count] === true){
+ $jsonParamArr['req_data_source'][$count] = array('sourcemethod' => 'GET');
+ $jsonParamArr['req_data_source'][$count]['source_url'] = $imageSource[$count];
+ }else{
+ $jsonParamArr['req_data_source'][$count] = array('sourcemethod' => 'BODY');
+ if($isEmpty === true){
+ $jsonParamArr['source_data']['data1'] = base64_encode($imageSource[$count]);
+ $isEmpty = false;
+ }else{
+ $jsonParamArr['source_data']['data2'] = base64_encode($imageSource[$count]);
+ }
+
+ }
+ $jsonParamArr['req_data_source'][$count]['source_data_type'] = 1;
+ $jsonParamArr['req_data_source'][$count]['operations'] = array();
+ $jsonParamArr['req_data_source'][$count]['http_reqpack'] = array();
+ if(!is_null($this->_getOperation($operations[$count], 'x_offset'))){
+ $jsonParamArr['req_data_source'][$count]['operations']['x_offset'] = $this->_getOperation($operations[$count], 'x_offset');
+ }else{
+ $jsonParamArr['req_data_source'][$count]['operations']['x_offset'] = 0;
+ }
+
+ if(!is_null($this->_getOperation($operations[$count], 'y_offset'))){
+ $jsonParamArr['req_data_source'][$count]['operations']['y_offset'] = $this->_getOperation($operations[$count], 'y_offset');
+ }else{
+ $jsonParamArr['req_data_source'][$count]['operations']['y_offset'] = 0;
+ }
+
+ if(!is_null($this->_getOperation($operations[$count], 'opacity'))){
+ $jsonParamArr['req_data_source'][$count]['operations']['opacity'] = $this->_getOperation($operations[$count], 'opacity');
+ }else{
+ $jsonParamArr['req_data_source'][$count]['operations']['opacity'] = 0.0;
+ }
+
+ if(!is_null($this->_getOperation($operations[$count],'anchor_point'))){
+ $jsonParamArr['req_data_source'][$count]['operations']['anchor_point'] = $this->_getOperation($operations[$count],'anchor_point');
+ }else{
+ $jsonParamArr['req_data_source'][$count]['operations']['anchor_point'] = BaeImageConstant::TOP_LEFT;
+ }
+ /*********************Common params********************************/
+ if(!is_null($this->_getOperation($operations,'canvas_width'))){
+ $jsonParamArr['req_data_source'][$count]['operations']['canvas_width'] = $this->_getOperation($operations,'canvas_width');
+ }else{
+ $jsonParamArr['req_data_source'][$count]['operations']['canvas_width'] = 0;
+ }
+ if(!is_null($this->_getOperation($operations,'canvas_height'))){
+ $jsonParamArr['req_data_source'][$count]['operations']['canvas_height'] = $this->_getOperation($operations,'canvas_height');
+ }else{
+ $jsonParamArr['req_data_source'][$count]['operations']['canvas_height'] = 0;
+ }
+ if(!is_null($this->_getOperation($operations,'desttype'))){
+ $jsonParamArr['req_data_source'][$count]['operations']['desttype'] = $this->_getOperation($operations,'desttype');
+ }else{
+ $jsonParamArr['req_data_source'][$count]['operations']['desttype'] = 0;
+ }
+ if(!is_null($this->_getOperation($operations,'quality'))){
+ $jsonParamArr['req_data_source'][$count]['operations']['quality'] = $this->_getOperation($operations,'quality');
+ }else{
+ $jsonParamArr['req_data_source'][$count]['operations']['quality'] = 80;
+ }
+ $count++;
+
+ }
+ break;
+
+ }
+ return json_encode($jsonParamArr);
+ }
+
+ private function _getOperation($arrParams, $strOperation){
+ if(!empty($arrParams[$strOperation])){
+ return $arrParams[$strOperation];
+ }
+ return null;
+
+ }
+ /*
+ * Examming url pattern
+ * */
+ private function _examURL($url)
+ {
+ $this->_checkString2($url, 'url', 0, 2048);
+ $pattern = "/^(http[s]?:\/\/){1}[.]*/";
+ // regular match
+ if(!preg_match($pattern, $url)){
+ throw new BaeException(sprintf('invalid image source url[%s]', $url),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);//
+ }
+ return true;
+ }
+
+ private function _resetErrorStatus()
+ {
+ $this->errcode = 0;
+ $this->errmsg = $this->_arrayErrorMap[$this->errcode];
+ $this->_requestId = 0;
+ }
+
+ private function _exceptionHandler($ex)
+ {
+ $tmpCode = $ex->getCode();
+ if (0 === $tmpCode) {
+ $tmpCode = BaeImageConstant::BAE_IMAGEUI_SDK_SYS;
+ }
+
+ $this->errcode = $tmpCode;
+ if ($this->errcode >= 30000) {
+ $this->errmsg = $ex->getMessage();
+ } else {
+ $this->errmsg = $this->_arrayErrorMap[$this->errcode]
+ . ', detail info[' . $ex->getMessage()
+ . ', break point: ' . $ex->getFile(). ':' . $ex->getLine() . '].'
+ . "\n"
+ . $ex->getTraceAsString();
+ }
+ }
+
+ private function _checkInt($num, $prompt, $intMin = -1, $intMax = -1)
+ {
+ if (!is_integer($num)) {
+ throw new BaeException(sprintf('[%s] parameter not an integer', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if ($intMin !== -1 && $num < $intMin) {
+ throw new BaeException(sprintf('[%s] parameter less than minimum', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if ($intMax !== -1 && $intMax < $num) {
+ throw new BaeException(sprintf('[%s] parameter greater than maximum', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+
+ private function _checkString($str, $min, $max)
+ {
+ if (is_string($str) && strlen($str) >= $min && strlen($str) <= $max) {
+ return true;
+ }
+ return false;
+ }
+ private function _checkString2($str, $prompt, $min=null, $max=null)
+ {
+ if (!is_string($str)){
+ throw new BaeException(sprintf('[%s] parameter not a string', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if($min !== null && strlen($str) < $min){
+ throw new BaeException(sprintf('[%s] parameter less than minimum', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if($max !== null && strlen($str) > $max) {
+ throw new BaeException(sprintf('[%s] parameter greater than maximum', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+}
diff --git a/ptcms/library/bae/BaeMemcache.class.php b/ptcms/library/bae/BaeMemcache.class.php
new file mode 100644
index 0000000..c69c824
--- /dev/null
+++ b/ptcms/library/bae/BaeMemcache.class.php
@@ -0,0 +1,256 @@
+_handle= $memcache;
+ }
+ return;
+ }
+
+ /**
+ * Retrieve previously stored data if an item with such key exists on the server
+ * at this moment. You can pass array of keys to get array of values. The result
+ * array will contain only found key-value pairs.
+ *
+ * @param string|array $mixedKey The key or array of keys to fetch
+ * @param int|array $flag If present, flags fetched along with
+ * the values will be written to this parameter
+ * @return string|array
+ * @see http://cn.php.net/manual/zh/memcache.get.php
+ */
+ public function get($key, $flag= null)
+ {
+ if(empty($key))
+ {
+ return null;
+ }
+ $res= $this->_handle->getExt($key);
+ if(false === $res)
+ {
+ $this->errcode = $this->_handle->_last_errno;
+ $this->errmsg= $this->_handle->_convertErrmsg($this->errcode);
+ }
+ else
+ {
+ $this->errcode = 0;
+ $this->errmsg= "RES_SUCCESS";
+ }
+ return $res;
+ }
+
+ /**
+ * Store data at the memcache cluster
+ *
+ * @param string $key The key that will be associated with the item
+ * @param mixed $var The variable to store
+ * @param int $flag Use MEMCACHE_COMPRESSED to store the item compressed (uses zlib)
+ * @param int $expire Expiration time of the item. If it's equal to zero, the item will never expire
+ * @return bool
+ * @see http://cn.php.net/manual/zh/memcache.set.php
+ */
+ public function set($key, $var, $flag=0, $expire=0)
+ {
+ $res= $this->_handle->set($key, $var, $expire);
+ if(!$res)
+ {
+ $this->errcode = $this->_handle->_last_errno;
+ $this->errmsg= $this->_handle->_convertErrmsg($this->errcode);
+ }
+ else
+ {
+ $this->errcode = 0;
+ $this->errmsg= "RES_SUCCESS";
+ }
+ return $res;
+ }
+
+ /**
+ * Add an item to the memcache cluster
+ *
+ * @param string $key The key that will be associated with the item
+ * @param mix $var The variable to store
+ * @param int $flag Use MEMCACHE_COMPRESSED to store the item compressed (uses zlib)
+ * @param int $expire Expiration time of the item. If it's equal to zero, the item will never expire
+ * @return bool
+ * @see http://cn.php.net/manual/zh/memcache.add.php
+ */
+ public function add($key, $var, $flag= 0, $expire= 0)
+ {
+ $res= $this->_handle->add($key, $var, $expire);
+ if(!$res)
+ {
+ $this->errcode = $this->_handle->_last_errno;
+ $this->errmsg= $this->_handle->_convertErrmsg($this->errcode);
+ }
+ else
+ {
+ $this->errcode = 0;
+ $this->errmsg= "RES_SUCCESS";
+ }
+ return $res;
+ }
+
+ /**
+ * Replace value of the existing item in memcache cluster
+ *
+ * @param string $key The key that will be associated with the item
+ * @param mixed $var The variable to store
+ * @param int $flag Use MEMCACHE_COMPRESSED to store the item compressed (uses zlib)
+ * @param int $expire Expiration time of the item. If it's equal to zero, the item will never expire
+ * @return bool
+ * @see http://cn.php.net/manual/zh/memcache.replace.php
+ */
+ public function replace($key, $var, $flag= 0, $expire= 0)
+ {
+ $res= $this->_handle->replace($key, $var, $expire);
+ if(!$res)
+ {
+ $this->errcode = $this->_handle->_last_errno;
+ $this->errmsg= $this->_handle->_convertErrmsg($this->errcode);
+ }
+ else
+ {
+ $this->errcode = 0;
+ $this->errmsg= "RES_SUCCESS";
+ }
+ return $res;
+ }
+
+ /**
+ * Increment cache item's value at the memcache cluster
+ *
+ * @param string $key Key of the item to increment
+ * @param int $value Increment the item by value
+ * @return int
+ * @see http://cn.php.net/manual/zh/memcache.increment.php
+ */
+ public function increment($key, $value= 1)
+ {
+ $res= $this->_handle->increment($key, $value);
+ if(!$res)
+ {
+ $this->errcode = $this->_handle->_last_errno;
+ $this->errmsg= $this->_handle->_convertErrmsg($this->errcode);
+ }
+ else
+ {
+ $this->errcode = 0;
+ $this->errmsg= "RES_SUCCESS";
+ }
+ return $res;
+ }
+
+ /**
+ * Decrement cache item's value at the memcache cluster
+ *
+ * @param string $key Key of the item to decrement
+ * @param int $value Dncrement the item by value
+ * @return int
+ * @see http://cn.php.net/manual/zh/memcache.decrement.php
+ */
+ public function decrement($key, $value= 1)
+ {
+ $res= $this->_handle->decrement($key, $value);
+ if(!$res)
+ {
+ $this->errcode = $this->_handle->_last_errno;
+ $this->errmsg= $this->_handle->_convertErrmsg($this->errcode);
+ }
+ else
+ {
+ $this->errcode = 0;
+ $this->errmsg= "RES_SUCCESS";
+ }
+ return $res;
+ }
+
+ /**
+ * Delete item from the memcache cluster
+ *
+ * @param string $key The key associated with the item to delete
+ * @param int $time The value will be deleted whithin $time seconds.
+ * @return bool
+ * @see http://cn.php.net/manual/zh/function.memcache-delete.php
+ */
+ public function delete($key, $time = 0)
+ {
+ $res= $this->_handle->delete($key, $time);
+ if(!$res)
+ {
+ $this->errcode = $this->_handle->_last_errno;
+ $this->errmsg= $this->_handle->_convertErrmsg($this->errcode);
+ }
+ else
+ {
+ $this->errcode = 0;
+ $this->errmsg= "RES_SUCCESS";
+ }
+ return $res;
+ }
+
+ /**
+ * Close memcached connection
+ *
+ */
+ public function close()
+ {
+ if($this->_handle)
+ {
+ //return $this->_handle->close();
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public function set_shareAppid($appid)
+ {
+ if(!is_string($appid)) return false;
+
+ $ret = $this->_handle->set_shareAppid($appid);
+ if($ret === false) return false;
+
+ $this->appid = $appid;
+ return true;
+ }
+
+ public function __destruct()
+ {
+ $this->close();
+ }
+
+}
+
+/* vim: set ts=4 sw=4 sts=4 tw=100 noet: */
diff --git a/ptcms/library/bae/images/BaeImageAnnotate.class.php b/ptcms/library/bae/images/BaeImageAnnotate.class.php
new file mode 100644
index 0000000..3950740
--- /dev/null
+++ b/ptcms/library/bae/images/BaeImageAnnotate.class.php
@@ -0,0 +1,254 @@
+ 'php sdk error',
+ BaeImageConstant::BAE_IMAGEUI_SDK_SYS => 'php sdk error',
+ BaeImageConstant::BAE_IMAGEUI_SDK_INIT_FAIL => 'php sdk init error',
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM => 'param invalid',
+ BaeImageConstant::BAE_IMAGEUI_SDK_HTTP_STATUS_ERROR_AND_RESULT_ERROR
+ => 'http status is error, and the body returned is not a json string',
+ BaeImageConstant::BAE_IMAGEUI_SDK_HTTP_STATUS_OK_BUT_RESULT_ERROR
+ => 'http status is ok, but the body returned is not a json string',
+ );
+
+ public function __construct($text = NULL)
+ {
+ $this->_resetErrorStatus();
+ $this->paramArr = array();
+ if(!is_null($text)){
+ $this->setText($text);
+ }
+
+ }
+ /**
+ * The text script of annotation
+ * @param text string,range: 1-500 characters
+ */
+ public function setText($text)
+ {
+ try {
+ $this->_checkString($text, 1, 500);
+ $this->text = $text;
+ $this->paramArr['text'] = $text;
+ }catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+
+ public function getText()
+ {
+ return $this->text;
+
+ }
+
+ public function getOperations()
+ {
+ return $this->paramArr;
+ }
+
+ private function setParam($key, $value)
+ {
+ $this->paramArr[$key] = $value;
+ }
+ /**
+ * The opacity of an image
+ * @param floatOpacity float,range: 0-1
+ */
+ public function setOpacity($floatOpacity)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ $this->_checkFloat($floatOpacity, 'opacity', 0.0, 1.0);
+ $this->setParam('opacity', $floatOpacity);
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+
+ }
+ /**
+ * Font options
+ * @param name BaeImageConstant
+ * @param size int, range: 0-1000,default 5
+ * @param color string,range: 6 bits RGB,default '000000'
+ */
+ public function setFont($name, $size, $color)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ $this->_checkInt($name,'font name', 0, 4);
+ $this->_checkInt($size, 'font size' ,0, 1000);
+ $this->_checkRGB($color);
+ $this->setParam('font_name', $name);
+ $this->setParam('font_color', $color);
+ $this->setParam('font_size', $size);
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+
+ }
+ /**
+ * Position of the text script
+ * @param x_offset int,range: 0-width of the image
+ * @param y_offset int,range: 0-height of the image
+ */
+ public function setPos($x_offset, $y_offset)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ $this->_checkInt($x_offset, 'x_offset', 0);//without restriction
+ $this->_checkInt($y_offset, 'y_offset', 0);//without restriction
+ $this->setParam('x_offset', $x_offset);
+ $this->setParam('y_offset', $y_offset);
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+
+ }
+ /**
+ * The output image type
+ * @param outputcode BaeImageConstant,support by JPG,GIF,BMP,PNG,WEBP
+ */
+ public function setOutputCode($outputcode)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ $this->_checkInt($outputcode, 'outputcode', 0, 4);
+ $this->setParam('desttype', $outputcode);
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+
+ }
+ /**
+ * The quality of output image
+ * @param intQuality int,
range: 0-100,default 80
+ */
+ public function setQuality($intQuality)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ $this->_checkInt($intQuality, 'quality', 0, 100);
+ $this->setParam('quality', $intQuality);
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+
+ }
+
+ public function clearOperations()
+ {
+ $this->paramArr = array();
+ return true;
+ }
+
+ private function _checkRGB($strRGB){
+ $this->_checkString($strRGB, 6, 6);
+ $pattern = "/[AaBbCcDdEeFf0123456789]{6}/";
+ // regular match
+ if(!preg_match($pattern, $strRGB)){
+ throw new BaeException(sprintf('invalid RGB color[%s]', $strRGB),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);//
+ }
+ }
+
+ private function _checkFloat($num, $prompt, $floatMin = null, $floatMax = null)
+ {
+ if(is_integer($num)){
+ $num = floatval($num);
+ }
+ if(!is_float($num)){
+ throw new BaeException(sprintf('[%s] parameter not a float', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if($floatMin !== null && $num < $floatMin){
+ throw new BaeException(sprintf('[%s] parameter less than minimum', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if($floatMax !== null && $num > $floatMax){
+ throw new BaeException(sprintf('[%s] parameter greater than maximum', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+
+ private function _checkEnum($value, $arrEnum = array(0,1,2),$name)
+ {
+ if(!in_array($value, $arrEnum)) {
+ throw new Exception(sprintf('Param % is incorrect',$name));
+ }
+ }
+
+ private function _checkInt($num, $prompt, $intMin = -1, $intMax = -1)
+ {
+ if (!is_integer($num)) {
+ throw new BaeException(sprintf('[%s] parameter not an integer', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if ($intMin !== -1 && $num < $intMin) {
+ throw new BaeException(sprintf('[%s] parameter less than minimum', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if ($intMax !== -1 && $intMax < $num) {
+ throw new BaeException(sprintf('[%s] parameter greater than maximum', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+
+ private function _checkString($str, $min=null, $max=null)
+ {
+ if (!is_string($str)){
+ throw new BaeException(sprintf('[%s] parameter not a string', $str), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if($min !== null && strlen($str) < $min){
+ throw new BaeException(sprintf('[%s] parameter less than minimum', $str), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if($max !== null && strlen($str) > $max) {
+ throw new BaeException(sprintf('[%s] parameter greater than maximum', $str), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+
+ private function _resetErrorStatus()
+ {
+ $this->errcode = 0;
+ $this->errmsg = $this->_arrayErrorMap[$this->errcode];
+ $this->_requestId = 0;
+ }
+
+ private function _exceptionHandler($ex)
+ {
+ $tmpCode = $ex->getCode();
+ if (0 === $tmpCode) {
+ $tmpCode = BaeImageConstant::BAE_IMAGEUI_SDK_SYS;
+ }
+
+ $this->errcode = $tmpCode;
+ if ($this->errcode >= 30000) {
+ $this->errmsg = $ex->getMessage();
+ } else {
+ $this->errmsg = $this->_arrayErrorMap[$this->errcode]
+ . ', detail info[' . $ex->getMessage()
+ . ', break point: ' . $ex->getFile(). ':' . $ex->getLine() . '].'
+ . "\n"
+ . $ex->getTraceAsString();
+ }
+ }
+}
\ No newline at end of file
diff --git a/ptcms/library/bae/images/BaeImageComposite.class.php b/ptcms/library/bae/images/BaeImageComposite.class.php
new file mode 100644
index 0000000..a3e6f09
--- /dev/null
+++ b/ptcms/library/bae/images/BaeImageComposite.class.php
@@ -0,0 +1,246 @@
+ 'php sdk error',
+ BaeImageConstant::BAE_IMAGEUI_SDK_SYS => 'php sdk error',
+ BaeImageConstant::BAE_IMAGEUI_SDK_INIT_FAIL => 'php sdk init error',
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM => 'param invalid',
+ BaeImageConstant::BAE_IMAGEUI_SDK_HTTP_STATUS_ERROR_AND_RESULT_ERROR
+ => 'http status is error, and the body returned is not a json string',
+ BaeImageConstant::BAE_IMAGEUI_SDK_HTTP_STATUS_OK_BUT_RESULT_ERROR
+ => 'http status is ok, but the body returned is not a json string',
+ );
+
+ public function __construct($baeImageSource = NULL)
+ {
+ $isURL = true;
+ $this->_resetErrorStatus();
+ try{
+ if(!is_null($baeImageSource)){
+ if($isURL === true){
+ $this->_examURL($baeImageSource);
+ $this->baeImageSource = $baeImageSource;
+ }
+ else{
+ if(!$this->_checkString($baeImageSource, 0, 2*1024*1024)){
+ throw new BaeException('image must be less than 2M', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+ $this->isURL = true;
+ }
+ }catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ }
+ /**
+ * Setting the image source
+ * @param baeImageSource string, image source url or byte string
+ * @param isURL bool,true for $baeImageSource is url pattern, false for byte string
+ */
+ public function setBaeImageSource($baeImageSource)
+ {
+ $isURL=true;
+ try{
+ if(empty($baeImageSource)){
+ throw new BaeException('no bae image source', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if($isURL === true){
+ $this->_examURL($baeImageSource);
+ $this->baeImageSource = $baeImageSource;
+ }
+ else{
+ if(!$this->_checkString($baeImageSource, 0, 2*1024*1024)){
+ throw new BaeException('image must be less than 2M', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+ $this->isURL = true;
+ }catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+
+ public function getBaeImageSource()
+ {
+ return array('data'=>$this->baeImageSource, 'isURL'=>$this->isURL);
+ }
+
+ public function getOperations()
+ {
+ return $this->paramArr;
+ }
+
+ private function setParam($key, $value)
+ {
+ $this->paramArr[$key] = $value;
+ }
+ /**
+ * Position of the image apart from anchor point
+ * @param x_offset int
+ * @param y_offset int
+ */
+ public function setPos($x_offset, $y_offset)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ $this->_checkInt($x_offset, 'x_offset');//without restriction
+ $this->_checkInt($y_offset, 'y_offset');//without restriction
+ $this->setParam('x_offset', $x_offset);
+ $this->setParam('y_offset', $y_offset);
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+
+ }
+ /**
+ * Opacity of the image
+ * @param floatOpacity float,range: 0-1
+ */
+ public function setOpacity($floatOpacity)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ $this->_checkFloat($floatOpacity, 'opacity', 0.0, 1.0);
+ $this->setParam('opacity', $floatOpacity);
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+
+ }
+ /**
+ * Anchor point of the image
+ * @param anchor BaeImageConstant,range: 0-8,default 0
+ */
+ public function setAnchor($anchor)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ $this->_checkInt($anchor, 'anchor', 0, 8);
+ $this->setParam('anchor_point', $anchor);
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+
+ }
+
+ public function clearOperations()
+ {
+ $this->paramArr = array();
+ return true;
+ }
+
+
+
+ private function _checkFloat($num, $prompt, $floatMin = null, $floatMax = null)
+ {
+ if(is_integer($num)){
+ $num = floatval($num);
+ }
+ if(!is_float($num)){
+ throw new BaeException(sprintf('[%s] parameter not a float', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if($floatMin !== null && $num < $floatMin){
+ throw new BaeException(sprintf('[%s] parameter less than minimum', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if($floatMax !== null && $num > $floatMax){
+ throw new BaeException(sprintf('[%s] parameter greater than maximum', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+
+ private function _checkInt($num, $prompt, $intMin = -1, $intMax = -1)
+ {
+ if (!is_integer($num)) {
+ throw new BaeException(sprintf('[%s] parameter not an integer', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if ($intMin !== -1 && $num < $intMin) {
+ throw new BaeException(sprintf('[%s] parameter less than minimum', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if ($intMax !== -1 && $intMax < $num) {
+ throw new BaeException(sprintf('[%s] parameter greater than maximum', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+
+ private function _checkString($str, $min, $max)
+ {
+ if (is_string($str) && strlen($str) >= $min && strlen($str) <= $max) {
+ return true;
+ }
+ return false;
+ }
+ private function _checkString2($str, $prompt, $min=null, $max=null)
+ {
+ if (!is_string($str)){
+ throw new BaeException(sprintf('[%s] parameter not a string', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if($min !== null && strlen($str) < $min){
+ throw new BaeException(sprintf('[%s] parameter less than minimum', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if($max !== null && strlen($str) > $max) {
+ throw new BaeException(sprintf('[%s] parameter greater than maximum', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+
+ /*
+ * Examming url pattern
+ * */
+ private function _examURL($url)
+ {
+ $this->_checkString2($url, 'url', 0, 2048);
+ $pattern = "/^(http[s]?:\/\/){1}[.]*/";
+ // regular match
+ if(!preg_match($pattern, $url)){
+ throw new BaeException(sprintf('invalid image source url[%s]', $url),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);//
+ }
+ return true;
+ }
+
+ private function _resetErrorStatus()
+ {
+ $this->errcode = 0;
+ $this->errmsg = $this->_arrayErrorMap[$this->errcode];
+ $this->_requestId = 0;
+ }
+
+ private function _exceptionHandler($ex)
+ {
+ $tmpCode = $ex->getCode();
+ if (0 === $tmpCode) {
+ $tmpCode = BaeImageConstant::BAE_IMAGEUI_SDK_SYS;
+ }
+
+ $this->errcode = $tmpCode;
+ if ($this->errcode >= 30000) {
+ $this->errmsg = $ex->getMessage();
+ } else {
+ $this->errmsg = $this->_arrayErrorMap[$this->errcode]
+ . ', detail info[' . $ex->getMessage()
+ . ', break point: ' . $ex->getFile(). ':' . $ex->getLine() . '].'
+ . "\n"
+ . $ex->getTraceAsString();
+ }
+ }
+
+}
diff --git a/ptcms/library/bae/images/BaeImageConstant.class.php b/ptcms/library/bae/images/BaeImageConstant.class.php
new file mode 100644
index 0000000..700e587
--- /dev/null
+++ b/ptcms/library/bae/images/BaeImageConstant.class.php
@@ -0,0 +1,99 @@
+
\ No newline at end of file
diff --git a/ptcms/library/bae/images/BaeImageQRCode.class.php b/ptcms/library/bae/images/BaeImageQRCode.class.php
new file mode 100644
index 0000000..23a5e4e
--- /dev/null
+++ b/ptcms/library/bae/images/BaeImageQRCode.class.php
@@ -0,0 +1,235 @@
+ 'php sdk error',
+ BaeImageConstant::BAE_IMAGEUI_SDK_SYS => 'php sdk error',
+ BaeImageConstant::BAE_IMAGEUI_SDK_INIT_FAIL => 'php sdk init error',
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM => 'param invalid',
+ BaeImageConstant::BAE_IMAGEUI_SDK_HTTP_STATUS_ERROR_AND_RESULT_ERROR
+ => 'http status is error, and the body returned is not a json string',
+ BaeImageConstant::BAE_IMAGEUI_SDK_HTTP_STATUS_OK_BUT_RESULT_ERROR
+ => 'http status is ok, but the body returned is not a json string',
+ );
+
+ public function __construct($text = NULL)
+ {
+ $this->_resetErrorStatus();
+ $this->paramArr = array();
+ if(!is_null($text)){
+ $this->setText($text);
+ }
+
+ }
+ /**
+ * Setting the text script
+ * @param text string,the text script to generate QR coderange: 1-500 characters
+ */
+ public function setText($text)
+ {
+ try {
+ $this->_checkString($text);//check if it is not a string
+ $text = mb_convert_encoding($text, 'GBK', 'UTF-8');
+ //echo "---------:". $text." len:". strlen($text);
+ $this->_checkString($text, 1, 500);
+ $this->text = $text;
+ $this->paramArr['text'] = $text;
+ }catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+
+ public function getText()
+ {
+ return $this->text;
+ }
+
+ public function getOperations()
+ {
+ return $this->paramArr;
+ }
+
+ private function setParam($key, $value)
+ {
+ $this->paramArr[$key] = $value;
+ }
+ /**
+ * The version of the QR code
+ * @param intVersion int,range: 0-30
+ */
+ public function setVersion($intVersion)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ $this->_checkInt($intVersion, 'version', 0, 30);
+ $this->setParam('version', $intVersion);
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+ /**
+ * The size of the QR code
+ * @param intSize int, range: 1-100
+ */
+ public function setSize($intSize)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ $this->_checkInt($intSize, 'size', 1, 100);
+ $this->setParam('size', $intSize);
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+ /**
+ * The error correction level of an QR code
+ * @param intLevel int, range: 1-4
+ */
+ public function setLevel($intLevel)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ $this->_checkInt($intLevel, 'level', 1, 4);
+ $this->setParam('level', $intLevel);
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+ /**
+ * The margin of a QR code
+ * @param intMargin int,range: 1-100
+ */
+ public function setMargin($intMargin)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ $this->_checkInt($intMargin, 'margin', 1, 100);
+ $this->setParam('margin', $intMargin);
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+ /**
+ * Foreground color of QR code
+ * @param strForeground string,range: 6 bits RGB,default '000000'
+ */
+ public function setForeground($strForeground)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ $this->_checkRGB($strForeground);
+ $this->setParam('foreground', $strForeground);
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+ /**
+ * Background color of QR code
+ * @param strBackground string,range: 6 bits RGB,default 'FFFFFF'
+ */
+ public function setBackground($strBackground)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ $this->_checkRGB($strBackground);
+ $this->setParam('background', $strBackground);
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+
+ public function clearOperations(){
+ $this->paramArr = array();
+ return true;
+ }
+
+
+ private function _checkInt($num, $prompt, $intMin = -1, $intMax = -1)
+ {
+ if (!is_integer($num)) {
+ throw new BaeException(sprintf('[%s] parameter not an integer', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if ($intMin !== -1 && $num < $intMin) {
+ throw new BaeException(sprintf('[%s] parameter less than minimum', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if ($intMax !== -1 && $intMax < $num) {
+ throw new BaeException(sprintf('[%s] parameter greater than maximum', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+
+ private function _checkString($str, $min=null, $max=null)
+ {
+ if (!is_string($str)){
+ throw new BaeException(sprintf('[%s] parameter not a string', $str), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if($min !== null && strlen($str) < $min){
+ throw new BaeException(sprintf('[%s] parameter less than minimum', $str), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if($max !== null && strlen($str) > $max) {
+ throw new BaeException(sprintf('[%s] parameter greater than maximum', $str), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+
+ private function _checkRGB($strRGB){
+ $this->_checkString($strRGB, 6, 6);
+ $pattern = "/[AaBbCcDdEeFf0123456789]{6}/";
+ // regular match
+ if(!preg_match($pattern, $strRGB)){
+ throw new BaeException(sprintf('invalid RGB color[%s]', $strRGB),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);//
+ }
+ }
+
+ private function _resetErrorStatus()
+ {
+ $this->errcode = 0;
+ $this->errmsg = $this->_arrayErrorMap[$this->errcode];
+ $this->_requestId = 0;
+ }
+
+ private function _exceptionHandler($ex)
+ {
+ $tmpCode = $ex->getCode();
+ if (0 === $tmpCode) {
+ $tmpCode = BaeImageConstant::BAE_IMAGEUI_SDK_SYS;
+ }
+
+ $this->errcode = $tmpCode;
+ if ($this->errcode >= 30000) {
+ $this->errmsg = $ex->getMessage();
+ } else {
+ $this->errmsg = $this->_arrayErrorMap[$this->errcode]
+ . ', detail info[' . $ex->getMessage()
+ . ', break point: ' . $ex->getFile(). ':' . $ex->getLine() . '].'
+ . "\n"
+ . $ex->getTraceAsString();
+ }
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/ptcms/library/bae/images/BaeImageTransform.class.php b/ptcms/library/bae/images/BaeImageTransform.class.php
new file mode 100644
index 0000000..69a3190
--- /dev/null
+++ b/ptcms/library/bae/images/BaeImageTransform.class.php
@@ -0,0 +1,355 @@
+
+ * such as cropping,rotation,transcode and adjusting lightness an image.
+ * You can consider each operation or simultaneously combine some operations
+ * at one request.
+ *
+ */
+class BaeImageTransform extends BaeBase{
+
+
+ private $_arrayErrorMap = array(
+ '0' => 'php sdk error',
+ BaeImageConstant::BAE_IMAGEUI_SDK_SYS => 'php sdk error',
+ BaeImageConstant::BAE_IMAGEUI_SDK_INIT_FAIL => 'php sdk init error',
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM => 'param invalid',
+ BaeImageConstant::BAE_IMAGEUI_SDK_HTTP_STATUS_ERROR_AND_RESULT_ERROR
+ => 'http status is error, and the body returned is not a json string',
+ BaeImageConstant::BAE_IMAGEUI_SDK_HTTP_STATUS_OK_BUT_RESULT_ERROR
+ => 'http status is ok, but the body returned is not a json string',
+ );
+
+ private $paramArr;
+
+ private $_requestId;
+
+ public function __construct(){
+ $this->paramArr = array();
+ $this->_resetErrorStatus();
+ }
+
+ public function getRequestId()
+ {
+ return $this->_requestId;
+ }
+
+ private function setParam($key, $value)
+ {
+ $this->paramArr[$key] = $value;
+ }
+
+ public function getOperations()
+ {
+
+ return $this->paramArr;
+ }
+
+ /**
+ *
+ * @param intZoomingType int,the zooming type,including height,width and pixel
+ * @param intValue int, the zooming value,width: 0-1000 height: 0-1000
+ * pixel: 0-1000000
+ * @param heightIntValue[optional],
+ * @throws BaeException
+ */
+ public function setZooming($intZoomingType, $intValue, $heightIntValue = 0)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ switch ($intZoomingType) {
+ case BaeImageConstant::TRANSFORM_ZOOMING_TYPE_HEIGHT:
+ $this->_checkInt($intValue, 'zooming height' , 0, 10000);
+ $this->setParam('size', 'b0_' . $intValue);
+ break;
+ case BaeImageConstant::TRANSFORM_ZOOMING_TYPE_WIDTH:
+ $this->_checkInt($intValue, 'zooming width' ,0, 10000);
+ $this->setParam('size', 'b' . $intValue . '_0');
+ break;
+ case BaeImageConstant::TRANSFORM_ZOOMING_TYPE_PIXELS:
+ $this->_checkInt($intValue, 'zooming pixels' ,0, 100000000);
+ $this->setParam('size','p' . $intValue);
+ break;
+ case BaeImageConstant::TRANSFORM_ZOOMING_TYPE_UNRATIO:
+ $this->_checkInt($intValue, 'zooming unratio' , 0, 10000);
+ $this->_checkInt($heightIntValue, 'zooming height(unratio)' , 0, 10000);
+ $this->setParam('size','u' . $intValue . '_' .$heightIntValue);
+ break;
+ default:
+ throw new BaeException('invalid zooming type parameters', BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+ /**
+ * Cropping an image
+ * @param intX int,start with x coordinates,range: 0-10000
+ * @param intY int,start with y coordinates,range: 0-10000
+ * @param intWidth,end with x+width,range: 0-10000
+ * @param intHeight, end with y+height,range: 0-10000
+ */
+ public function setCropping($intX, $intY, $intWidth, $intHeight)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ $this->_checkInt($intX, 'cut_x' , 0, 10000);
+ $this->_checkInt($intY, 'cut_y' , 0, 10000);
+ $this->_checkInt($intHeight, 'cut_h' , 0, 10000);
+ $this->_checkInt($intWidth, 'cut_w' , 0, 10000);
+
+ $this->setParam('cut_x', $intX);
+ $this->setParam('cut_y', $intY);
+ $this->setParam('cut_h', $intHeight);
+ $this->setParam('cut_w', $intWidth);
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+ /**
+ * Rotating an image with any degree
+ * @param intDegree int, the rotating value,range: 0-360
+ */
+ public function setRotation($intDegree)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ $this->_checkInt($intDegree, 'rotate' , 0, 360);
+ $this->setParam('rotate', $intDegree);
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+ /**
+ * Setting the hue of an image
+ * @param intHue int, the hue value,range: 1-100
+ */
+ public function setHue($intHue)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ $this->_checkInt($intHue, 'hue' ,1, 100);
+ $this->setParam('hue', $intHue);
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+ /**
+ * Setting the lightness of an image
+ * @param intLightness int,the lightness value range: bigger than 1
+ */
+ public function setLightness($intLightness)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ $this->_checkInt($intLightness, 'lightness' , 1);
+ $this->setParam('lightness', $intLightness);
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+ /**
+ * Setting the contrast of an image
+ * @param intContrast int,0 for degenerate,1 for enhance.
+ */
+ public function setContrast($intContrast)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ $this->_checkInt($intContrast, 'contrast' , 0, 1);
+ $this->setParam('contrast', $intContrast);
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+ /**
+ * Setting the sharpness of an image
+ * @param intSharpness int,the sharpness value,1-100 for sharpen, 101-200 for vague.
+ */
+ public function setSharpness($intSharpness)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ $this->_checkInt($intSharpness, 'sharpness' , 1, 200);
+ $this->setParam('sharpen', $intSharpness);
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+ /**
+ * Setting the saturation of an image
+ * @param intSaturation int, the saturation value,range: 1-100
+ */
+ public function setSaturation($intSaturation)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ $this->_checkInt($intSaturation, 'saturation', 1, 100);
+ $this->setParam('saturation',$intSaturation);
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+ /**
+ * Transcoding the output image with a given type
+ * @param imageType BaeImageConstant,support by GIF,JPG,WEBP,BMP,PNG
intQuality
+ * @param intQuality[optional] int, the quality of an image.range: 0-100
+ * @throws BaeException
+ */
+ public function setTranscoding($imageType, $intQuality = 60)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ if(!is_integer($imageType)){
+ throw new BaeException(sprintf('invalid image type[%s]', $imageType),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ switch ($imageType) {
+ case BaeImageConstant::GIF:
+ $this->_checkInt($intQuality, 'quality' , 0, 100);
+ $this->setParam('quality', $intQuality);
+ $this->setParam('imgtype', 2);
+ break;
+ case BaeImageConstant::JPG:
+ $this->_checkInt($intQuality, 'quality' , 0, 100);
+ $this->setParam('quality', $intQuality);
+ $this->setParam('imgtype', 1);
+ break;
+ case BaeImageConstant::PNG:
+ $this->setParam('imgtype', 3);
+ break;
+ case BaeImageConstant::WEBP:
+ $this->setParam('imgtype', 4);
+ break;
+ default:
+ throw new BaeException(sprintf('invalid image type[%s]', $imageType),
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+ /**
+ * Setting the quality of an image
+ * @param intQuality int,the quality value, range: 0-100
+ */
+ public function setQuality($intQuality = 60)
+ {
+ //$this->_resetErrorStatus();
+ try {
+ $this->_checkInt($intQuality, 'quality', 0, 100);
+ $this->setParam('quality', $intQuality);
+ } catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+
+ public function setGetGifFirstFrame()
+ {
+ $this->setParam('tieba', 1);
+ return true;
+ }
+
+ public function setAutorotate()
+ {
+ $this->setParam('autorotate', 1);
+ return true;
+ }
+ /**
+ * Flipping the image horizontally
+ */
+ public function horizontalFlip()
+ {
+ $this->setParam('flop', 1);
+ return true;
+ }
+ /**
+ * Flipping the image vertically
+ */
+ public function verticalFlip()
+ {
+ $this->setParam('flip', 1);
+ return true;
+ }
+ /**
+ * Clear operations
+ */
+ public function clearOperations(){
+ $this->paramArr = array();
+ return true;
+ }
+
+ private function _resetErrorStatus()
+ {
+ $this->errcode = 0;
+ $this->errmsg = $this->_arrayErrorMap[$this->errcode];
+ $this->_requestId = 0;
+ }
+
+ private function _exceptionHandler($ex)
+ {
+ $tmpCode = $ex->getCode();
+ if (0 === $tmpCode) {
+ $tmpCode = BaeImageConstant::BAE_IMAGEUI_SDK_SYS;
+ }
+
+ $this->errcode = $tmpCode;
+ if ($this->errcode >= 30000) {
+ $this->errmsg = $ex->getMessage();
+ } else {
+ $this->errmsg = $this->_arrayErrorMap[$this->errcode]
+ . ', detail info[' . $ex->getMessage()
+ . ', break point: ' . $ex->getFile(). ':' . $ex->getLine() . '].'
+ . "\n"
+ . $ex->getTraceAsString();
+ }
+ }
+
+ private function _checkInt($num, $prompt, $intMin = -1, $intMax = -1)
+ {
+ if (!is_integer($num)) {
+ throw new BaeException(sprintf('[%s] parameter not an integer', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if ($intMin !== -1 && $num < $intMin) {
+ throw new BaeException(sprintf('[%s] parameter less than minimum', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if ($intMax !== -1 && $intMax < $num) {
+ throw new BaeException(sprintf('[%s] parameter greater than maximum', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+
+ private function _checkString($str, $min, $max)
+ {
+ if (is_string($str) && strlen($str) >= $min && strlen($str) <= $max) {
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/ptcms/library/bae/images/BaeImageVCode.class.php b/ptcms/library/bae/images/BaeImageVCode.class.php
new file mode 100644
index 0000000..6f5ccf7
--- /dev/null
+++ b/ptcms/library/bae/images/BaeImageVCode.class.php
@@ -0,0 +1,173 @@
+ 'php sdk error',
+ BaeImageConstant::BAE_IMAGEUI_SDK_SYS => 'php sdk error',
+ BaeImageConstant::BAE_IMAGEUI_SDK_INIT_FAIL => 'php sdk init error',
+ BaeImageConstant::BAE_IMAGEUI_SDK_PARAM => 'param invalid',
+ BaeImageConstant::BAE_IMAGEUI_SDK_HTTP_STATUS_ERROR_AND_RESULT_ERROR
+ => 'http status is error, and the body returned is not a json string',
+ BaeImageConstant::BAE_IMAGEUI_SDK_HTTP_STATUS_OK_BUT_RESULT_ERROR
+ => 'http status is ok, but the body returned is not a json string',
+ );
+
+ public function __construct()
+ {
+ $this->_resetErrorStatus();
+ $this->paramArr = array('len'=>4,'setno'=>0);
+ }
+ public function getOperations()
+ {
+ return $this->paramArr;
+ }
+
+ private function setParam($key, $value)
+ {
+ $this->paramArr[$key] = $value;
+ }
+ /**
+ * The bits of the verification code
+ * @param intLen integer,range: 4-5
+ */
+ public function setLen($intLen)
+ {
+ try {
+ $this->_checkInt($intLen, 'verification code len', 4, 5);
+ $this->setParam('len', $intLen);
+ }catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * The pattern of the verification code
+ * @param pattern integer,range: 0-3
+ */
+ public function setPattern($pattern)
+ {
+ try {
+ $this->_checkInt($pattern, 'verification code pattern', 0, 3);
+ $this->setParam('setno', $pattern);
+ }catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * The input to verify
+ * @param strInput string,range: 4-5
+ */
+ public function setInput($strInput)
+ {
+ try {
+ $this->_checkString($strInput, 'vcode.input' ,4, 5);
+ $this->setParam('input', $strInput);
+ $this->input = $strInput;
+ }catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+
+ public function getInput(){
+ return $this->input;
+ }
+
+ /**
+ * The secret text of the verification code
+ * @param strSecret string,range: without restriction
+ */
+ public function setSecret($strSecret)
+ {
+ try {
+ $this->_checkString($strSecret,'vcode.secret', 368, 368);//without restriction
+ $this->setParam('vcode', $strSecret);
+ $this->strSecret = $strSecret;
+ }catch (Exception $ex) {
+ $this->_exceptionHandler($ex);
+ return false;
+ }
+ return true;
+ }
+ public function getSecret(){
+ return $this->strSecret;
+ }
+
+ public function clearOperations()
+ {
+ $this->paramArr = array();
+ return true;
+ }
+
+ private function _checkInt($num, $prompt, $intMin = -1, $intMax = -1)
+ {
+ if (!is_integer($num)) {
+ throw new BaeException(sprintf('[%s] parameter not an integer', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if ($intMin !== -1 && $num < $intMin) {
+ throw new BaeException(sprintf('[%s] parameter less than minimum', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if ($intMax !== -1 && $intMax < $num) {
+ throw new BaeException(sprintf('[%s] parameter greater than maximum', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+
+ private function _checkString($str, $prompt, $min=null, $max=null)
+ {
+ if (!is_string($str)){
+ throw new BaeException(sprintf('[%s] parameter not a string', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if($min !== null && strlen($str) < $min){
+ throw new BaeException(sprintf('[%s] parameter less than minimum', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ if($max !== null && strlen($str) > $max) {
+ throw new BaeException(sprintf('[%s] parameter greater than maximum', $prompt), BaeImageConstant::BAE_IMAGEUI_SDK_PARAM);
+ }
+ }
+
+ private function _resetErrorStatus()
+ {
+ $this->errcode = 0;
+ $this->errmsg = $this->_arrayErrorMap[$this->errcode];
+ $this->_requestId = 0;
+ }
+
+ private function _exceptionHandler($ex)
+ {
+ $tmpCode = $ex->getCode();
+ if (0 === $tmpCode) {
+ $tmpCode = BaeImageConstant::BAE_IMAGEUI_SDK_SYS;
+ }
+
+ $this->errcode = $tmpCode;
+ if ($this->errcode >= 30000) {
+ $this->errmsg = $ex->getMessage();
+ } else {
+ $this->errmsg = $this->_arrayErrorMap[$this->errcode]
+ . ', detail info[' . $ex->getMessage()
+ . ', break point: ' . $ex->getFile(). ':' . $ex->getLine() . '].'
+ . "\n"
+ . $ex->getTraceAsString();
+ }
+ }
+}
\ No newline at end of file
diff --git a/ptcms/library/bae/lib/BaeBase.class.php b/ptcms/library/bae/lib/BaeBase.class.php
new file mode 100644
index 0000000..7fd1a22
--- /dev/null
+++ b/ptcms/library/bae/lib/BaeBase.class.php
@@ -0,0 +1,78 @@
+';
+ debug_print_backtrace();
+ echo '';
+ trigger_error($error_msg, $error_type);
+ }
+
+ /**
+ * @brief return the handle
+ *
+ */
+ public function getHandle()
+ {
+ return $this->_handle;
+ }
+
+ /**
+ * @brief return the error message
+ *
+ */
+ public function errmsg()
+ {
+ return $this->errmsg;
+ }
+
+ /**
+ * @brief return the error code
+ *
+ */
+ public function errno()
+ {
+ return $this->errcode;
+ }
+
+}
+
+/* vim: set ts=4 sw=4 sts=4 tw=100 noet: */
+?>
\ No newline at end of file
diff --git a/ptcms/library/bae/lib/BaeException.class.php b/ptcms/library/bae/lib/BaeException.class.php
new file mode 100644
index 0000000..39686ad
--- /dev/null
+++ b/ptcms/library/bae/lib/BaeException.class.php
@@ -0,0 +1,21 @@
+
\ No newline at end of file
diff --git a/ptcms/library/bae/lib/BaeTaskQueueException.class.php b/ptcms/library/bae/lib/BaeTaskQueueException.class.php
new file mode 100644
index 0000000..2ffb584
--- /dev/null
+++ b/ptcms/library/bae/lib/BaeTaskQueueException.class.php
@@ -0,0 +1,6 @@
+
diff --git a/ptcms/library/bae/lib/BccsServerException.class.php b/ptcms/library/bae/lib/BccsServerException.class.php
new file mode 100644
index 0000000..4987923
--- /dev/null
+++ b/ptcms/library/bae/lib/BccsServerException.class.php
@@ -0,0 +1,6 @@
+
diff --git a/ptcms/library/bae/lib/BcmsException.class.php b/ptcms/library/bae/lib/BcmsException.class.php
new file mode 100644
index 0000000..cacd6c3
--- /dev/null
+++ b/ptcms/library/bae/lib/BcmsException.class.php
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git a/ptcms/library/bae/lib/ChannelException.class.php b/ptcms/library/bae/lib/ChannelException.class.php
new file mode 100644
index 0000000..ef7d02e
--- /dev/null
+++ b/ptcms/library/bae/lib/ChannelException.class.php
@@ -0,0 +1,6 @@
+
diff --git a/ptcms/library/bae/lib/CronException.class.php b/ptcms/library/bae/lib/CronException.class.php
new file mode 100644
index 0000000..175f223
--- /dev/null
+++ b/ptcms/library/bae/lib/CronException.class.php
@@ -0,0 +1,6 @@
+
diff --git a/ptcms/library/bae/lib/RequestCore.class.php b/ptcms/library/bae/lib/RequestCore.class.php
new file mode 100644
index 0000000..8b6c85e
--- /dev/null
+++ b/ptcms/library/bae/lib/RequestCore.class.php
@@ -0,0 +1,773 @@
+).
+ */
+ public $request_class = 'RequestCore';
+ /**
+ * The default class to use for HTTP Responses (defaults to ).
+ */
+ public $response_class = 'ResponseCore';
+ /**
+ * Default useragent string to use.
+ */
+ public $useragent = 'RequestCore/1.4.2';
+ /**
+ * File to read from while streaming up.
+ */
+ public $read_file = null;
+ /**
+ * The resource to read from while streaming up.
+ */
+ public $read_stream = null;
+ /**
+ * The size of the stream to read from.
+ */
+ public $read_stream_size = null;
+ /**
+ * The length already read from the stream.
+ */
+ public $read_stream_read = 0;
+ /**
+ * File to write to while streaming down.
+ */
+ public $write_file = null;
+ /**
+ * The resource to write to while streaming down.
+ */
+ public $write_stream = null;
+ /**
+ * Stores the intended starting seek position.
+ */
+ public $seek_position = null;
+ /**
+ * The user-defined callback function to call when a stream is read from.
+ */
+ public $registered_streaming_read_callback = null;
+ /**
+ * The user-defined callback function to call when a stream is written to.
+ */
+ public $registered_streaming_write_callback = null;
+ /*%******************************************************************************************%*/
+ // CONSTANTS
+ /**
+ * GET HTTP Method
+ */
+ const HTTP_GET = 'GET';
+ /**
+ * POST HTTP Method
+ */
+ const HTTP_POST = 'POST';
+ /**
+ * PUT HTTP Method
+ */
+ const HTTP_PUT = 'PUT';
+ /**
+ * DELETE HTTP Method
+ */
+ const HTTP_DELETE = 'DELETE';
+ /**
+ * HEAD HTTP Method
+ */
+ const HTTP_HEAD = 'HEAD';
+ /*%******************************************************************************************%*/
+ // CONSTRUCTOR/DESTRUCTOR
+ /**
+ * Constructs a new instance of this class.
+ *
+ * @param string $url (Optional) The URL to request or service endpoint to query.
+ * @param string $proxy (Optional) The faux-url to use for proxy settings. Takes the following format: `proxy://user:pass@hostname:port`
+ * @param array $helpers (Optional) An associative array of classnames to use for request, and response functionality. Gets passed in automatically by the calling class.
+ * @return $this A reference to the current instance.
+ */
+ public function __construct($url = null, $proxy = null, $helpers = null) {
+ // Set some default values.
+ $this->request_url = $url;
+ $this->method = self::HTTP_GET;
+ $this->request_headers = array ();
+ $this->request_body = '';
+ // Set a new Request class if one was set.
+ if (isset ( $helpers ['request'] ) && ! empty ( $helpers ['request'] )) {
+ $this->request_class = $helpers ['request'];
+ }
+ // Set a new Request class if one was set.
+ if (isset ( $helpers ['response'] ) && ! empty ( $helpers ['response'] )) {
+ $this->response_class = $helpers ['response'];
+ }
+ if ($proxy) {
+ $this->set_proxy ( $proxy );
+ }
+ return $this;
+ }
+ /**
+ * Destructs the instance. Closes opened file handles.
+ *
+ * @return $this A reference to the current instance.
+ */
+ public function __destruct() {
+ if (isset ( $this->read_file ) && isset ( $this->read_stream )) {
+ fclose ( $this->read_stream );
+ }
+ if (isset ( $this->write_file ) && isset ( $this->write_stream )) {
+ fclose ( $this->write_stream );
+ }
+ return $this;
+ }
+ /*%******************************************************************************************%*/
+ // REQUEST METHODS
+ /**
+ * Sets the credentials to use for authentication.
+ *
+ * @param string $user (Required) The username to authenticate with.
+ * @param string $pass (Required) The password to authenticate with.
+ * @return $this A reference to the current instance.
+ */
+ public function set_credentials($user, $pass) {
+ $this->username = $user;
+ $this->password = $pass;
+ return $this;
+ }
+ /**
+ * Adds a custom HTTP header to the cURL request.
+ *
+ * @param string $key (Required) The custom HTTP header to set.
+ * @param mixed $value (Required) The value to assign to the custom HTTP header.
+ * @return $this A reference to the current instance.
+ */
+ public function add_header($key, $value) {
+ $this->request_headers [$key] = $value;
+ return $this;
+ }
+ /**
+ * Removes an HTTP header from the cURL request.
+ *
+ * @param string $key (Required) The custom HTTP header to set.
+ * @return $this A reference to the current instance.
+ */
+ public function remove_header($key) {
+ if (isset ( $this->request_headers [$key] )) {
+ unset ( $this->request_headers [$key] );
+ }
+ return $this;
+ }
+ /**
+ * Set the method type for the request.
+ *
+ * @param string $method (Required) One of the following constants: , , , , .
+ * @return $this A reference to the current instance.
+ */
+ public function set_method($method) {
+ $this->method = strtoupper ( $method );
+ return $this;
+ }
+ /**
+ * Sets a custom useragent string for the class.
+ *
+ * @param string $ua (Required) The useragent string to use.
+ * @return $this A reference to the current instance.
+ */
+ public function set_useragent($ua) {
+ $this->useragent = $ua;
+ return $this;
+ }
+ /**
+ * Set the body to send in the request.
+ *
+ * @param string $body (Required) The textual content to send along in the body of the request.
+ * @return $this A reference to the current instance.
+ */
+ public function set_body($body) {
+ $this->request_body = $body;
+ return $this;
+ }
+ /**
+ * Set the URL to make the request to.
+ *
+ * @param string $url (Required) The URL to make the request to.
+ * @return $this A reference to the current instance.
+ */
+ public function set_request_url($url) {
+ $this->request_url = $url;
+ return $this;
+ }
+ /**
+ * Set additional CURLOPT settings. These will merge with the default settings, and override if
+ * there is a duplicate.
+ *
+ * @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.
+ * @return $this A reference to the current instance.
+ */
+ public function set_curlopts($curlopts) {
+ $this->curlopts = $curlopts;
+ return $this;
+ }
+ /**
+ * Sets the length in bytes to read from the stream while streaming up.
+ *
+ * @param integer $size (Required) The length in bytes to read from the stream.
+ * @return $this A reference to the current instance.
+ */
+ public function set_read_stream_size($size) {
+ $this->read_stream_size = $size;
+ return $this;
+ }
+ /**
+ * Sets the resource to read from while streaming up. Reads the stream from its current position until
+ * EOF or `$size` bytes have been read. If `$size` is not given it will be determined by and
+ * .
+ *
+ * @param resource $resource (Required) The readable resource to read from.
+ * @param integer $size (Optional) The size of the stream to read.
+ * @return $this A reference to the current instance.
+ */
+ public function set_read_stream($resource, $size = null) {
+ if (! isset ( $size ) || $size < 0) {
+ $stats = fstat ( $resource );
+ if ($stats && $stats ['size'] >= 0) {
+ $position = ftell ( $resource );
+ if ($position !== false && $position >= 0) {
+ $size = $stats ['size'] - $position;
+ }
+ }
+ }
+ $this->read_stream = $resource;
+ return $this->set_read_stream_size ( $size );
+ }
+ /**
+ * Sets the file to read from while streaming up.
+ *
+ * @param string $location (Required) The readable location to read from.
+ * @return $this A reference to the current instance.
+ */
+ public function set_read_file($location) {
+ $this->read_file = $location;
+ $read_file_handle = fopen ( $location, 'r' );
+ return $this->set_read_stream ( $read_file_handle );
+ }
+ /**
+ * Sets the resource to write to while streaming down.
+ *
+ * @param resource $resource (Required) The writeable resource to write to.
+ * @return $this A reference to the current instance.
+ */
+ public function set_write_stream($resource) {
+ $this->write_stream = $resource;
+ return $this;
+ }
+ /**
+ * Sets the file to write to while streaming down.
+ *
+ * @param string $location (Required) The writeable location to write to.
+ * @return $this A reference to the current instance.
+ */
+ public function set_write_file($location) {
+ $this->write_file = $location;
+ $write_file_handle = fopen ( $location, 'w' );
+ return $this->set_write_stream ( $write_file_handle );
+ }
+ /**
+ * Set the proxy to use for making requests.
+ *
+ * @param string $proxy (Required) The faux-url to use for proxy settings. Takes the following format: `proxy://user:pass@hostname:port`
+ * @return $this A reference to the current instance.
+ */
+ public function set_proxy($proxy) {
+ $proxy = parse_url ( $proxy );
+ $proxy ['user'] = isset ( $proxy ['user'] ) ? $proxy ['user'] : null;
+ $proxy ['pass'] = isset ( $proxy ['pass'] ) ? $proxy ['pass'] : null;
+ $proxy ['port'] = isset ( $proxy ['port'] ) ? $proxy ['port'] : null;
+ $this->proxy = $proxy;
+ return $this;
+ }
+ /**
+ * Set the intended starting seek position.
+ *
+ * @param integer $position (Required) The byte-position of the stream to begin reading from.
+ * @return $this A reference to the current instance.
+ */
+ public function set_seek_position($position) {
+ $this->seek_position = isset ( $position ) ? ( integer ) $position : null;
+ return $this;
+ }
+ /**
+ * Register a callback function to execute whenever a data stream is read from using
+ * .
+ *
+ * The user-defined callback function should accept three arguments:
+ *
+ *
+ * $curl_handle
- resource
- Required - The cURL handle resource that represents the in-progress transfer.
+ * $file_handle
- resource
- Required - The file handle resource that represents the file on the local file system.
+ * $length
- integer
- Required - The length in kilobytes of the data chunk that was transferred.
+ *
+ *
+ * @param string|array|function $callback (Required) The callback function is called by , so you can pass the following values:
+ * The name of a global function to execute, passed as a string.
+ * A method to execute, passed as array('ClassName', 'MethodName')
.
+ * An anonymous function (PHP 5.3+).
+ * @return $this A reference to the current instance.
+ */
+ public function register_streaming_read_callback($callback) {
+ $this->registered_streaming_read_callback = $callback;
+ return $this;
+ }
+ /**
+ * Register a callback function to execute whenever a data stream is written to using
+ * .
+ *
+ * The user-defined callback function should accept two arguments:
+ *
+ *
+ * $curl_handle
- resource
- Required - The cURL handle resource that represents the in-progress transfer.
+ * $length
- integer
- Required - The length in kilobytes of the data chunk that was transferred.
+ *
+ *
+ * @param string|array|function $callback (Required) The callback function is called by , so you can pass the following values:
+ * The name of a global function to execute, passed as a string.
+ * A method to execute, passed as array('ClassName', 'MethodName')
.
+ * An anonymous function (PHP 5.3+).
+ * @return $this A reference to the current instance.
+ */
+ public function register_streaming_write_callback($callback) {
+ $this->registered_streaming_write_callback = $callback;
+ return $this;
+ }
+ /*%******************************************************************************************%*/
+ // PREPARE, SEND, AND PROCESS REQUEST
+ /**
+ * A callback function that is invoked by cURL for streaming up.
+ *
+ * @param resource $curl_handle (Required) The cURL handle for the request.
+ * @param resource $file_handle (Required) The open file handle resource.
+ * @param integer $length (Required) The maximum number of bytes to read.
+ * @return binary Binary data from a stream.
+ */
+ public function streaming_read_callback($curl_handle, $file_handle, $length) {
+ // Once we've sent as much as we're supposed to send...
+ if ($this->read_stream_read >= $this->read_stream_size) {
+ // Send EOF
+ return '';
+ }
+ // If we're at the beginning of an upload and need to seek...
+ if ($this->read_stream_read == 0 && isset ( $this->seek_position ) && $this->seek_position !== ftell ( $this->read_stream )) {
+ if (fseek ( $this->read_stream, $this->seek_position ) !== 0) {
+ throw new RequestCore_Exception ( 'The stream does not support seeking and is either not at the requested position or the position is unknown.' );
+ }
+ }
+ $read = fread ( $this->read_stream, min ( $this->read_stream_size - $this->read_stream_read, $length ) ); // Remaining upload data or cURL's requested chunk size
+ $this->read_stream_read += strlen ( $read );
+ $out = $read === false ? '' : $read;
+ // Execute callback function
+ if ($this->registered_streaming_read_callback) {
+ call_user_func ( $this->registered_streaming_read_callback, $curl_handle, $file_handle, $out );
+ }
+ return $out;
+ }
+ /**
+ * A callback function that is invoked by cURL for streaming down.
+ *
+ * @param resource $curl_handle (Required) The cURL handle for the request.
+ * @param binary $data (Required) The data to write.
+ * @return integer The number of bytes written.
+ */
+ public function streaming_write_callback($curl_handle, $data) {
+ $length = strlen ( $data );
+ $written_total = 0;
+ $written_last = 0;
+ while ( $written_total < $length ) {
+ $written_last = fwrite ( $this->write_stream, substr ( $data, $written_total ) );
+ if ($written_last === false) {
+ return $written_total;
+ }
+ $written_total += $written_last;
+ }
+ // Execute callback function
+ if ($this->registered_streaming_write_callback) {
+ call_user_func ( $this->registered_streaming_write_callback, $curl_handle, $written_total );
+ }
+ return $written_total;
+ }
+ /**
+ * Prepares and adds the details of the cURL request. This can be passed along to a
+ * function.
+ *
+ * @return resource The handle for the cURL object.
+ */
+ public function prep_request() {
+ $curl_handle = curl_init ();
+ // Set default options.
+ curl_setopt ( $curl_handle, CURLOPT_URL, $this->request_url );
+ curl_setopt ( $curl_handle, CURLOPT_FILETIME, true );
+ curl_setopt ( $curl_handle, CURLOPT_FRESH_CONNECT, false );
+ curl_setopt ( $curl_handle, CURLOPT_SSL_VERIFYPEER, false );
+ @ curl_setopt ( $curl_handle, CURLOPT_SSL_VERIFYHOST, true );
+ curl_setopt ( $curl_handle, CURLOPT_CLOSEPOLICY, CURLCLOSEPOLICY_LEAST_RECENTLY_USED );
+ curl_setopt ( $curl_handle, CURLOPT_MAXREDIRS, 5 );
+ curl_setopt ( $curl_handle, CURLOPT_HEADER, true );
+ curl_setopt ( $curl_handle, CURLOPT_RETURNTRANSFER, true );
+ curl_setopt ( $curl_handle, CURLOPT_TIMEOUT, 5184000 );
+ curl_setopt ( $curl_handle, CURLOPT_CONNECTTIMEOUT, 120 );
+ curl_setopt ( $curl_handle, CURLOPT_NOSIGNAL, true );
+ curl_setopt ( $curl_handle, CURLOPT_REFERER, $this->request_url );
+ curl_setopt ( $curl_handle, CURLOPT_USERAGENT, $this->useragent );
+ curl_setopt ( $curl_handle, CURLOPT_READFUNCTION, array (
+ $this, 'streaming_read_callback' ) );
+ if ($this->debug_mode) {
+ curl_setopt ( $curl_handle, CURLOPT_VERBOSE, true );
+ }
+ if (! ini_get ( 'safe_mode' )) {
+ //modify by zhengkan
+ //curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, true);
+ }
+ // Enable a proxy connection if requested.
+ if ($this->proxy) {
+ curl_setopt ( $curl_handle, CURLOPT_HTTPPROXYTUNNEL, true );
+ $host = $this->proxy ['host'];
+ $host .= ($this->proxy ['port']) ? ':' . $this->proxy ['port'] : '';
+ curl_setopt ( $curl_handle, CURLOPT_PROXY, $host );
+ if (isset ( $this->proxy ['user'] ) && isset ( $this->proxy ['pass'] )) {
+ curl_setopt ( $curl_handle, CURLOPT_PROXYUSERPWD, $this->proxy ['user'] . ':' . $this->proxy ['pass'] );
+ }
+ }
+ // Set credentials for HTTP Basic/Digest Authentication.
+ if ($this->username && $this->password) {
+ curl_setopt ( $curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY );
+ curl_setopt ( $curl_handle, CURLOPT_USERPWD, $this->username . ':' . $this->password );
+ }
+ // Handle the encoding if we can.
+ if (extension_loaded ( 'zlib' )) {
+ curl_setopt ( $curl_handle, CURLOPT_ENCODING, '' );
+ }
+ // Process custom headers
+ if (isset ( $this->request_headers ) && count ( $this->request_headers )) {
+ $temp_headers = array ();
+ foreach ( $this->request_headers as $k => $v ) {
+ $temp_headers [] = $k . ': ' . $v;
+ }
+ curl_setopt ( $curl_handle, CURLOPT_HTTPHEADER, $temp_headers );
+ }
+ switch ($this->method) {
+ case self::HTTP_PUT :
+ curl_setopt ( $curl_handle, CURLOPT_CUSTOMREQUEST, 'PUT' );
+ if (isset ( $this->read_stream )) {
+ if (! isset ( $this->read_stream_size ) || $this->read_stream_size < 0) {
+ throw new RequestCore_Exception ( 'The stream size for the streaming upload cannot be determined.' );
+ }
+ curl_setopt ( $curl_handle, CURLOPT_INFILESIZE, $this->read_stream_size );
+ curl_setopt ( $curl_handle, CURLOPT_UPLOAD, true );
+ } else {
+ curl_setopt ( $curl_handle, CURLOPT_POSTFIELDS, $this->request_body );
+ }
+ break;
+ case self::HTTP_POST :
+ curl_setopt ( $curl_handle, CURLOPT_POST, true );
+ curl_setopt ( $curl_handle, CURLOPT_POSTFIELDS, $this->request_body );
+ break;
+ case self::HTTP_HEAD :
+ curl_setopt ( $curl_handle, CURLOPT_CUSTOMREQUEST, self::HTTP_HEAD );
+ curl_setopt ( $curl_handle, CURLOPT_NOBODY, 1 );
+ break;
+ default : // Assumed GET
+ curl_setopt ( $curl_handle, CURLOPT_CUSTOMREQUEST, $this->method );
+ if (isset ( $this->write_stream )) {
+ curl_setopt ( $curl_handle, CURLOPT_WRITEFUNCTION, array (
+ $this, 'streaming_write_callback' ) );
+ curl_setopt ( $curl_handle, CURLOPT_HEADER, false );
+ } else {
+ curl_setopt ( $curl_handle, CURLOPT_POSTFIELDS, $this->request_body );
+ }
+ break;
+ }
+ // Merge in the CURLOPTs
+ if (isset ( $this->curlopts ) && sizeof ( $this->curlopts ) > 0) {
+ foreach ( $this->curlopts as $k => $v ) {
+ curl_setopt ( $curl_handle, $k, $v );
+ }
+ }
+ return $curl_handle;
+ }
+ /**
+ * Take the post-processed cURL data and break it down into useful header/body/info chunks. Uses the
+ * data stored in the `curl_handle` and `response` properties unless replacement data is passed in via
+ * parameters.
+ *
+ * @param resource $curl_handle (Optional) The reference to the already executed cURL request.
+ * @param string $response (Optional) The actual response content itself that needs to be parsed.
+ * @return ResponseCore A object containing a parsed HTTP response.
+ */
+ public function process_response($curl_handle = null, $response = null) {
+ // Accept a custom one if it's passed.
+ if ($curl_handle && $response) {
+ $this->curl_handle = $curl_handle;
+ $this->response = $response;
+ }
+ // As long as this came back as a valid resource...
+ if (is_resource ( $this->curl_handle )) {
+ // Determine what's what.
+ $header_size = curl_getinfo ( $this->curl_handle, CURLINFO_HEADER_SIZE );
+ $this->response_headers = substr ( $this->response, 0, $header_size );
+ $this->response_body = substr ( $this->response, $header_size );
+ $this->response_code = curl_getinfo ( $this->curl_handle, CURLINFO_HTTP_CODE );
+ $this->response_info = curl_getinfo ( $this->curl_handle );
+ // Parse out the headers
+ $this->response_headers = explode ( "\r\n\r\n", trim ( $this->response_headers ) );
+ $this->response_headers = array_pop ( $this->response_headers );
+ $this->response_headers = explode ( "\r\n", $this->response_headers );
+ array_shift ( $this->response_headers );
+ // Loop through and split up the headers.
+ $header_assoc = array ();
+ foreach ( $this->response_headers as $header ) {
+ $kv = explode ( ': ', $header );
+ //$header_assoc [strtolower ( $kv [0] )] = $kv [1];
+ $header_assoc [$kv [0]] = $kv [1];
+ }
+ // Reset the headers to the appropriate property.
+ $this->response_headers = $header_assoc;
+ $this->response_headers ['_info'] = $this->response_info;
+ $this->response_headers ['_info'] ['method'] = $this->method;
+ if ($curl_handle && $response) {
+ return new $this->response_class ( $this->response_headers, $this->response_body, $this->response_code, $this->curl_handle );
+ }
+ }
+ // Return false
+ return false;
+ }
+ /**
+ * Sends the request, calling necessary utility functions to update built-in properties.
+ *
+ * @param boolean $parse (Optional) Whether to parse the response with ResponseCore or not.
+ * @return string The resulting unparsed data from the request.
+ */
+ public function send_request($parse = false) {
+ $curl_handle = $this->prep_request ();
+ $this->response = curl_exec ( $curl_handle );
+ if ($this->response === false) {
+ throw new RequestCore_Exception ( 'cURL resource: ' . ( string ) $curl_handle . '; cURL error: ' . curl_error ( $curl_handle ) . ' (' . curl_errno ( $curl_handle ) . ')' );
+ }
+ $parsed_response = $this->process_response ( $curl_handle, $this->response );
+ curl_close ( $curl_handle );
+ if ($parse) {
+ return $parsed_response;
+ }
+ return $this->response;
+ }
+ /**
+ * Sends the request using , enabling parallel requests. Uses the "rolling" method.
+ *
+ * @param array $handles (Required) An indexed array of cURL handles to process simultaneously.
+ * @param array $opt (Optional) An associative array of parameters that can have the following keys:
+ * callback
- string|array
- Optional - The string name of a function to pass the response data to. If this is a method, pass an array where the [0]
index is the class and the [1]
index is the method name.
+ * limit
- integer
- 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.
+ * @return array Post-processed cURL responses.
+ */
+ public function send_multi_request($handles, $opt = null) {
+ // Skip everything if there are no handles to process.
+ if (count ( $handles ) === 0)
+ return array ();
+ if (! $opt)
+ $opt = array ();
+
+ // Initialize any missing options
+ $limit = isset ( $opt ['limit'] ) ? $opt ['limit'] : - 1;
+ // Initialize
+ $handle_list = $handles;
+ $http = new $this->request_class ();
+ $multi_handle = curl_multi_init ();
+ $handles_post = array ();
+ $added = count ( $handles );
+ $last_handle = null;
+ $count = 0;
+ $i = 0;
+ // Loop through the cURL handles and add as many as it set by the limit parameter.
+ while ( $i < $added ) {
+ if ($limit > 0 && $i >= $limit)
+ break;
+ curl_multi_add_handle ( $multi_handle, array_shift ( $handles ) );
+ $i ++;
+ }
+ do {
+ $active = false;
+ // Start executing and wait for a response.
+ while ( ($status = curl_multi_exec ( $multi_handle, $active )) === CURLM_CALL_MULTI_PERFORM ) {
+ // Start looking for possible responses immediately when we have to add more handles
+ if (count ( $handles ) > 0)
+ break;
+ }
+ // Figure out which requests finished.
+ $to_process = array ();
+ while ( $done = curl_multi_info_read ( $multi_handle ) ) {
+ // 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 )
+ if ($done ['result'] > 0) {
+ throw new RequestCore_Exception ( 'cURL resource: ' . ( string ) $done ['handle'] . '; cURL error: ' . curl_error ( $done ['handle'] ) . ' (' . $done ['result'] . ')' );
+ } // 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
+elseif (! isset ( $to_process [( int ) $done ['handle']] )) {
+ $to_process [( int ) $done ['handle']] = $done;
+ }
+ }
+ // Actually deal with the request
+ foreach ( $to_process as $pkey => $done ) {
+ $response = $http->process_response ( $done ['handle'], curl_multi_getcontent ( $done ['handle'] ) );
+ $key = array_search ( $done ['handle'], $handle_list, true );
+ $handles_post [$key] = $response;
+ if (count ( $handles ) > 0) {
+ curl_multi_add_handle ( $multi_handle, array_shift ( $handles ) );
+ }
+ curl_multi_remove_handle ( $multi_handle, $done ['handle'] );
+ curl_close ( $done ['handle'] );
+ }
+ } while ( $active || count ( $handles_post ) < $added );
+ curl_multi_close ( $multi_handle );
+ ksort ( $handles_post, SORT_NUMERIC );
+ return $handles_post;
+ }
+ /*%******************************************************************************************%*/
+ // RESPONSE METHODS
+ /**
+ * Get the HTTP response headers from the request.
+ *
+ * @param string $header (Optional) A specific header value to return. Defaults to all headers.
+ * @return string|array All or selected header values.
+ */
+ public function get_response_header($header = null) {
+ if ($header) {
+ // return $this->response_headers [strtolower ( $header )];
+ return $this->response_headers [$header];
+ }
+ return $this->response_headers;
+ }
+ /**
+ * Get the HTTP response body from the request.
+ *
+ * @return string The response body.
+ */
+ public function get_response_body() {
+ return $this->response_body;
+ }
+ /**
+ * Get the HTTP response code from the request.
+ *
+ * @return string The HTTP response code.
+ */
+ public function get_response_code() {
+ return $this->response_code;
+ }
+}
+/**
+ * Container for all response-related methods.
+ */
+class ResponseCore {
+ /**
+ * Stores the HTTP header information.
+ */
+ public $header;
+ /**
+ * Stores the SimpleXML response.
+ */
+ public $body;
+ /**
+ * Stores the HTTP response code.
+ */
+ public $status;
+ /**
+ * Constructs a new instance of this class.
+ *
+ * @param array $header (Required) Associative array of HTTP headers (typically returned by ).
+ * @param string $body (Required) XML-formatted response from AWS.
+ * @param integer $status (Optional) HTTP response status code from the request.
+ * @return object Contains an `header` property (HTTP headers as an associative array), a or `body` property, and an `status` code.
+ */
+ public function __construct($header, $body, $status = null) {
+ $this->header = $header;
+ $this->body = $body;
+ $this->status = $status;
+ return $this;
+ }
+ /**
+ * Did we receive the status code we expected?
+ *
+ * @param integer|array $codes (Optional) The status code(s) to expect. Pass an for a single acceptable value, or an of integers for multiple acceptable values.
+ * @return boolean Whether we received the expected status code or not.
+ */
+ public function isOK($codes = array(200, 201, 204, 206)) {
+ if (is_array ( $codes )) {
+ return in_array ( $this->status, $codes );
+ }
+ return $this->status === $codes;
+ }
+}
+/**
+ * Default RequestCore Exception.
+ */
+class RequestCore_Exception extends Exception {
+}
diff --git a/ptcms/library/bae/zcache/memcache_errno.php b/ptcms/library/bae/zcache/memcache_errno.php
new file mode 100644
index 0000000..96eede5
--- /dev/null
+++ b/ptcms/library/bae/zcache/memcache_errno.php
@@ -0,0 +1,26 @@
+ "RES_PAYLOAD_FAILURE",
+ "0" => "RES_SUCCESS",
+ "1" => "RES_FAILURE",
+ "2" => "RES_USER_AUTH_FAILURE",
+ "7" => "RES_UNKNOWN_READ_FAILURE",
+ "8" => "RES_PROTOCOL_ERROR",
+ "9" => "RES_CLIENT_ERROR",
+ "10" => "RES_SERVER_ERROR",
+ "5" => "RES_WRITE_FAILURE",
+ "12" => "RES_DATA_EXISTS",
+ "14" => "RES_NOTSTORED",
+ "16" => "RES_NOTFOUND",
+ "18" => "RES_PARTIAL_READ",
+ "19" => "RES_SOME_ERRORS",
+ "20" => "RES_NO_SERVERS",
+ "21" => "RES_SERVER_BUSY",
+ "26" => "RES_ERRNO",
+ "32" => "RES_BUFFERED",
+ "31" => "RES_TIMEOUT",
+ "33" => "RES_BAD_KEY_PROVIDED",
+ "11" => "RES_CONNECTION_SOCKET_CREATE_FAILURE",
+
+ );
+
+ private $errnomap = array (
+
+ ZCACHE_AGENT_ERR_PARAM => RES_CLIENT_ERROR,
+ ZCACHE_AGENT_ERR_MCPACK => RES_PROTOCOL_ERROR,
+ ZCACHE_AGENT_ERR_MEM => RES_SERVER_ERROR,
+ ZCACHE_AGENT_ERR_MCPACK_OP => RES_PROTOCOL_ERROR,
+
+ ZCACHE_OK => RES_SUCCESS,
+ ZCACHE_ERR_PARAM => RES_CLIENT_ERROR,
+ ZCACHE_ERR_NOT_AUTH => RES_HOST_LOOKUP_FAILURE,
+ ZCACHE_ERR_BUF_NOT_ENOUGH => RES_BUFFERED,
+ ZCACHE_ERR_EXIST => RES_DATA_EXISTS,
+ ZCACHE_ERR_NOT_EXIST => RES_NOTFOUND,
+ ZCACHE_ERR_BLOCK_NOT_EXIST => RES_SERVER_ERROR,
+ ZCACHE_ERR_PRODUCT_NOT_EXIST => RES_SERVER_ERROR,
+ ZCACHE_ERR_BUSY => RES_END,
+ ZCACHE_ERR_FROZEN_DELETE => RES_SERVER_ERROR,
+ ZCACHE_ERR_BLOCK_UPDATED => RES_SERVER_ERROR,
+ ZCACHE_ERR_TIMEOUT => RES_TIMEOUT,
+ ZCACHE_ERR_NET => RES_SERVER_ERROR,
+ ZCACHE_ERR_MEM => RES_SERVER_ERROR,
+ ZCACHE_ERR_DISK => RES_SERVER_ERROR,
+ ZCACHE_ERR_METASERVER => RES_SERVER_ERROR,
+ ZCACHE_ERR_CACHESERVER => RES_SERVER_ERROR,
+ ZCACHE_ERR_LIB => RES_SERVER_ERROR,
+ ZCACHE_ERR_PART_SUC => RES_SERVER_ERROR,
+ ZCACHE_ERR_BLOCK_WRONG_STATE => RES_SERVER_ERROR,
+ ZCACHE_APIPLUS_INIT_FAIL => RES_SERVER_ERROR,
+ ZCACHE_ERR_CREATE_PRDT_FILE => RES_SERVER_ERROR,
+ ZCACHE_ERR_PRODUCT_ALREADY_EXIST => RES_SERVER_ERROR,
+
+ ZCACHE_CLIENT_ERR_PARAM => RES_CLIENT_ERROR,
+ ZCACHE_CLIENT_ERR_CONNECT => RES_CONNECTION_SOCKET_CREATE_FAILURE,
+ ZCACHE_CLIENT_ERR_READ => RES_UNKNOWN_READ_FAILURE,
+ ZCACHE_CLIENT_ERR_WRITE => RES_WRITE_FAILURE,
+ ZCACHE_CLIENT_ERR_NSHEAD => RES_PROTOCOL_ERROR,
+ ZCACHE_CLIENT_ERR_MCPACK => RES_PROTOCOL_ERROR,
+
+ );
+
+ private $_adapter;
+ private $_pname_str;
+ private $_token_str;
+ private $_logid_int;
+ private $_appid;
+ public $_last_errno;
+
+ private function _convertErrno($errcode) {
+ if (array_key_exists($errcode, $this->errnomap)) {
+ return $this->errnomap[$errcode];
+ }
+ return RES_SOME_ERRORS;
+ }
+
+ private function _log($output) {
+ if(ENABLE_DEBUG !== 0) {
+ echo "--memcached: $output";
+ }
+ }
+
+ public function _convertErrmsg($errcode) {
+ if (array_key_exists(strval($errcode), $this->errmsgmap)) {
+ return $this->errmsgmap[strval($errcode)];
+ }
+ return "RES_SOME_ERRORS";
+ }
+
+ public function __construct($cache_id, $memcache_addr, $user, $password) {
+ $cnfobj = new ZCacheConf();
+ //$cnfobj->PERSISTENT = 0;
+ $cnfobj->CONNTIMEOUT = 1;
+ $cnfobj->MCPACK_VERSION = PHP_MC_PACK_V2;
+
+ //retry time
+ $cnfobj->RETRYTIME = 3;
+
+ $zcache_addrs = $memcache_addr;
+
+ if($zcache_addrs === false) {
+ throw new MemcachedMeException("Missing cache server address");
+ }
+
+ $addr_arr = explode(",", $zcache_addrs);
+ if($addr_arr === false) {
+ throw new MemcachedMeException("invalid cache server address");
+ }
+
+ foreach($addr_arr as $addr) {
+ $ipport = explode(":", $addr);
+ if($ipport === false) {
+ throw new MemcachedMeException("invalid cache server address");
+ }
+ $cnfobj->agent_servers[] = array(
+ "socket_address" => $ipport[0],
+ "socket_port" => intval($ipport[1]),
+ "socket_timeout" => 500
+ );
+ }
+ if(!$this->_getInitEnv($cache_id, $user, $password)) {
+ throw new MemcachedMeException("invalid cache evn");
+ }
+ $this->_adapter = new ZCache($cnfobj);
+ $this->_adapter->set_shareAppid($this->_appid);
+ $this->_last_errno = RES_SUCCESS;
+ }
+ private function _getInitEnv($cache_id, $user, $password) {
+ $pname_str = $user;
+ $token_str = $password;
+ $logid_int = 1;
+
+ $appid = $cache_id;
+
+ if($pname_str === false || $token_str === false || $logid_int === false || $appid === false) {
+ $this->_log("Please setup HTTP_BAE_ENV_AK, HTTP_BAE_ENV_SK, HTTP_BAE_ENV_APPID\n");
+ return false;
+ }
+ $logid_int = intval($logid_int);
+ $this->_pname_str = $pname_str;
+ $this->_token_str = $token_str;
+ $this->_logid_int = $logid_int;
+ $this->_appid = $appid;
+
+ return true;
+ }
+
+ private function _getEnv(&$pname_str, &$token_str, &$logid_int) {
+ $pname_str = $this->_pname_str;
+ $token_str = $this->_token_str;
+ $logid_int = $this->_logid_int;
+
+ return true;
+ }
+
+ private function _checkParamValue($value) {
+ if(!is_string($value))
+ return true;
+
+ $len = strlen($value);
+ if($len == 0 || $len > ZCACHE_MAX_VALUE_LEN) {
+ return false;
+ }
+ return true;
+ }
+
+ private function _convertKey($key) {
+ if(is_numeric($key))
+ return strval($key);
+ return $key;
+ }
+
+ private function _convertValue($value) {
+ if(is_int($value)) {
+ $res = strval($value);
+ } else if(is_float($value)) {
+ $res = serialize(strval($value));
+ } else if(is_string($value)) {
+ if(is_numeric($value)) {
+ if(strstr($value, ".") !== false) { ### float
+ $res = serialize(strval($value));
+ } else
+ $res = $value;
+ }
+ $res = serialize($value);
+ } else {
+ $res = serialize($value);
+ }
+
+ if($this->_checkParamValue($res) === false) return false;
+ else return $res;
+ }
+
+ private function _convertOffset($offset) {
+ if(is_numeric($offset))
+ return intval($offset);
+ return 0;
+ }
+
+ private function _unconvertResult($result) {
+ if(!is_numeric($result)) {
+ return unserialize($result);
+ }
+ return $result;
+ }
+
+ public function addEx($pname_str, $token_str, $logid_int, $key, $value, $expiration = 0) {
+ if(!is_int($expiration) || $expiration < 0) {
+ $this->_last_errno = RES_CLIENT_ERROR;
+ return false;
+ }
+
+ $key = $this->_convertKey($key);
+ $value_str = $this->_convertValue($value);
+ if($value_str === false) {
+ $this->_last_errno = RES_CLIENT_ERROR;
+ return false;
+ }
+ $ret = $this->_adapter->addOne($pname_str, $token_str, $logid_int, $key, $value_str, $expiration*1000);
+ $this->_last_errno = $this->_convertErrno($this->_adapter->getLastErrCode());
+ return $ret;
+ }
+
+ public function add($key, $value, $expiration = 0) {
+ $pname_str = "";
+ $token_str = "";
+ $logid_int = 0;
+ if(!$this->_getEnv($pname_str, $token_str, $logid_int)) {
+ $this->_last_errno = RES_CLIENT_ERROR;
+ return false;
+ }
+ return $this->addEx($pname_str, $token_str, $logid_int, $key, $value, $expiration);
+ }
+
+ public function setEx($pname_str, $token_str, $logid_int, $key, $value, $expiration = 0) {
+ if(!is_int($expiration) || $expiration < 0) {
+ $this->_last_errno = RES_CLIENT_ERROR;
+ return false;
+ }
+
+ $key = $this->_convertKey($key);
+ $value_str = $this->_convertValue($value);
+ if($value_str === false) {
+ $this->_last_errno = RES_CLIENT_ERROR;
+ return false;
+ }
+ $ret = $this->_adapter->setOne($pname_str, $token_str, $logid_int, $key, $value_str, $expiration*1000);
+ $this->_last_errno = $this->_convertErrno($this->_adapter->getLastErrCode());
+ return $ret;
+ }
+
+ public function set($key, $value, $expiration = 0) {
+ $pname_str = "";
+ $token_str = "";
+ $logid_int = 0;
+ if(!$this->_getEnv($pname_str, $token_str, $logid_int)) {
+ $this->_last_errno = RES_CLIENT_ERROR;
+ return false;
+ }
+ return $this->setEx($pname_str, $token_str, $logid_int, $key, $value, $expiration);
+ }
+
+ public function replaceEx($pname_str, $token_str, $logid_int, $key, $value, $expiration = 0) {
+ if(!is_int($expiration) || $expiration < 0) {
+ $this->_last_errno = RES_CLIENT_ERROR;
+ return false;
+ }
+
+ $key = $this->_convertKey($key);
+ $value_str = $this->_convertValue($value);
+ if($value_str === false) {
+ $this->_last_errno = RES_CLIENT_ERROR;
+ return false;
+ }
+
+ $ret = $this->_adapter->replaceOne($pname_str, $token_str, $logid_int, $key, $value_str, $expiration*1000);
+ $this->_last_errno = $this->_convertErrno($this->_adapter->getLastErrCode());
+ return $ret;
+ }
+
+ public function replace($key, $value, $expiration = 0) {
+ $pname_str = "";
+ $token_str = "";
+ $logid_int = 0;
+ if(!$this->_getEnv($pname_str, $token_str, $logid_int)) {
+ $this->_last_errno = RES_CLIENT_ERROR;
+ return false;
+ }
+ return $this->replaceEx($pname_str, $token_str, $logid_int, $key, $value, $expiration);
+ }
+
+ public function deleteEx($pname_str, $token_str, $logid_int, $key, $time=0) {
+ $key = $this->_convertKey($key);
+ $ret = $this->_adapter->deleteOne($pname_str, $token_str, $logid_int, $key, $time*1000);
+ $this->_last_errno = $this->_convertErrno($this->_adapter->getLastErrCode());
+
+ return $ret;
+ }
+
+ public function delete($key, $time = 0) {
+ $pname_str = "";
+ $token_str = "";
+ $logid_int = 0;
+ if(!$this->_getEnv($pname_str, $token_str, $logid_int)) {
+ $this->_last_errno = RES_CLIENT_ERROR;
+ return false;
+ }
+ return $this->deleteEx($pname_str, $token_str, $logid_int, $key, $time);
+ }
+
+ public function incrementEx($pname_str, $token_str, $logid_int, $key, $offset = 1) {
+ $key = $this->_convertKey($key);
+ $offset = $this->_convertOffset($offset);
+ $ret = $this->_adapter->increment($pname_str, $token_str, $logid_int, $key, strval($offset), 0);
+ $this->_last_errno = $this->_convertErrno($this->_adapter->getLastErrCode());
+ if($ret === false) return false;
+ return intval($ret);
+ }
+
+ public function increment($key, $offset = 1) {
+ $pname_str = "";
+ $token_str = "";
+ $logid_int = 0;
+ if(!$this->_getEnv($pname_str, $token_str, $logid_int)) {
+ $this->_last_errno = RES_CLIENT_ERROR;
+ return false;
+ }
+ return $this->incrementEx($pname_str, $token_str, $logid_int, $key, $offset);
+ }
+
+ public function decrementEx($pname_str, $token_str, $logid_int, $key, $offset = 1) {
+ $key = $this->_convertKey($key);
+ $offset = $this->_convertOffset($offset);
+ $ret = $this->_adapter->decrement($pname_str, $token_str, $logid_int, $key, strval($offset), 0);
+ $this->_last_errno = $this->_convertErrno($this->_adapter->getLastErrCode());
+ if($ret === false) return false;
+ return intval($ret);
+ }
+
+ public function decrement($key, $offset = 1) {
+ $pname_str = "";
+ $token_str = "";
+ $logid_int = 0;
+ if(!$this->_getEnv($pname_str, $token_str, $logid_int)) {
+ $this->_last_errno = RES_CLIENT_ERROR;
+ return false;
+ }
+ return $this->decrementEx($pname_str, $token_str, $logid_int, $key, $offset);
+ }
+
+ public function getEx($pname_str, $token_str, $logid_int, $key) {
+ $key = $this->_convertKey($key);
+ $ret = $this->_adapter->getOne($pname_str, $token_str, $logid_int, $key);
+ $this->_last_errno = $this->_convertErrno($this->_adapter->getLastErrCode());
+ $ret = $this->_unconvertResult($ret);
+ return $ret;
+ }
+
+ public function get($key, $cache_cb = null, & $cas_token = null) {
+ $pname_str = "";
+ $token_str = "";
+ $logid_int = 0;
+ if(!$this->_getEnv($pname_str, $token_str, $logid_int)) {
+ $this->_last_errno = RES_CLIENT_ERROR;
+ return false;
+ }
+ return $this->getEx($pname_str, $token_str, $logid_int, $key);
+ }
+
+ public function setMultiEx($pname_str, $token_str, $logid_int, array $items, $expiration = 0) {
+ if(!is_int($expiration) || $expiration < 0) {
+ $this->_last_errno = RES_CLIENT_ERROR;
+ return false;
+ }
+ $new_items = array();
+ foreach($items as $key => $val) {
+ $key = $this->_convertKey($key);
+ $value_str = $this->_convertValue($val);
+ if($value_str === false) {
+ $this->_last_errno = RES_CLIENT_ERROR;
+ return false;
+ }
+ $new_items[$key] = $value_str;
+ }
+
+ $ret_arr = $this->_adapter->setMulti($pname_str, $token_str, $logid_int, $new_items, $expiration*1000);
+ if(!$ret_arr) {
+ $this->_last_errno = RES_PAYLOAD_FAILURE;
+ return false;
+ }
+
+ if(!isset($ret_arr['content']) || !is_array($ret_arr['content']) ) {
+ $this->_last_errno = RES_PAYLOAD_FAILURE;
+ return false;
+ }
+
+ $count = count($ret_arr['content']);
+ if(count($items) != $count) {
+ $this->_last_errno = RES_PAYLOAD_FAILURE;
+ return false;
+ }
+
+ for($i = 0; $i < $count; $i++) {
+ $result = $ret_arr['content']['result' . $i];
+ if(isset($result['err_no']) && is_int($result['err_no']) && $result['err_no'] == ZCACHE_OK) {
+ continue;
+ } else {
+ $this->_last_errno = RES_PAYLOAD_FAILURE;
+ return false;
+ }
+ }
+ $this->_last_errno = RES_SUCCESS;
+ return true;
+ }
+
+ public function setMulti(array $items, $expiration = 0) {
+ $pname_str = "";
+ $token_str = "";
+ $logid_int = 0;
+
+ if(!$this->_getEnv($pname_str, $token_str, $logid_int)) {
+ $this->_last_errno = RES_CLIENT_ERROR;
+ return false;
+ }
+ return $this->setMultiEx($pname_str, $token_str, $logid_int, $items, $expiration);
+ }
+
+ public function getMultiEx($pname_str, $token_str, $logid_int, array $keys) {
+ if(!is_array($keys)) {
+ $this->_last_errno = RES_CLIENT_ERROR;
+ return false;
+ }
+
+ $strkey_arr = array();
+ foreach($keys as $k => $v) {
+ $strkey_arr[] = $this->_convertKey($v);
+ }
+
+ $ret_arr = $this->_adapter->getMulti($pname_str, $token_str, $logid_int, $strkey_arr);
+ if(!$ret_arr) {
+
+ $this->_last_errno = RES_PAYLOAD_FAILURE;
+ return false;
+ }
+
+ if(!isset($ret_arr['content']) || !is_array($ret_arr['content']) ) {
+
+ $this->_last_errno = RES_PAYLOAD_FAILURE;
+ return false;
+ }
+
+ $count = count($ret_arr['content']);
+ if(count($keys) != $count) {
+
+ $this->_last_errno = RES_PAYLOAD_FAILURE;
+ return false;
+ }
+
+
+ $ret_values = array();
+ for($i = 0; $i < $count; $i++) {
+ $result = $ret_arr['content']['result' . $i];
+ if(isset($result['err_no']) && is_int($result['err_no']) && $result['err_no'] == ZCACHE_OK &&
+ isset($result['value']) && is_string($result['value']) ) {
+
+ $ret_values[$keys[$i]] = $this->_unconvertResult($result['value']);
+ }
+ }
+ $this->_last_errno = RES_SUCCESS;
+ return $ret_values;
+ }
+
+ public function getMulti(array $keys, & $cas_tokens = null, $flags = 0) {
+ $pname_str = "";
+ $token_str = "";
+ $logid_int = 0;
+ if(!$this->_getEnv($pname_str, $token_str, $logid_int)) {
+ $this->_last_errno = RES_CLIENT_ERROR;
+ return false;
+ }
+ return $this->getMultiEx($pname_str, $token_str, $logid_int, $keys);
+ }
+/*
+ public function getByKey($server_key, $key, $cache_cb = null, & $cas_token = null) {
+ throw new Exception("NotImplemented");
+ }
+
+ public function getMultiByKey($server_key, array $keys, & $cas_tokens = null, $flags = 0) {
+ throw new Exception("NotImplemented");
+ }
+
+ public function getDelayed(array $keys, $with_cas = null, $value_cb = null) {
+ throw new Exception("NotImplemented");
+ }
+
+ public function getDelayedByKey($server_key, array $keys, $with_cas = null, $value_cb = null) {
+ throw new Exception("NotImplemented");
+ }
+
+ public function fetch() {
+ throw new Exception("NotImplemented");
+ }
+
+ public function fetchAll() {
+ throw new Exception("NotImplemented");
+ }
+
+ public function setByKey($server_key, $key, $value, $expiration = 0) {
+ throw new Exception("NotImplemented");
+ }
+
+ public function setMultiByKey($server_key, array $items, $expiration = 0) {
+ throw new Exception("NotImplemented");
+ }
+
+ public function cas($token, $key, $value, $expiration = 0) {
+ throw new Exception("NotImplemented");
+ }
+
+ public function casByKey($token, $server_key, $key, $value, $expiration = 0) {
+ throw new Exception("NotImplemented");
+ }
+
+ public function addByKey($server_key, $key, $value, $expiration = 0) {
+ throw new Exception("NotImplemented");
+ }
+
+ public function append($key, $value, $expiration = 0) {
+ throw new Exception("NotImplemented");
+ }
+
+ public function appendByKey($server_ke, $key, $value, $expiration = 0) {
+ throw new Exception("NotImplemented");
+ }
+
+ public function prepend($key, $value, $expiration = 0) {
+ throw new Exception("NotImplemented");
+ }
+
+ public function prependByKey($server_key, $key, $value, $expiration = 0) {
+ throw new Exception("NotImplemented");
+ }
+
+ public function replaceByKey($serve_key, $key, $value, $expiration = 0) {
+ throw new Exception("NotImplemented");
+ }
+
+ public function deleteByKey($key, $time = 0) {
+ throw new Exception("NotImplemented");
+ }
+
+ public function getOption($option) {
+ throw new Exception("NotImplemented");
+ }
+
+ public function setOption($option, $value) {
+ throw new Exception("NotImplemented");
+ }
+
+ public function addServer($host, $port, $weight = 0) {
+ throw new Exception("NotImplemented");
+ }
+
+ public function addServers(array $servers) {
+ throw new Exception("NotImplemented");
+ }
+
+ public function getServerList() {
+ throw new Exception("NotImplemented");
+ }
+
+ public function getServerByKey($server_key) {
+ throw new Exception("NotImplemented");
+ }
+
+ public function flush($delay = 0) {
+ throw new Exception("NotImplemented");
+ }
+
+ public function getStats() {
+ throw new Exception("NotImplemented");
+ }
+
+ public function getResultMessage() {
+ throw new Exception("NotImplemented");
+ }
+*/
+
+ public function getResultCode() {
+ return $this->_last_errno;
+ }
+
+ public function getExtEx($pname_str, $token_str, $logid_int, $key) {
+
+ $key = $this->_convertKey($key);
+
+ if(is_string($key)) {
+ return $this->getEx($pname_str, $token_str, $logid_int, $key);
+ } elseif(is_array($key)) {
+ return $this->getMultiEx($pname_str, $token_str, $logid_int, $key);
+ } else {
+ $this->_last_errno = RES_CLIENT_ERROR;
+ return false;
+ }
+ }
+
+ public function getExt($key, $cache_cb = null, & $cas_token = null) {
+ $pname_str = "";
+ $token_str = "";
+ $logid_int = 0;
+
+ if(!$this->_getEnv($pname_str, $token_str, $logid_int)) {
+ $this->_last_errno = RES_CLIENT_ERROR;
+ return false;
+ }
+ return $this->getExtEx($pname_str, $token_str, $logid_int, $key);
+ }
+
+ public function set_shareAppid($appid)
+ {
+ if(!is_string($appid)) return false;
+
+ $ret = $this->_adapter->set_shareAppid($appid);
+ if($ret === false) return false;
+
+ $this->_appid = $appid;
+ return true;
+ }
+}
+
+class MemcachedMeException extends Exception {
+ function __construct($errmsg = "", $errcode = 0) {
+ }
+
+}
diff --git a/ptcms/library/bae/zcache/zcache_api.php b/ptcms/library/bae/zcache/zcache_api.php
new file mode 100644
index 0000000..11db7e7
--- /dev/null
+++ b/ptcms/library/bae/zcache/zcache_api.php
@@ -0,0 +1,486 @@
+handlers = array ();
+ $this->zcfObj = $pZcfObj;
+ }
+
+ public function __destruct() {
+ foreach($this->handlers as $k => $handler) {
+ $handler->close();
+ unset ($this->handlers[$k]);
+ }
+ }
+
+ private function _log($output) {
+ #echo "--zcached: $output";
+ }
+
+ protected function _getHandler() {
+ if (isset($this->_cur_handler))
+ {
+ return $this->_cur_handler;
+ }
+ $servers = $this->zcfObj->agent_servers;
+ $num = count($servers);
+ $retry = $this->zcfObj->RETRYTIME;
+
+ while ($retry-- > 0) {
+ $idx = rand() % $num;
+ $server = $servers[$idx];
+ $key = $server['socket_address'] . ":" . $server['socket_port'];
+ $socket = new ZCacheSocket();
+ $socket->set_vars_from_array($server);
+ if ($socket->connect($this->zcfObj->CONNTIMEOUT))
+ {
+ $this->_cur_handler = $socket;
+ return $socket;
+ }
+ /* if (!isset ($this->handlers[$key])) { */
+ /* $socket = new ZCacheSocket(); */
+ /* $socket->set_vars_from_array($server); */
+
+ /* if ($socket->connect($this->zcfObj->CONNTIMEOUT)) { */
+ /* $this->handlers[$key] = $socket; */
+ /* return $socket; */
+ /* } */
+ /* } else */
+ /* return $this->handlers[$key]; */
+ }
+ return null;
+ }
+
+ protected function _putHandler($handler, $force = 0) {
+ if (!$this->zcfObj->PERSISTENT || $force != 0) {
+ /* foreach ($this->handlers as $key => $value) { */
+ /* if ($value === $handler) { */
+ /* $handler->close(); */
+ /* unset ($this->handlers[$key]); */
+ /* break; */
+ /* } */
+ /* } */
+ $handler->close();
+ unset($this->_cur_handler);
+ }
+ }
+
+ protected function _readResponse($handler) {
+ //ȡnshead
+
+ $headbuf = $handler->read(36);
+ if (!$headbuf) {
+ $this->_log("read nshead failed\n");
+ $this->_last_errno = ZCACHE_CLIENT_ERR_READ;
+ $this->_last_errmsg = "net read err";
+ return NULL;
+ }
+
+ //nshead
+ $head = zcache_split_nshead($headbuf);
+ if (!isset ($head['body_len'])) {
+ $this->_log("no body_len in nshead\n");
+ $this->_last_errno = ZCACHE_CLIENT_ERR_NSHEAD;
+ $this->_last_errmsg = "nshead err";
+ return NULL;
+ }
+
+ //ȡݰ
+ $retbuffer = $handler->read($head['body_len']);
+ if (!$retbuffer) {
+ $this->_log("read nsbody " . $head['body_len'] . " failed\n");
+ $this->_last_errno = ZCACHE_CLIENT_ERR_READ;
+ $this->_last_errmsg = "net read err";
+ return NULL;
+ }
+ if($head['reserverd']) {
+ $decrypt_data = fcrypt_decode_hmac('key', $retbuffer);
+ //$this->_log("fcrypt_decode_hmac: " . strlen($retbuffer) . " " . strlen($decrypt_data) );
+ return $decrypt_data;
+ } else {
+ return $retbuffer;
+ }
+ }
+
+ public function getLastErrCode() {
+ return $this->_last_errno;
+ }
+ public function getLastErrMsg() {
+ return $this->_last_errmsg;
+ }
+
+ private function _makeNshead($logid_int, $query_pack) {
+ $nshead = new ZCacheNsHead();
+ $nshead_arr['provider'] = "zcacheadapter";
+ $nshead_arr['log_id'] = $logid_int;
+
+ $nshead_arr['reserved'] = $this->zcfObj->crypt_flag;
+ if($this->zcfObj->crypt_flag) {
+ $crypt_data = fcrypt_encode_hmac('key', $query_pack);
+ //$this->_log("fcrypt_encode_hmac: " . strlen($query_pack) . " " . strlen($crypt_data) );
+ $nshead_arr['body_len'] = strlen($crypt_data);
+ $buffer = $nshead->build_nshead($nshead_arr) . $crypt_data;
+ } else {
+ $nshead_arr['body_len'] = strlen($query_pack);
+ $buffer = $nshead->build_nshead($nshead_arr) . $query_pack;
+ }
+ return $buffer;
+ }
+
+ private function _makePack($pname_str, $token_str, $logid_int, $cmd_str, $expire_int, $item_arr) {
+ //fill query pack
+ $query_arr['cmd'] = $cmd_str;
+ $query_arr['pname'] = $pname_str;
+ $query_arr['token'] = $token_str;
+ $query_arr['logid'] = $logid_int;
+ $query_arr['appid'] = $this->_appid;
+
+ $query_num = count($item_arr);
+ $query_arr['content']['query_num'] = $query_num;
+
+ $i = 0;
+ foreach($item_arr as $value) {
+ $query_arr['content']['query' . $i]['key'] = $value['key'];
+
+ if (isset($value['value']))
+ $query_arr['content']['query' . $i]['value'] = $value['value'];
+
+ if($expire_int >= 0) {
+ $query_arr['content']['query' . $i]['delay_time'] = $expire_int;
+ }
+ $i++;
+ }
+
+ $query_pack = mc_pack_array2pack($query_arr, $this->zcfObj->MCPACK_VERSION);
+ return $this->_makeNshead($logid_int, $query_pack);
+ }
+
+ public function parseResult($ret_arr) {
+ if(!isset($ret_arr['content']) || !is_array($ret_arr['content']) ||
+ !isset($ret_arr['content']['result0']) || !is_array($ret_arr['content']['result0']) ) {
+ $this->_last_errno = ZCACHE_CLIENT_ERR_MCPACK;
+ return false;
+ }
+
+ $val = $ret_arr['content']['result0'];
+ if (isset($val['err_no']) && is_int($val['err_no']) ) {
+ $this->_last_errno = $val['err_no'];
+ if($this->_last_errno == ZCACHE_OK)
+ return true;
+ return false;
+ } else {
+ $this->_last_errno = ZCACHE_CLIENT_ERR_MCPACK;
+ return false;
+ }
+ }
+
+ public function parseResult2($ret_arr) {
+ if(!isset($ret_arr['content']) || !is_array($ret_arr['content']) ||
+ !isset($ret_arr['content']['result0']) || !is_array($ret_arr['content']['result0']) ) {
+ $this->_last_errno = ZCACHE_CLIENT_ERR_MCPACK;
+ return false;
+ }
+
+ $val = $ret_arr['content']['result0'];
+ if (isset($val['err_no']) && is_int($val['err_no']) &&
+ isset($val['value']) && is_string($val['value']) ) {
+ $this->_last_errno = $val['err_no'];
+ return $val['value'];
+ }
+ else if(isset($val['err_no']) && is_int($val['err_no'])) {
+ $this->_last_errno = $val['err_no'];
+ return false;
+ }
+ else {
+ $this->_last_errno = ZCACHE_CLIENT_ERR_MCPACK;
+ return false;
+ }
+ }
+
+ private function _talkWithServer($handler, $buffer) {
+
+ if (!$handler->write($buffer)) {
+ $this->_last_errno = ZCACHE_CLIENT_ERR_WRITE;
+ $this->_last_errmsg = "net write err";
+ $this->_putHandler($handler, 1);
+ return false;
+ }
+
+ $retbuffer = $this->_readResponse($handler);
+ if (!$retbuffer) {
+ $this->_putHandler($handler, 1);
+
+ //print("retry connect\n");
+ $handler = $this->_getHandler(); // read error: retry connect , write , read once
+ if (!$handler) {
+ $this->_last_errno = ZCACHE_CLIENT_ERR_CONNECT;
+ $this->_last_errmsg = "retry net connect err";
+ return false;
+ }
+
+ //print("retry write\n");
+ if (!$handler->write($buffer)) {
+ $this->_last_errno = ZCACHE_CLIENT_ERR_WRITE;
+ $this->_last_errmsg = "retry net write err";
+ $this->_putHandler($handler, 1);
+ return false;
+ }
+
+ //print("retry read\n");
+ $retbuffer = $this->_readResponse($handler);
+ if (!$retbuffer) {
+ $this->_last_errno = ZCACHE_CLIENT_ERR_READ;
+ $this->_last_errmsg = "retry net read err";
+ $this->_putHandler($handler, 1);
+ return false;
+ }
+
+ }
+
+ //print("query ok\n");
+ $this->_putHandler($handler);
+ $ret_arr = mc_pack_pack2array($retbuffer);
+
+
+
+ if (isset ($ret_arr['err_no']) && ZCACHE_OK == $ret_arr['err_no'] ) {
+ $this->_last_errno = ZCACHE_OK;
+ if(isset($ret_arr['error'])) {
+ $this->_last_errmsg = $ret_arr['error'];
+ }
+ return $ret_arr;
+ } else {
+ if (isset ($ret_arr['err_no'])) {
+ $this->_last_errno = $ret_arr['err_no'];
+ if(isset($ret_arr['error'])) {
+ $this->_last_errmsg = $ret_arr['error'];
+ }
+ } else {
+ $this->_last_errno = ZCACHE_CLIENT_ERR_MCPACK;
+ $this->_last_errmsg = "mcpack err";
+ }
+ return false;
+ }
+ }
+
+ private function talkWithServer($pname_str, $token_str, $logid_int, $cmd_str, $expire_int, $item_arr) {
+ $handler = $this->_getHandler();
+ if (!$handler) {
+ $this->_last_errno = ZCACHE_CLIENT_ERR_CONNECT;
+ $this->_last_errmsg = "net connect err";
+ return false;
+ }
+
+ $buffer = $this->_makePack($pname_str, $token_str, $logid_int, $cmd_str, $expire_int, $item_arr);
+ return $this->_talkWithServer($handler, $buffer);
+ }
+
+ private function talkWithServer2($logid_int, $query_arr) {
+ $handler = $this->_getHandler();
+ if (!$handler) {
+ $this->_last_errno = ZCACHE_CLIENT_ERR_CONNECT;
+ $this->_last_errmsg = "net connect err";
+ return false;
+ }
+
+ $query_pack = mc_pack_array2pack($query_arr, $this->zcfObj->MCPACK_VERSION);
+ $buffer = $this->_makeNshead($logid_int, $query_pack);
+ return $this->_talkWithServer($handler, $buffer);
+ }
+
+ private function _addSetReplace($pname_str, $token_str, $logid_int, $cmd_str, $key_str, $value_str, $expire_int) {
+ //param judge
+ if (!is_string($pname_str) || !is_string($token_str) || !is_int($logid_int) ||
+ !is_string($key_str) || strlen($key_str) > ZCACHE_MAX_KEY_LEN || strlen($key_str) == 0 ||
+ !is_string($value_str) ||
+ !is_int($expire_int) ) {
+ $this->_last_errno = ZCACHE_CLIENT_ERR_PARAM;
+ $this->_last_errmsg = "param err";
+ return false;
+ }
+
+ $query_arr = array(
+ array(
+ 'key' => $key_str,
+ 'value' => $value_str
+ )
+ );
+ $ret_arr = $this->talkWithServer($pname_str, $token_str, $logid_int, $cmd_str, $expire_int, $query_arr);
+ if($ret_arr === false) return false;
+ return $this->parseResult($ret_arr);
+ }
+
+ public function addOne($pname_str, $token_str, $logid_int, $key_str, $value_str, $expire_int = 0) {
+ return $this->_addSetReplace($pname_str, $token_str, $logid_int, "add", $key_str, $value_str, $expire_int);
+ }
+
+ public function setOne($pname_str, $token_str, $logid_int, $key_str, $value_str, $expire_int = 0) {
+ return $this->_addSetReplace($pname_str, $token_str, $logid_int, "set", $key_str, $value_str, $expire_int);
+ }
+
+ public function replaceOne($pname_str, $token_str, $logid_int, $key_str, $value_str, $expire_int = 0) {
+ return $this->_addSetReplace($pname_str, $token_str, $logid_int, "replace", $key_str, $value_str, $expire_int);
+ }
+
+ public function deleteOne($pname_str, $token_str, $logid_int, $key_str, $delay_int = 0) {
+ //param judge
+ if (!is_string($pname_str) || !is_string($token_str) || !is_int($logid_int) ||
+ !is_string($key_str) || strlen($key_str) > ZCACHE_MAX_KEY_LEN || strlen($key_str) == 0 ||
+ !is_int($delay_int) ) {
+ $this->_last_errno = ZCACHE_CLIENT_ERR_PARAM;
+ $this->_last_errmsg = "param err";
+ return false;
+ }
+
+ $query_arr = array(
+ array(
+ 'key' => $key_str,
+ )
+ );
+ $ret_arr = $this->talkWithServer($pname_str, $token_str, $logid_int, "delete", $delay_int, $query_arr);
+ if($ret_arr === false) return false;
+ return $this->parseResult($ret_arr);
+ }
+
+ public function increment($pname_str, $token_str, $logid_int, $key_str, $value_str, $expire_int = 0) {
+ //param judge
+ if (!is_string($pname_str) || !is_string($token_str) || !is_int($logid_int) ||
+ !is_string($key_str) || strlen($key_str) > ZCACHE_MAX_KEY_LEN || strlen($key_str) == 0 ||
+ !is_string($value_str) ||
+ !is_int($expire_int) ) {
+ $this->_last_errno = ZCACHE_CLIENT_ERR_PARAM;
+ $this->_last_errmsg = "param err";
+ return false;
+ }
+ $query_arr = array(
+ array(
+ 'key' => $key_str,
+ 'value' => $value_str
+ )
+ );
+ $ret_arr = $this->talkWithServer($pname_str, $token_str, $logid_int, "increment", $expire_int, $query_arr);
+ if($ret_arr === false) return false;
+ return $this->parseResult2($ret_arr);
+ }
+
+ public function decrement($pname_str, $token_str, $logid_int, $key_str, $value_str, $expire_int = 0) {
+ //param judge
+ if (!is_string($pname_str) || !is_string($token_str) || !is_int($logid_int) ||
+ !is_string($key_str) || strlen($key_str) > ZCACHE_MAX_KEY_LEN || strlen($key_str) == 0 ||
+ !is_string($value_str) ||
+ !is_int($expire_int) ) {
+ $this->_last_errno = ZCACHE_CLIENT_ERR_PARAM;
+ $this->_last_errmsg = "param err";
+ return false;
+ }
+
+ $query_arr = array(
+ array(
+ 'key' => $key_str,
+ 'value' => $value_str
+ )
+ );
+ $ret_arr = $this->talkWithServer($pname_str, $token_str, $logid_int, "decrement", $expire_int, $query_arr);
+ if($ret_arr === false) return false;
+ return $this->parseResult2($ret_arr);
+ }
+
+ /*
+ ** return: value(string) or FALSE
+ */
+ public function getOne($pname_str, $token_str, $logid_int, $key_str) {
+ //param judge
+ if (!is_string($pname_str) || !is_string($token_str) || !is_int($logid_int) ||
+ !is_string($key_str) || strlen($key_str) > ZCACHE_MAX_KEY_LEN || strlen($key_str) == 0) {
+ $this->_last_errno = ZCACHE_CLIENT_ERR_PARAM;
+ $this->_last_errmsg = "param err";
+ return false;
+ }
+
+ $query_arr = array(
+ array(
+ 'key' => $key_str,
+ )
+ );
+ $ret_arr = $this->talkWithServer($pname_str, $token_str, $logid_int, "get", -1, $query_arr);
+ if($ret_arr === false) return false;
+ return $this->parseResult2($ret_arr);
+ }
+
+ public function getMulti($pname_str, $token_str, $logid_int, $key_arr) {
+ //param judge
+ if (!is_string($pname_str) || !is_string($token_str) || !is_int($logid_int) ||
+ !is_array($key_arr) || count($key_arr) > ZCACHE_MAX_QUERY_NUM) {
+ $this->_last_errno = ZCACHE_CLIENT_ERR_PARAM;
+ $this->_last_errmsg = "param err";
+ return false;
+ }
+
+ $query_arr = array();
+ foreach ($key_arr as $key) {
+ if (!is_string($key) || strlen($key) > ZCACHE_MAX_KEY_LEN || strlen($key) == 0) {
+ $this->_last_errno = ZCACHE_CLIENT_ERR_PARAM;
+ $this->_last_errmsg = "param err";
+ return false;
+ }
+ $query_arr[] = array(
+ 'key' => $key,
+ );
+ }
+ return $this->talkWithServer($pname_str, $token_str, $logid_int, "get", -1, $query_arr);
+ }
+
+ public function setMulti($pname_str, $token_str, $logid_int, $item_arr, $expire_int = 0) {
+ //param judge
+ if (!is_string($pname_str) || !is_string($token_str) || !is_int($logid_int) ||
+ !is_array($item_arr) || count($item_arr) > ZCACHE_MAX_QUERY_NUM ||
+ !is_int($expire_int) ) {
+ $this->_last_errno = ZCACHE_CLIENT_ERR_PARAM;
+ $this->_last_errmsg = "param err";
+ return false;
+ }
+
+ $query_arr = array();
+ foreach($item_arr as $key => $val) {
+ if (!is_string($key) || strlen($key) > ZCACHE_MAX_KEY_LEN || strlen($key) == 0 ||
+ !is_string($val) ) {
+ $this->_last_errno = ZCACHE_CLIENT_ERR_PARAM;
+ $this->_last_errmsg = "param err";
+ return false;
+ }
+
+ $query_arr[] = array(
+ 'key' => $key,
+ 'value' => $val
+ );
+ }
+ return $this->talkWithServer($pname_str, $token_str, $logid_int, "set", $expire_int, $query_arr);
+ }
+
+ public function set_shareAppid($appid)
+ {
+ if(!is_string($appid)) return false;
+
+ $this->_appid = $appid;
+ return true;
+ }
+}
diff --git a/ptcms/library/bae/zcache/zcache_conf.php b/ptcms/library/bae/zcache/zcache_conf.php
new file mode 100644
index 0000000..0461fc6
--- /dev/null
+++ b/ptcms/library/bae/zcache/zcache_conf.php
@@ -0,0 +1,20 @@
+ 0,
+ * 'version' => 0,
+ * 'log_id' => 0,
+ * 'provider' => ""
+ * 'magic_num' => 0xfb709394, #ħ, ⲿҪдԶ
+ * 'reserved' => 0,
+ * 'body_len' => 0
+ * );
+ *
+ *
+ *
+ * װһԷ͵nsheadͷݰ,ݣⲿƴװ
+ *
+ * @param $vars_arr Ҫnsheadͷݰ,
+ * @return һԷ͵nsheadͷݰ,ݣⲿƴװ
+ */
+ public function build_nshead($vars_arr)
+ {
+ $nshead_arr = array(
+ 'id' => 0,
+ 'version' => 0,
+ 'log_id' => 0,
+ 'provider' => str_pad("", 16, "\0", STR_PAD_BOTH),
+ 'magic_num' => 0xfb709394, #ħ
+ 'reserved' => 0,
+ 'body_len' => 0
+ );
+ foreach ($vars_arr as $key => $value)
+ {
+ if (isset($nshead_arr[$key]))
+ {
+ $nshead_arr[$key] = $value;
+ }
+ }
+ $nshead = "";
+ $nshead = pack("L*", (($nshead_arr['version'] << 16) + ($nshead_arr['id'])), $nshead_arr['log_id']);
+ //ȡ15ֽڵprovider
+ $nshead .= str_pad(substr($nshead_arr['provider'], 0, 15), 16, "\0");
+ $nshead .= pack("L*", $nshead_arr['magic_num'], $nshead_arr['reserved']);
+ $nshead .= pack("L", $nshead_arr['body_len']);
+ return $nshead;
+ }
+
+ /**
+ * nsheadbuf뷵bufֶ
+ * һnsheadݰ nshead + buf
+ *
+ * һnsheadarray,
+ *
+ * array(
+ * 'id' =>
+ * 'version' =>
+ * 'log_id' =>
+ * 'provider' =>
+ * 'magic_num' =>
+ * 'reserved' =>
+ * 'body_len' =>
+ * 'buf' =>
+ * );
+
+ *
+ * 'buf' DZʾʵʵ
+ *
+ * @param $head յnshead ݰ
+ * @param $get_buf Ҫݣget_buf == false, 'buf'
+ * @param һnsheadarray
+ */
+ public function split_nshead($head, $get_buf = true)
+ {
+ $ret_arr = array(
+ 'id' => 0,
+ 'version' => 0,
+ 'log_id' => 0,
+ 'provider' => "",
+ 'magic_num' => 0,
+ 'reserved' => 0,
+ 'body_len' => 0,
+ 'buf' => ""
+ );
+
+ $ret = unpack("v1id/v1version/I1log_id", substr($head, 0, 8));
+ foreach ($ret as $key => $value)
+ {
+ $ret_arr[$key] = $value;
+ }
+ $ret_arr['provider'] = substr($head, 8, 16);
+ $ret = unpack("I1magic_num/I1reserverd/I1body_len", substr($head, 24, 12));
+ foreach ($ret as $key => $value)
+ {
+ $ret_arr[$key] = $value;
+ }
+ //36nshead_tṹС
+ if ($get_buf) {
+ $ret_arr['buf'] = substr($head, 36, $ret_arr['body_len']);
+ }
+ return $ret_arr;
+ }
+
+ /**
+ * nshead ͨsocket $msgsocket ͳȥ
+ *
+ * @param $msgsocket Ҫдsocket
+ * @param $vars_arr Ҫ͵nsheadͷ
+ * @param $buf Ҫ͵ʵ
+ * @return ͵ʵݳ
+ */
+ public function nshead_write($msgsocket, $vars_arr, $buf)
+ {
+ $nshead = $this->build_nshead($vars_arr);
+ $nshead .= $buf;
+ return fwrite($msgsocket, $nshead, strlen($nshead));
+ }
+
+ /**
+ * socket $msgsocket ȡnsheadݰ
+ *
+ * @param $msgsocket Ҫյsocket
+ * @param $nshead_check_magicnum ǷMAGICNUM, Ĭϼ
+ */
+ public function nshead_read($msgsocket, $nshead_check_magicnum = true)
+ {
+ $temp_out = "";
+ $this->socket_read_buf = "";
+ //ȶnsheadͷ
+ $temp_out = fread($msgsocket, 36);
+ if ($temp_out === false)
+ {
+ return false;
+ }
+ $nshead = $this->split_nshead($temp_out, false);
+ // msgic num
+ if ($nshead_check_magicnum == true
+ && $nshead['magic_num'] != 0xfb709394
+ && $nshead['magic_num'] != -76508268)
+ //php汾unpackʱbugжһ¸
+ {
+ error_log("magic num mismatch: ret ".$nshead['magic_num']." want 0xfb709394");
+ return false;
+ }
+ #nshead
+ $left_bytes = $nshead['body_len'];
+ while ($left_bytes > 0) {
+ $recv_data = fread($msgsocket, $left_bytes);
+ $recv_size = strlen($recv_data);
+ if ($recv_size > 0 && $recv_size <= $left_bytes) {
+ $nshead['buf'] .= $recv_data;
+ $left_bytes -= $recv_size;
+ } else {
+ return false;
+ }
+ }
+ return $nshead;
+ }
+}
+
diff --git a/ptcms/library/bae/zcache/zcache_socket.php b/ptcms/library/bae/zcache/zcache_socket.php
new file mode 100644
index 0000000..2832e5a
--- /dev/null
+++ b/ptcms/library/bae/zcache/zcache_socket.php
@@ -0,0 +1,277 @@
+socket_domain = 1; //AF_INET;
+ $this->socket_type = 1; //SOCK_STREAM;
+ $this->socket_protocol = 6; //SOL_TCP;
+ $this->socket_address = "127.0.0.1";
+ $this->socket_port = 9120;
+ $this->socket_read_len = 8192;
+ $this->socket_read_type = 2; //PHP_BINARY_READ;
+ $this->socket_timeout = 200;
+ $this->socket_error = "";
+ $this->socket_errno = 0;
+ }
+
+ function __destruct()
+ {
+ if (!empty($this->socket))
+ {
+ if(is_resource($this->socket))
+ {
+ fclose($this->socket);
+ //socket_close($this->socket);
+ }
+ $this->socket = NULL;
+ }
+ $this->socket_domain = NULL;
+ $this->socket_type = NULL;
+ $this->socket_protocol = NULL;
+ $this->socket_address = NULL;
+ $this->socket_port = NULL;
+ $this->socket_read_len = NULL;
+ $this->socket_read_type = NULL;
+ $this->socket_timeout = NULL;
+ $this->socket_error = NULL;
+ $this->socket_errno = NULL;
+ }
+
+ function __set($name, $value)
+ {
+ switch ($name)
+ {
+ case "socket_domain":
+ if ($value == 2 /*AF_INET*/ || $value == 10 /*AF_INET6*/ || $value == 1 /*AF_UNIX*/)
+ {
+ $this->$name = $value;
+ }
+ break;
+ case "socket_type":
+ if ($value == 1 /*SOCK_STREAM*/ || $value = 2 /*SOCK_DGRAM*/ || $value == 3 /*SOCK_RAW*/ ||
+ $value == 5 /*SOCK_SEQPACKET*/ || $value == 4 /*SOCK_RDM*/)
+ {
+ $this->$name = $value;
+ }
+ break;
+ case "socket_protocol":
+ if ($value == 6 /*SOL_TCP*/ || $value == 17 /*SOL_UDP*/ || $value == 1 /*SOL_SOCKET*/)
+ {
+ $this->$name = $value;
+ }
+ break;
+ case "socket_address":
+ //preg_match_all("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $value, $match);
+ //if ($match[0][0] == $value)
+ //{
+ $this->$name = $value;
+ //}
+ break;
+ case "socket_port":
+ if ($value > 0 && $value <= 65535)
+ {
+ $this->$name = $value;
+ }
+ break;
+ case "socket_read_len":
+ if ($value > 0 && $value <= 8192)
+ {
+ $this->$name = $value;
+ }
+ break;
+ case "socket_read_type":
+ if ($value == 2 /*PHP_BINARY_READ*/ || $value == 1 /*PHP_NORMAL_READ*/)
+ {
+ $this->$name = $value;
+ }
+ break;
+ case "socket_timeout":
+ if ($value >= 0)
+ {
+ $this->$name = $value;
+ }
+ break;
+ }
+ }
+
+ function __get($name)
+ {
+ switch ($name)
+ {
+ case "socket_domain":
+ case "socket_type":
+ case "socket_protocol":
+ case "socket_address":
+ case "socket_port":
+ case "socket_read_len":
+ case "socket_read_type":
+ case "socket_timeout":
+ case "socket_error":
+ case "socket_errno":
+ return $this->$name;
+ break;
+ default:
+ return NULL;
+ break;
+ }
+ }
+
+ function set_vars_from_array($vars_arr)
+ {
+ foreach ($vars_arr as $key => $value)
+ {
+ $this->__set($key, $value);
+ }
+ }
+
+ function get_vars_to_array()
+ {
+ $vars_arr = array(
+ 'socket_domain' => $this->socket_domain,
+ 'socket_type' => $this->socket_type,
+ 'socket_protocol' => $this->socket_protocol,
+ 'socket_address' => $this->socket_address,
+ 'socket_port' => $this->socket_port,
+ 'socket_read_len' => $this->socket_read_len,
+ 'socket_read_type' => $this->socket_read_type,
+ 'socket_timeout' => $this->socket_timeout,
+ 'socket_error' => $this->socket_error,
+ 'socket_errno' => $this->socket_errno,
+ );
+ return $vars_arr;
+ }
+
+ // NOTE: this function may report PHP WARNING
+ function tcp_connect($address, $port, $ctimeout = NULL)
+ {
+ $fp = fsockopen($address, $port, $error, $errstr, $ctimeout);
+ if(!$fp) {
+ return false;
+ }
+
+ /*if(!stream_set_blocking($fp, 0)) {
+ fclose($fp);
+ return false;
+ }*/
+ return $fp;
+ }
+
+ public function connect($timeout)
+ {
+ $this->connect_timeout = $timeout;
+ $this->socket=$this->tcp_connect($this->socket_address, $this->socket_port, $timeout);
+ if(is_resource($this->socket))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ function close()
+ {
+ if ($this->socket !== false || $this->socket !== NULL)
+ {
+ if(is_resource($this->socket))
+ {
+ fclose($this->socket);
+ }
+ $this->socket = NULL;
+ }
+ }
+
+ function write($buffer)
+ {
+ $orignbuf = $buffer;
+ $ret = false;
+ while (true)
+ {
+ $ret = @fwrite($this->socket, $buffer, strlen($buffer));
+ if ($ret == false)
+ {
+ fclose($this->socket);
+ $this->socket = NULL;
+ break;
+ //return false;
+
+ }
+
+ if ($ret == strlen($buffer))
+ break;
+
+ $buffer = substr($buffer, $ret);
+ }
+ if ($ret == false)//ʧ
+ {
+ $ret = $this->connect($this->connect_timeout);
+ if ($ret ===false)//ʧ
+ {
+ return $ret;
+ }
+ $this->socket = $ret;
+ }
+ else//ͳɹ
+ {
+ return $ret;
+ }
+
+ $ret = false;
+ $buffer = $orignbuf;
+ while (true)
+ {
+ $ret = @fwrite($this->socket, $buffer, strlen($buffer));
+ if ($ret == false)
+ {
+ fclose($this->socket);
+ $this->socket = NULL;
+ return false;
+
+ }
+
+ if ($ret == strlen($buffer))
+ break;
+
+ $buffer = substr($buffer, $ret);
+ }
+
+ return true;
+ }
+
+ function read($len)
+ {
+ $buffer = "";
+ while ((@ $temp = fread($this->socket, $len)) !== false)
+ {
+ if( strlen($temp) == 0 )
+ {
+ //print("read error\n");
+ return false;
+ }
+ $buffer .= $temp;
+ $len -= strlen($temp);
+ if ($len === 0)
+ break;
+ }
+ if ($temp === false)
+ {
+ fclose($this->socket);
+ $this->socket = NULL;
+ return false;
+ }
+ return $buffer;
+ }
+ }
diff --git a/ptcms/library/bae/zcache/zcache_util.php b/ptcms/library/bae/zcache/zcache_util.php
new file mode 100644
index 0000000..8e7ad65
--- /dev/null
+++ b/ptcms/library/bae/zcache/zcache_util.php
@@ -0,0 +1,95 @@
+ 0,
+ 'version' => 0,
+ 'log_id' => zcache_build_logid(),
+ 'provider' => str_pad("", 16, "\0", STR_PAD_BOTH),
+ 'magic_num' => 0xfb709394,
+ 'reserved' => 0,
+ 'body_len' => 0
+ );
+ foreach ($vars_arr as $key => $value)
+ {
+ if (isset($nshead_arr[$key]))
+ {
+ $nshead_arr[$key] = $value;
+ }
+ }
+ $nshead = "";
+ $nshead = pack("L*", (($nshead_arr['version'] << 16) + ($nshead_arr['id'])), $nshead_arr['log_id']);
+ $nshead .= $nshead_arr['provider'];
+ $nshead .= pack("L*", $nshead_arr['magic_num'], $nshead_arr['reserved']);
+ $nshead .= pack("L", $nshead_arr['body_len']);
+ return $nshead;
+ }
+
+ /**
+ * nsheadbuf뷵bufֶ
+ * typedef struct _nshead_t
+ * {
+ * unsigned short id;
+ * unsigned short version;
+ * unsigned int log_id;
+ * char provider[16];
+ * unsigned int magic_num;
+ * unsigned int reserved;
+ * unsigned int body_len;
+ * } nshead_t;
+ */
+ function zcache_split_nshead($buf)
+ {
+ #echo "split nshead";
+ $ret_arr = array(
+ 'id' => 0,
+ 'version' => 0,
+ 'log_id' => 0,
+ 'provider' => "",
+ 'magic_num' => 0,
+ 'reserved' => 0,
+ 'body_len' => 0,
+ 'buf' => ""
+ );
+ $ret = unpack("v1id/v1version/I1log_id", substr($buf, 0, 8));
+ foreach ($ret as $key => $value)
+ {
+ $ret_arr[$key] = $value;
+ }
+ $ret_arr['provider'] = substr($buf, 8, 16);
+ $ret = unpack("I1magic_num/I1reserverd/I1body_len", substr($buf, 24, 12));
+ foreach ($ret as $key => $value)
+ {
+ $ret_arr[$key] = $value;
+ }
+ $ret_arr['buf'] = substr($buf, 36, $ret_arr['body_len']);
+ return $ret_arr;
+ }
+
+
+
diff --git a/ptcms/library/collect.php b/ptcms/library/collect.php
index d0308d7..95823b6 100644
--- a/ptcms/library/collect.php
+++ b/ptcms/library/collect.php
@@ -2,6 +2,33 @@
class collect {
+ public static function getcontent($data) {
+ if(is_string($data)) $data=array('rule'=>$data,'charset'=>'auto');
+ $content=http::get($data['rule']);
+ if ($content){
+ // 处理编码
+ if (!in_array($data['charset'], array('auto', 'utf-8', 'gbk'))) {
+ $data['charset'] = 'auto';
+ }
+ if ($data['charset'] == 'auto') {
+ if (!mb_check_encoding($content,'UTF-8')) {
+ $content = mb_convert_encoding ($content,'UTF-8','GBK' );
+ }
+ } elseif ($data['charset'] == 'gbk') {
+ $content = mb_convert_encoding ($content,'UTF-8','GBK' );
+ }
+ //错误标识
+ if (!empty($data['error']) && strpos($content,$data['error'])!==false){
+ return '';
+ }
+ if (!empty($data['replace'])) {
+ $content=collect::replace($content, $data['replace']);
+ }
+ return $content;
+ }
+ return '';
+ }
+
/**
* 根据正则批量获取
*
@@ -12,7 +39,7 @@ class collect {
*/
public static function getMatchAll($pregArr, $code, $needposition = 0) {
if (is_string($pregArr)) {
- $pregArr = array('rule' => $pregArr);
+ $pregArr = array('rule' => self::parseMatchRule($pregArr));
} elseif (empty($pregArr['rule'])) {
return array();
}
@@ -51,7 +78,11 @@ public static function getMatchAll($pregArr, $code, $needposition = 0) {
}
}
}
- $matchvar = $match['1'];
+ if (isset($match['1'])){
+ $matchvar = $match['1'];
+ }else{
+ return false;
+ }
}
if (!empty($pregArr['replace'])) {
foreach ($matchvar as $k => $v) {
@@ -72,7 +103,7 @@ public static function getMatchAll($pregArr, $code, $needposition = 0) {
*/
public static function getMatch($pregArr, $code) {
if (is_string($pregArr)) {
- $pregArr = array('rule' => $pregArr);
+ $pregArr = array('rule' => self::parseMatchRule($pregArr));
} elseif (empty($pregArr['rule'])) {
return '';
}
@@ -111,7 +142,7 @@ public static function replace($con, array $arr) {
$replace = isset($tmp['1']) ? $tmp['1'] : '';
$v['option'] = isset($v['option']) ? $v['option'] : '';
if ($v['method'] == 1) { //正则
- $con = preg_replace("{{$rule}}{$v['option']}", $replace, $con);
+ $con = preg_replace("{".$rule."}{$v['option']}", $replace, $con);
} else {
if (strpos($v['option'], 'i') === false) {
$con = str_replace($rule, $replace, $con);
@@ -132,17 +163,21 @@ public static function replace($con, array $arr) {
* @return string
*/
public static function parseUrl($url, $path) {
- if (strpos($url, '://') === false) {
- if (substr($url, 0, 1) == '/') {
- $tmp = parse_url($path);
- $url = $tmp['scheme'] . '://' . $tmp['host'] . $url;
- } elseif (substr($path, -1) == '/') {
- $url = $path . $url;
- } else {
- $url = dirname($path) . '/' . $url;
+ if ($url){
+ if (strpos($url, '://') === false) {
+ if (substr($url, 0, 1) == '/') {
+ $tmp = parse_url($path);
+ $url = $tmp['scheme'] . '://' . $tmp['host'] . $url;
+ } elseif (substr($path, -1) == '/') {
+ $url = $path . $url;
+ } else {
+ $url = dirname($path) . '/' . $url;
+ }
}
+ return $url;
+ }else{
+ return '';
}
- return $url;
}
/**
@@ -176,4 +211,20 @@ public static function cut($strings, $argl, $argr, $lt = false, $gt = false) {
}
return ($args);
}
+
+ public static function parseMatchRule($rules) {
+ $replace_pairs=array(
+ '{'=>'\{',
+ '}'=>'\}',
+ '[内容]'=>'(.*?)',
+ '[数字]'=>'\d*',
+ '[空白]'=>'\s*',
+ '[任意]'=>'.*?',
+ '[参数]'=>'[^\>\<]*?',
+ '[属性]'=>'[^\>\<\'"]*?',
+ );
+ return strtr($rules,$replace_pairs);
+ }
+
+
}
\ No newline at end of file
diff --git a/ptcms/library/dc.php b/ptcms/library/dc.php
deleted file mode 100644
index 6e1d130..0000000
--- a/ptcms/library/dc.php
+++ /dev/null
@@ -1,103 +0,0 @@
-data($data)->where(array($model->getPk() => $id))->save()) {
- return self::refresh($type, $id);
- } else {
- return false;
- }
- }
-
- //删除信息
- static public function delete($type, $id) {
- Cache::rm($type . '.' . $id);
- unset(self::$_data[$type][$id]);
- return true;
- }
-
- //更新信息
- static public function refresh($type, $id) {
- $model = M($type);
- self::$_data[$type][$id] = $model->find($id);
- if (self::$_data[$type][$id]) {
- //其他处理 如小说的链接
- if (method_exists($model, 'dataAppend')) {
- self::$_data[$type][$id] = $model->dataAppend(self::$_data[$type][$id]);
- }
- }
- // 写入缓存
- Cache::set($type . '.' . $id, self::$_data[$type][$id],C('cache_time',null,900));
- return self::$_data[$type][$id];
- }
-
- // 获取数据
- static public function get($type, $id, $field = '') {
- if ($id == 0) return null;
- if (!isset(self::$_data[$type][$id])) {
- // 检索memCache,不存在则读取数据库
- self::$_data[$type][$id] = Cache::get($type . '.' . $id);
- if (self::$_data[$type][$id] === null) {
- $model = M($type);
- self::$_data[$type][$id] = $model->find($id);
- if (self::$_data[$type][$id]) {
- //其他处理 如小说的链接
- if (method_exists($model, 'dataAppend')) {
- self::$_data[$type][$id] = $model->dataAppend(self::$_data[$type][$id]);
- }
- }
- Cache::set($type . '.' . $id, self::$_data[$type][$id],C('cache_time',null,900));
- }
- }
- if ($field !== '') {
- if(strpos($field,',')){
- //多字段获取 如"novelid,novelname"
- return array_intersect_key(self::$_data[$type][$id],array_flip(explode(',',$field)));
- }else{
- //单字段
- if (isset(self::$_data[$type][$id][$field])) {
- return self::$_data[$type][$id][$field];
- } else {
- return null;
- }
- }
- }
- return self::$_data[$type][$id];
- }
-}
\ No newline at end of file
diff --git a/ptcms/library/html.php b/ptcms/library/html.php
index 38d2f80..4fdace4 100644
--- a/ptcms/library/html.php
+++ b/ptcms/library/html.php
@@ -6,7 +6,7 @@ class html {
public static function create($url, $content) {
$file = self::parseUrl($url);
if ($file) {
- return F($file, str_replace(C('gen_html_replace'), '', $content));
+ return F($file, str_replace(PT_Base::getInstance()->config->get('gen_html_replace'), '', $content));
} else {
return false;
}
@@ -29,16 +29,21 @@ public static function read($url) {
// 地址解析
public static function parseUrl($url) {
- if (!C('html') || strpos($url, '?') || strpos($url, '#') || strpos($url, '&') || strpos($url, '=')) return false;
+ if (!PT_Base::getInstance()->config->get('html') || strpos($url, '?') || strpos($url, '#') || strpos($url, '&') || strpos($url, '=')) return false;
$path = parse_url($url, PHP_URL_PATH);
if (strpos(basename($path), '.') === false) {
- $path = trim($path, '/') . '/' . C('HTML_DEFAULTFILE', null, 'index.html');
+ $path = trim($path, '/') . '/' . PT_Base::getInstance()->config->get('HTML_DEFAULTFILE', 'index.html');
} else {
$path = trim($path, '/');
}
- if (PT_DIR && substr($path, 0, strlen(PT_DIR)) == PT_DIR) {
- $path = trim(substr($path, strlen(PT_DIR)), '/');
+ $dir = trim(PT_DIR, '/');
+ if ($dir && substr($path, 0, strlen($dir)) == $dir) {
+ $path = trim(substr($path, strlen($dir)), '/');
}
return PT_ROOT . '/' . $path;
}
+
+ public static function trigger($url) {
+ http::trigger($url);
+ }
}
\ No newline at end of file
diff --git a/ptcms/library/http.php b/ptcms/library/http.php
index fa07715..299e336 100644
--- a/ptcms/library/http.php
+++ b/ptcms/library/http.php
@@ -2,22 +2,26 @@
class http {
- public static function curl($url, $params = array(), $method = 'GET', $header = array()) {
+ public static function curl($url, $params = array(), $method = 'GET', $header = array(), $option = array()) {
$opts = array(
- CURLOPT_TIMEOUT => C('timeout', null, 10),
- CURLOPT_CONNECTTIMEOUT => C('timeout', null, 10),
+ CURLOPT_TIMEOUT => PT_Base::getInstance()->config->get('timeout', 10),
+ CURLOPT_CONNECTTIMEOUT => PT_Base::getInstance()->config->get('timeout', 10),
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FOLLOWLOCATION => 1,
- CURLOPT_HEADER => false,
- CURLOPT_USERAGENT => C('user_agent', null, 'PTSingleNovel'),
- CURLOPT_REFERER => $url,
- CURLOPT_NOSIGNAL => 1,
- CURLOPT_ENCODING => 'gzip, deflate',
- CURLOPT_HTTPHEADER => $header,
+ CURLOPT_HEADER => false,
+ CURLOPT_USERAGENT => PT_Base::getInstance()->config->get('user_agent', 'PTCMS Spider'),
+ CURLOPT_REFERER => $url,
+ CURLOPT_NOSIGNAL => 1,
+ CURLOPT_ENCODING => 'gzip, deflate',
+ CURLOPT_HTTPHEADER => $header,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
);
-
+ //补充配置
+ foreach ($option as $k => $v) {
+ $opts[$k] = $v;
+ }
+ //安全模式
if (ini_get("safe_mode") || ini_get('open_basedir')) {
unset($opts[CURLOPT_FOLLOWLOCATION]);
}
@@ -28,8 +32,8 @@ public static function curl($url, $params = array(), $method = 'GET', $header =
break;
case 'POST':
//判断是否传输文件
- $opts[CURLOPT_URL] = $url;
- $opts[CURLOPT_POST] = 1;
+ $opts[CURLOPT_URL] = $url;
+ $opts[CURLOPT_POST] = 1;
$opts[CURLOPT_POSTFIELDS] = $params;
break;
default:
@@ -42,52 +46,58 @@ public static function curl($url, $params = array(), $method = 'GET', $header =
$data = curl_exec($ch);
//todo safe_mode模式下需要处理的location
$error = curl_error($ch);
+ $errno = curl_errno($ch);
curl_close($ch);
- if ($error) return false;
+ if ($error && $errno !== 28) {
+ PT_Log::record('Curl获取远程内容错误!原因:' . $error . ' 地址:' . $url);
+ return false;
+ }
return $data;
}
- public static function filegc($url, $params = array(), $method = 'GET') {
- $header = array("Referer: $url", "User-Agent: " . C('user_agent', null, 'PTSingleNovel'));
+ public static function filegc($url, $params = array(), $method = 'GET', $header = array(), $option = array()) {
+ $header = array_merge(array("Referer: $url", "User-Agent: " . PT_Base::getInstance()->config->get('user_agent', 'PTCMS Spider', "Accept-Encoding: gzip,deflate")), $header);
$context = array(
'http' => array(
- 'method' => $method,
- 'header' => implode("\r\n", $header),
- 'timeout' => C('timeout', null, 10),
+ 'method' => $method,
+ 'header' => implode("\r\n", $header),
+ 'timeout' => PT_Base::getInstance()->config->get('timeout', 10),
)
);
+ if ($option) $context['http'] = array_merge($context['http'], $option);
if ($method == 'POST') {
if (is_array($params)) $params = http_build_query($params);
- $content_length = strlen($params);
- $header[] = "Content-type: application/x-www-form-urlencoded";
- $header[] = "Content-length: $content_length";
- $context['http']['header'] = implode("\r\n", $header);
+ $content_length = strlen($params);
+ $header[] = "Content-type: application/x-www-form-urlencoded";
+ $header[] = "Content-length: $content_length";
+ $context['http']['header'] = implode("\r\n", $header);
$context['http']['content'] = $params;
}
$stream_context = stream_context_create($context);
- $data = file_get_contents($url, false, $stream_context);
- return $data;
+ $data = @file_get_contents($url, false, $stream_context);
+ return self::gzdecode($data);
}
- public static function fsock($url, $params, $method = 'GET') {
+ public static function fsock($url, $params = array(), $method = 'GET') {
$urlinfo = parse_url($url);
- $port = isset($urlinfo["port"]) ? $urlinfo["port"] : 80;
- $path = $urlinfo['path'] . (!empty($urlinfo['query']) ? '?' . $urlinfo['query'] : '') . (!empty($urlinfo['fragment']) ? '#' . $urlinfo['fragment'] : '');
+ $port = isset($urlinfo["port"]) ? $urlinfo["port"] : 80;
+ $path = $urlinfo['path'] . (!empty($urlinfo['query']) ? '?' . $urlinfo['query'] : '') . (!empty($urlinfo['fragment']) ? '#' . $urlinfo['fragment'] : '');
$in = "{$method} {$path} HTTP/1.1\r\n";
$in .= "Host: {$urlinfo['host']}\r\n";
$in .= "Content-Type: application/octet-stream\r\n";
$in .= "Connection: Close\r\n";
$in .= "Hostname: {$urlinfo['host']}\r\n";
- $in .= "User-Agent: " . C('user_agent', null, 'PTSingleNovel') . "\r\n";
+ $in .= "User-Agent: " . PT_Base::getInstance()->config->get('user_agent', 'PTCMS Spider') . "\r\n";
$in .= "Referer: {$url}\r\n";
+ $in .= "Accept-Encoding: gzip,deflate\r\n";
if ($method == 'POST') {
$params = is_array($params) ? http_build_query($params) : $params;
$in .= "Content-Length: " . strlen($params) . "\r\n\r\n";
}
$address = gethostbyname($urlinfo['host']);
- $fp = fsockopen($address, $port, $err, $errstr, C('timeout', null, 10));
+ $fp = fsockopen($address, $port, $err, $errstr, PT_Base::getInstance()->config->get('timeout', 10));
if (!$fp) {
exit ("cannot conncect to {$address} at port {$port} '{$errstr}'");
}
@@ -103,7 +113,7 @@ public static function fsock($url, $params, $method = 'GET') {
}
public static function get($url, $data = array()) {
- $func = C('httpmethod', null, 'curl');
+ $func = PT_Base::getInstance()->config->get('httpmethod', 'curl');
if (is_array($data)) {
$data = http_build_query($data);
}
@@ -115,17 +125,27 @@ public static function get($url, $data = array()) {
}
$data = array();
}
- $t = microtime(true);
- $res = self::$func($url, $data, 'GET');
- $GLOBALS['_api'][] = $func . ' GET ' . number_format(microtime(true) - $t, 5) . ' ' . $url;
+ if (APP_DEBUG || isset($_GET['debug'])) {
+ $t = microtime(true);
+ $res = self::$func($url, $data, 'GET');
+ $GLOBALS['_api'][] = $func . ' GET ' . number_format(microtime(true) - $t, 5) . ' ' . strlen($res) . ' ' . $url;
+ } else {
+ $res = self::$func($url, $data, 'GET');
+ }
+ $GLOBALS['_apinum']++;
return $res;
}
- public static function post($url, $data = array()) {
- $func = C('httpmethod', null, 'curl');
- $t = microtime(true);
- $res = self::$func($url, $data, 'POST');
- $GLOBALS['_api'][] = $func . ' POST ' . number_format(microtime(true) - $t, 5) . ' ' . $url . json_encode($data, 256);
+ public static function post($url, $data = array(), $header = array()) {
+ $func = PT_Base::getInstance()->config->get('httpmethod', 'curl');
+ if (APP_DEBUG || isset($_GET['debug'])) {
+ $t = microtime(true);
+ $res = self::$func($url, $data, 'POST');
+ $GLOBALS['_api'][] = $func . ' POST ' . number_format(microtime(true) - $t, 5) . ' ' . strlen($res) . ' ' . $url . json_encode($data, 256);
+ } else {
+ $res = self::$func($url, $data, 'POST', $header);
+ }
+ $GLOBALS['_apinum']++;
return $res;
}
@@ -142,4 +162,43 @@ public static function getMethod() {
}
return $method;
}
+
+ //触发G
+ public static function trigger($url) {
+ if (stripos($url, 'http') === 0) {
+ $func = PT_Base::getInstance()->config->get('httpmethod', 'curl');
+ if ($func == 'curl') {
+ http::curl($url, array(), 'GET', array(), array(
+ CURLOPT_TIMEOUT_MS => 20,
+ CURLOPT_CONNECTTIMEOUT_MS => 20,
+ ));
+ } else {
+ http::filegc($url, array(), 'GET', array(), array(
+ 'timeout' => 0,
+ ));
+ }
+ }
+ return;
+ }
+
+ // Gzip解压函数
+ public static function gzdecode($data) {
+ if (strlen($data) < 18) return $data;
+ $res = unpack('vfile_type', substr($data, 0, 2));
+ if ($res['file_type'] <> 35615) return $data;
+ if (function_exists('gzdecode') && $unpacked = gzdecode($data)) return $unpacked;
+ $flags = ord(substr($data, 3, 1));
+ $headerlen = 10;
+ if ($flags & 4) {
+ $extralen = unpack('v', substr($data, 10, 2));
+ $extralen = $extralen[1];
+ $headerlen += $extralen + 2;
+ }
+ if ($flags & 8) $headerlen = strpos($data, chr(0), $headerlen) + 1;
+ if ($flags & 16) $headerlen = strpos($data, chr(0), $headerlen) + 1;
+ if ($flags & 2) $headerlen += 2;
+ $unpacked = gzinflate(substr($data, $headerlen));
+ if ($unpacked === false) return $data;
+ return $unpacked;
+ }
}
\ No newline at end of file
diff --git a/ptcms/library/image.php b/ptcms/library/image.php
index 2203281..c06d81a 100644
--- a/ptcms/library/image.php
+++ b/ptcms/library/image.php
@@ -286,9 +286,10 @@ public function water($source, $posotion = image::IMAGE_WATER_SOUTHEAST, $alpha
*/
public function text($text, $font, $size = 20, $color = '#ff0000', $locate = Image::IMAGE_WATER_SOUTHEAST, $margin = '', $offset = 0, $angle = 0) {
//资源检测
- if (!is_file($font)) return false;
+ //if (!is_file($font)) return false;
if ($margin === '') $margin = ceil($size / 2);
//获取文字信息
+
$info = imagettfbbox($size, $angle, $font, $text);
$minx = min($info[0], $info[2], $info[4], $info[6]);
$maxx = max($info[0], $info[2], $info[4], $info[6]);
diff --git a/ptcms/library/oauth.php b/ptcms/library/oauth.php
index 8e2d9d7..9e95a77 100644
--- a/ptcms/library/oauth.php
+++ b/ptcms/library/oauth.php
@@ -108,8 +108,8 @@ public function __construct(array $config, $token = null) {
*/
public static function getInstance($type, $token = null) {
if (empty(self::$_instance[$type])) {
- $config['appid'] = C("oauth_{$type}_appid");
- $config['appsecret'] = C("oauth_{$type}_appsecret");
+ $config['appid'] = PT_Base::getInstance()->config->get("oauth_{$type}_appid");
+ $config['appsecret'] = PT_Base::getInstance()->config->get("oauth_{$type}_appsecret");
$classname = 'Driver_Oauth_' . $type;
self::$_instance[$type] = new $classname($config, $token);
}
diff --git a/ptcms/library/pinyin.php b/ptcms/library/pinyin.php
index b77d908..038aeab 100644
--- a/ptcms/library/pinyin.php
+++ b/ptcms/library/pinyin.php
@@ -7,9 +7,9 @@
*/
class pinyin {
- static $data = null;
+ protected static $data = null;
- public static function getdata() {
+ protected static function getdata() {
if (self::$data === null) {
$fp = fopen(dirname(__FILE__) . '/data/pinyin.dat', 'r') or exit('读取字典失败');
while (!feof($fp)) {
@@ -29,7 +29,7 @@ public static function getdata() {
* @param string $default 匹配不到默认显示字符
* @return string
*/
- public static function change($str, $isfirst = false, $default = '-') {
+ public static function change($str, $isfirst = false, $default = '0') {
$str = iconv('UTF-8', 'GBK//ignore', $str);
$data = self::getdata();
$restr = '';
diff --git a/ptcms/library/steal.php b/ptcms/library/steal.php
deleted file mode 100644
index 55ed5c0..0000000
--- a/ptcms/library/steal.php
+++ /dev/null
@@ -1,182 +0,0 @@
- $v) {
- if ($v == '') {
- for ($i = 2; $i < $count; $i++) {
- if (!empty($match[$i][$k])) {
- $match['1'][$k] = $match[$i][$k];
- break;
- }
- }
- }
- }
- }
- $matchvar = $match['1'];
- }
- if (!empty($pregArr['replace'])) {
- foreach ($matchvar as $k => $v) {
- $matchvar[$k] = self::replace($v, $pregArr['replace']);
- }
- }
- return $matchvar;
- }
- return false;
- }
-
- /**
- * 根据正则获取指定数据 单个
- *
- * @param string $pregArr 正则
- * @param string $code 源内容
- * @return bool|string
- */
- public static function getMatch($pregArr, $code)
- {
- try {
- if (empty($pregArr['rule'])) {
- return '';
- }
- $pregstr = '{' . $pregArr['rule'] . '}';
- if (!empty($pregArr['option'])) {
- $pregstr .= $pregArr['option'];
- }
- preg_match($pregstr, $code, $match);
- if (isset($match['1'])) {
- if (empty($pregArr['replace'])) {
- return $match['1'];
- } else {
- return self::replace($match[1], $pregArr['replace']);
- }
- }
- return false;
- } catch (Exception $e) {
- halt($e->getMessage());
- return '';
- }
- }
-
- /**
- * 内容替换 支持正则批量替换
- *
- * @param string $con 代替换的内容
- * @param array $arr 替换规则数组 单个元素如下
- * array(
- * 'rule'=>'规则1',//♂后面表示要替换的 内容
- * 'option'=>'参数',
- * 'method'=>1,//1 正则 0普通
- * ),
- * @return mixed
- */
- public static function replace($con, array $arr)
- {
- foreach ($arr as $v) {
- if (!empty($v['rule'])) {
- $tmp = explode('♂', $v['rule']);
- $rule = $tmp['0'];
- $replace = isset($tmp['1']) ? $tmp['1'] : '';
- $v['option'] = isset($v['option']) ? $v['option'] : '';
- if ($v['method'] == 1) { //正则
- $con = preg_replace("{{$rule}}{$v['option']}", $replace, $con);
- } else {
- if (strpos($v['option'], 'i') === false) {
- $con = str_replace($rule, $replace, $con);
- } else {
- $con = str_ireplace($rule, $replace, $con);
- }
- }
- }
- }
- return $con;
- }
-
- /**
- * 处理链接,根据当前页面地址得到完整的链接地址
- *
- * @param string $url 当前链接
- * @param string $path 当前页面地址
- * @return string
- */
- public static function parseUrl($url, $path)
- {
- if (strpos($url, '://') === false) {
- if (substr($url, 0, 1) == '/') {
- $tmp = parse_url($path);
- $url = $tmp['scheme'] . '://' . $tmp['host'] . $url;
- } elseif (substr($path, -1) == '/') {
- $url = $path . $url;
- } else {
- $url = dirname($path) . '/' . $url;
- }
- }
- return $url;
- }
-
- //内容切割
- public static function cut($argl, $argr, $lt, $gt, $strings)
- {
- if (!$strings) return ("");
- if (strpos($argl, ".+?")) {
- $argl = strtr($argl, array("/" => "\/"));
- if (@preg_match("/" . $argl . "/", $strings, $match)) $argl = $match[0];
- }
- if (strpos($argr, ".+?")) {
- $argr = strtr($argr, array("/" => "\/"));
- if (@preg_match("/" . $argr . "/", $strings, $match)) $argr = $match[0];
- }
- $args = @explode($argl, $strings);
- $args = @explode($argr, $args[1]);
- $args = $args[0];
- if ($args) {
- if ($lt) $args = $argl . $args;
- if ($gt) $args .= $argr;
- } else {
- $args = "";
- }
- return ($args);
- }
-}
\ No newline at end of file
diff --git a/ptcms/library/upload.php b/ptcms/library/upload.php
index 5dc68d3..b45638d 100644
--- a/ptcms/library/upload.php
+++ b/ptcms/library/upload.php
@@ -16,7 +16,7 @@ class upload {
//自定义文件存放完整路径
public $filePath;
//自定义允许文件后缀
- public $allowType = "jpg|png|gif|txt|bmp|doc|xls|jpeg|zip|rar";
+ public $allowType = "jpg|png|gif|txt|bmp|ico|doc|xls|jpeg|zip|rar";
//自定义允许文件mime
public $allowMime = array();
//自定义文件大小 Kb
@@ -131,7 +131,7 @@ public function uploadone() {
// 上传操作
if ($this->save(F($this->fileinfo['tmp_name']))) {
$info['ext'] = $this->get_type();
- $info['fileurl'] = Storage::geturl($this->filePath);
+ $info['fileurl'] = PT_Base::getInstance()->storage->geturl($this->filePath);
$info['filepath'] = $this->filePath;
$info['filename'] = $this->fileinfo['name'];
$info['hash'] = md5_file($this->fileinfo['tmp_name']);
@@ -151,7 +151,7 @@ protected function save($content) {
$content = $img->save();
}
}
- return storage::write($this->filePath, $content);
+ return PT_Base::getInstance()->storage->write($this->filePath, $content);
}
protected function geterrorinfo($num) {
@@ -184,7 +184,7 @@ public function uploadurl($url, $content = '') {
$this->getpath();
if ($this->save($content)) {
$info['ext'] = $this->get_type();
- $info['fileurl'] = Storage::geturl($this->filePath);
+ $info['fileurl'] = PT_Base::getInstance()->storage->geturl($this->filePath);
$info['filepath'] = $this->filePath;
$info['filename'] = $this->fileinfo['name'];
$info['hash'] = md5($content);
diff --git a/ptcms/library/verify.php b/ptcms/library/verify.php
index c21b425..2bd33b8 100644
--- a/ptcms/library/verify.php
+++ b/ptcms/library/verify.php
@@ -70,7 +70,7 @@ static public function randString($len = 6, $type = '', $addChars = '') {
*/
static function buildImageVerify($length = 4, $mode = 1, $type = 'png', $width = 48, $height = 22, $verifyName = 'verify') {
$randval = self::randString($length, $mode);
- $_SESSION[$verifyName] = strtolower($randval);
+ PT_Base::getInstance()->session->set($verifyName, strtolower($randval));
$width = ($length * 10 + 10) > $width ? $length * 10 + 10 : $width;
if ($type != 'gif' && function_exists('imagecreatetruecolor')) {
$im = imagecreatetruecolor($width, $height);
diff --git a/ptcms/library/yarclient.php b/ptcms/library/yarclient.php
index 68ffd8b..b6c4a72 100644
--- a/ptcms/library/yarclient.php
+++ b/ptcms/library/yarclient.php
@@ -1,10 +1,6 @@
$name = self::$_class[$name];
}
- F($runtimefile, $str);
+ if ($name == 'pt') {
+ return $this->pt = self::getInstance();
+ }
+ if (is_file(PT_PATH . "/core/{$name}.php")) {
+ $classname = 'PT_' . $name;
+ if (!class_exists($classname, true)) pt::import(PT_PATH . "/core/{$name}.php");
+ return $this->$name = self::$_class[$name] = new $classname();
+ }
+ return null;
+ }
+
+ public function __get($name) {
+ return $this->$name=$this->getInstanceof($name);
+ }
+
+ /**
+ * @param $name
+ * @return object
+ */
+ public function model($name) {
+ $class=null;
+ if (isset(self::$_model[$name])) return self::$_model[$name];
+ $classname=$name.'Model';
+ if (class_exists($classname)){
+ return self::$_model[$name]=new $classname($name);
+ }
+ return $class;
+ }
+
+ /**
+ * @param $name
+ * @return Driver_Db_Dao
+ */
+ public function db($name='') {
+ return $this->getInstanceof('db')->getInstance($name);
+ }
+
+ /**
+ * @param $name
+ * @return PT_model
+ */
+ public function block($name) {
+ return $this->getInstanceof('block')->getInstance($name);
}
- include $runtimefile;
}
-pt::start();
-class pt {
+class pt extends PT_Base {
+
+ protected static $base;
/**
* 框架开始调用
*/
- public static function start() {
+ public function start() {
+ self::$base = PT_Base::getInstance();
//初始化加载
- self::init();
- plugin::call('app_init_start');
+ $this->init();
+ $this->plugin->call('app_init_start');
//加载站点配置文件
- C(self::import(APP_PATH . '/common/' . pt::getSiteCode() . '.config.php'));
+ $this->config->register(self::import(APP_PATH . '/common/' . $this->request->getSiteCode() . '.config.php'));
// 路由解析
- plugin::call('dispatcher_start');
+ $this->plugin->call('dispatcher_start');
self::dispatcher();
- plugin::call('dispatcher_end');
+ $this->plugin->call('dispatcher_end');
if (MODULE_NAME != 'common') {
// 加载模块文件
- C(self::import(APP_PATH . '/' . MODULE_NAME . '/config.php'));
+ $this->config->register(self::import(APP_PATH . '/' . MODULE_NAME . '/config.php'));
// 加载函数
self::import(APP_PATH . '/' . MODULE_NAME . '/function.php');
}
// 控制器调用
- self::app();
+ $this->app();
}
/**
* 注册autoload等操作
*/
- protected static function init() {
+ protected function init() {
// 设定错误和异常处理
register_shutdown_function(array(__CLASS__, 'shutdown'));
//set_error_handler(array(__CLASS__, 'error'));
@@ -177,32 +203,34 @@ function stripslashes_deep($value) {
return $value;
}
- $_POST = stripslashes_deep($_POST);
- $_GET = stripslashes_deep($_GET);
+ $_POST = stripslashes_deep($_POST);
+ $_GET = stripslashes_deep($_GET);
$_COOKIE = stripslashes_deep($_COOKIE);
}
}
// 注册插件
- Plugin::register(C('plugin', null, array()));
+ $this->plugin->register($this->config->get('plugin', array()));
}
- protected static function app() {
+ protected function app() {
//加载控制器启动的插件
- plugin::call('controller_start');
+ $this->plugin->call('controller_start');
+ //正常模式
+ $controllerFile = APP_PATH . '/' . MODULE_NAME . '/controller/' . CONTROLLER_NAME . '.php';
+ $classname = CONTROLLER_NAME . 'Controller';
+ $actionname = ACTION_NAME . 'Action';
if (MODULE_NAME == 'plugin') {
//插件控制器
$controllerFile = APP_PATH . '/common/plugin/' . CONTROLLER_NAME . '/manage.php';
- $classname = 'manageController';
- $actionname = ACTION_NAME . 'Action';
- } else {
- //正常模式
- $controllerFile = APP_PATH . '/' . MODULE_NAME . '/controller/' . CONTROLLER_NAME . '.php';
- $classname = CONTROLLER_NAME . 'Controller';
- $actionname = ACTION_NAME . 'Action';
+ $classname = 'manageController';
+ $actionname = ACTION_NAME . 'Action';
+ } elseif (!in_array(MODULE_NAME, explode(',', $this->config->get('allow_module', '')))) {
+ $this->response->error(MODULE_NAME . '模块不允许访问');
}
if (is_file($controllerFile)) {
include $controllerFile;
if (class_exists($classname, false)) {
+ /* @var $app PT_Controller */
$app = new $classname();
//加载init方法
if (method_exists($app, 'init')) {
@@ -211,17 +239,33 @@ protected static function app() {
// 加载action
if (method_exists($app, $actionname)) {
$app->$actionname();
+ if ($this->response->isAutoRender()) {
+ switch ($_GET['f']) {
+ case 'json':
+ $data = $app->view->get();
+ $this->response->jsonEncode($data);
+ break;
+ case 'jsonp':
+ $data = $app->view->get();
+ $this->response->jsonpEncode($data);
+ break;
+ case 'xml':
+ $data = $app->view->get();
+ $this->response->xmlEncode($data);
+ break;
+ default:
+ $app->display();
+ }
+ }
} else {
- $app->_empty("当前控制器下" . get_class($app) . "找不到指定的方法 {$_GET['a']}Action");
+ $this->response->error("当前控制器下" . get_class($app) . "找不到指定的方法 {$_GET['a']}Action");
}
- plugin::call('controller_end');
+ $this->plugin->call('controller_end');
} else {
- $app = new Controller();
- $app->_empty('控制器' . CONTROLLER_NAME . '对应的文件中未找到类' . $classname);
+ $this->response->error('控制器' . CONTROLLER_NAME . '对应的文件中未找到类' . $classname);
}
} else {
- $app = new Controller();
- $app->_empty(MODULE_NAME . '模块下控制器' . CONTROLLER_NAME . 'Controller对应的文件不存在');
+ $this->response->error(MODULE_NAME . '模块下控制器' . CONTROLLER_NAME . 'Controller对应的文件不存在');
}
}
@@ -239,7 +283,7 @@ public static function import($filename) {
protected static function dispatcher() {
- dispatcher::run();
+ self::$base->dispatcher->run();
// 获取分组 模块和操作名称
define('MODULE_NAME', strtolower($_GET['m']));
define('CONTROLLER_NAME', strtolower($_GET['c']));
@@ -257,9 +301,9 @@ protected static function dispatcher() {
// 自动加载
public static function autoload($class) {
$classfile = strtolower(str_replace('_', '/', $class));
- if (in_array($classfile, array('controller', 'view', 'dispatcher', 'cache', 'model', 'plugin', 'storage', 'block', 'log'))) {
- pt::import(PT_PATH . '/core/' . $classfile . '.php');
- } elseif (substr($classfile, 0, 6) == 'driver') {
+ //pt_开头的类指定目录到core
+ if (strpos($classfile, 'pt/') === 0) $classfile = str_replace('pt/', 'core/', $classfile);
+ if (is_file(PT_PATH . '/' . $classfile . '.php')) {
pt::import(PT_PATH . '/' . $classfile . '.php');
} elseif (substr($classfile, -10) == 'controller') {
if (!pt::import(APP_PATH . '/' . MODULE_NAME . '/controller/' . substr($classfile, 0, -10) . '.php')) {
@@ -268,26 +312,44 @@ public static function autoload($class) {
} elseif (substr($classfile, -5) == 'model') {
//适配ptcms_a_b这样的表
$classfile = substr(str_replace('/', '_', $classfile), 0, -5);
- if (MODULE_NAME == 'plugin') {
- $file = APP_PATH . '/common/plugin/' . MODULE_NAME . '/model/' . $classfile . '.php';
- } else {
- $file = APP_PATH . '/' . MODULE_NAME . '/model/' . $classfile . '.php';
- }
- if (!pt::import($file)) {
- pt::import(APP_PATH . '/common/model/' . $classfile . '.php');
+ if (isset($GLOBALS['_automap']['model'][$classfile])) {
+ //存在这个model
+ if (isset($GLOBALS['_automap']['model'][$classfile][MODULE_NAME])) {
+ $file = $GLOBALS['_automap']['model'][$classfile][MODULE_NAME];
+ } elseif (isset($GLOBALS['_automap']['model'][$classfile]['common'])) {
+ $file = $GLOBALS['_automap']['model'][$classfile]['common'];
+ } else {
+ $file = current(array_slice($GLOBALS['_automap']['model'][$classfile], 0, 1));
+ }
+ pt::import($file);
}
} elseif (substr($classfile, -5) == 'block') {
- if (!pt::import(APP_PATH . '/' . MODULE_NAME . '/block/' . substr($classfile, 0, -5) . '.php')) {
- pt::import(APP_PATH . '/common/block/' . substr($classfile, 0, -5) . '.php');
+ $classfile = substr($classfile, 0, -5);
+ if (isset($GLOBALS['_automap']['block'][$classfile])) {
+ //存在这个block
+ if (isset($GLOBALS['_automap']['block'][$classfile][MODULE_NAME])) {
+ $file = $GLOBALS['_automap']['block'][$classfile][MODULE_NAME];
+ } elseif (isset($GLOBALS['_automap']['block'][$classfile]['common'])) {
+ $file = $GLOBALS['_automap']['block'][$classfile]['common'];
+ } else {
+ $file = current(array_slice($GLOBALS['_automap']['block'][$classfile], 0, 1));
+ }
+ pt::import($file);
}
} elseif (substr($classfile, -6) == 'plugin') {
$classname = substr($classfile, 0, -6);
pt::import(APP_PATH . '/common/plugin/' . $classname . '/' . $classname . '.php');
} else {
- (pt::import(PT_PATH . '/library/' . $classfile . '.php')) or
- (pt::import(APP_PATH . '/common/library/' . $classfile . '.php')) or
- (pt::import(APP_PATH . '/' . MODULE_NAME . '/library/' . $classfile . '.php')) or
- (pt::import(APP_PATH . '/common/plugin/' . MODULE_NAME . '/library/' . $classfile . '.php'));
+ if (!pt::import(PT_PATH . '/library/' . $classfile . '.php') && isset($GLOBALS['_automap']['library'][$classfile])) {
+ if (isset($GLOBALS['_automap']['library'][$classfile][MODULE_NAME])) {
+ $file = $GLOBALS['_automap']['library'][$classfile][MODULE_NAME];
+ } elseif (isset($GLOBALS['_automap']['library'][$classfile]['common'])) {
+ $file = $GLOBALS['_automap']['library'][$classfile]['common'];
+ } else {
+ $file = current(array_slice($GLOBALS['_automap']['library'][$classfile], 0, 1));
+ }
+ pt::import($file);
+ }
}
}
@@ -300,7 +362,7 @@ public static function shutdown() {
}
}
//如果开启日志 则记录日志
- if (C('log', null, false)) log::build();
+ if (self::$base->config->get('log', false)) self::$base->log->build();
// 如果自定义了close函数 则进行调用
if (function_exists('pt_close')) {
pt_close();
@@ -329,180 +391,8 @@ public static function error($errno, $errstr, $errfile, $errline) {
break;
}
}
-
- public static function err404($msg = '找不到指定的页面') {
- $file = PT_ROOT . C('404file', null, '/404.html');
- log::write($msg);
- if (is_file($file)) {
- $content = F($file);
- $content = str_replace(array('{$sitename}', '{$siteurl}', '{$msg}'), array(C('sitename'), C('siteurl'), $msg), $content);
- exit($content);
- } else {
- exit($msg . ' 页面出现错误,如需自定义此错误,请创建文件:' . $file);
- }
- }
-
- /**
- * 获取host
- **/
- public static function getSiteCode() {
- // 替换域名中的-为_
- $domain = str_replace('-', '_', $_SERVER['HTTP_HOST']);
- // 去掉端口
- if (strpos($domain, ':') !== false) $domain = substr($domain, 0, strpos($domain, ':'));
- // 去掉开始的www.
- if (stripos($domain, 'www.') === 0) $domain = substr($domain, 4);
- return $domain;
- }
-
- /**
- * 输出视图内容
- *
- * @access public
- * @param string $content 输出内容
- * @param string $mimeType MIME类型
- * @return void
- */
- public static function show($content = '', $mimeType = 'text/html') {
- if (C('gzip_encode', null, false)) {
- $zlib = ini_get('zlib.output_compression');
- if (empty($zlib)) ob_start('ob_gzhandler');
- }
- if (!headers_sent()) {
- //设置系统的输出字符为utf-8
- header("Content-Type: $mimeType; charset=utf-8");
- //支持页面回跳
- header("Cache-control: private");
- //长连接
- header("Connection:Keep-Alive");
- //版权标识
- header("X-Powered-By: PTcms Studio (www.ptcms.com)");
- }
- echo $content;
- }
-}
-
-
-/**
- * 获取和设置配置参数 支持批量定义
- *
- * @param string|array $name 配置变量
- * @param mixed $value 配置值
- * @param mixed $default 默认值
- * @return mixed
- */
-function C($name = null, $value = null, $default = null) {
- static $_config = array();
- // 无参数时获取所有
- if (empty($name)) {
- return $_config;
- }
- // 优先执行设置获取或赋值
- if (is_string($name)) {
- $name = strtolower($name);
- if (!strpos($name, '.')) {
- if (is_null($value))
- return $_config[$name] = isset($_config[$name]) ? $_config[$name] : $default;
- $_config[$name] = $value;
- return true;
- }
- // 二维数组设置和获取支持
- $name = explode('.', $name);
- if (is_null($value)) {
- $value = $_config;
- foreach ($name as $n) {
- if (isset($value[$n])) {
- $value = $value[$n];
- } else {
- $value = $default;
- break;
- }
- }
- return $value;
- }
- $_config[$name[0]][$name[1]] = $value;
- return true;
- }
- // 批量设置
- if (is_array($name)) {
- $_config = array_merge($_config, array_change_key_case($name));
- return true;
- }
- // 避免非法参数
- return null;
}
-/**
- * Cookie 设置、获取、删除
- *
- * @param string $name cookies名称
- * @param string $value cookie值
- * @param string $option cookie参数
- * @return mixed
- */
-function cookie($name, $value = '', $option = null) {
- static $_config = null;
- if (!$_config) {
- // 默认设置
- $_config = array(
- // cookie 名称前缀
- 'prefix' => C('cookie_prefix', null, 'PTCMS_'),
- // cookie 保存时间
- 'expire' => intval(C('cookie_expire', null, 2592000)),
- // cookie 保存路径
- 'path' => C('cookie_path', null, '/'),
- // cookie 有效域名
- 'domain' => C('cookie_domain'),
- );
- }
- // 参数设置(会覆盖黙认设置)
- if (!is_null($option)) {
- if (is_numeric($option))
- $option = array('expire' => $option);
- elseif (is_string($option))
- parse_str($option, $option);
- $config = array_merge($_config, array_change_key_case($option));
- } else {
- $config = $_config;
- }
- // 清除指定前缀的所有cookie
- if (is_null($name)) {
- if (empty($_COOKIE))
- return true;
- // 要删除的cookie前缀,不指定则删除config设置的指定前缀
- $prefix = empty($value) ? $config['prefix'] : $value;
- if (!empty($prefix)) {
- // 如果前缀为空字符串将不作处理直接返回
- foreach ($_COOKIE as $key => $val) {
- if (0 === stripos($key, $prefix)) {
- setcookie($key, '', time() - 3600, $config['path'], $config['domain']);
- unset($_COOKIE[$key]);
- }
- }
- }
- return true;
- }
- $name = $config['prefix'] . $name;
- if ('' === $value) {
- if (isset($_COOKIE[$name])) {
- return $_COOKIE[$name];
- } else {
- return null;
- }
- } else {
- if (is_null($value)) {
- setcookie($name, '', time() - 3600, $config['path'], $config['domain']);
- // 删除指定cookie
- unset($_COOKIE[$name]);
- } else {
- // 设置cookie
- $expire = !empty($config['expire']) ? time() + $config['expire'] : 0;
- setcookie($name, $value, $expire, $config['path'], $config['domain']);
- $_COOKIE[$name] = $value;
- }
- }
- return null;
-}
/**
* 文件函数
@@ -533,11 +423,7 @@ function F($file, $content = false, $mod = '') {
mkdir(dirname($file), 0755, true);
}
if (is_array($content)) {
- if (APP_DEBUG) {
- $content = str_replace('\\\\', '\\', 'response->setHeader();
$e['message'] = $msg;
- $e['file'] = $file;
- $e['line'] = $line;
+ $e['file'] = $file;
+ $e['line'] = $line;
include PT_PATH . '/error.tpl';
exit;
} else {
- PT::err404($msg);
- }
-}
-
-/**
- * 获取输入参数 支持过滤和默认值
- *
- * @param string $name 变量的名称 支持指定类型
- * @param mixed $default 不存在的时候默认值
- * @param mixed $filter 参数过滤方法
- * @param array $input
- * @return mixed
- */
-function I($name, $filter = 'int', $default = null, $input = array()) {
- // 可以从指定的数组中取值
- if ($input == array()) {
- if (strpos($name, '.')) {
- // 指定参数来源
- list($method, $name) = explode('.', $name, 2);
- } else {
- // 默认为post
- $method = 'post';
- }
- switch (strtolower($method)) {
- case 'get' :
- $input = $_GET;
- break;
- case 'post' :
- $input = $_POST;
- break;
- case 'put' :
- parse_str(file_get_contents('php://input'), $input);
- break;
- case 'request' :
- $input = $_REQUEST;
- break;
- case 'session' :
- $input = $_SESSION;
- break;
- case 'cookie' :
- $input = $_COOKIE;
- break;
- case 'server' :
- $input = $_SERVER;
- break;
- case 'globals' :
- $input = $GLOBALS;
- break;
- default:
- return NULL;
- }
+ PT_Base::getInstance()->response->error($msg . ' [' . $file . '(' . $line . ')]');
}
- $value = isset($input[$name]) ? $input[$name] : null;
- if (is_array($filter)) return in_array($value, $filter) ? $value : $default;
- if (!is_string($filter)) return $value;
- switch ($filter) {
- case 'int':
- return is_null($value) ? (is_null($default) ? 0 : $default) : intval($value);
- case 'str':
- return is_null($value) ? (is_null($default) ? '' : $default) : strval($value);
- case 'arr':
- return is_array($value) ? $value : (is_array($default) ? $default : array());
- default:
- return empty($value) ? $default : (regex($value, $filter) ? $value : $default);
- }
-}
-
-
-/**
- * regex
- * 使用正则验证数据
- *
- * @param string $value 要验证的数据
- * @param string $rule 验证规则
- * @return mixed
- */
-function regex($value, $rule) {
- $validate = array(
- //必填
- 'require' => '/.+/',
- //邮箱
- 'email' => '/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/',
- //链接
- 'url' => '/^http:\/\/[a-zA-Z0-9]+\.[a-zA-Z0-9]+[\/=\?%\-&_~`@\[\]\':+!]*([^<>\"\"])*$/',
- //货币
- 'currency' => '/^\d+(\.\d+)?$/',
- //数字
- 'number' => '/^\d+$/',
- //邮编
- 'zip' => '/^[0-9]\d{5}$/',
- //电话
- 'tel' => '/^1[\d]{10}$/',
- //整型
- 'integer' => '/^[-\+]?\d+$/',
- //带小数点
- 'double' => '/^[-\+]?\d+(\.\d+)?$/',
- //英文字母
- 'english' => '/^[a-zA-Z]+$/',
- //中文汉字
- 'chinese' => '/^[\x{4e00}-\x{9fa5}]+$/u',
- //拼音
- 'pinyin' => '/^[a-zA-Z0-9\-\_]+$/',
- //用户名
- 'username' => '/^(?!_)(?!.*?_$)[a-zA-Z0-9_\x{4e00}-\x{9fa5}]{3,15}$/u',
- //英文字符
- 'en' => '/^[a-zA-Z0-9_\s\-\.]+$/',
- //中文字符
- 'cn' => '/^[\w\s\-\x{4e00}-\x{9fa5}]+$/u',
- //安全字符串
- 'safestring' => '/^[^\$\?]+$/'
- );
- // 检查是否有内置的正则表达式
- if (isset($validate[strtolower($rule)])) $rule = $validate[strtolower($rule)];
- return preg_match($rule, strval($value)) === 1;
}
/**
@@ -716,10 +456,11 @@ function regex($value, $rule) {
* @return string
*/
function U($method = '', $args = array(), $ignores = array()) {
- static $rules = null, $_method = array(), $_map = array();
+ static $rules = null, $_method = array(), $_map = array(),$power=false;
if ($rules === null) {
- $rules = C('URL_RULES');
- $_map = C('map_module');
+ $rules = PT_Base::getInstance()->config->get('URL_RULES');
+ $_map = PT_Base::getInstance()->config->get('map_module');
+ $power = PT_Base::getInstance()->config->get('rewritepower',false);
}
//忽视args中的部分参数
if (!empty($ignores)) {
@@ -740,24 +481,39 @@ function U($method = '', $args = array(), $ignores = array()) {
$_method[$method] = strtolower($_method[$method]);
}
$method = $_method[$method];
- if (!empty($rules[$method])) {
- $keys = array();
- $rule = $rules[$method];
+ if (!empty($rules[$method]) && empty($args['_force']) && count($args) >= substr_count($rules[$method], '{')) {
+ $keys = array();
+ $rule = $rules[$method];
+ $oargs = $args;
foreach ($args as $key => $arg) {
$keys[] = '{' . $key . '}';
+ if (strpos($rule, '{' . $key . '}')) unset($oargs[$key]);
}
$url = clearUrl(str_replace($keys, $args, $rule));
if (strpos($url, ']')) {
$url = strtr($url, array('[' => '', ']' => ''));
}
- return PT_DIR . $url;
+ if ($oargs) {
+ return PT_DIR . $url . (strpos($url, '?') ? '&' : '?') . http_build_query($oargs);
+ } else {
+ return PT_DIR . $url;
+ }
} else {
list($param['m'], $param['c'], $param['a']) = explode('.', $method);
+ if (isset($_map[$param['m']])) $param['m'] = $_map[$param['m']];
//调整顺序为m c a
krsort($param);
$param = array_merge($param, $args);
- if (isset($_map[$param['m']])) $param['m'] = $_map[$param['m']];
- return __APP__ . '?' . http_build_query($param);
+ if ($power){
+ $url = PT_DIR . '/' . $param['m'] . '/' . $param['c'] . '/' . $param['a'] . '.' . $_GET['f'];
+ unset($param['m'], $param['c'], $param['a']);
+ if ($param) {
+ $url .= '?' . http_build_query($param);
+ }
+ }else{
+ $url=__APP__.'?'.http_build_query($param);
+ }
+ return $url;
}
}
@@ -784,7 +540,7 @@ function clearUrl($url) {
function strip_whitespace($content) {
$stripStr = '';
//分析php源码
- $tokens = token_get_all($content);
+ $tokens = token_get_all($content);
$last_space = false;
for ($i = 0, $j = count($tokens); $i < $j; $i++) {
if (is_string($tokens[$i])) {
@@ -826,110 +582,101 @@ function strip_whitespace($content) {
return $stripStr;
}
-
/**
- * block调用函数
+ * 获取自动加载的目录文件
*
- * @param string $class block名称
- * @param array $param block参数
- * @return mixed
+ * @return array
*/
-function B($class, $param) {
- static $_class;
- $classname = ucfirst(strtolower($class));
- $class = $classname . 'Block';
- if (empty($_class[$class])) {
- if (class_exists($class)) {
- $_class[$class] = new $class();
- } else {
- halt('不存在的block:' . $classname, __FILE__, __LINE__ - 4);
+function get_auto_map() {
+ $map = array();
+ $dirs = array_unique(explode(',', trim((PT_Base::getInstance()->config->get('allow_module', null, '') . ',common'), ',')));
+ foreach ($dirs as $dir) {
+ $path = APP_PATH . '/' . $dir;
+ if (!is_dir($path)) continue;
+ $handle = opendir($path);
+ while (($dirname = readdir($handle)) !== false) {
+ if (in_array($dirname, array('model', 'block', 'library'))) {
+ $handle1 = opendir($path . '/' . $dirname);
+ while (($filename = readdir($handle1)) !== false) {
+ if (substr($filename, -4) == '.php') {
+ $map[$dirname][substr($filename, 0, -4)][$dir] = $path . '/' . $dirname . '/' . $filename;
+ }
+ }
+ closedir($handle1);
+ }
}
+ closedir($handle);
}
- return $_class[$class]->run($param);
+ return $map;
}
-function runinfo() {
- if (C('is_gen_html')) return '';
- $tpl = C('runinfo', null, 'Power by PTCMS, Processed in {time}(s), Memory usage: {mem}MB.');
- $from[] = '{time}';
- $to[] = number_format(microtime(true) - $GLOBALS['_startTime'], 3);
- $from[] = '{mem}';
- $to[] = number_format((memory_get_usage() - $GLOBALS['_startUseMems']) / 1024 / 1024, 3);
- if (strpos($tpl, '{net}')) {
- $from[] = '{net}';
- $to[] = count($GLOBALS['_api']);
- }
- if (strpos($tpl, '{file}')) {
- $from[] = '{file}';
- $to[] = count(get_included_files());
- }
- if (strpos($tpl, '{sql}')) {
- $from[] = '{sql}';
- $to[] = count($GLOBALS['_sql']);
- }
- if (strpos($tpl, '{cacheread}')) {
- $from[] = '{cacheread}';
- $to[] = $GLOBALS['_cacheRead'];
- }
- if (strpos($tpl, '{cachewrite}')) {
- $from[] = '{cachewrite}';
- $to[] = $GLOBALS['_cacheWrite'];
- }
- $runtimeinfo = str_replace($from, $to, $tpl);
- return $runtimeinfo;
+// 判断是否有html缓存
+if ($_SERVER['REQUEST_METHOD'] === 'GET' && strpos($_SERVER['REQUEST_URI'], '.php') === false && is_file(PT_ROOT . $_SERVER['REQUEST_URI'])) {
+ readfile(PT_ROOT . $_SERVER['REQUEST_URI']);
+ exit;
}
-
-function is_mobile() {
- // 如果有HTTP_X_WAP_PROFILE则一定是移动设备
- if (isset ($_SERVER['HTTP_X_WAP_PROFILE'])) {
- return true;
- }
- // 如果via信息含有wap则一定是移动设备,部分服务商会屏蔽该信息
- if (isset ($_SERVER['HTTP_VIA'])) {
- // 找不到为flase,否则为true
- return stristr($_SERVER['HTTP_VIA'], "wap") ? true : false;
- }
- // 脑残法,判断手机发送的客户端标志,兼容性有待提高
- if (isset ($_SERVER['HTTP_USER_AGENT'])) {
- $clientkeywords = array('nokia', 'sony', 'ericsson', 'mot', 'samsung', 'htc', 'sgh', 'lg', 'sharp', 'sie-', 'philips', 'panasonic', 'alcatel', 'lenovo', 'iphone', 'ipod', 'blackberry', 'meizu', 'android', 'netfront', 'symbian', 'ucweb', 'windowsce', 'palm', 'operamini', 'operamobi', 'openwave', 'nexusone', 'cldc', 'midp', 'wap', 'mobile', 'UCBrowser');
- // 从HTTP_USER_AGENT中查找手机浏览器的关键字
- if (preg_match("/(" . implode('|', $clientkeywords) . ")/i", strtolower($_SERVER['HTTP_USER_AGENT']))) {
- return true;
- }
- }
- // 协议法,因为有可能不准确,放到最后判断
- if (isset ($_SERVER['HTTP_ACCEPT'])) {
- // 如果只支持wml并且不支持html那一定是移动设备
- // 如果支持wml和html但是wml在html之前则是移动设备
- if ((strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') !== false) && (strpos($_SERVER['HTTP_ACCEPT'], 'text/html') === false || (strpos($_SERVER['HTTP_ACCEPT'], 'vnd.wap.wml') < strpos($_SERVER['HTTP_ACCEPT'], 'text/html')))) {
- return true;
- }
- }
- return false;
+// 自动识别SAE环境
+if (function_exists('saeAutoLoader') or function_exists('sae_auto_load')) {
+ // sae
+ defined('APP_MODE') or define('APP_MODE', 'sae');
+} else {
+ // 普通模式
+ defined('APP_MODE') or define('APP_MODE', 'common');
}
-// 判断是否是蜘蛛
-function is_spider($ua = '') {
- empty($ua) && $ua = $_SERVER['HTTP_USER_AGENT'];
- $ua = strtolower($ua);
- $spiders = array('bot', 'crawl', 'spider', 'slurp', 'sohu-search', 'lycos', 'robozilla');
- foreach ($spiders as $spider) {
- if (false !== strpos($ua, $spider)) return true;
+//后台运行程序
+if (!empty($_GET['backRun'])) {
+ //生成html
+ if (function_exists('fastcgi_finish_request')) {
+ fastcgi_finish_request();
+ } else {
+ ignore_user_abort(true);
}
- return false;
}
-//获取客户端ip
-function get_ip($default = '0.0.0.0') {
- $keys = array('HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'REMOTE_ADDR');
+// 加载公共配置文件
+PT_Base::getInstance()->config->register(pt::import(APP_PATH . '/common/config.php'));
+pt::import(APP_PATH . '/common/function.php');
- foreach ($keys as $key) {
- if (empty($_SERVER[$key])) continue;
- $ips = explode(',', $_SERVER[$key], 1);
- $ip = $ips[0];
- $l = ip2long($ip);
- if ((false !== $l) && ($ip === long2ip($l))) return $ip;
+// 编译模式
+if (APP_DEBUG) {
+ // 开启错误输出
+ ini_set('display_errors', 'on');
+ // 设置错误输出级别
+ error_reporting(E_ALL);
+ $GLOBALS['_automap'] = get_auto_map();
+} else {
+ // 开启错误输出
+ ini_set('display_errors', 'off');
+ // 设置错误输出级别
+ error_reporting(0);
+ // 合并核心文件
+ $runtimefile = CACHE_PATH . '/pt_runtime.php';
+ if (!is_file($runtimefile)) {
+ $files = array(
+ PT_PATH . '/core/cache.php',
+ PT_PATH . '/driver/cache/' . strtolower(PT_Base::getInstance()->config->get('cache_driver', 'file')) . '.php',
+ PT_PATH . '/core/controller.php',
+ PT_PATH . '/core/dispatcher.php',
+ PT_PATH . '/core/log.php',
+ PT_PATH . '/core/plugin.php',
+ PT_PATH . '/core/view.php',
+ PT_PATH . '/core/block.php',
+ );
+ if (PT_Base::getInstance()->config->get('mysql_driver')) {
+ $files[] = PT_PATH . '/core/model.php';
+ $files[] = PT_PATH . '/driver/model/' . strtolower(PT_Base::getInstance()->config->get('mysql_driver', null, 'pdo')) . '.php';
+ }
+ $str = "start();
diff --git a/ptcms_ad.sql b/ptcms_ad.sql
deleted file mode 100644
index 8ac8afa..0000000
--- a/ptcms_ad.sql
+++ /dev/null
@@ -1,35 +0,0 @@
-# Host: localhost (Version: 5.5.38)
-# Date: 2014-10-10 08:45:08
-# Generator: MySQL-Front 5.3 (Build 4.120)
-
-/*!40101 SET NAMES utf8 */;
-
-#
-# Structure for table "ptcms_ad"
-#
-
-DROP TABLE IF EXISTS `ptcms_ad`;
-CREATE TABLE `ptcms_ad` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(50) NOT NULL DEFAULT '',
- `key` varchar(50) NOT NULL DEFAULT '',
- `width` smallint(6) DEFAULT '0',
- `height` smallint(6) DEFAULT '0',
- `code` text,
- `intro` varchar(255) NOT NULL DEFAULT '',
- `create_user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建人',
- `update_user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '修改人',
- `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
- `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '修改时间',
- `type` tinyint(3) DEFAULT '1' COMMENT '广告类型 1 html 2 js',
- `status` tinyint(3) DEFAULT '1',
- PRIMARY KEY (`id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
-#
-# Data for table "ptcms_ad"
-#
-
-/*!40000 ALTER TABLE `ptcms_ad` DISABLE KEYS */;
-INSERT INTO `ptcms_ad` VALUES (1,'ddd333','sss22',12,32,'123123','123',1,1,1412899971,1412900277,1,1),(2,'网站统计','tongji',0,0,'','',1,0,1412900092,0,1,1);
-/*!40000 ALTER TABLE `ptcms_ad` ENABLE KEYS */;
diff --git a/ptcms_friendlink.sql b/ptcms_friendlink.sql
deleted file mode 100644
index 557a85d..0000000
--- a/ptcms_friendlink.sql
+++ /dev/null
@@ -1,35 +0,0 @@
-# Host: localhost (Version: 5.5.38)
-# Date: 2014-10-10 08:45:16
-# Generator: MySQL-Front 5.3 (Build 4.120)
-
-/*!40101 SET NAMES utf8 */;
-
-#
-# Structure for table "ptcms_friendlink"
-#
-
-DROP TABLE IF EXISTS `ptcms_friendlink`;
-CREATE TABLE `ptcms_friendlink` (
- `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
- `name` varchar(20) NOT NULL DEFAULT '',
- `url` varchar(100) NOT NULL DEFAULT '',
- `logo` varchar(100) NOT NULL,
- `description` varchar(255) NOT NULL COMMENT '描述信息',
- `ordernum` smallint(5) unsigned NOT NULL DEFAULT '50',
- `color` varchar(20) NOT NULL COMMENT '颜色代码',
- `isbold` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否加粗',
- `create_user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建人',
- `update_user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '修改人',
- `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
- `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '修改时间',
- `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态 1可用 0禁用',
- PRIMARY KEY (`id`)
-) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
-
-#
-# Data for table "ptcms_friendlink"
-#
-
-/*!40000 ALTER TABLE `ptcms_friendlink` DISABLE KEYS */;
-INSERT INTO `ptcms_friendlink` VALUES (6,'PTCMS工作室','http://www.ptcms.com','','PTCMS官方网站',10,'red',1,1,1,1412859114,1412862704,1);
-/*!40000 ALTER TABLE `ptcms_friendlink` ENABLE KEYS */;
diff --git a/public/image/114.png b/public/image/114.png
deleted file mode 100644
index 3d08227..0000000
Binary files a/public/image/114.png and /dev/null differ
diff --git a/public/image/144.png b/public/image/144.png
deleted file mode 100644
index b6bd36d..0000000
Binary files a/public/image/144.png and /dev/null differ
diff --git a/public/image/57.png b/public/image/57.png
deleted file mode 100644
index 07835df..0000000
Binary files a/public/image/57.png and /dev/null differ
diff --git a/public/image/72.png b/public/image/72.png
deleted file mode 100644
index 6107000..0000000
Binary files a/public/image/72.png and /dev/null differ
diff --git a/public/image/error.gif b/public/image/error.gif
deleted file mode 100644
index e68479b..0000000
Binary files a/public/image/error.gif and /dev/null differ
diff --git a/public/image/favicon.ico b/public/image/favicon.ico
deleted file mode 100644
index 50d9690..0000000
Binary files a/public/image/favicon.ico and /dev/null differ
diff --git a/public/image/loading.gif b/public/image/loading.gif
deleted file mode 100644
index ca8d7a2..0000000
Binary files a/public/image/loading.gif and /dev/null differ
diff --git a/public/image/loading2.gif b/public/image/loading2.gif
deleted file mode 100644
index 5bb90fd..0000000
Binary files a/public/image/loading2.gif and /dev/null differ
diff --git a/public/image/logo.png b/public/image/logo.png
deleted file mode 100644
index 72a5e5d..0000000
Binary files a/public/image/logo.png and /dev/null differ
diff --git a/public/image/success.gif b/public/image/success.gif
deleted file mode 100644
index eb5905b..0000000
Binary files a/public/image/success.gif and /dev/null differ
diff --git a/public/plugin/datepicker/WdatePicker.js b/public/plugin/datepicker/WdatePicker.js
deleted file mode 100644
index 1d95ab3..0000000
--- a/public/plugin/datepicker/WdatePicker.js
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- * My97 DatePicker 4.8 Beta2
- * License: http://www.my97.net/dp/license.asp
- */
-var $dp, WdatePicker;
-(function () {
- var $ = {
- $langList: [{name: "en", charset: "UTF-8"}, {name: "zh-cn", charset: "UTF-8"}, {name: "zh-tw", charset: "UTF-8"}],
- $skinList: [
- {name: "default", charset: "gb2312"},
- {name: "whyGreen", charset: "gb2312"},
- {name: "blue", charset: "gb2312"},
- {name: "green", charset: "gb2312"},
- {name: "ext", charset: "gb2312"},
- {name: "blueFresh", charset: "gb2312"}
- ],
- $wdate: true,
- $crossFrame: true,
- $preLoad: false,
- doubleCalendar: false,
- enableKeyboard: true,
- enableInputMask: true,
- autoUpdateOnChanged: null,
- weekMethod: "ISO8601",
- position: {},
- lang: "auto",
- skin: "ext",
- dateFmt: "yyyy-MM-dd HH:mm:ss",
-//dateFmt:"yyyy-MM-dd",
- realDateFmt: "yyyy-MM-dd",
- realTimeFmt: "HH:mm:ss",
- realFullFmt: "%Date %Time",
- minDate: "1900-01-01 00:00:00",
- maxDate: "2099-12-31 23:59:59",
- startDate: "",
- alwaysUseStartDate: false,
- yearOffset: 1911,
- firstDayOfWeek: 0,
- isShowWeek: false,
- highLineWeekDay: true,
- isShowClear: true,
- isShowToday: true,
- isShowOK: true,
- isShowOthers: true,
- readOnly: false,
- errDealMode: 0,
- autoPickDate: null,
- qsEnabled: true,
- autoShowQS: false,
- specialDates: null, specialDays: null, disabledDates: null, disabledDays: null, opposite: false, onpicking: null, onpicked: null, onclearing: null, oncleared: null, ychanging: null, ychanged: null, Mchanging: null, Mchanged: null, dchanging: null, dchanged: null, Hchanging: null, Hchanged: null, mchanging: null, mchanged: null, schanging: null, schanged: null, eCont: null, vel: null, elProp: "", errMsg: "", quickSel: [], has: {}, getRealLang: function () {
- var _ = $.$langList;
- for (var A = 0; A < _.length; A++)if (_[A].name == this.lang)return _[A];
- return _[0]
- }
- };
- WdatePicker = T;
- var X = window, S = {innerHTML: ""}, M = "document", H = "documentElement", C = "getElementsByTagName", U, A, R, G, a, W = navigator.appName;
- if (W == "Microsoft Internet Explorer")R = true; else if (W == "Opera")a = true; else G = true;
- A = J();
- if ($.$wdate)K(A + "skin/WdatePicker.css");
- U = X;
- if ($.$crossFrame) {
- try {
- while (U.parent && U.parent[M] != U[M] && U.parent[M][C]("frameset").length == 0)U = U.parent
- } catch (N) {
- }
- }
- if (!U.$dp)U.$dp = {ff: G, ie: R, opera: a, status: 0, defMinDate: $.minDate, defMaxDate: $.maxDate};
- B();
- if ($.$preLoad && $dp.status == 0)E(X, "onload", function () {
- T(null, true)
- });
- if (!X[M].docMD) {
- E(X[M], "onmousedown", D);
- X[M].docMD = true
- }
- if (!U[M].docMD) {
- E(U[M], "onmousedown", D);
- U[M].docMD = true
- }
- E(X, "onunload", function () {
- if ($dp.dd)O($dp.dd, "none")
- });
- function B() {
- U.$dp = U.$dp || {};
- obj = {
- $: function ($) {
- return (typeof $ == "string") ? X[M].getElementById($) : $
- }, $D: function ($, _) {
- return this.$DV(this.$($).value, _)
- }, $DV: function (_, $) {
- if (_ != "") {
- this.dt = $dp.cal.splitDate(_, $dp.cal.dateFmt);
- if ($)for (var B in $)if (this.dt[B] === undefined)this.errMsg = "invalid property:" + B; else {
- this.dt[B] += $[B];
- if (B == "M") {
- var C = $["M"] > 0 ? 1 : 0, A = new Date(this.dt["y"], this.dt["M"], 0).getDate();
- this.dt["d"] = Math.min(A + C, this.dt["d"])
- }
- }
- if (this.dt.refresh())return this.dt
- }
- return ""
- }, show: function () {
- var A = U[M].getElementsByTagName("div"), $ = 100000;
- for (var B = 0; B < A.length; B++) {
- var _ = parseInt(A[B].style.zIndex);
- if (_ > $)$ = _
- }
- this.dd.style.zIndex = $ + 2;
- O(this.dd, "block")
- }, hide: function () {
- O(this.dd, "none")
- }, attachEvent: E
- };
- for (var $ in obj)U.$dp[$] = obj[$];
- $dp = U.$dp
- }
-
- function E(A, $, _) {
- if (R)A.attachEvent($, _); else if (_) {
- var B = $.replace(/on/, "");
- _._ieEmuEventHandler = function ($) {
- return _($)
- };
- A.addEventListener(B, _._ieEmuEventHandler, false)
- }
- }
-
- function J() {
- var _, A, $ = X[M][C]("script");
- for (var B = 0; B < $.length; B++) {
- _ = $[B].getAttribute("src") || "";
- _ = _.substr(0, _.toLowerCase().indexOf("wdatepicker.js"));
- A = _.lastIndexOf("/");
- if (A > 0)_ = _.substring(0, A + 1);
- if (_)break
- }
- return _
- }
-
- function K(A, $, B) {
- var D = X[M][C]("HEAD").item(0), _ = X[M].createElement("link");
- if (D) {
- _.href = A;
- _.rel = "stylesheet";
- _.type = "text/css";
- if ($)_.title = $;
- if (B)_.charset = B;
- D.appendChild(_)
- }
- }
-
- function F($) {
- $ = $ || U;
- var A = 0, _ = 0;
- while ($ != U) {
- var D = $.parent[M][C]("iframe");
- for (var F = 0; F < D.length; F++) {
- try {
- if (D[F].contentWindow == $) {
- var E = V(D[F]);
- A += E.left;
- _ += E.top;
- break
- }
- } catch (B) {
- }
- }
- $ = $.parent
- }
- return {"leftM": A, "topM": _}
- }
-
- function V(G, F) {
- if (G.getBoundingClientRect)return G.getBoundingClientRect(); else {
- var A = {ROOT_TAG: /^body|html$/i, OP_SCROLL: /^(?:inline|table-row)$/i}, E = false, I = null, _ = G.offsetTop, H = G.offsetLeft, D = G.offsetWidth, B = G.offsetHeight, C = G.offsetParent;
- if (C != G)while (C) {
- H += C.offsetLeft;
- _ += C.offsetTop;
- if (Q(C, "position").toLowerCase() == "fixed")E = true; else if (C.tagName.toLowerCase() == "body")I = C.ownerDocument.defaultView;
- C = C.offsetParent
- }
- C = G.parentNode;
- while (C.tagName && !A.ROOT_TAG.test(C.tagName)) {
- if (C.scrollTop || C.scrollLeft)if (!A.OP_SCROLL.test(O(C)))if (!a || C.style.overflow !== "visible") {
- H -= C.scrollLeft;
- _ -= C.scrollTop
- }
- C = C.parentNode
- }
- if (!E) {
- var $ = Z(I);
- H -= $.left;
- _ -= $.top
- }
- D += H;
- B += _;
- return {"left": H, "top": _, "right": D, "bottom": B}
- }
- }
-
- function L($) {
- $ = $ || U;
- var B = $[M], A = ($.innerWidth) ? $.innerWidth : (B[H] && B[H].clientWidth) ? B[H].clientWidth : B.body.offsetWidth, _ = ($.innerHeight) ? $.innerHeight : (B[H] && B[H].clientHeight) ? B[H].clientHeight : B.body.offsetHeight;
- return {"width": A, "height": _}
- }
-
- function Z($) {
- $ = $ || U;
- var B = $[M], A = B[H], _ = B.body;
- B = (A && A.scrollTop != null && (A.scrollTop > _.scrollTop || A.scrollLeft > _.scrollLeft)) ? A : _;
- return {"top": B.scrollTop, "left": B.scrollLeft}
- }
-
- function D($) {
- var _ = $ ? ($.srcElement || $.target) : null;
- try {
- if ($dp.cal && !$dp.eCont && $dp.dd && _ != $dp.el && $dp.dd.style.display == "block")$dp.cal.close()
- } catch ($) {
- }
- }
-
- function Y() {
- $dp.status = 2
- }
-
- var P, _;
-
- function T(N, F) {
- $dp.win = X;
- B();
- N = N || {};
- for (var K in $)if (K.substring(0, 1) != "$" && N[K] === undefined)N[K] = $[K];
- if (F) {
- if (!L()) {
- _ = _ || setInterval(function () {
- if (U[M].readyState == "complete")clearInterval(_);
- T(null, true)
- }, 50);
- return
- }
- if ($dp.status == 0) {
- $dp.status = 1;
- N.el = S;
- I(N, true)
- } else return
- } else if (N.eCont) {
- N.eCont = $dp.$(N.eCont);
- N.el = S;
- N.autoPickDate = true;
- N.qsEnabled = false;
- I(N)
- } else {
- if ($.$preLoad && $dp.status != 2)return;
- var J = H();
- if (J) {
- N.srcEl = J.srcElement || J.target;
- J.cancelBubble = true
- }
- N.el = N.el = $dp.$(N.el || N.srcEl);
- if (!N.el || N.el["My97Mark"] === true || N.el.disabled || ($dp.dd && O($dp.dd) != "none" && $dp.dd.style.left != "-970px")) {
- try {
- N.el["My97Mark"] = false
- } catch (C) {
- }
- return
- }
- I(N);
- if (J && N.el.nodeType == 1 && N.el["My97Mark"] === undefined) {
- var A, D;
- if (J.type == "focus") {
- A = "onclick";
- D = "onfocus"
- } else {
- A = "onfocus";
- D = "onclick"
- }
- E(N.el, A, N.el[D])
- }
- }
- function L() {
- if (R && U != X && U[M].readyState != "complete")return false;
- return true
- }
-
- function H() {
- if (G) {
- func = H.caller;
- while (func != null) {
- var $ = func.arguments[0];
- if ($ && ($ + "").indexOf("Event") >= 0)return $;
- func = func.caller
- }
- return null
- }
- return event
- }
- }
-
- function Q(_, $) {
- return _.currentStyle ? _.currentStyle[$] : document.defaultView.getComputedStyle(_, false)[$]
- }
-
- function O(_, $) {
- if (_)if ($ != null)_.style.display = $; else return Q(_, "display")
- }
-
- function I(G, _) {
- var D = G.el ? G.el.nodeName : "INPUT";
- if (_ || G.eCont || new RegExp(/input|textarea|div|span|p|a/ig).test(D))G.elProp = D == "INPUT" ? "value" : "innerHTML"; else return;
- if (G.lang == "auto")G.lang = R ? navigator.browserLanguage.toLowerCase() : navigator.language.toLowerCase();
- if (!G.eCont)for (var C in G)$dp[C] = G[C];
- if (!$dp.dd || G.eCont || ($dp.dd && (G.getRealLang().name != $dp.dd.lang || G.skin != $dp.dd.skin))) {
- if (G.eCont)E(G.eCont, G); else {
- $dp.dd = U[M].createElement("DIV");
- $dp.dd.style.cssText = "position:absolute";
- U[M].body.appendChild($dp.dd);
- E($dp.dd, G);
- if (_)$dp.dd.style.left = $dp.dd.style.top = "-970px"; else {
- $dp.show();
- B($dp)
- }
- }
- } else if ($dp.cal) {
- $dp.show();
- $dp.cal.init();
- if (!$dp.eCont)B($dp)
- }
- function E(F, E) {
- F.innerHTML = "";
- var D = F.lastChild.contentWindow[M], _ = $.$langList, C = $.$skinList, H = E.getRealLang();
- F.lang = H.name;
- F.skin = E.skin;
- var G = [""];
- for (var I = 0; I < C.length; I++)if (C[I].name == E.skin)G.push(" ");
- G.push("");
- G.push("");
- G.push("");
- E.setPos = B;
- E.onload = Y;
- D.write("");
- D.cfg = E;
- D.write(G.join(""))
- }
-
- function B(I) {
- var G = I.position.left, B = I.position.top, C = I.el;
- if (C == S)return;
- if (C != I.srcEl && (O(C) == "none" || C.type == "hidden"))C = I.srcEl;
- var H = V(C), $ = F(X), D = L(U), A = Z(U), E = $dp.dd.offsetHeight, _ = $dp.dd.offsetWidth;
- if (isNaN(B))B = 0;
- if (($.topM + H.bottom + E > D.height) && ($.topM + H.top - E > 0))B += A.top + $.topM + H.top - E - 2; else B += A.top + $.topM + Math.min(H.bottom, D.height - E) + 2;
- if (isNaN(G))G = 0;
- G += A.left + Math.min($.leftM + H.left, D.width - _ - 5) - (R ? 2 : 0);
- I.dd.style.top = B + "px";
- I.dd.style.left = G + "px"
- }
- }
-})()
\ No newline at end of file
diff --git a/public/plugin/datepicker/calendar.js b/public/plugin/datepicker/calendar.js
deleted file mode 100644
index 69b42e4..0000000
--- a/public/plugin/datepicker/calendar.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * My97 DatePicker 4.8 Beta2
- * License: http://www.my97.net/dp/license.asp
- */
-eval(function (p, a, c, k, e, d) {
- e = function (c) {
- return (c < a ? "" : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36))
- };
- if (!''.replace(/^/, String)) {
- while (c--)d[e(c)] = k[c] || e(c);
- k = [function (e) {
- return d[e]
- }];
- e = function () {
- return '\\w+'
- };
- c = 1;
- }
- ;
- while (c--)if (k[c])p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]);
- return p;
-}('k($4j.3X){$f={};19(o p 4i $2l)k(5Z $2l[p]=="6d"){$f[p]={};19(o 4B 4i $2l[p])$f[p][4B]=$2l[p][4B]}q $f[p]=$2l[p]}q $f=$2l;19(p 4i $4j)$f[p]=$4j[p];o $c;k($62){6o.2N.7c("6W",l($){k(!$)h.2h();t $});6o.2N.7b("6N",l(){o $=h.6K;3l($.5f!=1)$=$.7e;t $});7a.2N.2T=l($,b){o A=$.1l(/6C/,"");b.6B=l($){6M.1Q=$;t b()};h.7g(A,b.6B,1n)}}l 5n(){$c=h;h.2F=[];$d=1P.75("x");$d.1d="4r";$d.1I=" <1t Y=3Y> <1t Y=3Y> <1x 2t=0 2r=0 2u=0><1j><18 7V=2><4k 1E=7W>4k>&4A;<1t Y=7u 4g=2><1t 1f=\\":\\" Y=6i 6p><1t Y=6q 4g=2><1t 1f=\\":\\" Y=6i 6p><1t Y=6q 4g=2>18><18><1N 1E=7s>1N>18>1j><1j><18><1N 1E=7r>1N>18>1j>1x><1t Y=4h 1E=7y 3a=1N><1t Y=4h 1E=7C 3a=1N><1t Y=4h 1E=73 3a=1N> ";6S($d,l(){3x()});A();h.5o();$f.22=[1P,$d.1K,$d.1v,$d.2B,$d.2Q,$d.2S,$d.2W,$d.2d,$d.1X];19(o B=0;B<$f.22.u;B++){o b=$f.22[B];b.34=B==$f.22.u-1?$f.22[1]:$f.22[B+1];$f.2T(b,"56",4P)}$();4K("y,M,H,m,s");$d.5s.1r=l(){58(1)};$d.5t.1r=l(){58(-1)};$d.4s.1r=l(){k($d.1F.1c.2g!="6t"){$c.4I();3v($d.1F)}q 1m($d.1F)};1P.6G.4x($d);l A(){o b=$("a");1q=$("x"),1M=$("1t"),4n=$("1N"),5q=$("4k");$d.3R=b[0];$d.3H=b[1];$d.3E=b[3];$d.3G=b[2];$d.41=1q[9];$d.1K=1M[0];$d.1v=1M[1];$d.4z=1q[0];$d.3C=1q[4];$d.3g=1q[6];$d.1F=1q[10];$d.2Y=1q[11];$d.2V=1q[12];$d.6F=1q[13];$d.6I=1q[14];$d.6T=1q[15];$d.4s=1q[16];$d.3Z=1q[17];$d.2B=1M[2];$d.2Q=1M[4];$d.2S=1M[6];$d.2W=1M[7];$d.2d=1M[8];$d.1X=1M[9];$d.5s=4n[0];$d.5t=4n[1];$d.5w=5q[0];l $($){t $d.6P($)}}l $(){$d.3R.1r=l(){$1L=$1L<=0?$1L-1:-1;k($1L%5==0){$d.1v.1U();t}$d.1v.1f=$n.y-1;$d.1v.2m()};$d.3H.1r=l(){$n.2q("M",-1);$d.1K.2m()};$d.3E.1r=l(){$n.2q("M",1);$d.1K.2m()};$d.3G.1r=l(){$1L=$1L>=0?$1L+1:1;k($1L%5==0){$d.1v.1U();t}$d.1v.1f=$n.y+1;$d.1v.2m()}}}5n.2N={5o:l(){$1L=0;$f.5h=h;k($f.3L&&$f.z.3L!=1h){$f.z.3L=1a;$f.z.4d()}h.4w();$n=h.5J=1b 1G();$1B=1b 1G();$1u=h.2A=1b 1G();h.1A=h.3j($f.1A);h.2L=$f.2L==1h?($f.Z.25&&$f.Z.25?1n:1a):$f.2L;$f.3r=$f.3r==1h?($f.4t&&$f.Z.d?1n:1a):$f.3r;h.4a=h.3p("7A");h.5S=h.3p("7G");h.5U=h.3p("7H");h.5O=h.3p("7F");h.1T=h.3s($f.1T,$f.1T!=$f.5A?$f.1Z:$f.2G,$f.5A);h.1W=h.3s($f.1W,$f.1W!=$f.5B?$f.1Z:$f.2G,$f.5B);k(h.1T.2z(h.1W)>0)$f.4o=$1k.7D;k(h.1R()){h.5C();h.3F=$f.z[$f.1y]}q h.35(1n,2);4H($n);$d.5w.1I=$1k.7q;$d.2W.1f=$1k.7o;$d.2d.1f=$1k.7p;$d.1X.1f=$1k.7w;$d.1X.28=!$c.1w($1u);h.5Y();h.6O();k($f.4o)7v($f.4o);h.4F();k($f.z.5f==1&&$f.z["3z"]===6J){$f.2T($f.z,"56",4P);$f.2T($f.z,"2m",l(){k($f&&$f.1J.1c.2g=="2s"){$c.3I();k($f.5h.3F!=$f.z[$f.1y]&&$f.z.7t)4J($f.z,"7I")}});$f.z["3z"]=1n}$c.1i=$f.z;3x()},5C:l(){o b=h.3f();k(b!=0){o $;k(b>0)$=h.1W;q $=h.1T;k($f.Z.3T){$n.y=$.y;$n.M=$.M;$n.d=$.d}k($f.Z.25){$n.H=$.H;$n.m=$.m;$n.s=$.s}}},3i:l(J,C,Q,E,B,G,F,K,L){o $;k(J&&J.1R)$=J;q{$=1b 1G();k(J!=""){C=C||$f.1A;o H,P=0,O,A=/3d|2n|3m|y|2w|3b|3K|M|1J|d|%2i|4O|H|4U|m|4V|s|3h|D|4Z|W|w/g,b=C.2Z(A);A.2C=0;k(L)O=J.43(/\\W+/);q{o D=0,M="^";3l((O=A.3k(C))!==1h){k(D>=0)M+=C.1D(D,O.3Q);D=A.2C;2R(O[0]){1e"3d":M+="(\\\\d{4})";1g;1e"2n":M+="(\\\\d{3})";1g;1e"2w":1e"3b":1e"3h":1e"D":M+="(\\\\D+)";1g;63:M+="(\\\\d\\\\d?)";1g}}M+=".*$";O=1b 4u(M).3k(J);P=1}k(O){19(H=0;H=0){A=A.1l(/%2i/g,"0");$.d=0;$.M=2e($.M)+1}$.1S()}t $},1R:l(){o b,$;k($f.7R||($f.6c!=""&&$f.z[$f.1y]=="")){b=h.3j($f.6c);$=$f.1Z}q{b=$f.z[$f.1y];$=h.1A}$n.2k(h.3i(b,$));k(b!=""){o A=1;k($f.Z.3T&&!h.4l($n)){$n.y=$1B.y;$n.M=$1B.M;$n.d=$1B.d;A=0}k($f.Z.25&&!h.4m($n)){$n.H=$1B.H;$n.m=$1B.m;$n.s=$1B.s;A=0}t A&&h.1w($n)}t 1},4l:l($){k($.y!=1h)$=2I($.y,4)+"-"+$.M+"-"+$.d;t $.2Z(/^((\\d{2}(([6f][7Q])|([6e][26]))[\\-\\/\\s]?((((0?[6b])|(1[68]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[67])))|(((0?[69])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])))))|(\\d{2}(([6f][7P])|([6e][72]))[\\-\\/\\s]?((((0?[6b])|(1[68]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[67])))|(((0?[69])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))(\\s(((0?[0-9])|([1-2][0-3]))\\:([0-5]?[0-9])((\\s)|(\\:([0-5]?[0-9])))))?$/)},4m:l($){k($.H!=1h)$=$.H+":"+$.m+":"+$.s;t $.2Z(/^([0-9]|([0-1][0-9])|([2][0-3])):([0-9]|([0-5][0-9])):([0-9]|([0-5][0-9]))$/)},3f:l($,A){$=$||$n;o b=$.2z(h.1T,A);k(b>0){b=$.2z(h.1W,A);k(b<0)b=0}t b},1w:l($,A,B){A=A||$f.Z.49;o b=h.3f($,A);k(b==0){b=1;k(A=="d"&&B==1h)B=24.5F((1b 1z($.y,$.M-1,$.d).1H()-$f.3M+7)%7);b=!h.5T(B)&&!h.5M($,A)}q b=0;t b},5L:l(){o b=$f.z,A=h,$=$f.z[$f.1y];k($f.4q>=0&&$f.4q<=2&&$!=1h){k($!="")A.2A.2k(A.3i($,A.1A));k($==""||(A.4l(A.2A)&&A.4m(A.2A)&&A.1w(A.2A))){k($!=""){A.5J.2k(A.2A);A.3D()}q A.3W("")}q t 1n}t 1a},3I:l($){3x();k(h.5L()){h.35(1a);$f.1m()}q{k($){2J($);h.35(1n,2)}q h.35(1n);$f.20()}},44:l(){o E,C,D,K,A,H=1b 2p(),F=$1k.5l,G=$f.3M,I="",$="",b=1b 1G($n.y,$n.M,$n.d,0,0,0),J=b.y,B=b.M;A=1-1b 1z(J,B-1,1).1H()+G;k(A>1)A-=7;H.a("<1x Y=5E 2U=33% 2u=0 2t=0 2r=0>");H.a("<1j Y=5H 4D=5P>");k($f.5G)H.a("<18>"+F[0]+"18>");19(E=0;E<7;E++)H.a("<18>"+F[(G+E)%7+1]+"18>");H.a("1j>");19(E=1,C=A;E<7;E++){H.a("<1j>");19(D=0;D<7;D++){b.1R(J,B,C++);b.1S();k(b.M==B){K=1a;k(b.2z($1u,"d")==0)I="74";q k(b.2z($1B,"d")==0)I="6X";q I=($f.5D&&(0==(G+D)%7||6==(G+D)%7)?"7i":"7j");$=($f.5D&&(0==(G+D)%7||6==(G+D)%7)?"7h":"7k")}q k($f.5y){K=1a;I="7l";$="7f"}q K=1n;k($f.5G&&D==0&&(E<4||K))H.a("<18 Y=77>"+4v(b,$f.3M==0?1:0)+"18>");H.a("<18 ");k(K){k(h.1w(b,"d",D)){k(h.5R(24.5F((1b 1z(b.y,b.M-1,b.d).1H()-$f.3M+7)%7))||h.5V(b))I="78";H.a("1r=\\"2K("+b.y+","+b.M+","+b.d+");\\" ");H.a("2y=\\"h.1d=\'"+$+"\'\\" ");H.a("2v=\\"h.1d=\'"+I+"\'\\" ")}q I="7d";H.a("Y="+I);H.a(">"+b.d+"18>")}q H.a(">18>")}H.a("1j>")}H.a("1x>");t H.j()},5M:l(b,A){o $=h.4e(b,h.4a,A);t(h.4a&&$f.5N)?!$:$},5T:l($){t h.4f($,h.5S)},5V:l($){t h.4e($,h.5U)},5R:l($){t h.4f($,h.5O)},4e:l($,B,A){o b=A=="d"?$f.4E:$f.1Z;t B?B.4Q(h.3J(b,$)):0},4f:l(b,$){t $?$.4Q(b):0},2H:l(p,c,r,e,2b){o s=1b 2p(),4c=2b?"r"+p:p;5Q=$n[p];s.a("<1x 2t=0 2r=3 2u=0");19(o i=0;i");19(o j=0;j"+(p=="M"?$1k.29[$n[p]-1]:$n[p])+"18>")}s.a("1j>")}s.a("1x>");$n[p]=5Q;t s.j()},4C:l($,b){k($){o A=$.7n;k($6y)A=$.7m().2D;b.1c.2D=A}},6Z:l($){h.4C($,$d.3C);$d.3C.1I=h.2H("M",2,6,"i+j*6+1",$==$d.2c)},4b:l(b,B,A){o $=1b 2p();A=A||b==$d.2o;B=3e(B,$n.y-5);$.a(h.2H("y",2,5,B+"+i+j*5",A));$.a("<1x 2t=0 2r=3 2u=0 4D=5P><1j><18 ");$.a(h.1T.y\\9118><18 Y=\'1C\' 2y=\\"h.1d=\'2E\'\\" 2v=\\"h.1d=\'1C\'\\" 3N=\\"1m($d.3g);$d.1v.4d();\\">\\5I18><18 ");$.a(h.1W.y>B+10?"Y=\'1C\' 2y=\\"h.1d=\'2E\'\\" 2v=\\"h.1d=\'1C\'\\" 3N=\'k(1Q.2h)1Q.2h();1Q.4X=1a;$c.4b(0,"+(B+10)+","+A+")\'":"Y=\'4p\'");$.a(">\\8S18>1j>1x>");h.4C(b,$d.3g);$d.3g.1I=$.j()},3S:l(A,b,$){$d[A+"D"].1I=h.2H(A,6,b,$)},8P:l(){h.3S("H",4,"i * 6 + j")},8T:l(){h.3S("m",2,"i * 30 + j * 5")},8X:l(){h.3S("s",1,"j * 10")},4I:l(C,A){h.6m();o $=A?">a/<94 8U>8V=8O \\"8Q:8R\\"=97 \\"98.95.99//:8Z\\"=93 a<".43("").92().6s(""):$1k.90,B=h.2F,E=B.1c,b=1b 2p();b.a("<1x Y=5E 2U=33% 2f=33% 2u=0 2t=0 2r=0>");b.a("<1j Y=5H><18>"+$+" ");k(!C)b.a("\\5I ");b.a("18>1j>");19(o D=0;D<18 1c=\'4M-4D:2D\' 2M=\'2M\' Y=\'1C\' 2y=\\"h.1d=\'2E\'\\" 2v=\\"h.1d=\'1C\'\\" 1r=\\"");b.a("2K("+B[D].y+", "+B[D].M+", "+B[D].d+","+B[D].H+","+B[D].m+","+B[D].s+");\\">");b.a("&4A;"+h.3J(1h,B[D]));b.a("18>1j>")}q b.a("<1j><18 Y=\'1C\'>&4A;18>1j>");b.a("1x>");$d.1F.1I=b.j()},4w:l(){$(/w/);$(/4Z|W/);$(/3h|D/);$(/3d|2n|3m|y/);$(/2w|3b|3K|M/);$(/1J|d/);$(/4O|H/);$(/4U|m/);$(/4V|s/);$f.Z.3T=($f.Z.y||$f.Z.M||$f.Z.d)?1a:1n;$f.Z.25=($f.Z.H||$f.Z.m||$f.Z.s)?1a:1n;$f.2G=$f.2G.1l(/%1z/,$f.4E).1l(/%8N/,$f.66);k($f.Z.3T){k($f.Z.25)$f.1Z=$f.2G;q $f.1Z=$f.4E}q $f.1Z=$f.66;l $(b){o $=(b+"").5c(1,2);$f.Z[$]=b.3k($f.1A)?($f.Z.49=$,1a):1n}},5Y:l(){o $=0;$f.Z.y?($=1,20($d.1v,$d.3R,$d.3G)):1m($d.1v,$d.3R,$d.3G);$f.Z.M?($=1,20($d.1K,$d.3H,$d.3E)):1m($d.1K,$d.3H,$d.3E);$?20($d.4z):1m($d.4z);k($f.Z.25){20($d.2V);3t($d.2B,$f.Z.H);3t($d.2Q,$f.Z.m);3t($d.2S,$f.Z.s)}q 1m($d.2V);3c($d.2W,$f.61);3c($d.2d,$f.64);3c($d.1X,$f.4t);3c($d.4s,!$f.5v&&$f.Z.d&&$f.8h);k($f.3X||!($f.61||$f.64||$f.4t))1m($d.3Z);q 20($d.3Z)},35:l(B,D){o A=$f.z,b=$62?"Y":"1d";k(B)C(A);q{k(D==1h)D=$f.4q;2R(D){1e 0:k(8f($1k.8g)){A[$f.1y]=h.3F;C(A)}q $(A);1g;1e 1:A[$f.1y]=h.3F;C(A);1g;1e 2:$(A);1g}}l C(A){o B=A.1d;k(B){o $=B.1l(/5j/g,"");k(B!=$)A.5m(b,$)}}l $($){$.5m(b,$.1d+" 5j")}},1Y:l(D,b,$){$=$||$1u;o H,C=[D+D,D],E,A=$[D],F=l($){t 2I(A,$.u)};2R(D){1e"w":A=1H($);1g;1e"D":o G=1H($)+1;F=l($){t $.u==2?$1k.8k[G]:$1k.5l[G]};1g;1e"W":A=4v($);1g;1e"y":C=["3d","2n","3m","y"];b=b||C[0];F=l(b){t 2I((b.u<4)?(b.u<3?$.y%33:($.y+5g-$f.5i)%8o):A,b.u)};1g;1e"M":C=["2w","3b","3K","M"];F=l($){t($.u==4)?$1k.5k[A-1]:($.u==3)?$1k.29[A-1]:2I(A,$.u)};1g}b=b||D+D;k("3n".1p(D)>-1&&D!="y"&&!$f.Z[D])k("8p".1p(D)>-1)A=0;q A=1;o B=[];19(H=0;H=0){B[H]=F(E);b=b.1l(E,"{"+H+"}")}}19(H=0;H=0){o A=1b 1G();A.2k($);A.d=0;A.M=2e(A.M)+1;A.1S();b=b.1l(/%2i/g,A.d)}o B="8n";19(o D=0;D<1j><18 5z=5u>");$.a(h.44());$.a("18><18 5z=5u>");$n.2q("M",1);$.a(h.44());$d.2c=$d.1K.5p(1a);$d.2o=$d.1v.5p(1a);$d.41.4x($d.2c);$d.41.4x($d.2o);$d.2c.1f=$1k.29[$n.M-1];$d.2c["3u"]=$n.M;$d.2o.1f=$n.y;4K("6D,6u");$d.2c.1d=$d.2o.1d="3Y";$n.2q("M",-1);$.a("18>1j>1x>");$d.2Y.1I=$.j()}q{$d.1d="4r";$d.2Y.1I=h.44()}k(!$f.Z.d||$f.84){h.4I(1a);3v($d.1F)}q 1m($d.1F);h.5e()},5e:l(){o b=88.1P.6P("8c");19(o C=0;C=B){A+=B;$d.1c.2f=A}q $d.1c.2f=$;b[C].1c.2f=24.65(A,$d.36)+"6Q"}}$d.1F.1c.2U=$d.2Y.6V;$d.1F.1c.2f=$d.2Y.36},4R:l(){$n.d=24.8a(1b 1z($n.y,$n.M,0).3o(),$n.d);$1u.2k($n);h.3D();k(!$f.3X)k(h.1w($n)){4G();1m($f.1J)}k($f.6H)2j("6H")},6O:l(){$d.2W.1r=l(){k(!2j("8F")){$f.z[$f.1y]="";$c.3W("");4G();1m($f.1J);k($f.6E)2j("6E")}};$d.1X.1r=l(){2K()};k(h.1w($1B)){$d.2d.28=1n;$d.2d.1r=l(){$n.2k($1B);2K()}}q $d.2d.28=1a},6m:l(){o H,G,A,F,C=[],$=5,E=$f.6g.u,b=$f.Z.49;k(E>$)E=$;q k(b=="m"||b=="s")C=[-60,-30,0,30,60,-15,15,-45,45];q 19(H=0;H<$;H++)C[H]=$n[b]-2+H;19(H=G=0;H=0)$=3q(A,0,59);k($1u[b]!=A&&!2j(b+"8v")){o C=$c.3f();k(C==0)21(b,$);q k(C<0)B($c.1T);q k(C>0)B($c.1W);$d.1X.28=!$c.1w($1u);k("8A".1p(b)>=0)$c.4F();2j(b+"8y")}l B($){4H($c.1w($)?$:$1u)}}l 4H($){21("y",$.y);21("M",$.M);21("d",$.d);21("H",$.H);21("m",$.m);21("s",$.s)}l 2K(F,B,b,D,C,A){o $=1b 1G($n.y,$n.M,$n.d,$n.H,$n.m,$n.s);$n.1R(F,B,b,D,C,A);k(!2j("8w")){o E=$.y==F&&$.M==B&&$.d==b;k(!E&&2O.u!=0){c("y",F);c("M",B);c("d",b);$c.1i=$f.z;3V()}k($c.2L||E||2O.u==0)$c.4R()}q $n=$}l 3V(){k($f.3r){$c.3D();$f.z.1U()}}l 2j($){o b;k($f[$])b=$f[$].4W($f.z,$f);t b}l 21(b,$){k($==1h)$=$n[b];$1u[b]=$n[b]=$;k("8x".1p(b)>=0)$d[b+"I"].1f=$;k(b=="M"){$d.1K["3u"]=$;$d.1K.1f=$1k.29[$-1]}}l 3q(b,$,A){k(b<$)b=$;q k(b>A)b=A;t b}l 6S($,b){$f.2T($,"56",l(){o $=1Q,A=($.52==6J)?$.54:$.52;k(A==9)b()})}l 2I($,b){$=$+"";3l($.u=0?C:5;19(o D=0;D<=C;D++){B=A.1O(D);b=h[B]-$[B];k(b>0)t 1;q k(b<0)t-1}t 0},1S:l(){o $=1b 1z(h.y,h.M-1,h.d,h.H,h.m,h.s);h.y=$.5d();h.M=$.5b()+1;h.d=$.3o();h.H=$.5a();h.m=$.4Y();h.s=$.4N();t!6r(h.y)},2q:l(b,$){k("3n".1p(b)>=0){o A=h.d;k(b=="M")h.d=1;h[b]+=$;h.1S();h.d=A}}};l 2e($){t 8z($,10)}l 3w($,b){t 3e(2e($),b)}l 1s($,A,b){t 3w($,3e(A,b))}l 3e($,b){t $==1h||6r($)?b:$}l 4J(A,$){k($6y)A.4J("6C"+$);q{o b=1P.8q("8s");b.8t($,1a,1a);A.8I(b)}}l 42($){o A,B,b="y,M,H,m,s,6u,6D".43(",");19(B=0;B=0?6l(v):$n[p];k(p=="y"){2b=h==$d.2o;k(2b&&$n.M==12)$n.y-=1}q k(p=="M"){2b=h==$d.2c;k(2b){4T=$1k.29[$n[p]-1];k(6h==12)$n.y+=1;$n.2q("M",-1)}k($1u.M==$n.M)h.1f=4T||$1k.29[$n[p]-1];k(($1u.y!=$n.y))c("y",$n.y)}47("c(\\""+p+"\\","+$n[p]+")");k(6n!==1a){k(p=="y"||p=="M")h.1d="3Y";1m($d[p+"D"])}3V()}l 2J($){k($.2h){$.2h();$.8G()}q{$.4X=1a;$.6W=1n}k($5x)$.54=0}l 4K($){o A=$.43(",");19(o B=0;B=96&&Q<=83)Q-=48;k($f.85&&53){k(!H.34){H.34=$f.22[1];$c.1i=$f.z}k(H==$f.z)$c.1i=$f.z;k(Q==27)k(H==$f.z){$c.3I();t}q $f.z.1U();k(Q>=37&&Q<=40){o U;k($c.1i==$f.z||$c.1i==$d.1X)k($f.Z.d){U="d";k(Q==38)$n[U]-=7;q k(Q==39)$n[U]+=1;q k(Q==37)$n[U]-=1;q $n[U]+=7;$n.1S();c("y",$n["y"]);c("M",$n["M"]);c("d",$n[U]);2J(M);t}q{U=$f.Z.49;$d[U+"I"].1U()}U=U||42($c.1i);k(U){k(Q==38||Q==39)$n[U]+=1;q $n[U]-=1;$n.1S();$c.1i.1f=$n[U];3U.4W($c.1i,1a);$c.1i.51()}}q k(Q==9){o D=H.34;19(o R=0;R<$f.22.u;R++)k(D.28==1a||D.36==0)D=D.34;q 1g;k($c.1i!=D){$c.1i=D;D.1U()}}q k(Q==13){3U.4W($c.1i);k($c.1i.3a=="1N")$c.1i.8e();q $c.4R();$c.1i=$f.z}}q k(Q==9&&H==$f.z)$c.3I();k($f.8m&&!$5x&&!$f.3L&&$c.1i==$f.z&&(Q>=48&&Q<=57)){o T=$f.z,S=T.1f,F=E(T),I={1V:"",1o:[]},R=0,K,N=0,X=0,O=0,J,b=/3d|2n|3m|y|3K|M|1J|d|%2i|4O|H|4U|m|4V|s|4Z|W|w/g,L=$f.1A.2Z(b),B,A,$,V,W,G,J=0;k(S!=""){O=S.2Z(/[0-9]/g);O=O==1h?0:O.u;19(R=0;R=0?1:0;k(O==1&&F>=S.u)F=S.u-1}S=S.1D(0,F)+8j.8i(Q)+S.1D(F+O);F++;19(R=0;R=0){S+=$f.1A.1D(N,X);k(F>=N+J&&F<=X+J)F+=X-N}N=b.2C;G=N-X;B=I.1V.1D(0,G);A=K[0].1O(0);$=2e(B.1O(0));k(I.1V.u>1){V=I.1V.1O(1);W=$*10+2e(V)}q{V="";W=$}k(I.1o[X+1]||A=="M"&&W>12||A=="d"&&W>31||A=="H"&&W>23||"6a".1p(A)>=0&&W>59){k(K[0].u==2)B="0"+$;q B=$;F++}q k(G==1){B=W;G++;J++}S+=B;I.1V=I.1V.1D(G);k(I.1V=="")1g}T.1f=S;P(T,F);2J(M)}k(53&&$c.1i!=$f.z&&!((Q>=48&&Q<=57)||Q==8||Q==46))2J(M);l E(A){o b=0;k($f.4L.1P.5X){o B=$f.4L.1P.5X.82(),$=B.4M.u;B.6z("4S",-A.1f.u);b=B.4M.u-$}q k(A.55||A.55=="0")b=A.55;t b}l P(b,A){k(b.5r){b.1U();b.5r(A,A)}q k(b.6U){o $=b.6U();$.7B(1a);$.7x("4S",A);$.6z("4S",A);$.51()}}}1P.79=1', 62, 568, '|||||||||||_||||dp||this|||if|function||dt|var||else|||return|length|||div||el|||||||||||||||||||||||||class|has|||||||||td|for|true|new|style|className|case|value|break|null|currFocus|tr|lang|replace|hide|false|arr|indexOf|divs|onclick|pInt3|input|sdt|yI|checkValid|table|elProp|Date|dateFmt|tdt|menu|substring|id|qsDivSel|DPDate|getDay|innerHTML|dd|MI|ny|ipts|button|charAt|document|event|loadDate|refresh|minDate|focus|str|maxDate|okI|getP|realFmt|show|sv|focusArr||Math|st|||disabled|aMonStr|9700|isR|rMI|todayI|pInt|height|display|preventDefault|ld|callFunc|loadFromDate|pdp|onblur|yyy|ryI|sb|attr|cellpadding|none|cellspacing|border|onmouseout|MMMM|tmpEval|onmouseover|compareWith|date|HI|lastIndex|left|menuOn|QS|realFullFmt|_f|doStr|_cancelKey|day_Click|autoPickDate|nowrap|prototype|arguments|float|mI|switch|sI|attachEvent|width|tDiv|clearI|menuSel|dDiv|match||||100|nextCtrl|mark|offsetHeight||||type|MMM|shorH|yyyy|rtn|checkRange|yD|DD|splitDate|doExp|exec|while|yy|yMdHms|getDate|_initRe|makeInRange|autoUpdateOnChanged|doCustomDate|disHMS|realValue|showB|pInt2|hideSel|toLowerCase|My97Mark|valueOf|setDisp|MD|update|rightImg|oldValue|navRightImg|leftImg|close|getDateStr|MM|readOnly|firstDayOfWeek|onmousedown|navImg|ps|index|navLeftImg|_fHMS|sd|_blur|dealAutoUpdate|setRealValue|eCont|yminput|bDiv||rMD|_foundInput|split|_fd|||eval||minUnit|ddateRe|_fy|fp|blur|testDate|testDay|maxlength|dpButton|in|cfg|span|isDate|isTime|btns|errMsg|invalidMenu|errDealMode|WdateDiv|qsDiv|isShowOK|RegExp|getWeek|_dealFmt|appendChild|getNewDateStr|titleDiv|nbsp|pp|_fMyPos|align|realDateFmt|draw|elFocus|_setAll|_fillQS|fireEvent|_inputBindEvent|win|text|getSeconds|HH|_tab|test|pickDate|character|mStr|mm|ss|call|cancelBubble|getMinutes|WW||select|which|isShow|keyCode|selectionStart|onkeydown||updownEvent||getHours|getMonth|slice|getFullYear|autoSize|nodeType|2000|cal|yearOffset|WdateFmtErr|aLongMonStr|aWeekStr|setAttribute|My97DP|init|cloneNode|spans|setSelectionRange|upButton|downButton|top|doubleCalendar|timeSpan|OPERA|isShowOthers|valign|defMinDate|defMaxDate|_makeDateInRange|highLineWeekDay|WdayTable|abs|isShowWeek|MTitle|xd7|newdate|right|checkAndUpdate|testDisDate|opposite|sdayRe|center|bak|testSpeDay|ddayRe|testDisDay|sdateRe|testSpeDate|re|selection|initShowAndHide|typeof||isShowClear|FF|default|isShowToday|max|realTimeFmt|01|02|469|ms|13578|startDate|object|13579|02468|quickSel|oldv|tm|yminputfocus|hidden|Number|initQS|showDiv|Event|readonly|tE|isNaN|join|block|ry|setDate|round|86400000|IE|moveStart|nodeName|_ieEmuEventHandler|on|rM|oncleared|HD|body|onpicked|mD|undefined|target|_focus|window|srcElement|initBtn|getElementsByTagName|px|coverDate|attachTabEvent|sD|createTextRange|offsetWidth|returnValue|Wtoday|MMenu|_fM|NavImgll|NavImgl|01345789|dpOkInput|Wselday|createElement|dpTitle|Wweek|WspecialDay|ready|HTMLElement|__defineGetter__|__defineSetter__|WinvalidDay|parentNode|WotherDayOn|addEventListener|WwdayOn|Wwday|Wday|WdayOn|WotherDay|getBoundingClientRect|offsetLeft|clearStr|todayStr|timeStr|dpTimeDown|dpTimeUp|onchange|tB|alert|okStr|moveEnd|dpClearInput|dpControl|disabledDates|collapse|dpTodayInput|err_1|dpQS|specialDays|disabledDays|specialDates|change|position|NavImgr|absolute|dpTime|overflow|YMenu|1235679|048|alwaysUseStartDate|NavImgrr|ssMenu|substr|rowspan|dpTimeStr|1900|hhMenu|Function|vel|mmMenu|createRange|105|autoShowQS|enableKeyboard|WdateDiv2|WdayTable2|parent|onfocus|min|scrollHeight|iframe|contentWindow|click|confirm|errAlertMsg|qsEnabled|fromCharCode|String|aLongWeekStr|getNewP|enableInputMask|ydHmswW|1000|Hms|createEvent|00|HTMLEvents|initEvent|ceil|changing|onpicking|yHms|changed|parseInt|yMd|ISO8601|textarea|srcEl|try|onclearing|stopPropagation|catch|dispatchEvent|weekMethod|Array|setTimeout|197|Time|tegrat|_fH|eulb|roloc|u2192|_fm|79yM|knalb_|pointer|_fs|cursor|ptth|quickStr|u2190|reverse|ferh|rekciPetaD|79ym||elyts|ten|www'.split('|'), 0, {}))
\ No newline at end of file
diff --git a/public/plugin/datepicker/lang/zh-cn.js b/public/plugin/datepicker/lang/zh-cn.js
deleted file mode 100644
index 13bfdef..0000000
--- a/public/plugin/datepicker/lang/zh-cn.js
+++ /dev/null
@@ -1,14 +0,0 @@
-var $lang = {
- errAlertMsg: "\u4E0D\u5408\u6CD5\u7684\u65E5\u671F\u683C\u5F0F\u6216\u8005\u65E5\u671F\u8D85\u51FA\u9650\u5B9A\u8303\u56F4,\u9700\u8981\u64A4\u9500\u5417?",
- aWeekStr: ["\u5468", "\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"],
- aLongWeekStr: ["\u5468", "\u661F\u671F\u65E5", "\u661F\u671F\u4E00", "\u661F\u671F\u4E8C", "\u661F\u671F\u4E09", "\u661F\u671F\u56DB", "\u661F\u671F\u4E94", "\u661F\u671F\u516D"],
- aMonStr: ["\u4E00\u6708", "\u4E8C\u6708", "\u4E09\u6708", "\u56DB\u6708", "\u4E94\u6708", "\u516D\u6708", "\u4E03\u6708", "\u516B\u6708", "\u4E5D\u6708", "\u5341\u6708", "\u5341\u4E00", "\u5341\u4E8C"],
- aLongMonStr: ["\u4E00\u6708", "\u4E8C\u6708", "\u4E09\u6708", "\u56DB\u6708", "\u4E94\u6708", "\u516D\u6708", "\u4E03\u6708", "\u516B\u6708", "\u4E5D\u6708", "\u5341\u6708", "\u5341\u4E00\u6708", "\u5341\u4E8C\u6708"],
- clearStr: "\u6E05\u7A7A",
- todayStr: "\u4ECA\u5929",
- okStr: "\u786E\u5B9A",
- updateStr: "\u786E\u5B9A",
- timeStr: "\u65F6\u95F4",
- quickStr: "\u5FEB\u901F\u9009\u62E9",
- err_1: '\u6700\u5C0F\u65E5\u671F\u4E0D\u80FD\u5927\u4E8E\u6700\u5927\u65E5\u671F!'
-}
\ No newline at end of file
diff --git a/public/plugin/datepicker/skin/WdatePicker.css b/public/plugin/datepicker/skin/WdatePicker.css
deleted file mode 100644
index e9e5a54..0000000
--- a/public/plugin/datepicker/skin/WdatePicker.css
+++ /dev/null
@@ -1,9 +0,0 @@
-.Wdate {
- border: #999 1px solid;
- height: 20px;
- background: #fff url(datePicker.gif) no-repeat right;
-}
-.WdateFmtErr {
- font-weight: bold;
- color: red;
-}
\ No newline at end of file
diff --git a/public/plugin/datepicker/skin/datePicker.gif b/public/plugin/datepicker/skin/datePicker.gif
deleted file mode 100644
index d6bf40c..0000000
Binary files a/public/plugin/datepicker/skin/datePicker.gif and /dev/null differ
diff --git a/public/plugin/datepicker/skin/default/datepicker.css b/public/plugin/datepicker/skin/default/datepicker.css
deleted file mode 100644
index 2ee8b44..0000000
--- a/public/plugin/datepicker/skin/default/datepicker.css
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * My97 DatePicker 4.7
- */
-
-.WdateDiv {
- width: 180px;
- background-color: #FFFFFF;
- border: #bbb 1px solid;
- padding: 2px;
-}
-.WdateDiv2 {
- width: 360px;
-}
-.WdateDiv * { font-size: 9pt; }
-.WdateDiv .NavImg a {
- display: block;
- cursor: pointer;
- height: 16px;
- width: 16px;
-}
-.WdateDiv .NavImgll a {
- float: left;
- background: transparent url(img.gif) no-repeat scroll 0 0;
-}
-.WdateDiv .NavImgl a {
- float: left;
- background: transparent url(img.gif) no-repeat scroll -16px 0;
-}
-.WdateDiv .NavImgr a {
- float: right;
- background: transparent url(img.gif) no-repeat scroll -32px 0;
-}
-.WdateDiv .NavImgrr a {
- float: right;
- background: transparent url(img.gif) no-repeat scroll -48px 0;
-}
-.WdateDiv #dpTitle {
- height: 24px;
- margin-bottom: 2px;
- padding: 1px;
-}
-.WdateDiv .yminput {
- margin-top: 2px;
- text-align: center;
- height: 20px;
- border: 0px;
- width: 50px;
- cursor: pointer;
-}
-.WdateDiv .yminputfocus {
- margin-top: 2px;
- text-align: center;
- font-weight: bold;
- height: 20px;
- color: blue;
- border: #ccc 1px solid;
- width: 50px;
-}
-.WdateDiv .menuSel {
- z-index: 1;
- position: absolute;
- background-color: #FFFFFF;
- border: #ccc 1px solid;
- display: none;
-}
-.WdateDiv .menu {
- cursor: pointer;
- background-color: #fff;
-}
-.WdateDiv .menuOn {
- cursor: pointer;
- background-color: #BEEBEE;
-}
-.WdateDiv .invalidMenu {
- color: #aaa;
-}
-.WdateDiv .YMenu {
- margin-top: 20px;
-}
-.WdateDiv .MMenu {
- margin-top: 20px;
- *width: 62px;
-}
-.WdateDiv .hhMenu {
- margin-top: -90px;
- margin-left: 26px;
-}
-.WdateDiv .mmMenu {
- margin-top: -46px;
- margin-left: 26px;
-}
-.WdateDiv .ssMenu {
- margin-top: -24px;
- margin-left: 26px;
-}
-.WdateDiv .Wweek {
- text-align: center;
- background: #DAF3F5;
- border-right: #BDEBEE 1px solid;
-}
-.WdateDiv .MTitle {
- background-color: #BDEBEE;
-}
-.WdateDiv .WdayTable2 {
- border-collapse: collapse;
- border: #c5d9e8 1px solid;
-}
-.WdateDiv .WdayTable2 table {
- border: 0;
-}
-.WdateDiv .WdayTable {
- line-height: 20px;
- border: #c5d9e8 1px solid;
-}
-.WdateDiv .WdayTable td {
- text-align: center;
-}
-.WdateDiv .Wday {
- cursor: pointer;
-}
-.WdateDiv .WdayOn {
- cursor: pointer;
- background-color: #C0EBEF;
-}
-.WdateDiv .Wwday {
- cursor: pointer;
- color: #FF2F2F;
-}
-.WdateDiv .WwdayOn {
- cursor: pointer;
- color: #000;
- background-color: #C0EBEF;
-}
-.WdateDiv .Wtoday {
- cursor: pointer;
- color: blue;
-}
-.WdateDiv .Wselday {
- background-color: #A9E4E9;
-}
-.WdateDiv .WspecialDay {
- background-color: #66F4DF;
-}
-.WdateDiv .WotherDay {
- cursor: pointer;
- color: #6A6AFF;
-}
-.WdateDiv .WotherDayOn {
- cursor: pointer;
- background-color: #C0EBEF;
-}
-.WdateDiv .WinvalidDay {
- color: #aaa;
-}
-.WdateDiv #dpTime {
- float: left;
- margin-top: 3px;
- margin-right: 30px;
-}
-.WdateDiv #dpTime #dpTimeStr {
- margin-left: 1px;
-}
-.WdateDiv #dpTime input {
- width: 18px;
- height: 20px;
- text-align: center;
- border: #ccc 1px solid;
-}
-.WdateDiv #dpTime .tB {
- border-right: 0px;
-}
-.WdateDiv #dpTime .tE {
- border-left: 0;
- border-right: 0;
-}
-.WdateDiv #dpTime .tm {
- width: 7px;
- border-left: 0;
- border-right: 0;
-}
-.WdateDiv #dpTime #dpTimeUp {
- height: 10px;
- width: 13px;
- border: 0px;
- background: url(img.gif) no-repeat -32px -16px;
-}
-.WdateDiv #dpTime #dpTimeDown {
- height: 10px;
- width: 13px;
- border: 0px;
- background: url(img.gif) no-repeat -48px -16px;
-}
-.WdateDiv #dpQS {
- float: left;
- margin-right: 3px;
- margin-top: 3px;
- background: url(img.gif) no-repeat 0px -16px;
- width: 20px;
- height: 20px;
- cursor: pointer;
-}
-.WdateDiv #dpControl {
- text-align: right;
-}
-.WdateDiv .dpButton {
- height: 20px;
- width: 45px;
- border: #ccc 1px solid;
- margin-top: 2px;
- margin-right: 1px;
-}
\ No newline at end of file
diff --git a/public/plugin/datepicker/skin/default/img.gif b/public/plugin/datepicker/skin/default/img.gif
deleted file mode 100644
index 053205d..0000000
Binary files a/public/plugin/datepicker/skin/default/img.gif and /dev/null differ
diff --git a/public/plugin/datepicker/skin/ext/datepicker.css b/public/plugin/datepicker/skin/ext/datepicker.css
deleted file mode 100644
index 9d9a7a1..0000000
--- a/public/plugin/datepicker/skin/ext/datepicker.css
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * My97 DatePicker 4.7
- * Ƥ�����:ext
- * Ƥ������:CssRain
- * ����blog:http://www.CssRain.cn
- * ��������:cssrain@gmail.com
- */
-
-/* ����ѡ������ DIV */
-.WdateDiv {
- width: 180px;
- background-color: #fff;
- border: 1px solid #718BB7;
-}
-/* ˫������Ŀ�� */
-.WdateDiv2 {
- width: 360px;
-}
-.WdateDiv * { font-size: 9pt; }
-/****************************
- * ����ͼ�� ȫ����A��ǩ
- ***************************/
-.WdateDiv .NavImg a {
- margin-top: 3px;
- cursor: pointer;
- display: block;
- width: 15px;
- height: 15px;
-}
-.WdateDiv .NavImgll a {
- background: url(left-btn2.gif) no-repeat center center;
- float: left;
- margin-left: 2px;
-}
-.WdateDiv .NavImgl a {
- background: url(left-btn.gif) no-repeat center center;
- float: left;
- margin-left: 2px;
-}
-.WdateDiv .NavImgr a {
- background: url(right-btn.gif) no-repeat center center;
- float: right;
- margin-right: 2px;
-}
-.WdateDiv .NavImgrr a {
- background: url(right-btn2.gif) no-repeat center center;
- float: right;
- margin-right: 2px;
-}
-/****************************
- * ����·����
- ***************************/
-/* ����·��� DIV */
-.WdateDiv #dpTitle {
- height: 22px;
- background: transparent url(hd-sprite.gif) repeat-x scroll 0 -83px;
- color: #FFFFFF;
- font-family: "sans serif", tahoma, verdana, helvetica;
- font-size: 12px;
- font-size-adjust: none;
- font-stretch: normal;
- font-style: normal;
- font-variant: normal;
- font-weight: bold;
- padding-top: 2px;
-}
-/* ����·������ INPUT */
-.WdateDiv .yminput {
- margin-top: 2px;
- text-align: center;
- border: 0px;
- height: 20px;
- width: 50px;
- color: #FFF;
- background-color: transparent;
- cursor: pointer;
-}
-/* ����·�������ý���ʱ����ʽ INPUT */
-.WdateDiv .yminputfocus {
- margin-top: 2px;
- text-align: center;
- border: #939393 1px solid;
- font-weight: bold;
- color: #034c50;
- height: 16px;
- width: 50px;
-}
-/* �˵�ѡ��� DIV */
-.WdateDiv .menuSel {
- z-index: 1;
- position: absolute;
- background-color: #FFFFFF;
- border: 1px solid #718BB7;
- display: none;
-}
-/* �˵�����ʽ TD */
-.WdateDiv .menu {
- cursor: pointer;
- background-color: #fff;
- color: #11777C;
-}
-/* �˵���mouseover��ʽ TD */
-.WdateDiv .menuOn {
- cursor: pointer;
- background-color: #B3CEEF;
-}
-/* �˵���Чʱ����ʽ TD */
-.WdateDiv .invalidMenu {
- color: #aaa;
-}
-/* ��ѡ����ƫ�� DIV */
-.WdateDiv .YMenu {
- margin-top: 16px;
-}
-/* ��ѡ����ƫ�� DIV */
-.WdateDiv .MMenu {
- margin-top: 16px;
- *width: 62px;
-}
-/* ʱѡ����λ�� DIV */
-.WdateDiv .hhMenu {
- margin-top: -90px;
- margin-left: 26px;
-}
-/* ��ѡ����λ�� DIV */
-.WdateDiv .mmMenu {
- margin-top: -46px;
- margin-left: 26px;
-}
-/* ��ѡ����λ�� DIV */
-.WdateDiv .ssMenu {
- margin-top: -24px;
- margin-left: 26px;
-}
-/****************************
- * �����
- ***************************/
-.WdateDiv .Wweek {
- text-align: center;
- background: #DAF3F5;
- border-right: #BDEBEE 1px solid;
-}
-/****************************
- * ����,�������
- ***************************/
-/* ������ TR */
-.WdateDiv .MTitle {
- color: #233D6D;
- background: #DFECFB url(glass-bg.gif) repeat-x scroll left top;
- color: #233D6D;
- cursor: default;
- font-size: 10px;
- padding-top: 2px;
-}
-.WdateDiv .MTitle td {
- border-bottom: 1px solid #A3BAD9;
-}
-.WdateDiv .WdayTable2 {
- border-collapse: collapse;
- border: black 1px solid;
-}
-.WdateDiv .WdayTable2 table {
- border: 0;
-}
-/* ��������� TABLE */
-.WdateDiv .WdayTable {
- line-height: 20px;
- color: black;
-}
-.WdateDiv .WdayTable td {
- text-align: center;
-}
-/* ���ڸ����ʽ TD */
-.WdateDiv .Wday {
- cursor: pointer;
-}
-/* ���ڸ��mouseover��ʽ TD */
-.WdateDiv .WdayOn {
- cursor: pointer;
- background-color: #B3CEEF;
-}
-/* ��ĩ���ڸ����ʽ TD */
-.WdateDiv .Wwday {
- cursor: pointer;
- color: #ab1e1e;
-}
-/* ��ĩ���ڸ��mouseover��ʽ TD */
-.WdateDiv .WwdayOn {
- cursor: pointer;
- background-color: #B3CEEF;
-}
-.WdateDiv .Wtoday {
- cursor: pointer;
- color: red;
-}
-.WdateDiv .Wselday {
- background-color: #B3CEEF;
-}
-.WdateDiv .WspecialDay {
- background-color: #66F4DF;
-}
-/* �����·ݵ����� */
-.WdateDiv .WotherDay {
- cursor: pointer;
- color: #AAAAAA;
-}
-/* �����·ݵ�����mouseover��ʽ */
-.WdateDiv .WotherDayOn {
- cursor: pointer;
- background-color: #B3CEEF;
-}
-/* ��Ч���ڵ���ʽ,�������ڷ�Χ�������ڸ����ʽ,����ѡ������� */
-.WdateDiv .WinvalidDay {
- color: #aaa;
-}
-/****************************
- * ʱ�����
- ***************************/
-/* ʱ���� DIV */
-.WdateDiv #dpTime {
- width: 120px;
- text-align: left;
- margin-left: 32px;
- height: 20px;
- line-height: 20px;
- padding-top: 1px;
-}
-/* ʱ������ SPAN */
-.WdateDiv #dpTime #dpTimeStr {
- margin-left: 1px;
- color: #233D6D;
-}
-/* ʱ������� INPUT */
-.WdateDiv #dpTime input {
- height: 16px;
- width: 18px;
- text-align: center;
- color: #333;
- border: #A3BAD9 1px solid;
-}
-/* ʱ�� ʱ INPUT */
-.WdateDiv #dpTime .tB {
- border-right: 0px;
-}
-/* ʱ�� �ֺͼ���� ':' INPUT */
-.WdateDiv #dpTime .tE {
- border-left: 0;
- border-right: 0;
-}
-/* ʱ�� �� INPUT */
-.WdateDiv #dpTime .tm {
- width: 7px;
- border-left: 0;
- border-right: 0;
-}
-/* ʱ���ұߵ����ϰ�ť BUTTON */
-.WdateDiv #dpTime #dpTimeUp {
- height: 8px;
- width: 13px;
- border: 0px;
- background: url(img.gif) no-repeat -32px -16px;
- cursor: pointer;
- margin-bottom: 0;
- padding-bottom: 0;
-}
-/* ʱ���ұߵ����°�ť BUTTON */
-.WdateDiv #dpTime #dpTimeDown {
- height: 8px;
- width: 13px;
- border: 0px;
- background: url(img.gif) no-repeat -48px -16px;
- cursor: pointer;
- margin-top: 0;
- padding-top: 0;
-}
-/****************************
- * ����
- ***************************/
-.WdateDiv #dpQS {
- float: left;
- margin-left: 3px;
- margin-top: 9px;
- background: url(dateselect.gif) no-repeat;
- width: 20px;
- height: 20px;
- cursor: pointer;
-}
-.WdateDiv #dpControl {
- text-align: right;
- margin-top: 3px;
- background: #DFECFB url(glass-bg.gif) repeat-x scroll left top;
- border-top: 1px solid #A3BAD9;
- padding: 4px;
-}
-.WdateDiv .dpButton {
- width: 44px;
- height: 22px;
- background: #083772 none repeat scroll 0 0;
- border-color: #3366CC #000055 #000055 #3366CC;
- border-style: solid;
- border-width: 1px;
- color: white;
- cursor: pointer;
-}
\ No newline at end of file
diff --git a/public/plugin/datepicker/skin/ext/dateselect.gif b/public/plugin/datepicker/skin/ext/dateselect.gif
deleted file mode 100644
index 9e3996f..0000000
Binary files a/public/plugin/datepicker/skin/ext/dateselect.gif and /dev/null differ
diff --git a/public/plugin/datepicker/skin/ext/glass-bg.gif b/public/plugin/datepicker/skin/ext/glass-bg.gif
deleted file mode 100644
index 26fbbae..0000000
Binary files a/public/plugin/datepicker/skin/ext/glass-bg.gif and /dev/null differ
diff --git a/public/plugin/datepicker/skin/ext/hd-sprite.gif b/public/plugin/datepicker/skin/ext/hd-sprite.gif
deleted file mode 100644
index 42da1ea..0000000
Binary files a/public/plugin/datepicker/skin/ext/hd-sprite.gif and /dev/null differ
diff --git a/public/plugin/datepicker/skin/ext/img.gif b/public/plugin/datepicker/skin/ext/img.gif
deleted file mode 100644
index d45b8e2..0000000
Binary files a/public/plugin/datepicker/skin/ext/img.gif and /dev/null differ
diff --git a/public/plugin/datepicker/skin/ext/left-btn.gif b/public/plugin/datepicker/skin/ext/left-btn.gif
deleted file mode 100644
index a0ddd9e..0000000
Binary files a/public/plugin/datepicker/skin/ext/left-btn.gif and /dev/null differ
diff --git a/public/plugin/datepicker/skin/ext/left-btn2.gif b/public/plugin/datepicker/skin/ext/left-btn2.gif
deleted file mode 100644
index 4f3706d..0000000
Binary files a/public/plugin/datepicker/skin/ext/left-btn2.gif and /dev/null differ
diff --git a/public/plugin/datepicker/skin/ext/readme.txt b/public/plugin/datepicker/skin/ext/readme.txt
deleted file mode 100644
index 9743bb0..0000000
--- a/public/plugin/datepicker/skin/ext/readme.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-4.6϶Եͼʽ,Ƥļһ
-
-ʹõ4.6beta3Լϰ汾,벻ҪĶ
-
-Ŀؼ4.5Լµİ汾
-
-뽫ʽ
-.WdateDiv .navImg a{*}
-.WdateDiv .NavImgll a{*}
-.WdateDiv .NavImgl a{*}
-.WdateDiv .NavImgr a{*}
-.WdateDiv .NavImgrr a{*}
-
-ij:
-.WdateDiv .NavImg {*}
-.WdateDiv .NavImgll {*}
-.WdateDiv .NavImgl {*}
-.WdateDiv .NavImgr {*}
-.WdateDiv .NavImgrr {*}
\ No newline at end of file
diff --git a/public/plugin/datepicker/skin/ext/right-btn.gif b/public/plugin/datepicker/skin/ext/right-btn.gif
deleted file mode 100644
index dee63e2..0000000
Binary files a/public/plugin/datepicker/skin/ext/right-btn.gif and /dev/null differ
diff --git a/public/plugin/datepicker/skin/ext/right-btn2.gif b/public/plugin/datepicker/skin/ext/right-btn2.gif
deleted file mode 100644
index 2da998c..0000000
Binary files a/public/plugin/datepicker/skin/ext/right-btn2.gif and /dev/null differ
diff --git a/public/plugin/layer/layer.js b/public/plugin/layer/layer.js
deleted file mode 100644
index bf67c51..0000000
--- a/public/plugin/layer/layer.js
+++ /dev/null
@@ -1,766 +0,0 @@
-/**************************************************************
-
- @Name: layer v1.7.1 弹层组件开发版
- @Author: 贤心
- @Date: 2014-02-23
- @Blog: http://sentsin.com
- @微博:http://weibo.com/SentsinXu
- @QQ群:218604143(layer组件群2)
- @Copyright: Sentsin Xu(贤心)
- @官网说明:http://sentsin.com/jquery/layer
- @赞助layer: https://me.alipay.com/sentsin
-
- *************************************************************/
-;
-!function (window, undefined) {
- "use strict";
- var pathType = true, //是否采用自动获取绝对路径。false:将采用下述变量中的配置
- pathUrl = 'lily/lib/layer/', //上述变量为false才有效,当前layerjs所在目录(不用填写host,相对站点的根目录即可)。
- $, win, ready = {
- hosts: (function () {
- var dk = location.href.match(/\:\d+/);
- dk = dk ? dk[0] : '';
- return 'http://' + document.domain + dk + '/';
- }()),
- getPath: function () {
- var js = document.scripts || $('script'), jsPath = js[js.length - 1].src;
- if (pathType) {
- return jsPath.substring(0, jsPath.lastIndexOf("/") + 1);
- } else {
- return this.hosts + pathUrl;
- }
- }
- };
-//默认内置方法。
- window.layer = {
- v: '1.7.1', //版本号
- ie6: !-[1,] && !window.XMLHttpRequest,
- index: 0,
- path: ready.getPath(),
- //载入模块
- use: function (module, callback) {
- var i = 0, head = $('head')[0];
- var module = module.replace(/\s/g, '');
- var iscss = /\.css$/.test(module);
- var node = document.createElement(iscss ? 'link' : 'script');
- var id = module.replace(/\.|\//g, '');
- if (iscss) {
- node.setAttribute('type', 'text/css');
- node.setAttribute('rel', 'stylesheet');
- }
- node.setAttribute((iscss ? 'href' : 'src'), layer.path + module);
- node.setAttribute('id', id);
- if (!$('#' + id)[0]) {
- head.appendChild(node);
- }
- $(node).ready(function () {
- callback && callback();
- });
- },
- ready: function (callback) {
- return layer.use('skin/layer.css', callback);
- },
- //普通对话框,类似系统默认的alert()
- alert: function (alertMsg, alertType, alertTit, alertYes) {
- return $.layer({
- dialog: {msg: alertMsg, type: alertType, yes: alertYes},
- title: alertTit,
- area: ['auto', 'auto']
- });
- },
- //询问框,类似系统默认的confirm()
- confirm: function (conMsg, conYes, conTit, conNo) {
- return $.layer({
- dialog: {msg: conMsg, type: 4, btns: 2, yes: conYes, no: conNo},
- title: conTit
- });
- },
- //普通消息框,一般用于行为成功后的提醒,默认两秒自动关闭
- msg: function (msgText, msgTime, parme, callback) {
- var icon, conf = {title: false, closeBtn: false};
- (msgText == '' || msgText == undefined) && (msgText = ' ');
- msgTime === undefined && (msgTime = 2);
- if (typeof parme === 'number') {
- icon = parme;
- } else {
- parme = parme || {};
- icon = parme.type;
- conf.success = function () {
- layer.shift(parme.rate)
- };
- conf.shade = parme.shade;
- }
- conf.time = msgTime;
- conf.dialog = {msg: msgText, type: icon};
- conf.end = typeof parme === 'function' ? parme : callback;
- return $.layer(conf);
- },
- //加载层快捷引用
- load: function (parme, loadIcon) {
- if (typeof parme === 'string') {
- return this.msg(parme, 0, 16);
- } else {
- return $.layer({
- time: parme,
- loading: {type: loadIcon},
- bgcolor: !loadIcon ? '' : '#fff',
- shade: [0.1, '#000', !loadIcon ? false : true],
- border: [7, 0.3, '#000', (loadIcon === 3 || !loadIcon) ? false : true],
- type: 3,
- title: ['', false],
- closeBtn: [0, false]
- });
- }
- },
- //tips层快捷引用
- // pakey 改 后面参数改为end函数回调
- tips: function (html, follow, parme, end) {
- var conf = {
- type: 4, shade: false, success: function (layerE) {
- if (!this.closeBtn) {
- layerE.find('.xubox_tips').css({'padding-right': 10});
- }
- }, bgcolor: '', tips: {msg: html, follow: follow}
- };
- parme = parme || {};
- conf.time = parme.time || parme;
- conf.closeBtn = parme.closeBtn || false
- conf.maxWidth = parme.maxWidth || maxWidth;
- conf.tips.guide = parme.guide || guide;
- conf.tips.style = parme.style || style;
- if ($.isFunction(end)) {
- conf.end = end;
- }
- return $.layer(conf);
- }
- };
- var Class = function (setings) {
- var config = this.config;
- layer.index++;
- this.index = layer.index;
- this.config = $.extend({}, config, setings);
- this.config.dialog = $.extend({}, config.dialog, setings.dialog);
- this.config.page = $.extend({}, config.page, setings.page);
- this.config.iframe = $.extend({}, config.iframe, setings.iframe);
- this.config.loading = $.extend({}, config.loading, setings.loading);
- this.config.tips = $.extend({}, config.tips, setings.tips);
- this.creat();
- };
- Class.pt = Class.prototype;
-//默认配置
- Class.pt.config = {
- type: 0,
- shade: [0.3, '#000', true],
- shadeClose: false,
- fix: true,
- move: ['.xubox_title', true],
- moveOut: false,
- title: ['温馨提示', true],
- offset: ['200px', '50%'],
- area: ['310px', 'auto'],
- closeBtn: [0, true],
- time: 0,
- bgcolor: '#fff',
- border: [8, 0.3, '#000', true],
- zIndex: 19891014,
- maxWidth: 400,
- dialog: {
- btns: 1, btn: ['确定', '取消'], type: 3, msg: '', yes: function (index) {
- layer.close(index);
- }, no: function (index) {
- layer.close(index);
- }
- },
- page: {dom: '#xulayer', html: '', url: ''},
- iframe: {src: 'http://sentsin.com'},
- loading: {type: 0},
- tips: {msg: '', follow: '', guide: 0, isGuide: true, style: ['background-color:#FF9900; color:#fff;', '#FF9900']},
- success: function (layer) {
- }, //创建成功后的回调
- close: function (index) {
- layer.close(index);
- }, //右上角关闭回调
- end: function () {
- } //终极销毁回调
- };
- Class.pt.type = ['dialog', 'page', 'iframe', 'loading', 'tips'];
-//容器
- Class.pt.space = function (html) {
- var html = html || '', times = this.index, config = this.config, dialog = config.dialog, dom = this.dom,
- ico = dialog.type === -1 ? '' : ' ',
- frame = [
- '' + ico + '' + dialog.msg + '
',
- '' + html + '
',
- '',
- ' ',
- ''
- ],
- shade = '', border = '', zIndex = config.zIndex + times,
- shadeStyle = 'z-index:' + zIndex + '; background-color:' + config.shade[1] + '; opacity:' + config.shade[0] + '; filter:alpha(opacity=' + config.shade[0] * 100 + ');';
- config.shade[2] && (shade = '
');
- config.zIndex = zIndex;
- var title = '', closebtn = '', borderStyle = "z-index:" + (zIndex - 1) + "; background-color: " + config.border[2] + "; opacity:" + config.border[1] + "; filter:alpha(opacity=" + config.border[1] * 100 + "); top:-" + config.border[0] + "px; left:-" + config.border[0] + "px;";
- config.border[3] && (border = '
');
- config.closeBtn[1] && (closebtn = ' ');
- config.title[1] && (title = '' + config.title[0] + ' ')
- var boxhtml = ''
- + '
'
- + frame[config.type]
- + title
- + closebtn
- + ' '
- + '
' + border + '
';
- return [shade, boxhtml];
- };
-//缓存字符
- Class.pt.dom = {
- lay: 'xubox_layer',
- ifr: 'xubox_iframe'
- };
-//创建骨架
- Class.pt.creat = function () {
- var that = this, space = '', config = this.config, dialog = config.dialog, title = that.config.title, dom = that.dom, times = that.index;
- ;
- title.constructor === Array || (that.config.title = [title, true]);
- title === false && (that.config.title = [title, false]);
- var page = config.page, body = $("body"), setSpace = function (html) {
- var html = html || ''
- space = that.space(html);
- body.append(space[0]);
- };
- switch (config.type) {
- case 1:
- if (page.html !== '') {
- setSpace('' + page.html + '
');
- body.append(space[1]);
- } else if (page.url !== '') {
- setSpace('' + page.html + '
');
- body.append(space[1]);
- $.get(page.url, function (datas) {
- $('#xuboxPageHtml' + times).html(datas.toString());
- page.ok && page.ok(datas);
- });
- } else {
- if ($(page.dom).parents('.xubox_page').length == 0) {
- setSpace();
- $(page.dom).show().wrap(space[1]);
- } else {
- return;
- }
- }
- break;
- case 2:
- setSpace();
- body.append(space[1]);
- break;
- case 3:
- config.title = ['', false];
- config.area = ['auto', 'auto'];
- config.closeBtn = ['', false];
- $('.xubox_loading')[0] && layer.close($('.xubox_loading').parents('.' + dom.lay).attr('times'));
- setSpace();
- body.append(space[1]);
- break;
- case 4:
- config.title = ['', false];
- config.area = ['auto', 'auto'];
- config.fix = false;
- config.border = false;
- $('.xubox_tips')[0] && layer.close($('.xubox_tips').parents('.' + dom.lay).attr('times'));
- setSpace();
- body.append(space[1]);
- $('#' + dom.lay + times).find('.xubox_close').css({top: 6, right: 7});
- break;
- default:
- config.title[1] || (config.area = ['auto', 'auto']);
- $('.xubox_dialog')[0] && layer.close($('.xubox_dialog').parents('.' + dom.lay).attr('times'));
- setSpace();
- body.append(space[1]);
- break;
- }
- ;
- this.layerS = $('#xubox_shade' + times);
- this.layerB = $('#xubox_border' + times);
- this.layerE = $('#' + dom.lay + times);
- var layerE = this.layerE;
- this.layerMian = layerE.find('.xubox_main');
- this.layerTitle = layerE.find('.xubox_title');
- this.layerText = layerE.find('.xubox_text');
- this.layerPage = layerE.find('.xubox_page');
- this.layerBtn = layerE.find('.xubox_botton');
- //设置layer面积坐标等数据
- if (config.offset[1].indexOf("px") != -1) {
- var _left = parseInt(config.offset[1]);
- } else {
- if (config.offset[1] == '50%') {
- var _left = config.offset[1];
- } else {
- var _left = parseInt(config.offset[1]) / 100 * win.width();
- }
- }
- ;
- layerE.css({left: _left + config.border[0], width: config.area[0], height: config.area[1]});
- config.fix ? layerE.css({top: parseInt(config.offset[0]) + config.border[0]}) : layerE.css({top: parseInt(config.offset[0]) + win.scrollTop() + config.border[0], position: 'absolute'});
- //配置按钮
- if (config.title[1] && (config.type !== 3 || config.type !== 4)) {
- var confbtn = config.type === 0 ? dialog : config;
- confbtn.btn = config.btn || dialog.btn;
- switch (confbtn.btns) {
- case 0:
- that.layerBtn.html('').hide();
- break;
- case 1:
- that.layerBtn.html('' + confbtn.btn[0] + ' ');
- break;
- case 2:
- that.layerBtn.html('' + confbtn.btn[0] + ' ' + '' + confbtn.btn[1] + ' ');
- break;
- }
- }
- if (layerE.css('left') === 'auto') {
- layerE.hide();
- setTimeout(function () {
- layerE.show();
- that.set(times);
- }, 500);
- } else {
- that.set(times);
- }
- config.time <= 0 || that.autoclose();
- this.callback();
- };
-//初始化骨架
- Class.pt.set = function (times) {
- var that = this, layerE = that.layerE, config = that.config, dialog = config.dialog, page = config.page, loading = config.loading, dom = that.dom;
- that.autoArea(times);
- if (config.title[1]) {
- layer.ie6 && that.layerTitle.css({width: layerE.outerWidth()});
- } else {
- config.type != 4 && layerE.find('.xubox_close').addClass('xubox_close1');
- }
- ;
- layerE.attr({'type': that.type[config.type]});
- switch (config.type) {
- case 1:
- layerE.find(page.dom).addClass('layer_pageContent');
- config.shade[2] && layerE.css({zIndex: config.zIndex + 1});
- config.title[1] && that.layerPage.css({top: that.layerTitle.outerHeight()});
- break;
- case 2:
- var iframe = layerE.find('.' + dom.ifr), heg = layerE.height();
- iframe.addClass('xubox_load').css({width: layerE.width()});
- config.title[1] ? iframe.css({top: that.layerTitle.height(), height: heg - that.layerTitle.height()}) : iframe.css({top: 0, height: heg});
- layer.ie6 && iframe.attr('src', config.iframe.src);
- break;
- case 3:
- break;
- case 4 :
- var layArea = [0, layerE.outerHeight()], fow = $(config.tips.follow), fowo = {
- width: fow.outerWidth(),
- height: fow.outerHeight(),
- top: fow.offset().top,
- left: fow.offset().left
- }, tipsG = layerE.find('.layerTipsG');
- config.tips.isGuide || tipsG.remove();
- layerE.outerWidth() > config.maxWidth && layerE.width(config.maxWidth);
- fowo.tipColor = config.tips.style[1];
- layArea[0] = layerE.outerWidth();
- //辨别tips的方位
- fowo.where = [function () { //上
- fowo.tipLeft = fowo.left;
- fowo.tipTop = fowo.top - layArea[1] - 10;
- tipsG.removeClass('layerTipsB').addClass('layerTipsT').css({'border-right-color': fowo.tipColor});
- }, function () { //右
- fowo.tipLeft = fowo.left + fowo.width + 10;
- fowo.tipTop = fowo.top;
- tipsG.removeClass('layerTipsL').addClass('layerTipsR').css({'border-bottom-color': fowo.tipColor});
- }, function () { //下
- fowo.tipLeft = fowo.left;
- fowo.tipTop = fowo.top + fowo.height + 10;
- tipsG.removeClass('layerTipsT').addClass('layerTipsB').css({'border-right-color': fowo.tipColor});
- }, function () { //左
- fowo.tipLeft = fowo.left - layArea[0] + 10;
- fowo.tipTop = fowo.top;
- tipsG.removeClass('layerTipsR').addClass('layerTipsL').css({'border-bottom-color': fowo.tipColor});
- }];
- fowo.where[config.tips.guide]();
- /* 8*2为小三角形占据的空间 */
- if (config.tips.guide === 0) {
- fowo.top - (win.scrollTop() + layArea[1] + 8 * 2) < 0 && fowo.where[2]();
- } else if (config.tips.guide === 1) {
- win.width() - (fowo.left + fowo.width + layArea[0] + 8 * 2) > 0 || fowo.where[3]()
- } else if (config.tips.guide === 2) {
- (fowo.top - win.scrollTop() + fowo.height + layArea[1] + 8 * 2) - win.height() > 0 && fowo.where[0]();
- } else if (config.tips.guide === 3) {
- layArea[0] + 8 * 2 - fowo.left > 0 && fowo.where[1]()
- }
- layerE.css({left: fowo.tipLeft, top: fowo.tipTop});
- break;
- default:
- that.layerMian.css({'background-color': '#fff'});
- if (config.title[1]) {
- that.layerText.css({paddingTop: 18 + that.layerTitle.outerHeight()});
- } else {
- layerE.find('.xubox_msgico').css({top: 8});
- that.layerText.css({marginTop: 11});
- }
- break;
- }
- ;
- config.fadeIn && layerE.css({opacity: 0}).animate({opacity: 1}, config.fadeIn);
- that.move();
- };
-//自适应宽高
- Class.pt.autoArea = function (times) {
- var that = this, layerE = that.layerE, config = that.config, page = config.page,
- layerMian = that.layerMian, layerBtn = that.layerBtn, layerText = that.layerText,
- layerPage = that.layerPage, layerB = that.layerB, titHeight, outHeight, btnHeight = 0,
- load = $(".xubox_loading");
- if (config.area[0] === 'auto' && layerMian.outerWidth() >= config.maxWidth) {
- layerE.css({width: config.maxWidth});
- }
- config.title[1] ? titHeight = that.layerTitle.innerHeight() : titHeight = 0;
- switch (config.type) {
- case 0:
- var aBtn = layerBtn.find('a');
- outHeight = layerText.outerHeight() + 20;
- if (aBtn.length > 0) {
- btnHeight = aBtn.outerHeight() + 20;
- }
- break;
- case 1:
- outHeight = $(page.dom).outerHeight();
- config.area[0] === 'auto' && layerE.css({width: layerPage.outerWidth()});
- if (page.html !== '' || page.url !== '') {
- outHeight = layerPage.outerHeight();
- }
- break;
- case 3:
- outHeight = load.outerHeight();
- layerMian.css({width: load.width()});
- break;
- }
- ;
- (config.area[1] === 'auto') && layerMian.css({height: titHeight + outHeight + btnHeight});
- layerB.css({width: layerE.outerWidth() + 2 * config.border[0], height: layerE.outerHeight() + 2 * config.border[0]});
- (layer.ie6 && config.area[0] != 'auto') && layerMian.css({width: layerE.outerWidth()});
- (config.offset[1] === '50%' || config.offset[1] == '') && (config.type !== 4) ? layerE.css({marginLeft: -layerE.outerWidth() / 2}) : layerE.css({marginLeft: 0});
- };
-//拖拽层
- Class.pt.move = function () {
- var that = this, config = this.config, dom = that.dom, conf = {
- setY: 0,
- moveLayer: function () {
- if (parseInt(conf.layerE.css('margin-left')) == 0) {
- var lefts = parseInt(conf.move.css('left'));
- } else {
- var lefts = parseInt(conf.move.css('left')) + (-parseInt(conf.layerE.css('margin-left')))
- }
- if (conf.layerE.css('position') !== 'fixed') {
- lefts = lefts - conf.layerE.parent().offset().left;
- conf.setY = 0
- }
- conf.layerE.css({left: lefts, top: parseInt(conf.move.css('top')) - conf.setY});
- }
- };
- config.move[1] && that.layerE.find(config.move[0]).attr('move', 'ok');
- config.move[1] ? that.layerE.find(config.move[0]).css({cursor: 'move'}) : that.layerE.find(config.move[0]).css({cursor: 'auto'});
- $(config.move[0]).on('mousedown', function (M) {
- M.preventDefault();
- if ($(this).attr('move') === 'ok') {
- conf.ismove = true;
- conf.layerE = $(this).parents('.' + dom.lay);
- var xx = conf.layerE.offset().left, yy = conf.layerE.offset().top, ww = conf.layerE.width() - 6, hh = conf.layerE.height() - 6;
- if (!$('#xubox_moves')[0]) {
- $('body').append('
');
- }
- conf.move = $('#xubox_moves');
- config.moveType && conf.move.css({opacity: 0});
- conf.moveX = M.pageX - conf.move.position().left;
- conf.moveY = M.pageY - conf.move.position().top;
- conf.layerE.css('position') !== 'fixed' || (conf.setY = win.scrollTop());
- }
- });
- $(document).mousemove(function (M) {
- if (conf.ismove) {
- var offsetX = M.pageX - conf.moveX, offsetY = M.pageY - conf.moveY;
- M.preventDefault();
- //控制元素不被拖出窗口外
- if (!config.moveOut) {
- conf.setY = win.scrollTop();
- var setRig = win.width() - conf.move.outerWidth() - config.border[0], setTop = config.border[0] + conf.setY;
- offsetX < config.border[0] && (offsetX = config.border[0]);
- offsetX > setRig && (offsetX = setRig);
- offsetY < setTop && (offsetY = setTop);
- offsetY > win.height() - conf.move.outerHeight() - config.border[0] + conf.setY && (offsetY = win.height() - conf.move.outerHeight() - config.border[0] + conf.setY);
- }
- conf.move.css({left: offsetX, top: offsetY});
- config.moveType && conf.moveLayer();
- offsetX = null;
- offsetY = null;
- setRig = null;
- setTop = null
- }
- }).mouseup(function () {
- try {
- if (conf.ismove) {
- conf.moveLayer();
- conf.move.remove();
- }
- conf.ismove = false;
- } catch (e) {
- conf.ismove = false;
- }
- config.moveEnd && config.moveEnd();
- });
- };
-//自动关闭layer
- Class.pt.autoclose = function () {
- var that = this, time = this.config.time, maxLoad = function () {
- time--;
- if (time === 0) {
- layer.close(that.index);
- clearInterval(that.autotime);
- }
- };
- this.autotime = setInterval(maxLoad, 1000);
- };
- ready.config = {
- end: {}
- };
- Class.pt.callback = function () {
- var that = this, layerE = that.layerE, config = that.config, dialog = config.dialog;
- that.openLayer();
- that.config.success(layerE);
- layer.ie6 && that.IE6();
- layerE.find('.xubox_close').off('click').on('click', function (e) {
- e.preventDefault();
- config.close(that.index);
- });
- layerE.find('.xubox_yes').off('click').on('click', function (e) {
- e.preventDefault();
- config.yes ? config.yes(that.index) : dialog.yes(that.index);
- });
- layerE.find('.xubox_no').off('click').on('click', function (e) {
- e.preventDefault();
- config.no ? config.no(that.index) : dialog.no(that.index);
- });
- this.layerS.off('click').on('click', function (e) {
- e.preventDefault();
- that.config.shadeClose && layer.close(that.index);
- });
- ready.config.end[that.index] = config.end;
- };
- Class.pt.IE6 = function () {
- var that = this, layerE = that.layerE, select = $('select'), dom = that.dom;
- var _ieTop = layerE.offset().top;
- //ie6的固定与相对定位
- if (that.config.fix) {
- var ie6Fix = function () {
- layerE.css({top: $(document).scrollTop() + _ieTop});
- };
- } else {
- var ie6Fix = function () {
- layerE.css({top: _ieTop});
- };
- }
- ie6Fix();
- win.scroll(ie6Fix);
- //隐藏select
- $.each(select, function (index, value) {
- var sthis = $(this);
- if (!sthis.parents('.' + dom.lay)[0]) {
- sthis.css('display') == 'none' || sthis.attr({'layer': '1'}).hide();
- }
- sthis = null;
- });
- //恢复select
- that.reselect = function () {
- $.each(select, function (index, value) {
- var sthis = $(this);
- if (!sthis.parents('.' + dom.lay)[0]) {
- (sthis.attr('layer') == 1 && $('.' + dom.lay).length < 1) && sthis.removeAttr('layer').show();
- }
- sthis = null;
- });
- };
- };
-//给layer对象拓展方法
- Class.pt.openLayer = function () {
- var that = this, dom = that.dom;
- //自适应宽高
- layer.autoArea = function (index) {
- return that.autoArea(index);
- };
- //获取layer当前索引
- layer.getIndex = function (selector) {
- return $(selector).parents('.' + dom.lay).attr('times');
- };
- //获取子iframe的DOM
- layer.getChildFrame = function (selector, index) {
- index = index || $('.' + dom.ifr).parents('.' + dom.lay).attr('times');
- return $('#' + dom.lay + index).find('.' + dom.ifr).contents().find(selector);
- };
- //得到当前iframe层的索引,子iframe时使用
- layer.getFrameIndex = function (name) {
- return $(name ? '#' + name : '.' + dom.ifr).parents('.' + dom.lay).attr('times');
- };
- //iframe层自适应宽高
- layer.iframeAuto = function (index) {
- index = index || $('.' + dom.ifr).parents('.' + dom.lay).attr('times');
- var heg = this.getChildFrame('body', index).outerHeight(),
- lbox = $('#' + dom.lay + index), tit = lbox.find('.xubox_title'), titHt = 0;
- !tit || (titHt = tit.height());
- lbox.css({height: heg + titHt});
- var bs = -parseInt($('#xubox_border' + index).css('top'));
- $('#xubox_border' + index).css({height: heg + 2 * bs + titHt});
- $('#' + dom.ifr + index).css({height: heg});
- };
- //关闭layer
- layer.close = function (index) {
- var layerNow = $('#' + dom.lay + index), shadeNow = $('#xubox_moves, #xubox_shade' + index);
- if (layerNow.attr('type') == that.type[1]) {
- if (layerNow.find('.xuboxPageHtml')[0]) {
- layerNow.remove();
- } else {
- layerNow.find('.xubox_close,.xubox_botton,.xubox_title,.xubox_border').remove();
- for (var i = 0; i < 3; i++) {
- layerNow.find('.layer_pageContent').unwrap().hide();
- }
- }
- } else {
- document.all && layerNow.find('#' + dom.ifr + index).remove();
- layerNow.remove();
- }
- shadeNow.remove();
- layer.ie6 && that.reselect();
- typeof ready.config.end[index] === 'function' && ready.config.end[index]();
- delete ready.config.end[index];
- };
- //关闭加载层
- layer.loadClose = function () {
- var parent = $('.xubox_loading').parents('.' + dom.lay),
- index = parent.attr('times');
- layer.close(index);
- };
- //出场内置动画
- layer.shift = function (type, rate) {
- var config = that.config, iE6 = layer.ie6, layerE = that.layerE, cutWth = 0, ww = win.width(), wh = win.height();
- (config.offset[1] == '50%' || config.offset[1] == '') ? cutWth = layerE.outerWidth() / 2 : cutWth = layerE.outerWidth();
- var anim = {
- t: {top: 50 + config.border[0]},
- b: {top: wh - layerE.outerHeight() - config.border[0]},
- cl: cutWth + config.border[0],
- ct: -layerE.outerHeight(),
- cr: ww - cutWth - config.border[0],
- fn: function () {
- iE6 && that.IE6();
- }
- };
- switch (type) {
- case 'left-top':
- layerE.css({left: anim.cl, top: anim.ct}).animate(anim.t, rate, anim.fn);
- break;
- case 'top':
- layerE.css({top: anim.ct}).animate(anim.t, rate, anim.fn);
- break;
- case 'right-top':
- layerE.css({left: anim.cr, top: anim.ct}).animate(anim.t, rate, anim.fn);
- break;
- case 'right-bottom':
- layerE.css({left: anim.cr, top: wh}).animate(anim.b, rate, anim.fn);
- break;
- case 'bottom':
- layerE.css({top: wh}).animate(anim.b, rate, anim.fn);
- break;
- case 'left-bottom':
- layerE.css({left: anim.cl, top: wh}).animate(anim.b, rate, anim.fn);
- break;
- case 'left':
- layerE.css({left: -layerE.outerWidth(), marginLeft: 0}).animate({left: anim.t.top}, rate, anim.fn);
- break;
- }
- ;
- };
- //初始化拖拽元素
- layer.setMove = function () {
- return that.move();
- };
- //给指定层重置属性
- layer.area = function (index, options) {
- var nowobect = [$('#' + dom.lay + index), $('#xubox_border' + index)],
- type = nowobect[0].attr('type'), main = nowobect[0].find('.xubox_main'),
- title = nowobect[0].find('.xubox_title');
- if (type === that.type[1] || type === that.type[2]) {
- nowobect[0].css(options);
- main.css({height: options.height});
- if (type === that.type[2]) {
- var iframe = nowobect[0].find('iframe');
- iframe.css({width: options.width, height: title ? options.height - title.outerHeight() : options.height});
- }
- if (nowobect[0].css('margin-left') !== '0px') {
- options.hasOwnProperty('top') && nowobect[0].css({top: options.top - (nowobect[1][0] && parseInt(nowobect[1].css('top')))});
- options.hasOwnProperty('left') && nowobect[0].css({left: options.left + nowobect[0].outerWidth() / 2 - (nowobect[1][0] && parseInt(nowobect[1].css('left')))})
- nowobect[0].css({marginLeft: -nowobect[0].outerWidth() / 2});
- }
- if (nowobect[1][0]) {
- nowobect[1].css({
- width: parseFloat(options.width) - 2 * parseInt(nowobect[1].css('left')),
- height: parseFloat(options.height) - 2 * parseInt(nowobect[1].css('top'))
- });
- }
- }
- };
- //关闭所有层
- layer.closeAll = function () {
- var layerObj = $('.' + dom.lay);
- $.each(layerObj, function () {
- var i = $(this).attr('times');
- layer.close(i);
- });
- };
- //关闭tips层
- layer.closeTips = function () {
- var tips = $('.xubox_tips');
- if (tips[0]) {
- layer.close(tips.parents('.xubox_layer').attr('times'));
- }
- };
- //重置iframe url
- layer.iframeSrc = function (index, url) {
- $('#' + dom.lay + index).find('iframe').attr('src', url);
- };
- //置顶当前窗口
- layer.zIndex = that.config.zIndex;
- layer.setTop = function (layerNow) {
- var setZindex = function () {
- layer.zIndex++;
- layerNow.css('z-index', layer.zIndex + 1);
- };
- layer.zIndex = parseInt(layerNow[0].style.zIndex);
- layerNow.on('mousedown', setZindex);
- return layer.zIndex;
- };
- };
-//主入口
- ready.run = function () {
- $ = jQuery;
- win = $(window);
- layer.use('skin/layer.css');
- $.layer = function (deliver) {
- var o = new Class(deliver);
- return o.index;
- };
- };
-//为支持CMD规范的模块加载器
- var require = '../../init/jquery'; //若采用seajs,需正确配置jquery的相对路径。未用可无视此处。
- if (window.seajs) {
- define([require], function (require, exports, module) {
- ready.run();
- exports.layer = [window.layer, window['$'].layer];
- });
- } else {
- ready.run();
- }
-}(window);
\ No newline at end of file
diff --git a/public/plugin/layer/skin/default/Thumbs.db b/public/plugin/layer/skin/default/Thumbs.db
deleted file mode 100644
index 69b55dc..0000000
Binary files a/public/plugin/layer/skin/default/Thumbs.db and /dev/null differ
diff --git a/public/plugin/layer/skin/default/textbg.png b/public/plugin/layer/skin/default/textbg.png
deleted file mode 100644
index ad1040c..0000000
Binary files a/public/plugin/layer/skin/default/textbg.png and /dev/null differ
diff --git a/public/plugin/layer/skin/default/xubox_ico0.png b/public/plugin/layer/skin/default/xubox_ico0.png
deleted file mode 100644
index eed069e..0000000
Binary files a/public/plugin/layer/skin/default/xubox_ico0.png and /dev/null differ
diff --git a/public/plugin/layer/skin/default/xubox_loading0.gif b/public/plugin/layer/skin/default/xubox_loading0.gif
deleted file mode 100644
index 6f3c953..0000000
Binary files a/public/plugin/layer/skin/default/xubox_loading0.gif and /dev/null differ
diff --git a/public/plugin/layer/skin/default/xubox_loading1.gif b/public/plugin/layer/skin/default/xubox_loading1.gif
deleted file mode 100644
index db3a483..0000000
Binary files a/public/plugin/layer/skin/default/xubox_loading1.gif and /dev/null differ
diff --git a/public/plugin/layer/skin/default/xubox_loading2.gif b/public/plugin/layer/skin/default/xubox_loading2.gif
deleted file mode 100644
index 5bb90fd..0000000
Binary files a/public/plugin/layer/skin/default/xubox_loading2.gif and /dev/null differ
diff --git a/public/plugin/layer/skin/default/xubox_loading3.gif b/public/plugin/layer/skin/default/xubox_loading3.gif
deleted file mode 100644
index fbe57be..0000000
Binary files a/public/plugin/layer/skin/default/xubox_loading3.gif and /dev/null differ
diff --git a/public/plugin/layer/skin/default/xubox_title0.png b/public/plugin/layer/skin/default/xubox_title0.png
deleted file mode 100644
index 4ffbe31..0000000
Binary files a/public/plugin/layer/skin/default/xubox_title0.png and /dev/null differ
diff --git a/public/plugin/layer/skin/layer.css b/public/plugin/layer/skin/layer.css
deleted file mode 100644
index 478be98..0000000
--- a/public/plugin/layer/skin/layer.css
+++ /dev/null
@@ -1,58 +0,0 @@
-body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, input, button, textarea, p, blockquote, th, td, form { margin: 0; padding: 0 }
-* html { background-image: url(about:blank); background-attachment: fixed }
-.xubox_shade, .xubox_layer { position: fixed; _position: absolute }
-.xubox_shade { top: 0; left: 0; width: 100%; height: 100%; _height: expression(document.body.offsetHeight+"px") }
-.xubox_layer { top: 150px; left: 50%; height: auto; width: 310px; margin-left: -155px }
-.xubox_border, .xubox_title, .xubox_title i, .xubox_page, .xubox_iframe, .xubox_title em, .xubox_close, .xubox_msgico, .xubox_moves { position: absolute }
-.xubox_border { border-radius: 5px }
-.xubox_title { left: 0; top: 0 }
-.xubox_main { position: relative; height: 100%; _float: left }
-.xubox_page { top: 0; left: 0 }
-.xubox_load { background: url(default/xubox_loading0.gif) #fff center center no-repeat }
-.xubox_loading { display: block; float: left; text-decoration: none; color: #FFF; _float: none }
-.xulayer_png32 { background: url(default/xubox_ico0.png) no-repeat }
-.xubox_moves { border: 3px solid #333; cursor: move; opacity: .7; filter: alpha(opacity=70) }
-.xubox_msgico { width: 32px; height: 32px; top: 52px; left: 15px; background: url(default/xubox_ico0.png) no-repeat }
-.xubox_text { padding-left: 55px; float: left; line-height: 25px; word-break: break-all; padding-right: 20px; overflow: hidden; font-size: 14px }
-.xubox_msgtype0 { background-position: -91px -38px }
-.xubox_msgtype1 { background-position: -128px -38px }
-.xubox_msgtype2 { background-position: -163px -38px }
-.xubox_msgtype3 { background-position: -91px -75px }
-.xubox_msgtype4 { background-position: -163px -75px }
-.xubox_msgtype5 { background-position: -163px -112px }
-.xubox_msgtype6 { background-position: -163px -148px }
-.xubox_msgtype7 { background-position: -128px -75px }
-.xubox_msgtype8 { background-position: -91px -6px }
-.xubox_msgtype9 { background-position: -129px -6px }
-.xubox_msgtype10 { background-position: -163px -6px }
-.xubox_msgtype11 { background-position: -206px -6px }
-.xubox_msgtype12 { background-position: -206px -44px }
-.xubox_msgtype13 { background-position: -206px -81px }
-.xubox_msgtype14 { background-position: -206px -122px }
-.xubox_msgtype15 { background-position: -206px -157px }
-.xubox_loading_0 { width: 60px; height: 24px; background: url(default/xubox_loading0.gif) no-repeat }
-.xubox_loading_1 { width: 37px; height: 37px; background: url(default/xubox_loading1.gif) no-repeat }
-.xubox_loading_2, .xubox_msgtype16 { width: 32px; height: 32px; background: url(default/xubox_loading2.gif) no-repeat }
-.xubox_loading_3 { width: 126px; height: 22px; background: url(default/xubox_loading3.gif) no-repeat }
-.xubox_title { width: 100%; height: 35px; line-height: 35px; border-bottom: 1px solid #d5d5d5; background: url(default/xubox_title0.png) #ebebeb repeat-x; cursor: move; font-size: 14px; color: #333 }
-.xubox_title em { display: block; height: 20px; line-height: 20px; width: 80%; top: 9px; left: 10px; font-style: normal; overflow: hidden }
-.xubox_close0 { right: 10px; top: 10px; width: 14px; height: 14px; background-position: -31px -7px; cursor: pointer; overflow: hidden }
-.xubox_close0:hover { background-position: -51px -7px }
-.xubox_close1 { right: -20px; top: -21px; width: 34px; height: 30px; background-position: -5px -252px; cursor: pointer; overflow: hidden; _right: 3px; _top: 3px; _width: 14px; _height: 14px; _background-position: -31px -7px }
-.xubox_close1:hover { background-position: -44px -252px; _background-position: -51px -7px }
-.xubox_botton a { position: absolute; bottom: 10px; left: 50%; background: url(default/xubox_ico0.png) repeat; text-decoration: none; color: #FFF; font-size: 14px; text-align: center; font-weight: bold; overflow: hidden }
-.xubox_botton a:hover { text-decoration: none; color: #FFF }
-.xubox_botton .xubox_botton1 { width: 79px; height: 32px; line-height: 32px; margin-left: -39px; background-position: -6px -34px }
-.xubox_botton1:hover { background-position: -6px -72px }
-.xubox_botton .xubox_botton2 { margin-left: -76px; width: 71px; height: 29px; line-height: 29px; background-position: -5px -114px }
-.xubox_botton2:hover { background-position: -5px -146px }
-.xubox_botton .xubox_botton3 { width: 71px; height: 29px; line-height: 29px; margin-left: 10px; background-position: -81px -114px }
-.xubox_botton3:hover { background-position: -81px -146px }
-.xubox_tips { position: relative; line-height: 20px; padding: 3px 30px 3px 10px; font-size: 12px; _float: left; border-radius: 3px; box-shadow: 1px 1px 3px rgba(0, 0, 0, .3) }
-.xubox_tips i.layerTipsG { position: absolute; width: 0; height: 0; border-width: 8px; border-color: transparent; border-style: dashed; *overflow: hidden }
-.xubox_tips i.layerTipsT, .xubox_tips i.layerTipsB { left: 5px; border-right-style: solid }
-.xubox_tips i.layerTipsT { bottom: -8px }
-.xubox_tips i.layerTipsB { top: -8px }
-.xubox_tips i.layerTipsR, .xubox_tips i.layerTipsL { top: 1px; border-bottom-style: solid }
-.xubox_tips i.layerTipsR { left: -8px }
-.xubox_tips i.layerTipsL { right: -8px }
diff --git a/public/plugin/layer/skin/layer.ext.css b/public/plugin/layer/skin/layer.ext.css
deleted file mode 100644
index 9d0dd47..0000000
--- a/public/plugin/layer/skin/layer.ext.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
-
- @Name: layer拓展样式
- @Date: 2012.12.13
- @Author: 贤心
- @blog: sentsin.com
-
-**/
-
-/* prompt模式 */
-.xubox_layer .xubox_form { width: 240px; line-height: 30px; padding: 0 5px; border: 1px solid #ccc; background: url(default/textbg.png) #fff repeat-x; color: #333; }
-.xubox_layer .xubox_formArea { width: 300px; height: 100px; line-height: 20px; }
-/* tab模式 */
-.xubox_layer .xubox_tab { position: relative; border: 1px solid #ccc; }
-.xubox_layer .xubox_tabmove { position: absolute; width: 600px; height: 30px; top: 0; left: 0; }
-.xubox_layer .xubox_tabtit { display: block; height: 30px; border-bottom: 1px solid #ccc; background-color: #eee; }
-.xubox_layer .xubox_tabtit span { position: relative; float: left; width: 120px; height: 30px; line-height: 30px; text-align: center; cursor: pointer; }
-.xubox_layer .xubox_tabtit span.xubox_tabnow { left: -1px; _top: 1px; height: 31px; border-left: 1px solid #ccc; border-right: 1px solid #ccc; background-color: #fff; z-index: 10; }
-.xubox_layer .xubox_tab_main { line-height: 24px; clear: both; }
-.xubox_layer .xubox_tab_main .xubox_tabli { display: none; }
-.xubox_layer .xubox_tab_main .xubox_tabli.xubox_tab_layer { display: block; }
-.xubox_layer .xubox_tabclose { position: absolute; right: 10px; top: 5px; cursor: pointer; }
diff --git a/public/plugin/validator/change.txt b/public/plugin/validator/change.txt
deleted file mode 100644
index e3881b6..0000000
--- a/public/plugin/validator/change.txt
+++ /dev/null
@@ -1 +0,0 @@
-remote增加tp ajax返回支持
\ No newline at end of file
diff --git a/public/plugin/validator/images/loading.gif b/public/plugin/validator/images/loading.gif
deleted file mode 100644
index 6e5bace..0000000
Binary files a/public/plugin/validator/images/loading.gif and /dev/null differ
diff --git a/public/plugin/validator/images/validator_default.png b/public/plugin/validator/images/validator_default.png
deleted file mode 100644
index 5a95640..0000000
Binary files a/public/plugin/validator/images/validator_default.png and /dev/null differ
diff --git a/public/plugin/validator/images/validator_simple.png b/public/plugin/validator/images/validator_simple.png
deleted file mode 100644
index 2470db5..0000000
Binary files a/public/plugin/validator/images/validator_simple.png and /dev/null differ
diff --git a/public/plugin/validator/jquery.validator.css b/public/plugin/validator/jquery.validator.css
deleted file mode 100644
index 82558a8..0000000
--- a/public/plugin/validator/jquery.validator.css
+++ /dev/null
@@ -1,64 +0,0 @@
-/*! nice Validator 0.7.0
- * (c) 2012-2014 Jony Zhang , MIT Licensed
- * http://niceue.com/validator/
- */
-.n-inline-block, .nice-validator input, .nice-validator select, .nice-validator textarea, .msg-wrap, .n-icon, .n-msg { display: inline-block; *display: inline; *zoom: 1 }
-.msg-box { position: relative; *zoom: 1 }
-.msg-wrap { position: relative; white-space: nowrap }
-.msg-wrap, .n-icon, .n-msg { vertical-align: top }
-.n-arrow { position: absolute; overflow: hidden; }
-.n-arrow b, .n-arrow i { position: absolute; left: 0; top: 0; border: 0; margin: 0; padding: 0; overflow: hidden; font-weight: 400; font-style: normal; font-size: 12px; font-family: serif; line-height: 14px; _line-height: 15px }
-.n-arrow i { text-shadow: none }
-.n-icon { width: 16px; height: 16px; overflow: hidden; background-repeat: no-repeat }
-.n-msg { display: inline-block; line-height: 15px; margin-left: 2px; *margin-top: -1px; _margin-top: 0; font-size: 12px; font-family: simsun }
-.n-error { color: #c33 }
-.n-ok { color: #390 }
-.n-tip, .n-loading { color: #808080 }
-.n-error .n-icon { background-position: 0 0 }
-.n-ok .n-icon { background-position: -16px 0 }
-.n-tip .n-icon { background-position: -32px 0 }
-.n-loading .n-icon { background: url("images/loading.gif") 0 center no-repeat !important }
-.n-top, .n-right, .n-bottom, .n-left { display: inline-block; line-height: 0; vertical-align: top; outline: 0 }
-.n-top .n-arrow, .n-bottom .n-arrow { height: 6px; width: 12px; left: 8px }
-.n-left .n-arrow, .n-right .n-arrow { width: 6px; height: 12px; top: 6px }
-.n-top { vertical-align: top; }
-.n-top .msg-wrap { margin-bottom: 6px }
-.n-top .n-arrow { bottom: -6px; }
-.n-top .n-arrow b { top: -6px }
-.n-top .n-arrow i { top: -7px }
-.n-bottom { vertical-align: bottom; }
-.n-bottom .msg-wrap { margin-top: 6px }
-.n-bottom .n-arrow { top: -6px; }
-.n-bottom .n-arrow b { top: -1px }
-.n-bottom .n-arrow i { top: 0 }
-.n-left .msg-wrap { right: 100%; margin-right: 6px }
-.n-left .n-arrow { right: -6px; }
-.n-left .n-arrow b { left: -6px }
-.n-left .n-arrow i { left: -7px }
-.n-right .msg-wrap { margin-left: 6px }
-.n-right .n-arrow { left: -6px; }
-.n-right .n-arrow b { left: 1px }
-.n-right .n-arrow i { left: 2px }
-.n-default .n-left, .n-default .n-right { margin-top: 5px }
-.n-default .n-top .msg-wrap { bottom: 100% }
-.n-default .n-bottom .msg-wrap { top: 100% }
-.n-default .msg-wrap { position: absolute; z-index: 1; }
-.n-default .msg-wrap .n-icon { background-image: url("images/validator_default.png") }
-.n-default .n-tip .n-icon { display: none }
-.n-simple .msg-wrap { position: absolute; z-index: 1; }
-.n-simple .msg-wrap .n-icon { background-image: url("images/validator_simple.png") }
-.n-simple .n-top .msg-wrap { bottom: 100% }
-.n-simple .n-bottom .msg-wrap { top: 100% }
-.n-simple .n-left, .n-simple .n-right { margin-top: 5px }
-.n-simple .n-bottom .msg-wrap { margin-top: 3px }
-.n-simple .n-tip .n-icon { display: none }
-.n-yellow .msg-wrap { position: absolute; z-index: 1; padding: 4px 6px; font-size: 12px; border: 1px solid transparent; background-color: #fffcef; border-color: #ffbb76; color: #db7c22; box-shadow: 0 1px 3px #ccc; border-radius: 2px; }
-.n-yellow .msg-wrap .n-arrow b { color: #ffbb76; text-shadow: 0 0 2px #ccc }
-.n-yellow .msg-wrap .n-arrow i { color: #fffcef }
-.n-yellow .msg-wrap .n-icon { background-image: url("images/validator_simple.png") }
-.n-yellow .n-top .msg-wrap { bottom: 100% }
-.n-yellow .n-bottom .msg-wrap { top: 100% }
-.n-yellow .n-tip, .n-yellow .n-ok, .n-yellow .n-loading { background-color: #f8fdff; border-color: #ddd; color: #333; box-shadow: 0 1px 3px #ccc; }
-.n-yellow .n-tip .n-arrow b, .n-yellow .n-ok .n-arrow b, .n-yellow .n-loading .n-arrow b { color: #ddd; text-shadow: 0 0 2px #ccc }
-.n-yellow .n-tip .n-arrow i, .n-yellow .n-ok .n-arrow i, .n-yellow .n-loading .n-arrow i { color: #f8fdff }
-.n-yellow .n-tip .n-icon { display: none }
diff --git a/public/plugin/validator/jquery.validator.js b/public/plugin/validator/jquery.validator.js
deleted file mode 100644
index 510bb11..0000000
--- a/public/plugin/validator/jquery.validator.js
+++ /dev/null
@@ -1,1526 +0,0 @@
-/*! nice Validator 0.7.0
- * (c) 2012-2014 Jony Zhang , MIT Licensed
- * http://niceue.com/validator/
- */
-/*jshint evil:true, expr:true */
-(function ($, undefined) {
- "use strict";
- var NS = 'validator',
- CLS_NS = '.' + NS,
- CLS_NS_RULE = '.rule',
- CLS_NS_FIELD = '.field',
- CLS_NS_FORM = '.form',
- CLS_WRAPPER = 'nice-' + NS,
- CLS_MSG_OK = 'n-ok',
- CLS_MSG_ERROR = 'n-error',
- CLS_MSG_TIP = 'n-tip',
- CLS_MSG_LOADING = 'n-loading',
- CLS_MSG_BOX = 'msg-box',
- ARIA_REQUIRED = 'aria-required',
- ARIA_INVALID = 'aria-invalid',
- DATA_RULE = 'data-rule',
- DATA_MSG = 'data-msg',
- DATA_TIP = 'data-tip',
- DATA_OK = 'data-ok',
- DATA_TARGET = 'data-target',
- DATA_INPUT_STATUS = 'data-inputstatus',
- NOVALIDATE = 'novalidate',
- INPUT_SELECTOR = ':verifiable',
- rRules = /(!?)\s?(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?\s*(;|\||&)?/g,
- rRule = /(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?/,
- rDisplay = /(?:([^:;\(\[]*):)?(.*)/,
- rDoubleBytes = /[^\x00-\xff]/g,
- rPos = /^.*(top|right|bottom|left).*$/,
- rAjaxType = /(?:(post|get):)?(.+)/i,
- rUnsafe = /<|>/g,
- noop = $.noop,
- proxy = $.proxy,
- isFunction = $.isFunction,
- isArray = $.isArray,
- isString = function (s) {
- return typeof s === 'string';
- },
- isObject = function (o) {
- return o && Object.prototype.toString.call(o) === '[object Object]';
- },
- isIE6 = !window.XMLHttpRequest,
- attr = function (el, key, value) {
- if (value !== undefined) {
- if (value === null) el.removeAttribute(key);
- else el.setAttribute(key, '' + value);
- } else {
- return el.getAttribute(key);
- }
- },
- debug = window.console || {
- log: noop,
- info: noop
- },
- novalidateonce,
- defaults = {
- debug: 0,
- timely: 1,
- theme: 'default',
- ignore: '',
- //stopOnError: false,
- //focusCleanup: false,
- focusInvalid: true,
- beforeSubmit: noop,
- //dataFilter: null,
- //valid: null,
- //invalid: null,
- validClass: 'n-valid',
- invalidClass: 'n-invalid',
- msgWrapper: 'span',
- msgMaker: function (opt) {
- var html,
- cls = {
- error: CLS_MSG_ERROR,
- ok: CLS_MSG_OK,
- tip: CLS_MSG_TIP,
- loading: CLS_MSG_LOADING
- }[opt.type];
- html = '';
- html += opt.arrow + opt.icon + '' + opt.msg + ' ';
- html += ' ';
- return html;
- },
- msgIcon: ' ',
- msgArrow: '',
- msgClass: '',
- //msgStyle: null,
- //msgShow: null,
- //msgHide: null,
- //showOk: true,
- defaultMsg: '{0} is not valid.',
- loadingMsg: 'Validating...'
- },
- themes = {
- 'default': {
- formClass: 'n-default',
- msgClass: 'n-right',
- showOk: ''
- }
- };
- /** jQuery Plugin
- * @param {Object} options
- debug {Boolean} false Whether to enable debug mode
- timely {Boolean} true Whether to enable timely verification
- theme {String} 'default' Using which theme
- stopOnError {Boolean} false Whether to stop validate when found an error input
- focusCleanup {Boolean} false Whether to clean up the field message when focus the field
- focusInvalid {Boolean} true Whether to focus the field that is invalid
- ignore {jqSelector} '' Ignored fields (Using jQuery selector)
-
- beforeSubmit {Function} Do something before submitting the form
- dataFilter {Function} Conversion ajax results
- valid {Function} Triggered when the form is valid
- invalid {Function} Triggered when the form is invalid
- validClass {String} Add the class name to a valid field
- invalidClass {String} Add the class name to a invalid field
-
- msgShow {Function} null When show a message, will trigger this callback
- msgHide {Function} null When hide a message, will trigger this callback
- msgWrapper {String} 'span' Message wrapper tag name
- msgMaker {Function} Message HTML maker
- msgIcon {String} Icon template
- msgArrow {String} Small arrow template
- msgStyle {String} Custom message style
- msgClass {String} Additional added to the message class names
- formClass {String} Additional added to the form class names
-
- defaultMsg {String} Default error message
- loadingMsg {String} Tips for asynchronous loading
- messages {Object} null Custom messages for the current instance
-
- rules {Object} null Custom rules for the current instance
-
- fields {Object} Field set to be verified
- {String} key name|#id
- {String|Object} value Rule string, or an object is passed more arguments
-
- fields[key][rule] {String} Rule string
- fields[key][tip] {String} Custom friendly message when focus the input
- fields[key][ok] {String} Custom success message
- fields[key][msg] {Object} Custom error message
- fields[key][msgStyle] {String} Custom message style
- fields[key][msgClass] {String} Additional added to the message class names
- fields[key][msgWrapper] {String} Message wrapper tag name
- fields[key][msgMaker] {Function} Custom message HTML maker
- fields[key][dataFilter] {Function} Conversion ajax results
- fields[key][valid] {Function} Triggered when this field is valid
- fields[key][invalid] {Function} Triggered when this field is invalid
- fields[key][must] {Boolean} If set true, we always check the field even has remote checking
- fields[key][timely] {Boolean} Whether to enable timely verification
- fields[key][target] {jqSelector} Verify the current field, but the message can be displayed on target element
- */
- $.fn[NS] = function (options) {
- var that = this,
- args = arguments;
- if (that.is(':input')) return that;
- !that.is('form') && (that = this.find('form'));
- !that.length && (that = this);
- that.each(function () {
- var cache = $(this).data(NS);
- if (cache) {
- if (isString(options)) {
- if (options.charAt(0) === '_') return;
- cache[options].apply(cache, Array.prototype.slice.call(args, 1));
- } else if (options) {
- cache._reset(true);
- cache._init(this, options);
- }
- } else {
- new Validator(this, options);
- }
- });
- return this;
- };
- // Validate a field, or an area
- $.fn.isValid = function (callback, checkOnly) {
- var me = getInstance(this[0]),
- hasCallback = isFunction(callback),
- ret;
- if (!me) return true;
- // By default only verify without prompt message
- me.checkOnly = checkOnly === undefined || checkOnly;
- ret = me._multiValidate(
- this.is(':input') ? this : this.find(INPUT_SELECTOR),
- function (isValid) {
- hasCallback && callback.call(null, isValid);
- me.checkOnly = false;
- }
- );
- // If you pass a callback, we maintain the jQuery object chain
- return hasCallback ? this : ret;
- };
- // A faster selector than ":input:not(:submit,:button,:reset,:image,:disabled,[novalidate])"
- $.expr[":"].verifiable = function (elem) {
- var name = elem.nodeName.toLowerCase();
- return (name === 'input' && !({submit: 1, button: 1, reset: 1, image: 1})[elem.type] || name === 'select' || name === 'textarea') &&
- elem.disabled === false && attr(elem, NOVALIDATE) === null;
- };
- // Constructor for Validator
- function Validator(element, options) {
- var me = this;
- if (!me instanceof Validator) return new Validator(element, options);
- me.$el = $(element);
- me._init(element, options);
- }
-
- Validator.prototype = {
- _init: function (element, options) {
- var me = this,
- opt, themeOpt, dataOpt;
- // Initialization options
- if (isFunction(options)) {
- options = {
- valid: options
- };
- }
- options = options || {};
- dataOpt = attr(element, 'data-' + NS + '-option');
- dataOpt = dataOpt && dataOpt.charAt(0) === '{' ? (new Function("return " + dataOpt))() : {};
- themeOpt = themes[options.theme || dataOpt.theme || defaults.theme];
- opt = me.options = $.extend({}, defaults, themeOpt, dataOpt, me.options, options);
- me.rules = new Rules(opt.rules, true);
- me.messages = new Messages(opt.messages, true);
- me.elements = me.elements || {};
- me.deferred = {};
- me.errors = {};
- me.fields = {};
- // Initialization fields
- me._initFields(opt.fields);
- // Initialization group verification
- if (isArray(opt.groups)) {
- $.map(opt.groups, function (obj) {
- if (!isString(obj.fields) || !isFunction(obj.callback)) return null;
- obj.$elems = me.$el.find(keys2selector(obj.fields));
- $.map(obj.fields.split(' '), function (k) {
- me.fields[k] = me.fields[k] || {};
- me.fields[k].group = obj;
- });
- });
- }
- // Initialization message parameters
- me.msgOpt = {
- type: 'error',
- pos: getPos(opt.msgClass),
- wrapper: opt.msgWrapper,
- cls: opt.msgClass,
- style: opt.msgStyle,
- icon: opt.msgIcon,
- arrow: opt.msgArrow,
- show: opt.msgShow,
- hide: opt.msgHide
- };
- // Guess whether it use ajax submit
- me.isAjaxSubmit = false;
- if (opt.valid || attr(element, 'action') === null) {
- me.isAjaxSubmit = true;
- } else {
- // if there is a "valid.form" event
- var events = $[$._data ? '_data' : 'data'](element, "events");
- if (events && events.valid &&
- $.map(events.valid, function (e) {
- return e.namespace.indexOf('form') !== -1 ? 1 : null;
- }).length
- ) {
- me.isAjaxSubmit = true;
- }
- }
- // Initialization events and make a cache
- if (!me.$el.data(NS)) {
- me.$el.data(NS, me).addClass(CLS_WRAPPER + ' ' + opt.formClass)
- .on('submit' + CLS_NS + ' validate' + CLS_NS, proxy(me, '_submit'))
- .on('reset' + CLS_NS, proxy(me, '_reset'))
- .on('showtip' + CLS_NS, proxy(me, '_showTip'))
- .on('validated' + CLS_NS_FIELD + CLS_NS, INPUT_SELECTOR, proxy(me, '_validatedField'))
- .on('validated' + CLS_NS_RULE + CLS_NS, INPUT_SELECTOR, proxy(me, '_validatedRule'))
- .on('focusin' + CLS_NS + ' click' + CLS_NS + ' showtip' + CLS_NS, INPUT_SELECTOR, proxy(me, '_focusin'))
- .on('focusout' + CLS_NS + ' validate' + CLS_NS, INPUT_SELECTOR, proxy(me, '_focusout'))
- .on('click' + CLS_NS, ':radio,:checkbox', proxy(me, '_click'));
- if (opt.timely >= 2) {
- me.$el.on('keyup' + CLS_NS + ' paste' + CLS_NS, INPUT_SELECTOR, proxy(me, '_focusout'))
- .on('change' + CLS_NS, 'select', proxy(me, '_click'));
- }
- // cache the novalidate attribute value
- me._novalidate = attr(element, NOVALIDATE);
- // Initialization is complete, stop off default HTML5 form validation, and as a basis has been initialized
- // jQuery's "attr('novalidate')" in IE7 will complain: "SCRIPT3: Member not found."
- attr(element, NOVALIDATE, NOVALIDATE);
- }
- },
- _initFields: function (fields) {
- var me = this;
- // Processing field information
- if (isObject(fields)) {
- $.each(fields, function (k, v) {
- // delete the field from settings
- if (v === null) {
- var el = me.elements[k];
- if (el) me._resetElement(el, true);
- delete me.fields[k];
- } else {
- me.fields[k] = isString(v) ? {
- rule: v
- } : v;
- }
- });
- }
- // Parsing DOM rules
- me.$el.find(INPUT_SELECTOR).each(function () {
- me._parse(this);
- });
- },
- // Parsing a field
- _parse: function (el) {
- var me = this,
- field,
- key = el.name,
- dataRule = attr(el, DATA_RULE);
- dataRule && attr(el, DATA_RULE, null);
- // if the field has passed the key as id mode, or it doesn't has a name
- if (el.id && ('#' + el.id in me.fields) || !el.name) {
- key = '#' + el.id;
- }
- // doesn't verify a field that has neither id nor name
- if (!key) return;
- field = me.fields[key] || {};
- field.key = key;
- field.old = {};
- field.rule = field.rule || dataRule || '';
- if (!field.rule) return;
- if (field.rule.match(/match|checked/)) {
- field.must = true;
- }
- if (field.rule.indexOf('required') !== -1) {
- field.required = true;
- attr(el, ARIA_REQUIRED, true);
- }
- if ('timely' in field && !field.timely || !me.options.timely) {
- attr(el, 'notimely', true);
- }
- if (isString(field.target)) {
- attr(el, DATA_TARGET, field.target);
- }
- if (isString(field.tip)) {
- attr(el, DATA_TIP, field.tip);
- }
- me.fields[key] = me._parseRule(field);
- },
- // Parsing field rules
- _parseRule: function (field) {
- var arr = rDisplay.exec(field.rule);
- if (!arr) return;
- // current rule index
- field._v = 0;
- if (arr[1]) {
- field.display = arr[1];
- }
- if (arr[2]) {
- field.rules = [];
- arr[2].replace(rRules, function () {
- var args = arguments;
- args[3] = args[3] || args[4];
- field.rules.push({
- not: args[1] === "!",
- method: args[2],
- params: args[3] ? args[3].split(', ') : undefined,
- or: args[5] === "|"
- });
- });
- // current rule name
- // field._r = field.rules[0].method;
- }
- return field;
- },
- // Verify a zone
- _multiValidate: function ($inputs, doneCallbacks) {
- var me = this,
- opt = me.options;
- me._multiValid = true;
- if (opt.ignore) $inputs = $inputs.not(opt.ignore);
- $inputs.each(function (i, el) {
- var field = me.getField(el);
- if (field) {
- me._validate(el, field);
- if (!me._multiValid && opt.stopOnError) {
- // stop the verification
- return false;
- }
- }
- });
- // Need to wait for the completion of all field validation (especially asynchronous verification)
- $.when.apply(
- null,
- $.map(me.deferred, function (v) {
- return v;
- })
- ).done(function () {
- doneCallbacks.call(me, me._multiValid);
- });
- // If the form does not contain asynchronous validation, the return value is correct.
- // Otherwise, you should detect whether a form valid through "doneCallbacks".
- return !$.isEmptyObject(me.deferred) ? undefined : me._multiValid;
- },
- // Verify the whole form
- _submit: function (e) {
- var me = this,
- opt = me.options,
- form = e.target,
- autoSubmit = e.type === 'submit';
- e.preventDefault();
- if (
- novalidateonce && (novalidateonce = false) ||
- // Prevent duplicate submission
- me.submiting ||
- // Receive the "validate" event only from the form.
- e.type === 'validate' && me.$el[0] !== form ||
- // trigger the beforeSubmit callback.
- opt.beforeSubmit.call(me, form) === false
- ) {
- return;
- }
- opt.debug && debug.log("\n" + e.type);
- me._reset();
- me.submiting = true;
- me.isValid = undefined;
- me._multiValidate(
- me.$el.find(INPUT_SELECTOR),
- function (isValid) {
- var ret = (isValid || opt.debug === 2) ? 'valid' : 'invalid',
- errors;
- if (!isValid) {
- if (opt.focusInvalid) {
- // navigate to the error element
- me.$el.find(':input[' + ARIA_INVALID + '="true"]:first').focus();
- }
- errors = $.map(me.errors, function (err) {
- return err;
- });
- }
- // releasing submit
- me.submiting = false;
- // trigger callback and event
- isFunction(opt[ret]) && opt[ret].call(me, form, errors);
- me.$el.trigger(ret + CLS_NS_FORM, [form, errors]);
- if (isValid && !me.isAjaxSubmit && autoSubmit) {
- novalidateonce = true;
- form.submit();
- }
- }
- );
- },
- _reset: function (e) {
- var me = this;
- me.errors = {};
- if (e) {
- me.$el.find(INPUT_SELECTOR).each(function (i, el) {
- me._resetElement(el);
- });
- }
- },
- _resetElement: function (el, all) {
- var opt = this.options;
- $(el).removeClass(opt.validClass + ' ' + opt.invalidClass);
- this.hideMsg(el);
- if (all) {
- attr(el, ARIA_REQUIRED, null);
- }
- },
- _focusin: function (e) {
- var me = this,
- opt = me.options,
- el = e.target,
- msg;
- if (e.type !== 'showtip') {
- if (me.submiting) return;
- if (attr(el, DATA_INPUT_STATUS) === 'error') {
- if (opt.focusCleanup) {
- $(el).removeClass(opt.invalidClass);
- me.hideMsg(el);
- }
- } else {
- if (el.value !== '') return;
- }
- }
- msg = attr(el, DATA_TIP);
- if (!msg) return;
- me.showMsg(el, {
- type: 'tip',
- msg: msg
- });
- },
- // Handle focusout/validate/keyup/click/paste events
- _focusout: function (e, isClick) {
- var me = this,
- opt = me.options,
- field,
- must,
- el = e.target,
- etype = e.type,
- timer = 150;
- if (!isClick && etype !== 'paste') {
- // must be verified, if it is a manual trigger
- if (etype === 'validate') {
- must = true;
- timer = 0;
- }
- // or doesn't require real-time verification, exit
- else if (attr(el, 'notimely')) return;
- // or it isn't a "keyup" event, exit
- else if (opt.timely >= 2 && etype !== 'keyup') return;
- // if the current field is ignored, exit
- if (opt.ignore && $(el).is(opt.ignore)) return;
- if (etype === 'keyup') {
- var key = e.keyCode,
- specialKey = {
- 8: 1, // Backspace
- 9: 1, // Tab
- 16: 1, // Shift
- 32: 1, // Space
- 46: 1 // Delete
- };
- // only gets focus, no verification
- if (key === 9 && !el.value) return;
- // do not validate, if triggered by these keys
- if (key < 48 && !specialKey[key]) return;
- // keyboard events, reducing the frequency of verification
- timer = opt.timely >= 100 ? opt.timely : 500;
- }
- }
- field = me.getField(el);
- if (!field) return;
- if (timer) {
- if (field._t) clearTimeout(field._t);
- field._t = setTimeout(function () {
- me._validate(el, field, must);
- }, timer);
- } else {
- // use synchronous verification for "validate" event
- me._validate(el, field, must);
- }
- },
- _click: function (e) {
- this._focusout(e, true);
- },
- _showTip: function (e) {
- var me = this;
- if (me.$el[0] !== e.target) return;
- me.$el.find(INPUT_SELECTOR + "[" + DATA_TIP + "]").each(function () {
- me.showMsg(this, {
- msg: attr(this, DATA_TIP),
- type: 'tip'
- });
- });
- },
- // Validated a field
- _validatedField: function (e, field, ret) {
- var me = this,
- opt = me.options,
- el = e.target,
- isValid = ret.isValid = field.isValid = !!ret.isValid,
- callback = isValid ? 'valid' : 'invalid';
- ret.key = field.key;
- ret.rule = field._r;
- if (isValid) {
- ret.type = 'ok';
- } else {
- if (me.submiting) {
- me.errors[field.key] = ret.msg;
- }
- me._multiValid = false;
- }
- field.old.value = el.value;
- field.old.id = el.id;
- me.elements[field.key] = el;
- me.$el[0].isValid = me.isValid = isValid ? me.isFormValid() : isValid;
- if (me.checkOnly) return;
- // trigger callback and event
- isFunction(field[callback]) && field[callback].call(me, el, ret);
- $(el).attr(ARIA_INVALID, isValid ? null : true)
- .removeClass(isValid ? opt.invalidClass : opt.validClass)
- .addClass(!ret.skip ? isValid ? opt.validClass : opt.invalidClass : "")
- .trigger(callback + CLS_NS_FIELD, [ret, me]);
- me.$el.triggerHandler('validation', [ret, me]);
- // show or hide the message
- if (field.msgMaker || opt.msgMaker) {
- me[ret.showOk || ret.msg ? 'showMsg' : 'hideMsg'](el, ret, field);
- }
- },
- // Validated a rule
- _validatedRule: function (e, field, ret, msgOpt) {
- field = field || me.getField(el);
- msgOpt = msgOpt || {};
- var me = this,
- opt = me.options,
- el = e.target,
- msg,
- rule,
- method = field._r,
- transfer,
- isValid = false;
- // use null to break validation from a field
- if (ret === null) {
- $(el).trigger('validated' + CLS_NS_FIELD, [field, {isValid: true, skip: true}]);
- return;
- }
- else if (ret === true || ret === undefined || ret === '') {
- isValid = true;
- }
- else if (isString(ret)) {
- msg = ret;
- }
- else if (isObject(ret)) {
- if (ret.error) {
- msg = ret.error;
- } else {
- msg = ret.ok;
- isValid = true;
- }
- }
- if (field.rules) {
- rule = field.rules[field._v];
- if (rule.not) {
- msg = undefined;
- isValid = method === "required" || !isValid;
- }
- if (rule.or) {
- if (isValid) {
- while (field._v < field.rules.length && field.rules[field._v].or) {
- field._v++;
- }
- } else {
- transfer = true;
- }
- }
- }
- // message analysis, and throw rule level event
- if (!transfer) {
- if (isValid) {
- msgOpt.isValid = isValid;
- if (opt.showOk !== false) {
- if (!isString(msg)) {
- if (isString(field.ok)) {
- msg = field.ok;
- } else if (isString(attr(el, DATA_OK))) {
- msg = attr(el, DATA_OK);
- } else if (isString(opt.showOk)) {
- msg = opt.showOk;
- }
- }
- if (isString(msg)) {
- msgOpt.showOk = isValid;
- msgOpt.msg = msg;
- }
- }
- $(el).trigger('valid' + CLS_NS_RULE, [method, msgOpt.msg]);
- } else {
- /* rule message priority:
- 1. custom field message;
- 2. custom DOM message
- 3. global defined message;
- 4. rule returned message;
- 5. default message;
- */
- msgOpt.msg = (getDataMsg(el, field, msg, me.messages[method]) || defaults.defaultMsg).replace('{0}', field.display || '');
- $(el).trigger('invalid' + CLS_NS_RULE, [method, msgOpt.msg]);
- }
- }
- // output the debug message
- if (opt.debug) {
- debug.log(' ' + field._v + ': ' + method + ' => ' + (isValid || msgOpt.msg || isValid));
- }
- // the current rule has passed, continue to validate
- if (transfer || isValid && field._v < field.rules.length - 1) {
- field._v++;
- me._checkRule(el, field);
- }
- // field was invalid, or all fields was valid
- else {
- field._v = 0;
- $(el).trigger('validated' + CLS_NS_FIELD, [field, msgOpt]);
- }
- },
- // Verify a rule form a field
- _checkRule: function (el, field) {
- var me = this,
- ret,
- old,
- key = field.key,
- rule = field.rules[field._v],
- method = rule.method,
- params = rule.params;
- // request has been sent, wait it
- if (me.submiting && me.deferred[key]) return;
- old = field.old;
- field._r = method;
- if (!field.must && old.ret !== undefined &&
- old.rule === rule && old.id === el.id &&
- el.value && old.value === el.value) {
- // get result from cache
- ret = old.ret;
- }
- else {
- // get result from current rule
- ret = (getDataRule(el, method) || me.rules[method] || noop).call(me, el, params, field);
- }
- // asynchronous validation
- if (isObject(ret) && isFunction(ret.then)) {
- me.deferred[key] = ret;
- // show loading message
- !me.checkOnly && me.showMsg(el, {
- type: 'loading',
- msg: me.options.loadingMsg
- }, field);
- // waiting to parse the response data
- ret.then(
- function (d, textStatus, jqXHR) {
- var data = jqXHR.responseText,
- result,
- dataFilter = field.dataFilter || me.options.dataFilter;
- // detect if it is json format
- if (this.dataType === 'json') {
- data = d;
- } else if (data.charAt(0) === '{') {
- data = $.parseJSON(data) || {};
- }
- if (!isFunction(dataFilter)) {
- dataFilter = function (data) {
- if (isString(data) || (isObject(data) && ('error' in data || 'ok' in data))) return data;
- };
- }
- // filter data
- if ('status' in data && 'info' in data) {
- if (data.status) {
- result = {'ok': data.info}
- } else {
- result = {'error': data.info}
- }
- } else {
- result = dataFilter(data);
- if (result === undefined) result = dataFilter(data.data);
- }
- old.rule = rule;
- old.ret = result;
- $(el).trigger('validated' + CLS_NS_RULE, [field, result]);
- },
- function (jqXHR, textStatus) {
- $(el).trigger('validated' + CLS_NS_RULE, [field, textStatus]);
- }
- ).always(function () {
- delete me.deferred[key];
- });
- // whether the field valid is unknown
- field.isValid = undefined;
- }
- // other result
- else {
- $(el).trigger('validated' + CLS_NS_RULE, [field, ret]);
- }
- },
- // Processing the validation
- _validate: function (el, field) {
- // doesn't validate the element that has "disabled" or "novalidate" attribute
- if (el.disabled || attr(el, NOVALIDATE) !== null) return;
- var me = this,
- $el = $(el),
- msgOpt = {},
- group = field.group,
- ret,
- isValid = field.isValid = true;
- if (!field.rules) me._parse(el);
- if (me.options.debug) debug.info(field.key);
- // group validation
- if (group) {
- ret = group.callback.call(me, group.$elems);
- if (ret !== undefined) {
- me.hideMsg(group.target, {}, field);
- if (ret === true) ret = undefined;
- else {
- field._v = 0;
- field._r = 'group';
- isValid = false;
- me.hideMsg(el, {}, field);
- $.extend(msgOpt, group);
- }
- }
- }
- // if the field is not required and it has a blank value
- if (isValid && !field.required && !field.must && !el.value) {
- if (attr(el, DATA_INPUT_STATUS) === 'tip') {
- return;
- }
- if (!checkable(el)) {
- $el.trigger('validated' + CLS_NS_FIELD, [field, {isValid: true}]);
- return;
- }
- }
- // if the results are out
- if (ret !== undefined) {
- $el.trigger('validated' + CLS_NS_RULE, [field, ret, msgOpt]);
- } else if (field.rule) {
- me._checkRule(el, field);
- }
- },
- /* Detecting whether the value of an element that matches a rule
- *
- * @interface: test
- */
- test: function (el, rule) {
- var me = this,
- ret,
- parts = rRule.exec(rule),
- method,
- params;
- if (parts) {
- method = parts[1];
- if (method in me.rules) {
- params = parts[2] || parts[3];
- params = params ? params.split(', ') : undefined;
- ret = me.rules[method].call(me, el, params);
- }
- }
- return ret === true || ret === undefined || ret === null;
- },
- // Get a range of validation messages
- getRangeMsg: function (value, params, type, suffix) {
- if (!params) return;
- var me = this,
- msg = me.messages[type] || '',
- p = params[0].split('~'),
- a = p[0],
- b = p[1],
- c = 'rg',
- args = [''],
- isNumber = +value === +value;
- if (p.length === 2) {
- if (a && b) {
- if (isNumber && value >= +a && value <= +b) return true;
- args = args.concat(p);
- } else if (a && !b) {
- if (isNumber && value >= +a) return true;
- args.push(a);
- c = 'gt';
- } else if (!a && b) {
- if (isNumber && value <= +b) return true;
- args.push(b);
- c = 'lt';
- }
- } else {
- if (value === +a) return true;
- args.push(a);
- c = 'eq';
- }
- if (msg) {
- if (suffix && msg[c + suffix]) {
- c += suffix;
- }
- args[0] = msg[c];
- }
- return me.renderMsg.apply(null, args);
- },
- /* @interface: renderMsg
- */
- renderMsg: function () {
- var args = arguments,
- tpl = args[0],
- i = args.length;
- if (!tpl) return;
- while (--i) {
- tpl = tpl.replace('{' + i + '}', args[i]);
- }
- return tpl;
- },
- _getMsgOpt: function (obj) {
- return $.extend({}, this.msgOpt, isString(obj) ? {msg: obj} : obj);
- },
- _getMsgDOM: function (el, opt) {
- var $el = $(el), $msgbox, datafor, tgt;
- if ($el.is(':input')) {
- tgt = opt.target || attr(el, DATA_TARGET);
- if (tgt) {
- tgt = this.$el.find(tgt);
- if (tgt.length) {
- if (tgt.is(':input')) {
- el = tgt.get(0);
- } else {
- $msgbox = tgt;
- }
- }
- }
- if (!$msgbox) {
- datafor = !checkable(el) && el.id ? el.id : el.name;
- $msgbox = this.$el.find(opt.wrapper + '.' + CLS_MSG_BOX + '[for="' + datafor + '"]');
- }
- } else {
- $msgbox = $el;
- }
- if (!$msgbox.length) {
- $el = this.$el.find(tgt || el);
- $msgbox = $('<' + opt.wrapper + '>').attr({
- 'class': CLS_MSG_BOX + (opt.cls ? ' ' + opt.cls : ''),
- 'style': opt.style || '',
- 'for': datafor
- });
- if (checkable(el)) {
- var $parent = $el.parent();
- $msgbox.appendTo($parent.is('label') ? $parent.parent() : $parent);
- } else {
- $msgbox[!opt.pos || opt.pos === 'right' ? 'insertAfter' : 'insertBefore']($el);
- }
- }
- return $msgbox;
- },
- /* @interface: showMsg
- */
- showMsg: function (el, opt, /*INTERNAL*/ field) {
- var me = this;
- opt = me._getMsgOpt(opt);
- if (!opt.msg && !opt.showOk) return;
- el = $(el).get(0);
- if ($(el).is(INPUT_SELECTOR)) {
- // mark message status
- attr(el, DATA_INPUT_STATUS, opt.type);
- field = field || me.getField(el);
- if (field) {
- opt.style = field.msgStyle || opt.style;
- opt.cls = field.msgClass || opt.cls;
- opt.wrapper = field.msgWrapper || opt.wrapper;
- }
- }
- var $msgbox = me._getMsgDOM(el, opt),
- cls = $msgbox[0].className;
- !rPos.test(cls) && $msgbox.addClass(opt.cls);
- if (isIE6 && opt.pos === 'bottom') {
- $msgbox[0].style.marginTop = $(el).outerHeight() + 'px';
- }
- $msgbox.html(( (field || {}).msgMaker || me.options.msgMaker ).call(me, opt));
- $msgbox[0].style.display = '';
- isFunction(opt.show) && opt.show.call(me, $msgbox, opt.type);
- },
- /* @interface: hideMsg
- */
- hideMsg: function (el, opt, /*INTERNAL*/ field) {
- var me = this;
- el = $(el).get(0);
- opt = me._getMsgOpt(opt);
- if ($(el).is(INPUT_SELECTOR)) {
- attr(el, DATA_INPUT_STATUS, null);
- attr(el, ARIA_INVALID, null);
- field = field || me.getField(el);
- if (field) {
- opt.wrapper = field.msgWrapper || opt.wrapper;
- }
- }
- var $msgbox = me._getMsgDOM(el, opt);
- if (!$msgbox.length) return;
- if (isFunction(opt.hide)) {
- opt.hide.call(me, $msgbox, opt.type);
- } else {
- $msgbox[0].style.display = 'none';
- }
- },
- /* @interface: mapMsg
- */
- mapMsg: function (obj) {
- var me = this;
- $.each(obj, function (name, msg) {
- var el = me.elements[name] || me.$el.find(':input[name="' + name + '"]')[0];
- me.showMsg(el, msg);
- });
- },
- /* @interface: setMsg
- */
- setMsg: function (obj) {
- new Messages(obj, this.messages);
- },
- /* @interface: setRule
- */
- setRule: function (obj) {
- new Rules(obj, this.rules);
- $.map(this.fields, function (field) {
- field.old = {};
- });
- },
- // Get field information
- getField: function (el) {
- var me = this,
- key;
- if (el.id && '#' + el.id in me.fields || !el.name) {
- key = '#' + el.id;
- } else {
- key = el.name;
- }
- if (attr(el, DATA_RULE)) me._parse(el);
- return me.fields[key];
- },
- /* @interface: setField
- */
- setField: function (key, obj) {
- var fields = {};
- // update this field
- if (isString(key)) {
- fields[key] = obj;
- }
- // update fields
- else if (isObject(key)) {
- fields = key;
- }
- this._initFields(fields);
- },
- /* @interface: isFormValid
- */
- isFormValid: function () {
- var fields = this.fields;
- for (var k in fields) {
- if (!fields[k].isValid) {
- return fields[k].isValid;
- }
- }
- return true;
- },
- /* @interface: holdSubmit
- */
- holdSubmit: function (hold) {
- this.submiting = hold === undefined || hold;
- },
- /* @interface: cleanUp
- */
- cleanUp: function () {
- this._reset(1);
- },
- /* @interface: destroy
- */
- destroy: function () {
- this._reset(1);
- this.$el.off(CLS_NS).removeData(NS);
- attr(this.$el[0], NOVALIDATE, this._novalidate);
- }
- };
- // Rule class
- function Rules(obj, context) {
- var that = context ? context === true ? this : context : Rules.prototype;
- if (!isObject(obj)) return;
- for (var k in obj) {
- that[k] = getRule(obj[k]);
- }
- }
-
- // Message class
- function Messages(obj, context) {
- var that = context ? context === true ? this : context : Messages.prototype;
- if (!isObject(obj)) return;
- for (var k in obj) {
- if (!obj[k]) return;
- that[k] = obj[k];
- }
- }
-
- // Rule converted factory
- function getRule(fn) {
- switch ($.type(fn)) {
- case 'function':
- return fn;
- case 'array':
- return function (el) {
- return fn[0].test(el.value) || fn[1] || false;
- };
- case 'regexp':
- return function (el) {
- return fn.test(el.value);
- };
- }
- }
-
- // Convert space-separated keys to jQuery selector
- function keys2selector(keys) {
- var selector = '';
- $.map(keys.split(' '), function (k) {
- selector += ',' + (k.charAt(0) === '#' ? k : '[name="' + k + '"]');
- });
- return selector.substring(1);
- }
-
- // Get instance by an element
- function getInstance(el) {
- var wrap;
- if (!el || !el.tagName) return;
- switch (el.tagName) {
- case 'INPUT':
- case 'SELECT':
- case 'TEXTAREA':
- case 'BUTTON':
- case 'FIELDSET':
- wrap = el.form || $(el).closest('.' + CLS_WRAPPER);
- break;
- case 'FORM':
- wrap = el;
- break;
- default:
- wrap = $(el).closest('.' + CLS_WRAPPER);
- }
- return $(wrap).data(NS) || $(wrap)[NS]().data(NS);
- }
-
- function initByInput(e) {
- var el = e.currentTarget, me;
- if (!el.form || attr(el.form, NOVALIDATE) !== null) return;
- me = getInstance(el);
- if (me) {
- me._parse(el);
- me['_' + e.type](e);
- } else {
- attr(el, DATA_RULE, null);
- }
- }
-
- // Get custom rules on the node
- function getDataRule(el, method) {
- var fn = $.trim(attr(el, DATA_RULE + '-' + method));
- if (!fn) return;
- fn = (new Function("return " + fn))();
- if (fn) return getRule(fn);
- }
-
- // Get custom messages on the node
- function getDataMsg(el, field, ret, m) {
- var msg = field.msg,
- item = field._r;
- if (isObject(msg)) msg = msg[item];
- if (!isString(msg)) {
- msg = attr(el, DATA_MSG + '-' + item) || attr(el, DATA_MSG) || ret || ( m ? isString(m) ? m : m[item] : '');
- }
- return msg;
- }
-
- // Get message position
- function getPos(str) {
- var pos;
- if (str) pos = rPos.exec(str);
- return pos ? pos[1] : '';
- }
-
- // Check whether the element is checkbox or radio
- function checkable(el) {
- return el.tagName === 'INPUT' && el.type === 'checkbox' || el.type === 'radio';
- }
-
- // parse date string to timestamp
- function parseDate(str) {
- return Date.parse(str.replace(/\.|\-/g, '/'));
- }
-
- // Global events
- $(document)
- .on('focusin', ':input[' + DATA_RULE + ']', function (e) {
- initByInput(e);
- })
- .on('click', 'input,button', function (e) {
- var input = this;
- if (!input.form) return;
- if (input.type === 'submit') {
- if (attr(input, NOVALIDATE) !== null) {
- novalidateonce = true;
- }
- }
- else if (input.name && checkable(input)) {
- var elem = input.form.elements[input.name];
- if (elem.length) elem = elem[0];
- if (attr(elem, DATA_RULE)) {
- initByInput(e);
- }
- }
- })
- .on('submit validate', 'form', function (e) {
- if (attr(this, NOVALIDATE) !== null) return;
- var $form = $(this), me;
- if (!$form.data(NS)) {
- me = $form[NS]().data(NS);
- if (!$.isEmptyObject(me.fields)) {
- me._submit(e);
- } else {
- attr(this, NOVALIDATE, NOVALIDATE);
- $form.off(CLS_NS).removeData(NS);
- }
- }
- });
- // Built-in rules (global)
- new Rules({
- /** required
- * @example:
- required
- */
- required: function (element, params) {
- var val = $.trim(element.value),
- isValid = true;
- if (params) {
- if (params.length === 1) {
- if (!val && !this.test(element, params[0])) {
- attr(element, ARIA_REQUIRED, null);
- return null;
- } else {
- attr(element, ARIA_REQUIRED, true);
- }
- } else if (params[0] === 'not') {
- $.map(params.slice(1), function (v) {
- if (val === $.trim(v)) {
- isValid = false;
- }
- });
- }
- }
- return isValid && !!val;
- },
- /** integer
- * @example:
- integer
- integer[+]
- integer[+0]
- integer[-]
- integer[-0]
- */
- integer: function (element, params) {
- var re, z = '0|',
- p = '[1-9]\\d*',
- key = params ? params[0] : '*';
- switch (key) {
- case '+':
- re = p;
- break;
- case '-':
- re = '-' + p;
- break;
- case '+0':
- re = z + p;
- break;
- case '-0':
- re = z + '-' + p;
- break;
- default:
- re = z + '-?' + p;
- }
- re = '^(?:' + re + ')$';
- return new RegExp(re).test(element.value) || this.messages.integer[key];
- },
- /** match another field
- * @example:
- match[password] Match the password field (two values must be the same)
- match[eq, password] Ditto
- match[neq, count] The value must be not equal to the value of the count field
- match[lt, count] The value must be less than the value of the count field
- match[lte, count] The value must be less than or equal to the value of the count field
- match[gt, count] The value must be greater than the value of the count field
- match[gte, count] The value must be greater than or equal to the value of the count field
- **/
- match: function (element, params, field) {
- if (!params) return;
- var me = this,
- a, b,
- key, msg, type = 'eq',
- selector2, elem2, field2;
- if (params.length === 1) {
- key = params[0];
- } else {
- type = params[0];
- key = params[1];
- }
- selector2 = key.charAt(0) === '#' ? key : ':input[name="' + key + '"]';
- elem2 = me.$el.find(selector2)[0];
- // If the compared field is not exist
- if (!elem2) return;
- field2 = me.getField(elem2);
- a = element.value;
- b = elem2.value;
- if (!field._match) {
- me.$el.on('valid' + CLS_NS_FIELD + CLS_NS, selector2, function () {
- $(element).trigger('validate');
- });
- field._match = field2._match = 1;
- }
- // If both fields are blank
- if (!field.required && a === "" && b === "") {
- return null;
- }
- if (params[2]) {
- if (params[2] === 'date') {
- a = parseDate(a);
- b = parseDate(b);
- } else if (params[2] === 'time') {
- a = +a.replace(':', '');
- b = +b.replace(':', '');
- }
- }
- // If the compared field is incorrect, we only ensure that this field is correct.
- if (type !== "eq" && !isNaN(+a) && isNaN(+b)) {
- return true;
- }
- msg = me.messages.match[type].replace('{1}', field2.display || key);
- switch (type) {
- case 'lt':
- return (+a < +b) || msg;
- case 'lte':
- return (+a <= +b) || msg;
- case 'gte':
- return (+a >= +b) || msg;
- case 'gt':
- return (+a > +b) || msg;
- case 'neq':
- return (a !== b) || msg;
- default:
- return (a === b) || msg;
- }
- },
- /** range numbers
- * @example:
- range[0~99] Number 0-99
- range[0~] Number greater than or equal to 0
- range[~100] Number less than or equal to 100
- **/
- range: function (element, params) {
- return this.getRangeMsg(+element.value, params, 'range');
- },
- /** how many checkbox or radio inputs that checked
- * @example:
- checked; no empty, same to required
- checked[1~3] 1-3 items
- checked[1~] greater than 1 item
- checked[~3] less than 3 items
- checked[3] 3 items
- **/
- checked: function (element, params) {
- if (!checkable(element)) return;
- var me = this,
- elem, count;
- count = me.$el.find('input[name="' + element.name + '"]').filter(function () {
- var el = this;
- if (!elem && checkable(el)) elem = el;
- return !el.disabled && el.checked && $(el).is(':visible');
- }).length;
- if (params) {
- return me.getRangeMsg(count, params, 'checked');
- } else {
- return !!count || me.messages.required;
- }
- },
- /** length of a characters (You can pass the second parameter "true", will calculate the length in bytes)
- * @example:
- length[6~16] 6-16 characters
- length[6~] Greater than 6 characters
- length[~16] Less than 16 characters
- length[~16, true] Less than 16 characters, non-ASCII characters calculating two-character
- **/
- length: function (element, params) {
- if (!params) return;
- var value = element.value,
- len = (params[1] ? value.replace(rDoubleBytes, 'xx') : value).length;
- if (params[0].charAt(0) === '~') {
- params[0] = '0' + params[0];
- }
- return this.getRangeMsg(len, params, 'length', (params[1] ? '_2' : ''));
- },
- /** remote validation
- * remote([get:]url [, name1, [name2 ...]]);
- * Adaptation three kinds of results (Front for the successful, followed by a failure):
- 1. text:
- '' 'Error Message'
- 2. json:
- {"ok": ""} {"error": "Error Message"}
- 3. json wrapper:
- {"status": 1, "data": {"ok": ""}} {"status": 1, "data": {"error": "Error Message"}}
- * @example:
- The simplest: remote(path/to/server.php);
- With parameters: remote(path/to/server.php, name1, name2, ...);
- By GET: remote(get:path/to/server.php, name1, name2, ...);
- */
- remote: function (element, params) {
- if (!params) return;
- var me = this,
- arr = rAjaxType.exec(params[0]),
- url = arr[2],
- type = (arr[1] || 'POST').toUpperCase(),
- search,
- data = {};
- data[element.name] = element.value;
- // There are extra fields
- if (params[1]) {
- $.map(params.slice(1), function (name) {
- data[$.trim(name)] = me.$el.find(':input[name="' + name + '"]').val();
- });
- }
- data = $.param(data);
- if (type === 'POST') {
- search = url.indexOf('?');
- if (search !== -1) {
- data += '&' + url.substring(search + 1, url.length);
- url = url.substring(0, search);
- }
- }
- // Asynchronous validation need to return jqXHR objects
- return $.ajax({
- url: url,
- type: type,
- data: data,
- cache: false
- });
- },
- /** filters, direct filtration without prompting error (support custom regular expressions)
- * @example:
- * filter filter "<>"
- * filter(regexp) filter the "regexp" matched characters
- */
- filter: function (element, params) {
- element.value = element.value.replace(params ? (new RegExp("[" + params[0] + "]", "gm")) : rUnsafe, '');
- }
- });
- /** @interface: config
- * @usage:
- .config( obj )
- */
- Validator.config = function (obj) {
- $.each(obj, function (k, o) {
- if (k === 'rules') {
- new Rules(o);
- } else if (k === 'messages') {
- new Messages(o);
- } else {
- defaults[k] = o;
- }
- });
- };
- /** @interface: setTheme
- * @usage:
- .setTheme( name, obj )
- .setTheme( obj )
- */
- Validator.setTheme = function (name, obj) {
- if (isObject(name)) {
- $.each(name, function (i, o) {
- themes[i] = o;
- });
- } else if (isString(name) && isObject(obj)) {
- themes[name] = obj;
- }
- };
- $[NS] = Validator;
-})(jQuery);
-(function ($) {
- /* Global configuration
- */
- $.validator.config({
- //stopOnError: false,
- //theme: 'yellow_right',
- defaultMsg: "{0}格式不正确",
- loadingMsg: "正在验证...",
- // Custom rules
- rules: {
- digits: [/^\d+$/, "请输入数字"],
- letters: [/^[a-z]+$/i, "{0}只能输入字母"],
- en: [/^\w+$/i, "{0}只能输入字母和数字"],
- tel: [/^(?:(?:0\d{2,3}[- ]?[1-9]\d{6,7})|(?:[48]00[- ]?[1-9]\d{6}))$/, "电话格式不正确"],
- mobile: [/^1[3-9]\d{9}$/, "手机号格式不正确"],
- email: [/^(?:[a-z0-9]+[_\-+.]?)*[a-z0-9]+@(?:([a-z0-9]+-?)*[a-z0-9]+\.)+([a-z]{2,})+$/i, "邮箱格式不正确"],
- qq: [/^[1-9]\d{4,}$/, "QQ号格式不正确"],
- date: [/^\d{4}-\d{1,2}-\d{1,2}$/, "请输入正确的日期,例:yyyy-mm-dd"],
- time: [/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/, "请输入正确的时间,例:14:30或14:30:00"],
- ID_card: [/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[A-Z])$/, "请输入正确的身份证号码"],
- url: [/^(https?|ftp):\/\/[^\s]+$/i, "网址格式不正确"],
- postcode: [/^[1-9]\d{5}$/, "邮政编码格式不正确"],
- chinese: [/^[\u0391-\uFFE5]+$/, "请输入中文"],
- username: [/^\w{3,12}$/, "请输入3-12位数字、字母、下划线"],
- password: [/^[0-9a-zA-Z]{6,16}$/, "密码由6-16位数字、字母组成"],
- accept: function (element, params) {
- if (!params) return true;
- var ext = params[0];
- return (ext === '*') ||
- (new RegExp(".(?:" + (ext || "png|jpg|jpeg|gif") + ")$", "i")).test(element.value) ||
- this.renderMsg("只接受{1}后缀", ext.replace('|', ','));
- }
- }
- });
- /* Default error messages
- */
- $.validator.config({
- messages: {
- required: "{0}不能为空",
- remote: "{0}已被使用",
- integer: {
- '*': "请输入整数",
- '+': "请输入正整数",
- '+0': "请输入正整数或0",
- '-': "请输入负整数",
- '-0': "请输入负整数或0"
- },
- match: {
- eq: "{0}与{1}不一致",
- neq: "{0}与{1}不能相同",
- lt: "{0}必须小于{1}",
- gt: "{0}必须大于{1}",
- lte: "{0}必须小于或等于{1}",
- gte: "{0}必须大于或等于{1}"
- },
- range: {
- rg: "请输入{1}到{2}的数",
- gt: "请输入大于或等于{1}的数",
- lt: "请输入小于或等于{1}的数"
- },
- checked: {
- eq: "请选择{1}项",
- rg: "请选择{1}到{2}项",
- gt: "请至少选择{1}项",
- lt: "请最多选择{1}项"
- },
- length: {
- eq: "请输入{1}个字符",
- rg: "请输入{1}到{2}个字符",
- gt: "请输入大于{1}个字符",
- lt: "请输入小于{1}个字符",
- eq_2: "",
- rg_2: "",
- gt_2: "",
- lt_2: ""
- }
- }
- });
-})(jQuery);
\ No newline at end of file
diff --git a/public/plugin/zclip/zclip.js b/public/plugin/zclip/zclip.js
deleted file mode 100644
index 63921da..0000000
--- a/public/plugin/zclip/zclip.js
+++ /dev/null
@@ -1,397 +0,0 @@
-/*
- * zClip :: jQuery ZeroClipboard v1.1.1
- * http://steamdev.com/zclip
- *
- * Copyright 2011, SteamDev
- * Released under the MIT license.
- * http://www.opensource.org/licenses/mit-license.php
- *
- * Date: Wed Jun 01, 2011
- */
-(function ($) {
- $.fn.zclip = function (params) {
- if (typeof params == "object" && !params.length) {
- var settings = $.extend({
- path: 'ZeroClipboard.swf',
- copy: null,
- beforeCopy: null,
- afterCopy: null,
- clickAfter: true,
- setHandCursor: true,
- setCSSEffects: true
- }, params);
- return this.each(function () {
- var o = $(this);
- if (o.is(':visible') && (typeof settings.copy == 'string' || $.isFunction(settings.copy))) {
- ZeroClipboard.setMoviePath(settings.path);
- var clip = new ZeroClipboard.Client();
- if ($.isFunction(settings.copy)) {
- o.bind('zClip_copy', settings.copy);
- }
- if ($.isFunction(settings.beforeCopy)) {
- o.bind('zClip_beforeCopy', settings.beforeCopy);
- }
- if ($.isFunction(settings.afterCopy)) {
- o.bind('zClip_afterCopy', settings.afterCopy);
- }
- clip.setHandCursor(settings.setHandCursor);
- clip.setCSSEffects(settings.setCSSEffects);
- clip.addEventListener('mouseOver', function (client) {
- o.trigger('mouseenter');
- });
- clip.addEventListener('mouseOut', function (client) {
- o.trigger('mouseleave');
- });
- clip.addEventListener('mouseDown', function (client) {
- o.trigger('mousedown');
- if (!$.isFunction(settings.copy)) {
- clip.setText(settings.copy);
- } else {
- clip.setText(o.triggerHandler('zClip_copy'));
- }
- if ($.isFunction(settings.beforeCopy)) {
- o.trigger('zClip_beforeCopy');
- }
- });
- clip.addEventListener('complete', function (client, text) {
- if ($.isFunction(settings.afterCopy)) {
- o.trigger('zClip_afterCopy');
- } else {
- if (text.length > 500) {
- text = text.substr(0, 500) + "...\n\n(" + (text.length - 500) + " characters not shown)";
- }
- o.removeClass('hover');
- alert("Copied text to clipboard:\n\n " + text);
- }
- if (settings.clickAfter) {
- o.trigger('click');
- }
- });
- clip.glue(o[0], o.parent()[0]);
- $(window).bind('load resize', function () {
- clip.reposition();
- });
- }
- });
- } else if (typeof params == "string") {
- return this.each(function () {
- var o = $(this);
- params = params.toLowerCase();
- var zclipId = o.data('zclipId');
- var clipElm = $('#' + zclipId + '.zclip');
- if (params == "remove") {
- clipElm.remove();
- o.removeClass('active hover');
- } else if (params == "hide") {
- clipElm.hide();
- o.removeClass('active hover');
- } else if (params == "show") {
- clipElm.show();
- }
- });
- }
- }
-})(jQuery);
-// ZeroClipboard
-// Simple Set Clipboard System
-// Author: Joseph Huckaby
-var ZeroClipboard = {
- version: "1.0.7",
- clients: {},
- // registered upload clients on page, indexed by id
- moviePath: 'ZeroClipboard.swf',
- // URL to movie
- nextId: 1,
- // ID of next movie
- $: function (thingy) {
- // simple DOM lookup utility function
- if (typeof(thingy) == 'string') thingy = document.getElementById(thingy);
- if (!thingy.addClass) {
- // extend element with a few useful methods
- thingy.hide = function () {
- this.style.display = 'none';
- };
- thingy.show = function () {
- this.style.display = '';
- };
- thingy.addClass = function (name) {
- this.removeClass(name);
- this.className += ' ' + name;
- };
- thingy.removeClass = function (name) {
- var classes = this.className.split(/\s+/);
- var idx = -1;
- for (var k = 0; k < classes.length; k++) {
- if (classes[k] == name) {
- idx = k;
- k = classes.length;
- }
- }
- if (idx > -1) {
- classes.splice(idx, 1);
- this.className = classes.join(' ');
- }
- return this;
- };
- thingy.hasClass = function (name) {
- return !!this.className.match(new RegExp("\\s*" + name + "\\s*"));
- };
- }
- return thingy;
- },
- setMoviePath: function (path) {
- // set path to ZeroClipboard.swf
- this.moviePath = path;
- },
- dispatch: function (id, eventName, args) {
- // receive event from flash movie, send to client
- var client = this.clients[id];
- if (client) {
- client.receiveEvent(eventName, args);
- }
- },
- register: function (id, client) {
- // register new client to receive events
- this.clients[id] = client;
- },
- getDOMObjectPosition: function (obj, stopObj) {
- // get absolute coordinates for dom element
- var info = {
- left: 0,
- top: 0,
- width: obj.width ? obj.width : obj.offsetWidth,
- height: obj.height ? obj.height : obj.offsetHeight
- };
- if (obj && (obj != stopObj)) {
- info.left += obj.offsetLeft;
- info.top += obj.offsetTop;
- }
- return info;
- },
- Client: function (elem) {
- // constructor for new simple upload client
- this.handlers = {};
- // unique ID
- this.id = ZeroClipboard.nextId++;
- this.movieId = 'ZeroClipboardMovie_' + this.id;
- // register client with singleton to receive flash events
- ZeroClipboard.register(this.id, this);
- // create movie
- if (elem) this.glue(elem);
- }
-};
-ZeroClipboard.Client.prototype = {
- id: 0,
- // unique ID for us
- ready: false,
- // whether movie is ready to receive events or not
- movie: null,
- // reference to movie object
- clipText: '',
- // text to copy to clipboard
- handCursorEnabled: true,
- // whether to show hand cursor, or default pointer cursor
- cssEffects: true,
- // enable CSS mouse effects on dom container
- handlers: null,
- // user event handlers
- glue: function (elem, appendElem, stylesToAdd) {
- // glue to DOM element
- // elem can be ID or actual DOM element object
- this.domElement = ZeroClipboard.$(elem);
- // float just above object, or zIndex 99 if dom element isn't set
- var zIndex = 99;
- if (this.domElement.style.zIndex) {
- zIndex = parseInt(this.domElement.style.zIndex, 10) + 1;
- }
- if (typeof(appendElem) == 'string') {
- appendElem = ZeroClipboard.$(appendElem);
- } else if (typeof(appendElem) == 'undefined') {
- appendElem = document.getElementsByTagName('body')[0];
- }
- // find X/Y position of domElement
- var box = ZeroClipboard.getDOMObjectPosition(this.domElement, appendElem);
- // create floating DIV above element
- this.div = document.createElement('div');
- this.div.className = "zclip";
- this.div.id = "zclip-" + this.movieId;
- $(this.domElement).data('zclipId', 'zclip-' + this.movieId);
- var style = this.div.style;
- style.position = 'absolute';
- style.left = '' + box.left + 'px';
- style.top = '' + box.top + 'px';
- style.width = '' + box.width + 'px';
- style.height = '' + box.height + 'px';
- style.zIndex = zIndex;
- if (typeof(stylesToAdd) == 'object') {
- for (addedStyle in stylesToAdd) {
- style[addedStyle] = stylesToAdd[addedStyle];
- }
- }
- // style.backgroundColor = '#f00'; // debug
- appendElem.appendChild(this.div);
- this.div.innerHTML = this.getHTML(box.width, box.height);
- },
- getHTML: function (width, height) {
- // return HTML for movie
- var html = '';
- var flashvars = 'id=' + this.id + '&width=' + width + '&height=' + height;
- if (navigator.userAgent.match(/MSIE/)) {
- // IE gets an OBJECT tag
- var protocol = location.href.match(/^https/i) ? 'https://' : 'http://';
- html += ' ';
- } else {
- // all other browsers get an EMBED tag
- html += ' ';
- }
- return html;
- },
- hide: function () {
- // temporarily hide floater offscreen
- if (this.div) {
- this.div.style.left = '-2000px';
- }
- },
- show: function () {
- // show ourselves after a call to hide()
- this.reposition();
- },
- destroy: function () {
- // destroy control and floater
- if (this.domElement && this.div) {
- this.hide();
- this.div.innerHTML = '';
- var body = document.getElementsByTagName('body')[0];
- try {
- body.removeChild(this.div);
- } catch (e) {
- ;
- }
- this.domElement = null;
- this.div = null;
- }
- },
- reposition: function (elem) {
- // reposition our floating div, optionally to new container
- // warning: container CANNOT change size, only position
- if (elem) {
- this.domElement = ZeroClipboard.$(elem);
- if (!this.domElement) this.hide();
- }
- if (this.domElement && this.div) {
- var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
- var style = this.div.style;
- style.left = '' + box.left + 'px';
- style.top = '' + box.top + 'px';
- }
- },
- setText: function (newText) {
- // set text to be copied to clipboard
- this.clipText = newText;
- if (this.ready) {
- this.movie.setText(newText);
- }
- },
- addEventListener: function (eventName, func) {
- // add user event listener for event
- // event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel
- eventName = eventName.toString().toLowerCase().replace(/^on/, '');
- if (!this.handlers[eventName]) {
- this.handlers[eventName] = [];
- }
- this.handlers[eventName].push(func);
- },
- setHandCursor: function (enabled) {
- // enable hand cursor (true), or default arrow cursor (false)
- this.handCursorEnabled = enabled;
- if (this.ready) {
- this.movie.setHandCursor(enabled);
- }
- },
- setCSSEffects: function (enabled) {
- // enable or disable CSS effects on DOM container
- this.cssEffects = !!enabled;
- },
- receiveEvent: function (eventName, args) {
- // receive event from flash
- eventName = eventName.toString().toLowerCase().replace(/^on/, '');
- // special behavior for certain events
- switch (eventName) {
- case 'load':
- // movie claims it is ready, but in IE this isn't always the case...
- // bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function
- this.movie = document.getElementById(this.movieId);
- if (!this.movie) {
- var self = this;
- setTimeout(function () {
- self.receiveEvent('load', null);
- }, 1);
- return;
- }
- // firefox on pc needs a "kick" in order to set these in certain cases
- if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) {
- var self = this;
- setTimeout(function () {
- self.receiveEvent('load', null);
- }, 100);
- this.ready = true;
- return;
- }
- this.ready = true;
- try {
- this.movie.setText(this.clipText);
- } catch (e) {
- }
- try {
- this.movie.setHandCursor(this.handCursorEnabled);
- } catch (e) {
- }
- break;
- case 'mouseover':
- if (this.domElement && this.cssEffects) {
- this.domElement.addClass('hover');
- if (this.recoverActive) {
- this.domElement.addClass('active');
- }
- }
- break;
- case 'mouseout':
- if (this.domElement && this.cssEffects) {
- this.recoverActive = false;
- if (this.domElement.hasClass('active')) {
- this.domElement.removeClass('active');
- this.recoverActive = true;
- }
- this.domElement.removeClass('hover');
- }
- break;
- case 'mousedown':
- if (this.domElement && this.cssEffects) {
- this.domElement.addClass('active');
- }
- break;
- case 'mouseup':
- if (this.domElement && this.cssEffects) {
- this.domElement.removeClass('active');
- this.recoverActive = false;
- }
- break;
- } // switch eventName
- if (this.handlers[eventName]) {
- for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) {
- var func = this.handlers[eventName][idx];
- if (typeof(func) == 'function') {
- // actual function reference
- func(this, args);
- } else if ((typeof(func) == 'object') && (func.length == 2)) {
- // PHP style object + method, i.e. [myObject, 'myMethod']
- func[0][func[1]](this, args);
- } else if (typeof(func) == 'string') {
- // name of function
- window[func](this, args);
- }
- } // foreach event handler defined
- } // user defined handler for event
- }
-};
-
diff --git a/public/plugin/zclip/zclip.min.js b/public/plugin/zclip/zclip.min.js
deleted file mode 100644
index 2ccd4be..0000000
--- a/public/plugin/zclip/zclip.min.js
+++ /dev/null
@@ -1,314 +0,0 @@
-(function (a) {
- a.fn.zclip = function (c) {
- if (typeof c == "object" && !c.length) {
- var b = a.extend({path: "ZeroClipboard.swf", copy: null, beforeCopy: null, afterCopy: null, clickAfter: true, setHandCursor: true, setCSSEffects: true}, c);
- return this.each(function () {
- var e = a(this);
- if (e.is(":visible") && (typeof b.copy == "string" || a.isFunction(b.copy))) {
- ZeroClipboard.setMoviePath(b.path);
- var d = new ZeroClipboard.Client();
- if (a.isFunction(b.copy)) {
- e.bind("zClip_copy", b.copy)
- }
- if (a.isFunction(b.beforeCopy)) {
- e.bind("zClip_beforeCopy", b.beforeCopy)
- }
- if (a.isFunction(b.afterCopy)) {
- e.bind("zClip_afterCopy", b.afterCopy)
- }
- d.setHandCursor(b.setHandCursor);
- d.setCSSEffects(b.setCSSEffects);
- d.addEventListener("mouseOver", function (f) {
- e.trigger("mouseenter")
- });
- d.addEventListener("mouseOut", function (f) {
- e.trigger("mouseleave")
- });
- d.addEventListener("mouseDown", function (f) {
- e.trigger("mousedown");
- if (!a.isFunction(b.copy)) {
- d.setText(b.copy)
- } else {
- d.setText(e.triggerHandler("zClip_copy"))
- }
- if (a.isFunction(b.beforeCopy)) {
- e.trigger("zClip_beforeCopy")
- }
- });
- d.addEventListener("complete", function (f, g) {
- if (a.isFunction(b.afterCopy)) {
- e.trigger("zClip_afterCopy")
- } else {
- if (g.length > 500) {
- g = g.substr(0, 500) + "...\n\n(" + (g.length - 500) + " characters not shown)"
- }
- e.removeClass("hover");
- alert("Copied text to clipboard:\n\n " + g)
- }
- if (b.clickAfter) {
- e.trigger("click")
- }
- });
- d.glue(e[0], e.parent()[0]);
- a(window).bind("load resize", function () {
- d.reposition()
- })
- }
- })
- } else {
- if (typeof c == "string") {
- return this.each(function () {
- var f = a(this);
- c = c.toLowerCase();
- var e = f.data("zclipId");
- var d = a("#" + e + ".zclip");
- if (c == "remove") {
- d.remove();
- f.removeClass("active hover")
- } else {
- if (c == "hide") {
- d.hide();
- f.removeClass("active hover")
- } else {
- if (c == "show") {
- d.show()
- }
- }
- }
- })
- }
- }
- }
-})(jQuery);
-var ZeroClipboard = {
- version: "1.0.7", clients: {}, moviePath: "ZeroClipboard.swf", nextId: 1, $: function (a) {
- if (typeof(a) == "string") {
- a = document.getElementById(a)
- }
- if (!a.addClass) {
- a.hide = function () {
- this.style.display = "none"
- };
- a.show = function () {
- this.style.display = ""
- };
- a.addClass = function (b) {
- this.removeClass(b);
- this.className += " " + b
- };
- a.removeClass = function (d) {
- var e = this.className.split(/\s+/);
- var b = -1;
- for (var c = 0; c < e.length; c++) {
- if (e[c] == d) {
- b = c;
- c = e.length
- }
- }
- if (b > -1) {
- e.splice(b, 1);
- this.className = e.join(" ")
- }
- return this
- };
- a.hasClass = function (b) {
- return !!this.className.match(new RegExp("\\s*" + b + "\\s*"))
- }
- }
- return a
- }, setMoviePath: function (a) {
- this.moviePath = a
- }, dispatch: function (d, b, c) {
- var a = this.clients[d];
- if (a) {
- a.receiveEvent(b, c)
- }
- }, register: function (b, a) {
- this.clients[b] = a
- }, getDOMObjectPosition: function (c, a) {
- var b = {left: 0, top: 0, width: c.width ? c.width : c.offsetWidth, height: c.height ? c.height : c.offsetHeight};
- if (c && (c != a)) {
- b.left += c.offsetLeft;
- b.top += c.offsetTop
- }
- return b
- }, Client: function (a) {
- this.handlers = {};
- this.id = ZeroClipboard.nextId++;
- this.movieId = "ZeroClipboardMovie_" + this.id;
- ZeroClipboard.register(this.id, this);
- if (a) {
- this.glue(a)
- }
- }
-};
-ZeroClipboard.Client.prototype = {
- id: 0, ready: false, movie: null, clipText: "", handCursorEnabled: true, cssEffects: true, handlers: null, glue: function (d, b, e) {
- this.domElement = ZeroClipboard.$(d);
- var f = 99;
- if (this.domElement.style.zIndex) {
- f = parseInt(this.domElement.style.zIndex, 10) + 1
- }
- if (typeof(b) == "string") {
- b = ZeroClipboard.$(b)
- } else {
- if (typeof(b) == "undefined") {
- b = document.getElementsByTagName("body")[0]
- }
- }
- var c = ZeroClipboard.getDOMObjectPosition(this.domElement, b);
- this.div = document.createElement("div");
- this.div.className = "zclip";
- this.div.id = "zclip-" + this.movieId;
- $(this.domElement).data("zclipId", "zclip-" + this.movieId);
- var a = this.div.style;
- a.position = "absolute";
- a.left = "" + c.left + "px";
- a.top = "" + c.top + "px";
- a.width = "" + c.width + "px";
- a.height = "" + c.height + "px";
- a.zIndex = f;
- if (typeof(e) == "object") {
- for (addedStyle in e) {
- a[addedStyle] = e[addedStyle]
- }
- }
- b.appendChild(this.div);
- this.div.innerHTML = this.getHTML(c.width, c.height)
- }, getHTML: function (d, a) {
- var c = "";
- var b = "id=" + this.id + "&width=" + d + "&height=" + a;
- if (navigator.userAgent.match(/MSIE/)) {
- var e = location.href.match(/^https/i) ? "https://" : "http://";
- c += ' '
- } else {
- c += ' '
- }
- return c
- }, hide: function () {
- if (this.div) {
- this.div.style.left = "-2000px"
- }
- }, show: function () {
- this.reposition()
- }, destroy: function () {
- if (this.domElement && this.div) {
- this.hide();
- this.div.innerHTML = "";
- var a = document.getElementsByTagName("body")[0];
- try {
- a.removeChild(this.div)
- } catch (b) {
- }
- this.domElement = null;
- this.div = null
- }
- }, reposition: function (c) {
- if (c) {
- this.domElement = ZeroClipboard.$(c);
- if (!this.domElement) {
- this.hide()
- }
- }
- if (this.domElement && this.div) {
- var b = ZeroClipboard.getDOMObjectPosition(this.domElement);
- var a = this.div.style;
- a.left = "" + b.left + "px";
- a.top = "" + b.top + "px"
- }
- }, setText: function (a) {
- this.clipText = a;
- if (this.ready) {
- this.movie.setText(a)
- }
- }, addEventListener: function (a, b) {
- a = a.toString().toLowerCase().replace(/^on/, "");
- if (!this.handlers[a]) {
- this.handlers[a] = []
- }
- this.handlers[a].push(b)
- }, setHandCursor: function (a) {
- this.handCursorEnabled = a;
- if (this.ready) {
- this.movie.setHandCursor(a)
- }
- }, setCSSEffects: function (a) {
- this.cssEffects = !!a
- }, receiveEvent: function (d, f) {
- d = d.toString().toLowerCase().replace(/^on/, "");
- switch (d) {
- case"load":
- this.movie = document.getElementById(this.movieId);
- if (!this.movie) {
- var c = this;
- setTimeout(function () {
- c.receiveEvent("load", null)
- }, 1);
- return
- }
- if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) {
- var c = this;
- setTimeout(function () {
- c.receiveEvent("load", null)
- }, 100);
- this.ready = true;
- return
- }
- this.ready = true;
- try {
- this.movie.setText(this.clipText)
- } catch (h) {
- }
- try {
- this.movie.setHandCursor(this.handCursorEnabled)
- } catch (h) {
- }
- break;
- case"mouseover":
- if (this.domElement && this.cssEffects) {
- this.domElement.addClass("hover");
- if (this.recoverActive) {
- this.domElement.addClass("active")
- }
- }
- break;
- case"mouseout":
- if (this.domElement && this.cssEffects) {
- this.recoverActive = false;
- if (this.domElement.hasClass("active")) {
- this.domElement.removeClass("active");
- this.recoverActive = true
- }
- this.domElement.removeClass("hover")
- }
- break;
- case"mousedown":
- if (this.domElement && this.cssEffects) {
- this.domElement.addClass("active")
- }
- break;
- case"mouseup":
- if (this.domElement && this.cssEffects) {
- this.domElement.removeClass("active");
- this.recoverActive = false
- }
- break
- }
- if (this.handlers[d]) {
- for (var b = 0, a = this.handlers[d].length; b < a; b++) {
- var g = this.handlers[d][b];
- if (typeof(g) == "function") {
- g(this, f)
- } else {
- if ((typeof(g) == "object") && (g.length == 2)) {
- g[0][g[1]](this, f)
- } else {
- if (typeof(g) == "string") {
- window[g](this, f)
- }
- }
- }
- }
- }
- }
-};
\ No newline at end of file
diff --git a/public/plugin/zclip/zclip.swf b/public/plugin/zclip/zclip.swf
deleted file mode 100644
index 13bf8e3..0000000
Binary files a/public/plugin/zclip/zclip.swf and /dev/null differ
diff --git a/public/script/angular.init.js b/public/script/angular.init.js
deleted file mode 100644
index 58fcbdd..0000000
--- a/public/script/angular.init.js
+++ /dev/null
@@ -1,28 +0,0 @@
-angular.module('ptcms', []).config(function($httpProvider){
- //对php的post处理
- $httpProvider.defaults.transformRequest = function(request){
- if(typeof(request)!='object'){
- return request;
- }
- var str = [];
- for(var k in request){
- if(k.charAt(0)=='$'){
- delete request[k];
- continue;
- }
- var v='object'==typeof(request[k])?JSON.stringify(request[k]):request[k];
- str.push(encodeURIComponent(k) + "=" + encodeURIComponent(v));
- }
- return str.join("&");
- };
- $httpProvider.defaults.timeout=10000;
- $httpProvider.defaults.headers.post = {
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'X-Requested-With': 'XMLHttpRequest'
- };
-}).filter('to_trusted', ['$sce', function($sce){
- return function(text) {
- return $sce.trustAsHtml(text);
- };
-}]);
-;
\ No newline at end of file
diff --git a/public/script/angular.min.js b/public/script/angular.min.js
deleted file mode 100644
index 6d2d8f5..0000000
--- a/public/script/angular.min.js
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- AngularJS v1.3.0-beta.8
- (c) 2010-2014 Google, Inc. http://angularjs.org
- License: MIT
-*/
-(function(M,T,r){'use strict';function B(b){return function(){var a=arguments[0],c,a="["+(b?b+":":"")+a+"] http://errors.angularjs.org/1.3.0-beta.8/"+(b?b+"/":"")+a;for(c=1;c").append(b).html();try{return 3===b[0].nodeType?z(c):c.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(a,b){return"<"+z(b)})}catch(d){return z(c)}}function fc(b){try{return decodeURIComponent(b)}catch(a){}}function gc(b){var a={},c,d;q((b||"").split("&"),function(b){b&&(c=b.split("="),d=fc(c[0]),C(d)&&(b=C(c[1])?fc(c[1]):!0,a[d]?N(a[d])?a[d].push(b):a[d]=[a[d],b]:a[d]=b))});return a}function Db(b){var a=[];q(b,function(b,d){N(b)?q(b,function(b){a.push(za(d,!0)+(!0===b?"":"="+za(b,!0)))}):
-a.push(za(d,!0)+(!0===b?"":"="+za(b,!0)))});return a.length?a.join("&"):""}function kb(b){return za(b,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function za(b,a){return encodeURIComponent(b).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,a?"%20":"+")}function kd(b,a){var c,d,e=hc.length;b=E(b);for(d=0;d$2>")+d[2];for(d=d[0];d--;)c=c.lastChild;f=f.concat(qa.call(c.childNodes,void 0));c=e.firstChild;c.textContent=""}else f.push(a.createTextNode(b));e.textContent="";e.innerHTML="";q(f,function(a){e.appendChild(a)});return e}function W(b){if(b instanceof W)return b;y(b)&&(b=aa(b));if(!(this instanceof W)){if(y(b)&&"<"!=b.charAt(0))throw Kb("nosel");return new W(b)}if(y(b)){var a;a=T;var c;b=(c=De.exec(b))?
-[a.createElement(c[1])]:(c=Ae(b,a))?c.childNodes:[]}pc(this,b)}function Lb(b){return b.cloneNode(!0)}function Ia(b){qc(b);var a=0;for(b=b.childNodes||[];a=X?(c.preventDefault=null,c.stopPropagation=null,c.isDefaultPrevented=null):(delete c.preventDefault,delete c.stopPropagation,delete c.isDefaultPrevented)};c.elem=
-b;return c}function Ja(b){var a=typeof b,c;"object"==a&&null!==b?"function"==typeof(c=b.$$hashKey)?c=b.$$hashKey():c===r&&(c=b.$$hashKey=gb()):c=b;return a+":"+c}function Ya(b){q(b,this.put,this)}function Ge(b){return(b=b.toString().replace(xc,"").match(yc))?"function("+(b[1]||"").replace(/[\s\r\n]+/," ")+")":"fn"}function Nb(b,a,c){var d;if("function"==typeof b){if(!(d=b.$inject)){d=[];if(b.length){if(a)throw y(c)&&c||(c=b.name||Ge(b)),Ka("strictdi",c);a=b.toString().replace(xc,"");a=a.match(yc);
-q(a[1].split(He),function(a){a.replace(Ie,function(a,b,c){d.push(c)})})}b.$inject=d}}else N(b)?(a=b.length-1,Ta(b[a],"fn"),d=b.slice(0,a)):Ta(b,"fn",!0);return d}function Eb(b,a){function c(a){return function(b,c){if(V(b))q(b,$b(a));else return a(b,c)}}function d(a,b){Aa(a,"service");if(P(b)||N(b))b=m.instantiate(b);if(!b.$get)throw Ka("pget",a);return n[a+p]=b}function e(a,b){return d(a,{$get:b})}function f(a){var b=[],c;q(a,function(a){function d(a){var b,c;b=0;for(c=a.length;b 4096 bytes)!"));else{if(p.cookie!==L)for(L=p.cookie,d=L.split("; "),R={},f=0;fk&&this.remove(m.key),b},get:function(a){if(k").parent()[0])});var f=R(a,b,a,c,d,e);O(a,"ng-scope");return function(b,
-c,d){Fb(b,"scope");var e=c?La.clone.call(a):a;q(d,function(a,b){e.data("$"+b+"Controller",a)});d=0;for(var g=e.length;darguments.length&&(b=a,a=r);Na&&(c=Z);return m(a,b,c)}var x,v,zc,u,ba,S,Z={},ea;x=c===f?d:cc(d,new Ob(E(f),d.$attr));v=x.$$element;if(L){var Q=/^\s*([@=&])(\??)\s*(\w*)\s*$/;g=E(f);S=e.$new(!0);!R||R!==L&&R!==L.$$originalDirective?g.data("$isolateScopeNoTemplate",S):g.data("$isolateScope",S);O(g,"ng-isolate-scope");q(L.scope,function(a,c){var d=
-a.match(Q)||[],f=d[3]||c,g="?"==d[2],d=d[1],h,k,m,n;S.$$isolateBindings[c]=d+f;switch(d){case "@":x.$observe(f,function(a){S[c]=a});x.$$observers[f].$$scope=e;x[f]&&(S[c]=b(x[f])(e));break;case "=":if(g&&!x[f])break;k=t(x[f]);n=k.literal?ya:function(a,b){return a===b};m=k.assign||function(){h=S[c]=k(e);throw ja("nonassign",x[f],L.name);};h=S[c]=k(e);S.$watch(function(){var a=k(e);n(a,S[c])||(n(a,h)?m(e,a=S[c]):S[c]=a);return h=a},null,k.literal);break;case "&":k=t(x[f]);S[c]=function(a){return k(e,
-a)};break;default:throw ja("iscp",L.name,c,a);}})}ea=m&&s;G&&q(G,function(a){var b={$scope:a===L||a.$$isolateScope?S:e,$element:v,$attrs:x,$transclude:ea},c;ba=a.controller;"@"==ba&&(ba=x[a.name]);c=J(ba,b);Z[a.name]=c;Na||v.data("$"+a.name+"Controller",c);a.controllerAs&&(b.$scope[a.controllerAs]=c)});g=0;for(zc=h.length;gH.priority)break;if(Q=H.scope)v=v||H,H.templateUrl||($a("new/isolated scope",
-L,H,K),V(Q)&&(L=H));F=H.name;!H.templateUrl&&H.controller&&(Q=H.controller,G=G||{},$a("'"+F+"' controller",G[F],H,K),G[F]=H);if(Q=H.transclude)C=!0,H.$$tlb||($a("transclusion",ea,H,K),ea=H),"element"==Q?(Na=!0,x=H.priority,Q=u(c,Za,U),K=d.$$element=E(T.createComment(" "+F+": "+d[F]+" ")),c=K[0],sb(f,E(qa.call(Q,0)),c),z=Z(Q,e,x,g&&g.name,{nonTlbTranscludeDirective:ea})):(Q=E(Lb(c)).contents(),K.empty(),z=Z(Q,e));if(H.template)if($a("template",R,H,K),R=H,Q=P(H.template)?H.template(K,d):H.template,
-Q=Bc(Q),H.replace){g=H;Q=Jb.test(Q)?E(W(H.type,aa(Q))):[];c=Q[0];if(1!=Q.length||1!==c.nodeType)throw ja("tplrt",F,"");sb(f,K,c);sa={$attr:{}};Q=S(c,[],sa);var X=a.splice(M+1,a.length-(M+1));L&&rb(Q);a=a.concat(Q).concat(X);w(d,sa);sa=a.length}else K.html(Q);if(H.templateUrl)$a("template",R,H,K),R=H,H.replace&&(g=H),D=I(a.splice(M,a.length-M),K,d,f,z,h,k,{controllerDirectives:G,newIsolateScopeDirective:L,templateDirective:R,nonTlbTranscludeDirective:ea}),sa=a.length;else if(H.compile)try{B=H.compile(K,
-d,z),P(B)?s(null,B,Za,U):B&&s(B.pre,B.post,Za,U)}catch(Y){n(Y,ia(K))}H.terminal&&(D.terminal=!0,x=Math.max(x,H.priority))}D.scope=v&&!0===v.scope;D.transclude=C&&z;m.hasElementTranscludeDirective=Na;return D}function rb(a){for(var b=0,c=a.length;bs.priority)&&-1!=s.restrict.indexOf(f)&&(l&&(s=bc(s,{$$start:l,$$end:m})),
-b.push(s),h=s)}catch(t){n(t)}}return h}function w(a,b){var c=b.$attr,d=a.$attr,e=a.$$element;q(a,function(d,e){"$"!=e.charAt(0)&&(b[e]&&(d+=("style"===e?";":" ")+b[e]),a.$set(e,d,!0,c[e]))});q(b,function(b,f){"class"==f?(O(e,b),a["class"]=(a["class"]?a["class"]+" ":"")+b):"style"==f?(e.attr("style",e.attr("style")+";"+b),a.style=(a.style?a.style+";":"")+b):"$"==f.charAt(0)||a.hasOwnProperty(f)||(a[f]=b,d[f]=c[f])})}function I(a,b,c,d,e,f,g,h){var k=[],l,n,A=b[0],D=a.shift(),t=F({},D,{templateUrl:null,
-transclude:null,replace:null,$$originalDirective:D}),J=P(D.templateUrl)?D.templateUrl(b,c):D.templateUrl,v=D.type;b.empty();m.get(x.getTrustedResourceUrl(J),{cache:s}).success(function(m){var s,x;m=Bc(m);if(D.replace){m=Jb.test(m)?E(W(v,aa(m))):[];s=m[0];if(1!=m.length||1!==s.nodeType)throw ja("tplrt",D.name,J);m={$attr:{}};sb(d,b,s);var G=S(s,[],m);V(D.scope)&&rb(G);a=G.concat(a);w(c,m)}else s=A,b.html(m);a.unshift(t);l=ea(a,s,c,e,b,D,f,g,h);q(d,function(a,c){a==s&&(d[c]=b[0])});for(n=R(b[0].childNodes,
-e);k.length;){m=k.shift();x=k.shift();var u=k.shift(),ba=k.shift(),G=b[0];if(x!==A){var Z=x.className;h.hasElementTranscludeDirective&&D.replace||(G=Lb(s));sb(u,E(x),G);O(E(G),Z)}x=l.transclude?L(m,l.transclude):ba;l(n,m,G,d,x)}k=null}).error(function(a,b,c,d){throw ja("tpload",d.url);});return function(a,b,c,d,e){k?(k.push(b),k.push(c),k.push(d),k.push(e)):l(n,b,c,d,e)}}function B(a,b){var c=b.priority-a.priority;return 0!==c?c:a.name!==b.name?a.name"+b+""+a+">";return c.childNodes[0].childNodes;default:return b}}function Na(a,b){if("srcdoc"==b)return x.HTML;var c=Ma(a);
-if("xlinkHref"==b||"FORM"==c&&"action"==b||"IMG"!=c&&("src"==b||"ngSrc"==b))return x.RESOURCE_URL}function Q(a,c,d,e){var f=b(d,!0);if(f){if("multiple"===e&&"SELECT"===Ma(a))throw ja("selmulti",ia(a));c.push({priority:100,compile:function(){return{pre:function(c,d,k){d=k.$$observers||(k.$$observers={});if(g.test(e))throw ja("nodomevents");if(f=b(k[e],!0,Na(a,e),h[e]))k[e]=f(c),(d[e]||(d[e]=[])).$$inter=!0,(k.$$observers&&k.$$observers[e].$$scope||c).$watch(f,function(a,b){"class"===e&&a!=b?k.$updateClass(a,
-b):k.$set(e,a)})}}}})}}function sb(a,b,c){var d=b[0],e=b.length,f=d.parentNode,g,h;if(a)for(g=0,h=a.length;ga.status?b:l.reject(b)}var d={method:"get",transformRequest:e.transformRequest,
-transformResponse:e.transformResponse},f=function(a){function b(a){var c;q(a,function(b,d){P(b)&&(c=b(),null!=c?a[d]=c:delete a[d])})}var c=e.headers,d=F({},a.headers),f,g,c=F({},c.common,c[z(a.method)]);b(c);b(d);a:for(f in c){a=z(f);for(g in d)if(z(g)===a)continue a;d[f]=c[f]}return d}(a);F(d,a);d.headers=f;d.method=Ga(d.method);(a=Pb(d.url)?b.cookies()[d.xsrfCookieName||e.xsrfCookieName]:r)&&(f[d.xsrfHeaderName||e.xsrfHeaderName]=a);var h=[function(a){f=a.headers;var b=Fc(a.data,Ec(f),a.transformRequest);
-I(a.data)&&q(f,function(a,b){"content-type"===z(b)&&delete f[b]});I(a.withCredentials)&&!I(e.withCredentials)&&(a.withCredentials=e.withCredentials);return s(a,b,f).then(c,c)},r],k=l.when(d);for(q(A,function(a){(a.request||a.requestError)&&h.unshift(a.request,a.requestError);(a.response||a.responseError)&&h.push(a.response,a.responseError)});h.length;){a=h.shift();var p=h.shift(),k=k.then(a,p)}k.success=function(a){k.then(function(b){a(b.data,b.status,b.headers,d)});return k};k.error=function(a){k.then(null,
-function(b){a(b.data,b.status,b.headers,d)});return k};return k}function s(b,c,f){function g(a,b,c,e){q&&(200<=a&&300>a?q.put(ba,[a,b,Dc(c),e]):q.remove(ba));p(b,a,c,e);d.$$phase||d.$apply()}function p(a,c,d,e){c=Math.max(c,0);(200<=c&&300>c?s.resolve:s.reject)({data:a,status:c,headers:Ec(d),config:b,statusText:e})}function n(){var a=ib(m.pendingRequests,b);-1!==a&&m.pendingRequests.splice(a,1)}var s=l.defer(),A=s.promise,q,u,ba=t(b.url,b.params);m.pendingRequests.push(b);A.then(n,n);(b.cache||e.cache)&&
-(!1!==b.cache&&"GET"==b.method)&&(q=V(b.cache)?b.cache:V(e.cache)?e.cache:J);if(q)if(u=q.get(ba),C(u)){if(u.then)return u.then(n,n),u;N(u)?p(u[1],u[0],da(u[2]),u[3]):p(u,200,{},"OK")}else q.put(ba,A);I(u)&&a(b.method,ba,c,g,f,b.timeout,b.withCredentials,b.responseType);return A}function t(a,b){if(!b)return a;var c=[];fd(b,function(a,b){null===a||I(a)||(N(a)||(a=[a]),q(a,function(a){V(a)&&(a=ra(a));c.push(za(b)+"="+za(a))}))});0=X&&(!b.match(/^(get|post|head|put|delete|options)$/i)||!M.XMLHttpRequest))return new M.ActiveXObject("Microsoft.XMLHTTP");
-if(M.XMLHttpRequest)return new M.XMLHttpRequest;throw B("$httpBackend")("noxhr");}function ke(){this.$get=["$browser","$window","$document",function(b,a,c){return Ne(b,Me,b.defer,a.angular.callbacks,c[0])}]}function Ne(b,a,c,d,e){function f(a,b,c){var f=e.createElement("script"),h=null;f.type="text/javascript";f.src=a;f.async=!0;h=function(a){Wa(f,"load",h);Wa(f,"error",h);e.body.removeChild(f);f=null;var g=-1,t="unknown";a&&("load"!==a.type||d[b].called||(a={type:"error"}),t=a.type,g="error"===a.type?
-404:200);c&&c(g,t)};tb(f,"load",h);tb(f,"error",h);e.body.appendChild(f);return h}var h=-1;return function(e,p,k,l,n,m,s,t){function J(){D=h;G&&G();v&&v.abort()}function A(a,d,e,f,g){O&&c.cancel(O);G=v=null;0===d&&(d=e?200:"file"==ta(p).protocol?404:0);a(1223===d?204:d,e,f,g||"");b.$$completeOutstandingRequest(w)}var D;b.$$incOutstandingRequestCount();p=p||b.url();if("jsonp"==z(e)){var x="_"+(d.counter++).toString(36);d[x]=function(a){d[x].data=a;d[x].called=!0};var G=f(p.replace("JSON_CALLBACK",
-"angular.callbacks."+x),x,function(a,b){A(l,a,d[x].data,"",b);d[x]=w})}else{var v=a(e);v.open(e,p,!0);q(n,function(a,b){C(a)&&v.setRequestHeader(b,a)});v.onreadystatechange=function(){if(v&&4==v.readyState){var a=null,b=null;D!==h&&(a=v.getAllResponseHeaders(),b="response"in v?v.response:v.responseText);A(l,D||v.status,b,a,v.statusText||"")}};s&&(v.withCredentials=!0);if(t)try{v.responseType=t}catch(r){if("json"!==t)throw r;}v.send(k||null)}if(0=g&&(n.resolve(s),l(m.$$intervalId),delete e[m.$$intervalId]);t||b.$apply()},h);e[m.$$intervalId]=n;return m}var e={};d.cancel=function(a){return a&&a.$$intervalId in e?(e[a.$$intervalId].reject("canceled"),clearInterval(a.$$intervalId),delete e[a.$$intervalId],!0):!1};return d}]}function qd(){this.$get=function(){return{id:"en-us",NUMBER_FORMATS:{DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{minInt:1,minFrac:0,maxFrac:3,posPre:"",posSuf:"",negPre:"-",negSuf:"",gSize:3,
-lgSize:3},{minInt:1,minFrac:2,maxFrac:2,posPre:"\u00a4",posSuf:"",negPre:"(\u00a4",negSuf:")",gSize:3,lgSize:3}],CURRENCY_SYM:"$"},DATETIME_FORMATS:{MONTH:"January February March April May June July August September October November December".split(" "),SHORTMONTH:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),DAY:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),SHORTDAY:"Sun Mon Tue Wed Thu Fri Sat".split(" "),AMPMS:["AM","PM"],medium:"MMM d, y h:mm:ss a","short":"M/d/yy h:mm a",
-fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",mediumDate:"MMM d, y",shortDate:"M/d/yy",mediumTime:"h:mm:ss a",shortTime:"h:mm a"},pluralCat:function(b){return 1===b?"one":"other"}}}}function Qb(b){b=b.split("/");for(var a=b.length;a--;)b[a]=kb(b[a]);return b.join("/")}function Hc(b,a,c){b=ta(b,c);a.$$protocol=b.protocol;a.$$host=b.hostname;a.$$port=U(b.port)||Oe[b.protocol]||null}function Ic(b,a,c){var d="/"!==b.charAt(0);d&&(b="/"+b);b=ta(b,c);a.$$path=decodeURIComponent(d&&"/"===b.pathname.charAt(0)?
-b.pathname.substring(1):b.pathname);a.$$search=gc(b.search);a.$$hash=decodeURIComponent(b.hash);a.$$path&&"/"!=a.$$path.charAt(0)&&(a.$$path="/"+a.$$path)}function na(b,a){if(0===a.indexOf(b))return a.substr(b.length)}function ab(b){var a=b.indexOf("#");return-1==a?b:b.substr(0,a)}function Rb(b){return b.substr(0,ab(b).lastIndexOf("/")+1)}function Jc(b,a){this.$$html5=!0;a=a||"";var c=Rb(b);Hc(b,this,b);this.$$parse=function(a){var e=na(c,a);if(!y(e))throw Sb("ipthprfx",a,c);Ic(e,this,b);this.$$path||
-(this.$$path="/");this.$$compose()};this.$$compose=function(){var a=Db(this.$$search),b=this.$$hash?"#"+kb(this.$$hash):"";this.$$url=Qb(this.$$path)+(a?"?"+a:"")+b;this.$$absUrl=c+this.$$url.substr(1)};this.$$rewrite=function(d){var e;if((e=na(b,d))!==r)return d=e,(e=na(a,e))!==r?c+(na("/",e)||e):b+d;if((e=na(c,d))!==r)return c+e;if(c==d+"/")return c}}function Tb(b,a){var c=Rb(b);Hc(b,this,b);this.$$parse=function(d){var e=na(b,d)||na(c,d),e="#"==e.charAt(0)?na(a,e):this.$$html5?e:"";if(!y(e))throw Sb("ihshprfx",
-d,a);Ic(e,this,b);d=this.$$path;var f=/^\/[A-Z]:(\/.*)/;0===e.indexOf(b)&&(e=e.replace(b,""));f.exec(e)||(d=(e=f.exec(d))?e[1]:d);this.$$path=d;this.$$compose()};this.$$compose=function(){var c=Db(this.$$search),e=this.$$hash?"#"+kb(this.$$hash):"";this.$$url=Qb(this.$$path)+(c?"?"+c:"")+e;this.$$absUrl=b+(this.$$url?a+this.$$url:"")};this.$$rewrite=function(a){if(ab(b)==ab(a))return a}}function Ub(b,a){this.$$html5=!0;Tb.apply(this,arguments);var c=Rb(b);this.$$rewrite=function(d){var e;if(b==ab(d))return d;
-if(e=na(c,d))return b+a+e;if(c===d+"/")return c};this.$$compose=function(){var c=Db(this.$$search),e=this.$$hash?"#"+kb(this.$$hash):"";this.$$url=Qb(this.$$path)+(c?"?"+c:"")+e;this.$$absUrl=b+a+this.$$url}}function ub(b){return function(){return this[b]}}function Kc(b,a){return function(c){if(I(c))return this[b];this[b]=a(c);this.$$compose();return this}}function le(){var b="",a=!1;this.hashPrefix=function(a){return C(a)?(b=a,this):b};this.html5Mode=function(b){return C(b)?(a=b,this):a};this.$get=
-["$rootScope","$browser","$sniffer","$rootElement",function(c,d,e,f){function h(a){c.$broadcast("$locationChangeSuccess",g.absUrl(),a)}var g,p,k=d.baseHref(),l=d.url(),n;a?(n=l.substring(0,l.indexOf("/",l.indexOf("//")+2))+(k||"/"),p=e.history?Jc:Ub):(n=ab(l),p=Tb);g=new p(n,"#"+b);g.$$parse(g.$$rewrite(l));f.on("click",function(a){if(!a.ctrlKey&&!a.metaKey&&2!=a.which){for(var e=E(a.target);"a"!==z(e[0].nodeName);)if(e[0]===f[0]||!(e=e.parent())[0])return;var h=e.prop("href");V(h)&&"[object SVGAnimatedString]"===
-h.toString()&&(h=ta(h.animVal).href);if(p===Ub){var k=e.attr("href")||e.attr("xlink:href");if(0>k.indexOf("://"))if(h="#"+b,"/"==k[0])h=n+h+k;else if("#"==k[0])h=n+h+(g.path()||"/")+k;else{for(var l=g.path().split("/"),k=k.split("/"),m=0;me?Lc(d[0],d[1],d[2],d[3],d[4],c,a):function(b,f){var g=0,h;do h=Lc(d[g++],d[g++],d[g++],d[g++],d[g++],c,a)(b,f),f=r,b=h;while(ga)for(b in k++,e)e.hasOwnProperty(b)&&!d.hasOwnProperty(b)&&(q--,delete e[b])}else e!==d&&(e=d,k++);return k},function(){n?(n=!1,b(d,d,c)):b(d,g,c);if(h)if(V(d))if(fb(d)){g=Array(d.length);for(var a=0;ar&&(L=4-r,R[L]||(R[L]=
-[]),C=P(d.exp)?"fn: "+(d.exp.name||d.exp.toString()):d.exp,C+="; newVal: "+ra(f)+"; oldVal: "+ra(g),R[L].push(C));else if(d===c){v=!1;break a}}catch(F){m.$$phase=null,e(F)}if(!(h=O.$$childHead||O!==this&&O.$$nextSibling))for(;O!==this&&!(h=O.$$nextSibling);)O=O.$parent}while(O=h);if((v||k.length)&&!r--)throw m.$$phase=null,a("infdig",b,ra(R));}while(v||k.length);for(m.$$phase=null;l.length;)try{l.shift()()}catch(y){e(y)}},$destroy:function(){if(!this.$$destroyed){var a=this.$parent;this.$broadcast("$destroy");
-this.$$destroyed=!0;this!==m&&(q(this.$$listenerCount,jb(null,l,this)),a.$$childHead==this&&(a.$$childHead=this.$$nextSibling),a.$$childTail==this&&(a.$$childTail=this.$$prevSibling),this.$$prevSibling&&(this.$$prevSibling.$$nextSibling=this.$$nextSibling),this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=this.$$prevSibling),this.$parent=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=this.$root=null,this.$$listeners={},this.$$watchers=this.$$asyncQueue=this.$$postDigestQueue=
-[],this.$destroy=this.$digest=this.$apply=w,this.$on=this.$watch=this.$watchGroup=function(){return w})}},$eval:function(a,b){return f(a)(this,b)},$evalAsync:function(a){m.$$phase||m.$$asyncQueue.length||h.defer(function(){m.$$asyncQueue.length&&m.$digest()});this.$$asyncQueue.push({scope:this,expression:a})},$$postDigest:function(a){this.$$postDigestQueue.push(a)},$apply:function(a){try{return p("$apply"),this.$eval(a)}catch(b){e(b)}finally{m.$$phase=null;try{m.$digest()}catch(c){throw e(c),c;}}},
-$on:function(a,b){var c=this.$$listeners[a];c||(this.$$listeners[a]=c=[]);c.push(b);var d=this;do d.$$listenerCount[a]||(d.$$listenerCount[a]=0),d.$$listenerCount[a]++;while(d=d.$parent);var e=this;return function(){c[ib(c,b)]=null;l(e,1,a)}},$emit:function(a,b){var c=[],d,f=this,g=!1,h={name:a,targetScope:f,stopPropagation:function(){g=!0},preventDefault:function(){h.defaultPrevented=!0},defaultPrevented:!1},k=[h].concat(qa.call(arguments,1)),l,m;do{d=f.$$listeners[a]||c;h.currentScope=f;l=0;for(m=
-d.length;lc.msieDocumentMode)throw va("iequirks");var e=da(ha);e.isEnabled=function(){return b};e.trustAs=
-d.trustAs;e.getTrusted=d.getTrusted;e.valueOf=d.valueOf;b||(e.trustAs=e.getTrusted=function(a,b){return b},e.valueOf=Da);e.parseAs=function(b,c){var d=a(c);return d.literal&&d.constant?d:function(a,c){return e.getTrusted(b,d(a,c))}};var f=e.parseAs,h=e.getTrusted,g=e.trustAs;q(ha,function(a,b){var c=z(b);e[Va("parse_as_"+c)]=function(b){return f(a,b)};e[Va("get_trusted_"+c)]=function(b){return h(a,b)};e[Va("trust_as_"+c)]=function(b){return g(a,b)}});return e}]}function se(){this.$get=["$window",
-"$document",function(b,a){var c={},d=U((/android (\d+)/.exec(z((b.navigator||{}).userAgent))||[])[1]),e=/Boxee/i.test((b.navigator||{}).userAgent),f=a[0]||{},h=f.documentMode,g,p=/^(Moz|webkit|O|ms)(?=[A-Z])/,k=f.body&&f.body.style,l=!1,n=!1;if(k){for(var m in k)if(l=p.exec(m)){g=l[0];g=g.substr(0,1).toUpperCase()+g.substr(1);break}g||(g="WebkitOpacity"in k&&"webkit");l=!!("transition"in k||g+"Transition"in k);n=!!("animation"in k||g+"Animation"in k);!d||l&&n||(l=y(f.body.style.webkitTransition),
-n=y(f.body.style.webkitAnimation))}return{history:!(!b.history||!b.history.pushState||4>d||e),hashchange:"onhashchange"in b&&(!h||7b;b=Math.abs(b);var h=b+"",g="",p=[],k=!1;if(-1!==h.indexOf("e")){var l=h.match(/([\d\.]+)e(-?)(\d+)/);l&&"-"==l[2]&&l[3]>e+1?h="0":(g=h,k=!0)}if(k)0b)&&(g=b.toFixed(e));else{h=(h.split(Wc)[1]||"").length;I(e)&&(e=Math.min(Math.max(a.minFrac,h),a.maxFrac));h=Math.pow(10,e);b=Math.round(b*h)/h;b=(""+b).split(Wc);h=b[0];b=b[1]||"";var l=0,n=a.lgSize,m=a.gSize;if(h.length>=n+m)for(l=h.length-n,k=0;kb&&(d="-",b=-b);for(b=""+b;b.length-c)e+=c;0===e&&-12==c&&(e=12);return wb(e,a,d)}}function xb(b,a){return function(c,d){var e=c["get"+b](),f=Ga(a?"SHORT"+b:b);return d[f][e]}}
-function Xc(b){var a=(new Date(b,0,1)).getDay();return new Date(b,0,(4>=a?5:12)-a)}function Yc(b){return function(a){var c=Xc(a.getFullYear());a=+new Date(a.getFullYear(),a.getMonth(),a.getDate()+(4-a.getDay()))-+c;a=1+Math.round(a/6048E5);return wb(a,b)}}function Sc(b){function a(a){var b;if(b=a.match(c)){a=new Date(0);var f=0,h=0,g=b[8]?a.setUTCFullYear:a.setFullYear,p=b[8]?a.setUTCHours:a.setHours;b[9]&&(f=U(b[9]+b[10]),h=U(b[9]+b[11]));g.call(a,U(b[1]),U(b[2])-1,U(b[3]));f=U(b[4]||0)-f;h=U(b[5]||
-0)-h;g=U(b[6]||0);b=Math.round(1E3*parseFloat("0."+(b[7]||0)));p.call(a,f,h,g,b)}return a}var c=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(c,e){var f="",h=[],g,p;e=e||"mediumDate";e=b.DATETIME_FORMATS[e]||e;y(c)&&(c=Ye.test(c)?U(c):a(c));Ea(c)&&(c=new Date(c));if(!pa(c))return c;for(;e;)(p=Ze.exec(e))?(h=h.concat(qa.call(p,1)),e=h.pop()):(h.push(e),e=null);q(h,function(a){g=$e[a];f+=g?g(c,b.DATETIME_FORMATS):a.replace(/(^'|'$)/g,
-"").replace(/''/g,"'")});return f}}function Ue(){return function(b){return ra(b,!0)}}function Ve(){return function(b,a){if(!N(b)&&!y(b))return b;a=Infinity===Math.abs(Number(a))?Number(a):U(a);if(y(b))return a?0<=a?b.slice(0,a):b.slice(a,b.length):"";var c=[],d,e;a>b.length?a=b.length:a<-b.length&&(a=-b.length);0 b||37<=b&&40>=b)||m(a)});if(e.hasEvent("paste"))a.on("paste cut",m)}a.on("change",l);d.$render=function(){a.val(d.$isEmpty(d.$viewValue)?"":d.$viewValue)};var s=c.ngPattern;s&&((e=s.match(/^\/(.*)\/([gim]*)$/))?(s=RegExp(e[1],e[2]),e=function(a){return oa(d,"pattern",d.$isEmpty(a)||s.test(a),a)}):e=function(c){var e=b.$eval(s);if(!e||!e.test)throw B("ngPattern")("noregexp",s,e,ia(a));return oa(d,"pattern",d.$isEmpty(c)||e.test(c),c)},d.$formatters.push(e),
-d.$parsers.push(e));if(c.ngMinlength){var q=U(c.ngMinlength);e=function(a){return oa(d,"minlength",d.$isEmpty(a)||a.length>=q,a)};d.$parsers.push(e);d.$formatters.push(e)}if(c.ngMaxlength){var J=U(c.ngMaxlength);e=function(a){return oa(d,"maxlength",d.$isEmpty(a)||a.length<=J,a)};d.$parsers.push(e);d.$formatters.push(e)}}function Cb(b,a){return function(c){var d;return pa(c)?c:y(c)&&(b.lastIndex=0,c=b.exec(c))?(c.shift(),d={yyyy:0,MM:1,dd:1,HH:0,mm:0},q(c,function(b,c){c =c(h.min);g.$setValidity("min",b);return b?a:r},g.$parsers.push(e),g.$formatters.push(e));h.max&&(e=function(a){var b=g.$isEmpty(a)||
-c(a)<=c(h.max);g.$setValidity("max",b);return b?a:r},g.$parsers.push(e),g.$formatters.push(e))}}function Xb(b,a){b="ngClass"+b;return["$animate",function(c){function d(a,b){var c=[],d=0;a:for(;dX?function(b){b=b.nodeName?b:b[0];return b.scopeName&&"HTML"!=b.scopeName?Ga(b.scopeName+":"+b.nodeName):b.nodeName}:function(b){return b.nodeName?b.nodeName:b[0].nodeName};var hc=["ng-","data-ng-","ng:","x-ng-"],md=/[A-Z]/g,pd={full:"1.3.0-beta.8",major:1,minor:3,dot:0,codeName:"accidental-haiku"},Xa=W.cache={},mb=W.expando="ng-"+(new Date).getTime(),
-Ee=1,tb=M.document.addEventListener?function(b,a,c){b.addEventListener(a,c,!1)}:function(b,a,c){b.attachEvent("on"+a,c)},Wa=M.document.removeEventListener?function(b,a,c){b.removeEventListener(a,c,!1)}:function(b,a,c){b.detachEvent("on"+a,c)};W._data=function(b){return this.cache[b[this.expando]]||{}};var ye=/([\:\-\_]+(.))/g,ze=/^moz([A-Z])/,Kb=B("jqLite"),De=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,Jb=/<|?\w+;/,Be=/<([\w:]+)/,Ce=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,fa=
-{option:[1,''," "],thead:[1,""],col:[2,""],tr:[2,""],td:[3,""],_default:[0,"",""]};fa.optgroup=fa.option;fa.tbody=fa.tfoot=fa.colgroup=fa.caption=fa.thead;fa.th=fa.td;var La=W.prototype={ready:function(b){function a(){c||(c=!0,b())}var c=!1;"complete"===T.readyState?setTimeout(a):(this.on("DOMContentLoaded",a),W(M).on("load",a))},toString:function(){var b=
-[];q(this,function(a){b.push(""+a)});return"["+b.join(", ")+"]"},eq:function(b){return 0<=b?E(this[b]):E(this[this.length+b])},length:0,push:bf,sort:[].sort,splice:[].splice},qb={};q("multiple selected checked disabled readOnly required open".split(" "),function(b){qb[z(b)]=b});var wc={};q("input select option textarea button form details".split(" "),function(b){wc[Ga(b)]=!0});q({data:sc,inheritedData:pb,scope:function(b){return E(b).data("$scope")||pb(b.parentNode||b,["$isolateScope","$scope"])},
-isolateScope:function(b){return E(b).data("$isolateScope")||E(b).data("$isolateScopeNoTemplate")},controller:tc,injector:function(b){return pb(b,"$injector")},removeAttr:function(b,a){b.removeAttribute(a)},hasClass:Mb,css:function(b,a,c){a=Va(a);if(C(c))b.style[a]=c;else{var d;8>=X&&(d=b.currentStyle&&b.currentStyle[a],""===d&&(d="auto"));d=d||b.style[a];8>=X&&(d=""===d?r:d);return d}},attr:function(b,a,c){var d=z(a);if(qb[d])if(C(c))c?(b[a]=!0,b.setAttribute(a,d)):(b[a]=!1,b.removeAttribute(d));
-else return b[a]||(b.attributes.getNamedItem(a)||w).specified?d:r;else if(C(c))b.setAttribute(a,c);else if(b.getAttribute)return b=b.getAttribute(a,2),null===b?r:b},prop:function(b,a,c){if(C(c))b[a]=c;else return b[a]},text:function(){function b(b,d){var e=a[b.nodeType];if(I(d))return e?b[e]:"";b[e]=d}var a=[];9>X?(a[1]="innerText",a[3]="nodeValue"):a[1]=a[3]="textContent";b.$dv="";return b}(),val:function(b,a){if(I(a)){if("SELECT"===Ma(b)&&b.multiple){var c=[];q(b.options,function(a){a.selected&&
-c.push(a.value||a.text)});return 0===c.length?null:c}return b.value}b.value=a},html:function(b,a){if(I(a))return b.innerHTML;for(var c=0,d=b.childNodes;c":function(a,c,d,e){return d(a,c)>e(a,c)},"<=":function(a,c,d,e){return d(a,c)<=e(a,c)},">=":function(a,c,d,e){return d(a,c)>=e(a,c)},"&&":function(a,c,d,e){return d(a,c)&&e(a,c)},"||":function(a,c,d,e){return d(a,c)||e(a,c)},"&":function(a,c,d,e){return d(a,c)&e(a,c)},"|":function(a,c,d,e){return e(a,c)(a,c,d(a,c))},"!":function(a,c,d){return!d(a,c)}},ef={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},
-Wb=function(a){this.options=a};Wb.prototype={constructor:Wb,lex:function(a){this.text=a;this.index=0;this.ch=r;this.lastCh=":";this.tokens=[];var c;for(a=[];this.index=a},isWhitespace:function(a){return" "===a||"\r"===a||"\t"===a||"\n"===a||"\v"===a||"\u00a0"===
-a},isIdent:function(a){return"a"<=a&&"z">=a||"A"<=a&&"Z">=a||"_"===a||"$"===a},isExpOperator:function(a){return"-"===a||"+"===a||this.isNumber(a)},throwError:function(a,c,d){d=d||this.index;c=C(c)?"s "+c+"-"+this.index+" ["+this.text.substring(c,d)+"]":" "+d;throw Ba("lexerr",a,c,this.text);},readNumber:function(){for(var a="",c=this.index;this.index","<=",">="))a=this.binaryFn(a,c.fn,this.relational());return a},additive:function(){for(var a=this.multiplicative(),c;c=this.expect("+","-");)a=this.binaryFn(a,c.fn,this.multiplicative());return a},multiplicative:function(){for(var a=this.unary(),c;c=this.expect("*","/","%");)a=this.binaryFn(a,c.fn,this.unary());return a},unary:function(){var a;return this.expect("+")?this.primary():(a=this.expect("-"))?this.binaryFn(cb.ZERO,a.fn,
-this.unary()):(a=this.expect("!"))?this.unaryFn(a.fn,this.unary()):this.primary()},fieldAccess:function(a){var c=this,d=this.expect().text,e=Mc(d,this.options,this.text);return F(function(c,d,g){return e(g||a(c,d))},{assign:function(e,h,g){return vb(a(e,g),d,h,c.text,c.options)}})},objectIndex:function(a){var c=this,d=this.expression();this.consume("]");return F(function(e,f){var h=a(e,f),g=d(e,f),p;if(!h)return r;(h=bb(h[g],c.text))&&(h.then&&c.options.unwrapPromises)&&(p=h,"$$v"in h||(p.$$v=r,p.then(function(a){p.$$v=
-a})),h=h.$$v);return h},{assign:function(e,f,h){var g=d(e,h);return bb(a(e,h),c.text)[g]=f}})},functionCall:function(a,c){var d=[];if(")"!==this.peekToken().text){do d.push(this.expression());while(this.expect(","))}this.consume(")");var e=this;return function(f,h){for(var g=[],p=c?c(f,h):f,k=0;ka.getHours()?c.AMPMS[0]:c.AMPMS[1]},Z:function(a){a=-1*a.getTimezoneOffset();return a=(0<=a?"+":"")+(wb(Math[0=X&&(c.href||c.name||c.$set("href",""),a.append(T.createComment("IE fix")));if(!c.href&&!c.xlinkHref&&!c.name)return function(a,c){var f="[object SVGAnimatedString]"===xa.call(c.prop("href"))?"xlink:href":"href";c.on("click",function(a){c.attr(f)||a.preventDefault()})}}}),Hb={};q(qb,function(a,c){if("multiple"!=a){var d=ma("ng-"+c);Hb[d]=function(){return{priority:100,link:function(a,f,h){a.$watch(h[d],function(a){h.$set(c,
-!!a)})}}}}});q(["src","srcset","href"],function(a){var c=ma("ng-"+a);Hb[c]=function(){return{priority:99,link:function(d,e,f){var h=a,g=a;"href"===a&&"[object SVGAnimatedString]"===xa.call(e.prop("href"))&&(g="xlinkHref",f.$attr[g]="xlink:href",h=null);f.$observe(c,function(a){a&&(f.$set(g,a),X&&h&&e.prop(h,f[g]))})}}}});var Ab={$addControl:w,$removeControl:w,$setValidity:w,$setDirty:w,$setPristine:w};Zc.$inject=["$element","$attrs","$scope","$animate"];var $c=function(a){return["$timeout",function(c){return{name:"form",
-restrict:a?"EAC":"E",controller:Zc,compile:function(){return{pre:function(a,e,f,h){if(!f.action){var g=function(c){a.$apply(function(){h.$commitViewValue()});c.preventDefault?c.preventDefault():c.returnValue=!1};tb(e[0],"submit",g);e.on("$destroy",function(){c(function(){Wa(e[0],"submit",g)},0,!1)})}var p=e.parent().controller("form"),k=f.name||f.ngForm;k&&vb(a,k,h,k);if(p)e.on("$destroy",function(){p.$removeControl(h);k&&vb(a,k,r,k);F(h,Ab)})}}}}}]},td=$c(),Gd=$c(!0),ff=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/,
-gf=/^[a-z0-9!#$%&'*+/=?^_`{|}~.-]+@[a-z0-9-]+(\.[a-z0-9-]+)*$/i,hf=/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/,ad=/^(\d{4})-(\d{2})-(\d{2})$/,bd=/^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d)$/,Yb=/^(\d{4})-W(\d\d)$/,cd=/^(\d{4})-(\d\d)$/,dd=/^(\d\d):(\d\d)$/,jf=/(\s+|^)default(\s+|$)/,ed={text:db,date:eb("date",ad,Cb(ad,["yyyy","MM","dd"]),"yyyy-MM-dd"),"datetime-local":eb("datetimelocal",bd,Cb(bd,["yyyy","MM","dd","HH","mm"]),"yyyy-MM-ddTHH:mm"),time:eb("time",dd,Cb(dd,["HH","mm"]),"HH:mm"),week:eb("week",Yb,function(a){if(pa(a))return a;
-if(y(a)){Yb.lastIndex=0;var c=Yb.exec(a);if(c){a=+c[1];var d=+c[2],c=Xc(a),d=7*(d-1);return new Date(a,0,c.getDate()+d)}}return NaN},"yyyy-Www"),month:eb("month",cd,Cb(cd,["yyyy","MM"]),"yyyy-MM"),number:function(a,c,d,e,f,h){db(a,c,d,e,f,h);e.$parsers.push(function(a){var c=e.$isEmpty(a);if(c||hf.test(a))return e.$setValidity("number",!0),""===a?null:c?a:parseFloat(a);e.$setValidity("number",!1);return r});af(e,"number",c);e.$formatters.push(function(a){return e.$isEmpty(a)?"":""+a});d.min&&(a=function(a){var c=
-parseFloat(d.min);return oa(e,"min",e.$isEmpty(a)||a>=c,a)},e.$parsers.push(a),e.$formatters.push(a));d.max&&(a=function(a){var c=parseFloat(d.max);return oa(e,"max",e.$isEmpty(a)||a<=c,a)},e.$parsers.push(a),e.$formatters.push(a));e.$formatters.push(function(a){return oa(e,"number",e.$isEmpty(a)||Ea(a),a)})},url:function(a,c,d,e,f,h){db(a,c,d,e,f,h);a=function(a){return oa(e,"url",e.$isEmpty(a)||ff.test(a),a)};e.$formatters.push(a);e.$parsers.push(a)},email:function(a,c,d,e,f,h){db(a,c,d,e,f,h);
-a=function(a){return oa(e,"email",e.$isEmpty(a)||gf.test(a),a)};e.$formatters.push(a);e.$parsers.push(a)},radio:function(a,c,d,e){I(d.name)&&c.attr("name",gb());c.on("click",function(f){c[0].checked&&a.$apply(function(){e.$setViewValue(d.value,f&&f.type)})});e.$render=function(){c[0].checked=d.value==e.$viewValue};d.$observe("value",e.$render)},checkbox:function(a,c,d,e){var f=d.ngTrueValue,h=d.ngFalseValue;y(f)||(f=!0);y(h)||(h=!1);c.on("click",function(d){a.$apply(function(){e.$setViewValue(c[0].checked,
-d&&d.type)})});e.$render=function(){c[0].checked=e.$viewValue};e.$isEmpty=function(a){return a!==f};e.$formatters.push(function(a){return a===f});e.$parsers.push(function(a){return a?f:h})},hidden:w,button:w,submit:w,reset:w,file:w},lc=["$browser","$sniffer","$filter",function(a,c,d){return{restrict:"E",require:["?ngModel"],link:function(e,f,h,g){g[0]&&(ed[z(h.type)]||ed.text)(e,f,h,g[0],c,a,d)}}}],zb="ng-valid",yb="ng-invalid",Oa="ng-pristine",Bb="ng-dirty",kf=["$scope","$exceptionHandler","$attrs",
-"$element","$parse","$animate","$timeout",function(a,c,d,e,f,h,g){function p(a,c){c=c?"-"+lb(c,"-"):"";h.removeClass(e,(a?yb:zb)+c);h.addClass(e,(a?zb:yb)+c)}this.$modelValue=this.$viewValue=Number.NaN;this.$parsers=[];this.$formatters=[];this.$viewChangeListeners=[];this.$pristine=!0;this.$dirty=!1;this.$valid=!0;this.$invalid=!1;this.$name=d.name;var k=f(d.ngModel),l=k.assign,n=null,m=this;if(!l)throw B("ngModel")("nonassign",d.ngModel,ia(e));this.$render=w;this.$isEmpty=function(a){return I(a)||
-""===a||null===a||a!==a};var s=e.inheritedData("$formController")||Ab,t=0,r=this.$error={};e.addClass(Oa);p(!0);this.$setValidity=function(a,c){r[a]!==!c&&(c?(r[a]&&t--,t||(p(!0),m.$valid=!0,m.$invalid=!1)):(p(!1),m.$invalid=!0,m.$valid=!1,t++),r[a]=!c,p(c,a),s.$setValidity(a,c,m))};this.$setPristine=function(){m.$dirty=!1;m.$pristine=!0;h.removeClass(e,Bb);h.addClass(e,Oa)};this.$rollbackViewValue=function(){g.cancel(n);m.$viewValue=m.$$lastCommittedViewValue;m.$render()};this.$commitViewValue=function(){var d=
-m.$viewValue;m.$$lastCommittedViewValue=d;g.cancel(n);m.$pristine&&(m.$dirty=!0,m.$pristine=!1,h.removeClass(e,Oa),h.addClass(e,Bb),s.$setDirty());q(m.$parsers,function(a){d=a(d)});m.$modelValue!==d&&(m.$modelValue=d,l(a,d),q(m.$viewChangeListeners,function(a){try{a()}catch(d){c(d)}}))};this.$setViewValue=function(a,c){m.$viewValue=a;m.$options&&!m.$options.updateOnDefault||m.$$debounceViewValueCommit(c)};this.$$debounceViewValueCommit=function(a){var c=0,d=m.$options;d&&C(d.debounce)&&(d=d.debounce,
-Ea(d)?c=d:Ea(d[a])?c=d[a]:Ea(d["default"])&&(c=d["default"]));g.cancel(n);c?n=g(function(){m.$commitViewValue()},c):m.$commitViewValue()};a.$watch(function(){var c=k(a);if(m.$modelValue!==c){var d=m.$formatters,e=d.length;for(m.$modelValue=c;e--;)c=d[e](c);m.$viewValue!==c&&(m.$viewValue=m.$$lastCommittedViewValue=c,m.$render())}return c})}],Vd=function(){return{require:["ngModel","^?form","^?ngModelOptions"],controller:kf,link:{pre:function(a,c,d,e){e[2]&&(e[0].$options=e[2].$options);var f=e[0],
-h=e[1]||Ab;h.$addControl(f);a.$on("$destroy",function(){h.$removeControl(f)})},post:function(a,c,d,e){var f=e[0];if(f.$options&&f.$options.updateOn)c.on(f.$options.updateOn,function(c){a.$apply(function(){f.$$debounceViewValueCommit(c&&c.type)})})}}}},Xd=ca({require:"ngModel",link:function(a,c,d,e){e.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),mc=function(){return{require:"?ngModel",link:function(a,c,d,e){if(e){d.required=!0;var f=function(a){if(d.required&&e.$isEmpty(a))e.$setValidity("required",
-!1);else return e.$setValidity("required",!0),a};e.$formatters.push(f);e.$parsers.unshift(f);d.$observe("required",function(){f(e.$viewValue)})}}}},Wd=function(){return{require:"ngModel",link:function(a,c,d,e){var f=(a=/\/(.*)\//.exec(d.ngList))&&RegExp(a[1])||d.ngList||",";e.$parsers.push(function(a){if(!I(a)){var c=[];a&&q(a.split(f),function(a){a&&c.push(aa(a))});return c}});e.$formatters.push(function(a){return N(a)?a.join(", "):r});e.$isEmpty=function(a){return!a||!a.length}}}},lf=/^(true|false|\d+)$/,
-Yd=function(){return{priority:100,compile:function(a,c){return lf.test(c.ngValue)?function(a,c,f){f.$set("value",a.$eval(f.ngValue))}:function(a,c,f){a.$watch(f.ngValue,function(a){f.$set("value",a)})}}}},Zd=function(){return{controller:["$scope","$attrs",function(a,c){var d=this;this.$options=a.$eval(c.ngModelOptions);this.$options.updateOn!==r?(this.$options.updateOnDefault=!1,this.$options.updateOn=aa(this.$options.updateOn.replace(jf,function(){d.$options.updateOnDefault=!0;return" "}))):this.$options.updateOnDefault=
-!0}]}},yd=wa(function(a,c,d){c.addClass("ng-binding").data("$binding",d.ngBind);a.$watch(d.ngBind,function(a){c.text(a==r?"":a)})}),Ad=["$interpolate",function(a){return function(c,d,e){c=a(d.attr(e.$attr.ngBindTemplate));d.addClass("ng-binding").data("$binding",c);e.$observe("ngBindTemplate",function(a){d.text(a)})}}],zd=["$sce","$parse",function(a,c){return function(d,e,f){e.addClass("ng-binding").data("$binding",f.ngBindHtml);var h=c(f.ngBindHtml);d.$watch(function(){return(h(d)||"").toString()},
-function(c){e.html(a.getTrustedHtml(h(d))||"")})}}],Bd=Xb("",!0),Dd=Xb("Odd",0),Cd=Xb("Even",1),Ed=wa({compile:function(a,c){c.$set("ngCloak",r);a.removeClass("ng-cloak")}}),Fd=[function(){return{scope:!0,controller:"@",priority:500}}],nc={};q("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),function(a){var c=ma("ng-"+a);nc[c]=["$parse",function(d){return{compile:function(e,f){var h=d(f[c]);return function(c,
-d,e){d.on(z(a),function(a){c.$apply(function(){h(c,{$event:a})})})}}}}]});var Id=["$animate",function(a){return{transclude:"element",priority:600,terminal:!0,restrict:"A",$$tlb:!0,link:function(c,d,e,f,h){var g,p,k;c.$watch(e.ngIf,function(f){Ra(f)?p||(p=c.$new(),h(p,function(c){c[c.length++]=T.createComment(" end ngIf: "+e.ngIf+" ");g={clone:c};a.enter(c,d.parent(),d)})):(k&&(k.remove(),k=null),p&&(p.$destroy(),p=null),g&&(k=Gb(g.clone),a.leave(k,function(){k=null}),g=null))})}}}],Jd=["$http","$templateCache",
-"$anchorScroll","$animate","$sce",function(a,c,d,e,f){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:Sa.noop,compile:function(h,g){var p=g.ngInclude||g.src,k=g.onload||"",l=g.autoscroll;return function(g,h,q,r,J){var A=0,D,x,G,v=function(){x&&(x.remove(),x=null);D&&(D.$destroy(),D=null);G&&(e.leave(G,function(){x=null}),x=G,G=null)};g.$watch(f.parseAsResourceUrl(p),function(f){var p=function(){!C(l)||l&&!g.$eval(l)||d()},q=++A;f?(a.get(f,{cache:c}).success(function(a){if(q===
-A){var c=g.$new();r.template=a;a=J(c,function(a){v();e.enter(a,null,h,p)});D=c;G=a;D.$emit("$includeContentLoaded");g.$eval(k)}}).error(function(){q===A&&v()}),g.$emit("$includeContentRequested")):(v(),r.template=null)})}}}}],$d=["$compile",function(a){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(c,d,e,f){d.html(f.template);a(d.contents())(c)}}}],Kd=wa({priority:450,compile:function(){return{pre:function(a,c,d){a.$eval(d.ngInit)}}}}),Ld=wa({terminal:!0,priority:1E3}),Md=["$locale",
-"$interpolate",function(a,c){var d=/{}/g;return{restrict:"EA",link:function(e,f,h){var g=h.count,p=h.$attr.when&&f.attr(h.$attr.when),k=h.offset||0,l=e.$eval(p)||{},n={},m=c.startSymbol(),s=c.endSymbol(),r=/^when(Minus)?(.+)$/;q(h,function(a,c){r.test(c)&&(l[z(c.replace("when","").replace("Minus","-"))]=f.attr(h.$attr[c]))});q(l,function(a,e){n[e]=c(a.replace(d,m+g+"-"+k+s))});e.$watch(function(){var c=parseFloat(e.$eval(g));if(isNaN(c))return"";c in l||(c=a.pluralCat(c-k));return n[c](e)},function(a){f.text(a)})}}}],
-Nd=["$parse","$animate",function(a,c){var d=B("ngRepeat");return{transclude:"element",priority:1E3,terminal:!0,$$tlb:!0,link:function(e,f,h,g,p){var k=h.ngRepeat,l=k.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?\s*$/),n,m,s,r,C,A,D={$id:Ja};if(!l)throw d("iexp",k);h=l[1];g=l[2];(l=l[3])?(n=a(l),m=function(a,c,d){A&&(D[A]=a);D[C]=c;D.$index=d;return n(e,D)}):(s=function(a,c){return Ja(c)},r=function(a){return a});l=h.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/);if(!l)throw d("iidexp",
-h);C=l[3]||l[1];A=l[2];var x={};e.$watchCollection(g,function(a){var g,h,l=f[0],n,D={},F,u,y,w,z,K,B=[];if(fb(a))z=a,n=m||s;else{n=m||r;z=[];for(y in a)a.hasOwnProperty(y)&&"$"!=y.charAt(0)&&z.push(y);z.sort()}F=z.length;h=B.length=z.length;for(g=0;gB;)u.pop().element.remove()}for(;w.length>z;)w.pop()[0].element.remove()}var k;if(!(k=
-t.match(d)))throw mf("iexp",t,ia(f));var l=c(k[2]||k[1]),m=k[4]||k[6],n=k[5],p=c(k[3]||""),q=c(k[2]?k[1]:m),A=c(k[7]),v=k[8]?c(k[8]):null,w=[[{element:f,label:""}]];y&&(a(y)(e),y.removeClass("ng-scope"),y.remove());f.empty();f.on("change",function(){e.$apply(function(){var a,c=A(e)||[],d={},h,k,l,p,t,x,u;if(s)for(k=[],p=0,x=w.length;p@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide{display:none !important;}ng\\:form{display:block;}');
-//# sourceMappingURL=angular.min.js.map
diff --git a/public/script/jquery.cookie.js b/public/script/jquery.cookie.js
deleted file mode 100644
index 43eb74a..0000000
--- a/public/script/jquery.cookie.js
+++ /dev/null
@@ -1,103 +0,0 @@
-/*!
- * jQuery Cookie Plugin v1.4.0
- * https://github.com/carhartl/jquery-cookie
- *
- * Copyright 2013 Klaus Hartl
- * Released under the MIT license
- */
-(function (factory) {
- if (typeof define === 'function' && define.amd) {
- // AMD. Register as anonymous module.
- define(['jquery'], factory);
- } else {
- // Browser globals.
- factory(jQuery);
- }
-}(function ($) {
- var pluses = /\+/g;
-
- function encode(s) {
- return config.raw ? s : encodeURIComponent(s);
- }
-
- function decode(s) {
- return config.raw ? s : decodeURIComponent(s);
- }
-
- function stringifyCookieValue(value) {
- return encode(config.json ? JSON.stringify(value) : String(value));
- }
-
- function parseCookieValue(s) {
- if (s.indexOf('"') === 0) {
- // This is a quoted cookie as according to RFC2068, unescape...
- s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
- }
- try {
- // Replace server-side written pluses with spaces.
- // If we can't decode the cookie, ignore it, it's unusable.
- s = decodeURIComponent(s.replace(pluses, ' '));
- } catch (e) {
- return;
- }
- try {
- // If we can't parse the cookie, ignore it, it's unusable.
- return config.json ? JSON.parse(s) : s;
- } catch (e) {
- }
- }
-
- function read(s, converter) {
- var value = config.raw ? s : parseCookieValue(s);
- return $.isFunction(converter) ? converter(value) : value;
- }
-
- var config = $.cookie = function (key, value, options) {
-
- // Write
- if (value !== undefined && !$.isFunction(value)) {
- options = $.extend({}, config.defaults, options);
- if (typeof options.expires === 'number') {
- var days = options.expires, t = options.expires = new Date();
- t.setDate(t.getDate() + days);
- }
- return (document.cookie = [
- encode(key), '=', stringifyCookieValue(value),
- options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
- options.path ? '; path=' + options.path : '',
- options.domain ? '; domain=' + options.domain : '',
- options.secure ? '; secure' : ''
- ].join(''));
- }
- // Read
- var result = key ? undefined : {};
- // To prevent the for loop in the first place assign an empty array
- // in case there are no cookies at all. Also prevents odd result when
- // calling $.cookie().
- var cookies = document.cookie ? document.cookie.split('; ') : [];
- for (var i = 0, l = cookies.length; i < l; i++) {
- var parts = cookies[i].split('=');
- var name = decode(parts.shift());
- var cookie = parts.join('=');
- if (key && key === name) {
- // If second argument (value) is a function it's a converter...
- result = read(cookie, value);
- break;
- }
- // Prevent storing a cookie that we couldn't decode.
- if (!key && (cookie = read(cookie)) !== undefined) {
- result[name] = cookie;
- }
- }
- return result;
- };
- config.defaults = {};
- $.removeCookie = function (key, options) {
- if ($.cookie(key) !== undefined) {
- // Must not alter options, thus extending a fresh object...
- $.cookie(key, '', $.extend({}, options, {expires: -1}));
- return true;
- }
- return false;
- };
-}));
diff --git a/public/script/jquery.form.js b/public/script/jquery.form.js
deleted file mode 100644
index 701d80b..0000000
--- a/public/script/jquery.form.js
+++ /dev/null
@@ -1,1183 +0,0 @@
-/*!
- * jQuery Form Plugin
- * version: 3.50.0-2014.02.05
- * Requires jQuery v1.5 or later
- * Copyright (c) 2013 M. Alsup
- * Examples and documentation at: http://malsup.com/jquery/form/
- * Project repository: https://github.com/malsup/form
- * Dual licensed under the MIT and GPL licenses.
- * https://github.com/malsup/form#copyright-and-license
- */
-/*global ActiveXObject */
-
-// AMD support
-(function (factory) {
- "use strict";
- if (typeof define === 'function' && define.amd) {
- // using AMD; register as anon module
- define(['jquery'], factory);
- } else {
- // no AMD; invoke directly
- factory((typeof(jQuery) != 'undefined') ? jQuery : window.Zepto);
- }
-}
-(function ($) {
- "use strict";
- /*
- Usage Note:
- -----------
- Do not use both ajaxSubmit and ajaxForm on the same form. These
- functions are mutually exclusive. Use ajaxSubmit if you want
- to bind your own submit handler to the form. For example,
-
- $(document).ready(function() {
- $('#myForm').on('submit', function(e) {
- e.preventDefault(); // <-- important
- $(this).ajaxSubmit({
- target: '#output'
- });
- });
- });
-
- Use ajaxForm when you want the plugin to manage all the event binding
- for you. For example,
-
- $(document).ready(function() {
- $('#myForm').ajaxForm({
- target: '#output'
- });
- });
-
- You can also use ajaxForm with delegation (requires jQuery v1.7+), so the
- form does not have to exist when you invoke ajaxForm:
-
- $('#myForm').ajaxForm({
- delegation: true,
- target: '#output'
- });
-
- When using ajaxForm, the ajaxSubmit function will be invoked for you
- at the appropriate time.
- */
- /**
- * Feature detection
- */
- var feature = {};
- feature.fileapi = $(" ").get(0).files !== undefined;
- feature.formdata = window.FormData !== undefined;
- var hasProp = !!$.fn.prop;
-// attr2 uses prop when it can but checks the return type for
-// an expected string. this accounts for the case where a form
-// contains inputs with names like "action" or "method"; in those
-// cases "prop" returns the element
- $.fn.attr2 = function () {
- if (!hasProp) {
- return this.attr.apply(this, arguments);
- }
- var val = this.prop.apply(this, arguments);
- if (( val && val.jquery ) || typeof val === 'string') {
- return val;
- }
- return this.attr.apply(this, arguments);
- };
- /**
- * ajaxSubmit() provides a mechanism for immediately submitting
- * an HTML form using AJAX.
- */
- $.fn.ajaxSubmit = function (options) {
- /*jshint scripturl:true */
- // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
- if (!this.length) {
- log('ajaxSubmit: skipping submit process - no element selected');
- return this;
- }
- var method, action, url, $form = this;
- if (typeof options == 'function') {
- options = {success: options};
- }
- else if (options === undefined) {
- options = {};
- }
- method = options.type || this.attr2('method');
- action = options.url || this.attr2('action');
- url = (typeof action === 'string') ? $.trim(action) : '';
- url = url || window.location.href || '';
- if (url) {
- // clean url (don't include hash vaue)
- url = (url.match(/^([^#]+)/) || [])[1];
- }
- options = $.extend(true, {
- url: url,
- success: $.ajaxSettings.success,
- type: method || $.ajaxSettings.type,
- iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
- }, options);
- // hook for manipulating the form data before it is extracted;
- // convenient for use with rich editors like tinyMCE or FCKEditor
- var veto = {};
- this.trigger('form-pre-serialize', [this, options, veto]);
- if (veto.veto) {
- log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
- return this;
- }
- // provide opportunity to alter form data before it is serialized
- if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
- log('ajaxSubmit: submit aborted via beforeSerialize callback');
- return this;
- }
- var traditional = options.traditional;
- if (traditional === undefined) {
- traditional = $.ajaxSettings.traditional;
- }
- var elements = [];
- var qx, a = this.formToArray(options.semantic, elements);
- if (options.data) {
- options.extraData = options.data;
- qx = $.param(options.data, traditional);
- }
- // give pre-submit callback an opportunity to abort the submit
- if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
- log('ajaxSubmit: submit aborted via beforeSubmit callback');
- return this;
- }
- // fire vetoable 'validate' event
- this.trigger('form-submit-validate', [a, this, options, veto]);
- if (veto.veto) {
- log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
- return this;
- }
- var q = $.param(a, traditional);
- if (qx) {
- q = ( q ? (q + '&' + qx) : qx );
- }
- if (options.type.toUpperCase() == 'GET') {
- options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
- options.data = null; // data is null for 'get'
- }
- else {
- options.data = q; // data is the query string for 'post'
- }
- var callbacks = [];
- if (options.resetForm) {
- callbacks.push(function () {
- $form.resetForm();
- });
- }
- if (options.clearForm) {
- callbacks.push(function () {
- $form.clearForm(options.includeHidden);
- });
- }
- // perform a load on the target only if dataType is not provided
- if (!options.dataType && options.target) {
- var oldSuccess = options.success || function () {
- };
- callbacks.push(function (data) {
- var fn = options.replaceTarget ? 'replaceWith' : 'html';
- $(options.target)[fn](data).each(oldSuccess, arguments);
- });
- }
- else if (options.success) {
- callbacks.push(options.success);
- }
- options.success = function (data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
- var context = options.context || this; // jQuery 1.4+ supports scope context
- for (var i = 0, max = callbacks.length; i < max; i++) {
- callbacks[i].apply(context, [data, status, xhr || $form, $form]);
- }
- };
- if (options.error) {
- var oldError = options.error;
- options.error = function (xhr, status, error) {
- var context = options.context || this;
- oldError.apply(context, [xhr, status, error, $form]);
- };
- }
- if (options.complete) {
- var oldComplete = options.complete;
- options.complete = function (xhr, status) {
- var context = options.context || this;
- oldComplete.apply(context, [xhr, status, $form]);
- };
- }
- // are there files to upload?
- // [value] (issue #113), also see comment:
- // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219
- var fileInputs = $('input[type=file]:enabled', this).filter(function () {
- return $(this).val() !== '';
- });
- var hasFileInputs = fileInputs.length > 0;
- var mp = 'multipart/form-data';
- var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
- var fileAPI = feature.fileapi && feature.formdata;
- log("fileAPI :" + fileAPI);
- var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;
- var jqxhr;
- // options.iframe allows user to force iframe mode
- // 06-NOV-09: now defaulting to iframe mode if file input is detected
- if (options.iframe !== false && (options.iframe || shouldUseFrame)) {
- // hack to fix Safari hang (thanks to Tim Molendijk for this)
- // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
- if (options.closeKeepAlive) {
- $.get(options.closeKeepAlive, function () {
- jqxhr = fileUploadIframe(a);
- });
- }
- else {
- jqxhr = fileUploadIframe(a);
- }
- }
- else if ((hasFileInputs || multipart) && fileAPI) {
- jqxhr = fileUploadXhr(a);
- }
- else {
- jqxhr = $.ajax(options);
- }
- $form.removeData('jqxhr').data('jqxhr', jqxhr);
- // clear element array
- for (var k = 0; k < elements.length; k++) {
- elements[k] = null;
- }
- // fire 'notify' event
- this.trigger('form-submit-notify', [this, options]);
- return this;
- // utility fn for deep serialization
- function deepSerialize(extraData) {
- var serialized = $.param(extraData, options.traditional).split('&');
- var len = serialized.length;
- var result = [];
- var i, part;
- for (i = 0; i < len; i++) {
- // #252; undo param space replacement
- serialized[i] = serialized[i].replace(/\+/g, ' ');
- part = serialized[i].split('=');
- // #278; use array instead of object storage, favoring array serializations
- result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);
- }
- return result;
- }
-
- // XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)
- function fileUploadXhr(a) {
- var formdata = new FormData();
- for (var i = 0; i < a.length; i++) {
- formdata.append(a[i].name, a[i].value);
- }
- if (options.extraData) {
- var serializedData = deepSerialize(options.extraData);
- for (i = 0; i < serializedData.length; i++) {
- if (serializedData[i]) {
- formdata.append(serializedData[i][0], serializedData[i][1]);
- }
- }
- }
- options.data = null;
- var s = $.extend(true, {}, $.ajaxSettings, options, {
- contentType: false,
- processData: false,
- cache: false,
- type: method || 'POST'
- });
- if (options.uploadProgress) {
- // workaround because jqXHR does not expose upload property
- s.xhr = function () {
- var xhr = $.ajaxSettings.xhr();
- if (xhr.upload) {
- xhr.upload.addEventListener('progress', function (event) {
- var percent = 0;
- var position = event.loaded || event.position;
- /*event.position is deprecated*/
- var total = event.total;
- if (event.lengthComputable) {
- percent = Math.ceil(position / total * 100);
- }
- options.uploadProgress(event, position, total, percent);
- }, false);
- }
- return xhr;
- };
- }
- s.data = null;
- var beforeSend = s.beforeSend;
- s.beforeSend = function (xhr, o) {
- //Send FormData() provided by user
- if (options.formData) {
- o.data = options.formData;
- }
- else {
- o.data = formdata;
- }
- if (beforeSend) {
- beforeSend.call(this, xhr, o);
- }
- };
- return $.ajax(s);
- }
-
- // private function for handling file uploads (hat tip to YAHOO!)
- function fileUploadIframe(a) {
- var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle;
- var deferred = $.Deferred();
- // #341
- deferred.abort = function (status) {
- xhr.abort(status);
- };
- if (a) {
- // ensure that every serialized input is still enabled
- for (i = 0; i < elements.length; i++) {
- el = $(elements[i]);
- if (hasProp) {
- el.prop('disabled', false);
- }
- else {
- el.removeAttr('disabled');
- }
- }
- }
- s = $.extend(true, {}, $.ajaxSettings, options);
- s.context = s.context || s;
- id = 'jqFormIO' + (new Date().getTime());
- if (s.iframeTarget) {
- $io = $(s.iframeTarget);
- n = $io.attr2('name');
- if (!n) {
- $io.attr2('name', id);
- }
- else {
- id = n;
- }
- }
- else {
- $io = $('');
- $io.css({position: 'absolute', top: '-1000px', left: '-1000px'});
- }
- io = $io[0];
- xhr = { // mock object
- aborted: 0,
- responseText: null,
- responseXML: null,
- status: 0,
- statusText: 'n/a',
- getAllResponseHeaders: function () {
- },
- getResponseHeader: function () {
- },
- setRequestHeader: function () {
- },
- abort: function (status) {
- var e = (status === 'timeout' ? 'timeout' : 'aborted');
- log('aborting upload... ' + e);
- this.aborted = 1;
- try { // #214, #257
- if (io.contentWindow.document.execCommand) {
- io.contentWindow.document.execCommand('Stop');
- }
- }
- catch (ignore) {
- }
- $io.attr('src', s.iframeSrc); // abort op in progress
- xhr.error = e;
- if (s.error) {
- s.error.call(s.context, xhr, e, status);
- }
- if (g) {
- $.event.trigger("ajaxError", [xhr, s, e]);
- }
- if (s.complete) {
- s.complete.call(s.context, xhr, e);
- }
- }
- };
- g = s.global;
- // trigger ajax global events so that activity/block indicators work like normal
- if (g && 0 === $.active++) {
- $.event.trigger("ajaxStart");
- }
- if (g) {
- $.event.trigger("ajaxSend", [xhr, s]);
- }
- if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
- if (s.global) {
- $.active--;
- }
- deferred.reject();
- return deferred;
- }
- if (xhr.aborted) {
- deferred.reject();
- return deferred;
- }
- // add submitting element to data if we know it
- sub = form.clk;
- if (sub) {
- n = sub.name;
- if (n && !sub.disabled) {
- s.extraData = s.extraData || {};
- s.extraData[n] = sub.value;
- if (sub.type == "image") {
- s.extraData[n + '.x'] = form.clk_x;
- s.extraData[n + '.y'] = form.clk_y;
- }
- }
- }
- var CLIENT_TIMEOUT_ABORT = 1;
- var SERVER_ABORT = 2;
-
- function getDoc(frame) {
- /* it looks like contentWindow or contentDocument do not
- * carry the protocol property in ie8, when running under ssl
- * frame.document is the only valid response document, since
- * the protocol is know but not on the other two objects. strange?
- * "Same origin policy" http://en.wikipedia.org/wiki/Same_origin_policy
- */
- var doc = null;
- // IE8 cascading access check
- try {
- if (frame.contentWindow) {
- doc = frame.contentWindow.document;
- }
- } catch (err) {
- // IE8 access denied under ssl & missing protocol
- log('cannot get iframe.contentWindow document: ' + err);
- }
- if (doc) { // successful getting content
- return doc;
- }
- try { // simply checking may throw in ie8 under ssl or mismatched protocol
- doc = frame.contentDocument ? frame.contentDocument : frame.document;
- } catch (err) {
- // last attempt
- log('cannot get iframe.contentDocument: ' + err);
- doc = frame.document;
- }
- return doc;
- }
-
- // Rails CSRF hack (thanks to Yvan Barthelemy)
- var csrf_token = $('meta[name=csrf-token]').attr('content');
- var csrf_param = $('meta[name=csrf-param]').attr('content');
- if (csrf_param && csrf_token) {
- s.extraData = s.extraData || {};
- s.extraData[csrf_param] = csrf_token;
- }
- // take a breath so that pending repaints get some cpu time before the upload starts
- function doSubmit() {
- // make sure form attrs are set
- var t = $form.attr2('target'),
- a = $form.attr2('action'),
- mp = 'multipart/form-data',
- et = $form.attr('enctype') || $form.attr('encoding') || mp;
- // update form attrs in IE friendly way
- form.setAttribute('target', id);
- if (!method || /post/i.test(method)) {
- form.setAttribute('method', 'POST');
- }
- if (a != s.url) {
- form.setAttribute('action', s.url);
- }
- // ie borks in some cases when setting encoding
- if (!s.skipEncodingOverride && (!method || /post/i.test(method))) {
- $form.attr({
- encoding: 'multipart/form-data',
- enctype: 'multipart/form-data'
- });
- }
- // support timout
- if (s.timeout) {
- timeoutHandle = setTimeout(function () {
- timedOut = true;
- cb(CLIENT_TIMEOUT_ABORT);
- }, s.timeout);
- }
- // look for server aborts
- function checkState() {
- try {
- var state = getDoc(io).readyState;
- log('state = ' + state);
- if (state && state.toLowerCase() == 'uninitialized') {
- setTimeout(checkState, 50);
- }
- }
- catch (e) {
- log('Server abort: ', e, ' (', e.name, ')');
- cb(SERVER_ABORT);
- if (timeoutHandle) {
- clearTimeout(timeoutHandle);
- }
- timeoutHandle = undefined;
- }
- }
-
- // add "extra" data to form if provided in options
- var extraInputs = [];
- try {
- if (s.extraData) {
- for (var n in s.extraData) {
- if (s.extraData.hasOwnProperty(n)) {
- // if using the $.param format that allows for multiple values with the same name
- if ($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {
- extraInputs.push(
- $(' ').val(s.extraData[n].value)
- .appendTo(form)[0]);
- } else {
- extraInputs.push(
- $(' ').val(s.extraData[n])
- .appendTo(form)[0]);
- }
- }
- }
- }
- if (!s.iframeTarget) {
- // add iframe to doc and submit the form
- $io.appendTo('body');
- }
- if (io.attachEvent) {
- io.attachEvent('onload', cb);
- }
- else {
- io.addEventListener('load', cb, false);
- }
- setTimeout(checkState, 15);
- try {
- form.submit();
- } catch (err) {
- // just in case form has element with name/id of 'submit'
- var submitFn = document.createElement('form').submit;
- submitFn.apply(form);
- }
- }
- finally {
- // reset attrs and remove "extra" input elements
- form.setAttribute('action', a);
- form.setAttribute('enctype', et); // #380
- if (t) {
- form.setAttribute('target', t);
- } else {
- $form.removeAttr('target');
- }
- $(extraInputs).remove();
- }
- }
-
- if (s.forceSync) {
- doSubmit();
- }
- else {
- setTimeout(doSubmit, 10); // this lets dom updates render
- }
- var data, doc, domCheckCount = 50, callbackProcessed;
-
- function cb(e) {
- if (xhr.aborted || callbackProcessed) {
- return;
- }
- doc = getDoc(io);
- if (!doc) {
- log('cannot access response document');
- e = SERVER_ABORT;
- }
- if (e === CLIENT_TIMEOUT_ABORT && xhr) {
- xhr.abort('timeout');
- deferred.reject(xhr, 'timeout');
- return;
- }
- else if (e == SERVER_ABORT && xhr) {
- xhr.abort('server abort');
- deferred.reject(xhr, 'error', 'server abort');
- return;
- }
- if (!doc || doc.location.href == s.iframeSrc) {
- // response not received yet
- if (!timedOut) {
- return;
- }
- }
- if (io.detachEvent) {
- io.detachEvent('onload', cb);
- }
- else {
- io.removeEventListener('load', cb, false);
- }
- var status = 'success', errMsg;
- try {
- if (timedOut) {
- throw 'timeout';
- }
- var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
- log('isXml=' + isXml);
- if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {
- if (--domCheckCount) {
- // in some browsers (Opera) the iframe DOM is not always traversable when
- // the onload callback fires, so we loop a bit to accommodate
- log('requeing onLoad callback, DOM not available');
- setTimeout(cb, 250);
- return;
- }
- // let this fall through because server response could be an empty document
- //log('Could not access iframe DOM after mutiple tries.');
- //throw 'DOMException: not available';
- }
- //log('response detected');
- var docRoot = doc.body ? doc.body : doc.documentElement;
- xhr.responseText = docRoot ? docRoot.innerHTML : null;
- xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
- if (isXml) {
- s.dataType = 'xml';
- }
- xhr.getResponseHeader = function (header) {
- var headers = {'content-type': s.dataType};
- return headers[header.toLowerCase()];
- };
- // support for XHR 'status' & 'statusText' emulation :
- if (docRoot) {
- xhr.status = Number(docRoot.getAttribute('status')) || xhr.status;
- xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText;
- }
- var dt = (s.dataType || '').toLowerCase();
- var scr = /(json|script|text)/.test(dt);
- if (scr || s.textarea) {
- // see if user embedded response in textarea
- var ta = doc.getElementsByTagName('textarea')[0];
- if (ta) {
- xhr.responseText = ta.value;
- // support for XHR 'status' & 'statusText' emulation :
- xhr.status = Number(ta.getAttribute('status')) || xhr.status;
- xhr.statusText = ta.getAttribute('statusText') || xhr.statusText;
- }
- else if (scr) {
- // account for browsers injecting pre around json response
- var pre = doc.getElementsByTagName('pre')[0];
- var b = doc.getElementsByTagName('body')[0];
- if (pre) {
- xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;
- }
- else if (b) {
- xhr.responseText = b.textContent ? b.textContent : b.innerText;
- }
- }
- }
- else if (dt == 'xml' && !xhr.responseXML && xhr.responseText) {
- xhr.responseXML = toXml(xhr.responseText);
- }
- try {
- data = httpData(xhr, dt, s);
- }
- catch (err) {
- status = 'parsererror';
- xhr.error = errMsg = (err || status);
- }
- }
- catch (err) {
- log('error caught: ', err);
- status = 'error';
- xhr.error = errMsg = (err || status);
- }
- if (xhr.aborted) {
- log('upload aborted');
- status = null;
- }
- if (xhr.status) { // we've set xhr.status
- status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error';
- }
- // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
- if (status === 'success') {
- if (s.success) {
- s.success.call(s.context, data, 'success', xhr);
- }
- deferred.resolve(xhr.responseText, 'success', xhr);
- if (g) {
- $.event.trigger("ajaxSuccess", [xhr, s]);
- }
- }
- else if (status) {
- if (errMsg === undefined) {
- errMsg = xhr.statusText;
- }
- if (s.error) {
- s.error.call(s.context, xhr, status, errMsg);
- }
- deferred.reject(xhr, 'error', errMsg);
- if (g) {
- $.event.trigger("ajaxError", [xhr, s, errMsg]);
- }
- }
- if (g) {
- $.event.trigger("ajaxComplete", [xhr, s]);
- }
- if (g && !--$.active) {
- $.event.trigger("ajaxStop");
- }
- if (s.complete) {
- s.complete.call(s.context, xhr, status);
- }
- callbackProcessed = true;
- if (s.timeout) {
- clearTimeout(timeoutHandle);
- }
- // clean up
- setTimeout(function () {
- if (!s.iframeTarget) {
- $io.remove();
- }
- else { //adding else to clean up existing iframe response.
- $io.attr('src', s.iframeSrc);
- }
- xhr.responseXML = null;
- }, 100);
- }
-
- var toXml = $.parseXML || function (s, doc) { // use parseXML if available (jQuery 1.5+)
- if (window.ActiveXObject) {
- doc = new ActiveXObject('Microsoft.XMLDOM');
- doc.async = 'false';
- doc.loadXML(s);
- }
- else {
- doc = (new DOMParser()).parseFromString(s, 'text/xml');
- }
- return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
- };
- var parseJSON = $.parseJSON || function (s) {
- /*jslint evil:true */
- return window['eval']('(' + s + ')');
- };
- var httpData = function (xhr, type, s) { // mostly lifted from jq1.4.4
- var ct = xhr.getResponseHeader('content-type') || '',
- xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
- data = xml ? xhr.responseXML : xhr.responseText;
- if (xml && data.documentElement.nodeName === 'parsererror') {
- if ($.error) {
- $.error('parsererror');
- }
- }
- if (s && s.dataFilter) {
- data = s.dataFilter(data, type);
- }
- if (typeof data === 'string') {
- if (type === 'json' || !type && ct.indexOf('json') >= 0) {
- data = parseJSON(data);
- } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
- $.globalEval(data);
- }
- }
- return data;
- };
- return deferred;
- }
- };
- /**
- * ajaxForm() provides a mechanism for fully automating form submission.
- *
- * The advantages of using this method instead of ajaxSubmit() are:
- *
- * 1: This method will include coordinates for elements (if the element
- * is used to submit the form).
- * 2. This method will include the submit element's name/value data (for the element that was
- * used to submit the form).
- * 3. This method binds the submit() method to the form for you.
- *
- * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
- * passes the options argument along after properly binding events for submit elements and
- * the form itself.
- */
- $.fn.ajaxForm = function (options) {
- options = options || {};
- options.delegation = options.delegation && $.isFunction($.fn.on);
- // in jQuery 1.3+ we can fix mistakes with the ready state
- if (!options.delegation && this.length === 0) {
- var o = {s: this.selector, c: this.context};
- if (!$.isReady && o.s) {
- log('DOM not ready, queuing ajaxForm');
- $(function () {
- $(o.s, o.c).ajaxForm(options);
- });
- return this;
- }
- // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
- log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
- return this;
- }
- if (options.delegation) {
- $(document)
- .off('submit.form-plugin', this.selector, doAjaxSubmit)
- .off('click.form-plugin', this.selector, captureSubmittingElement)
- .on('submit.form-plugin', this.selector, options, doAjaxSubmit)
- .on('click.form-plugin', this.selector, options, captureSubmittingElement);
- return this;
- }
- return this.ajaxFormUnbind()
- .bind('submit.form-plugin', options, doAjaxSubmit)
- .bind('click.form-plugin', options, captureSubmittingElement);
- };
-// private event handlers
- function doAjaxSubmit(e) {
- /*jshint validthis:true */
- var options = e.data;
- if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
- e.preventDefault();
- $(e.target).ajaxSubmit(options); // #365
- }
- }
-
- function captureSubmittingElement(e) {
- /*jshint validthis:true */
- var target = e.target;
- var $el = $(target);
- if (!($el.is("[type=submit],[type=image]"))) {
- // is this a child element of the submit el? (ex: a span within a button)
- var t = $el.closest('[type=submit]');
- if (t.length === 0) {
- return;
- }
- target = t[0];
- }
- var form = this;
- form.clk = target;
- if (target.type == 'image') {
- if (e.offsetX !== undefined) {
- form.clk_x = e.offsetX;
- form.clk_y = e.offsetY;
- } else if (typeof $.fn.offset == 'function') {
- var offset = $el.offset();
- form.clk_x = e.pageX - offset.left;
- form.clk_y = e.pageY - offset.top;
- } else {
- form.clk_x = e.pageX - target.offsetLeft;
- form.clk_y = e.pageY - target.offsetTop;
- }
- }
- // clear form vars
- setTimeout(function () {
- form.clk = form.clk_x = form.clk_y = null;
- }, 100);
- }
-
-// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
- $.fn.ajaxFormUnbind = function () {
- return this.unbind('submit.form-plugin click.form-plugin');
- };
- /**
- * formToArray() gathers form element data into an array of objects that can
- * be passed to any of the following ajax functions: $.get, $.post, or load.
- * Each object in the array has both a 'name' and 'value' property. An example of
- * an array for a simple login form might be:
- *
- * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
- *
- * It is this array that is passed to pre-submit callback functions provided to the
- * ajaxSubmit() and ajaxForm() methods.
- */
- $.fn.formToArray = function (semantic, elements) {
- var a = [];
- if (this.length === 0) {
- return a;
- }
- var form = this[0];
- var formId = this.attr('id');
- var els = semantic ? form.getElementsByTagName('*') : form.elements;
- var els2;
- if (els && !/MSIE [678]/.test(navigator.userAgent)) { // #390
- els = $(els).get(); // convert to standard array
- }
- // #386; account for inputs outside the form which use the 'form' attribute
- if (formId) {
- els2 = $(':input[form=' + formId + ']').get();
- if (els2.length) {
- els = (els || []).concat(els2);
- }
- }
- if (!els || !els.length) {
- return a;
- }
- var i, j, n, v, el, max, jmax;
- for (i = 0, max = els.length; i < max; i++) {
- el = els[i];
- n = el.name;
- if (!n || el.disabled) {
- continue;
- }
- if (semantic && form.clk && el.type == "image") {
- // handle image inputs on the fly when semantic == true
- if (form.clk == el) {
- a.push({name: n, value: $(el).val(), type: el.type});
- a.push({name: n + '.x', value: form.clk_x}, {name: n + '.y', value: form.clk_y});
- }
- continue;
- }
- v = $.fieldValue(el, true);
- if (v && v.constructor == Array) {
- if (elements) {
- elements.push(el);
- }
- for (j = 0, jmax = v.length; j < jmax; j++) {
- a.push({name: n, value: v[j]});
- }
- }
- else if (feature.fileapi && el.type == 'file') {
- if (elements) {
- elements.push(el);
- }
- var files = el.files;
- if (files.length) {
- for (j = 0; j < files.length; j++) {
- a.push({name: n, value: files[j], type: el.type});
- }
- }
- else {
- // #180
- a.push({name: n, value: '', type: el.type});
- }
- }
- else if (v !== null && typeof v != 'undefined') {
- if (elements) {
- elements.push(el);
- }
- a.push({name: n, value: v, type: el.type, required: el.required});
- }
- }
- if (!semantic && form.clk) {
- // input type=='image' are not found in elements array! handle it here
- var $input = $(form.clk), input = $input[0];
- n = input.name;
- if (n && !input.disabled && input.type == 'image') {
- a.push({name: n, value: $input.val()});
- a.push({name: n + '.x', value: form.clk_x}, {name: n + '.y', value: form.clk_y});
- }
- }
- return a;
- };
- /**
- * Serializes form data into a 'submittable' string. This method will return a string
- * in the format: name1=value1&name2=value2
- */
- $.fn.formSerialize = function (semantic) {
- //hand off to jQuery.param for proper encoding
- return $.param(this.formToArray(semantic));
- };
- /**
- * Serializes all field elements in the jQuery object into a query string.
- * This method will return a string in the format: name1=value1&name2=value2
- */
- $.fn.fieldSerialize = function (successful) {
- var a = [];
- this.each(function () {
- var n = this.name;
- if (!n) {
- return;
- }
- var v = $.fieldValue(this, successful);
- if (v && v.constructor == Array) {
- for (var i = 0, max = v.length; i < max; i++) {
- a.push({name: n, value: v[i]});
- }
- }
- else if (v !== null && typeof v != 'undefined') {
- a.push({name: this.name, value: v});
- }
- });
- //hand off to jQuery.param for proper encoding
- return $.param(a);
- };
- /**
- * Returns the value(s) of the element in the matched set. For example, consider the following form:
- *
- *
- *
- * var v = $('input[type=text]').fieldValue();
- * // if no values are entered into the text inputs
- * v == ['','']
- * // if values entered into the text inputs are 'foo' and 'bar'
- * v == ['foo','bar']
- *
- * var v = $('input[type=checkbox]').fieldValue();
- * // if neither checkbox is checked
- * v === undefined
- * // if both checkboxes are checked
- * v == ['B1', 'B2']
- *
- * var v = $('input[type=radio]').fieldValue();
- * // if neither radio is checked
- * v === undefined
- * // if first radio is checked
- * v == ['C1']
- *
- * The successful argument controls whether or not the field element must be 'successful'
- * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
- * The default value of the successful argument is true. If this value is false the value(s)
- * for each element is returned.
- *
- * Note: This method *always* returns an array. If no valid value can be determined the
- * array will be empty, otherwise it will contain one or more values.
- */
- $.fn.fieldValue = function (successful) {
- for (var val = [], i = 0, max = this.length; i < max; i++) {
- var el = this[i];
- var v = $.fieldValue(el, successful);
- if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
- continue;
- }
- if (v.constructor == Array) {
- $.merge(val, v);
- }
- else {
- val.push(v);
- }
- }
- return val;
- };
- /**
- * Returns the value of the field element.
- */
- $.fieldValue = function (el, successful) {
- var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
- if (successful === undefined) {
- successful = true;
- }
- if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
- (t == 'checkbox' || t == 'radio') && !el.checked ||
- (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
- tag == 'select' && el.selectedIndex == -1)) {
- return null;
- }
- if (tag == 'select') {
- var index = el.selectedIndex;
- if (index < 0) {
- return null;
- }
- var a = [], ops = el.options;
- var one = (t == 'select-one');
- var max = (one ? index + 1 : ops.length);
- for (var i = (one ? index : 0); i < max; i++) {
- var op = ops[i];
- if (op.selected) {
- var v = op.value;
- if (!v) { // extra pain for IE...
- v = (op.attributes && op.attributes.value && !(op.attributes.value.specified)) ? op.text : op.value;
- }
- if (one) {
- return v;
- }
- a.push(v);
- }
- }
- return a;
- }
- return $(el).val();
- };
- /**
- * Clears the form data. Takes the following actions on the form's input fields:
- * - input text fields will have their 'value' property set to the empty string
- * - select elements will have their 'selectedIndex' property set to -1
- * - checkbox and radio inputs will have their 'checked' property set to false
- * - inputs of type submit, button, reset, and hidden will *not* be effected
- * - button elements will *not* be effected
- */
- $.fn.clearForm = function (includeHidden) {
- return this.each(function () {
- $('input,select,textarea', this).clearFields(includeHidden);
- });
- };
- /**
- * Clears the selected form elements.
- */
- $.fn.clearFields = $.fn.clearInputs = function (includeHidden) {
- var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list
- return this.each(function () {
- var t = this.type, tag = this.tagName.toLowerCase();
- if (re.test(t) || tag == 'textarea') {
- this.value = '';
- }
- else if (t == 'checkbox' || t == 'radio') {
- this.checked = false;
- }
- else if (tag == 'select') {
- this.selectedIndex = -1;
- }
- else if (t == "file") {
- if (/MSIE/.test(navigator.userAgent)) {
- $(this).replaceWith($(this).clone(true));
- } else {
- $(this).val('');
- }
- }
- else if (includeHidden) {
- // includeHidden can be the value true, or it can be a selector string
- // indicating a special test; for example:
- // $('#myForm').clearForm('.special:hidden')
- // the above would clean hidden inputs that have the class of 'special'
- if ((includeHidden === true && /hidden/.test(t)) ||
- (typeof includeHidden == 'string' && $(this).is(includeHidden))) {
- this.value = '';
- }
- }
- });
- };
- /**
- * Resets the form data. Causes all form elements to be reset to their original value.
- */
- $.fn.resetForm = function () {
- return this.each(function () {
- // guard against an input with the name of 'reset'
- // note that IE reports the reset function as an 'object'
- if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
- this.reset();
- }
- });
- };
- /**
- * Enables or disables any matching elements.
- */
- $.fn.enable = function (b) {
- if (b === undefined) {
- b = true;
- }
- return this.each(function () {
- this.disabled = !b;
- });
- };
- /**
- * Checks/unchecks any matching checkboxes or radio buttons and
- * selects/deselects and matching option elements.
- */
- $.fn.selected = function (select) {
- if (select === undefined) {
- select = true;
- }
- return this.each(function () {
- var t = this.type;
- if (t == 'checkbox' || t == 'radio') {
- this.checked = select;
- }
- else if (this.tagName.toLowerCase() == 'option') {
- var $sel = $(this).parent('select');
- if (select && $sel[0] && $sel[0].type == 'select-one') {
- // deselect all other options
- $sel.find('option').selected(false);
- }
- this.selected = select;
- }
- });
- };
-// expose debug var
- $.fn.ajaxSubmit.debug = false;
-// helper fn for console logging
- function log() {
- if (!$.fn.ajaxSubmit.debug) {
- return;
- }
- var msg = '[jquery.form] ' + Array.prototype.join.call(arguments, '');
- if (window.console && window.console.log) {
- window.console.log(msg);
- }
- else if (window.opera && window.opera.postError) {
- window.opera.postError(msg);
- }
- }
-}));
diff --git a/public/script/jquery.min.js b/public/script/jquery.min.js
deleted file mode 100644
index 78ee040..0000000
--- a/public/script/jquery.min.js
+++ /dev/null
@@ -1,2647 +0,0 @@
-/*! jQuery v1.8.3 jquery.com | jquery.org/license */
-(function (e, t) {
- function _(e) {
- var t = M[e] = {};
- return v.each(e.split(y), function (e, n) {
- t[n] = !0
- }), t
- }
-
- function H(e, n, r) {
- if (r === t && e.nodeType === 1) {
- var i = "data-" + n.replace(P, "-$1").toLowerCase();
- r = e.getAttribute(i);
- if (typeof r == "string") {
- try {
- r = r === "true" ? !0 : r === "false" ? !1 : r === "null" ? null : +r + "" === r ? +r : D.test(r) ? v.parseJSON(r) : r
- } catch (s) {
- }
- v.data(e, n, r)
- } else r = t
- }
- return r
- }
-
- function B(e) {
- var t;
- for (t in e) {
- if (t === "data" && v.isEmptyObject(e[t]))continue;
- if (t !== "toJSON")return !1
- }
- return !0
- }
-
- function et() {
- return !1
- }
-
- function tt() {
- return !0
- }
-
- function ut(e) {
- return !e || !e.parentNode || e.parentNode.nodeType === 11
- }
-
- function at(e, t) {
- do e = e[t]; while (e && e.nodeType !== 1);
- return e
- }
-
- function ft(e, t, n) {
- t = t || 0;
- if (v.isFunction(t))return v.grep(e, function (e, r) {
- var i = !!t.call(e, r, e);
- return i === n
- });
- if (t.nodeType)return v.grep(e, function (e, r) {
- return e === t === n
- });
- if (typeof t == "string") {
- var r = v.grep(e, function (e) {
- return e.nodeType === 1
- });
- if (it.test(t))return v.filter(t, r, !n);
- t = v.filter(t, r)
- }
- return v.grep(e, function (e, r) {
- return v.inArray(e, t) >= 0 === n
- })
- }
-
- function lt(e) {
- var t = ct.split("|"), n = e.createDocumentFragment();
- if (n.createElement)while (t.length)n.createElement(t.pop());
- return n
- }
-
- function Lt(e, t) {
- return e.getElementsByTagName(t)[0] || e.appendChild(e.ownerDocument.createElement(t))
- }
-
- function At(e, t) {
- if (t.nodeType !== 1 || !v.hasData(e))return;
- var n, r, i, s = v._data(e), o = v._data(t, s), u = s.events;
- if (u) {
- delete o.handle, o.events = {};
- for (n in u)for (r = 0, i = u[n].length; r < i; r++)v.event.add(t, n, u[n][r])
- }
- o.data && (o.data = v.extend({}, o.data))
- }
-
- function Ot(e, t) {
- var n;
- if (t.nodeType !== 1)return;
- t.clearAttributes && t.clearAttributes(), t.mergeAttributes && t.mergeAttributes(e), n = t.nodeName.toLowerCase(), n === "object" ? (t.parentNode && (t.outerHTML = e.outerHTML), v.support.html5Clone && e.innerHTML && !v.trim(t.innerHTML) && (t.innerHTML = e.innerHTML)) : n === "input" && Et.test(e.type) ? (t.defaultChecked = t.checked = e.checked, t.value !== e.value && (t.value = e.value)) : n === "option" ? t.selected = e.defaultSelected : n === "input" || n === "textarea" ? t.defaultValue = e.defaultValue : n === "script" && t.text !== e.text && (t.text = e.text), t.removeAttribute(v.expando)
- }
-
- function Mt(e) {
- return typeof e.getElementsByTagName != "undefined" ? e.getElementsByTagName("*") : typeof e.querySelectorAll != "undefined" ? e.querySelectorAll("*") : []
- }
-
- function _t(e) {
- Et.test(e.type) && (e.defaultChecked = e.checked)
- }
-
- function Qt(e, t) {
- if (t in e)return t;
- var n = t.charAt(0).toUpperCase() + t.slice(1), r = t, i = Jt.length;
- while (i--) {
- t = Jt[i] + n;
- if (t in e)return t
- }
- return r
- }
-
- function Gt(e, t) {
- return e = t || e, v.css(e, "display") === "none" || !v.contains(e.ownerDocument, e)
- }
-
- function Yt(e, t) {
- var n, r, i = [], s = 0, o = e.length;
- for (; s < o; s++) {
- n = e[s];
- if (!n.style)continue;
- i[s] = v._data(n, "olddisplay"), t ? (!i[s] && n.style.display === "none" && (n.style.display = ""), n.style.display === "" && Gt(n) && (i[s] = v._data(n, "olddisplay", nn(n.nodeName)))) : (r = Dt(n, "display"), !i[s] && r !== "none" && v._data(n, "olddisplay", r))
- }
- for (s = 0; s < o; s++) {
- n = e[s];
- if (!n.style)continue;
- if (!t || n.style.display === "none" || n.style.display === "")n.style.display = t ? i[s] || "" : "none"
- }
- return e
- }
-
- function Zt(e, t, n) {
- var r = Rt.exec(t);
- return r ? Math.max(0, r[1] - (n || 0)) + (r[2] || "px") : t
- }
-
- function en(e, t, n, r) {
- var i = n === (r ? "border" : "content") ? 4 : t === "width" ? 1 : 0, s = 0;
- for (; i < 4; i += 2)n === "margin" && (s += v.css(e, n + $t[i], !0)), r ? (n === "content" && (s -= parseFloat(Dt(e, "padding" + $t[i])) || 0), n !== "margin" && (s -= parseFloat(Dt(e, "border" + $t[i] + "Width")) || 0)) : (s += parseFloat(Dt(e, "padding" + $t[i])) || 0, n !== "padding" && (s += parseFloat(Dt(e, "border" + $t[i] + "Width")) || 0));
- return s
- }
-
- function tn(e, t, n) {
- var r = t === "width" ? e.offsetWidth : e.offsetHeight, i = !0, s = v.support.boxSizing && v.css(e, "boxSizing") === "border-box";
- if (r <= 0 || r == null) {
- r = Dt(e, t);
- if (r < 0 || r == null)r = e.style[t];
- if (Ut.test(r))return r;
- i = s && (v.support.boxSizingReliable || r === e.style[t]), r = parseFloat(r) || 0
- }
- return r + en(e, t, n || (s ? "border" : "content"), i) + "px"
- }
-
- function nn(e) {
- if (Wt[e])return Wt[e];
- var t = v("<" + e + ">").appendTo(i.body), n = t.css("display");
- t.remove();
- if (n === "none" || n === "") {
- Pt = i.body.appendChild(Pt || v.extend(i.createElement("iframe"), {frameBorder: 0, width: 0, height: 0}));
- if (!Ht || !Pt.createElement)Ht = (Pt.contentWindow || Pt.contentDocument).document, Ht.write(""), Ht.close();
- t = Ht.body.appendChild(Ht.createElement(e)), n = Dt(t, "display"), i.body.removeChild(Pt)
- }
- return Wt[e] = n, n
- }
-
- function fn(e, t, n, r) {
- var i;
- if (v.isArray(t))v.each(t, function (t, i) {
- n || sn.test(e) ? r(e, i) : fn(e + "[" + (typeof i == "object" ? t : "") + "]", i, n, r)
- }); else if (!n && v.type(t) === "object")for (i in t)fn(e + "[" + i + "]", t[i], n, r); else r(e, t)
- }
-
- function Cn(e) {
- return function (t, n) {
- typeof t != "string" && (n = t, t = "*");
- var r, i, s, o = t.toLowerCase().split(y), u = 0, a = o.length;
- if (v.isFunction(n))for (; u < a; u++)r = o[u], s = /^\+/.test(r), s && (r = r.substr(1) || "*"), i = e[r] = e[r] || [], i[s ? "unshift" : "push"](n)
- }
- }
-
- function kn(e, n, r, i, s, o) {
- s = s || n.dataTypes[0], o = o || {}, o[s] = !0;
- var u, a = e[s], f = 0, l = a ? a.length : 0, c = e === Sn;
- for (; f < l && (c || !u); f++)u = a[f](n, r, i), typeof u == "string" && (!c || o[u] ? u = t : (n.dataTypes.unshift(u), u = kn(e, n, r, i, u, o)));
- return (c || !u) && !o["*"] && (u = kn(e, n, r, i, "*", o)), u
- }
-
- function Ln(e, n) {
- var r, i, s = v.ajaxSettings.flatOptions || {};
- for (r in n)n[r] !== t && ((s[r] ? e : i || (i = {}))[r] = n[r]);
- i && v.extend(!0, e, i)
- }
-
- function An(e, n, r) {
- var i, s, o, u, a = e.contents, f = e.dataTypes, l = e.responseFields;
- for (s in l)s in r && (n[l[s]] = r[s]);
- while (f[0] === "*")f.shift(), i === t && (i = e.mimeType || n.getResponseHeader("content-type"));
- if (i)for (s in a)if (a[s] && a[s].test(i)) {
- f.unshift(s);
- break
- }
- if (f[0]in r)o = f[0]; else {
- for (s in r) {
- if (!f[0] || e.converters[s + " " + f[0]]) {
- o = s;
- break
- }
- u || (u = s)
- }
- o = o || u
- }
- if (o)return o !== f[0] && f.unshift(o), r[o]
- }
-
- function On(e, t) {
- var n, r, i, s, o = e.dataTypes.slice(), u = o[0], a = {}, f = 0;
- e.dataFilter && (t = e.dataFilter(t, e.dataType));
- if (o[1])for (n in e.converters)a[n.toLowerCase()] = e.converters[n];
- for (; i = o[++f];)if (i !== "*") {
- if (u !== "*" && u !== i) {
- n = a[u + " " + i] || a["* " + i];
- if (!n)for (r in a) {
- s = r.split(" ");
- if (s[1] === i) {
- n = a[u + " " + s[0]] || a["* " + s[0]];
- if (n) {
- n === !0 ? n = a[r] : a[r] !== !0 && (i = s[0], o.splice(f--, 0, i));
- break
- }
- }
- }
- if (n !== !0)if (n && e["throws"])t = n(t); else try {
- t = n(t)
- } catch (l) {
- return {state: "parsererror", error: n ? l : "No conversion from " + u + " to " + i}
- }
- }
- u = i
- }
- return {state: "success", data: t}
- }
-
- function Fn() {
- try {
- return new e.XMLHttpRequest
- } catch (t) {
- }
- }
-
- function In() {
- try {
- return new e.ActiveXObject("Microsoft.XMLHTTP")
- } catch (t) {
- }
- }
-
- function $n() {
- return setTimeout(function () {
- qn = t
- }, 0), qn = v.now()
- }
-
- function Jn(e, t) {
- v.each(t, function (t, n) {
- var r = (Vn[t] || []).concat(Vn["*"]), i = 0, s = r.length;
- for (; i < s; i++)if (r[i].call(e, t, n))return
- })
- }
-
- function Kn(e, t, n) {
- var r, i = 0, s = 0, o = Xn.length, u = v.Deferred().always(function () {
- delete a.elem
- }), a = function () {
- var t = qn || $n(), n = Math.max(0, f.startTime + f.duration - t), r = n / f.duration || 0, i = 1 - r, s = 0, o = f.tweens.length;
- for (; s < o; s++)f.tweens[s].run(i);
- return u.notifyWith(e, [f, i, n]), i < 1 && o ? n : (u.resolveWith(e, [f]), !1)
- }, f = u.promise({
- elem: e, props: v.extend({}, t), opts: v.extend(!0, {specialEasing: {}}, n), originalProperties: t, originalOptions: n, startTime: qn || $n(), duration: n.duration, tweens: [], createTween: function (t, n, r) {
- var i = v.Tween(e, f.opts, t, n, f.opts.specialEasing[t] || f.opts.easing);
- return f.tweens.push(i), i
- }, stop: function (t) {
- var n = 0, r = t ? f.tweens.length : 0;
- for (; n < r; n++)f.tweens[n].run(1);
- return t ? u.resolveWith(e, [f, t]) : u.rejectWith(e, [f, t]), this
- }
- }), l = f.props;
- Qn(l, f.opts.specialEasing);
- for (; i < o; i++) {
- r = Xn[i].call(f, e, l, f.opts);
- if (r)return r
- }
- return Jn(f, l), v.isFunction(f.opts.start) && f.opts.start.call(e, f), v.fx.timer(v.extend(a, {anim: f, queue: f.opts.queue, elem: e})), f.progress(f.opts.progress).done(f.opts.done, f.opts.complete).fail(f.opts.fail).always(f.opts.always)
- }
-
- function Qn(e, t) {
- var n, r, i, s, o;
- for (n in e) {
- r = v.camelCase(n), i = t[r], s = e[n], v.isArray(s) && (i = s[1], s = e[n] = s[0]), n !== r && (e[r] = s, delete e[n]), o = v.cssHooks[r];
- if (o && "expand"in o) {
- s = o.expand(s), delete e[r];
- for (n in s)n in e || (e[n] = s[n], t[n] = i)
- } else t[r] = i
- }
- }
-
- function Gn(e, t, n) {
- var r, i, s, o, u, a, f, l, c, h = this, p = e.style, d = {}, m = [], g = e.nodeType && Gt(e);
- n.queue || (l = v._queueHooks(e, "fx"), l.unqueued == null && (l.unqueued = 0, c = l.empty.fire, l.empty.fire = function () {
- l.unqueued || c()
- }), l.unqueued++, h.always(function () {
- h.always(function () {
- l.unqueued--, v.queue(e, "fx").length || l.empty.fire()
- })
- })), e.nodeType === 1 && ("height"in t || "width"in t) && (n.overflow = [p.overflow, p.overflowX, p.overflowY], v.css(e, "display") === "inline" && v.css(e, "float") === "none" && (!v.support.inlineBlockNeedsLayout || nn(e.nodeName) === "inline" ? p.display = "inline-block" : p.zoom = 1)), n.overflow && (p.overflow = "hidden", v.support.shrinkWrapBlocks || h.done(function () {
- p.overflow = n.overflow[0], p.overflowX = n.overflow[1], p.overflowY = n.overflow[2]
- }));
- for (r in t) {
- s = t[r];
- if (Un.exec(s)) {
- delete t[r], a = a || s === "toggle";
- if (s === (g ? "hide" : "show"))continue;
- m.push(r)
- }
- }
- o = m.length;
- if (o) {
- u = v._data(e, "fxshow") || v._data(e, "fxshow", {}), "hidden"in u && (g = u.hidden), a && (u.hidden = !g), g ? v(e).show() : h.done(function () {
- v(e).hide()
- }), h.done(function () {
- var t;
- v.removeData(e, "fxshow", !0);
- for (t in d)v.style(e, t, d[t])
- });
- for (r = 0; r < o; r++)i = m[r], f = h.createTween(i, g ? u[i] : 0), d[i] = u[i] || v.style(e, i), i in u || (u[i] = f.start, g && (f.end = f.start, f.start = i === "width" || i === "height" ? 1 : 0))
- }
- }
-
- function Yn(e, t, n, r, i) {
- return new Yn.prototype.init(e, t, n, r, i)
- }
-
- function Zn(e, t) {
- var n, r = {height: e}, i = 0;
- t = t ? 1 : 0;
- for (; i < 4; i += 2 - t)n = $t[i], r["margin" + n] = r["padding" + n] = e;
- return t && (r.opacity = r.width = e), r
- }
-
- function tr(e) {
- return v.isWindow(e) ? e : e.nodeType === 9 ? e.defaultView || e.parentWindow : !1
- }
-
- var n, r, i = e.document, s = e.location, o = e.navigator, u = e.jQuery, a = e.$, f = Array.prototype.push, l = Array.prototype.slice, c = Array.prototype.indexOf, h = Object.prototype.toString, p = Object.prototype.hasOwnProperty, d = String.prototype.trim, v = function (e, t) {
- return new v.fn.init(e, t, n)
- }, m = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source, g = /\S/, y = /\s+/, b = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, w = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, E = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, S = /^[\],:{}\s]*$/, x = /(?:^|:|,)(?:\s*\[)+/g, T = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, N = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g, C = /^-ms-/, k = /-([\da-z])/gi, L = function (e, t) {
- return (t + "").toUpperCase()
- }, A = function () {
- i.addEventListener ? (i.removeEventListener("DOMContentLoaded", A, !1), v.ready()) : i.readyState === "complete" && (i.detachEvent("onreadystatechange", A), v.ready())
- }, O = {};
- v.fn = v.prototype = {
- constructor: v, init: function (e, n, r) {
- var s, o, u, a;
- if (!e)return this;
- if (e.nodeType)return this.context = this[0] = e, this.length = 1, this;
- if (typeof e == "string") {
- e.charAt(0) === "<" && e.charAt(e.length - 1) === ">" && e.length >= 3 ? s = [null, e, null] : s = w.exec(e);
- if (s && (s[1] || !n)) {
- if (s[1])return n = n instanceof v ? n[0] : n, a = n && n.nodeType ? n.ownerDocument || n : i, e = v.parseHTML(s[1], a, !0), E.test(s[1]) && v.isPlainObject(n) && this.attr.call(e, n, !0), v.merge(this, e);
- o = i.getElementById(s[2]);
- if (o && o.parentNode) {
- if (o.id !== s[2])return r.find(e);
- this.length = 1, this[0] = o
- }
- return this.context = i, this.selector = e, this
- }
- return !n || n.jquery ? (n || r).find(e) : this.constructor(n).find(e)
- }
- return v.isFunction(e) ? r.ready(e) : (e.selector !== t && (this.selector = e.selector, this.context = e.context), v.makeArray(e, this))
- }, selector: "", jquery: "1.8.3", length: 0, size: function () {
- return this.length
- }, toArray: function () {
- return l.call(this)
- }, get: function (e) {
- return e == null ? this.toArray() : e < 0 ? this[this.length + e] : this[e]
- }, pushStack: function (e, t, n) {
- var r = v.merge(this.constructor(), e);
- return r.prevObject = this, r.context = this.context, t === "find" ? r.selector = this.selector + (this.selector ? " " : "") + n : t && (r.selector = this.selector + "." + t + "(" + n + ")"), r
- }, each: function (e, t) {
- return v.each(this, e, t)
- }, ready: function (e) {
- return v.ready.promise().done(e), this
- }, eq: function (e) {
- return e = +e, e === -1 ? this.slice(e) : this.slice(e, e + 1)
- }, first: function () {
- return this.eq(0)
- }, last: function () {
- return this.eq(-1)
- }, slice: function () {
- return this.pushStack(l.apply(this, arguments), "slice", l.call(arguments).join(","))
- }, map: function (e) {
- return this.pushStack(v.map(this, function (t, n) {
- return e.call(t, n, t)
- }))
- }, end: function () {
- return this.prevObject || this.constructor(null)
- }, push: f, sort: [].sort, splice: [].splice
- }, v.fn.init.prototype = v.fn, v.extend = v.fn.extend = function () {
- var e, n, r, i, s, o, u = arguments[0] || {}, a = 1, f = arguments.length, l = !1;
- typeof u == "boolean" && (l = u, u = arguments[1] || {}, a = 2), typeof u != "object" && !v.isFunction(u) && (u = {}), f === a && (u = this, --a);
- for (; a < f; a++)if ((e = arguments[a]) != null)for (n in e) {
- r = u[n], i = e[n];
- if (u === i)continue;
- l && i && (v.isPlainObject(i) || (s = v.isArray(i))) ? (s ? (s = !1, o = r && v.isArray(r) ? r : []) : o = r && v.isPlainObject(r) ? r : {}, u[n] = v.extend(l, o, i)) : i !== t && (u[n] = i)
- }
- return u
- }, v.extend({
- noConflict: function (t) {
- return e.$ === v && (e.$ = a), t && e.jQuery === v && (e.jQuery = u), v
- }, isReady: !1, readyWait: 1, holdReady: function (e) {
- e ? v.readyWait++ : v.ready(!0)
- }, ready: function (e) {
- if (e === !0 ? --v.readyWait : v.isReady)return;
- if (!i.body)return setTimeout(v.ready, 1);
- v.isReady = !0;
- if (e !== !0 && --v.readyWait > 0)return;
- r.resolveWith(i, [v]), v.fn.trigger && v(i).trigger("ready").off("ready")
- }, isFunction: function (e) {
- return v.type(e) === "function"
- }, isArray: Array.isArray || function (e) {
- return v.type(e) === "array"
- }, isWindow: function (e) {
- return e != null && e == e.window
- }, isNumeric: function (e) {
- return !isNaN(parseFloat(e)) && isFinite(e)
- }, type: function (e) {
- return e == null ? String(e) : O[h.call(e)] || "object"
- }, isPlainObject: function (e) {
- if (!e || v.type(e) !== "object" || e.nodeType || v.isWindow(e))return !1;
- try {
- if (e.constructor && !p.call(e, "constructor") && !p.call(e.constructor.prototype, "isPrototypeOf"))return !1
- } catch (n) {
- return !1
- }
- var r;
- for (r in e);
- return r === t || p.call(e, r)
- }, isEmptyObject: function (e) {
- var t;
- for (t in e)return !1;
- return !0
- }, error: function (e) {
- throw new Error(e)
- }, parseHTML: function (e, t, n) {
- var r;
- return !e || typeof e != "string" ? null : (typeof t == "boolean" && (n = t, t = 0), t = t || i, (r = E.exec(e)) ? [t.createElement(r[1])] : (r = v.buildFragment([e], t, n ? null : []), v.merge([], (r.cacheable ? v.clone(r.fragment) : r.fragment).childNodes)))
- }, parseJSON: function (t) {
- if (!t || typeof t != "string")return null;
- t = v.trim(t);
- if (e.JSON && e.JSON.parse)return e.JSON.parse(t);
- if (S.test(t.replace(T, "@").replace(N, "]").replace(x, "")))return (new Function("return " + t))();
- v.error("Invalid JSON: " + t)
- }, parseXML: function (n) {
- var r, i;
- if (!n || typeof n != "string")return null;
- try {
- e.DOMParser ? (i = new DOMParser, r = i.parseFromString(n, "text/xml")) : (r = new ActiveXObject("Microsoft.XMLDOM"), r.async = "false", r.loadXML(n))
- } catch (s) {
- r = t
- }
- return (!r || !r.documentElement || r.getElementsByTagName("parsererror").length) && v.error("Invalid XML: " + n), r
- }, noop: function () {
- }, globalEval: function (t) {
- t && g.test(t) && (e.execScript || function (t) {
- e.eval.call(e, t)
- })(t)
- }, camelCase: function (e) {
- return e.replace(C, "ms-").replace(k, L)
- }, nodeName: function (e, t) {
- return e.nodeName && e.nodeName.toLowerCase() === t.toLowerCase()
- }, each: function (e, n, r) {
- var i, s = 0, o = e.length, u = o === t || v.isFunction(e);
- if (r) {
- if (u) {
- for (i in e)if (n.apply(e[i], r) === !1)break
- } else for (; s < o;)if (n.apply(e[s++], r) === !1)break
- } else if (u) {
- for (i in e)if (n.call(e[i], i, e[i]) === !1)break
- } else for (; s < o;)if (n.call(e[s], s, e[s++]) === !1)break;
- return e
- }, trim: d && !d.call("\ufeff\u00a0") ? function (e) {
- return e == null ? "" : d.call(e)
- } : function (e) {
- return e == null ? "" : (e + "").replace(b, "")
- }, makeArray: function (e, t) {
- var n, r = t || [];
- return e != null && (n = v.type(e), e.length == null || n === "string" || n === "function" || n === "regexp" || v.isWindow(e) ? f.call(r, e) : v.merge(r, e)), r
- }, inArray: function (e, t, n) {
- var r;
- if (t) {
- if (c)return c.call(t, e, n);
- r = t.length, n = n ? n < 0 ? Math.max(0, r + n) : n : 0;
- for (; n < r; n++)if (n in t && t[n] === e)return n
- }
- return -1
- }, merge: function (e, n) {
- var r = n.length, i = e.length, s = 0;
- if (typeof r == "number")for (; s < r; s++)e[i++] = n[s]; else while (n[s] !== t)e[i++] = n[s++];
- return e.length = i, e
- }, grep: function (e, t, n) {
- var r, i = [], s = 0, o = e.length;
- n = !!n;
- for (; s < o; s++)r = !!t(e[s], s), n !== r && i.push(e[s]);
- return i
- }, map: function (e, n, r) {
- var i, s, o = [], u = 0, a = e.length, f = e instanceof v || a !== t && typeof a == "number" && (a > 0 && e[0] && e[a - 1] || a === 0 || v.isArray(e));
- if (f)for (; u < a; u++)i = n(e[u], u, r), i != null && (o[o.length] = i); else for (s in e)i = n(e[s], s, r), i != null && (o[o.length] = i);
- return o.concat.apply([], o)
- }, guid: 1, proxy: function (e, n) {
- var r, i, s;
- return typeof n == "string" && (r = e[n], n = e, e = r), v.isFunction(e) ? (i = l.call(arguments, 2), s = function () {
- return e.apply(n, i.concat(l.call(arguments)))
- }, s.guid = e.guid = e.guid || v.guid++, s) : t
- }, access: function (e, n, r, i, s, o, u) {
- var a, f = r == null, l = 0, c = e.length;
- if (r && typeof r == "object") {
- for (l in r)v.access(e, n, l, r[l], 1, o, i);
- s = 1
- } else if (i !== t) {
- a = u === t && v.isFunction(i), f && (a ? (a = n, n = function (e, t, n) {
- return a.call(v(e), n)
- }) : (n.call(e, i), n = null));
- if (n)for (; l < c; l++)n(e[l], r, a ? i.call(e[l], l, n(e[l], r)) : i, u);
- s = 1
- }
- return s ? e : f ? n.call(e) : c ? n(e[0], r) : o
- }, now: function () {
- return (new Date).getTime()
- }
- }), v.ready.promise = function (t) {
- if (!r) {
- r = v.Deferred();
- if (i.readyState === "complete")setTimeout(v.ready, 1); else if (i.addEventListener)i.addEventListener("DOMContentLoaded", A, !1), e.addEventListener("load", v.ready, !1); else {
- i.attachEvent("onreadystatechange", A), e.attachEvent("onload", v.ready);
- var n = !1;
- try {
- n = e.frameElement == null && i.documentElement
- } catch (s) {
- }
- n && n.doScroll && function o() {
- if (!v.isReady) {
- try {
- n.doScroll("left")
- } catch (e) {
- return setTimeout(o, 50)
- }
- v.ready()
- }
- }()
- }
- }
- return r.promise(t)
- }, v.each("Boolean Number String Function Array Date RegExp Object".split(" "), function (e, t) {
- O["[object " + t + "]"] = t.toLowerCase()
- }), n = v(i);
- var M = {};
- v.Callbacks = function (e) {
- e = typeof e == "string" ? M[e] || _(e) : v.extend({}, e);
- var n, r, i, s, o, u, a = [], f = !e.once && [], l = function (t) {
- n = e.memory && t, r = !0, u = s || 0, s = 0, o = a.length, i = !0;
- for (; a && u < o; u++)if (a[u].apply(t[0], t[1]) === !1 && e.stopOnFalse) {
- n = !1;
- break
- }
- i = !1, a && (f ? f.length && l(f.shift()) : n ? a = [] : c.disable())
- }, c = {
- add: function () {
- if (a) {
- var t = a.length;
- (function r(t) {
- v.each(t, function (t, n) {
- var i = v.type(n);
- i === "function" ? (!e.unique || !c.has(n)) && a.push(n) : n && n.length && i !== "string" && r(n)
- })
- })(arguments), i ? o = a.length : n && (s = t, l(n))
- }
- return this
- }, remove: function () {
- return a && v.each(arguments, function (e, t) {
- var n;
- while ((n = v.inArray(t, a, n)) > -1)a.splice(n, 1), i && (n <= o && o--, n <= u && u--)
- }), this
- }, has: function (e) {
- return v.inArray(e, a) > -1
- }, empty: function () {
- return a = [], this
- }, disable: function () {
- return a = f = n = t, this
- }, disabled: function () {
- return !a
- }, lock: function () {
- return f = t, n || c.disable(), this
- }, locked: function () {
- return !f
- }, fireWith: function (e, t) {
- return t = t || [], t = [e, t.slice ? t.slice() : t], a && (!r || f) && (i ? f.push(t) : l(t)), this
- }, fire: function () {
- return c.fireWith(this, arguments), this
- }, fired: function () {
- return !!r
- }
- };
- return c
- }, v.extend({
- Deferred: function (e) {
- var t = [["resolve", "done", v.Callbacks("once memory"), "resolved"], ["reject", "fail", v.Callbacks("once memory"), "rejected"], ["notify", "progress", v.Callbacks("memory")]], n = "pending", r = {
- state: function () {
- return n
- }, always: function () {
- return i.done(arguments).fail(arguments), this
- }, then: function () {
- var e = arguments;
- return v.Deferred(function (n) {
- v.each(t, function (t, r) {
- var s = r[0], o = e[t];
- i[r[1]](v.isFunction(o) ? function () {
- var e = o.apply(this, arguments);
- e && v.isFunction(e.promise) ? e.promise().done(n.resolve).fail(n.reject).progress(n.notify) : n[s + "With"](this === i ? n : this, [e])
- } : n[s])
- }), e = null
- }).promise()
- }, promise: function (e) {
- return e != null ? v.extend(e, r) : r
- }
- }, i = {};
- return r.pipe = r.then, v.each(t, function (e, s) {
- var o = s[2], u = s[3];
- r[s[1]] = o.add, u && o.add(function () {
- n = u
- }, t[e ^ 1][2].disable, t[2][2].lock), i[s[0]] = o.fire, i[s[0] + "With"] = o.fireWith
- }), r.promise(i), e && e.call(i, i), i
- }, when: function (e) {
- var t = 0, n = l.call(arguments), r = n.length, i = r !== 1 || e && v.isFunction(e.promise) ? r : 0, s = i === 1 ? e : v.Deferred(), o = function (e, t, n) {
- return function (r) {
- t[e] = this, n[e] = arguments.length > 1 ? l.call(arguments) : r, n === u ? s.notifyWith(t, n) : --i || s.resolveWith(t, n)
- }
- }, u, a, f;
- if (r > 1) {
- u = new Array(r), a = new Array(r), f = new Array(r);
- for (; t < r; t++)n[t] && v.isFunction(n[t].promise) ? n[t].promise().done(o(t, f, n)).fail(s.reject).progress(o(t, a, u)) : --i
- }
- return i || s.resolveWith(f, n), s.promise()
- }
- }), v.support = function () {
- var t, n, r, s, o, u, a, f, l, c, h, p = i.createElement("div");
- p.setAttribute("className", "t"), p.innerHTML = " a ", n = p.getElementsByTagName("*"), r = p.getElementsByTagName("a")[0];
- if (!n || !r || !n.length)return {};
- s = i.createElement("select"), o = s.appendChild(i.createElement("option")), u = p.getElementsByTagName("input")[0], r.style.cssText = "top:1px;float:left;opacity:.5", t = {
- leadingWhitespace: p.firstChild.nodeType === 3,
- tbody: !p.getElementsByTagName("tbody").length,
- htmlSerialize: !!p.getElementsByTagName("link").length,
- style: /top/.test(r.getAttribute("style")),
- hrefNormalized: r.getAttribute("href") === "/a",
- opacity: /^0.5/.test(r.style.opacity),
- cssFloat: !!r.style.cssFloat,
- checkOn: u.value === "on",
- optSelected: o.selected,
- getSetAttribute: p.className !== "t",
- enctype: !!i.createElement("form").enctype,
- html5Clone: i.createElement("nav").cloneNode(!0).outerHTML !== "<:nav>",
- boxModel: i.compatMode === "CSS1Compat",
- submitBubbles: !0,
- changeBubbles: !0,
- focusinBubbles: !1,
- deleteExpando: !0,
- noCloneEvent: !0,
- inlineBlockNeedsLayout: !1,
- shrinkWrapBlocks: !1,
- reliableMarginRight: !0,
- boxSizingReliable: !0,
- pixelPosition: !1
- }, u.checked = !0, t.noCloneChecked = u.cloneNode(!0).checked, s.disabled = !0, t.optDisabled = !o.disabled;
- try {
- delete p.test
- } catch (d) {
- t.deleteExpando = !1
- }
- !p.addEventListener && p.attachEvent && p.fireEvent && (p.attachEvent("onclick", h = function () {
- t.noCloneEvent = !1
- }), p.cloneNode(!0).fireEvent("onclick"), p.detachEvent("onclick", h)), u = i.createElement("input"), u.value = "t", u.setAttribute("type", "radio"), t.radioValue = u.value === "t", u.setAttribute("checked", "checked"), u.setAttribute("name", "t"), p.appendChild(u), a = i.createDocumentFragment(), a.appendChild(p.lastChild), t.checkClone = a.cloneNode(!0).cloneNode(!0).lastChild.checked, t.appendChecked = u.checked, a.removeChild(u), a.appendChild(p);
- if (p.attachEvent)for (l in{submit: !0, change: !0, focusin: !0})f = "on" + l, c = f in p, c || (p.setAttribute(f, "return;"), c = typeof p[f] == "function"), t[l + "Bubbles"] = c;
- return v(function () {
- var n, r, s, o, u = "padding:0;margin:0;border:0;display:block;overflow:hidden;", a = i.getElementsByTagName("body")[0];
- if (!a)return;
- n = i.createElement("div"), n.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px", a.insertBefore(n, a.firstChild), r = i.createElement("div"), n.appendChild(r), r.innerHTML = "", s = r.getElementsByTagName("td"), s[0].style.cssText = "padding:0;margin:0;border:0;display:none", c = s[0].offsetHeight === 0, s[0].style.display = "", s[1].style.display = "none", t.reliableHiddenOffsets = c && s[0].offsetHeight === 0, r.innerHTML = "", r.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;", t.boxSizing = r.offsetWidth === 4, t.doesNotIncludeMarginInBodyOffset = a.offsetTop !== 1, e.getComputedStyle && (t.pixelPosition = (e.getComputedStyle(r, null) || {}).top !== "1%", t.boxSizingReliable = (e.getComputedStyle(r, null) || {width: "4px"}).width === "4px", o = i.createElement("div"), o.style.cssText = r.style.cssText = u, o.style.marginRight = o.style.width = "0", r.style.width = "1px", r.appendChild(o), t.reliableMarginRight = !parseFloat((e.getComputedStyle(o, null) || {}).marginRight)), typeof r.style.zoom != "undefined" && (r.innerHTML = "", r.style.cssText = u + "width:1px;padding:1px;display:inline;zoom:1", t.inlineBlockNeedsLayout = r.offsetWidth === 3, r.style.display = "block", r.style.overflow = "visible", r.innerHTML = "
", r.firstChild.style.width = "5px", t.shrinkWrapBlocks = r.offsetWidth !== 3, n.style.zoom = 1), a.removeChild(n), n = r = s = o = null
- }), a.removeChild(p), n = r = s = o = u = a = p = null, t
- }();
- var D = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, P = /([A-Z])/g;
- v.extend({
- cache: {}, deletedIds: [], uuid: 0, expando: "jQuery" + (v.fn.jquery + Math.random()).replace(/\D/g, ""), noData: {embed: !0, object: "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", applet: !0}, hasData: function (e) {
- return e = e.nodeType ? v.cache[e[v.expando]] : e[v.expando], !!e && !B(e)
- }, data: function (e, n, r, i) {
- if (!v.acceptData(e))return;
- var s, o, u = v.expando, a = typeof n == "string", f = e.nodeType, l = f ? v.cache : e, c = f ? e[u] : e[u] && u;
- if ((!c || !l[c] || !i && !l[c].data) && a && r === t)return;
- c || (f ? e[u] = c = v.deletedIds.pop() || v.guid++ : c = u), l[c] || (l[c] = {}, f || (l[c].toJSON = v.noop));
- if (typeof n == "object" || typeof n == "function")i ? l[c] = v.extend(l[c], n) : l[c].data = v.extend(l[c].data, n);
- return s = l[c], i || (s.data || (s.data = {}), s = s.data), r !== t && (s[v.camelCase(n)] = r), a ? (o = s[n], o == null && (o = s[v.camelCase(n)])) : o = s, o
- }, removeData: function (e, t, n) {
- if (!v.acceptData(e))return;
- var r, i, s, o = e.nodeType, u = o ? v.cache : e, a = o ? e[v.expando] : v.expando;
- if (!u[a])return;
- if (t) {
- r = n ? u[a] : u[a].data;
- if (r) {
- v.isArray(t) || (t in r ? t = [t] : (t = v.camelCase(t), t in r ? t = [t] : t = t.split(" ")));
- for (i = 0, s = t.length; i < s; i++)delete r[t[i]];
- if (!(n ? B : v.isEmptyObject)(r))return
- }
- }
- if (!n) {
- delete u[a].data;
- if (!B(u[a]))return
- }
- o ? v.cleanData([e], !0) : v.support.deleteExpando || u != u.window ? delete u[a] : u[a] = null
- }, _data: function (e, t, n) {
- return v.data(e, t, n, !0)
- }, acceptData: function (e) {
- var t = e.nodeName && v.noData[e.nodeName.toLowerCase()];
- return !t || t !== !0 && e.getAttribute("classid") === t
- }
- }), v.fn.extend({
- data: function (e, n) {
- var r, i, s, o, u, a = this[0], f = 0, l = null;
- if (e === t) {
- if (this.length) {
- l = v.data(a);
- if (a.nodeType === 1 && !v._data(a, "parsedAttrs")) {
- s = a.attributes;
- for (u = s.length; f < u; f++)o = s[f].name, o.indexOf("data-") || (o = v.camelCase(o.substring(5)), H(a, o, l[o]));
- v._data(a, "parsedAttrs", !0)
- }
- }
- return l
- }
- return typeof e == "object" ? this.each(function () {
- v.data(this, e)
- }) : (r = e.split(".", 2), r[1] = r[1] ? "." + r[1] : "", i = r[1] + "!", v.access(this, function (n) {
- if (n === t)return l = this.triggerHandler("getData" + i, [r[0]]), l === t && a && (l = v.data(a, e), l = H(a, e, l)), l === t && r[1] ? this.data(r[0]) : l;
- r[1] = n, this.each(function () {
- var t = v(this);
- t.triggerHandler("setData" + i, r), v.data(this, e, n), t.triggerHandler("changeData" + i, r)
- })
- }, null, n, arguments.length > 1, null, !1))
- }, removeData: function (e) {
- return this.each(function () {
- v.removeData(this, e)
- })
- }
- }), v.extend({
- queue: function (e, t, n) {
- var r;
- if (e)return t = (t || "fx") + "queue", r = v._data(e, t), n && (!r || v.isArray(n) ? r = v._data(e, t, v.makeArray(n)) : r.push(n)), r || []
- }, dequeue: function (e, t) {
- t = t || "fx";
- var n = v.queue(e, t), r = n.length, i = n.shift(), s = v._queueHooks(e, t), o = function () {
- v.dequeue(e, t)
- };
- i === "inprogress" && (i = n.shift(), r--), i && (t === "fx" && n.unshift("inprogress"), delete s.stop, i.call(e, o, s)), !r && s && s.empty.fire()
- }, _queueHooks: function (e, t) {
- var n = t + "queueHooks";
- return v._data(e, n) || v._data(e, n, {
- empty: v.Callbacks("once memory").add(function () {
- v.removeData(e, t + "queue", !0), v.removeData(e, n, !0)
- })
- })
- }
- }), v.fn.extend({
- queue: function (e, n) {
- var r = 2;
- return typeof e != "string" && (n = e, e = "fx", r--), arguments.length < r ? v.queue(this[0], e) : n === t ? this : this.each(function () {
- var t = v.queue(this, e, n);
- v._queueHooks(this, e), e === "fx" && t[0] !== "inprogress" && v.dequeue(this, e)
- })
- }, dequeue: function (e) {
- return this.each(function () {
- v.dequeue(this, e)
- })
- }, delay: function (e, t) {
- return e = v.fx ? v.fx.speeds[e] || e : e, t = t || "fx", this.queue(t, function (t, n) {
- var r = setTimeout(t, e);
- n.stop = function () {
- clearTimeout(r)
- }
- })
- }, clearQueue: function (e) {
- return this.queue(e || "fx", [])
- }, promise: function (e, n) {
- var r, i = 1, s = v.Deferred(), o = this, u = this.length, a = function () {
- --i || s.resolveWith(o, [o])
- };
- typeof e != "string" && (n = e, e = t), e = e || "fx";
- while (u--)r = v._data(o[u], e + "queueHooks"), r && r.empty && (i++, r.empty.add(a));
- return a(), s.promise(n)
- }
- });
- var j, F, I, q = /[\t\r\n]/g, R = /\r/g, U = /^(?:button|input)$/i, z = /^(?:button|input|object|select|textarea)$/i, W = /^a(?:rea|)$/i, X = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, V = v.support.getSetAttribute;
- v.fn.extend({
- attr: function (e, t) {
- return v.access(this, v.attr, e, t, arguments.length > 1)
- }, removeAttr: function (e) {
- return this.each(function () {
- v.removeAttr(this, e)
- })
- }, prop: function (e, t) {
- return v.access(this, v.prop, e, t, arguments.length > 1)
- }, removeProp: function (e) {
- return e = v.propFix[e] || e, this.each(function () {
- try {
- this[e] = t, delete this[e]
- } catch (n) {
- }
- })
- }, addClass: function (e) {
- var t, n, r, i, s, o, u;
- if (v.isFunction(e))return this.each(function (t) {
- v(this).addClass(e.call(this, t, this.className))
- });
- if (e && typeof e == "string") {
- t = e.split(y);
- for (n = 0, r = this.length; n < r; n++) {
- i = this[n];
- if (i.nodeType === 1)if (!i.className && t.length === 1)i.className = e; else {
- s = " " + i.className + " ";
- for (o = 0, u = t.length; o < u; o++)s.indexOf(" " + t[o] + " ") < 0 && (s += t[o] + " ");
- i.className = v.trim(s)
- }
- }
- }
- return this
- }, removeClass: function (e) {
- var n, r, i, s, o, u, a;
- if (v.isFunction(e))return this.each(function (t) {
- v(this).removeClass(e.call(this, t, this.className))
- });
- if (e && typeof e == "string" || e === t) {
- n = (e || "").split(y);
- for (u = 0, a = this.length; u < a; u++) {
- i = this[u];
- if (i.nodeType === 1 && i.className) {
- r = (" " + i.className + " ").replace(q, " ");
- for (s = 0, o = n.length; s < o; s++)while (r.indexOf(" " + n[s] + " ") >= 0)r = r.replace(" " + n[s] + " ", " ");
- i.className = e ? v.trim(r) : ""
- }
- }
- }
- return this
- }, toggleClass: function (e, t) {
- var n = typeof e, r = typeof t == "boolean";
- return v.isFunction(e) ? this.each(function (n) {
- v(this).toggleClass(e.call(this, n, this.className, t), t)
- }) : this.each(function () {
- if (n === "string") {
- var i, s = 0, o = v(this), u = t, a = e.split(y);
- while (i = a[s++])u = r ? u : !o.hasClass(i), o[u ? "addClass" : "removeClass"](i)
- } else if (n === "undefined" || n === "boolean")this.className && v._data(this, "__className__", this.className), this.className = this.className || e === !1 ? "" : v._data(this, "__className__") || ""
- })
- }, hasClass: function (e) {
- var t = " " + e + " ", n = 0, r = this.length;
- for (; n < r; n++)if (this[n].nodeType === 1 && (" " + this[n].className + " ").replace(q, " ").indexOf(t) >= 0)return !0;
- return !1
- }, val: function (e) {
- var n, r, i, s = this[0];
- if (!arguments.length) {
- if (s)return n = v.valHooks[s.type] || v.valHooks[s.nodeName.toLowerCase()], n && "get"in n && (r = n.get(s, "value")) !== t ? r : (r = s.value, typeof r == "string" ? r.replace(R, "") : r == null ? "" : r);
- return
- }
- return i = v.isFunction(e), this.each(function (r) {
- var s, o = v(this);
- if (this.nodeType !== 1)return;
- i ? s = e.call(this, r, o.val()) : s = e, s == null ? s = "" : typeof s == "number" ? s += "" : v.isArray(s) && (s = v.map(s, function (e) {
- return e == null ? "" : e + ""
- })), n = v.valHooks[this.type] || v.valHooks[this.nodeName.toLowerCase()];
- if (!n || !("set"in n) || n.set(this, s, "value") === t)this.value = s
- })
- }
- }), v.extend({
- valHooks: {
- option: {
- get: function (e) {
- var t = e.attributes.value;
- return !t || t.specified ? e.value : e.text
- }
- }, select: {
- get: function (e) {
- var t, n, r = e.options, i = e.selectedIndex, s = e.type === "select-one" || i < 0, o = s ? null : [], u = s ? i + 1 : r.length, a = i < 0 ? u : s ? i : 0;
- for (; a < u; a++) {
- n = r[a];
- if ((n.selected || a === i) && (v.support.optDisabled ? !n.disabled : n.getAttribute("disabled") === null) && (!n.parentNode.disabled || !v.nodeName(n.parentNode, "optgroup"))) {
- t = v(n).val();
- if (s)return t;
- o.push(t)
- }
- }
- return o
- }, set: function (e, t) {
- var n = v.makeArray(t);
- return v(e).find("option").each(function () {
- this.selected = v.inArray(v(this).val(), n) >= 0
- }), n.length || (e.selectedIndex = -1), n
- }
- }
- }, attrFn: {}, attr: function (e, n, r, i) {
- var s, o, u, a = e.nodeType;
- if (!e || a === 3 || a === 8 || a === 2)return;
- if (i && v.isFunction(v.fn[n]))return v(e)[n](r);
- if (typeof e.getAttribute == "undefined")return v.prop(e, n, r);
- u = a !== 1 || !v.isXMLDoc(e), u && (n = n.toLowerCase(), o = v.attrHooks[n] || (X.test(n) ? F : j));
- if (r !== t) {
- if (r === null) {
- v.removeAttr(e, n);
- return
- }
- return o && "set"in o && u && (s = o.set(e, r, n)) !== t ? s : (e.setAttribute(n, r + ""), r)
- }
- return o && "get"in o && u && (s = o.get(e, n)) !== null ? s : (s = e.getAttribute(n), s === null ? t : s)
- }, removeAttr: function (e, t) {
- var n, r, i, s, o = 0;
- if (t && e.nodeType === 1) {
- r = t.split(y);
- for (; o < r.length; o++)i = r[o], i && (n = v.propFix[i] || i, s = X.test(i), s || v.attr(e, i, ""), e.removeAttribute(V ? i : n), s && n in e && (e[n] = !1))
- }
- }, attrHooks: {
- type: {
- set: function (e, t) {
- if (U.test(e.nodeName) && e.parentNode)v.error("type property can't be changed"); else if (!v.support.radioValue && t === "radio" && v.nodeName(e, "input")) {
- var n = e.value;
- return e.setAttribute("type", t), n && (e.value = n), t
- }
- }
- }, value: {
- get: function (e, t) {
- return j && v.nodeName(e, "button") ? j.get(e, t) : t in e ? e.value : null
- }, set: function (e, t, n) {
- if (j && v.nodeName(e, "button"))return j.set(e, t, n);
- e.value = t
- }
- }
- }, propFix: {tabindex: "tabIndex", readonly: "readOnly", "for": "htmlFor", "class": "className", maxlength: "maxLength", cellspacing: "cellSpacing", cellpadding: "cellPadding", rowspan: "rowSpan", colspan: "colSpan", usemap: "useMap", frameborder: "frameBorder", contenteditable: "contentEditable"}, prop: function (e, n, r) {
- var i, s, o, u = e.nodeType;
- if (!e || u === 3 || u === 8 || u === 2)return;
- return o = u !== 1 || !v.isXMLDoc(e), o && (n = v.propFix[n] || n, s = v.propHooks[n]), r !== t ? s && "set"in s && (i = s.set(e, r, n)) !== t ? i : e[n] = r : s && "get"in s && (i = s.get(e, n)) !== null ? i : e[n]
- }, propHooks: {
- tabIndex: {
- get: function (e) {
- var n = e.getAttributeNode("tabindex");
- return n && n.specified ? parseInt(n.value, 10) : z.test(e.nodeName) || W.test(e.nodeName) && e.href ? 0 : t
- }
- }
- }
- }), F = {
- get: function (e, n) {
- var r, i = v.prop(e, n);
- return i === !0 || typeof i != "boolean" && (r = e.getAttributeNode(n)) && r.nodeValue !== !1 ? n.toLowerCase() : t
- }, set: function (e, t, n) {
- var r;
- return t === !1 ? v.removeAttr(e, n) : (r = v.propFix[n] || n, r in e && (e[r] = !0), e.setAttribute(n, n.toLowerCase())), n
- }
- }, V || (I = {name: !0, id: !0, coords: !0}, j = v.valHooks.button = {
- get: function (e, n) {
- var r;
- return r = e.getAttributeNode(n), r && (I[n] ? r.value !== "" : r.specified) ? r.value : t
- }, set: function (e, t, n) {
- var r = e.getAttributeNode(n);
- return r || (r = i.createAttribute(n), e.setAttributeNode(r)), r.value = t + ""
- }
- }, v.each(["width", "height"], function (e, t) {
- v.attrHooks[t] = v.extend(v.attrHooks[t], {
- set: function (e, n) {
- if (n === "")return e.setAttribute(t, "auto"), n
- }
- })
- }), v.attrHooks.contenteditable = {
- get: j.get, set: function (e, t, n) {
- t === "" && (t = "false"), j.set(e, t, n)
- }
- }), v.support.hrefNormalized || v.each(["href", "src", "width", "height"], function (e, n) {
- v.attrHooks[n] = v.extend(v.attrHooks[n], {
- get: function (e) {
- var r = e.getAttribute(n, 2);
- return r === null ? t : r
- }
- })
- }), v.support.style || (v.attrHooks.style = {
- get: function (e) {
- return e.style.cssText.toLowerCase() || t
- }, set: function (e, t) {
- return e.style.cssText = t + ""
- }
- }), v.support.optSelected || (v.propHooks.selected = v.extend(v.propHooks.selected, {
- get: function (e) {
- var t = e.parentNode;
- return t && (t.selectedIndex, t.parentNode && t.parentNode.selectedIndex), null
- }
- })), v.support.enctype || (v.propFix.enctype = "encoding"), v.support.checkOn || v.each(["radio", "checkbox"], function () {
- v.valHooks[this] = {
- get: function (e) {
- return e.getAttribute("value") === null ? "on" : e.value
- }
- }
- }), v.each(["radio", "checkbox"], function () {
- v.valHooks[this] = v.extend(v.valHooks[this], {
- set: function (e, t) {
- if (v.isArray(t))return e.checked = v.inArray(v(e).val(), t) >= 0
- }
- })
- });
- var $ = /^(?:textarea|input|select)$/i, J = /^([^\.]*|)(?:\.(.+)|)$/, K = /(?:^|\s)hover(\.\S+|)\b/, Q = /^key/, G = /^(?:mouse|contextmenu)|click/, Y = /^(?:focusinfocus|focusoutblur)$/, Z = function (e) {
- return v.event.special.hover ? e : e.replace(K, "mouseenter$1 mouseleave$1")
- };
- v.event = {
- add: function (e, n, r, i, s) {
- var o, u, a, f, l, c, h, p, d, m, g;
- if (e.nodeType === 3 || e.nodeType === 8 || !n || !r || !(o = v._data(e)))return;
- r.handler && (d = r, r = d.handler, s = d.selector), r.guid || (r.guid = v.guid++), a = o.events, a || (o.events = a = {}), u = o.handle, u || (o.handle = u = function (e) {
- return typeof v == "undefined" || !!e && v.event.triggered === e.type ? t : v.event.dispatch.apply(u.elem, arguments)
- }, u.elem = e), n = v.trim(Z(n)).split(" ");
- for (f = 0; f < n.length; f++) {
- l = J.exec(n[f]) || [], c = l[1], h = (l[2] || "").split(".").sort(), g = v.event.special[c] || {}, c = (s ? g.delegateType : g.bindType) || c, g = v.event.special[c] || {}, p = v.extend({type: c, origType: l[1], data: i, handler: r, guid: r.guid, selector: s, needsContext: s && v.expr.match.needsContext.test(s), namespace: h.join(".")}, d), m = a[c];
- if (!m) {
- m = a[c] = [], m.delegateCount = 0;
- if (!g.setup || g.setup.call(e, i, h, u) === !1)e.addEventListener ? e.addEventListener(c, u, !1) : e.attachEvent && e.attachEvent("on" + c, u)
- }
- g.add && (g.add.call(e, p), p.handler.guid || (p.handler.guid = r.guid)), s ? m.splice(m.delegateCount++, 0, p) : m.push(p), v.event.global[c] = !0
- }
- e = null
- }, global: {}, remove: function (e, t, n, r, i) {
- var s, o, u, a, f, l, c, h, p, d, m, g = v.hasData(e) && v._data(e);
- if (!g || !(h = g.events))return;
- t = v.trim(Z(t || "")).split(" ");
- for (s = 0; s < t.length; s++) {
- o = J.exec(t[s]) || [], u = a = o[1], f = o[2];
- if (!u) {
- for (u in h)v.event.remove(e, u + t[s], n, r, !0);
- continue
- }
- p = v.event.special[u] || {}, u = (r ? p.delegateType : p.bindType) || u, d = h[u] || [], l = d.length, f = f ? new RegExp("(^|\\.)" + f.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
- for (c = 0; c < d.length; c++)m = d[c], (i || a === m.origType) && (!n || n.guid === m.guid) && (!f || f.test(m.namespace)) && (!r || r === m.selector || r === "**" && m.selector) && (d.splice(c--, 1), m.selector && d.delegateCount--, p.remove && p.remove.call(e, m));
- d.length === 0 && l !== d.length && ((!p.teardown || p.teardown.call(e, f, g.handle) === !1) && v.removeEvent(e, u, g.handle), delete h[u])
- }
- v.isEmptyObject(h) && (delete g.handle, v.removeData(e, "events", !0))
- }, customEvent: {getData: !0, setData: !0, changeData: !0}, trigger: function (n, r, s, o) {
- if (!s || s.nodeType !== 3 && s.nodeType !== 8) {
- var u, a, f, l, c, h, p, d, m, g, y = n.type || n, b = [];
- if (Y.test(y + v.event.triggered))return;
- y.indexOf("!") >= 0 && (y = y.slice(0, -1), a = !0), y.indexOf(".") >= 0 && (b = y.split("."), y = b.shift(), b.sort());
- if ((!s || v.event.customEvent[y]) && !v.event.global[y])return;
- n = typeof n == "object" ? n[v.expando] ? n : new v.Event(y, n) : new v.Event(y), n.type = y, n.isTrigger = !0, n.exclusive = a, n.namespace = b.join("."), n.namespace_re = n.namespace ? new RegExp("(^|\\.)" + b.join("\\.(?:.*\\.|)") + "(\\.|$)") : null, h = y.indexOf(":") < 0 ? "on" + y : "";
- if (!s) {
- u = v.cache;
- for (f in u)u[f].events && u[f].events[y] && v.event.trigger(n, r, u[f].handle.elem, !0);
- return
- }
- n.result = t, n.target || (n.target = s), r = r != null ? v.makeArray(r) : [], r.unshift(n), p = v.event.special[y] || {};
- if (p.trigger && p.trigger.apply(s, r) === !1)return;
- m = [[s, p.bindType || y]];
- if (!o && !p.noBubble && !v.isWindow(s)) {
- g = p.delegateType || y, l = Y.test(g + y) ? s : s.parentNode;
- for (c = s; l; l = l.parentNode)m.push([l, g]), c = l;
- c === (s.ownerDocument || i) && m.push([c.defaultView || c.parentWindow || e, g])
- }
- for (f = 0; f < m.length && !n.isPropagationStopped(); f++)l = m[f][0], n.type = m[f][1], d = (v._data(l, "events") || {})[n.type] && v._data(l, "handle"), d && d.apply(l, r), d = h && l[h], d && v.acceptData(l) && d.apply && d.apply(l, r) === !1 && n.preventDefault();
- return n.type = y, !o && !n.isDefaultPrevented() && (!p._default || p._default.apply(s.ownerDocument, r) === !1) && (y !== "click" || !v.nodeName(s, "a")) && v.acceptData(s) && h && s[y] && (y !== "focus" && y !== "blur" || n.target.offsetWidth !== 0) && !v.isWindow(s) && (c = s[h], c && (s[h] = null), v.event.triggered = y, s[y](), v.event.triggered = t, c && (s[h] = c)), n.result
- }
- return
- }, dispatch: function (n) {
- n = v.event.fix(n || e.event);
- var r, i, s, o, u, a, f, c, h, p, d = (v._data(this, "events") || {})[n.type] || [], m = d.delegateCount, g = l.call(arguments), y = !n.exclusive && !n.namespace, b = v.event.special[n.type] || {}, w = [];
- g[0] = n, n.delegateTarget = this;
- if (b.preDispatch && b.preDispatch.call(this, n) === !1)return;
- if (m && (!n.button || n.type !== "click"))for (s = n.target; s != this; s = s.parentNode || this)if (s.disabled !== !0 || n.type !== "click") {
- u = {}, f = [];
- for (r = 0; r < m; r++)c = d[r], h = c.selector, u[h] === t && (u[h] = c.needsContext ? v(h, this).index(s) >= 0 : v.find(h, this, null, [s]).length), u[h] && f.push(c);
- f.length && w.push({elem: s, matches: f})
- }
- d.length > m && w.push({elem: this, matches: d.slice(m)});
- for (r = 0; r < w.length && !n.isPropagationStopped(); r++) {
- a = w[r], n.currentTarget = a.elem;
- for (i = 0; i < a.matches.length && !n.isImmediatePropagationStopped(); i++) {
- c = a.matches[i];
- if (y || !n.namespace && !c.namespace || n.namespace_re && n.namespace_re.test(c.namespace))n.data = c.data, n.handleObj = c, o = ((v.event.special[c.origType] || {}).handle || c.handler).apply(a.elem, g), o !== t && (n.result = o, o === !1 && (n.preventDefault(), n.stopPropagation()))
- }
- }
- return b.postDispatch && b.postDispatch.call(this, n), n.result
- }, props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), fixHooks: {}, keyHooks: {
- props: "char charCode key keyCode".split(" "), filter: function (e, t) {
- return e.which == null && (e.which = t.charCode != null ? t.charCode : t.keyCode), e
- }
- }, mouseHooks: {
- props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), filter: function (e, n) {
- var r, s, o, u = n.button, a = n.fromElement;
- return e.pageX == null && n.clientX != null && (r = e.target.ownerDocument || i, s = r.documentElement, o = r.body, e.pageX = n.clientX + (s && s.scrollLeft || o && o.scrollLeft || 0) - (s && s.clientLeft || o && o.clientLeft || 0), e.pageY = n.clientY + (s && s.scrollTop || o && o.scrollTop || 0) - (s && s.clientTop || o && o.clientTop || 0)), !e.relatedTarget && a && (e.relatedTarget = a === e.target ? n.toElement : a), !e.which && u !== t && (e.which = u & 1 ? 1 : u & 2 ? 3 : u & 4 ? 2 : 0), e
- }
- }, fix: function (e) {
- if (e[v.expando])return e;
- var t, n, r = e, s = v.event.fixHooks[e.type] || {}, o = s.props ? this.props.concat(s.props) : this.props;
- e = v.Event(r);
- for (t = o.length; t;)n = o[--t], e[n] = r[n];
- return e.target || (e.target = r.srcElement || i), e.target.nodeType === 3 && (e.target = e.target.parentNode), e.metaKey = !!e.metaKey, s.filter ? s.filter(e, r) : e
- }, special: {
- load: {noBubble: !0}, focus: {delegateType: "focusin"}, blur: {delegateType: "focusout"}, beforeunload: {
- setup: function (e, t, n) {
- v.isWindow(this) && (this.onbeforeunload = n)
- }, teardown: function (e, t) {
- this.onbeforeunload === t && (this.onbeforeunload = null)
- }
- }
- }, simulate: function (e, t, n, r) {
- var i = v.extend(new v.Event, n, {type: e, isSimulated: !0, originalEvent: {}});
- r ? v.event.trigger(i, null, t) : v.event.dispatch.call(t, i), i.isDefaultPrevented() && n.preventDefault()
- }
- }, v.event.handle = v.event.dispatch, v.removeEvent = i.removeEventListener ? function (e, t, n) {
- e.removeEventListener && e.removeEventListener(t, n, !1)
- } : function (e, t, n) {
- var r = "on" + t;
- e.detachEvent && (typeof e[r] == "undefined" && (e[r] = null), e.detachEvent(r, n))
- }, v.Event = function (e, t) {
- if (!(this instanceof v.Event))return new v.Event(e, t);
- e && e.type ? (this.originalEvent = e, this.type = e.type, this.isDefaultPrevented = e.defaultPrevented || e.returnValue === !1 || e.getPreventDefault && e.getPreventDefault() ? tt : et) : this.type = e, t && v.extend(this, t), this.timeStamp = e && e.timeStamp || v.now(), this[v.expando] = !0
- }, v.Event.prototype = {
- preventDefault: function () {
- this.isDefaultPrevented = tt;
- var e = this.originalEvent;
- if (!e)return;
- e.preventDefault ? e.preventDefault() : e.returnValue = !1
- }, stopPropagation: function () {
- this.isPropagationStopped = tt;
- var e = this.originalEvent;
- if (!e)return;
- e.stopPropagation && e.stopPropagation(), e.cancelBubble = !0
- }, stopImmediatePropagation: function () {
- this.isImmediatePropagationStopped = tt, this.stopPropagation()
- }, isDefaultPrevented: et, isPropagationStopped: et, isImmediatePropagationStopped: et
- }, v.each({mouseenter: "mouseover", mouseleave: "mouseout"}, function (e, t) {
- v.event.special[e] = {
- delegateType: t, bindType: t, handle: function (e) {
- var n, r = this, i = e.relatedTarget, s = e.handleObj, o = s.selector;
- if (!i || i !== r && !v.contains(r, i))e.type = s.origType, n = s.handler.apply(this, arguments), e.type = t;
- return n
- }
- }
- }), v.support.submitBubbles || (v.event.special.submit = {
- setup: function () {
- if (v.nodeName(this, "form"))return !1;
- v.event.add(this, "click._submit keypress._submit", function (e) {
- var n = e.target, r = v.nodeName(n, "input") || v.nodeName(n, "button") ? n.form : t;
- r && !v._data(r, "_submit_attached") && (v.event.add(r, "submit._submit", function (e) {
- e._submit_bubble = !0
- }), v._data(r, "_submit_attached", !0))
- })
- }, postDispatch: function (e) {
- e._submit_bubble && (delete e._submit_bubble, this.parentNode && !e.isTrigger && v.event.simulate("submit", this.parentNode, e, !0))
- }, teardown: function () {
- if (v.nodeName(this, "form"))return !1;
- v.event.remove(this, "._submit")
- }
- }), v.support.changeBubbles || (v.event.special.change = {
- setup: function () {
- if ($.test(this.nodeName)) {
- if (this.type === "checkbox" || this.type === "radio")v.event.add(this, "propertychange._change", function (e) {
- e.originalEvent.propertyName === "checked" && (this._just_changed = !0)
- }), v.event.add(this, "click._change", function (e) {
- this._just_changed && !e.isTrigger && (this._just_changed = !1), v.event.simulate("change", this, e, !0)
- });
- return !1
- }
- v.event.add(this, "beforeactivate._change", function (e) {
- var t = e.target;
- $.test(t.nodeName) && !v._data(t, "_change_attached") && (v.event.add(t, "change._change", function (e) {
- this.parentNode && !e.isSimulated && !e.isTrigger && v.event.simulate("change", this.parentNode, e, !0)
- }), v._data(t, "_change_attached", !0))
- })
- }, handle: function (e) {
- var t = e.target;
- if (this !== t || e.isSimulated || e.isTrigger || t.type !== "radio" && t.type !== "checkbox")return e.handleObj.handler.apply(this, arguments)
- }, teardown: function () {
- return v.event.remove(this, "._change"), !$.test(this.nodeName)
- }
- }), v.support.focusinBubbles || v.each({focus: "focusin", blur: "focusout"}, function (e, t) {
- var n = 0, r = function (e) {
- v.event.simulate(t, e.target, v.event.fix(e), !0)
- };
- v.event.special[t] = {
- setup: function () {
- n++ === 0 && i.addEventListener(e, r, !0)
- }, teardown: function () {
- --n === 0 && i.removeEventListener(e, r, !0)
- }
- }
- }), v.fn.extend({
- on: function (e, n, r, i, s) {
- var o, u;
- if (typeof e == "object") {
- typeof n != "string" && (r = r || n, n = t);
- for (u in e)this.on(u, n, r, e[u], s);
- return this
- }
- r == null && i == null ? (i = n, r = n = t) : i == null && (typeof n == "string" ? (i = r, r = t) : (i = r, r = n, n = t));
- if (i === !1)i = et; else if (!i)return this;
- return s === 1 && (o = i, i = function (e) {
- return v().off(e), o.apply(this, arguments)
- }, i.guid = o.guid || (o.guid = v.guid++)), this.each(function () {
- v.event.add(this, e, i, r, n)
- })
- }, one: function (e, t, n, r) {
- return this.on(e, t, n, r, 1)
- }, off: function (e, n, r) {
- var i, s;
- if (e && e.preventDefault && e.handleObj)return i = e.handleObj, v(e.delegateTarget).off(i.namespace ? i.origType + "." + i.namespace : i.origType, i.selector, i.handler), this;
- if (typeof e == "object") {
- for (s in e)this.off(s, n, e[s]);
- return this
- }
- if (n === !1 || typeof n == "function")r = n, n = t;
- return r === !1 && (r = et), this.each(function () {
- v.event.remove(this, e, r, n)
- })
- }, bind: function (e, t, n) {
- return this.on(e, null, t, n)
- }, unbind: function (e, t) {
- return this.off(e, null, t)
- }, live: function (e, t, n) {
- return v(this.context).on(e, this.selector, t, n), this
- }, die: function (e, t) {
- return v(this.context).off(e, this.selector || "**", t), this
- }, delegate: function (e, t, n, r) {
- return this.on(t, e, n, r)
- }, undelegate: function (e, t, n) {
- return arguments.length === 1 ? this.off(e, "**") : this.off(t, e || "**", n)
- }, trigger: function (e, t) {
- return this.each(function () {
- v.event.trigger(e, t, this)
- })
- }, triggerHandler: function (e, t) {
- if (this[0])return v.event.trigger(e, t, this[0], !0)
- }, toggle: function (e) {
- var t = arguments, n = e.guid || v.guid++, r = 0, i = function (n) {
- var i = (v._data(this, "lastToggle" + e.guid) || 0) % r;
- return v._data(this, "lastToggle" + e.guid, i + 1), n.preventDefault(), t[i].apply(this, arguments) || !1
- };
- i.guid = n;
- while (r < t.length)t[r++].guid = n;
- return this.click(i)
- }, hover: function (e, t) {
- return this.mouseenter(e).mouseleave(t || e)
- }
- }), v.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "), function (e, t) {
- v.fn[t] = function (e, n) {
- return n == null && (n = e, e = null), arguments.length > 0 ? this.on(t, null, e, n) : this.trigger(t)
- }, Q.test(t) && (v.event.fixHooks[t] = v.event.keyHooks), G.test(t) && (v.event.fixHooks[t] = v.event.mouseHooks)
- }), function (e, t) {
- function nt(e, t, n, r) {
- n = n || [], t = t || g;
- var i, s, a, f, l = t.nodeType;
- if (!e || typeof e != "string")return n;
- if (l !== 1 && l !== 9)return [];
- a = o(t);
- if (!a && !r)if (i = R.exec(e))if (f = i[1]) {
- if (l === 9) {
- s = t.getElementById(f);
- if (!s || !s.parentNode)return n;
- if (s.id === f)return n.push(s), n
- } else if (t.ownerDocument && (s = t.ownerDocument.getElementById(f)) && u(t, s) && s.id === f)return n.push(s), n
- } else {
- if (i[2])return S.apply(n, x.call(t.getElementsByTagName(e), 0)), n;
- if ((f = i[3]) && Z && t.getElementsByClassName)return S.apply(n, x.call(t.getElementsByClassName(f), 0)), n
- }
- return vt(e.replace(j, "$1"), t, n, r, a)
- }
-
- function rt(e) {
- return function (t) {
- var n = t.nodeName.toLowerCase();
- return n === "input" && t.type === e
- }
- }
-
- function it(e) {
- return function (t) {
- var n = t.nodeName.toLowerCase();
- return (n === "input" || n === "button") && t.type === e
- }
- }
-
- function st(e) {
- return N(function (t) {
- return t = +t, N(function (n, r) {
- var i, s = e([], n.length, t), o = s.length;
- while (o--)n[i = s[o]] && (n[i] = !(r[i] = n[i]))
- })
- })
- }
-
- function ot(e, t, n) {
- if (e === t)return n;
- var r = e.nextSibling;
- while (r) {
- if (r === t)return -1;
- r = r.nextSibling
- }
- return 1
- }
-
- function ut(e, t) {
- var n, r, s, o, u, a, f, l = L[d][e + " "];
- if (l)return t ? 0 : l.slice(0);
- u = e, a = [], f = i.preFilter;
- while (u) {
- if (!n || (r = F.exec(u)))r && (u = u.slice(r[0].length) || u), a.push(s = []);
- n = !1;
- if (r = I.exec(u))s.push(n = new m(r.shift())), u = u.slice(n.length), n.type = r[0].replace(j, " ");
- for (o in i.filter)(r = J[o].exec(u)) && (!f[o] || (r = f[o](r))) && (s.push(n = new m(r.shift())), u = u.slice(n.length), n.type = o, n.matches = r);
- if (!n)break
- }
- return t ? u.length : u ? nt.error(e) : L(e, a).slice(0)
- }
-
- function at(e, t, r) {
- var i = t.dir, s = r && t.dir === "parentNode", o = w++;
- return t.first ? function (t, n, r) {
- while (t = t[i])if (s || t.nodeType === 1)return e(t, n, r)
- } : function (t, r, u) {
- if (!u) {
- var a, f = b + " " + o + " ", l = f + n;
- while (t = t[i])if (s || t.nodeType === 1) {
- if ((a = t[d]) === l)return t.sizset;
- if (typeof a == "string" && a.indexOf(f) === 0) {
- if (t.sizset)return t
- } else {
- t[d] = l;
- if (e(t, r, u))return t.sizset = !0, t;
- t.sizset = !1
- }
- }
- } else while (t = t[i])if (s || t.nodeType === 1)if (e(t, r, u))return t
- }
- }
-
- function ft(e) {
- return e.length > 1 ? function (t, n, r) {
- var i = e.length;
- while (i--)if (!e[i](t, n, r))return !1;
- return !0
- } : e[0]
- }
-
- function lt(e, t, n, r, i) {
- var s, o = [], u = 0, a = e.length, f = t != null;
- for (; u < a; u++)if (s = e[u])if (!n || n(s, r, i))o.push(s), f && t.push(u);
- return o
- }
-
- function ct(e, t, n, r, i, s) {
- return r && !r[d] && (r = ct(r)), i && !i[d] && (i = ct(i, s)), N(function (s, o, u, a) {
- var f, l, c, h = [], p = [], d = o.length, v = s || dt(t || "*", u.nodeType ? [u] : u, []), m = e && (s || !t) ? lt(v, h, e, u, a) : v, g = n ? i || (s ? e : d || r) ? [] : o : m;
- n && n(m, g, u, a);
- if (r) {
- f = lt(g, p), r(f, [], u, a), l = f.length;
- while (l--)if (c = f[l])g[p[l]] = !(m[p[l]] = c)
- }
- if (s) {
- if (i || e) {
- if (i) {
- f = [], l = g.length;
- while (l--)(c = g[l]) && f.push(m[l] = c);
- i(null, g = [], f, a)
- }
- l = g.length;
- while (l--)(c = g[l]) && (f = i ? T.call(s, c) : h[l]) > -1 && (s[f] = !(o[f] = c))
- }
- } else g = lt(g === o ? g.splice(d, g.length) : g), i ? i(null, o, g, a) : S.apply(o, g)
- })
- }
-
- function ht(e) {
- var t, n, r, s = e.length, o = i.relative[e[0].type], u = o || i.relative[" "], a = o ? 1 : 0, f = at(function (e) {
- return e === t
- }, u, !0), l = at(function (e) {
- return T.call(t, e) > -1
- }, u, !0), h = [function (e, n, r) {
- return !o && (r || n !== c) || ((t = n).nodeType ? f(e, n, r) : l(e, n, r))
- }];
- for (; a < s; a++)if (n = i.relative[e[a].type])h = [at(ft(h), n)]; else {
- n = i.filter[e[a].type].apply(null, e[a].matches);
- if (n[d]) {
- r = ++a;
- for (; r < s; r++)if (i.relative[e[r].type])break;
- return ct(a > 1 && ft(h), a > 1 && e.slice(0, a - 1).join("").replace(j, "$1"), n, a < r && ht(e.slice(a, r)), r < s && ht(e = e.slice(r)), r < s && e.join(""))
- }
- h.push(n)
- }
- return ft(h)
- }
-
- function pt(e, t) {
- var r = t.length > 0, s = e.length > 0, o = function (u, a, f, l, h) {
- var p, d, v, m = [], y = 0, w = "0", x = u && [], T = h != null, N = c, C = u || s && i.find.TAG("*", h && a.parentNode || a), k = b += N == null ? 1 : Math.E;
- T && (c = a !== g && a, n = o.el);
- for (; (p = C[w]) != null; w++) {
- if (s && p) {
- for (d = 0; v = e[d]; d++)if (v(p, a, f)) {
- l.push(p);
- break
- }
- T && (b = k, n = ++o.el)
- }
- r && ((p = !v && p) && y--, u && x.push(p))
- }
- y += w;
- if (r && w !== y) {
- for (d = 0; v = t[d]; d++)v(x, m, a, f);
- if (u) {
- if (y > 0)while (w--)!x[w] && !m[w] && (m[w] = E.call(l));
- m = lt(m)
- }
- S.apply(l, m), T && !u && m.length > 0 && y + t.length > 1 && nt.uniqueSort(l)
- }
- return T && (b = k, c = N), x
- };
- return o.el = 0, r ? N(o) : o
- }
-
- function dt(e, t, n) {
- var r = 0, i = t.length;
- for (; r < i; r++)nt(e, t[r], n);
- return n
- }
-
- function vt(e, t, n, r, s) {
- var o, u, f, l, c, h = ut(e), p = h.length;
- if (!r && h.length === 1) {
- u = h[0] = h[0].slice(0);
- if (u.length > 2 && (f = u[0]).type === "ID" && t.nodeType === 9 && !s && i.relative[u[1].type]) {
- t = i.find.ID(f.matches[0].replace($, ""), t, s)[0];
- if (!t)return n;
- e = e.slice(u.shift().length)
- }
- for (o = J.POS.test(e) ? -1 : u.length - 1; o >= 0; o--) {
- f = u[o];
- if (i.relative[l = f.type])break;
- if (c = i.find[l])if (r = c(f.matches[0].replace($, ""), z.test(u[0].type) && t.parentNode || t, s)) {
- u.splice(o, 1), e = r.length && u.join("");
- if (!e)return S.apply(n, x.call(r, 0)), n;
- break
- }
- }
- }
- return a(e, h)(r, t, s, n, z.test(e)), n
- }
-
- function mt() {
- }
-
- var n, r, i, s, o, u, a, f, l, c, h = !0, p = "undefined", d = ("sizcache" + Math.random()).replace(".", ""), m = String, g = e.document, y = g.documentElement, b = 0, w = 0, E = [].pop, S = [].push, x = [].slice, T = [].indexOf || function (e) {
- var t = 0, n = this.length;
- for (; t < n; t++)if (this[t] === e)return t;
- return -1
- }, N = function (e, t) {
- return e[d] = t == null || t, e
- }, C = function () {
- var e = {}, t = [];
- return N(function (n, r) {
- return t.push(n) > i.cacheLength && delete e[t.shift()], e[n + " "] = r
- }, e)
- }, k = C(), L = C(), A = C(), O = "[\\x20\\t\\r\\n\\f]", M = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+", _ = M.replace("w", "w#"), D = "([*^$|!~]?=)", P = "\\[" + O + "*(" + M + ")" + O + "*(?:" + D + O + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + _ + ")|)|)" + O + "*\\]", H = ":(" + M + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + P + ")|[^:]|\\\\.)*|.*))\\)|)", B = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + O + "*((?:-\\d)?\\d*)" + O + "*\\)|)(?=[^-]|$)", j = new RegExp("^" + O + "+|((?:^|[^\\\\])(?:\\\\.)*)" + O + "+$", "g"), F = new RegExp("^" + O + "*," + O + "*"), I = new RegExp("^" + O + "*([\\x20\\t\\r\\n\\f>+~])" + O + "*"), q = new RegExp(H), R = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/, U = /^:not/, z = /[\x20\t\r\n\f]*[+~]/, W = /:not\($/, X = /h\d/i, V = /input|select|textarea|button/i, $ = /\\(?!\\)/g, J = {
- ID: new RegExp("^#(" + M + ")"),
- CLASS: new RegExp("^\\.(" + M + ")"),
- NAME: new RegExp("^\\[name=['\"]?(" + M + ")['\"]?\\]"),
- TAG: new RegExp("^(" + M.replace("w", "w*") + ")"),
- ATTR: new RegExp("^" + P),
- PSEUDO: new RegExp("^" + H),
- POS: new RegExp(B, "i"),
- CHILD: new RegExp("^:(only|nth|first|last)-child(?:\\(" + O + "*(even|odd|(([+-]|)(\\d*)n|)" + O + "*(?:([+-]|)" + O + "*(\\d+)|))" + O + "*\\)|)", "i"),
- needsContext: new RegExp("^" + O + "*[>+~]|" + B, "i")
- }, K = function (e) {
- var t = g.createElement("div");
- try {
- return e(t)
- } catch (n) {
- return !1
- } finally {
- t = null
- }
- }, Q = K(function (e) {
- return e.appendChild(g.createComment("")), !e.getElementsByTagName("*").length
- }), G = K(function (e) {
- return e.innerHTML = " ", e.firstChild && typeof e.firstChild.getAttribute !== p && e.firstChild.getAttribute("href") === "#"
- }), Y = K(function (e) {
- e.innerHTML = " ";
- var t = typeof e.lastChild.getAttribute("multiple");
- return t !== "boolean" && t !== "string"
- }), Z = K(function (e) {
- return e.innerHTML = "
", !e.getElementsByClassName || !e.getElementsByClassName("e").length ? !1 : (e.lastChild.className = "e", e.getElementsByClassName("e").length === 2)
- }), et = K(function (e) {
- e.id = d + 0, e.innerHTML = "
", y.insertBefore(e, y.firstChild);
- var t = g.getElementsByName && g.getElementsByName(d).length === 2 + g.getElementsByName(d + 0).length;
- return r = !g.getElementById(d), y.removeChild(e), t
- });
- try {
- x.call(y.childNodes, 0)[0].nodeType
- } catch (tt) {
- x = function (e) {
- var t, n = [];
- for (; t = this[e]; e++)n.push(t);
- return n
- }
- }
- nt.matches = function (e, t) {
- return nt(e, null, null, t)
- }, nt.matchesSelector = function (e, t) {
- return nt(t, null, null, [e]).length > 0
- }, s = nt.getText = function (e) {
- var t, n = "", r = 0, i = e.nodeType;
- if (i) {
- if (i === 1 || i === 9 || i === 11) {
- if (typeof e.textContent == "string")return e.textContent;
- for (e = e.firstChild; e; e = e.nextSibling)n += s(e)
- } else if (i === 3 || i === 4)return e.nodeValue
- } else for (; t = e[r]; r++)n += s(t);
- return n
- }, o = nt.isXML = function (e) {
- var t = e && (e.ownerDocument || e).documentElement;
- return t ? t.nodeName !== "HTML" : !1
- }, u = nt.contains = y.contains ? function (e, t) {
- var n = e.nodeType === 9 ? e.documentElement : e, r = t && t.parentNode;
- return e === r || !!(r && r.nodeType === 1 && n.contains && n.contains(r))
- } : y.compareDocumentPosition ? function (e, t) {
- return t && !!(e.compareDocumentPosition(t) & 16)
- } : function (e, t) {
- while (t = t.parentNode)if (t === e)return !0;
- return !1
- }, nt.attr = function (e, t) {
- var n, r = o(e);
- return r || (t = t.toLowerCase()), (n = i.attrHandle[t]) ? n(e) : r || Y ? e.getAttribute(t) : (n = e.getAttributeNode(t), n ? typeof e[t] == "boolean" ? e[t] ? t : null : n.specified ? n.value : null : null)
- }, i = nt.selectors = {
- cacheLength: 50, createPseudo: N, match: J, attrHandle: G ? {} : {
- href: function (e) {
- return e.getAttribute("href", 2)
- }, type: function (e) {
- return e.getAttribute("type")
- }
- }, find: {
- ID: r ? function (e, t, n) {
- if (typeof t.getElementById !== p && !n) {
- var r = t.getElementById(e);
- return r && r.parentNode ? [r] : []
- }
- } : function (e, n, r) {
- if (typeof n.getElementById !== p && !r) {
- var i = n.getElementById(e);
- return i ? i.id === e || typeof i.getAttributeNode !== p && i.getAttributeNode("id").value === e ? [i] : t : []
- }
- }, TAG: Q ? function (e, t) {
- if (typeof t.getElementsByTagName !== p)return t.getElementsByTagName(e)
- } : function (e, t) {
- var n = t.getElementsByTagName(e);
- if (e === "*") {
- var r, i = [], s = 0;
- for (; r = n[s]; s++)r.nodeType === 1 && i.push(r);
- return i
- }
- return n
- }, NAME: et && function (e, t) {
- if (typeof t.getElementsByName !== p)return t.getElementsByName(name)
- }, CLASS: Z && function (e, t, n) {
- if (typeof t.getElementsByClassName !== p && !n)return t.getElementsByClassName(e)
- }
- }, relative: {">": {dir: "parentNode", first: !0}, " ": {dir: "parentNode"}, "+": {dir: "previousSibling", first: !0}, "~": {dir: "previousSibling"}}, preFilter: {
- ATTR: function (e) {
- return e[1] = e[1].replace($, ""), e[3] = (e[4] || e[5] || "").replace($, ""), e[2] === "~=" && (e[3] = " " + e[3] + " "), e.slice(0, 4)
- }, CHILD: function (e) {
- return e[1] = e[1].toLowerCase(), e[1] === "nth" ? (e[2] || nt.error(e[0]), e[3] = +(e[3] ? e[4] + (e[5] || 1) : 2 * (e[2] === "even" || e[2] === "odd")), e[4] = +(e[6] + e[7] || e[2] === "odd")) : e[2] && nt.error(e[0]), e
- }, PSEUDO: function (e) {
- var t, n;
- if (J.CHILD.test(e[0]))return null;
- if (e[3])e[2] = e[3]; else if (t = e[4])q.test(t) && (n = ut(t, !0)) && (n = t.indexOf(")", t.length - n) - t.length) && (t = t.slice(0, n), e[0] = e[0].slice(0, n)), e[2] = t;
- return e.slice(0, 3)
- }
- }, filter: {
- ID: r ? function (e) {
- return e = e.replace($, ""), function (t) {
- return t.getAttribute("id") === e
- }
- } : function (e) {
- return e = e.replace($, ""), function (t) {
- var n = typeof t.getAttributeNode !== p && t.getAttributeNode("id");
- return n && n.value === e
- }
- }, TAG: function (e) {
- return e === "*" ? function () {
- return !0
- } : (e = e.replace($, "").toLowerCase(), function (t) {
- return t.nodeName && t.nodeName.toLowerCase() === e
- })
- }, CLASS: function (e) {
- var t = k[d][e + " "];
- return t || (t = new RegExp("(^|" + O + ")" + e + "(" + O + "|$)")) && k(e, function (e) {
- return t.test(e.className || typeof e.getAttribute !== p && e.getAttribute("class") || "")
- })
- }, ATTR: function (e, t, n) {
- return function (r, i) {
- var s = nt.attr(r, e);
- return s == null ? t === "!=" : t ? (s += "", t === "=" ? s === n : t === "!=" ? s !== n : t === "^=" ? n && s.indexOf(n) === 0 : t === "*=" ? n && s.indexOf(n) > -1 : t === "$=" ? n && s.substr(s.length - n.length) === n : t === "~=" ? (" " + s + " ").indexOf(n) > -1 : t === "|=" ? s === n || s.substr(0, n.length + 1) === n + "-" : !1) : !0
- }
- }, CHILD: function (e, t, n, r) {
- return e === "nth" ? function (e) {
- var t, i, s = e.parentNode;
- if (n === 1 && r === 0)return !0;
- if (s) {
- i = 0;
- for (t = s.firstChild; t; t = t.nextSibling)if (t.nodeType === 1) {
- i++;
- if (e === t)break
- }
- }
- return i -= r, i === n || i % n === 0 && i / n >= 0
- } : function (t) {
- var n = t;
- switch (e) {
- case"only":
- case"first":
- while (n = n.previousSibling)if (n.nodeType === 1)return !1;
- if (e === "first")return !0;
- n = t;
- case"last":
- while (n = n.nextSibling)if (n.nodeType === 1)return !1;
- return !0
- }
- }
- }, PSEUDO: function (e, t) {
- var n, r = i.pseudos[e] || i.setFilters[e.toLowerCase()] || nt.error("unsupported pseudo: " + e);
- return r[d] ? r(t) : r.length > 1 ? (n = [e, e, "", t], i.setFilters.hasOwnProperty(e.toLowerCase()) ? N(function (e, n) {
- var i, s = r(e, t), o = s.length;
- while (o--)i = T.call(e, s[o]), e[i] = !(n[i] = s[o])
- }) : function (e) {
- return r(e, 0, n)
- }) : r
- }
- }, pseudos: {
- not: N(function (e) {
- var t = [], n = [], r = a(e.replace(j, "$1"));
- return r[d] ? N(function (e, t, n, i) {
- var s, o = r(e, null, i, []), u = e.length;
- while (u--)if (s = o[u])e[u] = !(t[u] = s)
- }) : function (e, i, s) {
- return t[0] = e, r(t, null, s, n), !n.pop()
- }
- }), has: N(function (e) {
- return function (t) {
- return nt(e, t).length > 0
- }
- }), contains: N(function (e) {
- return function (t) {
- return (t.textContent || t.innerText || s(t)).indexOf(e) > -1
- }
- }), enabled: function (e) {
- return e.disabled === !1
- }, disabled: function (e) {
- return e.disabled === !0
- }, checked: function (e) {
- var t = e.nodeName.toLowerCase();
- return t === "input" && !!e.checked || t === "option" && !!e.selected
- }, selected: function (e) {
- return e.parentNode && e.parentNode.selectedIndex, e.selected === !0
- }, parent: function (e) {
- return !i.pseudos.empty(e)
- }, empty: function (e) {
- var t;
- e = e.firstChild;
- while (e) {
- if (e.nodeName > "@" || (t = e.nodeType) === 3 || t === 4)return !1;
- e = e.nextSibling
- }
- return !0
- }, header: function (e) {
- return X.test(e.nodeName)
- }, text: function (e) {
- var t, n;
- return e.nodeName.toLowerCase() === "input" && (t = e.type) === "text" && ((n = e.getAttribute("type")) == null || n.toLowerCase() === t)
- }, radio: rt("radio"), checkbox: rt("checkbox"), file: rt("file"), password: rt("password"), image: rt("image"), submit: it("submit"), reset: it("reset"), button: function (e) {
- var t = e.nodeName.toLowerCase();
- return t === "input" && e.type === "button" || t === "button"
- }, input: function (e) {
- return V.test(e.nodeName)
- }, focus: function (e) {
- var t = e.ownerDocument;
- return e === t.activeElement && (!t.hasFocus || t.hasFocus()) && !!(e.type || e.href || ~e.tabIndex)
- }, active: function (e) {
- return e === e.ownerDocument.activeElement
- }, first: st(function () {
- return [0]
- }), last: st(function (e, t) {
- return [t - 1]
- }), eq: st(function (e, t, n) {
- return [n < 0 ? n + t : n]
- }), even: st(function (e, t) {
- for (var n = 0; n < t; n += 2)e.push(n);
- return e
- }), odd: st(function (e, t) {
- for (var n = 1; n < t; n += 2)e.push(n);
- return e
- }), lt: st(function (e, t, n) {
- for (var r = n < 0 ? n + t : n; --r >= 0;)e.push(r);
- return e
- }), gt: st(function (e, t, n) {
- for (var r = n < 0 ? n + t : n; ++r < t;)e.push(r);
- return e
- })
- }
- }, f = y.compareDocumentPosition ? function (e, t) {
- return e === t ? (l = !0, 0) : (!e.compareDocumentPosition || !t.compareDocumentPosition ? e.compareDocumentPosition : e.compareDocumentPosition(t) & 4) ? -1 : 1
- } : function (e, t) {
- if (e === t)return l = !0, 0;
- if (e.sourceIndex && t.sourceIndex)return e.sourceIndex - t.sourceIndex;
- var n, r, i = [], s = [], o = e.parentNode, u = t.parentNode, a = o;
- if (o === u)return ot(e, t);
- if (!o)return -1;
- if (!u)return 1;
- while (a)i.unshift(a), a = a.parentNode;
- a = u;
- while (a)s.unshift(a), a = a.parentNode;
- n = i.length, r = s.length;
- for (var f = 0; f < n && f < r; f++)if (i[f] !== s[f])return ot(i[f], s[f]);
- return f === n ? ot(e, s[f], -1) : ot(i[f], t, 1)
- }, [0, 0].sort(f), h = !l, nt.uniqueSort = function (e) {
- var t, n = [], r = 1, i = 0;
- l = h, e.sort(f);
- if (l) {
- for (; t = e[r]; r++)t === e[r - 1] && (i = n.push(r));
- while (i--)e.splice(n[i], 1)
- }
- return e
- }, nt.error = function (e) {
- throw new Error("Syntax error, unrecognized expression: " + e)
- }, a = nt.compile = function (e, t) {
- var n, r = [], i = [], s = A[d][e + " "];
- if (!s) {
- t || (t = ut(e)), n = t.length;
- while (n--)s = ht(t[n]), s[d] ? r.push(s) : i.push(s);
- s = A(e, pt(i, r))
- }
- return s
- }, g.querySelectorAll && function () {
- var e, t = vt, n = /'|\\/g, r = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, i = [":focus"], s = [":active"], u = y.matchesSelector || y.mozMatchesSelector || y.webkitMatchesSelector || y.oMatchesSelector || y.msMatchesSelector;
- K(function (e) {
- e.innerHTML = " ", e.querySelectorAll("[selected]").length || i.push("\\[" + O + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)"), e.querySelectorAll(":checked").length || i.push(":checked")
- }), K(function (e) {
- e.innerHTML = "
", e.querySelectorAll("[test^='']").length && i.push("[*^$]=" + O + "*(?:\"\"|'')"), e.innerHTML = " ", e.querySelectorAll(":enabled").length || i.push(":enabled", ":disabled")
- }), i = new RegExp(i.join("|")), vt = function (e, r, s, o, u) {
- if (!o && !u && !i.test(e)) {
- var a, f, l = !0, c = d, h = r, p = r.nodeType === 9 && e;
- if (r.nodeType === 1 && r.nodeName.toLowerCase() !== "object") {
- a = ut(e), (l = r.getAttribute("id")) ? c = l.replace(n, "\\$&") : r.setAttribute("id", c), c = "[id='" + c + "'] ", f = a.length;
- while (f--)a[f] = c + a[f].join("");
- h = z.test(e) && r.parentNode || r, p = a.join(",")
- }
- if (p)try {
- return S.apply(s, x.call(h.querySelectorAll(p), 0)), s
- } catch (v) {
- } finally {
- l || r.removeAttribute("id")
- }
- }
- return t(e, r, s, o, u)
- }, u && (K(function (t) {
- e = u.call(t, "div");
- try {
- u.call(t, "[test!='']:sizzle"), s.push("!=", H)
- } catch (n) {
- }
- }), s = new RegExp(s.join("|")), nt.matchesSelector = function (t, n) {
- n = n.replace(r, "='$1']");
- if (!o(t) && !s.test(n) && !i.test(n))try {
- var a = u.call(t, n);
- if (a || e || t.document && t.document.nodeType !== 11)return a
- } catch (f) {
- }
- return nt(n, null, null, [t]).length > 0
- })
- }(), i.pseudos.nth = i.pseudos.eq, i.filters = mt.prototype = i.pseudos, i.setFilters = new mt, nt.attr = v.attr, v.find = nt, v.expr = nt.selectors, v.expr[":"] = v.expr.pseudos, v.unique = nt.uniqueSort, v.text = nt.getText, v.isXMLDoc = nt.isXML, v.contains = nt.contains
- }(e);
- var nt = /Until$/, rt = /^(?:parents|prev(?:Until|All))/, it = /^.[^:#\[\.,]*$/, st = v.expr.match.needsContext, ot = {children: !0, contents: !0, next: !0, prev: !0};
- v.fn.extend({
- find: function (e) {
- var t, n, r, i, s, o, u = this;
- if (typeof e != "string")return v(e).filter(function () {
- for (t = 0, n = u.length; t < n; t++)if (v.contains(u[t], this))return !0
- });
- o = this.pushStack("", "find", e);
- for (t = 0, n = this.length; t < n; t++) {
- r = o.length, v.find(e, this[t], o);
- if (t > 0)for (i = r; i < o.length; i++)for (s = 0; s < r; s++)if (o[s] === o[i]) {
- o.splice(i--, 1);
- break
- }
- }
- return o
- }, has: function (e) {
- var t, n = v(e, this), r = n.length;
- return this.filter(function () {
- for (t = 0; t < r; t++)if (v.contains(this, n[t]))return !0
- })
- }, not: function (e) {
- return this.pushStack(ft(this, e, !1), "not", e)
- }, filter: function (e) {
- return this.pushStack(ft(this, e, !0), "filter", e)
- }, is: function (e) {
- return !!e && (typeof e == "string" ? st.test(e) ? v(e, this.context).index(this[0]) >= 0 : v.filter(e, this).length > 0 : this.filter(e).length > 0)
- }, closest: function (e, t) {
- var n, r = 0, i = this.length, s = [], o = st.test(e) || typeof e != "string" ? v(e, t || this.context) : 0;
- for (; r < i; r++) {
- n = this[r];
- while (n && n.ownerDocument && n !== t && n.nodeType !== 11) {
- if (o ? o.index(n) > -1 : v.find.matchesSelector(n, e)) {
- s.push(n);
- break
- }
- n = n.parentNode
- }
- }
- return s = s.length > 1 ? v.unique(s) : s, this.pushStack(s, "closest", e)
- }, index: function (e) {
- return e ? typeof e == "string" ? v.inArray(this[0], v(e)) : v.inArray(e.jquery ? e[0] : e, this) : this[0] && this[0].parentNode ? this.prevAll().length : -1
- }, add: function (e, t) {
- var n = typeof e == "string" ? v(e, t) : v.makeArray(e && e.nodeType ? [e] : e), r = v.merge(this.get(), n);
- return this.pushStack(ut(n[0]) || ut(r[0]) ? r : v.unique(r))
- }, addBack: function (e) {
- return this.add(e == null ? this.prevObject : this.prevObject.filter(e))
- }
- }), v.fn.andSelf = v.fn.addBack, v.each({
- parent: function (e) {
- var t = e.parentNode;
- return t && t.nodeType !== 11 ? t : null
- }, parents: function (e) {
- return v.dir(e, "parentNode")
- }, parentsUntil: function (e, t, n) {
- return v.dir(e, "parentNode", n)
- }, next: function (e) {
- return at(e, "nextSibling")
- }, prev: function (e) {
- return at(e, "previousSibling")
- }, nextAll: function (e) {
- return v.dir(e, "nextSibling")
- }, prevAll: function (e) {
- return v.dir(e, "previousSibling")
- }, nextUntil: function (e, t, n) {
- return v.dir(e, "nextSibling", n)
- }, prevUntil: function (e, t, n) {
- return v.dir(e, "previousSibling", n)
- }, siblings: function (e) {
- return v.sibling((e.parentNode || {}).firstChild, e)
- }, children: function (e) {
- return v.sibling(e.firstChild)
- }, contents: function (e) {
- return v.nodeName(e, "iframe") ? e.contentDocument || e.contentWindow.document : v.merge([], e.childNodes)
- }
- }, function (e, t) {
- v.fn[e] = function (n, r) {
- var i = v.map(this, t, n);
- return nt.test(e) || (r = n), r && typeof r == "string" && (i = v.filter(r, i)), i = this.length > 1 && !ot[e] ? v.unique(i) : i, this.length > 1 && rt.test(e) && (i = i.reverse()), this.pushStack(i, e, l.call(arguments).join(","))
- }
- }), v.extend({
- filter: function (e, t, n) {
- return n && (e = ":not(" + e + ")"), t.length === 1 ? v.find.matchesSelector(t[0], e) ? [t[0]] : [] : v.find.matches(e, t)
- }, dir: function (e, n, r) {
- var i = [], s = e[n];
- while (s && s.nodeType !== 9 && (r === t || s.nodeType !== 1 || !v(s).is(r)))s.nodeType === 1 && i.push(s), s = s[n];
- return i
- }, sibling: function (e, t) {
- var n = [];
- for (; e; e = e.nextSibling)e.nodeType === 1 && e !== t && n.push(e);
- return n
- }
- });
- var ct = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", ht = / jQuery\d+="(?:null|\d+)"/g, pt = /^\s+/, dt = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, vt = /<([\w:]+)/, mt = / ]", "i"), Et = /^(?:checkbox|radio)$/, St = /checked\s*(?:[^=]|=\s*.checked.)/i, xt = /\/(java|ecma)script/i, Tt = /^\s*\s*$/g, Nt = {
- option: [1, "", " "],
- legend: [1, "", " "],
- thead: [1, ""],
- tr: [2, ""],
- td: [3, ""],
- col: [2, ""],
- area: [1, "", " "],
- _default: [0, "", ""]
- }, Ct = lt(i), kt = Ct.appendChild(i.createElement("div"));
- Nt.optgroup = Nt.option, Nt.tbody = Nt.tfoot = Nt.colgroup = Nt.caption = Nt.thead, Nt.th = Nt.td, v.support.htmlSerialize || (Nt._default = [1, "X", "
"]), v.fn.extend({
- text: function (e) {
- return v.access(this, function (e) {
- return e === t ? v.text(this) : this.empty().append((this[0] && this[0].ownerDocument || i).createTextNode(e))
- }, null, e, arguments.length)
- }, wrapAll: function (e) {
- if (v.isFunction(e))return this.each(function (t) {
- v(this).wrapAll(e.call(this, t))
- });
- if (this[0]) {
- var t = v(e, this[0].ownerDocument).eq(0).clone(!0);
- this[0].parentNode && t.insertBefore(this[0]), t.map(function () {
- var e = this;
- while (e.firstChild && e.firstChild.nodeType === 1)e = e.firstChild;
- return e
- }).append(this)
- }
- return this
- }, wrapInner: function (e) {
- return v.isFunction(e) ? this.each(function (t) {
- v(this).wrapInner(e.call(this, t))
- }) : this.each(function () {
- var t = v(this), n = t.contents();
- n.length ? n.wrapAll(e) : t.append(e)
- })
- }, wrap: function (e) {
- var t = v.isFunction(e);
- return this.each(function (n) {
- v(this).wrapAll(t ? e.call(this, n) : e)
- })
- }, unwrap: function () {
- return this.parent().each(function () {
- v.nodeName(this, "body") || v(this).replaceWith(this.childNodes)
- }).end()
- }, append: function () {
- return this.domManip(arguments, !0, function (e) {
- (this.nodeType === 1 || this.nodeType === 11) && this.appendChild(e)
- })
- }, prepend: function () {
- return this.domManip(arguments, !0, function (e) {
- (this.nodeType === 1 || this.nodeType === 11) && this.insertBefore(e, this.firstChild)
- })
- }, before: function () {
- if (!ut(this[0]))return this.domManip(arguments, !1, function (e) {
- this.parentNode.insertBefore(e, this)
- });
- if (arguments.length) {
- var e = v.clean(arguments);
- return this.pushStack(v.merge(e, this), "before", this.selector)
- }
- }, after: function () {
- if (!ut(this[0]))return this.domManip(arguments, !1, function (e) {
- this.parentNode.insertBefore(e, this.nextSibling)
- });
- if (arguments.length) {
- var e = v.clean(arguments);
- return this.pushStack(v.merge(this, e), "after", this.selector)
- }
- }, remove: function (e, t) {
- var n, r = 0;
- for (; (n = this[r]) != null; r++)if (!e || v.filter(e, [n]).length)!t && n.nodeType === 1 && (v.cleanData(n.getElementsByTagName("*")), v.cleanData([n])), n.parentNode && n.parentNode.removeChild(n);
- return this
- }, empty: function () {
- var e, t = 0;
- for (; (e = this[t]) != null; t++) {
- e.nodeType === 1 && v.cleanData(e.getElementsByTagName("*"));
- while (e.firstChild)e.removeChild(e.firstChild)
- }
- return this
- }, clone: function (e, t) {
- return e = e == null ? !1 : e, t = t == null ? e : t, this.map(function () {
- return v.clone(this, e, t)
- })
- }, html: function (e) {
- return v.access(this, function (e) {
- var n = this[0] || {}, r = 0, i = this.length;
- if (e === t)return n.nodeType === 1 ? n.innerHTML.replace(ht, "") : t;
- if (typeof e == "string" && !yt.test(e) && (v.support.htmlSerialize || !wt.test(e)) && (v.support.leadingWhitespace || !pt.test(e)) && !Nt[(vt.exec(e) || ["", ""])[1].toLowerCase()]) {
- e = e.replace(dt, "<$1>$2>");
- try {
- for (; r < i; r++)n = this[r] || {}, n.nodeType === 1 && (v.cleanData(n.getElementsByTagName("*")), n.innerHTML = e);
- n = 0
- } catch (s) {
- }
- }
- n && this.empty().append(e)
- }, null, e, arguments.length)
- }, replaceWith: function (e) {
- return ut(this[0]) ? this.length ? this.pushStack(v(v.isFunction(e) ? e() : e), "replaceWith", e) : this : v.isFunction(e) ? this.each(function (t) {
- var n = v(this), r = n.html();
- n.replaceWith(e.call(this, t, r))
- }) : (typeof e != "string" && (e = v(e).detach()), this.each(function () {
- var t = this.nextSibling, n = this.parentNode;
- v(this).remove(), t ? v(t).before(e) : v(n).append(e)
- }))
- }, detach: function (e) {
- return this.remove(e, !0)
- }, domManip: function (e, n, r) {
- e = [].concat.apply([], e);
- var i, s, o, u, a = 0, f = e[0], l = [], c = this.length;
- if (!v.support.checkClone && c > 1 && typeof f == "string" && St.test(f))return this.each(function () {
- v(this).domManip(e, n, r)
- });
- if (v.isFunction(f))return this.each(function (i) {
- var s = v(this);
- e[0] = f.call(this, i, n ? s.html() : t), s.domManip(e, n, r)
- });
- if (this[0]) {
- i = v.buildFragment(e, this, l), o = i.fragment, s = o.firstChild, o.childNodes.length === 1 && (o = s);
- if (s) {
- n = n && v.nodeName(s, "tr");
- for (u = i.cacheable || c - 1; a < c; a++)r.call(n && v.nodeName(this[a], "table") ? Lt(this[a], "tbody") : this[a], a === u ? o : v.clone(o, !0, !0))
- }
- o = s = null, l.length && v.each(l, function (e, t) {
- t.src ? v.ajax ? v.ajax({url: t.src, type: "GET", dataType: "script", async: !1, global: !1, "throws": !0}) : v.error("no ajax") : v.globalEval((t.text || t.textContent || t.innerHTML || "").replace(Tt, "")), t.parentNode && t.parentNode.removeChild(t)
- })
- }
- return this
- }
- }), v.buildFragment = function (e, n, r) {
- var s, o, u, a = e[0];
- return n = n || i, n = !n.nodeType && n[0] || n, n = n.ownerDocument || n, e.length === 1 && typeof a == "string" && a.length < 512 && n === i && a.charAt(0) === "<" && !bt.test(a) && (v.support.checkClone || !St.test(a)) && (v.support.html5Clone || !wt.test(a)) && (o = !0, s = v.fragments[a], u = s !== t), s || (s = n.createDocumentFragment(), v.clean(e, n, s, r), o && (v.fragments[a] = u && s)), {fragment: s, cacheable: o}
- }, v.fragments = {}, v.each({appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith"}, function (e, t) {
- v.fn[e] = function (n) {
- var r, i = 0, s = [], o = v(n), u = o.length, a = this.length === 1 && this[0].parentNode;
- if ((a == null || a && a.nodeType === 11 && a.childNodes.length === 1) && u === 1)return o[t](this[0]), this;
- for (; i < u; i++)r = (i > 0 ? this.clone(!0) : this).get(), v(o[i])[t](r), s = s.concat(r);
- return this.pushStack(s, e, o.selector)
- }
- }), v.extend({
- clone: function (e, t, n) {
- var r, i, s, o;
- v.support.html5Clone || v.isXMLDoc(e) || !wt.test("<" + e.nodeName + ">") ? o = e.cloneNode(!0) : (kt.innerHTML = e.outerHTML, kt.removeChild(o = kt.firstChild));
- if ((!v.support.noCloneEvent || !v.support.noCloneChecked) && (e.nodeType === 1 || e.nodeType === 11) && !v.isXMLDoc(e)) {
- Ot(e, o), r = Mt(e), i = Mt(o);
- for (s = 0; r[s]; ++s)i[s] && Ot(r[s], i[s])
- }
- if (t) {
- At(e, o);
- if (n) {
- r = Mt(e), i = Mt(o);
- for (s = 0; r[s]; ++s)At(r[s], i[s])
- }
- }
- return r = i = null, o
- }, clean: function (e, t, n, r) {
- var s, o, u, a, f, l, c, h, p, d, m, g, y = t === i && Ct, b = [];
- if (!t || typeof t.createDocumentFragment == "undefined")t = i;
- for (s = 0; (u = e[s]) != null; s++) {
- typeof u == "number" && (u += "");
- if (!u)continue;
- if (typeof u == "string")if (!gt.test(u))u = t.createTextNode(u); else {
- y = y || lt(t), c = t.createElement("div"), y.appendChild(c), u = u.replace(dt, "<$1>$2>"), a = (vt.exec(u) || ["", ""])[1].toLowerCase(), f = Nt[a] || Nt._default, l = f[0], c.innerHTML = f[1] + u + f[2];
- while (l--)c = c.lastChild;
- if (!v.support.tbody) {
- h = mt.test(u), p = a === "table" && !h ? c.firstChild && c.firstChild.childNodes : f[1] === "" && !h ? c.childNodes : [];
- for (o = p.length - 1; o >= 0; --o)v.nodeName(p[o], "tbody") && !p[o].childNodes.length && p[o].parentNode.removeChild(p[o])
- }
- !v.support.leadingWhitespace && pt.test(u) && c.insertBefore(t.createTextNode(pt.exec(u)[0]), c.firstChild), u = c.childNodes, c.parentNode.removeChild(c)
- }
- u.nodeType ? b.push(u) : v.merge(b, u)
- }
- c && (u = c = y = null);
- if (!v.support.appendChecked)for (s = 0; (u = b[s]) != null; s++)v.nodeName(u, "input") ? _t(u) : typeof u.getElementsByTagName != "undefined" && v.grep(u.getElementsByTagName("input"), _t);
- if (n) {
- m = function (e) {
- if (!e.type || xt.test(e.type))return r ? r.push(e.parentNode ? e.parentNode.removeChild(e) : e) : n.appendChild(e)
- };
- for (s = 0; (u = b[s]) != null; s++)if (!v.nodeName(u, "script") || !m(u))n.appendChild(u), typeof u.getElementsByTagName != "undefined" && (g = v.grep(v.merge([], u.getElementsByTagName("script")), m), b.splice.apply(b, [s + 1, 0].concat(g)), s += g.length)
- }
- return b
- }, cleanData: function (e, t) {
- var n, r, i, s, o = 0, u = v.expando, a = v.cache, f = v.support.deleteExpando, l = v.event.special;
- for (; (i = e[o]) != null; o++)if (t || v.acceptData(i)) {
- r = i[u], n = r && a[r];
- if (n) {
- if (n.events)for (s in n.events)l[s] ? v.event.remove(i, s) : v.removeEvent(i, s, n.handle);
- a[r] && (delete a[r], f ? delete i[u] : i.removeAttribute ? i.removeAttribute(u) : i[u] = null, v.deletedIds.push(r))
- }
- }
- }
- }), function () {
- var e, t;
- v.uaMatch = function (e) {
- e = e.toLowerCase();
- var t = /(chrome)[ \/]([\w.]+)/.exec(e) || /(webkit)[ \/]([\w.]+)/.exec(e) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e) || /(msie) ([\w.]+)/.exec(e) || e.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e) || [];
- return {browser: t[1] || "", version: t[2] || "0"}
- }, e = v.uaMatch(o.userAgent), t = {}, e.browser && (t[e.browser] = !0, t.version = e.version), t.chrome ? t.webkit = !0 : t.webkit && (t.safari = !0), v.browser = t, v.sub = function () {
- function e(t, n) {
- return new e.fn.init(t, n)
- }
-
- v.extend(!0, e, this), e.superclass = this, e.fn = e.prototype = this(), e.fn.constructor = e, e.sub = this.sub, e.fn.init = function (r, i) {
- return i && i instanceof v && !(i instanceof e) && (i = e(i)), v.fn.init.call(this, r, i, t)
- }, e.fn.init.prototype = e.fn;
- var t = e(i);
- return e
- }
- }();
- var Dt, Pt, Ht, Bt = /alpha\([^)]*\)/i, jt = /opacity=([^)]*)/, Ft = /^(top|right|bottom|left)$/, It = /^(none|table(?!-c[ea]).+)/, qt = /^margin/, Rt = new RegExp("^(" + m + ")(.*)$", "i"), Ut = new RegExp("^(" + m + ")(?!px)[a-z%]+$", "i"), zt = new RegExp("^([-+])=(" + m + ")", "i"), Wt = {BODY: "block"}, Xt = {position: "absolute", visibility: "hidden", display: "block"}, Vt = {
- letterSpacing: 0,
- fontWeight: 400
- }, $t = ["Top", "Right", "Bottom", "Left"], Jt = ["Webkit", "O", "Moz", "ms"], Kt = v.fn.toggle;
- v.fn.extend({
- css: function (e, n) {
- return v.access(this, function (e, n, r) {
- return r !== t ? v.style(e, n, r) : v.css(e, n)
- }, e, n, arguments.length > 1)
- }, show: function () {
- return Yt(this, !0)
- }, hide: function () {
- return Yt(this)
- }, toggle: function (e, t) {
- var n = typeof e == "boolean";
- return v.isFunction(e) && v.isFunction(t) ? Kt.apply(this, arguments) : this.each(function () {
- (n ? e : Gt(this)) ? v(this).show() : v(this).hide()
- })
- }
- }), v.extend({
- cssHooks: {
- opacity: {
- get: function (e, t) {
- if (t) {
- var n = Dt(e, "opacity");
- return n === "" ? "1" : n
- }
- }
- }
- }, cssNumber: {fillOpacity: !0, fontWeight: !0, lineHeight: !0, opacity: !0, orphans: !0, widows: !0, zIndex: !0, zoom: !0}, cssProps: {"float": v.support.cssFloat ? "cssFloat" : "styleFloat"}, style: function (e, n, r, i) {
- if (!e || e.nodeType === 3 || e.nodeType === 8 || !e.style)return;
- var s, o, u, a = v.camelCase(n), f = e.style;
- n = v.cssProps[a] || (v.cssProps[a] = Qt(f, a)), u = v.cssHooks[n] || v.cssHooks[a];
- if (r === t)return u && "get"in u && (s = u.get(e, !1, i)) !== t ? s : f[n];
- o = typeof r, o === "string" && (s = zt.exec(r)) && (r = (s[1] + 1) * s[2] + parseFloat(v.css(e, n)), o = "number");
- if (r == null || o === "number" && isNaN(r))return;
- o === "number" && !v.cssNumber[a] && (r += "px");
- if (!u || !("set"in u) || (r = u.set(e, r, i)) !== t)try {
- f[n] = r
- } catch (l) {
- }
- }, css: function (e, n, r, i) {
- var s, o, u, a = v.camelCase(n);
- return n = v.cssProps[a] || (v.cssProps[a] = Qt(e.style, a)), u = v.cssHooks[n] || v.cssHooks[a], u && "get"in u && (s = u.get(e, !0, i)), s === t && (s = Dt(e, n)), s === "normal" && n in Vt && (s = Vt[n]), r || i !== t ? (o = parseFloat(s), r || v.isNumeric(o) ? o || 0 : s) : s
- }, swap: function (e, t, n) {
- var r, i, s = {};
- for (i in t)s[i] = e.style[i], e.style[i] = t[i];
- r = n.call(e);
- for (i in t)e.style[i] = s[i];
- return r
- }
- }), e.getComputedStyle ? Dt = function (t, n) {
- var r, i, s, o, u = e.getComputedStyle(t, null), a = t.style;
- return u && (r = u.getPropertyValue(n) || u[n], r === "" && !v.contains(t.ownerDocument, t) && (r = v.style(t, n)), Ut.test(r) && qt.test(n) && (i = a.width, s = a.minWidth, o = a.maxWidth, a.minWidth = a.maxWidth = a.width = r, r = u.width, a.width = i, a.minWidth = s, a.maxWidth = o)), r
- } : i.documentElement.currentStyle && (Dt = function (e, t) {
- var n, r, i = e.currentStyle && e.currentStyle[t], s = e.style;
- return i == null && s && s[t] && (i = s[t]), Ut.test(i) && !Ft.test(t) && (n = s.left, r = e.runtimeStyle && e.runtimeStyle.left, r && (e.runtimeStyle.left = e.currentStyle.left), s.left = t === "fontSize" ? "1em" : i, i = s.pixelLeft + "px", s.left = n, r && (e.runtimeStyle.left = r)), i === "" ? "auto" : i
- }), v.each(["height", "width"], function (e, t) {
- v.cssHooks[t] = {
- get: function (e, n, r) {
- if (n)return e.offsetWidth === 0 && It.test(Dt(e, "display")) ? v.swap(e, Xt, function () {
- return tn(e, t, r)
- }) : tn(e, t, r)
- }, set: function (e, n, r) {
- return Zt(e, n, r ? en(e, t, r, v.support.boxSizing && v.css(e, "boxSizing") === "border-box") : 0)
- }
- }
- }), v.support.opacity || (v.cssHooks.opacity = {
- get: function (e, t) {
- return jt.test((t && e.currentStyle ? e.currentStyle.filter : e.style.filter) || "") ? .01 * parseFloat(RegExp.$1) + "" : t ? "1" : ""
- }, set: function (e, t) {
- var n = e.style, r = e.currentStyle, i = v.isNumeric(t) ? "alpha(opacity=" + t * 100 + ")" : "", s = r && r.filter || n.filter || "";
- n.zoom = 1;
- if (t >= 1 && v.trim(s.replace(Bt, "")) === "" && n.removeAttribute) {
- n.removeAttribute("filter");
- if (r && !r.filter)return
- }
- n.filter = Bt.test(s) ? s.replace(Bt, i) : s + " " + i
- }
- }), v(function () {
- v.support.reliableMarginRight || (v.cssHooks.marginRight = {
- get: function (e, t) {
- return v.swap(e, {display: "inline-block"}, function () {
- if (t)return Dt(e, "marginRight")
- })
- }
- }), !v.support.pixelPosition && v.fn.position && v.each(["top", "left"], function (e, t) {
- v.cssHooks[t] = {
- get: function (e, n) {
- if (n) {
- var r = Dt(e, t);
- return Ut.test(r) ? v(e).position()[t] + "px" : r
- }
- }
- }
- })
- }), v.expr && v.expr.filters && (v.expr.filters.hidden = function (e) {
- return e.offsetWidth === 0 && e.offsetHeight === 0 || !v.support.reliableHiddenOffsets && (e.style && e.style.display || Dt(e, "display")) === "none"
- }, v.expr.filters.visible = function (e) {
- return !v.expr.filters.hidden(e)
- }), v.each({margin: "", padding: "", border: "Width"}, function (e, t) {
- v.cssHooks[e + t] = {
- expand: function (n) {
- var r, i = typeof n == "string" ? n.split(" ") : [n], s = {};
- for (r = 0; r < 4; r++)s[e + $t[r] + t] = i[r] || i[r - 2] || i[0];
- return s
- }
- }, qt.test(e) || (v.cssHooks[e + t].set = Zt)
- });
- var rn = /%20/g, sn = /\[\]$/, on = /\r?\n/g, un = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, an = /^(?:select|textarea)/i;
- v.fn.extend({
- serialize: function () {
- return v.param(this.serializeArray())
- }, serializeArray: function () {
- return this.map(function () {
- return this.elements ? v.makeArray(this.elements) : this
- }).filter(function () {
- return this.name && !this.disabled && (this.checked || an.test(this.nodeName) || un.test(this.type))
- }).map(function (e, t) {
- var n = v(this).val();
- return n == null ? null : v.isArray(n) ? v.map(n, function (e, n) {
- return {name: t.name, value: e.replace(on, "\r\n")}
- }) : {name: t.name, value: n.replace(on, "\r\n")}
- }).get()
- }
- }), v.param = function (e, n) {
- var r, i = [], s = function (e, t) {
- t = v.isFunction(t) ? t() : t == null ? "" : t, i[i.length] = encodeURIComponent(e) + "=" + encodeURIComponent(t)
- };
- n === t && (n = v.ajaxSettings && v.ajaxSettings.traditional);
- if (v.isArray(e) || e.jquery && !v.isPlainObject(e))v.each(e, function () {
- s(this.name, this.value)
- }); else for (r in e)fn(r, e[r], n, s);
- return i.join("&").replace(rn, "+")
- };
- var ln, cn, hn = /#.*$/, pn = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, dn = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/, vn = /^(?:GET|HEAD)$/, mn = /^\/\//, gn = /\?/, yn = /
- {/if}
-
-
-
\ No newline at end of file
diff --git a/template/default/config.ini b/template/default/config.ini
deleted file mode 100644
index ae0b741..0000000
--- a/template/default/config.ini
+++ /dev/null
@@ -1,6 +0,0 @@
-name=默认模版
-description="这里填写模版简介"
-author=杰少Pakey
-version=1.0.0
-email=admin@ptcms.com
-url=http://www.ptcms.com
\ No newline at end of file
diff --git a/template/default/config.php b/template/default/config.php
deleted file mode 100644
index 2590d64..0000000
--- a/template/default/config.php
+++ /dev/null
@@ -1,28 +0,0 @@
-
- array (
- 'name' => '焦点图',
- 'value' => '大主宰|完美世界|莽荒纪|绝世唐门',
- ),
- 'bjtjtop' =>
- array (
- 'name' => '编辑推荐头条',
- 'value' => '天醒之路',
- ),
- 'bjtj' =>
- array (
- 'name' => '编辑推荐列表',
- 'value' => '魔天记|我欲封天|绝世武神|择天记|武极天下|灵域|永夜君王|校花的贴身高手|星战风暴',
- ),
- 'viptop' =>
- array (
- 'name' => 'vip推荐头条',
- 'value' => '英雄联盟之谁与争锋|星河大帝',
- ),
- 'vip' =>
- array (
- 'name' => 'vip推荐列表',
- 'value' => '剑道独尊|傲世九重天|最强弃少|天骄无双',
- ),
-);
\ No newline at end of file
diff --git a/template/default/demo.jpg b/template/default/demo.jpg
deleted file mode 100644
index f354ed8..0000000
Binary files a/template/default/demo.jpg and /dev/null differ
diff --git a/template/default/index/index_index.html b/template/default/index/index_index.html
deleted file mode 100644
index f127558..0000000
--- a/template/default/index/index_index.html
+++ /dev/null
@@ -1,9 +0,0 @@
-Hello World By PTcms Framework!
-
-友情链接展示
-{block method="friendlink" name=list num=10}
-{loop=$list}
-{$loop.showname}
-{/loop}
-
-广告展示
\ No newline at end of file